@hpcc-js/ddl-shim 2.20.6 → 2.21.0

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.es6.js CHANGED
@@ -14,8 +14,8 @@ function _mergeNamespaces(n, m) {
14
14
  }
15
15
 
16
16
  var PKG_NAME = "@hpcc-js/ddl-shim";
17
- var PKG_VERSION = "2.20.6";
18
- var BUILD_VERSION = "2.104.30";
17
+ var PKG_VERSION = "2.21.0";
18
+ var BUILD_VERSION = "2.106.0";
19
19
 
20
20
  function isWorkunitDatasource(ref) {
21
21
  return ref.WUID !== undefined;
@@ -62,20 +62,20 @@ function isGeohashMapping(mappings) {
62
62
 
63
63
  var v1 = /*#__PURE__*/Object.freeze({
64
64
  __proto__: null,
65
- isWorkunitDatasource: isWorkunitDatasource,
65
+ isChoroVisualization: isChoroVisualization,
66
66
  isDatabombDatasource: isDatabombDatasource,
67
+ isFormVisualization: isFormVisualization,
68
+ isGeohashMapping: isGeohashMapping,
69
+ isGraphVisualization: isGraphVisualization,
70
+ isHeatMapVisualization: isHeatMapVisualization,
67
71
  isHipieDatasource: isHipieDatasource,
68
- isPieVisualization: isPieVisualization,
69
72
  isLineVisualization: isLineVisualization,
70
- isChoroVisualization: isChoroVisualization,
71
- isTableVisualization: isTableVisualization,
73
+ isPieVisualization: isPieVisualization,
72
74
  isSliderVisualization: isSliderVisualization,
73
- isGraphVisualization: isGraphVisualization,
74
- isHeatMapVisualization: isHeatMapVisualization,
75
- isFormVisualization: isFormVisualization,
76
- isUSStateMapping: isUSStateMapping,
75
+ isTableVisualization: isTableVisualization,
77
76
  isUSCountyMapping: isUSCountyMapping,
78
- isGeohashMapping: isGeohashMapping
77
+ isUSStateMapping: isUSStateMapping,
78
+ isWorkunitDatasource: isWorkunitDatasource
79
79
  });
80
80
 
81
81
  function isDatabombRef(ref) {
@@ -112,17 +112,17 @@ var VisibilitySet = ["normal", "flyout"];
112
112
 
113
113
  var v2$1 = /*#__PURE__*/Object.freeze({
114
114
  __proto__: null,
115
+ VisibilitySet: VisibilitySet,
115
116
  isDatabombRef: isDatabombRef,
116
- isWUResultRef: isWUResultRef,
117
- isRoxieServiceRef: isRoxieServiceRef,
118
- isIFilterCondition: isIFilterCondition,
119
117
  isFilterActivity: isFilterActivity,
120
- isProjectActivity: isProjectActivity,
121
- isMappingsActivity: isMappingsActivity,
122
118
  isGroupByActivity: isGroupByActivity,
123
- isSortActivity: isSortActivity,
119
+ isIFilterCondition: isIFilterCondition,
124
120
  isLimitActivity: isLimitActivity,
125
- VisibilitySet: VisibilitySet
121
+ isMappingsActivity: isMappingsActivity,
122
+ isProjectActivity: isProjectActivity,
123
+ isRoxieServiceRef: isRoxieServiceRef,
124
+ isSortActivity: isSortActivity,
125
+ isWUResultRef: isWUResultRef
126
126
  });
127
127
 
128
128
  /******************************************************************************
@@ -139,6 +139,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
139
139
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
140
140
  PERFORMANCE OF THIS SOFTWARE.
141
141
  ***************************************************************************** */
142
+ /* global Reflect, Promise, SuppressedError, Symbol */
143
+
142
144
 
143
145
  var __assign = function() {
144
146
  __assign = Object.assign || function __assign(t) {
@@ -1091,159 +1093,162 @@ function upgrade(ddl, baseUrl, wuid, toLowerCase, dermatologyJson) {
1091
1093
 
1092
1094
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1093
1095
 
1096
+ function getDefaultExportFromCjs (x) {
1097
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1098
+ }
1099
+
1094
1100
  var uri_all = {exports: {}};
1095
1101
 
1096
1102
  /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
1097
1103
 
1098
1104
  (function (module, exports) {
1099
- (function (global, factory) {
1100
- factory(exports) ;
1101
- }(commonjsGlobal, (function (exports) {
1102
- function merge() {
1103
- for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
1104
- sets[_key] = arguments[_key];
1105
- }
1106
-
1107
- if (sets.length > 1) {
1108
- sets[0] = sets[0].slice(0, -1);
1109
- var xl = sets.length - 1;
1110
- for (var x = 1; x < xl; ++x) {
1111
- sets[x] = sets[x].slice(1, -1);
1112
- }
1113
- sets[xl] = sets[xl].slice(1);
1114
- return sets.join('');
1115
- } else {
1116
- return sets[0];
1117
- }
1118
- }
1119
- function subexp(str) {
1120
- return "(?:" + str + ")";
1121
- }
1122
- function typeOf(o) {
1123
- return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
1124
- }
1125
- function toUpperCase(str) {
1126
- return str.toUpperCase();
1127
- }
1128
- function toArray(obj) {
1129
- 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) : [];
1130
- }
1131
- function assign(target, source) {
1132
- var obj = target;
1133
- if (source) {
1134
- for (var key in source) {
1135
- obj[key] = source[key];
1136
- }
1137
- }
1138
- return obj;
1139
- }
1140
-
1141
- function buildExps(isIRI) {
1142
- var ALPHA$$ = "[A-Za-z]",
1143
- DIGIT$$ = "[0-9]",
1144
- HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
1145
- PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
1146
- //expanded
1147
- GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
1148
- SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
1149
- RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
1150
- UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
1151
- //subset, excludes bidi control characters
1152
- IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
1153
- //subset
1154
- UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
1155
- subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
1156
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
1157
- 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$$),
1158
- //relaxed parsing rules
1159
- IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
1160
- H16$ = subexp(HEXDIG$$ + "{1,4}"),
1161
- LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
1162
- IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
1163
- // 6( h16 ":" ) ls32
1164
- IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
1165
- // "::" 5( h16 ":" ) ls32
1166
- IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
1167
- //[ h16 ] "::" 4( h16 ":" ) ls32
1168
- IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
1169
- //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
1170
- IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
1171
- //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
1172
- IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
1173
- //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
1174
- IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
1175
- //[ *4( h16 ":" ) h16 ] "::" ls32
1176
- IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
1177
- //[ *5( h16 ":" ) h16 ] "::" h16
1178
- IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
1179
- //[ *6( h16 ":" ) h16 ] "::"
1180
- IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
1181
- ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
1182
- //RFC 6874, with relaxed parsing rules
1183
- subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
1184
- //RFC 6874
1185
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
1186
- var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
1187
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
1188
- subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
1189
- return {
1190
- NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
1191
- NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1192
- NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1193
- NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1194
- NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1195
- NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
1196
- NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
1197
- ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1198
- UNRESERVED: new RegExp(UNRESERVED$$, "g"),
1199
- OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
1200
- PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
1201
- IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
1202
- IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
1203
- };
1204
- }
1205
- var URI_PROTOCOL = buildExps(false);
1105
+ (function (global, factory) {
1106
+ factory(exports) ;
1107
+ }(commonjsGlobal, (function (exports) {
1108
+ function merge() {
1109
+ for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
1110
+ sets[_key] = arguments[_key];
1111
+ }
1112
+
1113
+ if (sets.length > 1) {
1114
+ sets[0] = sets[0].slice(0, -1);
1115
+ var xl = sets.length - 1;
1116
+ for (var x = 1; x < xl; ++x) {
1117
+ sets[x] = sets[x].slice(1, -1);
1118
+ }
1119
+ sets[xl] = sets[xl].slice(1);
1120
+ return sets.join('');
1121
+ } else {
1122
+ return sets[0];
1123
+ }
1124
+ }
1125
+ function subexp(str) {
1126
+ return "(?:" + str + ")";
1127
+ }
1128
+ function typeOf(o) {
1129
+ return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
1130
+ }
1131
+ function toUpperCase(str) {
1132
+ return str.toUpperCase();
1133
+ }
1134
+ function toArray(obj) {
1135
+ 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) : [];
1136
+ }
1137
+ function assign(target, source) {
1138
+ var obj = target;
1139
+ if (source) {
1140
+ for (var key in source) {
1141
+ obj[key] = source[key];
1142
+ }
1143
+ }
1144
+ return obj;
1145
+ }
1206
1146
 
1207
- var IRI_PROTOCOL = buildExps(true);
1147
+ function buildExps(isIRI) {
1148
+ var ALPHA$$ = "[A-Za-z]",
1149
+ DIGIT$$ = "[0-9]",
1150
+ HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
1151
+ PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
1152
+ //expanded
1153
+ GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
1154
+ SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
1155
+ RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
1156
+ UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
1157
+ //subset, excludes bidi control characters
1158
+ IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
1159
+ //subset
1160
+ UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
1161
+ subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
1162
+ subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
1163
+ 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$$),
1164
+ //relaxed parsing rules
1165
+ IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
1166
+ H16$ = subexp(HEXDIG$$ + "{1,4}"),
1167
+ LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
1168
+ IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
1169
+ // 6( h16 ":" ) ls32
1170
+ IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
1171
+ // "::" 5( h16 ":" ) ls32
1172
+ IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
1173
+ //[ h16 ] "::" 4( h16 ":" ) ls32
1174
+ IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
1175
+ //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
1176
+ IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
1177
+ //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
1178
+ IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
1179
+ //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
1180
+ IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
1181
+ //[ *4( h16 ":" ) h16 ] "::" ls32
1182
+ IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
1183
+ //[ *5( h16 ":" ) h16 ] "::" h16
1184
+ IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
1185
+ //[ *6( h16 ":" ) h16 ] "::"
1186
+ IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
1187
+ ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
1188
+ //RFC 6874, with relaxed parsing rules
1189
+ subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
1190
+ //RFC 6874
1191
+ subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
1192
+ var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
1193
+ subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
1194
+ subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
1195
+ return {
1196
+ NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
1197
+ NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1198
+ NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1199
+ NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1200
+ NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1201
+ NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
1202
+ NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
1203
+ ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1204
+ UNRESERVED: new RegExp(UNRESERVED$$, "g"),
1205
+ OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
1206
+ PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
1207
+ IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
1208
+ IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
1209
+ };
1210
+ }
1211
+ var URI_PROTOCOL = buildExps(false);
1208
1212
 
1209
- var slicedToArray = function () {
1210
- function sliceIterator(arr, i) {
1211
- var _arr = [];
1212
- var _n = true;
1213
- var _d = false;
1214
- var _e = undefined;
1213
+ var IRI_PROTOCOL = buildExps(true);
1215
1214
 
1216
- try {
1217
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
1218
- _arr.push(_s.value);
1215
+ var slicedToArray = function () {
1216
+ function sliceIterator(arr, i) {
1217
+ var _arr = [];
1218
+ var _n = true;
1219
+ var _d = false;
1220
+ var _e = undefined;
1219
1221
 
1220
- if (i && _arr.length === i) break;
1221
- }
1222
- } catch (err) {
1223
- _d = true;
1224
- _e = err;
1225
- } finally {
1226
- try {
1227
- if (!_n && _i["return"]) _i["return"]();
1228
- } finally {
1229
- if (_d) throw _e;
1230
- }
1231
- }
1222
+ try {
1223
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
1224
+ _arr.push(_s.value);
1232
1225
 
1233
- return _arr;
1234
- }
1226
+ if (i && _arr.length === i) break;
1227
+ }
1228
+ } catch (err) {
1229
+ _d = true;
1230
+ _e = err;
1231
+ } finally {
1232
+ try {
1233
+ if (!_n && _i["return"]) _i["return"]();
1234
+ } finally {
1235
+ if (_d) throw _e;
1236
+ }
1237
+ }
1235
1238
 
1236
- return function (arr, i) {
1237
- if (Array.isArray(arr)) {
1238
- return arr;
1239
- } else if (Symbol.iterator in Object(arr)) {
1240
- return sliceIterator(arr, i);
1241
- } else {
1242
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
1243
- }
1244
- };
1245
- }();
1239
+ return _arr;
1240
+ }
1246
1241
 
1242
+ return function (arr, i) {
1243
+ if (Array.isArray(arr)) {
1244
+ return arr;
1245
+ } else if (Symbol.iterator in Object(arr)) {
1246
+ return sliceIterator(arr, i);
1247
+ } else {
1248
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
1249
+ }
1250
+ };
1251
+ }();
1247
1252
 
1248
1253
 
1249
1254
 
@@ -1256,1248 +1261,1251 @@ var slicedToArray = function () {
1256
1261
 
1257
1262
 
1258
1263
 
1259
- var toConsumableArray = function (arr) {
1260
- if (Array.isArray(arr)) {
1261
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
1262
1264
 
1263
- return arr2;
1264
- } else {
1265
- return Array.from(arr);
1266
- }
1267
- };
1265
+ var toConsumableArray = function (arr) {
1266
+ if (Array.isArray(arr)) {
1267
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
1268
1268
 
1269
- /** Highest positive signed 32-bit float value */
1270
-
1271
- var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
1272
-
1273
- /** Bootstring parameters */
1274
- var base = 36;
1275
- var tMin = 1;
1276
- var tMax = 26;
1277
- var skew = 38;
1278
- var damp = 700;
1279
- var initialBias = 72;
1280
- var initialN = 128; // 0x80
1281
- var delimiter = '-'; // '\x2D'
1282
-
1283
- /** Regular expressions */
1284
- var regexPunycode = /^xn--/;
1285
- var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
1286
- var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
1287
-
1288
- /** Error messages */
1289
- var errors = {
1290
- 'overflow': 'Overflow: input needs wider integers to process',
1291
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
1292
- 'invalid-input': 'Invalid input'
1293
- };
1269
+ return arr2;
1270
+ } else {
1271
+ return Array.from(arr);
1272
+ }
1273
+ };
1294
1274
 
1295
- /** Convenience shortcuts */
1296
- var baseMinusTMin = base - tMin;
1297
- var floor = Math.floor;
1298
- var stringFromCharCode = String.fromCharCode;
1275
+ /** Highest positive signed 32-bit float value */
1299
1276
 
1300
- /*--------------------------------------------------------------------------*/
1277
+ var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
1301
1278
 
1302
- /**
1303
- * A generic error utility function.
1304
- * @private
1305
- * @param {String} type The error type.
1306
- * @returns {Error} Throws a `RangeError` with the applicable error message.
1307
- */
1308
- function error$1(type) {
1309
- throw new RangeError(errors[type]);
1310
- }
1279
+ /** Bootstring parameters */
1280
+ var base = 36;
1281
+ var tMin = 1;
1282
+ var tMax = 26;
1283
+ var skew = 38;
1284
+ var damp = 700;
1285
+ var initialBias = 72;
1286
+ var initialN = 128; // 0x80
1287
+ var delimiter = '-'; // '\x2D'
1311
1288
 
1312
- /**
1313
- * A generic `Array#map` utility function.
1314
- * @private
1315
- * @param {Array} array The array to iterate over.
1316
- * @param {Function} callback The function that gets called for every array
1317
- * item.
1318
- * @returns {Array} A new array of values returned by the callback function.
1319
- */
1320
- function map(array, fn) {
1321
- var result = [];
1322
- var length = array.length;
1323
- while (length--) {
1324
- result[length] = fn(array[length]);
1325
- }
1326
- return result;
1327
- }
1289
+ /** Regular expressions */
1290
+ var regexPunycode = /^xn--/;
1291
+ var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
1292
+ var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
1328
1293
 
1329
- /**
1330
- * A simple `Array#map`-like wrapper to work with domain name strings or email
1331
- * addresses.
1332
- * @private
1333
- * @param {String} domain The domain name or email address.
1334
- * @param {Function} callback The function that gets called for every
1335
- * character.
1336
- * @returns {Array} A new string of characters returned by the callback
1337
- * function.
1338
- */
1339
- function mapDomain(string, fn) {
1340
- var parts = string.split('@');
1341
- var result = '';
1342
- if (parts.length > 1) {
1343
- // In email addresses, only the domain name should be punycoded. Leave
1344
- // the local part (i.e. everything up to `@`) intact.
1345
- result = parts[0] + '@';
1346
- string = parts[1];
1347
- }
1348
- // Avoid `split(regex)` for IE8 compatibility. See #17.
1349
- string = string.replace(regexSeparators, '\x2E');
1350
- var labels = string.split('.');
1351
- var encoded = map(labels, fn).join('.');
1352
- return result + encoded;
1353
- }
1294
+ /** Error messages */
1295
+ var errors = {
1296
+ 'overflow': 'Overflow: input needs wider integers to process',
1297
+ 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
1298
+ 'invalid-input': 'Invalid input'
1299
+ };
1354
1300
 
1355
- /**
1356
- * Creates an array containing the numeric code points of each Unicode
1357
- * character in the string. While JavaScript uses UCS-2 internally,
1358
- * this function will convert a pair of surrogate halves (each of which
1359
- * UCS-2 exposes as separate characters) into a single code point,
1360
- * matching UTF-16.
1361
- * @see `punycode.ucs2.encode`
1362
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
1363
- * @memberOf punycode.ucs2
1364
- * @name decode
1365
- * @param {String} string The Unicode input string (UCS-2).
1366
- * @returns {Array} The new array of code points.
1367
- */
1368
- function ucs2decode(string) {
1369
- var output = [];
1370
- var counter = 0;
1371
- var length = string.length;
1372
- while (counter < length) {
1373
- var value = string.charCodeAt(counter++);
1374
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
1375
- // It's a high surrogate, and there is a next character.
1376
- var extra = string.charCodeAt(counter++);
1377
- if ((extra & 0xFC00) == 0xDC00) {
1378
- // Low surrogate.
1379
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
1380
- } else {
1381
- // It's an unmatched surrogate; only append this code unit, in case the
1382
- // next code unit is the high surrogate of a surrogate pair.
1383
- output.push(value);
1384
- counter--;
1385
- }
1386
- } else {
1387
- output.push(value);
1388
- }
1389
- }
1390
- return output;
1391
- }
1301
+ /** Convenience shortcuts */
1302
+ var baseMinusTMin = base - tMin;
1303
+ var floor = Math.floor;
1304
+ var stringFromCharCode = String.fromCharCode;
1392
1305
 
1393
- /**
1394
- * Creates a string based on an array of numeric code points.
1395
- * @see `punycode.ucs2.decode`
1396
- * @memberOf punycode.ucs2
1397
- * @name encode
1398
- * @param {Array} codePoints The array of numeric code points.
1399
- * @returns {String} The new Unicode string (UCS-2).
1400
- */
1401
- var ucs2encode = function ucs2encode(array) {
1402
- return String.fromCodePoint.apply(String, toConsumableArray(array));
1403
- };
1306
+ /*--------------------------------------------------------------------------*/
1404
1307
 
1405
- /**
1406
- * Converts a basic code point into a digit/integer.
1407
- * @see `digitToBasic()`
1408
- * @private
1409
- * @param {Number} codePoint The basic numeric code point value.
1410
- * @returns {Number} The numeric value of a basic code point (for use in
1411
- * representing integers) in the range `0` to `base - 1`, or `base` if
1412
- * the code point does not represent a value.
1413
- */
1414
- var basicToDigit = function basicToDigit(codePoint) {
1415
- if (codePoint - 0x30 < 0x0A) {
1416
- return codePoint - 0x16;
1417
- }
1418
- if (codePoint - 0x41 < 0x1A) {
1419
- return codePoint - 0x41;
1420
- }
1421
- if (codePoint - 0x61 < 0x1A) {
1422
- return codePoint - 0x61;
1308
+ /**
1309
+ * A generic error utility function.
1310
+ * @private
1311
+ * @param {String} type The error type.
1312
+ * @returns {Error} Throws a `RangeError` with the applicable error message.
1313
+ */
1314
+ function error$1(type) {
1315
+ throw new RangeError(errors[type]);
1423
1316
  }
1424
- return base;
1425
- };
1426
1317
 
1427
- /**
1428
- * Converts a digit/integer into a basic code point.
1429
- * @see `basicToDigit()`
1430
- * @private
1431
- * @param {Number} digit The numeric value of a basic code point.
1432
- * @returns {Number} The basic code point whose value (when used for
1433
- * representing integers) is `digit`, which needs to be in the range
1434
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
1435
- * used; else, the lowercase form is used. The behavior is undefined
1436
- * if `flag` is non-zero and `digit` has no uppercase form.
1437
- */
1438
- var digitToBasic = function digitToBasic(digit, flag) {
1439
- // 0..25 map to ASCII a..z or A..Z
1440
- // 26..35 map to ASCII 0..9
1441
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
1442
- };
1443
-
1444
- /**
1445
- * Bias adaptation function as per section 3.4 of RFC 3492.
1446
- * https://tools.ietf.org/html/rfc3492#section-3.4
1447
- * @private
1448
- */
1449
- var adapt = function adapt(delta, numPoints, firstTime) {
1450
- var k = 0;
1451
- delta = firstTime ? floor(delta / damp) : delta >> 1;
1452
- delta += floor(delta / numPoints);
1453
- for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
1454
- delta = floor(delta / baseMinusTMin);
1318
+ /**
1319
+ * A generic `Array#map` utility function.
1320
+ * @private
1321
+ * @param {Array} array The array to iterate over.
1322
+ * @param {Function} callback The function that gets called for every array
1323
+ * item.
1324
+ * @returns {Array} A new array of values returned by the callback function.
1325
+ */
1326
+ function map(array, fn) {
1327
+ var result = [];
1328
+ var length = array.length;
1329
+ while (length--) {
1330
+ result[length] = fn(array[length]);
1331
+ }
1332
+ return result;
1455
1333
  }
1456
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
1457
- };
1458
1334
 
1459
- /**
1460
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
1461
- * symbols.
1462
- * @memberOf punycode
1463
- * @param {String} input The Punycode string of ASCII-only symbols.
1464
- * @returns {String} The resulting string of Unicode symbols.
1465
- */
1466
- var decode = function decode(input) {
1467
- // Don't use UCS-2.
1468
- var output = [];
1469
- var inputLength = input.length;
1470
- var i = 0;
1471
- var n = initialN;
1472
- var bias = initialBias;
1473
-
1474
- // Handle the basic code points: let `basic` be the number of input code
1475
- // points before the last delimiter, or `0` if there is none, then copy
1476
- // the first basic code points to the output.
1477
-
1478
- var basic = input.lastIndexOf(delimiter);
1479
- if (basic < 0) {
1480
- basic = 0;
1335
+ /**
1336
+ * A simple `Array#map`-like wrapper to work with domain name strings or email
1337
+ * addresses.
1338
+ * @private
1339
+ * @param {String} domain The domain name or email address.
1340
+ * @param {Function} callback The function that gets called for every
1341
+ * character.
1342
+ * @returns {Array} A new string of characters returned by the callback
1343
+ * function.
1344
+ */
1345
+ function mapDomain(string, fn) {
1346
+ var parts = string.split('@');
1347
+ var result = '';
1348
+ if (parts.length > 1) {
1349
+ // In email addresses, only the domain name should be punycoded. Leave
1350
+ // the local part (i.e. everything up to `@`) intact.
1351
+ result = parts[0] + '@';
1352
+ string = parts[1];
1353
+ }
1354
+ // Avoid `split(regex)` for IE8 compatibility. See #17.
1355
+ string = string.replace(regexSeparators, '\x2E');
1356
+ var labels = string.split('.');
1357
+ var encoded = map(labels, fn).join('.');
1358
+ return result + encoded;
1481
1359
  }
1482
1360
 
1483
- for (var j = 0; j < basic; ++j) {
1484
- // if it's not a basic code point
1485
- if (input.charCodeAt(j) >= 0x80) {
1486
- error$1('not-basic');
1361
+ /**
1362
+ * Creates an array containing the numeric code points of each Unicode
1363
+ * character in the string. While JavaScript uses UCS-2 internally,
1364
+ * this function will convert a pair of surrogate halves (each of which
1365
+ * UCS-2 exposes as separate characters) into a single code point,
1366
+ * matching UTF-16.
1367
+ * @see `punycode.ucs2.encode`
1368
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
1369
+ * @memberOf punycode.ucs2
1370
+ * @name decode
1371
+ * @param {String} string The Unicode input string (UCS-2).
1372
+ * @returns {Array} The new array of code points.
1373
+ */
1374
+ function ucs2decode(string) {
1375
+ var output = [];
1376
+ var counter = 0;
1377
+ var length = string.length;
1378
+ while (counter < length) {
1379
+ var value = string.charCodeAt(counter++);
1380
+ if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
1381
+ // It's a high surrogate, and there is a next character.
1382
+ var extra = string.charCodeAt(counter++);
1383
+ if ((extra & 0xFC00) == 0xDC00) {
1384
+ // Low surrogate.
1385
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
1386
+ } else {
1387
+ // It's an unmatched surrogate; only append this code unit, in case the
1388
+ // next code unit is the high surrogate of a surrogate pair.
1389
+ output.push(value);
1390
+ counter--;
1391
+ }
1392
+ } else {
1393
+ output.push(value);
1394
+ }
1487
1395
  }
1488
- output.push(input.charCodeAt(j));
1396
+ return output;
1489
1397
  }
1490
1398
 
1491
- // Main decoding loop: start just after the last delimiter if any basic code
1492
- // points were copied; start at the beginning otherwise.
1493
-
1494
- for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
1495
-
1496
- // `index` is the index of the next character to be consumed.
1497
- // Decode a generalized variable-length integer into `delta`,
1498
- // which gets added to `i`. The overflow checking is easier
1499
- // if we increase `i` as we go, then subtract off its starting
1500
- // value at the end to obtain `delta`.
1501
- var oldi = i;
1502
- for (var w = 1, k = base;; /* no condition */k += base) {
1503
-
1504
- if (index >= inputLength) {
1505
- error$1('invalid-input');
1506
- }
1399
+ /**
1400
+ * Creates a string based on an array of numeric code points.
1401
+ * @see `punycode.ucs2.decode`
1402
+ * @memberOf punycode.ucs2
1403
+ * @name encode
1404
+ * @param {Array} codePoints The array of numeric code points.
1405
+ * @returns {String} The new Unicode string (UCS-2).
1406
+ */
1407
+ var ucs2encode = function ucs2encode(array) {
1408
+ return String.fromCodePoint.apply(String, toConsumableArray(array));
1409
+ };
1507
1410
 
1508
- var digit = basicToDigit(input.charCodeAt(index++));
1411
+ /**
1412
+ * Converts a basic code point into a digit/integer.
1413
+ * @see `digitToBasic()`
1414
+ * @private
1415
+ * @param {Number} codePoint The basic numeric code point value.
1416
+ * @returns {Number} The numeric value of a basic code point (for use in
1417
+ * representing integers) in the range `0` to `base - 1`, or `base` if
1418
+ * the code point does not represent a value.
1419
+ */
1420
+ var basicToDigit = function basicToDigit(codePoint) {
1421
+ if (codePoint - 0x30 < 0x0A) {
1422
+ return codePoint - 0x16;
1423
+ }
1424
+ if (codePoint - 0x41 < 0x1A) {
1425
+ return codePoint - 0x41;
1426
+ }
1427
+ if (codePoint - 0x61 < 0x1A) {
1428
+ return codePoint - 0x61;
1429
+ }
1430
+ return base;
1431
+ };
1509
1432
 
1510
- if (digit >= base || digit > floor((maxInt - i) / w)) {
1511
- error$1('overflow');
1512
- }
1433
+ /**
1434
+ * Converts a digit/integer into a basic code point.
1435
+ * @see `basicToDigit()`
1436
+ * @private
1437
+ * @param {Number} digit The numeric value of a basic code point.
1438
+ * @returns {Number} The basic code point whose value (when used for
1439
+ * representing integers) is `digit`, which needs to be in the range
1440
+ * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
1441
+ * used; else, the lowercase form is used. The behavior is undefined
1442
+ * if `flag` is non-zero and `digit` has no uppercase form.
1443
+ */
1444
+ var digitToBasic = function digitToBasic(digit, flag) {
1445
+ // 0..25 map to ASCII a..z or A..Z
1446
+ // 26..35 map to ASCII 0..9
1447
+ return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
1448
+ };
1513
1449
 
1514
- i += digit * w;
1515
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
1450
+ /**
1451
+ * Bias adaptation function as per section 3.4 of RFC 3492.
1452
+ * https://tools.ietf.org/html/rfc3492#section-3.4
1453
+ * @private
1454
+ */
1455
+ var adapt = function adapt(delta, numPoints, firstTime) {
1456
+ var k = 0;
1457
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
1458
+ delta += floor(delta / numPoints);
1459
+ for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
1460
+ delta = floor(delta / baseMinusTMin);
1461
+ }
1462
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
1463
+ };
1516
1464
 
1517
- if (digit < t) {
1518
- break;
1519
- }
1465
+ /**
1466
+ * Converts a Punycode string of ASCII-only symbols to a string of Unicode
1467
+ * symbols.
1468
+ * @memberOf punycode
1469
+ * @param {String} input The Punycode string of ASCII-only symbols.
1470
+ * @returns {String} The resulting string of Unicode symbols.
1471
+ */
1472
+ var decode = function decode(input) {
1473
+ // Don't use UCS-2.
1474
+ var output = [];
1475
+ var inputLength = input.length;
1476
+ var i = 0;
1477
+ var n = initialN;
1478
+ var bias = initialBias;
1479
+
1480
+ // Handle the basic code points: let `basic` be the number of input code
1481
+ // points before the last delimiter, or `0` if there is none, then copy
1482
+ // the first basic code points to the output.
1483
+
1484
+ var basic = input.lastIndexOf(delimiter);
1485
+ if (basic < 0) {
1486
+ basic = 0;
1487
+ }
1520
1488
 
1521
- var baseMinusT = base - t;
1522
- if (w > floor(maxInt / baseMinusT)) {
1523
- error$1('overflow');
1489
+ for (var j = 0; j < basic; ++j) {
1490
+ // if it's not a basic code point
1491
+ if (input.charCodeAt(j) >= 0x80) {
1492
+ error$1('not-basic');
1524
1493
  }
1525
-
1526
- w *= baseMinusT;
1494
+ output.push(input.charCodeAt(j));
1527
1495
  }
1528
1496
 
1529
- var out = output.length + 1;
1530
- bias = adapt(i - oldi, out, oldi == 0);
1497
+ // Main decoding loop: start just after the last delimiter if any basic code
1498
+ // points were copied; start at the beginning otherwise.
1531
1499
 
1532
- // `i` was supposed to wrap around from `out` to `0`,
1533
- // incrementing `n` each time, so we'll fix that now:
1534
- if (floor(i / out) > maxInt - n) {
1535
- error$1('overflow');
1536
- }
1500
+ for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
1537
1501
 
1538
- n += floor(i / out);
1539
- i %= out;
1502
+ // `index` is the index of the next character to be consumed.
1503
+ // Decode a generalized variable-length integer into `delta`,
1504
+ // which gets added to `i`. The overflow checking is easier
1505
+ // if we increase `i` as we go, then subtract off its starting
1506
+ // value at the end to obtain `delta`.
1507
+ var oldi = i;
1508
+ for (var w = 1, k = base;; /* no condition */k += base) {
1540
1509
 
1541
- // Insert `n` at position `i` of the output.
1542
- output.splice(i++, 0, n);
1543
- }
1510
+ if (index >= inputLength) {
1511
+ error$1('invalid-input');
1512
+ }
1544
1513
 
1545
- return String.fromCodePoint.apply(String, output);
1546
- };
1514
+ var digit = basicToDigit(input.charCodeAt(index++));
1547
1515
 
1548
- /**
1549
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
1550
- * Punycode string of ASCII-only symbols.
1551
- * @memberOf punycode
1552
- * @param {String} input The string of Unicode symbols.
1553
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
1554
- */
1555
- var encode = function encode(input) {
1556
- var output = [];
1516
+ if (digit >= base || digit > floor((maxInt - i) / w)) {
1517
+ error$1('overflow');
1518
+ }
1557
1519
 
1558
- // Convert the input in UCS-2 to an array of Unicode code points.
1559
- input = ucs2decode(input);
1520
+ i += digit * w;
1521
+ var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
1560
1522
 
1561
- // Cache the length.
1562
- var inputLength = input.length;
1523
+ if (digit < t) {
1524
+ break;
1525
+ }
1563
1526
 
1564
- // Initialize the state.
1565
- var n = initialN;
1566
- var delta = 0;
1567
- var bias = initialBias;
1527
+ var baseMinusT = base - t;
1528
+ if (w > floor(maxInt / baseMinusT)) {
1529
+ error$1('overflow');
1530
+ }
1568
1531
 
1569
- // Handle the basic code points.
1570
- var _iteratorNormalCompletion = true;
1571
- var _didIteratorError = false;
1572
- var _iteratorError = undefined;
1532
+ w *= baseMinusT;
1533
+ }
1573
1534
 
1574
- try {
1575
- for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1576
- var _currentValue2 = _step.value;
1535
+ var out = output.length + 1;
1536
+ bias = adapt(i - oldi, out, oldi == 0);
1577
1537
 
1578
- if (_currentValue2 < 0x80) {
1579
- output.push(stringFromCharCode(_currentValue2));
1580
- }
1581
- }
1582
- } catch (err) {
1583
- _didIteratorError = true;
1584
- _iteratorError = err;
1585
- } finally {
1586
- try {
1587
- if (!_iteratorNormalCompletion && _iterator.return) {
1588
- _iterator.return();
1589
- }
1590
- } finally {
1591
- if (_didIteratorError) {
1592
- throw _iteratorError;
1538
+ // `i` was supposed to wrap around from `out` to `0`,
1539
+ // incrementing `n` each time, so we'll fix that now:
1540
+ if (floor(i / out) > maxInt - n) {
1541
+ error$1('overflow');
1593
1542
  }
1594
- }
1595
- }
1596
-
1597
- var basicLength = output.length;
1598
- var handledCPCount = basicLength;
1599
1543
 
1600
- // `handledCPCount` is the number of code points that have been handled;
1601
- // `basicLength` is the number of basic code points.
1544
+ n += floor(i / out);
1545
+ i %= out;
1602
1546
 
1603
- // Finish the basic string with a delimiter unless it's empty.
1604
- if (basicLength) {
1605
- output.push(delimiter);
1606
- }
1547
+ // Insert `n` at position `i` of the output.
1548
+ output.splice(i++, 0, n);
1549
+ }
1607
1550
 
1608
- // Main encoding loop:
1609
- while (handledCPCount < inputLength) {
1551
+ return String.fromCodePoint.apply(String, output);
1552
+ };
1610
1553
 
1611
- // All non-basic code points < n have been handled already. Find the next
1612
- // larger one:
1613
- var m = maxInt;
1614
- var _iteratorNormalCompletion2 = true;
1615
- var _didIteratorError2 = false;
1616
- var _iteratorError2 = undefined;
1554
+ /**
1555
+ * Converts a string of Unicode symbols (e.g. a domain name label) to a
1556
+ * Punycode string of ASCII-only symbols.
1557
+ * @memberOf punycode
1558
+ * @param {String} input The string of Unicode symbols.
1559
+ * @returns {String} The resulting Punycode string of ASCII-only symbols.
1560
+ */
1561
+ var encode = function encode(input) {
1562
+ var output = [];
1563
+
1564
+ // Convert the input in UCS-2 to an array of Unicode code points.
1565
+ input = ucs2decode(input);
1566
+
1567
+ // Cache the length.
1568
+ var inputLength = input.length;
1569
+
1570
+ // Initialize the state.
1571
+ var n = initialN;
1572
+ var delta = 0;
1573
+ var bias = initialBias;
1574
+
1575
+ // Handle the basic code points.
1576
+ var _iteratorNormalCompletion = true;
1577
+ var _didIteratorError = false;
1578
+ var _iteratorError = undefined;
1617
1579
 
1618
1580
  try {
1619
- for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
1620
- var currentValue = _step2.value;
1581
+ for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1582
+ var _currentValue2 = _step.value;
1621
1583
 
1622
- if (currentValue >= n && currentValue < m) {
1623
- m = currentValue;
1584
+ if (_currentValue2 < 0x80) {
1585
+ output.push(stringFromCharCode(_currentValue2));
1624
1586
  }
1625
1587
  }
1626
-
1627
- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
1628
- // but guard against overflow.
1629
1588
  } catch (err) {
1630
- _didIteratorError2 = true;
1631
- _iteratorError2 = err;
1589
+ _didIteratorError = true;
1590
+ _iteratorError = err;
1632
1591
  } finally {
1633
1592
  try {
1634
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
1635
- _iterator2.return();
1593
+ if (!_iteratorNormalCompletion && _iterator.return) {
1594
+ _iterator.return();
1636
1595
  }
1637
1596
  } finally {
1638
- if (_didIteratorError2) {
1639
- throw _iteratorError2;
1597
+ if (_didIteratorError) {
1598
+ throw _iteratorError;
1640
1599
  }
1641
1600
  }
1642
1601
  }
1643
1602
 
1644
- var handledCPCountPlusOne = handledCPCount + 1;
1645
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
1646
- error$1('overflow');
1647
- }
1603
+ var basicLength = output.length;
1604
+ var handledCPCount = basicLength;
1648
1605
 
1649
- delta += (m - n) * handledCPCountPlusOne;
1650
- n = m;
1606
+ // `handledCPCount` is the number of code points that have been handled;
1607
+ // `basicLength` is the number of basic code points.
1651
1608
 
1652
- var _iteratorNormalCompletion3 = true;
1653
- var _didIteratorError3 = false;
1654
- var _iteratorError3 = undefined;
1609
+ // Finish the basic string with a delimiter unless it's empty.
1610
+ if (basicLength) {
1611
+ output.push(delimiter);
1612
+ }
1655
1613
 
1656
- try {
1657
- for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
1658
- var _currentValue = _step3.value;
1614
+ // Main encoding loop:
1615
+ while (handledCPCount < inputLength) {
1659
1616
 
1660
- if (_currentValue < n && ++delta > maxInt) {
1661
- error$1('overflow');
1662
- }
1663
- if (_currentValue == n) {
1664
- // Represent delta as a generalized variable-length integer.
1665
- var q = delta;
1666
- for (var k = base;; /* no condition */k += base) {
1667
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
1668
- if (q < t) {
1669
- break;
1670
- }
1671
- var qMinusT = q - t;
1672
- var baseMinusT = base - t;
1673
- output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
1674
- q = floor(qMinusT / baseMinusT);
1675
- }
1617
+ // All non-basic code points < n have been handled already. Find the next
1618
+ // larger one:
1619
+ var m = maxInt;
1620
+ var _iteratorNormalCompletion2 = true;
1621
+ var _didIteratorError2 = false;
1622
+ var _iteratorError2 = undefined;
1676
1623
 
1677
- output.push(stringFromCharCode(digitToBasic(q, 0)));
1678
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
1679
- delta = 0;
1680
- ++handledCPCount;
1681
- }
1682
- }
1683
- } catch (err) {
1684
- _didIteratorError3 = true;
1685
- _iteratorError3 = err;
1686
- } finally {
1687
1624
  try {
1688
- if (!_iteratorNormalCompletion3 && _iterator3.return) {
1689
- _iterator3.return();
1625
+ for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
1626
+ var currentValue = _step2.value;
1627
+
1628
+ if (currentValue >= n && currentValue < m) {
1629
+ m = currentValue;
1630
+ }
1690
1631
  }
1632
+
1633
+ // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
1634
+ // but guard against overflow.
1635
+ } catch (err) {
1636
+ _didIteratorError2 = true;
1637
+ _iteratorError2 = err;
1691
1638
  } finally {
1692
- if (_didIteratorError3) {
1693
- throw _iteratorError3;
1639
+ try {
1640
+ if (!_iteratorNormalCompletion2 && _iterator2.return) {
1641
+ _iterator2.return();
1642
+ }
1643
+ } finally {
1644
+ if (_didIteratorError2) {
1645
+ throw _iteratorError2;
1646
+ }
1694
1647
  }
1695
1648
  }
1696
- }
1697
-
1698
- ++delta;
1699
- ++n;
1700
- }
1701
- return output.join('');
1702
- };
1703
-
1704
- /**
1705
- * Converts a Punycode string representing a domain name or an email address
1706
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
1707
- * it doesn't matter if you call it on a string that has already been
1708
- * converted to Unicode.
1709
- * @memberOf punycode
1710
- * @param {String} input The Punycoded domain name or email address to
1711
- * convert to Unicode.
1712
- * @returns {String} The Unicode representation of the given Punycode
1713
- * string.
1714
- */
1715
- var toUnicode = function toUnicode(input) {
1716
- return mapDomain(input, function (string) {
1717
- return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
1718
- });
1719
- };
1720
-
1721
- /**
1722
- * Converts a Unicode string representing a domain name or an email address to
1723
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
1724
- * i.e. it doesn't matter if you call it with a domain that's already in
1725
- * ASCII.
1726
- * @memberOf punycode
1727
- * @param {String} input The domain name or email address to convert, as a
1728
- * Unicode string.
1729
- * @returns {String} The Punycode representation of the given domain name or
1730
- * email address.
1731
- */
1732
- var toASCII = function toASCII(input) {
1733
- return mapDomain(input, function (string) {
1734
- return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
1735
- });
1736
- };
1737
1649
 
1738
- /*--------------------------------------------------------------------------*/
1650
+ var handledCPCountPlusOne = handledCPCount + 1;
1651
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
1652
+ error$1('overflow');
1653
+ }
1739
1654
 
1740
- /** Define the public API */
1741
- var punycode = {
1742
- /**
1743
- * A string representing the current Punycode.js version number.
1744
- * @memberOf punycode
1745
- * @type String
1746
- */
1747
- 'version': '2.1.0',
1748
- /**
1749
- * An object of methods to convert from JavaScript's internal character
1750
- * representation (UCS-2) to Unicode code points, and back.
1751
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
1752
- * @memberOf punycode
1753
- * @type Object
1754
- */
1755
- 'ucs2': {
1756
- 'decode': ucs2decode,
1757
- 'encode': ucs2encode
1758
- },
1759
- 'decode': decode,
1760
- 'encode': encode,
1761
- 'toASCII': toASCII,
1762
- 'toUnicode': toUnicode
1763
- };
1655
+ delta += (m - n) * handledCPCountPlusOne;
1656
+ n = m;
1764
1657
 
1765
- /**
1766
- * URI.js
1767
- *
1768
- * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
1769
- * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
1770
- * @see http://github.com/garycourt/uri-js
1771
- */
1772
- /**
1773
- * Copyright 2011 Gary Court. All rights reserved.
1774
- *
1775
- * Redistribution and use in source and binary forms, with or without modification, are
1776
- * permitted provided that the following conditions are met:
1777
- *
1778
- * 1. Redistributions of source code must retain the above copyright notice, this list of
1779
- * conditions and the following disclaimer.
1780
- *
1781
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
1782
- * of conditions and the following disclaimer in the documentation and/or other materials
1783
- * provided with the distribution.
1784
- *
1785
- * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
1786
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1787
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
1788
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1789
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1790
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1791
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1792
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
1793
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1794
- *
1795
- * The views and conclusions contained in the software and documentation are those of the
1796
- * authors and should not be interpreted as representing official policies, either expressed
1797
- * or implied, of Gary Court.
1798
- */
1799
- var SCHEMES = {};
1800
- function pctEncChar(chr) {
1801
- var c = chr.charCodeAt(0);
1802
- var e = void 0;
1803
- 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();
1804
- return e;
1805
- }
1806
- function pctDecChars(str) {
1807
- var newStr = "";
1808
- var i = 0;
1809
- var il = str.length;
1810
- while (i < il) {
1811
- var c = parseInt(str.substr(i + 1, 2), 16);
1812
- if (c < 128) {
1813
- newStr += String.fromCharCode(c);
1814
- i += 3;
1815
- } else if (c >= 194 && c < 224) {
1816
- if (il - i >= 6) {
1817
- var c2 = parseInt(str.substr(i + 4, 2), 16);
1818
- newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
1819
- } else {
1820
- newStr += str.substr(i, 6);
1821
- }
1822
- i += 6;
1823
- } else if (c >= 224) {
1824
- if (il - i >= 9) {
1825
- var _c = parseInt(str.substr(i + 4, 2), 16);
1826
- var c3 = parseInt(str.substr(i + 7, 2), 16);
1827
- newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
1828
- } else {
1829
- newStr += str.substr(i, 9);
1830
- }
1831
- i += 9;
1832
- } else {
1833
- newStr += str.substr(i, 3);
1834
- i += 3;
1835
- }
1836
- }
1837
- return newStr;
1838
- }
1839
- function _normalizeComponentEncoding(components, protocol) {
1840
- function decodeUnreserved(str) {
1841
- var decStr = pctDecChars(str);
1842
- return !decStr.match(protocol.UNRESERVED) ? str : decStr;
1843
- }
1844
- if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
1845
- if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
1846
- 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);
1847
- 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);
1848
- if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
1849
- if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
1850
- return components;
1851
- }
1658
+ var _iteratorNormalCompletion3 = true;
1659
+ var _didIteratorError3 = false;
1660
+ var _iteratorError3 = undefined;
1852
1661
 
1853
- function _stripLeadingZeros(str) {
1854
- return str.replace(/^0*(.*)/, "$1") || "0";
1855
- }
1856
- function _normalizeIPv4(host, protocol) {
1857
- var matches = host.match(protocol.IPV4ADDRESS) || [];
1662
+ try {
1663
+ for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
1664
+ var _currentValue = _step3.value;
1858
1665
 
1859
- var _matches = slicedToArray(matches, 2),
1860
- address = _matches[1];
1666
+ if (_currentValue < n && ++delta > maxInt) {
1667
+ error$1('overflow');
1668
+ }
1669
+ if (_currentValue == n) {
1670
+ // Represent delta as a generalized variable-length integer.
1671
+ var q = delta;
1672
+ for (var k = base;; /* no condition */k += base) {
1673
+ var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
1674
+ if (q < t) {
1675
+ break;
1676
+ }
1677
+ var qMinusT = q - t;
1678
+ var baseMinusT = base - t;
1679
+ output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
1680
+ q = floor(qMinusT / baseMinusT);
1681
+ }
1861
1682
 
1862
- if (address) {
1863
- return address.split(".").map(_stripLeadingZeros).join(".");
1864
- } else {
1865
- return host;
1866
- }
1867
- }
1868
- function _normalizeIPv6(host, protocol) {
1869
- var matches = host.match(protocol.IPV6ADDRESS) || [];
1870
-
1871
- var _matches2 = slicedToArray(matches, 3),
1872
- address = _matches2[1],
1873
- zone = _matches2[2];
1874
-
1875
- if (address) {
1876
- var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
1877
- _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
1878
- last = _address$toLowerCase$2[0],
1879
- first = _address$toLowerCase$2[1];
1880
-
1881
- var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
1882
- var lastFields = last.split(":").map(_stripLeadingZeros);
1883
- var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
1884
- var fieldCount = isLastFieldIPv4Address ? 7 : 8;
1885
- var lastFieldsStart = lastFields.length - fieldCount;
1886
- var fields = Array(fieldCount);
1887
- for (var x = 0; x < fieldCount; ++x) {
1888
- fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
1889
- }
1890
- if (isLastFieldIPv4Address) {
1891
- fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
1892
- }
1893
- var allZeroFields = fields.reduce(function (acc, field, index) {
1894
- if (!field || field === "0") {
1895
- var lastLongest = acc[acc.length - 1];
1896
- if (lastLongest && lastLongest.index + lastLongest.length === index) {
1897
- lastLongest.length++;
1898
- } else {
1899
- acc.push({ index: index, length: 1 });
1900
- }
1901
- }
1902
- return acc;
1903
- }, []);
1904
- var longestZeroFields = allZeroFields.sort(function (a, b) {
1905
- return b.length - a.length;
1906
- })[0];
1907
- var newHost = void 0;
1908
- if (longestZeroFields && longestZeroFields.length > 1) {
1909
- var newFirst = fields.slice(0, longestZeroFields.index);
1910
- var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
1911
- newHost = newFirst.join(":") + "::" + newLast.join(":");
1912
- } else {
1913
- newHost = fields.join(":");
1914
- }
1915
- if (zone) {
1916
- newHost += "%" + zone;
1917
- }
1918
- return newHost;
1919
- } else {
1920
- return host;
1921
- }
1922
- }
1923
- var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
1924
- var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
1925
- function parse(uriString) {
1926
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1927
-
1928
- var components = {};
1929
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
1930
- if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
1931
- var matches = uriString.match(URI_PARSE);
1932
- if (matches) {
1933
- if (NO_MATCH_IS_UNDEFINED) {
1934
- //store each component
1935
- components.scheme = matches[1];
1936
- components.userinfo = matches[3];
1937
- components.host = matches[4];
1938
- components.port = parseInt(matches[5], 10);
1939
- components.path = matches[6] || "";
1940
- components.query = matches[7];
1941
- components.fragment = matches[8];
1942
- //fix port number
1943
- if (isNaN(components.port)) {
1944
- components.port = matches[5];
1945
- }
1946
- } else {
1947
- //IE FIX for improper RegExp matching
1948
- //store each component
1949
- components.scheme = matches[1] || undefined;
1950
- components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
1951
- components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
1952
- components.port = parseInt(matches[5], 10);
1953
- components.path = matches[6] || "";
1954
- components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
1955
- components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
1956
- //fix port number
1957
- if (isNaN(components.port)) {
1958
- components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
1959
- }
1960
- }
1961
- if (components.host) {
1962
- //normalize IP hosts
1963
- components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
1964
- }
1965
- //determine reference type
1966
- if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
1967
- components.reference = "same-document";
1968
- } else if (components.scheme === undefined) {
1969
- components.reference = "relative";
1970
- } else if (components.fragment === undefined) {
1971
- components.reference = "absolute";
1972
- } else {
1973
- components.reference = "uri";
1974
- }
1975
- //check for reference errors
1976
- if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
1977
- components.error = components.error || "URI is not a " + options.reference + " reference.";
1978
- }
1979
- //find scheme handler
1980
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
1981
- //check if scheme can't handle IRIs
1982
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
1983
- //if host component is a domain name
1984
- if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
1985
- //convert Unicode IDN -> ASCII IDN
1986
- try {
1987
- components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
1988
- } catch (e) {
1989
- components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
1990
- }
1991
- }
1992
- //convert IRI -> URI
1993
- _normalizeComponentEncoding(components, URI_PROTOCOL);
1994
- } else {
1995
- //normalize encodings
1996
- _normalizeComponentEncoding(components, protocol);
1997
- }
1998
- //perform scheme specific parsing
1999
- if (schemeHandler && schemeHandler.parse) {
2000
- schemeHandler.parse(components, options);
2001
- }
2002
- } else {
2003
- components.error = components.error || "URI can not be parsed.";
2004
- }
2005
- return components;
2006
- }
1683
+ output.push(stringFromCharCode(digitToBasic(q, 0)));
1684
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
1685
+ delta = 0;
1686
+ ++handledCPCount;
1687
+ }
1688
+ }
1689
+ } catch (err) {
1690
+ _didIteratorError3 = true;
1691
+ _iteratorError3 = err;
1692
+ } finally {
1693
+ try {
1694
+ if (!_iteratorNormalCompletion3 && _iterator3.return) {
1695
+ _iterator3.return();
1696
+ }
1697
+ } finally {
1698
+ if (_didIteratorError3) {
1699
+ throw _iteratorError3;
1700
+ }
1701
+ }
1702
+ }
2007
1703
 
2008
- function _recomposeAuthority(components, options) {
2009
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
2010
- var uriTokens = [];
2011
- if (components.userinfo !== undefined) {
2012
- uriTokens.push(components.userinfo);
2013
- uriTokens.push("@");
2014
- }
2015
- if (components.host !== undefined) {
2016
- //normalize IP hosts, add brackets and escape zone separator for IPv6
2017
- uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
2018
- return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
2019
- }));
2020
- }
2021
- if (typeof components.port === "number" || typeof components.port === "string") {
2022
- uriTokens.push(":");
2023
- uriTokens.push(String(components.port));
2024
- }
2025
- return uriTokens.length ? uriTokens.join("") : undefined;
2026
- }
1704
+ ++delta;
1705
+ ++n;
1706
+ }
1707
+ return output.join('');
1708
+ };
2027
1709
 
