@oscarpalmer/atoms 0.212.0 → 0.214.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 (258) hide show
  1. package/dist/array/difference.d.mts +1 -1
  2. package/dist/array/difference.mjs +3 -2
  3. package/dist/array/exists.d.mts +1 -1
  4. package/dist/array/exists.mjs +3 -2
  5. package/dist/array/filter.d.mts +1 -1
  6. package/dist/array/filter.mjs +1 -0
  7. package/dist/array/find.d.mts +1 -1
  8. package/dist/array/find.mjs +4 -3
  9. package/dist/array/first.d.mts +1 -1
  10. package/dist/array/flatten.d.mts +1 -1
  11. package/dist/array/group-by.d.mts +1 -1
  12. package/dist/array/index.d.mts +2 -2
  13. package/dist/array/insert.mjs +3 -2
  14. package/dist/array/intersection.mjs +3 -2
  15. package/dist/array/last.d.mts +1 -1
  16. package/dist/array/move.d.mts +1 -1
  17. package/dist/array/partition.d.mts +1 -1
  18. package/dist/array/partition.mjs +1 -0
  19. package/dist/array/push.mjs +3 -2
  20. package/dist/array/select.d.mts +10 -12
  21. package/dist/array/select.mjs +1 -0
  22. package/dist/array/single.d.mts +1 -1
  23. package/dist/array/single.mjs +1 -0
  24. package/dist/array/slice.d.mts +1 -1
  25. package/dist/array/slice.mjs +4 -5
  26. package/dist/array/sort.d.mts +4 -103
  27. package/dist/array/sort.mjs +6 -14
  28. package/dist/array/splice.mjs +3 -2
  29. package/dist/array/swap.d.mts +1 -1
  30. package/dist/array/to-map.d.mts +1 -1
  31. package/dist/array/to-record.d.mts +1 -1
  32. package/dist/array/to-set.d.mts +1 -1
  33. package/dist/array/toggle.d.mts +1 -1
  34. package/dist/array/union.mjs +3 -2
  35. package/dist/array/unique.d.mts +1 -1
  36. package/dist/array/unique.mjs +3 -2
  37. package/dist/array/update.d.mts +1 -1
  38. package/dist/beacon.d.mts +6 -92
  39. package/dist/beacon.mjs +6 -16
  40. package/dist/color/constants.d.mts +2 -2
  41. package/dist/color/constants.mjs +1 -1
  42. package/dist/color/index.d.mts +1 -1
  43. package/dist/color/instance.d.mts +1 -1
  44. package/dist/color/instance.mjs +0 -1
  45. package/dist/color/misc/alpha.d.mts +1 -1
  46. package/dist/color/misc/format.d.mts +1 -1
  47. package/dist/color/misc/get.d.mts +1 -1
  48. package/dist/color/misc/is.d.mts +2 -2
  49. package/dist/color/misc/is.mjs +1 -0
  50. package/dist/color/misc/state.d.mts +1 -1
  51. package/dist/color/space/hex.d.mts +1 -1
  52. package/dist/color/space/hsl.d.mts +1 -1
  53. package/dist/color/space/hwb.d.mts +1 -1
  54. package/dist/color/space/rgb.d.mts +1 -1
  55. package/dist/function/limit.d.mts +2 -2
  56. package/dist/function/limit.mjs +2 -1
  57. package/dist/function/once.d.mts +7 -3
  58. package/dist/function/once.mjs +5 -10
  59. package/dist/function/retry.d.mts +4 -14
  60. package/dist/function/retry.mjs +3 -15
  61. package/dist/herald.d.mts +2 -2
  62. package/dist/index.d.mts +466 -351
  63. package/dist/index.mjs +491 -439
  64. package/dist/internal/aborter.d.mts +1 -6
  65. package/dist/internal/aborter.mjs +3 -4
  66. package/dist/internal/array/callbacks.d.mts +3 -7
  67. package/dist/internal/array/chunk.mjs +2 -2
  68. package/dist/internal/array/find.d.mts +5 -23
  69. package/dist/internal/array/find.mjs +5 -9
  70. package/dist/internal/array/get.d.mts +1 -1
  71. package/dist/internal/array/group.d.mts +1 -1
  72. package/dist/internal/array/index-of.d.mts +1 -1
  73. package/dist/internal/array/index-of.mjs +4 -3
  74. package/dist/internal/array/insert.d.mts +2 -5
  75. package/dist/internal/array/insert.mjs +2 -4
  76. package/dist/internal/array/match.d.mts +2 -5
  77. package/dist/internal/array/match.mjs +10 -20
  78. package/dist/internal/array/overlap.d.mts +2 -10
  79. package/dist/internal/array/sets.d.mts +2 -5
  80. package/dist/internal/array/sets.mjs +5 -7
  81. package/dist/internal/function/assert.d.mts +5 -12
  82. package/dist/internal/function/assert.mjs +2 -2
  83. package/dist/internal/function/limit.d.mts +2 -37
  84. package/dist/internal/function/limit.mjs +4 -15
  85. package/dist/internal/function/memoize.d.mts +5 -70
  86. package/dist/internal/function/memoize.mjs +2 -5
  87. package/dist/internal/function/work.d.mts +16 -22
  88. package/dist/internal/function/work.mjs +1 -8
  89. package/dist/internal/herald.d.mts +3 -3
  90. package/dist/internal/herald.mjs +2 -1
  91. package/dist/internal/is.d.mts +1 -1
  92. package/dist/internal/math/aggregate.d.mts +2 -14
  93. package/dist/internal/math/aggregate.mjs +2 -5
  94. package/dist/internal/number.mjs +4 -7
  95. package/dist/internal/result/attempt.d.mts +1 -1
  96. package/dist/internal/result/misc.d.mts +1 -1
  97. package/dist/internal/string/case.mjs +6 -16
  98. package/dist/internal/string/misc.mjs +1 -3
  99. package/dist/internal/subscription.d.mts +1 -100
  100. package/dist/internal/subscription.mjs +3 -9
  101. package/dist/internal/value/compare.d.mts +4 -4
  102. package/dist/internal/value/compare.mjs +1 -1
  103. package/dist/internal/value/equal.d.mts +6 -57
  104. package/dist/internal/value/equal.mjs +5 -10
  105. package/dist/internal/value/get.d.mts +1 -1
  106. package/dist/internal/value/handlers.d.mts +2 -21
  107. package/dist/internal/value/has.d.mts +2 -2
  108. package/dist/internal/value/misc.d.mts +1 -1
  109. package/dist/internal/value/misc.mjs +8 -14
  110. package/dist/internal/value/set.d.mts +1 -1
  111. package/dist/internal/value/set.mjs +2 -2
  112. package/dist/is.mjs +3 -3
  113. package/dist/logger.d.mts +3 -70
  114. package/dist/logger.mjs +2 -5
  115. package/dist/math.d.mts +1 -1
  116. package/dist/math.mjs +2 -1
  117. package/dist/models/aborter.model.d.mts +12 -0
  118. package/dist/models/aborter.model.mjs +5 -0
  119. package/dist/models/array/array.find.model.d.mts +22 -0
  120. package/dist/models/array/array.find.model.mjs +8 -0
  121. package/dist/models/array/array.match.model.d.mts +14 -0
  122. package/dist/models/array/array.match.model.mjs +14 -0
  123. package/dist/models/array/array.misc.model.d.mts +36 -0
  124. package/dist/models/array/array.misc.model.mjs +12 -0
  125. package/dist/models/array/array.sort.model.d.mts +122 -0
  126. package/dist/models/array/array.sort.model.mjs +12 -0
  127. package/dist/models/beacon.model.d.mts +119 -0
  128. package/dist/models/beacon.model.mjs +16 -0
  129. package/dist/{color/models.d.mts → models/color.model.d.mts} +4 -4
  130. package/dist/models/function/assert.model.d.mts +13 -0
  131. package/dist/models/function/assert.model.mjs +4 -0
  132. package/dist/models/function/limiter.model.d.mts +71 -0
  133. package/dist/models/function/limiter.model.mjs +15 -0
  134. package/dist/models/function/memoize.model.d.mts +88 -0
  135. package/dist/models/function/memoize.model.mjs +7 -0
  136. package/dist/models/function/once.model.d.mts +76 -0
  137. package/dist/models/function/once.model.mjs +9 -0
  138. package/dist/models/function/retry.model.d.mts +17 -0
  139. package/dist/models/function/retry.model.mjs +17 -0
  140. package/dist/models/function/work.model.d.mts +20 -0
  141. package/dist/models/function/work.model.mjs +11 -0
  142. package/dist/{internal/models → models}/herald.model.d.mts +3 -3
  143. package/dist/{internal/models → models}/herald.model.mjs +2 -2
  144. package/dist/{models.d.mts → models/index.d.mts} +8 -50
  145. package/dist/models/logger.model.d.mts +83 -0
  146. package/dist/models/logger.model.mjs +7 -0
  147. package/dist/models/math.model.d.mts +16 -0
  148. package/dist/models/math.model.mjs +7 -0
  149. package/dist/models/misc.model.d.mts +10 -0
  150. package/dist/models/misc.model.mjs +11 -0
  151. package/dist/{internal/models → models}/plan.model.d.mts +17 -15
  152. package/dist/{internal/models → models}/plan.model.mjs +1 -1
  153. package/dist/models/promise.model.d.mts +119 -0
  154. package/dist/models/promise.model.mjs +47 -0
  155. package/dist/models/query.model.d.mts +9 -0
  156. package/dist/models/query.model.mjs +14 -0
  157. package/dist/models/queue.model.d.mts +251 -0
  158. package/dist/models/queue.model.mjs +29 -0
  159. package/dist/models/random.model.d.mts +6 -0
  160. package/dist/models/random.model.mjs +7 -0
  161. package/dist/{internal/models → models}/result.model.d.mts +10 -2
  162. package/dist/models/string/string.case.model.d.mts +19 -0
  163. package/dist/models/string/string.case.model.mjs +14 -0
  164. package/dist/models/string/string.fuzzy.model.d.mts +108 -0
  165. package/dist/models/string/string.fuzzy.model.mjs +9 -0
  166. package/dist/models/string/string.misc.model.d.mts +13 -0
  167. package/dist/models/string/string.misc.model.mjs +13 -0
  168. package/dist/models/string/string.normalize.model.d.mts +85 -0
  169. package/dist/models/string/string.normalize.model.mjs +43 -0
  170. package/dist/models/string/string.template.model.d.mts +50 -0
  171. package/dist/models/string/string.template.model.mjs +5 -0
  172. package/dist/models/subscription.model.d.mts +127 -0
  173. package/dist/models/subscription.model.mjs +10 -0
  174. package/dist/models/value/value.clone.model.d.mts +56 -0
  175. package/dist/models/value/value.clone.model.mjs +24 -0
  176. package/dist/models/value/value.diff.model.d.mts +61 -0
  177. package/dist/models/value/value.diff.model.mjs +6 -0
  178. package/dist/models/value/value.equal.model.d.mts +76 -0
  179. package/dist/models/value/value.equal.model.mjs +9 -0
  180. package/dist/models/value/value.handler.model.d.mts +27 -0
  181. package/dist/models/value/value.handler.model.mjs +1 -0
  182. package/dist/models/value/value.merge.model.d.mts +82 -0
  183. package/dist/models/value/value.merge.model.mjs +5 -0
  184. package/dist/models/value/value.misc.model.d.mts +33 -0
  185. package/dist/models/value/value.misc.model.mjs +12 -0
  186. package/dist/models/value/value.transform.model.d.mts +28 -0
  187. package/dist/models/value/value.transform.model.mjs +4 -0
  188. package/dist/plan/generate.d.mts +3 -2
  189. package/dist/plan/generate.mjs +14 -10
  190. package/dist/plan/index.d.mts +1 -1
  191. package/dist/plan/index.mjs +2 -2
  192. package/dist/plan/is.d.mts +31 -2
  193. package/dist/plan/is.mjs +45 -1
  194. package/dist/plan/misc.d.mts +21 -2
  195. package/dist/plan/misc.mjs +32 -2
  196. package/dist/plan/models.d.mts +1 -1
  197. package/dist/plan/result.d.mts +7 -7
  198. package/dist/plan/result.mjs +6 -6
  199. package/dist/plan/run.d.mts +5 -5
  200. package/dist/plan/run.mjs +6 -6
  201. package/dist/promise/delay.d.mts +1 -1
  202. package/dist/promise/delay.mjs +2 -1
  203. package/dist/promise/helpers.d.mts +2 -2
  204. package/dist/promise/helpers.mjs +6 -6
  205. package/dist/promise/index.d.mts +2 -2
  206. package/dist/promise/index.mjs +1 -1
  207. package/dist/promise/misc.d.mts +3 -3
  208. package/dist/promise/misc.mjs +7 -4
  209. package/dist/promise/models.d.mts +2 -106
  210. package/dist/promise/models.mjs +1 -35
  211. package/dist/promise/timed.d.mts +2 -2
  212. package/dist/promise/timed.mjs +3 -3
  213. package/dist/query.d.mts +1 -1
  214. package/dist/query.mjs +5 -15
  215. package/dist/queue.d.mts +6 -200
  216. package/dist/queue.mjs +9 -34
  217. package/dist/random.mjs +2 -5
  218. package/dist/result/match.d.mts +1 -1
  219. package/dist/result/match.mjs +27 -15
  220. package/dist/result/misc.d.mts +1 -1
  221. package/dist/result/work/flow.d.mts +13 -21
  222. package/dist/result/work/flow.mjs +0 -1
  223. package/dist/result/work/pipe.d.mts +2 -2
  224. package/dist/result/work/pipe.mjs +0 -1
  225. package/dist/string/fuzzy.d.mts +5 -87
  226. package/dist/string/fuzzy.mjs +6 -11
  227. package/dist/string/index.mjs +6 -8
  228. package/dist/string/match.mjs +4 -6
  229. package/dist/string/normalize.d.mts +4 -40
  230. package/dist/string/normalize.mjs +9 -48
  231. package/dist/string/template.d.mts +5 -43
  232. package/dist/string/template.mjs +1 -2
  233. package/dist/subscription.d.mts +2 -1
  234. package/dist/value/clone.d.mts +6 -42
  235. package/dist/value/clone.mjs +10 -30
  236. package/dist/value/collection.mjs +2 -0
  237. package/dist/value/diff.d.mts +3 -44
  238. package/dist/value/diff.mjs +1 -3
  239. package/dist/value/freeze.d.mts +1 -5
  240. package/dist/value/index.d.mts +4 -3
  241. package/dist/value/merge.d.mts +6 -64
  242. package/dist/value/merge.mjs +8 -8
  243. package/dist/value/omit.d.mts +1 -1
  244. package/dist/value/pick.d.mts +1 -1
  245. package/dist/value/shake.d.mts +4 -6
  246. package/dist/value/smush.d.mts +4 -6
  247. package/dist/value/smush.mjs +2 -2
  248. package/dist/value/transform.d.mts +6 -22
  249. package/dist/value/transform.mjs +1 -1
  250. package/dist/value/unsmush.d.mts +4 -10
  251. package/package.json +12 -3
  252. package/dist/internal/plan.d.mts +0 -45
  253. package/dist/internal/plan.mjs +0 -70
  254. package/dist/promise/constants.d.mts +0 -17
  255. package/dist/promise/constants.mjs +0 -15
  256. /package/dist/{color/models.mjs → models/color.model.mjs} +0 -0
  257. /package/dist/{internal/models/result.model.mjs → models/index.mjs} +0 -0
  258. /package/dist/{models.mjs → models/result.model.mjs} +0 -0
package/dist/index.mjs CHANGED
@@ -1,3 +1,8 @@
1
+ //#region src/models/array/array.find.model.ts
2
+ const ARRAY_FIND_VALUE_INDEX = "index";
3
+ const ARRAY_FIND_VALUE_ITEM = "item";
4
+ const ARRAY_FIND_VALUES_UNIQUE = "unique";
5
+ //#endregion
1
6
  //#region src/internal/array/callbacks.ts
