@hpcc-js/marshaller 2.25.50 → 2.25.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,8 +5,8 @@
5
5
  })(this, (function (exports, comms, common, util$6, chart, dgrid, form, graph, map, layout, phosphor, codemirror, other) { 'use strict';
6
6
 
7
7
  var PKG_NAME$1 = "@hpcc-js/marshaller";
8
- var PKG_VERSION$1 = "2.25.50";
9
- var BUILD_VERSION = "2.105.11";
8
+ var PKG_VERSION$1 = "2.25.51";
9
+ var BUILD_VERSION = "2.105.12";
10
10
 
11
11
  /******************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
@@ -2338,7 +2338,7 @@
2338
2338
  }
2339
2339
 
2340
2340
  var PKG_NAME = "@hpcc-js/ddl-shim";
2341
- var PKG_VERSION = "2.20.6";
2341
+ var PKG_VERSION = "2.20.7";
2342
2342
 
2343
2343
  function isWorkunitDatasource(ref) {
2344
2344
  return ref.WUID !== undefined;
@@ -2405,17 +2405,17 @@
2405
2405
 
2406
2406
  var v2$1 = /*#__PURE__*/Object.freeze({
2407
2407
  __proto__: null,
2408
+ VisibilitySet: VisibilitySet,
2408
2409
  isDatabombRef: isDatabombRef,
2409
- isWUResultRef: isWUResultRef,
2410
- isRoxieServiceRef: isRoxieServiceRef,
2411
- isIFilterCondition: isIFilterCondition,
2412
2410
  isFilterActivity: isFilterActivity,
2413
- isProjectActivity: isProjectActivity,
2414
- isMappingsActivity: isMappingsActivity,
2415
2411
  isGroupByActivity: isGroupByActivity,
2416
- isSortActivity: isSortActivity,
2412
+ isIFilterCondition: isIFilterCondition,
2417
2413
  isLimitActivity: isLimitActivity,
2418
- VisibilitySet: VisibilitySet
2414
+ isMappingsActivity: isMappingsActivity,
2415
+ isProjectActivity: isProjectActivity,
2416
+ isRoxieServiceRef: isRoxieServiceRef,
2417
+ isSortActivity: isSortActivity,
2418
+ isWUResultRef: isWUResultRef
2419
2419
  });
2420
2420
 
2421
2421
  /******************************************************************************
@@ -2432,6 +2432,8 @@
2432
2432
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2433
2433
  PERFORMANCE OF THIS SOFTWARE.
2434
2434
  ***************************************************************************** */
2435
+ /* global Reflect, Promise, SuppressedError, Symbol */
2436
+
2435
2437
 
2436
2438
  var __assign = function() {
2437
2439
  __assign = Object.assign || function __assign(t) {
@@ -2445,7 +2447,7 @@
2445
2447
  };
2446
2448
 
2447
2449
  function __spreadArray(to, from, pack) {
2448
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
2450
+ for (var i = 0, l = from.length, ar; i < l; i++) {
2449
2451
  if (ar || !(i in from)) {
2450
2452
  if (!ar) ar = Array.prototype.slice.call(from, 0, i);
2451
2453
  ar[i] = from[i];
@@ -2903,7 +2905,7 @@
2903
2905
  this._ddl2DataviewActivities[viz.id].project.transformations = projectTransformations;
2904
2906
  }
2905
2907
  if (aggrFields.length) {
2906
- this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns, true);
2908
+ this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns);
2907
2909
  this._ddl2DataviewActivities[viz.id].groupBy.aggregates = aggrFields;
2908
2910
  }
2909
2911
  }
@@ -3374,7 +3376,6 @@
3374
3376
  return DDLUpgrade;
3375
3377
  }());
3376
3378
  function upgrade(ddl, baseUrl, wuid, toLowerCase, dermatologyJson) {
3377
- if (toLowerCase === void 0) { toLowerCase = true; }
3378
3379
  if (dermatologyJson === void 0) { dermatologyJson = {}; }
3379
3380
  var ddlUp = new DDLUpgrade(ddl, baseUrl, wuid, toLowerCase);
3380
3381
  var retVal = ddlUp.write();
@@ -3384,159 +3385,162 @@
3384
3385
 
3385
3386
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3386
3387
 
3388
+ function getDefaultExportFromCjs (x) {
3389
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
3390
+ }
3391
+
3387
3392
  var uri_all = {exports: {}};
3388
3393
 
3389
3394
  /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
3390
3395
 
3391
3396
  (function (module, exports) {
3392
- (function (global, factory) {
3393
- factory(exports) ;
3394
- }(commonjsGlobal, (function (exports) {
3395
- function merge() {
3396
- for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
3397
- sets[_key] = arguments[_key];
3398
- }
3399
-
3400
- if (sets.length > 1) {
3401
- sets[0] = sets[0].slice(0, -1);
3402
- var xl = sets.length - 1;
3403
- for (var x = 1; x < xl; ++x) {
3404
- sets[x] = sets[x].slice(1, -1);
3405
- }
3406
- sets[xl] = sets[xl].slice(1);
3407
- return sets.join('');
3408
- } else {
3409
- return sets[0];
3410
- }
3411
- }
3412
- function subexp(str) {
3413
- return "(?:" + str + ")";
3414
- }
3415
- function typeOf(o) {
3416
- return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
3417
- }
3418
- function toUpperCase(str) {
3419
- return str.toUpperCase();
3420
- }
3421
- function toArray(obj) {
3422
- 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) : [];
3423
- }
3424
- function assign(target, source) {
3425
- var obj = target;
3426
- if (source) {
3427
- for (var key in source) {
3428
- obj[key] = source[key];
3429
- }
3430
- }
3431
- return obj;
3432
- }
3433
-
3434
- function buildExps(isIRI) {
3435
- var ALPHA$$ = "[A-Za-z]",
3436
- DIGIT$$ = "[0-9]",
3437
- HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
3438
- PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
3439
- //expanded
3440
- GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
3441
- SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
3442
- RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
3443
- UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
3444
- //subset, excludes bidi control characters
3445
- IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
3446
- //subset
3447
- UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
3448
- subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
3449
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
3450
- 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$$),
3451
- //relaxed parsing rules
3452
- IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
3453
- H16$ = subexp(HEXDIG$$ + "{1,4}"),
3454
- LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
3455
- IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
3456
- // 6( h16 ":" ) ls32
3457
- IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
3458
- // "::" 5( h16 ":" ) ls32
3459
- IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
3460
- //[ h16 ] "::" 4( h16 ":" ) ls32
3461
- IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
3462
- //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
3463
- IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
3464
- //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
3465
- IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
3466
- //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
3467
- IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
3468
- //[ *4( h16 ":" ) h16 ] "::" ls32
3469
- IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
3470
- //[ *5( h16 ":" ) h16 ] "::" h16
3471
- IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
3472
- //[ *6( h16 ":" ) h16 ] "::"
3473
- IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
3474
- ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
3475
- //RFC 6874, with relaxed parsing rules
3476
- subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
3477
- //RFC 6874
3478
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
3479
- var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
3480
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
3481
- subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
3482
- return {
3483
- NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
3484
- NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
3485
- NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
3486
- NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
3487
- NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
3488
- NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
3489
- NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
3490
- ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
3491
- UNRESERVED: new RegExp(UNRESERVED$$, "g"),
3492
- OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
3493
- PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
3494
- IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
3495
- IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
3496
- };
3497
- }
3498
- var URI_PROTOCOL = buildExps(false);
3397
+ (function (global, factory) {
3398
+ factory(exports) ;
3399
+ }(commonjsGlobal, (function (exports) {
3400
+ function merge() {
3401
+ for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
3402
+ sets[_key] = arguments[_key];
3403
+ }
3404
+
3405
+ if (sets.length > 1) {
3406
+ sets[0] = sets[0].slice(0, -1);
3407
+ var xl = sets.length - 1;
3408
+ for (var x = 1; x < xl; ++x) {
3409
+ sets[x] = sets[x].slice(1, -1);
3410
+ }
3411
+ sets[xl] = sets[xl].slice(1);
3412
+ return sets.join('');
3413
+ } else {
3414
+ return sets[0];
3415
+ }
3416
+ }
3417
+ function subexp(str) {
3418
+ return "(?:" + str + ")";
3419
+ }
3420
+ function typeOf(o) {
3421
+ return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
3422
+ }
3423
+ function toUpperCase(str) {
3424
+ return str.toUpperCase();
3425
+ }
3426
+ function toArray(obj) {
3427
+ 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) : [];
3428
+ }
3429
+ function assign(target, source) {
3430
+ var obj = target;
3431
+ if (source) {
3432
+ for (var key in source) {
3433
+ obj[key] = source[key];
3434
+ }
3435
+ }
3436
+ return obj;
3437
+ }
3499
3438
 
3500
- var IRI_PROTOCOL = buildExps(true);
3439
+ function buildExps(isIRI) {
3440
+ var ALPHA$$ = "[A-Za-z]",
3441
+ DIGIT$$ = "[0-9]",
3442
+ HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
3443
+ PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
3444
+ //expanded
3445
+ GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
3446
+ SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
3447
+ RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
3448
+ UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
3449
+ //subset, excludes bidi control characters
3450
+ IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
3451
+ //subset
3452
+ UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
3453
+ subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
3454
+ subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
3455
+ 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$$),
3456
+ //relaxed parsing rules
3457
+ IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
3458
+ H16$ = subexp(HEXDIG$$ + "{1,4}"),
3459
+ LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
3460
+ IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
3461
+ // 6( h16 ":" ) ls32
3462
+ IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
3463
+ // "::" 5( h16 ":" ) ls32
3464
+ IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
3465
+ //[ h16 ] "::" 4( h16 ":" ) ls32
3466
+ IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
3467
+ //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
3468
+ IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
3469
+ //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
3470
+ IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
3471
+ //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
3472
+ IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
3473
+ //[ *4( h16 ":" ) h16 ] "::" ls32
3474
+ IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
3475
+ //[ *5( h16 ":" ) h16 ] "::" h16
3476
+ IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
3477
+ //[ *6( h16 ":" ) h16 ] "::"
3478
+ IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
3479
+ ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
3480
+ //RFC 6874, with relaxed parsing rules
3481
+ subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
3482
+ //RFC 6874
3483
+ subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
3484
+ var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
3485
+ subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
3486
+ subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
3487
+ return {
3488
+ NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
3489
+ NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
3490
+ NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
3491
+ NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
3492
+ NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
3493
+ NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
3494
+ NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
3495
+ ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
3496
+ UNRESERVED: new RegExp(UNRESERVED$$, "g"),
3497
+ OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
3498
+ PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
3499
+ IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
3500
+ IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
3501
+ };
3502
+ }
3503
+ var URI_PROTOCOL = buildExps(false);
3501
3504
 
3502
- var slicedToArray = function () {
3503
- function sliceIterator(arr, i) {
3504
- var _arr = [];
3505
- var _n = true;
3506
- var _d = false;
3507
- var _e = undefined;
3505
+ var IRI_PROTOCOL = buildExps(true);
3508
3506
 
3509
- try {
3510
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
3511
- _arr.push(_s.value);
3507
+ var slicedToArray = function () {
3508
+ function sliceIterator(arr, i) {
3509
+ var _arr = [];
3510
+ var _n = true;
3511
+ var _d = false;
3512
+ var _e = undefined;
3512
3513
 
3513
- if (i && _arr.length === i) break;
3514
- }
3515
- } catch (err) {
3516
- _d = true;
3517
- _e = err;
3518
- } finally {
3519
- try {
3520
- if (!_n && _i["return"]) _i["return"]();
3521
- } finally {
3522
- if (_d) throw _e;
3523
- }
3524
- }
3514
+ try {
3515
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
3516
+ _arr.push(_s.value);
3525
3517
 
3526
- return _arr;
3527
- }
3518
+ if (i && _arr.length === i) break;
3519
+ }
3520
+ } catch (err) {
3521
+ _d = true;
3522
+ _e = err;
3523
+ } finally {
3524
+ try {
3525
+ if (!_n && _i["return"]) _i["return"]();
3526
+ } finally {
3527
+ if (_d) throw _e;
3528
+ }
3529
+ }
3528
3530
 
3529
- return function (arr, i) {
3530
- if (Array.isArray(arr)) {
3531
- return arr;
3532
- } else if (Symbol.iterator in Object(arr)) {
3533
- return sliceIterator(arr, i);
3534
- } else {
3535
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
3536
- }
3537
- };
3538
- }();
3531
+ return _arr;
3532
+ }
3539
3533
 
3534
+ return function (arr, i) {
3535
+ if (Array.isArray(arr)) {
3536
+ return arr;
3537
+ } else if (Symbol.iterator in Object(arr)) {
3538
+ return sliceIterator(arr, i);
3539
+ } else {
3540
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
3541
+ }
3542
+ };
3543
+ }();
3540
3544
 
3541
3545
 
3542
3546
 
@@ -3549,1248 +3553,1251 @@
3549
3553
 
3550
3554
 
3551
3555
 
3552
- var toConsumableArray = function (arr) {
3553
- if (Array.isArray(arr)) {
3554
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
3555
3556
 
3556
- return arr2;
3557
- } else {
3558
- return Array.from(arr);
3559
- }
3560
- };
3557
+ var toConsumableArray = function (arr) {
3558
+ if (Array.isArray(arr)) {
3559
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
3561
3560
 
3562
- /** Highest positive signed 32-bit float value */
3563
-
3564
- var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
3565
-
3566
- /** Bootstring parameters */
3567
- var base = 36;
3568
- var tMin = 1;
3569
- var tMax = 26;
3570
- var skew = 38;
3571
- var damp = 700;
3572
- var initialBias = 72;
3573
- var initialN = 128; // 0x80
3574
- var delimiter = '-'; // '\x2D'
3575
-
3576
- /** Regular expressions */
3577
- var regexPunycode = /^xn--/;
3578
- var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
3579
- var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
3580
-
3581
- /** Error messages */
3582
- var errors = {
3583
- 'overflow': 'Overflow: input needs wider integers to process',
3584
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
3585
- 'invalid-input': 'Invalid input'
3586
- };
3561
+ return arr2;
3562
+ } else {
3563
+ return Array.from(arr);
3564
+ }
3565
+ };
3587
3566
 
3588
- /** Convenience shortcuts */
3589
- var baseMinusTMin = base - tMin;
3590
- var floor = Math.floor;
3591
- var stringFromCharCode = String.fromCharCode;
3567
+ /** Highest positive signed 32-bit float value */
3592
3568
 
3593
- /*--------------------------------------------------------------------------*/
3569
+ var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
3594
3570
 
3595
- /**
3596
- * A generic error utility function.
3597
- * @private
3598
- * @param {String} type The error type.
3599
- * @returns {Error} Throws a `RangeError` with the applicable error message.
3600
- */
3601
- function error$1(type) {
3602
- throw new RangeError(errors[type]);
3603
- }
3571
+ /** Bootstring parameters */
3572
+ var base = 36;
3573
+ var tMin = 1;
3574
+ var tMax = 26;
3575
+ var skew = 38;
3576
+ var damp = 700;
3577
+ var initialBias = 72;
3578
+ var initialN = 128; // 0x80
3579
+ var delimiter = '-'; // '\x2D'
3604
3580
 
3605
- /**
3606
- * A generic `Array#map` utility function.
3607
- * @private
3608
- * @param {Array} array The array to iterate over.
3609
- * @param {Function} callback The function that gets called for every array
3610
- * item.
3611
- * @returns {Array} A new array of values returned by the callback function.
3612
- */
3613
- function map(array, fn) {
3614
- var result = [];
3615
- var length = array.length;
3616
- while (length--) {
3617
- result[length] = fn(array[length]);
3618
- }
3619
- return result;
3620
- }
3581
+ /** Regular expressions */
3582
+ var regexPunycode = /^xn--/;
3583
+ var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
3584
+ var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
3621
3585
 
3622
- /**
3623
- * A simple `Array#map`-like wrapper to work with domain name strings or email
3624
- * addresses.
3625
- * @private
3626
- * @param {String} domain The domain name or email address.
3627
- * @param {Function} callback The function that gets called for every
3628
- * character.
3629
- * @returns {Array} A new string of characters returned by the callback
3630
- * function.
3631
- */
3632
- function mapDomain(string, fn) {
3633
- var parts = string.split('@');
3634
- var result = '';
3635
- if (parts.length > 1) {
3636
- // In email addresses, only the domain name should be punycoded. Leave
3637
- // the local part (i.e. everything up to `@`) intact.
3638
- result = parts[0] + '@';
3639
- string = parts[1];
3640
- }
3641
- // Avoid `split(regex)` for IE8 compatibility. See #17.
3642
- string = string.replace(regexSeparators, '\x2E');
3643
- var labels = string.split('.');
3644
- var encoded = map(labels, fn).join('.');
3645
- return result + encoded;
3646
- }
3586
+ /** Error messages */
3587
+ var errors = {
3588
+ 'overflow': 'Overflow: input needs wider integers to process',
3589
+ 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
3590
+ 'invalid-input': 'Invalid input'
3591
+ };
3647
3592
 
3648
- /**
3649
- * Creates an array containing the numeric code points of each Unicode
3650
- * character in the string. While JavaScript uses UCS-2 internally,
3651
- * this function will convert a pair of surrogate halves (each of which
3652
- * UCS-2 exposes as separate characters) into a single code point,
3653
- * matching UTF-16.
3654
- * @see `punycode.ucs2.encode`
3655
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
3656
- * @memberOf punycode.ucs2
3657
- * @name decode
3658
- * @param {String} string The Unicode input string (UCS-2).
3659
- * @returns {Array} The new array of code points.
3660
- */
3661
- function ucs2decode(string) {
3662
- var output = [];
3663
- var counter = 0;
3664
- var length = string.length;
3665
- while (counter < length) {
3666
- var value = string.charCodeAt(counter++);
3667
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
3668
- // It's a high surrogate, and there is a next character.
3669
- var extra = string.charCodeAt(counter++);
3670
- if ((extra & 0xFC00) == 0xDC00) {
3671
- // Low surrogate.
3672
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
3673
- } else {
3674
- // It's an unmatched surrogate; only append this code unit, in case the
3675
- // next code unit is the high surrogate of a surrogate pair.
3676
- output.push(value);
3677
- counter--;
3678
- }
3679
- } else {
3680
- output.push(value);
3681
- }
3682
- }
3683
- return output;
3684
- }
3593
+ /** Convenience shortcuts */
3594
+ var baseMinusTMin = base - tMin;
3595
+ var floor = Math.floor;
3596
+ var stringFromCharCode = String.fromCharCode;
3685
3597
 
3686
- /**
3687
- * Creates a string based on an array of numeric code points.
3688
- * @see `punycode.ucs2.decode`
3689
- * @memberOf punycode.ucs2
3690
- * @name encode
3691
- * @param {Array} codePoints The array of numeric code points.
3692
- * @returns {String} The new Unicode string (UCS-2).
3693
- */
3694
- var ucs2encode = function ucs2encode(array) {
3695
- return String.fromCodePoint.apply(String, toConsumableArray(array));
3696
- };
3598
+ /*--------------------------------------------------------------------------*/
3697
3599
 
3698
- /**
3699
- * Converts a basic code point into a digit/integer.
3700
- * @see `digitToBasic()`
3701
- * @private
3702
- * @param {Number} codePoint The basic numeric code point value.
3703
- * @returns {Number} The numeric value of a basic code point (for use in
3704
- * representing integers) in the range `0` to `base - 1`, or `base` if
3705
- * the code point does not represent a value.
3706
- */
3707
- var basicToDigit = function basicToDigit(codePoint) {
3708
- if (codePoint - 0x30 < 0x0A) {
3709
- return codePoint - 0x16;
3710
- }
3711
- if (codePoint - 0x41 < 0x1A) {
3712
- return codePoint - 0x41;
3713
- }
3714
- if (codePoint - 0x61 < 0x1A) {
3715
- return codePoint - 0x61;
3600
+ /**
3601
+ * A generic error utility function.
3602
+ * @private
3603
+ * @param {String} type The error type.
3604
+ * @returns {Error} Throws a `RangeError` with the applicable error message.
3605
+ */
3606
+ function error$1(type) {
3607
+ throw new RangeError(errors[type]);
3716
3608
  }
3717
- return base;
3718
- };
3719
-
3720
- /**
3721
- * Converts a digit/integer into a basic code point.
3722
- * @see `basicToDigit()`
3723
- * @private
3724
- * @param {Number} digit The numeric value of a basic code point.
3725
- * @returns {Number} The basic code point whose value (when used for
3726
- * representing integers) is `digit`, which needs to be in the range
3727
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
3728
- * used; else, the lowercase form is used. The behavior is undefined
3729
- * if `flag` is non-zero and `digit` has no uppercase form.
3730
- */
3731
- var digitToBasic = function digitToBasic(digit, flag) {
3732
- // 0..25 map to ASCII a..z or A..Z
3733
- // 26..35 map to ASCII 0..9
3734
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
3735
- };
3736
3609
 
3737
- /**
3738
- * Bias adaptation function as per section 3.4 of RFC 3492.
3739
- * https://tools.ietf.org/html/rfc3492#section-3.4
3740
- * @private
3741
- */
3742
- var adapt = function adapt(delta, numPoints, firstTime) {
3743
- var k = 0;
3744
- delta = firstTime ? floor(delta / damp) : delta >> 1;
3745
- delta += floor(delta / numPoints);
3746
- for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
3747
- delta = floor(delta / baseMinusTMin);
3610
+ /**
3611
+ * A generic `Array#map` utility function.
3612
+ * @private
3613
+ * @param {Array} array The array to iterate over.
3614
+ * @param {Function} callback The function that gets called for every array
3615
+ * item.
3616
+ * @returns {Array} A new array of values returned by the callback function.
3617
+ */
3618
+ function map(array, fn) {
3619
+ var result = [];
3620
+ var length = array.length;
3621
+ while (length--) {
3622
+ result[length] = fn(array[length]);
3623
+ }
3624
+ return result;
3748
3625
  }
3749
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
3750
- };
3751
3626
 
3752
- /**
3753
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
3754
- * symbols.
3755
- * @memberOf punycode
3756
- * @param {String} input The Punycode string of ASCII-only symbols.
3757
- * @returns {String} The resulting string of Unicode symbols.
3758
- */
3759
- var decode = function decode(input) {
3760
- // Don't use UCS-2.
3761
- var output = [];
3762
- var inputLength = input.length;
3763
- var i = 0;
3764
- var n = initialN;
3765
- var bias = initialBias;
3766
-
3767
- // Handle the basic code points: let `basic` be the number of input code
3768
- // points before the last delimiter, or `0` if there is none, then copy
3769
- // the first basic code points to the output.
3770
-
3771
- var basic = input.lastIndexOf(delimiter);
3772
- if (basic < 0) {
3773
- basic = 0;
3627
+ /**
3628
+ * A simple `Array#map`-like wrapper to work with domain name strings or email
3629
+ * addresses.
3630
+ * @private
3631
+ * @param {String} domain The domain name or email address.
3632
+ * @param {Function} callback The function that gets called for every
3633
+ * character.
3634
+ * @returns {Array} A new string of characters returned by the callback
3635
+ * function.
3636
+ */
3637
+ function mapDomain(string, fn) {
3638
+ var parts = string.split('@');
3639
+ var result = '';
3640
+ if (parts.length > 1) {
3641
+ // In email addresses, only the domain name should be punycoded. Leave
3642
+ // the local part (i.e. everything up to `@`) intact.
3643
+ result = parts[0] + '@';
3644
+ string = parts[1];
3645
+ }
3646
+ // Avoid `split(regex)` for IE8 compatibility. See #17.
3647
+ string = string.replace(regexSeparators, '\x2E');
3648
+ var labels = string.split('.');
3649
+ var encoded = map(labels, fn).join('.');
3650
+ return result + encoded;
3774
3651
  }
3775
3652
 
3776
- for (var j = 0; j < basic; ++j) {
3777
- // if it's not a basic code point
3778
- if (input.charCodeAt(j) >= 0x80) {
3779
- error$1('not-basic');
3653
+ /**
3654
+ * Creates an array containing the numeric code points of each Unicode
3655
+ * character in the string. While JavaScript uses UCS-2 internally,
3656
+ * this function will convert a pair of surrogate halves (each of which
3657
+ * UCS-2 exposes as separate characters) into a single code point,
3658
+ * matching UTF-16.
3659
+ * @see `punycode.ucs2.encode`
3660
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
3661
+ * @memberOf punycode.ucs2
3662
+ * @name decode
3663
+ * @param {String} string The Unicode input string (UCS-2).
3664
+ * @returns {Array} The new array of code points.
3665
+ */
3666
+ function ucs2decode(string) {
3667
+ var output = [];
3668
+ var counter = 0;
3669
+ var length = string.length;
3670
+ while (counter < length) {
3671
+ var value = string.charCodeAt(counter++);
3672
+ if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
3673
+ // It's a high surrogate, and there is a next character.
3674
+ var extra = string.charCodeAt(counter++);
3675
+ if ((extra & 0xFC00) == 0xDC00) {
3676
+ // Low surrogate.
3677
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
3678
+ } else {
3679
+ // It's an unmatched surrogate; only append this code unit, in case the
3680
+ // next code unit is the high surrogate of a surrogate pair.
3681
+ output.push(value);
3682
+ counter--;
3683
+ }
3684
+ } else {
3685
+ output.push(value);
3686
+ }
3780
3687
  }
3781
- output.push(input.charCodeAt(j));
3688
+ return output;
3782
3689
  }
3783
3690
 
3784
- // Main decoding loop: start just after the last delimiter if any basic code
3785
- // points were copied; start at the beginning otherwise.
3786
-
3787
- for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
3788
-
3789
- // `index` is the index of the next character to be consumed.
3790
- // Decode a generalized variable-length integer into `delta`,
3791
- // which gets added to `i`. The overflow checking is easier
3792
- // if we increase `i` as we go, then subtract off its starting
3793
- // value at the end to obtain `delta`.
3794
- var oldi = i;
3795
- for (var w = 1, k = base;; /* no condition */k += base) {
3796
-
3797
- if (index >= inputLength) {
3798
- error$1('invalid-input');
3799
- }
3691
+ /**
3692
+ * Creates a string based on an array of numeric code points.
3693
+ * @see `punycode.ucs2.decode`
3694
+ * @memberOf punycode.ucs2
3695
+ * @name encode
3696
+ * @param {Array} codePoints The array of numeric code points.
3697
+ * @returns {String} The new Unicode string (UCS-2).
3698
+ */
3699
+ var ucs2encode = function ucs2encode(array) {
3700
+ return String.fromCodePoint.apply(String, toConsumableArray(array));
3701
+ };
3800
3702
 
3801
- var digit = basicToDigit(input.charCodeAt(index++));
3703
+ /**
3704
+ * Converts a basic code point into a digit/integer.
3705
+ * @see `digitToBasic()`
3706
+ * @private
3707
+ * @param {Number} codePoint The basic numeric code point value.
3708
+ * @returns {Number} The numeric value of a basic code point (for use in
3709
+ * representing integers) in the range `0` to `base - 1`, or `base` if
3710
+ * the code point does not represent a value.
3711
+ */
3712
+ var basicToDigit = function basicToDigit(codePoint) {
3713
+ if (codePoint - 0x30 < 0x0A) {
3714
+ return codePoint - 0x16;
3715
+ }
3716
+ if (codePoint - 0x41 < 0x1A) {
3717
+ return codePoint - 0x41;
3718
+ }
3719
+ if (codePoint - 0x61 < 0x1A) {
3720
+ return codePoint - 0x61;
3721
+ }
3722
+ return base;
3723
+ };
3802
3724
 
3803
- if (digit >= base || digit > floor((maxInt - i) / w)) {
3804
- error$1('overflow');
3805
- }
3725
+ /**
3726
+ * Converts a digit/integer into a basic code point.
3727
+ * @see `basicToDigit()`
3728
+ * @private
3729
+ * @param {Number} digit The numeric value of a basic code point.
3730
+ * @returns {Number} The basic code point whose value (when used for
3731
+ * representing integers) is `digit`, which needs to be in the range
3732
+ * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
3733
+ * used; else, the lowercase form is used. The behavior is undefined
3734
+ * if `flag` is non-zero and `digit` has no uppercase form.
3735
+ */
3736
+ var digitToBasic = function digitToBasic(digit, flag) {
3737
+ // 0..25 map to ASCII a..z or A..Z
3738
+ // 26..35 map to ASCII 0..9
3739
+ return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
3740
+ };
3806
3741
 
3807
- i += digit * w;
3808
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
3742
+ /**
3743
+ * Bias adaptation function as per section 3.4 of RFC 3492.
3744
+ * https://tools.ietf.org/html/rfc3492#section-3.4
3745
+ * @private
3746
+ */
3747
+ var adapt = function adapt(delta, numPoints, firstTime) {
3748
+ var k = 0;
3749
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
3750
+ delta += floor(delta / numPoints);
3751
+ for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
3752
+ delta = floor(delta / baseMinusTMin);
3753
+ }
3754
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
3755
+ };
3809
3756
 
3810
- if (digit < t) {
3811
- break;
3812
- }
3757
+ /**
3758
+ * Converts a Punycode string of ASCII-only symbols to a string of Unicode
3759
+ * symbols.
3760
+ * @memberOf punycode
3761
+ * @param {String} input The Punycode string of ASCII-only symbols.
3762
+ * @returns {String} The resulting string of Unicode symbols.
3763
+ */
3764
+ var decode = function decode(input) {
3765
+ // Don't use UCS-2.
3766
+ var output = [];
3767
+ var inputLength = input.length;
3768
+ var i = 0;
3769
+ var n = initialN;
3770
+ var bias = initialBias;
3771
+
3772
+ // Handle the basic code points: let `basic` be the number of input code
3773
+ // points before the last delimiter, or `0` if there is none, then copy
3774
+ // the first basic code points to the output.
3775
+
3776
+ var basic = input.lastIndexOf(delimiter);
3777
+ if (basic < 0) {
3778
+ basic = 0;
3779
+ }
3813
3780
 
3814
- var baseMinusT = base - t;
3815
- if (w > floor(maxInt / baseMinusT)) {
3816
- error$1('overflow');
3781
+ for (var j = 0; j < basic; ++j) {
3782
+ // if it's not a basic code point
3783
+ if (input.charCodeAt(j) >= 0x80) {
3784
+ error$1('not-basic');
3817
3785
  }
3818
-
3819
- w *= baseMinusT;
3786
+ output.push(input.charCodeAt(j));
3820
3787
  }
3821
3788
 
3822
- var out = output.length + 1;
3823
- bias = adapt(i - oldi, out, oldi == 0);
3789
+ // Main decoding loop: start just after the last delimiter if any basic code
3790
+ // points were copied; start at the beginning otherwise.
3824
3791
 
3825
- // `i` was supposed to wrap around from `out` to `0`,
3826
- // incrementing `n` each time, so we'll fix that now:
3827
- if (floor(i / out) > maxInt - n) {
3828
- error$1('overflow');
3829
- }
3792
+ for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
3830
3793
 
3831
- n += floor(i / out);
3832
- i %= out;
3794
+ // `index` is the index of the next character to be consumed.
3795
+ // Decode a generalized variable-length integer into `delta`,
3796
+ // which gets added to `i`. The overflow checking is easier
3797
+ // if we increase `i` as we go, then subtract off its starting
3798
+ // value at the end to obtain `delta`.
3799
+ var oldi = i;
3800
+ for (var w = 1, k = base;; /* no condition */k += base) {
3833
3801
 
3834
- // Insert `n` at position `i` of the output.
3835
- output.splice(i++, 0, n);
3836
- }
3802
+ if (index >= inputLength) {
3803
+ error$1('invalid-input');
3804
+ }
3837
3805
 
3838
- return String.fromCodePoint.apply(String, output);
3839
- };
3806
+ var digit = basicToDigit(input.charCodeAt(index++));
3840
3807
 
3841
- /**
3842
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
3843
- * Punycode string of ASCII-only symbols.
3844
- * @memberOf punycode
3845
- * @param {String} input The string of Unicode symbols.
3846
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
3847
- */
3848
- var encode = function encode(input) {
3849
- var output = [];
3808
+ if (digit >= base || digit > floor((maxInt - i) / w)) {
3809
+ error$1('overflow');
3810
+ }
3850
3811
 
3851
- // Convert the input in UCS-2 to an array of Unicode code points.
3852
- input = ucs2decode(input);
3812
+ i += digit * w;
3813
+ var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
3853
3814
 
3854
- // Cache the length.
3855
- var inputLength = input.length;
3815
+ if (digit < t) {
3816
+ break;
3817
+ }
3856
3818
 
3857
- // Initialize the state.
3858
- var n = initialN;
3859
- var delta = 0;
3860
- var bias = initialBias;
3819
+ var baseMinusT = base - t;
3820
+ if (w > floor(maxInt / baseMinusT)) {
3821
+ error$1('overflow');
3822
+ }
3861
3823
 
3862
- // Handle the basic code points.
3863
- var _iteratorNormalCompletion = true;
3864
- var _didIteratorError = false;
3865
- var _iteratorError = undefined;
3824
+ w *= baseMinusT;
3825
+ }
3866
3826
 
3867
- try {
3868
- for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
3869
- var _currentValue2 = _step.value;
3827
+ var out = output.length + 1;
3828
+ bias = adapt(i - oldi, out, oldi == 0);
3870
3829
 
3871
- if (_currentValue2 < 0x80) {
3872
- output.push(stringFromCharCode(_currentValue2));
3873
- }
3874
- }
3875
- } catch (err) {
3876
- _didIteratorError = true;
3877
- _iteratorError = err;
3878
- } finally {
3879
- try {
3880
- if (!_iteratorNormalCompletion && _iterator.return) {
3881
- _iterator.return();
3882
- }
3883
- } finally {
3884
- if (_didIteratorError) {
3885
- throw _iteratorError;
3830
+ // `i` was supposed to wrap around from `out` to `0`,
3831
+ // incrementing `n` each time, so we'll fix that now:
3832
+ if (floor(i / out) > maxInt - n) {
3833
+ error$1('overflow');
3886
3834
  }
3887
- }
3888
- }
3889
-
3890
- var basicLength = output.length;
3891
- var handledCPCount = basicLength;
3892
3835
 
3893
- // `handledCPCount` is the number of code points that have been handled;
3894
- // `basicLength` is the number of basic code points.
3836
+ n += floor(i / out);
3837
+ i %= out;
3895
3838
 
3896
- // Finish the basic string with a delimiter unless it's empty.
3897
- if (basicLength) {
3898
- output.push(delimiter);
3899
- }
3839
+ // Insert `n` at position `i` of the output.
3840
+ output.splice(i++, 0, n);
3841
+ }
3900
3842
 
3901
- // Main encoding loop:
3902
- while (handledCPCount < inputLength) {
3843
+ return String.fromCodePoint.apply(String, output);
3844
+ };
3903
3845
 
3904
- // All non-basic code points < n have been handled already. Find the next
3905
- // larger one:
3906
- var m = maxInt;
3907
- var _iteratorNormalCompletion2 = true;
3908
- var _didIteratorError2 = false;
3909
- var _iteratorError2 = undefined;
3846
+ /**
3847
+ * Converts a string of Unicode symbols (e.g. a domain name label) to a
3848
+ * Punycode string of ASCII-only symbols.
3849
+ * @memberOf punycode
3850
+ * @param {String} input The string of Unicode symbols.
3851
+ * @returns {String} The resulting Punycode string of ASCII-only symbols.
3852
+ */
3853
+ var encode = function encode(input) {
3854
+ var output = [];
3855
+
3856
+ // Convert the input in UCS-2 to an array of Unicode code points.
3857
+ input = ucs2decode(input);
3858
+
3859
+ // Cache the length.
3860
+ var inputLength = input.length;
3861
+
3862
+ // Initialize the state.
3863
+ var n = initialN;
3864
+ var delta = 0;
3865
+ var bias = initialBias;
3866
+
3867
+ // Handle the basic code points.
3868
+ var _iteratorNormalCompletion = true;
3869
+ var _didIteratorError = false;
3870
+ var _iteratorError = undefined;
3910
3871
 
3911
3872
  try {
3912
- for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
3913
- var currentValue = _step2.value;
3873
+ for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
3874
+ var _currentValue2 = _step.value;
3914
3875
 
3915
- if (currentValue >= n && currentValue < m) {
3916
- m = currentValue;
3876
+ if (_currentValue2 < 0x80) {
3877
+ output.push(stringFromCharCode(_currentValue2));
3917
3878
  }
3918
3879
  }
3919
-
3920
- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
3921
- // but guard against overflow.
3922
3880
  } catch (err) {
3923
- _didIteratorError2 = true;
3924
- _iteratorError2 = err;
3881
+ _didIteratorError = true;
3882
+ _iteratorError = err;
3925
3883
  } finally {
3926
3884
  try {
3927
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
3928
- _iterator2.return();
3885
+ if (!_iteratorNormalCompletion && _iterator.return) {
3886
+ _iterator.return();
3929
3887
  }
3930
3888
  } finally {
3931
- if (_didIteratorError2) {
3932
- throw _iteratorError2;
3889
+ if (_didIteratorError) {
3890
+ throw _iteratorError;
3933
3891
  }
3934
3892
  }
3935
3893
  }
3936
3894
 
3937
- var handledCPCountPlusOne = handledCPCount + 1;
3938
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
3939
- error$1('overflow');
3940
- }
3895
+ var basicLength = output.length;
3896
+ var handledCPCount = basicLength;
3941
3897
 
3942
- delta += (m - n) * handledCPCountPlusOne;
3943
- n = m;
3898
+ // `handledCPCount` is the number of code points that have been handled;
3899
+ // `basicLength` is the number of basic code points.
3944
3900
 
3945
- var _iteratorNormalCompletion3 = true;
3946
- var _didIteratorError3 = false;
3947
- var _iteratorError3 = undefined;
3901
+ // Finish the basic string with a delimiter unless it's empty.
3902
+ if (basicLength) {
3903
+ output.push(delimiter);
3904
+ }
3948
3905
 
3949
- try {
3950
- for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
3951
- var _currentValue = _step3.value;
3906
+ // Main encoding loop:
3907
+ while (handledCPCount < inputLength) {
3952
3908
 
3953
- if (_currentValue < n && ++delta > maxInt) {
3954
- error$1('overflow');
3955
- }
3956
- if (_currentValue == n) {
3957
- // Represent delta as a generalized variable-length integer.
3958
- var q = delta;
3959
- for (var k = base;; /* no condition */k += base) {
3960
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
3961
- if (q < t) {
3962
- break;
3963
- }
3964
- var qMinusT = q - t;
3965
- var baseMinusT = base - t;
3966
- output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
3967
- q = floor(qMinusT / baseMinusT);
3968
- }
3909
+ // All non-basic code points < n have been handled already. Find the next
3910
+ // larger one:
3911
+ var m = maxInt;
3912
+ var _iteratorNormalCompletion2 = true;
3913
+ var _didIteratorError2 = false;
3914
+ var _iteratorError2 = undefined;
3969
3915
 
3970
- output.push(stringFromCharCode(digitToBasic(q, 0)));
3971
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
3972
- delta = 0;
3973
- ++handledCPCount;
3974
- }
3975
- }
3976
- } catch (err) {
3977
- _didIteratorError3 = true;
3978
- _iteratorError3 = err;
3979
- } finally {
3980
3916
  try {
3981
- if (!_iteratorNormalCompletion3 && _iterator3.return) {
3982
- _iterator3.return();
3917
+ for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
3918
+ var currentValue = _step2.value;
3919
+
3920
+ if (currentValue >= n && currentValue < m) {
3921
+ m = currentValue;
3922
+ }
3983
3923
  }
3924
+
3925
+ // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
3926
+ // but guard against overflow.
3927
+ } catch (err) {
3928
+ _didIteratorError2 = true;
3929
+ _iteratorError2 = err;
3984
3930
  } finally {
3985
- if (_didIteratorError3) {
3986
- throw _iteratorError3;
3931
+ try {
3932
+ if (!_iteratorNormalCompletion2 && _iterator2.return) {
3933
+ _iterator2.return();
3934
+ }
3935
+ } finally {
3936
+ if (_didIteratorError2) {
3937
+ throw _iteratorError2;
3938
+ }
3987
3939
  }
3988
3940
  }
3989
- }
3990
-
3991
- ++delta;
3992
- ++n;
3993
- }
3994
- return output.join('');
3995
- };
3996
3941
 
3997
- /**
3998
- * Converts a Punycode string representing a domain name or an email address
3999
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
4000
- * it doesn't matter if you call it on a string that has already been
4001
- * converted to Unicode.
4002
- * @memberOf punycode
4003
- * @param {String} input The Punycoded domain name or email address to
4004
- * convert to Unicode.
4005
- * @returns {String} The Unicode representation of the given Punycode
4006
- * string.
4007
- */
4008
- var toUnicode = function toUnicode(input) {
4009
- return mapDomain(input, function (string) {
4010
- return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
4011
- });
4012
- };
4013
-
4014
- /**
4015
- * Converts a Unicode string representing a domain name or an email address to
4016
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
4017
- * i.e. it doesn't matter if you call it with a domain that's already in
4018
- * ASCII.
4019
- * @memberOf punycode
4020
- * @param {String} input The domain name or email address to convert, as a
4021
- * Unicode string.
4022
- * @returns {String} The Punycode representation of the given domain name or
4023
- * email address.
4024
- */
4025
- var toASCII = function toASCII(input) {
4026
- return mapDomain(input, function (string) {
4027
- return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
4028
- });
4029
- };
4030
-
4031
- /*--------------------------------------------------------------------------*/
4032
-
4033
- /** Define the public API */
4034
- var punycode = {
4035
- /**
4036
- * A string representing the current Punycode.js version number.
4037
- * @memberOf punycode
4038
- * @type String
4039
- */
4040
- 'version': '2.1.0',
4041
- /**
4042
- * An object of methods to convert from JavaScript's internal character
4043
- * representation (UCS-2) to Unicode code points, and back.
4044
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
4045
- * @memberOf punycode
4046
- * @type Object
4047
- */
4048
- 'ucs2': {
4049
- 'decode': ucs2decode,
4050
- 'encode': ucs2encode
4051
- },
4052
- 'decode': decode,
4053
- 'encode': encode,
4054
- 'toASCII': toASCII,
4055
- 'toUnicode': toUnicode
4056
- };
3942
+ var handledCPCountPlusOne = handledCPCount + 1;
3943
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
3944
+ error$1('overflow');
3945
+ }
4057
3946
 
4058
- /**
4059
- * URI.js
4060
- *
4061
- * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
4062
- * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
4063
- * @see http://github.com/garycourt/uri-js
4064
- */
4065
- /**
4066
- * Copyright 2011 Gary Court. All rights reserved.
4067
- *
4068
- * Redistribution and use in source and binary forms, with or without modification, are
4069
- * permitted provided that the following conditions are met:
4070
- *
4071
- * 1. Redistributions of source code must retain the above copyright notice, this list of
4072
- * conditions and the following disclaimer.
4073
- *
4074
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
4075
- * of conditions and the following disclaimer in the documentation and/or other materials
4076
- * provided with the distribution.
4077
- *
4078
- * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
4079
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
4080
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
4081
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
4082
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
4083
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
4084
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
4085
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
4086
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4087
- *
4088
- * The views and conclusions contained in the software and documentation are those of the
4089
- * authors and should not be interpreted as representing official policies, either expressed
4090
- * or implied, of Gary Court.
4091
- */
4092
- var SCHEMES = {};
4093
- function pctEncChar(chr) {
4094
- var c = chr.charCodeAt(0);
4095
- var e = void 0;
4096
- 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();
4097
- return e;
4098
- }
4099
- function pctDecChars(str) {
4100
- var newStr = "";
4101
- var i = 0;
4102
- var il = str.length;
4103
- while (i < il) {
4104
- var c = parseInt(str.substr(i + 1, 2), 16);
4105
- if (c < 128) {
4106
- newStr += String.fromCharCode(c);
4107
- i += 3;
4108
- } else if (c >= 194 && c < 224) {
4109
- if (il - i >= 6) {
4110
- var c2 = parseInt(str.substr(i + 4, 2), 16);
4111
- newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
4112
- } else {
4113
- newStr += str.substr(i, 6);
4114
- }
4115
- i += 6;
4116
- } else if (c >= 224) {
4117
- if (il - i >= 9) {
4118
- var _c = parseInt(str.substr(i + 4, 2), 16);
4119
- var c3 = parseInt(str.substr(i + 7, 2), 16);
4120
- newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
4121
- } else {
4122
- newStr += str.substr(i, 9);
4123
- }
4124
- i += 9;
4125
- } else {
4126
- newStr += str.substr(i, 3);
4127
- i += 3;
4128
- }
4129
- }
4130
- return newStr;
4131
- }
4132
- function _normalizeComponentEncoding(components, protocol) {
4133
- function decodeUnreserved(str) {
4134
- var decStr = pctDecChars(str);
4135
- return !decStr.match(protocol.UNRESERVED) ? str : decStr;
4136
- }
4137
- if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
4138
- if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
4139
- 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);
4140
- 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);
4141
- if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
4142
- if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
4143
- return components;
4144
- }
3947
+ delta += (m - n) * handledCPCountPlusOne;
3948
+ n = m;
4145
3949
 
4146
- function _stripLeadingZeros(str) {
4147
- return str.replace(/^0*(.*)/, "$1") || "0";
4148
- }
4149
- function _normalizeIPv4(host, protocol) {
4150
- var matches = host.match(protocol.IPV4ADDRESS) || [];
3950
+ var _iteratorNormalCompletion3 = true;
3951
+ var _didIteratorError3 = false;
3952
+ var _iteratorError3 = undefined;
4151
3953
 
4152
- var _matches = slicedToArray(matches, 2),
4153
- address = _matches[1];
3954
+ try {
3955
+ for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
3956
+ var _currentValue = _step3.value;
4154
3957
 
4155
- if (address) {
4156
- return address.split(".").map(_stripLeadingZeros).join(".");
4157
- } else {
4158
- return host;
4159
- }
4160
- }
4161
- function _normalizeIPv6(host, protocol) {
4162
- var matches = host.match(protocol.IPV6ADDRESS) || [];
4163
-
4164
- var _matches2 = slicedToArray(matches, 3),
4165
- address = _matches2[1],
4166
- zone = _matches2[2];
4167
-
4168
- if (address) {
4169
- var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
4170
- _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
4171
- last = _address$toLowerCase$2[0],
4172
- first = _address$toLowerCase$2[1];
4173
-
4174
- var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
4175
- var lastFields = last.split(":").map(_stripLeadingZeros);
4176
- var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
4177
- var fieldCount = isLastFieldIPv4Address ? 7 : 8;
4178
- var lastFieldsStart = lastFields.length - fieldCount;
4179
- var fields = Array(fieldCount);
4180
- for (var x = 0; x < fieldCount; ++x) {
4181
- fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
4182
- }
4183
- if (isLastFieldIPv4Address) {
4184
- fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
4185
- }
4186
- var allZeroFields = fields.reduce(function (acc, field, index) {
4187
- if (!field || field === "0") {
4188
- var lastLongest = acc[acc.length - 1];
4189
- if (lastLongest && lastLongest.index + lastLongest.length === index) {
4190
- lastLongest.length++;
4191
- } else {
4192
- acc.push({ index: index, length: 1 });
4193
- }
4194
- }
4195
- return acc;
4196
- }, []);
4197
- var longestZeroFields = allZeroFields.sort(function (a, b) {
4198
- return b.length - a.length;
4199
- })[0];
4200
- var newHost = void 0;
4201
- if (longestZeroFields && longestZeroFields.length > 1) {
4202
- var newFirst = fields.slice(0, longestZeroFields.index);
4203
- var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
4204
- newHost = newFirst.join(":") + "::" + newLast.join(":");
4205
- } else {
4206
- newHost = fields.join(":");
4207
- }
4208
- if (zone) {
4209
- newHost += "%" + zone;
4210
- }
4211
- return newHost;
4212
- } else {
4213
- return host;
4214
- }
4215
- }
4216
- var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
4217
- var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
4218
- function parse(uriString) {
4219
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4220
-
4221
- var components = {};
4222
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
4223
- if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
4224
- var matches = uriString.match(URI_PARSE);
4225
- if (matches) {
4226
- if (NO_MATCH_IS_UNDEFINED) {
4227
- //store each component
4228
- components.scheme = matches[1];
4229
- components.userinfo = matches[3];
4230
- components.host = matches[4];
4231
- components.port = parseInt(matches[5], 10);
4232
- components.path = matches[6] || "";
4233
- components.query = matches[7];
4234
- components.fragment = matches[8];
4235
- //fix port number
4236
- if (isNaN(components.port)) {
4237
- components.port = matches[5];
4238
- }
4239
- } else {
4240
- //IE FIX for improper RegExp matching
4241
- //store each component
4242
- components.scheme = matches[1] || undefined;
4243
- components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
4244
- components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
4245
- components.port = parseInt(matches[5], 10);
4246
- components.path = matches[6] || "";
4247
- components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
4248
- components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
4249
- //fix port number
4250
- if (isNaN(components.port)) {
4251
- components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
4252
- }
4253
- }
4254
- if (components.host) {
4255
- //normalize IP hosts
4256
- components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
4257
- }
4258
- //determine reference type
4259
- if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
4260
- components.reference = "same-document";
4261
- } else if (components.scheme === undefined) {
4262
- components.reference = "relative";
4263
- } else if (components.fragment === undefined) {
4264
- components.reference = "absolute";
4265
- } else {
4266
- components.reference = "uri";
4267
- }
4268
- //check for reference errors
4269
- if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
4270
- components.error = components.error || "URI is not a " + options.reference + " reference.";
4271
- }
4272
- //find scheme handler
4273
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
4274
- //check if scheme can't handle IRIs
4275
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
4276
- //if host component is a domain name
4277
- if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
4278
- //convert Unicode IDN -> ASCII IDN
4279
- try {
4280
- components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
4281
- } catch (e) {
4282
- components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
4283
- }
4284
- }
4285
- //convert IRI -> URI
4286
- _normalizeComponentEncoding(components, URI_PROTOCOL);
4287
- } else {
4288
- //normalize encodings
4289
- _normalizeComponentEncoding(components, protocol);
4290
- }
4291
- //perform scheme specific parsing
4292
- if (schemeHandler && schemeHandler.parse) {
4293
- schemeHandler.parse(components, options);
4294
- }
4295
- } else {
4296
- components.error = components.error || "URI can not be parsed.";
4297
- }
4298
- return components;
4299
- }
3958
+ if (_currentValue < n && ++delta > maxInt) {
3959
+ error$1('overflow');
3960
+ }
3961
+ if (_currentValue == n) {
3962
+ // Represent delta as a generalized variable-length integer.
3963
+ var q = delta;
3964
+ for (var k = base;; /* no condition */k += base) {
3965
+ var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
3966
+ if (q < t) {
3967
+ break;
3968
+ }
3969
+ var qMinusT = q - t;
3970
+ var baseMinusT = base - t;
3971
+ output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
3972
+ q = floor(qMinusT / baseMinusT);
3973
+ }
4300
3974
 
4301
- function _recomposeAuthority(components, options) {
4302
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
4303
- var uriTokens = [];
4304
- if (components.userinfo !== undefined) {
4305
- uriTokens.push(components.userinfo);
4306
- uriTokens.push("@");
4307
- }
4308
- if (components.host !== undefined) {
4309
- //normalize IP hosts, add brackets and escape zone separator for IPv6
4310
- uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
4311
- return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
4312
- }));
4313
- }
4314
- if (typeof components.port === "number" || typeof components.port === "string") {
4315
- uriTokens.push(":");
4316
- uriTokens.push(String(components.port));
4317
- }
4318
- return uriTokens.length ? uriTokens.join("") : undefined;
4319
- }
3975
+ output.push(stringFromCharCode(digitToBasic(q, 0)));
3976
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
3977
+ delta = 0;
3978
+ ++handledCPCount;
3979
+ }
3980
+ }
3981
+ } catch (err) {
3982
+ _didIteratorError3 = true;
3983
+ _iteratorError3 = err;
3984
+ } finally {
3985
+ try {
3986
+ if (!_iteratorNormalCompletion3 && _iterator3.return) {
3987
+ _iterator3.return();
3988
+ }
3989
+ } finally {
3990
+ if (_didIteratorError3) {
3991
+ throw _iteratorError3;
3992
+ }
3993
+ }
3994
+ }
4320
3995
 
