data-structure-typed 2.5.1 → 2.5.2

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 (172) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/README.md +75 -17
  3. package/dist/cjs/binary-tree.cjs +2723 -139
  4. package/dist/cjs/graph.cjs +192 -6
  5. package/dist/cjs/hash.cjs +63 -15
  6. package/dist/cjs/heap.cjs +93 -31
  7. package/dist/cjs/index.cjs +3514 -379
  8. package/dist/cjs/linked-list.cjs +237 -31
  9. package/dist/cjs/matrix.cjs +47 -9
  10. package/dist/cjs/priority-queue.cjs +92 -30
  11. package/dist/cjs/queue.cjs +176 -2
  12. package/dist/cjs/stack.cjs +48 -2
  13. package/dist/cjs/trie.cjs +78 -28
  14. package/dist/cjs-legacy/binary-tree.cjs +2725 -136
  15. package/dist/cjs-legacy/graph.cjs +192 -6
  16. package/dist/cjs-legacy/hash.cjs +63 -15
  17. package/dist/cjs-legacy/heap.cjs +93 -31
  18. package/dist/cjs-legacy/index.cjs +3389 -249
  19. package/dist/cjs-legacy/linked-list.cjs +237 -31
  20. package/dist/cjs-legacy/matrix.cjs +47 -9
  21. package/dist/cjs-legacy/priority-queue.cjs +92 -30
  22. package/dist/cjs-legacy/queue.cjs +176 -2
  23. package/dist/cjs-legacy/stack.cjs +48 -2
  24. package/dist/cjs-legacy/trie.cjs +78 -28
  25. package/dist/esm/binary-tree.mjs +2723 -139
  26. package/dist/esm/graph.mjs +192 -6
  27. package/dist/esm/hash.mjs +63 -15
  28. package/dist/esm/heap.mjs +93 -31
  29. package/dist/esm/index.mjs +3514 -380
  30. package/dist/esm/linked-list.mjs +237 -31
  31. package/dist/esm/matrix.mjs +47 -9
  32. package/dist/esm/priority-queue.mjs +92 -30
  33. package/dist/esm/queue.mjs +176 -2
  34. package/dist/esm/stack.mjs +48 -2
  35. package/dist/esm/trie.mjs +78 -28
  36. package/dist/esm-legacy/binary-tree.mjs +2725 -136
  37. package/dist/esm-legacy/graph.mjs +192 -6
  38. package/dist/esm-legacy/hash.mjs +63 -15
  39. package/dist/esm-legacy/heap.mjs +93 -31
  40. package/dist/esm-legacy/index.mjs +3389 -250
  41. package/dist/esm-legacy/linked-list.mjs +237 -31
  42. package/dist/esm-legacy/matrix.mjs +47 -9
  43. package/dist/esm-legacy/priority-queue.mjs +92 -30
  44. package/dist/esm-legacy/queue.mjs +176 -2
  45. package/dist/esm-legacy/stack.mjs +48 -2
  46. package/dist/esm-legacy/trie.mjs +78 -28
  47. package/dist/types/common/error.d.ts +9 -0
  48. package/dist/types/common/index.d.ts +1 -1
  49. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +48 -0
  50. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
  51. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +102 -2
  52. package/dist/types/data-structures/binary-tree/bst.d.ts +195 -0
  53. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +76 -0
  54. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
  55. package/dist/types/data-structures/binary-tree/tree-map.d.ts +528 -0
  56. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +531 -6
  57. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +435 -6
  58. package/dist/types/data-structures/binary-tree/tree-set.d.ts +505 -0
  59. package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
  60. package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
  61. package/dist/types/data-structures/hash/hash-map.d.ts +44 -0
  62. package/dist/types/data-structures/heap/heap.d.ts +56 -0
  63. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +68 -0
  64. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +60 -0
  65. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
  66. package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
  67. package/dist/types/data-structures/queue/deque.d.ts +60 -0
  68. package/dist/types/data-structures/queue/queue.d.ts +48 -0
  69. package/dist/types/data-structures/stack/stack.d.ts +40 -0
  70. package/dist/types/data-structures/trie/trie.d.ts +48 -0
  71. package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
  72. package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
  73. package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
  74. package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
  75. package/dist/umd/data-structure-typed.js +3404 -265
  76. package/dist/umd/data-structure-typed.min.js +5 -5
  77. package/docs-site-docusaurus/docs/api/classes/AVLTree.md +650 -136
  78. package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
  79. package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +71 -71
  80. package/docs-site-docusaurus/docs/api/classes/BST.md +591 -129
  81. package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
  82. package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
  83. package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +107 -107
  84. package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
  85. package/docs-site-docusaurus/docs/api/classes/Deque.md +82 -82
  86. package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +82 -82
  87. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +74 -74
  88. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
  89. package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
  90. package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
  91. package/docs-site-docusaurus/docs/api/classes/HashMap.md +47 -47
  92. package/docs-site-docusaurus/docs/api/classes/Heap.md +45 -45
  93. package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
  94. package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +33 -33
  95. package/docs-site-docusaurus/docs/api/classes/LinearBase.md +50 -50
  96. package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +55 -55
  97. package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +49 -49
  98. package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
  99. package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +78 -78
  100. package/docs-site-docusaurus/docs/api/classes/MapGraph.md +82 -82
  101. package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
  102. package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +45 -45
  103. package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +45 -45
  104. package/docs-site-docusaurus/docs/api/classes/MinHeap.md +45 -45
  105. package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +45 -45
  106. package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
  107. package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +44 -44
  108. package/docs-site-docusaurus/docs/api/classes/Queue.md +60 -60
  109. package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +660 -146
  110. package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
  111. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +78 -78
  112. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
  113. package/docs-site-docusaurus/docs/api/classes/SkipList.md +44 -44
  114. package/docs-site-docusaurus/docs/api/classes/Stack.md +39 -39
  115. package/docs-site-docusaurus/docs/api/classes/TreeMap.md +165 -33
  116. package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +162 -46
  117. package/docs-site-docusaurus/docs/api/classes/TreeSet.md +161 -32
  118. package/docs-site-docusaurus/docs/api/classes/Trie.md +47 -47
  119. package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
  120. package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +81 -81
  121. package/docs-site-docusaurus/docs/guide/architecture.md +2 -0
  122. package/docs-site-docusaurus/docs/guide/concepts.md +32 -1
  123. package/docs-site-docusaurus/docs/guide/faq.md +180 -0
  124. package/docs-site-docusaurus/docs/guide/guides.md +40 -54
  125. package/docs-site-docusaurus/docs/guide/installation.md +2 -0
  126. package/docs-site-docusaurus/docs/guide/integrations.md +2 -0
  127. package/docs-site-docusaurus/docs/guide/overview.md +7 -0
  128. package/docs-site-docusaurus/docs/guide/performance.md +2 -0
  129. package/docs-site-docusaurus/docs/guide/quick-start.md +31 -0
  130. package/docs-site-docusaurus/docs/guide/use-cases/_category_.json +6 -0
  131. package/docs-site-docusaurus/docs/guide/use-cases/array-sort-alternative.md +158 -0
  132. package/docs-site-docusaurus/docs/guide/use-cases/heap-vs-sorting.md +92 -0
  133. package/docs-site-docusaurus/docs/guide/use-cases/map-vs-treemap.md +151 -0
  134. package/docs-site-docusaurus/docs/guide/use-cases/priority-queue-typescript.md +113 -0
  135. package/docs-site-docusaurus/docs/guide/use-cases/treemap-javascript.md +151 -0
  136. package/docs-site-docusaurus/docusaurus.config.ts +1 -1
  137. package/docs-site-docusaurus/src/pages/index.tsx +51 -2
  138. package/docs-site-docusaurus/static/llms.txt +37 -0
  139. package/llms.txt +37 -0
  140. package/package.json +64 -56
  141. package/src/common/error.ts +19 -1
  142. package/src/common/index.ts +1 -1
  143. package/src/data-structures/base/iterable-element-base.ts +3 -2
  144. package/src/data-structures/binary-tree/avl-tree.ts +47 -0
  145. package/src/data-structures/binary-tree/binary-indexed-tree.ts +46 -4
  146. package/src/data-structures/binary-tree/binary-tree.ts +79 -4
  147. package/src/data-structures/binary-tree/bst.ts +441 -6
  148. package/src/data-structures/binary-tree/red-black-tree.ts +73 -0
  149. package/src/data-structures/binary-tree/segment-tree.ts +18 -0
  150. package/src/data-structures/binary-tree/tree-map.ts +434 -9
  151. package/src/data-structures/binary-tree/tree-multi-map.ts +426 -5
  152. package/src/data-structures/binary-tree/tree-multi-set.ts +350 -6
  153. package/src/data-structures/binary-tree/tree-set.ts +410 -8
  154. package/src/data-structures/graph/abstract-graph.ts +2 -2
  155. package/src/data-structures/graph/directed-graph.ts +30 -0
  156. package/src/data-structures/graph/undirected-graph.ts +27 -0
  157. package/src/data-structures/hash/hash-map.ts +35 -4
  158. package/src/data-structures/heap/heap.ts +46 -4
  159. package/src/data-structures/heap/max-heap.ts +2 -2
  160. package/src/data-structures/linked-list/doubly-linked-list.ts +51 -0
  161. package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
  162. package/src/data-structures/linked-list/skip-linked-list.ts +59 -5
  163. package/src/data-structures/matrix/matrix.ts +33 -9
  164. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
  165. package/src/data-structures/queue/deque.ts +45 -0
  166. package/src/data-structures/queue/queue.ts +36 -0
  167. package/src/data-structures/stack/stack.ts +30 -0
  168. package/src/data-structures/trie/trie.ts +38 -2
  169. package/src/types/data-structures/binary-tree/bst.ts +1 -0
  170. package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
  171. package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
  172. package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
@@ -10,6 +10,37 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
10
10
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
11
11
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
12
12
 
13
+ // src/common/error.ts
14
+ function raise(ErrorClass, message) {
15
+ throw new ErrorClass(message);
16
+ }
17
+ __name(raise, "raise");
18
+ var ERR = {
19
+ // Range / index
20
+ indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
21
+ invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
22
+ // Type / argument
23
+ invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
24
+ comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
25
+ invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
26
+ notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
27
+ invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
28
+ invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
29
+ invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
30
+ reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
31
+ callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
32
+ // State / operation
33
+ invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
34
+ // Matrix
35
+ matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
36
+ matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
37
+ matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
38
+ matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
39
+ matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
40
+ // Order statistic
41
+ orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
42
+ };
43
+
13
44
  // src/data-structures/base/iterable-element-base.ts
14
45
  var _IterableElementBase = class _IterableElementBase {
15
46
  /**
@@ -32,7 +63,7 @@ var _IterableElementBase = class _IterableElementBase {
32
63
  if (options) {
33
64
  const { toElementFn } = options;
34
65
  if (typeof toElementFn === "function") this._toElementFn = toElementFn;
35
- else if (toElementFn) throw new TypeError("toElementFn must be a function type");
66
+ else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
36
67
  }
37
68
  }
38
69
  /**
@@ -188,7 +219,7 @@ var _IterableElementBase = class _IterableElementBase {
188
219
  acc = initialValue;
189
220
  } else {
190
221
  const first = iter.next();
191
- if (first.done) throw new TypeError("Reduce of empty structure with no initial value");
222
+ if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
192
223
  acc = first.value;
193
224
  index = 1;
194
225
  }
@@ -756,6 +787,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
756
787
 
757
788
 
758
789
 
790
+
791
+
792
+
793
+
759
794
 
760
795
 
761
796
 
@@ -819,6 +854,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
819
854
 
820
855
 
821
856
 
857
+
858
+
859
+
860
+
822
861
 
823
862
 
824
863
 
@@ -888,6 +927,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
888
927
 
889
928
 
890
929
 
930
+
931
+
932
+
933
+
891
934
 
892
935
 
893
936
 
@@ -938,6 +981,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
938
981
 
939
982
 
940
983
 
984
+
985
+
986
+
987
+
941
988
 
942
989
 
943
990
 
@@ -1049,6 +1096,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1049
1096
 
1050
1097
 
1051
1098
 
1099
+
1100
+
1101
+
1102
+
1052
1103
 
1053
1104
 
1054
1105
 
@@ -1104,6 +1155,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1104
1155
 
1105
1156
 
1106
1157
 
1158
+
1159
+
1160
+
1161
+
1107
1162
 
1108
1163
 
1109
1164
 
@@ -1148,6 +1203,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1148
1203
 
1149
1204
 
1150
1205
 
1206
+
1207
+
1208
+
1209
+
1151
1210
 
1152
1211
 
1153
1212
 
@@ -1198,6 +1257,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1198
1257
 
1199
1258
 
1200
1259
 
1260
+
1261
+
1262
+
1263
+
1201
1264
 
1202
1265
 
1203
1266
 
@@ -1253,6 +1316,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1253
1316
 
1254
1317
 
1255
1318
 
1319
+
1320
+
1321
+
1322
+
1256
1323
 
1257
1324
 
1258
1325
 
@@ -1316,6 +1383,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1316
1383
 
1317
1384
 
1318
1385
 
1386
+
1387
+
1388
+
1389
+
1319
1390
 
1320
1391
 
1321
1392
 
@@ -1356,6 +1427,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1356
1427
 
1357
1428
 
1358
1429
 
1430
+
1431
+
1432
+
1433
+
1359
1434
 
1360
1435
 
1361
1436
 
@@ -1402,6 +1477,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1402
1477
 
1403
1478
 
1404
1479
 
1480
+
1481
+
1482
+
1483
+
1405
1484
 
1406
1485
 
1407
1486
 
@@ -1614,6 +1693,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1614
1693
 
1615
1694
 
1616
1695
 
1696
+
1697
+
1698
+
1699
+
1617
1700
 
1618
1701
 
1619
1702
 
@@ -1664,6 +1747,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1664
1747
 
1665
1748
 
1666
1749
 
1750
+
1751
+
1752
+
1753
+
1667
1754
 
1668
1755
 
1669
1756
 
@@ -1742,6 +1829,10 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1742
1829
 
1743
1830
 
1744
1831
 
1832
+
1833
+
1834
+
1835
+
1745
1836
 
1746
1837
 
1747
1838
 
@@ -2058,6 +2149,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2058
2149
 
2059
2150
 
2060
2151
 
2152
+
2153
+
2154
+
2155
+
2061
2156
 
2062
2157
 
2063
2158
 
@@ -2123,6 +2218,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2123
2218
 
2124
2219
 
2125
2220
 
2221
+
2222
+
2223
+
2224
+
2126
2225
 
2127
2226
 
2128
2227
 
@@ -2187,6 +2286,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2187
2286
 
2188
2287
 
2189
2288
 
2289
+
2290
+
2291
+
2292
+
2190
2293
 
2191
2294
 
2192
2295
 
@@ -2242,6 +2345,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2242
2345
 
2243
2346
 
2244
2347
 
2348
+
2349
+
2350
+
2351
+
2245
2352
 
2246
2353
 
2247
2354
 
@@ -2326,6 +2433,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2326
2433
 
2327
2434
 
2328
2435
 
2436
+
2437
+
2438
+
2439
+
2329
2440
 
2330
2441
 
2331
2442
 
@@ -2371,6 +2482,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2371
2482
 
2372
2483
 
2373
2484
 
2485
+
2486
+
2487
+
2488
+
2374
2489
 
2375
2490
 
2376
2491
 
@@ -2447,6 +2562,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2447
2562
 
2448
2563
 
2449
2564
 
2565
+
2566
+
2567
+
2568
+
2450
2569
 
2451
2570
 
2452
2571
 
@@ -2551,6 +2670,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2551
2670
 
2552
2671
 
2553
2672
 
2673
+
2674
+
2675
+
2676
+
2554
2677
 
2555
2678
 
2556
2679
 
@@ -2602,6 +2725,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2602
2725
 
2603
2726
 
2604
2727
 
2728
+
2729
+
2730
+
2731
+
2605
2732
 
2606
2733
 
2607
2734
 
@@ -2655,6 +2782,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2655
2782
 
2656
2783
 
2657
2784
 
2785
+
2786
+
2787
+
2788
+
2658
2789
 
2659
2790
 
2660
2791
 
@@ -2695,6 +2826,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2695
2826
 
2696
2827
 
2697
2828
 
2829
+
2830
+
2831
+
2832
+
2698
2833
 
2699
2834
 
2700
2835
 
@@ -2739,6 +2874,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2739
2874
 
2740
2875
 
2741
2876
 
2877
+
2878
+
2879
+
2880
+
2742
2881
 
2743
2882
 
2744
2883
 
@@ -2787,6 +2926,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2787
2926
 
2788
2927
 
2789
2928
 
2929
+
2930
+
2931
+
2932
+
2790
2933
 
2791
2934
 
2792
2935
 
@@ -2838,6 +2981,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2838
2981
 
2839
2982
 
2840
2983
 
2984
+
2985
+
2986
+
2987
+
2841
2988
 
2842
2989
 
2843
2990
 
@@ -2897,6 +3044,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2897
3044
 
2898
3045
 
2899
3046
 
3047
+
3048
+
3049
+
3050
+
2900
3051
 
2901
3052
 
2902
3053
 
@@ -2946,6 +3097,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2946
3097
 
2947
3098
 
2948
3099
 
3100
+
3101
+
3102
+
3103
+
2949
3104
 
2950
3105
 
2951
3106
 
@@ -3014,6 +3169,10 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
3014
3169
 
3015
3170
 
3016
3171
 
3172
+
3173
+
3174
+
3175
+
3017
3176
 
3018
3177
 
3019
3178
 
@@ -3124,31 +3283,6 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
3124
3283
  __name(_DoublyLinkedList, "DoublyLinkedList");
3125
3284
  var DoublyLinkedList = _DoublyLinkedList;
3126
3285
 
3127
- // src/common/error.ts
3128
- var ERR = {
3129
- // Range / index
3130
- indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
3131
- invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
3132
- // Type / argument
3133
- invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
3134
- comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
3135
- invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
3136
- notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
3137
- invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
3138
- invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
3139
- invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
3140
- reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
3141
- callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
3142
- // State / operation
3143
- invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
3144
- // Matrix
3145
- matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
3146
- matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
3147
- matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
3148
- matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
3149
- matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
3150
- };
3151
-
3152
3286
  // src/data-structures/base/iterable-entry-base.ts
3153
3287
  var _IterableEntryBase = class _IterableEntryBase {
3154
3288
  /**
@@ -3368,7 +3502,7 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3368
3502
  [k, v] = toEntryFn(item);
3369
3503
  } else {
3370
3504
  if (!Array.isArray(item) || item.length < 2) {
3371
- throw new TypeError(ERR.invalidEntry("SkipList"));
3505
+ raise(TypeError, ERR.invalidEntry("SkipList"));
3372
3506
  }
3373
3507
  [k, v] = item;
3374
3508
  }
@@ -3381,7 +3515,7 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3381
3515
  static createDefaultComparator() {
3382
3516
  return (a, b) => {
3383
3517
  if (typeof a === "number" && typeof b === "number") {
3384
- if (Number.isNaN(a) || Number.isNaN(b)) throw new TypeError(ERR.invalidNaN("SkipList"));
3518
+ if (Number.isNaN(a) || Number.isNaN(b)) raise(TypeError, ERR.invalidNaN("SkipList"));
3385
3519
  return a - b;
3386
3520
  }
3387
3521
  if (typeof a === "string" && typeof b === "string") {
@@ -3389,13 +3523,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3389
3523
  }
3390
3524
  if (a instanceof Date && b instanceof Date) {
3391
3525
  const ta = a.getTime(), tb = b.getTime();
3392
- if (Number.isNaN(ta) || Number.isNaN(tb)) throw new TypeError(ERR.invalidDate("SkipList"));
3526
+ if (Number.isNaN(ta) || Number.isNaN(tb)) raise(TypeError, ERR.invalidDate("SkipList"));
3393
3527
  return ta - tb;
3394
3528
  }
3395
3529
  if (typeof a === "bigint" && typeof b === "bigint") {
3396
3530
  return a < b ? -1 : a > b ? 1 : 0;
3397
3531
  }
3398
- throw new TypeError(ERR.comparatorRequired("SkipList"));
3532
+ raise(TypeError, ERR.comparatorRequired("SkipList"));
3399
3533
  };
3400
3534
  }
3401
3535
  // ─── Size & lifecycle ────────────────────────────────────────
@@ -3436,6 +3570,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3436
3570
 
3437
3571
 
3438
3572
 
3573
+
3574
+
3575
+
3576
+
3439
3577
 
3440
3578
 
3441
3579
 
@@ -3474,6 +3612,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3474
3612
 
3475
3613
 
3476
3614
 
3615
+
3616
+
3617
+
3618
+
3477
3619
 
3478
3620
 
3479
3621
 
@@ -3515,6 +3657,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3515
3657
 
3516
3658
 
3517
3659
 
3660
+
3661
+
3662
+
3663
+
3518
3664
 
3519
3665
 
3520
3666
 
@@ -3564,6 +3710,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3564
3710
 
3565
3711
 
3566
3712
 
3713
+
3714
+
3715
+
3716
+
3567
3717
 
3568
3718
 
3569
3719
 
@@ -3638,6 +3788,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3638
3788
 
3639
3789
 
3640
3790
 
3791
+
3792
+
3793
+
3794
+
3641
3795
 
3642
3796
 
3643
3797
 
@@ -3697,6 +3851,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3697
3851
 
3698
3852
 
3699
3853
 
3854
+
3855
+
3856
+
3857
+
3700
3858
 
3701
3859
 
3702
3860
 
@@ -3739,6 +3897,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3739
3897
 
3740
3898
 
3741
3899
 
3900
+
3901
+
3902
+
3903
+
3742
3904
 
3743
3905
 
3744
3906
 
@@ -3801,6 +3963,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3801
3963
 
3802
3964
 
3803
3965
 
3966
+
3967
+
3968
+
3969
+
3804
3970
 
3805
3971
 
3806
3972
 
@@ -3843,6 +4009,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3843
4009
 
3844
4010
 
3845
4011
 
4012
+
4013
+
4014
+
4015
+
3846
4016
 
3847
4017
 
3848
4018
 
@@ -3887,6 +4057,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3887
4057
 
3888
4058
 
3889
4059
 
4060
+
4061
+
4062
+
4063
+
3890
4064
 
3891
4065
 
3892
4066
 
@@ -3929,6 +4103,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3929
4103
 
3930
4104
 
3931
4105
 
4106
+
4107
+
4108
+
4109
+
3932
4110
 
3933
4111
 
3934
4112
 
@@ -3974,6 +4152,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3974
4152
 
3975
4153
 
3976
4154
 
4155
+
4156
+
4157
+
4158
+
3977
4159
 
3978
4160
 
3979
4161
 
@@ -4024,6 +4206,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4024
4206
 
4025
4207
 
4026
4208
 
4209
+
4210
+
4211
+
4212
+
4027
4213
 
4028
4214
 
4029
4215
 
@@ -4072,6 +4258,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4072
4258
 
4073
4259
 
4074
4260
 
4261
+
4262
+
4263
+
4264
+
4075
4265
 
4076
4266
 
4077
4267
 
@@ -4119,6 +4309,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4119
4309
 
4120
4310
 
4121
4311
 
4312
+
4313
+
4314
+
4315
+
4122
4316
 
4123
4317
 
4124
4318
 
@@ -4172,6 +4366,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4172
4366
 
4173
4367
 
4174
4368
 
4369
+
4370
+
4371
+
4372
+
4175
4373
 
4176
4374
 
4177
4375
 
@@ -4233,6 +4431,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4233
4431
 
4234
4432
 
4235
4433
 
4434
+
4435
+
4436
+
4437
+
4236
4438
 
4237
4439
 
4238
4440
 
@@ -4278,6 +4480,10 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4278
4480
 
4279
4481
 
4280
4482
 
4483
+
4484
+
4485
+
4486
+
4281
4487
 
4282
4488
 
4283
4489