2
7
  function getArrayCallback(value) {
3
8
  switch (typeof value) {
@@ -25,7 +30,7 @@ function createFindParameters(original) {
25
30
  };
26
31
  }
27
32
  function findValue(type, array, parameters, reversed) {
28
- const findIndex = type === FIND_VALUE_INDEX;
33
+ const findIndex = type === ARRAY_FIND_VALUE_INDEX;
29
34
  if (!Array.isArray(array) || array.length === 0) return findIndex ? -1 : void 0;
30
35
  const { bool, key, value } = createFindParameters(parameters);
31
36
  const callbacks = getArrayCallbacks(bool, key);
@@ -52,7 +57,7 @@ function findAbsoluteValueOrDefault(array, parameters, defaultValue, useDefaultV
52
57
  if (Array.isArray(array) && array.length > 0) return reversed ? array.at(-1) : array[0];
53
58
  return useDefaultValue ? defaultValue : void 0;
54
59
  }
55
- const index = findValue(FIND_VALUE_INDEX, array, parameters, reversed);
60
+ const index = findValue(ARRAY_FIND_VALUE_INDEX, array, parameters, reversed);
56
61
  return index > -1 ? array[index] : useDefaultValue ? defaultValue : void 0;
57
62
  }
58
63
  function findValues(type, array, parameters, mapper) {
@@ -64,7 +69,7 @@ function findValues(type, array, parameters, mapper) {
64
69
  const { length } = array;
65
70
  const { bool, key, value } = createFindParameters(parameters);
66
71
  const callbacks = getArrayCallbacks(bool, key);
67
- if (type === "unique" && callbacks?.keyed == null && length >= FIND_UNIQUE_THRESHOLD) {
72
+ if (type === "unique" && callbacks?.keyed == null && length >= 100) {
68
73
  result.matched = [...new Set(array)];
69
74
  return result;
70
75
  }
@@ -101,10 +106,6 @@ function findValues(type, array, parameters, mapper) {
101
106
  }
102
107
  return result;
103
108
  }
104
- const FIND_VALUE_INDEX = "index";
105
- const FIND_VALUE_ITEM = "item";
106
- const FIND_VALUES_UNIQUE = "unique";
107
- const FIND_UNIQUE_THRESHOLD = 100;
108
109
  //#endregion
109
110
  //#region src/array/filter.ts
110
111
  function exclude(array, ...parameters) {
@@ -117,10 +118,10 @@ filter.remove = exclude;
117
118
  //#endregion
118
119
  //#region src/array/find.ts
119
120
  function find(array, ...parameters) {
120
- return findValue(FIND_VALUE_ITEM, array, parameters, false);
121
+ return findValue(ARRAY_FIND_VALUE_ITEM, array, parameters, false);
121
122
  }
122
123
  function findLast(array, ...parameters) {
123
- return findValue(FIND_VALUE_ITEM, array, parameters, true);
124
+ return findValue(ARRAY_FIND_VALUE_ITEM, array, parameters, true);
124
125
  }
125
126
  find.last = findLast;
126
127
  //#endregion
@@ -161,6 +162,17 @@ function groupArraysBy(array, first, second) {
161
162
  }
162
163
  groupBy.arrays = groupArraysBy;
163
164
  //#endregion
165
+ //#region src/models/array/array.misc.model.ts
166
+ const ARRAY_CHUNK_MAX_SIZE = 5e3;
167
+ const ARRAY_INSERT_TYPE_INSERT = "insert";
168
+ const ARRAY_INSERT_TYPE_PUSH = "push";
169
+ const ARRAY_INSERT_TYPE_SPLICE = "splice";
170
+ const ARRAY_SETS_COMPARE_DIFFERENCE = "difference";
171
+ const ARRAY_SETS_COMPARE_INTERSECTION = "intersection";
172
+ const ARRAY_SETS_COMPARE_UNION = "union";
173
+ const ARRAY_SLICE_DROP = "drop";
174
+ const ARRAY_SLICE_TAKE = "take";
175
+ //#endregion
164
176
  //#region src/internal/array/chunk.ts
165
177
  /**
166
178
  * Chunk an array into smaller arrays
@@ -178,7 +190,7 @@ function chunk(array, size) {
178
190
  if (!Array.isArray(array)) return [];
179
191
  if (array.length === 0) return [];
180
192
  const { length } = array;
181
- const actualSize = typeof size === "number" && size > 0 && size <= CHUNK_MAX_SIZE ? size : CHUNK_MAX_SIZE;
193
+ const actualSize = typeof size === "number" && size > 0 && size <= 5e3 ? size : ARRAY_CHUNK_MAX_SIZE;
182
194
  if (length <= actualSize) return [array];
183
195
  const chunks = [];
184
196
  let index = 0;
@@ -188,7 +200,6 @@ function chunk(array, size) {
188
200
  }
189
201
  return chunks;
190
202
  }
191
- const CHUNK_MAX_SIZE = 5e3;
192
203
  //#endregion
193
204
  //#region src/internal/array/compact.ts
194
205
  function compact(array, strict) {
@@ -405,24 +416,34 @@ function getArray(value, indiced) {
405
416
  }
406
417
  return array;
407
418
  }
419
+ const ARRAY_MATCH_COMPARISON_INSIDE = "inside";
420
+ const ARRAY_MATCH_COMPARISON_INVALID = "invalid";
421
+ const ARRAY_MATCH_COMPARISON_OUTSIDE = "outside";
422
+ const ARRAY_MATCH_COMPARISON_SAME = "same";
423
+ const ARRAY_MATCH_COMPARISON_START = "start";
424
+ const arrayMatchEndings = /* @__PURE__ */ new Set(["end", ARRAY_MATCH_COMPARISON_SAME]);
425
+ const arrayMatchInvalid = [-1, ARRAY_MATCH_COMPARISON_INVALID];
426
+ const arrayMatchOutside = [-1, ARRAY_MATCH_COMPARISON_OUTSIDE];
427
+ const arrayMatchOutsides = /* @__PURE__ */ new Set([ARRAY_MATCH_COMPARISON_INVALID, ARRAY_MATCH_COMPARISON_OUTSIDE]);
428
+ const arrayMatchStarts = /* @__PURE__ */ new Set([ARRAY_MATCH_COMPARISON_START, ARRAY_MATCH_COMPARISON_SAME]);
408
429
  //#endregion
409
430
  //#region src/internal/array/match.ts
410
431
  function endsWithArray(haystack, needle, key) {
411
- return endings.has(getPosition(haystack, needle, key)[1]);
432
+ return arrayMatchEndings.has(getPosition(haystack, needle, key)[1]);
412
433
  }
413
434
  function getArrayComparison(haystack, needle, key) {
414
435
  return getPosition(haystack, needle, key)[1];
415
436
  }
416
437
  function getName(start, haystack, needle) {
417
- if (start === 0) return haystack === needle ? MATCH_COMPARISON_SAME : MATCH_COMPARISON_START;
418
- return start + needle === haystack ? MATCH_COMPARISON_END : MATCH_COMPARISON_INSIDE;
438
+ if (start === 0) return haystack === needle ? ARRAY_MATCH_COMPARISON_SAME : ARRAY_MATCH_COMPARISON_START;
439
+ return start + needle === haystack ? "end" : ARRAY_MATCH_COMPARISON_INSIDE;
419
440
  }
420
441
  function getPosition(haystack, needle, key) {
421
- if (!Array.isArray(haystack) || !Array.isArray(needle)) return invalid;
442
+ if (!Array.isArray(haystack) || !Array.isArray(needle)) return arrayMatchInvalid;
422
443
  const haystackLength = haystack.length;
423
444
  const needleLength = needle.length;
424
- if (haystackLength === 0 || needleLength === 0) return outside;
425
- if (needleLength > haystackLength) return outside;
445
+ if (haystackLength === 0 || needleLength === 0) return arrayMatchOutside;
446
+ if (needleLength > haystackLength) return arrayMatchOutside;
426
447
  const callback = getArrayCallback(key);
427
448
  const limit = haystackLength - needleLength + 1;
428
449
  let needleValues = callback == null ? needle : needle.slice();
@@ -439,28 +460,17 @@ function getPosition(haystack, needle, key) {
439
460
  if (needleIndex === needleLength - 1) return [haystackIndex, getName(haystackIndex, haystackLength, needleLength)];
440
461
  }
441
462
  }
442
- return outside;
463
+ return arrayMatchOutside;
443
464
  }
444
465
  function includesArray(haystack, needle, key) {
445
- return !outsides.has(getPosition(haystack, needle, key)[1]);
466
+ return !arrayMatchOutsides.has(getPosition(haystack, needle, key)[1]);
446
467
  }
447
468
  function indexOfArray(haystack, needle, key) {
448
469
  return getPosition(haystack, needle, key)[0];
449
470
  }
450
471
  function startsWithArray(haystack, needle, key) {
451
- return starts.has(getPosition(haystack, needle, key)[1]);
452
- }
453
- const MATCH_COMPARISON_END = "end";
454
- const MATCH_COMPARISON_INSIDE = "inside";
455
- const MATCH_COMPARISON_INVALID = "invalid";
456
- const MATCH_COMPARISON_OUTSIDE = "outside";
457
- const MATCH_COMPARISON_SAME = "same";
458
- const MATCH_COMPARISON_START = "start";
459
- const endings = /* @__PURE__ */ new Set([MATCH_COMPARISON_END, MATCH_COMPARISON_SAME]);
460
- const invalid = [-1, MATCH_COMPARISON_INVALID];
461
- const outside = [-1, MATCH_COMPARISON_OUTSIDE];
462
- const outsides = /* @__PURE__ */ new Set([MATCH_COMPARISON_INVALID, MATCH_COMPARISON_OUTSIDE]);
463
- const starts = /* @__PURE__ */ new Set([MATCH_COMPARISON_START, MATCH_COMPARISON_SAME]);
472
+ return arrayMatchStarts.has(getPosition(haystack, needle, key)[1]);
473
+ }
464
474
  //#endregion
465
475
  //#region src/internal/math/misc.ts
466
476
  /**
@@ -541,9 +551,9 @@ function shuffle(array) {
541
551
  //#region src/internal/array/sets.ts
542
552
  function compareSets(type, first, second, key) {
543
553
  if (!Array.isArray(first)) return [];
544
- const isDifference = type === SETS_COMPARE_DIFFERENCE;
545
- const isIntersection = type === SETS_COMPARE_INTERSECTION;
546
- const isUnion = type === SETS_COMPARE_UNION;
554
+ const isDifference = type === ARRAY_SETS_COMPARE_DIFFERENCE;
555
+ const isIntersection = type === ARRAY_SETS_COMPARE_INTERSECTION;
556
+ const isUnion = type === ARRAY_SETS_COMPARE_UNION;
547
557
  if (first.length === 0) return isDifference ? first.slice() : isIntersection ? [] : second.slice();
548
558
  if (!Array.isArray(second) || second.length === 0) return isIntersection ? [] : first.slice();
549
559
  const callback = getArrayCallback(key);
@@ -564,19 +574,16 @@ function compareSets(type, first, second, key) {
564
574
  }
565
575
  return result;
566
576
  }
567
- const SETS_COMPARE_DIFFERENCE = "difference";
568
- const SETS_COMPARE_INTERSECTION = "intersection";
569
- const SETS_COMPARE_UNION = "union";
570
577
  //#endregion
571
578
  //#region src/array/difference.ts
572
579
  function difference(first, second, key) {
573
- return compareSets(SETS_COMPARE_DIFFERENCE, first, second, key);
580
+ return compareSets(ARRAY_SETS_COMPARE_DIFFERENCE, first, second, key);
574
581
  }
575
582
  //#endregion
576
583
  //#region src/array/exists.ts
577
584
  function exists(array, ...parameters) {
578
585
  if (parameters.length === 1 && typeof parameters[0] !== "function") return Array.isArray(array) ? array.includes(parameters[0]) : false;
579
- return findValue(FIND_VALUE_INDEX, array, parameters, false) > -1;
586
+ return findValue(ARRAY_FIND_VALUE_INDEX, array, parameters, false) > -1;
580
587
  }
581
588
  //#endregion
582
589
  //#region src/array/flatten.ts
@@ -614,6 +621,9 @@ function times(length, value) {
614
621
  return values;
615
622
  }
616
623
  //#endregion
624
+ //#region src/models/math.model.ts
625
+ const AGGREGATION_AVERAGE = "average";
626
+ //#endregion
617
627
  //#region src/internal/math/aggregate.ts
618
628
  function aggregate(type, array, key, first) {
619
629
  const length = Array.isArray(array) ? array.length : 0;
@@ -677,7 +687,6 @@ function max(array, key, first) {
677
687
  function min(array, key, first) {
678
688
  return getAggregated("min", array, key, first);
679
689
  }
680
- const AGGREGATION_AVERAGE = "average";
681
690
  const aggregators = {
682
691
  average: calculateSum,
683
692
  max: getAbsoluteValue.bind(void 0, isMaxValue),
@@ -707,18 +716,15 @@ function insertValues(type, array, items, start, deleteCount) {
707
716
  if (!Array.isArray(array) || typeof start !== "number" || !Array.isArray(items) || items.length === 0) return spliceArray ? [] : 0;
708
717
  return insertChunkedValues(type, array, items, start, spliceArray ? deleteCount : 0);
709
718
  }
710
- const INSERT_TYPE_INSERT = "insert";
711
- const INSERT_TYPE_PUSH = "push";
712
- const INSERT_TYPE_SPLICE = "splice";
713
719
  //#endregion
714
720
  //#region src/array/insert.ts
715
721
  function insert(array, indexOrItems, items) {
716
- return insertValues(INSERT_TYPE_INSERT, array, items == null ? indexOrItems : items, typeof indexOrItems === "number" ? indexOrItems : array?.length, 0);
722
+ return insertValues(ARRAY_INSERT_TYPE_INSERT, array, items == null ? indexOrItems : items, typeof indexOrItems === "number" ? indexOrItems : array?.length, 0);
717
723
  }
718
724
  //#endregion
719
725
  //#region src/array/intersection.ts
720
726
  function intersection(first, second, key) {
721
- return compareSets(SETS_COMPARE_INTERSECTION, first, second, key);
727
+ return compareSets(ARRAY_SETS_COMPARE_INTERSECTION, first, second, key);
722
728
  }
723
729
  //#endregion
724
730
  //#region src/array/partition.ts
@@ -743,7 +749,7 @@ function partition(array, ...parameters) {
743
749
  * ```
744
750
  */
745
751
  function push(array, pushed) {
746
- return insertValues(INSERT_TYPE_PUSH, array, pushed, array.length, 0);
752
+ return insertValues(ARRAY_INSERT_TYPE_PUSH, array, pushed, array.length, 0);
747
753
  }
748
754
  //#endregion
749
755
  //#region src/array/reverse.ts
@@ -777,13 +783,13 @@ const SINGLE_MESSAGE = "Multiple items were found";
777
783
  //#endregion
778
784
  //#region src/array/slice.ts
779
785
  function drop(array, first, second) {
780
- return extract(SLICE_DROP, array, first, second);
786
+ return extract(ARRAY_SLICE_DROP, array, first, second);
781
787
  }
782
788
  function extract(type, array, first, second) {
783
789
  if (!Array.isArray(array)) return [];
784
790
  const { length } = array;
785
791
  if (length === 0) return [];
786
- const isTake = type === SLICE_TAKE;
792
+ const isTake = type === ARRAY_SLICE_TAKE;
787
793
  if (typeof first === "number") {
788
794
  if (Math.abs(first) >= length) return isTake ? array.slice() : [];
789
795
  if (first === 0) return isTake ? [] : array.slice();
@@ -821,15 +827,13 @@ function slice(array, first, second) {
821
827
  return first >= 0 ? array.slice(first, second) : array.slice(array.length + first, array.length + second);
822
828
  }
823
829
  function take(array, first, second) {
824
- return extract(SLICE_TAKE, array, first, second);
830
+ return extract(ARRAY_SLICE_TAKE, array, first, second);
825
831
  }
826
- const SLICE_DROP = "drop";
827
- const SLICE_TAKE = "take";
828
832
  //#endregion
829
833
  //#region src/array/splice.ts
830
834
  function splice(array, start, deleteCountOrItems, items) {
831
835
  const deleteCountIsNumber = typeof deleteCountOrItems === "number";
832
- return insertValues(INSERT_TYPE_SPLICE, array, deleteCountIsNumber ? items : deleteCountOrItems, start, deleteCountIsNumber ? deleteCountOrItems : 0);
836
+ return insertValues(ARRAY_INSERT_TYPE_SPLICE, array, deleteCountIsNumber ? items : deleteCountOrItems, start, deleteCountIsNumber ? deleteCountOrItems : 0);
833
837
  }
834
838
  //#endregion
835
839
  //#region src/array/to-set.ts
@@ -872,13 +876,13 @@ function toggle(array, values, key) {
872
876
  //#endregion
873
877
  //#region src/array/union.ts
874
878
  function union(first, second, key) {
875
- return compareSets(SETS_COMPARE_UNION, first, second, key);
879
+ return compareSets(ARRAY_SETS_COMPARE_UNION, first, second, key);
876
880
  }
877
881
  //#endregion
878
882
  //#region src/array/unique.ts
879
883
  function unique(array, key) {
880
884
  if (!Array.isArray(array)) return [];
881
- return array.length > 1 ? findValues(FIND_VALUES_UNIQUE, array, [key, void 0]).matched : array;
885
+ return array.length > 1 ? findValues(ARRAY_FIND_VALUES_UNIQUE, array, [key, void 0]).matched : array;
882
886
  }
883
887
  //#endregion
884
888
  //#region src/array/update.ts
@@ -1006,6 +1010,24 @@ function selectValues(array, parameters) {
1006
1010
  }
1007
1011
  filterAndMap.reverse = mapAndFilter;
1008
1012
  //#endregion
1013
+ //#region src/models/value/value.misc.model.ts
1014
+ const COMPARE_NAME = "compare";
1015
+ const VALUE_MISC_EXPRESSION_BRACKET = /\[(\w+)\]/g;
1016
+ const VALUE_MISC_EXPRESSION_DOTS = /^\.|\.$/g;
1017
+ const VALUE_MISC_EXPRESSION_NESTED = /\.|\[\w+\]/;
1018
+ const VALUE_MISC_NESTED_MESSAGE_INPUT = "Expected data to be an object";
1019
+ const VALUE_MISC_NESTED_MESSAGE_MISSING = "Expected property to exist in object";
1020
+ const VALUE_MISC_NESTED_MESSAGE_PATH = "Expected path to be a string";
1021
+ const VALUE_MISC_NESTED_MESSAGE_UNSAFE = "Access to this property is not allowed";
1022
+ //#endregion
1023
+ //#region src/models/string/string.misc.model.ts
1024
+ const STRING_EXPRESSION_IGNORED = /(^|\.)(__proto__|constructor|prototype)(\.|$)/i;
1025
+ const STRING_EXPRESSION_WORDS = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
1026
+ const STRING_EXPRESSION_WHITESPACE_PREFIX = /^(\s+)/;
1027
+ const STRING_MATCH_ENDS_WITH = "endsWith";
1028
+ const STRING_MATCH_INCLUDES = "includes";
1029
+ const STRING_MATCH_STARTS_WITH = "startsWith";
1030
+ //#endregion
1009
1031
  //#region src/internal/result/misc.ts
1010
1032
  function error(value, original) {
1011
1033
  return getError(value, original);
@@ -1169,8 +1191,6 @@ function tryEncode(value) {
1169
1191
  function words(value) {
1170
1192
  return typeof value === "string" ? value.match(STRING_EXPRESSION_WORDS) ?? [] : [];
1171
1193
  }
1172
- const STRING_EXPRESSION_IGNORED = /(^|\.)(__proto__|constructor|prototype)(\.|$)/i;
1173
- const STRING_EXPRESSION_WORDS = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
1174
1194
  //#endregion
1175
1195
  //#region src/internal/value/handlers.ts
1176
1196
  function BaseHandler(owner, options) {
@@ -1226,7 +1246,6 @@ function handleValue$1(value, ...parameters) {
1226
1246
  }
1227
1247
  //#endregion
1228
1248
  //#region src/internal/value/compare.ts
1229
- const COMPARE_NAME = "compare";
1230
1249
  /**
1231
1250
  * Compare two values _(for sorting purposes)_
1232
1251
  *
@@ -1310,6 +1329,15 @@ compare.deregister = deregisterComparator;
1310
1329
  compare.handler = compareHandler;
1311
1330
  compare.register = registerComparator;
1312
1331
  //#endregion
1332
+ //#region src/models/array/array.sort.model.ts
1333
+ const SORT_DIRECTION_ASCENDING = "ascending";
1334
+ const SORT_DIRECTION_DESCENDING = "descending";
1335
+ const SORTER_SYMBOL = Symbol("sorter");
1336
+ const arrayModifiers = {
1337
+ [SORT_DIRECTION_ASCENDING]: 1,
1338
+ [SORT_DIRECTION_DESCENDING]: -1
1339
+ };
1340
+ //#endregion
1313
1341
  //#region src/array/sort.ts
1314
1342
  function Sorter(sorters) {
1315
1343
  this[SORTER_SYMBOL] = sorters;
@@ -1335,7 +1363,7 @@ function getComparisonValue(first, second, sorters, length) {
1335
1363
  return 0;
1336
1364
  }
1337
1365
  function getModifier(first, second) {
1338
- return modifiers[first === true || second === true ? SORT_DIRECTION_DESCENDING : SORT_DIRECTION_ASCENDING];
1366
+ return arrayModifiers[first === true || second === true ? SORT_DIRECTION_DESCENDING : SORT_DIRECTION_ASCENDING];
1339
1367
  }
1340
1368
  function getObjectSorter(obj, modifier) {
1341
1369
  let sorter;
@@ -1344,7 +1372,7 @@ function getObjectSorter(obj, modifier) {
1344
1372
  sorter = getValueSortHandlers(obj.key, modifier);
1345
1373
  if (typeof obj.compare === "function") sorter.comparison = { complex: obj.compare };
1346
1374
  } else if (typeof obj.value === "function") sorter = getValueSortHandlers(obj.value, modifier);
1347
- if (sorter != null && typeof obj.direction === "string") sorter.modifier = modifiers[obj.direction] ?? modifier;
1375
+ if (sorter != null && typeof obj.direction === "string") sorter.modifier = arrayModifiers[obj.direction] ?? modifier;
1348
1376
  return sorter;
1349
1377
  }
1350
1378
  function getSortedArrayIndex(array, item) {
@@ -1412,9 +1440,9 @@ function isSortedArray(array) {
1412
1440
  const sorters = Array.isArray(this) ? this : this[SORTER_SYMBOL];
1413
1441
  const sortersLength = sorters.length;
1414
1442
  let offset = 0;
1415
- if (length >= SORT_THRESHOLD) {
1416
- offset = round(length / SORT_PEEK_PERCENTAGE);
1417
- offset = offset > SORT_THRESHOLD ? SORT_THRESHOLD : offset;
1443
+ if (length >= 100) {
1444
+ offset = round(length / 10);
1445
+ offset = offset > 100 ? 100 : offset;
1418
1446
  for (let index = 0; index < offset; index += 1) {
1419
1447
  const [firstItem, firstOffset] = [array[index], array[index + 1]];
1420
1448
  const [secondItem, secondOffset] = [array[length - index - 2], array[length - index - 1]];
@@ -1439,25 +1467,16 @@ function sortArray(array) {
1439
1467
  const { length } = sorters;
1440
1468
  return array.length > 1 ? array.sort((first, second) => getComparisonValue(first, second, sorters, length)) : array;
1441
1469
  }
1442
- const SORT_PEEK_PERCENTAGE = 10;
1443
- const SORT_THRESHOLD = 100;
1444
- const SORT_DIRECTION_ASCENDING = "ascending";
1445
- const SORT_DIRECTION_DESCENDING = "descending";
1446
- const SORTER_SYMBOL = Symbol("sorter");
1447
- const modifiers = {
1448
- [SORT_DIRECTION_ASCENDING]: 1,
1449
- [SORT_DIRECTION_DESCENDING]: -1
1450
- };
1451
1470
  sort.getIndex = getSortedIndex;
1452
1471
  sort.initialize = initializeSorter;
1453
1472
  sort.is = isSorted;
1454
1473
  //#endregion
1455
1474
  //#region src/internal/array/index-of.ts
1456
1475
  function indexOf(array, ...parameters) {
1457
- return findValue(FIND_VALUE_INDEX, array, parameters, false);
1476
+ return findValue(ARRAY_FIND_VALUE_INDEX, array, parameters, false);
1458
1477
  }
1459
1478
  function lastIndexOf(array, ...parameters) {
1460
- return findValue(FIND_VALUE_INDEX, array, parameters, true);
1479
+ return findValue(ARRAY_FIND_VALUE_INDEX, array, parameters, true);
1461
1480
  }
1462
1481
  indexOf.last = lastIndexOf;
1463
1482
  //#endregion
@@ -1559,6 +1578,19 @@ toRecord.arrays = toRecordArrays;
1559
1578
  */
1560
1579
  function noop() {}
1561
1580
  //#endregion
1581
+ //#region src/models/function/limiter.model.ts
1582
+ const LIMITER_DEBOUNCE = "debounce";
1583
+ const LIMITER_NAME_ASYNC = "asyncLimiter";
1584
+ const LIMITER_NAME_SYNC = "limiter";
1585
+ const LIMITER_PROPERTY = "$limiter";
1586
+ const LIMITER_SYMBOL = Symbol("limiter");
1587
+ const LIMITER_THROTTLE = "throttle";
1588
+ const LIMITER_WAIT = "wait";
1589
+ // istanbul ignore next
1590
+ const clearTimer = typeof cancelAnimationFrame === "function" ? cancelAnimationFrame : clearTimeout;
1591
+ // istanbul ignore next
1592
+ const startTimer = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout;
1593
+ //#endregion
1562
1594
  //#region src/internal/defaults.ts
1563
1595
  function getBooleanOrDefault(value, defaultValue) {
1564
1596
  return typeof value === "boolean" ? value : defaultValue;
@@ -1568,9 +1600,6 @@ function getNumberOrDefault(value, defaultValue, minimum) {
1568
1600
  }
1569
1601
  //#endregion
1570
1602
  //#region src/internal/function/limit.ts
1571
- const LIMITER_NAME_ASYNC = "asyncLimiter";
1572
- const LIMITER_NAME_SYNC = "limiter";
1573
- const LIMITER_PROPERTY = "$limiter";
1574
1603
  function AsyncLimiter(type, callback, time) {
1575
1604
  this[LIMITER_SYMBOL] = {
1576
1605
  callback,
@@ -1616,7 +1645,7 @@ function getLimiter(type, callback, time) {
1616
1645
  async function handleAsyncLimiter(state, item) {
1617
1646
  const now = performance.now();
1618
1647
  state.start ??= now;
1619
- if (state.interval === 0 || now - state.start >= state.interval - LIMITER_OFFSET) {
1648
+ if (state.interval === 0 || now - state.start >= state.interval - 5) {
1620
1649
  state.start = state.throttle ? now : void 0;
1621
1650
  item.running = true;
1622
1651
  const result = await asyncAttempt(async () => {
@@ -1632,7 +1661,7 @@ async function handleAsyncLimiter(state, item) {
1632
1661
  function handleLimiter(state) {
1633
1662
  const now = performance.now();
1634
1663
  state.start ??= now;
1635
- if (state.interval === 0 || now - state.start >= state.interval - LIMITER_OFFSET) {
1664
+ if (state.interval === 0 || now - state.start >= state.interval - 5) {
1636
1665
  state.start = state.throttle ? now : void 0;
1637
1666
  state.callback(...state.parameters);
1638
1667
  } else state.timer = startTimer(() => handleLimiter(state));
@@ -1660,15 +1689,6 @@ function runLimiter(...parameters) {
1660
1689
  if (state.throttle) handleLimiter(state);
1661
1690
  else state.timer = startTimer(() => handleLimiter(state));
1662
1691
  }
1663
- const LIMITER_DEBOUNCE = "debounce";
1664
- const LIMITER_OFFSET = 5;
1665
- const LIMITER_SYMBOL = Symbol("limiter");
1666
- const LIMITER_THROTTLE = "throttle";
1667
- const LIMITER_WAIT = "wait";
1668
- // istanbul ignore next
1669
- const clearTimer = typeof cancelAnimationFrame === "function" ? cancelAnimationFrame : clearTimeout;
1670
- // istanbul ignore next
1671
- const startTimer = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout;
1672
1692
  //#endregion
1673
1693
  //#region src/function/limit.ts
1674
1694
  /**
@@ -1733,8 +1753,8 @@ function findKey(needle, haystack) {
1733
1753
  return index > -1 ? keys[index] : needle;
1734
1754
  }
1735
1755
  function getNestedValue(data, path, ignoreCase) {
1736
- if (typeof data !== "object" || data === null) return error(MISC_NESTED_MESSAGE_INPUT);
1737
- if (typeof path !== "string" || path.trim().length === 0) return error(MISC_NESTED_MESSAGE_PATH);
1756
+ if (typeof data !== "object" || data === null) return error(VALUE_MISC_NESTED_MESSAGE_INPUT);
1757
+ if (typeof path !== "string" || path.trim().length === 0) return error(VALUE_MISC_NESTED_MESSAGE_PATH);
1738
1758
  const shouldIgnoreCase = ignoreCase === true;
1739
1759
  const paths = getPaths(path, shouldIgnoreCase);
1740
1760
  if (typeof paths === "string") return handleValue(data, paths, null, true, shouldIgnoreCase);
@@ -1750,26 +1770,19 @@ function getNestedValue(data, path, ignoreCase) {
1750
1770
  }
1751
1771
  function getPaths(path, lowercase) {
1752
1772
  const normalized = lowercase ? path.toLowerCase() : path;
1753
- if (!MISC_EXPRESSION_NESTED.test(normalized)) return normalized;
1754
- return normalized.replace(MISC_EXPRESSION_BRACKET, ".$1").replace(MISC_EXPRESSION_DOTS, "").split(".");
1773
+ if (!VALUE_MISC_EXPRESSION_NESTED.test(normalized)) return normalized;
1774
+ return normalized.replace(VALUE_MISC_EXPRESSION_BRACKET, ".$1").replace(VALUE_MISC_EXPRESSION_DOTS, "").split(".");
1755
1775
  }
1756
1776
  function handleValue(data, path, value, get, ignoreCase) {
1757
1777
  if (typeof data === "object" && data !== null) {
1758
- if (ignoreKey(path)) return error(MISC_NESTED_MESSAGE_UNSAFE);
1778
+ if (ignoreKey(path)) return error(VALUE_MISC_NESTED_MESSAGE_UNSAFE);
1759
1779
  const dataObject = data;
1760
1780
  const key = ignoreCase ? findKey(path, dataObject) : path;
1761
- if (get) return key in dataObject ? ok(dataObject[key]) : error(MISC_NESTED_MESSAGE_MISSING);
1781
+ if (get) return key in dataObject ? ok(dataObject[key]) : error(VALUE_MISC_NESTED_MESSAGE_MISSING);
1762
1782
  dataObject[key] = typeof value === "function" ? value(dataObject[key]) : value;
1763
1783
  }
1764
- if (get) return error(MISC_NESTED_MESSAGE_MISSING);
1784
+ if (get) return error(VALUE_MISC_NESTED_MESSAGE_MISSING);
1765
1785
  }
1766
- const MISC_EXPRESSION_BRACKET = /\[(\w+)\]/g;
1767
- const MISC_EXPRESSION_DOTS = /^\.|\.$/g;
1768
- const MISC_EXPRESSION_NESTED = /\.|\[\w+\]/;
1769
- const MISC_NESTED_MESSAGE_INPUT = "Expected data to be an object";
1770
- const MISC_NESTED_MESSAGE_MISSING = "Expected property to exist in object";
1771
- const MISC_NESTED_MESSAGE_PATH = "Expected path to be a string";
1772
- const MISC_NESTED_MESSAGE_UNSAFE = "Access to this property is not allowed";
1773
1786
  //#endregion
1774
1787
  //#region src/internal/value/has.ts
1775
1788
  function hasValue(data, path, ignoreCase) {
@@ -1816,7 +1829,7 @@ function assertCondition(condition, message, error) {
1816
1829
  * @param error Error constructor _(defaults to `Error`)_
1817
1830
  */
1818
1831
  function assertDefined(value, message, error) {
1819
- assert(() => value != null, message ?? ASSERT_MESSAGE_VALUE_DEFINED, error);
1832
+ assert(() => value != null, message ?? "Expected value to be defined", error);
1820
1833
  }
1821
1834
  /**
1822
1835
  * Creates an _Asserter_ that asserts a value is an instance of a constructor, throwing an error if it is not
@@ -1867,17 +1880,21 @@ function assertProperty(path, condition, message, error) {
1867
1880
  }, message, error);
1868
1881
  };
1869
1882
  }
1870
- const ASSERT_MESSAGE_VALUE_DEFINED = "Expected value to be defined";
1871
1883
  assert.condition = assertCondition;
1872
1884
  assert.defined = assertDefined;
1873
1885
  assert.instanceOf = assertInstanceOf;
1874
1886
  assert.is = assertIs;
1875
1887
  assert.property = assertProperty;
1876
1888
  //#endregion
1877
- //#region src/function/once.ts
1889
+ //#region src/models/function/once.model.ts
1878
1890
  const ONCE_NAME_ASYNC = "asyncOnce";
1879
1891
  const ONCE_NAME_SYNC = "once";
1880
1892
  const ONCE_PROPERTY = "$once";
1893
+ const ONCE_MESSAGE_CLEARED = "Once has been cleared";
1894
+ const ONCE_MESSAGE_EXPECTATION = "Once expected a function";
1895
+ const ONCE_SYMBOL = Symbol(ONCE_PROPERTY);
1896
+ //#endregion
1897
+ //#region src/function/once.ts
1881
1898
  function AsyncOnce(callback) {
1882
1899
  this[ONCE_SYMBOL] = {
1883
1900
  callback,
@@ -1969,9 +1986,9 @@ function handleOnceResult(state, value, error) {
1969
1986
  const items = state.items.splice(0);
1970
1987
  const { length } = items;
1971
1988
  for (let index = 0; index < length; index += 1) {
1972
- const { reject, resolve } = items[index];
1973
- if (error) reject(value);
1974
- else resolve(value);
1989
+ const item = items[index];
1990
+ if (error) item.reject(value);
1991
+ else item.resolve(value);
1975
1992
  }
1976
1993
  }
1977
1994
  /**
@@ -1993,7 +2010,7 @@ function isOnce(value) {
1993
2010
  return isOnceInstance(value, ONCE_NAME_SYNC);
1994
2011
  }
1995
2012
  function isOnceInstance(value, name) {
1996
- return typeof value === "object" && value !== null && ONCE_PROPERTY in value && value[ONCE_PROPERTY] === name;
2013
+ return typeof value === "object" && value !== null && "$once" in value && value["$once"] === name;
1997
2014
  }
1998
2015
  /**
1999
2016
  * Create a function that can only be called once, returning the same value on subsequent calls
@@ -2015,7 +2032,7 @@ function runOnce(...parameters) {
2015
2032
  }
2016
2033
  function runOnceAsync(...parameters) {
2017
2034
  const state = this[ONCE_SYMBOL];
2018
- if (state.cleared) return Promise.reject(new Error(ONCE_MESSAGE_CLEARED));
2035
+ if (state.cleared) return Promise.reject(/* @__PURE__ */ new Error(ONCE_MESSAGE_CLEARED));
2019
2036
  if (state.finished) return state.error ? Promise.reject(state.value) : Promise.resolve(state.value);
2020
2037
  if (state.called) return new Promise((resolve, reject) => {
2021
2038
  state.items.push({
@@ -2036,15 +2053,12 @@ function runOnceAsync(...parameters) {
2036
2053
  });
2037
2054
  });
2038
2055
  }
2039
- const ONCE_MESSAGE_CLEARED = "Once has been cleared";
2040
- const ONCE_MESSAGE_EXPECTATION = "Once expected a function";
2041
- const ONCE_SYMBOL = Symbol(ONCE_PROPERTY);
2042
2056
  asyncOnce.is = isAsyncOnce;
2043
2057
  once.async = asyncOnce;
2044
2058
  once.is = isOnce;
2045
2059
  once.isAsync = isAsyncOnce;
2046
2060
  //#endregion
2047
- //#region src/function/retry.ts
2061
+ //#region src/models/function/retry.model.ts
2048
2062
  /**
2049
2063
  * An error thrown when a retry fails
2050
2064
  */
@@ -2056,6 +2070,11 @@ var RetryError = class extends Error {
2056
2070
  this.name = RETRY_ERROR_NAME;
2057
2071
  }
2058
2072
  };
2073
+ const RETRY_ERROR_NAME = "RetryError";
2074
+ const RETRY_MESSAGE_EXPECTATION = "Retry expected a function";
2075
+ const RETRY_MESSAGE_FAILED = "Retry failed";
2076
+ //#endregion
2077
+ //#region src/function/retry.ts
2059
2078
  /**
2060
2079
  * Retry a callback a specified number of times, with a delay between attempts
2061
2080
  *
@@ -2119,11 +2138,22 @@ function retry(callback, options) {
2119
2138
  function shouldRetry() {
2120
2139
  return true;
2121
2140
  }
2122
- const RETRY_ERROR_NAME = "RetryError";
2123
- const RETRY_MESSAGE_EXPECTATION = "Retry expected a function";
2124
- const RETRY_MESSAGE_FAILED = "Retry failed";
2125
2141
  retry.async = asyncRetry;
2126
2142
  //#endregion
2143
+ //#region src/models/function/memoize.model.ts
2144
+ const MEMOIZED_CACHE_SIZE_DEFAULT = 1024;
2145
+ const MEMOIZED_CALLBACK = "Memoized requires a callback function";
2146
+ const MEMOIZED_SYMBOL = Symbol("memoized");
2147
+ //#endregion
2148
+ //#region src/models/misc.model.ts
2149
+ const EXPRESSION_INTEGER = /^\d+$/;
2150
+ const EXPRESSION_NUMBER_BINARY = /^0b[01]+$/i;
2151
+ const EXPRESSION_NUMBER_OCTAL = /^0o[0-7]+$/i;
2152
+ const EXPRESSION_NUMBER_ZEROISH = /^\s*0+\s*$/;
2153
+ const EXPRESSION_NUMERICAL_PREFIX = /^\d/;
2154
+ const EXPRESSION_WHITESPACE_MULTIPLE = /\s+/g;
2155
+ const EXPRESSION_WHITESPACE_ONLY = /^\s*$/;
2156
+ //#endregion
2127
2157
  //#region src/internal/number.ts
2128
2158
  /**
2129
2159
  * Is the number between a minimum and maximum value?
@@ -2184,15 +2214,11 @@ function getNumber(value) {
2184
2214
  if (typeof parsed !== "string") return getNumber(parsed);
2185
2215
  const trimmed = parsed.trim();
2186
2216
  if (trimmed.length === 0) return NaN;
2187
- if (NUMBER_EXPRESSION_ZEROISH.test(parsed)) return 0;
2188
- const isBinary = NUMBER_EXPRESSION_BINARY.test(trimmed);
2189
- if (isBinary || NUMBER_EXPRESSION_OCTAL.test(trimmed)) return Number.parseInt(trimmed.slice(2), isBinary ? 2 : NUMBER_OCTAL_VALUE);
2217
+ if (EXPRESSION_NUMBER_ZEROISH.test(parsed)) return 0;
2218
+ const isBinary = EXPRESSION_NUMBER_BINARY.test(trimmed);
2219
+ if (isBinary || EXPRESSION_NUMBER_OCTAL.test(trimmed)) return Number.parseInt(trimmed.slice(2), isBinary ? 2 : 8);
2190
2220
  return Number(trimmed);
2191
2221
  }
2192
- const NUMBER_EXPRESSION_BINARY = /^0b[01]+$/i;
2193
- const NUMBER_EXPRESSION_OCTAL = /^0o[0-7]+$/i;
2194
- const NUMBER_EXPRESSION_ZEROISH = /^\s*0+\s*$/;
2195
- const NUMBER_OCTAL_VALUE = 8;
2196
2222
  //#endregion
2197
2223
  //#region src/internal/sized/misc.ts
2198
2224
  function getSizedMaximum(first, second) {
@@ -2291,7 +2317,7 @@ function deleteMemoizedValue(key) {
2291
2317
  }
2292
2318
  function createGetter(state, callback) {
2293
2319
  return (...parameters) => {
2294
- const key = state.options.cacheKey?.(...parameters) ?? (parameters.length === 1 ? parameters[0] : join(parameters.map(getString), MEMOIZED_KEY_SEPARATOR));
2320
+ const key = state.options.cacheKey?.(...parameters) ?? (parameters.length === 1 ? parameters[0] : join(parameters.map(getString), "_"));
2295
2321
  if (state.cache.has(key)) return state.cache.get(key);
2296
2322
  const value = callback(...parameters);
2297
2323
  state.cache.set(key, value);
@@ -2331,10 +2357,15 @@ function memoize(callback, options) {
2331
2357
  function runMemoized(...parameters) {
2332
2358
  return this[MEMOIZED_SYMBOL].getter(...parameters);
2333
2359
  }
2334
- const MEMOIZED_CACHE_SIZE_DEFAULT = 1024;
2335
- const MEMOIZED_CALLBACK = "Memoized requires a callback function";
2336
- const MEMOIZED_KEY_SEPARATOR = "_";
2337
- const MEMOIZED_SYMBOL = Symbol("memoized");
2360
+ //#endregion
2361
+ //#region src/models/function/work.model.ts
2362
+ const WORK_MESSAGE_FLOW_ARRAY = "Flow expected to receive an array of functions";
2363
+ const WORK_MESSAGE_FLOW_PROMISE = "Synchronous Flow received a promise. Use `flow.async` instead.";
2364
+ const WORK_MESSAGE_NESTING = "Return values are too deeply nested.";
2365
+ const WORK_MESSAGE_PIPE_ARRAY = "Pipe expected to receive an array of functions";
2366
+ const WORK_MESSAGE_PIPE_PROMISE = "Synchronous Pipe received a promise. Use `pipe.async` instead.";
2367
+ const assertFlowFunctions = assert.condition((value) => Array.isArray(value) && value.every((item) => typeof item === "function"), WORK_MESSAGE_FLOW_ARRAY, TypeError);
2368
+ const assertPipeFunctions = assert.condition((value) => Array.isArray(value) && value.every((item) => typeof item === "function"), WORK_MESSAGE_PIPE_ARRAY, TypeError);
2338
2369
  //#endregion
2339
2370
  //#region src/internal/function/work.ts
2340
2371
  function asyncFlow(...fns) {
@@ -2386,16 +2417,18 @@ function work(initial, functions, flow) {
2386
2417
  }
2387
2418
  return transformed;
2388
2419
  }
2389
- const WORK_MESSAGE_FLOW_ARRAY = "Flow expected to receive an array of functions";
2390
- const WORK_MESSAGE_FLOW_PROMISE = "Synchronous Flow received a promise. Use `flow.async` instead.";
2391
- const WORK_MESSAGE_NESTING = "Return values are too deeply nested.";
2392
- const WORK_MESSAGE_PIPE_ARRAY = "Pipe expected to receive an array of functions";
2393
- const WORK_MESSAGE_PIPE_PROMISE = "Synchronous Pipe received a promise. Use `pipe.async` instead.";
2394
- const assertFlowFunctions = assert.condition((value) => Array.isArray(value) && value.every((item) => typeof item === "function"), WORK_MESSAGE_FLOW_ARRAY, TypeError);
2395
- const assertPipeFunctions = assert.condition((value) => Array.isArray(value) && value.every((item) => typeof item === "function"), WORK_MESSAGE_PIPE_ARRAY, TypeError);
2396
2420
  flow.async = asyncFlow;
2397
2421
  pipe.async = asyncPipe;
2398
2422
  //#endregion
2423
+ //#region src/models/string/string.case.model.ts
2424
+ const STRING_CASE_CAMEL = "camel";
2425
+ const STRING_CASE_KEBAB = "kebab";
2426
+ const STRING_CASE_PASCAL = "pascal";
2427
+ const STRING_CASE_SNAKE = "snake";
2428
+ const STRING_EXPRESSION_CAMEL_CASE = /(\p{Ll})(\p{Lu})/gu;
2429
+ const STRING_EXPRESSION_ACRONYM = /(\p{Lu}*)(\p{Lu})(\p{Ll}+)/gu;
2430
+ const STRING_REPLACEMENT_CAMEL_CASE = "$1-$2";
2431
+ //#endregion
2399
2432
  //#region src/internal/string/case.ts
2400
2433
  /**
2401
2434
  * Convert a string to camel case _(thisIsCamelCase)_
@@ -2482,7 +2515,7 @@ function toCaseCallback(value) {
2482
2515
  const partsLength = parts.length;
2483
2516
  const cased = [];
2484
2517
  for (let partIndex = 0; partIndex < partsLength; partIndex += 1) {
2485
- const items = parts[partIndex].replace(STRING_EXPRESSION_ACRONYM, (full, one, two, three) => three === STRING_S ? full : `${one}-${two}${three}`).replace(STRING_EXPRESSION_CAMEL_CASE, STRING_REPLACEMENT_CAMEL_CASE).split("-");
2518
+ const items = parts[partIndex].replace(STRING_EXPRESSION_ACRONYM, (full, one, two, three) => three === "s" ? full : `${one}-${two}${three}`).replace(STRING_EXPRESSION_CAMEL_CASE, STRING_REPLACEMENT_CAMEL_CASE).split("-");
2486
2519
  const itemsLength = items.length;
2487
2520
  const partResult = [];
2488
2521
  let itemCount = 0;
@@ -2508,29 +2541,23 @@ function upperCase(value) {
2508
2541
  memoizedUpperCase ??= memoize((v) => v.toLocaleUpperCase());
2509
2542
  return memoizedUpperCase.run(value);
2510
2543
  }
2511
- const STRING_CASE_CAMEL = "camel";
2512
- const STRING_CASE_KEBAB = "kebab";
2513
- const STRING_CASE_PASCAL = "pascal";
2514
- const STRING_CASE_SNAKE = "snake";
2515
- const STRING_DELIMTER_EMPTY = "";
2516
- const STRING_DELIMITER_HYPHEN = "-";
2517
- const STRING_DELIMITER_UNDERSCORE = "_";
2518
- const STRING_EXPRESSION_CAMEL_CASE = /(\p{Ll})(\p{Lu})/gu;
2519
- const STRING_EXPRESSION_ACRONYM = /(\p{Lu}*)(\p{Lu})(\p{Ll}+)/gu;
2520
- const STRING_REPLACEMENT_CAMEL_CASE = "$1-$2";
2521
- const STRING_S = "s";
2522
2544
  const caseMemoizers = {};
2523
2545
  const delimiters = {
2524
- [STRING_CASE_CAMEL]: STRING_DELIMTER_EMPTY,
2525
- [STRING_CASE_KEBAB]: STRING_DELIMITER_HYPHEN,
2526
- [STRING_CASE_PASCAL]: STRING_DELIMTER_EMPTY,
2527
- [STRING_CASE_SNAKE]: STRING_DELIMITER_UNDERSCORE
2546
+ [STRING_CASE_CAMEL]: "",
2547
+ [STRING_CASE_KEBAB]: "-",
2548
+ [STRING_CASE_PASCAL]: "",
2549
+ [STRING_CASE_SNAKE]: "_"
2528
2550
  };
2529
2551
  let memoizedCapitalize;
2530
2552
  let memoizedLowerCase;
2531
2553
  let memoizedTitleCase;
2532
2554
  let memoizedUpperCase;
2533
2555
  //#endregion
2556
+ //#region src/models/value/value.equal.model.ts
2557
+ const EQUAL_ERROR_PROPERTIES = ["name", "message"];
2558
+ const EQUAL_EXPRESSION_PROPERTIES = ["source", "flags"];
2559
+ const EQUAL_SYMBOL = Symbol("equal");
2560
+ //#endregion
2534
2561
  //#region src/internal/value/equal.ts
2535
2562
  function Equalizer(options) {
2536
2563
  this[EQUAL_SYMBOL] = options;
@@ -2590,9 +2617,9 @@ function equalArray(first, second, options) {
2590
2617
  const { length } = first;
2591
2618
  if (length !== second.length) return false;
2592
2619
  let offset = 0;
2593
- if (length >= EQUAL_ARRAY_THRESHOLD) {
2594
- offset = round(length / EQUAL_ARRAY_PEEK_PERCENTAGE);
2595
- offset = offset > EQUAL_ARRAY_THRESHOLD ? EQUAL_ARRAY_THRESHOLD : offset;
2620
+ if (length >= 100) {
2621
+ offset = round(length / 10);
2622
+ offset = offset > 100 ? 100 : offset;
2596
2623
  for (let index = 0; index < offset; index += 1) if (!(equalValue(first[index], second[index], options) && equalValue(first[length - index - 1], second[length - index - 1], options))) return false;
2597
2624
  }
2598
2625
  const end = length - offset;
@@ -2622,7 +2649,7 @@ function equalPlainObject(first, second, options) {
2622
2649
  firstKeys = firstKeys.filter((key) => filterKey(key, options));
2623
2650
  secondKeys = secondKeys.filter((key) => filterKey(key, options));
2624
2651
  }
2625
- const secondSet = secondKeys.length >= EQUAL_MINIMUM_LENGTH_FOR_SET ? new Set(secondKeys) : void 0;
2652
+ const secondSet = secondKeys.length >= 16 ? new Set(secondKeys) : void 0;
2626
2653
  const { length } = firstKeys;
2627
2654
  if (length !== secondKeys.length) return false;
2628
2655
  for (let index = 0; index < length; index += 1) {
@@ -2699,12 +2726,6 @@ function initializeEqualizer(options) {
2699
2726
  function registerEqualizer(constructor, handler) {
2700
2727
  equalHandler.base.register(constructor, handler);
2701
2728
  }
2702
- const EQUAL_ARRAY_PEEK_PERCENTAGE = 10;
2703
- const EQUAL_ARRAY_THRESHOLD = 100;
2704
- const EQUAL_ERROR_PROPERTIES = ["name", "message"];
2705
- const EQUAL_EXPRESSION_PROPERTIES = ["source", "flags"];
2706
- const EQUAL_MINIMUM_LENGTH_FOR_SET = 16;
2707
- const EQUAL_SYMBOL = Symbol("equal");
2708
2729
  const equalHandler = createCompareHandler(equal, { callback: Object.is });
2709
2730
  equal.deregister = deregisterEqualizer;
2710
2731
  equal.handler = equalHandler;
@@ -2737,7 +2758,7 @@ function setValue(data, path, value, ignoreCase) {
2737
2758
  let next = unwrap(handleValue(target, currentPath, null, true, shouldIgnoreCase), void 0);
2738
2759
  if (typeof next !== "object" || next === null) {
2739
2760
  const nextPath = paths[index + 1];
2740
- if (SET_EXPRESSION_INDEX.test(nextPath)) next = Array.from({ length: +nextPath + 1 }, () => void 0);
2761
+ if (EXPRESSION_INTEGER.test(nextPath)) next = Array.from({ length: +nextPath + 1 }, () => void 0);
2741
2762
  else next = {};
2742
2763
  target[currentPath] = next;
2743
2764
  }
@@ -2745,9 +2766,8 @@ function setValue(data, path, value, ignoreCase) {
2745
2766
  }
2746
2767
  return data;
2747
2768
  }
2748
- const SET_EXPRESSION_INDEX = /^\d+$/;
2749
2769
  //#endregion
2750
- //#region src/internal/models/plan.model.ts
2770
+ //#region src/models/plan.model.ts
2751
2771
  const GENERATOR_NAME_ASYNC = "AsyncGeneratorFunction";
2752
2772
  const GENERATOR_NAME_SYNC = "GeneratorFunction";
2753
2773
  const PLAN_MESSAGE_PLAN_INPUT = "plan requires a generator function";
@@ -2756,19 +2776,7 @@ const PLAN_SYMBOL = Symbol("plan");
2756
2776
  const PLAN_TYPE_PLAN_ASYNC = "asyncPlan";
2757
2777
  const PLAN_TYPE_PLAN_SYNC = "plan";
2758
2778
  //#endregion
2759
- //#region src/internal/plan.ts
2760
- /**
2761
- * Create an immediately failing generator
2762
- *
2763
- * @param reason Failure reason
2764
- * @returns Failing generator
2765
- */
2766
- function fail(reason) {
2767
- return (function* () {
2768
- yield;
2769
- throw reason;
2770
- })();
2771
- }
2779
+ //#region src/plan/is.ts
2772
2780
  /**
2773
2781
  * Is the value an asynchronous generator function?
2774
2782
  *
@@ -2811,29 +2819,19 @@ function isPlan(value) {
2811
2819
  function isPlanInstance(type, value) {
2812
2820
  return typeof value === "object" && value !== null && PLAN_SYMBOL in value && value[PLAN_SYMBOL].type === type;
2813
2821
  }
2814
- /**
2815
- * Create an immediately succeeding generator
2816
- *
2817
- * @param value Success value
2818
- * @returns Succeeding generator
2819
- */
2820
- function succeed(value) {
2821
- return (function* () {
2822
- yield;
2823
- return value;
2824
- })();
2825
- }
2826
2822
  //#endregion
2827
2823
  //#region src/plan/generate.ts
2828
- async function asyncGenerate(callback, parameters) {
2829
- const generator = callback(...parameters);
2824
+ async function asyncGenerate(input, parameters, unwrap) {
2825
+ let generator;
2826
+ if (typeof input === "function") generator = input(...parameters);
2827
+ else generator = input.generator(...parameters);
2830
2828
  let success = true;
2831
2829
  let lastValue;
2832
2830
  try {
2833
2831
  while (true) {
2834
2832
  const next = await generator.next(lastValue);
2835
- const { done } = next;
2836
- let { value } = next;
2833
+ const done = next.done === true;
2834
+ const { value } = next;
2837
2835
  if (value instanceof Error) throw value;
2838
2836
  if (isError(value)) throw value.error;
2839
2837
  lastValue = value;
@@ -2843,13 +2841,15 @@ async function asyncGenerate(callback, parameters) {
2843
2841
  lastValue = error;
2844
2842
  success = false;
2845
2843
  } finally {
2846
- await generator?.return(lastValue);
2844
+ await generator.return(lastValue);
2847
2845
  }
2848
- if (success) return lastValue;
2846
+ if (success) return unwrap && isOk(lastValue) ? lastValue.value : lastValue;
2849
2847
  throw lastValue;
2850
2848
  }
2851
- function generate(callback, parameters) {
2852
- const generator = callback(...parameters);
2849
+ function generate(input, parameters, unwrap) {
2850
+ let generator;
2851
+ if (typeof input === "function") generator = input(...parameters);
2852
+ else generator = input.generator(...parameters);
2853
2853
  let success = true;
2854
2854
  let lastValue;
2855
2855
  try {
@@ -2868,45 +2868,45 @@ function generate(callback, parameters) {
2868
2868
  } finally {
2869
2869
  generator.return(lastValue);
2870
2870
  }
2871
- if (success) return lastValue;
2871
+ if (success) return unwrap && isOk(lastValue) ? lastValue.value : lastValue;
2872
2872
  throw lastValue;
2873
2873
  }
2874
2874
  //#endregion
2875
2875
  //#region src/plan/result.ts
2876
2876
  function asyncAttemptRun(input, ...parameters) {
2877
2877
  if (isAsyncPlan(input)) return input.attempt(...parameters);
2878
- if (isAsyncGenerator(input)) return asyncAttempt(() => asyncGenerate(input, parameters));
2878
+ if (isAsyncGenerator(input)) return asyncAttempt(() => asyncGenerate(input, parameters, true));
2879
2879
  throw new Error(PLAN_MESSAGE_RUN_INPUT);
2880
2880
  }
2881
2881
  function attemptRun(input, ...parameters) {
2882
2882
  if (isPlan(input)) return input.attempt(...parameters);
2883
- if (isGenerator(input)) return attempt(() => generate(input, parameters));
2883
+ if (isGenerator(input)) return attempt(() => generate(input, parameters, true));
2884
2884
  throw new Error(PLAN_MESSAGE_RUN_INPUT);
2885
2885
  }
2886
2886
  function attemptRunAsyncPlan(...parameters) {
2887
- return asyncAttempt(() => this.run(...parameters));
2887
+ return asyncAttempt(() => asyncGenerate(this[PLAN_SYMBOL], parameters, true));
2888
2888
  }
2889
2889
  function attemptRunPlan(...parameters) {
2890
- return attempt(() => this.run(...parameters));
2890
+ return attempt(() => generate(this[PLAN_SYMBOL], parameters, true));
2891
2891
  }
2892
2892
  attemptRun.async = asyncAttemptRun;
2893
2893
  //#endregion
2894
2894
  //#region src/plan/run.ts
2895
2895
  function asyncRun(input, ...parameters) {
2896
2896
  if (isAsyncPlan(input)) return input.run(...parameters);
2897
- if (isAsyncGenerator(input)) return asyncGenerate(input, parameters);
2897
+ if (isAsyncGenerator(input)) return asyncGenerate(input, parameters, false);
2898
2898
  throw new Error(PLAN_MESSAGE_RUN_INPUT);
2899
2899
  }
2900
2900
  function run(input, ...parameters) {
2901
2901
  if (isPlan(input)) return input.run(...parameters);
2902
- if (isGenerator(input)) return generate(input, parameters);
2902
+ if (isGenerator(input)) return generate(input, parameters, false);
2903
2903
  throw new Error(PLAN_MESSAGE_RUN_INPUT);
2904
2904
  }
2905
2905
  function runAsyncPlan(...parameters) {
2906
- return asyncGenerate(this[PLAN_SYMBOL].generator, parameters);
2906
+ return asyncGenerate(this[PLAN_SYMBOL], parameters, false);
2907
2907
  }
2908
2908
  function runPlan(...parameters) {
2909
- return generate(this[PLAN_SYMBOL].generator, parameters);
2909
+ return generate(this[PLAN_SYMBOL], parameters, false);
2910
2910
  }
2911
2911
  asyncRun.attempt = asyncAttemptRun;
2912
2912
  run.async = asyncRun;
@@ -2941,32 +2941,52 @@ function plan(generator) {
2941
2941
  throw new Error(PLAN_MESSAGE_PLAN_INPUT);
2942
2942
  }
2943
2943
  //#endregion
2944
+ //#region src/plan/misc.ts
2945
+ /**
2946
+ * Create an immediately failing plan
2947
+ *
2948
+ * @param reason Failure reason
2949
+ * @returns Plan failure
2950
+ */
2951
+ function fail(reason) {
2952
+ return (function* () {
2953
+ throw reason;
2954
+ })();
2955
+ }
2956
+ /**
2957
+ * Create an immediately succeeding plan
2958
+ *
2959
+ * @param value Success value
2960
+ * @returns Plan success
2961
+ */
2962
+ function succeed(value) {
2963
+ return (function* () {
2964
+ return value;
2965
+ })();
2966
+ }
2967
+ function succeedResult(value) {
2968
+ return (function* () {
2969
+ return ok(value);
2970
+ })();
2971
+ }
2972
+ succeed.result = succeedResult;
2973
+ //#endregion
2974
+ //#region src/models/aborter.model.ts
2975
+ const ABORTER_EVENT = "abort";
2976
+ const ABORTER_OPTIONS = { once: true };
2977
+ //#endregion
2944
2978
  //#region src/internal/aborter.ts
2945
2979
  function createAborter(value, onAbort) {
2946
2980
  if (!(value instanceof AbortSignal)) return;
2947
- value.addEventListener(ABORT_EVENT, onAbort, ABORT_OPTIONS);
2981
+ value.addEventListener(ABORTER_EVENT, onAbort, ABORTER_OPTIONS);
2948
2982
  return {
2949
2983
  callback: onAbort,
2950
2984
  signal: value,
2951
- cancel: () => value.removeEventListener(ABORT_EVENT, onAbort)
2985
+ cancel: () => value.removeEventListener(ABORTER_EVENT, onAbort)
2952
2986
  };
2953
2987
  }
2954
- const ABORT_EVENT = "abort";
2955
- const ABORT_OPTIONS = { once: true };
2956
- //#endregion
2957
- //#region src/promise/constants.ts
2958
- const PROMISE_ERROR_NAME = "PromiseTimeoutError";
2959
- const PROMISE_MESSAGE_EXPECTATION_ATTEMPT = "Attempt expected a function or a promise";
2960
- const PROMISE_MESSAGE_EXPECTATION_ITEMS_TYPE = "promises expected an array or object holding promise-functions or promises";
2961
- const PROMISE_MESSAGE_EXPECTATION_RESULT = "toResult expected a Promise";
2962
- const PROMISE_MESSAGE_EXPECTATION_TIMED = "Timed function expected a Promise";
2963
- const PROMISE_MESSAGE_TIMEOUT = "Promise timed out";
2964
- const PROMISE_STRATEGY_ALL = /* @__PURE__ */ new Set(["complete", "first"]);
2965
- const PROMISE_STRATEGY_DEFAULT = "complete";
2966
- const PROMISE_TYPE_FULFILLED = "fulfilled";
2967
- const PROMISE_TYPE_REJECTED = "rejected";
2968
2988
  //#endregion
2969
- //#region src/promise/models.ts
2989
+ //#region src/models/promise.model.ts
2970
2990
  /**
2971
2991
  * A _Promise_ that can be canceled
2972
2992
  */
@@ -2999,6 +3019,16 @@ var PromiseTimeoutError = class extends Error {
2999
3019
  this.name = PROMISE_ERROR_NAME;
3000
3020
  }
3001
3021
  };
3022
+ const PROMISE_ERROR_NAME = "PromiseTimeoutError";
3023
+ const PROMISE_MESSAGE_EXPECTATION_ATTEMPT = "Attempt expected a function or a promise";
3024
+ const PROMISE_MESSAGE_EXPECTATION_ITEMS_TYPE = "promises expected an array or object holding promise-functions or promises";
3025
+ const PROMISE_MESSAGE_EXPECTATION_RESULT = "toResult expected a Promise";
3026
+ const PROMISE_MESSAGE_EXPECTATION_TIMED = "Timed function expected a Promise";
3027
+ const PROMISE_MESSAGE_TIMEOUT = "Promise timed out";
3028
+ const PROMISE_STRATEGY_ALL = /* @__PURE__ */ new Set(["complete", "first"]);
3029
+ const PROMISE_STRATEGY_DEFAULT = "complete";
3030
+ const PROMISE_TYPE_FULFILLED = "fulfilled";
3031
+ const PROMISE_TYPE_REJECTED = "rejected";
3002
3032
  //#endregion
3003
3033
  //#region src/promise/helpers.ts
3004
3034
  function createPromiseOptions(input) {
@@ -3046,7 +3076,10 @@ function getStrategyOrDefault(value) {
3046
3076
  * @returns `true` if the value is a fulfilled _Promise_ result, otherwise `false`
3047
3077
  */
3048
3078
  function isFulfilled(value) {
3049
- return isType(value, PROMISE_TYPE_FULFILLED);
3079
+ return isPromiseResult(value, PROMISE_TYPE_FULFILLED);
3080
+ }
3081
+ function isPromiseResult(value, type) {
3082
+ return isPlainObject(value) && "status" in value && value.status === type;
3050
3083
  }
3051
3084
  /**
3052
3085
  * Is the value a rejected _Promise_ result?
@@ -3055,10 +3088,7 @@ function isFulfilled(value) {
3055
3088
  * @returns `true` if the value is a rejected _Promise_ result, otherwise `false`
3056
3089
  */
3057
3090
  function isRejected(value) {
3058
- return isType(value, PROMISE_TYPE_REJECTED);
3059
- }
3060
- function isType(value, type) {
3061
- return isPlainObject(value) && "status" in value && value.status === type;
3091
+ return isPromiseResult(value, PROMISE_TYPE_REJECTED);
3062
3092
  }
3063
3093
  //#endregion
3064
3094
  //#region src/promise/misc.ts
@@ -3075,7 +3105,8 @@ function handleResult(status, parameters) {
3075
3105
  const { aborter, complete, data, handlers, index, key, value } = parameters;
3076
3106
  if (aborter?.signal.aborted ?? false) return;
3077
3107
  if (!complete && status === "rejected") {
3078
- settlePromise(handlers.reject, value, aborter);
3108
+ aborter?.cancel();
3109
+ handlers.reject(value);
3079
3110
  return;
3080
3111
  }
3081
3112
  data.result[key] = !complete ? value : status === "fulfilled" ? {
@@ -3085,7 +3116,10 @@ function handleResult(status, parameters) {
3085
3116
  status,
3086
3117
  reason: value
3087
3118
  };
3088
- if (index === data.last) settlePromise(handlers.resolve, data.result, aborter);
3119
+ if (index === data.last) {
3120
+ aborter?.cancel();
3121
+ handlers.resolve(data.result);
3122
+ }
3089
3123
  }
3090
3124
  function settlePromise(settler, value, aborter) {
3091
3125
  aborter?.cancel();
@@ -3213,28 +3247,39 @@ async function resultPromises(items, signal) {
3213
3247
  promises.result = resultPromises;
3214
3248
  //#endregion
3215
3249
  //#region src/result/match.ts
3216
- async function asyncMatchResult(result, first, error) {
3250
+ async function asyncMatchResult(result, first, second) {
3217
3251
  let value;
3218
3252
  if (typeof result === "function") value = await result();
3219
3253
  else if (result instanceof Promise) value = await result;
3220
3254
  else value = result;
3221
- if (!isResult(value)) throw new Error(MATCH_MESSAGE);
3222
- const hasObj = typeof first === "object" && first !== null;
3223
- const okHandler = hasObj ? first.ok : first;
3224
- const errorHandler = hasObj ? first.error : error;
3225
- if (isOk(value)) return okHandler(value.value);
3226
- return errorHandler(value.error, value.original);
3227
- }
3228
- function matchResult(result, first, error) {
3255
+ if (!isResult(value)) throw new Error(MATCH_MESSAGE_RESULT);
3256
+ return handleResult$1(value, first, second);
3257
+ }
3258
+ function handleResult$1(result, first, second) {
3259
+ let error;
3260
+ let ok;
3261
+ if (isPlainObject(first)) {
3262
+ ok = first.ok;
3263
+ error = first.error;
3264
+ } else {
3265
+ ok = first;
3266
+ error = second;
3267
+ }
3268
+ if (isOk(result)) {
3269
+ if (typeof ok !== "function") throw new Error(MATCH_MESSAGE_OK);
3270
+ return ok(result.value);
3271
+ }
3272
+ if (typeof error !== "function") throw new Error(MATCH_MESSAGE_ERROR);
3273
+ return error(result.error, result.original);
3274
+ }
3275
+ function matchResult(result, first, second) {
3229
3276
  const value = typeof result === "function" ? result() : result;
3230
- if (!isResult(value)) throw new Error(MATCH_MESSAGE);
3231
- const hasObj = typeof first === "object" && first !== null;
3232
- const okHandler = hasObj ? first.ok : first;
3233
- const errorHandler = hasObj ? first.error : error;
3234
- if (isOk(value)) return okHandler(value.value);
3235
- return errorHandler(value.error, value.original);
3236
- }
3237
- const MATCH_MESSAGE = "`result.match` expected a Result or a function that returns a Result";
3277
+ if (!isResult(value)) throw new Error(MATCH_MESSAGE_RESULT);
3278
+ return handleResult$1(value, first, second);
3279
+ }
3280
+ const MATCH_MESSAGE_ERROR = "`result.match` expected an Error callback";
3281
+ const MATCH_MESSAGE_OK = "`result.match` expected an Ok callback";
3282
+ const MATCH_MESSAGE_RESULT = "`result.match` expected a Result or a function that returns a Result";
3238
3283
  matchResult.async = asyncMatchResult;
3239
3284
  //#endregion
3240
3285
  //#region src/result/work/flow.ts
@@ -3279,6 +3324,12 @@ function attemptPipe(initial, first, ...seconds) {
3279
3324
  }
3280
3325
  attemptPipe.async = attemptAsyncPipe;
3281
3326
  //#endregion
3327
+ //#region src/models/string/string.fuzzy.model.ts
3328
+ const FUZZY_MESSAGE_ARRAY = "Fuzzy requires an array of items";
3329
+ const FUZZY_MESSAGE_HANDLER = "Fuzzy requires a key or function to stringify items";
3330
+ const FUZZY_PROPERTY = "$fuzzy";
3331
+ const FUZZY_SYMBOL = Symbol(FUZZY_PROPERTY);
3332
+ //#endregion
3282
3333
  //#region src/string/match.ts
3283
3334
  /**
3284
3335
  * Check if a string ends with a specified substring
@@ -3289,7 +3340,7 @@ attemptPipe.async = attemptAsyncPipe;
3289
3340
  * @returns `true` if the string ends with the given substring, otherwise `false`
3290
3341
  */
3291
3342
  function endsWith(haystack, needle, ignoreCase) {
3292
- return match(MATCH_ENDS_WITH, haystack, needle, ignoreCase === true);
3343
+ return match(STRING_MATCH_ENDS_WITH, haystack, needle, ignoreCase === true);
3293
3344
  }
3294
3345
  /**
3295
3346
  * Check if a string includes a specified substring
@@ -3300,7 +3351,7 @@ function endsWith(haystack, needle, ignoreCase) {
3300
3351
  * @returns `true` if the string includes the given substring, otherwise `false`
3301
3352
  */
3302
3353
  function includes(haystack, needle, ignoreCase) {
3303
- return match(MATCH_INCLUDES, haystack, needle, ignoreCase === true);
3354
+ return match(STRING_MATCH_INCLUDES, haystack, needle, ignoreCase === true);
3304
3355
  }
3305
3356
  function match(type, haystack, needle, ignoreCase) {
3306
3357
  if (typeof haystack !== "string" || typeof needle !== "string") return false;
@@ -3319,16 +3370,11 @@ function matchCallback(haystack, needle, ignoreCase) {
3319
3370
  * @returns `true` if the string starts with the given substring, otherwise `false`
3320
3371
  */
3321
3372
  function startsWith(haystack, needle, ignoreCase) {
3322
- return match(MATCH_STARTS_WITH, haystack, needle, ignoreCase === true);
3373
+ return match(STRING_MATCH_STARTS_WITH, haystack, needle, ignoreCase === true);
3323
3374
  }
3324
- const MATCH_ENDS_WITH = "endsWith";
3325
- const MATCH_INCLUDES = "includes";
3326
- const MATCH_STARTS_WITH = "startsWith";
3327
3375
  const matchMemoizers = {};
3328
3376
  //#endregion
3329
3377
  //#region src/string/fuzzy.ts
3330
- const FUZZY_PROPERTY = "$fuzzy";
3331
- const FUZZY_SYMBOL = Symbol(FUZZY_PROPERTY);
3332
3378
  function Fuzzy(state) {
3333
3379
  this[FUZZY_SYMBOL] = state;
3334
3380
  }
@@ -3416,19 +3462,19 @@ function getScore(haystack, needle) {
3416
3462
  if (haystackIndex === 0) score += 1;
3417
3463
  if (previousMatchIndex !== -1) {
3418
3464
  const gap = haystackIndex - previousMatchIndex - 1;
3419
- score += max([0, FUZZY_PROXIMITY_THRESHOLD - gap]);
3465
+ score += max([0, 5 - gap]);
3420
3466
  }
3421
3467
  previousMatchIndex = haystackIndex;
3422
3468
  needleIndex += 1;
3423
3469
  }
3424
3470
  if (needleIndex === needleLength) break;
3425
3471
  }
3426
- score -= floor(lowerCaseHaystack.length / FUZZY_LENGTH_DIVISOR);
3472
+ score -= floor(lowerCaseHaystack.length / 3);
3427
3473
  return max([0, score]);
3428
3474
  }
3429
3475
  function getTolerance(input, state) {
3430
3476
  if (typeof input === "number" && !Number.isNaN(input)) return input < 0 ? 0 : floor(input);
3431
- return state?.tolerance ?? FUZZY_PROXIMITY_THRESHOLD;
3477
+ return state?.tolerance ?? 5;
3432
3478
  }
3433
3479
  /**
3434
3480
  * Is the value a fuzzy searcher?
@@ -3439,7 +3485,7 @@ function getTolerance(input, state) {
3439
3485
  * @returns `true` if the value is a fuzzy searcher, otherwise `false`
3440
3486
  */
3441
3487
  function isFuzzy(value) {
3442
- return typeof value === "object" && value !== null && FUZZY_PROPERTY in value && value[FUZZY_PROPERTY] === true;
3488
+ return typeof value === "object" && value !== null && "$fuzzy" in value && value["$fuzzy"] === true;
3443
3489
  }
3444
3490
  function isSubsequence(haystack, needle) {
3445
3491
  const lowerCaseHaystack = lowerCase(haystack);
@@ -3507,12 +3553,8 @@ function setFuzzyItems(value) {
3507
3553
  if (!Array.isArray(value)) throw new TypeError(FUZZY_MESSAGE_ARRAY);
3508
3554
  const state = this[FUZZY_SYMBOL];
3509
3555
  state.items = value.slice();
3510
- state.strings = value.map(state.handler);
3556
+ state.strings = value.map((item) => state.handler(item));
3511
3557
  }
3512
- const FUZZY_LENGTH_DIVISOR = 3;
3513
- const FUZZY_MESSAGE_ARRAY = "Fuzzy requires an array of items";
3514
- const FUZZY_MESSAGE_HANDLER = "Fuzzy requires a key or function to stringify items";
3515
- const FUZZY_PROXIMITY_THRESHOLD = 5;
3516
3558
  fuzzy.is = isFuzzy;
3517
3559
  fuzzy.match = fuzzyMatch;
3518
3560
  //#endregion
@@ -3528,7 +3570,7 @@ function dedent(value, ...values) {
3528
3570
  const lastIndex = length - 1;
3529
3571
  const lengths = [];
3530
3572
  for (let index = 0; index < length; index += 1) {
3531
- const [, indentation] = /^(\s+)/.exec(lines[index]) ?? [];
3573
+ const [, indentation] = STRING_EXPRESSION_WHITESPACE_PREFIX.exec(lines[index]) ?? [];
3532
3574
  if (indentation != null) lengths.push(indentation.length);
3533
3575
  }
3534
3576
  if (lengths.length === 0) return actual.trim();
@@ -3553,16 +3595,16 @@ function getUuid(html) {
3553
3595
  crypto.getRandomValues(bytes);
3554
3596
  bytes[6] = bytes[6] & 15 | 64;
3555
3597
  bytes[8] = bytes[8] & 63 | 128;
3556
- const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, STRING_ZERO)).join("");
3598
+ const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
3557
3599
  const first = hex.substring(0, 8);
3558
- if (forHTML && STRING_NUMERICAL_PREFIX_PATTERN.test(first)) continue;
3600
+ if (forHTML && EXPRESSION_NUMERICAL_PREFIX.test(first)) continue;
3559
3601
  return [
3560
3602
  first,
3561
3603
  hex.substring(8, 12),
3562
3604
  hex.substring(12, 16),
3563
3605
  hex.substring(16, 20),
3564
3606
  hex.substring(20, 32)
3565
- ].join(forHTML ? STRING_DELIMITER_UUID_HTML : STRING_DELIMITER_UUID_DEFAULT);
3607
+ ].join(forHTML ? "_" : "-");
3566
3608
  }
3567
3609
  }
3568
3610
  /**
@@ -3605,17 +3647,51 @@ function truncate(value, length, suffix) {
3605
3647
  const truncatedLength = length - actualSuffixLength;
3606
3648
  return `${value.slice(0, truncatedLength)}${actualSuffix}`;
3607
3649
  }
3608
- const STRING_DELIMITER_UUID_DEFAULT = "-";
3609
- const STRING_DELIMITER_UUID_HTML = "_";
3610
- const STRING_NUMERICAL_PREFIX_PATTERN = /^\d/;
3611
- const STRING_ZERO = "0";
3650
+ //#endregion
3651
+ //#region src/models/string/string.normalize.model.ts
3652
+ const NORMALIZE_DEBURR_CHARACTERS = {
3653
+ Æ: "AE",
3654
+ æ: "ae",
3655
+ Ð: "D",
3656
+ ð: "d",
3657
+ Đ: "D",
3658
+ đ: "d",
3659
+ Ħ: "H",
3660
+ ħ: "h",
3661
+ IJ: "IJ",
3662
+ ij: "ij",
3663
+ İ: "I",
3664
+ ı: "i",
3665
+ ĸ: "k",
3666
+ Ŀ: "L",
3667
+ ŀ: "l",
3668
+ Ł: "L",
3669
+ ł: "l",
3670
+ Ŋ: "N",
3671
+ ŋ: "n",
3672
+ ʼn: "'n",
3673
+ Œ: "OE",
3674
+ œ: "oe",
3675
+ Ø: "O",
3676
+ ø: "o",
3677
+ ſ: "s",
3678
+ ß: "ss",
3679
+ Þ: "TH",
3680
+ þ: "th",
3681
+ Ŧ: "T",
3682
+ ŧ: "t"
3683
+ };
3684
+ const NORMALIZE_DEBURR_PATTERN_CHARACTERS = new RegExp(`(${Object.keys(NORMALIZE_DEBURR_CHARACTERS).join("|")})`, "g");
3685
+ const NORMALIZE_DEBURR_PATTERN_SIMPLE = /[\u0300-\u036f]/g;
3686
+ const NORMALIZE_SPECIAL_PATTERN = /[\p{P}\p{S}]/gu;
3687
+ const NORMALIZE_SYMBOL = Symbol("normalize");
3612
3688
  //#endregion
3613
3689
  //#region src/string/normalize.ts
3614
3690
  function Normalizer(options) {
3615
3691
  this[NORMALIZE_SYMBOL] = options;
3616
3692
  }
3617
3693
  Normalizer.prototype.normalize = normalizeString;
3618
- function createNormalizeOptions(input) {
3694
+ function createNormalizerOptions(input) {
3619
3695
  const options = isPlainObject(input) ? input : {};
3620
3696
  return {
3621
3697
  deburr: options.deburr !== false,
@@ -3634,7 +3710,7 @@ function createNormalizeOptions(input) {
3634
3710
  function deburr(value) {
3635
3711
  if (typeof value !== "string") return "";
3636
3712
  deburrMemoizer ??= memoize((value) => {
3637
- let deburred = value.normalize(NORMALIZE_DEBURR_NORMALIZATION).replace(NORMALIZE_DEBURR_PATTERN_SIMPLE, "");
3713
+ let deburred = value.normalize("NFD").replace(NORMALIZE_DEBURR_PATTERN_SIMPLE, "");
3638
3714
  deburred = deburred.replace(NORMALIZE_DEBURR_PATTERN_CHARACTERS, (_, character) => NORMALIZE_DEBURR_CHARACTERS[character]);
3639
3715
  return deburred;
3640
3716
  });
@@ -3649,7 +3725,7 @@ function deburr(value) {
3649
3725
  * @returns Normalizer function
3650
3726
  */
3651
3727
  function initializeNormalizer(options) {
3652
- return new Normalizer(createNormalizeOptions(options));
3728
+ return new Normalizer(createNormalizerOptions(options));
3653
3729
  }
3654
3730
  /**
3655
3731
  * Normalize a string
@@ -3661,63 +3737,26 @@ function initializeNormalizer(options) {
3661
3737
  * @returns Normalized string
3662
3738
  */
3663
3739
  function normalize(value, options) {
3664
- return normalizeString.call(createNormalizeOptions(options), value);
3740
+ return normalizeString.call(createNormalizerOptions(options), value);
3665
3741
  }
3666
3742
  function normalizeString(value) {
3667
3743
  if (typeof value !== "string") return "";
3668
3744
  const options = NORMALIZE_SYMBOL in this ? this[NORMALIZE_SYMBOL] : this;
3669
3745
  let result = value;
3670
3746
  if (options.trim) result = result.trim();
3671
- if (options.whitespace) result = result.replace(NORMALIZE_WHITESPACE_PATTERN, NORMALIZE_WHITESPACE_REPLACEMENT);
3747
+ if (options.whitespace) result = result.replace(EXPRESSION_WHITESPACE_MULTIPLE, " ");
3672
3748
  if (options.deburr) result = deburr(result);
3673
3749
  if (options.lowerCase) result = lowerCase(result);
3674
- if (options.special) result = result.replace(NORMALIZE_SPECIAL_PATTERN, NORMALIZE_SPECIAL_REPLACEMENT);
3675
- return result.normalize(NORMALIZE_NORMALIZATION_NORMALIZATION);
3750
+ if (options.special) result = result.replace(NORMALIZE_SPECIAL_PATTERN, "");
3751
+ return result.normalize("NFC");
3676
3752
  }
3677
- const NORMALIZE_DEBURR_CHARACTERS = {
3678
- Æ: "AE",
3679
- æ: "ae",
3680
- Ð: "D",
3681
- ð: "d",
3682
- Đ: "D",
3683
- đ: "d",
3684
- Ħ: "H",
3685
- ħ: "h",
3686
- IJ: "IJ",
3687
- ij: "ij",
3688
- İ: "I",
3689
- ı: "i",
3690
- ĸ: "k",
3691
- Ŀ: "L",
3692
- ŀ: "l",
3693
- Ł: "L",
3694
- ł: "l",
3695
- Ŋ: "N",
3696
- ŋ: "n",
3697
- ʼn: "'n",
3698
- Œ: "OE",
3699
- œ: "oe",
3700
- Ø: "O",
3701
- ø: "o",
3702
- ſ: "s",
3703
- ß: "ss",
3704
- Þ: "TH",
3705
- þ: "th",
3706
- Ŧ: "T",
3707
- ŧ: "t"
3708
- };
3709
- const NORMALIZE_DEBURR_NORMALIZATION = "NFD";
3710
- const NORMALIZE_DEBURR_PATTERN_CHARACTERS = new RegExp(`(${Object.keys(NORMALIZE_DEBURR_CHARACTERS).join("|")})`, "g");
3711
- const NORMALIZE_DEBURR_PATTERN_SIMPLE = /[\u0300-\u036f]/g;
3712
- const NORMALIZE_NORMALIZATION_NORMALIZATION = "NFC";
3713
- const NORMALIZE_SPECIAL_PATTERN = /[\p{P}\p{S}]/gu;
3714
- const NORMALIZE_SPECIAL_REPLACEMENT = "";
3715
- const NORMALIZE_SYMBOL = Symbol("normalize");
3716
- const NORMALIZE_WHITESPACE_PATTERN = /\s+/g;
3717
- const NORMALIZE_WHITESPACE_REPLACEMENT = " ";
3718
3753
  let deburrMemoizer;
3719
3754
  normalize.initialize = initializeNormalizer;
3720
3755
  //#endregion
3756
+ //#region src/models/string/string.template.model.ts
3757
+ const TEMPLATE_EXPRESSION_VARIABLE = /{{([\s\S]+?)}}/g;
3758
+ const TEMPLATE_SYMBOL = Symbol("template");
3759
+ //#endregion
3721
3760
  //#region src/string/template.ts
3722
3761
  function Templater(options) {
3723
3762
  this[TEMPLATE_SYMBOL] = options;
@@ -3768,12 +3807,31 @@ function template(value, ...parameters) {
3768
3807
  const { ignoreCase, pattern } = createTemplateOptions(parameters[1]);
3769
3808
  return handleTemplate(value, pattern, ignoreCase, parameters[0]);
3770
3809
  }
3771
- const TEMPLATE_EXPRESSION_VARIABLE = /{{([\s\S]+?)}}/g;
3772
- const TEMPLATE_SYMBOL = Symbol("template");
3773
3810
  template.initialize = initializeTemplater;
3774
3811
  //#endregion
3775
- //#region src/value/clone.ts
3812
+ //#region src/models/value/value.clone.model.ts
3776
3813
  const CLONE_NAME = "clone";
3814
+ const CLONE_COPY_OPTIONS = {
3815
+ copyFunctions: true,
3816
+ copySymbols: true
3817
+ };
3818
+ const CLONE_DEFAULT_OPTIONS = {
3819
+ copyFunctions: false,
3820
+ copySymbols: false
3821
+ };
3822
+ const CLONE_PRIMITIVES = {
3823
+ bigint: true,
3824
+ boolean: true,
3825
+ function: false,
3826
+ number: true,
3827
+ object: false,
3828
+ string: true,
3829
+ symbol: false,
3830
+ undefined: true
3831
+ };
3832
+ const CLONE_SYMBOL = Symbol(CLONE_NAME);
3833
+ //#endregion
3834
+ //#region src/value/clone.ts
3777
3835
  function Cloner(options) {
3778
3836
  this[CLONE_SYMBOL] = options;
3779
3837
  }
@@ -3810,14 +3868,14 @@ function cloneAny(value, parameters, depth, options) {
3810
3868
  }
3811
3869
  }
3812
3870
  function cloneArrayBuffer(value, parameters, depth) {
3813
- if (parameters.copy || depth >= CLONE_MAX_DEPTH) return value;
3871
+ if (parameters.copy || depth >= 100) return value;
3814
3872
  const cloned = new ArrayBuffer(value.byteLength);
3815
3873
  new Uint8Array(cloned).set(new Uint8Array(value));
3816
3874
  parameters.references.set(value, cloned);
3817
3875
  return cloned;
3818
3876
  }
3819
3877
  function cloneDataView(value, parameters, depth) {
3820
- if (parameters.copy || depth >= CLONE_MAX_DEPTH) return value;
3878
+ if (parameters.copy || depth >= 100) return value;
3821
3879
  const buffer = cloneArrayBuffer(value.buffer, parameters, depth);
3822
3880
  const cloned = new DataView(buffer, value.byteOffset, value.byteLength);
3823
3881
  parameters.references.set(value, cloned);
@@ -3830,7 +3888,7 @@ function cloneFromCloner(value) {
3830
3888
  }, 0);
3831
3889
  }
3832
3890
  function cloneMap(map, parameters, depth) {
3833
- if (depth >= CLONE_MAX_DEPTH) return map;
3891
+ if (depth >= 100) return map;
3834
3892
  if (parameters.copy) return new Map(map);
3835
3893
  const cloned = /* @__PURE__ */ new Map();
3836
3894
  for (const [key, value] of map.entries()) cloned.set(cloneAny(key, parameters, depth + 1), cloneAny(value, parameters, depth + 1));
@@ -3838,13 +3896,13 @@ function cloneMap(map, parameters, depth) {
3838
3896
  return cloned;
3839
3897
  }
3840
3898
  function cloneNode(node, parameters, depth) {
3841
- if (parameters.copy || depth >= CLONE_MAX_DEPTH) return node;
3899
+ if (parameters.copy || depth >= 100) return node;
3842
3900
  const cloned = node.cloneNode(true);
3843
3901
  parameters.references.set(node, cloned);
3844
3902
  return cloned;
3845
3903
  }
3846
3904
  function cloneObject(value, parameters, depth) {
3847
- if (depth >= CLONE_MAX_DEPTH) return value;
3905
+ if (depth >= 100) return value;
3848
3906
  const isArray = Array.isArray(value);
3849
3907
  if (parameters.copy) return isArray ? value.slice() : { ...value };
3850
3908
  const cloned = isArray ? [] : {};
@@ -3858,14 +3916,14 @@ function cloneObject(value, parameters, depth) {
3858
3916
  return cloned;
3859
3917
  }
3860
3918
  function cloneRegularExpression(value, parameters, depth) {
3861
- if (parameters.copy || depth >= CLONE_MAX_DEPTH) return value;
3919
+ if (parameters.copy || depth >= 100) return value;
3862
3920
  const cloned = new RegExp(value.source, value.flags);
3863
3921
  cloned.lastIndex = value.lastIndex;
3864
3922
  parameters.references.set(value, cloned);
3865
3923
  return cloned;
3866
3924
  }
3867
3925
  function cloneSet(set, parameters, depth) {
3868
- if (depth >= CLONE_MAX_DEPTH) return set;
3926
+ if (depth >= 100) return set;
3869
3927
  if (parameters.copy) return new Set(set);
3870
3928
  const cloned = /* @__PURE__ */ new Set();
3871
3929
  for (const value of set.values()) cloned.add(cloneAny(value, parameters, depth + 1));
@@ -3873,7 +3931,7 @@ function cloneSet(set, parameters, depth) {
3873
3931
  return cloned;
3874
3932
  }
3875
3933
  function cloneTypedArray(value, parameters, depth) {
3876
- if (parameters.copy || depth >= CLONE_MAX_DEPTH) return value;
3934
+ if (parameters.copy || depth >= 100) return value;
3877
3935
  const cloned = new value.constructor(value);
3878
3936
  parameters.references.set(value, cloned);
3879
3937
  return cloned;
@@ -3925,35 +3983,15 @@ function registerCloner(constructor, handler) {
3925
3983
  cloneHandler.base.register(constructor, handler);
3926
3984
  }
3927
3985
  function tryStructuredClone(value, parameters, depth) {
3928
- if (depth >= CLONE_MAX_DEPTH) return value;
3986
+ if (depth >= 100) return value;
3929
3987
  const cloned = unwrap(attempt(() => structuredClone(value)), value);
3930
3988
  parameters.references.set(value, cloned);
3931
3989
  return cloned;
3932
3990
  }
3933
- const CLONE_COPY_OPTIONS = {
3934
- copyFunctions: true,
3935
- copySymbols: true
3936
- };
3937
- const CLONE_DEFAULT_OPTIONS = {
3938
- copyFunctions: false,
3939
- copySymbols: false
3940
- };
3941
- const CLONE_MAX_DEPTH = 100;
3942
3991
  const cloneHandler = createValueHandler(clone, {
3943
3992
  callback: tryStructuredClone,
3944
3993
  method: CLONE_NAME
3945
3994
  });
3946
- const CLONE_PRIMITIVES = {
3947
- bigint: true,
3948
- boolean: true,
3949
- function: false,
3950
- number: true,
3951
- object: false,
3952
- string: true,
3953
- symbol: false,
3954
- undefined: true
3955
- };
3956
- const CLONE_SYMBOL = Symbol(CLONE_NAME);
3957
3995
  clone.deregister = deregisterCloner;
3958
3996
  clone.handlers = cloneHandler;
3959
3997
  clone.initialize = initializeCloner;
@@ -3978,10 +4016,16 @@ function inMap(map, value, key) {
3978
4016
  function inSet(set, value) {
3979
4017
  if (!(set instanceof Set)) return false;
3980
4018
  if (set.has(value)) return true;
4019
+ if (isPrimitive(value)) return false;
3981
4020
  for (const item of set) if (equal(item, value)) return true;
3982
4021
  return false;
3983
4022
  }
3984
4023
  //#endregion
4024
+ //#region src/models/value/value.diff.model.ts
4025
+ const DIFF_FULL = "full";
4026
+ const DIFF_NONE = "none";
4027
+ const DIFF_PARTIAL = "partial";
4028
+ //#endregion
3985
4029
  //#region src/value/diff.ts
3986
4030
  /**
3987
4031
  * Find the differences between two values
@@ -4081,9 +4125,6 @@ function setChanges(parameters) {
4081
4125
  const diffsLength = diffs.length;
4082
4126
  for (let diffIndex = 0; diffIndex < diffsLength; diffIndex += 1) changes.push(diffs[diffIndex]);
4083
4127
  }
4084
- const DIFF_FULL = "full";
4085
- const DIFF_NONE = "none";
4086
- const DIFF_PARTIAL = "partial";
4087
4128
  //#endregion
4088
4129
  //#region src/value/freeze.ts
4089
4130
  function fakeDelete() {
@@ -4225,7 +4266,7 @@ function shake(value) {
4225
4266
  //#endregion
4226
4267
  //#region src/value/smush.ts
4227
4268
  function flattenObject(value, depth, smushed, prefix) {
4228
- if (depth >= SMUSH_MAX_DEPTH) return {};
4269
+ if (depth >= 100) return {};
4229
4270
  if (smushed.has(value)) return smushed.get(value);
4230
4271
  const keys = Object.keys(value);
4231
4272
  const { length } = keys;
@@ -4257,7 +4298,6 @@ function flattenObject(value, depth, smushed, prefix) {
4257
4298
  function smush(value) {
4258
4299
  return typeof value === "object" && value !== null ? flattenObject(value, 0, /* @__PURE__ */ new WeakMap()) : {};
4259
4300
  }
4260
- const SMUSH_MAX_DEPTH = 100;
4261
4301
  //#endregion
4262
4302
  //#region src/value/unsmush.ts
4263
4303
  function getKeys(value) {
@@ -4294,6 +4334,10 @@ function unsmush(value) {
4294
4334
  return unsmushed;
4295
4335
  }
4296
4336
  //#endregion
4337
+ //#region src/models/value/value.merge.model.ts
4338
+ const MERGE_SYMBOL_ASSIGN = Symbol("assign");
4339
+ const MERGE_SYMBOL_MERGE = Symbol("merge");
4340
+ //#endregion
4297
4341
  //#region src/value/merge.ts
4298
4342
  function Assigner(options) {
4299
4343
  this[MERGE_SYMBOL_ASSIGN] = {
@@ -4315,21 +4359,22 @@ Merger.prototype.merge = mergeFromMerger;
4315
4359
  * @returns Assigned value
4316
4360
  */
4317
4361
  function assign(to, from, options) {
4318
- const actual = createMergeOptions(options);
4362
+ const actual = createMergingOptions(options);
4319
4363
  actual.assignValues = true;
4320
4364
  return mergeValues([to, ...from], actual);
4321
4365
  }
4322
4366
  function assignFromAssigner(to, from) {
4323
4367
  return mergeValues([to, ...from], this[MERGE_SYMBOL_ASSIGN]);
4324
4368
  }
4325
- function createMergeOptions(options) {
4369
+ function createMergingOptions(input) {
4326
4370
  const actual = {
4327
4371
  assignValues: false,
4328
4372
  replaceableObjects: void 0,
4329
4373
  skipNullableAny: false,
4330
4374
  skipNullableInArrays: false
4331
4375
  };
4332
- if (typeof options !== "object" || options == null) return actual;
4376
+ if (typeof input !== "object" || input == null) return actual;
4377
+ const options = input;
4333
4378
  actual.replaceableObjects = getReplaceableObjects(options.replaceableObjects);
4334
4379
  actual.assignValues = options.assignValues === true;
4335
4380
  actual.skipNullableAny = options.skipNullableAny === true;
@@ -4350,7 +4395,7 @@ function getReplaceableObjects(value) {
4350
4395
  * @returns Assigner function
4351
4396
  */
4352
4397
  function initializeAssigner(options) {
4353
- return new Assigner(createMergeOptions(options));
4398
+ return new Assigner(createMergingOptions(options));
4354
4399
  }
4355
4400
  /**
4356
4401
  * Create a merger with predefined options
@@ -4361,7 +4406,7 @@ function initializeAssigner(options) {
4361
4406
  * @returns Merger function
4362
4407
  */
4363
4408
  function initializeMerger(options) {
4364
- return new Merger(createMergeOptions(options));
4409
+ return new Merger(createMergingOptions(options));
4365
4410
  }
4366
4411
  /**
4367
4412
  * Merge multiple arrays or objects into a single one
@@ -4371,7 +4416,7 @@ function initializeMerger(options) {
4371
4416
  * @returns Merged value
4372
4417
  */
4373
4418
  function merge(values, options) {
4374
- return mergeValues(values, createMergeOptions(options));
4419
+ return mergeValues(values, createMergingOptions(options));
4375
4420
  }
4376
4421
  function mergeFromMerger(values) {
4377
4422
  return mergeValues(values, this[MERGE_SYMBOL_MERGE]);
@@ -4405,11 +4450,12 @@ function mergeValues(values, options, prefix) {
4405
4450
  if (actual.length > 1) return mergeObjects(actual, options, options.assignValues ? actual[0] : void 0, prefix);
4406
4451
  return options.assignValues ? actual[0] : Array.isArray(actual[0]) ? actual[0].slice() : { ...actual[0] };
4407
4452
  }
4408
- const MERGE_SYMBOL_ASSIGN = Symbol("assign");
4409
- const MERGE_SYMBOL_MERGE = Symbol("merge");
4410
4453
  assign.initialize = initializeAssigner;
4411
4454
  merge.initialize = initializeMerger;
4412
4455
  //#endregion
4456
+ //#region src/models/value/value.transform.model.ts
4457
+ const TRANSFORM_SYMBOL = Symbol("transform");
4458
+ //#endregion
4413
4459
  //#region src/value/transform.ts
4414
4460
  function Transformer(transformer) {
4415
4461
  this[TRANSFORM_SYMBOL] = transformer;
@@ -4448,13 +4494,18 @@ function transformValue(value) {
4448
4494
  }
4449
4495
  return value;
4450
4496
  }
4451
- const TRANSFORM_SYMBOL = Symbol("transform");
4452
4497
  transform.initialize = initializeTransformer;
4453
4498
  //#endregion
4454
- //#region src/internal/subscription.ts
4499
+ //#region src/models/subscription.model.ts
4500
+ const SUBSCRIPTION_DISALLOWED_KEY = "Disallowed key for subscription";
4501
+ const SUBSCRIPTION_INVALID_KEY = "Invalid key for subscription";
4502
+ const SUBSCRIPTION_INVALID_VALUE = "A subscription requires a non-null value to identify it";
4455
4503
  const SUBSCRIPTION_NAME = "subscription";
4456
4504
  const SUBSCRIPTION_PROPERTY = "$subscription";
4457
4505
  const SUBSCRIPTION_STORE = "subscriptions";
4506
+ const SUBSCRIPTION_SYMBOL = Symbol(SUBSCRIPTION_PROPERTY);
4507
+ //#endregion
4508
+ //#region src/internal/subscription.ts
4458
4509
  function Subscription(state, property, parameters) {
4459
4510
  this[SUBSCRIPTION_SYMBOL] = state;
4460
4511
  this[property.key] = property.value;
@@ -4611,7 +4662,7 @@ function isSubscription(value) {
4611
4662
  return isSubscriptionInstance(value, SUBSCRIPTION_NAME);
4612
4663
  }
4613
4664
  function isSubscriptionInstance(value, name) {
4614
- return typeof value === "object" && value !== null && SUBSCRIPTION_PROPERTY in value && value[SUBSCRIPTION_PROPERTY] === name;
4665
+ return typeof value === "object" && value !== null && "$subscription" in value && value["$subscription"] === name;
4615
4666
  }
4616
4667
  /**
4617
4668
  * Is the value a subscriptions store?
@@ -4662,15 +4713,22 @@ function removeSubscription() {
4662
4713
  function subscriptions(parameters) {
4663
4714
  return new Subscriptions(parameters);
4664
4715
  }
4665
- const SUBSCRIPTION_DISALLOWED_KEY = "Disallowed key for subscription";
4666
- const SUBSCRIPTION_INVALID_KEY = "Invalid key for subscription";
4667
- const SUBSCRIPTION_INVALID_VALUE = "A subscription requires a non-null value to identify it";
4668
- const SUBSCRIPTION_SYMBOL = Symbol(SUBSCRIPTION_PROPERTY);
4669
4716
  //#endregion
4670
- //#region src/beacon.ts
4717
+ //#region src/models/beacon.model.ts
4718
+ const BEACON_MESSAGE_RETRIEVE = "Cannot retrieve observable from a closed beacon";
4719
+ const BEACON_MESSAGE_SUBSCRIBE = "Cannot subscribe to a closed observable";
4671
4720
  const BEACON_PROPERTY = "$beacon";
4672
4721
  const BEACON_NAME = "beacon";
4673
4722
  const BEACON_OBSERVABLE = "observable";
4723
+ const BEACON_SYMBOL = Symbol(BEACON_PROPERTY);
4724
+ const BEACON_TYPE_ERROR = "error";
4725
+ const BEACON_TYPE_NEXT = "next";
4726
+ const beaconSubscription = {
4727
+ key: BEACON_PROPERTY,
4728
+ value: SUBSCRIPTION_NAME
4729
+ };
4730
+ //#endregion
4731
+ //#region src/beacon.ts
4674
4732
  function Beacon(value, options) {
4675
4733
  this[BEACON_SYMBOL] = {
4676
4734
  value,
@@ -4794,7 +4852,7 @@ function isBeacon(value) {
4794
4852
  return isBeaconInstance(BEACON_NAME, value);
4795
4853
  }
4796
4854
  function isBeaconInstance(name, value) {
4797
- return typeof value === "object" && value !== null && BEACON_PROPERTY in value && value[BEACON_PROPERTY] === name;
4855
+ return typeof value === "object" && value !== null && "$beacon" in value && value["$beacon"] === name;
4798
4856
  }
4799
4857
  /**
4800
4858
  * Is the value a beacon subscription?
@@ -4803,7 +4861,7 @@ function isBeaconInstance(name, value) {
4803
4861
  * @returns `true` if the value is a beacon subscription, otherwise `false`
4804
4862
  */
4805
4863
  function isBeaconSubscription(value) {
4806
- return isSubscription(value) && value[BEACON_PROPERTY] === "subscription";
4864
+ return isSubscription(value) && value["$beacon"] === "subscription";
4807
4865
  }
4808
4866
  /**
4809
4867
  * Is the value an observable?
@@ -4829,7 +4887,7 @@ function subscribeToObservable(first, second, third) {
4829
4887
  function updateBeacon(instance, type, value, finish) {
4830
4888
  const state = instance[BEACON_SYMBOL];
4831
4889
  if (!state.active) return;
4832
- if (type === BEACON_TYPE_NEXT) {
4890
+ if (type === "next") {
4833
4891
  if (state.options.equal(state.value, value)) return;
4834
4892
  state.value = value;
4835
4893
  }
@@ -4837,17 +4895,8 @@ function updateBeacon(instance, type, value, finish) {
4837
4895
  if (subscriptions != null && subscriptions.size > 0) for (const [, observer] of subscriptions) observer[type]?.(value);
4838
4896
  if (finish === true) closeBeacon(state, true);
4839
4897
  }
4840
- const BEACON_MESSAGE_RETRIEVE = "Cannot retrieve observable from a closed beacon";
4841
- const BEACON_MESSAGE_SUBSCRIBE = "Cannot subscribe to a closed observable";
4842
- const BEACON_SYMBOL = Symbol(BEACON_PROPERTY);
4843
- const BEACON_TYPE_ERROR = "error";
4844
- const BEACON_TYPE_NEXT = "next";
4845
- const beaconSubscription = {
4846
- key: BEACON_PROPERTY,
4847
- value: SUBSCRIPTION_NAME
4848
- };
4849
4898
  //#endregion
4850
- //#region src/internal/models/herald.model.ts
4899
+ //#region src/models/herald.model.ts
4851
4900
  const HERALD_MESSAGE_ARRAY = "Herald requires an array of event names.";
4852
4901
  const HERALD_MESSAGE_ONCREATE = `Herald requires a valid onCreate callback for subscription creation`;
4853
4902
  const HERALD_MESSAGE_PROPERTY = `Herald requires valid property information for subscription identification`;
@@ -6260,7 +6309,7 @@ function isNonNullableOrEmpty(value) {
6260
6309
  * @returns `true` if the value is not `undefined`, `null`, or matches a whitespace-only string, otherwise `false`
6261
6310
  */
6262
6311
  function isNonNullableOrWhitespace(value) {
6263
- return value != null && !EXPRESSION_WHITESPACE.test(getString(value));
6312
+ return value != null && !EXPRESSION_WHITESPACE_ONLY.test(getString(value));
6264
6313
  }
6265
6314
  /**
6266
6315
  * Is the value not a number or a number-like string?
@@ -6305,7 +6354,7 @@ function isNullableOrEmpty(value) {
6305
6354
  * @returns `true` if the value is nullable or matches a whitespace-only string, otherwise `false`
6306
6355
  */
6307
6356
  function isNullableOrWhitespace(value) {
6308
- return value == null || EXPRESSION_WHITESPACE.test(getString(value));
6357
+ return value == null || EXPRESSION_WHITESPACE_ONLY.test(getString(value));
6309
6358
  }
6310
6359
  /**
6311
6360
  * Is the value a number or a number-like string?
@@ -6325,12 +6374,14 @@ function isNumerical(value) {
6325
6374
  function isObject(value) {
6326
6375
  return typeof value === "object" && value !== null || typeof value === "function";
6327
6376
  }
6328
- const EXPRESSION_WHITESPACE = /^\s*$/;
6329
6377
  //#endregion
6330
- //#region src/logger.ts
6378
+ //#region src/models/logger.model.ts
6331
6379
  const LOGGER_NAME = "Logger";
6332
6380
  const LOGGER_NAME_TIMED = "TimedLogger";
6333
6381
  const LOGGER_PROPERTY = "$logger";
6382
+ const LOGGER_SYMBOL = Symbol(LOGGER_PROPERTY);
6383
+ //#endregion
6384
+ //#region src/logger.ts
6334
6385
  function Lumberjack() {}
6335
6386
  Lumberjack.prototype[LOGGER_PROPERTY] = LOGGER_NAME;
6336
6387
  Lumberjack.prototype.time = getTimeLogger;
@@ -6397,7 +6448,7 @@ function isLogger(value) {
6397
6448
  return isLoggerInstance(LOGGER_NAME, value);
6398
6449
  }
6399
6450
  function isLoggerInstance(name, value) {
6400
- return typeof value === "object" && value !== null && LOGGER_PROPERTY in value && value[LOGGER_PROPERTY] === name;
6451
+ return typeof value === "object" && value !== null && "$logger" in value && value["$logger"] === name;
6401
6452
  }
6402
6453
  function isTimeLogger(value) {
6403
6454
  return isLoggerInstance(LOGGER_NAME_TIMED, value);
@@ -6405,7 +6456,6 @@ function isTimeLogger(value) {
6405
6456
  function setLoggerEnabled(value) {
6406
6457
  enabled = typeof value === "boolean" ? value : enabled;
6407
6458
  }
6408
- const LOGGER_SYMBOL = Symbol(LOGGER_PROPERTY);
6409
6459
  /**
6410
6460
  * A logger that can be used to log messages to the console
6411
6461
  *
@@ -6461,6 +6511,16 @@ function sum(array, key) {
6461
6511
  return getAggregated("sum", array, key);
6462
6512
  }
6463
6513
  //#endregion
6514
+ //#region src/models/query.model.ts
6515
+ const QUERY_EXPRESSION_ARRAY_SUFFIX = /\[\]$/;
6516
+ const QUERY_EXPRESSION_BOOLEAN = /^(false|true)$/;
6517
+ const QUERY_TRUE = "true";
6518
+ const QUERY_TYPES = /* @__PURE__ */ new Set([
6519
+ "boolean",
6520
+ "number",
6521
+ "string"
6522
+ ]);
6523
+ //#endregion
6464
6524
  //#region src/query.ts
6465
6525
  /**
6466
6526
  * Convert a query string to a plain _(nested)_ object
@@ -6470,7 +6530,7 @@ function sum(array, key) {
6470
6530
  */
6471
6531
  function fromQuery(query) {
6472
6532
  if (typeof query !== "string" || query.trim().length === 0) return {};
6473
- const parts = query.split(QUERY_AMPERSAND).map((part) => part.split(QUERY_EQUAL).map(tryDecode)).sort(([first], [second]) => first.localeCompare(second));
6533
+ const parts = query.split("&").map((part) => part.split("=").map(tryDecode)).sort(([first], [second]) => first.localeCompare(second));
6474
6534
  const { length } = parts;
6475
6535
  const parameters = {};
6476
6536
  let position = 0;
@@ -6500,9 +6560,9 @@ function getParts(value, fromArray, prefix) {
6500
6560
  for (let index = 0; index < length; index += 1) {
6501
6561
  const key = keys[index];
6502
6562
  const val = value[key];
6503
- const fullKey = join([prefix, fromArray ? void 0 : key], QUERY_DOT);
6563
+ const fullKey = join([prefix, fromArray ? void 0 : key], ".");
6504
6564
  const encodedKey = getString(tryEncode(fullKey));
6505
- const prefixedKey = fromArray ? join([encodedKey, index], QUERY_DOT) : encodedKey;
6565
+ const prefixedKey = fromArray ? join([encodedKey, index], ".") : encodedKey;
6506
6566
  if (Array.isArray(val)) parts.push(...getParts(val, true, fullKey));
6507
6567
  else if (isPlainObject(val)) parts.push(...getParts(val, false, fullKey));
6508
6568
  else if (isDecodable(val)) parts.push(`${prefixedKey}=${getString(tryEncode(val))}`);
@@ -6529,24 +6589,10 @@ function isDecodable(value) {
6529
6589
  * @returns Query string representation of the object
6530
6590
  */
6531
6591
  function toQuery(parameters) {
6532
- return isPlainObject(parameters) ? join(getParts(parameters, false).filter((part) => part.length > 0), QUERY_AMPERSAND) : "";
6592
+ return isPlainObject(parameters) ? join(getParts(parameters, false).filter((part) => part.length > 0), "&") : "";
6533
6593
  }
6534
- const QUERY_AMPERSAND = "&";
6535
- const QUERY_DOT = ".";
6536
- const QUERY_EQUAL = "=";
6537
- const QUERY_EXPRESSION_ARRAY_SUFFIX = /\[\]$/;
6538
- const QUERY_EXPRESSION_BOOLEAN = /^(false|true)$/;
6539
- const QUERY_TRUE = "true";
6540
- const QUERY_TYPES = /* @__PURE__ */ new Set([
6541
- "boolean",
6542
- "number",
6543
- "string"
6544
- ]);
6545
6594
  //#endregion
6546
- //#region src/queue.ts
6547
- const QUEUE_NAME_KEYED = "keyedQueue";
6548
- const QUEUE_NAME_QUEUE = "queue";
6549
- const QUEUE_PROPERTY = "$queue";
6595
+ //#region src/models/queue.model.ts
6550
6596
  /**
6551
6597
  * An error thrown by the Queue when an operation fails
6552
6598
  */
@@ -6556,6 +6602,25 @@ var QueueError = class extends Error {
6556
6602
  this.name = QUEUE_ERROR_NAME;
6557
6603
  }
6558
6604
  };
6605
+ const QUEUE_ERROR_NAME = "QueueError";
6606
+ const QUEUE_HANDLE_CLEAR = "clear";
6607
+ const QUEUE_HANDLE_PAUSE = "pause";
6608
+ const QUEUE_HANDLE_RESUME = "resume";
6609
+ const QUEUE_MESSAGE_CALLBACK = "A Queue requires a callback function";
6610
+ const QUEUE_MESSAGE_CLEAR = "Queue was cleared";
6611
+ const QUEUE_MESSAGE_KEY = "Key must be a non-empty string";
6612
+ const QUEUE_MESSAGE_MAXIMUM = "Queue has reached its maximum size";
6613
+ const QUEUE_MESSAGE_REMOVE = "Item removed from queue";
6614
+ const QUEUE_NAME_KEYED = "keyedQueue";
6615
+ const QUEUE_NAME_QUEUE = "queue";
6616
+ const QUEUE_PROPERTY = "$queue";
6617
+ const QUEUE_STATUS_ACTIVE = "active";
6618
+ const QUEUE_STATUS_EMPTY = "empty";
6619
+ const QUEUE_STATUS_FULL = "full";
6620
+ const QUEUE_STATUS_PAUSED = "paused";
6621
+ const QUEUE_SYMBOL = Symbol(QUEUE_PROPERTY);
6622
+ //#endregion
6623
+ //#region src/queue.ts
6559
6624
  function KeyedQueue(callback, options) {
6560
6625
  this[QUEUE_SYMBOL] = {
6561
6626
  callback,
@@ -6699,9 +6764,9 @@ function clearQueue() {
6699
6764
  const items = this[QUEUE_SYMBOL].items.splice(0);
6700
6765
  const { length } = items;
6701
6766
  for (let index = 0; index < length; index += 1) {
6702
- const { aborter, reject } = items[index];
6703
- aborter?.cancel();
6704
- reject(new QueueError(QUEUE_MESSAGE_CLEAR));
6767
+ const item = items[index];
6768
+ item.aborter?.cancel();
6769
+ item.reject(new QueueError(QUEUE_MESSAGE_CLEAR));
6705
6770
  }
6706
6771
  }
6707
6772
  function clearQueues(key) {
@@ -6828,7 +6893,7 @@ function isQueue(value) {
6828
6893
  return isQueueInstance(QUEUE_NAME_QUEUE, value);
6829
6894
  }
6830
6895
  function isQueueInstance(name, value) {
6831
- return typeof value === "object" && value != null && QUEUE_PROPERTY in value && value[QUEUE_PROPERTY] === name;
6896
+ return typeof value === "object" && value != null && "$queue" in value && value["$queue"] === name;
6832
6897
  }
6833
6898
  function keyedQueue(callback, options) {
6834
6899
  if (typeof callback !== "function") throw new TypeError(QUEUE_MESSAGE_CALLBACK);
@@ -6863,9 +6928,9 @@ function removeQueued(id) {
6863
6928
  const state = this[QUEUE_SYMBOL];
6864
6929
  const index = state.items.findIndex((item) => item.id === id);
6865
6930
  if (index > -1) {
6866
- const { aborter, reject } = state.items.splice(index, 1)[0];
6867
- aborter?.cancel();
6868
- reject(new QueueError(QUEUE_MESSAGE_REMOVE));
6931
+ const item = state.items.splice(index, 1)[0];
6932
+ item.aborter?.cancel();
6933
+ item.reject(new QueueError(QUEUE_MESSAGE_REMOVE));
6869
6934
  }
6870
6935
  }
6871
6936
  function resumeQueue() {
@@ -6911,22 +6976,13 @@ async function run$1(state) {
6911
6976
  }
6912
6977
  state.runners -= 1;
6913
6978
  }
6914
- const QUEUE_ERROR_NAME = "QueueError";
6915
- const QUEUE_HANDLE_CLEAR = "clear";
6916
- const QUEUE_HANDLE_PAUSE = "pause";
6917
- const QUEUE_HANDLE_RESUME = "resume";
6918
- const QUEUE_MESSAGE_CALLBACK = "A Queue requires a callback function";
6919
- const QUEUE_MESSAGE_CLEAR = "Queue was cleared";
6920
- const QUEUE_MESSAGE_KEY = "Key must be a non-empty string";
6921
- const QUEUE_MESSAGE_MAXIMUM = "Queue has reached its maximum size";
6922
- const QUEUE_MESSAGE_REMOVE = "Item removed from queue";
6923
- const QUEUE_STATUS_ACTIVE = "active";
6924
- const QUEUE_STATUS_EMPTY = "empty";
6925
- const QUEUE_STATUS_FULL = "full";
6926
- const QUEUE_STATUS_PAUSED = "paused";
6927
- const QUEUE_SYMBOL = Symbol(QUEUE_PROPERTY);
6928
6979
  queue.keyed = keyedQueue;
6929
6980
  //#endregion
6981
+ //#region src/models/random.model.ts
6982
+ const RANDOM_ALPHABET = "abcdefghijklmnopqrstuvwxyz";
6983
+ const RANDOM_BOOLEAN_MODIFIER = .5;
6984
+ const RANDOM_HEX_CHARACTERS = "0123456789ABCDEF";
6985
+ //#endregion
6930
6986
  //#region src/random.ts
6931
6987
  /**
6932
6988
  * Get a random boolean
@@ -6965,7 +7021,7 @@ function getRandomColor(prefix) {
6965
7021
  * @returns Random hexadecimal character from `0-9` and `A-F`
6966
7022
  */
6967
7023
  function getRandomHex() {
6968
- return RANDOM_HEX_CHARACTERS[getRandomInteger(0, RANDOM_HEX_MAXIMUM)];
7024
+ return RANDOM_HEX_CHARACTERS[getRandomInteger(0, 15)];
6969
7025
  }
6970
7026
  /**
6971
7027
  * Get a random item from an array
@@ -6983,10 +7039,6 @@ function getRandomItems(array, amount) {
6983
7039
  if (amount === 1) return [array[getRandomInteger(0, array.length - 1)]];
6984
7040
  return typeof amount !== "number" || amount <= 0 || amount >= array.length ? shuffle(array) : shuffle(array).slice(0, amount);
6985
7041
  }
6986
- const RANDOM_ALPHABET = "abcdefghijklmnopqrstuvwxyz";
6987
- const RANDOM_BOOLEAN_MODIFIER = .5;
6988
- const RANDOM_HEX_CHARACTERS = "0123456789ABCDEF";
6989
- const RANDOM_HEX_MAXIMUM = 15;
6990
7042
  //#endregion
6991
7043
  //#region src/sized/set.ts
6992
7044
  /**
@@ -7043,4 +7095,4 @@ var SizedSet = class extends Set {
7043
7095
  }
7044
7096
  };
7045
7097
  //#endregion
7046
- export { CancelablePromise, Logger, PromiseTimeoutError, QueueError, RetryError, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, SizedMap, SizedSet, push as append, push, assert, assertCondition, assertDefined, assertInstanceOf, assertIs, assertProperty, assign, asyncAttempt, asyncAttemptRun, asyncDebounce, asyncFlow, asyncMatchResult, asyncOnce, asyncPipe, asyncRun, asyncThrottle, attempt, attemptAsyncFlow, attemptAsyncPipe, attemptFlow, attemptPipe, attemptPromise, attemptRun, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, copy, count, debounce, deburr, dedent, delay, deregisterCloner, deregisterComparator, deregisterEqualizer, diff, difference, drop, endsWith, endsWithArray, equal, error, exclude, exists, fail, filter, filterAndMap, filterAndMap as select, find, findLast, first, firstOrDefault, flatFreeze, flatten, floor, flow, freeze, fromQuery, toPromise as fromResult, toPromise, fuzzy, fuzzyMatch, getArray, getArrayComparison, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloatingNumber as getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getSortedIndex, getString, getTimedPromise, getUuid, getValue, groupArraysBy, groupBy, handleResult, hasValue, hasValueResult, herald, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba, hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba, ignoreKey, inMap, inSet, includes, includesArray, indexOf, indexOfArray, initializeAssigner, initializeCloner, initializeEqualizer, initializeMerger, initializeNormalizer, initializeSorter, initializeTemplater, initializeTransformer, insert, interpolate, intersection, isArrayOrPlainObject, isAsyncGenerator, isAsyncOnce, isAsyncPlan, isBeacon, isBeaconSubscription, isColor, isConstructor, isEmpty, isError, isFrozen, isFulfilled, isFuzzy, isGenerator, isHerald, isHeraldEvents, isHeraldSubscription, isHexColor, isHslColor, isHslaColor, isHwbColor, isHwbaColor, isInstanceOf, isKey, isKeyedQueue, isLogger, isNonArrayOrPlainObject, isNonConstructor, isNonEmpty, isNonInstanceOf, isNonKey, isNonNullable, isNonNullableOrEmpty, isNonNullableOrWhitespace, isNonNumber, isNonNumerical, isNonObject, isNonPlainObject, isNonPrimitive, isNonTemplateStringsArray, isNonTypedArray, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isObservable, isOk, isOnce, isPlainObject, isPlan, isPrimitive, isQueue, isQueueInstance, isRejected, isResult, isRgbColor, isRgbaColor, isSorted, isSubscription, isSubscriptions, isTemplateStringsArray, isTimeLogger, isTypedArray, join, kebabCase, keyedQueue, last, lastIndexOf, lastOrDefault, lowerCase, mapAndFilter, mapAndFilter as reverseSelect, matchResult, max, median, memoize, merge, min, move, moveIndices, moveToIndex, noop, normalize, ok, omit, once, parse, partition, pascalCase, pick, pipe, plan, promises, queue, range, registerCloner, registerComparator, registerEqualizer, resultPromises, retry, reverse, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba, round, run, setValue, settlePromise, shake, shuffle, single, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, subscriptions, succeed, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toResult, toSet, toggle, transform, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };
7098
+ export { CancelablePromise, Logger, PromiseTimeoutError, RetryError, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, SizedMap, SizedSet, push as append, push, assert, assertCondition, assertDefined, assertInstanceOf, assertIs, assertProperty, assign, asyncAttempt, asyncAttemptRun, asyncDebounce, asyncFlow, asyncMatchResult, asyncOnce, asyncPipe, asyncRun, asyncThrottle, attempt, attemptAsyncFlow, attemptAsyncPipe, attemptFlow, attemptPipe, attemptPromise, attemptRun, attemptRunAsyncPlan, attemptRunPlan, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, copy, count, debounce, deburr, dedent, delay, deregisterCloner, deregisterComparator, deregisterEqualizer, diff, difference, drop, endsWith, endsWithArray, equal, error, exclude, exists, fail, filter, filterAndMap, filterAndMap as select, find, findLast, first, firstOrDefault, flatFreeze, flatten, floor, flow, freeze, fromQuery, toPromise as fromResult, toPromise, fuzzy, fuzzyMatch, getArray, getArrayComparison, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloatingNumber as getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getSortedIndex, getString, getTimedPromise, getUuid, getValue, groupArraysBy, groupBy, handleResult, hasValue, hasValueResult, herald, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba, hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba, ignoreKey, inMap, inSet, includes, includesArray, indexOf, indexOfArray, initializeAssigner, initializeCloner, initializeEqualizer, initializeMerger, initializeNormalizer, initializeSorter, initializeTemplater, initializeTransformer, insert, interpolate, intersection, isArrayOrPlainObject, isAsyncGenerator, isAsyncOnce, isAsyncPlan, isBeacon, isBeaconSubscription, isColor, isConstructor, isEmpty, isError, isFrozen, isFulfilled, isFuzzy, isGenerator, isHerald, isHeraldEvents, isHeraldSubscription, isHexColor, isHslColor, isHslaColor, isHwbColor, isHwbaColor, isInstanceOf, isKey, isKeyedQueue, isLogger, isNonArrayOrPlainObject, isNonConstructor, isNonEmpty, isNonInstanceOf, isNonKey, isNonNullable, isNonNullableOrEmpty, isNonNullableOrWhitespace, isNonNumber, isNonNumerical, isNonObject, isNonPlainObject, isNonPrimitive, isNonTemplateStringsArray, isNonTypedArray, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isObservable, isOk, isOnce, isPlainObject, isPlan, isPrimitive, isQueue, isQueueInstance, isRejected, isResult, isRgbColor, isRgbaColor, isSorted, isSubscription, isSubscriptions, isTemplateStringsArray, isTimeLogger, isTypedArray, join, kebabCase, keyedQueue, last, lastIndexOf, lastOrDefault, lowerCase, mapAndFilter, mapAndFilter as reverseSelect, matchResult, max, median, memoize, merge, min, move, moveIndices, moveToIndex, noop, normalize, ok, omit, once, parse, partition, pascalCase, pick, pipe, plan, promises, queue, range, registerCloner, registerComparator, registerEqualizer, resultPromises, retry, reverse, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba, round, run, runAsyncPlan, runPlan, setValue, settlePromise, shake, shuffle, single, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, subscriptions, succeed, succeedResult, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toResult, toSet, toggle, transform, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };