@blueking/bkui-form 0.0.48 → 0.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -182,7 +182,7 @@ function _objectWithoutProperties(e, t) {
182
182
  i = _objectWithoutPropertiesLoose(e, t);
183
183
  if (Object.getOwnPropertySymbols) {
184
184
  var n = Object.getOwnPropertySymbols(e);
185
- for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
185
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
186
186
  }
187
187
  return i;
188
188
  }
@@ -190,311 +190,118 @@ function _objectWithoutPropertiesLoose(r, e) {
190
190
  if (null == r) return {};
191
191
  var t = {};
192
192
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
193
- if (e.indexOf(n) >= 0) continue;
193
+ if (-1 !== e.indexOf(n)) continue;
194
194
  t[n] = r[n];
195
195
  }
196
196
  return t;
197
197
  }
198
- function _regeneratorRuntime() {
199
- _regeneratorRuntime = function () {
200
- return e;
201
- };
202
- var t,
203
- e = {},
204
- r = Object.prototype,
205
- n = r.hasOwnProperty,
206
- o = Object.defineProperty || function (t, e, r) {
207
- t[e] = r.value;
208
- },
209
- i = "function" == typeof Symbol ? Symbol : {},
210
- a = i.iterator || "@@iterator",
211
- c = i.asyncIterator || "@@asyncIterator",
212
- u = i.toStringTag || "@@toStringTag";
213
- function define(t, e, r) {
214
- return Object.defineProperty(t, e, {
215
- value: r,
216
- enumerable: !0,
217
- configurable: !0,
218
- writable: !0
219
- }), t[e];
220
- }
221
- try {
222
- define({}, "");
223
- } catch (t) {
224
- define = function (t, e, r) {
225
- return t[e] = r;
226
- };
227
- }
228
- function wrap(t, e, r, n) {
229
- var i = e && e.prototype instanceof Generator ? e : Generator,
230
- a = Object.create(i.prototype),
231
- c = new Context(n || []);
232
- return o(a, "_invoke", {
233
- value: makeInvokeMethod(t, r, c)
234
- }), a;
235
- }
236
- function tryCatch(t, e, r) {
237
- try {
238
- return {
239
- type: "normal",
240
- arg: t.call(e, r)
241
- };
242
- } catch (t) {
243
- return {
244
- type: "throw",
245
- arg: t
246
- };
247
- }
248
- }
249
- e.wrap = wrap;
250
- var h = "suspendedStart",
251
- l = "suspendedYield",
252
- f = "executing",
253
- s = "completed",
254
- y = {};
255
- function Generator() {}
256
- function GeneratorFunction() {}
257
- function GeneratorFunctionPrototype() {}
258
- var p = {};
259
- define(p, a, function () {
260
- return this;
261
- });
262
- var d = Object.getPrototypeOf,
263
- v = d && d(d(values([])));
264
- v && v !== r && n.call(v, a) && (p = v);
265
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
266
- function defineIteratorMethods(t) {
267
- ["next", "throw", "return"].forEach(function (e) {
268
- define(t, e, function (t) {
269
- return this._invoke(e, t);
270
- });
271
- });
272
- }
273
- function AsyncIterator(t, e) {
274
- function invoke(r, o, i, a) {
275
- var c = tryCatch(t[r], t, o);
276
- if ("throw" !== c.type) {
277
- var u = c.arg,
278
- h = u.value;
279
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
280
- invoke("next", t, i, a);
281
- }, function (t) {
282
- invoke("throw", t, i, a);
283
- }) : e.resolve(h).then(function (t) {
284
- u.value = t, i(u);
285
- }, function (t) {
286
- return invoke("throw", t, i, a);
287
- });
198
+ function _regenerator() {
199
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
200
+ var e,
201
+ t,
202
+ r = "function" == typeof Symbol ? Symbol : {},
203
+ n = r.iterator || "@@iterator",
204
+ o = r.toStringTag || "@@toStringTag";
205
+ function i(r, n, o, i) {
206
+ var c = n && n.prototype instanceof Generator ? n : Generator,
207
+ u = Object.create(c.prototype);
208
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
209
+ var i,
210
+ c,
211
+ u,
212
+ f = 0,
213
+ p = o || [],
214
+ y = !1,
215
+ G = {
216
+ p: 0,
217
+ n: 0,
218
+ v: e,
219
+ a: d,
220
+ f: d.bind(e, 4),
221
+ d: function (t, r) {
222
+ return i = t, c = 0, u = e, G.n = r, a;
223
+ }
224
+ };
225
+ function d(r, n) {
226
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
227
+ var o,
228
+ i = p[t],
229
+ d = G.p,
230
+ l = i[2];
231
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
232
+ }
233
+ if (o || r > 1) return a;
234
+ throw y = !0, n;
288
235
  }
289
- a(c.arg);
290
- }
291
- var r;
292
- o(this, "_invoke", {
293
- value: function (t, n) {
294
- function callInvokeWithMethodAndArg() {
295
- return new e(function (e, r) {
296
- invoke(t, n, e, r);
297
- });
236
+ return function (o, p, l) {
237
+ if (f > 1) throw TypeError("Generator is already running");
238
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
239
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
240
+ try {
241
+ if (f = 2, i) {
242
+ if (c || (o = "next"), t = i[o]) {
243
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
244
+ if (!t.done) return t;
245
+ u = t.value, c < 2 && (c = 0);
246
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
247
+ i = e;
248
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
249
+ } catch (t) {
250
+ i = e, c = 1, u = t;
251
+ } finally {
252
+ f = 1;
253
+ }
298
254
  }
299
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
300
- }
301
- });
302
- }
303
- function makeInvokeMethod(e, r, n) {
304
- var o = h;
305
- return function (i, a) {
306
- if (o === f) throw Error("Generator is already running");
307
- if (o === s) {
308
- if ("throw" === i) throw a;
309
255
  return {
310
256
  value: t,
311
- done: !0
257
+ done: y
312
258
  };
313
- }
314
- for (n.method = i, n.arg = a;;) {
315
- var c = n.delegate;
316
- if (c) {
317
- var u = maybeInvokeDelegate(c, n);
318
- if (u) {
319
- if (u === y) continue;
320
- return u;
321
- }
322
- }
323
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
324
- if (o === h) throw o = s, n.arg;
325
- n.dispatchException(n.arg);
326
- } else "return" === n.method && n.abrupt("return", n.arg);
327
- o = f;
328
- var p = tryCatch(e, r, n);
329
- if ("normal" === p.type) {
330
- if (o = n.done ? s : l, p.arg === y) continue;
331
- return {
332
- value: p.arg,
333
- done: n.done
334
- };
335
- }
336
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
337
- }
338
- };
259
+ };
260
+ }(r, o, i), !0), u;
339
261
  }
340
- function maybeInvokeDelegate(e, r) {
341
- var n = r.method,
342
- o = e.iterator[n];
343
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
344
- var i = tryCatch(o, e.iterator, r.arg);
345
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
346
- var a = i.arg;
347
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
348
- }
349
- function pushTryEntry(t) {
350
- var e = {
351
- tryLoc: t[0]
352
- };
353
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
354
- }
355
- function resetTryEntry(t) {
356
- var e = t.completion || {};
357
- e.type = "normal", delete e.arg, t.completion = e;
358
- }
359
- function Context(t) {
360
- this.tryEntries = [{
361
- tryLoc: "root"
362
- }], t.forEach(pushTryEntry, this), this.reset(!0);
363
- }
364
- function values(e) {
365
- if (e || "" === e) {
366
- var r = e[a];
367
- if (r) return r.call(e);
368
- if ("function" == typeof e.next) return e;
369
- if (!isNaN(e.length)) {
370
- var o = -1,
371
- i = function next() {
372
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
373
- return next.value = t, next.done = !0, next;
374
- };
375
- return i.next = i;
376
- }
377
- }
378
- throw new TypeError(typeof e + " is not iterable");
379
- }
380
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
381
- value: GeneratorFunctionPrototype,
382
- configurable: !0
383
- }), o(GeneratorFunctionPrototype, "constructor", {
384
- value: GeneratorFunction,
385
- configurable: !0
386
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
387
- var e = "function" == typeof t && t.constructor;
388
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
389
- }, e.mark = function (t) {
390
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
391
- }, e.awrap = function (t) {
392
- return {
393
- __await: t
394
- };
395
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
396
- return this;
397
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
398
- void 0 === i && (i = Promise);
399
- var a = new AsyncIterator(wrap(t, r, n, o), i);
400
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
401
- return t.done ? t.value : a.next();
402
- });
403
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
262
+ var a = {};
263
+ function Generator() {}
264
+ function GeneratorFunction() {}
265
+ function GeneratorFunctionPrototype() {}
266
+ t = Object.getPrototypeOf;
267
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
268
+ return this;
269
+ }), t),
270
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
271
+ function f(e) {
272
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
273
+ }
274
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
404
275
  return this;
