data-structure-typed 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/CONTRIBUTING.md +4 -0
  3. package/README.md +19 -7
  4. package/dist/cjs/index.cjs +1175 -585
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/{index.cjs → cjs-legacy/index.cjs} +1145 -613
  7. package/dist/cjs-legacy/index.cjs.map +1 -0
  8. package/dist/esm/index.mjs +1175 -585
  9. package/dist/esm/index.mjs.map +1 -1
  10. package/dist/{index.js → esm-legacy/index.mjs} +1147 -615
  11. package/dist/esm-legacy/index.mjs.map +1 -0
  12. package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +58 -4
  13. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +66 -4
  14. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +59 -5
  15. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +1 -1
  16. package/dist/types/data-structures/binary-tree/bst.d.ts +58 -4
  17. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +60 -6
  18. package/dist/types/data-structures/binary-tree/tree-counter.d.ts +58 -4
  19. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +66 -4
  20. package/dist/types/data-structures/heap/heap.d.ts +4 -4
  21. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +1 -1
  22. package/dist/types/interfaces/binary-tree.d.ts +1 -1
  23. package/dist/umd/data-structure-typed.js +711 -228
  24. package/dist/umd/data-structure-typed.js.map +1 -1
  25. package/dist/umd/data-structure-typed.min.js +3 -3
  26. package/dist/umd/data-structure-typed.min.js.map +1 -1
  27. package/jest.integration.config.js +7 -3
  28. package/package.json +29 -7
  29. package/src/data-structures/binary-tree/avl-tree-counter.ts +106 -15
  30. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +116 -12
  31. package/src/data-structures/binary-tree/avl-tree.ts +107 -16
  32. package/src/data-structures/binary-tree/binary-tree.ts +4 -4
  33. package/src/data-structures/binary-tree/bst.ts +103 -12
  34. package/src/data-structures/binary-tree/red-black-tree.ts +110 -20
  35. package/src/data-structures/binary-tree/tree-counter.ts +105 -14
  36. package/src/data-structures/binary-tree/tree-multi-map.ts +123 -12
  37. package/src/data-structures/graph/abstract-graph.ts +5 -5
  38. package/src/data-structures/graph/directed-graph.ts +5 -5
  39. package/src/data-structures/graph/undirected-graph.ts +5 -5
  40. package/src/data-structures/heap/heap.ts +5 -5
  41. package/src/data-structures/linked-list/singly-linked-list.ts +2 -2
  42. package/src/interfaces/binary-tree.ts +1 -1
  43. package/test/integration/compile.test.mjs +159 -0
  44. package/test/integration/compile.test.ts +176 -0
  45. package/test/integration/heap.test.js +1 -1
  46. package/test/integration/index.html +1 -1
  47. package/test/unit/data-structures/binary-tree/avl-tree-counter.test.ts +5 -4
  48. package/test/unit/data-structures/binary-tree/avl-tree.test.ts +3 -3
  49. package/test/unit/data-structures/binary-tree/binary-tree.test.ts +3 -3
  50. package/test/unit/data-structures/binary-tree/bst.test.ts +2 -2
  51. package/test/unit/data-structures/binary-tree/red-black-tree.test.ts +3 -3
  52. package/test/unit/data-structures/binary-tree/tree-counter.test.ts +5 -4
  53. package/test/unit/data-structures/binary-tree/tree-multi-map.test.ts +4 -4
  54. package/{tsconfig-base.json → tsconfig.base.json} +0 -1
  55. package/tsconfig.test.json +1 -0
  56. package/{tsconfig-types.json → tsconfig.types.json} +1 -3
  57. package/tsup.config.js +2 -3
  58. package/tsup.node.config.js +71 -0
  59. package/dist/index.cjs.map +0 -1
  60. package/dist/index.js.map +0 -1
  61. package/test/integration/compile.js +0 -144
  62. package/test/integration/compile.mjs +0 -135
  63. package/test/integration/compile.ts +0 -171
  64. package/tsup.node.config.ts +0 -37
@@ -1,42 +1,10 @@
1
1
  "use strict";