2028
- var RDS1 = /^\.\.?\//;
2029
- var RDS2 = /^\/\.(\/|$)/;
2030
- var RDS3 = /^\/\.\.(\/|$)/;
2031
- var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
2032
- function removeDotSegments(input) {
2033
- var output = [];
2034
- while (input.length) {
2035
- if (input.match(RDS1)) {
2036
- input = input.replace(RDS1, "");
2037
- } else if (input.match(RDS2)) {
2038
- input = input.replace(RDS2, "/");
2039
- } else if (input.match(RDS3)) {
2040
- input = input.replace(RDS3, "/");
2041
- output.pop();
2042
- } else if (input === "." || input === "..") {
2043
- input = "";
2044
- } else {
2045
- var im = input.match(RDS5);
2046
- if (im) {
2047
- var s = im[0];
2048
- input = input.slice(s.length);
2049
- output.push(s);
2050
- } else {
2051
- throw new Error("Unexpected dot segment condition");
2052
- }
2053
- }
2054
- }
2055
- return output.join("");
2056
- }
1710
+ /**
1711
+ * Converts a Punycode string representing a domain name or an email address
1712
+ * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
1713
+ * it doesn't matter if you call it on a string that has already been
1714
+ * converted to Unicode.
1715
+ * @memberOf punycode
1716
+ * @param {String} input The Punycoded domain name or email address to
1717
+ * convert to Unicode.
1718
+ * @returns {String} The Unicode representation of the given Punycode
1719
+ * string.
1720
+ */
1721
+ var toUnicode = function toUnicode(input) {
1722
+ return mapDomain(input, function (string) {
1723
+ return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
1724
+ });
1725
+ };
2057
1726
 
2058
- function serialize(components) {
2059
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2060
-
2061
- var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
2062
- var uriTokens = [];
2063
- //find scheme handler
2064
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
2065
- //perform scheme specific serialization
2066
- if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
2067
- if (components.host) {
2068
- //if host component is an IPv6 address
2069
- if (protocol.IPV6ADDRESS.test(components.host)) ;
2070
- //TODO: normalize IPv6 address as per RFC 5952
2071
-
2072
- //if host component is a domain name
2073
- else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
2074
- //convert IDN via punycode
2075
- try {
2076
- components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
2077
- } catch (e) {
2078
- components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
2079
- }
2080
- }
2081
- }
2082
- //normalize encoding
2083
- _normalizeComponentEncoding(components, protocol);
2084
- if (options.reference !== "suffix" && components.scheme) {
2085
- uriTokens.push(components.scheme);
2086
- uriTokens.push(":");
2087
- }
2088
- var authority = _recomposeAuthority(components, options);
2089
- if (authority !== undefined) {
2090
- if (options.reference !== "suffix") {
2091
- uriTokens.push("//");
2092
- }
2093
- uriTokens.push(authority);
2094
- if (components.path && components.path.charAt(0) !== "/") {
2095
- uriTokens.push("/");
2096
- }
2097
- }
2098
- if (components.path !== undefined) {
2099
- var s = components.path;
2100
- if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
2101
- s = removeDotSegments(s);
2102
- }
2103
- if (authority === undefined) {
2104
- s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
2105
- }
2106
- uriTokens.push(s);
2107
- }
2108
- if (components.query !== undefined) {
2109
- uriTokens.push("?");
2110
- uriTokens.push(components.query);
2111
- }
2112
- if (components.fragment !== undefined) {
2113
- uriTokens.push("#");
2114
- uriTokens.push(components.fragment);
2115
- }
2116
- return uriTokens.join(""); //merge tokens into a string
2117
- }
1727
+ /**
1728
+ * Converts a Unicode string representing a domain name or an email address to
1729
+ * Punycode. Only the non-ASCII parts of the domain name will be converted,
1730
+ * i.e. it doesn't matter if you call it with a domain that's already in
1731
+ * ASCII.
1732
+ * @memberOf punycode
1733
+ * @param {String} input The domain name or email address to convert, as a
1734
+ * Unicode string.
1735
+ * @returns {String} The Punycode representation of the given domain name or
1736
+ * email address.
1737
+ */
1738
+ var toASCII = function toASCII(input) {
1739
+ return mapDomain(input, function (string) {
1740
+ return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
1741
+ });
1742
+ };
1743
+
1744
+ /*--------------------------------------------------------------------------*/
1745
+
1746
+ /** Define the public API */
1747
+ var punycode = {
1748
+ /**
1749
+ * A string representing the current Punycode.js version number.
1750
+ * @memberOf punycode
1751
+ * @type String
1752
+ */
1753
+ 'version': '2.1.0',
1754
+ /**
1755
+ * An object of methods to convert from JavaScript's internal character
1756
+ * representation (UCS-2) to Unicode code points, and back.
1757
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
1758
+ * @memberOf punycode
1759
+ * @type Object
1760
+ */
1761
+ 'ucs2': {
1762
+ 'decode': ucs2decode,
1763
+ 'encode': ucs2encode
1764
+ },
1765
+ 'decode': decode,
1766
+ 'encode': encode,
1767
+ 'toASCII': toASCII,
1768
+ 'toUnicode': toUnicode
1769
+ };
2118
1770
 