4321
- var RDS1 = /^\.\.?\//;
4322
- var RDS2 = /^\/\.(\/|$)/;
4323
- var RDS3 = /^\/\.\.(\/|$)/;
4324
- var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
4325
- function removeDotSegments(input) {
4326
- var output = [];
4327
- while (input.length) {
4328
- if (input.match(RDS1)) {
4329
- input = input.replace(RDS1, "");
4330
- } else if (input.match(RDS2)) {
4331
- input = input.replace(RDS2, "/");
4332
- } else if (input.match(RDS3)) {
4333
- input = input.replace(RDS3, "/");
4334
- output.pop();
4335
- } else if (input === "." || input === "..") {
4336
- input = "";
4337
- } else {
4338
- var im = input.match(RDS5);
4339
- if (im) {
4340
- var s = im[0];
4341
- input = input.slice(s.length);
4342
- output.push(s);
4343
- } else {
4344
- throw new Error("Unexpected dot segment condition");
4345
- }
4346
- }
4347
- }
4348
- return output.join("");
4349
- }
3996
+ ++delta;
3997
+ ++n;
3998
+ }
3999
+ return output.join('');
4000
+ };
4350
4001
 
4351
- function serialize(components) {
4352
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4353
-
4354
- var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
4355
- var uriTokens = [];
4356
- //find scheme handler
4357
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
4358
- //perform scheme specific serialization
4359
- if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
4360
- if (components.host) {
4361
- //if host component is an IPv6 address
4362
- if (protocol.IPV6ADDRESS.test(components.host)) ;
4363
- //TODO: normalize IPv6 address as per RFC 5952
4364
-
4365
- //if host component is a domain name
4366
- else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
4367
- //convert IDN via punycode
4368
- try {
4369
- components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
4370
- } catch (e) {
4371
- components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
4372
- }
4373
- }
4374
- }
4375
- //normalize encoding
4376
- _normalizeComponentEncoding(components, protocol);
4377
- if (options.reference !== "suffix" && components.scheme) {
4378
- uriTokens.push(components.scheme);
4379
- uriTokens.push(":");
4380
- }
4381
- var authority = _recomposeAuthority(components, options);
4382
- if (authority !== undefined) {
4383
- if (options.reference !== "suffix") {
4384
- uriTokens.push("//");
4385
- }
4386
- uriTokens.push(authority);
4387
- if (components.path && components.path.charAt(0) !== "/") {
4388
- uriTokens.push("/");
4389
- }
4390
- }
4391
- if (components.path !== undefined) {
4392
- var s = components.path;
4393
- if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
4394
- s = removeDotSegments(s);
4395
- }
4396
- if (authority === undefined) {
4397
- s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
4398
- }
4399
- uriTokens.push(s);
4400
- }
4401
- if (components.query !== undefined) {
4402
- uriTokens.push("?");
4403
- uriTokens.push(components.query);
4404
- }
4405
- if (components.fragment !== undefined) {
4406
- uriTokens.push("#");
4407
- uriTokens.push(components.fragment);
4408
- }
4409
- return uriTokens.join(""); //merge tokens into a string
4410
- }
4002
+ /**
4003
+ * Converts a Punycode string representing a domain name or an email address
4004
+ * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
4005
+ * it doesn't matter if you call it on a string that has already been
4006
+ * converted to Unicode.
4007
+ * @memberOf punycode
4008
+ * @param {String} input The Punycoded domain name or email address to
4009
+ * convert to Unicode.
4010
+ * @returns {String} The Unicode representation of the given Punycode
4011
+ * string.
4012
+ */
4013
+ var toUnicode = function toUnicode(input) {
4014
+ return mapDomain(input, function (string) {
4015
+ return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
4016
+ });
4017
+ };
4411
4018
 