2
2
  var dataStructureTyped = (() => {
3
3
  var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
12
- var __typeError = (msg) => {
13
- throw TypeError(msg);
14
- };
15
7
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16
- var __spreadValues = (a, b) => {
17
- for (var prop in b || (b = {}))
18
- if (__hasOwnProp.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- if (__getOwnPropSymbols)
21
- for (var prop of __getOwnPropSymbols(b)) {
22
- if (__propIsEnum.call(b, prop))
23
- __defNormalProp(a, prop, b[prop]);
24
- }
25
- return a;
26
- };
27
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
- var __objRest = (source, exclude) => {
29
- var target = {};
30
- for (var prop in source)
31
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
32
- target[prop] = source[prop];
33
- if (source != null && __getOwnPropSymbols)
34
- for (var prop of __getOwnPropSymbols(source)) {
35
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
36
- target[prop] = source[prop];
37
- }
38
- return target;
39
- };
40
8
  var __export = (target, all) => {
41
9
  for (var name in all)
42
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -51,58 +19,6 @@ var dataStructureTyped = (() => {
51
19
  };
52
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
53
21
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
54
- var __async = (__this, __arguments, generator) => {
55
- return new Promise((resolve, reject) => {
56
- var fulfilled = (value) => {
57
- try {
58
- step(generator.next(value));
59
- } catch (e) {
60
- reject(e);
61
- }
62
- };
63
- var rejected = (value) => {
64
- try {
65
- step(generator.throw(value));
66
- } catch (e) {
67
- reject(e);
68
- }
69
- };
70
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
71
- step((generator = generator.apply(__this, __arguments)).next());
72
- });
73
- };
74
- var __await = function(promise, isYieldStar) {
75
- this[0] = promise;
76
- this[1] = isYieldStar;
77
- };
78
- var __yieldStar = (value) => {
79
- var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
80
- if (obj == null) {
81
- obj = value[__knownSymbol("iterator")]();
82
- method = (k) => it[k] = (x) => obj[k](x);
83
- } else {
84
- obj = obj.call(value);
85
- method = (k) => it[k] = (v) => {
86
- if (isAwait) {
87
- isAwait = false;
88
- if (k === "throw") throw v;
89
- return v;
90
- }
91
- isAwait = true;
92
- return {
93
- done: false,
94
- value: new __await(new Promise((resolve) => {
95
- var x = obj[k](v);
96
- if (!(x instanceof Object)) __typeError("Object expected");
97
- resolve(x);
98
- }), 1)
99
- };
100
- };
101
- }
102
- return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
103
- throw x;
104
- }, "return" in obj && method("return"), it;
105
- };
106
22
 
107
23
  // src/index.ts
108
24
  var src_exports = {};
@@ -194,7 +110,7 @@ var dataStructureTyped = (() => {
194
110
  * @remarks Time O(n) to iterate, Space O(1)
195
111
  */
196
112
  *[Symbol.iterator](...args) {
197
- yield* __yieldStar(this._getIterator(...args));
113
+ yield* this._getIterator(...args);
198
114
  }
199
115
  /**
200
116
  * Iterate over `[key, value]` pairs (may yield `undefined` values).
@@ -402,7 +318,7 @@ var dataStructureTyped = (() => {
402
318
  * Producing the iterator is O(1); consuming the entire iterator is Time O(n) with O(1) extra space.
403
319
  */
404
320
  *[Symbol.iterator](...args) {
405
- yield* __yieldStar(this._getIterator(...args));
321
+ yield* this._getIterator(...args);
406
322
  }
407
323
  /**
408
324
  * Returns an iterator over the values (alias of the default iterator).
@@ -667,19 +583,17 @@ var dataStructureTyped = (() => {
667
583
  function makeTrampoline(fn) {
668
584
  return (...args) => trampoline(fn(...args));
669
585
  }
670
- function asyncTrampoline(initial) {
671
- return __async(this, null, function* () {
672
- let current = yield initial;
673
- while (isTrampolineThunk(current)) {
674
- current = yield current.fn();
675
- }
676
- return current;
677
- });
586
+ async function asyncTrampoline(initial) {
587
+ let current = await initial;
588
+ while (isTrampolineThunk(current)) {
589
+ current = await current.fn();
590
+ }
591
+ return current;
678
592
  }
679
593
  function makeAsyncTrampoline(fn) {
680
- return (...args) => __async(null, null, function* () {
594
+ return async (...args) => {
681
595
  return asyncTrampoline(fn(...args));
682
- });
596
+ };
683
597
  }
684
598
 
685
599
  // src/utils/number.ts
@@ -2207,7 +2121,7 @@ var dataStructureTyped = (() => {
2207
2121
  * @returns A new SinglyLinkedList with mapped values.
2208
2122
  */
2209
2123
  map(callback, options, thisArg) {
2210
- const out = this._createLike([], __spreadProps(__spreadValues({}, options != null ? options : {}), { maxLen: this._maxLen }));
2124
+ const out = this._createLike([], { ...options != null ? options : {}, maxLen: this._maxLen });
2211
2125
  let index = 0;
2212
2126
  for (const value of this) out.push(callback.call(thisArg, value, index++, this));
2213
2127
  return out;
@@ -2218,7 +2132,7 @@ var dataStructureTyped = (() => {
2218
2132
  * @param value - Value to wrap in a node.
2219
2133
  * @returns A new SinglyLinkedListNode instance.
2220
2134
  */
2221
- _createNode(value) {
2135
+ createNode(value) {
2222
2136
  return new SinglyLinkedListNode(value);
2223
2137
  }
2224
2138
  /**
@@ -2238,7 +2152,7 @@ var dataStructureTyped = (() => {
2238
2152
  */
2239
2153
  _ensureNode(elementOrNode) {
2240
2154
  if (this.isNode(elementOrNode)) return elementOrNode;
2241
- return this._createNode(elementOrNode);
2155
+ return this.createNode(elementOrNode);
2242
2156
  }
2243
2157
  /**
2244
2158
  * (Protected) Normalize input into a node predicate.
@@ -2867,7 +2781,7 @@ var dataStructureTyped = (() => {
2867
2781
  * @returns A new DoublyLinkedList with mapped values.
2868
2782
  */
2869
2783
  map(callback, options, thisArg) {
2870
- const out = this._createLike([], __spreadProps(__spreadValues({}, options != null ? options : {}), { maxLen: this._maxLen }));
2784
+ const out = this._createLike([], { ...options != null ? options : {}, maxLen: this._maxLen });
2871
2785
  let index = 0;
2872
2786
  for (const v of this) out.push(callback.call(thisArg, v, index++, this));
2873
2787
  return out;
@@ -3284,7 +3198,7 @@ var dataStructureTyped = (() => {
3284
3198
  * @returns A new Stack with mapped elements.
3285
3199
  */
3286
3200
  map(callback, options, thisArg) {
3287
- const out = this._createLike([], __spreadValues({}, options != null ? options : {}));
3201
+ const out = this._createLike([], { ...options != null ? options : {} });
3288
3202
  let index = 0;
3289
3203
  for (const v of this) {
3290
3204
  out.push(thisArg === void 0 ? callback(v, index, this) : callback.call(thisArg, v, index, this));
@@ -4333,10 +4247,11 @@ var dataStructureTyped = (() => {
4333
4247
  * @returns A new Deque with mapped elements.
4334
4248
  */
4335
4249
  map(callback, options, thisArg) {
4336
- const out = this._createLike([], __spreadProps(__spreadValues({}, options != null ? options : {}), {
4250
+ const out = this._createLike([], {
4251
+ ...options != null ? options : {},
4337
4252
  bucketSize: this._bucketSize,
4338
4253
  maxLen: this._maxLen
4339
- }));
4254
+ });
4340
4255
  let index = 0;
4341
4256
  for (const el of this) {
4342
4257
  const mv = thisArg === void 0 ? callback(el, index, this) : callback.call(thisArg, el, index, this);
@@ -4772,9 +4687,9 @@ var dataStructureTyped = (() => {
4772
4687
  * @returns A new heap with mapped elements.
4773
4688
  */
4774
4689
  map(callback, options, thisArg) {
4775
- const _a = options != null ? options : {}, { comparator, toElementFn } = _a, rest = __objRest(_a, ["comparator", "toElementFn"]);
4690
+ const { comparator, toElementFn, ...rest } = options != null ? options : {};
4776
4691
  if (!comparator) throw new TypeError("Heap.map requires options.comparator for EM");
4777
- const out = this._createLike([], __spreadProps(__spreadValues({}, rest), { comparator, toElementFn }));
4692
+ const out = this._createLike([], { ...rest, comparator, toElementFn });
4778
4693
  let i = 0;
4779
4694
  for (const x of this) {
4780
4695
  const v = thisArg === void 0 ? callback(x, i++, this) : callback.call(thisArg, x, i++, this);
@@ -4851,7 +4766,7 @@ var dataStructureTyped = (() => {
4851
4766
  */
4852
4767
  _createInstance(options) {
4853
4768
  const Ctor = this.constructor;
4854
- const next = new Ctor([], __spreadValues({ comparator: this.comparator, toElementFn: this.toElementFn }, options != null ? options : {}));
4769
+ const next = new Ctor([], { comparator: this.comparator, toElementFn: this.toElementFn, ...options != null ? options : {} });
4855
4770
  return next;
4856
4771
  }
4857
4772
  /**
@@ -4947,7 +4862,7 @@ var dataStructureTyped = (() => {
4947
4862
  * @returns This heap.
4948
4863
  */
4949
4864
  push(element) {
4950
- const node = this._createNode(element);
4865
+ const node = this.createNode(element);
4951
4866
  node.left = node;
4952
4867
  node.right = node;
4953
4868
  this.mergeWithRoot(node);
@@ -5046,7 +4961,7 @@ var dataStructureTyped = (() => {
5046
4961
  this._size += heapToMerge.size;
5047
4962
  heapToMerge.clear();
5048
4963
  }
5049
- _createNode(element) {
4964
+ createNode(element) {
5050
4965
  return new FibonacciHeapNode(element);
5051
4966
  }
5052
4967
  isEmpty() {
@@ -5113,7 +5028,7 @@ var dataStructureTyped = (() => {
5113
5028
  * @param options Optional configuration.
5114
5029
  */
5115
5030
  constructor(elements = [], options) {
5116
- super(elements, __spreadValues({
5031
+ super(elements, {
5117
5032
  comparator: (a, b) => {
5118
5033
  if (typeof a === "object" || typeof b === "object") {
5119
5034
  throw TypeError(
@@ -5123,8 +5038,9 @@ var dataStructureTyped = (() => {
5123
5038
  if (a < b) return 1;
5124
5039
  if (a > b) return -1;
5125
5040
  return 0;
5126
- }
5127
- }, options));
5041
+ },
5042
+ ...options
5043
+ });
5128
5044
  }
5129
5045
  };
5130
5046
 
@@ -5173,7 +5089,7 @@ var dataStructureTyped = (() => {
5173
5089
  __publicField(this, "_options", { defaultEdgeWeight: 1 });
5174
5090
  __publicField(this, "_vertexMap", /* @__PURE__ */ new Map());
5175
5091
  const graph = options == null ? void 0 : options.graph;
5176
- this._options = __spreadValues({ defaultEdgeWeight: 1 }, graph != null ? graph : {});
5092
+ this._options = { defaultEdgeWeight: 1, ...graph != null ? graph : {} };
5177
5093
  }
5178
5094
  get options() {
5179
5095
  return this._options;
@@ -5867,7 +5783,7 @@ var dataStructureTyped = (() => {
5867
5783
  * @remarks Time O(1), Space O(1)
5868
5784
  */
5869
5785
  _snapshotOptions() {
5870
- return { graph: __spreadValues({}, this._options) };
5786
+ return { graph: { ...this._options } };
5871
5787
  }
5872
5788
  /**
5873
5789
  * Create an empty graph instance of the same concrete species (Directed/Undirected/etc).
@@ -5883,8 +5799,8 @@ var dataStructureTyped = (() => {
5883
5799
  const Ctor = this.constructor;
5884
5800
  const instance = new Ctor();
5885
5801
  const graph = _options == null ? void 0 : _options.graph;
5886
- if (graph) instance._options = __spreadValues(__spreadValues({}, instance._options), graph);
5887
- else instance._options = __spreadValues(__spreadValues({}, instance._options), this._options);
5802
+ if (graph) instance._options = { ...instance._options, ...graph };
5803
+ else instance._options = { ...instance._options, ...this._options };
5888
5804
  return instance;
5889
5805
  }
5890
5806
  /**
@@ -6890,7 +6806,7 @@ var dataStructureTyped = (() => {
6890
6806
  * @remarks Time O(1), Space O(1)
6891
6807
  */
6892
6808
  _snapshotOptions() {
6893
- return __spreadProps(__spreadValues({}, super._snapshotOptions()), { originCoord: this.originCoord, bottomRight: this.bottomRight });
6809
+ return { ...super._snapshotOptions(), originCoord: this.originCoord, bottomRight: this.bottomRight };
6894
6810
  }
6895
6811
  /**
6896
6812
  * Re-create a same-species MapGraph instance from snapshot options.
@@ -7171,7 +7087,7 @@ var dataStructureTyped = (() => {
7171
7087
  * @param [value] - The value for the new node (used if not in Map mode).
7172
7088
  * @returns The newly created node.
7173
7089
  */
7174
- _createNode(key, value) {
7090
+ createNode(key, value) {
7175
7091
  return new BinaryTreeNode(key, this._isMapMode ? void 0 : value);
7176
7092
  }
7177
7093
  /**
@@ -8112,7 +8028,7 @@ var dataStructureTyped = (() => {
8112
8028
  * @returns The string representation of the tree.
8113
8029
  */
8114
8030
  toVisual(startNode = this._root, options) {
8115
- const opts = __spreadValues({ isShowUndefined: false, isShowNull: true, isShowRedBlackNIL: false }, options);
8031
+ const opts = { isShowUndefined: false, isShowNull: true, isShowRedBlackNIL: false, ...options };
8116
8032
  startNode = this.ensureNode(startNode);
8117
8033
  let output = "";
8118
8034
  if (!startNode) return output;
@@ -8275,12 +8191,12 @@ var dataStructureTyped = (() => {
8275
8191
  }
8276
8192
  } else {
8277
8193
  if (node.left && this.isRealNode(node)) {
8278
- yield* __yieldStar(this[Symbol.iterator](node.left));
8194
+ yield* this[Symbol.iterator](node.left);
8279
8195
  }
8280
8196
  if (this._isMapMode) yield [node.key, this._store.get(node.key)];
8281
8197
  else yield [node.key, node.value];
8282
8198
  if (node.right && this.isRealNode(node)) {
8283
- yield* __yieldStar(this[Symbol.iterator](node.right));
8199
+ yield* this[Symbol.iterator](node.right);
8284
8200
  }
8285
8201
  }
8286
8202
  }
@@ -8309,7 +8225,7 @@ var dataStructureTyped = (() => {
8309
8225
  */
8310
8226
  _createInstance(options) {
8311
8227
  const Ctor = this.constructor;
8312
- return new Ctor([], __spreadValues(__spreadValues({}, this._snapshotOptions()), options != null ? options : {}));
8228
+ return new Ctor([], { ...this._snapshotOptions(), ...options != null ? options : {} });
8313
8229
  }
8314
8230
  /**
8315
8231
  * (Protected) Creates a new instance of the same tree constructor, potentially with different generic types.
@@ -8322,7 +8238,7 @@ var dataStructureTyped = (() => {
8322
8238
  */
8323
8239
  _createLike(iter = [], options) {
8324
8240
  const Ctor = this.constructor;
8325
- return new Ctor(iter, __spreadValues(__spreadValues({}, this._snapshotOptions()), options != null ? options : {}));
8241
+ return new Ctor(iter, { ...this._snapshotOptions(), ...options != null ? options : {} });
8326
8242
  }
8327
8243
  /**
8328
8244
  * (Protected) Converts a key, node, or entry into a standardized [node, value] tuple.
@@ -8341,9 +8257,9 @@ var dataStructureTyped = (() => {
8341
8257
  if (key === void 0) return [void 0, void 0];
8342
8258
  else if (key === null) return [null, void 0];
8343
8259
  const finalValue = value != null ? value : entryValue;
8344
- return [this._createNode(key, finalValue), finalValue];
8260
+ return [this.createNode(key, finalValue), finalValue];
8345
8261
  }
8346
- return [this._createNode(keyNodeOrEntry, value), value];
8262
+ return [this.createNode(keyNodeOrEntry, value), value];
8347
8263
  }
8348
8264
  /**
8349
8265
  * (Protected) Helper for cloning. Performs a BFS and adds all nodes to the new tree.
@@ -8428,7 +8344,7 @@ var dataStructureTyped = (() => {
8428
8344
  destNode = this.ensureNode(destNode);
8429
8345
  if (srcNode && destNode) {
8430
8346
  const { key, value } = destNode;
8431
- const tempNode = this._createNode(key, value);
8347
+ const tempNode = this.createNode(key, value);
8432
8348
  if (tempNode) {
8433
8349
  destNode.key = srcNode.key;
8434
8350
  if (!this._isMapMode) destNode.value = srcNode.value;
@@ -8549,7 +8465,7 @@ var dataStructureTyped = (() => {
8549
8465
  };
8550
8466
 
8551
8467
  // src/data-structures/binary-tree/bst.ts
8552
- var BSTNode = class extends BinaryTreeNode {
8468
+ var BSTNode = class {
8553
8469
  /**
8554
8470
  * Creates an instance of BSTNode.
8555
8471
  * @remarks Time O(1), Space O(1)
@@ -8558,10 +8474,16 @@ var dataStructureTyped = (() => {
8558
8474
  * @param [value] - The value associated with the key.
8559
8475
  */
8560
8476
  constructor(key, value) {
8561
- super(key, value);
8477
+ __publicField(this, "key");
8478
+ __publicField(this, "value");
8562
8479
  __publicField(this, "parent");
8563
8480
  __publicField(this, "_left");
8564
8481
  __publicField(this, "_right");
8482
+ __publicField(this, "_height", 0);
8483
+ __publicField(this, "_color", "BLACK");
8484
+ __publicField(this, "_count", 1);
8485
+ this.key = key;
8486
+ this.value = value;
8565
8487
  }
8566
8488
  /**
8567
8489
  * Gets the left child of the node.
@@ -8601,6 +8523,77 @@ var dataStructureTyped = (() => {
8601
8523
  if (v) v.parent = this;
8602
8524
  this._right = v;
8603
8525
  }
8526
+ /**
8527
+ * Gets the height of the node (used in self-balancing trees).
8528
+ * @remarks Time O(1), Space O(1)
8529
+ *
8530
+ * @returns The height.
8531
+ */
8532
+ get height() {
8533
+ return this._height;
8534
+ }
8535
+ /**
8536
+ * Sets the height of the node.
8537
+ * @remarks Time O(1), Space O(1)
8538
+ *
8539
+ * @param value - The new height.
8540
+ */
8541
+ set height(value) {
8542
+ this._height = value;
8543
+ }
8544
+ /**
8545
+ * Gets the color of the node (used in Red-Black trees).
8546
+ * @remarks Time O(1), Space O(1)
8547
+ *
8548
+ * @returns The node's color.
8549
+ */
8550
+ get color() {
8551
+ return this._color;
8552
+ }
8553
+ /**
8554
+ * Sets the color of the node.
8555
+ * @remarks Time O(1), Space O(1)
8556
+ *
8557
+ * @param value - The new color.
8558
+ */
8559
+ set color(value) {
8560
+ this._color = value;
8561
+ }
8562
+ /**
8563
+ * Gets the count of nodes in the subtree rooted at this node (used in order-statistic trees).
8564
+ * @remarks Time O(1), Space O(1)
8565
+ *
8566
+ * @returns The subtree node count.
8567
+ */
8568
+ get count() {
8569
+ return this._count;
8570
+ }
8571
+ /**
8572
+ * Sets the count of nodes in the subtree.
8573
+ * @remarks Time O(1), Space O(1)
8574
+ *
8575
+ * @param value - The new count.
8576
+ */
8577
+ set count(value) {
8578
+ this._count = value;
8579
+ }
8580
+ /**
8581
+ * Gets the position of the node relative to its parent.
8582
+ * @remarks Time O(1), Space O(1)
8583
+ *
8584
+ * @returns The family position (e.g., 'ROOT', 'LEFT', 'RIGHT').
8585
+ */
8586
+ get familyPosition() {
8587
+ if (!this.parent) {
8588
+ return this.left || this.right ? "ROOT" : "ISOLATED";
8589
+ }
8590
+ if (this.parent.left === this) {
8591
+ return this.left || this.right ? "ROOT_LEFT" : "LEFT";
8592
+ } else if (this.parent.right === this) {
8593
+ return this.left || this.right ? "ROOT_RIGHT" : "RIGHT";
8594
+ }
8595
+ return "MAL_NODE";
8596
+ }
8604
8597
  };
8605
8598
  var BST = class extends BinaryTree {
8606
8599
  /**
@@ -8690,7 +8683,7 @@ var dataStructureTyped = (() => {
8690
8683
  * @param [value] - The value for the new node (used if not in Map mode).
8691
8684
  * @returns The newly created BSTNode.
8692
8685
  */
8693
- _createNode(key, value) {
8686
+ createNode(key, value) {
8694
8687
  return new BSTNode(key, this._isMapMode ? void 0 : value);
8695
8688
  }
8696
8689
  /**
@@ -9160,7 +9153,7 @@ var dataStructureTyped = (() => {
9160
9153
  */
9161
9154
  _createInstance(options) {
9162
9155
  const Ctor = this.constructor;
9163
- return new Ctor([], __spreadValues(__spreadValues({}, this._snapshotOptions()), options != null ? options : {}));
9156
+ return new Ctor([], { ...this._snapshotOptions(), ...options != null ? options : {} });
9164
9157
  }
9165
9158
  /**
9166
9159
  * (Protected) Creates a new instance of the same BST constructor, potentially with different generic types.
@@ -9173,7 +9166,7 @@ var dataStructureTyped = (() => {
9173
9166
  */
9174
9167
  _createLike(iter = [], options) {
9175
9168
  const Ctor = this.constructor;
9176
- return new Ctor(iter, __spreadValues(__spreadValues({}, this._snapshotOptions()), options != null ? options : {}));
9169
+ return new Ctor(iter, { ...this._snapshotOptions(), ...options != null ? options : {} });
9177
9170
  }
9178
9171
  /**
9179
9172
  * (Protected) Snapshots the current BST's configuration options.
@@ -9183,10 +9176,11 @@ var dataStructureTyped = (() => {
9183
9176
  * @returns The options object.
9184
9177
  */
9185
9178
  _snapshotOptions() {
9186
- return __spreadProps(__spreadValues({}, super._snapshotOptions()), {
9179
+ return {
9180
+ ...super._snapshotOptions(),
9187
9181
  specifyComparable: this.specifyComparable,
9188
9182
  isReverse: this.isReverse
9189
- });
9183
+ };
9190
9184
  }
9191
9185
  /**
9192
9186
  * (Protected) Converts a key, node, or entry into a standardized [node, value] tuple.
@@ -9838,7 +9832,7 @@ var dataStructureTyped = (() => {
9838
9832
  };
9839
9833
 
9840
9834
  // src/data-structures/binary-tree/avl-tree.ts
9841
- var AVLTreeNode = class extends BSTNode {
9835
+ var AVLTreeNode = class {
9842
9836
  /**
9843
9837
  * Creates an instance of AVLTreeNode.
9844
9838
  * @remarks Time O(1), Space O(1)
@@ -9847,10 +9841,16 @@ var dataStructureTyped = (() => {
9847
9841
  * @param [value] - The value associated with the key.
9848
9842
  */
9849
9843
  constructor(key, value) {
9850
- super(key, value);
9844
+ __publicField(this, "key");
9845
+ __publicField(this, "value");
9851
9846
  __publicField(this, "parent");
9852
9847
  __publicField(this, "_left");
9853
9848
  __publicField(this, "_right");
9849
+ __publicField(this, "_height", 0);
9850
+ __publicField(this, "_color", "BLACK");
9851
+ __publicField(this, "_count", 1);
9852
+ this.key = key;
9853
+ this.value = value;
9854
9854
  }
9855
9855
  /**
9856
9856
  * Gets the left child of the node.
@@ -9894,6 +9894,77 @@ var dataStructureTyped = (() => {
9894
9894
  }
9895
9895
  this._right = v;
9896
9896
  }
9897
+ /**
9898
+ * Gets the height of the node (used in self-balancing trees).
9899
+ * @remarks Time O(1), Space O(1)
9900
+ *
9901
+ * @returns The height.
9902
+ */
9903
+ get height() {
9904
+ return this._height;
9905
+ }
9906
+ /**
9907
+ * Sets the height of the node.
9908
+ * @remarks Time O(1), Space O(1)
9909
+ *
9910
+ * @param value - The new height.
9911
+ */
9912
+ set height(value) {
9913
+ this._height = value;
9914
+ }
9915
+ /**
9916
+ * Gets the color of the node (used in Red-Black trees).
9917
+ * @remarks Time O(1), Space O(1)
9918
+ *
9919
+ * @returns The node's color.
9920
+ */
9921
+ get color() {
9922
+ return this._color;
9923
+ }
9924
+ /**
9925
+ * Sets the color of the node.
9926
+ * @remarks Time O(1), Space O(1)
9927
+ *
9928
+ * @param value - The new color.
9929
+ */
9930
+ set color(value) {
9931
+ this._color = value;
9932
+ }
9933
+ /**
9934
+ * Gets the count of nodes in the subtree rooted at this node (used in order-statistic trees).
9935
+ * @remarks Time O(1), Space O(1)
9936
+ *
9937
+ * @returns The subtree node count.
9938
+ */
9939
+ get count() {
9940
+ return this._count;
9941
+ }
9942
+ /**
9943
+ * Sets the count of nodes in the subtree.
9944
+ * @remarks Time O(1), Space O(1)
9945
+ *
9946
+ * @param value - The new count.
9947
+ */
9948
+ set count(value) {
9949
+ this._count = value;
9950
+ }
9951
+ /**
9952
+ * Gets the position of the node relative to its parent.
9953
+ * @remarks Time O(1), Space O(1)
9954
+ *
9955
+ * @returns The family position (e.g., 'ROOT', 'LEFT', 'RIGHT').
9956
+ */
9957
+ get familyPosition() {
9958
+ if (!this.parent) {
9959
+ return this.left || this.right ? "ROOT" : "ISOLATED";
9960
+ }
9961
+ if (this.parent.left === this) {
9962
+ return this.left || this.right ? "ROOT_LEFT" : "LEFT";
9963
+ } else if (this.parent.right === this) {
9964
+ return this.left || this.right ? "ROOT_RIGHT" : "RIGHT";
9965
+ }
9966
+ return "MAL_NODE";
9967
+ }
9897
9968
  };
9898
9969
  var AVLTree = class extends BST {
9899
9970
  /**
@@ -9915,7 +9986,7 @@ var dataStructureTyped = (() => {
9915
9986
  * @param [value] - The value for the new node.
9916
9987
  * @returns The newly created AVLTreeNode.
9917
9988
  */
9918
- _createNode(key, value) {
9989
+ createNode(key, value) {
9919
9990
  return new AVLTreeNode(key, this._isMapMode ? void 0 : value);
9920
9991
  }
9921
9992
  /**
@@ -10018,7 +10089,7 @@ var dataStructureTyped = (() => {
10018
10089
  */
10019
10090
  _createInstance(options) {
10020
10091
  const Ctor = this.constructor;
10021
- return new Ctor([], __spreadValues(__spreadValues({}, this._snapshotOptions()), options != null ? options : {}));
10092
+ return new Ctor([], { ...this._snapshotOptions(), ...options != null ? options : {} });
10022
10093
  }
10023
10094
  /**
10024
10095
  * (Protected) Creates a new instance of the same AVLTree constructor, potentially with different generic types.
@@ -10031,7 +10102,7 @@ var dataStructureTyped = (() => {
10031
10102
  */
10032
10103
  _createLike(iter = [], options) {
10033
10104
  const Ctor = this.constructor;
10034
- return new Ctor(iter, __spreadValues(__spreadValues({}, this._snapshotOptions()), options != null ? options : {}));
10105
+ return new Ctor(iter, { ...this._snapshotOptions(), ...options != null ? options : {} });
10035
10106
  }
10036
10107
  /**
10037
10108
  * (Protected) Swaps properties of two nodes, including height.
@@ -10046,7 +10117,7 @@ var dataStructureTyped = (() => {
10046
10117
  const destNodeEnsured = this.ensureNode(destNode);
10047
10118
  if (srcNodeEnsured && destNodeEnsured) {
10048
10119
  const { key, value, height } = destNodeEnsured;
10049
- const tempNode = this._createNode(key, value);
10120
+ const tempNode = this.createNode(key, value);
10050
10121
  if (tempNode) {
10051
10122
  tempNode.height = height;
10052
10123
  destNodeEnsured.key = srcNodeEnsured.key;
@@ -10285,7 +10356,7 @@ var dataStructureTyped = (() => {
10285
10356
  };
10286
10357
 
10287
10358
  // src/data-structures/binary-tree/red-black-tree.ts
10288
- var RedBlackTreeNode = class extends BSTNode {
10359
+ var RedBlackTreeNode = class {
10289
10360
  /**
10290
10361
  * Create a Red-Black Tree and optionally bulk-insert items.
10291
10362
  * @remarks Time O(n log n), Space O(n)
@@ -10295,11 +10366,17 @@ var dataStructureTyped = (() => {
10295
10366
  * @returns New RedBlackTree instance.
10296
10367
  */
10297
10368
  constructor(key, value, color = "BLACK") {
10298
- super(key, value);
10369
+ __publicField(this, "key");
10370
+ __publicField(this, "value");
10299
10371
  __publicField(this, "parent");
10300
10372
  __publicField(this, "_left");
10301
10373
  __publicField(this, "_right");
10302
- this._color = color;
10374
+ __publicField(this, "_height", 0);
10375
+ __publicField(this, "_color", "BLACK");
10376
+ __publicField(this, "_count", 1);
10377
+ this.key = key;
10378
+ this.value = value;
10379
+ this.color = color;
10303
10380
  }
10304
10381
  /**
10305
10382
  * Get the left child pointer.
@@ -10341,61 +10418,132 @@ var dataStructureTyped = (() => {
10341
10418
  }
10342
10419
  this._right = v;
10343
10420
  }
10344
- };
10345
- var RedBlackTree = class extends BST {
10346
- constructor(keysNodesEntriesOrRaws = [], options) {
10347
- super([], options);
10348
- __publicField(this, "_root");
10349
- this._root = this.NIL;
10350
- if (keysNodesEntriesOrRaws) {
10351
- this.addMany(keysNodesEntriesOrRaws);
10352
- }
10353
- }
10354
10421
  /**
10355
- * Get the current root node.
10422
+ * Gets the height of the node (used in self-balancing trees).
10356
10423
  * @remarks Time O(1), Space O(1)
10357
- * @returns Root node, or undefined.
10424
+ *
10425
+ * @returns The height.
10358
10426
  */
10359
- get root() {
10360
- return this._root;
10427
+ get height() {
10428
+ return this._height;
10361
10429
  }
10362
10430
  /**
10363
- * Create a red-black node for the given key/value (value ignored in map mode).
10431
+ * Sets the height of the node.
10364
10432
  * @remarks Time O(1), Space O(1)
10365
- * @param key - See parameter type for details.
10366
- * @param [value] - See parameter type for details.
10367
- * @param color - See parameter type for details.
10368
- * @returns A new RedBlackTreeNode instance.
10433
+ *
10434
+ * @param value - The new height.
10369
10435
  */
10370
- _createNode(key, value, color = "BLACK") {
10371
- return new RedBlackTreeNode(key, this._isMapMode ? void 0 : value, color);
10436
+ set height(value) {
10437
+ this._height = value;
10372
10438
  }
10373
10439
  /**
10374
- * Type guard: check whether the input is a RedBlackTreeNode.
10440
+ * Gets the color of the node (used in Red-Black trees).
10375
10441
  * @remarks Time O(1), Space O(1)
10376
- * @param keyNodeOrEntry - See parameter type for details.
10377
- * @returns True if the value is a RedBlackTreeNode.
10442
+ *
10443
+ * @returns The node's color.
10378
10444
  */
10379
- isNode(keyNodeOrEntry) {
10380
- return keyNodeOrEntry instanceof RedBlackTreeNode;
10445
+ get color() {
10446
+ return this._color;
10381
10447
  }
10382
10448
  /**
10383
- * Remove all nodes and clear the key→value store (if in map mode).
10384
- * @remarks Time O(n), Space O(1)
10385
- * @returns void
10449
+ * Sets the color of the node.
10450
+ * @remarks Time O(1), Space O(1)
10451
+ *
10452
+ * @param value - The new color.
10386
10453
  */
10387
- clear() {
10388
- super.clear();
10389
- this._root = this.NIL;
10454
+ set color(value) {
10455
+ this._color = value;
10390
10456
  }
10391
10457
  /**
10392
- * Insert or replace an entry using BST order and red-black fix-up.
10393
- * @remarks Time O(log n), Space O(1)
10394
- * @param keyNodeOrEntry - Key, node, or [key, value] entry to insert.
10395
- * @param [value]- See parameter type for details.
10396
- * @returns True if inserted or updated; false if ignored.
10458
+ * Gets the count of nodes in the subtree rooted at this node (used in order-statistic trees).
10459
+ * @remarks Time O(1), Space O(1)
10460
+ *
10461
+ * @returns The subtree node count.
10397
10462
  */
10398
- add(keyNodeOrEntry, value) {
10463
+ get count() {
10464
+ return this._count;
10465
+ }
10466
+ /**
10467
+ * Sets the count of nodes in the subtree.
10468
+ * @remarks Time O(1), Space O(1)
10469
+ *
10470
+ * @param value - The new count.
10471
+ */
10472
+ set count(value) {
10473
+ this._count = value;
10474
+ }
10475
+ /**
10476
+ * Gets the position of the node relative to its parent.
10477
+ * @remarks Time O(1), Space O(1)
10478
+ *
10479
+ * @returns The family position (e.g., 'ROOT', 'LEFT', 'RIGHT').
10480
+ */
10481
+ get familyPosition() {
10482
+ if (!this.parent) {
10483
+ return this.left || this.right ? "ROOT" : "ISOLATED";
10484
+ }
10485
+ if (this.parent.left === this) {
10486
+ return this.left || this.right ? "ROOT_LEFT" : "LEFT";
10487
+ } else if (this.parent.right === this) {
10488
+ return this.left || this.right ? "ROOT_RIGHT" : "RIGHT";
10489
+ }
10490
+ return "MAL_NODE";
10491
+ }
10492
+ };
10493
+ var RedBlackTree = class extends BST {
10494
+ constructor(keysNodesEntriesOrRaws = [], options) {
10495
+ super([], options);
10496
+ __publicField(this, "_root");
10497
+ this._root = this.NIL;
10498
+ if (keysNodesEntriesOrRaws) {
10499
+ this.addMany(keysNodesEntriesOrRaws);
10500
+ }
10501
+ }
10502
+ /**
10503
+ * Get the current root node.
10504
+ * @remarks Time O(1), Space O(1)
10505
+ * @returns Root node, or undefined.
10506
+ */
10507
+ get root() {
10508
+ return this._root;
10509
+ }
10510
+ /**
10511
+ * Create a red-black node for the given key/value (value ignored in map mode).
10512
+ * @remarks Time O(1), Space O(1)
10513
+ * @param key - See parameter type for details.
10514
+ * @param [value] - See parameter type for details.
10515
+ * @param color - See parameter type for details.
10516
+ * @returns A new RedBlackTreeNode instance.
10517
+ */
10518
+ createNode(key, value, color = "BLACK") {
10519
+ return new RedBlackTreeNode(key, this._isMapMode ? void 0 : value, color);
10520
+ }
10521
+ /**
10522
+ * Type guard: check whether the input is a RedBlackTreeNode.
10523
+ * @remarks Time O(1), Space O(1)
10524
+ * @param keyNodeOrEntry - See parameter type for details.
10525
+ * @returns True if the value is a RedBlackTreeNode.
10526
+ */
10527
+ isNode(keyNodeOrEntry) {
10528
+ return keyNodeOrEntry instanceof RedBlackTreeNode;
10529
+ }
10530
+ /**
10531
+ * Remove all nodes and clear the key→value store (if in map mode).
10532
+ * @remarks Time O(n), Space O(1)
10533
+ * @returns void
10534
+ */
10535
+ clear() {
10536
+ super.clear();
10537
+ this._root = this.NIL;
10538
+ }
10539
+ /**
10540
+ * Insert or replace an entry using BST order and red-black fix-up.
10541
+ * @remarks Time O(log n), Space O(1)
10542
+ * @param keyNodeOrEntry - Key, node, or [key, value] entry to insert.
10543
+ * @param [value]- See parameter type for details.
10544
+ * @returns True if inserted or updated; false if ignored.
10545
+ */
10546
+ add(keyNodeOrEntry, value) {
10399
10547
  const [newNode, newValue] = this._keyValueNodeOrEntryToNodeAndValue(keyNodeOrEntry, value);
10400
10548
  if (!this.isRealNode(newNode)) return false;
10401
10549
  const insertStatus = this._insert(newNode);
@@ -10495,11 +10643,11 @@ var dataStructureTyped = (() => {
10495
10643
  }
10496
10644
  _createInstance(options) {
10497
10645
  const Ctor = this.constructor;
10498
- return new Ctor([], __spreadValues(__spreadValues({}, this._snapshotOptions()), options != null ? options : {}));
10646
+ return new Ctor([], { ...this._snapshotOptions(), ...options != null ? options : {} });
10499
10647
  }
10500
10648
  _createLike(iter = [], options) {
10501
10649
  const Ctor = this.constructor;
10502
- return new Ctor(iter, __spreadValues(__spreadValues({}, this._snapshotOptions()), options != null ? options : {}));
10650
+ return new Ctor(iter, { ...this._snapshotOptions(), ...options != null ? options : {} });
10503
10651
  }
10504
10652
  _setRoot(v) {
10505
10653
  if (v) {
@@ -10518,16 +10666,16 @@ var dataStructureTyped = (() => {
10518
10666
  * @returns Status string: 'CREATED' or 'UPDATED'.
10519
10667
  */
10520
10668
  _insert(node) {
10521
- var _a, _b;
10522
- let current = this.root;
10669
+ var _a, _b, _c;
10670
+ let current = (_a = this.root) != null ? _a : this.NIL;
10523
10671
  let parent = void 0;
10524
- while (this.isRealNode(current)) {
10672
+ while (current !== this.NIL) {
10525
10673
  parent = current;
10526
10674
  const compared = this._compare(node.key, current.key);
10527
10675
  if (compared < 0) {
10528
- current = (_a = current.left) != null ? _a : this.NIL;
10676
+ current = (_b = current.left) != null ? _b : this.NIL;
10529
10677
  } else if (compared > 0) {
10530
- current = (_b = current.right) != null ? _b : this.NIL;
10678
+ current = (_c = current.right) != null ? _c : this.NIL;
10531
10679
  } else {
10532
10680
  this._replaceNode(current, node);
10533
10681
  return "UPDATED";
@@ -10587,7 +10735,7 @@ var dataStructureTyped = (() => {
10587
10735
  z = z.parent;
10588
10736
  this._leftRotate(z);
10589
10737
  }
10590
- if (z && this.isRealNode(z.parent) && this.isRealNode(z.parent.parent)) {
10738
+ if (z && z.parent && z.parent.parent) {
10591
10739
  z.parent.color = "BLACK";
10592
10740
  z.parent.parent.color = "RED";
10593
10741
  this._rightRotate(z.parent.parent);
@@ -10605,7 +10753,7 @@ var dataStructureTyped = (() => {
10605
10753
  z = z.parent;
10606
10754
  this._rightRotate(z);
10607
10755
  }
10608
- if (z && this.isRealNode(z.parent) && this.isRealNode(z.parent.parent)) {
10756
+ if (z && z.parent && z.parent.parent) {
10609
10757
  z.parent.color = "BLACK";
10610
10758
  z.parent.parent.color = "RED";
10611
10759
  this._leftRotate(z.parent.parent);
@@ -10688,7 +10836,7 @@ var dataStructureTyped = (() => {
10688
10836
  }
10689
10837
  const y = x.right;
10690
10838
  x.right = y.left;
10691
- if (this.isRealNode(y.left)) {
10839
+ if (y.left && y.left !== this.NIL) {
10692
10840
  y.left.parent = x;
10693
10841
  }
10694
10842
  y.parent = x.parent;
@@ -10714,7 +10862,7 @@ var dataStructureTyped = (() => {
10714
10862
  }
10715
10863
  const x = y.left;
10716
10864
  y.left = x.right;
10717
- if (this.isRealNode(x.right)) {
10865
+ if (x.right && x.right !== this.NIL) {
10718
10866
  x.right.parent = y;
10719
10867
  }
10720
10868
  x.parent = y.parent;
@@ -10731,7 +10879,7 @@ var dataStructureTyped = (() => {
10731
10879
  };
10732
10880
 
10733
10881
  // src/data-structures/binary-tree/avl-tree-multi-map.ts
10734
- var AVLTreeMultiMapNode = class extends AVLTreeNode {
10882
+ var AVLTreeMultiMapNode = class {
10735
10883
  /**
10736
10884
  * Create an AVLTreeMultiMap node with a value bucket.
10737
10885
  * @remarks Time O(1), Space O(1)
@@ -10739,11 +10887,17 @@ var dataStructureTyped = (() => {
10739
10887
  * @param value - Initial array of values.
10740
10888
  * @returns New AVLTreeMultiMapNode instance.
10741
10889
  */
10742
- constructor(key, value) {
10743
- super(key, value);
10890
+ constructor(key, value = []) {
10891
+ __publicField(this, "key");
10892
+ __publicField(this, "value");
10744
10893
  __publicField(this, "parent");
10745
10894
  __publicField(this, "_left");
10746
10895
  __publicField(this, "_right");
10896
+ __publicField(this, "_height", 0);
10897
+ __publicField(this, "_color", "BLACK");
10898
+ __publicField(this, "_count", 1);
10899
+ this.key = key;
10900
+ this.value = value;
10747
10901
  }
10748
10902
  /**
10749
10903
  * Get the left child pointer.
@@ -10785,6 +10939,77 @@ var dataStructureTyped = (() => {
10785
10939
  }
10786
10940
  this._right = v;
10787
10941
  }
10942
+ /**
10943
+ * Gets the height of the node (used in self-balancing trees).
10944
+ * @remarks Time O(1), Space O(1)
10945
+ *
10946
+ * @returns The height.
10947
+ */
10948
+ get height() {
10949
+ return this._height;
10950
+ }
10951
+ /**
10952
+ * Sets the height of the node.
10953
+ * @remarks Time O(1), Space O(1)
10954
+ *
10955
+ * @param value - The new height.
10956
+ */
10957
+ set height(value) {
10958
+ this._height = value;
10959
+ }
10960
+ /**
10961
+ * Gets the color of the node (used in Red-Black trees).
10962
+ * @remarks Time O(1), Space O(1)
10963
+ *
10964
+ * @returns The node's color.
10965
+ */
10966
+ get color() {
10967
+ return this._color;
10968
+ }
10969
+ /**
10970
+ * Sets the color of the node.
10971
+ * @remarks Time O(1), Space O(1)
10972
+ *
10973
+ * @param value - The new color.
10974
+ */
10975
+ set color(value) {
10976
+ this._color = value;
10977
+ }
10978
+ /**
10979
+ * Gets the count of nodes in the subtree rooted at this node (used in order-statistic trees).
10980
+ * @remarks Time O(1), Space O(1)
10981
+ *
10982
+ * @returns The subtree node count.
10983
+ */
10984
+ get count() {
10985
+ return this._count;
10986
+ }
10987
+ /**
10988
+ * Sets the count of nodes in the subtree.
10989
+ * @remarks Time O(1), Space O(1)
10990
+ *
10991
+ * @param value - The new count.
10992
+ */
10993
+ set count(value) {
10994
+ this._count = value;
10995
+ }
10996
+ /**
10997
+ * Gets the position of the node relative to its parent.
10998
+ * @remarks Time O(1), Space O(1)
10999
+ *
11000
+ * @returns The family position (e.g., 'ROOT', 'LEFT', 'RIGHT').
11001
+ */
11002
+ get familyPosition() {
11003
+ if (!this.parent) {
11004
+ return this.left || this.right ? "ROOT" : "ISOLATED";
11005
+ }
11006
+ if (this.parent.left === this) {
11007
+ return this.left || this.right ? "ROOT_LEFT" : "LEFT";
11008
+ } else if (this.parent.right === this) {
11009
+ return this.left || this.right ? "ROOT_RIGHT" : "RIGHT";
11010
+ }
11011
+ return "MAL_NODE";
11012
+ }
10788
11013
  };
10789
11014
  var AVLTreeMultiMap = class extends AVLTree {
10790
11015
  /**
@@ -10795,14 +11020,24 @@ var dataStructureTyped = (() => {
10795
11020
  * @returns New AVLTreeMultiMap instance.
10796
11021
  */
10797
11022
  constructor(keysNodesEntriesOrRaws = [], options) {
10798
- super([], __spreadProps(__spreadValues({}, options), { isMapMode: true }));
11023
+ super([], { ...options, isMapMode: true });
10799
11024
  if (keysNodesEntriesOrRaws) {
10800
11025
  this.addMany(keysNodesEntriesOrRaws);
10801
11026
  }
10802
11027
  }
10803
- _createNode(key, value = []) {
11028
+ createNode(key, value = []) {
10804
11029
  return new AVLTreeMultiMapNode(key, this._isMapMode ? [] : value);
10805
11030
  }
11031
+ /**
11032
+ * Checks if the given item is a `AVLTreeMultiMapNode` instance.
11033
+ * @remarks Time O(1), Space O(1)
11034
+ *
11035
+ * @param keyNodeOrEntry - The item to check.
11036
+ * @returns True if it's a AVLTreeMultiMapNode, false otherwise.
11037
+ */
11038
+ isNode(keyNodeOrEntry) {
11039
+ return keyNodeOrEntry instanceof AVLTreeMultiMapNode;
11040
+ }
10806
11041
  /**
10807
11042
  * Insert a value or a list of values into the multimap. If the key exists, values are appended.
10808
11043
  * @remarks Time O(log N + M), Space O(1)
@@ -10926,7 +11161,7 @@ var dataStructureTyped = (() => {
10926
11161
  _createInstance(options) {
10927
11162
  var _a, _b;
10928
11163
  const Ctor = this.constructor;
10929
- return new Ctor([], __spreadValues(__spreadValues({}, (_b = (_a = this._snapshotOptions) == null ? void 0 : _a.call(this)) != null ? _b : {}), options != null ? options : {}));
11164
+ return new Ctor([], { ...(_b = (_a = this._snapshotOptions) == null ? void 0 : _a.call(this)) != null ? _b : {}, ...options != null ? options : {} });
10930
11165
  }
10931
11166
  /**
10932
11167
  * (Protected) Create a like-kind instance and seed it from an iterable.
@@ -10941,12 +11176,12 @@ var dataStructureTyped = (() => {
10941
11176
  _createLike(iter = [], options) {
10942
11177
  var _a, _b;
10943
11178
  const Ctor = this.constructor;
10944
- return new Ctor(iter, __spreadValues(__spreadValues({}, (_b = (_a = this._snapshotOptions) == null ? void 0 : _a.call(this)) != null ? _b : {}), options != null ? options : {}));
11179
+ return new Ctor(iter, { ...(_b = (_a = this._snapshotOptions) == null ? void 0 : _a.call(this)) != null ? _b : {}, ...options != null ? options : {} });
10945
11180
  }
10946
11181
  };
10947
11182
 
10948
11183
  // src/data-structures/binary-tree/tree-multi-map.ts
10949
- var TreeMultiMapNode = class extends RedBlackTreeNode {
11184
+ var TreeMultiMapNode = class {
10950
11185
  /**
10951
11186
  * Create a TreeMultiMap node with an optional value bucket.
10952
11187
  * @remarks Time O(1), Space O(1)
@@ -10954,11 +11189,18 @@ var dataStructureTyped = (() => {
10954
11189
  * @param [value] - Initial array of values.
10955
11190
  * @returns New TreeMultiMapNode instance.
10956
11191
  */
10957
- constructor(key, value) {
10958
- super(key, value);
11192
+ constructor(key, value = [], color = "BLACK") {
11193
+ __publicField(this, "key");
11194
+ __publicField(this, "value");
10959
11195
  __publicField(this, "parent");
10960
11196
  __publicField(this, "_left");
10961
11197
  __publicField(this, "_right");
11198
+ __publicField(this, "_height", 0);
11199
+ __publicField(this, "_color", "BLACK");
11200
+ __publicField(this, "_count", 1);
11201
+ this.key = key;
11202
+ this.value = value;
11203
+ this.color = color;
10962
11204
  }
10963
11205
  /**
10964
11206
  * Get the left child pointer.
@@ -11000,6 +11242,77 @@ var dataStructureTyped = (() => {
11000
11242
  }
11001
11243
  this._right = v;
11002
11244
  }
11245
+ /**
11246
+ * Gets the height of the node (used in self-balancing trees).
11247
+ * @remarks Time O(1), Space O(1)
11248
+ *
11249
+ * @returns The height.
11250
+ */
11251
+ get height() {
11252
+ return this._height;
11253
+ }
11254
+ /**
11255
+ * Sets the height of the node.
11256
+ * @remarks Time O(1), Space O(1)
11257
+ *
11258
+ * @param value - The new height.
11259
+ */
11260
+ set height(value) {
11261
+ this._height = value;
11262
+ }
11263
+ /**
11264
+ * Gets the color of the node (used in Red-Black trees).
11265
+ * @remarks Time O(1), Space O(1)
11266
+ *
11267
+ * @returns The node's color.
11268
+ */
11269
+ get color() {
11270
+ return this._color;
11271
+ }
11272
+ /**
11273
+ * Sets the color of the node.
11274
+ * @remarks Time O(1), Space O(1)
11275
+ *
11276
+ * @param value - The new color.
11277
+ */
11278
+ set color(value) {
11279
+ this._color = value;
11280
+ }
11281
+ /**
11282
+ * Gets the count of nodes in the subtree rooted at this node (used in order-statistic trees).
11283
+ * @remarks Time O(1), Space O(1)
11284
+ *
11285
+ * @returns The subtree node count.
11286
+ */
11287
+ get count() {
11288
+ return this._count;
11289
+ }
11290
+ /**
11291
+ * Sets the count of nodes in the subtree.
11292
+ * @remarks Time O(1), Space O(1)
11293
+ *
11294
+ * @param value - The new count.
11295
+ */
11296
+ set count(value) {
11297
+ this._count = value;
11298
+ }
11299
+ /**
11300
+ * Gets the position of the node relative to its parent.
11301
+ * @remarks Time O(1), Space O(1)
11302
+ *
11303
+ * @returns The family position (e.g., 'ROOT', 'LEFT', 'RIGHT').
11304
+ */
11305
+ get familyPosition() {
11306
+ if (!this.parent) {
11307
+ return this.left || this.right ? "ROOT" : "ISOLATED";
11308
+ }
11309
+ if (this.parent.left === this) {
11310
+ return this.left || this.right ? "ROOT_LEFT" : "LEFT";
11311
+ } else if (this.parent.right === this) {
11312
+ return this.left || this.right ? "ROOT_RIGHT" : "RIGHT";
11313
+ }
11314
+ return "MAL_NODE";
11315
+ }
11003
11316
  };
11004
11317
  var TreeMultiMap = class extends RedBlackTree {
11005
11318
  /**
@@ -11010,14 +11323,24 @@ var dataStructureTyped = (() => {
11010
11323
  * @returns New TreeMultiMap instance.
11011
11324
  */
11012
11325
  constructor(keysNodesEntriesOrRaws = [], options) {
11013
- super([], __spreadValues({}, options));
11326
+ super([], { ...options });
11014
11327
  if (keysNodesEntriesOrRaws) {
11015
11328
  this.addMany(keysNodesEntriesOrRaws);
11016
11329
  }
11017
11330
  }
11018
- _createNode(key, value = []) {
11331
+ createNode(key, value = []) {
11019
11332
  return new TreeMultiMapNode(key, this._isMapMode ? [] : value);
11020
11333
  }
11334
+ /**
11335
+ * Checks if the given item is a `TreeMultiMapNode` instance.
11336
+ * @remarks Time O(1), Space O(1)
11337
+ *
11338
+ * @param keyNodeOrEntry - The item to check.
11339
+ * @returns True if it's a TreeMultiMapNode, false otherwise.
11340
+ */
11341
+ isNode(keyNodeOrEntry) {
11342
+ return keyNodeOrEntry instanceof TreeMultiMapNode;
11343
+ }
11021
11344
  /**
11022
11345
  * Insert a value or a list of values into the multimap. If the key exists, values are appended.
11023
11346
  * @remarks Time O(log N + M), Space O(1)
@@ -11113,7 +11436,7 @@ var dataStructureTyped = (() => {
11113
11436
  _createInstance(options) {
11114
11437
  var _a, _b;
11115
11438
  const Ctor = this.constructor;
11116
- return new Ctor([], __spreadValues(__spreadValues({}, (_b = (_a = this._snapshotOptions) == null ? void 0 : _a.call(this)) != null ? _b : {}), options != null ? options : {}));
11439
+ return new Ctor([], { ...(_b = (_a = this._snapshotOptions) == null ? void 0 : _a.call(this)) != null ? _b : {}, ...options != null ? options : {} });
11117
11440
  }
11118
11441
  /**
11119
11442
  * (Protected) Create a like-kind instance and seed it from an iterable.
@@ -11128,12 +11451,12 @@ var dataStructureTyped = (() => {
11128
11451
  _createLike(iter = [], options) {
11129
11452
  var _a, _b;
11130
11453
  const Ctor = this.constructor;
11131
- return new Ctor(iter, __spreadValues(__spreadValues({}, (_b = (_a = this._snapshotOptions) == null ? void 0 : _a.call(this)) != null ? _b : {}), options != null ? options : {}));
11454
+ return new Ctor(iter, { ...(_b = (_a = this._snapshotOptions) == null ? void 0 : _a.call(this)) != null ? _b : {}, ...options != null ? options : {} });
11132
11455
  }
11133
11456
  };
11134
11457
 
11135
11458
  // src/data-structures/binary-tree/tree-counter.ts
11136
- var TreeCounterNode = class extends RedBlackTreeNode {
11459
+ var TreeCounterNode = class {
11137
11460
  /**
11138
11461
  * Create a tree counter node.
11139
11462
  * @remarks Time O(1), Space O(1)
@@ -11144,10 +11467,17 @@ var dataStructureTyped = (() => {
11144
11467
  * @returns New TreeCounterNode instance.
11145
11468
  */
11146
11469
  constructor(key, value, count = 1, color = "BLACK") {
11147
- super(key, value, color);
11470
+ __publicField(this, "key");
11471
+ __publicField(this, "value");
11148
11472
  __publicField(this, "parent");
11149
11473
  __publicField(this, "_left");
11150
11474
  __publicField(this, "_right");
11475
+ __publicField(this, "_height", 0);
11476
+ __publicField(this, "_color", "BLACK");
11477
+ __publicField(this, "_count", 1);
11478
+ this.key = key;
11479
+ this.value = value;
11480
+ this.color = color;
11151
11481
  this.count = count;
11152
11482
  }
11153
11483
  /**
@@ -11190,6 +11520,77 @@ var dataStructureTyped = (() => {
11190
11520
  }
11191
11521
  this._right = v;
11192
11522
  }
11523
+ /**
11524
+ * Gets the height of the node (used in self-balancing trees).
11525
+ * @remarks Time O(1), Space O(1)
11526
+ *
11527
+ * @returns The height.
11528
+ */
11529
+ get height() {
11530
+ return this._height;
11531
+ }
11532
+ /**
11533
+ * Sets the height of the node.
11534
+ * @remarks Time O(1), Space O(1)
11535
+ *
11536
+ * @param value - The new height.
11537
+ */
11538
+ set height(value) {
11539
+ this._height = value;
11540
+ }
11541
+ /**
11542
+ * Gets the color of the node (used in Red-Black trees).
11543
+ * @remarks Time O(1), Space O(1)
11544
+ *
11545
+ * @returns The node's color.
11546
+ */
11547
+ get color() {
11548
+ return this._color;
11549
+ }
11550
+ /**
11551
+ * Sets the color of the node.
11552
+ * @remarks Time O(1), Space O(1)
11553
+ *
11554
+ * @param value - The new color.
11555
+ */
11556
+ set color(value) {
11557
+ this._color = value;
11558
+ }
11559
+ /**
11560
+ * Gets the count of nodes in the subtree rooted at this node (used in order-statistic trees).
11561
+ * @remarks Time O(1), Space O(1)
11562
+ *
11563
+ * @returns The subtree node count.
11564
+ */
11565
+ get count() {
11566
+ return this._count;
11567
+ }
11568
+ /**
11569
+ * Sets the count of nodes in the subtree.
11570
+ * @remarks Time O(1), Space O(1)
11571
+ *
11572
+ * @param value - The new count.
11573
+ */
11574
+ set count(value) {
11575
+ this._count = value;
11576
+ }
11577
+ /**
11578
+ * Gets the position of the node relative to its parent.
11579
+ * @remarks Time O(1), Space O(1)
11580
+ *
11581
+ * @returns The family position (e.g., 'ROOT', 'LEFT', 'RIGHT').
11582
+ */
11583
+ get familyPosition() {
11584
+ if (!this.parent) {
11585
+ return this.left || this.right ? "ROOT" : "ISOLATED";
11586
+ }
11587
+ if (this.parent.left === this) {
11588
+ return this.left || this.right ? "ROOT_LEFT" : "LEFT";
11589
+ } else if (this.parent.right === this) {
11590
+ return this.left || this.right ? "ROOT_RIGHT" : "RIGHT";
11591
+ }
11592
+ return "MAL_NODE";
11593
+ }
11193
11594
  };
11194
11595
  var TreeCounter = class extends RedBlackTree {
11195
11596
  /**
@@ -11222,7 +11623,7 @@ var dataStructureTyped = (() => {
11222
11623
  this.dfs((node) => sum += node ? node.count : 0);
11223
11624
  return sum;
11224
11625
  }
11225
- _createNode(key, value, color = "BLACK", count) {
11626
+ createNode(key, value, color = "BLACK", count) {
11226
11627
  return new TreeCounterNode(key, this._isMapMode ? void 0 : value, count, color);
11227
11628
  }
11228
11629
  /**
@@ -11423,7 +11824,7 @@ var dataStructureTyped = (() => {
11423
11824
  */
11424
11825
  _createInstance(options) {
11425
11826
  const Ctor = this.constructor;
11426
- return new Ctor([], __spreadValues(__spreadValues({}, this._snapshotOptions()), options != null ? options : {}));
11827
+ return new Ctor([], { ...this._snapshotOptions(), ...options != null ? options : {} });
11427
11828
  }
11428
11829
  /**
11429
11830
  * (Protected) Create a like-kind instance and seed it from an iterable.
@@ -11437,7 +11838,10 @@ var dataStructureTyped = (() => {
11437
11838
  */
11438
11839
  _createLike(iter = [], options) {
11439
11840
  const Ctor = this.constructor;
11440
- return new Ctor(iter, __spreadValues(__spreadValues({}, this._snapshotOptions()), options != null ? options : {}));
11841
+ return new Ctor(iter, {
11842
+ ...this._snapshotOptions(),
11843
+ ...options != null ? options : {}
11844
+ });
11441
11845
  }
11442
11846
  /**
11443
11847
  * (Protected) Normalize input into a node plus its effective value and count.
@@ -11454,9 +11858,9 @@ var dataStructureTyped = (() => {
11454
11858
  const [key, entryValue] = keyNodeOrEntry;
11455
11859
  if (key === void 0 || key === null) return [void 0, void 0];
11456
11860
  const finalValue = value != null ? value : entryValue;
11457
- return [this._createNode(key, finalValue, "BLACK", count), finalValue];
11861
+ return [this.createNode(key, finalValue, "BLACK", count), finalValue];
11458
11862
  }
11459
- return [this._createNode(keyNodeOrEntry, value, "BLACK", count), value];
11863
+ return [this.createNode(keyNodeOrEntry, value, "BLACK", count), value];
11460
11864
  }
11461
11865
  /**
11462
11866
  * (Protected) Swap keys/values/counters between the source and destination nodes.
@@ -11470,7 +11874,7 @@ var dataStructureTyped = (() => {
11470
11874
  destNode = this.ensureNode(destNode);
11471
11875
  if (srcNode && destNode) {
11472
11876
  const { key, value, count, color } = destNode;
11473
- const tempNode = this._createNode(key, value, color, count);
11877
+ const tempNode = this.createNode(key, value, color, count);
11474
11878
  if (tempNode) {
11475
11879
  tempNode.color = color;
11476
11880
  destNode.key = srcNode.key;
@@ -11500,7 +11904,7 @@ var dataStructureTyped = (() => {
11500
11904
  };
11501
11905
 
11502
11906
  // src/data-structures/binary-tree/avl-tree-counter.ts
11503
- var AVLTreeCounterNode = class extends AVLTreeNode {
11907
+ var AVLTreeCounterNode = class {
11504
11908
  /**
11505
11909
  * Create an AVL counter node.
11506
11910
  * @remarks Time O(1), Space O(1)
@@ -11510,10 +11914,16 @@ var dataStructureTyped = (() => {
11510
11914
  * @returns New AVLTreeCounterNode instance.
11511
11915
  */
11512
11916
  constructor(key, value, count = 1) {
11513
- super(key, value);
11917
+ __publicField(this, "key");
11918
+ __publicField(this, "value");
11514
11919
  __publicField(this, "parent");
11515
11920
  __publicField(this, "_left");
11516
11921
  __publicField(this, "_right");
11922
+ __publicField(this, "_height", 0);
11923
+ __publicField(this, "_color", "BLACK");
11924
+ __publicField(this, "_count", 1);
11925
+ this.key = key;
11926
+ this.value = value;
11517
11927
  this.count = count;
11518
11928
  }
11519
11929
  /**
@@ -11556,6 +11966,77 @@ var dataStructureTyped = (() => {
11556
11966
  }
11557
11967
  this._right = v;
11558
11968
  }
11969
+ /**
11970
+ * Gets the height of the node (used in self-balancing trees).
11971
+ * @remarks Time O(1), Space O(1)
11972
+ *
11973
+ * @returns The height.
11974
+ */
11975
+ get height() {
11976
+ return this._height;
11977
+ }
11978
+ /**
11979
+ * Sets the height of the node.
11980
+ * @remarks Time O(1), Space O(1)
11981
+ *
11982
+ * @param value - The new height.
11983
+ */
11984
+ set height(value) {
11985
+ this._height = value;
11986
+ }
11987
+ /**
11988
+ * Gets the color of the node (used in Red-Black trees).
11989
+ * @remarks Time O(1), Space O(1)
11990
+ *
11991
+ * @returns The node's color.
11992
+ */
11993
+ get color() {
11994
+ return this._color;
11995
+ }
11996
+ /**
11997
+ * Sets the color of the node.
11998
+ * @remarks Time O(1), Space O(1)
11999
+ *
12000
+ * @param value - The new color.
12001
+ */
12002
+ set color(value) {
12003
+ this._color = value;
12004
+ }
12005
+ /**
12006
+ * Gets the count of nodes in the subtree rooted at this node (used in order-statistic trees).
12007
+ * @remarks Time O(1), Space O(1)
12008
+ *
12009
+ * @returns The subtree node count.
12010
+ */
12011
+ get count() {
12012
+ return this._count;
12013
+ }
12014
+ /**
12015
+ * Sets the count of nodes in the subtree.
12016
+ * @remarks Time O(1), Space O(1)
12017
+ *
12018
+ * @param value - The new count.
12019
+ */
12020
+ set count(value) {
12021
+ this._count = value;
12022
+ }
12023
+ /**
12024
+ * Gets the position of the node relative to its parent.
12025
+ * @remarks Time O(1), Space O(1)
12026
+ *
12027
+ * @returns The family position (e.g., 'ROOT', 'LEFT', 'RIGHT').
12028
+ */
12029
+ get familyPosition() {
12030
+ if (!this.parent) {
12031
+ return this.left || this.right ? "ROOT" : "ISOLATED";
12032
+ }
12033
+ if (this.parent.left === this) {
12034
+ return this.left || this.right ? "ROOT_LEFT" : "LEFT";
12035
+ } else if (this.parent.right === this) {
12036
+ return this.left || this.right ? "ROOT_RIGHT" : "RIGHT";
12037
+ }
12038
+ return "MAL_NODE";
12039
+ }
11559
12040
  };
11560
12041
  var AVLTreeCounter = class extends AVLTree {
11561
12042
  /**
@@ -11583,7 +12064,7 @@ var dataStructureTyped = (() => {
11583
12064
  this.dfs((node) => sum += node.count);
11584
12065
  return sum;
11585
12066
  }
11586
- _createNode(key, value, count) {
12067
+ createNode(key, value, count) {
11587
12068
  return new AVLTreeCounterNode(key, this._isMapMode ? void 0 : value, count);
11588
12069
  }
11589
12070
  /**
@@ -11752,7 +12233,7 @@ var dataStructureTyped = (() => {
11752
12233
  */
11753
12234
  _createInstance(options) {
11754
12235
  const Ctor = this.constructor;
11755
- return new Ctor([], __spreadValues(__spreadValues({}, this._snapshotOptions()), options != null ? options : {}));
12236
+ return new Ctor([], { ...this._snapshotOptions(), ...options != null ? options : {} });
11756
12237
  }
11757
12238
  /**
11758
12239
  * (Protected) Create a like-kind instance and seed it from an iterable.
@@ -11766,7 +12247,7 @@ var dataStructureTyped = (() => {
11766
12247
  */
11767
12248
  _createLike(iter = [], options) {
11768
12249
  const Ctor = this.constructor;
11769
- return new Ctor(iter, __spreadValues(__spreadValues({}, this._snapshotOptions()), options != null ? options : {}));
12250
+ return new Ctor(iter, { ...this._snapshotOptions(), ...options != null ? options : {} });
11770
12251
  }
11771
12252
  /**
11772
12253
  * (Protected) Normalize input into a node plus its effective value and count.
@@ -11783,9 +12264,9 @@ var dataStructureTyped = (() => {
11783
12264
  const [key, entryValue] = keyNodeOrEntry;
11784
12265
  if (key === void 0 || key === null) return [void 0, void 0];
11785
12266
  const finalValue = value != null ? value : entryValue;
11786
- return [this._createNode(key, finalValue, count), finalValue];
12267
+ return [this.createNode(key, finalValue, count), finalValue];
11787
12268
  }
11788
- return [this._createNode(keyNodeOrEntry, value, count), value];
12269
+ return [this.createNode(keyNodeOrEntry, value, count), value];
11789
12270
  }
11790
12271
  /**
11791
12272
  * (Protected) Swap keys/values/counters between the source and destination nodes.
@@ -11799,7 +12280,7 @@ var dataStructureTyped = (() => {
11799
12280
  destNode = this.ensureNode(destNode);
11800
12281
  if (srcNode && destNode) {
11801
12282
  const { key, value, count, height } = destNode;
11802
- const tempNode = this._createNode(key, value, count);
12283
+ const tempNode = this.createNode(key, value, count);
11803
12284
  if (tempNode) {
11804
12285
  tempNode.height = height;
11805
12286
  destNode.key = srcNode.key;
@@ -11858,7 +12339,7 @@ var dataStructureTyped = (() => {
11858
12339
  * @remarks Complexity — Time: O(n log n) when inserting n elements incrementally; Space: O(n).
11859
12340
  */
11860
12341
  constructor(elements = [], options) {
11861
- super(elements, __spreadValues({
12342
+ super(elements, {
11862
12343
  comparator: (a, b) => {
11863
12344
  if (typeof a === "object" || typeof b === "object") {
11864
12345
  throw TypeError(
@@ -11868,8 +12349,9 @@ var dataStructureTyped = (() => {
11868
12349
  if (a < b) return 1;
11869
12350
  if (a > b) return -1;
11870
12351
  return 0;
11871
- }
11872
- }, options));
12352
+ },
12353
+ ...options
12354
+ });
11873
12355
  }
11874
12356
  };
11875
12357
 
@@ -12828,10 +13310,11 @@ var dataStructureTyped = (() => {
12828
13310
  */
12829
13311
  _createInstance(options) {
12830
13312
  const Ctor = this.constructor;
12831
- const next = new Ctor([], __spreadValues({
13313
+ const next = new Ctor([], {
12832
13314
  toElementFn: this.toElementFn,
12833
- caseSensitive: this.caseSensitive
12834
- }, options != null ? options : {}));
13315
+ caseSensitive: this.caseSensitive,
13316
+ ...options != null ? options : {}
13317
+ });
12835
13318
  return next;
12836
13319
  }
12837
13320
  /**
@@ -12867,10 +13350,10 @@ var dataStructureTyped = (() => {
12867
13350
  yield path;
12868
13351
  }
12869
13352
  for (const [char, childNode] of node.children) {
12870
- yield* __yieldStar(_dfs(childNode, path + char));
13353
+ yield* _dfs(childNode, path + char);
12871
13354
  }
12872
13355
  }
12873
- yield* __yieldStar(_dfs(this.root, ""));
13356
+ yield* _dfs(this.root, "");
12874
13357
  }
12875
13358
  /**
12876
13359
  * (Protected) Normalize a string according to case sensitivity.