2119
- function resolveComponents(base, relative) {
2120
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2121
- var skipNormalization = arguments[3];
2122
-
2123
- var target = {};
2124
- if (!skipNormalization) {
2125
- base = parse(serialize(base, options), options); //normalize base components
2126
- relative = parse(serialize(relative, options), options); //normalize relative components
2127
- }
2128
- options = options || {};
2129
- if (!options.tolerant && relative.scheme) {
2130
- target.scheme = relative.scheme;
2131
- //target.authority = relative.authority;
2132
- target.userinfo = relative.userinfo;
2133
- target.host = relative.host;
2134
- target.port = relative.port;
2135
- target.path = removeDotSegments(relative.path || "");
2136
- target.query = relative.query;
2137
- } else {
2138
- if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
2139
- //target.authority = relative.authority;
2140
- target.userinfo = relative.userinfo;
2141
- target.host = relative.host;
2142
- target.port = relative.port;
2143
- target.path = removeDotSegments(relative.path || "");
2144
- target.query = relative.query;
2145
- } else {
2146
- if (!relative.path) {
2147
- target.path = base.path;
2148
- if (relative.query !== undefined) {
2149
- target.query = relative.query;
2150
- } else {
2151
- target.query = base.query;
2152
- }
2153
- } else {
2154
- if (relative.path.charAt(0) === "/") {
2155
- target.path = removeDotSegments(relative.path);
2156
- } else {
2157
- if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
2158
- target.path = "/" + relative.path;
2159
- } else if (!base.path) {
2160
- target.path = relative.path;
2161
- } else {
2162
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
2163
- }
2164
- target.path = removeDotSegments(target.path);
2165
- }
2166
- target.query = relative.query;
2167
- }
2168
- //target.authority = base.authority;
2169
- target.userinfo = base.userinfo;
2170
- target.host = base.host;
2171
- target.port = base.port;
2172
- }
2173
- target.scheme = base.scheme;
2174
- }
2175
- target.fragment = relative.fragment;
2176
- return target;
2177
- }
1771
+ /**
1772
+ * URI.js
1773
+ *
1774
+ * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
1775
+ * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
1776
+ * @see http://github.com/garycourt/uri-js
1777
+ */
1778
+ /**
1779
+ * Copyright 2011 Gary Court. All rights reserved.
1780
+ *
1781
+ * Redistribution and use in source and binary forms, with or without modification, are
1782
+ * permitted provided that the following conditions are met:
1783
+ *
1784
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
1785
+ * conditions and the following disclaimer.
1786
+ *
1787
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
1788
+ * of conditions and the following disclaimer in the documentation and/or other materials
1789
+ * provided with the distribution.
1790
+ *
1791
+ * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
1792
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1793
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
1794
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1795
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1796
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1797
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1798
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
1799
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1800
+ *
1801
+ * The views and conclusions contained in the software and documentation are those of the
1802
+ * authors and should not be interpreted as representing official policies, either expressed
1803
+ * or implied, of Gary Court.
1804
+ */
1805
+ var SCHEMES = {};
1806
+ function pctEncChar(chr) {
1807
+ var c = chr.charCodeAt(0);
1808
+ var e = void 0;
1809
+ 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();
1810
+ return e;
1811
+ }
1812
+ function pctDecChars(str) {
1813
+ var newStr = "";
1814
+ var i = 0;
1815
+ var il = str.length;
1816
+ while (i < il) {
1817
+ var c = parseInt(str.substr(i + 1, 2), 16);
1818
+ if (c < 128) {
1819
+ newStr += String.fromCharCode(c);
1820
+ i += 3;
1821
+ } else if (c >= 194 && c < 224) {
1822
+ if (il - i >= 6) {
1823
+ var c2 = parseInt(str.substr(i + 4, 2), 16);
1824
+ newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
1825
+ } else {
1826
+ newStr += str.substr(i, 6);
1827
+ }
1828
+ i += 6;
1829
+ } else if (c >= 224) {
1830
+ if (il - i >= 9) {
1831
+ var _c = parseInt(str.substr(i + 4, 2), 16);
1832
+ var c3 = parseInt(str.substr(i + 7, 2), 16);
1833
+ newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
1834
+ } else {
1835
+ newStr += str.substr(i, 9);
1836
+ }
1837
+ i += 9;
1838
+ } else {
1839
+ newStr += str.substr(i, 3);
1840
+ i += 3;
1841
+ }
1842
+ }
1843
+ return newStr;
1844
+ }
1845
+ function _normalizeComponentEncoding(components, protocol) {
1846
+ function decodeUnreserved(str) {
1847
+ var decStr = pctDecChars(str);
1848
+ return !decStr.match(protocol.UNRESERVED) ? str : decStr;
1849
+ }
1850
+ if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
1851
+ if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
1852
+ 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);
1853
+ 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);
1854
+ if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
1855
+ if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
1856
+ return components;
1857
+ }
2178
1858
 
2179
- function resolve(baseURI, relativeURI, options) {
2180
- var schemelessOptions = assign({ scheme: 'null' }, options);
2181
- return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
2182
- }
1859
+ function _stripLeadingZeros(str) {
1860
+ return str.replace(/^0*(.*)/, "$1") || "0";
1861
+ }
1862
+ function _normalizeIPv4(host, protocol) {
1863
+ var matches = host.match(protocol.IPV4ADDRESS) || [];
2183
1864
 
2184
- function normalize(uri, options) {
2185
- if (typeof uri === "string") {
2186
- uri = serialize(parse(uri, options), options);
2187
- } else if (typeOf(uri) === "object") {
2188
- uri = parse(serialize(uri, options), options);
2189
- }
2190
- return uri;
2191
- }
1865
+ var _matches = slicedToArray(matches, 2),
1866
+ address = _matches[1];
2192
1867
 
2193
- function equal(uriA, uriB, options) {
2194
- if (typeof uriA === "string") {
2195
- uriA = serialize(parse(uriA, options), options);
2196
- } else if (typeOf(uriA) === "object") {
2197
- uriA = serialize(uriA, options);
2198
- }
2199
- if (typeof uriB === "string") {
2200
- uriB = serialize(parse(uriB, options), options);
2201
- } else if (typeOf(uriB) === "object") {
2202
- uriB = serialize(uriB, options);
2203
- }
2204
- return uriA === uriB;
2205
- }
1868
+ if (address) {
1869
+ return address.split(".").map(_stripLeadingZeros).join(".");
1870
+ } else {
1871
+ return host;
1872
+ }
1873
+ }
1874
+ function _normalizeIPv6(host, protocol) {
1875
+ var matches = host.match(protocol.IPV6ADDRESS) || [];
1876
+
1877
+ var _matches2 = slicedToArray(matches, 3),
1878
+ address = _matches2[1],
1879
+ zone = _matches2[2];
1880
+
1881
+ if (address) {
1882
+ var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
1883
+ _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
1884
+ last = _address$toLowerCase$2[0],
1885
+ first = _address$toLowerCase$2[1];
1886
+
1887
+ var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
1888
+ var lastFields = last.split(":").map(_stripLeadingZeros);
1889
+ var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
1890
+ var fieldCount = isLastFieldIPv4Address ? 7 : 8;
1891
+ var lastFieldsStart = lastFields.length - fieldCount;
1892
+ var fields = Array(fieldCount);
1893
+ for (var x = 0; x < fieldCount; ++x) {
1894
+ fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
1895
+ }
1896
+ if (isLastFieldIPv4Address) {
1897
+ fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
1898
+ }
1899
+ var allZeroFields = fields.reduce(function (acc, field, index) {
1900
+ if (!field || field === "0") {
1901
+ var lastLongest = acc[acc.length - 1];
1902
+ if (lastLongest && lastLongest.index + lastLongest.length === index) {
1903
+ lastLongest.length++;
1904
+ } else {
1905
+ acc.push({ index: index, length: 1 });
1906
+ }
1907
+ }
1908
+ return acc;
1909
+ }, []);
1910
+ var longestZeroFields = allZeroFields.sort(function (a, b) {
1911
+ return b.length - a.length;
1912
+ })[0];
1913
+ var newHost = void 0;
1914
+ if (longestZeroFields && longestZeroFields.length > 1) {
1915
+ var newFirst = fields.slice(0, longestZeroFields.index);
1916
+ var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
1917
+ newHost = newFirst.join(":") + "::" + newLast.join(":");
1918
+ } else {
1919
+ newHost = fields.join(":");
1920
+ }
1921
+ if (zone) {
1922
+ newHost += "%" + zone;
1923
+ }
1924
+ return newHost;
1925
+ } else {
1926
+ return host;
1927
+ }
1928
+ }
1929
+ var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
1930
+ var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
1931
+ function parse(uriString) {
1932
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1933
+
1934
+ var components = {};
1935
+ var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
1936
+ if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
1937
+ var matches = uriString.match(URI_PARSE);
1938
+ if (matches) {
1939
+ if (NO_MATCH_IS_UNDEFINED) {
1940
+ //store each component
1941
+ components.scheme = matches[1];
1942
+ components.userinfo = matches[3];
1943
+ components.host = matches[4];
1944
+ components.port = parseInt(matches[5], 10);
1945
+ components.path = matches[6] || "";
1946
+ components.query = matches[7];
1947
+ components.fragment = matches[8];
1948
+ //fix port number
1949
+ if (isNaN(components.port)) {
1950
+ components.port = matches[5];
1951
+ }
1952
+ } else {
1953
+ //IE FIX for improper RegExp matching
1954
+ //store each component
1955
+ components.scheme = matches[1] || undefined;
1956
+ components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
1957
+ components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
1958
+ components.port = parseInt(matches[5], 10);
1959
+ components.path = matches[6] || "";
1960
+ components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
1961
+ components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
1962
+ //fix port number
1963
+ if (isNaN(components.port)) {
1964
+ components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
1965
+ }
1966
+ }
1967
+ if (components.host) {
1968
+ //normalize IP hosts
1969
+ components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
1970
+ }
1971
+ //determine reference type
1972
+ if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
1973
+ components.reference = "same-document";
1974
+ } else if (components.scheme === undefined) {
1975
+ components.reference = "relative";
1976
+ } else if (components.fragment === undefined) {
1977
+ components.reference = "absolute";
1978
+ } else {
1979
+ components.reference = "uri";
1980
+ }
1981
+ //check for reference errors
1982
+ if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
1983
+ components.error = components.error || "URI is not a " + options.reference + " reference.";
1984
+ }
1985
+ //find scheme handler
1986
+ var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
1987
+ //check if scheme can't handle IRIs
1988
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
1989
+ //if host component is a domain name
1990
+ if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
1991
+ //convert Unicode IDN -> ASCII IDN
1992
+ try {
1993
+ components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
1994
+ } catch (e) {
1995
+ components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
1996
+ }
1997
+ }
1998
+ //convert IRI -> URI
1999
+ _normalizeComponentEncoding(components, URI_PROTOCOL);
2000
+ } else {
2001
+ //normalize encodings
2002
+ _normalizeComponentEncoding(components, protocol);
2003
+ }
2004
+ //perform scheme specific parsing
2005
+ if (schemeHandler && schemeHandler.parse) {
2006
+ schemeHandler.parse(components, options);
2007
+ }
2008
+ } else {
2009
+ components.error = components.error || "URI can not be parsed.";
2010
+ }
2011
+ return components;
2012
+ }
2206
2013
 
2207
- function escapeComponent(str, options) {
2208
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
2209
- }
2014
+ function _recomposeAuthority(components, options) {
2015
+ var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
2016
+ var uriTokens = [];
2017
+ if (components.userinfo !== undefined) {
2018
+ uriTokens.push(components.userinfo);
2019
+ uriTokens.push("@");
2020
+ }
2021
+ if (components.host !== undefined) {
2022
+ //normalize IP hosts, add brackets and escape zone separator for IPv6
2023
+ uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
2024
+ return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
2025
+ }));
2026
+ }
2027
+ if (typeof components.port === "number" || typeof components.port === "string") {
2028
+ uriTokens.push(":");
2029
+ uriTokens.push(String(components.port));
2030
+ }
2031
+ return uriTokens.length ? uriTokens.join("") : undefined;
2032
+ }
2210
2033
 
2211
- function unescapeComponent(str, options) {
2212
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
2213
- }
2034
+ var RDS1 = /^\.\.?\//;
2035
+ var RDS2 = /^\/\.(\/|$)/;
2036
+ var RDS3 = /^\/\.\.(\/|$)/;
2037
+ var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
2038
+ function removeDotSegments(input) {
2039
+ var output = [];
2040
+ while (input.length) {
2041
+ if (input.match(RDS1)) {
2042
+ input = input.replace(RDS1, "");
2043
+ } else if (input.match(RDS2)) {
2044
+ input = input.replace(RDS2, "/");
2045
+ } else if (input.match(RDS3)) {
2046
+ input = input.replace(RDS3, "/");
2047
+ output.pop();
2048
+ } else if (input === "." || input === "..") {
2049
+ input = "";
2050
+ } else {
2051
+ var im = input.match(RDS5);
2052
+ if (im) {
2053
+ var s = im[0];
2054
+ input = input.slice(s.length);
2055
+ output.push(s);
2056
+ } else {
2057
+ throw new Error("Unexpected dot segment condition");
2058
+ }
2059
+ }
2060
+ }
2061
+ return output.join("");
2062
+ }
2214
2063
 
2215
- var handler = {
2216
- scheme: "http",
2217
- domainHost: true,
2218
- parse: function parse(components, options) {
2219
- //report missing host
2220
- if (!components.host) {
2221
- components.error = components.error || "HTTP URIs must have a host.";
2222
- }
2223
- return components;
2224
- },
2225
- serialize: function serialize(components, options) {
2226
- var secure = String(components.scheme).toLowerCase() === "https";
2227
- //normalize the default port
2228
- if (components.port === (secure ? 443 : 80) || components.port === "") {
2229
- components.port = undefined;
2230
- }
2231
- //normalize the empty path
2232
- if (!components.path) {
2233
- components.path = "/";
2234
- }
2235
- //NOTE: We do not parse query strings for HTTP URIs
2236
- //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
2237
- //and not the HTTP spec.
2238
- return components;
2239
- }
2240
- };
2064
+ function serialize(components) {
2065
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2066
+
2067
+ var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
2068
+ var uriTokens = [];
2069
+ //find scheme handler
2070
+ var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
2071
+ //perform scheme specific serialization
2072
+ if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
2073
+ if (components.host) {
2074
+ //if host component is an IPv6 address
2075
+ if (protocol.IPV6ADDRESS.test(components.host)) ;
2076
+ //TODO: normalize IPv6 address as per RFC 5952
2077
+
2078
+ //if host component is a domain name
2079
+ else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
2080
+ //convert IDN via punycode
2081
+ try {
2082
+ components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
2083
+ } catch (e) {
2084
+ components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
2085
+ }
2086
+ }
2087
+ }
2088
+ //normalize encoding
2089
+ _normalizeComponentEncoding(components, protocol);
2090
+ if (options.reference !== "suffix" && components.scheme) {
2091
+ uriTokens.push(components.scheme);
2092
+ uriTokens.push(":");
2093
+ }
2094
+ var authority = _recomposeAuthority(components, options);
2095
+ if (authority !== undefined) {
2096
+ if (options.reference !== "suffix") {
2097
+ uriTokens.push("//");
2098
+ }
2099
+ uriTokens.push(authority);
2100
+ if (components.path && components.path.charAt(0) !== "/") {
2101
+ uriTokens.push("/");
2102
+ }
2103
+ }
2104
+ if (components.path !== undefined) {
2105
+ var s = components.path;
2106
+ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
2107
+ s = removeDotSegments(s);
2108
+ }
2109
+ if (authority === undefined) {
2110
+ s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
2111
+ }
2112
+ uriTokens.push(s);
2113
+ }
2114
+ if (components.query !== undefined) {
2115
+ uriTokens.push("?");
2116
+ uriTokens.push(components.query);
2117
+ }
2118
+ if (components.fragment !== undefined) {
2119
+ uriTokens.push("#");
2120
+ uriTokens.push(components.fragment);
2121
+ }
2122
+ return uriTokens.join(""); //merge tokens into a string
2123
+ }
2241
2124
 
2242
- var handler$1 = {
2243
- scheme: "https",
2244
- domainHost: handler.domainHost,
2245
- parse: handler.parse,
2246
- serialize: handler.serialize
2247
- };
2125
+ function resolveComponents(base, relative) {
2126
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2127
+ var skipNormalization = arguments[3];
2128
+
2129
+ var target = {};
2130
+ if (!skipNormalization) {
2131
+ base = parse(serialize(base, options), options); //normalize base components
2132
+ relative = parse(serialize(relative, options), options); //normalize relative components
2133
+ }
2134
+ options = options || {};
2135
+ if (!options.tolerant && relative.scheme) {
2136
+ target.scheme = relative.scheme;
2137
+ //target.authority = relative.authority;
2138
+ target.userinfo = relative.userinfo;
2139
+ target.host = relative.host;
2140
+ target.port = relative.port;
2141
+ target.path = removeDotSegments(relative.path || "");
2142
+ target.query = relative.query;
2143
+ } else {
2144
+ if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
2145
+ //target.authority = relative.authority;
2146
+ target.userinfo = relative.userinfo;
2147
+ target.host = relative.host;
2148
+ target.port = relative.port;
2149
+ target.path = removeDotSegments(relative.path || "");
2150
+ target.query = relative.query;
2151
+ } else {
2152
+ if (!relative.path) {
2153
+ target.path = base.path;
2154
+ if (relative.query !== undefined) {
2155
+ target.query = relative.query;
2156
+ } else {
2157
+ target.query = base.query;
2158
+ }
2159
+ } else {
2160
+ if (relative.path.charAt(0) === "/") {
2161
+ target.path = removeDotSegments(relative.path);
2162
+ } else {
2163
+ if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
2164
+ target.path = "/" + relative.path;
2165
+ } else if (!base.path) {
2166
+ target.path = relative.path;
2167
+ } else {
2168
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
2169
+ }
2170
+ target.path = removeDotSegments(target.path);
2171
+ }
2172
+ target.query = relative.query;
2173
+ }
2174
+ //target.authority = base.authority;
2175
+ target.userinfo = base.userinfo;
2176
+ target.host = base.host;
2177
+ target.port = base.port;
2178
+ }
2179
+ target.scheme = base.scheme;
2180
+ }
2181
+ target.fragment = relative.fragment;
2182
+ return target;
2183
+ }
2248
2184
 
2249
- function isSecure(wsComponents) {
2250
- return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
2251
- }
2252
- //RFC 6455
2253
- var handler$2 = {
2254
- scheme: "ws",
2255
- domainHost: true,
2256
- parse: function parse(components, options) {
2257
- var wsComponents = components;
2258
- //indicate if the secure flag is set
2259
- wsComponents.secure = isSecure(wsComponents);
2260
- //construct resouce name
2261
- wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
2262
- wsComponents.path = undefined;
2263
- wsComponents.query = undefined;
2264
- return wsComponents;
2265
- },
2266
- serialize: function serialize(wsComponents, options) {
2267
- //normalize the default port
2268
- if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
2269
- wsComponents.port = undefined;
2270
- }
2271
- //ensure scheme matches secure flag
2272
- if (typeof wsComponents.secure === 'boolean') {
2273
- wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
2274
- wsComponents.secure = undefined;
2275
- }
2276
- //reconstruct path from resource name
2277
- if (wsComponents.resourceName) {
2278
- var _wsComponents$resourc = wsComponents.resourceName.split('?'),
2279
- _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
2280
- path = _wsComponents$resourc2[0],
2281
- query = _wsComponents$resourc2[1];
2282
-
2283
- wsComponents.path = path && path !== '/' ? path : undefined;
2284
- wsComponents.query = query;
2285
- wsComponents.resourceName = undefined;
2286
- }
2287
- //forbid fragment component
2288
- wsComponents.fragment = undefined;
2289
- return wsComponents;
2290
- }
2291
- };
2185
+ function resolve(baseURI, relativeURI, options) {
2186
+ var schemelessOptions = assign({ scheme: 'null' }, options);
2187
+ return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
2188
+ }
2292
2189
 
2293
- var handler$3 = {
2294
- scheme: "wss",
2295
- domainHost: handler$2.domainHost,
2296
- parse: handler$2.parse,
2297
- serialize: handler$2.serialize
2298
- };
2190
+ function normalize(uri, options) {
2191
+ if (typeof uri === "string") {
2192
+ uri = serialize(parse(uri, options), options);
2193
+ } else if (typeOf(uri) === "object") {
2194
+ uri = parse(serialize(uri, options), options);
2195
+ }
2196
+ return uri;
2197
+ }
2299
2198
 
2300
- var O = {};
2301
- //RFC 3986
2302
- var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
2303
- var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
2304
- var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
2305
- //RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
2306
- //const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
2307
- //const WSP$$ = "[\\x20\\x09]";
2308
- //const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
2309
- //const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
2310
- //const VCHAR$$ = "[\\x21-\\x7E]";
2311
- //const WSP$$ = "[\\x20\\x09]";
2312
- //const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
2313
- //const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
2314
- //const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
2315
- //const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
2316
- var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
2317
- var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
2318
- var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
2319
- var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
2320
- var UNRESERVED = new RegExp(UNRESERVED$$, "g");
2321
- var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
2322
- var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
2323
- var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
2324
- var NOT_HFVALUE = NOT_HFNAME;
2325
- function decodeUnreserved(str) {
2326
- var decStr = pctDecChars(str);
2327
- return !decStr.match(UNRESERVED) ? str : decStr;
2328
- }
2329
- var handler$4 = {
2330
- scheme: "mailto",
2331
- parse: function parse$$1(components, options) {
2332
- var mailtoComponents = components;
2333
- var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
2334
- mailtoComponents.path = undefined;
2335
- if (mailtoComponents.query) {
2336
- var unknownHeaders = false;
2337
- var headers = {};
2338
- var hfields = mailtoComponents.query.split("&");
2339
- for (var x = 0, xl = hfields.length; x < xl; ++x) {
2340
- var hfield = hfields[x].split("=");
2341
- switch (hfield[0]) {
2342
- case "to":
2343
- var toAddrs = hfield[1].split(",");
2344
- for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
2345
- to.push(toAddrs[_x]);
2346
- }
2347
- break;
2348
- case "subject":
2349
- mailtoComponents.subject = unescapeComponent(hfield[1], options);
2350
- break;
2351
- case "body":
2352
- mailtoComponents.body = unescapeComponent(hfield[1], options);
2353
- break;
2354
- default:
2355
- unknownHeaders = true;
2356
- headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
2357
- break;
2358
- }
2359
- }
2360
- if (unknownHeaders) mailtoComponents.headers = headers;
2361
- }
2362
- mailtoComponents.query = undefined;
2363
- for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
2364
- var addr = to[_x2].split("@");
2365
- addr[0] = unescapeComponent(addr[0]);
2366
- if (!options.unicodeSupport) {
2367
- //convert Unicode IDN -> ASCII IDN
2368
- try {
2369
- addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
2370
- } catch (e) {
2371
- mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
2372
- }
2373
- } else {
2374
- addr[1] = unescapeComponent(addr[1], options).toLowerCase();
2375
- }
2376
- to[_x2] = addr.join("@");
2377
- }
2378
- return mailtoComponents;
2379
- },
2380
- serialize: function serialize$$1(mailtoComponents, options) {
2381
- var components = mailtoComponents;
2382
- var to = toArray(mailtoComponents.to);
2383
- if (to) {
2384
- for (var x = 0, xl = to.length; x < xl; ++x) {
2385
- var toAddr = String(to[x]);
2386
- var atIdx = toAddr.lastIndexOf("@");
2387
- var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
2388
- var domain = toAddr.slice(atIdx + 1);
2389
- //convert IDN via punycode
2390
- try {
2391
- domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
2392
- } catch (e) {
2393
- components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
2394
- }
2395
- to[x] = localPart + "@" + domain;
2396
- }
2397
- components.path = to.join(",");
2398
- }
2399
- var headers = mailtoComponents.headers = mailtoComponents.headers || {};
2400
- if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
2401
- if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
2402
- var fields = [];
2403
- for (var name in headers) {
2404
- if (headers[name] !== O[name]) {
2405
- 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));
2406
- }
2407
- }
2408
- if (fields.length) {
2409
- components.query = fields.join("&");
2410
- }
2411
- return components;
2412
- }
2413
- };
2199
+ function equal(uriA, uriB, options) {
2200
+ if (typeof uriA === "string") {
2201
+ uriA = serialize(parse(uriA, options), options);
2202
+ } else if (typeOf(uriA) === "object") {
2203
+ uriA = serialize(uriA, options);
2204
+ }
2205
+ if (typeof uriB === "string") {
2206
+ uriB = serialize(parse(uriB, options), options);
2207
+ } else if (typeOf(uriB) === "object") {
2208
+ uriB = serialize(uriB, options);
2209
+ }
2210
+ return uriA === uriB;
2211
+ }
2414
2212
 
2415
- var URN_PARSE = /^([^\:]+)\:(.*)/;
2416
- //RFC 2141
2417
- var handler$5 = {
2418
- scheme: "urn",
2419
- parse: function parse$$1(components, options) {
2420
- var matches = components.path && components.path.match(URN_PARSE);
2421
- var urnComponents = components;
2422
- if (matches) {
2423
- var scheme = options.scheme || urnComponents.scheme || "urn";
2424
- var nid = matches[1].toLowerCase();
2425
- var nss = matches[2];
2426
- var urnScheme = scheme + ":" + (options.nid || nid);
2427
- var schemeHandler = SCHEMES[urnScheme];
2428
- urnComponents.nid = nid;
2429
- urnComponents.nss = nss;
2430
- urnComponents.path = undefined;
2431
- if (schemeHandler) {
2432
- urnComponents = schemeHandler.parse(urnComponents, options);
2433
- }
2434
- } else {
2435
- urnComponents.error = urnComponents.error || "URN can not be parsed.";
2436
- }
2437
- return urnComponents;
2438
- },
2439
- serialize: function serialize$$1(urnComponents, options) {
2440
- var scheme = options.scheme || urnComponents.scheme || "urn";
2441
- var nid = urnComponents.nid;
2442
- var urnScheme = scheme + ":" + (options.nid || nid);
2443
- var schemeHandler = SCHEMES[urnScheme];
2444
- if (schemeHandler) {
2445
- urnComponents = schemeHandler.serialize(urnComponents, options);
2446
- }
2447
- var uriComponents = urnComponents;
2448
- var nss = urnComponents.nss;
2449
- uriComponents.path = (nid || options.nid) + ":" + nss;
2450
- return uriComponents;
2451
- }
2452
- };
2213
+ function escapeComponent(str, options) {
2214
+ return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
2215
+ }
2453
2216
 
2454
- var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
2455
- //RFC 4122
2456
- var handler$6 = {
2457
- scheme: "urn:uuid",
2458
- parse: function parse(urnComponents, options) {
2459
- var uuidComponents = urnComponents;
2460
- uuidComponents.uuid = uuidComponents.nss;
2461
- uuidComponents.nss = undefined;
2462
- if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
2463
- uuidComponents.error = uuidComponents.error || "UUID is not valid.";
2464
- }
2465
- return uuidComponents;
2466
- },
2467
- serialize: function serialize(uuidComponents, options) {
2468
- var urnComponents = uuidComponents;
2469
- //normalize UUID
2470
- urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
2471
- return urnComponents;
2472
- }
2473
- };
2217
+ function unescapeComponent(str, options) {
2218
+ return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
2219
+ }
2474
2220
 
2475
- SCHEMES[handler.scheme] = handler;
2476
- SCHEMES[handler$1.scheme] = handler$1;
2477
- SCHEMES[handler$2.scheme] = handler$2;
2478
- SCHEMES[handler$3.scheme] = handler$3;
2479
- SCHEMES[handler$4.scheme] = handler$4;
2480
- SCHEMES[handler$5.scheme] = handler$5;
2481
- SCHEMES[handler$6.scheme] = handler$6;
2482
-
2483
- exports.SCHEMES = SCHEMES;
2484
- exports.pctEncChar = pctEncChar;
2485
- exports.pctDecChars = pctDecChars;
2486
- exports.parse = parse;
2487
- exports.removeDotSegments = removeDotSegments;
2488
- exports.serialize = serialize;
2489
- exports.resolveComponents = resolveComponents;
2490
- exports.resolve = resolve;
2491
- exports.normalize = normalize;
2492
- exports.equal = equal;
2493
- exports.escapeComponent = escapeComponent;
2494
- exports.unescapeComponent = unescapeComponent;
2495
-
2496
- Object.defineProperty(exports, '__esModule', { value: true });
2497
-
2498
- })));
2499
-
2500
- }(uri_all, uri_all.exports));
2221
+ var handler = {
2222
+ scheme: "http",
2223
+ domainHost: true,
2224
+ parse: function parse(components, options) {
2225
+ //report missing host
2226
+ if (!components.host) {
2227
+ components.error = components.error || "HTTP URIs must have a host.";
2228
+ }
2229
+ return components;
2230
+ },
2231
+ serialize: function serialize(components, options) {
2232
+ var secure = String(components.scheme).toLowerCase() === "https";
2233
+ //normalize the default port
2234
+ if (components.port === (secure ? 443 : 80) || components.port === "") {
2235
+ components.port = undefined;
2236
+ }
2237
+ //normalize the empty path
2238
+ if (!components.path) {
2239
+ components.path = "/";
2240
+ }
2241
+ //NOTE: We do not parse query strings for HTTP URIs
2242
+ //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
2243
+ //and not the HTTP spec.
2244
+ return components;
2245
+ }
2246
+ };
2247
+
2248
+ var handler$1 = {
2249
+ scheme: "https",
2250
+ domainHost: handler.domainHost,
2251
+ parse: handler.parse,
2252
+ serialize: handler.serialize
2253
+ };
2254
+
2255
+ function isSecure(wsComponents) {
2256
+ return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
2257
+ }
2258
+ //RFC 6455
2259
+ var handler$2 = {
2260
+ scheme: "ws",
2261
+ domainHost: true,
2262
+ parse: function parse(components, options) {
2263
+ var wsComponents = components;
2264
+ //indicate if the secure flag is set
2265
+ wsComponents.secure = isSecure(wsComponents);
2266
+ //construct resouce name
2267
+ wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
2268
+ wsComponents.path = undefined;
2269
+ wsComponents.query = undefined;
2270
+ return wsComponents;
2271
+ },
2272
+ serialize: function serialize(wsComponents, options) {
2273
+ //normalize the default port
2274
+ if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
2275
+ wsComponents.port = undefined;
2276
+ }
2277
+ //ensure scheme matches secure flag
2278
+ if (typeof wsComponents.secure === 'boolean') {
2279
+ wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
2280
+ wsComponents.secure = undefined;
2281
+ }
2282
+ //reconstruct path from resource name
2283
+ if (wsComponents.resourceName) {
2284
+ var _wsComponents$resourc = wsComponents.resourceName.split('?'),
2285
+ _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
2286
+ path = _wsComponents$resourc2[0],
2287
+ query = _wsComponents$resourc2[1];
2288
+
2289
+ wsComponents.path = path && path !== '/' ? path : undefined;
2290
+ wsComponents.query = query;
2291
+ wsComponents.resourceName = undefined;
2292
+ }
2293
+ //forbid fragment component
2294
+ wsComponents.fragment = undefined;
2295
+ return wsComponents;
2296
+ }
2297
+ };
2298
+
2299
+ var handler$3 = {
2300
+ scheme: "wss",
2301
+ domainHost: handler$2.domainHost,
2302
+ parse: handler$2.parse,
2303
+ serialize: handler$2.serialize
2304
+ };
2305
+
2306
+ var O = {};
2307
+ //RFC 3986
2308
+ var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
2309
+ var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
2310
+ var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
2311
+ //RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
2312
+ //const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
2313
+ //const WSP$$ = "[\\x20\\x09]";
2314
+ //const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
2315
+ //const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
2316
+ //const VCHAR$$ = "[\\x21-\\x7E]";
2317
+ //const WSP$$ = "[\\x20\\x09]";
2318
+ //const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
2319
+ //const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
2320
+ //const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
2321
+ //const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
2322
+ var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
2323
+ var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
2324
+ var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
2325
+ var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
2326
+ var UNRESERVED = new RegExp(UNRESERVED$$, "g");
2327
+ var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
2328
+ var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
2329
+ var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
2330
+ var NOT_HFVALUE = NOT_HFNAME;
2331
+ function decodeUnreserved(str) {
2332
+ var decStr = pctDecChars(str);
2333
+ return !decStr.match(UNRESERVED) ? str : decStr;
2334
+ }
2335
+ var handler$4 = {
2336
+ scheme: "mailto",
2337
+ parse: function parse$$1(components, options) {
2338
+ var mailtoComponents = components;
2339
+ var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
2340
+ mailtoComponents.path = undefined;
2341
+ if (mailtoComponents.query) {
2342
+ var unknownHeaders = false;
2343
+ var headers = {};
2344
+ var hfields = mailtoComponents.query.split("&");
2345
+ for (var x = 0, xl = hfields.length; x < xl; ++x) {
2346
+ var hfield = hfields[x].split("=");
2347
+ switch (hfield[0]) {
2348
+ case "to":
2349
+ var toAddrs = hfield[1].split(",");
2350
+ for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
2351
+ to.push(toAddrs[_x]);
2352
+ }
2353
+ break;
2354
+ case "subject":
2355
+ mailtoComponents.subject = unescapeComponent(hfield[1], options);
2356
+ break;
2357
+ case "body":
2358
+ mailtoComponents.body = unescapeComponent(hfield[1], options);
2359
+ break;
2360
+ default:
2361
+ unknownHeaders = true;
2362
+ headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
2363
+ break;
2364
+ }
2365
+ }
2366
+ if (unknownHeaders) mailtoComponents.headers = headers;
2367
+ }
2368
+ mailtoComponents.query = undefined;
2369
+ for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
2370
+ var addr = to[_x2].split("@");
2371
+ addr[0] = unescapeComponent(addr[0]);
2372
+ if (!options.unicodeSupport) {
2373
+ //convert Unicode IDN -> ASCII IDN
2374
+ try {
2375
+ addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
2376
+ } catch (e) {
2377
+ mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
2378
+ }
2379
+ } else {
2380
+ addr[1] = unescapeComponent(addr[1], options).toLowerCase();
2381
+ }
2382
+ to[_x2] = addr.join("@");
2383
+ }
2384
+ return mailtoComponents;
2385
+ },
2386
+ serialize: function serialize$$1(mailtoComponents, options) {
2387
+ var components = mailtoComponents;
2388
+ var to = toArray(mailtoComponents.to);
2389
+ if (to) {
2390
+ for (var x = 0, xl = to.length; x < xl; ++x) {
2391
+ var toAddr = String(to[x]);
2392
+ var atIdx = toAddr.lastIndexOf("@");
2393
+ var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
2394
+ var domain = toAddr.slice(atIdx + 1);
2395
+ //convert IDN via punycode
2396
+ try {
2397
+ domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
2398
+ } catch (e) {
2399
+ components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
2400
+ }
2401
+ to[x] = localPart + "@" + domain;
2402
+ }
2403
+ components.path = to.join(",");
2404
+ }
2405
+ var headers = mailtoComponents.headers = mailtoComponents.headers || {};
2406
+ if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
2407
+ if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
2408
+ var fields = [];
2409
+ for (var name in headers) {
2410
+ if (headers[name] !== O[name]) {
2411
+ 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));
2412
+ }
2413
+ }
2414
+ if (fields.length) {
2415
+ components.query = fields.join("&");
2416
+ }
2417
+ return components;
2418
+ }
2419
+ };
2420
+
2421
+ var URN_PARSE = /^([^\:]+)\:(.*)/;
2422
+ //RFC 2141
2423
+ var handler$5 = {
2424
+ scheme: "urn",
2425
+ parse: function parse$$1(components, options) {
2426
+ var matches = components.path && components.path.match(URN_PARSE);
2427
+ var urnComponents = components;
2428
+ if (matches) {
2429
+ var scheme = options.scheme || urnComponents.scheme || "urn";
2430
+ var nid = matches[1].toLowerCase();
2431
+ var nss = matches[2];
2432
+ var urnScheme = scheme + ":" + (options.nid || nid);
2433
+ var schemeHandler = SCHEMES[urnScheme];
2434
+ urnComponents.nid = nid;
2435
+ urnComponents.nss = nss;
2436
+ urnComponents.path = undefined;
2437
+ if (schemeHandler) {
2438
+ urnComponents = schemeHandler.parse(urnComponents, options);
2439
+ }
2440
+ } else {
2441
+ urnComponents.error = urnComponents.error || "URN can not be parsed.";
2442
+ }
2443
+ return urnComponents;
2444
+ },
2445
+ serialize: function serialize$$1(urnComponents, options) {
2446
+ var scheme = options.scheme || urnComponents.scheme || "urn";
2447
+ var nid = urnComponents.nid;
2448
+ var urnScheme = scheme + ":" + (options.nid || nid);
2449
+ var schemeHandler = SCHEMES[urnScheme];
2450
+ if (schemeHandler) {
2451
+ urnComponents = schemeHandler.serialize(urnComponents, options);
2452
+ }
2453
+ var uriComponents = urnComponents;
2454
+ var nss = urnComponents.nss;
2455
+ uriComponents.path = (nid || options.nid) + ":" + nss;
2456
+ return uriComponents;
2457
+ }
2458
+ };
2459
+
2460
+ var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
2461
+ //RFC 4122
2462
+ var handler$6 = {
2463
+ scheme: "urn:uuid",
2464
+ parse: function parse(urnComponents, options) {
2465
+ var uuidComponents = urnComponents;
2466
+ uuidComponents.uuid = uuidComponents.nss;
2467
+ uuidComponents.nss = undefined;
2468
+ if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
2469
+ uuidComponents.error = uuidComponents.error || "UUID is not valid.";
2470
+ }
2471
+ return uuidComponents;
2472
+ },
2473
+ serialize: function serialize(uuidComponents, options) {
2474
+ var urnComponents = uuidComponents;
2475
+ //normalize UUID
2476
+ urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
2477
+ return urnComponents;
2478
+ }
2479
+ };
2480
+
2481
+ SCHEMES[handler.scheme] = handler;
2482
+ SCHEMES[handler$1.scheme] = handler$1;
2483
+ SCHEMES[handler$2.scheme] = handler$2;
2484
+ SCHEMES[handler$3.scheme] = handler$3;
2485
+ SCHEMES[handler$4.scheme] = handler$4;
2486
+ SCHEMES[handler$5.scheme] = handler$5;
2487
+ SCHEMES[handler$6.scheme] = handler$6;
2488
+
2489
+ exports.SCHEMES = SCHEMES;
2490
+ exports.pctEncChar = pctEncChar;
2491
+ exports.pctDecChars = pctDecChars;
2492
+ exports.parse = parse;
2493
+ exports.removeDotSegments = removeDotSegments;
2494
+ exports.serialize = serialize;
2495
+ exports.resolveComponents = resolveComponents;
2496
+ exports.resolve = resolve;
2497
+ exports.normalize = normalize;
2498
+ exports.equal = equal;
2499
+ exports.escapeComponent = escapeComponent;
2500
+ exports.unescapeComponent = unescapeComponent;
2501
+
2502
+ Object.defineProperty(exports, '__esModule', { value: true });
2503
+
2504
+ })));
2505
+
2506
+ } (uri_all, uri_all.exports));
2507
+
2508
+ var uri_allExports = uri_all.exports;
2501
2509
 
2502
2510
  // do not edit .js files directly - edit src/index.jst
2503
2511
 
@@ -2898,11 +2906,13 @@ function escapeJsonPtr(str) {
2898
2906
  return str.replace(/~/g, '~0').replace(/\//g, '~1');
2899
2907
  }
2900
2908
 
2901
- var URI$1 = uri_all.exports
2909
+ var jsonSchemaTraverseExports = jsonSchemaTraverse.exports;
2910
+
2911
+ var URI$1 = uri_allExports
2902
2912
  , equal$1 = fastDeepEqual
2903
2913
  , util$3 = util$5
2904
2914
  , SchemaObject$1 = schema_obj
2905
- , traverse = jsonSchemaTraverse.exports;
2915
+ , traverse = jsonSchemaTraverseExports;
2906
2916
 
2907
2917
  var resolve_1 = resolve$3;
2908
2918
 
@@ -4152,6 +4162,8 @@ Cache$1.prototype.clear = function Cache_clear() {
4152
4162
  this._cache = {};
4153
4163
  };
4154
4164
 
4165
+ var cacheExports = cache.exports;
4166
+
4155
4167
  var util$1 = util$5;
4156
4168
 
4157
4169
  var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
@@ -7718,7 +7730,7 @@ var require$$12 = {
7718
7730
 
7719
7731
  var compileSchema = compile_1
7720
7732
  , resolve = resolve_1
7721
- , Cache = cache.exports
7733
+ , Cache = cacheExports
7722
7734
  , SchemaObject = schema_obj
7723
7735
  , stableStringify = fastJsonStableStringify
7724
7736
  , formats = formats_1
@@ -8221,9 +8233,11 @@ function setLogger(self) {
8221
8233
 
8222
8234
  function noop() {}
8223
8235
 
8236
+ var ajv$1 = /*@__PURE__*/getDefaultExportFromCjs(ajv);
8237
+
8224
8238
  var _Ajv = /*#__PURE__*/_mergeNamespaces({
8225
8239
  __proto__: null,
8226
- 'default': ajv
8240
+ default: ajv$1
8227
8241
  }, [ajv]);
8228
8242
 
8229
8243
  var $ref = "#/definitions/Schema";
@@ -9806,11 +9820,11 @@ var _ddl2Schema = /*#__PURE__*/Object.freeze({
9806
9820
  __proto__: null,
9807
9821
  $ref: $ref,
9808
9822
  $schema: $schema,
9809
- definitions: definitions,
9810
- 'default': v2
9823
+ default: v2,
9824
+ definitions: definitions
9811
9825
  });
9812
9826
 
9813
- var Ajv = ajv || _Ajv;
9827
+ var Ajv = ajv$1 || _Ajv;
9814
9828
  var ddl2Schema = _ddl2Schema;
9815
9829
  var options = {
9816
9830
  allErrors: false,