queue-typed 2.5.1 → 2.5.3

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 (75) hide show
  1. package/dist/cjs/index.cjs +399 -51
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +398 -50
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +399 -52
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +398 -51
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/common/error.d.ts +9 -0
  10. package/dist/types/common/index.d.ts +1 -1
  11. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +86 -2
  12. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +98 -0
  13. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +189 -13
  14. package/dist/types/data-structures/binary-tree/bst.d.ts +270 -3
  15. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +136 -8
  16. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +42 -0
  17. package/dist/types/data-structures/binary-tree/tree-map.d.ts +1089 -161
  18. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1243 -350
  19. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +980 -255
  20. package/dist/types/data-structures/binary-tree/tree-set.d.ts +1174 -284
  21. package/dist/types/data-structures/graph/directed-graph.d.ts +70 -0
  22. package/dist/types/data-structures/graph/undirected-graph.d.ts +63 -0
  23. package/dist/types/data-structures/hash/hash-map.d.ts +84 -6
  24. package/dist/types/data-structures/heap/heap.d.ts +140 -12
  25. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +126 -0
  26. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +106 -1
  27. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +126 -0
  28. package/dist/types/data-structures/matrix/matrix.d.ts +56 -0
  29. package/dist/types/data-structures/queue/deque.d.ts +127 -0
  30. package/dist/types/data-structures/queue/queue.d.ts +97 -0
  31. package/dist/types/data-structures/stack/stack.d.ts +72 -2
  32. package/dist/types/data-structures/trie/trie.d.ts +84 -0
  33. package/dist/types/interfaces/binary-tree.d.ts +2 -3
  34. package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
  35. package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
  36. package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
  37. package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
  38. package/dist/umd/queue-typed.js +396 -49
  39. package/dist/umd/queue-typed.js.map +1 -1
  40. package/dist/umd/queue-typed.min.js +1 -1
  41. package/dist/umd/queue-typed.min.js.map +1 -1
  42. package/package.json +2 -2
  43. package/src/common/error.ts +19 -1
  44. package/src/common/index.ts +1 -1
  45. package/src/data-structures/base/iterable-element-base.ts +3 -2
  46. package/src/data-structures/binary-tree/avl-tree.ts +99 -5
  47. package/src/data-structures/binary-tree/binary-indexed-tree.ts +102 -4
  48. package/src/data-structures/binary-tree/binary-tree.ts +239 -78
  49. package/src/data-structures/binary-tree/bst.ts +542 -13
  50. package/src/data-structures/binary-tree/red-black-tree.ts +155 -15
  51. package/src/data-structures/binary-tree/segment-tree.ts +42 -0
  52. package/src/data-structures/binary-tree/tree-map.ts +1223 -261
  53. package/src/data-structures/binary-tree/tree-multi-map.ts +939 -30
  54. package/src/data-structures/binary-tree/tree-multi-set.ts +746 -10
  55. package/src/data-structures/binary-tree/tree-set.ts +1018 -99
  56. package/src/data-structures/graph/abstract-graph.ts +2 -2
  57. package/src/data-structures/graph/directed-graph.ts +71 -1
  58. package/src/data-structures/graph/undirected-graph.ts +64 -1
  59. package/src/data-structures/hash/hash-map.ts +102 -16
  60. package/src/data-structures/heap/heap.ts +153 -23
  61. package/src/data-structures/heap/max-heap.ts +2 -2
  62. package/src/data-structures/linked-list/doubly-linked-list.ts +139 -0
  63. package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
  64. package/src/data-structures/linked-list/skip-linked-list.ts +131 -5
  65. package/src/data-structures/matrix/matrix.ts +65 -9
  66. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
  67. package/src/data-structures/queue/deque.ts +130 -0
  68. package/src/data-structures/queue/queue.ts +109 -0
  69. package/src/data-structures/stack/stack.ts +75 -5
  70. package/src/data-structures/trie/trie.ts +86 -2
  71. package/src/interfaces/binary-tree.ts +1 -9
  72. package/src/types/data-structures/binary-tree/bst.ts +1 -0
  73. package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
  74. package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
  75. package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
@@ -5,6 +5,60 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
5
5
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
6
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
7
 
8
+ // src/common/error.ts
9
+ function raise(ErrorClass, message) {
10
+ throw new ErrorClass(message);
11
+ }
12
+ __name(raise, "raise");
13
+ var ERR = {
14
+ // Range / index
15
+ indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
16
+ invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
17
+ // Type / argument
18
+ invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
19
+ comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
20
+ invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
21
+ notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
22
+ invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
23
+ invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
24
+ invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
25
+ reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
26
+ callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
27
+ // State / operation
28
+ invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
29
+ // Matrix
30
+ matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
31
+ matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
32
+ matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
33
+ matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
34
+ matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
35
+ // Order statistic
36
+ orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
37
+ };
38
+
39
+ // src/common/index.ts
40
+ var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
41
+ DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
42
+ DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
43
+ return DFSOperation2;
44
+ })(DFSOperation || {});
45
+ var _Range = class _Range {
46
+ constructor(low, high, includeLow = true, includeHigh = true) {
47
+ this.low = low;
48
+ this.high = high;
49
+ this.includeLow = includeLow;
50
+ this.includeHigh = includeHigh;
51
+ }
52
+ // Determine whether a key is within the range
53
+ isInRange(key, comparator) {
54
+ const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
55
+ const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
56
+ return lowCheck && highCheck;
57
+ }
58
+ };
59
+ __name(_Range, "Range");
60
+ var Range = _Range;
61
+
8
62
  // src/data-structures/base/iterable-element-base.ts
9
63
  var _IterableElementBase = class _IterableElementBase {
10
64
  /**
@@ -27,7 +81,7 @@ var _IterableElementBase = class _IterableElementBase {
27
81
  if (options) {
28
82
  const { toElementFn } = options;
29
83
  if (typeof toElementFn === "function") this._toElementFn = toElementFn;
30
- else if (toElementFn) throw new TypeError("toElementFn must be a function type");
84
+ else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
31
85
  }
32
86
  }
33
87
  /**
@@ -183,7 +237,7 @@ var _IterableElementBase = class _IterableElementBase {
183
237
  acc = initialValue;
184
238
  } else {
185
239
  const first = iter.next();
186
- if (first.done) throw new TypeError("Reduce of empty structure with no initial value");
240
+ if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
187
241
  acc = first.value;
188
242
  index = 1;
189
243
  }
@@ -749,6 +803,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
749
803
 
750
804
 
751
805
 
806
+
807
+
808
+
809
+
810
+
811
+
812
+
752
813
 
753
814
 
754
815
 
@@ -813,6 +874,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
813
874
 
814
875
 
815
876
 
877
+
878
+
879
+
880
+
881
+
882
+
883
+
816
884
 
817
885
 
818
886
 
@@ -883,6 +951,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
883
951
 
884
952
 
885
953
 
954
+
955
+
956
+
957
+
958
+
959
+
960
+
886
961
 
887
962
 
888
963
 
@@ -934,6 +1009,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
934
1009
 
935
1010
 
936
1011
 
1012
+
1013
+
1014
+
1015
+
1016
+
1017
+
1018
+
937
1019
 
938
1020
 
939
1021
 
@@ -1046,6 +1128,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1046
1128
 
1047
1129
 
1048
1130
 
1131
+
1132
+
1133
+
1134
+
1135
+
1136
+
1137
+
1049
1138
 
1050
1139
 
1051
1140
 
@@ -1102,6 +1191,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1102
1191
 
1103
1192
 
1104
1193
 
1194
+
1195
+
1196
+
1197
+
1198
+
1199
+
1200
+
1105
1201
 
1106
1202
 
1107
1203
 
@@ -1147,6 +1243,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1147
1243
 
1148
1244
 
1149
1245
 
1246
+
1247
+
1248
+
1249
+
1250
+
1251
+
1252
+
1150
1253
 
1151
1254
 
1152
1255
 
@@ -1198,6 +1301,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1198
1301
 
1199
1302
 
1200
1303
 
1304
+
1305
+
1306
+
1307
+
1308
+
1309
+
1310
+
1201
1311
 
1202
1312
 
1203
1313
 
@@ -1254,6 +1364,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1254
1364
 
1255
1365
 
1256
1366
 
1367
+
1368
+
1369
+
1370
+
1371
+
1372
+
1373
+
1257
1374
 
1258
1375
 
1259
1376
 
@@ -1318,6 +1435,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1318
1435
 
1319
1436
 
1320
1437
 
1438
+
1439
+
1440
+
1441
+
1442
+
1443
+
1444
+
1321
1445
 
1322
1446
 
1323
1447
 
@@ -1359,6 +1483,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1359
1483
 
1360
1484
 
1361
1485
 
1486
+
1487
+
1488
+
1489
+
1490
+
1491
+
1492
+
1362
1493
 
1363
1494
 
1364
1495
 
@@ -1406,6 +1537,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1406
1537
 
1407
1538
 
1408
1539
 
1540
+
1541
+
1542
+
1543
+
1544
+
1545
+
1546
+
1409
1547
 
1410
1548
 
1411
1549
 
@@ -1619,6 +1757,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1619
1757
 
1620
1758
 
1621
1759
 
1760
+
1761
+
1762
+
1763
+
1764
+
1765
+
1766
+
1622
1767
 
1623
1768
 
1624
1769
 
@@ -1670,6 +1815,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1670
1815
 
1671
1816
 
1672
1817
 
1818
+
1819
+
1820
+
1821
+
1822
+
1823
+
1824
+
1673
1825
 
1674
1826
 
1675
1827
 
@@ -1749,6 +1901,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1749
1901
 
1750
1902
 
1751
1903
 
1904
+
1905
+
1906
+
1907
+
1908
+
1909
+
1910
+
1752
1911
 
1753
1912
 
1754
1913
 
@@ -1899,54 +2058,6 @@ function elementOrPredicate(input, equals) {
1899
2058
  }
1900
2059
  __name(elementOrPredicate, "elementOrPredicate");
1901
2060
 
1902
- // src/common/error.ts
1903
- var ERR = {
1904
- // Range / index
1905
- indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
1906
- invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
1907
- // Type / argument
1908
- invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
1909
- comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
1910
- invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
1911
- notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
1912
- invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
1913
- invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
1914
- invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
1915
- reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
1916
- callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
1917
- // State / operation
1918
- invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
1919
- // Matrix
1920
- matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
1921
- matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
1922
- matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
1923
- matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
1924
- matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
1925
- };
1926
-
1927
- // src/common/index.ts
1928
- var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
1929
- DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
1930
- DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
1931
- return DFSOperation2;
1932
- })(DFSOperation || {});
1933
- var _Range = class _Range {
1934
- constructor(low, high, includeLow = true, includeHigh = true) {
1935
- this.low = low;
1936
- this.high = high;
1937
- this.includeLow = includeLow;
1938
- this.includeHigh = includeHigh;
1939
- }
1940
- // Determine whether a key is within the range
1941
- isInRange(key, comparator) {
1942
- const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
1943
- const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
1944
- return lowCheck && highCheck;
1945
- }
1946
- };
1947
- __name(_Range, "Range");
1948
- var Range = _Range;
1949
-
1950
2061
  // src/data-structures/queue/queue.ts
1951
2062
  var _Queue = class _Queue extends LinearBase {
1952
2063
  /**
@@ -2028,6 +2139,13 @@ var _Queue = class _Queue extends LinearBase {
2028
2139
 
2029
2140
 
2030
2141
 
2142
+
2143
+
2144
+
2145
+
2146
+
2147
+
2148
+
2031
2149
 
2032
2150
 
2033
2151
 
@@ -2075,6 +2193,13 @@ var _Queue = class _Queue extends LinearBase {
2075
2193
 
2076
2194
 
2077
2195
 
2196
+
2197
+
2198
+
2199
+
2200
+
2201
+
2202
+
2078
2203
 
2079
2204
 
2080
2205
 
@@ -2092,6 +2217,14 @@ var _Queue = class _Queue extends LinearBase {
2092
2217
  get first() {
2093
2218
  return this.length > 0 ? this.elements[this._offset] : void 0;
2094
2219
  }
2220
+ /**
2221
+ * Peek at the front element without removing it (alias for `first`).
2222
+ * @remarks Time O(1), Space O(1)
2223
+ * @returns Front element or undefined.
2224
+ */
2225
+ peek() {
2226
+ return this.first;
2227
+ }
2095
2228
  /**
2096
2229
  * Get the last element (back) without removing it.
2097
2230
  * @remarks Time O(1), Space O(1)
@@ -2138,6 +2271,13 @@ var _Queue = class _Queue extends LinearBase {
2138
2271
 
2139
2272
 
2140
2273
 
2274
+
2275
+
2276
+
2277
+
2278
+
2279
+
2280
+
2141
2281
 
2142
2282
 
2143
2283
 
@@ -2197,6 +2337,13 @@ var _Queue = class _Queue extends LinearBase {
2197
2337
 
2198
2338
 
2199
2339
 
2340
+
2341
+
2342
+
2343
+
2344
+
2345
+
2346
+
2200
2347
 
2201
2348
 
2202
2349
 
@@ -2263,6 +2410,13 @@ var _Queue = class _Queue extends LinearBase {
2263
2410
 
2264
2411
 
2265
2412
 
2413
+
2414
+
2415
+
2416
+
2417
+
2418
+
2419
+
2266
2420
 
2267
2421
 
2268
2422
 
@@ -2319,6 +2473,13 @@ var _Queue = class _Queue extends LinearBase {
2319
2473
 
2320
2474
 
2321
2475
 
2476
+
2477
+
2478
+
2479
+
2480
+
2481
+
2482
+
2322
2483
 
2323
2484
 
2324
2485
 
@@ -2368,6 +2529,13 @@ var _Queue = class _Queue extends LinearBase {
2368
2529
 
2369
2530
 
2370
2531
 
2532
+
2533
+
2534
+
2535
+
2536
+
2537
+
2538
+
2371
2539
 
2372
2540
 
2373
2541
 
@@ -2422,6 +2590,21 @@ var _Queue = class _Queue extends LinearBase {
2422
2590
  this._elements[this._offset + index] = newElement;
2423
2591
  return true;
2424
2592
  }
2593
+ /**
2594
+ * Delete the first element that satisfies a predicate.
2595
+ * @remarks Time O(N), Space O(N)
2596
+ * @param predicate - Function (value, index, queue) → boolean to decide deletion.
2597
+ * @returns True if a match was removed.
2598
+ */
2599
+ deleteWhere(predicate) {
2600
+ for (let i = 0; i < this.length; i++) {
2601
+ if (predicate(this._elements[this._offset + i], i, this)) {
2602
+ this.deleteAt(i);
2603
+ return true;
2604
+ }
2605
+ }
2606
+ return false;
2607
+ }
2425
2608
  /**
2426
2609
  * Reverse the queue in-place by compacting then reversing.
2427
2610
  * @remarks Time O(N), Space O(N)
@@ -2458,6 +2641,13 @@ var _Queue = class _Queue extends LinearBase {
2458
2641
 
2459
2642
 
2460
2643
 
2644
+
2645
+
2646
+
2647
+
2648
+
2649
+
2650
+
2461
2651
 
2462
2652
 
2463
2653
 
@@ -2501,6 +2691,13 @@ var _Queue = class _Queue extends LinearBase {
2501
2691
 
2502
2692
 
2503
2693
 
2694
+
2695
+
2696
+
2697
+
2698
+
2699
+
2700
+
2504
2701
 
2505
2702
 
2506
2703
 
@@ -2567,6 +2764,13 @@ var _Queue = class _Queue extends LinearBase {
2567
2764
 
2568
2765
 
2569
2766
 
2767
+
2768
+
2769
+
2770
+
2771
+
2772
+
2773
+
2570
2774
 
2571
2775
 
2572
2776
 
@@ -2617,6 +2821,13 @@ var _Queue = class _Queue extends LinearBase {
2617
2821
 
2618
2822
 
2619
2823
 
2824
+
2825
+
2826
+
2827
+
2828
+
2829
+
2830
+
2620
2831
 
2621
2832
 
2622
2833
 
@@ -2671,6 +2882,13 @@ var _Queue = class _Queue extends LinearBase {
2671
2882
 
2672
2883
 
2673
2884
 
2885
+
2886
+
2887
+
2888
+
2889
+
2890
+
2891
+
2674
2892
 
2675
2893
 
2676
2894
 
@@ -2947,6 +3165,12 @@ var _Deque = class _Deque extends LinearBase {
2947
3165
 
2948
3166
 
2949
3167
 
3168
+
3169
+
3170
+
3171
+
3172
+
3173
+
2950
3174
 
2951
3175
 
2952
3176
 
@@ -2967,6 +3191,31 @@ var _Deque = class _Deque extends LinearBase {
2967
3191
  * console.log(last); // 50;
2968
3192
  *
2969
3193
  * // Length unchanged
3194
+ * console.log(deque.length); // 5;
3195
+ */
3196
+ /**
3197
+ * Peek at the front element without removing it (alias for `first`).
3198
+ * @remarks Time O(1), Space O(1)
3199
+ * @returns Front element or undefined.
3200
+ */
3201
+ peek() {
3202
+ return this.first;
3203
+ }
3204
+ /**
3205
+ * Deque peek at both ends
3206
+ * @example
3207
+ * // Deque peek at both ends
3208
+ * const deque = new Deque<number>([10, 20, 30, 40, 50]);
3209
+ *
3210
+ * // Get first element without removing
3211
+ * const first = deque.at(0);
3212
+ * console.log(first); // 10;
3213
+ *
3214
+ * // Get last element without removing
3215
+ * const last = deque.at(deque.length - 1);
3216
+ * console.log(last); // 50;
3217
+ *
3218
+ * // Length unchanged
2970
3219
  * console.log(deque.length); // 5;
2971
3220
  */
2972
3221
  get first() {
@@ -3001,6 +3250,13 @@ var _Deque = class _Deque extends LinearBase {
3001
3250
 
3002
3251
 
3003
3252
 
3253
+
3254
+
3255
+
3256
+
3257
+
3258
+
3259
+
3004
3260
 
3005
3261
 
3006
3262
 
@@ -3061,6 +3317,13 @@ var _Deque = class _Deque extends LinearBase {
3061
3317
 
3062
3318
 
3063
3319
 
3320
+
3321
+
3322
+
3323
+
3324
+
3325
+
3326
+
3064
3327
 
3065
3328
 
3066
3329
 
@@ -3134,6 +3397,13 @@ var _Deque = class _Deque extends LinearBase {
3134
3397
 
3135
3398
 
3136
3399
 
3400
+
3401
+
3402
+
3403
+
3404
+
3405
+
3406
+
3137
3407
 
3138
3408
 
3139
3409
 
@@ -3194,6 +3464,13 @@ var _Deque = class _Deque extends LinearBase {
3194
3464
 
3195
3465
 
3196
3466
 
3467
+
3468
+
3469
+
3470
+
3471
+
3472
+
3473
+
3197
3474
 
3198
3475
 
3199
3476
 
@@ -3255,6 +3532,13 @@ var _Deque = class _Deque extends LinearBase {
3255
3532
 
3256
3533
 
3257
3534
 
3535
+
3536
+
3537
+
3538
+
3539
+
3540
+
3541
+
3258
3542
 
3259
3543
 
3260
3544
 
@@ -3357,6 +3641,13 @@ var _Deque = class _Deque extends LinearBase {
3357
3641
 
3358
3642
 
3359
3643
 
3644
+
3645
+
3646
+
3647
+
3648
+
3649
+
3650
+
3360
3651
 
3361
3652
 
3362
3653
 
@@ -3399,6 +3690,13 @@ var _Deque = class _Deque extends LinearBase {
3399
3690
 
3400
3691
 
3401
3692
 
3693
+
3694
+
3695
+
3696
+
3697
+
3698
+
3699
+
3402
3700
 
3403
3701
 
3404
3702
 
@@ -3445,6 +3743,13 @@ var _Deque = class _Deque extends LinearBase {
3445
3743
 
3446
3744
 
3447
3745
 
3746
+
3747
+
3748
+
3749
+
3750
+
3751
+
3752
+
3448
3753
 
3449
3754
 
3450
3755
 
@@ -3642,6 +3947,13 @@ var _Deque = class _Deque extends LinearBase {
3642
3947
 
3643
3948
 
3644
3949
 
3950
+
3951
+
3952
+
3953
+
3954
+
3955
+
3956
+
3645
3957
 
3646
3958
 
3647
3959
 
@@ -3726,6 +4038,13 @@ var _Deque = class _Deque extends LinearBase {
3726
4038
 
3727
4039
 
3728
4040
 
4041
+
4042
+
4043
+
4044
+
4045
+
4046
+
4047
+
3729
4048
 
3730
4049
 
3731
4050
 
@@ -3835,6 +4154,13 @@ var _Deque = class _Deque extends LinearBase {
3835
4154
 
3836
4155
 
3837
4156
 
4157
+
4158
+
4159
+
4160
+
4161
+
4162
+
4163
+
3838
4164
 
3839
4165
 
3840
4166
 
@@ -3903,6 +4229,13 @@ var _Deque = class _Deque extends LinearBase {
3903
4229
 
3904
4230
 
3905
4231
 
4232
+
4233
+
4234
+
4235
+
4236
+
4237
+
4238
+
3906
4239
 
3907
4240
 
3908
4241
 
@@ -3954,6 +4287,13 @@ var _Deque = class _Deque extends LinearBase {
3954
4287
 
3955
4288
 
3956
4289
 
4290
+
4291
+
4292
+
4293
+
4294
+
4295
+
4296
+
3957
4297
 
3958
4298
 
3959
4299
 
@@ -4025,6 +4365,13 @@ var _Deque = class _Deque extends LinearBase {
4025
4365
 
4026
4366
 
4027
4367
 
4368
+
4369
+
4370
+
4371
+
4372
+
4373
+
4374
+
4028
4375
 
4029
4376
 
4030
4377
 
@@ -4177,5 +4524,6 @@ exports.ERR = ERR;
4177
4524
  exports.LinkedListQueue = LinkedListQueue;
4178
4525
  exports.Queue = Queue;
4179
4526
  exports.Range = Range;
4527
+ exports.raise = raise;
4180
4528
  //# sourceMappingURL=index.cjs.map
4181
4529
  //# sourceMappingURL=index.cjs.map