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
@@ -3,6 +3,37 @@
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
5
 
6
+ // src/common/error.ts
7
+ function raise(ErrorClass, message) {
8
+ throw new ErrorClass(message);
9
+ }
10
+ __name(raise, "raise");
11
+ var ERR = {
12
+ // Range / index
13
+ indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
14
+ invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
15
+ // Type / argument
16
+ invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
17
+ comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
18
+ invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
19
+ notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
20
+ invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
21
+ invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
22
+ invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
23
+ reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
24
+ callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
25
+ // State / operation
26
+ invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
27
+ // Matrix
28
+ matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
29
+ matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
30
+ matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
31
+ matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
32
+ matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
33
+ // Order statistic
34
+ orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
35
+ };
36
+
6
37
  // src/data-structures/base/iterable-element-base.ts
7
38
  var IterableElementBase = class {
8
39
  static {
@@ -21,7 +52,7 @@ var IterableElementBase = class {
21
52
  if (options) {
22
53
  const { toElementFn } = options;
23
54
  if (typeof toElementFn === "function") this._toElementFn = toElementFn;
24
- else if (toElementFn) throw new TypeError("toElementFn must be a function type");
55
+ else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
25
56
  }
26
57
  }
27
58
  /**
@@ -184,7 +215,7 @@ var IterableElementBase = class {
184
215
  acc = initialValue;
185
216
  } else {
186
217
  const first = iter.next();
187
- if (first.done) throw new TypeError("Reduce of empty structure with no initial value");
218
+ if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
188
219
  acc = first.value;
189
220
  index = 1;
190
221
  }
@@ -755,6 +786,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
755
786
 
756
787
 
757
788
 
789
+
790
+
791
+
792
+
758
793
 
759
794
 
760
795
 
@@ -818,6 +853,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
818
853
 
819
854
 
820
855
 
856
+
857
+
858
+
859
+
821
860
 
822
861
 
823
862
 
@@ -886,6 +925,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
886
925
 
887
926
 
888
927
 
928
+
929
+
930
+
931
+
889
932
 
890
933
 
891
934
 
@@ -936,6 +979,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
936
979
 
937
980
 
938
981
 
982
+
983
+
984
+
985
+
939
986
 
940
987
 
941
988
 
@@ -1047,6 +1094,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1047
1094
 
1048
1095
 
1049
1096
 
1097
+
1098
+
1099
+
1100
+
1050
1101
 
1051
1102
 
1052
1103
 
@@ -1102,6 +1153,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1102
1153
 
1103
1154
 
1104
1155
 
1156
+
1157
+
1158
+
1159
+
1105
1160
 
1106
1161
 
1107
1162
 
@@ -1146,6 +1201,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1146
1201
 
1147
1202
 
1148
1203
 
1204
+
1205
+
1206
+
1207
+
1149
1208
 
1150
1209
 
1151
1210
 
@@ -1196,6 +1255,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1196
1255
 
1197
1256
 
1198
1257
 
1258
+
1259
+
1260
+
1261
+
1199
1262
 
1200
1263
 
1201
1264
 
@@ -1251,6 +1314,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1251
1314
 
1252
1315
 
1253
1316
 
1317
+
1318
+
1319
+
1320
+
1254
1321
 
1255
1322
 
1256
1323
 
@@ -1314,6 +1381,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1314
1381
 
1315
1382
 
1316
1383
 
1384
+
1385
+
1386
+
1387
+
1317
1388
 
1318
1389
 
1319
1390
 
@@ -1354,6 +1425,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1354
1425
 
1355
1426
 
1356
1427
 
1428
+
1429
+
1430
+
1431
+
1357
1432
 
1358
1433
 
1359
1434
 
@@ -1400,6 +1475,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1400
1475
 
1401
1476
 
1402
1477
 
1478
+
1479
+
1480
+
1481
+
1403
1482
 
1404
1483
 
1405
1484
 
@@ -1612,6 +1691,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1612
1691
 
1613
1692
 
1614
1693
 
1694
+
1695
+
1696
+
1697
+
1615
1698
 
1616
1699
 
1617
1700
 
@@ -1662,6 +1745,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1662
1745
 
1663
1746
 
1664
1747
 
1748
+
1749
+
1750
+
1751
+
1665
1752
 
1666
1753
 
1667
1754
 
@@ -1740,6 +1827,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
1740
1827
 
1741
1828
 
1742
1829
 
1830
+
1831
+
1832
+
1833
+
1743
1834
 
1744
1835
 
1745
1836
 
@@ -2056,6 +2147,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2056
2147
 
2057
2148
 
2058
2149
 
2150
+
2151
+
2152
+
2153
+
2059
2154
 
2060
2155
 
2061
2156
 
@@ -2121,6 +2216,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2121
2216
 
2122
2217
 
2123
2218
 
2219
+
2220
+
2221
+
2222
+
2124
2223
 
2125
2224
 
2126
2225
 
@@ -2185,6 +2284,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2185
2284
 
2186
2285
 
2187
2286
 
2287
+
2288
+
2289
+
2290
+
2188
2291
 
2189
2292
 
2190
2293
 
@@ -2240,6 +2343,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2240
2343
 
2241
2344
 
2242
2345
 
2346
+
2347
+
2348
+
2349
+
2243
2350
 
2244
2351
 
2245
2352
 
@@ -2324,6 +2431,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2324
2431
 
2325
2432
 
2326
2433
 
2434
+
2435
+
2436
+
2437
+
2327
2438
 
2328
2439
 
2329
2440
 
@@ -2369,6 +2480,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2369
2480
 
2370
2481
 
2371
2482
 
2483
+
2484
+
2485
+
2486
+
2372
2487
 
2373
2488
 
2374
2489
 
@@ -2445,6 +2560,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2445
2560
 
2446
2561
 
2447
2562
 
2563
+
2564
+
2565
+
2566
+
2448
2567
 
2449
2568
 
2450
2569
 
@@ -2549,6 +2668,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2549
2668
 
2550
2669
 
2551
2670
 
2671
+
2672
+
2673
+
2674
+
2552
2675
 
2553
2676
 
2554
2677
 
@@ -2600,6 +2723,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2600
2723
 
2601
2724
 
2602
2725
 
2726
+
2727
+
2728
+
2729
+
2603
2730
 
2604
2731
 
2605
2732
 
@@ -2653,6 +2780,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2653
2780
 
2654
2781
 
2655
2782
 
2783
+
2784
+
2785
+
2786
+
2656
2787
 
2657
2788
 
2658
2789
 
@@ -2693,6 +2824,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2693
2824
 
2694
2825
 
2695
2826
 
2827
+
2828
+
2829
+
2830
+
2696
2831
 
2697
2832
 
2698
2833
 
@@ -2737,6 +2872,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2737
2872
 
2738
2873
 
2739
2874
 
2875
+
2876
+
2877
+
2878
+
2740
2879
 
2741
2880
 
2742
2881
 
@@ -2785,6 +2924,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2785
2924
 
2786
2925
 
2787
2926
 
2927
+
2928
+
2929
+
2930
+
2788
2931
 
2789
2932
 
2790
2933
 
@@ -2836,6 +2979,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2836
2979
 
2837
2980
 
2838
2981
 
2982
+
2983
+
2984
+
2985
+
2839
2986
 
2840
2987
 
2841
2988
 
@@ -2895,6 +3042,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2895
3042
 
2896
3043
 
2897
3044
 
3045
+
3046
+
3047
+
3048
+
2898
3049
 
2899
3050
 
2900
3051
 
@@ -2944,6 +3095,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
2944
3095
 
2945
3096
 
2946
3097
 
3098
+
3099
+
3100
+
3101
+
2947
3102
 
2948
3103
 
2949
3104
 
@@ -3012,6 +3167,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
3012
3167
 
3013
3168
 
3014
3169
 
3170
+
3171
+
3172
+
3173
+
3015
3174
 
3016
3175
 
3017
3176
 
@@ -3120,31 +3279,6 @@ var DoublyLinkedList = class extends LinearLinkedBase {
3120
3279
  }
3121
3280
  };
3122
3281
 
3123
- // src/common/error.ts
3124
- var ERR = {
3125
- // Range / index
3126
- indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
3127
- invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
3128
- // Type / argument
3129
- invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
3130
- comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
3131
- invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
3132
- notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
3133
- invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
3134
- invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
3135
- invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
3136
- reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
3137
- callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
3138
- // State / operation
3139
- invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
3140
- // Matrix
3141
- matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
3142
- matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
3143
- matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
3144
- matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
3145
- matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
3146
- };
3147
-
3148
3282
  // src/data-structures/base/iterable-entry-base.ts
3149
3283
  var IterableEntryBase = class {
3150
3284
  static {
@@ -3362,7 +3496,7 @@ var SkipList = class _SkipList extends IterableEntryBase {
3362
3496
  [k, v] = toEntryFn(item);
3363
3497
  } else {
3364
3498
  if (!Array.isArray(item) || item.length < 2) {
3365
- throw new TypeError(ERR.invalidEntry("SkipList"));
3499
+ raise(TypeError, ERR.invalidEntry("SkipList"));
3366
3500
  }
3367
3501
  [k, v] = item;
3368
3502
  }
@@ -3375,7 +3509,7 @@ var SkipList = class _SkipList extends IterableEntryBase {
3375
3509
  static createDefaultComparator() {
3376
3510
  return (a, b) => {
3377
3511
  if (typeof a === "number" && typeof b === "number") {
3378
- if (Number.isNaN(a) || Number.isNaN(b)) throw new TypeError(ERR.invalidNaN("SkipList"));
3512
+ if (Number.isNaN(a) || Number.isNaN(b)) raise(TypeError, ERR.invalidNaN("SkipList"));
3379
3513
  return a - b;
3380
3514
  }
3381
3515
  if (typeof a === "string" && typeof b === "string") {
@@ -3383,13 +3517,13 @@ var SkipList = class _SkipList extends IterableEntryBase {
3383
3517
  }
3384
3518
  if (a instanceof Date && b instanceof Date) {
3385
3519
  const ta = a.getTime(), tb = b.getTime();
3386
- if (Number.isNaN(ta) || Number.isNaN(tb)) throw new TypeError(ERR.invalidDate("SkipList"));
3520
+ if (Number.isNaN(ta) || Number.isNaN(tb)) raise(TypeError, ERR.invalidDate("SkipList"));
3387
3521
  return ta - tb;
3388
3522
  }
3389
3523
  if (typeof a === "bigint" && typeof b === "bigint") {
3390
3524
  return a < b ? -1 : a > b ? 1 : 0;
3391
3525
  }
3392
- throw new TypeError(ERR.comparatorRequired("SkipList"));
3526
+ raise(TypeError, ERR.comparatorRequired("SkipList"));
3393
3527
  };
3394
3528
  }
3395
3529
  // ─── Internal state ──────────────────────────────────────────
@@ -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