405
- }), define(g, "toString", function () {
276
+ }), _regeneratorDefine(u, "toString", function () {
406
277
  return "[object Generator]";
407
- }), e.keys = function (t) {
408
- var e = Object(t),
409
- r = [];
410
- for (var n in e) r.push(n);
411
- return r.reverse(), function next() {
412
- for (; r.length;) {
413
- var t = r.pop();
414
- if (t in e) return next.value = t, next.done = !1, next;
415
- }
416
- return next.done = !0, next;
278
+ }), (_regenerator = function () {
279
+ return {
280
+ w: i,
281
+ m: f
417
282
  };
418
- }, e.values = values, Context.prototype = {
419
- constructor: Context,
420
- reset: function (e) {
421
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
422
- },
423
- stop: function () {
424
- this.done = !0;
425
- var t = this.tryEntries[0].completion;
426
- if ("throw" === t.type) throw t.arg;
427
- return this.rval;
428
- },
429
- dispatchException: function (e) {
430
- if (this.done) throw e;
431
- var r = this;
432
- function handle(n, o) {
433
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
434
- }
435
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
436
- var i = this.tryEntries[o],
437
- a = i.completion;
438
- if ("root" === i.tryLoc) return handle("end");
439
- if (i.tryLoc <= this.prev) {
440
- var c = n.call(i, "catchLoc"),
441
- u = n.call(i, "finallyLoc");
442
- if (c && u) {
443
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
444
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
445
- } else if (c) {
446
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
447
- } else {
448
- if (!u) throw Error("try statement without catch or finally");
449
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
450
- }
451
- }
452
- }
453
- },
454
- abrupt: function (t, e) {
455
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
456
- var o = this.tryEntries[r];
457
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
458
- var i = o;
459
- break;
460
- }
461
- }
462
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
463
- var a = i ? i.completion : {};
464
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
465
- },
466
- complete: function (t, e) {
467
- if ("throw" === t.type) throw t.arg;
468
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
469
- },
470
- finish: function (t) {
471
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
472
- var r = this.tryEntries[e];
473
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
474
- }
475
- },
476
- catch: function (t) {
477
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
478
- var r = this.tryEntries[e];
479
- if (r.tryLoc === t) {
480
- var n = r.completion;
481
- if ("throw" === n.type) {
482
- var o = n.arg;
483
- resetTryEntry(r);
484
- }
485
- return o;
486
- }
487
- }
488
- throw Error("illegal catch attempt");
489
- },
490
- delegateYield: function (e, r, n) {
491
- return this.delegate = {
492
- iterator: values(e),
493
- resultName: r,
494
- nextLoc: n
495
- }, "next" === this.method && (this.arg = t), y;
283
+ })();
284
+ }
285
+ function _regeneratorDefine(e, r, n, t) {
286
+ var i = Object.defineProperty;
287
+ try {
288
+ i({}, "", {});
289
+ } catch (e) {
290
+ i = 0;
291
+ }
292
+ _regeneratorDefine = function (e, r, n, t) {
293
+ function o(r, n) {
294
+ _regeneratorDefine(e, r, function (e) {
295
+ return this._invoke(r, n, e);
296
+ });
496
297
  }
497
- }, e;
298
+ r ? i ? i(e, r, {
299
+ value: n,
300
+ enumerable: !t,
301
+ configurable: !t,
302
+ writable: !t
303
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
304
+ }, _regeneratorDefine(e, r, n, t);
498
305
  }
499
306
  function _slicedToArray(r, e) {
500
307
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
@@ -584,11 +391,11 @@ var valueType = function valueType(value) {
584
391
  }
585
392
  return _typeof(value);
586
393
  };
587
- var merge = function merge(target, source) {
394
+ var _merge = function merge(target, source) {
588
395
  if (isObj(source)) {
589
396
  return Object.keys(source).reduce(function (pre, key) {
590
397
  var _target;
591
- pre[key] = merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
398
+ pre[key] = _merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
592
399
  return pre;
593
400
  }, JSON.parse(JSON.stringify(target)));
594
401
  }
@@ -596,7 +403,7 @@ var merge = function merge(target, source) {
596
403
  target = Array.isArray(target) ? target : [];
597
404
  return source.map(function (item, index) {
598
405
  if (target[index]) {
599
- return merge(target[index], item);
406
+ return _merge(target[index], item);
600
407
  }
601
408
  return item;
602
409
  });
@@ -1367,8 +1174,8 @@ var defaultConfig = {
1367
1174
  headers: {},
1368
1175
  cache: 'no-cache'
1369
1176
  };
1370
- var request = ( /*#__PURE__*/(function () {
1371
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
1177
+ var request = (/*#__PURE__*/function () {
1178
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(url) {
1372
1179
  var config,
1373
1180
  _mergeDeep,
1374
1181
  params,
@@ -1389,9 +1196,11 @@ var request = ( /*#__PURE__*/(function () {
1389
1196
  labelKey,
1390
1197
  valueKey,
1391
1198
  data,
1392
- _args = arguments;
1393
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1394
- while (1) switch (_context.prev = _context.next) {
1199
+ _args = arguments,
1200
+ _t,
1201
+ _t2;
1202
+ return _regenerator().w(function (_context) {
1203
+ while (1) switch (_context.p = _context.n) {
1395
1204
  case 0:
1396
1205
  config = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
1397
1206
  _mergeDeep = mergeDeep(defaultConfig, config), params = _mergeDeep.params, _mergeDeep$responseTy = _mergeDeep.responseType, responseType = _mergeDeep$responseTy === void 0 ? 'json' : _mergeDeep$responseTy, _mergeDeep$method = _mergeDeep.method, method = _mergeDeep$method === void 0 ? 'GET' : _mergeDeep$method, _mergeDeep$headers = _mergeDeep.headers, headers = _mergeDeep$headers === void 0 ? {} : _mergeDeep$headers, responseParse = _mergeDeep.responseParse, reset = _objectWithoutProperties(_mergeDeep, _excluded$5);
@@ -1407,35 +1216,35 @@ var request = ( /*#__PURE__*/(function () {
1407
1216
  body = params;
1408
1217
  }
1409
1218
  }
1410
- _context.prev = 4;
1411
- _context.next = 7;
1219
+ _context.p = 1;
1220
+ _context.n = 2;
1412
1221
  return fetch(requestURL, _objectSpread2(_objectSpread2({}, reset), {}, {
1413
1222
  method: method.toLocaleUpperCase(),
1414
1223
  headers: headers,
1415
1224
  body: body
1416
1225
  }));
1417
- case 7:
1418
- response = _context.sent;
1226
+ case 2:
1227
+ response = _context.v;
1419
1228
  if (!response.ok) {
1420
- _context.next = 21;
1229
+ _context.n = 7;
1421
1230
  break;
1422
1231
  }
1423
- _context.next = 11;
1232
+ _context.n = 3;
1424
1233
  return response[responseType]();
1425
- case 11:
1426
- res = _context.sent;
1234
+ case 3:
1235
+ res = _context.v;
1427
1236
  if (!responseParse) {
1428
- _context.next = 20;
1237
+ _context.n = 6;
1429
1238
  break;
1430
1239
  }
1431
1240
  if (!(typeof responseParse === 'function')) {
1432
- _context.next = 15;
1241
+ _context.n = 4;
1433
1242
  break;
1434
1243
  }
1435
- return _context.abrupt("return", Promise.resolve(responseParse(res)));
1436
- case 15:
1244
+ return _context.a(2, Promise.resolve(responseParse(res)));
1245
+ case 4:
1437
1246
  if (!isObj(responseParse)) {
1438
- _context.next = 19;
1247
+ _context.n = 5;
1439
1248
  break;
1440
1249
  }
1441
1250
  _responseParse$dataKe = responseParse.dataKey, dataKey = _responseParse$dataKe === void 0 ? 'data' : _responseParse$dataKe, labelKey = responseParse.labelKey, valueKey = responseParse.valueKey;
@@ -1445,39 +1254,38 @@ var request = ( /*#__PURE__*/(function () {
1445
1254
  value: item === null || item === void 0 ? void 0 : item[valueKey]
1446
1255
  });
1447
1256
  });
1448
- return _context.abrupt("return", Promise.resolve(data));
1449
- case 19:
1450
- return _context.abrupt("return", Promise.resolve(res));
1451
- case 20:
1452
- return _context.abrupt("return", Promise.resolve(res));
1453
- case 21:
1454
- _context.t0 = response.status;
1455
- _context.next = _context.t0 === 400 ? 24 : _context.t0 === 401 ? 25 : _context.t0 === 403 ? 26 : _context.t0 === 500 ? 26 : 27;
1257
+ return _context.a(2, Promise.resolve(data));
1258
+ case 5:
1259
+ return _context.a(2, Promise.resolve(res));
1260
+ case 6:
1261
+ return _context.a(2, Promise.resolve(res));
1262
+ case 7:
1263
+ _t = response.status;
1264
+ _context.n = _t === 400 ? 8 : _t === 401 ? 9 : _t === 403 ? 10 : _t === 500 ? 10 : 11;
1456
1265
  break;
1457
- case 24:
1458
- return _context.abrupt("break", 27);
1459
- case 25:
1460
- return _context.abrupt("break", 27);
1461
- case 26:
1462
- return _context.abrupt("break", 27);
1463
- case 27:
1464
- _context.next = 33;
1266
+ case 8:
1267
+ return _context.a(3, 11);
1268
+ case 9:
1269
+ return _context.a(3, 11);
1270
+ case 10:
1271
+ return _context.a(3, 11);
1272
+ case 11:
1273
+ _context.n = 13;
1465
1274
  break;
1466
- case 29:
1467
- _context.prev = 29;
1468
- _context.t1 = _context["catch"](4);
1469
- console.error('Request Failed', _context.t1);
1470
- Promise.reject(_context.t1);
1471
- case 33:
1472
- case "end":
1473
- return _context.stop();
1275
+ case 12:
1276
+ _context.p = 12;
1277
+ _t2 = _context.v;
1278
+ console.error('Request Failed', _t2);
1279
+ Promise.reject(_t2);
1280
+ case 13:
1281
+ return _context.a(2);
1474
1282
  }
1475
- }, _callee, null, [[4, 29]]);
1283
+ }, _callee, null, [[1, 12]]);
1476
1284
  }));
1477
1285
  return function (_x) {
1478
1286
  return _ref.apply(this, arguments);
1479
1287
  };
1480
- })());
1288
+ }());
1481
1289
 
1482
1290
  var props$1 = {
1483
1291
  // 表单值
@@ -1714,7 +1522,7 @@ var getContext = function getContext(instance) {
1714
1522
  }
1715
1523
  };
1716
1524
  };
1717
- var executeExpression = function executeExpression(expression, instance) {
1525
+ var _executeExpression = function executeExpression(expression, instance) {
1718
1526
  var $dep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1719
1527
  var $args = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1720
1528
  var _getContext = getContext(instance),
@@ -1772,7 +1580,7 @@ var executeExpression = function executeExpression(expression, instance) {
1772
1580
  }
1773
1581
  if (isObj(expression)) {
1774
1582
  Object.keys(expression).forEach(function (key) {
1775
- expression[key] = executeExpression(expression[key], instance);
1583
+ expression[key] = _executeExpression(expression[key], instance);
1776
1584
  });
1777
1585
  return expression;
1778
1586
  }
@@ -1818,7 +1626,6 @@ var resolveReaction = function resolveReaction(crtInsPath, targetPath, reaction,
1818
1626
  crtInstance = _ref.instance; // 当前组件实例,用来条件表达式判断
1819
1627
  var _ref2 = widgetTree.widgetMap[targetPath] || {},
1820
1628
  operateInstance = _ref2.instance; // 需要执行操作的组件实例,可能为其他组件也可能为当前组件
1821
- if (!crtInstance || !operateInstance) return;
1822
1629
  var fullfill = true;
1823
1630
  var deps = [];
1824
1631
  if (reaction.source) {
@@ -1828,33 +1635,39 @@ var resolveReaction = function resolveReaction(crtInsPath, targetPath, reaction,
1828
1635
  deps.push(instance);
1829
1636
  });
1830
1637
  }
1831
- if (typeof reaction.if === 'string') {
1832
- fullfill = executeExpression(reaction.if, crtInstance, deps);
1638
+ if (typeof reaction.if === 'string' && crtInstance) {
1639
+ fullfill = _executeExpression(reaction.if, crtInstance, deps);
1833
1640
  }
1834
1641
  var operations = fullfill ? reaction.then : reaction.else;
1835
- executeOperations(operations, operateInstance, deps);
1642
+ operateInstance && executeOperations(operations, operateInstance, deps);
1836
1643
  };
1837
1644
  };
1645
+ /**
1646
+ * 执行操作
1647
+ * @param operations
1648
+ * @param instance
1649
+ * @param deps
1650
+ */
1838
1651
  var executeOperations = function executeOperations(operations, instance, deps) {
1839
1652
  if (operations) {
1840
1653
  if (operations.state) {
1841
1654
  Object.keys(operations.state).forEach(function (key) {
1842
1655
  var val = operations.state[key];
1843
1656
  if (typeof val === 'string' && /^{{.+}}$/.test(val.trim())) {
1844
- val = executeExpression(val, instance, deps);
1657
+ val = _executeExpression(val, instance, deps);
1845
1658
  }
1846
1659
  instance.setState(key, val);
1847
1660
  });
1848
1661
  }
1849
1662
  if (Array.isArray(operations.actions)) {
1850
1663
  operations.actions.forEach(function (item) {
1851
- executeExpression(item, instance, deps);
1664
+ _executeExpression(item, instance, deps);
1852
1665
  });
1853
1666
  }
1854
1667
  }
1855
1668
  };
1856
1669
  var parsePath = function parsePath(path, instance) {
1857
- return isExpression(path) ? executeExpression(path, instance) : path;
1670
+ return isExpression(path) ? _executeExpression(path, instance) : path;
1858
1671
  };
1859
1672
  var reactionRegister = function reactionRegister(path) {
1860
1673
  var reactions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -1907,8 +1720,6 @@ var reactionDispatch = function reactionDispatch(path, typeName) {
1907
1720
  }
1908
1721
  };
1909
1722
 
1910
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1911
-
1912
1723
  function getDefaultExportFromCjs (x) {
1913
1724
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1914
1725
  }
@@ -1930,6 +1741,7 @@ var code$1 = {};
1930
1741
  (function (exports) {
1931
1742
  Object.defineProperty(exports, "__esModule", { value: true });
1932
1743
  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;
1744
+ // eslint-disable-next-line @typescript-eslint/no-extraneous-class
1933
1745
  class _CodeOrName {
1934
1746
  }
1935
1747
  exports._CodeOrName = _CodeOrName;
@@ -3938,7 +3750,7 @@ function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, composi
3938
3750
  }
3939
3751
  subschema.extendSubschemaMode = extendSubschemaMode;
3940
3752
 
3941
- var resolve$1 = {};
3753
+ var resolve$2 = {};
3942
3754
 
3943
3755
  // do not edit .js files directly - edit src/index.jst
3944
3756
 
@@ -4079,10 +3891,10 @@ function escapeJsonPtr(str) {
4079
3891
  return str.replace(/~/g, '~0').replace(/\//g, '~1');
4080
3892
  }
4081
3893
 
4082
- Object.defineProperty(resolve$1, "__esModule", { value: true });
4083
- resolve$1.getSchemaRefs = resolve$1.resolveUrl = resolve$1.normalizeId = resolve$1._getFullPath = resolve$1.getFullPath = resolve$1.inlineRef = void 0;
3894
+ Object.defineProperty(resolve$2, "__esModule", { value: true });
3895
+ resolve$2.getSchemaRefs = resolve$2.resolveUrl = resolve$2.normalizeId = resolve$2._getFullPath = resolve$2.getFullPath = resolve$2.inlineRef = void 0;
4084
3896
  const util_1$m = util;
4085
- const equal$2 = fastDeepEqual;
3897
+ const equal$3 = fastDeepEqual;
4086
3898
  const traverse = jsonSchemaTraverse.exports;
4087
3899
  // TODO refactor to use keyword definitions
4088
3900
  const SIMPLE_INLINED = new Set([
@@ -4112,7 +3924,7 @@ function inlineRef(schema, limit = true) {
4112
3924
  return false;
4113
3925
  return countKeys(schema) <= limit;
4114
3926
  }
4115
- resolve$1.inlineRef = inlineRef;
3927
+ resolve$2.inlineRef = inlineRef;
4116
3928
  const REF_KEYWORDS = new Set([
4117
3929
  "$ref",
4118
3930
  "$recursiveRef",
@@ -4154,22 +3966,22 @@ function getFullPath(resolver, id = "", normalize) {
4154
3966
  const p = resolver.parse(id);
4155
3967
  return _getFullPath(resolver, p);
4156
3968
  }
4157
- resolve$1.getFullPath = getFullPath;
3969
+ resolve$2.getFullPath = getFullPath;
4158
3970
  function _getFullPath(resolver, p) {
4159
3971
  const serialized = resolver.serialize(p);
4160
3972
  return serialized.split("#")[0] + "#";
4161
3973
  }
4162
- resolve$1._getFullPath = _getFullPath;
3974
+ resolve$2._getFullPath = _getFullPath;
4163
3975
  const TRAILING_SLASH_HASH = /#\/?$/;
4164
3976
  function normalizeId(id) {
4165
3977
  return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
4166
3978
  }
4167
- resolve$1.normalizeId = normalizeId;
3979
+ resolve$2.normalizeId = normalizeId;
4168
3980
  function resolveUrl(resolver, baseId, id) {
4169
3981
  id = normalizeId(id);
4170
3982
  return resolver.resolve(baseId, id);
4171
3983
  }
4172
- resolve$1.resolveUrl = resolveUrl;
3984
+ resolve$2.resolveUrl = resolveUrl;
4173
3985
  const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
4174
3986
  function getSchemaRefs(schema, baseId) {
4175
3987
  if (typeof schema == "boolean")
@@ -4224,14 +4036,14 @@ function getSchemaRefs(schema, baseId) {
4224
4036
  });
4225
4037
  return localRefs;
4226
4038
  function checkAmbiguosRef(sch1, sch2, ref) {
4227
- if (sch2 !== undefined && !equal$2(sch1, sch2))
4039
+ if (sch2 !== undefined && !equal$3(sch1, sch2))
4228
4040
  throw ambiguos(ref);
4229
4041
  }
4230
4042
  function ambiguos(ref) {
4231
4043
  return new Error(`reference "${ref}" resolves to more than one schema`);
4232
4044
  }
4233
4045
  }
4234
- resolve$1.getSchemaRefs = getSchemaRefs;
4046
+ resolve$2.getSchemaRefs = getSchemaRefs;
4235
4047
 
4236
4048
  Object.defineProperty(validate$1, "__esModule", { value: true });
4237
4049
  validate$1.getData = validate$1.KeywordCxt = validate$1.validateFunctionCode = void 0;
@@ -4244,7 +4056,7 @@ const keyword_1 = keyword;
4244
4056
  const subschema_1 = subschema;
4245
4057
  const codegen_1$n = codegen;
4246
4058
  const names_1$3 = names$1;
4247
- const resolve_1$2 = resolve$1;
4059
+ const resolve_1$2 = resolve$2;
4248
4060
  const util_1$l = util;
4249
4061
  const errors_1 = errors;
4250
4062
  // schema compilation - generates validation function, subschemaCode (below) is used for subschemas
@@ -4766,7 +4578,7 @@ validation_error.default = ValidationError;
4766
4578
  var ref_error = {};
4767
4579
 
4768
4580
  Object.defineProperty(ref_error, "__esModule", { value: true });
4769
- const resolve_1$1 = resolve$1;
4581
+ const resolve_1$1 = resolve$2;
4770
4582
  class MissingRefError extends Error {
4771
4583
  constructor(resolver, baseId, ref, msg) {
4772
4584
  super(msg || `can't resolve reference ${ref} from id ${baseId}`);
@@ -4783,7 +4595,7 @@ compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compil
4783
4595
  const codegen_1$m = codegen;
4784
4596
  const validation_error_1 = validation_error;
4785
4597
  const names_1$2 = names$1;
4786
- const resolve_1 = resolve$1;
4598
+ const resolve_1 = resolve$2;
4787
4599
  const util_1$k = util;
4788
4600
  const validate_1$1 = validate$1;
4789
4601
  class SchemaEnv {
@@ -4909,7 +4721,7 @@ function resolveRef(root, baseId, ref) {
4909
4721
  const schOrFunc = root.refs[ref];
4910
4722
  if (schOrFunc)
4911
4723
  return schOrFunc;
4912
- let _sch = resolve.call(this, root, ref);
4724
+ let _sch = resolve$1.call(this, root, ref);
4913
4725
  if (_sch === undefined) {
4914
4726
  const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv
4915
4727
  const { schemaId } = this.opts;
@@ -4939,7 +4751,7 @@ function sameSchemaEnv(s1, s2) {
4939
4751
  }
4940
4752
  // resolve and compile the references ($ref)
4941
4753
  // TODO returns AnySchemaObject (if the schema can be inlined) or validation function
4942
- function resolve(root, // information about the root schema for the current schema
4754
+ function resolve$1(root, // information about the root schema for the current schema
4943
4755
  ref // reference to resolve
4944
4756
  ) {
4945
4757
  let sch;
@@ -5050,1416 +4862,770 @@ var require$$9 = {
5050
4862
 
5051
4863
  var uri$1 = {};
5052
4864
 
5053
- var uri_all = {exports: {}};
5054
-
5055
- /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
5056
-
5057
- (function (module, exports) {
5058
- (function (global, factory) {
5059
- factory(exports) ;
5060
- }(commonjsGlobal, (function (exports) {
5061
- function merge() {
5062
- for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
5063
- sets[_key] = arguments[_key];
5064
- }
5065
-
5066
- if (sets.length > 1) {
5067
- sets[0] = sets[0].slice(0, -1);
5068
- var xl = sets.length - 1;
5069
- for (var x = 1; x < xl; ++x) {
5070
- sets[x] = sets[x].slice(1, -1);
5071
- }
5072
- sets[xl] = sets[xl].slice(1);
5073
- return sets.join('');
5074
- } else {
5075
- return sets[0];
5076
- }
5077
- }
5078
- function subexp(str) {
5079
- return "(?:" + str + ")";
5080
- }
5081
- function typeOf(o) {
5082
- return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
5083
- }
5084
- function toUpperCase(str) {
5085
- return str.toUpperCase();
5086
- }
5087
- function toArray(obj) {
5088
- return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : [];
5089
- }
5090
- function assign(target, source) {
5091
- var obj = target;
5092
- if (source) {
5093
- for (var key in source) {
5094
- obj[key] = source[key];
5095
- }
5096
- }
5097
- return obj;
5098
- }
5099
-
5100
- function buildExps(isIRI) {
5101
- var ALPHA$$ = "[A-Za-z]",
5102
- DIGIT$$ = "[0-9]",
5103
- HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
5104
- PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
5105
- //expanded
5106
- GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
5107
- SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
5108
- RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
5109
- UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
5110
- //subset, excludes bidi control characters
5111
- IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
5112
- //subset
5113
- UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
5114
- subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
5115
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
5116
- var DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$),
5117
- //relaxed parsing rules
5118
- IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
5119
- H16$ = subexp(HEXDIG$$ + "{1,4}"),
5120
- LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
5121
- IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
5122
- // 6( h16 ":" ) ls32
5123
- IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
5124
- // "::" 5( h16 ":" ) ls32
5125
- IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
5126
- //[ h16 ] "::" 4( h16 ":" ) ls32
5127
- IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
5128
- //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
5129
- IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
5130
- //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
5131
- IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
5132
- //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
5133
- IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
5134
- //[ *4( h16 ":" ) h16 ] "::" ls32
5135
- IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
5136
- //[ *5( h16 ":" ) h16 ] "::" h16
5137
- IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
5138
- //[ *6( h16 ":" ) h16 ] "::"
5139
- IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
5140
- ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
5141
- //RFC 6874, with relaxed parsing rules
5142
- subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
5143
- //RFC 6874
5144
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
5145
- var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
5146
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
5147
- subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
5148
- return {
5149
- NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
5150
- NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5151
- NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5152
- NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5153
- NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5154
- NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
5155
- NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
5156
- ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5157
- UNRESERVED: new RegExp(UNRESERVED$$, "g"),
5158
- OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
5159
- PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
5160
- IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
5161
- IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
5162
- };
4865
+ var fastUri$1 = {exports: {}};
4866
+
4867
+ const HEX$1 = {
4868
+ 0: 0,
4869
+ 1: 1,
4870
+ 2: 2,
4871
+ 3: 3,
4872
+ 4: 4,
4873
+ 5: 5,
4874
+ 6: 6,
4875
+ 7: 7,
4876
+ 8: 8,
4877
+ 9: 9,
4878
+ a: 10,
4879
+ A: 10,
4880
+ b: 11,
4881
+ B: 11,
4882
+ c: 12,
4883
+ C: 12,
4884
+ d: 13,
4885
+ D: 13,
4886
+ e: 14,
4887
+ E: 14,
4888
+ f: 15,
4889
+ F: 15
4890
+ };
4891
+
4892
+ var scopedChars = {
4893
+ HEX: HEX$1
4894
+ };
4895
+
4896
+ const { HEX } = scopedChars;
4897
+
4898
+ 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;
4899
+
4900
+ function normalizeIPv4$1 (host) {
4901
+ if (findToken(host, '.') < 3) { return { host, isIPV4: false } }
4902
+ const matches = host.match(IPV4_REG) || [];
4903
+ const [address] = matches;
4904
+ if (address) {
4905
+ return { host: stripLeadingZeros(address, '.'), isIPV4: true }
4906
+ } else {
4907
+ return { host, isIPV4: false }
4908
+ }
5163
4909
  }
5164
- var URI_PROTOCOL = buildExps(false);
5165
-
5166
- var IRI_PROTOCOL = buildExps(true);
5167
-
5168
- var slicedToArray = function () {
5169
- function sliceIterator(arr, i) {
5170
- var _arr = [];
5171
- var _n = true;
5172
- var _d = false;
5173
- var _e = undefined;
5174
4910
 
5175
- try {
5176
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
5177
- _arr.push(_s.value);
4911
+ /**
4912
+ * @param {string[]} input
4913
+ * @param {boolean} [keepZero=false]
4914
+ * @returns {string|undefined}
4915
+ */
4916
+ function stringArrayToHexStripped (input, keepZero = false) {
4917
+ let acc = '';
4918
+ let strip = true;
4919
+ for (const c of input) {
4920
+ if (HEX[c] === undefined) return undefined
4921
+ if (c !== '0' && strip === true) strip = false;
4922
+ if (!strip) acc += c;
4923
+ }
4924
+ if (keepZero && acc.length === 0) acc = '0';
4925
+ return acc
4926
+ }
4927
+
4928
+ function getIPV6 (input) {
4929
+ let tokenCount = 0;
4930
+ const output = { error: false, address: '', zone: '' };
4931
+ const address = [];
4932
+ const buffer = [];
4933
+ let isZone = false;
4934
+ let endipv6Encountered = false;
4935
+ let endIpv6 = false;
4936
+
4937
+ function consume () {
4938
+ if (buffer.length) {
4939
+ if (isZone === false) {
4940
+ const hex = stringArrayToHexStripped(buffer);
4941
+ if (hex !== undefined) {
4942
+ address.push(hex);
4943
+ } else {
4944
+ output.error = true;
4945
+ return false
4946
+ }
4947
+ }
4948
+ buffer.length = 0;
4949
+ }
4950
+ return true
4951
+ }
5178
4952
 
5179
- if (i && _arr.length === i) break;
4953
+ for (let i = 0; i < input.length; i++) {
4954
+ const cursor = input[i];
4955
+ if (cursor === '[' || cursor === ']') { continue }
4956
+ if (cursor === ':') {
4957
+ if (endipv6Encountered === true) {
4958
+ endIpv6 = true;
5180
4959
  }
5181
- } catch (err) {
5182
- _d = true;
5183
- _e = err;
5184
- } finally {
5185
- try {
5186
- if (!_n && _i["return"]) _i["return"]();
5187
- } finally {
5188
- if (_d) throw _e;
4960
+ if (!consume()) { break }
4961
+ tokenCount++;
4962
+ address.push(':');
4963
+ if (tokenCount > 7) {
4964
+ // not valid
4965
+ output.error = true;
4966
+ break
5189
4967
  }
4968
+ if (i - 1 >= 0 && input[i - 1] === ':') {
4969
+ endipv6Encountered = true;
4970
+ }
4971
+ continue
4972
+ } else if (cursor === '%') {
4973
+ if (!consume()) { break }
4974
+ // switch to zone detection
4975
+ isZone = true;
4976
+ } else {
4977
+ buffer.push(cursor);
4978
+ continue
5190
4979
  }
5191
-
5192
- return _arr;
5193
4980
  }
5194
-
5195
- return function (arr, i) {
5196
- if (Array.isArray(arr)) {
5197
- return arr;
5198
- } else if (Symbol.iterator in Object(arr)) {
5199
- return sliceIterator(arr, i);
4981
+ if (buffer.length) {
4982
+ if (isZone) {
4983
+ output.zone = buffer.join('');
4984
+ } else if (endIpv6) {
4985
+ address.push(buffer.join(''));
5200
4986
  } else {
5201
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
4987
+ address.push(stringArrayToHexStripped(buffer));
5202
4988
  }
5203
- };
5204
- }();
5205
-
5206
-
5207
-
5208
-
5209
-
5210
-
5211
-
5212
-
5213
-
5214
-
5215
-
5216
-
4989
+ }
4990
+ output.address = address.join('');
4991
+ return output
4992
+ }
5217
4993
 
5218
- var toConsumableArray = function (arr) {
5219
- if (Array.isArray(arr)) {
5220
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
4994
+ function normalizeIPv6$1 (host) {
4995
+ if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
4996
+ const ipv6 = getIPV6(host);
5221
4997
 
5222
- return arr2;
4998
+ if (!ipv6.error) {
4999
+ let newHost = ipv6.address;
5000
+ let escapedHost = ipv6.address;
5001
+ if (ipv6.zone) {
5002
+ newHost += '%' + ipv6.zone;
5003
+ escapedHost += '%25' + ipv6.zone;
5004
+ }
5005
+ return { host: newHost, escapedHost, isIPV6: true }
5223
5006
  } else {
5224
- return Array.from(arr);
5007
+ return { host, isIPV6: false }
5225
5008
  }
5226
- };
5227
-
5228
- /** Highest positive signed 32-bit float value */
5229
-
5230
- var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
5231
-
5232
- /** Bootstring parameters */
5233
- var base = 36;
5234
- var tMin = 1;
5235
- var tMax = 26;
5236
- var skew = 38;
5237
- var damp = 700;
5238
- var initialBias = 72;
5239
- var initialN = 128; // 0x80
5240
- var delimiter = '-'; // '\x2D'
5241
-
5242
- /** Regular expressions */
5243
- var regexPunycode = /^xn--/;
5244
- var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
5245
- var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
5246
-
5247
- /** Error messages */
5248
- var errors = {
5249
- 'overflow': 'Overflow: input needs wider integers to process',
5250
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
5251
- 'invalid-input': 'Invalid input'
5252
- };
5253
-
5254
- /** Convenience shortcuts */
5255
- var baseMinusTMin = base - tMin;
5256
- var floor = Math.floor;
5257
- var stringFromCharCode = String.fromCharCode;
5258
-
5259
- /*--------------------------------------------------------------------------*/
5260
-
5261
- /**
5262
- * A generic error utility function.
5263
- * @private
5264
- * @param {String} type The error type.
5265
- * @returns {Error} Throws a `RangeError` with the applicable error message.
5266
- */
5267
- function error$1(type) {
5268
- throw new RangeError(errors[type]);
5269
5009
  }
5270
5010
 
5271
- /**
5272
- * A generic `Array#map` utility function.
5273
- * @private
5274
- * @param {Array} array The array to iterate over.
5275
- * @param {Function} callback The function that gets called for every array
5276
- * item.
5277
- * @returns {Array} A new array of values returned by the callback function.
5278
- */
5279
- function map(array, fn) {
5280
- var result = [];
5281
- var length = array.length;
5282
- while (length--) {
5283
- result[length] = fn(array[length]);
5284
- }
5285
- return result;
5011
+ function stripLeadingZeros (str, token) {
5012
+ let out = '';
5013
+ let skip = true;
5014
+ const l = str.length;
5015
+ for (let i = 0; i < l; i++) {
5016
+ const c = str[i];
5017
+ if (c === '0' && skip) {
5018
+ if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {
5019
+ out += c;
5020
+ skip = false;
5021
+ }
5022
+ } else {
5023
+ if (c === token) {
5024
+ skip = true;
5025
+ } else {
5026
+ skip = false;
5027
+ }
5028
+ out += c;
5029
+ }
5030
+ }
5031
+ return out
5286
5032
  }
5287
5033
 
5288
- /**
5289
- * A simple `Array#map`-like wrapper to work with domain name strings or email
5290
- * addresses.
5291
- * @private
5292
- * @param {String} domain The domain name or email address.
5293
- * @param {Function} callback The function that gets called for every
5294
- * character.
5295
- * @returns {Array} A new string of characters returned by the callback
5296
- * function.
5297
- */
5298
- function mapDomain(string, fn) {
5299
- var parts = string.split('@');
5300
- var result = '';
5301
- if (parts.length > 1) {
5302
- // In email addresses, only the domain name should be punycoded. Leave
5303
- // the local part (i.e. everything up to `@`) intact.
5304
- result = parts[0] + '@';
5305
- string = parts[1];
5306
- }
5307
- // Avoid `split(regex)` for IE8 compatibility. See #17.
5308
- string = string.replace(regexSeparators, '\x2E');
5309
- var labels = string.split('.');
5310
- var encoded = map(labels, fn).join('.');
5311
- return result + encoded;
5034
+ function findToken (str, token) {
5035
+ let ind = 0;
5036
+ for (let i = 0; i < str.length; i++) {
5037
+ if (str[i] === token) ind++;
5038
+ }
5039
+ return ind
5040
+ }
5041
+
5042
+ const RDS1 = /^\.\.?\//u;
5043
+ const RDS2 = /^\/\.(?:\/|$)/u;
5044
+ const RDS3 = /^\/\.\.(?:\/|$)/u;
5045
+ const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u;
5046
+
5047
+ function removeDotSegments$1 (input) {
5048
+ const output = [];
5049
+
5050
+ while (input.length) {
5051
+ if (input.match(RDS1)) {
5052
+ input = input.replace(RDS1, '');
5053
+ } else if (input.match(RDS2)) {
5054
+ input = input.replace(RDS2, '/');
5055
+ } else if (input.match(RDS3)) {
5056
+ input = input.replace(RDS3, '/');
5057
+ output.pop();
5058
+ } else if (input === '.' || input === '..') {
5059
+ input = '';
5060
+ } else {
5061
+ const im = input.match(RDS5);
5062
+ if (im) {
5063
+ const s = im[0];
5064
+ input = input.slice(s.length);
5065
+ output.push(s);
5066
+ } else {
5067
+ throw new Error('Unexpected dot segment condition')
5068
+ }
5069
+ }
5070
+ }
5071
+ return output.join('')
5312
5072
  }
5313
5073
 
5314
- /**
5315
- * Creates an array containing the numeric code points of each Unicode
5316
- * character in the string. While JavaScript uses UCS-2 internally,
5317
- * this function will convert a pair of surrogate halves (each of which
5318
- * UCS-2 exposes as separate characters) into a single code point,
5319
- * matching UTF-16.
5320
- * @see `punycode.ucs2.encode`
5321
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
5322
- * @memberOf punycode.ucs2
5323
- * @name decode
5324
- * @param {String} string The Unicode input string (UCS-2).
5325
- * @returns {Array} The new array of code points.
5326
- */
5327
- function ucs2decode(string) {
5328
- var output = [];
5329
- var counter = 0;
5330
- var length = string.length;
5331
- while (counter < length) {
5332
- var value = string.charCodeAt(counter++);
5333
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
5334
- // It's a high surrogate, and there is a next character.
5335
- var extra = string.charCodeAt(counter++);
5336
- if ((extra & 0xFC00) == 0xDC00) {
5337
- // Low surrogate.
5338
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
5339
- } else {
5340
- // It's an unmatched surrogate; only append this code unit, in case the
5341
- // next code unit is the high surrogate of a surrogate pair.
5342
- output.push(value);
5343
- counter--;
5344
- }
5345
- } else {
5346
- output.push(value);
5347
- }
5348
- }
5349
- return output;
5074
+ function normalizeComponentEncoding$1 (components, esc) {
5075
+ const func = esc !== true ? escape : unescape;
5076
+ if (components.scheme !== undefined) {
5077
+ components.scheme = func(components.scheme);
5078
+ }
5079
+ if (components.userinfo !== undefined) {
5080
+ components.userinfo = func(components.userinfo);
5081
+ }
5082
+ if (components.host !== undefined) {
5083
+ components.host = func(components.host);
5084
+ }
5085
+ if (components.path !== undefined) {
5086
+ components.path = func(components.path);
5087
+ }
5088
+ if (components.query !== undefined) {
5089
+ components.query = func(components.query);
5090
+ }
5091
+ if (components.fragment !== undefined) {
5092
+ components.fragment = func(components.fragment);
5093
+ }
5094
+ return components
5350
5095
  }
5351
5096
 
5352
- /**
5353
- * Creates a string based on an array of numeric code points.
5354
- * @see `punycode.ucs2.decode`
5355
- * @memberOf punycode.ucs2
5356
- * @name encode
5357
- * @param {Array} codePoints The array of numeric code points.
5358
- * @returns {String} The new Unicode string (UCS-2).
5359
- */
5360
- var ucs2encode = function ucs2encode(array) {
5361
- return String.fromCodePoint.apply(String, toConsumableArray(array));
5362
- };
5363
-
5364
- /**
5365
- * Converts a basic code point into a digit/integer.
5366
- * @see `digitToBasic()`
5367
- * @private
5368
- * @param {Number} codePoint The basic numeric code point value.
5369
- * @returns {Number} The numeric value of a basic code point (for use in
5370
- * representing integers) in the range `0` to `base - 1`, or `base` if
5371
- * the code point does not represent a value.
5372
- */
5373
- var basicToDigit = function basicToDigit(codePoint) {
5374
- if (codePoint - 0x30 < 0x0A) {
5375
- return codePoint - 0x16;
5376
- }
5377
- if (codePoint - 0x41 < 0x1A) {
5378
- return codePoint - 0x41;
5379
- }
5380
- if (codePoint - 0x61 < 0x1A) {
5381
- return codePoint - 0x61;
5382
- }
5383
- return base;
5384
- };
5097
+ function recomposeAuthority$1 (components) {
5098
+ const uriTokens = [];
5385
5099
 
5386
- /**
5387
- * Converts a digit/integer into a basic code point.
5388
- * @see `basicToDigit()`
5389
- * @private
5390
- * @param {Number} digit The numeric value of a basic code point.
5391
- * @returns {Number} The basic code point whose value (when used for
5392
- * representing integers) is `digit`, which needs to be in the range
5393
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
5394
- * used; else, the lowercase form is used. The behavior is undefined
5395
- * if `flag` is non-zero and `digit` has no uppercase form.
5396
- */
5397
- var digitToBasic = function digitToBasic(digit, flag) {
5398
- // 0..25 map to ASCII a..z or A..Z
5399
- // 26..35 map to ASCII 0..9
5400
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
5401
- };
5402
-
5403
- /**
5404
- * Bias adaptation function as per section 3.4 of RFC 3492.
5405
- * https://tools.ietf.org/html/rfc3492#section-3.4
5406
- * @private
5407
- */
5408
- var adapt = function adapt(delta, numPoints, firstTime) {
5409
- var k = 0;
5410
- delta = firstTime ? floor(delta / damp) : delta >> 1;
5411
- delta += floor(delta / numPoints);
5412
- for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
5413
- delta = floor(delta / baseMinusTMin);
5414
- }
5415
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
5416
- };
5417
-
5418
- /**
5419
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
5420
- * symbols.
5421
- * @memberOf punycode
5422
- * @param {String} input The Punycode string of ASCII-only symbols.
5423
- * @returns {String} The resulting string of Unicode symbols.
5424
- */
5425
- var decode = function decode(input) {
5426
- // Don't use UCS-2.
5427
- var output = [];
5428
- var inputLength = input.length;
5429
- var i = 0;
5430
- var n = initialN;
5431
- var bias = initialBias;
5432
-
5433
- // Handle the basic code points: let `basic` be the number of input code
5434
- // points before the last delimiter, or `0` if there is none, then copy
5435
- // the first basic code points to the output.
5436
-
5437
- var basic = input.lastIndexOf(delimiter);
5438
- if (basic < 0) {
5439
- basic = 0;
5440
- }
5441
-
5442
- for (var j = 0; j < basic; ++j) {
5443
- // if it's not a basic code point
5444
- if (input.charCodeAt(j) >= 0x80) {
5445
- error$1('not-basic');
5446
- }
5447
- output.push(input.charCodeAt(j));
5448
- }
5100
+ if (components.userinfo !== undefined) {
5101
+ uriTokens.push(components.userinfo);
5102
+ uriTokens.push('@');
5103
+ }
5449
5104
 
5450
- // Main decoding loop: start just after the last delimiter if any basic code
5451
- // points were copied; start at the beginning otherwise.
5105
+ if (components.host !== undefined) {
5106
+ let host = unescape(components.host);
5107
+ const ipV4res = normalizeIPv4$1(host);
5452
5108
 
5453
- for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
5109
+ if (ipV4res.isIPV4) {
5110
+ host = ipV4res.host;
5111
+ } else {
5112
+ const ipV6res = normalizeIPv6$1(ipV4res.host);
5113
+ if (ipV6res.isIPV6 === true) {
5114
+ host = `[${ipV6res.escapedHost}]`;
5115
+ } else {
5116
+ host = components.host;
5117
+ }
5118
+ }
5119
+ uriTokens.push(host);
5120
+ }
5454
5121
 
5455
- // `index` is the index of the next character to be consumed.
5456
- // Decode a generalized variable-length integer into `delta`,
5457
- // which gets added to `i`. The overflow checking is easier
5458
- // if we increase `i` as we go, then subtract off its starting
5459
- // value at the end to obtain `delta`.
5460
- var oldi = i;
5461
- for (var w = 1, k = base;; /* no condition */k += base) {
5122
+ if (typeof components.port === 'number' || typeof components.port === 'string') {
5123
+ uriTokens.push(':');
5124
+ uriTokens.push(String(components.port));
5125
+ }
5462
5126
 
5463
- if (index >= inputLength) {
5464
- error$1('invalid-input');
5465
- }
5127
+ return uriTokens.length ? uriTokens.join('') : undefined
5128
+ }
5129
+ var utils = {
5130
+ recomposeAuthority: recomposeAuthority$1,
5131
+ normalizeComponentEncoding: normalizeComponentEncoding$1,
5132
+ removeDotSegments: removeDotSegments$1,
5133
+ normalizeIPv4: normalizeIPv4$1,
5134
+ normalizeIPv6: normalizeIPv6$1,
5135
+ stringArrayToHexStripped
5136
+ };
5466
5137
 
5467
- var digit = basicToDigit(input.charCodeAt(index++));
5138
+ const UUID_REG = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu;
5139
+ const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
5468
5140
 
5469
- if (digit >= base || digit > floor((maxInt - i) / w)) {
5470
- error$1('overflow');
5471
- }
5141
+ function isSecure (wsComponents) {
5142
+ return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss'
5143
+ }
5472
5144
 
5473
- i += digit * w;
5474
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
5145
+ function httpParse (components) {
5146
+ if (!components.host) {
5147
+ components.error = components.error || 'HTTP URIs must have a host.';
5148
+ }
5475
5149
 
5476
- if (digit < t) {
5477
- break;
5478
- }
5150
+ return components
5151
+ }
5479
5152
 
5480
- var baseMinusT = base - t;
5481
- if (w > floor(maxInt / baseMinusT)) {
5482
- error$1('overflow');
5483
- }
5153
+ function httpSerialize (components) {
5154
+ const secure = String(components.scheme).toLowerCase() === 'https';
5484
5155
 
5485
- w *= baseMinusT;
5486
- }
5156
+ // normalize the default port
5157
+ if (components.port === (secure ? 443 : 80) || components.port === '') {
5158
+ components.port = undefined;
5159
+ }
5487
5160
 
5488
- var out = output.length + 1;
5489
- bias = adapt(i - oldi, out, oldi == 0);
5161
+ // normalize the empty path
5162
+ if (!components.path) {
5163
+ components.path = '/';
5164
+ }
5490
5165
 
5491
- // `i` was supposed to wrap around from `out` to `0`,
5492
- // incrementing `n` each time, so we'll fix that now:
5493
- if (floor(i / out) > maxInt - n) {
5494
- error$1('overflow');
5495
- }
5166
+ // NOTE: We do not parse query strings for HTTP URIs
5167
+ // as WWW Form Url Encoded query strings are part of the HTML4+ spec,
5168
+ // and not the HTTP spec.
5496
5169
 
5497
- n += floor(i / out);
5498
- i %= out;
5170
+ return components
5171
+ }
5499
5172
 
5500
- // Insert `n` at position `i` of the output.
5501
- output.splice(i++, 0, n);
5502
- }
5173
+ function wsParse (wsComponents) {
5174
+ // indicate if the secure flag is set
5175
+ wsComponents.secure = isSecure(wsComponents);
5503
5176
 
5504
- return String.fromCodePoint.apply(String, output);
5505
- };
5177
+ // construct resouce name
5178
+ wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
5179
+ wsComponents.path = undefined;
5180
+ wsComponents.query = undefined;
5506
5181
 
5507
- /**
5508
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
5509
- * Punycode string of ASCII-only symbols.
5510
- * @memberOf punycode
5511
- * @param {String} input The string of Unicode symbols.
5512
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
5513
- */
5514
- var encode = function encode(input) {
5515
- var output = [];
5516
-
5517
- // Convert the input in UCS-2 to an array of Unicode code points.
5518
- input = ucs2decode(input);
5182
+ return wsComponents
5183
+ }
5519
5184
 
5520
- // Cache the length.
5521
- var inputLength = input.length;
5185
+ function wsSerialize (wsComponents) {
5186
+ // normalize the default port
5187
+ if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') {
5188
+ wsComponents.port = undefined;
5189
+ }
5522
5190
 
5523
- // Initialize the state.
5524
- var n = initialN;
5525
- var delta = 0;
5526
- var bias = initialBias;
5191
+ // ensure scheme matches secure flag
5192
+ if (typeof wsComponents.secure === 'boolean') {
5193
+ wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws');
5194
+ wsComponents.secure = undefined;
5195
+ }
5527
5196
 
5528
- // Handle the basic code points.
5529
- var _iteratorNormalCompletion = true;
5530
- var _didIteratorError = false;
5531
- var _iteratorError = undefined;
5197
+ // reconstruct path from resource name
5198
+ if (wsComponents.resourceName) {
5199
+ const [path, query] = wsComponents.resourceName.split('?');
5200
+ wsComponents.path = (path && path !== '/' ? path : undefined);
5201
+ wsComponents.query = query;
5202
+ wsComponents.resourceName = undefined;
5203
+ }
5532
5204
 
5533
- try {
5534
- for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
5535
- var _currentValue2 = _step.value;
5205
+ // forbid fragment component
5206
+ wsComponents.fragment = undefined;
5536
5207
 
5537
- if (_currentValue2 < 0x80) {
5538
- output.push(stringFromCharCode(_currentValue2));
5539
- }
5540
- }
5541
- } catch (err) {
5542
- _didIteratorError = true;
5543
- _iteratorError = err;
5544
- } finally {
5545
- try {
5546
- if (!_iteratorNormalCompletion && _iterator.return) {
5547
- _iterator.return();
5548
- }
5549
- } finally {
5550
- if (_didIteratorError) {
5551
- throw _iteratorError;
5552
- }
5553
- }
5554
- }
5208
+ return wsComponents
5209
+ }
5555
5210
 
5556
- var basicLength = output.length;
5557
- var handledCPCount = basicLength;
5211
+ function urnParse (urnComponents, options) {
5212
+ if (!urnComponents.path) {
5213
+ urnComponents.error = 'URN can not be parsed';
5214
+ return urnComponents
5215
+ }
5216
+ const matches = urnComponents.path.match(URN_REG);
5217
+ if (matches) {
5218
+ const scheme = options.scheme || urnComponents.scheme || 'urn';
5219
+ urnComponents.nid = matches[1].toLowerCase();
5220
+ urnComponents.nss = matches[2];
5221
+ const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`;
5222
+ const schemeHandler = SCHEMES$1[urnScheme];
5223
+ urnComponents.path = undefined;
5224
+
5225
+ if (schemeHandler) {
5226
+ urnComponents = schemeHandler.parse(urnComponents, options);
5227
+ }
5228
+ } else {
5229
+ urnComponents.error = urnComponents.error || 'URN can not be parsed.';
5230
+ }
5558
5231
 
5559
- // `handledCPCount` is the number of code points that have been handled;
5560
- // `basicLength` is the number of basic code points.
5232
+ return urnComponents
5233
+ }
5561
5234
 
5562
- // Finish the basic string with a delimiter unless it's empty.
5563
- if (basicLength) {
5564
- output.push(delimiter);
5565
- }
5235
+ function urnSerialize (urnComponents, options) {
5236
+ const scheme = options.scheme || urnComponents.scheme || 'urn';
5237
+ const nid = urnComponents.nid.toLowerCase();
5238
+ const urnScheme = `${scheme}:${options.nid || nid}`;
5239
+ const schemeHandler = SCHEMES$1[urnScheme];
5566
5240
 
5567
- // Main encoding loop:
5568
- while (handledCPCount < inputLength) {
5241
+ if (schemeHandler) {
5242
+ urnComponents = schemeHandler.serialize(urnComponents, options);
5243
+ }
5569
5244
 
5570
- // All non-basic code points < n have been handled already. Find the next
5571
- // larger one:
5572
- var m = maxInt;
5573
- var _iteratorNormalCompletion2 = true;
5574
- var _didIteratorError2 = false;
5575
- var _iteratorError2 = undefined;
5245
+ const uriComponents = urnComponents;
5246
+ const nss = urnComponents.nss;
5247
+ uriComponents.path = `${nid || options.nid}:${nss}`;
5576
5248
 
5577
- try {
5578
- for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
5579
- var currentValue = _step2.value;
5249
+ options.skipEscape = true;
5250
+ return uriComponents
5251
+ }
5580
5252
 
5581
- if (currentValue >= n && currentValue < m) {
5582
- m = currentValue;
5583
- }
5584
- }
5253
+ function urnuuidParse (urnComponents, options) {
5254
+ const uuidComponents = urnComponents;
5255
+ uuidComponents.uuid = uuidComponents.nss;
5256
+ uuidComponents.nss = undefined;
5585
5257
 
5586
- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
5587
- // but guard against overflow.
5588
- } catch (err) {
5589
- _didIteratorError2 = true;
5590
- _iteratorError2 = err;
5591
- } finally {
5592
- try {
5593
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
5594
- _iterator2.return();
5595
- }
5596
- } finally {
5597
- if (_didIteratorError2) {
5598
- throw _iteratorError2;
5599
- }
5600
- }
5601
- }
5258
+ if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {
5259
+ uuidComponents.error = uuidComponents.error || 'UUID is not valid.';
5260
+ }
5602
5261
 
5603
- var handledCPCountPlusOne = handledCPCount + 1;
5604
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
5605
- error$1('overflow');
5606
- }
5262
+ return uuidComponents
5263
+ }
5607
5264
 
5608
- delta += (m - n) * handledCPCountPlusOne;
5609
- n = m;
5265
+ function urnuuidSerialize (uuidComponents) {
5266
+ const urnComponents = uuidComponents;
5267
+ // normalize UUID
5268
+ urnComponents.nss = (uuidComponents.uuid || '').toLowerCase();
5269
+ return urnComponents
5270
+ }
5610
5271
 
5611
- var _iteratorNormalCompletion3 = true;
5612
- var _didIteratorError3 = false;
5613
- var _iteratorError3 = undefined;
5272
+ const http = {
5273
+ scheme: 'http',
5274
+ domainHost: true,
5275
+ parse: httpParse,
5276
+ serialize: httpSerialize
5277
+ };
5614
5278
 
5615
- try {
5616
- for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
5617
- var _currentValue = _step3.value;
5279
+ const https = {
5280
+ scheme: 'https',
5281
+ domainHost: http.domainHost,
5282
+ parse: httpParse,
5283
+ serialize: httpSerialize
5284
+ };
5618
5285
 
5619
- if (_currentValue < n && ++delta > maxInt) {
5620
- error$1('overflow');
5621
- }
5622
- if (_currentValue == n) {
5623
- // Represent delta as a generalized variable-length integer.
5624
- var q = delta;
5625
- for (var k = base;; /* no condition */k += base) {
5626
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
5627
- if (q < t) {
5628
- break;
5629
- }
5630
- var qMinusT = q - t;
5631
- var baseMinusT = base - t;
5632
- output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
5633
- q = floor(qMinusT / baseMinusT);
5634
- }
5635
-
5636
- output.push(stringFromCharCode(digitToBasic(q, 0)));
5637
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
5638
- delta = 0;
5639
- ++handledCPCount;
5640
- }
5641
- }
5642
- } catch (err) {
5643
- _didIteratorError3 = true;
5644
- _iteratorError3 = err;
5645
- } finally {
5646
- try {
5647
- if (!_iteratorNormalCompletion3 && _iterator3.return) {
5648
- _iterator3.return();
5649
- }
5650
- } finally {
5651
- if (_didIteratorError3) {
5652
- throw _iteratorError3;
5653
- }
5654
- }
5655
- }
5286
+ const ws = {
5287
+ scheme: 'ws',
5288
+ domainHost: true,
5289
+ parse: wsParse,
5290
+ serialize: wsSerialize
5291
+ };
5656
5292
 
5657
- ++delta;
5658
- ++n;
5659
- }
5660
- return output.join('');
5293
+ const wss = {
5294
+ scheme: 'wss',
5295
+ domainHost: ws.domainHost,
5296
+ parse: ws.parse,
5297
+ serialize: ws.serialize
5661
5298
  };
5662
5299
 
5663
- /**
5664
- * Converts a Punycode string representing a domain name or an email address
5665
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
5666
- * it doesn't matter if you call it on a string that has already been
5667
- * converted to Unicode.
5668
- * @memberOf punycode
5669
- * @param {String} input The Punycoded domain name or email address to
5670
- * convert to Unicode.
5671
- * @returns {String} The Unicode representation of the given Punycode
5672
- * string.
5673
- */
5674
- var toUnicode = function toUnicode(input) {
5675
- return mapDomain(input, function (string) {
5676
- return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
5677
- });
5300
+ const urn = {
5301
+ scheme: 'urn',
5302
+ parse: urnParse,
5303
+ serialize: urnSerialize,
5304
+ skipNormalize: true
5678
5305
  };
5679
5306
 
5680
- /**
5681
- * Converts a Unicode string representing a domain name or an email address to
5682
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
5683
- * i.e. it doesn't matter if you call it with a domain that's already in
5684
- * ASCII.
5685
- * @memberOf punycode
5686
- * @param {String} input The domain name or email address to convert, as a
5687
- * Unicode string.
5688
- * @returns {String} The Punycode representation of the given domain name or
5689
- * email address.
5690
- */
5691
- var toASCII = function toASCII(input) {
5692
- return mapDomain(input, function (string) {
5693
- return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
5694
- });
5307
+ const urnuuid = {
5308
+ scheme: 'urn:uuid',
5309
+ parse: urnuuidParse,
5310
+ serialize: urnuuidSerialize,
5311
+ skipNormalize: true
5695
5312
  };
5696
5313
 
5697
- /*--------------------------------------------------------------------------*/
5698
-
5699
- /** Define the public API */
5700
- var punycode = {
5701
- /**
5702
- * A string representing the current Punycode.js version number.
5703
- * @memberOf punycode
5704
- * @type String
5705
- */
5706
- 'version': '2.1.0',
5707
- /**
5708
- * An object of methods to convert from JavaScript's internal character
5709
- * representation (UCS-2) to Unicode code points, and back.
5710
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
5711
- * @memberOf punycode
5712
- * @type Object
5713
- */
5714
- 'ucs2': {
5715
- 'decode': ucs2decode,
5716
- 'encode': ucs2encode
5717
- },
5718
- 'decode': decode,
5719
- 'encode': encode,
5720
- 'toASCII': toASCII,
5721
- 'toUnicode': toUnicode
5314
+ const SCHEMES$1 = {
5315
+ http,
5316
+ https,
5317
+ ws,
5318
+ wss,
5319
+ urn,
5320
+ 'urn:uuid': urnuuid
5722
5321
  };
5723
5322
 
5724
- /**
5725
- * URI.js
5726
- *
5727
- * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
5728
- * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
5729
- * @see http://github.com/garycourt/uri-js
5730
- */
5731
- /**
5732
- * Copyright 2011 Gary Court. All rights reserved.
5733
- *
5734
- * Redistribution and use in source and binary forms, with or without modification, are
5735
- * permitted provided that the following conditions are met:
5736
- *
5737
- * 1. Redistributions of source code must retain the above copyright notice, this list of
5738
- * conditions and the following disclaimer.
5739
- *
5740
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
5741
- * of conditions and the following disclaimer in the documentation and/or other materials
5742
- * provided with the distribution.
5743
- *
5744
- * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
5745
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
5746
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
5747
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
5748
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5749
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
5750
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5751
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
5752
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5753
- *
5754
- * The views and conclusions contained in the software and documentation are those of the
5755
- * authors and should not be interpreted as representing official policies, either expressed
5756
- * or implied, of Gary Court.
5757
- */
5758
- var SCHEMES = {};
5759
- function pctEncChar(chr) {
5760
- var c = chr.charCodeAt(0);
5761
- var e = void 0;
5762
- if (c < 16) e = "%0" + c.toString(16).toUpperCase();else if (c < 128) e = "%" + c.toString(16).toUpperCase();else if (c < 2048) e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();else e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();
5763
- return e;
5764
- }
5765
- function pctDecChars(str) {
5766
- var newStr = "";
5767
- var i = 0;
5768
- var il = str.length;
5769
- while (i < il) {
5770
- var c = parseInt(str.substr(i + 1, 2), 16);
5771
- if (c < 128) {
5772
- newStr += String.fromCharCode(c);
5773
- i += 3;
5774
- } else if (c >= 194 && c < 224) {
5775
- if (il - i >= 6) {
5776
- var c2 = parseInt(str.substr(i + 4, 2), 16);
5777
- newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
5778
- } else {
5779
- newStr += str.substr(i, 6);
5780
- }
5781
- i += 6;
5782
- } else if (c >= 224) {
5783
- if (il - i >= 9) {
5784
- var _c = parseInt(str.substr(i + 4, 2), 16);
5785
- var c3 = parseInt(str.substr(i + 7, 2), 16);
5786
- newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
5787
- } else {
5788
- newStr += str.substr(i, 9);
5789
- }
5790
- i += 9;
5791
- } else {
5792
- newStr += str.substr(i, 3);
5793
- i += 3;
5794
- }
5795
- }
5796
- return newStr;
5797
- }
5798
- function _normalizeComponentEncoding(components, protocol) {
5799
- function decodeUnreserved(str) {
5800
- var decStr = pctDecChars(str);
5801
- return !decStr.match(protocol.UNRESERVED) ? str : decStr;
5802
- }
5803
- if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
5804
- if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5805
- if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5806
- if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5807
- if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5808
- if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5809
- return components;
5810
- }
5323
+ var schemes = SCHEMES$1;
5324
+
5325
+ const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = utils;
5326
+ const SCHEMES = schemes;
5811
5327
 
5812
- function _stripLeadingZeros(str) {
5813
- return str.replace(/^0*(.*)/, "$1") || "0";
5328
+ function normalize (uri, options) {
5329
+ if (typeof uri === 'string') {
5330
+ uri = serialize(parse(uri, options), options);
5331
+ } else if (typeof uri === 'object') {
5332
+ uri = parse(serialize(uri, options), options);
5333
+ }
5334
+ return uri
5814
5335
  }
5815
- function _normalizeIPv4(host, protocol) {
5816
- var matches = host.match(protocol.IPV4ADDRESS) || [];
5817
5336
 
5818
- var _matches = slicedToArray(matches, 2),
5819
- address = _matches[1];
5337
+ function resolve (baseURI, relativeURI, options) {
5338
+ const schemelessOptions = Object.assign({ scheme: 'null' }, options);
5339
+ const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
5340
+ return serialize(resolved, { ...schemelessOptions, skipEscape: true })
5341
+ }
5820
5342
 
5821
- if (address) {
5822
- return address.split(".").map(_stripLeadingZeros).join(".");
5823
- } else {
5824
- return host;
5825
- }
5826
- }
5827
- function _normalizeIPv6(host, protocol) {
5828
- var matches = host.match(protocol.IPV6ADDRESS) || [];
5829
-
5830
- var _matches2 = slicedToArray(matches, 3),
5831
- address = _matches2[1],
5832
- zone = _matches2[2];
5833
-
5834
- if (address) {
5835
- var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
5836
- _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
5837
- last = _address$toLowerCase$2[0],
5838
- first = _address$toLowerCase$2[1];
5839
-
5840
- var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
5841
- var lastFields = last.split(":").map(_stripLeadingZeros);
5842
- var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
5843
- var fieldCount = isLastFieldIPv4Address ? 7 : 8;
5844
- var lastFieldsStart = lastFields.length - fieldCount;
5845
- var fields = Array(fieldCount);
5846
- for (var x = 0; x < fieldCount; ++x) {
5847
- fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
5848
- }
5849
- if (isLastFieldIPv4Address) {
5850
- fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
5851
- }
5852
- var allZeroFields = fields.reduce(function (acc, field, index) {
5853
- if (!field || field === "0") {
5854
- var lastLongest = acc[acc.length - 1];
5855
- if (lastLongest && lastLongest.index + lastLongest.length === index) {
5856
- lastLongest.length++;
5857
- } else {
5858
- acc.push({ index: index, length: 1 });
5859
- }
5860
- }
5861
- return acc;
5862
- }, []);
5863
- var longestZeroFields = allZeroFields.sort(function (a, b) {
5864
- return b.length - a.length;
5865
- })[0];
5866
- var newHost = void 0;
5867
- if (longestZeroFields && longestZeroFields.length > 1) {
5868
- var newFirst = fields.slice(0, longestZeroFields.index);
5869
- var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
5870
- newHost = newFirst.join(":") + "::" + newLast.join(":");
5871
- } else {
5872
- newHost = fields.join(":");
5873
- }
5874
- if (zone) {
5875
- newHost += "%" + zone;
5876
- }
5877
- return newHost;
5343
+ function resolveComponents (base, relative, options, skipNormalization) {
5344
+ const target = {};
5345
+ if (!skipNormalization) {
5346
+ base = parse(serialize(base, options), options); // normalize base components
5347
+ relative = parse(serialize(relative, options), options); // normalize relative components
5348
+ }
5349
+ options = options || {};
5350
+
5351
+ if (!options.tolerant && relative.scheme) {
5352
+ target.scheme = relative.scheme;
5353
+ // target.authority = relative.authority;
5354
+ target.userinfo = relative.userinfo;
5355
+ target.host = relative.host;
5356
+ target.port = relative.port;
5357
+ target.path = removeDotSegments(relative.path || '');
5358
+ target.query = relative.query;
5359
+ } else {
5360
+ if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
5361
+ // target.authority = relative.authority;
5362
+ target.userinfo = relative.userinfo;
5363
+ target.host = relative.host;
5364
+ target.port = relative.port;
5365
+ target.path = removeDotSegments(relative.path || '');
5366
+ target.query = relative.query;
5878
5367
  } else {
5879
- return host;
5880
- }
5881
- }
5882
- var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
5883
- var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
5884
- function parse(uriString) {
5885
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5886
-
5887
- var components = {};
5888
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
5889
- if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
5890
- var matches = uriString.match(URI_PARSE);
5891
- if (matches) {
5892
- if (NO_MATCH_IS_UNDEFINED) {
5893
- //store each component
5894
- components.scheme = matches[1];
5895
- components.userinfo = matches[3];
5896
- components.host = matches[4];
5897
- components.port = parseInt(matches[5], 10);
5898
- components.path = matches[6] || "";
5899
- components.query = matches[7];
5900
- components.fragment = matches[8];
5901
- //fix port number
5902
- if (isNaN(components.port)) {
5903
- components.port = matches[5];
5904
- }
5368
+ if (!relative.path) {
5369
+ target.path = base.path;
5370
+ if (relative.query !== undefined) {
5371
+ target.query = relative.query;
5905
5372
  } else {
5906
- //IE FIX for improper RegExp matching
5907
- //store each component
5908
- components.scheme = matches[1] || undefined;
5909
- components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
5910
- components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
5911
- components.port = parseInt(matches[5], 10);
5912
- components.path = matches[6] || "";
5913
- components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
5914
- components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
5915
- //fix port number
5916
- if (isNaN(components.port)) {
5917
- components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
5918
- }
5373
+ target.query = base.query;
5919
5374
  }
5920
- if (components.host) {
5921
- //normalize IP hosts
5922
- components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
5923
- }
5924
- //determine reference type
5925
- if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
5926
- components.reference = "same-document";
5927
- } else if (components.scheme === undefined) {
5928
- components.reference = "relative";
5929
- } else if (components.fragment === undefined) {
5930
- components.reference = "absolute";
5931
- } else {
5932
- components.reference = "uri";
5933
- }
5934
- //check for reference errors
5935
- if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
5936
- components.error = components.error || "URI is not a " + options.reference + " reference.";
5937
- }
5938
- //find scheme handler
5939
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
5940
- //check if scheme can't handle IRIs
5941
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5942
- //if host component is a domain name
5943
- if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
5944
- //convert Unicode IDN -> ASCII IDN
5945
- try {
5946
- components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
5947
- } catch (e) {
5948
- components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
5949
- }
5950
- }
5951
- //convert IRI -> URI
5952
- _normalizeComponentEncoding(components, URI_PROTOCOL);
5375
+ } else {
5376
+ if (relative.path.charAt(0) === '/') {
5377
+ target.path = removeDotSegments(relative.path);
5953
5378
  } else {
5954
- //normalize encodings
5955
- _normalizeComponentEncoding(components, protocol);
5956
- }
5957
- //perform scheme specific parsing
5958
- if (schemeHandler && schemeHandler.parse) {
5959
- schemeHandler.parse(components, options);
5379
+ if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
5380
+ target.path = '/' + relative.path;
5381
+ } else if (!base.path) {
5382
+ target.path = relative.path;
5383
+ } else {
5384
+ target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path;
5385
+ }
5386
+ target.path = removeDotSegments(target.path);
5960
5387
  }
5961
- } else {
5962
- components.error = components.error || "URI can not be parsed.";
5388
+ target.query = relative.query;
5389
+ }
5390
+ // target.authority = base.authority;
5391
+ target.userinfo = base.userinfo;
5392
+ target.host = base.host;
5393
+ target.port = base.port;
5963
5394
  }
5964
- return components;
5965
- }
5395
+ target.scheme = base.scheme;
5396
+ }
5966
5397
 
5967
- function _recomposeAuthority(components, options) {
5968
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
5969
- var uriTokens = [];
5970
- if (components.userinfo !== undefined) {
5971
- uriTokens.push(components.userinfo);
5972
- uriTokens.push("@");
5973
- }
5974
- if (components.host !== undefined) {
5975
- //normalize IP hosts, add brackets and escape zone separator for IPv6
5976
- uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
5977
- return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
5978
- }));
5979
- }
5980
- if (typeof components.port === "number" || typeof components.port === "string") {
5981
- uriTokens.push(":");
5982
- uriTokens.push(String(components.port));
5983
- }
5984
- return uriTokens.length ? uriTokens.join("") : undefined;
5985
- }
5986
-
5987
- var RDS1 = /^\.\.?\//;
5988
- var RDS2 = /^\/\.(\/|$)/;
5989
- var RDS3 = /^\/\.\.(\/|$)/;
5990
- var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
5991
- function removeDotSegments(input) {
5992
- var output = [];
5993
- while (input.length) {
5994
- if (input.match(RDS1)) {
5995
- input = input.replace(RDS1, "");
5996
- } else if (input.match(RDS2)) {
5997
- input = input.replace(RDS2, "/");
5998
- } else if (input.match(RDS3)) {
5999
- input = input.replace(RDS3, "/");
6000
- output.pop();
6001
- } else if (input === "." || input === "..") {
6002
- input = "";
6003
- } else {
6004
- var im = input.match(RDS5);
6005
- if (im) {
6006
- var s = im[0];
6007
- input = input.slice(s.length);
6008
- output.push(s);
6009
- } else {
6010
- throw new Error("Unexpected dot segment condition");
6011
- }
6012
- }
6013
- }
6014
- return output.join("");
5398
+ target.fragment = relative.fragment;
5399
+
5400
+ return target
6015
5401
  }
6016
5402
 
6017
- function serialize(components) {
6018
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5403
+ function equal$2 (uriA, uriB, options) {
5404
+ if (typeof uriA === 'string') {
5405
+ uriA = unescape(uriA);
5406
+ uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
5407
+ } else if (typeof uriA === 'object') {
5408
+ uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
5409
+ }
6019
5410
 
6020
- var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
6021
- var uriTokens = [];
6022
- //find scheme handler
6023
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
6024
- //perform scheme specific serialization
6025
- if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
6026
- if (components.host) {
6027
- //if host component is an IPv6 address
6028
- if (protocol.IPV6ADDRESS.test(components.host)) ;
6029
- //TODO: normalize IPv6 address as per RFC 5952
5411
+ if (typeof uriB === 'string') {
5412
+ uriB = unescape(uriB);
5413
+ uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
5414
+ } else if (typeof uriB === 'object') {
5415
+ uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
5416
+ }
6030
5417
 
6031
- //if host component is a domain name
6032
- else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
6033
- //convert IDN via punycode
6034
- try {
6035
- components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
6036
- } catch (e) {
6037
- components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
6038
- }
6039
- }
6040
- }
6041
- //normalize encoding
6042
- _normalizeComponentEncoding(components, protocol);
6043
- if (options.reference !== "suffix" && components.scheme) {
6044
- uriTokens.push(components.scheme);
6045
- uriTokens.push(":");
6046
- }
6047
- var authority = _recomposeAuthority(components, options);
6048
- if (authority !== undefined) {
6049
- if (options.reference !== "suffix") {
6050
- uriTokens.push("//");
6051
- }
6052
- uriTokens.push(authority);
6053
- if (components.path && components.path.charAt(0) !== "/") {
6054
- uriTokens.push("/");
6055
- }
6056
- }
6057
- if (components.path !== undefined) {
6058
- var s = components.path;
6059
- if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
6060
- s = removeDotSegments(s);
6061
- }
6062
- if (authority === undefined) {
6063
- s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
6064
- }
6065
- uriTokens.push(s);
6066
- }
6067
- if (components.query !== undefined) {
6068
- uriTokens.push("?");
6069
- uriTokens.push(components.query);
6070
- }
6071
- if (components.fragment !== undefined) {
6072
- uriTokens.push("#");
6073
- uriTokens.push(components.fragment);
6074
- }
6075
- return uriTokens.join(""); //merge tokens into a string
6076
- }
5418
+ return uriA.toLowerCase() === uriB.toLowerCase()
5419
+ }
5420
+
5421
+ function serialize (cmpts, opts) {
5422
+ const components = {
5423
+ host: cmpts.host,
5424
+ scheme: cmpts.scheme,
5425
+ userinfo: cmpts.userinfo,
5426
+ port: cmpts.port,
5427
+ path: cmpts.path,
5428
+ query: cmpts.query,
5429
+ nid: cmpts.nid,
5430
+ nss: cmpts.nss,
5431
+ uuid: cmpts.uuid,
5432
+ fragment: cmpts.fragment,
5433
+ reference: cmpts.reference,
5434
+ resourceName: cmpts.resourceName,
5435
+ secure: cmpts.secure,
5436
+ error: ''
5437
+ };
5438
+ const options = Object.assign({}, opts);
5439
+ const uriTokens = [];
6077
5440
 
6078
- function resolveComponents(base, relative) {
6079
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6080
- var skipNormalization = arguments[3];
5441
+ // find scheme handler
5442
+ const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()];
6081
5443
 
6082
- var target = {};
6083
- if (!skipNormalization) {
6084
- base = parse(serialize(base, options), options); //normalize base components
6085
- relative = parse(serialize(relative, options), options); //normalize relative components
6086
- }
6087
- options = options || {};
6088
- if (!options.tolerant && relative.scheme) {
6089
- target.scheme = relative.scheme;
6090
- //target.authority = relative.authority;
6091
- target.userinfo = relative.userinfo;
6092
- target.host = relative.host;
6093
- target.port = relative.port;
6094
- target.path = removeDotSegments(relative.path || "");
6095
- target.query = relative.query;
5444
+ // perform scheme specific serialization
5445
+ if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
5446
+
5447
+ if (components.path !== undefined) {
5448
+ if (!options.skipEscape) {
5449
+ components.path = escape(components.path);
5450
+
5451
+ if (components.scheme !== undefined) {
5452
+ components.path = components.path.split('%3A').join(':');
5453
+ }
6096
5454
  } else {
6097
- if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
6098
- //target.authority = relative.authority;
6099
- target.userinfo = relative.userinfo;
6100
- target.host = relative.host;
6101
- target.port = relative.port;
6102
- target.path = removeDotSegments(relative.path || "");
6103
- target.query = relative.query;
6104
- } else {
6105
- if (!relative.path) {
6106
- target.path = base.path;
6107
- if (relative.query !== undefined) {
6108
- target.query = relative.query;
6109
- } else {
6110
- target.query = base.query;
6111
- }
6112
- } else {
6113
- if (relative.path.charAt(0) === "/") {
6114
- target.path = removeDotSegments(relative.path);
6115
- } else {
6116
- if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
6117
- target.path = "/" + relative.path;
6118
- } else if (!base.path) {
6119
- target.path = relative.path;
6120
- } else {
6121
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
6122
- }
6123
- target.path = removeDotSegments(target.path);
6124
- }
6125
- target.query = relative.query;
6126
- }
6127
- //target.authority = base.authority;
6128
- target.userinfo = base.userinfo;
6129
- target.host = base.host;
6130
- target.port = base.port;
6131
- }
6132
- target.scheme = base.scheme;
5455
+ components.path = unescape(components.path);
6133
5456
  }
6134
- target.fragment = relative.fragment;
6135
- return target;
6136
- }
5457
+ }
6137
5458
 
6138
- function resolve(baseURI, relativeURI, options) {
6139
- var schemelessOptions = assign({ scheme: 'null' }, options);
6140
- return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
6141
- }
5459
+ if (options.reference !== 'suffix' && components.scheme) {
5460
+ uriTokens.push(components.scheme, ':');
5461
+ }
6142
5462
 
6143
- function normalize(uri, options) {
6144
- if (typeof uri === "string") {
6145
- uri = serialize(parse(uri, options), options);
6146
- } else if (typeOf(uri) === "object") {
6147
- uri = parse(serialize(uri, options), options);
5463
+ const authority = recomposeAuthority(components);
5464
+ if (authority !== undefined) {
5465
+ if (options.reference !== 'suffix') {
5466
+ uriTokens.push('//');
6148
5467
  }
6149
- return uri;
6150
- }
6151
5468
 
6152
- function equal(uriA, uriB, options) {
6153
- if (typeof uriA === "string") {
6154
- uriA = serialize(parse(uriA, options), options);
6155
- } else if (typeOf(uriA) === "object") {
6156
- uriA = serialize(uriA, options);
5469
+ uriTokens.push(authority);
5470
+
5471
+ if (components.path && components.path.charAt(0) !== '/') {
5472
+ uriTokens.push('/');
5473
+ }
5474
+ }
5475
+ if (components.path !== undefined) {
5476
+ let s = components.path;
5477
+
5478
+ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
5479
+ s = removeDotSegments(s);
6157
5480
  }
6158
- if (typeof uriB === "string") {
6159
- uriB = serialize(parse(uriB, options), options);
6160
- } else if (typeOf(uriB) === "object") {
6161
- uriB = serialize(uriB, options);
5481
+
5482
+ if (authority === undefined) {
5483
+ s = s.replace(/^\/\//u, '/%2F'); // don't allow the path to start with "//"
6162
5484
  }
6163
- return uriA === uriB;
6164
- }
6165
5485
 
6166
- function escapeComponent(str, options) {
6167
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
6168
- }
5486
+ uriTokens.push(s);
5487
+ }
5488
+
5489
+ if (components.query !== undefined) {
5490
+ uriTokens.push('?', components.query);
5491
+ }
6169
5492
 
6170
- function unescapeComponent(str, options) {
6171
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
5493
+ if (components.fragment !== undefined) {
5494
+ uriTokens.push('#', components.fragment);
5495
+ }
5496
+ return uriTokens.join('')
6172
5497
  }
6173
5498
 
6174
- var handler = {
6175
- scheme: "http",
6176
- domainHost: true,
6177
- parse: function parse(components, options) {
6178
- //report missing host
6179
- if (!components.host) {
6180
- components.error = components.error || "HTTP URIs must have a host.";
6181
- }
6182
- return components;
6183
- },
6184
- serialize: function serialize(components, options) {
6185
- var secure = String(components.scheme).toLowerCase() === "https";
6186
- //normalize the default port
6187
- if (components.port === (secure ? 443 : 80) || components.port === "") {
6188
- components.port = undefined;
6189
- }
6190
- //normalize the empty path
6191
- if (!components.path) {
6192
- components.path = "/";
6193
- }
6194
- //NOTE: We do not parse query strings for HTTP URIs
6195
- //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
6196
- //and not the HTTP spec.
6197
- return components;
5499
+ const hexLookUp = Array.from({ length: 127 }, (_v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)));
5500
+
5501
+ function nonSimpleDomain (value) {
5502
+ let code = 0;
5503
+ for (let i = 0, len = value.length; i < len; ++i) {
5504
+ code = value.charCodeAt(i);
5505
+ if (code > 126 || hexLookUp[code]) {
5506
+ return true
6198
5507
  }
6199
- };
5508
+ }
5509
+ return false
5510
+ }
6200
5511
 
6201
- var handler$1 = {
6202
- scheme: "https",
6203
- domainHost: handler.domainHost,
6204
- parse: handler.parse,
6205
- serialize: handler.serialize
6206
- };
5512
+ const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
6207
5513
 
6208
- function isSecure(wsComponents) {
6209
- return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
6210
- }
6211
- //RFC 6455
6212
- var handler$2 = {
6213
- scheme: "ws",
6214
- domainHost: true,
6215
- parse: function parse(components, options) {
6216
- var wsComponents = components;
6217
- //indicate if the secure flag is set
6218
- wsComponents.secure = isSecure(wsComponents);
6219
- //construct resouce name
6220
- wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
6221
- wsComponents.path = undefined;
6222
- wsComponents.query = undefined;
6223
- return wsComponents;
6224
- },
6225
- serialize: function serialize(wsComponents, options) {
6226
- //normalize the default port
6227
- if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
6228
- wsComponents.port = undefined;
6229
- }
6230
- //ensure scheme matches secure flag
6231
- if (typeof wsComponents.secure === 'boolean') {
6232
- wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
6233
- wsComponents.secure = undefined;
6234
- }
6235
- //reconstruct path from resource name
6236
- if (wsComponents.resourceName) {
6237
- var _wsComponents$resourc = wsComponents.resourceName.split('?'),
6238
- _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
6239
- path = _wsComponents$resourc2[0],
6240
- query = _wsComponents$resourc2[1];
6241
-
6242
- wsComponents.path = path && path !== '/' ? path : undefined;
6243
- wsComponents.query = query;
6244
- wsComponents.resourceName = undefined;
6245
- }
6246
- //forbid fragment component
6247
- wsComponents.fragment = undefined;
6248
- return wsComponents;
5514
+ function parse (uri, opts) {
5515
+ const options = Object.assign({}, opts);
5516
+ const parsed = {
5517
+ scheme: undefined,
5518
+ userinfo: undefined,
5519
+ host: '',
5520
+ port: undefined,
5521
+ path: '',
5522
+ query: undefined,
5523
+ fragment: undefined
5524
+ };
5525
+ const gotEncoding = uri.indexOf('%') !== -1;
5526
+ let isIP = false;
5527
+ if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri;
5528
+
5529
+ const matches = uri.match(URI_PARSE);
5530
+
5531
+ if (matches) {
5532
+ // store each component
5533
+ parsed.scheme = matches[1];
5534
+ parsed.userinfo = matches[3];
5535
+ parsed.host = matches[4];
5536
+ parsed.port = parseInt(matches[5], 10);
5537
+ parsed.path = matches[6] || '';
5538
+ parsed.query = matches[7];
5539
+ parsed.fragment = matches[8];
5540
+
5541
+ // fix port number
5542
+ if (isNaN(parsed.port)) {
5543
+ parsed.port = matches[5];
5544
+ }
5545
+ if (parsed.host) {
5546
+ const ipv4result = normalizeIPv4(parsed.host);
5547
+ if (ipv4result.isIPV4 === false) {
5548
+ const ipv6result = normalizeIPv6(ipv4result.host);
5549
+ parsed.host = ipv6result.host.toLowerCase();
5550
+ isIP = ipv6result.isIPV6;
5551
+ } else {
5552
+ parsed.host = ipv4result.host;
5553
+ isIP = true;
5554
+ }
5555
+ }
5556
+ if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && parsed.query === undefined && !parsed.path) {
5557
+ parsed.reference = 'same-document';
5558
+ } else if (parsed.scheme === undefined) {
5559
+ parsed.reference = 'relative';
5560
+ } else if (parsed.fragment === undefined) {
5561
+ parsed.reference = 'absolute';
5562
+ } else {
5563
+ parsed.reference = 'uri';
6249
5564
  }
6250
- };
6251
5565
 
6252
- var handler$3 = {
6253
- scheme: "wss",
6254
- domainHost: handler$2.domainHost,
6255
- parse: handler$2.parse,
6256
- serialize: handler$2.serialize
6257
- };
5566
+ // check for reference errors
5567
+ if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {
5568
+ parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.';
5569
+ }
6258
5570
 
6259
- var O = {};
6260
- //RFC 3986
6261
- var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
6262
- var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
6263
- var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
6264
- //RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
6265
- //const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
6266
- //const WSP$$ = "[\\x20\\x09]";
6267
- //const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
6268
- //const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
6269
- //const VCHAR$$ = "[\\x21-\\x7E]";
6270
- //const WSP$$ = "[\\x20\\x09]";
6271
- //const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
6272
- //const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
6273
- //const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
6274
- //const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
6275
- var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
6276
- var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
6277
- var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
6278
- var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
6279
- var UNRESERVED = new RegExp(UNRESERVED$$, "g");
6280
- var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
6281
- var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
6282
- var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
6283
- var NOT_HFVALUE = NOT_HFNAME;
6284
- function decodeUnreserved(str) {
6285
- var decStr = pctDecChars(str);
6286
- return !decStr.match(UNRESERVED) ? str : decStr;
6287
- }
6288
- var handler$4 = {
6289
- scheme: "mailto",
6290
- parse: function parse$$1(components, options) {
6291
- var mailtoComponents = components;
6292
- var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
6293
- mailtoComponents.path = undefined;
6294
- if (mailtoComponents.query) {
6295
- var unknownHeaders = false;
6296
- var headers = {};
6297
- var hfields = mailtoComponents.query.split("&");
6298
- for (var x = 0, xl = hfields.length; x < xl; ++x) {
6299
- var hfield = hfields[x].split("=");
6300
- switch (hfield[0]) {
6301
- case "to":
6302
- var toAddrs = hfield[1].split(",");
6303
- for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
6304
- to.push(toAddrs[_x]);
6305
- }
6306
- break;
6307
- case "subject":
6308
- mailtoComponents.subject = unescapeComponent(hfield[1], options);
6309
- break;
6310
- case "body":
6311
- mailtoComponents.body = unescapeComponent(hfield[1], options);
6312
- break;
6313
- default:
6314
- unknownHeaders = true;
6315
- headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
6316
- break;
6317
- }
6318
- }
6319
- if (unknownHeaders) mailtoComponents.headers = headers;
6320
- }
6321
- mailtoComponents.query = undefined;
6322
- for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
6323
- var addr = to[_x2].split("@");
6324
- addr[0] = unescapeComponent(addr[0]);
6325
- if (!options.unicodeSupport) {
6326
- //convert Unicode IDN -> ASCII IDN
6327
- try {
6328
- addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
6329
- } catch (e) {
6330
- mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
6331
- }
6332
- } else {
6333
- addr[1] = unescapeComponent(addr[1], options).toLowerCase();
6334
- }
6335
- to[_x2] = addr.join("@");
6336
- }
6337
- return mailtoComponents;
6338
- },
6339
- serialize: function serialize$$1(mailtoComponents, options) {
6340
- var components = mailtoComponents;
6341
- var to = toArray(mailtoComponents.to);
6342
- if (to) {
6343
- for (var x = 0, xl = to.length; x < xl; ++x) {
6344
- var toAddr = String(to[x]);
6345
- var atIdx = toAddr.lastIndexOf("@");
6346
- var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
6347
- var domain = toAddr.slice(atIdx + 1);
6348
- //convert IDN via punycode
6349
- try {
6350
- domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
6351
- } catch (e) {
6352
- components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
6353
- }
6354
- to[x] = localPart + "@" + domain;
6355
- }
6356
- components.path = to.join(",");
6357
- }
6358
- var headers = mailtoComponents.headers = mailtoComponents.headers || {};
6359
- if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
6360
- if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
6361
- var fields = [];
6362
- for (var name in headers) {
6363
- if (headers[name] !== O[name]) {
6364
- fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar));
6365
- }
6366
- }
6367
- if (fields.length) {
6368
- components.query = fields.join("&");
5571
+ // find scheme handler
5572
+ const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()];
5573
+
5574
+ // check if scheme can't handle IRIs
5575
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5576
+ // if host component is a domain name
5577
+ if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {
5578
+ // convert Unicode IDN -> ASCII IDN
5579
+ try {
5580
+ parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
5581
+ } catch (e) {
5582
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
6369
5583
  }
6370
- return components;
5584
+ }
5585
+ // convert IRI -> URI
6371
5586
  }
6372
- };
6373
5587
 
6374
- var URN_PARSE = /^([^\:]+)\:(.*)/;
6375
- //RFC 2141
6376
- var handler$5 = {
6377
- scheme: "urn",
6378
- parse: function parse$$1(components, options) {
6379
- var matches = components.path && components.path.match(URN_PARSE);
6380
- var urnComponents = components;
6381
- if (matches) {
6382
- var scheme = options.scheme || urnComponents.scheme || "urn";
6383
- var nid = matches[1].toLowerCase();
6384
- var nss = matches[2];
6385
- var urnScheme = scheme + ":" + (options.nid || nid);
6386
- var schemeHandler = SCHEMES[urnScheme];
6387
- urnComponents.nid = nid;
6388
- urnComponents.nss = nss;
6389
- urnComponents.path = undefined;
6390
- if (schemeHandler) {
6391
- urnComponents = schemeHandler.parse(urnComponents, options);
6392
- }
6393
- } else {
6394
- urnComponents.error = urnComponents.error || "URN can not be parsed.";
6395
- }
6396
- return urnComponents;
6397
- },
6398
- serialize: function serialize$$1(urnComponents, options) {
6399
- var scheme = options.scheme || urnComponents.scheme || "urn";
6400
- var nid = urnComponents.nid;
6401
- var urnScheme = scheme + ":" + (options.nid || nid);
6402
- var schemeHandler = SCHEMES[urnScheme];
6403
- if (schemeHandler) {
6404
- urnComponents = schemeHandler.serialize(urnComponents, options);
6405
- }
6406
- var uriComponents = urnComponents;
6407
- var nss = urnComponents.nss;
6408
- uriComponents.path = (nid || options.nid) + ":" + nss;
6409
- return uriComponents;
5588
+ if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
5589
+ if (gotEncoding && parsed.scheme !== undefined) {
5590
+ parsed.scheme = unescape(parsed.scheme);
5591
+ }
5592
+ if (gotEncoding && parsed.host !== undefined) {
5593
+ parsed.host = unescape(parsed.host);
5594
+ }
5595
+ if (parsed.path) {
5596
+ parsed.path = escape(unescape(parsed.path));
5597
+ }
5598
+ if (parsed.fragment) {
5599
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
5600
+ }
6410
5601
  }
6411
- };
6412
5602
 
6413
- var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
6414
- //RFC 4122
6415
- var handler$6 = {
6416
- scheme: "urn:uuid",
6417
- parse: function parse(urnComponents, options) {
6418
- var uuidComponents = urnComponents;
6419
- uuidComponents.uuid = uuidComponents.nss;
6420
- uuidComponents.nss = undefined;
6421
- if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
6422
- uuidComponents.error = uuidComponents.error || "UUID is not valid.";
6423
- }
6424
- return uuidComponents;
6425
- },
6426
- serialize: function serialize(uuidComponents, options) {
6427
- var urnComponents = uuidComponents;
6428
- //normalize UUID
6429
- urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
6430
- return urnComponents;
5603
+ // perform scheme specific parsing
5604
+ if (schemeHandler && schemeHandler.parse) {
5605
+ schemeHandler.parse(parsed, options);
6431
5606
  }
5607
+ } else {
5608
+ parsed.error = parsed.error || 'URI can not be parsed.';
5609
+ }
5610
+ return parsed
5611
+ }
5612
+
5613
+ const fastUri = {
5614
+ SCHEMES,
5615
+ normalize,
5616
+ resolve,
5617
+ resolveComponents,
5618
+ equal: equal$2,
5619
+ serialize,
5620
+ parse
6432
5621
  };
6433
5622
 
6434
- SCHEMES[handler.scheme] = handler;
6435
- SCHEMES[handler$1.scheme] = handler$1;
6436
- SCHEMES[handler$2.scheme] = handler$2;
6437
- SCHEMES[handler$3.scheme] = handler$3;
6438
- SCHEMES[handler$4.scheme] = handler$4;
6439
- SCHEMES[handler$5.scheme] = handler$5;
6440
- SCHEMES[handler$6.scheme] = handler$6;
6441
-
6442
- exports.SCHEMES = SCHEMES;
6443
- exports.pctEncChar = pctEncChar;
6444
- exports.pctDecChars = pctDecChars;
6445
- exports.parse = parse;
6446
- exports.removeDotSegments = removeDotSegments;
6447
- exports.serialize = serialize;
6448
- exports.resolveComponents = resolveComponents;
6449
- exports.resolve = resolve;
6450
- exports.normalize = normalize;
6451
- exports.equal = equal;
6452
- exports.escapeComponent = escapeComponent;
6453
- exports.unescapeComponent = unescapeComponent;
6454
-
6455
- Object.defineProperty(exports, '__esModule', { value: true });
6456
-
6457
- })));
6458
-
6459
- }(uri_all, uri_all.exports));
5623
+ fastUri$1.exports = fastUri;
5624
+ fastUri$1.exports.default = fastUri;
5625
+ fastUri$1.exports.fastUri = fastUri;
6460
5626
 
6461
5627
  Object.defineProperty(uri$1, "__esModule", { value: true });
6462
- const uri = uri_all.exports;
5628
+ const uri = fastUri$1.exports;
6463
5629
  uri.code = 'require("ajv/dist/runtime/uri").default';
6464
5630
  uri$1.default = uri;
6465
5631
 
@@ -6480,7 +5646,7 @@ const ref_error_1 = ref_error;
6480
5646
  const rules_1 = rules;
6481
5647
  const compile_1 = compile;
6482
5648
  const codegen_2 = codegen;
6483
- const resolve_1 = resolve$1;
5649
+ const resolve_1 = resolve$2;
6484
5650
  const dataType_1 = dataType;
6485
5651
  const util_1 = util;
6486
5652
  const $dataRefSchema = require$$9;
@@ -9596,7 +8762,7 @@ var validate = function validate(rule, instance) {
9596
8762
  message = _theRule.message;
9597
8763
  var valid = true;
9598
8764
  if (isExpression(validator)) {
9599
- valid = executeExpression(validator, instance);
8765
+ valid = _executeExpression(validator, instance);
9600
8766
  } else if (typeof validator === 'function') {
9601
8767
  valid = validator(instance);
9602
8768
  // eslint-disable-next-line no-eval
@@ -9760,25 +8926,23 @@ var validateFormWithResult = function validateFormWithResult(widgetTree) {
9760
8926
  };
9761
8927
  // 校验schema是否正常
9762
8928
  var validateSchema = /*#__PURE__*/function () {
9763
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
9764
- return _regeneratorRuntime().wrap(function _callee$(_context) {
9765
- while (1) switch (_context.prev = _context.next) {
8929
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(schema) {
8930
+ var _t;
8931
+ return _regenerator().w(function (_context) {
8932
+ while (1) switch (_context.p = _context.n) {
9766
8933
  case 0:
9767
- _context.prev = 0;
9768
- _context.next = 3;
8934
+ _context.p = 0;
8935
+ _context.n = 1;
9769
8936
  return ajv.validateSchema(schema, true);
9770
- case 3:
9771
- return _context.abrupt("return", _context.sent);
9772
- case 6:
9773
- _context.prev = 6;
9774
- _context.t0 = _context["catch"](0);
9775
- console.error('Schema不符合规范, 请检查', _context.t0);
9776
- return _context.abrupt("return", false);
9777
- case 10:
9778
- case "end":
9779
- return _context.stop();
8937
+ case 1:
8938
+ return _context.a(2, _context.v);
8939
+ case 2:
8940
+ _context.p = 2;
8941
+ _t = _context.v;
8942
+ console.error('Schema不符合规范, 请检查', _t);
8943
+ return _context.a(2, false);
9780
8944
  }
9781
- }, _callee, null, [[0, 6]]);
8945
+ }, _callee, null, [[0, 2]]);
9782
8946
  }));
9783
8947
  return function validateSchema(_x) {
9784
8948
  return _ref.apply(this, arguments);
@@ -9985,43 +9149,42 @@ var Widget = Vue.extend({
9985
9149
  },
9986
9150
  loadDataSource: function loadDataSource() {
9987
9151
  var _this3 = this;
9988
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9152
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
9989
9153
  var _this3$widgetSchema, _this3$widgetSchema$u, _this3$widgetSchema$u2;
9990
- var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams;
9991
- return _regeneratorRuntime().wrap(function _callee$(_context) {
9992
- while (1) switch (_context.prev = _context.next) {
9154
+ var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams, _t;
9155
+ return _regenerator().w(function (_context) {
9156
+ while (1) switch (_context.p = _context.n) {
9993
9157
  case 0:
9994
9158
  xhrConfig = (_this3$widgetSchema = _this3.widgetSchema) === null || _this3$widgetSchema === void 0 ? void 0 : (_this3$widgetSchema$u = _this3$widgetSchema['ui:component']) === null || _this3$widgetSchema$u === void 0 ? void 0 : (_this3$widgetSchema$u2 = _this3$widgetSchema$u.props) === null || _this3$widgetSchema$u2 === void 0 ? void 0 : _this3$widgetSchema$u2.remoteConfig;
9995
9159
  if (!xhrConfig) {
9996
- _context.next = 18;
9160
+ _context.n = 4;
9997
9161
  break;
9998
9162
  }
9999
9163
  url = xhrConfig.url, params = xhrConfig.params, reset = _objectWithoutProperties(xhrConfig, _excluded$4);
10000
9164
  _this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
10001
- _context.prev = 4;
9165
+ _context.p = 1;
10002
9166
  _this3.loading = true;
10003
- remoteURL = executeExpression(url, _this3);
10004
- requestParams = isObj(params) ? executeExpression(params, _this3) : params;
10005
- _context.next = 10;
9167
+ remoteURL = _executeExpression(url, _this3);
9168
+ requestParams = isObj(params) ? _executeExpression(params, _this3) : params;
9169
+ _context.n = 2;
10006
9170
  return http(remoteURL, _objectSpread2(_objectSpread2({}, reset), {}, {
10007
9171
  params: requestParams,
10008
9172
  responseParse: responseParse
10009
9173
  }));
10010
- case 10:
10011
- _this3.datasource = _context.sent;
9174
+ case 2:
9175
+ _this3.datasource = _context.v;
10012
9176
  _this3.loading = false;
10013
- _context.next = 18;
9177
+ _context.n = 4;
10014
9178
  break;
10015
- case 14:
10016
- _context.prev = 14;
10017
- _context.t0 = _context["catch"](4);
9179
+ case 3:
9180
+ _context.p = 3;
9181
+ _t = _context.v;
10018
9182
  _this3.loading = false;
10019
- console.error(_context.t0);
10020
- case 18:
10021
- case "end":
10022
- return _context.stop();
9183
+ console.error(_t);
9184
+ case 4:
9185
+ return _context.a(2);
10023
9186
  }
10024
- }, _callee, null, [[4, 14]]);
9187
+ }, _callee, null, [[1, 3]]);
10025
9188
  }))();
10026
9189
  },
10027
9190
  setErrorTips: function setErrorTips(tips) {
@@ -11135,82 +10298,6 @@ var FieldGroupWrap = Vue.extend({
11135
10298
 
11136
10299
  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;
11137
10300
 
11138
- var CommonGroupWrap = Vue.extend({
11139
- name: 'CommonFieldGroupWrap',
11140
- inject: ['widgetTree'],
11141
- props: _objectSpread2(_objectSpread2({}, props), {}, {
11142
- // 组类型
11143
- type: {
11144
- type: String,
11145
- default: 'default',
11146
- validator: function validator(value) {
11147
- return ['default', 'normal', 'card'].includes(value);
11148
- }
11149
- },
11150
- // 是否显示组title
11151
- showTitle: {
11152
- type: Boolean,
11153
- default: false
11154
- },
11155
- // 是否显示border
11156
- border: {
11157
- type: Boolean,
11158
- default: false
11159
- },
11160
- verifiable: {
11161
- type: Boolean,
11162
- default: false
11163
- },
11164
- hideEmptyRow: {
11165
- type: Boolean,
11166
- default: false
11167
- },
11168
- description: {
11169
- type: String,
11170
- default: ''
11171
- },
11172
- tag: {
11173
- type: String,
11174
- default: 'div'
11175
- }
11176
- }),
11177
- data: function data() {
11178
- return {
11179
- state: {
11180
- // 组类型目前只支持visible
11181
- visible: true
11182
- }
11183
- };
11184
- },
11185
- // created() {
11186
- // // 注册widget TreeNode
11187
- // this.widgetTree.addWidgetNode(this.path, this, 'group');
11188
- // },
11189
- mounted: function mounted() {
11190
- // 更新样式
11191
- this.$forceUpdate();
11192
- },
11193
- // beforeDestroy() {
11194
- // this.widgetTree.removeWidgetNode(this.path, this);
11195
- // },
11196
- methods: {
11197
- setState: function setState(key, value) {
11198
- if (Reflect.has(this.state, key)) {
11199
- this.state[key] = value;
11200
- } else {
11201
- console.warn("Group unsupported ".concat(key, " state, please check"));
11202
- }
11203
- }
11204
- },
11205
- render: function render(h) {
11206
- var _this$layout;
11207
- var groupContentStyle = _objectSpread2({}, (_this$layout = this.layout) === null || _this$layout === void 0 ? void 0 : _this$layout.container);
11208
- return h(this.tag, {
11209
- style: groupContentStyle
11210
- }, [this.$slots.default]);
11211
- }
11212
- });
11213
-
11214
10301
  // 伪数组类型
11215
10302
  var KeyValueArrayWidget = Vue.extend({
11216
10303
  name: 'KeyValueArrayWidget',
@@ -11261,30 +10348,30 @@ var KeyValueArrayWidget = Vue.extend({
11261
10348
  _this$schema2,
11262
10349
  _this$schema2$items,
11263
10350
  _this = this,
11264
- _this$value2;
10351
+ _this$value2,
10352
+ _this$value3;
11265
10353
  var labelBtnStyle = {
11266
10354
  'font-size': '16px',
11267
10355
  color: this.disabled ? '#c4c6cc' : '#979ba5',
11268
10356
  cursor: this.disabled ? 'not-allowed' : 'pointer',
11269
10357
  display: 'inline-block'
11270
10358
  };
11271
- var theadStyle = {
11272
- display: this.showTableHead ? '' : 'none'
11273
- };
10359
+ 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;
10360
+ 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']);
10361
+ // props为空时,表示只有一个项
10362
+ var keysLen = Object.keys(properties || {}).length;
10363
+ var defaultCols = properties ? new Array(keysLen).fill('1fr').concat('20px').join(' ') : '1fr 20px';
10364
+ var defaultContainerLayout = _objectSpread2({}, this.layout.container || {
10365
+ display: 'grid',
10366
+ gridGap: '20px',
10367
+ 'grid-template-columns': defaultCols // 默认配置
10368
+ });
11274
10369
  var thStyle = {
11275
10370
  fontSize: '14px',
11276
10371
  textAlign: 'left',
11277
10372
  fontWeight: 'normal',
11278
- color: '#63656E',
11279
- paddingLeft: '10px',
11280
- paddingRight: '10px'
11281
- };
11282
- var tdStyle = {
11283
- paddingLeft: '10px',
11284
- paddingRight: '10px'
10373
+ color: '#63656E'
11285
10374
  };
11286
- 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;
11287
- 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']);
11288
10375
  var self = this;
11289
10376
  var dealSchema = function dealSchema(schema) {
11290
10377
  return (
@@ -11332,57 +10419,55 @@ var KeyValueArrayWidget = Vue.extend({
11332
10419
  }
11333
10420
  });
11334
10421
  };
11335
- return h("table", [h("thead", {
11336
- "style": theadStyle
11337
- }, [h("tr", [props === null || props === void 0 ? void 0 : props.map(function (prop, i) {
10422
+ return h("div", [this.showTableHead && (_this$value2 = this.value) !== null && _this$value2 !== void 0 && _this$value2.length ? h("div", {
10423
+ "style": _objectSpread2({}, defaultContainerLayout)
10424
+ }, [props !== null && props !== void 0 && props.length ? props.map(function (key, index) {
11338
10425
  var _this$schema3, _this$schema3$items, _this$columns$path;
11339
- 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];
11340
- var path = Path.getCurPath(_this.path, "0.".concat(prop));
11341
- return h("th", {
11342
- "style": _objectSpread2(_objectSpread2({}, thStyle), {}, {
11343
- paddingLeft: i > 0 ? '10px' : '0px',
10426
+ 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[key];
10427
+ var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(key));
10428
+ var lastProp = curPath.split('.').pop();
10429
+ var layoutConfig = Layout.findLayoutByProp(lastProp, _this.layout.group || []) || {};
10430
+ var path = Path.getCurPath(_this.path, "0.".concat(key));
10431
+ return h("div", {
10432
+ "style": _objectSpread2(_objectSpread2(_objectSpread2({}, thStyle), (layoutConfig === null || layoutConfig === void 0 ? void 0 : layoutConfig.item) || {}), {}, {
11344
10433
  display: ((_this$columns$path = _this.columns[path]) === null || _this$columns$path === void 0 ? void 0 : _this$columns$path.visible) === false ? 'none' : ''
11345
10434
  })
11346
10435
  }, [schemaItem === null || schemaItem === void 0 ? void 0 : schemaItem.title]);
11347
- }), h("th")])]), h("tbody", [(_this$value2 = this.value) === null || _this$value2 === void 0 ? void 0 : _this$value2.map(function (_, index) {
10436
+ }) : h("div"), h("div", {
10437
+ "style": {
10438
+ width: '16px'
10439
+ }
10440
+ })]) : null, (_this$value3 = this.value) === null || _this$value3 === void 0 ? void 0 : _this$value3.map(function (_, index) {
11348
10441
  var _this$schema5;
11349
10442
  var groupPath = Path.getCurPath(_this.path, "".concat(index));
11350
- return h(CommonGroupWrap, helper([{}, {
10443
+ return h(FieldGroupWrap, helper([{}, {
11351
10444
  "props": _objectSpread2(_objectSpread2({}, _this.$props), {}, {
11352
10445
  path: groupPath,
11353
10446
  value: Path.getPathVal(_this.rootData, groupPath),
11354
10447
  schema: _this.schema.items,
11355
- tag: 'tr',
11356
- layout: _objectSpread2({}, _this.layout)
10448
+ layout: _objectSpread2(_objectSpread2({}, _this.layout), {}, {
10449
+ container: _objectSpread2({}, defaultContainerLayout)
10450
+ })
11357
10451
  })
11358
- }]), [props !== null && props !== void 0 && props.length ? props.map(function (prop, i) {
11359
- var _this$schema4, _this$schema4$items, _this$columns$curPath;
10452
+ }]), [props !== null && props !== void 0 && props.length ? props.map(function (prop) {
10453
+ var _this$schema4, _this$schema4$items;
11360
10454
  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];
11361
10455
  var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(prop));
11362
10456
  var lastProp = curPath.split('.').pop();
11363
10457
  var layoutConfig = Layout.findLayoutByProp(lastProp, _this.layout.group || []) || {};
11364
- return h("td", {
11365
- "style": _objectSpread2(_objectSpread2({}, tdStyle), {}, {
11366
- paddingLeft: i > 0 ? '10px' : '0px',
11367
- display: ((_this$columns$curPath = _this.columns[curPath]) === null || _this$columns$curPath === void 0 ? void 0 : _this$columns$curPath.visible) === false ? 'none' : ''
11368
- })
11369
- }, [renderSchemaField({
10458
+ return renderSchemaField({
11370
10459
  path: curPath,
11371
10460
  schema: dealSchema(schemaItem),
11372
10461
  layout: layoutConfig,
11373
10462
  required: Schema.isRequired(schemaItem, prop)
11374
- })]);
11375
- }) : h("td", [renderSchemaField({
10463
+ });
10464
+ }) : renderSchemaField({
11376
10465
  path: Path.getCurPath(_this.path, index),
11377
10466
  schema: dealSchema(((_this$schema5 = _this.schema) === null || _this$schema5 === void 0 ? void 0 : _this$schema5.items) || {}),
11378
10467
  layout: {},
11379
10468
  required: false
11380
- })]), h("td", {
11381
- "style": _objectSpread2({}, tdStyle)
11382
- }, [h("span", {
11383
- "style": _objectSpread2(_objectSpread2({}, labelBtnStyle), {}, {
11384
- marginBottom: '10px'
11385
- }),
10469
+ }), h("span", {
10470
+ "style": labelBtnStyle,
11386
10471
  "on": {
11387
10472
  "click": function click() {
11388
10473
  return _this.handleRemoveItem(index);
@@ -11390,7 +10475,7 @@ var KeyValueArrayWidget = Vue.extend({
11390
10475
  }
11391
10476
  }, [h("i", {
11392
10477
  "class": "bk-icon icon-minus-line"
11393
- })])])]);
10478
+ })])]);
11394
10479
  }), h("span", {
11395
10480
  "on": {
11396
10481
  "click": this.handleAddItem
@@ -11398,7 +10483,7 @@ var KeyValueArrayWidget = Vue.extend({
11398
10483
  "style": labelBtnStyle
11399
10484
  }, [h("i", {
11400
10485
  "class": "bk-icon icon-plus-line"
11401
- })])])]);
10486
+ })])]);
11402
10487
  }
11403
10488
  });
11404
10489
 
@@ -11538,7 +10623,8 @@ var CollapseGroupWidget = Vue.extend({
11538
10623
  key: key,
11539
10624
  props: {
11540
10625
  hideArrow: true,
11541
- name: key
10626
+ name: key,
10627
+ contentHiddenType: 'hidden'
11542
10628
  },
11543
10629
  class: _this.collapseStyle === 'normal' ? ['mb15'] : []
11544
10630
  }, [h('div', {
@@ -11698,7 +10784,7 @@ var UploadWidget = Vue.extend({
11698
10784
  options.fileObj.xhr = xhr;
11699
10785
  var formData = new FormData();
11700
10786
  options.data.forEach(function (item) {
11701
- formData.append(item.name, executeExpression(item.value, _this.$parent.$parent));
10787
+ formData.append(item.name, _executeExpression(item.value, _this.$parent.$parent));
11702
10788
  });
11703
10789
  formData.append(options.fileName, options.fileObj.origin);
11704
10790
  xhr.onreadystatechange = function () {
@@ -11721,12 +10807,12 @@ var UploadWidget = Vue.extend({
11721
10807
  if (Array.isArray(options.header)) {
11722
10808
  options.header.forEach(function (head) {
11723
10809
  var headerKey = head.name;
11724
- var headerVal = executeExpression(head.value, _this.$parent.$parent);
10810
+ var headerVal = _executeExpression(head.value, _this.$parent.$parent);
11725
10811
  xhr.setRequestHeader(headerKey, headerVal);
11726
10812
  });
11727
10813
  } else {
11728
10814
  var headerKey = options.header.name;
11729
- var headerVal = executeExpression(options.header.value, this.$parent.$parent);
10815
+ var headerVal = _executeExpression(options.header.value, this.$parent.$parent);
11730
10816
  xhr.setRequestHeader(headerKey, headerVal);
11731
10817
  }
11732
10818
  }
@@ -11750,13 +10836,13 @@ var UploadWidget = Vue.extend({
11750
10836
  handleResCode: function handleResCode(res) {
11751
10837
  var successed = true;
11752
10838
  if (this.isUploadSuccessed) {
11753
- successed = executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
10839
+ successed = _executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
11754
10840
  response: res
11755
10841
  });
11756
10842
  }
11757
10843
  if (!successed) return;
11758
10844
  if (this.responseHandler) {
11759
- var files = executeExpression(this.responseHandler, this.$parent.$parent, [], {
10845
+ var files = _executeExpression(this.responseHandler, this.$parent.$parent, [], {
11760
10846
  response: res
11761
10847
  });
11762
10848
  this.$emit('input', files);
@@ -12094,7 +11180,7 @@ function createForm() {
12094
11180
  },
12095
11181
  methods: {
12096
11182
  initFormData: function initFormData() {
12097
- this.rootData = merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
11183
+ this.rootData = _merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
12098
11184
  this.emitFormValueChange(this.rootData, this.value);
12099
11185
  },
12100
11186
  emitFormValueChange: function emitFormValueChange(newValue, oldValue) {