@digipair/skill-mongodb 0.136.3 → 0.136.4

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.esm.js CHANGED
@@ -15,7 +15,7 @@ import require$$0$a from 'fs/promises';
15
15
  import require$$3 from 'tls';
16
16
  import require$$1$3 from 'child_process';
17
17
 
18
- function _mergeNamespaces$1(n, m) {
18
+ function _mergeNamespaces(n, m) {
19
19
  m.forEach(function(e) {
20
20
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
21
21
  if (k !== 'default' && !(k in n)) {
@@ -35,7 +35,7 @@ var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof w
35
35
  function getDefaultExportFromCjs(x) {
36
36
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
37
37
  }
38
- var handlebars_min = {
38
+ var handlebars_min$1 = {
39
39
  exports: {}
40
40
  };
41
41
  /**!
@@ -63,7 +63,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
63
63
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
64
64
  THE SOFTWARE.
65
65
 
66
- */ handlebars_min.exports;
66
+ */ handlebars_min$1.exports;
67
67
  (function(module1, exports1) {
68
68
  function _instanceof(left, right) {
69
69
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
@@ -8144,12 +8144,12 @@ THE SOFTWARE.
8144
8144
  }
8145
8145
  ]);
8146
8146
  });
8147
- })(handlebars_min, handlebars_min.exports);
8148
- var handlebars_minExports = handlebars_min.exports;
8149
- var handlebars_min_default = /*@__PURE__*/ getDefaultExportFromCjs(handlebars_minExports);
8150
- var HandlebarsNamespace = /*#__PURE__*/ _mergeNamespaces$1({
8147
+ })(handlebars_min$1, handlebars_min$1.exports);
8148
+ var handlebars_minExports = handlebars_min$1.exports;
8149
+ var handlebars_min = /*@__PURE__*/ getDefaultExportFromCjs(handlebars_minExports);
8150
+ var HandlebarsNamespace = /*#__PURE__*/ _mergeNamespaces({
8151
8151
  __proto__: null,
8152
- default: handlebars_min_default
8152
+ default: handlebars_min
8153
8153
  }, [
8154
8154
  handlebars_minExports
8155
8155
  ]);
@@ -17312,7 +17312,6 @@ class represent prop names.
17312
17312
  this.deserialize = config.deserialize || function() {
17313
17313
  throw new Error("This node type doesn't define a deserialize function");
17314
17314
  };
17315
- this.combine = config.combine || null;
17316
17315
  }
17317
17316
  _create_class$u$1(NodeProp, [
17318
17317
  {
@@ -17425,16 +17424,10 @@ represented by another tree.
17425
17424
  */ overlay, /**
17426
17425
  The parser used to create this subtree.
17427
17426
  */ parser) {
17428
- var /**
17429
- [Indicates](#common.IterMode.EnterBracketed) that the nested
17430
- content is delineated with some kind
17431
- of bracket token.
17432
- */ bracketed = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
17433
17427
  _class_call_check$z$1(this, MountedTree);
17434
17428
  this.tree = tree;
17435
17429
  this.overlay = overlay;
17436
17430
  this.parser = parser;
17437
- this.bracketed = bracketed;
17438
17431
  }
17439
17432
  _create_class$u$1(MountedTree, null, [
17440
17433
  {
@@ -17650,9 +17643,7 @@ types in it, so that the ids fit into 16-bit typed array slots.
17650
17643
  var add = source(type);
17651
17644
  if (add) {
17652
17645
  if (!newProps) newProps = Object.assign({}, type.props);
17653
- var value = add[1], prop = add[0];
17654
- if (prop.combine && prop.id in newProps) value = prop.combine(newProps[prop.id], value);
17655
- newProps[prop.id] = value;
17646
+ newProps[add[0].id] = add[1];
17656
17647
  }
17657
17648
  }
17658
17649
  } catch (err) {
@@ -17718,12 +17709,6 @@ operator to enable multiple ones.
17718
17709
  library to not enter mounted overlays if one covers the given
17719
17710
  position.
17720
17711
  */ IterMode[IterMode["IgnoreOverlays"] = 8] = "IgnoreOverlays";
17721
- /**
17722
- When set, positions on the boundary of a mounted overlay tree
17723
- that has its [`bracketed`](#common.NestedParse.bracketed) flag
17724
- set will enter that tree regardless of side. Only supported in
17725
- [`enter`](#common.SyntaxNode.enter), not in cursors.
17726
- */ IterMode[IterMode["EnterBracketed"] = 16] = "EnterBracketed";
17727
17712
  })(IterMode || (IterMode = {}));
17728
17713
  /**
17729
17714
  A piece of syntax tree. There are two ways to approach these
@@ -18282,17 +18267,17 @@ var TreeNode = /*#__PURE__*/ function(BaseNode) {
18282
18267
  var mode = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0;
18283
18268
  for(var parent = this;;){
18284
18269
  for(var _parent__tree = parent._tree, children = _parent__tree.children, positions = _parent__tree.positions, e = dir > 0 ? children.length : -1; i != e; i += dir){
18285
- var next = children[i], start = positions[i] + parent.from, mounted = void 0;
18286
- if (!(mode & IterMode.EnterBracketed && _instanceof$i(next, Tree) && (mounted = MountedTree.get(next)) && !mounted.overlay && mounted.bracketed && pos >= start && pos <= start + next.length) && !checkSide(side, pos, start, start + next.length)) continue;
18270
+ var next = children[i], start = positions[i] + parent.from;
18271
+ if (!checkSide(side, pos, start, start + next.length)) continue;
18287
18272
  if (_instanceof$i(next, TreeBuffer)) {
18288
18273
  if (mode & IterMode.ExcludeBuffers) continue;
18289
18274
  var index = next.findChild(0, next.buffer.length, dir, pos - start, side);
18290
18275
  if (index > -1) return new BufferNode(new BufferContext(parent, next, i, start), null, index);
18291
18276
  } else if (mode & IterMode.IncludeAnonymous || !next.type.isAnonymous || hasChild(next)) {
18292
- var mounted1 = void 0;
18293
- if (!(mode & IterMode.IgnoreMounts) && (mounted1 = MountedTree.get(next)) && !mounted1.overlay) return new TreeNode(mounted1.tree, start, i, parent);
18277
+ var mounted = void 0;
18278
+ if (!(mode & IterMode.IgnoreMounts) && (mounted = MountedTree.get(next)) && !mounted.overlay) return new TreeNode(mounted.tree, start, i, parent);
18294
18279
  var inner = new TreeNode(next, start, i, parent);
18295
- return mode & IterMode.IncludeAnonymous || !inner.type.isAnonymous ? inner : inner.nextChild(dir < 0 ? next.children.length - 1 : 0, dir, pos, side, mode);
18280
+ return mode & IterMode.IncludeAnonymous || !inner.type.isAnonymous ? inner : inner.nextChild(dir < 0 ? next.children.length - 1 : 0, dir, pos, side);
18296
18281
  }
18297
18282
  }
18298
18283
  if (mode & IterMode.IncludeAnonymous || !parent.type.isAnonymous) return null;
@@ -18327,24 +18312,18 @@ var TreeNode = /*#__PURE__*/ function(BaseNode) {
18327
18312
  return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Side.Before */ );
18328
18313
  }
18329
18314
  },
18330
- {
18331
- key: "prop",
18332
- value: function prop(prop) {
18333
- return this._tree.prop(prop);
18334
- }
18335
- },
18336
18315
  {
18337
18316
  key: "enter",
18338
18317
  value: function enter(pos, side) {
18339
18318
  var mode = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
18340
18319
  var mounted;
18341
18320
  if (!(mode & IterMode.IgnoreOverlays) && (mounted = MountedTree.get(this._tree)) && mounted.overlay) {
18342
- var rPos = pos - this.from, enterBracketed = mode & IterMode.EnterBracketed && mounted.bracketed;
18321
+ var rPos = pos - this.from;
18343
18322
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
18344
18323
  try {
18345
18324
  for(var _iterator = mounted.overlay[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
18346
18325
  var _step_value = _step.value, from = _step_value.from, to = _step_value.to;
18347
- if ((side > 0 || enterBracketed ? from <= rPos : from < rPos) && (side < 0 || enterBracketed ? to >= rPos : to > rPos)) return new TreeNode(mounted.tree, mounted.overlay[0].from + this.from, -1, this);
18326
+ if ((side > 0 ? from <= rPos : from < rPos) && (side < 0 ? to >= rPos : to > rPos)) return new TreeNode(mounted.tree, mounted.overlay[0].from + this.from, -1, this);
18348
18327
  }
18349
18328
  } catch (err) {
18350
18329
  _didIteratorError = true;
@@ -18508,12 +18487,6 @@ var BufferNode = /*#__PURE__*/ function(BaseNode) {
18508
18487
  return this.child(-1, pos, -2 /* Side.Before */ );
18509
18488
  }
18510
18489
  },
18511
- {
18512
- key: "prop",
18513
- value: function prop(prop) {
18514
- return this.type.prop(prop);
18515
- }
18516
- },
18517
18490
  {
18518
18491
  key: "enter",
18519
18492
  value: function enter(pos, side) {
@@ -18644,8 +18617,11 @@ A tree cursor object focuses on a given node in a syntax tree, and
18644
18617
  allows you to move to adjacent nodes.
18645
18618
  */ var TreeCursor = /*#__PURE__*/ function() {
18646
18619
  function TreeCursor(node) {
18647
- var mode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
18620
+ var /**
18621
+ @internal
18622
+ */ mode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
18648
18623
  _class_call_check$z$1(this, TreeCursor);
18624
+ this.mode = mode;
18649
18625
  /**
18650
18626
  @internal
18651
18627
  */ this.buffer = null;
@@ -18654,7 +18630,6 @@ allows you to move to adjacent nodes.
18654
18630
  @internal
18655
18631
  */ this.index = 0;
18656
18632
  this.bufferNode = null;
18657
- this.mode = mode & ~IterMode.EnterBracketed;
18658
18633
  if (_instanceof$i(node, TreeNode)) {
18659
18634
  this.yieldNode(node);
18660
18635
  } else {
@@ -18998,7 +18973,7 @@ function buildTree(data) {
18998
18973
  function takeNode(parentStart, minPos, children, positions, inRepeat, depth) {
18999
18974
  var id = cursor.id, start = cursor.start, end = cursor.end, size = cursor.size;
19000
18975
  var lookAheadAtStart = lookAhead, contextAtStart = contextHash;
19001
- if (size < 0) {
18976
+ while(size < 0){
19002
18977
  cursor.next();
19003
18978
  if (size == -1 /* SpecialRecord.Reuse */ ) {
19004
18979
  var node = reused[id];
@@ -19165,7 +19140,7 @@ function buildTree(data) {
19165
19140
  fork.next();
19166
19141
  while(fork.pos > startPos){
19167
19142
  if (fork.size < 0) {
19168
- if (fork.size == -3 /* SpecialRecord.ContextChange */ || fork.size == -4 /* SpecialRecord.LookAhead */ ) localSkipped += 4;
19143
+ if (fork.size == -3 /* SpecialRecord.ContextChange */ ) localSkipped += 4;
19169
19144
  else break scan;
19170
19145
  } else if (fork.id >= minRepeatType) {
19171
19146
  localSkipped += 4;
@@ -19604,11 +19579,11 @@ about the parse state.
19604
19579
  var _a;
19605
19580
  var depth = action >> 19 /* Action.ReduceDepthShift */ , type = action & 65535 /* Action.ValueMask */ ;
19606
19581
  var parser = this.p.parser;
19607
- var lookaheadRecord = this.reducePos < this.pos - 25 /* Lookahead.Margin */ && this.setLookAhead(this.pos);
19582
+ var lookaheadRecord = this.reducePos < this.pos - 25 /* Lookahead.Margin */ ;
19583
+ if (lookaheadRecord) this.setLookAhead(this.pos);
19608
19584
  var dPrec = parser.dynamicPrecedence(type);
19609
19585
  if (dPrec) this.score += dPrec;
19610
19586
  if (depth == 0) {
19611
- if (type < parser.minRepeatTerm && this.reducePos < this.pos) this.reducePos = this.pos;
19612
19587
  this.pushState(parser.getGoto(this.state, type, true), this.reducePos);
19613
19588
  // Zero-depth reductions are a special case—they add stuff to
19614
19589
  // the stack without popping anything off.
@@ -19622,9 +19597,7 @@ about the parse state.
19622
19597
  // expression and the state that we'll be staying in, which should
19623
19598
  // be moved to `this.state`).
19624
19599
  var base = this.stack.length - (depth - 1) * 3 - (action & 262144 /* Action.StayFlag */ ? 6 : 0);
19625
- var start = base ? this.stack[base - 2] : this.p.ranges[0].from;
19626
- if (type < parser.minRepeatTerm && start == this.reducePos && this.reducePos < this.pos) this.reducePos = this.pos;
19627
- var size = this.reducePos - start;
19600
+ var start = base ? this.stack[base - 2] : this.p.ranges[0].from, size = this.reducePos - start;
19628
19601
  // This is a kludge to try and detect overly deep left-associative
19629
19602
  // trees, which will not increase the parse stack depth and thus
19630
19603
  // won't be caught by the regular stack-depth limit check.
@@ -19663,11 +19636,15 @@ about the parse state.
19663
19636
  var size = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 4, mustSink = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false;
19664
19637
  if (term == 0 /* Term.Err */ && (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) {
19665
19638
  // Try to omit/merge adjacent error nodes
19666
- var top = this.buffer.length;
19667
- if (top > 0 && this.buffer[top - 4] == 0 /* Term.Err */ && this.buffer[top - 1] > -1) {
19639
+ var cur = this, top = this.buffer.length;
19640
+ if (top == 0 && cur.parent) {
19641
+ top = cur.bufferBase - cur.parent.bufferBase;
19642
+ cur = cur.parent;
19643
+ }
19644
+ if (top > 0 && cur.buffer[top - 4] == 0 /* Term.Err */ && cur.buffer[top - 1] > -1) {
19668
19645
  if (start == end) return;
19669
- if (this.buffer[top - 2] >= start) {
19670
- this.buffer[top - 2] = end;
19646
+ if (cur.buffer[top - 2] >= start) {
19647
+ cur.buffer[top - 2] = end;
19671
19648
  return;
19672
19649
  }
19673
19650
  }
@@ -19676,7 +19653,7 @@ about the parse state.
19676
19653
  this.buffer.push(term, start, end, size);
19677
19654
  } else {
19678
19655
  var index = this.buffer.length;
19679
- if (index > 0 && (this.buffer[index - 4] != 0 /* Term.Err */ || this.buffer[index - 1] < 0)) {
19656
+ if (index > 0 && this.buffer[index - 4] != 0 /* Term.Err */ ) {
19680
19657
  var mustMove = false;
19681
19658
  for(var scan = index; scan > 0 && this.buffer[scan - 2] > end; scan -= 4){
19682
19659
  if (this.buffer[scan - 1] >= 0) {
@@ -19711,11 +19688,11 @@ about the parse state.
19711
19688
  this.pushState(action & 65535 /* Action.ValueMask */ , this.pos);
19712
19689
  } else if ((action & 262144 /* Action.StayFlag */ ) == 0) {
19713
19690
  var nextState = action, parser = this.p.parser;
19714
- this.pos = end;
19715
- var skipped = parser.stateFlag(nextState, 1 /* StateFlag.Skipped */ );
19716
- // Skipped or zero-length non-tree tokens don't move reducePos
19717
- if (!skipped && (end > start || type <= parser.maxNode)) this.reducePos = end;
19718
- this.pushState(nextState, skipped ? start : Math.min(start, this.reducePos));
19691
+ if (end > this.pos || type <= parser.maxNode) {
19692
+ this.pos = end;
19693
+ if (!parser.stateFlag(nextState, 1 /* StateFlag.Skipped */ )) this.reducePos = end;
19694
+ }
19695
+ this.pushState(nextState, start);
19719
19696
  this.shiftContext(type, start);
19720
19697
  if (type <= parser.maxNode) this.buffer.push(type, start, end, 4);
19721
19698
  } else {
@@ -19763,9 +19740,6 @@ about the parse state.
19763
19740
  value: function split() {
19764
19741
  var parent = this;
19765
19742
  var off = parent.buffer.length;
19766
- // Leave off top error node, if there, because that might be
19767
- // merged with other nodes.
19768
- if (off && parent.buffer[off - 4] == 0 /* Term.Err */ ) off -= 4;
19769
19743
  // Because the top of the buffer (after this.pos) may be mutated
19770
19744
  // to reorder reductions and skipped tokens, and shared buffers
19771
19745
  // should be immutable, this copies any outstanding skipped tokens
@@ -20009,10 +19983,10 @@ about the parse state.
20009
19983
  @internal
20010
19984
  */ key: "setLookAhead",
20011
19985
  value: function setLookAhead(lookAhead) {
20012
- if (lookAhead <= this.lookAhead) return false;
20013
- this.emitLookAhead();
20014
- this.lookAhead = lookAhead;
20015
- return true;
19986
+ if (lookAhead > this.lookAhead) {
19987
+ this.emitLookAhead();
19988
+ this.lookAhead = lookAhead;
19989
+ }
20016
19990
  }
20017
19991
  },
20018
19992
  {
@@ -20905,12 +20879,7 @@ var Parse = /*#__PURE__*/ function() {
20905
20879
  }
20906
20880
  }
20907
20881
  }
20908
- if (newStacks.length > 12 /* Rec.MaxStackCount */ ) {
20909
- newStacks.sort(function(a, b) {
20910
- return b.score - a.score;
20911
- });
20912
- newStacks.splice(12 /* Rec.MaxStackCount */ , newStacks.length - 12 /* Rec.MaxStackCount */ );
20913
- }
20882
+ if (newStacks.length > 12 /* Rec.MaxStackCount */ ) newStacks.splice(12 /* Rec.MaxStackCount */ , newStacks.length - 12 /* Rec.MaxStackCount */ );
20914
20883
  }
20915
20884
  this.minStackPos = newStacks[0].pos;
20916
20885
  for(var i2 = 1; i2 < newStacks.length; i2++)if (newStacks[i2].pos < this.minStackPos) this.minStackPos = newStacks[i2].pos;
@@ -21005,7 +20974,7 @@ var Parse = /*#__PURE__*/ function() {
21005
20974
  if (done) continue;
21006
20975
  }
21007
20976
  var force = stack.split(), forceBase = base;
21008
- for(var j = 0; j < 10 /* Rec.ForceReduceLimit */ && force.forceReduce(); j++){
20977
+ for(var j = 0; force.forceReduce() && j < 10 /* Rec.ForceReduceLimit */ ; j++){
21009
20978
  if (verbose) console.log(forceBase + this.stackID(force) + " (via force-reduce)");
21010
20979
  var done1 = this.advanceFully(force, newStacks);
21011
20980
  if (done1) break;
@@ -21040,8 +21009,8 @@ var Parse = /*#__PURE__*/ function() {
21040
21009
  stack.recoverByDelete(token, tokenEnd);
21041
21010
  if (verbose) console.log(base + this.stackID(stack) + " (via recover-delete ".concat(this.parser.getName(token), ")"));
21042
21011
  pushStackDedup(stack, newStacks);
21043
- } else if (!finished || finished.score < force.score) {
21044
- finished = force;
21012
+ } else if (!finished || finished.score < stack.score) {
21013
+ finished = stack;
21045
21014
  }
21046
21015
  }
21047
21016
  return finished;
@@ -21890,7 +21859,7 @@ must be quoted as JSON strings.
21890
21859
  For example:
21891
21860
 
21892
21861
  ```javascript
21893
- parser.configure({props: [
21862
+ parser.withProps(
21894
21863
  styleTags({
21895
21864
  // Style Number and BigNumber nodes
21896
21865
  "Number BigNumber": tags.number,
@@ -21905,7 +21874,7 @@ parser.configure({props: [
21905
21874
  // Style the node named "/" as punctuation
21906
21875
  '"/"': tags.punctuation
21907
21876
  })
21908
- ]})
21877
+ )
21909
21878
  ```
21910
21879
  */ function styleTags(spec) {
21911
21880
  var byName = Object.create(null);
@@ -21961,26 +21930,7 @@ parser.configure({props: [
21961
21930
  }
21962
21931
  return ruleNodeProp.add(byName);
21963
21932
  }
21964
- var ruleNodeProp = new NodeProp({
21965
- combine: function combine(a, b) {
21966
- var cur, root, take;
21967
- while(a || b){
21968
- if (!a || b && a.depth >= b.depth) {
21969
- take = b;
21970
- b = b.next;
21971
- } else {
21972
- take = a;
21973
- a = a.next;
21974
- }
21975
- if (cur && cur.mode == take.mode && !take.context && !cur.context) continue;
21976
- var copy = new Rule$1(take.tags, take.mode, take.context);
21977
- if (cur) cur.next = copy;
21978
- else root = copy;
21979
- cur = copy;
21980
- }
21981
- return root;
21982
- }
21983
- });
21933
+ var ruleNodeProp = new NodeProp();
21984
21934
  var Rule$1 = /*#__PURE__*/ function() {
21985
21935
  function Rule(tags, mode, context, next) {
21986
21936
  _class_call_check$x$1(this, Rule);
@@ -22905,14 +22855,14 @@ function indent(str, spaces) {
22905
22855
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
22906
22856
  // match is required
22907
22857
  if (!match) {
22908
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
22858
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
22909
22859
  v: nextMatch1
22910
22860
  };
22911
22861
  }
22912
22862
  var token = match.token, offset = match.offset;
22913
22863
  i1 += offset;
22914
22864
  if (token === ' ') {
22915
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
22865
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
22916
22866
  }
22917
22867
  tokens1 = _to_consumable_array$4(tokens1).concat([
22918
22868
  token
@@ -22931,7 +22881,7 @@ function indent(str, spaces) {
22931
22881
  if (contextKeys.some(function(el) {
22932
22882
  return el.startsWith(name);
22933
22883
  })) {
22934
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
22884
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
22935
22885
  }
22936
22886
  if (dateTimeIdentifiers.some(function(el) {
22937
22887
  return el === name;
@@ -22950,9 +22900,9 @@ function indent(str, spaces) {
22950
22900
  if (dateTimeIdentifiers.some(function(el) {
22951
22901
  return el.startsWith(name);
22952
22902
  })) {
22953
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
22903
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
22954
22904
  }
22955
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
22905
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
22956
22906
  v: nextMatch1
22957
22907
  };
22958
22908
  };
@@ -44456,7 +44406,7 @@ function _object_spread_props$p(target, source) {
44456
44406
  prefix: '_'
44457
44407
  })).join('').toLowerCase();
44458
44408
  }
44459
- const Handlebars = handlebars_min_default || HandlebarsNamespace;
44409
+ const Handlebars = handlebars_min || HandlebarsNamespace;
44460
44410
  Handlebars.registerHelper('JSONstringify', function(value) {
44461
44411
  return JSON.stringify(value);
44462
44412
  });
@@ -50542,7 +50492,7 @@ bson$1.setInternalBufferSize = setInternalBufferSize;
50542
50492
  Object.defineProperty(exports, "__esModule", {
50543
50493
  value: true
50544
50494
  });
50545
- exports.setUint32LE = exports.readUint8 = exports.readInt32LE = exports.UUID = exports.Timestamp = exports.serialize = exports.ObjectId = exports.NumberUtils = exports.MinKey = exports.MaxKey = exports.Long = exports.Int32 = exports.EJSON = exports.Double = exports.deserialize = exports.Decimal128 = exports.DBRef = exports.Code = exports.calculateObjectSize = exports.ByteUtils = exports.BSONType = exports.BSONSymbol = exports.BSONRegExp = exports.BSONError = exports.BSON = exports.Binary = void 0;
50495
+ exports.setUint32LE = exports.readInt32LE = exports.UUID = exports.Timestamp = exports.serialize = exports.ObjectId = exports.NumberUtils = exports.MinKey = exports.MaxKey = exports.Long = exports.Int32 = exports.EJSON = exports.Double = exports.deserialize = exports.Decimal128 = exports.DBRef = exports.Code = exports.calculateObjectSize = exports.ByteUtils = exports.BSONType = exports.BSONSymbol = exports.BSONRegExp = exports.BSONError = exports.BSON = exports.Binary = void 0;
50546
50496
  exports.parseToElementsToArray = parseToElementsToArray;
50547
50497
  exports.pluckBSONSerializeOptions = pluckBSONSerializeOptions;
50548
50498
  exports.resolveBSONOptions = resolveBSONOptions;
@@ -50704,12 +50654,6 @@ bson$1.setInternalBufferSize = setInternalBufferSize;
50704
50654
  return bson_1.NumberUtils.getInt32LE(buffer, offset);
50705
50655
  };
50706
50656
  exports.readInt32LE = readInt32LE;
50707
- // readUint8, reads a single unsigned byte from buffer at given offset
50708
- var readUint8 = function(buffer, offset) {
50709
- validateBufferInputs(buffer, offset, 1);
50710
- return buffer[offset];
50711
- };
50712
- exports.readUint8 = readUint8;
50713
50657
  var setUint32LE = function(destination, offset, value) {
50714
50658
  destination[offset] = value;
50715
50659
  value >>>= 8;
@@ -50781,11 +50725,11 @@ Object.defineProperty(constants$4, "__esModule", {
50781
50725
  });
50782
50726
  constants$4.OP_MSG = constants$4.OP_COMPRESSED = constants$4.OP_DELETE = constants$4.OP_QUERY = constants$4.OP_INSERT = constants$4.OP_UPDATE = constants$4.OP_REPLY = constants$4.MIN_SUPPORTED_RAW_DATA_SERVER_VERSION = constants$4.MIN_SUPPORTED_RAW_DATA_WIRE_VERSION = constants$4.MIN_SUPPORTED_QE_SERVER_VERSION = constants$4.MIN_SUPPORTED_QE_WIRE_VERSION = constants$4.MAX_SUPPORTED_WIRE_VERSION = constants$4.MIN_SUPPORTED_WIRE_VERSION = constants$4.MIN_SUPPORTED_SNAPSHOT_READS_SERVER_VERSION = constants$4.MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION = constants$4.MAX_SUPPORTED_SERVER_VERSION = constants$4.MIN_SUPPORTED_SERVER_VERSION = void 0;
50783
50727
  constants$4.MIN_SUPPORTED_SERVER_VERSION = '4.2';
50784
- constants$4.MAX_SUPPORTED_SERVER_VERSION = '9.0';
50728
+ constants$4.MAX_SUPPORTED_SERVER_VERSION = '8.2';
50785
50729
  constants$4.MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION = 13;
50786
50730
  constants$4.MIN_SUPPORTED_SNAPSHOT_READS_SERVER_VERSION = '5.0';
50787
50731
  constants$4.MIN_SUPPORTED_WIRE_VERSION = 8;
50788
- constants$4.MAX_SUPPORTED_WIRE_VERSION = 29;
50732
+ constants$4.MAX_SUPPORTED_WIRE_VERSION = 27;
50789
50733
  constants$4.MIN_SUPPORTED_QE_WIRE_VERSION = 21;
50790
50734
  constants$4.MIN_SUPPORTED_QE_SERVER_VERSION = '7.0';
50791
50735
  constants$4.MIN_SUPPORTED_RAW_DATA_WIRE_VERSION = 27;
@@ -79342,6 +79286,77 @@ var ipv4 = {};
79342
79286
 
79343
79287
  var common = {};
79344
79288
 
79289
+ var hasRequiredCommon;
79290
+
79291
+ function requireCommon () {
79292
+ if (hasRequiredCommon) return common;
79293
+ hasRequiredCommon = 1;
79294
+ Object.defineProperty(common, "__esModule", {
79295
+ value: true
79296
+ });
79297
+ common.isInSubnet = isInSubnet;
79298
+ common.isCorrect = isCorrect;
79299
+ common.numberToPaddedHex = numberToPaddedHex;
79300
+ common.stringToPaddedHex = stringToPaddedHex;
79301
+ common.testBit = testBit;
79302
+ function isInSubnet(address) {
79303
+ if (this.subnetMask < address.subnetMask) {
79304
+ return false;
79305
+ }
79306
+ if (this.mask(address.subnetMask) === address.mask()) {
79307
+ return true;
79308
+ }
79309
+ return false;
79310
+ }
79311
+ function isCorrect(defaultBits) {
79312
+ return function() {
79313
+ if (this.addressMinusSuffix !== this.correctForm()) {
79314
+ return false;
79315
+ }
79316
+ if (this.subnetMask === defaultBits && !this.parsedSubnet) {
79317
+ return true;
79318
+ }
79319
+ return this.parsedSubnet === String(this.subnetMask);
79320
+ };
79321
+ }
79322
+ function numberToPaddedHex(number) {
79323
+ return number.toString(16).padStart(2, '0');
79324
+ }
79325
+ function stringToPaddedHex(numberString) {
79326
+ return numberToPaddedHex(parseInt(numberString, 10));
79327
+ }
79328
+ /**
79329
+ * @param binaryValue Binary representation of a value (e.g. `10`)
79330
+ * @param position Byte position, where 0 is the least significant bit
79331
+ */ function testBit(binaryValue, position) {
79332
+ var length = binaryValue.length;
79333
+ if (position > length) {
79334
+ return false;
79335
+ }
79336
+ var positionInString = length - position;
79337
+ return binaryValue.substring(positionInString, positionInString + 1) === '1';
79338
+ }
79339
+ return common;
79340
+ }
79341
+
79342
+ var constants$1 = {};
79343
+
79344
+ var hasRequiredConstants$1;
79345
+
79346
+ function requireConstants$1 () {
79347
+ if (hasRequiredConstants$1) return constants$1;
79348
+ hasRequiredConstants$1 = 1;
79349
+ Object.defineProperty(constants$1, "__esModule", {
79350
+ value: true
79351
+ });
79352
+ constants$1.RE_SUBNET_STRING = constants$1.RE_ADDRESS = constants$1.GROUPS = constants$1.BITS = void 0;
79353
+ constants$1.BITS = 32;
79354
+ constants$1.GROUPS = 4;
79355
+ constants$1.RE_ADDRESS = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g;
79356
+ constants$1.RE_SUBNET_STRING = /\/\d{1,2}$/;
79357
+ return constants$1;
79358
+ }
79359
+
79345
79360
  var addressError = {};
79346
79361
 
79347
79362
  var hasRequiredAddressError;
@@ -79487,97 +79502,6 @@ function requireAddressError () {
79487
79502
  return addressError;
79488
79503
  }
79489
79504
 
79490
- var hasRequiredCommon;
79491
-
79492
- function requireCommon () {
79493
- if (hasRequiredCommon) return common;
79494
- hasRequiredCommon = 1;
79495
- Object.defineProperty(common, "__esModule", {
79496
- value: true
79497
- });
79498
- common.isInSubnet = isInSubnet;
79499
- common.isCorrect = isCorrect;
79500
- common.prefixLengthFromMask = prefixLengthFromMask;
79501
- common.numberToPaddedHex = numberToPaddedHex;
79502
- common.stringToPaddedHex = stringToPaddedHex;
79503
- common.testBit = testBit;
79504
- var address_error_1 = requireAddressError();
79505
- function isInSubnet(address) {
79506
- if (this.subnetMask < address.subnetMask) {
79507
- return false;
79508
- }
79509
- if (this.mask(address.subnetMask) === address.mask()) {
79510
- return true;
79511
- }
79512
- return false;
79513
- }
79514
- function isCorrect(defaultBits) {
79515
- return function() {
79516
- if (this.addressMinusSuffix !== this.correctForm()) {
79517
- return false;
79518
- }
79519
- if (this.subnetMask === defaultBits && !this.parsedSubnet) {
79520
- return true;
79521
- }
79522
- return this.parsedSubnet === String(this.subnetMask);
79523
- };
79524
- }
79525
- /**
79526
- * Returns the prefix length (number of leading 1 bits) of a contiguous
79527
- * subnet mask. Throws `AddressError` if the mask is non-contiguous (e.g.
79528
- * `255.0.255.0`).
79529
- */ function prefixLengthFromMask(value, totalBits) {
79530
- var binary = value.toString(2).padStart(totalBits, '0');
79531
- if (binary.length > totalBits) {
79532
- throw new address_error_1.AddressError('Invalid subnet mask.');
79533
- }
79534
- var firstZero = binary.indexOf('0');
79535
- if (firstZero === -1) {
79536
- return totalBits;
79537
- }
79538
- if (binary.slice(firstZero).includes('1')) {
79539
- throw new address_error_1.AddressError('Invalid subnet mask.');
79540
- }
79541
- return firstZero;
79542
- }
79543
- function numberToPaddedHex(number) {
79544
- return number.toString(16).padStart(2, '0');
79545
- }
79546
- function stringToPaddedHex(numberString) {
79547
- return numberToPaddedHex(parseInt(numberString, 10));
79548
- }
79549
- /**
79550
- * @param binaryValue Binary representation of a value (e.g. `10`)
79551
- * @param position Byte position, where 0 is the least significant bit
79552
- */ function testBit(binaryValue, position) {
79553
- var length = binaryValue.length;
79554
- if (position > length) {
79555
- return false;
79556
- }
79557
- var positionInString = length - position;
79558
- return binaryValue.substring(positionInString, positionInString + 1) === '1';
79559
- }
79560
- return common;
79561
- }
79562
-
79563
- var constants$1 = {};
79564
-
79565
- var hasRequiredConstants$1;
79566
-
79567
- function requireConstants$1 () {
79568
- if (hasRequiredConstants$1) return constants$1;
79569
- hasRequiredConstants$1 = 1;
79570
- Object.defineProperty(constants$1, "__esModule", {
79571
- value: true
79572
- });
79573
- constants$1.RE_SUBNET_STRING = constants$1.RE_ADDRESS = constants$1.GROUPS = constants$1.BITS = void 0;
79574
- constants$1.BITS = 32;
79575
- constants$1.GROUPS = 4;
79576
- constants$1.RE_ADDRESS = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g;
79577
- constants$1.RE_SUBNET_STRING = /\/\d{1,2}$/;
79578
- return constants$1;
79579
- }
79580
-
79581
79505
  var hasRequiredIpv4;
79582
79506
 
79583
79507
  function requireIpv4 () {
@@ -79642,9 +79566,9 @@ function requireIpv4 () {
79642
79566
  var common = __importStar(requireCommon());
79643
79567
  var constants = __importStar(requireConstants$1());
79644
79568
  var address_error_1 = requireAddressError();
79645
- var isCorrect4 = common.isCorrect(constants.BITS);
79646
79569
  /**
79647
79570
  * Represents an IPv4 address
79571
+ * @class Address4
79648
79572
  * @param {string} address - An IPv4 address string
79649
79573
  */ var Address4 = /*#__PURE__*/ function() {
79650
79574
  function Address4(address) {
@@ -79657,10 +79581,14 @@ function requireIpv4 () {
79657
79581
  this.v4 = true;
79658
79582
  /**
79659
79583
  * Returns true if the address is correct, false otherwise
79584
+ * @memberof Address4
79585
+ * @instance
79660
79586
  * @returns {Boolean}
79661
- */ this.isCorrect = isCorrect4;
79587
+ */ this.isCorrect = common.isCorrect(constants.BITS);
79662
79588
  /**
79663
79589
  * Returns true if the given address is in the subnet of the current address
79590
+ * @memberof Address4
79591
+ * @instance
79664
79592
  * @returns {boolean}
79665
79593
  */ this.isInSubnet = common.isInSubnet;
79666
79594
  this.address = address;
@@ -79679,11 +79607,8 @@ function requireIpv4 () {
79679
79607
  }
79680
79608
  _create_class(Address4, [
79681
79609
  {
79682
- /**
79683
- * Parses an IPv4 address string into its four octet groups and stores the
79684
- * result on `this.parsedAddress`. Called automatically by the constructor;
79685
- * you typically don't need to call it directly. Throws `AddressError` if
79686
- * the input is not a valid IPv4 address.
79610
+ /*
79611
+ * Parses a v4 address
79687
79612
  */ key: "parse",
79688
79613
  value: function parse(address) {
79689
79614
  var groups = address.split('.');
@@ -79695,9 +79620,10 @@ function requireIpv4 () {
79695
79620
  },
79696
79621
  {
79697
79622
  /**
79698
- * Returns the address in correct form: octets joined with `.` and any
79699
- * leading zeros stripped (e.g. `192.168.1.1`). For IPv4 this matches the
79700
- * canonical dotted-decimal representation.
79623
+ * Returns the correct form of an address
79624
+ * @memberof Address4
79625
+ * @instance
79626
+ * @returns {String}
79701
79627
  */ key: "correctForm",
79702
79628
  value: function correctForm() {
79703
79629
  return this.parsedAddress.map(function(part) {
@@ -79708,6 +79634,8 @@ function requireIpv4 () {
79708
79634
  {
79709
79635
  /**
79710
79636
  * Converts an IPv4 address object to a hex string
79637
+ * @memberof Address4
79638
+ * @instance
79711
79639
  * @returns {String}
79712
79640
  */ key: "toHex",
79713
79641
  value: function toHex() {
@@ -79718,9 +79646,9 @@ function requireIpv4 () {
79718
79646
  },
79719
79647
  {
79720
79648
  /**
79721
- * Converts an IPv4 address object to an array of bytes.
79722
- *
79723
- * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toArray())`.
79649
+ * Converts an IPv4 address object to an array of bytes
79650
+ * @memberof Address4
79651
+ * @instance
79724
79652
  * @returns {Array}
79725
79653
  */ key: "toArray",
79726
79654
  value: function toArray() {
@@ -79732,6 +79660,8 @@ function requireIpv4 () {
79732
79660
  {
79733
79661
  /**
79734
79662
  * Converts an IPv4 address object to an IPv6 address group
79663
+ * @memberof Address4
79664
+ * @instance
79735
79665
  * @returns {String}
79736
79666
  */ key: "toGroup6",
79737
79667
  value: function toGroup6() {
@@ -79746,6 +79676,8 @@ function requireIpv4 () {
79746
79676
  {
79747
79677
  /**
79748
79678
  * Returns the address as a `bigint`
79679
+ * @memberof Address4
79680
+ * @instance
79749
79681
  * @returns {bigint}
79750
79682
  */ key: "bigInt",
79751
79683
  value: function bigInt() {
@@ -79757,6 +79689,8 @@ function requireIpv4 () {
79757
79689
  {
79758
79690
  /**
79759
79691
  * Helper function getting start address.
79692
+ * @memberof Address4
79693
+ * @instance
79760
79694
  * @returns {bigint}
79761
79695
  */ key: "_startAddress",
79762
79696
  value: function _startAddress() {
@@ -79767,6 +79701,8 @@ function requireIpv4 () {
79767
79701
  /**
79768
79702
  * The first address in the range given by this address' subnet.
79769
79703
  * Often referred to as the Network Address.
79704
+ * @memberof Address4
79705
+ * @instance
79770
79706
  * @returns {Address4}
79771
79707
  */ key: "startAddress",
79772
79708
  value: function startAddress() {
@@ -79777,6 +79713,8 @@ function requireIpv4 () {
79777
79713
  /**
79778
79714
  * The first host address in the range given by this address's subnet ie
79779
79715
  * the first address after the Network Address
79716
+ * @memberof Address4
79717
+ * @instance
79780
79718
  * @returns {Address4}
79781
79719
  */ key: "startAddressExclusive",
79782
79720
  value: function startAddressExclusive() {
@@ -79787,6 +79725,8 @@ function requireIpv4 () {
79787
79725
  {
79788
79726
  /**
79789
79727
  * Helper function getting end address.
79728
+ * @memberof Address4
79729
+ * @instance
79790
79730
  * @returns {bigint}
79791
79731
  */ key: "_endAddress",
79792
79732
  value: function _endAddress() {
@@ -79797,6 +79737,8 @@ function requireIpv4 () {
79797
79737
  /**
79798
79738
  * The last address in the range given by this address' subnet
79799
79739
  * Often referred to as the Broadcast
79740
+ * @memberof Address4
79741
+ * @instance
79800
79742
  * @returns {Address4}
79801
79743
  */ key: "endAddress",
79802
79744
  value: function endAddress() {
@@ -79807,6 +79749,8 @@ function requireIpv4 () {
79807
79749
  /**
79808
79750
  * The last host address in the range given by this address's subnet ie
79809
79751
  * the last address prior to the Broadcast Address
79752
+ * @memberof Address4
79753
+ * @instance
79810
79754
  * @returns {Address4}
79811
79755
  */ key: "endAddressExclusive",
79812
79756
  value: function endAddressExclusive() {
@@ -79816,40 +79760,10 @@ function requireIpv4 () {
79816
79760
  },
79817
79761
  {
79818
79762
  /**
79819
- * The dotted-decimal form of the subnet mask, e.g. `255.255.240.0` for
79820
- * a `/20`. Returns an `Address4`; call `.correctForm()` for the string.
79821
- * @returns {Address4}
79822
- */ key: "subnetMaskAddress",
79823
- value: function subnetMaskAddress() {
79824
- return Address4.fromBigInt(BigInt("0b".concat('1'.repeat(this.subnetMask)).concat('0'.repeat(constants.BITS - this.subnetMask))));
79825
- }
79826
- },
79827
- {
79828
- /**
79829
- * The Cisco-style wildcard mask, e.g. `0.0.0.255` for a `/24`. This is
79830
- * the bitwise inverse of `subnetMaskAddress()`. Returns an `Address4`;
79831
- * call `.correctForm()` for the string.
79832
- * @returns {Address4}
79833
- */ key: "wildcardMask",
79834
- value: function wildcardMask() {
79835
- return Address4.fromBigInt(BigInt("0b".concat('0'.repeat(this.subnetMask)).concat('1'.repeat(constants.BITS - this.subnetMask))));
79836
- }
79837
- },
79838
- {
79839
- /**
79840
- * The network address in CIDR string form, e.g. `192.168.1.0/24` for
79841
- * `192.168.1.5/24`. For an address with no explicit subnet the prefix is
79842
- * `/32`, e.g. `networkForm()` on `192.168.1.5` returns `192.168.1.5/32`.
79843
- * @returns {string}
79844
- */ key: "networkForm",
79845
- value: function networkForm() {
79846
- return "".concat(this.startAddress().correctForm(), "/").concat(this.subnetMask);
79847
- }
79848
- },
79849
- {
79850
- /**
79851
79763
  * Returns the first n bits of the address, defaulting to the
79852
79764
  * subnet mask
79765
+ * @memberof Address4
79766
+ * @instance
79853
79767
  * @returns {String}
79854
79768
  */ key: "mask",
79855
79769
  value: function mask(mask) {
@@ -79862,6 +79776,8 @@ function requireIpv4 () {
79862
79776
  {
79863
79777
  /**
79864
79778
  * Returns the bits in the given range as a base-2 string
79779
+ * @memberof Address4
79780
+ * @instance
79865
79781
  * @returns {string}
79866
79782
  */ key: "getBitsBase2",
79867
79783
  value: function getBitsBase2(start, end) {
@@ -79871,8 +79787,10 @@ function requireIpv4 () {
79871
79787
  {
79872
79788
  /**
79873
79789
  * Return the reversed ip6.arpa form of the address
79790
+ * @memberof Address4
79874
79791
  * @param {Object} options
79875
79792
  * @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix
79793
+ * @instance
79876
79794
  * @returns {String}
79877
79795
  */ key: "reverseForm",
79878
79796
  value: function reverseForm(options) {
@@ -79889,79 +79807,23 @@ function requireIpv4 () {
79889
79807
  {
79890
79808
  /**
79891
79809
  * Returns true if the given address is a multicast address
79810
+ * @memberof Address4
79811
+ * @instance
79892
79812
  * @returns {boolean}
79893
79813
  */ key: "isMulticast",
79894
79814
  value: function isMulticast() {
79895
- return this.isInSubnet(MULTICAST_V4);
79896
- }
79897
- },
79898
- {
79899
- /**
79900
- * Returns true if the address is in one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private address ranges (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`).
79901
- * @returns {boolean}
79902
- */ key: "isPrivate",
79903
- value: function isPrivate() {
79904
- var _this = this;
79905
- return PRIVATE_V4.some(function(subnet) {
79906
- return _this.isInSubnet(subnet);
79907
- });
79908
- }
79909
- },
79910
- {
79911
- /**
79912
- * Returns true if the address is in the loopback range `127.0.0.0/8` ([RFC 1122](https://datatracker.ietf.org/doc/html/rfc1122)).
79913
- * @returns {boolean}
79914
- */ key: "isLoopback",
79915
- value: function isLoopback() {
79916
- return this.isInSubnet(LOOPBACK_V4);
79917
- }
79918
- },
79919
- {
79920
- /**
79921
- * Returns true if the address is in the link-local range `169.254.0.0/16` ([RFC 3927](https://datatracker.ietf.org/doc/html/rfc3927)).
79922
- * @returns {boolean}
79923
- */ key: "isLinkLocal",
79924
- value: function isLinkLocal() {
79925
- return this.isInSubnet(LINK_LOCAL_V4);
79926
- }
79927
- },
79928
- {
79929
- /**
79930
- * Returns true if the address is the unspecified address `0.0.0.0`.
79931
- * @returns {boolean}
79932
- */ key: "isUnspecified",
79933
- value: function isUnspecified() {
79934
- return this.isInSubnet(UNSPECIFIED_V4);
79935
- }
79936
- },
79937
- {
79938
- /**
79939
- * Returns true if the address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)).
79940
- * @returns {boolean}
79941
- */ key: "isBroadcast",
79942
- value: function isBroadcast() {
79943
- return this.isInSubnet(BROADCAST_V4);
79944
- }
79945
- },
79946
- {
79947
- /**
79948
- * Returns true if the address is in the carrier-grade NAT range `100.64.0.0/10` ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)).
79949
- * @returns {boolean}
79950
- */ key: "isCGNAT",
79951
- value: function isCGNAT() {
79952
- return this.isInSubnet(CGNAT_V4);
79815
+ return this.isInSubnet(new Address4('224.0.0.0/4'));
79953
79816
  }
79954
79817
  },
79955
79818
  {
79956
79819
  /**
79957
79820
  * Returns a zero-padded base-2 string representation of the address
79821
+ * @memberof Address4
79822
+ * @instance
79958
79823
  * @returns {string}
79959
79824
  */ key: "binaryZeroPad",
79960
79825
  value: function binaryZeroPad() {
79961
- if (this._binaryZeroPad === undefined) {
79962
- this._binaryZeroPad = this.bigInt().toString(2).padStart(constants.BITS, '0');
79963
- }
79964
- return this._binaryZeroPad;
79826
+ return this.bigInt().toString(2).padStart(constants.BITS, '0');
79965
79827
  }
79966
79828
  },
79967
79829
  {
@@ -79977,13 +79839,7 @@ function requireIpv4 () {
79977
79839
  ], [
79978
79840
  {
79979
79841
  key: "isValid",
79980
- value: /**
79981
- * Returns true if the given string is a valid IPv4 address (with optional
79982
- * CIDR subnet), false otherwise. Host bits in the subnet portion are
79983
- * allowed (e.g. `192.168.1.5/24` is valid); for strict network-address
79984
- * validation compare `correctForm()` to `startAddress().correctForm()`,
79985
- * or use `networkForm()`.
79986
- */ function isValid(address) {
79842
+ value: function isValid(address) {
79987
79843
  try {
79988
79844
  // eslint-disable-next-line no-new
79989
79845
  new Address4(address);
@@ -79993,93 +79849,21 @@ function requireIpv4 () {
79993
79849
  }
79994
79850
  }
79995
79851
  },
79996
- {
79997
- key: "fromAddressAndMask",
79998
- value: /**
79999
- * Construct an `Address4` from an address and a dotted-decimal subnet
80000
- * mask given as separate strings (e.g. as returned by Node's
80001
- * `os.networkInterfaces()`). Throws `AddressError` if the mask is
80002
- * non-contiguous (e.g. `255.0.255.0`).
80003
- * @example
80004
- * var address = Address4.fromAddressAndMask('192.168.1.1', '255.255.255.0');
80005
- * address.subnetMask; // 24
80006
- */ function fromAddressAndMask(address, mask) {
80007
- var bits = common.prefixLengthFromMask(new Address4(mask).bigInt(), constants.BITS);
80008
- return new Address4("".concat(address, "/").concat(bits));
80009
- }
80010
- },
80011
- {
80012
- key: "fromAddressAndWildcardMask",
80013
- value: /**
80014
- * Construct an `Address4` from an address and a Cisco-style wildcard mask
80015
- * given as separate strings (e.g. `0.0.0.255` for a `/24`). The wildcard
80016
- * mask is the bitwise inverse of the subnet mask. Throws `AddressError`
80017
- * if the mask is non-contiguous (e.g. `0.255.0.255`).
80018
- * @example
80019
- * var address = Address4.fromAddressAndWildcardMask('10.0.0.1', '0.0.0.255');
80020
- * address.subnetMask; // 24
80021
- */ function fromAddressAndWildcardMask(address, wildcardMask) {
80022
- var wildcard = new Address4(wildcardMask).bigInt();
80023
- var allOnes = (BigInt(1) << BigInt(constants.BITS)) - BigInt(1);
80024
- // eslint-disable-next-line no-bitwise
80025
- var mask = wildcard ^ allOnes;
80026
- var bits = common.prefixLengthFromMask(mask, constants.BITS);
80027
- return new Address4("".concat(address, "/").concat(bits));
80028
- }
80029
- },
80030
- {
80031
- key: "fromWildcard",
80032
- value: /**
80033
- * Construct an `Address4` from a wildcard pattern with trailing `*`
80034
- * octets. The number of trailing wildcards determines the prefix
80035
- * length: each `*` represents 8 bits.
80036
- *
80037
- * Only trailing whole-octet wildcards are supported. Partial-octet
80038
- * wildcards (e.g. `192.168.0.1*`) and interior wildcards (e.g.
80039
- * `192.*.0.1`) throw `AddressError`.
80040
- * @example
80041
- * Address4.fromWildcard('192.168.0.*').subnet; // '/24'
80042
- * Address4.fromWildcard('192.168.*.*').subnet; // '/16'
80043
- * Address4.fromWildcard('*.*.*.*').subnet; // '/0'
80044
- */ function fromWildcard(input) {
80045
- var groups = input.split('.');
80046
- if (groups.length !== constants.GROUPS) {
80047
- throw new address_error_1.AddressError('Wildcard pattern must have 4 octets');
80048
- }
80049
- var firstWildcard = -1;
80050
- for(var i = 0; i < groups.length; i++){
80051
- if (groups[i] === '*') {
80052
- if (firstWildcard === -1) {
80053
- firstWildcard = i;
80054
- }
80055
- } else if (firstWildcard !== -1) {
80056
- throw new address_error_1.AddressError('Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)');
80057
- }
80058
- }
80059
- var trailing = firstWildcard === -1 ? 0 : groups.length - firstWildcard;
80060
- var replaced = groups.map(function(g) {
80061
- return g === '*' ? '0' : g;
80062
- });
80063
- var subnetBits = constants.BITS - trailing * 8;
80064
- return new Address4("".concat(replaced.join('.'), "/").concat(subnetBits));
80065
- }
80066
- },
80067
79852
  {
80068
79853
  key: "fromHex",
80069
79854
  value: /**
80070
- * Converts a hex string to an IPv4 address object. Accepts 8 hex digits
80071
- * with optional `:` separators (e.g. `'7f000001'` or `'7f:00:00:01'`).
80072
- * Throws `AddressError` for any other length or for non-hex characters.
79855
+ * Converts a hex string to an IPv4 address object
79856
+ * @memberof Address4
79857
+ * @static
80073
79858
  * @param {string} hex - a hex string to convert
80074
79859
  * @returns {Address4}
80075
79860
  */ function fromHex(hex) {
80076
- var stripped = hex.replace(/:/g, '');
80077
- if (!/^[0-9a-fA-F]{8}$/.test(stripped)) {
80078
- throw new address_error_1.AddressError('IPv4 hex must be exactly 8 hex digits');
80079
- }
79861
+ var padded = hex.replace(/:/g, '').padStart(8, '0');
80080
79862
  var groups = [];
80081
- for(var i = 0; i < 8; i += 2){
80082
- groups.push(parseInt(stripped.slice(i, i + 2), 16));
79863
+ var i;
79864
+ for(i = 0; i < 8; i += 2){
79865
+ var h = padded.slice(i, i + 2);
79866
+ groups.push(parseInt(h, 16));
80083
79867
  }
80084
79868
  return new Address4(groups.join('.'));
80085
79869
  }
@@ -80087,22 +79871,21 @@ function requireIpv4 () {
80087
79871
  {
80088
79872
  key: "fromInteger",
80089
79873
  value: /**
80090
- * Converts an integer into a IPv4 address object. The integer must be a
80091
- * non-negative safe integer in the range `[0, 2**32 - 1]`; otherwise
80092
- * `AddressError` is thrown.
79874
+ * Converts an integer into a IPv4 address object
79875
+ * @memberof Address4
79876
+ * @static
80093
79877
  * @param {integer} integer - a number to convert
80094
79878
  * @returns {Address4}
80095
79879
  */ function fromInteger(integer) {
80096
- if (!Number.isInteger(integer) || integer < 0 || integer > 0xffffffff) {
80097
- throw new address_error_1.AddressError('IPv4 integer must be in the range 0 to 2**32 - 1');
80098
- }
80099
- return Address4.fromHex(integer.toString(16).padStart(8, '0'));
79880
+ return Address4.fromHex(integer.toString(16));
80100
79881
  }
80101
79882
  },
80102
79883
  {
80103
79884
  key: "fromArpa",
80104
79885
  value: /**
80105
79886
  * Return an address from in-addr.arpa form
79887
+ * @memberof Address4
79888
+ * @static
80106
79889
  * @param {string} arpaFormAddress - an 'in-addr.arpa' form ipv4 address
80107
79890
  * @returns {Adress4}
80108
79891
  * @example
@@ -80118,67 +79901,19 @@ function requireIpv4 () {
80118
79901
  {
80119
79902
  key: "fromBigInt",
80120
79903
  value: /**
80121
- * Converts a BigInt to a v4 address object. The value must be in the
80122
- * range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown.
79904
+ * Converts a BigInt to a v4 address object
79905
+ * @memberof Address4
79906
+ * @static
80123
79907
  * @param {bigint} bigInt - a BigInt to convert
80124
79908
  * @returns {Address4}
80125
79909
  */ function fromBigInt(bigInt) {
80126
- if (bigInt < 0n || bigInt > 0xffffffffn) {
80127
- throw new address_error_1.AddressError('IPv4 BigInt must be in the range 0 to 2**32 - 1');
80128
- }
80129
- return Address4.fromHex(bigInt.toString(16).padStart(8, '0'));
80130
- }
80131
- },
80132
- {
80133
- key: "fromByteArray",
80134
- value: /**
80135
- * Convert a byte array to an Address4 object.
80136
- *
80137
- * To convert from a Node.js `Buffer`, spread it: `Address4.fromByteArray([...buf])`.
80138
- * @param {Array<number>} bytes - an array of 4 bytes (0-255)
80139
- * @returns {Address4}
80140
- */ function fromByteArray(bytes) {
80141
- if (bytes.length !== 4) {
80142
- throw new address_error_1.AddressError('IPv4 addresses require exactly 4 bytes');
80143
- }
80144
- // Validate that all bytes are within valid range (0-255)
80145
- for(var i = 0; i < bytes.length; i++){
80146
- if (!Number.isInteger(bytes[i]) || bytes[i] < 0 || bytes[i] > 255) {
80147
- throw new address_error_1.AddressError('All bytes must be integers between 0 and 255');
80148
- }
80149
- }
80150
- return this.fromUnsignedByteArray(bytes);
80151
- }
80152
- },
80153
- {
80154
- key: "fromUnsignedByteArray",
80155
- value: /**
80156
- * Convert an unsigned byte array to an Address4 object
80157
- * @param {Array<number>} bytes - an array of 4 unsigned bytes (0-255)
80158
- * @returns {Address4}
80159
- */ function fromUnsignedByteArray(bytes) {
80160
- if (bytes.length !== 4) {
80161
- throw new address_error_1.AddressError('IPv4 addresses require exactly 4 bytes');
80162
- }
80163
- var address = bytes.join('.');
80164
- return new Address4(address);
79910
+ return Address4.fromHex(bigInt.toString(16));
80165
79911
  }
80166
79912
  }
80167
79913
  ]);
80168
79914
  return Address4;
80169
79915
  }();
80170
- ipv4.Address4 = Address4;
80171
- var MULTICAST_V4 = new Address4('224.0.0.0/4');
80172
- var PRIVATE_V4 = [
80173
- new Address4('10.0.0.0/8'),
80174
- new Address4('172.16.0.0/12'),
80175
- new Address4('192.168.0.0/16')
80176
- ];
80177
- var LOOPBACK_V4 = new Address4('127.0.0.0/8');
80178
- var LINK_LOCAL_V4 = new Address4('169.254.0.0/16');
80179
- var UNSPECIFIED_V4 = new Address4('0.0.0.0/32');
80180
- var BROADCAST_V4 = new Address4('255.255.255.255/32');
80181
- var CGNAT_V4 = new Address4('100.64.0.0/10');
79916
+ ipv4.Address4 = Address4;
80182
79917
  return ipv4;
80183
79918
  }
80184
79919
 
@@ -80237,12 +79972,7 @@ function requireConstants () {
80237
79972
  '::/128': 'Unspecified',
80238
79973
  '::1/128': 'Loopback',
80239
79974
  'ff00::/8': 'Multicast',
80240
- 'fe80::/10': 'Link-local unicast',
80241
- 'fc00::/7': 'Unique local',
80242
- '2002::/16': '6to4',
80243
- '2001:db8::/32': 'Documentation',
80244
- '64:ff9b::/96': 'NAT64 (well-known)',
80245
- '64:ff9b:1::/48': 'NAT64 (local-use)'
79975
+ 'fe80::/10': 'Link-local unicast'
80246
79976
  };
80247
79977
  /**
80248
79978
  * A regular expression that matches bad characters in an IPv6 address
@@ -80279,18 +80009,14 @@ function requireHelpers$1 () {
80279
80009
  Object.defineProperty(helpers, "__esModule", {
80280
80010
  value: true
80281
80011
  });
80282
- helpers.escapeHtml = escapeHtml;
80283
80012
  helpers.spanAllZeroes = spanAllZeroes;
80284
80013
  helpers.spanAll = spanAll;
80285
80014
  helpers.spanLeadingZeroes = spanLeadingZeroes;
80286
80015
  helpers.simpleGroup = simpleGroup;
80287
- function escapeHtml(s) {
80288
- return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
80289
- }
80290
80016
  /**
80291
80017
  * @returns {String} the string with all zeroes contained in a <span>
80292
80018
  */ function spanAllZeroes(s) {
80293
- return escapeHtml(s).replace(/(0+)/g, '<span class="zero">$1</span>');
80019
+ return s.replace(/(0+)/g, '<span class="zero">$1</span>');
80294
80020
  }
80295
80021
  /**
80296
80022
  * @returns {String} the string with each character contained in a <span>
@@ -80298,11 +80024,11 @@ function requireHelpers$1 () {
80298
80024
  var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
80299
80025
  var letters = s.split('');
80300
80026
  return letters.map(function(n, i) {
80301
- return '<span class="digit value-'.concat(escapeHtml(n), " position-").concat(i + offset, '">').concat(spanAllZeroes(n), "</span>");
80027
+ return '<span class="digit value-'.concat(n, " position-").concat(i + offset, '">').concat(spanAllZeroes(n), "</span>");
80302
80028
  }).join('');
80303
80029
  }
80304
80030
  function spanLeadingZeroesSimple(group) {
80305
- return escapeHtml(group).replace(/^(0+)/, '<span class="zero">$1</span>');
80031
+ return group.replace(/^(0+)/, '<span class="zero">$1</span>');
80306
80032
  }
80307
80033
  /**
80308
80034
  * @returns {String} the string with leading zeroes contained in a <span>
@@ -80580,7 +80306,6 @@ function requireIpv6 () {
80580
80306
  var regular_expressions_1 = requireRegularExpressions();
80581
80307
  var address_error_1 = requireAddressError();
80582
80308
  var common_1 = requireCommon();
80583
- var isCorrect6 = common.isCorrect(constants6.BITS);
80584
80309
  function assert(condition) {
80585
80310
  if (!condition) {
80586
80311
  throw new Error('Assertion failed.');
@@ -80624,6 +80349,7 @@ function requireIpv6 () {
80624
80349
  }
80625
80350
  /**
80626
80351
  * Represents an IPv6 address
80352
+ * @class Address6
80627
80353
  * @param {string} address - An IPv6 address string
80628
80354
  * @param {number} [groups=8] - How many octets to parse
80629
80355
  * @example
@@ -80640,12 +80366,16 @@ function requireIpv6 () {
80640
80366
  // #region Attributes
80641
80367
  /**
80642
80368
  * Returns true if the given address is in the subnet of the current address
80369
+ * @memberof Address6
80370
+ * @instance
80643
80371
  * @returns {boolean}
80644
80372
  */ this.isInSubnet = common.isInSubnet;
80645
80373
  /**
80646
80374
  * Returns true if the address is correct, false otherwise
80375
+ * @memberof Address6
80376
+ * @instance
80647
80377
  * @returns {boolean}
80648
- */ this.isCorrect = isCorrect6;
80378
+ */ this.isCorrect = common.isCorrect(constants6.BITS);
80649
80379
  if (optionalGroups === undefined) {
80650
80380
  this.groups = constants6.GROUPS;
80651
80381
  } else {
@@ -80676,6 +80406,8 @@ function requireIpv6 () {
80676
80406
  {
80677
80407
  /**
80678
80408
  * Return the Microsoft UNC transcription of the address
80409
+ * @memberof Address6
80410
+ * @instance
80679
80411
  * @returns {String} the Microsoft UNC transcription of the address
80680
80412
  */ key: "microsoftTranscription",
80681
80413
  value: function microsoftTranscription() {
@@ -80685,6 +80417,8 @@ function requireIpv6 () {
80685
80417
  {
80686
80418
  /**
80687
80419
  * Return the first n bits of the address, defaulting to the subnet mask
80420
+ * @memberof Address6
80421
+ * @instance
80688
80422
  * @param {number} [mask=subnet] - the number of bits to mask
80689
80423
  * @returns {String} the first n bits of the address as a string
80690
80424
  */ key: "mask",
@@ -80696,6 +80430,8 @@ function requireIpv6 () {
80696
80430
  {
80697
80431
  /**
80698
80432
  * Return the number of possible subnets of a given size in the address
80433
+ * @memberof Address6
80434
+ * @instance
80699
80435
  * @param {number} [subnetSize=128] - the subnet size
80700
80436
  * @returns {String}
80701
80437
  */ // TODO: probably useful to have a numeric version of this too
@@ -80714,6 +80450,8 @@ function requireIpv6 () {
80714
80450
  {
80715
80451
  /**
80716
80452
  * Helper function getting start address.
80453
+ * @memberof Address6
80454
+ * @instance
80717
80455
  * @returns {bigint}
80718
80456
  */ key: "_startAddress",
80719
80457
  value: function _startAddress() {
@@ -80724,6 +80462,8 @@ function requireIpv6 () {
80724
80462
  /**
80725
80463
  * The first address in the range given by this address' subnet
80726
80464
  * Often referred to as the Network Address.
80465
+ * @memberof Address6
80466
+ * @instance
80727
80467
  * @returns {Address6}
80728
80468
  */ key: "startAddress",
80729
80469
  value: function startAddress() {
@@ -80734,6 +80474,8 @@ function requireIpv6 () {
80734
80474
  /**
80735
80475
  * The first host address in the range given by this address's subnet ie
80736
80476
  * the first address after the Network Address
80477
+ * @memberof Address6
80478
+ * @instance
80737
80479
  * @returns {Address6}
80738
80480
  */ key: "startAddressExclusive",
80739
80481
  value: function startAddressExclusive() {
@@ -80744,6 +80486,8 @@ function requireIpv6 () {
80744
80486
  {
80745
80487
  /**
80746
80488
  * Helper function getting end address.
80489
+ * @memberof Address6
80490
+ * @instance
80747
80491
  * @returns {bigint}
80748
80492
  */ key: "_endAddress",
80749
80493
  value: function _endAddress() {
@@ -80754,6 +80498,8 @@ function requireIpv6 () {
80754
80498
  /**
80755
80499
  * The last address in the range given by this address' subnet
80756
80500
  * Often referred to as the Broadcast
80501
+ * @memberof Address6
80502
+ * @instance
80757
80503
  * @returns {Address6}
80758
80504
  */ key: "endAddress",
80759
80505
  value: function endAddress() {
@@ -80764,6 +80510,8 @@ function requireIpv6 () {
80764
80510
  /**
80765
80511
  * The last host address in the range given by this address's subnet ie
80766
80512
  * the last address prior to the Broadcast Address
80513
+ * @memberof Address6
80514
+ * @instance
80767
80515
  * @returns {Address6}
80768
80516
  */ key: "endAddressExclusive",
80769
80517
  value: function endAddressExclusive() {
@@ -80773,75 +80521,47 @@ function requireIpv6 () {
80773
80521
  },
80774
80522
  {
80775
80523
  /**
80776
- * The hex form of the subnet mask, e.g. `ffff:ffff:ffff:ffff::` for a
80777
- * `/64`. Returns an `Address6`; call `.correctForm()` for the string.
80778
- * @returns {Address6}
80779
- */ key: "subnetMaskAddress",
80780
- value: function subnetMaskAddress() {
80781
- return Address6.fromBigInt(BigInt("0b".concat('1'.repeat(this.subnetMask)).concat('0'.repeat(constants6.BITS - this.subnetMask))));
80782
- }
80783
- },
80784
- {
80785
- /**
80786
- * The Cisco-style wildcard mask, e.g. `::ffff:ffff:ffff:ffff` for a
80787
- * `/64`. This is the bitwise inverse of `subnetMaskAddress()`. Returns
80788
- * an `Address6`; call `.correctForm()` for the string.
80789
- * @returns {Address6}
80790
- */ key: "wildcardMask",
80791
- value: function wildcardMask() {
80792
- return Address6.fromBigInt(BigInt("0b".concat('0'.repeat(this.subnetMask)).concat('1'.repeat(constants6.BITS - this.subnetMask))));
80793
- }
80794
- },
80795
- {
80796
- /**
80797
- * The network address in CIDR string form, e.g. `2001:db8::/32` for
80798
- * `2001:db8::1/32`. For an address with no explicit subnet the prefix
80799
- * is `/128`, e.g. `networkForm()` on `2001:db8::1` returns
80800
- * `2001:db8::1/128`.
80801
- * @returns {string}
80802
- */ key: "networkForm",
80803
- value: function networkForm() {
80804
- return "".concat(this.startAddress().correctForm(), "/").concat(this.subnetMask);
80805
- }
80806
- },
80807
- {
80808
- /**
80809
- * Return the scope of the address. The 4-bit scope field
80810
- * ([RFC 4291 §2.7](https://datatracker.ietf.org/doc/html/rfc4291#section-2.7))
80811
- * is only defined for multicast addresses; for unicast addresses the scope
80812
- * is derived from the address type per
80813
- * [RFC 4007 §6](https://datatracker.ietf.org/doc/html/rfc4007#section-6).
80524
+ * Return the scope of the address
80525
+ * @memberof Address6
80526
+ * @instance
80814
80527
  * @returns {String}
80815
80528
  */ key: "getScope",
80816
80529
  value: function getScope() {
80817
- var type = this.getType();
80818
- if (type === 'Multicast' || type.startsWith('Multicast ')) {
80819
- var scope = constants6.SCOPES[parseInt(this.getBits(12, 16).toString(10), 10)];
80820
- return scope || 'Unknown';
80821
- }
80822
- // RFC 4291 §2.5.3: the loopback address is treated as having Link-Local
80823
- // scope. (Multicast scope 1, "Interface-Local", is a different concept
80824
- // used only for loopback transmission of multicast.)
80825
- if (type === 'Link-local unicast' || type === 'Loopback') {
80826
- return 'Link local';
80827
- }
80828
- // RFC 4007 §6: the unspecified address has no scope.
80829
- if (type === 'Unspecified') {
80830
- return 'Unknown';
80530
+ var scope = constants6.SCOPES[parseInt(this.getBits(12, 16).toString(10), 10)];
80531
+ if (this.getType() === 'Global unicast' && scope !== 'Link local') {
80532
+ scope = 'Global';
80831
80533
  }
80832
- return 'Global';
80534
+ return scope || 'Unknown';
80833
80535
  }
80834
80536
  },
80835
80537
  {
80836
80538
  /**
80837
80539
  * Return the type of the address
80540
+ * @memberof Address6
80541
+ * @instance
80838
80542
  * @returns {String}
80839
80543
  */ key: "getType",
80840
80544
  value: function getType() {
80841
- for(var i = 0; i < TYPE_SUBNETS.length; i++){
80842
- var entry = TYPE_SUBNETS[i];
80843
- if (this.isInSubnet(entry[0])) {
80844
- return entry[1];
80545
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
80546
+ try {
80547
+ for(var _iterator = Object.keys(constants6.TYPES)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
80548
+ var subnet = _step.value;
80549
+ if (this.isInSubnet(new Address6(subnet))) {
80550
+ return constants6.TYPES[subnet];
80551
+ }
80552
+ }
80553
+ } catch (err) {
80554
+ _didIteratorError = true;
80555
+ _iteratorError = err;
80556
+ } finally{
80557
+ try {
80558
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
80559
+ _iterator.return();
80560
+ }
80561
+ } finally{
80562
+ if (_didIteratorError) {
80563
+ throw _iteratorError;
80564
+ }
80845
80565
  }
80846
80566
  }
80847
80567
  return 'Global unicast';
@@ -80850,6 +80570,8 @@ function requireIpv6 () {
80850
80570
  {
80851
80571
  /**
80852
80572
  * Return the bits in the given range as a BigInt
80573
+ * @memberof Address6
80574
+ * @instance
80853
80575
  * @returns {bigint}
80854
80576
  */ key: "getBits",
80855
80577
  value: function getBits(start, end) {
@@ -80859,6 +80581,8 @@ function requireIpv6 () {
80859
80581
  {
80860
80582
  /**
80861
80583
  * Return the bits in the given range as a base-2 string
80584
+ * @memberof Address6
80585
+ * @instance
80862
80586
  * @returns {String}
80863
80587
  */ key: "getBitsBase2",
80864
80588
  value: function getBitsBase2(start, end) {
@@ -80868,6 +80592,8 @@ function requireIpv6 () {
80868
80592
  {
80869
80593
  /**
80870
80594
  * Return the bits in the given range as a base-16 string
80595
+ * @memberof Address6
80596
+ * @instance
80871
80597
  * @returns {String}
80872
80598
  */ key: "getBitsBase16",
80873
80599
  value: function getBitsBase16(start, end) {
@@ -80881,6 +80607,8 @@ function requireIpv6 () {
80881
80607
  {
80882
80608
  /**
80883
80609
  * Return the bits that are set past the subnet mask length
80610
+ * @memberof Address6
80611
+ * @instance
80884
80612
  * @returns {String}
80885
80613
  */ key: "getBitsPastSubnet",
80886
80614
  value: function getBitsPastSubnet() {
@@ -80890,8 +80618,10 @@ function requireIpv6 () {
80890
80618
  {
80891
80619
  /**
80892
80620
  * Return the reversed ip6.arpa form of the address
80621
+ * @memberof Address6
80893
80622
  * @param {Object} options
80894
80623
  * @param {boolean} options.omitSuffix - omit the "ip6.arpa" suffix
80624
+ * @instance
80895
80625
  * @returns {String}
80896
80626
  */ key: "reverseForm",
80897
80627
  value: function reverseForm(options) {
@@ -80914,10 +80644,10 @@ function requireIpv6 () {
80914
80644
  },
80915
80645
  {
80916
80646
  /**
80917
- * Returns the address in correct form, per
80918
- * [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952): leading zeros
80919
- * stripped, the longest run of zero groups collapsed to `::`, and hex digits
80920
- * lowercased (e.g. `2001:db8::1`). This is the recommended form for display.
80647
+ * Return the correct form of the address
80648
+ * @memberof Address6
80649
+ * @instance
80650
+ * @returns {String}
80921
80651
  */ key: "correctForm",
80922
80652
  value: function correctForm() {
80923
80653
  var i;
@@ -80971,6 +80701,8 @@ function requireIpv6 () {
80971
80701
  {
80972
80702
  /**
80973
80703
  * Return a zero-padded base-2 string representation of the address
80704
+ * @memberof Address6
80705
+ * @instance
80974
80706
  * @returns {String}
80975
80707
  * @example
80976
80708
  * var address = new Address6('2001:4860:4001:803::1011');
@@ -80979,24 +80711,13 @@ function requireIpv6 () {
80979
80711
  * // 0000000000000000000000000000000000000000000000000001000000010001'
80980
80712
  */ key: "binaryZeroPad",
80981
80713
  value: function binaryZeroPad() {
80982
- if (this._binaryZeroPad === undefined) {
80983
- this._binaryZeroPad = this.bigInt().toString(2).padStart(constants6.BITS, '0');
80984
- }
80985
- return this._binaryZeroPad;
80714
+ return this.bigInt().toString(2).padStart(constants6.BITS, '0');
80986
80715
  }
80987
80716
  },
80988
80717
  {
80989
- /**
80990
- * Parses a v4-in-v6 string (e.g. `::ffff:192.168.0.1`) by extracting the
80991
- * trailing IPv4 address into `this.address4` / `this.parsedAddress4` and
80992
- * returning the address with the v4 portion converted to two v6 groups.
80993
- * Used internally by `parse()`.
80994
- */ // TODO: Improve the semantics of this helper function
80718
+ // TODO: Improve the semantics of this helper function
80995
80719
  key: "parse4in6",
80996
80720
  value: function parse4in6(address) {
80997
- if (address.indexOf('.') === -1) {
80998
- return address;
80999
- }
81000
80721
  var groups = address.split(':');
81001
80722
  var lastGroup = groups.slice(-1)[0];
81002
80723
  var address4 = lastGroup.match(constants4.RE_ADDRESS);
@@ -81005,12 +80726,7 @@ function requireIpv6 () {
81005
80726
  this.address4 = new ipv4_1.Address4(this.parsedAddress4);
81006
80727
  for(var i = 0; i < this.address4.groups; i++){
81007
80728
  if (/^0[0-9]+/.test(this.address4.parsedAddress[i])) {
81008
- // The prefix groups haven't been through the bad-character check
81009
- // yet, so escape them before including in the error HTML.
81010
- var highlighted = this.address4.parsedAddress.map(spanLeadingZeroes4).join('.');
81011
- var prefix = groups.slice(0, -1).map(helpers.escapeHtml).join(':');
81012
- var separator = groups.length > 1 ? ':' : '';
81013
- throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes.", "".concat(prefix).concat(separator).concat(highlighted));
80729
+ throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes.", address.replace(constants4.RE_ADDRESS, this.address4.parsedAddress.map(spanLeadingZeroes4).join('.')));
81014
80730
  }
81015
80731
  }
81016
80732
  this.v4 = true;
@@ -81021,13 +80737,7 @@ function requireIpv6 () {
81021
80737
  }
81022
80738
  },
81023
80739
  {
81024
- /**
81025
- * Parses an IPv6 address string into its 8 hexadecimal groups (expanding
81026
- * any `::` elision and any trailing v4-in-v6 portion) and stores the result
81027
- * on `this.parsedAddress`. Called automatically by the constructor; you
81028
- * typically don't need to call it directly. Throws `AddressError` if the
81029
- * input is malformed.
81030
- */ // TODO: Make private?
80740
+ // TODO: Make private?
81031
80741
  key: "parse",
81032
80742
  value: function parse(address) {
81033
80743
  address = this.parse4in6(address);
@@ -81079,10 +80789,10 @@ function requireIpv6 () {
81079
80789
  },
81080
80790
  {
81081
80791
  /**
81082
- * Returns the canonical (fully expanded) form of the address: all 8 groups,
81083
- * each padded to 4 hex digits, with no `::` collapsing
81084
- * (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and
81085
- * byte-exact comparison.
80792
+ * Return the canonical form of the address
80793
+ * @memberof Address6
80794
+ * @instance
80795
+ * @returns {String}
81086
80796
  */ key: "canonicalForm",
81087
80797
  value: function canonicalForm() {
81088
80798
  return this.parsedAddress.map(paddedHex).join(':');
@@ -81091,6 +80801,8 @@ function requireIpv6 () {
81091
80801
  {
81092
80802
  /**
81093
80803
  * Return the decimal form of the address
80804
+ * @memberof Address6
80805
+ * @instance
81094
80806
  * @returns {String}
81095
80807
  */ key: "decimal",
81096
80808
  value: function decimal() {
@@ -81102,6 +80814,8 @@ function requireIpv6 () {
81102
80814
  {
81103
80815
  /**
81104
80816
  * Return the address as a BigInt
80817
+ * @memberof Address6
80818
+ * @instance
81105
80819
  * @returns {bigint}
81106
80820
  */ key: "bigInt",
81107
80821
  value: function bigInt() {
@@ -81111,6 +80825,8 @@ function requireIpv6 () {
81111
80825
  {
81112
80826
  /**
81113
80827
  * Return the last two groups of this address as an IPv4 address string
80828
+ * @memberof Address6
80829
+ * @instance
81114
80830
  * @returns {Address4}
81115
80831
  * @example
81116
80832
  * var address = new Address6('2001:4860:4001::1825:bf11');
@@ -81118,12 +80834,14 @@ function requireIpv6 () {
81118
80834
  */ key: "to4",
81119
80835
  value: function to4() {
81120
80836
  var binary = this.binaryZeroPad().split('');
81121
- return ipv4_1.Address4.fromHex(BigInt("0b".concat(binary.slice(96, 128).join(''))).toString(16).padStart(8, '0'));
80837
+ return ipv4_1.Address4.fromHex(BigInt("0b".concat(binary.slice(96, 128).join(''))).toString(16));
81122
80838
  }
81123
80839
  },
81124
80840
  {
81125
80841
  /**
81126
80842
  * Return the v4-in-v6 form of the address
80843
+ * @memberof Address6
80844
+ * @instance
81127
80845
  * @returns {String}
81128
80846
  */ key: "to4in6",
81129
80847
  value: function to4in6() {
@@ -81139,10 +80857,10 @@ function requireIpv6 () {
81139
80857
  },
81140
80858
  {
81141
80859
  /**
81142
- * Decodes the Teredo tunneling fields embedded in this address. Returns the
81143
- * Teredo prefix, server IPv4, client IPv4, raw flag bits, cone-NAT flag,
81144
- * UDP port, and Microsoft-format flag breakdown (reserved, universal/local,
81145
- * group/individual, nonce). Only meaningful for addresses in `2001::/32`.
80860
+ * Return an object containing the Teredo properties of the address
80861
+ * @memberof Address6
80862
+ * @instance
80863
+ * @returns {Object}
81146
80864
  */ key: "inspectTeredo",
81147
80865
  value: function inspectTeredo() {
81148
80866
  /*
@@ -81172,7 +80890,7 @@ function requireIpv6 () {
81172
80890
  var server4 = ipv4_1.Address4.fromHex(this.getBitsBase16(32, 64));
81173
80891
  var bitsForClient4 = this.getBits(96, 128);
81174
80892
  // eslint-disable-next-line no-bitwise
81175
- var client4 = ipv4_1.Address4.fromHex((bitsForClient4 ^ BigInt('0xffffffff')).toString(16).padStart(8, '0'));
80893
+ var client4 = ipv4_1.Address4.fromHex((bitsForClient4 ^ BigInt('0xffffffff')).toString(16));
81176
80894
  var flagsBase2 = this.getBitsBase2(64, 80);
81177
80895
  var coneNat = (0, common_1.testBit)(flagsBase2, 15);
81178
80896
  var reserved = (0, common_1.testBit)(flagsBase2, 14);
@@ -81197,9 +80915,10 @@ function requireIpv6 () {
81197
80915
  },
81198
80916
  {
81199
80917
  /**
81200
- * Decodes the 6to4 tunneling fields embedded in this address. Returns the
81201
- * 6to4 prefix and the embedded IPv4 gateway address. Only meaningful for
81202
- * addresses in `2002::/16`.
80918
+ * Return an object containing the 6to4 properties of the address
80919
+ * @memberof Address6
80920
+ * @instance
80921
+ * @returns {Object}
81203
80922
  */ key: "inspect6to4",
81204
80923
  value: function inspect6to4() {
81205
80924
  /*
@@ -81216,6 +80935,8 @@ function requireIpv6 () {
81216
80935
  {
81217
80936
  /**
81218
80937
  * Return a v6 6to4 address from a v6 v4inv6 address
80938
+ * @memberof Address6
80939
+ * @instance
81219
80940
  * @returns {Address6}
81220
80941
  */ key: "to6to4",
81221
80942
  value: function to6to4() {
@@ -81234,43 +80955,9 @@ function requireIpv6 () {
81234
80955
  },
81235
80956
  {
81236
80957
  /**
81237
- * Extract the embedded IPv4 address from a NAT64 IPv6 address using the
81238
- * encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).
81239
- * The default prefix is the well-known prefix `64:ff9b::/96`. Returns
81240
- * `null` if this address is not contained within the given prefix.
81241
- * @example
81242
- * new Address6('64:ff9b::c000:221').toAddress4Nat64()!.correctForm(); // '192.0.2.33'
81243
- */ key: "toAddress4Nat64",
81244
- value: function toAddress4Nat64() {
81245
- var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : '64:ff9b::/96';
81246
- var prefix6 = new Address6(prefix);
81247
- var pl = prefix6.subnetMask;
81248
- if (pl !== 32 && pl !== 40 && pl !== 48 && pl !== 56 && pl !== 64 && pl !== 96) {
81249
- throw new address_error_1.AddressError('NAT64 prefix length must be 32, 40, 48, 56, 64, or 96');
81250
- }
81251
- if (!this.isInSubnet(prefix6)) {
81252
- return null;
81253
- }
81254
- var bits = this.binaryZeroPad();
81255
- var v4Bits;
81256
- if (pl === 96) {
81257
- v4Bits = bits.slice(96, 128);
81258
- } else {
81259
- var beforeU = 64 - pl;
81260
- v4Bits = bits.slice(pl, pl + beforeU) + bits.slice(72, 72 + (32 - beforeU));
81261
- }
81262
- var octets = [];
81263
- for(var i = 0; i < 4; i++){
81264
- octets.push(parseInt(v4Bits.slice(i * 8, (i + 1) * 8), 2).toString());
81265
- }
81266
- return new ipv4_1.Address4(octets.join('.'));
81267
- }
81268
- },
81269
- {
81270
- /**
81271
- * Return a byte array.
81272
- *
81273
- * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toByteArray())`.
80958
+ * Return a byte array
80959
+ * @memberof Address6
80960
+ * @instance
81274
80961
  * @returns {Array}
81275
80962
  */ key: "toByteArray",
81276
80963
  value: function toByteArray() {
@@ -81286,9 +80973,9 @@ function requireIpv6 () {
81286
80973
  },
81287
80974
  {
81288
80975
  /**
81289
- * Return an unsigned byte array.
81290
- *
81291
- * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toUnsignedByteArray())`.
80976
+ * Return an unsigned byte array
80977
+ * @memberof Address6
80978
+ * @instance
81292
80979
  * @returns {Array}
81293
80980
  */ key: "toUnsignedByteArray",
81294
80981
  value: function toUnsignedByteArray() {
@@ -81298,6 +80985,8 @@ function requireIpv6 () {
81298
80985
  {
81299
80986
  /**
81300
80987
  * Returns true if the address is in the canonical form, false otherwise
80988
+ * @memberof Address6
80989
+ * @instance
81301
80990
  * @returns {boolean}
81302
80991
  */ key: "isCanonical",
81303
80992
  value: function isCanonical() {
@@ -81307,6 +80996,8 @@ function requireIpv6 () {
81307
80996
  {
81308
80997
  /**
81309
80998
  * Returns true if the address is a link local address, false otherwise
80999
+ * @memberof Address6
81000
+ * @instance
81310
81001
  * @returns {boolean}
81311
81002
  */ key: "isLinkLocal",
81312
81003
  value: function isLinkLocal() {
@@ -81320,19 +81011,19 @@ function requireIpv6 () {
81320
81011
  {
81321
81012
  /**
81322
81013
  * Returns true if the address is a multicast address, false otherwise
81014
+ * @memberof Address6
81015
+ * @instance
81323
81016
  * @returns {boolean}
81324
81017
  */ key: "isMulticast",
81325
81018
  value: function isMulticast() {
81326
- var type = this.getType();
81327
- return type === 'Multicast' || type.startsWith('Multicast ');
81019
+ return this.getType() === 'Multicast';
81328
81020
  }
81329
81021
  },
81330
81022
  {
81331
81023
  /**
81332
- * Returns true if the address was written in v4-in-v6 dotted-quad notation
81333
- * (e.g. `::ffff:127.0.0.1`), false otherwise. This is a notation-level flag
81334
- * and does not reflect whether the address bits lie in the IPv4-mapped
81335
- * (`::ffff:0:0/96`) subnet — for that, see {@link isMapped4}.
81024
+ * Returns true if the address is a v4-in-v6 address, false otherwise
81025
+ * @memberof Address6
81026
+ * @instance
81336
81027
  * @returns {boolean}
81337
81028
  */ key: "is4",
81338
81029
  value: function is4() {
@@ -81341,78 +81032,42 @@ function requireIpv6 () {
81341
81032
  },
81342
81033
  {
81343
81034
  /**
81344
- * Returns true if the address is an IPv4-mapped IPv6 address in
81345
- * `::ffff:0:0/96` ([RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2)),
81346
- * false otherwise. Unlike {@link is4}, this checks the underlying address
81347
- * bits rather than the textual notation, so `::ffff:127.0.0.1` and
81348
- * `::ffff:7f00:1` both return true.
81349
- * @returns {boolean}
81350
- */ key: "isMapped4",
81351
- value: function isMapped4() {
81352
- return this.isInSubnet(IPV4_MAPPED_SUBNET);
81353
- }
81354
- },
81355
- {
81356
- /**
81357
81035
  * Returns true if the address is a Teredo address, false otherwise
81036
+ * @memberof Address6
81037
+ * @instance
81358
81038
  * @returns {boolean}
81359
81039
  */ key: "isTeredo",
81360
81040
  value: function isTeredo() {
81361
- return this.isInSubnet(TEREDO_SUBNET);
81041
+ return this.isInSubnet(new Address6('2001::/32'));
81362
81042
  }
81363
81043
  },
81364
81044
  {
81365
81045
  /**
81366
81046
  * Returns true if the address is a 6to4 address, false otherwise
81047
+ * @memberof Address6
81048
+ * @instance
81367
81049
  * @returns {boolean}
81368
81050
  */ key: "is6to4",
81369
81051
  value: function is6to4() {
81370
- return this.isInSubnet(SIX_TO_FOUR_SUBNET);
81052
+ return this.isInSubnet(new Address6('2002::/16'));
81371
81053
  }
81372
81054
  },
81373
81055
  {
81374
81056
  /**
81375
81057
  * Returns true if the address is a loopback address, false otherwise
81058
+ * @memberof Address6
81059
+ * @instance
81376
81060
  * @returns {boolean}
81377
81061
  */ key: "isLoopback",
81378
81062
  value: function isLoopback() {
81379
81063
  return this.getType() === 'Loopback';
81380
81064
  }
81381
81065
  },
81382
- {
81383
- /**
81384
- * Returns true if the address is a Unique Local Address in `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)). ULAs are the IPv6 equivalent of IPv4 [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private addresses.
81385
- * @returns {boolean}
81386
- */ key: "isULA",
81387
- value: function isULA() {
81388
- return this.isInSubnet(ULA_SUBNET);
81389
- }
81390
- },
81391
- {
81392
- /**
81393
- * Returns true if the address is the unspecified address `::`.
81394
- * @returns {boolean}
81395
- */ key: "isUnspecified",
81396
- value: function isUnspecified() {
81397
- return this.getType() === 'Unspecified';
81398
- }
81399
- },
81400
- {
81401
- /**
81402
- * Returns true if the address is in the documentation prefix `2001:db8::/32` ([RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849)).
81403
- * @returns {boolean}
81404
- */ key: "isDocumentation",
81405
- value: function isDocumentation() {
81406
- return this.isInSubnet(DOCUMENTATION_SUBNET);
81407
- }
81408
- },
81409
81066
  {
81410
81067
  // #endregion
81411
81068
  // #region HTML
81412
81069
  /**
81413
- * Returns the address as an HTTP URL with the host bracketed, e.g.
81414
- * `http://[2001:db8::1]/`. If `optionalPort` is provided it is appended,
81415
- * e.g. `http://[2001:db8::1]:8080/`.
81070
+ * @returns {String} the address in link form with a default port of 80
81416
81071
  */ key: "href",
81417
81072
  value: function href(optionalPort) {
81418
81073
  if (optionalPort === undefined) {
@@ -81425,12 +81080,7 @@ function requireIpv6 () {
81425
81080
  },
81426
81081
  {
81427
81082
  /**
81428
- * Returns an HTML `<a>` element whose `href` encodes the address in a URL
81429
- * hash fragment (default prefix `/#address=`). Useful for linking between
81430
- * pages of an address-inspector UI.
81431
- * @param options.className - CSS class for the rendered `<a>` element
81432
- * @param options.prefix - hash prefix prepended to the address (default `/#address=`)
81433
- * @param options.v4 - when true, render the address in v4-in-v6 form
81083
+ * @returns {String} a link suitable for conveying the address via a URL hash
81434
81084
  */ key: "link",
81435
81085
  value: function link(options) {
81436
81086
  if (!options) {
@@ -81450,13 +81100,10 @@ function requireIpv6 () {
81450
81100
  formFunction = this.to4in6;
81451
81101
  }
81452
81102
  var form = formFunction.call(this);
81453
- var safeHref = helpers.escapeHtml("".concat(options.prefix).concat(form));
81454
- var safeForm = helpers.escapeHtml(form);
81455
81103
  if (options.className) {
81456
- var safeClass = helpers.escapeHtml(options.className);
81457
- return '<a href="'.concat(safeHref, '" class="').concat(safeClass, '">').concat(safeForm, "</a>");
81104
+ return '<a href="'.concat(options.prefix).concat(form, '" class="').concat(options.className, '">').concat(form, "</a>");
81458
81105
  }
81459
- return '<a href="'.concat(safeHref, '">').concat(safeForm, "</a>");
81106
+ return '<a href="'.concat(options.prefix).concat(form, '">').concat(form, "</a>");
81460
81107
  }
81461
81108
  },
81462
81109
  {
@@ -81467,13 +81114,13 @@ function requireIpv6 () {
81467
81114
  value: function group() {
81468
81115
  if (this.elidedGroups === 0) {
81469
81116
  // The simple case
81470
- return helpers.simpleGroup(this.addressMinusSuffix).join(':');
81117
+ return helpers.simpleGroup(this.address).join(':');
81471
81118
  }
81472
81119
  assert(typeof this.elidedGroups === 'number');
81473
81120
  assert(typeof this.elisionBegin === 'number');
81474
81121
  // The elided case
81475
81122
  var output = [];
81476
- var _this_addressMinusSuffix_split = _sliced_to_array(this.addressMinusSuffix.split('::'), 2), left = _this_addressMinusSuffix_split[0], right = _this_addressMinusSuffix_split[1];
81123
+ var _this_address_split = _sliced_to_array(this.address.split('::'), 2), left = _this_address_split[0], right = _this_address_split[1];
81477
81124
  if (left.length) {
81478
81125
  var _output;
81479
81126
  (_output = output).push.apply(_output, _to_consumable_array(helpers.simpleGroup(left)));
@@ -81507,6 +81154,8 @@ function requireIpv6 () {
81507
81154
  /**
81508
81155
  * Generate a regular expression string that can be used to find or validate
81509
81156
  * all variations of this address
81157
+ * @memberof Address6
81158
+ * @instance
81510
81159
  * @param {boolean} substringSearch
81511
81160
  * @returns {string}
81512
81161
  */ key: "regularExpressionString",
@@ -81554,6 +81203,8 @@ function requireIpv6 () {
81554
81203
  /**
81555
81204
  * Generate a regular expression that can be used to find or validate all
81556
81205
  * variations of this address.
81206
+ * @memberof Address6
81207
+ * @instance
81557
81208
  * @param {boolean} substringSearch
81558
81209
  * @returns {RegExp}
81559
81210
  */ key: "regularExpression",
@@ -81565,13 +81216,7 @@ function requireIpv6 () {
81565
81216
  ], [
81566
81217
  {
81567
81218
  key: "isValid",
81568
- value: /**
81569
- * Returns true if the given string is a valid IPv6 address (with optional
81570
- * CIDR subnet and zone identifier), false otherwise. Host bits in the
81571
- * subnet portion are allowed (e.g. `2001:db8::1/32` is valid); for strict
81572
- * network-address validation compare `correctForm()` to
81573
- * `startAddress().correctForm()`, or use `networkForm()`.
81574
- */ function isValid(address) {
81219
+ value: function isValid(address) {
81575
81220
  try {
81576
81221
  // eslint-disable-next-line no-new
81577
81222
  new Address6(address);
@@ -81584,8 +81229,9 @@ function requireIpv6 () {
81584
81229
  {
81585
81230
  key: "fromBigInt",
81586
81231
  value: /**
81587
- * Convert a BigInt to a v6 address object. The value must be in the
81588
- * range `[0, 2**128 - 1]`; otherwise `AddressError` is thrown.
81232
+ * Convert a BigInt to a v6 address object
81233
+ * @memberof Address6
81234
+ * @static
81589
81235
  * @param {bigint} bigInt - a BigInt to convert
81590
81236
  * @returns {Address6}
81591
81237
  * @example
@@ -81593,12 +81239,10 @@ function requireIpv6 () {
81593
81239
  * var address = Address6.fromBigInt(bigInt);
81594
81240
  * address.correctForm(); // '::e8:d4a5:1000'
81595
81241
  */ function fromBigInt(bigInt) {
81596
- if (bigInt < 0n || bigInt > (1n << BigInt(constants6.BITS)) - 1n) {
81597
- throw new address_error_1.AddressError('IPv6 BigInt must be in the range 0 to 2**128 - 1');
81598
- }
81599
81242
  var hex = bigInt.toString(16).padStart(32, '0');
81600
81243
  var groups = [];
81601
- for(var i = 0; i < constants6.GROUPS; i++){
81244
+ var i;
81245
+ for(i = 0; i < constants6.GROUPS; i++){
81602
81246
  groups.push(hex.slice(i * 4, (i + 1) * 4));
81603
81247
  }
81604
81248
  return new Address6(groups.join(':'));
@@ -81607,10 +81251,10 @@ function requireIpv6 () {
81607
81251
  {
81608
81252
  key: "fromURL",
81609
81253
  value: /**
81610
- * Parse a URL (with optional bracketed host and port) into an address and
81611
- * port. Returns either `{ address, port }` on success or
81612
- * `{ error, address: null, port: null }` if the URL could not be parsed.
81613
- * Ports are returned as numbers (or `null` if absent or out of range).
81254
+ * Convert a URL (with optional port number) to an address object
81255
+ * @memberof Address6
81256
+ * @static
81257
+ * @param {string} url - a URL with optional port number
81614
81258
  * @example
81615
81259
  * var addressAndPort = Address6.fromURL('http://[ffff::]:8080/foo/');
81616
81260
  * addressAndPort.address.correctForm(); // 'ffff::'
@@ -81666,100 +81310,12 @@ function requireIpv6 () {
81666
81310
  };
81667
81311
  }
81668
81312
  },
81669
- {
81670
- key: "fromAddressAndMask",
81671
- value: /**
81672
- * Construct an `Address6` from an address and a hex subnet mask given as
81673
- * separate strings (e.g. as returned by Node's `os.networkInterfaces()`).
81674
- * Throws `AddressError` if the mask is non-contiguous (e.g.
81675
- * `ffff::ffff`).
81676
- * @example
81677
- * var address = Address6.fromAddressAndMask('fe80::1', 'ffff:ffff:ffff:ffff::');
81678
- * address.subnetMask; // 64
81679
- */ function fromAddressAndMask(address, mask) {
81680
- var bits = common.prefixLengthFromMask(new Address6(mask).bigInt(), constants6.BITS);
81681
- return new Address6("".concat(address, "/").concat(bits));
81682
- }
81683
- },
81684
- {
81685
- key: "fromAddressAndWildcardMask",
81686
- value: /**
81687
- * Construct an `Address6` from an address and a Cisco-style wildcard mask
81688
- * given as separate strings (e.g. `::ffff:ffff:ffff:ffff` for a `/64`).
81689
- * The wildcard mask is the bitwise inverse of the subnet mask. Throws
81690
- * `AddressError` if the mask is non-contiguous.
81691
- * @example
81692
- * var address = Address6.fromAddressAndWildcardMask('fe80::1', '::ffff:ffff:ffff:ffff');
81693
- * address.subnetMask; // 64
81694
- */ function fromAddressAndWildcardMask(address, wildcardMask) {
81695
- var wildcard = new Address6(wildcardMask).bigInt();
81696
- var allOnes = (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1);
81697
- // eslint-disable-next-line no-bitwise
81698
- var mask = wildcard ^ allOnes;
81699
- var bits = common.prefixLengthFromMask(mask, constants6.BITS);
81700
- return new Address6("".concat(address, "/").concat(bits));
81701
- }
81702
- },
81703
- {
81704
- key: "fromWildcard",
81705
- value: /**
81706
- * Construct an `Address6` from a wildcard pattern with trailing `*`
81707
- * groups. The number of trailing wildcards determines the prefix
81708
- * length: each `*` represents 16 bits. `::` is expanded to zero groups
81709
- * (not wildcards) before evaluating trailing wildcards.
81710
- *
81711
- * Only trailing whole-group wildcards are supported. Partial-group
81712
- * wildcards (e.g. `2001:db8::0*`) and interior wildcards (e.g.
81713
- * `*::1`) throw `AddressError`.
81714
- * @example
81715
- * Address6.fromWildcard('2001:db8:*:*:*:*:*:*').subnet; // '/32'
81716
- * Address6.fromWildcard('2001:db8::*').subnet; // '/112'
81717
- * Address6.fromWildcard('*:*:*:*:*:*:*:*').subnet; // '/0'
81718
- */ function fromWildcard(input) {
81719
- if (input.includes('%') || input.includes('/')) {
81720
- throw new address_error_1.AddressError('Wildcard pattern must not include a zone or CIDR suffix');
81721
- }
81722
- var halves = input.split('::');
81723
- if (halves.length > 2) {
81724
- throw new address_error_1.AddressError("Wildcard pattern cannot contain more than one '::'");
81725
- }
81726
- var groups;
81727
- if (halves.length === 2) {
81728
- var left = halves[0] === '' ? [] : halves[0].split(':');
81729
- var right = halves[1] === '' ? [] : halves[1].split(':');
81730
- var remaining = constants6.GROUPS - left.length - right.length;
81731
- if (remaining < 1) {
81732
- throw new address_error_1.AddressError("Wildcard pattern with '::' has too many groups");
81733
- }
81734
- groups = _to_consumable_array(left).concat(_to_consumable_array(new Array(remaining).fill('0')), _to_consumable_array(right));
81735
- } else {
81736
- groups = input.split(':');
81737
- }
81738
- if (groups.length !== constants6.GROUPS) {
81739
- throw new address_error_1.AddressError('Wildcard pattern must have 8 groups');
81740
- }
81741
- var firstWildcard = -1;
81742
- for(var i = 0; i < groups.length; i++){
81743
- if (groups[i] === '*') {
81744
- if (firstWildcard === -1) {
81745
- firstWildcard = i;
81746
- }
81747
- } else if (firstWildcard !== -1) {
81748
- throw new address_error_1.AddressError('Wildcard `*` must only appear in trailing groups (e.g. `2001:db8:*:*:*:*:*:*`)');
81749
- }
81750
- }
81751
- var trailing = firstWildcard === -1 ? 0 : groups.length - firstWildcard;
81752
- var replaced = groups.map(function(g) {
81753
- return g === '*' ? '0' : g;
81754
- });
81755
- var subnetBits = constants6.BITS - trailing * 16;
81756
- return new Address6("".concat(replaced.join(':'), "/").concat(subnetBits));
81757
- }
81758
- },
81759
81313
  {
81760
81314
  key: "fromAddress4",
81761
81315
  value: /**
81762
81316
  * Create an IPv6-mapped address given an IPv4 address
81317
+ * @memberof Address6
81318
+ * @static
81763
81319
  * @param {string} address - An IPv4 address string
81764
81320
  * @returns {Address6}
81765
81321
  * @example
@@ -81776,6 +81332,8 @@ function requireIpv6 () {
81776
81332
  key: "fromArpa",
81777
81333
  value: /**
81778
81334
  * Return an address from ip6.arpa form
81335
+ * @memberof Address6
81336
+ * @static
81779
81337
  * @param {string} arpaFormAddress - an 'ip6.arpa' form address
81780
81338
  * @returns {Adress6}
81781
81339
  * @example
@@ -81798,48 +81356,12 @@ function requireIpv6 () {
81798
81356
  return new Address6(address);
81799
81357
  }
81800
81358
  },
81801
- {
81802
- key: "fromAddress4Nat64",
81803
- value: /**
81804
- * Embed an IPv4 address into a NAT64 IPv6 address using the encoding
81805
- * defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).
81806
- * The default prefix is the well-known prefix `64:ff9b::/96`. The prefix
81807
- * length must be one of 32, 40, 48, 56, 64, or 96; for prefixes shorter
81808
- * than /64 the IPv4 octets are split around the reserved bits 64–71.
81809
- * @example
81810
- * Address6.fromAddress4Nat64('192.0.2.33').correctForm(); // '64:ff9b::c000:221'
81811
- * Address6.fromAddress4Nat64('192.0.2.33', '2001:db8::/32').correctForm(); // '2001:db8:c000:221::'
81812
- */ function fromAddress4Nat64(address) {
81813
- var prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '64:ff9b::/96';
81814
- var v4 = new ipv4_1.Address4(address);
81815
- var prefix6 = new Address6(prefix);
81816
- var pl = prefix6.subnetMask;
81817
- if (pl !== 32 && pl !== 40 && pl !== 48 && pl !== 56 && pl !== 64 && pl !== 96) {
81818
- throw new address_error_1.AddressError('NAT64 prefix length must be 32, 40, 48, 56, 64, or 96');
81819
- }
81820
- var prefixBits = prefix6.binaryZeroPad();
81821
- var v4Bits = v4.binaryZeroPad();
81822
- var bits;
81823
- if (pl === 96) {
81824
- bits = prefixBits.slice(0, 96) + v4Bits;
81825
- } else {
81826
- var beforeU = 64 - pl;
81827
- bits = prefixBits.slice(0, pl) + v4Bits.slice(0, beforeU) + '00000000' + v4Bits.slice(beforeU) + '0'.repeat(128 - 72 - (32 - beforeU));
81828
- }
81829
- var hex = BigInt("0b".concat(bits)).toString(16).padStart(32, '0');
81830
- var groups = [];
81831
- for(var i = 0; i < 8; i++){
81832
- groups.push(hex.slice(i * 4, (i + 1) * 4));
81833
- }
81834
- return new Address6(groups.join(':'));
81835
- }
81836
- },
81837
81359
  {
81838
81360
  key: "fromByteArray",
81839
81361
  value: /**
81840
- * Convert a byte array to an Address6 object.
81841
- *
81842
- * To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`.
81362
+ * Convert a byte array to an Address6 object
81363
+ * @memberof Address6
81364
+ * @static
81843
81365
  * @returns {Address6}
81844
81366
  */ function fromByteArray(bytes) {
81845
81367
  return this.fromUnsignedByteArray(bytes.map(unsignByte));
@@ -81848,9 +81370,9 @@ function requireIpv6 () {
81848
81370
  {
81849
81371
  key: "fromUnsignedByteArray",
81850
81372
  value: /**
81851
- * Convert an unsigned byte array to an Address6 object.
81852
- *
81853
- * To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`.
81373
+ * Convert an unsigned byte array to an Address6 object
81374
+ * @memberof Address6
81375
+ * @static
81854
81376
  * @returns {Address6}
81855
81377
  */ function fromUnsignedByteArray(bytes) {
81856
81378
  var BYTE_MAX = BigInt('256');
@@ -81866,18 +81388,7 @@ function requireIpv6 () {
81866
81388
  ]);
81867
81389
  return Address6;
81868
81390
  }();
81869
- ipv6.Address6 = Address6;
81870
- var TYPE_SUBNETS = Object.keys(constants6.TYPES).map(function(subnet) {
81871
- return [
81872
- new Address6(subnet),
81873
- constants6.TYPES[subnet]
81874
- ];
81875
- });
81876
- var TEREDO_SUBNET = new Address6('2001::/32');
81877
- var SIX_TO_FOUR_SUBNET = new Address6('2002::/16');
81878
- var ULA_SUBNET = new Address6('fc00::/7');
81879
- var DOCUMENTATION_SUBNET = new Address6('2001:db8::/32');
81880
- var IPV4_MAPPED_SUBNET = new Address6('::ffff:0:0/96');
81391
+ ipv6.Address6 = Address6;
81881
81392
  return ipv6;
81882
81393
  }
81883
81394
 
@@ -84727,7 +84238,7 @@ var providers$1 = {};
84727
84238
 
84728
84239
  var client_metadata = {};
84729
84240
 
84730
- var version = "7.3.0";
84241
+ var version = "7.2.0";
84731
84242
  var require$$4 = {
84732
84243
  version: version};
84733
84244
 
@@ -160795,7 +160306,7 @@ function continueScramConversation(cryptoMethod, response, authContext) {
160795
160306
  }
160796
160307
  function _continueScramConversation() {
160797
160308
  _continueScramConversation = _async_to_generator$6(function(cryptoMethod, response, authContext) {
160798
- var connection, credentials, nonce, db, username, password, processedPassword, payload, dict, iterations, salt, rnonce, withoutProof, saltedPassword, clientKey, serverKey, storedKey, firstMessageBytes, firstMessage, payloadString, authMessage, clientSignature, clientProof, clientFinal, serverSignature, saslContinueCmd, r, parsedResponse, retrySaslContinueCmd;
160309
+ var connection, credentials, nonce, db, username, password, processedPassword, payload, dict, iterations, salt, rnonce, withoutProof, saltedPassword, clientKey, serverKey, storedKey, authMessage, clientSignature, clientProof, clientFinal, serverSignature, saslContinueCmd, r, parsedResponse, retrySaslContinueCmd;
160799
160310
  return _ts_generator$6(this, function(_state) {
160800
160311
  switch(_state.label){
160801
160312
  case 0:
@@ -160851,12 +160362,9 @@ function _continueScramConversation() {
160851
160362
  ];
160852
160363
  case 4:
160853
160364
  storedKey = _state.sent();
160854
- firstMessageBytes = clientFirstMessageBare(username, nonce);
160855
- firstMessage = bson_1$2.ByteUtils.toUTF8(firstMessageBytes, 0, firstMessageBytes.length, false);
160856
- payloadString = bson_1$2.ByteUtils.toUTF8(payload.buffer, 0, payload.position, false);
160857
160365
  authMessage = [
160858
- firstMessage,
160859
- payloadString,
160366
+ clientFirstMessageBare(username, nonce),
160367
+ payload.toString('utf8'),
160860
160368
  withoutProof
160861
160369
  ].join(',');
160862
160370
  return [
@@ -160917,7 +160425,7 @@ function _continueScramConversation() {
160917
160425
  return _continueScramConversation.apply(this, arguments);
160918
160426
  }
160919
160427
  function parsePayload(payload) {
160920
- var payloadStr = bson_1$2.ByteUtils.toUTF8(payload.buffer, 0, payload.position, false);
160428
+ var payloadStr = payload.toString('utf8');
160921
160429
  var dict = {};
160922
160430
  var parts = payloadStr.split(',');
160923
160431
  for(var i = 0; i < parts.length; i++){