4412
- function resolveComponents(base, relative) {
4413
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
4414
- var skipNormalization = arguments[3];
4019
+ /**
4020
+ * Converts a Unicode string representing a domain name or an email address to
4021
+ * Punycode. Only the non-ASCII parts of the domain name will be converted,
4022
+ * i.e. it doesn't matter if you call it with a domain that's already in
4023
+ * ASCII.
4024
+ * @memberOf punycode
4025
+ * @param {String} input The domain name or email address to convert, as a
4026
+ * Unicode string.
4027
+ * @returns {String} The Punycode representation of the given domain name or
4028
+ * email address.
4029
+ */
4030
+ var toASCII = function toASCII(input) {
4031
+ return mapDomain(input, function (string) {
4032
+ return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
4033
+ });
4034
+ };
4035
+
4036
+ /*--------------------------------------------------------------------------*/
4037
+
4038
+ /** Define the public API */
4039
+ var punycode = {
4040
+ /**
4041
+ * A string representing the current Punycode.js version number.
4042
+ * @memberOf punycode
4043
+ * @type String
4044
+ */
4045
+ 'version': '2.1.0',
4046
+ /**
4047
+ * An object of methods to convert from JavaScript's internal character
4048
+ * representation (UCS-2) to Unicode code points, and back.
4049
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
4050
+ * @memberOf punycode
4051
+ * @type Object
4052
+ */
4053
+ 'ucs2': {
4054
+ 'decode': ucs2decode,
4055
+ 'encode': ucs2encode
4056
+ },
4057
+ 'decode': decode,
4058
+ 'encode': encode,
4059
+ 'toASCII': toASCII,
4060
+ 'toUnicode': toUnicode
4061
+ };
4415
4062
 
4416
- var target = {};
4417
- if (!skipNormalization) {
4418
- base = parse(serialize(base, options), options); //normalize base components
4419
- relative = parse(serialize(relative, options), options); //normalize relative components
4420
- }
4421
- options = options || {};
4422
- if (!options.tolerant && relative.scheme) {
4423
- target.scheme = relative.scheme;
4424
- //target.authority = relative.authority;
4425
- target.userinfo = relative.userinfo;
4426
- target.host = relative.host;
4427
- target.port = relative.port;
4428
- target.path = removeDotSegments(relative.path || "");
4429
- target.query = relative.query;
4430
- } else {
4431
- if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
4432
- //target.authority = relative.authority;
4433
- target.userinfo = relative.userinfo;
4434
- target.host = relative.host;
4435
- target.port = relative.port;
4436
- target.path = removeDotSegments(relative.path || "");
4437
- target.query = relative.query;
4438
- } else {
4439
- if (!relative.path) {
4440
- target.path = base.path;
4441
- if (relative.query !== undefined) {
4442
- target.query = relative.query;
4443
- } else {
4444
- target.query = base.query;
4445
- }
4446
- } else {
4447
- if (relative.path.charAt(0) === "/") {
4448
- target.path = removeDotSegments(relative.path);
4449
- } else {
4450
- if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
4451
- target.path = "/" + relative.path;
4452
- } else if (!base.path) {
4453
- target.path = relative.path;
4454
- } else {
4455
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
4456
- }
4457
- target.path = removeDotSegments(target.path);
4458
- }
4459
- target.query = relative.query;
4460
- }
4461
- //target.authority = base.authority;
4462
- target.userinfo = base.userinfo;
4463
- target.host = base.host;
4464
- target.port = base.port;
4465
- }
4466
- target.scheme = base.scheme;
4467
- }
4468
- target.fragment = relative.fragment;
4469
- return target;
4470
- }
4063
+ /**
4064
+ * URI.js
4065
+ *
4066
+ * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
4067
+ * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
4068
+ * @see http://github.com/garycourt/uri-js
4069
+ */
4070
+ /**
4071
+ * Copyright 2011 Gary Court. All rights reserved.
4072
+ *
4073
+ * Redistribution and use in source and binary forms, with or without modification, are
4074
+ * permitted provided that the following conditions are met:
4075
+ *
4076
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
4077
+ * conditions and the following disclaimer.
4078
+ *
4079
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
4080
+ * of conditions and the following disclaimer in the documentation and/or other materials
4081
+ * provided with the distribution.
4082
+ *
4083
+ * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
4084
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
4085
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
4086
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
4087
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
4088
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
4089
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
4090
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
4091
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4092
+ *
4093
+ * The views and conclusions contained in the software and documentation are those of the
4094
+ * authors and should not be interpreted as representing official policies, either expressed
4095
+ * or implied, of Gary Court.
4096
+ */
4097
+ var SCHEMES = {};
4098
+ function pctEncChar(chr) {
4099
+ var c = chr.charCodeAt(0);
4100
+ var e = void 0;
4101
+ 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();
4102
+ return e;
4103
+ }
4104
+ function pctDecChars(str) {
4105
+ var newStr = "";
4106
+ var i = 0;
4107
+ var il = str.length;
4108
+ while (i < il) {
4109
+ var c = parseInt(str.substr(i + 1, 2), 16);
4110
+ if (c < 128) {
4111
+ newStr += String.fromCharCode(c);
4112
+ i += 3;
4113
+ } else if (c >= 194 && c < 224) {
4114
+ if (il - i >= 6) {
4115
+ var c2 = parseInt(str.substr(i + 4, 2), 16);
4116
+ newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
4117
+ } else {
4118
+ newStr += str.substr(i, 6);
4119
+ }
4120
+ i += 6;
4121
+ } else if (c >= 224) {
4122
+ if (il - i >= 9) {
4123
+ var _c = parseInt(str.substr(i + 4, 2), 16);
4124
+ var c3 = parseInt(str.substr(i + 7, 2), 16);
4125
+ newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
4126
+ } else {
4127
+ newStr += str.substr(i, 9);
4128
+ }
4129
+ i += 9;
4130
+ } else {
4131
+ newStr += str.substr(i, 3);
4132
+ i += 3;
4133
+ }
4134
+ }
4135
+ return newStr;
4136
+ }
4137
+ function _normalizeComponentEncoding(components, protocol) {
4138
+ function decodeUnreserved(str) {
4139
+ var decStr = pctDecChars(str);
4140
+ return !decStr.match(protocol.UNRESERVED) ? str : decStr;
4141
+ }
4142
+ if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
4143
+ if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
4144
+ 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);
4145
+ 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);
4146
+ if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
4147
+ if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
4148
+ return components;
4149
+ }
4471
4150
 
4472
- function resolve(baseURI, relativeURI, options) {
4473
- var schemelessOptions = assign({ scheme: 'null' }, options);
4474
- return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
4475
- }
4151
+ function _stripLeadingZeros(str) {
4152
+ return str.replace(/^0*(.*)/, "$1") || "0";
4153
+ }
4154
+ function _normalizeIPv4(host, protocol) {
4155
+ var matches = host.match(protocol.IPV4ADDRESS) || [];
4476
4156
 
4477
- function normalize(uri, options) {
4478
- if (typeof uri === "string") {
4479
- uri = serialize(parse(uri, options), options);
4480
- } else if (typeOf(uri) === "object") {
4481
- uri = parse(serialize(uri, options), options);
4482
- }
4483
- return uri;
4484
- }
4157
+ var _matches = slicedToArray(matches, 2),
4158
+ address = _matches[1];
4485
4159
 
4486
- function equal(uriA, uriB, options) {
4487
- if (typeof uriA === "string") {
4488
- uriA = serialize(parse(uriA, options), options);
4489
- } else if (typeOf(uriA) === "object") {
4490
- uriA = serialize(uriA, options);
4491
- }
4492
- if (typeof uriB === "string") {
4493
- uriB = serialize(parse(uriB, options), options);
4494
- } else if (typeOf(uriB) === "object") {
4495
- uriB = serialize(uriB, options);
4496
- }
4497
- return uriA === uriB;
4498
- }
4160
+ if (address) {
4161
+ return address.split(".").map(_stripLeadingZeros).join(".");
4162
+ } else {
4163
+ return host;
4164
+ }
4165
+ }
4166
+ function _normalizeIPv6(host, protocol) {
4167
+ var matches = host.match(protocol.IPV6ADDRESS) || [];
4168
+
4169
+ var _matches2 = slicedToArray(matches, 3),
4170
+ address = _matches2[1],
4171
+ zone = _matches2[2];
4172
+
4173
+ if (address) {
4174
+ var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
4175
+ _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
4176
+ last = _address$toLowerCase$2[0],
4177
+ first = _address$toLowerCase$2[1];
4178
+
4179
+ var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
4180
+ var lastFields = last.split(":").map(_stripLeadingZeros);
4181
+ var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
4182
+ var fieldCount = isLastFieldIPv4Address ? 7 : 8;
4183
+ var lastFieldsStart = lastFields.length - fieldCount;
4184
+ var fields = Array(fieldCount);
4185
+ for (var x = 0; x < fieldCount; ++x) {
4186
+ fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
4187
+ }
4188
+ if (isLastFieldIPv4Address) {
4189
+ fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
4190
+ }
4191
+ var allZeroFields = fields.reduce(function (acc, field, index) {
4192
+ if (!field || field === "0") {
4193
+ var lastLongest = acc[acc.length - 1];
4194
+ if (lastLongest && lastLongest.index + lastLongest.length === index) {
4195
+ lastLongest.length++;
4196
+ } else {
4197
+ acc.push({ index: index, length: 1 });
4198
+ }
4199
+ }
4200
+ return acc;
4201
+ }, []);
4202
+ var longestZeroFields = allZeroFields.sort(function (a, b) {
4203
+ return b.length - a.length;
4204
+ })[0];
4205
+ var newHost = void 0;
4206
+ if (longestZeroFields && longestZeroFields.length > 1) {
4207
+ var newFirst = fields.slice(0, longestZeroFields.index);
4208
+ var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
4209
+ newHost = newFirst.join(":") + "::" + newLast.join(":");
4210
+ } else {
4211
+ newHost = fields.join(":");
4212
+ }
4213
+ if (zone) {
4214
+ newHost += "%" + zone;
4215
+ }
4216
+ return newHost;
4217
+ } else {
4218
+ return host;
4219
+ }
4220
+ }
4221
+ var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
4222
+ var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
4223
+ function parse(uriString) {
4224
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4225
+
4226
+ var components = {};
4227
+ var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
4228
+ if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
4229
+ var matches = uriString.match(URI_PARSE);
4230
+ if (matches) {
4231
+ if (NO_MATCH_IS_UNDEFINED) {
4232
+ //store each component
4233
+ components.scheme = matches[1];
4234
+ components.userinfo = matches[3];
4235
+ components.host = matches[4];
4236
+ components.port = parseInt(matches[5], 10);
4237
+ components.path = matches[6] || "";
4238
+ components.query = matches[7];
4239
+ components.fragment = matches[8];
4240
+ //fix port number
4241
+ if (isNaN(components.port)) {
4242
+ components.port = matches[5];
4243
+ }
4244
+ } else {
4245
+ //IE FIX for improper RegExp matching
4246
+ //store each component
4247
+ components.scheme = matches[1] || undefined;
4248
+ components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
4249
+ components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
4250
+ components.port = parseInt(matches[5], 10);
4251
+ components.path = matches[6] || "";
4252
+ components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
4253
+ components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
4254
+ //fix port number
4255
+ if (isNaN(components.port)) {
4256
+ components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
4257
+ }
4258
+ }
4259
+ if (components.host) {
4260
+ //normalize IP hosts
4261
+ components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
4262
+ }
4263
+ //determine reference type
4264
+ if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
4265
+ components.reference = "same-document";
4266
+ } else if (components.scheme === undefined) {
4267
+ components.reference = "relative";
4268
+ } else if (components.fragment === undefined) {
4269
+ components.reference = "absolute";
4270
+ } else {
4271
+ components.reference = "uri";
4272
+ }
4273
+ //check for reference errors
4274
+ if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
4275
+ components.error = components.error || "URI is not a " + options.reference + " reference.";
4276
+ }
4277
+ //find scheme handler
4278
+ var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
4279
+ //check if scheme can't handle IRIs
4280
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
4281
+ //if host component is a domain name
4282
+ if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
4283
+ //convert Unicode IDN -> ASCII IDN
4284
+ try {
4285
+ components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
4286
+ } catch (e) {
4287
+ components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
4288
+ }
4289
+ }
4290
+ //convert IRI -> URI
4291
+ _normalizeComponentEncoding(components, URI_PROTOCOL);
4292
+ } else {
4293
+ //normalize encodings
4294
+ _normalizeComponentEncoding(components, protocol);
4295
+ }
4296
+ //perform scheme specific parsing
4297
+ if (schemeHandler && schemeHandler.parse) {
4298
+ schemeHandler.parse(components, options);
4299
+ }
4300
+ } else {
4301
+ components.error = components.error || "URI can not be parsed.";
4302
+ }
4303
+ return components;
4304
+ }
4499
4305
 
4500
- function escapeComponent(str, options) {
4501
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
4502
- }
4306
+ function _recomposeAuthority(components, options) {
4307
+ var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
4308
+ var uriTokens = [];
4309
+ if (components.userinfo !== undefined) {
4310
+ uriTokens.push(components.userinfo);
4311
+ uriTokens.push("@");
4312
+ }
4313
+ if (components.host !== undefined) {
4314
+ //normalize IP hosts, add brackets and escape zone separator for IPv6
4315
+ uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
4316
+ return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
4317
+ }));
4318
+ }
4319
+ if (typeof components.port === "number" || typeof components.port === "string") {
4320
+ uriTokens.push(":");
4321
+ uriTokens.push(String(components.port));
4322
+ }
4323
+ return uriTokens.length ? uriTokens.join("") : undefined;
4324
+ }
4503
4325
 
4504
- function unescapeComponent(str, options) {
4505
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
4506
- }
4326
+ var RDS1 = /^\.\.?\//;
4327
+ var RDS2 = /^\/\.(\/|$)/;
4328
+ var RDS3 = /^\/\.\.(\/|$)/;
4329
+ var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
4330
+ function removeDotSegments(input) {
4331
+ var output = [];
4332
+ while (input.length) {
4333
+ if (input.match(RDS1)) {
4334
+ input = input.replace(RDS1, "");
4335
+ } else if (input.match(RDS2)) {
4336
+ input = input.replace(RDS2, "/");
4337
+ } else if (input.match(RDS3)) {
4338
+ input = input.replace(RDS3, "/");
4339
+ output.pop();
4340
+ } else if (input === "." || input === "..") {
4341
+ input = "";
4342
+ } else {
4343
+ var im = input.match(RDS5);
4344
+ if (im) {
4345
+ var s = im[0];
4346
+ input = input.slice(s.length);
4347
+ output.push(s);
4348
+ } else {
4349
+ throw new Error("Unexpected dot segment condition");
4350
+ }
4351
+ }
4352
+ }
4353
+ return output.join("");
4354
+ }
4507
4355
 
4508
- var handler = {
4509
- scheme: "http",
4510
- domainHost: true,
4511
- parse: function parse(components, options) {
4512
- //report missing host
4513
- if (!components.host) {
4514
- components.error = components.error || "HTTP URIs must have a host.";
4515
- }
4516
- return components;
4517
- },
4518
- serialize: function serialize(components, options) {
4519
- var secure = String(components.scheme).toLowerCase() === "https";
4520
- //normalize the default port
4521
- if (components.port === (secure ? 443 : 80) || components.port === "") {
4522
- components.port = undefined;
4523
- }
4524
- //normalize the empty path
4525
- if (!components.path) {
4526
- components.path = "/";
4527
- }
4528
- //NOTE: We do not parse query strings for HTTP URIs
4529
- //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
4530
- //and not the HTTP spec.
4531
- return components;
4532
- }
4533
- };
4356
+ function serialize(components) {
4357
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4358
+
4359
+ var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
4360
+ var uriTokens = [];
4361
+ //find scheme handler
4362
+ var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
4363
+ //perform scheme specific serialization
4364
+ if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
4365
+ if (components.host) {
4366
+ //if host component is an IPv6 address
4367
+ if (protocol.IPV6ADDRESS.test(components.host)) ;
4368
+ //TODO: normalize IPv6 address as per RFC 5952
4369
+
4370
+ //if host component is a domain name
4371
+ else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
4372
+ //convert IDN via punycode
4373
+ try {
4374
+ components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
4375
+ } catch (e) {
4376
+ components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
4377
+ }
4378
+ }
4379
+ }
4380
+ //normalize encoding
4381
+ _normalizeComponentEncoding(components, protocol);
4382
+ if (options.reference !== "suffix" && components.scheme) {
4383
+ uriTokens.push(components.scheme);
4384
+ uriTokens.push(":");
4385
+ }
4386
+ var authority = _recomposeAuthority(components, options);
4387
+ if (authority !== undefined) {
4388
+ if (options.reference !== "suffix") {
4389
+ uriTokens.push("//");
4390
+ }
4391
+ uriTokens.push(authority);
4392
+ if (components.path && components.path.charAt(0) !== "/") {
4393
+ uriTokens.push("/");
4394
+ }
4395
+ }
4396
+ if (components.path !== undefined) {
4397
+ var s = components.path;
4398
+ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
4399
+ s = removeDotSegments(s);
4400
+ }
4401
+ if (authority === undefined) {
4402
+ s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
4403
+ }
4404
+ uriTokens.push(s);
4405
+ }
4406
+ if (components.query !== undefined) {
4407
+ uriTokens.push("?");
4408
+ uriTokens.push(components.query);
4409
+ }
4410
+ if (components.fragment !== undefined) {
4411
+ uriTokens.push("#");
4412
+ uriTokens.push(components.fragment);
4413
+ }
4414
+ return uriTokens.join(""); //merge tokens into a string
4415
+ }
4534
4416
 
4535
- var handler$1 = {
4536
- scheme: "https",
4537
- domainHost: handler.domainHost,
4538
- parse: handler.parse,
4539
- serialize: handler.serialize
4540
- };
4417
+ function resolveComponents(base, relative) {
4418
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
4419
+ var skipNormalization = arguments[3];
4420
+
4421
+ var target = {};
4422
+ if (!skipNormalization) {
4423
+ base = parse(serialize(base, options), options); //normalize base components
4424
+ relative = parse(serialize(relative, options), options); //normalize relative components
4425
+ }
4426
+ options = options || {};
4427
+ if (!options.tolerant && relative.scheme) {
4428
+ target.scheme = relative.scheme;
4429
+ //target.authority = relative.authority;
4430
+ target.userinfo = relative.userinfo;
4431
+ target.host = relative.host;
4432
+ target.port = relative.port;
4433
+ target.path = removeDotSegments(relative.path || "");
4434
+ target.query = relative.query;
4435
+ } else {
4436
+ if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
4437
+ //target.authority = relative.authority;
4438
+ target.userinfo = relative.userinfo;
4439
+ target.host = relative.host;
4440
+ target.port = relative.port;
4441
+ target.path = removeDotSegments(relative.path || "");
4442
+ target.query = relative.query;
4443
+ } else {
4444
+ if (!relative.path) {
4445
+ target.path = base.path;
4446
+ if (relative.query !== undefined) {
4447
+ target.query = relative.query;
4448
+ } else {
4449
+ target.query = base.query;
4450
+ }
4451
+ } else {
4452
+ if (relative.path.charAt(0) === "/") {
4453
+ target.path = removeDotSegments(relative.path);
4454
+ } else {
4455
+ if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
4456
+ target.path = "/" + relative.path;
4457
+ } else if (!base.path) {
4458
+ target.path = relative.path;
4459
+ } else {
4460
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
4461
+ }
4462
+ target.path = removeDotSegments(target.path);
4463
+ }
4464
+ target.query = relative.query;
4465
+ }
4466
+ //target.authority = base.authority;
4467
+ target.userinfo = base.userinfo;
4468
+ target.host = base.host;
4469
+ target.port = base.port;
4470
+ }
4471
+ target.scheme = base.scheme;
4472
+ }
4473
+ target.fragment = relative.fragment;
4474
+ return target;
4475
+ }
4541
4476
 
4542
- function isSecure(wsComponents) {
4543
- return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
4544
- }
4545
- //RFC 6455
4546
- var handler$2 = {
4547
- scheme: "ws",
4548
- domainHost: true,
4549
- parse: function parse(components, options) {
4550
- var wsComponents = components;
4551
- //indicate if the secure flag is set
4552
- wsComponents.secure = isSecure(wsComponents);
4553
- //construct resouce name
4554
- wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
4555
- wsComponents.path = undefined;
4556
- wsComponents.query = undefined;
4557
- return wsComponents;
4558
- },
4559
- serialize: function serialize(wsComponents, options) {
4560
- //normalize the default port
4561
- if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
4562
- wsComponents.port = undefined;
4563
- }
4564
- //ensure scheme matches secure flag
4565
- if (typeof wsComponents.secure === 'boolean') {
4566
- wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
4567
- wsComponents.secure = undefined;
4568
- }
4569
- //reconstruct path from resource name
4570
- if (wsComponents.resourceName) {
4571
- var _wsComponents$resourc = wsComponents.resourceName.split('?'),
4572
- _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
4573
- path = _wsComponents$resourc2[0],
4574
- query = _wsComponents$resourc2[1];
4575
-
4576
- wsComponents.path = path && path !== '/' ? path : undefined;
4577
- wsComponents.query = query;
4578
- wsComponents.resourceName = undefined;
4579
- }
4580
- //forbid fragment component
4581
- wsComponents.fragment = undefined;
4582
- return wsComponents;
4583
- }
4584
- };
4477
+ function resolve(baseURI, relativeURI, options) {
4478
+ var schemelessOptions = assign({ scheme: 'null' }, options);
4479
+ return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
4480
+ }
4585
4481
 
4586
- var handler$3 = {
4587
- scheme: "wss",
4588
- domainHost: handler$2.domainHost,
4589
- parse: handler$2.parse,
4590
- serialize: handler$2.serialize
4591
- };
4482
+ function normalize(uri, options) {
4483
+ if (typeof uri === "string") {
4484
+ uri = serialize(parse(uri, options), options);
4485
+ } else if (typeOf(uri) === "object") {
4486
+ uri = parse(serialize(uri, options), options);
4487
+ }
4488
+ return uri;
4489
+ }
4592
4490
 
4593
- var O = {};
4594
- //RFC 3986
4595
- var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
4596
- var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
4597
- var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
4598
- //RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
4599
- //const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
4600
- //const WSP$$ = "[\\x20\\x09]";
4601
- //const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
4602
- //const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
4603
- //const VCHAR$$ = "[\\x21-\\x7E]";
4604
- //const WSP$$ = "[\\x20\\x09]";
4605
- //const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
4606
- //const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
4607
- //const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
4608
- //const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
4609
- var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
4610
- var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
4611
- var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
4612
- var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
4613
- var UNRESERVED = new RegExp(UNRESERVED$$, "g");
4614
- var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
4615
- var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
4616
- var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
4617
- var NOT_HFVALUE = NOT_HFNAME;
4618
- function decodeUnreserved(str) {
4619
- var decStr = pctDecChars(str);
4620
- return !decStr.match(UNRESERVED) ? str : decStr;
4621
- }
4622
- var handler$4 = {
4623
- scheme: "mailto",
4624
- parse: function parse$$1(components, options) {
4625
- var mailtoComponents = components;
4626
- var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
4627
- mailtoComponents.path = undefined;
4628
- if (mailtoComponents.query) {
4629
- var unknownHeaders = false;
4630
- var headers = {};
4631
- var hfields = mailtoComponents.query.split("&");
4632
- for (var x = 0, xl = hfields.length; x < xl; ++x) {
4633
- var hfield = hfields[x].split("=");
4634
- switch (hfield[0]) {
4635
- case "to":
4636
- var toAddrs = hfield[1].split(",");
4637
- for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
4638
- to.push(toAddrs[_x]);
4639
- }
4640
- break;
4641
- case "subject":
4642
- mailtoComponents.subject = unescapeComponent(hfield[1], options);
4643
- break;
4644
- case "body":
4645
- mailtoComponents.body = unescapeComponent(hfield[1], options);
4646
- break;
4647
- default:
4648
- unknownHeaders = true;
4649
- headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
4650
- break;
4651
- }
4652
- }
4653
- if (unknownHeaders) mailtoComponents.headers = headers;
4654
- }
4655
- mailtoComponents.query = undefined;
4656
- for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
4657
- var addr = to[_x2].split("@");
4658
- addr[0] = unescapeComponent(addr[0]);
4659
- if (!options.unicodeSupport) {
4660
- //convert Unicode IDN -> ASCII IDN
4661
- try {
4662
- addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
4663
- } catch (e) {
4664
- mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
4665
- }
4666
- } else {
4667
- addr[1] = unescapeComponent(addr[1], options).toLowerCase();
4668
- }
4669
- to[_x2] = addr.join("@");
4670
- }
4671
- return mailtoComponents;
4672
- },
4673
- serialize: function serialize$$1(mailtoComponents, options) {
4674
- var components = mailtoComponents;
4675
- var to = toArray(mailtoComponents.to);
4676
- if (to) {
4677
- for (var x = 0, xl = to.length; x < xl; ++x) {
4678
- var toAddr = String(to[x]);
4679
- var atIdx = toAddr.lastIndexOf("@");
4680
- var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
4681
- var domain = toAddr.slice(atIdx + 1);
4682
- //convert IDN via punycode
4683
- try {
4684
- domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
4685
- } catch (e) {
4686
- components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
4687
- }
4688
- to[x] = localPart + "@" + domain;
4689
- }
4690
- components.path = to.join(",");
4691
- }
4692
- var headers = mailtoComponents.headers = mailtoComponents.headers || {};
4693
- if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
4694
- if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
4695
- var fields = [];
4696
- for (var name in headers) {
4697
- if (headers[name] !== O[name]) {
4698
- 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));
4699
- }
4700
- }
4701
- if (fields.length) {
4702
- components.query = fields.join("&");
4703
- }
4704
- return components;
4705
- }
4706
- };
4491
+ function equal(uriA, uriB, options) {
4492
+ if (typeof uriA === "string") {
4493
+ uriA = serialize(parse(uriA, options), options);
4494
+ } else if (typeOf(uriA) === "object") {
4495
+ uriA = serialize(uriA, options);
4496
+ }
4497
+ if (typeof uriB === "string") {
4498
+ uriB = serialize(parse(uriB, options), options);
4499
+ } else if (typeOf(uriB) === "object") {
4500
+ uriB = serialize(uriB, options);
4501
+ }
4502
+ return uriA === uriB;
4503
+ }
4707
4504
 
4708
- var URN_PARSE = /^([^\:]+)\:(.*)/;
4709
- //RFC 2141
4710
- var handler$5 = {
4711
- scheme: "urn",
4712
- parse: function parse$$1(components, options) {
4713
- var matches = components.path && components.path.match(URN_PARSE);
4714
- var urnComponents = components;
4715
- if (matches) {
4716
- var scheme = options.scheme || urnComponents.scheme || "urn";
4717
- var nid = matches[1].toLowerCase();
4718
- var nss = matches[2];
4719
- var urnScheme = scheme + ":" + (options.nid || nid);
4720
- var schemeHandler = SCHEMES[urnScheme];
4721
- urnComponents.nid = nid;
4722
- urnComponents.nss = nss;
4723
- urnComponents.path = undefined;
4724
- if (schemeHandler) {
4725
- urnComponents = schemeHandler.parse(urnComponents, options);
4726
- }
4727
- } else {
4728
- urnComponents.error = urnComponents.error || "URN can not be parsed.";
4729
- }
4730
- return urnComponents;
4731
- },
4732
- serialize: function serialize$$1(urnComponents, options) {
4733
- var scheme = options.scheme || urnComponents.scheme || "urn";
4734
- var nid = urnComponents.nid;
4735
- var urnScheme = scheme + ":" + (options.nid || nid);
4736
- var schemeHandler = SCHEMES[urnScheme];
4737
- if (schemeHandler) {
4738
- urnComponents = schemeHandler.serialize(urnComponents, options);
4739
- }
4740
- var uriComponents = urnComponents;
4741
- var nss = urnComponents.nss;
4742
- uriComponents.path = (nid || options.nid) + ":" + nss;
4743
- return uriComponents;
4744
- }
4745
- };
4505
+ function escapeComponent(str, options) {
4506
+ return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
4507
+ }
4746
4508
 
4747
- var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
4748
- //RFC 4122
4749
- var handler$6 = {
4750
- scheme: "urn:uuid",
4751
- parse: function parse(urnComponents, options) {
4752
- var uuidComponents = urnComponents;
4753
- uuidComponents.uuid = uuidComponents.nss;
4754
- uuidComponents.nss = undefined;
4755
- if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
4756
- uuidComponents.error = uuidComponents.error || "UUID is not valid.";
4757
- }
4758
- return uuidComponents;
4759
- },
4760
- serialize: function serialize(uuidComponents, options) {
4761
- var urnComponents = uuidComponents;
4762
- //normalize UUID
4763
- urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
4764
- return urnComponents;
4765
- }
4766
- };
4509
+ function unescapeComponent(str, options) {
4510
+ return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
4511
+ }
4767
4512
 
4768
- SCHEMES[handler.scheme] = handler;
4769
- SCHEMES[handler$1.scheme] = handler$1;
4770
- SCHEMES[handler$2.scheme] = handler$2;
4771
- SCHEMES[handler$3.scheme] = handler$3;
4772
- SCHEMES[handler$4.scheme] = handler$4;
4773
- SCHEMES[handler$5.scheme] = handler$5;
4774
- SCHEMES[handler$6.scheme] = handler$6;
4775
-
4776
- exports.SCHEMES = SCHEMES;
4777
- exports.pctEncChar = pctEncChar;
4778
- exports.pctDecChars = pctDecChars;
4779
- exports.parse = parse;
4780
- exports.removeDotSegments = removeDotSegments;
4781
- exports.serialize = serialize;
4782
- exports.resolveComponents = resolveComponents;
4783
- exports.resolve = resolve;
4784
- exports.normalize = normalize;
4785
- exports.equal = equal;
4786
- exports.escapeComponent = escapeComponent;
4787
- exports.unescapeComponent = unescapeComponent;
4788
-
4789
- Object.defineProperty(exports, '__esModule', { value: true });
4790
-
4791
- })));
4792
-
4793
- }(uri_all, uri_all.exports));
4513
+ var handler = {
4514
+ scheme: "http",
4515
+ domainHost: true,
4516
+ parse: function parse(components, options) {
4517
+ //report missing host
4518
+ if (!components.host) {
4519
+ components.error = components.error || "HTTP URIs must have a host.";
4520
+ }
4521
+ return components;
4522
+ },
4523
+ serialize: function serialize(components, options) {
4524
+ var secure = String(components.scheme).toLowerCase() === "https";
4525
+ //normalize the default port
4526
+ if (components.port === (secure ? 443 : 80) || components.port === "") {
4527
+ components.port = undefined;
4528
+ }
4529
+ //normalize the empty path
4530
+ if (!components.path) {
4531
+ components.path = "/";
4532
+ }
4533
+ //NOTE: We do not parse query strings for HTTP URIs
4534
+ //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
4535
+ //and not the HTTP spec.
4536
+ return components;
4537
+ }
4538
+ };
4539
+
4540
+ var handler$1 = {
4541
+ scheme: "https",
4542
+ domainHost: handler.domainHost,
4543
+ parse: handler.parse,
4544
+ serialize: handler.serialize
4545
+ };
4546
+
4547
+ function isSecure(wsComponents) {
4548
+ return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
4549
+ }
4550
+ //RFC 6455
4551
+ var handler$2 = {
4552
+ scheme: "ws",
4553
+ domainHost: true,
4554
+ parse: function parse(components, options) {
4555
+ var wsComponents = components;
4556
+ //indicate if the secure flag is set
4557
+ wsComponents.secure = isSecure(wsComponents);
4558
+ //construct resouce name
4559
+ wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
4560
+ wsComponents.path = undefined;
4561
+ wsComponents.query = undefined;
4562
+ return wsComponents;
4563
+ },
4564
+ serialize: function serialize(wsComponents, options) {
4565
+ //normalize the default port
4566
+ if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
4567
+ wsComponents.port = undefined;
4568
+ }
4569
+ //ensure scheme matches secure flag
4570
+ if (typeof wsComponents.secure === 'boolean') {
4571
+ wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
4572
+ wsComponents.secure = undefined;
4573
+ }
4574
+ //reconstruct path from resource name
4575
+ if (wsComponents.resourceName) {
4576
+ var _wsComponents$resourc = wsComponents.resourceName.split('?'),
4577
+ _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
4578
+ path = _wsComponents$resourc2[0],
4579
+ query = _wsComponents$resourc2[1];
4580
+
4581
+ wsComponents.path = path && path !== '/' ? path : undefined;
4582
+ wsComponents.query = query;
4583
+ wsComponents.resourceName = undefined;
4584
+ }
4585
+ //forbid fragment component
4586
+ wsComponents.fragment = undefined;
4587
+ return wsComponents;
4588
+ }
4589
+ };
4590
+
4591
+ var handler$3 = {
4592
+ scheme: "wss",
4593
+ domainHost: handler$2.domainHost,
4594
+ parse: handler$2.parse,
4595
+ serialize: handler$2.serialize
4596
+ };
4597
+
4598
+ var O = {};
4599
+ //RFC 3986
4600
+ var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
4601
+ var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
4602
+ var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
4603
+ //RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
4604
+ //const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
4605
+ //const WSP$$ = "[\\x20\\x09]";
4606
+ //const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
4607
+ //const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
4608
+ //const VCHAR$$ = "[\\x21-\\x7E]";
4609
+ //const WSP$$ = "[\\x20\\x09]";
4610
+ //const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
4611
+ //const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
4612
+ //const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
4613
+ //const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
4614
+ var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
4615
+ var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
4616
+ var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
4617
+ var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
4618
+ var UNRESERVED = new RegExp(UNRESERVED$$, "g");
4619
+ var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
4620
+ var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
4621
+ var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
4622
+ var NOT_HFVALUE = NOT_HFNAME;
4623
+ function decodeUnreserved(str) {
4624
+ var decStr = pctDecChars(str);
4625
+ return !decStr.match(UNRESERVED) ? str : decStr;
4626
+ }
4627
+ var handler$4 = {
4628
+ scheme: "mailto",
4629
+ parse: function parse$$1(components, options) {
4630
+ var mailtoComponents = components;
4631
+ var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
4632
+ mailtoComponents.path = undefined;
4633
+ if (mailtoComponents.query) {
4634
+ var unknownHeaders = false;
4635
+ var headers = {};
4636
+ var hfields = mailtoComponents.query.split("&");
4637
+ for (var x = 0, xl = hfields.length; x < xl; ++x) {
4638
+ var hfield = hfields[x].split("=");
4639
+ switch (hfield[0]) {
4640
+ case "to":
4641
+ var toAddrs = hfield[1].split(",");
4642
+ for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
4643
+ to.push(toAddrs[_x]);
4644
+ }
4645
+ break;
4646
+ case "subject":
4647
+ mailtoComponents.subject = unescapeComponent(hfield[1], options);
4648
+ break;
4649
+ case "body":
4650
+ mailtoComponents.body = unescapeComponent(hfield[1], options);
4651
+ break;
4652
+ default:
4653
+ unknownHeaders = true;
4654
+ headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
4655
+ break;
4656
+ }
4657
+ }
4658
+ if (unknownHeaders) mailtoComponents.headers = headers;
4659
+ }
4660
+ mailtoComponents.query = undefined;
4661
+ for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
4662
+ var addr = to[_x2].split("@");
4663
+ addr[0] = unescapeComponent(addr[0]);
4664
+ if (!options.unicodeSupport) {
4665
+ //convert Unicode IDN -> ASCII IDN
4666
+ try {
4667
+ addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
4668
+ } catch (e) {
4669
+ mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
4670
+ }
4671
+ } else {
4672
+ addr[1] = unescapeComponent(addr[1], options).toLowerCase();
4673
+ }
4674
+ to[_x2] = addr.join("@");
4675
+ }
4676
+ return mailtoComponents;
4677
+ },
4678
+ serialize: function serialize$$1(mailtoComponents, options) {
4679
+ var components = mailtoComponents;
4680
+ var to = toArray(mailtoComponents.to);
4681
+ if (to) {
4682
+ for (var x = 0, xl = to.length; x < xl; ++x) {
4683
+ var toAddr = String(to[x]);
4684
+ var atIdx = toAddr.lastIndexOf("@");
4685
+ var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
4686
+ var domain = toAddr.slice(atIdx + 1);
4687
+ //convert IDN via punycode
4688
+ try {
4689
+ domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
4690
+ } catch (e) {
4691
+ components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
4692
+ }
4693
+ to[x] = localPart + "@" + domain;
4694
+ }
4695
+ components.path = to.join(",");
4696
+ }
4697
+ var headers = mailtoComponents.headers = mailtoComponents.headers || {};
4698
+ if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
4699
+ if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
4700
+ var fields = [];
4701
+ for (var name in headers) {
4702
+ if (headers[name] !== O[name]) {
4703
+ 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));
4704
+ }
4705
+ }
4706
+ if (fields.length) {
4707
+ components.query = fields.join("&");
4708
+ }
4709
+ return components;
4710
+ }
4711
+ };
4712
+
4713
+ var URN_PARSE = /^([^\:]+)\:(.*)/;
4714
+ //RFC 2141
4715
+ var handler$5 = {
4716
+ scheme: "urn",
4717
+ parse: function parse$$1(components, options) {
4718
+ var matches = components.path && components.path.match(URN_PARSE);
4719
+ var urnComponents = components;
4720
+ if (matches) {
4721
+ var scheme = options.scheme || urnComponents.scheme || "urn";
4722
+ var nid = matches[1].toLowerCase();
4723
+ var nss = matches[2];
4724
+ var urnScheme = scheme + ":" + (options.nid || nid);
4725
+ var schemeHandler = SCHEMES[urnScheme];
4726
+ urnComponents.nid = nid;
4727
+ urnComponents.nss = nss;
4728
+ urnComponents.path = undefined;
4729
+ if (schemeHandler) {
4730
+ urnComponents = schemeHandler.parse(urnComponents, options);
4731
+ }
4732
+ } else {
4733
+ urnComponents.error = urnComponents.error || "URN can not be parsed.";
4734
+ }
4735
+ return urnComponents;
4736
+ },
4737
+ serialize: function serialize$$1(urnComponents, options) {
4738
+ var scheme = options.scheme || urnComponents.scheme || "urn";
4739
+ var nid = urnComponents.nid;
4740
+ var urnScheme = scheme + ":" + (options.nid || nid);
4741
+ var schemeHandler = SCHEMES[urnScheme];
4742
+ if (schemeHandler) {
4743
+ urnComponents = schemeHandler.serialize(urnComponents, options);
4744
+ }
4745
+ var uriComponents = urnComponents;
4746
+ var nss = urnComponents.nss;
4747
+ uriComponents.path = (nid || options.nid) + ":" + nss;
4748
+ return uriComponents;
4749
+ }
4750
+ };
4751
+
4752
+ var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
4753
+ //RFC 4122
4754
+ var handler$6 = {
4755
+ scheme: "urn:uuid",
4756
+ parse: function parse(urnComponents, options) {
4757
+ var uuidComponents = urnComponents;
4758
+ uuidComponents.uuid = uuidComponents.nss;
4759
+ uuidComponents.nss = undefined;
4760
+ if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
4761
+ uuidComponents.error = uuidComponents.error || "UUID is not valid.";
4762
+ }
4763
+ return uuidComponents;
4764
+ },
4765
+ serialize: function serialize(uuidComponents, options) {
4766
+ var urnComponents = uuidComponents;
4767
+ //normalize UUID
4768
+ urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
4769
+ return urnComponents;
4770
+ }
4771
+ };
4772
+
4773
+ SCHEMES[handler.scheme] = handler;
4774
+ SCHEMES[handler$1.scheme] = handler$1;
4775
+ SCHEMES[handler$2.scheme] = handler$2;
4776
+ SCHEMES[handler$3.scheme] = handler$3;
4777
+ SCHEMES[handler$4.scheme] = handler$4;
4778
+ SCHEMES[handler$5.scheme] = handler$5;
4779
+ SCHEMES[handler$6.scheme] = handler$6;
4780
+
4781
+ exports.SCHEMES = SCHEMES;
4782
+ exports.pctEncChar = pctEncChar;
4783
+ exports.pctDecChars = pctDecChars;
4784
+ exports.parse = parse;
4785
+ exports.removeDotSegments = removeDotSegments;
4786
+ exports.serialize = serialize;
4787
+ exports.resolveComponents = resolveComponents;
4788
+ exports.resolve = resolve;
4789
+ exports.normalize = normalize;
4790
+ exports.equal = equal;
4791
+ exports.escapeComponent = escapeComponent;
4792
+ exports.unescapeComponent = unescapeComponent;
4793
+
4794
+ Object.defineProperty(exports, '__esModule', { value: true });
4795
+
4796
+ })));
4797
+
4798
+ } (uri_all, uri_all.exports));
4799
+
4800
+ var uri_allExports = uri_all.exports;
4794
4801
 
4795
4802
  // do not edit .js files directly - edit src/index.jst
4796
4803
 
@@ -5191,11 +5198,13 @@
5191
5198
  return str.replace(/~/g, '~0').replace(/\//g, '~1');
5192
5199
  }
5193
5200
 
5194
- var URI$1 = uri_all.exports
5201
+ var jsonSchemaTraverseExports = jsonSchemaTraverse.exports;
5202
+
5203
+ var URI$1 = uri_allExports
5195
5204
  , equal$1 = fastDeepEqual
5196
5205
  , util$3 = util$5
5197
5206
  , SchemaObject$1 = schema_obj
5198
- , traverse = jsonSchemaTraverse.exports;
5207
+ , traverse = jsonSchemaTraverseExports;
5199
5208
 
5200
5209
  var resolve_1 = resolve$3;
5201
5210
 
@@ -6445,6 +6454,8 @@
6445
6454
  this._cache = {};
6446
6455
  };
6447
6456
 
6457
+ var cacheExports = cache.exports;
6458
+
6448
6459
  var util$1 = util$5;
6449
6460
 
6450
6461
  var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
@@ -10011,7 +10022,7 @@
10011
10022
 
10012
10023
  var compileSchema = compile_1
10013
10024
  , resolve = resolve_1
10014
- , Cache = cache.exports
10025
+ , Cache = cacheExports
10015
10026
  , SchemaObject = schema_obj
10016
10027
  , stableStringify = fastJsonStableStringify
10017
10028
  , formats = formats_1
@@ -10514,9 +10525,11 @@
10514
10525
 
10515
10526
  function noop() {}
10516
10527
 
10528
+ var ajv$1 = /*@__PURE__*/getDefaultExportFromCjs(ajv);
10529
+
10517
10530
  var _Ajv = /*#__PURE__*/_mergeNamespaces$1({
10518
10531
  __proto__: null,
10519
- 'default': ajv
10532
+ default: ajv$1
10520
10533
  }, [ajv]);
10521
10534
 
10522
10535
  var $ref = "#/definitions/Schema";
@@ -12099,11 +12112,11 @@
12099
12112
  __proto__: null,
12100
12113
  $ref: $ref,
12101
12114
  $schema: $schema,
12102
- definitions: definitions,
12103
- 'default': v2
12115
+ default: v2,
12116
+ definitions: definitions
12104
12117
  });
12105
12118
 
12106
- var Ajv = ajv || _Ajv;
12119
+ var Ajv = ajv$1 || _Ajv;
12107
12120
  var ddl2Schema = _ddl2Schema;
12108
12121
  var options = {
12109
12122
  allErrors: false,
@@ -17594,7 +17607,7 @@
17594
17607
  }(phosphor.SplitPanel));
17595
17608
  Dashy.prototype._class += " composite_Dashy";
17596
17609
 
17597
- Object.defineProperty(exports, 'hookSend', {
17610
+ Object.defineProperty(exports, "hookSend", {
17598
17611
  enumerable: true,
17599
17612
  get: function () { return comms.hookSend; }
17600
17613
  });
@@ -17660,7 +17673,5 @@
17660
17673
  exports.stringify = stringify;
17661
17674
  exports.wsEclSchemaRow2IField = wsEclSchemaRow2IField;
17662
17675
 
17663
- Object.defineProperty(exports, '__esModule', { value: true });
17664
-
17665
17676
  }));
17666
17677
  //# sourceMappingURL=index.js.map