@scenid/react-formulator 2.0.0 → 2.1.1

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.cjs.js CHANGED
@@ -11,8 +11,6 @@ var styles = require('@mui/styles');
11
11
  var iconsMaterial = require('@mui/icons-material');
12
12
  var Autocomplete = require('@mui/material/Autocomplete');
13
13
  var path$3 = require('path');
14
- var proc = require('process');
15
- var url = require('url');
16
14
  var styles$1 = require('@mui/material/styles');
17
15
 
18
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -23,7 +21,6 @@ var makeStyles__default = /*#__PURE__*/_interopDefaultLegacy(makeStyles);
23
21
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
24
22
  var Autocomplete__default = /*#__PURE__*/_interopDefaultLegacy(Autocomplete);
25
23
  var path__default = /*#__PURE__*/_interopDefaultLegacy(path$3);
26
- var proc__default = /*#__PURE__*/_interopDefaultLegacy(proc);
27
24
 
28
25
  function _classCallCheck(instance, Constructor) {
29
26
  if (!(instance instanceof Constructor)) {
@@ -1530,9 +1527,9 @@ var engineUserAgent = getBuiltIn$K('navigator', 'userAgent') || '';
1530
1527
  var global$Y = global$_;
1531
1528
  var userAgent$7 = engineUserAgent;
1532
1529
 
1533
- var process$5 = global$Y.process;
1530
+ var process$6 = global$Y.process;
1534
1531
  var Deno$1 = global$Y.Deno;
1535
- var versions = process$5 && process$5.versions || Deno$1 && Deno$1.version;
1532
+ var versions = process$6 && process$6.versions || Deno$1 && Deno$1.version;
1536
1533
  var v8 = versions && versions.v8;
1537
1534
  var match$1, version$1;
1538
1535
 
@@ -1688,13 +1685,13 @@ var toObject$B = function (argument) {
1688
1685
  var uncurryThis$1p = functionUncurryThis;
1689
1686
  var toObject$A = toObject$B;
1690
1687
 
1691
- var hasOwnProperty$2 = uncurryThis$1p({}.hasOwnProperty);
1688
+ var hasOwnProperty$3 = uncurryThis$1p({}.hasOwnProperty);
1692
1689
 
1693
1690
  // `HasOwnProperty` abstract operation
1694
1691
  // https://tc39.es/ecma262/#sec-hasownproperty
1695
1692
  // eslint-disable-next-line es-x/no-object-hasown -- safe
1696
1693
  var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
1697
- return hasOwnProperty$2(toObject$A(it), key);
1694
+ return hasOwnProperty$3(toObject$A(it), key);
1698
1695
  };
1699
1696
 
1700
1697
  var uncurryThis$1o = functionUncurryThis;
@@ -8269,7 +8266,7 @@ var IS_NODE$5 = engineIsNode;
8269
8266
 
8270
8267
  var set$1 = global$A.setImmediate;
8271
8268
  var clear = global$A.clearImmediate;
8272
- var process$4 = global$A.process;
8269
+ var process$5 = global$A.process;
8273
8270
  var Dispatch = global$A.Dispatch;
8274
8271
  var Function$2 = global$A.Function;
8275
8272
  var MessageChannel = global$A.MessageChannel;
@@ -8325,7 +8322,7 @@ if (!set$1 || !clear) {
8325
8322
  // Node.js 0.8-
8326
8323
  if (IS_NODE$5) {
8327
8324
  defer = function (id) {
8328
- process$4.nextTick(runner(id));
8325
+ process$5.nextTick(runner(id));
8329
8326
  };
8330
8327
  // Sphere (JS game engine) Dispatch API
8331
8328
  } else if (Dispatch && Dispatch.now) {
@@ -8391,7 +8388,7 @@ var IS_NODE$4 = engineIsNode;
8391
8388
 
8392
8389
  var MutationObserver = global$y.MutationObserver || global$y.WebKitMutationObserver;
8393
8390
  var document$4 = global$y.document;
8394
- var process$3 = global$y.process;
8391
+ var process$4 = global$y.process;
8395
8392
  var Promise$4 = global$y.Promise;
8396
8393
  // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
8397
8394
  var queueMicrotaskDescriptor = getOwnPropertyDescriptor$5(global$y, 'queueMicrotask');
@@ -8403,7 +8400,7 @@ var flush, head, last, notify$1, toggle, node, promise, then;
8403
8400
  if (!queueMicrotask) {
8404
8401
  flush = function () {
8405
8402
  var parent, fn;
8406
- if (IS_NODE$4 && (parent = process$3.domain)) parent.exit();
8403
+ if (IS_NODE$4 && (parent = process$4.domain)) parent.exit();
8407
8404
  while (head) {
8408
8405
  fn = head.fn;
8409
8406
  head = head.next;
@@ -8440,7 +8437,7 @@ if (!queueMicrotask) {
8440
8437
  // Node.js without promises
8441
8438
  } else if (IS_NODE$4) {
8442
8439
  notify$1 = function () {
8443
- process$3.nextTick(flush);
8440
+ process$4.nextTick(flush);
8444
8441
  };
8445
8442
  // for other environments - macrotask based on:
8446
8443
  // - setImmediate
@@ -8612,7 +8609,7 @@ var PromiseConstructor = NativePromiseConstructor$3;
8612
8609
  var PromisePrototype = NativePromisePrototype$2;
8613
8610
  var TypeError$4 = global$u.TypeError;
8614
8611
  var document$3 = global$u.document;
8615
- var process$2 = global$u.process;
8612
+ var process$3 = global$u.process;
8616
8613
  var newPromiseCapability$1 = newPromiseCapabilityModule$6.f;
8617
8614
  var newGenericPromiseCapability = newPromiseCapability$1;
8618
8615
 
@@ -8704,7 +8701,7 @@ var onUnhandled = function (state) {
8704
8701
  if (IS_UNHANDLED) {
8705
8702
  result = perform$5(function () {
8706
8703
  if (IS_NODE$3) {
8707
- process$2.emit('unhandledRejection', value, promise);
8704
+ process$3.emit('unhandledRejection', value, promise);
8708
8705
  } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
8709
8706
  });
8710
8707
  // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
@@ -8722,7 +8719,7 @@ var onHandleUnhandled = function (state) {
8722
8719
  call$T(task, global$u, function () {
8723
8720
  var promise = state.facade;
8724
8721
  if (IS_NODE$3) {
8725
- process$2.emit('rejectionHandled', promise);
8722
+ process$3.emit('rejectionHandled', promise);
8726
8723
  } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
8727
8724
  });
8728
8725
  };
@@ -8810,7 +8807,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
8810
8807
  state.parent = true;
8811
8808
  reaction.ok = isCallable$f(onFulfilled) ? onFulfilled : true;
8812
8809
  reaction.fail = isCallable$f(onRejected) && onRejected;
8813
- reaction.domain = IS_NODE$3 ? process$2.domain : undefined;
8810
+ reaction.domain = IS_NODE$3 ? process$3.domain : undefined;
8814
8811
  if (state.state == PENDING) state.reactions.add(reaction);
8815
8812
  else microtask$1(function () {
8816
8813
  callReaction(reaction, state);
@@ -17082,7 +17079,7 @@ var aCallable = aCallable$Y;
17082
17079
  var validateArgumentsLength$4 = validateArgumentsLength$8;
17083
17080
  var IS_NODE$1 = engineIsNode;
17084
17081
 
17085
- var process$1 = global$7.process;
17082
+ var process$2 = global$7.process;
17086
17083
 
17087
17084
  // `queueMicrotask` method
17088
17085
  // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask
@@ -17090,7 +17087,7 @@ $$6({ global: true, enumerable: true, dontCallGetSet: true }, {
17090
17087
  queueMicrotask: function queueMicrotask(fn) {
17091
17088
  validateArgumentsLength$4(arguments.length, 1);
17092
17089
  aCallable(fn);
17093
- var domain = IS_NODE$1 && process$1.domain;
17090
+ var domain = IS_NODE$1 && process$2.domain;
17094
17091
  microtask(domain ? domain.bind(fn) : fn);
17095
17092
  }
17096
17093
  });
@@ -17757,7 +17754,7 @@ var adapt = function (delta, numPoints, firstTime) {
17757
17754
  * Converts a string of Unicode symbols (e.g. a domain name label) to a
17758
17755
  * Punycode string of ASCII-only symbols.
17759
17756
  */
17760
- var encode$2 = function (input) {
17757
+ var encode$3 = function (input) {
17761
17758
  var output = [];
17762
17759
 
17763
17760
  // Convert the input in UCS-2 to an array of Unicode code points.
@@ -17846,7 +17843,7 @@ var stringPunycodeToAscii = function (input) {
17846
17843
  var i, label;
17847
17844
  for (i = 0; i < labels.length; i++) {
17848
17845
  label = labels[i];
17849
- push$3(encoded, exec$1(regexNonASCII, label) ? 'xn--' + encode$2(label) : label);
17846
+ push$3(encoded, exec$1(regexNonASCII, label) ? 'xn--' + encode$3(label) : label);
17850
17847
  }
17851
17848
  return join$2(encoded, '.');
17852
17849
  };
@@ -17903,7 +17900,7 @@ var RequestPrototype = NativeRequest && NativeRequest.prototype;
17903
17900
  var HeadersPrototype = Headers && Headers.prototype;
17904
17901
  var RegExp$1 = global$2.RegExp;
17905
17902
  var TypeError$2 = global$2.TypeError;
17906
- var decodeURIComponent = global$2.decodeURIComponent;
17903
+ var decodeURIComponent$1 = global$2.decodeURIComponent;
17907
17904
  var encodeURIComponent$1 = global$2.encodeURIComponent;
17908
17905
  var charAt$1 = uncurryThis$1(''.charAt);
17909
17906
  var join$1 = uncurryThis$1([].join);
@@ -17923,7 +17920,7 @@ var percentSequence = function (bytes) {
17923
17920
 
17924
17921
  var percentDecode = function (sequence) {
17925
17922
  try {
17926
- return decodeURIComponent(sequence);
17923
+ return decodeURIComponent$1(sequence);
17927
17924
  } catch (error) {
17928
17925
  return sequence;
17929
17926
  }
@@ -17933,7 +17930,7 @@ var deserialize = function (it) {
17933
17930
  var result = replace$2(it, plus, ' ');
17934
17931
  var bytes = 4;
17935
17932
  try {
17936
- return decodeURIComponent(result);
17933
+ return decodeURIComponent$1(result);
17937
17934
  } catch (error) {
17938
17935
  while (bytes) {
17939
17936
  result = replace$2(result, percentSequence(bytes--), percentDecode);
@@ -29673,6 +29670,107 @@ function _extends() {
29673
29670
  return _extends.apply(this, arguments);
29674
29671
  }
29675
29672
 
29673
+ var FormDateRange = function FormDateRange(_ref) {
29674
+ var type = _ref.type,
29675
+ name = _ref.name,
29676
+ label = _ref.label,
29677
+ variant = _ref.variant,
29678
+ value = _ref.value,
29679
+ defaultValue = _ref.defaultValue,
29680
+ required = _ref.required,
29681
+ loading = _ref.loading,
29682
+ disabled = _ref.disabled,
29683
+ onChange = _ref.onChange;
29684
+
29685
+ var changeHandler = function changeHandler(newValue) {
29686
+ if (onChange) {
29687
+ onChange({
29688
+ target: {
29689
+ name: name,
29690
+ value: newValue
29691
+ }
29692
+ });
29693
+ }
29694
+ };
29695
+
29696
+ var handleStartChange = function handleStartChange(e) {
29697
+ var newValue = structuredClone(value || {});
29698
+ newValue.start = e.target.value;
29699
+ changeHandler(newValue);
29700
+ };
29701
+
29702
+ var handleEndChange = function handleEndChange(e) {
29703
+ var newValue = structuredClone(value || {});
29704
+ newValue.end = e.target.value;
29705
+ changeHandler(newValue);
29706
+ };
29707
+
29708
+ return /*#__PURE__*/React__default["default"].createElement(material.Stack, null, /*#__PURE__*/React__default["default"].createElement(material.Typography, {
29709
+ mb: 1
29710
+ }, label), /*#__PURE__*/React__default["default"].createElement(material.Stack, {
29711
+ direction: "row",
29712
+ sx: {
29713
+ flex: '1 1 auto',
29714
+ width: '100%'
29715
+ }
29716
+ }, /*#__PURE__*/React__default["default"].createElement(material.TextField, {
29717
+ sx: {
29718
+ flex: '1 1 auto'
29719
+ },
29720
+ type: type,
29721
+ name: "".concat(name, ".start"),
29722
+ label: "von",
29723
+ variant: variant,
29724
+ InputLabelProps: {
29725
+ shrink: true
29726
+ },
29727
+ value: (value === null || value === void 0 ? void 0 : value.start) || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.start) || '',
29728
+ max: (value === null || value === void 0 ? void 0 : value.end) || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.end) || '',
29729
+ required: required,
29730
+ disabled: disabled || loading,
29731
+ onChange: handleStartChange
29732
+ }), /*#__PURE__*/React__default["default"].createElement(material.Box, {
29733
+ sx: {
29734
+ display: 'flex',
29735
+ justifyContent: 'center',
29736
+ alignItems: 'center',
29737
+ ml: 2,
29738
+ mr: 2
29739
+ }
29740
+ }, /*#__PURE__*/React__default["default"].createElement(material.Typography, {
29741
+ color: "GrayText"
29742
+ }, "\u2013")), /*#__PURE__*/React__default["default"].createElement(material.TextField, {
29743
+ sx: {
29744
+ flex: '1 1 auto'
29745
+ },
29746
+ type: type,
29747
+ name: "".concat(name, ".end"),
29748
+ label: "bis",
29749
+ variant: variant,
29750
+ InputLabelProps: {
29751
+ shrink: true
29752
+ },
29753
+ value: (value === null || value === void 0 ? void 0 : value.end) || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.end) || '',
29754
+ min: (value === null || value === void 0 ? void 0 : value.start) || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.start) || '',
29755
+ required: required,
29756
+ disabled: disabled || loading,
29757
+ onChange: handleEndChange
29758
+ })));
29759
+ };
29760
+
29761
+ FormDateRange.propTypes = {
29762
+ type: PropTypes__default["default"].string,
29763
+ name: PropTypes__default["default"].string,
29764
+ label: PropTypes__default["default"].string,
29765
+ variant: PropTypes__default["default"].string,
29766
+ value: PropTypes__default["default"].object,
29767
+ defaultValue: PropTypes__default["default"].string,
29768
+ required: PropTypes__default["default"].bool,
29769
+ loading: PropTypes__default["default"].bool,
29770
+ disabled: PropTypes__default["default"].bool,
29771
+ onChange: PropTypes__default["default"].func
29772
+ };
29773
+
29676
29774
  var FormText = function FormText(_ref) {
29677
29775
  var type = _ref.type,
29678
29776
  name = _ref.name,
@@ -29682,6 +29780,7 @@ var FormText = function FormText(_ref) {
29682
29780
  defaultValue = _ref.defaultValue,
29683
29781
  multiline = _ref.multiline,
29684
29782
  minRows = _ref.minRows,
29783
+ range = _ref.range,
29685
29784
  required = _ref.required,
29686
29785
  loading = _ref.loading,
29687
29786
  disabled = _ref.disabled,
@@ -29694,6 +29793,19 @@ var FormText = function FormText(_ref) {
29694
29793
  };
29695
29794
  }
29696
29795
 
29796
+ if (range) {
29797
+ return /*#__PURE__*/React__default["default"].createElement(FormDateRange, {
29798
+ type: type,
29799
+ name: name,
29800
+ label: label,
29801
+ variant: variant,
29802
+ value: value || defaultValue || '',
29803
+ required: required,
29804
+ disabled: disabled || loading,
29805
+ onChange: onChange || function () {}
29806
+ });
29807
+ }
29808
+
29697
29809
  return /*#__PURE__*/React__default["default"].createElement(material.TextField, _extends({
29698
29810
  type: type,
29699
29811
  name: name,
@@ -29702,6 +29814,7 @@ var FormText = function FormText(_ref) {
29702
29814
  value: value || defaultValue || '',
29703
29815
  multiline: multiline,
29704
29816
  minRows: minRows,
29817
+ range: range,
29705
29818
  required: required,
29706
29819
  disabled: disabled || loading,
29707
29820
  onChange: onChange || function () {} // eslint-disable-next-line react/jsx-props-no-spreading
@@ -29718,6 +29831,7 @@ FormText.propTypes = {
29718
29831
  defaultValue: PropTypes__default["default"].string,
29719
29832
  multiline: PropTypes__default["default"].bool,
29720
29833
  minRows: PropTypes__default["default"].number,
29834
+ range: PropTypes__default["default"].bool,
29721
29835
  required: PropTypes__default["default"].bool,
29722
29836
  loading: PropTypes__default["default"].bool,
29723
29837
  disabled: PropTypes__default["default"].bool,
@@ -30083,7 +30197,7 @@ function pick(obj, keys) {
30083
30197
  }, {});
30084
30198
  }
30085
30199
 
30086
- function hasOwnProperty$1(obj, prop) {
30200
+ function hasOwnProperty$2(obj, prop) {
30087
30201
  return Object.prototype.hasOwnProperty.call(obj, prop);
30088
30202
  }
30089
30203
 
@@ -30251,7 +30365,7 @@ function asNumber(value) {
30251
30365
  function normalizeObject(obj, normalizer) {
30252
30366
  const normalized = {};
30253
30367
  for (const u in obj) {
30254
- if (hasOwnProperty$1(obj, u)) {
30368
+ if (hasOwnProperty$2(obj, u)) {
30255
30369
  const v = obj[u];
30256
30370
  if (v === undefined || v === null) continue;
30257
30371
  normalized[normalizer(u)] = asNumber(v);
@@ -32820,7 +32934,7 @@ class Duration {
32820
32934
  result = {};
32821
32935
 
32822
32936
  for (const k of orderedUnits$1) {
32823
- if (hasOwnProperty$1(dur.values, k) || hasOwnProperty$1(this.values, k)) {
32937
+ if (hasOwnProperty$2(dur.values, k) || hasOwnProperty$2(this.values, k)) {
32824
32938
  result[k] = dur.get(k) + this.get(k);
32825
32939
  }
32826
32940
  }
@@ -34305,7 +34419,7 @@ function match(input, regex, handlers) {
34305
34419
  const all = {};
34306
34420
  let matchIndex = 1;
34307
34421
  for (const i in handlers) {
34308
- if (hasOwnProperty$1(handlers, i)) {
34422
+ if (hasOwnProperty$2(handlers, i)) {
34309
34423
  const h = handlers[i],
34310
34424
  groups = h.groups ? h.groups + 1 : 1;
34311
34425
  if (!h.literal && h.token) {
@@ -34455,7 +34569,7 @@ function explainFromTokens(locale, input, format) {
34455
34569
  [result, zone, specificOffset] = matches
34456
34570
  ? dateTimeFromMatches(matches)
34457
34571
  : [null, null, undefined];
34458
- if (hasOwnProperty$1(matches, "a") && hasOwnProperty$1(matches, "H")) {
34572
+ if (hasOwnProperty$2(matches, "a") && hasOwnProperty$2(matches, "H")) {
34459
34573
  throw new ConflictingSpecificationError(
34460
34574
  "Can't include meridiem when specifying 24-hour format"
34461
34575
  );
@@ -36771,21 +36885,30 @@ function friendlyDateTime(dateTimeish) {
36771
36885
  }
36772
36886
  }
36773
36887
 
36888
+ var formatDate = function formatDate(value, renderFormat) {
36889
+ var formatter = DateTime.DATETIME_FULL;
36890
+
36891
+ if (renderFormat) {
36892
+ if (typeof renderFormat === 'string') formatter = DateTime[renderFormat];else formatter = renderFormat;
36893
+ }
36894
+
36895
+ return DateTime.fromISO(value).toLocaleString(formatter);
36896
+ };
36897
+
36774
36898
  var FormReadOnlyText = function FormReadOnlyText(_ref) {
36775
36899
  var value = _ref.value,
36776
36900
  type = _ref.type,
36777
36901
  renderFormat = _ref.renderFormat,
36902
+ range = _ref.range,
36778
36903
  multiline = _ref.multiline;
36779
36904
  var finalValue = value;
36780
36905
 
36781
36906
  if (type === 'date' || type === 'datetime-local') {
36782
- var formatter = DateTime.DATETIME_FULL;
36783
-
36784
- if (renderFormat) {
36785
- if (typeof renderFormat === 'string') formatter = DateTime[renderFormat];else formatter = renderFormat;
36907
+ if (range) {
36908
+ finalValue = "".concat(formatDate((value === null || value === void 0 ? void 0 : value.start) || '', renderFormat), " - ").concat(formatDate((value === null || value === void 0 ? void 0 : value.end) || '', renderFormat));
36909
+ } else {
36910
+ finalValue = formatDate(value, renderFormat);
36786
36911
  }
36787
-
36788
- finalValue = DateTime.fromISO(value).toLocaleString(formatter);
36789
36912
  }
36790
36913
 
36791
36914
  return /*#__PURE__*/React__default["default"].createElement(material.Typography, {
@@ -36799,6 +36922,7 @@ var FormReadOnlyText = function FormReadOnlyText(_ref) {
36799
36922
  FormReadOnlyText.propTypes = {
36800
36923
  value: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string]),
36801
36924
  type: PropTypes__default["default"].string,
36925
+ range: PropTypes__default["default"].bool,
36802
36926
  renderFormat: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].object]),
36803
36927
  multiline: PropTypes__default["default"].bool
36804
36928
  };
@@ -37832,6 +37956,1369 @@ VFileMessage$1.prototype.source = null;
37832
37956
  VFileMessage$1.prototype.ruleId = null;
37833
37957
  VFileMessage$1.prototype.position = null;
37834
37958
 
37959
+ // for now just expose the builtin process global from node.js
37960
+ var process$1 = commonjsGlobal.process;
37961
+
37962
+ var url = {};
37963
+
37964
+ var punycode$1 = {exports: {}};
37965
+
37966
+ /*! https://mths.be/punycode v1.3.2 by @mathias */
37967
+
37968
+ (function (module, exports) {
37969
+ (function(root) {
37970
+
37971
+ /** Detect free variables */
37972
+ var freeExports = exports &&
37973
+ !exports.nodeType && exports;
37974
+ var freeModule = module &&
37975
+ !module.nodeType && module;
37976
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal;
37977
+ if (
37978
+ freeGlobal.global === freeGlobal ||
37979
+ freeGlobal.window === freeGlobal ||
37980
+ freeGlobal.self === freeGlobal
37981
+ ) {
37982
+ root = freeGlobal;
37983
+ }
37984
+
37985
+ /**
37986
+ * The `punycode` object.
37987
+ * @name punycode
37988
+ * @type Object
37989
+ */
37990
+ var punycode,
37991
+
37992
+ /** Highest positive signed 32-bit float value */
37993
+ maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
37994
+
37995
+ /** Bootstring parameters */
37996
+ base = 36,
37997
+ tMin = 1,
37998
+ tMax = 26,
37999
+ skew = 38,
38000
+ damp = 700,
38001
+ initialBias = 72,
38002
+ initialN = 128, // 0x80
38003
+ delimiter = '-', // '\x2D'
38004
+
38005
+ /** Regular expressions */
38006
+ regexPunycode = /^xn--/,
38007
+ regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
38008
+ regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
38009
+
38010
+ /** Error messages */
38011
+ errors = {
38012
+ 'overflow': 'Overflow: input needs wider integers to process',
38013
+ 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
38014
+ 'invalid-input': 'Invalid input'
38015
+ },
38016
+
38017
+ /** Convenience shortcuts */
38018
+ baseMinusTMin = base - tMin,
38019
+ floor = Math.floor,
38020
+ stringFromCharCode = String.fromCharCode,
38021
+
38022
+ /** Temporary variable */
38023
+ key;
38024
+
38025
+ /*--------------------------------------------------------------------------*/
38026
+
38027
+ /**
38028
+ * A generic error utility function.
38029
+ * @private
38030
+ * @param {String} type The error type.
38031
+ * @returns {Error} Throws a `RangeError` with the applicable error message.
38032
+ */
38033
+ function error(type) {
38034
+ throw RangeError(errors[type]);
38035
+ }
38036
+
38037
+ /**
38038
+ * A generic `Array#map` utility function.
38039
+ * @private
38040
+ * @param {Array} array The array to iterate over.
38041
+ * @param {Function} callback The function that gets called for every array
38042
+ * item.
38043
+ * @returns {Array} A new array of values returned by the callback function.
38044
+ */
38045
+ function map(array, fn) {
38046
+ var length = array.length;
38047
+ var result = [];
38048
+ while (length--) {
38049
+ result[length] = fn(array[length]);
38050
+ }
38051
+ return result;
38052
+ }
38053
+
38054
+ /**
38055
+ * A simple `Array#map`-like wrapper to work with domain name strings or email
38056
+ * addresses.
38057
+ * @private
38058
+ * @param {String} domain The domain name or email address.
38059
+ * @param {Function} callback The function that gets called for every
38060
+ * character.
38061
+ * @returns {Array} A new string of characters returned by the callback
38062
+ * function.
38063
+ */
38064
+ function mapDomain(string, fn) {
38065
+ var parts = string.split('@');
38066
+ var result = '';
38067
+ if (parts.length > 1) {
38068
+ // In email addresses, only the domain name should be punycoded. Leave
38069
+ // the local part (i.e. everything up to `@`) intact.
38070
+ result = parts[0] + '@';
38071
+ string = parts[1];
38072
+ }
38073
+ // Avoid `split(regex)` for IE8 compatibility. See #17.
38074
+ string = string.replace(regexSeparators, '\x2E');
38075
+ var labels = string.split('.');
38076
+ var encoded = map(labels, fn).join('.');
38077
+ return result + encoded;
38078
+ }
38079
+
38080
+ /**
38081
+ * Creates an array containing the numeric code points of each Unicode
38082
+ * character in the string. While JavaScript uses UCS-2 internally,
38083
+ * this function will convert a pair of surrogate halves (each of which
38084
+ * UCS-2 exposes as separate characters) into a single code point,
38085
+ * matching UTF-16.
38086
+ * @see `punycode.ucs2.encode`
38087
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
38088
+ * @memberOf punycode.ucs2
38089
+ * @name decode
38090
+ * @param {String} string The Unicode input string (UCS-2).
38091
+ * @returns {Array} The new array of code points.
38092
+ */
38093
+ function ucs2decode(string) {
38094
+ var output = [],
38095
+ counter = 0,
38096
+ length = string.length,
38097
+ value,
38098
+ extra;
38099
+ while (counter < length) {
38100
+ value = string.charCodeAt(counter++);
38101
+ if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
38102
+ // high surrogate, and there is a next character
38103
+ extra = string.charCodeAt(counter++);
38104
+ if ((extra & 0xFC00) == 0xDC00) { // low surrogate
38105
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
38106
+ } else {
38107
+ // unmatched surrogate; only append this code unit, in case the next
38108
+ // code unit is the high surrogate of a surrogate pair
38109
+ output.push(value);
38110
+ counter--;
38111
+ }
38112
+ } else {
38113
+ output.push(value);
38114
+ }
38115
+ }
38116
+ return output;
38117
+ }
38118
+
38119
+ /**
38120
+ * Creates a string based on an array of numeric code points.
38121
+ * @see `punycode.ucs2.decode`
38122
+ * @memberOf punycode.ucs2
38123
+ * @name encode
38124
+ * @param {Array} codePoints The array of numeric code points.
38125
+ * @returns {String} The new Unicode string (UCS-2).
38126
+ */
38127
+ function ucs2encode(array) {
38128
+ return map(array, function(value) {
38129
+ var output = '';
38130
+ if (value > 0xFFFF) {
38131
+ value -= 0x10000;
38132
+ output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
38133
+ value = 0xDC00 | value & 0x3FF;
38134
+ }
38135
+ output += stringFromCharCode(value);
38136
+ return output;
38137
+ }).join('');
38138
+ }
38139
+
38140
+ /**
38141
+ * Converts a basic code point into a digit/integer.
38142
+ * @see `digitToBasic()`
38143
+ * @private
38144
+ * @param {Number} codePoint The basic numeric code point value.
38145
+ * @returns {Number} The numeric value of a basic code point (for use in
38146
+ * representing integers) in the range `0` to `base - 1`, or `base` if
38147
+ * the code point does not represent a value.
38148
+ */
38149
+ function basicToDigit(codePoint) {
38150
+ if (codePoint - 48 < 10) {
38151
+ return codePoint - 22;
38152
+ }
38153
+ if (codePoint - 65 < 26) {
38154
+ return codePoint - 65;
38155
+ }
38156
+ if (codePoint - 97 < 26) {
38157
+ return codePoint - 97;
38158
+ }
38159
+ return base;
38160
+ }
38161
+
38162
+ /**
38163
+ * Converts a digit/integer into a basic code point.
38164
+ * @see `basicToDigit()`
38165
+ * @private
38166
+ * @param {Number} digit The numeric value of a basic code point.
38167
+ * @returns {Number} The basic code point whose value (when used for
38168
+ * representing integers) is `digit`, which needs to be in the range
38169
+ * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
38170
+ * used; else, the lowercase form is used. The behavior is undefined
38171
+ * if `flag` is non-zero and `digit` has no uppercase form.
38172
+ */
38173
+ function digitToBasic(digit, flag) {
38174
+ // 0..25 map to ASCII a..z or A..Z
38175
+ // 26..35 map to ASCII 0..9
38176
+ return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
38177
+ }
38178
+
38179
+ /**
38180
+ * Bias adaptation function as per section 3.4 of RFC 3492.
38181
+ * http://tools.ietf.org/html/rfc3492#section-3.4
38182
+ * @private
38183
+ */
38184
+ function adapt(delta, numPoints, firstTime) {
38185
+ var k = 0;
38186
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
38187
+ delta += floor(delta / numPoints);
38188
+ for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
38189
+ delta = floor(delta / baseMinusTMin);
38190
+ }
38191
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
38192
+ }
38193
+
38194
+ /**
38195
+ * Converts a Punycode string of ASCII-only symbols to a string of Unicode
38196
+ * symbols.
38197
+ * @memberOf punycode
38198
+ * @param {String} input The Punycode string of ASCII-only symbols.
38199
+ * @returns {String} The resulting string of Unicode symbols.
38200
+ */
38201
+ function decode(input) {
38202
+ // Don't use UCS-2
38203
+ var output = [],
38204
+ inputLength = input.length,
38205
+ out,
38206
+ i = 0,
38207
+ n = initialN,
38208
+ bias = initialBias,
38209
+ basic,
38210
+ j,
38211
+ index,
38212
+ oldi,
38213
+ w,
38214
+ k,
38215
+ digit,
38216
+ t,
38217
+ /** Cached calculation results */
38218
+ baseMinusT;
38219
+
38220
+ // Handle the basic code points: let `basic` be the number of input code
38221
+ // points before the last delimiter, or `0` if there is none, then copy
38222
+ // the first basic code points to the output.
38223
+
38224
+ basic = input.lastIndexOf(delimiter);
38225
+ if (basic < 0) {
38226
+ basic = 0;
38227
+ }
38228
+
38229
+ for (j = 0; j < basic; ++j) {
38230
+ // if it's not a basic code point
38231
+ if (input.charCodeAt(j) >= 0x80) {
38232
+ error('not-basic');
38233
+ }
38234
+ output.push(input.charCodeAt(j));
38235
+ }
38236
+
38237
+ // Main decoding loop: start just after the last delimiter if any basic code
38238
+ // points were copied; start at the beginning otherwise.
38239
+
38240
+ for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
38241
+
38242
+ // `index` is the index of the next character to be consumed.
38243
+ // Decode a generalized variable-length integer into `delta`,
38244
+ // which gets added to `i`. The overflow checking is easier
38245
+ // if we increase `i` as we go, then subtract off its starting
38246
+ // value at the end to obtain `delta`.
38247
+ for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
38248
+
38249
+ if (index >= inputLength) {
38250
+ error('invalid-input');
38251
+ }
38252
+
38253
+ digit = basicToDigit(input.charCodeAt(index++));
38254
+
38255
+ if (digit >= base || digit > floor((maxInt - i) / w)) {
38256
+ error('overflow');
38257
+ }
38258
+
38259
+ i += digit * w;
38260
+ t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
38261
+
38262
+ if (digit < t) {
38263
+ break;
38264
+ }
38265
+
38266
+ baseMinusT = base - t;
38267
+ if (w > floor(maxInt / baseMinusT)) {
38268
+ error('overflow');
38269
+ }
38270
+
38271
+ w *= baseMinusT;
38272
+
38273
+ }
38274
+
38275
+ out = output.length + 1;
38276
+ bias = adapt(i - oldi, out, oldi == 0);
38277
+
38278
+ // `i` was supposed to wrap around from `out` to `0`,
38279
+ // incrementing `n` each time, so we'll fix that now:
38280
+ if (floor(i / out) > maxInt - n) {
38281
+ error('overflow');
38282
+ }
38283
+
38284
+ n += floor(i / out);
38285
+ i %= out;
38286
+
38287
+ // Insert `n` at position `i` of the output
38288
+ output.splice(i++, 0, n);
38289
+
38290
+ }
38291
+
38292
+ return ucs2encode(output);
38293
+ }
38294
+
38295
+ /**
38296
+ * Converts a string of Unicode symbols (e.g. a domain name label) to a
38297
+ * Punycode string of ASCII-only symbols.
38298
+ * @memberOf punycode
38299
+ * @param {String} input The string of Unicode symbols.
38300
+ * @returns {String} The resulting Punycode string of ASCII-only symbols.
38301
+ */
38302
+ function encode(input) {
38303
+ var n,
38304
+ delta,
38305
+ handledCPCount,
38306
+ basicLength,
38307
+ bias,
38308
+ j,
38309
+ m,
38310
+ q,
38311
+ k,
38312
+ t,
38313
+ currentValue,
38314
+ output = [],
38315
+ /** `inputLength` will hold the number of code points in `input`. */
38316
+ inputLength,
38317
+ /** Cached calculation results */
38318
+ handledCPCountPlusOne,
38319
+ baseMinusT,
38320
+ qMinusT;
38321
+
38322
+ // Convert the input in UCS-2 to Unicode
38323
+ input = ucs2decode(input);
38324
+
38325
+ // Cache the length
38326
+ inputLength = input.length;
38327
+
38328
+ // Initialize the state
38329
+ n = initialN;
38330
+ delta = 0;
38331
+ bias = initialBias;
38332
+
38333
+ // Handle the basic code points
38334
+ for (j = 0; j < inputLength; ++j) {
38335
+ currentValue = input[j];
38336
+ if (currentValue < 0x80) {
38337
+ output.push(stringFromCharCode(currentValue));
38338
+ }
38339
+ }
38340
+
38341
+ handledCPCount = basicLength = output.length;
38342
+
38343
+ // `handledCPCount` is the number of code points that have been handled;
38344
+ // `basicLength` is the number of basic code points.
38345
+
38346
+ // Finish the basic string - if it is not empty - with a delimiter
38347
+ if (basicLength) {
38348
+ output.push(delimiter);
38349
+ }
38350
+
38351
+ // Main encoding loop:
38352
+ while (handledCPCount < inputLength) {
38353
+
38354
+ // All non-basic code points < n have been handled already. Find the next
38355
+ // larger one:
38356
+ for (m = maxInt, j = 0; j < inputLength; ++j) {
38357
+ currentValue = input[j];
38358
+ if (currentValue >= n && currentValue < m) {
38359
+ m = currentValue;
38360
+ }
38361
+ }
38362
+
38363
+ // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
38364
+ // but guard against overflow
38365
+ handledCPCountPlusOne = handledCPCount + 1;
38366
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
38367
+ error('overflow');
38368
+ }
38369
+
38370
+ delta += (m - n) * handledCPCountPlusOne;
38371
+ n = m;
38372
+
38373
+ for (j = 0; j < inputLength; ++j) {
38374
+ currentValue = input[j];
38375
+
38376
+ if (currentValue < n && ++delta > maxInt) {
38377
+ error('overflow');
38378
+ }
38379
+
38380
+ if (currentValue == n) {
38381
+ // Represent delta as a generalized variable-length integer
38382
+ for (q = delta, k = base; /* no condition */; k += base) {
38383
+ t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
38384
+ if (q < t) {
38385
+ break;
38386
+ }
38387
+ qMinusT = q - t;
38388
+ baseMinusT = base - t;
38389
+ output.push(
38390
+ stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
38391
+ );
38392
+ q = floor(qMinusT / baseMinusT);
38393
+ }
38394
+
38395
+ output.push(stringFromCharCode(digitToBasic(q, 0)));
38396
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
38397
+ delta = 0;
38398
+ ++handledCPCount;
38399
+ }
38400
+ }
38401
+
38402
+ ++delta;
38403
+ ++n;
38404
+
38405
+ }
38406
+ return output.join('');
38407
+ }
38408
+
38409
+ /**
38410
+ * Converts a Punycode string representing a domain name or an email address
38411
+ * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
38412
+ * it doesn't matter if you call it on a string that has already been
38413
+ * converted to Unicode.
38414
+ * @memberOf punycode
38415
+ * @param {String} input The Punycoded domain name or email address to
38416
+ * convert to Unicode.
38417
+ * @returns {String} The Unicode representation of the given Punycode
38418
+ * string.
38419
+ */
38420
+ function toUnicode(input) {
38421
+ return mapDomain(input, function(string) {
38422
+ return regexPunycode.test(string)
38423
+ ? decode(string.slice(4).toLowerCase())
38424
+ : string;
38425
+ });
38426
+ }
38427
+
38428
+ /**
38429
+ * Converts a Unicode string representing a domain name or an email address to
38430
+ * Punycode. Only the non-ASCII parts of the domain name will be converted,
38431
+ * i.e. it doesn't matter if you call it with a domain that's already in
38432
+ * ASCII.
38433
+ * @memberOf punycode
38434
+ * @param {String} input The domain name or email address to convert, as a
38435
+ * Unicode string.
38436
+ * @returns {String} The Punycode representation of the given domain name or
38437
+ * email address.
38438
+ */
38439
+ function toASCII(input) {
38440
+ return mapDomain(input, function(string) {
38441
+ return regexNonASCII.test(string)
38442
+ ? 'xn--' + encode(string)
38443
+ : string;
38444
+ });
38445
+ }
38446
+
38447
+ /*--------------------------------------------------------------------------*/
38448
+
38449
+ /** Define the public API */
38450
+ punycode = {
38451
+ /**
38452
+ * A string representing the current Punycode.js version number.
38453
+ * @memberOf punycode
38454
+ * @type String
38455
+ */
38456
+ 'version': '1.3.2',
38457
+ /**
38458
+ * An object of methods to convert from JavaScript's internal character
38459
+ * representation (UCS-2) to Unicode code points, and back.
38460
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
38461
+ * @memberOf punycode
38462
+ * @type Object
38463
+ */
38464
+ 'ucs2': {
38465
+ 'decode': ucs2decode,
38466
+ 'encode': ucs2encode
38467
+ },
38468
+ 'decode': decode,
38469
+ 'encode': encode,
38470
+ 'toASCII': toASCII,
38471
+ 'toUnicode': toUnicode
38472
+ };
38473
+
38474
+ /** Expose `punycode` */
38475
+ // Some AMD build optimizers, like r.js, check for specific condition patterns
38476
+ // like the following:
38477
+ if (freeExports && freeModule) {
38478
+ if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+
38479
+ freeModule.exports = punycode;
38480
+ } else { // in Narwhal or RingoJS v0.7.0-
38481
+ for (key in punycode) {
38482
+ punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
38483
+ }
38484
+ }
38485
+ } else { // in Rhino or a web browser
38486
+ root.punycode = punycode;
38487
+ }
38488
+
38489
+ }(commonjsGlobal));
38490
+ } (punycode$1, punycode$1.exports));
38491
+
38492
+ var util$1 = {
38493
+ isString: function(arg) {
38494
+ return typeof(arg) === 'string';
38495
+ },
38496
+ isObject: function(arg) {
38497
+ return typeof(arg) === 'object' && arg !== null;
38498
+ },
38499
+ isNull: function(arg) {
38500
+ return arg === null;
38501
+ },
38502
+ isNullOrUndefined: function(arg) {
38503
+ return arg == null;
38504
+ }
38505
+ };
38506
+
38507
+ var querystring$1 = {};
38508
+
38509
+ // If obj.hasOwnProperty has been overridden, then calling
38510
+ // obj.hasOwnProperty(prop) will break.
38511
+ // See: https://github.com/joyent/node/issues/1707
38512
+ function hasOwnProperty$1(obj, prop) {
38513
+ return Object.prototype.hasOwnProperty.call(obj, prop);
38514
+ }
38515
+
38516
+ var decode$1 = function(qs, sep, eq, options) {
38517
+ sep = sep || '&';
38518
+ eq = eq || '=';
38519
+ var obj = {};
38520
+
38521
+ if (typeof qs !== 'string' || qs.length === 0) {
38522
+ return obj;
38523
+ }
38524
+
38525
+ var regexp = /\+/g;
38526
+ qs = qs.split(sep);
38527
+
38528
+ var maxKeys = 1000;
38529
+ if (options && typeof options.maxKeys === 'number') {
38530
+ maxKeys = options.maxKeys;
38531
+ }
38532
+
38533
+ var len = qs.length;
38534
+ // maxKeys <= 0 means that we should not limit keys count
38535
+ if (maxKeys > 0 && len > maxKeys) {
38536
+ len = maxKeys;
38537
+ }
38538
+
38539
+ for (var i = 0; i < len; ++i) {
38540
+ var x = qs[i].replace(regexp, '%20'),
38541
+ idx = x.indexOf(eq),
38542
+ kstr, vstr, k, v;
38543
+
38544
+ if (idx >= 0) {
38545
+ kstr = x.substr(0, idx);
38546
+ vstr = x.substr(idx + 1);
38547
+ } else {
38548
+ kstr = x;
38549
+ vstr = '';
38550
+ }
38551
+
38552
+ k = decodeURIComponent(kstr);
38553
+ v = decodeURIComponent(vstr);
38554
+
38555
+ if (!hasOwnProperty$1(obj, k)) {
38556
+ obj[k] = v;
38557
+ } else if (Array.isArray(obj[k])) {
38558
+ obj[k].push(v);
38559
+ } else {
38560
+ obj[k] = [obj[k], v];
38561
+ }
38562
+ }
38563
+
38564
+ return obj;
38565
+ };
38566
+
38567
+ var stringifyPrimitive = function(v) {
38568
+ switch (typeof v) {
38569
+ case 'string':
38570
+ return v;
38571
+
38572
+ case 'boolean':
38573
+ return v ? 'true' : 'false';
38574
+
38575
+ case 'number':
38576
+ return isFinite(v) ? v : '';
38577
+
38578
+ default:
38579
+ return '';
38580
+ }
38581
+ };
38582
+
38583
+ var encode$2 = function(obj, sep, eq, name) {
38584
+ sep = sep || '&';
38585
+ eq = eq || '=';
38586
+ if (obj === null) {
38587
+ obj = undefined;
38588
+ }
38589
+
38590
+ if (typeof obj === 'object') {
38591
+ return Object.keys(obj).map(function(k) {
38592
+ var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
38593
+ if (Array.isArray(obj[k])) {
38594
+ return obj[k].map(function(v) {
38595
+ return ks + encodeURIComponent(stringifyPrimitive(v));
38596
+ }).join(sep);
38597
+ } else {
38598
+ return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
38599
+ }
38600
+ }).join(sep);
38601
+
38602
+ }
38603
+
38604
+ if (!name) return '';
38605
+ return encodeURIComponent(stringifyPrimitive(name)) + eq +
38606
+ encodeURIComponent(stringifyPrimitive(obj));
38607
+ };
38608
+
38609
+ querystring$1.decode = querystring$1.parse = decode$1;
38610
+ querystring$1.encode = querystring$1.stringify = encode$2;
38611
+
38612
+ var punycode = punycode$1.exports;
38613
+ var util = util$1;
38614
+
38615
+ url.parse = urlParse;
38616
+ url.resolve = urlResolve;
38617
+ url.resolveObject = urlResolveObject;
38618
+ url.format = urlFormat;
38619
+
38620
+ url.Url = Url;
38621
+
38622
+ function Url() {
38623
+ this.protocol = null;
38624
+ this.slashes = null;
38625
+ this.auth = null;
38626
+ this.host = null;
38627
+ this.port = null;
38628
+ this.hostname = null;
38629
+ this.hash = null;
38630
+ this.search = null;
38631
+ this.query = null;
38632
+ this.pathname = null;
38633
+ this.path = null;
38634
+ this.href = null;
38635
+ }
38636
+
38637
+ // Reference: RFC 3986, RFC 1808, RFC 2396
38638
+
38639
+ // define these here so at least they only have to be
38640
+ // compiled once on the first module load.
38641
+ var protocolPattern = /^([a-z0-9.+-]+:)/i,
38642
+ portPattern = /:[0-9]*$/,
38643
+
38644
+ // Special case for a simple path URL
38645
+ simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
38646
+
38647
+ // RFC 2396: characters reserved for delimiting URLs.
38648
+ // We actually just auto-escape these.
38649
+ delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
38650
+
38651
+ // RFC 2396: characters not allowed for various reasons.
38652
+ unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
38653
+
38654
+ // Allowed by RFCs, but cause of XSS attacks. Always escape these.
38655
+ autoEscape = ['\''].concat(unwise),
38656
+ // Characters that are never ever allowed in a hostname.
38657
+ // Note that any invalid chars are also handled, but these
38658
+ // are the ones that are *expected* to be seen, so we fast-path
38659
+ // them.
38660
+ nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
38661
+ hostEndingChars = ['/', '?', '#'],
38662
+ hostnameMaxLen = 255,
38663
+ hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
38664
+ hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
38665
+ // protocols that can allow "unsafe" and "unwise" chars.
38666
+ unsafeProtocol = {
38667
+ 'javascript': true,
38668
+ 'javascript:': true
38669
+ },
38670
+ // protocols that never have a hostname.
38671
+ hostlessProtocol = {
38672
+ 'javascript': true,
38673
+ 'javascript:': true
38674
+ },
38675
+ // protocols that always contain a // bit.
38676
+ slashedProtocol = {
38677
+ 'http': true,
38678
+ 'https': true,
38679
+ 'ftp': true,
38680
+ 'gopher': true,
38681
+ 'file': true,
38682
+ 'http:': true,
38683
+ 'https:': true,
38684
+ 'ftp:': true,
38685
+ 'gopher:': true,
38686
+ 'file:': true
38687
+ },
38688
+ querystring = querystring$1;
38689
+
38690
+ function urlParse(url, parseQueryString, slashesDenoteHost) {
38691
+ if (url && util.isObject(url) && url instanceof Url) return url;
38692
+
38693
+ var u = new Url;
38694
+ u.parse(url, parseQueryString, slashesDenoteHost);
38695
+ return u;
38696
+ }
38697
+
38698
+ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
38699
+ if (!util.isString(url)) {
38700
+ throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
38701
+ }
38702
+
38703
+ // Copy chrome, IE, opera backslash-handling behavior.
38704
+ // Back slashes before the query string get converted to forward slashes
38705
+ // See: https://code.google.com/p/chromium/issues/detail?id=25916
38706
+ var queryIndex = url.indexOf('?'),
38707
+ splitter =
38708
+ (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
38709
+ uSplit = url.split(splitter),
38710
+ slashRegex = /\\/g;
38711
+ uSplit[0] = uSplit[0].replace(slashRegex, '/');
38712
+ url = uSplit.join(splitter);
38713
+
38714
+ var rest = url;
38715
+
38716
+ // trim before proceeding.
38717
+ // This is to support parse stuff like " http://foo.com \n"
38718
+ rest = rest.trim();
38719
+
38720
+ if (!slashesDenoteHost && url.split('#').length === 1) {
38721
+ // Try fast path regexp
38722
+ var simplePath = simplePathPattern.exec(rest);
38723
+ if (simplePath) {
38724
+ this.path = rest;
38725
+ this.href = rest;
38726
+ this.pathname = simplePath[1];
38727
+ if (simplePath[2]) {
38728
+ this.search = simplePath[2];
38729
+ if (parseQueryString) {
38730
+ this.query = querystring.parse(this.search.substr(1));
38731
+ } else {
38732
+ this.query = this.search.substr(1);
38733
+ }
38734
+ } else if (parseQueryString) {
38735
+ this.search = '';
38736
+ this.query = {};
38737
+ }
38738
+ return this;
38739
+ }
38740
+ }
38741
+
38742
+ var proto = protocolPattern.exec(rest);
38743
+ if (proto) {
38744
+ proto = proto[0];
38745
+ var lowerProto = proto.toLowerCase();
38746
+ this.protocol = lowerProto;
38747
+ rest = rest.substr(proto.length);
38748
+ }
38749
+
38750
+ // figure out if it's got a host
38751
+ // user@server is *always* interpreted as a hostname, and url
38752
+ // resolution will treat //foo/bar as host=foo,path=bar because that's
38753
+ // how the browser resolves relative URLs.
38754
+ if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
38755
+ var slashes = rest.substr(0, 2) === '//';
38756
+ if (slashes && !(proto && hostlessProtocol[proto])) {
38757
+ rest = rest.substr(2);
38758
+ this.slashes = true;
38759
+ }
38760
+ }
38761
+
38762
+ if (!hostlessProtocol[proto] &&
38763
+ (slashes || (proto && !slashedProtocol[proto]))) {
38764
+
38765
+ // there's a hostname.
38766
+ // the first instance of /, ?, ;, or # ends the host.
38767
+ //
38768
+ // If there is an @ in the hostname, then non-host chars *are* allowed
38769
+ // to the left of the last @ sign, unless some host-ending character
38770
+ // comes *before* the @-sign.
38771
+ // URLs are obnoxious.
38772
+ //
38773
+ // ex:
38774
+ // http://a@b@c/ => user:a@b host:c
38775
+ // http://a@b?@c => user:a host:c path:/?@c
38776
+
38777
+ // v0.12 TODO(isaacs): This is not quite how Chrome does things.
38778
+ // Review our test case against browsers more comprehensively.
38779
+
38780
+ // find the first instance of any hostEndingChars
38781
+ var hostEnd = -1;
38782
+ for (var i = 0; i < hostEndingChars.length; i++) {
38783
+ var hec = rest.indexOf(hostEndingChars[i]);
38784
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
38785
+ hostEnd = hec;
38786
+ }
38787
+
38788
+ // at this point, either we have an explicit point where the
38789
+ // auth portion cannot go past, or the last @ char is the decider.
38790
+ var auth, atSign;
38791
+ if (hostEnd === -1) {
38792
+ // atSign can be anywhere.
38793
+ atSign = rest.lastIndexOf('@');
38794
+ } else {
38795
+ // atSign must be in auth portion.
38796
+ // http://a@b/c@d => host:b auth:a path:/c@d
38797
+ atSign = rest.lastIndexOf('@', hostEnd);
38798
+ }
38799
+
38800
+ // Now we have a portion which is definitely the auth.
38801
+ // Pull that off.
38802
+ if (atSign !== -1) {
38803
+ auth = rest.slice(0, atSign);
38804
+ rest = rest.slice(atSign + 1);
38805
+ this.auth = decodeURIComponent(auth);
38806
+ }
38807
+
38808
+ // the host is the remaining to the left of the first non-host char
38809
+ hostEnd = -1;
38810
+ for (var i = 0; i < nonHostChars.length; i++) {
38811
+ var hec = rest.indexOf(nonHostChars[i]);
38812
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
38813
+ hostEnd = hec;
38814
+ }
38815
+ // if we still have not hit it, then the entire thing is a host.
38816
+ if (hostEnd === -1)
38817
+ hostEnd = rest.length;
38818
+
38819
+ this.host = rest.slice(0, hostEnd);
38820
+ rest = rest.slice(hostEnd);
38821
+
38822
+ // pull out port.
38823
+ this.parseHost();
38824
+
38825
+ // we've indicated that there is a hostname,
38826
+ // so even if it's empty, it has to be present.
38827
+ this.hostname = this.hostname || '';
38828
+
38829
+ // if hostname begins with [ and ends with ]
38830
+ // assume that it's an IPv6 address.
38831
+ var ipv6Hostname = this.hostname[0] === '[' &&
38832
+ this.hostname[this.hostname.length - 1] === ']';
38833
+
38834
+ // validate a little.
38835
+ if (!ipv6Hostname) {
38836
+ var hostparts = this.hostname.split(/\./);
38837
+ for (var i = 0, l = hostparts.length; i < l; i++) {
38838
+ var part = hostparts[i];
38839
+ if (!part) continue;
38840
+ if (!part.match(hostnamePartPattern)) {
38841
+ var newpart = '';
38842
+ for (var j = 0, k = part.length; j < k; j++) {
38843
+ if (part.charCodeAt(j) > 127) {
38844
+ // we replace non-ASCII char with a temporary placeholder
38845
+ // we need this to make sure size of hostname is not
38846
+ // broken by replacing non-ASCII by nothing
38847
+ newpart += 'x';
38848
+ } else {
38849
+ newpart += part[j];
38850
+ }
38851
+ }
38852
+ // we test again with ASCII char only
38853
+ if (!newpart.match(hostnamePartPattern)) {
38854
+ var validParts = hostparts.slice(0, i);
38855
+ var notHost = hostparts.slice(i + 1);
38856
+ var bit = part.match(hostnamePartStart);
38857
+ if (bit) {
38858
+ validParts.push(bit[1]);
38859
+ notHost.unshift(bit[2]);
38860
+ }
38861
+ if (notHost.length) {
38862
+ rest = '/' + notHost.join('.') + rest;
38863
+ }
38864
+ this.hostname = validParts.join('.');
38865
+ break;
38866
+ }
38867
+ }
38868
+ }
38869
+ }
38870
+
38871
+ if (this.hostname.length > hostnameMaxLen) {
38872
+ this.hostname = '';
38873
+ } else {
38874
+ // hostnames are always lower case.
38875
+ this.hostname = this.hostname.toLowerCase();
38876
+ }
38877
+
38878
+ if (!ipv6Hostname) {
38879
+ // IDNA Support: Returns a punycoded representation of "domain".
38880
+ // It only converts parts of the domain name that
38881
+ // have non-ASCII characters, i.e. it doesn't matter if
38882
+ // you call it with a domain that already is ASCII-only.
38883
+ this.hostname = punycode.toASCII(this.hostname);
38884
+ }
38885
+
38886
+ var p = this.port ? ':' + this.port : '';
38887
+ var h = this.hostname || '';
38888
+ this.host = h + p;
38889
+ this.href += this.host;
38890
+
38891
+ // strip [ and ] from the hostname
38892
+ // the host field still retains them, though
38893
+ if (ipv6Hostname) {
38894
+ this.hostname = this.hostname.substr(1, this.hostname.length - 2);
38895
+ if (rest[0] !== '/') {
38896
+ rest = '/' + rest;
38897
+ }
38898
+ }
38899
+ }
38900
+
38901
+ // now rest is set to the post-host stuff.
38902
+ // chop off any delim chars.
38903
+ if (!unsafeProtocol[lowerProto]) {
38904
+
38905
+ // First, make 100% sure that any "autoEscape" chars get
38906
+ // escaped, even if encodeURIComponent doesn't think they
38907
+ // need to be.
38908
+ for (var i = 0, l = autoEscape.length; i < l; i++) {
38909
+ var ae = autoEscape[i];
38910
+ if (rest.indexOf(ae) === -1)
38911
+ continue;
38912
+ var esc = encodeURIComponent(ae);
38913
+ if (esc === ae) {
38914
+ esc = escape(ae);
38915
+ }
38916
+ rest = rest.split(ae).join(esc);
38917
+ }
38918
+ }
38919
+
38920
+
38921
+ // chop off from the tail first.
38922
+ var hash = rest.indexOf('#');
38923
+ if (hash !== -1) {
38924
+ // got a fragment string.
38925
+ this.hash = rest.substr(hash);
38926
+ rest = rest.slice(0, hash);
38927
+ }
38928
+ var qm = rest.indexOf('?');
38929
+ if (qm !== -1) {
38930
+ this.search = rest.substr(qm);
38931
+ this.query = rest.substr(qm + 1);
38932
+ if (parseQueryString) {
38933
+ this.query = querystring.parse(this.query);
38934
+ }
38935
+ rest = rest.slice(0, qm);
38936
+ } else if (parseQueryString) {
38937
+ // no query string, but parseQueryString still requested
38938
+ this.search = '';
38939
+ this.query = {};
38940
+ }
38941
+ if (rest) this.pathname = rest;
38942
+ if (slashedProtocol[lowerProto] &&
38943
+ this.hostname && !this.pathname) {
38944
+ this.pathname = '/';
38945
+ }
38946
+
38947
+ //to support http.request
38948
+ if (this.pathname || this.search) {
38949
+ var p = this.pathname || '';
38950
+ var s = this.search || '';
38951
+ this.path = p + s;
38952
+ }
38953
+
38954
+ // finally, reconstruct the href based on what has been validated.
38955
+ this.href = this.format();
38956
+ return this;
38957
+ };
38958
+
38959
+ // format a parsed object into a url string
38960
+ function urlFormat(obj) {
38961
+ // ensure it's an object, and not a string url.
38962
+ // If it's an obj, this is a no-op.
38963
+ // this way, you can call url_format() on strings
38964
+ // to clean up potentially wonky urls.
38965
+ if (util.isString(obj)) obj = urlParse(obj);
38966
+ if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
38967
+ return obj.format();
38968
+ }
38969
+
38970
+ Url.prototype.format = function() {
38971
+ var auth = this.auth || '';
38972
+ if (auth) {
38973
+ auth = encodeURIComponent(auth);
38974
+ auth = auth.replace(/%3A/i, ':');
38975
+ auth += '@';
38976
+ }
38977
+
38978
+ var protocol = this.protocol || '',
38979
+ pathname = this.pathname || '',
38980
+ hash = this.hash || '',
38981
+ host = false,
38982
+ query = '';
38983
+
38984
+ if (this.host) {
38985
+ host = auth + this.host;
38986
+ } else if (this.hostname) {
38987
+ host = auth + (this.hostname.indexOf(':') === -1 ?
38988
+ this.hostname :
38989
+ '[' + this.hostname + ']');
38990
+ if (this.port) {
38991
+ host += ':' + this.port;
38992
+ }
38993
+ }
38994
+
38995
+ if (this.query &&
38996
+ util.isObject(this.query) &&
38997
+ Object.keys(this.query).length) {
38998
+ query = querystring.stringify(this.query);
38999
+ }
39000
+
39001
+ var search = this.search || (query && ('?' + query)) || '';
39002
+
39003
+ if (protocol && protocol.substr(-1) !== ':') protocol += ':';
39004
+
39005
+ // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
39006
+ // unless they had them to begin with.
39007
+ if (this.slashes ||
39008
+ (!protocol || slashedProtocol[protocol]) && host !== false) {
39009
+ host = '//' + (host || '');
39010
+ if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
39011
+ } else if (!host) {
39012
+ host = '';
39013
+ }
39014
+
39015
+ if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
39016
+ if (search && search.charAt(0) !== '?') search = '?' + search;
39017
+
39018
+ pathname = pathname.replace(/[?#]/g, function(match) {
39019
+ return encodeURIComponent(match);
39020
+ });
39021
+ search = search.replace('#', '%23');
39022
+
39023
+ return protocol + host + pathname + search + hash;
39024
+ };
39025
+
39026
+ function urlResolve(source, relative) {
39027
+ return urlParse(source, false, true).resolve(relative);
39028
+ }
39029
+
39030
+ Url.prototype.resolve = function(relative) {
39031
+ return this.resolveObject(urlParse(relative, false, true)).format();
39032
+ };
39033
+
39034
+ function urlResolveObject(source, relative) {
39035
+ if (!source) return relative;
39036
+ return urlParse(source, false, true).resolveObject(relative);
39037
+ }
39038
+
39039
+ Url.prototype.resolveObject = function(relative) {
39040
+ if (util.isString(relative)) {
39041
+ var rel = new Url();
39042
+ rel.parse(relative, false, true);
39043
+ relative = rel;
39044
+ }
39045
+
39046
+ var result = new Url();
39047
+ var tkeys = Object.keys(this);
39048
+ for (var tk = 0; tk < tkeys.length; tk++) {
39049
+ var tkey = tkeys[tk];
39050
+ result[tkey] = this[tkey];
39051
+ }
39052
+
39053
+ // hash is always overridden, no matter what.
39054
+ // even href="" will remove it.
39055
+ result.hash = relative.hash;
39056
+
39057
+ // if the relative url is empty, then there's nothing left to do here.
39058
+ if (relative.href === '') {
39059
+ result.href = result.format();
39060
+ return result;
39061
+ }
39062
+
39063
+ // hrefs like //foo/bar always cut to the protocol.
39064
+ if (relative.slashes && !relative.protocol) {
39065
+ // take everything except the protocol from relative
39066
+ var rkeys = Object.keys(relative);
39067
+ for (var rk = 0; rk < rkeys.length; rk++) {
39068
+ var rkey = rkeys[rk];
39069
+ if (rkey !== 'protocol')
39070
+ result[rkey] = relative[rkey];
39071
+ }
39072
+
39073
+ //urlParse appends trailing / to urls like http://www.example.com
39074
+ if (slashedProtocol[result.protocol] &&
39075
+ result.hostname && !result.pathname) {
39076
+ result.path = result.pathname = '/';
39077
+ }
39078
+
39079
+ result.href = result.format();
39080
+ return result;
39081
+ }
39082
+
39083
+ if (relative.protocol && relative.protocol !== result.protocol) {
39084
+ // if it's a known url protocol, then changing
39085
+ // the protocol does weird things
39086
+ // first, if it's not file:, then we MUST have a host,
39087
+ // and if there was a path
39088
+ // to begin with, then we MUST have a path.
39089
+ // if it is file:, then the host is dropped,
39090
+ // because that's known to be hostless.
39091
+ // anything else is assumed to be absolute.
39092
+ if (!slashedProtocol[relative.protocol]) {
39093
+ var keys = Object.keys(relative);
39094
+ for (var v = 0; v < keys.length; v++) {
39095
+ var k = keys[v];
39096
+ result[k] = relative[k];
39097
+ }
39098
+ result.href = result.format();
39099
+ return result;
39100
+ }
39101
+
39102
+ result.protocol = relative.protocol;
39103
+ if (!relative.host && !hostlessProtocol[relative.protocol]) {
39104
+ var relPath = (relative.pathname || '').split('/');
39105
+ while (relPath.length && !(relative.host = relPath.shift()));
39106
+ if (!relative.host) relative.host = '';
39107
+ if (!relative.hostname) relative.hostname = '';
39108
+ if (relPath[0] !== '') relPath.unshift('');
39109
+ if (relPath.length < 2) relPath.unshift('');
39110
+ result.pathname = relPath.join('/');
39111
+ } else {
39112
+ result.pathname = relative.pathname;
39113
+ }
39114
+ result.search = relative.search;
39115
+ result.query = relative.query;
39116
+ result.host = relative.host || '';
39117
+ result.auth = relative.auth;
39118
+ result.hostname = relative.hostname || relative.host;
39119
+ result.port = relative.port;
39120
+ // to support http.request
39121
+ if (result.pathname || result.search) {
39122
+ var p = result.pathname || '';
39123
+ var s = result.search || '';
39124
+ result.path = p + s;
39125
+ }
39126
+ result.slashes = result.slashes || relative.slashes;
39127
+ result.href = result.format();
39128
+ return result;
39129
+ }
39130
+
39131
+ var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
39132
+ isRelAbs = (
39133
+ relative.host ||
39134
+ relative.pathname && relative.pathname.charAt(0) === '/'
39135
+ ),
39136
+ mustEndAbs = (isRelAbs || isSourceAbs ||
39137
+ (result.host && relative.pathname)),
39138
+ removeAllDots = mustEndAbs,
39139
+ srcPath = result.pathname && result.pathname.split('/') || [],
39140
+ relPath = relative.pathname && relative.pathname.split('/') || [],
39141
+ psychotic = result.protocol && !slashedProtocol[result.protocol];
39142
+
39143
+ // if the url is a non-slashed url, then relative
39144
+ // links like ../.. should be able
39145
+ // to crawl up to the hostname, as well. This is strange.
39146
+ // result.protocol has already been set by now.
39147
+ // Later on, put the first path part into the host field.
39148
+ if (psychotic) {
39149
+ result.hostname = '';
39150
+ result.port = null;
39151
+ if (result.host) {
39152
+ if (srcPath[0] === '') srcPath[0] = result.host;
39153
+ else srcPath.unshift(result.host);
39154
+ }
39155
+ result.host = '';
39156
+ if (relative.protocol) {
39157
+ relative.hostname = null;
39158
+ relative.port = null;
39159
+ if (relative.host) {
39160
+ if (relPath[0] === '') relPath[0] = relative.host;
39161
+ else relPath.unshift(relative.host);
39162
+ }
39163
+ relative.host = null;
39164
+ }
39165
+ mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
39166
+ }
39167
+
39168
+ if (isRelAbs) {
39169
+ // it's absolute.
39170
+ result.host = (relative.host || relative.host === '') ?
39171
+ relative.host : result.host;
39172
+ result.hostname = (relative.hostname || relative.hostname === '') ?
39173
+ relative.hostname : result.hostname;
39174
+ result.search = relative.search;
39175
+ result.query = relative.query;
39176
+ srcPath = relPath;
39177
+ // fall through to the dot-handling below.
39178
+ } else if (relPath.length) {
39179
+ // it's relative
39180
+ // throw away the existing file, and take the new path instead.
39181
+ if (!srcPath) srcPath = [];
39182
+ srcPath.pop();
39183
+ srcPath = srcPath.concat(relPath);
39184
+ result.search = relative.search;
39185
+ result.query = relative.query;
39186
+ } else if (!util.isNullOrUndefined(relative.search)) {
39187
+ // just pull out the search.
39188
+ // like href='?foo'.
39189
+ // Put this after the other two cases because it simplifies the booleans
39190
+ if (psychotic) {
39191
+ result.hostname = result.host = srcPath.shift();
39192
+ //occationaly the auth can get stuck only in host
39193
+ //this especially happens in cases like
39194
+ //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
39195
+ var authInHost = result.host && result.host.indexOf('@') > 0 ?
39196
+ result.host.split('@') : false;
39197
+ if (authInHost) {
39198
+ result.auth = authInHost.shift();
39199
+ result.host = result.hostname = authInHost.shift();
39200
+ }
39201
+ }
39202
+ result.search = relative.search;
39203
+ result.query = relative.query;
39204
+ //to support http.request
39205
+ if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
39206
+ result.path = (result.pathname ? result.pathname : '') +
39207
+ (result.search ? result.search : '');
39208
+ }
39209
+ result.href = result.format();
39210
+ return result;
39211
+ }
39212
+
39213
+ if (!srcPath.length) {
39214
+ // no path at all. easy.
39215
+ // we've already handled the other stuff above.
39216
+ result.pathname = null;
39217
+ //to support http.request
39218
+ if (result.search) {
39219
+ result.path = '/' + result.search;
39220
+ } else {
39221
+ result.path = null;
39222
+ }
39223
+ result.href = result.format();
39224
+ return result;
39225
+ }
39226
+
39227
+ // if a url ENDs in . or .., then it must get a trailing slash.
39228
+ // however, if it ends in anything else non-slashy,
39229
+ // then it must NOT get a trailing slash.
39230
+ var last = srcPath.slice(-1)[0];
39231
+ var hasTrailingSlash = (
39232
+ (result.host || relative.host || srcPath.length > 1) &&
39233
+ (last === '.' || last === '..') || last === '');
39234
+
39235
+ // strip single dots, resolve double dots to parent dir
39236
+ // if the path tries to go above the root, `up` ends up > 0
39237
+ var up = 0;
39238
+ for (var i = srcPath.length; i >= 0; i--) {
39239
+ last = srcPath[i];
39240
+ if (last === '.') {
39241
+ srcPath.splice(i, 1);
39242
+ } else if (last === '..') {
39243
+ srcPath.splice(i, 1);
39244
+ up++;
39245
+ } else if (up) {
39246
+ srcPath.splice(i, 1);
39247
+ up--;
39248
+ }
39249
+ }
39250
+
39251
+ // if the path is allowed to go above the root, restore leading ..s
39252
+ if (!mustEndAbs && !removeAllDots) {
39253
+ for (; up--; up) {
39254
+ srcPath.unshift('..');
39255
+ }
39256
+ }
39257
+
39258
+ if (mustEndAbs && srcPath[0] !== '' &&
39259
+ (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
39260
+ srcPath.unshift('');
39261
+ }
39262
+
39263
+ if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
39264
+ srcPath.push('');
39265
+ }
39266
+
39267
+ var isAbsolute = srcPath[0] === '' ||
39268
+ (srcPath[0] && srcPath[0].charAt(0) === '/');
39269
+
39270
+ // put the host back
39271
+ if (psychotic) {
39272
+ result.hostname = result.host = isAbsolute ? '' :
39273
+ srcPath.length ? srcPath.shift() : '';
39274
+ //occationaly the auth can get stuck only in host
39275
+ //this especially happens in cases like
39276
+ //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
39277
+ var authInHost = result.host && result.host.indexOf('@') > 0 ?
39278
+ result.host.split('@') : false;
39279
+ if (authInHost) {
39280
+ result.auth = authInHost.shift();
39281
+ result.host = result.hostname = authInHost.shift();
39282
+ }
39283
+ }
39284
+
39285
+ mustEndAbs = mustEndAbs || (result.host && srcPath.length);
39286
+
39287
+ if (mustEndAbs && !isAbsolute) {
39288
+ srcPath.unshift('');
39289
+ }
39290
+
39291
+ if (!srcPath.length) {
39292
+ result.pathname = null;
39293
+ result.path = null;
39294
+ } else {
39295
+ result.pathname = srcPath.join('/');
39296
+ }
39297
+
39298
+ //to support request.http
39299
+ if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
39300
+ result.path = (result.pathname ? result.pathname : '') +
39301
+ (result.search ? result.search : '');
39302
+ }
39303
+ result.auth = relative.auth || result.auth;
39304
+ result.slashes = result.slashes || relative.slashes;
39305
+ result.href = result.format();
39306
+ return result;
39307
+ };
39308
+
39309
+ Url.prototype.parseHost = function() {
39310
+ var host = this.host;
39311
+ var port = portPattern.exec(host);
39312
+ if (port) {
39313
+ port = port[0];
39314
+ if (port !== ':') {
39315
+ this.port = port.substr(1);
39316
+ }
39317
+ host = host.substr(0, host.length - port.length);
39318
+ }
39319
+ if (host) this.hostname = host;
39320
+ };
39321
+
37835
39322
  /**
37836
39323
  * @typedef URL
37837
39324
  * @property {string} hash
@@ -37977,7 +39464,7 @@ class VFile$1 {
37977
39464
  * Defaults to `process.cwd()` (`/` in browsers).
37978
39465
  * @type {string}
37979
39466
  */
37980
- this.cwd = proc__default["default"].cwd();
39467
+ this.cwd = process$1.cwd();
37981
39468
 
37982
39469
  /* eslint-disable no-unused-expressions */
37983
39470
  /**
@@ -38855,7 +40342,7 @@ class VFile {
38855
40342
  * Defaults to `process.cwd()` (`/` in browsers).
38856
40343
  * @type {string}
38857
40344
  */
38858
- this.cwd = proc__default["default"].cwd();
40345
+ this.cwd = process$1.cwd();
38859
40346
 
38860
40347
  /* eslint-disable no-unused-expressions */
38861
40348
  /**
@@ -73196,7 +74683,7 @@ https://highlightjs.org/
73196
74683
  */
73197
74684
 
73198
74685
 
73199
- const escape = escapeHTML;
74686
+ const escape$1 = escapeHTML;
73200
74687
  const inherit = inherit$1;
73201
74688
  const NO_MATCH = Symbol("nomatch");
73202
74689
  const MAX_KEYWORD_HITS = 7;
@@ -73756,7 +75243,7 @@ const HLJS = function(hljs) {
73756
75243
  if (err.message && err.message.includes('Illegal')) {
73757
75244
  return {
73758
75245
  language: languageName,
73759
- value: escape(codeToHighlight),
75246
+ value: escape$1(codeToHighlight),
73760
75247
  illegal: true,
73761
75248
  relevance: 0,
73762
75249
  _illegalBy: {
@@ -73771,7 +75258,7 @@ const HLJS = function(hljs) {
73771
75258
  } else if (SAFE_MODE) {
73772
75259
  return {
73773
75260
  language: languageName,
73774
- value: escape(codeToHighlight),
75261
+ value: escape$1(codeToHighlight),
73775
75262
  illegal: false,
73776
75263
  relevance: 0,
73777
75264
  errorRaised: err,
@@ -73793,7 +75280,7 @@ const HLJS = function(hljs) {
73793
75280
  */
73794
75281
  function justTextHighlightResult(code) {
73795
75282
  const result = {
73796
- value: escape(code),
75283
+ value: escape$1(code),
73797
75284
  illegal: false,
73798
75285
  relevance: 0,
73799
75286
  _top: PLAINTEXT_LANGUAGE,