@synnaxlabs/x 0.43.0 → 0.44.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 (288) hide show
  1. package/.turbo/turbo-build.log +105 -93
  2. package/dist/base-BAM2mqCy.cjs +1 -0
  3. package/dist/base-DFq0vvGn.js +38 -0
  4. package/dist/binary.cjs +1 -1
  5. package/dist/binary.js +1 -1
  6. package/dist/bounds-D6e9xoHt.cjs +1 -0
  7. package/dist/bounds-Dj9nG39I.js +174 -0
  8. package/dist/bounds.cjs +1 -1
  9. package/dist/bounds.js +2 -2
  10. package/dist/box-BcGdqkt4.cjs +1 -0
  11. package/dist/box-D_qdUyEe.js +205 -0
  12. package/dist/box.cjs +1 -1
  13. package/dist/box.js +1 -1
  14. package/dist/caseconv.cjs +1 -1
  15. package/dist/caseconv.js +2 -2
  16. package/dist/change-C-YELKx6.cjs +1 -0
  17. package/dist/change-DLl6DccR.js +12 -0
  18. package/dist/change.cjs +1 -1
  19. package/dist/change.js +2 -10
  20. package/dist/compare.cjs +1 -1
  21. package/dist/compare.js +1 -1
  22. package/dist/deep.cjs +1 -1
  23. package/dist/deep.js +95 -96
  24. package/dist/dimensions-CRgergMS.js +43 -0
  25. package/dist/dimensions-D2QGoNXO.cjs +1 -0
  26. package/dist/dimensions.cjs +1 -1
  27. package/dist/dimensions.js +2 -41
  28. package/dist/direction-386XDm2w.cjs +1 -0
  29. package/dist/{index-DxU1zwsd.js → direction-8etxfKaR.js} +4 -3
  30. package/dist/direction.cjs +1 -1
  31. package/dist/direction.js +1 -1
  32. package/dist/external-B9AAGv50.cjs +1 -0
  33. package/dist/external-BFgJjMcS.js +23 -0
  34. package/dist/external-BPgtxa8d.js +29 -0
  35. package/dist/external-BYuXBYJh.js +40 -0
  36. package/dist/external-mffsMzJx.cjs +1 -0
  37. package/dist/external-uXk0Avrg.cjs +1 -0
  38. package/dist/index-B1m2qvBT.cjs +1 -0
  39. package/dist/{index-4GlOgZuh.js → index-B5l_quQn.js} +35 -42
  40. package/dist/index-BQe8OIgm.cjs +3 -0
  41. package/dist/index-D2xcvEO5.js +46 -0
  42. package/dist/index-DdhM_E4k.cjs +1 -0
  43. package/dist/index-PNh31WTW.js +125 -0
  44. package/dist/index.cjs +3 -5
  45. package/dist/index.js +685 -5363
  46. package/dist/kv.cjs +1 -1
  47. package/dist/kv.js +2 -45
  48. package/dist/{index-D6V-8SKw.js → location-Ar5y2DX2.js} +26 -26
  49. package/dist/location-DZi8ftXp.cjs +1 -0
  50. package/dist/location.cjs +1 -1
  51. package/dist/location.js +1 -1
  52. package/dist/observe.cjs +1 -1
  53. package/dist/observe.js +16 -20
  54. package/dist/path-BXdMenka.js +101 -0
  55. package/dist/path-st_E5-LJ.cjs +1 -0
  56. package/dist/position-DAL0Qqdf.cjs +1 -0
  57. package/dist/position-bA6pUwLn.js +85 -0
  58. package/dist/position.cjs +1 -1
  59. package/dist/position.js +2 -83
  60. package/dist/record-CAcQ5PNX.js +14 -0
  61. package/dist/record-YvCh7bzB.cjs +1 -0
  62. package/dist/record.cjs +1 -1
  63. package/dist/record.js +2 -8
  64. package/dist/runtime.cjs +1 -1
  65. package/dist/runtime.js +2 -27
  66. package/dist/scale-Bzn1Cl0r.cjs +1 -0
  67. package/dist/{index-BUa-NXAX.js → scale-CdTNWu-d.js} +55 -59
  68. package/dist/scale.cjs +1 -1
  69. package/dist/scale.js +1 -1
  70. package/dist/{index-DBGAIs_7.js → series-BeJyqCoP.js} +835 -759
  71. package/dist/series-anlpaR_I.cjs +6 -0
  72. package/dist/spatial-BSWPzMkK.js +11 -0
  73. package/dist/spatial-DGpZ2sO3.cjs +1 -0
  74. package/dist/spatial.cjs +1 -1
  75. package/dist/spatial.js +18 -25
  76. package/dist/src/binary/codec.d.ts +1 -1
  77. package/dist/src/binary/codec.d.ts.map +1 -1
  78. package/dist/src/breaker/breaker.d.ts +2 -2
  79. package/dist/src/breaker/breaker.d.ts.map +1 -1
  80. package/dist/src/caseconv/caseconv.d.ts +0 -1
  81. package/dist/src/caseconv/caseconv.d.ts.map +1 -1
  82. package/dist/src/change/change.d.ts +1 -1
  83. package/dist/src/change/change.d.ts.map +1 -1
  84. package/dist/src/color/color.d.ts +2 -2
  85. package/dist/src/color/color.d.ts.map +1 -1
  86. package/dist/src/color/gradient.d.ts +1 -1
  87. package/dist/src/color/gradient.d.ts.map +1 -1
  88. package/dist/src/color/palette.d.ts +3 -3
  89. package/dist/src/color/palette.d.ts.map +1 -1
  90. package/dist/src/compare/compare.d.ts +4 -4
  91. package/dist/src/compare/compare.d.ts.map +1 -1
  92. package/dist/src/control/control.d.ts +9 -9
  93. package/dist/src/control/control.d.ts.map +1 -1
  94. package/dist/src/deep/merge.d.ts +1 -1
  95. package/dist/src/deep/merge.d.ts.map +1 -1
  96. package/dist/src/deep/path.d.ts +6 -6
  97. package/dist/src/deep/path.d.ts.map +1 -1
  98. package/dist/src/destructor.d.ts +6 -2
  99. package/dist/src/destructor.d.ts.map +1 -1
  100. package/dist/src/errors/errors.d.ts +5 -1
  101. package/dist/src/errors/errors.d.ts.map +1 -1
  102. package/dist/src/flush.d.ts +11 -0
  103. package/dist/src/flush.d.ts.map +1 -0
  104. package/dist/src/id/id.d.ts +1 -0
  105. package/dist/src/id/id.d.ts.map +1 -1
  106. package/dist/src/identity.d.ts +2 -2
  107. package/dist/src/identity.d.ts.map +1 -1
  108. package/dist/src/index.d.ts +3 -1
  109. package/dist/src/index.d.ts.map +1 -1
  110. package/dist/src/jsonrpc/jsonrpc.d.ts +1 -1
  111. package/dist/src/jsonrpc/jsonrpc.d.ts.map +1 -1
  112. package/dist/src/kv/types.d.ts +1 -1
  113. package/dist/src/kv/types.d.ts.map +1 -1
  114. package/dist/src/map/index.d.ts +2 -0
  115. package/dist/src/map/index.d.ts.map +1 -0
  116. package/dist/src/map/map.d.ts +2 -0
  117. package/dist/src/map/map.d.ts.map +1 -0
  118. package/dist/src/map/map.spec.d.ts +2 -0
  119. package/dist/src/map/map.spec.d.ts.map +1 -0
  120. package/dist/src/math/math.d.ts +2 -4
  121. package/dist/src/math/math.d.ts.map +1 -1
  122. package/dist/src/migrate/migrate.d.ts +1 -1
  123. package/dist/src/migrate/migrate.d.ts.map +1 -1
  124. package/dist/src/notation/notation.d.ts +1 -1
  125. package/dist/src/notation/notation.d.ts.map +1 -1
  126. package/dist/src/optional.d.ts +0 -3
  127. package/dist/src/optional.d.ts.map +1 -1
  128. package/dist/src/record/index.d.ts +2 -0
  129. package/dist/src/record/index.d.ts.map +1 -0
  130. package/dist/src/record/record.d.ts +90 -0
  131. package/dist/src/record/record.d.ts.map +1 -0
  132. package/dist/src/record/record.spec.d.ts.map +1 -0
  133. package/dist/src/runtime/os.d.ts +1 -1
  134. package/dist/src/runtime/os.d.ts.map +1 -1
  135. package/dist/src/spatial/base.d.ts +1 -1
  136. package/dist/src/spatial/base.d.ts.map +1 -1
  137. package/dist/src/spatial/box/box.d.ts +1 -1
  138. package/dist/src/spatial/box/box.d.ts.map +1 -1
  139. package/dist/src/spatial/dimensions/dimensions.d.ts +1 -1
  140. package/dist/src/spatial/dimensions/dimensions.d.ts.map +1 -1
  141. package/dist/src/spatial/direction/direction.d.ts +3 -3
  142. package/dist/src/spatial/direction/direction.d.ts.map +1 -1
  143. package/dist/src/spatial/location/location.d.ts +1 -1
  144. package/dist/src/spatial/location/location.d.ts.map +1 -1
  145. package/dist/src/spatial/scale/scale.d.ts +1 -1
  146. package/dist/src/spatial/scale/scale.d.ts.map +1 -1
  147. package/dist/src/spatial/xy/xy.d.ts +1 -1
  148. package/dist/src/spatial/xy/xy.d.ts.map +1 -1
  149. package/dist/src/status/index.d.ts +1 -1
  150. package/dist/src/status/index.d.ts.map +1 -1
  151. package/dist/src/status/status.d.ts +42 -0
  152. package/dist/src/status/status.d.ts.map +1 -0
  153. package/dist/src/status/status.spec.d.ts +2 -0
  154. package/dist/src/status/status.spec.d.ts.map +1 -0
  155. package/dist/src/strings/strings.d.ts +16 -0
  156. package/dist/src/strings/strings.d.ts.map +1 -1
  157. package/dist/src/telem/gl.d.ts +1 -1
  158. package/dist/src/telem/gl.d.ts.map +1 -1
  159. package/dist/src/telem/series.d.ts +17 -16
  160. package/dist/src/telem/series.d.ts.map +1 -1
  161. package/dist/src/telem/telem.d.ts +42 -19
  162. package/dist/src/telem/telem.d.ts.map +1 -1
  163. package/dist/src/testutil/testutil.d.ts +1 -0
  164. package/dist/src/testutil/testutil.d.ts.map +1 -1
  165. package/dist/src/testutil/testutil.spec.d.ts +2 -0
  166. package/dist/src/testutil/testutil.spec.d.ts.map +1 -0
  167. package/dist/src/zod/external.d.ts +1 -0
  168. package/dist/src/zod/external.d.ts.map +1 -1
  169. package/dist/src/zod/nullToUndefined.d.ts +1 -1
  170. package/dist/src/zod/nullToUndefined.d.ts.map +1 -1
  171. package/dist/src/zod/toArray.d.ts +3 -0
  172. package/dist/src/zod/toArray.d.ts.map +1 -0
  173. package/dist/src/zod/toArray.spec.d.ts +2 -0
  174. package/dist/src/zod/toArray.spec.d.ts.map +1 -0
  175. package/dist/src/zod/util.d.ts +1 -1
  176. package/dist/src/zod/util.d.ts.map +1 -1
  177. package/dist/telem.cjs +1 -1
  178. package/dist/telem.js +10 -11
  179. package/dist/url.cjs +1 -1
  180. package/dist/url.js +16 -19
  181. package/dist/worker.cjs +1 -1
  182. package/dist/worker.js +18 -22
  183. package/dist/xy-B7065J2S.cjs +1 -0
  184. package/dist/{index-C-qYOegc.js → xy-D_LqxaGt.js} +62 -62
  185. package/dist/xy.cjs +1 -1
  186. package/dist/xy.js +1 -1
  187. package/dist/zod.cjs +1 -1
  188. package/dist/zod.js +2 -19
  189. package/package.json +13 -18
  190. package/src/binary/codec.spec.ts +1 -1
  191. package/src/binary/codec.ts +1 -1
  192. package/src/breaker/breaker.ts +1 -1
  193. package/src/caseconv/caseconv.ts +10 -12
  194. package/src/change/change.ts +1 -1
  195. package/src/color/color.ts +1 -1
  196. package/src/color/gradient.ts +1 -1
  197. package/src/color/palette.ts +1 -1
  198. package/src/compare/compare.ts +5 -5
  199. package/src/control/control.ts +2 -2
  200. package/src/deep/merge.spec.ts +2 -15
  201. package/src/deep/merge.ts +1 -1
  202. package/src/deep/path.spec.ts +41 -0
  203. package/src/deep/path.ts +48 -17
  204. package/src/destructor.ts +6 -2
  205. package/src/errors/errors.spec.ts +20 -20
  206. package/src/errors/errors.ts +4 -1
  207. package/src/flush.ts +21 -0
  208. package/src/id/id.spec.ts +1 -1
  209. package/src/id/id.ts +3 -1
  210. package/src/identity.ts +2 -2
  211. package/src/index.ts +3 -1
  212. package/src/instance/matcher.spec.ts +7 -7
  213. package/src/jsonrpc/jsonrpc.ts +1 -1
  214. package/src/kv/types.ts +1 -1
  215. package/src/map/index.ts +10 -0
  216. package/src/map/map.spec.ts +132 -0
  217. package/src/map/map.ts +17 -0
  218. package/src/math/math.ts +19 -27
  219. package/src/migrate/migrate.spec.ts +2 -2
  220. package/src/migrate/migrate.ts +2 -2
  221. package/src/notation/notation.ts +1 -1
  222. package/src/optional.ts +0 -4
  223. package/src/primitive/primitive.spec.ts +1 -1
  224. package/src/record/index.ts +10 -0
  225. package/src/record/record.spec.ts +319 -0
  226. package/src/record/record.ts +118 -0
  227. package/src/runtime/os.ts +1 -1
  228. package/src/spatial/base.ts +1 -1
  229. package/src/spatial/box/box.ts +1 -1
  230. package/src/spatial/dimensions/dimensions.ts +1 -1
  231. package/src/spatial/direction/direction.ts +1 -1
  232. package/src/spatial/location/location.ts +1 -1
  233. package/src/spatial/scale/scale.ts +1 -1
  234. package/src/spatial/xy/xy.ts +1 -1
  235. package/src/status/index.ts +1 -1
  236. package/src/status/status.spec.ts +25 -0
  237. package/src/status/status.ts +91 -0
  238. package/src/strings/strings.spec.ts +51 -13
  239. package/src/strings/strings.ts +20 -0
  240. package/src/telem/gl.ts +1 -1
  241. package/src/telem/series.spec.ts +193 -53
  242. package/src/telem/series.ts +53 -18
  243. package/src/telem/telem.spec.ts +202 -83
  244. package/src/telem/telem.ts +53 -35
  245. package/src/testutil/testutil.spec.ts +161 -0
  246. package/src/testutil/testutil.ts +12 -0
  247. package/src/zod/external.ts +1 -0
  248. package/src/zod/nullToUndefined.spec.ts +1 -1
  249. package/src/zod/nullToUndefined.ts +1 -1
  250. package/src/zod/toArray.spec.ts +182 -0
  251. package/src/{status/types.ts → zod/toArray.ts} +3 -12
  252. package/src/zod/util.spec.ts +2 -2
  253. package/src/zod/util.ts +3 -3
  254. package/tsconfig.tsbuildinfo +1 -1
  255. package/vite.config.ts +1 -2
  256. package/dist/base-B5lQIJKc.js +0 -38
  257. package/dist/base-CTq-lhpU.cjs +0 -1
  258. package/dist/index-B58dnYRu.cjs +0 -1
  259. package/dist/index-BMGaoK93.cjs +0 -1
  260. package/dist/index-BTet04Hd.cjs +0 -6
  261. package/dist/index-C07SBJhr.js +0 -128
  262. package/dist/index-C9EdKeu1.js +0 -174
  263. package/dist/index-CM8ZDZ6s.cjs +0 -1
  264. package/dist/index-CV2JaHfw.cjs +0 -1
  265. package/dist/index-CeBvOwG8.cjs +0 -3
  266. package/dist/index-ClrGyGDp.js +0 -205
  267. package/dist/index-CqQXXeCI.cjs +0 -1
  268. package/dist/index-DEdq2tza.cjs +0 -1
  269. package/dist/index-DKMnHBGR.cjs +0 -1
  270. package/dist/index-Dql5FMcH.js +0 -47
  271. package/dist/index-WwMnwoLy.cjs +0 -1
  272. package/dist/path-1tZLZ4AN.cjs +0 -1
  273. package/dist/path-DD6ytXzr.js +0 -76
  274. package/dist/schemas-55Usj0Fg.js +0 -3998
  275. package/dist/schemas-DbXuI2Qr.cjs +0 -27
  276. package/dist/search.cjs +0 -1
  277. package/dist/search.js +0 -14
  278. package/dist/src/record.d.ts +0 -18
  279. package/dist/src/record.d.ts.map +0 -1
  280. package/dist/src/record.spec.d.ts.map +0 -1
  281. package/dist/src/search.d.ts +0 -18
  282. package/dist/src/search.d.ts.map +0 -1
  283. package/dist/src/status/types.d.ts +0 -11
  284. package/dist/src/status/types.d.ts.map +0 -1
  285. package/src/record.spec.ts +0 -38
  286. package/src/record.ts +0 -45
  287. package/src/search.ts +0 -42
  288. /package/dist/src/{record.spec.d.ts → record/record.spec.d.ts} +0 -0
@@ -1,84 +1,64 @@
1
- var dt = Object.defineProperty;
2
- var gt = (n, t, e) => t in n ? dt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var i = (n, t, e) => gt(n, typeof t != "symbol" ? t + "" : t, e);
4
- import { J as W } from "./index-4GlOgZuh.js";
5
- import { s as mt } from "./index-Dql5FMcH.js";
6
- import { V as D, n as Ot } from "./index-C07SBJhr.js";
7
- import { g as x, j as q, k as Q, l as F, n as yt, t as bt, o as wt } from "./index-C9EdKeu1.js";
8
- import "./index-ClrGyGDp.js";
9
- import "./dimensions.js";
10
- import "./base-B5lQIJKc.js";
11
- import "./index-D6V-8SKw.js";
12
- import "./index-BUa-NXAX.js";
13
- import "./index-C-qYOegc.js";
14
- import { b8 as It, bc as Tt, dN as Nt, bb as pt, dC as vt, b9 as St, d2 as At, ba as Ut, d9 as Bt, d0 as Et, _ as Mt, u as S, o as G, s as $, a as O, n as P, b as rt, eI as Ct, f5 as Rt, r as xt, c as Lt } from "./schemas-55Usj0Fg.js";
15
- function Dt(n) {
16
- return Tt(Nt, n);
17
- }
18
- function qt(n) {
19
- return pt(vt, n);
20
- }
21
- function $t(n) {
22
- return St(At, n);
23
- }
24
- function st(n) {
25
- return It(Et, n);
26
- }
27
- function Pt(n) {
28
- return Ut(Bt, n);
29
- }
30
- const be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
31
- __proto__: null,
32
- bigint: st,
33
- boolean: $t,
34
- date: Pt,
35
- number: qt,
36
- string: Dt
37
- }, Symbol.toStringTag, { value: "Module" }));
38
- let Ft = (n, t = 21) => (e = t) => {
39
- let r = "", a = e | 0;
40
- for (; a--; )
41
- r += n[Math.random() * n.length | 0];
42
- return r;
1
+ import { z as o } from "zod";
2
+ import { J as L } from "./index-B5l_quQn.js";
3
+ import { s as z } from "./index-D2xcvEO5.js";
4
+ import { V as M, n as _ } from "./index-PNh31WTW.js";
5
+ import { m as B, c as C, a as Y, d as R, e as tt, t as et, f as st } from "./bounds-Dj9nG39I.js";
6
+ import "./box-D_qdUyEe.js";
7
+ import "./dimensions-CRgergMS.js";
8
+ import "./base-DFq0vvGn.js";
9
+ import "./location-Ar5y2DX2.js";
10
+ import "./scale-CdTNWu-d.js";
11
+ import "./xy-D_LqxaGt.js";
12
+ let rt = (i, t = 21) => (e = t) => {
13
+ let s = "", u = e | 0;
14
+ for (; u--; )
15
+ s += i[Math.random() * i.length | 0];
16
+ return s;
43
17
  };
44
- const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt = Ft(Zt, 11), nt = () => Yt(), we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18
+ const nt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", G = 11, it = rt(nt, G), J = () => it(), $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
45
19
  __proto__: null,
46
- create: nt
47
- }, Symbol.toStringTag, { value: "Module" })), it = (n, t) => (e) => e instanceof t || typeof e == "object" && e !== null && "discriminator" in e && e.discriminator === n, Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
20
+ LENGTH: G,
21
+ create: J
22
+ }, Symbol.toStringTag, { value: "Module" })), j = (i, t) => (e) => e instanceof t || typeof e == "object" && e !== null && "discriminator" in e && e.discriminator === i, Ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48
23
  __proto__: null,
49
- createMatcher: it
50
- }, Symbol.toStringTag, { value: "Module" })), Vt = Mt(["static", "dynamic"]), at = (n, t) => {
51
- const e = new d(t);
24
+ createMatcher: j
25
+ }, Symbol.toStringTag, { value: "Module" })), at = o.enum(["static", "dynamic"]), ut = o.union([
26
+ o.tuple([o.int()]),
27
+ o.tuple([o.int(), o.int().min(1).max(12)]),
28
+ o.tuple([o.int(), o.int().min(1).max(12), o.int().min(1).max(31)])
29
+ ]), W = (i, t) => {
30
+ const e = new n(t);
52
31
  if (![
53
- g.DAY,
54
- g.HOUR,
55
- g.MINUTE,
56
- g.SECOND,
57
- g.MILLISECOND,
58
- g.MICROSECOND,
59
- g.NANOSECOND
60
- ].some((a) => a.equals(e)))
32
+ a.DAY,
33
+ a.HOUR,
34
+ a.MINUTE,
35
+ a.SECOND,
36
+ a.MILLISECOND,
37
+ a.MICROSECOND,
38
+ a.NANOSECOND
39
+ ].some((u) => u.equals(e)))
61
40
  throw new Error(
62
41
  "Invalid argument for remainder. Must be an even TimeSpan or Timestamp"
63
42
  );
64
- const r = n.valueOf() % e.valueOf();
65
- return n instanceof d ? new d(r) : new g(r);
66
- }, u = class u extends D {
43
+ const s = i.valueOf() % e.valueOf();
44
+ return i instanceof n ? new n(s) : new a(s);
45
+ };
46
+ class n extends M {
67
47
  constructor(t, e = "UTC") {
68
- if (t == null) super(u.now().valueOf());
48
+ if (t == null) super(n.now().valueOf());
69
49
  else if (t instanceof Date)
70
- super(BigInt(t.getTime()) * u.MILLISECOND.valueOf());
50
+ super(BigInt(t.getTime()) * n.MILLISECOND.valueOf());
71
51
  else if (typeof t == "string")
72
- super(u.parseDateTimeString(t, e).valueOf());
73
- else if (Array.isArray(t)) super(u.parseDate(t));
52
+ super(n.parseDateTimeString(t, e).valueOf());
53
+ else if (Array.isArray(t)) super(n.parseDate(t));
74
54
  else {
75
- let r = BigInt(0);
76
- t instanceof Number && (t = t.valueOf()), e === "local" && (r = u.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = Math.trunc(t) : (isNaN(t) && (t = 0), t === 1 / 0 ? t = u.MAX : t = u.MIN)), super(BigInt(t.valueOf()) + r);
55
+ let s = 0n;
56
+ t instanceof Number && (t = t.valueOf()), e === "local" && (s = n.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = Math.trunc(t) : (isNaN(t) && (t = 0), t === 1 / 0 ? t = n.MAX : t = n.MIN)), super(BigInt(t.valueOf()) + s);
77
57
  }
78
58
  }
79
- static parseDate([t = 1970, e = 1, r = 1]) {
80
- const a = new Date(t, e - 1, r, 0, 0, 0, 0);
81
- return new u(BigInt(a.getTime()) * u.MILLISECOND.valueOf()).truncate(u.DAY).valueOf();
59
+ static parseDate([t = 1970, e = 1, s = 1]) {
60
+ const u = new Date(t, e - 1, s, 0, 0, 0, 0);
61
+ return new n(BigInt(u.getTime()) * n.MILLISECOND.valueOf()).truncate(n.DAY).valueOf();
82
62
  }
83
63
  /**
84
64
  * @returns the primitive value of the TimeStamp. Overrides standard JS valueOf()
@@ -88,18 +68,18 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
88
68
  return this.value;
89
69
  }
90
70
  static parseTimeString(t, e = "UTC") {
91
- const [r, a, f] = t.split(":");
92
- let h = "00", A = "00";
93
- f != null && ([h, A] = f.split("."));
94
- let y = u.hours(parseInt(r ?? "00")).add(u.minutes(parseInt(a ?? "00"))).add(u.seconds(parseInt(h ?? "00"))).add(u.milliseconds(parseInt(A ?? "00")));
95
- return e === "local" && (y = y.add(u.utcOffset)), y.valueOf();
71
+ const [s, u, f] = t.split(":");
72
+ let c = "00", y = "00";
73
+ f != null && ([c, y] = f.split("."));
74
+ let g = n.hours(parseInt(s ?? "00")).add(n.minutes(parseInt(u ?? "00"))).add(n.seconds(parseInt(c ?? "00"))).add(n.milliseconds(parseInt(y ?? "00")));
75
+ return e === "local" && (g = g.add(n.utcOffset)), g.valueOf();
96
76
  }
97
77
  static parseDateTimeString(t, e = "UTC") {
98
78
  if (!t.includes("/") && !t.includes("-"))
99
- return u.parseTimeString(t, e);
100
- const r = new Date(t);
101
- return t.includes(":") || r.setUTCHours(0, 0, 0, 0), new u(
102
- BigInt(r.getTime()) * u.MILLISECOND.valueOf(),
79
+ return n.parseTimeString(t, e);
80
+ const s = new Date(t);
81
+ return t.includes(":") || s.setUTCHours(0, 0, 0, 0), new n(
82
+ BigInt(s.getTime()) * n.MILLISECOND.valueOf(),
103
83
  e
104
84
  ).valueOf();
105
85
  }
@@ -131,20 +111,20 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
131
111
  }
132
112
  }
133
113
  toISOString(t = "UTC") {
134
- return t === "UTC" ? this.date().toISOString() : this.sub(u.utcOffset).date().toISOString();
114
+ return t === "UTC" ? this.date().toISOString() : this.sub(n.utcOffset).date().toISOString();
135
115
  }
136
116
  timeString(t = !1, e = "UTC") {
137
- const r = this.toISOString(e);
138
- return t ? r.slice(11, 23) : r.slice(11, 19);
117
+ const s = this.toISOString(e);
118
+ return t ? s.slice(11, 23) : s.slice(11, 19);
139
119
  }
140
120
  dateString() {
141
- const t = this.date(), e = t.toLocaleString("default", { month: "short" }), r = t.toLocaleString("default", { day: "numeric" });
142
- return `${e} ${r}`;
121
+ const t = this.date(), e = t.toLocaleString("default", { month: "short" }), s = t.toLocaleString("default", { day: "numeric" });
122
+ return `${e} ${s}`;
143
123
  }
144
124
  /** @returns The UTC offset for the time zone of the machine. */
145
125
  static get utcOffset() {
146
- return new g(
147
- BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * u.MINUTE.valueOf()
126
+ return new a(
127
+ BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * n.MINUTE.valueOf()
148
128
  );
149
129
  }
150
130
  /**
@@ -153,7 +133,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
153
133
  * @param other - The other timestamp.
154
134
  */
155
135
  static since(t) {
156
- return new u().span(t);
136
+ return new n().span(t);
157
137
  }
158
138
  /** @returns A JavaScript Date object representing the TimeStamp. */
159
139
  date() {
@@ -166,7 +146,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
166
146
  * @returns True if the TimeStamps are equal, false otherwise.
167
147
  */
168
148
  equals(t) {
169
- return this.valueOf() === new u(t).valueOf();
149
+ return this.valueOf() === new n(t).valueOf();
170
150
  }
171
151
  /**
172
152
  * Creates a TimeSpan representing the duration between the two timestamps.
@@ -186,7 +166,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
186
166
  * valid, regardless of the TimeStamp order.
187
167
  */
188
168
  range(t) {
189
- return new B(this, t).makeValid();
169
+ return new w(this, t).makeValid();
190
170
  }
191
171
  /**
192
172
  * Creates a TimeRange starting at the TimeStamp and spanning the given
@@ -205,7 +185,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
205
185
  * @returns True if the TimeStamp represents the unix epoch, false otherwise.
206
186
  */
207
187
  get isZero() {
208
- return this.valueOf() === BigInt(0);
188
+ return this.valueOf() === 0n;
209
189
  }
210
190
  /**
211
191
  * Checks if the TimeStamp is after the given TimeStamp.
@@ -215,7 +195,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
215
195
  * otherwise.
216
196
  */
217
197
  after(t) {
218
- return this.valueOf() > new u(t).valueOf();
198
+ return this.valueOf() > new n(t).valueOf();
219
199
  }
220
200
  /**
221
201
  * Checks if the TimeStamp is after or equal to the given TimeStamp.
@@ -225,7 +205,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
225
205
  * false otherwise.
226
206
  */
227
207
  afterEq(t) {
228
- return this.valueOf() >= new u(t).valueOf();
208
+ return this.valueOf() >= new n(t).valueOf();
229
209
  }
230
210
  /**
231
211
  * Checks if the TimeStamp is before the given TimeStamp.
@@ -235,7 +215,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
235
215
  * otherwise.
236
216
  */
237
217
  before(t) {
238
- return this.valueOf() < new u(t).valueOf();
218
+ return this.valueOf() < new n(t).valueOf();
239
219
  }
240
220
  /**
241
221
  * Checks if TimeStamp is before or equal to the current timestamp.
@@ -245,7 +225,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
245
225
  * false otherwise.
246
226
  */
247
227
  beforeEq(t) {
248
- return this.valueOf() <= new u(t).valueOf();
228
+ return this.valueOf() <= new n(t).valueOf();
249
229
  }
250
230
  /**
251
231
  * Adds a TimeSpan to the TimeStamp.
@@ -255,7 +235,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
255
235
  * TimeSpan.
256
236
  */
257
237
  add(t) {
258
- return new u(this.valueOf() + BigInt(t.valueOf()));
238
+ return new n(this.valueOf() + BigInt(t.valueOf()));
259
239
  }
260
240
  /**
261
241
  * Subtracts a TimeSpan from the TimeStamp.
@@ -265,43 +245,43 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
265
245
  * TimeSpan.
266
246
  */
267
247
  sub(t) {
268
- return new u(this.valueOf() - BigInt(t.valueOf()));
248
+ return new n(this.valueOf() - BigInt(t.valueOf()));
269
249
  }
270
250
  /**
271
251
  * @returns the floating point number of hours since the unix epoch to the timestamp
272
252
  * value.
273
253
  */
274
254
  get hours() {
275
- return Number(this.valueOf()) / Number(g.HOUR.valueOf());
255
+ return Number(this.valueOf()) / Number(a.HOUR.valueOf());
276
256
  }
277
257
  /**
278
258
  * @returns the floating point number of minutes since the unix epoch to the timestamp
279
259
  * value.
280
260
  */
281
261
  get minutes() {
282
- return Number(this.valueOf()) / Number(g.MINUTE.valueOf());
262
+ return Number(this.valueOf()) / Number(a.MINUTE.valueOf());
283
263
  }
284
264
  /**
285
265
  * @returns the floating point number of days since the unix epoch to the timestamp
286
266
  * value.
287
267
  */
288
268
  get days() {
289
- return Number(this.valueOf()) / Number(g.DAY.valueOf());
269
+ return Number(this.valueOf()) / Number(a.DAY.valueOf());
290
270
  }
291
271
  /**
292
272
  * @returns the floating point number of seconds since the unix epoch to the timestamp
293
273
  * value.
294
274
  */
295
275
  get seconds() {
296
- return Number(this.valueOf()) / Number(g.SECOND.valueOf());
276
+ return Number(this.valueOf()) / Number(a.SECOND.valueOf());
297
277
  }
298
278
  /** @returns the floating point number of milliseconds since the unix epoch. */
299
279
  get milliseconds() {
300
- return Number(this.valueOf()) / Number(u.MILLISECOND.valueOf());
280
+ return Number(this.valueOf()) / Number(n.MILLISECOND.valueOf());
301
281
  }
302
282
  /** @returns the floating point number of microseconds since the unix epoch. */
303
283
  get microseconds() {
304
- return Number(this.valueOf()) / Number(u.MICROSECOND.valueOf());
284
+ return Number(this.valueOf()) / Number(n.MICROSECOND.valueOf());
305
285
  }
306
286
  /**
307
287
  * @returns the floating point number of nanoseconds since the unix epoch.
@@ -321,7 +301,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
321
301
  */
322
302
  setYear(t) {
323
303
  const e = this.date();
324
- return e.setUTCFullYear(t), new u(e);
304
+ return e.setUTCFullYear(t), new n(e);
325
305
  }
326
306
  /** @returns the integer month that the timestamp corresponds to with its year. */
327
307
  get month() {
@@ -333,7 +313,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
333
313
  */
334
314
  setMonth(t) {
335
315
  const e = this.date();
336
- return e.setUTCMonth(t), new u(e);
316
+ return e.setUTCMonth(t), new n(e);
337
317
  }
338
318
  /** @returns the integer day that the timestamp corresponds to within its month. */
339
319
  get day() {
@@ -345,7 +325,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
345
325
  */
346
326
  setDay(t) {
347
327
  const e = this.date();
348
- return e.setUTCDate(t), new u(e);
328
+ return e.setUTCDate(t), new n(e);
349
329
  }
350
330
  /**
351
331
  * @returns the integer hour that the timestamp corresponds to within its day.
@@ -359,7 +339,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
359
339
  */
360
340
  setHour(t) {
361
341
  const e = this.date();
362
- return e.setUTCHours(t), new u(e, "UTC");
342
+ return e.setUTCHours(t), new n(e, "UTC");
363
343
  }
364
344
  /** @returns the integer minute that the timestamp corresponds to within its hour. */
365
345
  get minute() {
@@ -371,7 +351,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
371
351
  */
372
352
  setMinute(t) {
373
353
  const e = this.date();
374
- return e.setUTCMinutes(t), new u(e);
354
+ return e.setUTCMinutes(t), new n(e);
375
355
  }
376
356
  /**
377
357
  * @returns the integer second that the timestamp corresponds to within its
@@ -386,7 +366,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
386
366
  */
387
367
  setSecond(t) {
388
368
  const e = this.date();
389
- return e.setUTCSeconds(t), new u(e);
369
+ return e.setUTCSeconds(t), new n(e);
390
370
  }
391
371
  /**
392
372
  * @reutrns the integer millisecond that the timestamp corresponds to within
@@ -401,7 +381,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
401
381
  */
402
382
  setMillisecond(t) {
403
383
  const e = this.date();
404
- return e.setUTCMilliseconds(t), new u(e);
384
+ return e.setUTCMilliseconds(t), new n(e);
405
385
  }
406
386
  /** @returns the time stamp formatted as an ISO string. */
407
387
  toString() {
@@ -419,11 +399,11 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
419
399
  * @example TimeStamp.now().remainder(TimeStamp.DAY) // => TimeStamp representing the current day
420
400
  */
421
401
  remainder(t) {
422
- return at(this, t);
402
+ return W(this, t);
423
403
  }
424
404
  /** @returns true if the day portion TimeStamp is today, false otherwise. */
425
405
  get isToday() {
426
- return this.truncate(g.DAY).equals(u.now().truncate(g.DAY));
406
+ return this.truncate(a.DAY).equals(n.now().truncate(a.DAY));
427
407
  }
428
408
  /**
429
409
  * Truncates the TimeStamp to the nearest multiple of the given span.
@@ -440,7 +420,7 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
440
420
  * JavaScript can do).
441
421
  */
442
422
  static now() {
443
- return new u(/* @__PURE__ */ new Date());
423
+ return new n(/* @__PURE__ */ new Date());
444
424
  }
445
425
  /**
446
426
  * Finds the maximum timestamp among the provided timestamps.
@@ -449,10 +429,10 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
449
429
  * @returns The maximum (latest) timestamp from the input.
450
430
  */
451
431
  static max(...t) {
452
- let e = u.MIN;
453
- for (const r of t) {
454
- const a = new u(r);
455
- a.after(e) && (e = a);
432
+ let e = n.MIN;
433
+ for (const s of t) {
434
+ const u = new n(s);
435
+ u.after(e) && (e = u);
456
436
  }
457
437
  return e;
458
438
  }
@@ -463,10 +443,10 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
463
443
  * @returns The minimum (earliest) timestamp from the input.
464
444
  */
465
445
  static min(...t) {
466
- let e = u.MAX;
467
- for (const r of t) {
468
- const a = new u(r);
469
- a.before(e) && (e = a);
446
+ let e = n.MAX;
447
+ for (const s of t) {
448
+ const u = new n(s);
449
+ u.before(e) && (e = u);
470
450
  }
471
451
  return e;
472
452
  }
@@ -477,53 +457,76 @@ const Zt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Yt
477
457
  * @returns A TimeStamp representing the given number of nanoseconds.
478
458
  */
479
459
  static nanoseconds(t, e = "UTC") {
480
- return new u(t, e);
460
+ return new n(t, e);
481
461
  }
462
+ /** One nanosecond after the unix epoch */
463
+ static NANOSECOND = n.nanoseconds(1);
482
464
  /** @returns a new TimeStamp n microseconds after the unix epoch */
483
465
  static microseconds(t, e = "UTC") {
484
- return u.nanoseconds(t * 1e3, e);
466
+ return n.nanoseconds(t * 1e3, e);
485
467
  }
468
+ /** One microsecond after the unix epoch */
469
+ static MICROSECOND = n.microseconds(1);
486
470
  /** @returns a new TimeStamp n milliseconds after the unix epoch */
487
471
  static milliseconds(t, e = "UTC") {
488
- return u.microseconds(t * 1e3, e);
472
+ return n.microseconds(t * 1e3, e);
489
473
  }
474
+ /** One millisecond after the unix epoch */
475
+ static MILLISECOND = n.milliseconds(1);
490
476
  /** @returns a new TimeStamp n seconds after the unix epoch */
491
477
  static seconds(t, e = "UTC") {
492
- return u.milliseconds(t * 1e3, e);
478
+ return n.milliseconds(t * 1e3, e);
493
479
  }
480
+ /** One second after the unix epoch */
481
+ static SECOND = n.seconds(1);
494
482
  /** @returns a new TimeStamp n minutes after the unix epoch */
495
483
  static minutes(t, e = "UTC") {
496
- return u.seconds(t * 60, e);
484
+ return n.seconds(t * 60, e);
497
485
  }
486
+ /** One minute after the unix epoch */
487
+ static MINUTE = n.minutes(1);
498
488
  /** @returns a new TimeStamp n hours after the unix epoch */
499
489
  static hours(t, e = "UTC") {
500
- return u.minutes(t * 60, e);
490
+ return n.minutes(t * 60, e);
501
491
  }
492
+ /** One hour after the unix epoch */
493
+ static HOUR = n.hours(1);
502
494
  /** @returns a new TimeStamp n days after the unix epoch */
503
495
  static days(t, e = "UTC") {
504
- return u.hours(t * 24, e);
496
+ return n.hours(t * 24, e);
497
+ }
498
+ /** One day after the unix epoch */
499
+ static DAY = n.days(1);
500
+ /** The maximum possible value for a timestamp */
501
+ static MAX = new n((1n << 63n) - 1n);
502
+ /** The minimum possible value for a timestamp */
503
+ static MIN = new n(0);
504
+ /** The unix epoch */
505
+ static ZERO = new n(0);
506
+ /** A zod schema for validating timestamps */
507
+ static z = o.union([
508
+ o.instanceof(n),
509
+ o.object({ value: o.bigint() }).transform((t) => new n(t.value)),
510
+ o.string().transform((t) => new n(BigInt(t))),
511
+ o.number().transform((t) => new n(t)),
512
+ o.bigint().transform((t) => new n(t)),
513
+ o.date().transform((t) => new n(t)),
514
+ o.custom((t) => t instanceof a).transform((t) => new n(t)),
515
+ ut.transform((t) => new n(t))
516
+ ]);
517
+ /**
518
+ * Sorts two timestamps.
519
+ *
520
+ * @param a - The first timestamp.
521
+ * @param b - The second timestamp.
522
+ * @returns A number indicating the order of the two timestamps (positive if a is
523
+ * greater than b, negative if a is less than b, and 0 if they are equal).
524
+ */
525
+ static sort(t, e) {
526
+ return Number(t.valueOf() - e.valueOf());
505
527
  }
506
- };
507
- /** One nanosecond after the unix epoch */
508
- i(u, "NANOSECOND", u.nanoseconds(1)), /** One microsecond after the unix epoch */
509
- i(u, "MICROSECOND", u.microseconds(1)), /** One millisecond after the unix epoch */
510
- i(u, "MILLISECOND", u.milliseconds(1)), /** One second after the unix epoch */
511
- i(u, "SECOND", u.seconds(1)), /** One minute after the unix epoch */
512
- i(u, "MINUTE", u.minutes(1)), /** One hour after the unix epoch */
513
- i(u, "HOUR", u.hours(1)), /** One day after the unix epoch */
514
- i(u, "DAY", u.days(1)), /** The maximum possible value for a timestamp */
515
- i(u, "MAX", new u((1n << 63n) - 1n)), /** The minimum possible value for a timestamp */
516
- i(u, "MIN", new u(0)), /** The unix epoch */
517
- i(u, "ZERO", new u(0)), /** A zod schema for validating timestamps */
518
- i(u, "z", S([
519
- G({ value: rt() }).transform((t) => new u(t.value)),
520
- $().transform((t) => new u(BigInt(t))),
521
- O(Number).transform((t) => new u(t)),
522
- P().transform((t) => new u(t)),
523
- O(u)
524
- ]));
525
- let d = u;
526
- const o = class o extends D {
528
+ }
529
+ class a extends M {
527
530
  constructor(t) {
528
531
  typeof t == "number" && (t = Math.trunc(t.valueOf())), super(BigInt(t.valueOf()));
529
532
  }
@@ -534,7 +537,7 @@ const o = class o extends D {
534
537
  * @returns A TimeSpan representing the given number of seconds.
535
538
  */
536
539
  static fromSeconds(t) {
537
- return t instanceof o ? t : t instanceof Y ? t.period : t instanceof d ? new o(t) : ["number", "bigint"].includes(typeof t) ? o.seconds(t) : new o(t);
540
+ return t instanceof a ? t : t instanceof E ? t.period : t instanceof n ? new a(t) : ["number", "bigint"].includes(typeof t) ? a.seconds(t) : new a(t);
538
541
  }
539
542
  /**
540
543
  * Creates a TimeSpan representing the given number of milliseconds.
@@ -543,7 +546,7 @@ const o = class o extends D {
543
546
  * @returns A TimeSpan representing the given number of milliseconds.
544
547
  */
545
548
  static fromMilliseconds(t) {
546
- return t instanceof o ? t : t instanceof Y ? t.period : t instanceof d ? new o(t) : ["number", "bigint"].includes(typeof t) ? o.milliseconds(t) : new o(t);
549
+ return t instanceof a ? t : t instanceof E ? t.period : t instanceof n ? new a(t) : ["number", "bigint"].includes(typeof t) ? a.milliseconds(t) : new a(t);
547
550
  }
548
551
  /**
549
552
  * @returns the primitive value of the TimeSpan. Overrides standard JS valueOf()
@@ -559,7 +562,7 @@ const o = class o extends D {
559
562
  * @returns True if the TimeSpan is less than the other TimeSpan, false otherwise.
560
563
  */
561
564
  lessThan(t) {
562
- return this.valueOf() < new o(t).valueOf();
565
+ return this.valueOf() < new a(t).valueOf();
563
566
  }
564
567
  /**
565
568
  * Checks if the TimeSpan is greater than another TimeSpan.
@@ -568,7 +571,7 @@ const o = class o extends D {
568
571
  * @returns True if the TimeSpan is greater than the other TimeSpan, false otherwise.
569
572
  */
570
573
  greaterThan(t) {
571
- return this.valueOf() > new o(t).valueOf();
574
+ return this.valueOf() > new a(t).valueOf();
572
575
  }
573
576
  /**
574
577
  * Checks if the TimeSpan is less than or equal to another TimeSpan.
@@ -577,7 +580,7 @@ const o = class o extends D {
577
580
  * @returns True if the TimeSpan is less than or equal to the other TimeSpan, false otherwise.
578
581
  */
579
582
  lessThanOrEqual(t) {
580
- return this.valueOf() <= new o(t).valueOf();
583
+ return this.valueOf() <= new a(t).valueOf();
581
584
  }
582
585
  /**
583
586
  * Checks if the TimeSpan is greater than or equal to another TimeSpan.
@@ -586,7 +589,7 @@ const o = class o extends D {
586
589
  * @returns True if the TimeSpan is greater than or equal to the other TimeSpan, false otherwise.
587
590
  */
588
591
  greaterThanOrEqual(t) {
589
- return this.valueOf() >= new o(t).valueOf();
592
+ return this.valueOf() >= new a(t).valueOf();
590
593
  }
591
594
  /**
592
595
  * Calculates the remainder of the TimeSpan when divided by another TimeSpan.
@@ -595,7 +598,7 @@ const o = class o extends D {
595
598
  * @returns A new TimeSpan representing the remainder.
596
599
  */
597
600
  remainder(t) {
598
- return at(this, t);
601
+ return W(this, t);
599
602
  }
600
603
  /**
601
604
  * Truncates the TimeSpan to the nearest multiple of the given span.
@@ -604,7 +607,7 @@ const o = class o extends D {
604
607
  * @returns A new TimeSpan that is truncated to the nearest multiple of the given span.
605
608
  */
606
609
  truncate(t) {
607
- return new o(
610
+ return new a(
608
611
  BigInt(Math.trunc(Number(this.valueOf() / t.valueOf()))) * t.valueOf()
609
612
  );
610
613
  }
@@ -614,9 +617,9 @@ const o = class o extends D {
614
617
  * @returns A string representation of the TimeSpan.
615
618
  */
616
619
  toString() {
617
- const t = this.truncate(o.DAY), e = this.truncate(o.HOUR), r = this.truncate(o.MINUTE), a = this.truncate(o.SECOND), f = this.truncate(o.MILLISECOND), h = this.truncate(o.MICROSECOND), A = this.truncate(o.NANOSECOND), y = t, p = e.sub(t), E = r.sub(e), l = a.sub(r), M = f.sub(a), v = h.sub(f), X = A.sub(h);
618
- let C = "";
619
- return y.isZero || (C += `${y.days}d `), p.isZero || (C += `${p.hours}h `), E.isZero || (C += `${E.minutes}m `), l.isZero || (C += `${l.seconds}s `), M.isZero || (C += `${M.milliseconds}ms `), v.isZero || (C += `${v.microseconds}µs `), X.isZero || (C += `${X.nanoseconds}ns`), C.trim();
620
+ const t = this.truncate(a.DAY), e = this.truncate(a.HOUR), s = this.truncate(a.MINUTE), u = this.truncate(a.SECOND), f = this.truncate(a.MILLISECOND), c = this.truncate(a.MICROSECOND), y = this.truncate(a.NANOSECOND), g = t, b = e.sub(t), N = s.sub(e), l = u.sub(s), m = f.sub(u), v = c.sub(f), F = y.sub(c);
621
+ let U = "";
622
+ return g.isZero || (U += `${g.days}d `), b.isZero || (U += `${b.hours}h `), N.isZero || (U += `${N.minutes}m `), l.isZero || (U += `${l.seconds}s `), m.isZero || (U += `${m.milliseconds}ms `), v.isZero || (U += `${v.microseconds}µs `), F.isZero || (U += `${F.nanoseconds}ns`), U.trim();
620
623
  }
621
624
  /**
622
625
  * Multiplies the TimeSpan by a scalar value.
@@ -625,31 +628,31 @@ const o = class o extends D {
625
628
  * @returns A new TimeSpan that is this TimeSpan multiplied by the provided value.
626
629
  */
627
630
  mult(t) {
628
- return new o(this.valueOf() * BigInt(t));
631
+ return new a(this.valueOf() * BigInt(t));
629
632
  }
630
633
  /** @returns the decimal number of days in the TimeSpan. */
631
634
  get days() {
632
- return Number(this.valueOf()) / Number(o.DAY.valueOf());
635
+ return Number(this.valueOf()) / Number(a.DAY.valueOf());
633
636
  }
634
637
  /** @returns the decimal number of hours in the TimeSpan. */
635
638
  get hours() {
636
- return Number(this.valueOf()) / Number(o.HOUR.valueOf());
639
+ return Number(this.valueOf()) / Number(a.HOUR.valueOf());
637
640
  }
638
641
  /** @returns the decimal number of minutes in the TimeSpan. */
639
642
  get minutes() {
640
- return Number(this.valueOf()) / Number(o.MINUTE.valueOf());
643
+ return Number(this.valueOf()) / Number(a.MINUTE.valueOf());
641
644
  }
642
645
  /** @returns The number of seconds in the TimeSpan. */
643
646
  get seconds() {
644
- return Number(this.valueOf()) / Number(o.SECOND.valueOf());
647
+ return Number(this.valueOf()) / Number(a.SECOND.valueOf());
645
648
  }
646
649
  /** @returns The number of milliseconds in the TimeSpan. */
647
650
  get milliseconds() {
648
- return Number(this.valueOf()) / Number(o.MILLISECOND.valueOf());
651
+ return Number(this.valueOf()) / Number(a.MILLISECOND.valueOf());
649
652
  }
650
653
  /** @returns The number of microseconds in the TimeSpan. */
651
654
  get microseconds() {
652
- return Number(this.valueOf()) / Number(o.MICROSECOND.valueOf());
655
+ return Number(this.valueOf()) / Number(a.MICROSECOND.valueOf());
653
656
  }
654
657
  /** @returns The number of nanoseconds in the TimeSpan. */
655
658
  get nanoseconds() {
@@ -661,7 +664,7 @@ const o = class o extends D {
661
664
  * @returns True if the TimeSpan represents a zero duration, false otherwise.
662
665
  */
663
666
  get isZero() {
664
- return this.valueOf() === BigInt(0);
667
+ return this.valueOf() === 0n;
665
668
  }
666
669
  /**
667
670
  * Checks if the TimeSpan is equal to another TimeSpan.
@@ -669,7 +672,7 @@ const o = class o extends D {
669
672
  * @returns True if the TimeSpans are equal, false otherwise.
670
673
  */
671
674
  equals(t) {
672
- return this.valueOf() === new o(t).valueOf();
675
+ return this.valueOf() === new a(t).valueOf();
673
676
  }
674
677
  /**
675
678
  * Adds a TimeSpan to the TimeSpan.
@@ -677,7 +680,7 @@ const o = class o extends D {
677
680
  * @returns A new TimeSpan representing the sum of the two TimeSpans.
678
681
  */
679
682
  add(t) {
680
- return new o(this.valueOf() + new o(t).valueOf());
683
+ return new a(this.valueOf() + new a(t).valueOf());
681
684
  }
682
685
  /**
683
686
  * Creates a TimeSpan representing the duration between the two timestamps.
@@ -685,7 +688,7 @@ const o = class o extends D {
685
688
  * @param other
686
689
  */
687
690
  sub(t) {
688
- return new o(this.valueOf() - new o(t).valueOf());
691
+ return new a(this.valueOf() - new a(t).valueOf());
689
692
  }
690
693
  /**
691
694
  * Creates a TimeSpan representing the given number of nanoseconds.
@@ -694,8 +697,10 @@ const o = class o extends D {
694
697
  * @returns A TimeSpan representing the given number of nanoseconds.
695
698
  */
696
699
  static nanoseconds(t = 1) {
697
- return new o(t);
700
+ return new a(t);
698
701
  }
702
+ /** A nanosecond. */
703
+ static NANOSECOND = a.nanoseconds(1);
699
704
  /**
700
705
  * Creates a TimeSpan representing the given number of microseconds.
701
706
  *
@@ -703,8 +708,10 @@ const o = class o extends D {
703
708
  * @returns A TimeSpan representing the given number of microseconds.
704
709
  */
705
710
  static microseconds(t = 1) {
706
- return o.nanoseconds(x(t, 1e3));
711
+ return a.nanoseconds(B(t, 1e3));
707
712
  }
713
+ /** A microsecond. */
714
+ static MICROSECOND = a.microseconds(1);
708
715
  /**
709
716
  * Creates a TimeSpan representing the given number of milliseconds.
710
717
  *
@@ -712,8 +719,10 @@ const o = class o extends D {
712
719
  * @returns A TimeSpan representing the given number of milliseconds.
713
720
  */
714
721
  static milliseconds(t = 1) {
715
- return o.microseconds(x(t, 1e3));
722
+ return a.microseconds(B(t, 1e3));
716
723
  }
724
+ /** A millisecond. */
725
+ static MILLISECOND = a.milliseconds(1);
717
726
  /**
718
727
  * Creates a TimeSpan representing the given number of seconds.
719
728
  *
@@ -721,8 +730,10 @@ const o = class o extends D {
721
730
  * @returns A TimeSpan representing the given number of seconds.
722
731
  */
723
732
  static seconds(t = 1) {
724
- return o.milliseconds(x(t, 1e3));
733
+ return a.milliseconds(B(t, 1e3));
725
734
  }
735
+ /** A second. */
736
+ static SECOND = a.seconds(1);
726
737
  /**
727
738
  * Creates a TimeSpan representing the given number of minutes.
728
739
  *
@@ -730,8 +741,10 @@ const o = class o extends D {
730
741
  * @returns A TimeSpan representing the given number of minutes.
731
742
  */
732
743
  static minutes(t = 1) {
733
- return o.seconds(x(t, 60));
744
+ return a.seconds(B(t, 60));
734
745
  }
746
+ /** A minute. */
747
+ static MINUTE = a.minutes(1);
735
748
  /**
736
749
  * Creates a TimeSpan representing the given number of hours.
737
750
  *
@@ -739,8 +752,10 @@ const o = class o extends D {
739
752
  * @returns A TimeSpan representing the given number of hours.
740
753
  */
741
754
  static hours(t) {
742
- return o.minutes(x(t, 60));
755
+ return a.minutes(B(t, 60));
743
756
  }
757
+ /** Represents an hour. */
758
+ static HOUR = a.hours(1);
744
759
  /**
745
760
  * Creates a TimeSpan representing the given number of days.
746
761
  *
@@ -748,29 +763,25 @@ const o = class o extends D {
748
763
  * @returns A TimeSpan representing the given number of days.
749
764
  */
750
765
  static days(t) {
751
- return o.hours(x(t, 24));
752
- }
753
- };
754
- /** A nanosecond. */
755
- i(o, "NANOSECOND", o.nanoseconds(1)), /** A microsecond. */
756
- i(o, "MICROSECOND", o.microseconds(1)), /** A millisecond. */
757
- i(o, "MILLISECOND", o.milliseconds(1)), /** A second. */
758
- i(o, "SECOND", o.seconds(1)), /** A minute. */
759
- i(o, "MINUTE", o.minutes(1)), /** Represents an hour. */
760
- i(o, "HOUR", o.hours(1)), /** Represents a day. */
761
- i(o, "DAY", o.days(1)), /** The maximum possible value for a TimeSpan. */
762
- i(o, "MAX", new o((1n << 63n) - 1n)), /** The minimum possible value for a TimeSpan. */
763
- i(o, "MIN", new o(0)), /** The zero value for a TimeSpan. */
764
- i(o, "ZERO", new o(0)), /** A zod schema for validating and transforming timespans */
765
- i(o, "z", S([
766
- G({ value: rt() }).transform((t) => new o(t.value)),
767
- $().transform((t) => new o(BigInt(t))),
768
- O(Number).transform((t) => new o(t)),
769
- P().transform((t) => new o(t)),
770
- O(o)
771
- ]));
772
- let g = o;
773
- const U = class U extends D {
766
+ return a.hours(B(t, 24));
767
+ }
768
+ /** Represents a day. */
769
+ static DAY = a.days(1);
770
+ /** The maximum possible value for a TimeSpan. */
771
+ static MAX = new a((1n << 63n) - 1n);
772
+ /** The minimum possible value for a TimeSpan. */
773
+ static MIN = new a(0);
774
+ /** The zero value for a TimeSpan. */
775
+ static ZERO = new a(0);
776
+ /** A zod schema for validating and transforming timespans */
777
+ static z = o.union([
778
+ o.object({ value: o.bigint() }).transform((t) => new a(t.value)),
779
+ o.string().transform((t) => new a(BigInt(t))),
780
+ o.number().transform((t) => new a(t)),
781
+ o.instanceof(a)
782
+ ]);
783
+ }
784
+ class E extends M {
774
785
  constructor(t) {
775
786
  super(t.valueOf());
776
787
  }
@@ -780,7 +791,7 @@ const U = class U extends D {
780
791
  }
781
792
  /** @returns The number of seconds in the Rate. */
782
793
  equals(t) {
783
- return this.valueOf() === new U(t).valueOf();
794
+ return this.valueOf() === new E(t).valueOf();
784
795
  }
785
796
  /**
786
797
  * Calculates the period of the Rate as a TimeSpan.
@@ -788,7 +799,7 @@ const U = class U extends D {
788
799
  * @returns A TimeSpan representing the period of the Rate.
789
800
  */
790
801
  get period() {
791
- return g.seconds(1 / this.valueOf());
802
+ return a.seconds(1 / this.valueOf());
792
803
  }
793
804
  /**
794
805
  * Calculates the number of samples in the given TimeSpan at this rate.
@@ -797,7 +808,7 @@ const U = class U extends D {
797
808
  * @returns The number of samples in the given TimeSpan at this rate.
798
809
  */
799
810
  sampleCount(t) {
800
- return new g(t).seconds * this.valueOf();
811
+ return new a(t).seconds * this.valueOf();
801
812
  }
802
813
  /**
803
814
  * Calculates the number of bytes in the given TimeSpan at this rate.
@@ -807,7 +818,7 @@ const U = class U extends D {
807
818
  * @returns The number of bytes in the given TimeSpan at this rate.
808
819
  */
809
820
  byteCount(t, e) {
810
- return this.sampleCount(t) * new I(e).valueOf();
821
+ return this.sampleCount(t) * new d(e).valueOf();
811
822
  }
812
823
  /**
813
824
  * Calculates a TimeSpan given the number of samples at this rate.
@@ -816,7 +827,7 @@ const U = class U extends D {
816
827
  * @returns A TimeSpan that corresponds to the given number of samples.
817
828
  */
818
829
  span(t) {
819
- return g.seconds(t / this.valueOf());
830
+ return a.seconds(t / this.valueOf());
820
831
  }
821
832
  /**
822
833
  * Calculates a TimeSpan given the number of bytes at this rate.
@@ -835,7 +846,7 @@ const U = class U extends D {
835
846
  * @returns A Rate representing the given number of Hz.
836
847
  */
837
848
  static hz(t) {
838
- return new U(t);
849
+ return new E(t);
839
850
  }
840
851
  /**
841
852
  * Creates a Rate representing the given number of kHz.
@@ -844,17 +855,15 @@ const U = class U extends D {
844
855
  * @returns A Rate representing the given number of kHz.
845
856
  */
846
857
  static khz(t) {
847
- return U.hz(t * 1e3);
858
+ return E.hz(t * 1e3);
848
859
  }
849
- };
850
- /** A zod schema for validating and transforming rates */
851
- i(U, "z", S([
852
- P().transform((t) => new U(t)),
853
- O(Number).transform((t) => new U(t)),
854
- O(U)
855
- ]));
856
- let Y = U;
857
- const b = class b extends D {
860
+ /** A zod schema for validating and transforming rates */
861
+ static z = o.union([
862
+ o.number().transform((t) => new E(t)),
863
+ o.instanceof(E)
864
+ ]);
865
+ }
866
+ class d extends M {
858
867
  /**
859
868
  * Creates a Density representing the given number of bytes per value.
860
869
  *
@@ -881,23 +890,45 @@ const b = class b extends D {
881
890
  * @returns A Size representing the given number of values.
882
891
  */
883
892
  size(t) {
884
- return new L(t * this.valueOf());
885
- }
886
- };
887
- /** Unknown/Invalid Density. */
888
- i(b, "UNKNOWN", new b(0)), /** 128 bits per value. */
889
- i(b, "BIT128", new b(16)), /** 64 bits per value. */
890
- i(b, "BIT64", new b(8)), /** 32 bits per value. */
891
- i(b, "BIT32", new b(4)), /** 16 bits per value. */
892
- i(b, "BIT16", new b(2)), /** 8 bits per value. */
893
- i(b, "BIT8", new b(1)), /** A zod schema for validating and transforming densities */
894
- i(b, "z", S([
895
- P().transform((t) => new b(t)),
896
- O(Number).transform((t) => new b(t)),
897
- O(b)
898
- ]));
899
- let I = b;
900
- const T = class T {
893
+ return new h(t * this.valueOf());
894
+ }
895
+ /** Unknown/Invalid Density. */
896
+ static UNKNOWN = new d(0);
897
+ /** 128 bits per value. */
898
+ static BIT128 = new d(16);
899
+ /** 64 bits per value. */
900
+ static BIT64 = new d(8);
901
+ /** 32 bits per value. */
902
+ static BIT32 = new d(4);
903
+ /** 16 bits per value. */
904
+ static BIT16 = new d(2);
905
+ /** 8 bits per value. */
906
+ static BIT8 = new d(1);
907
+ /** A zod schema for validating and transforming densities */
908
+ static z = o.union([
909
+ o.number().transform((t) => new d(t)),
910
+ o.instanceof(d)
911
+ ]);
912
+ }
913
+ class w {
914
+ /**
915
+ * The starting TimeStamp of the TimeRange.
916
+ *
917
+ * Note that this value is not guaranteed to be before or equal to the ending value.
918
+ * To ensure that this is the case, call TimeRange.make_valid().
919
+ *
920
+ * In most cases, operations should treat start as inclusive.
921
+ */
922
+ start;
923
+ /**
924
+ * The starting TimeStamp of the TimeRange.
925
+ *
926
+ * Note that this value is not guaranteed to be before or equal to the ending value.
927
+ * To ensure that this is the case, call TimeRange.make_valid().
928
+ *
929
+ * In most cases, operations should treat end as exclusive.
930
+ */
931
+ end;
901
932
  /**
902
933
  * Creates a TimeRange from the given start and end TimeStamps.
903
934
  *
@@ -905,29 +936,11 @@ const T = class T {
905
936
  * @param end - A TimeStamp representing the end of the range.
906
937
  */
907
938
  constructor(t, e) {
908
- /**
909
- * The starting TimeStamp of the TimeRange.
910
- *
911
- * Note that this value is not guaranteed to be before or equal to the ending value.
912
- * To ensure that this is the case, call TimeRange.make_valid().
913
- *
914
- * In most cases, operations should treat start as inclusive.
915
- */
916
- i(this, "start");
917
- /**
918
- * The starting TimeStamp of the TimeRange.
919
- *
920
- * Note that this value is not guaranteed to be before or equal to the ending value.
921
- * To ensure that this is the case, call TimeRange.make_valid().
922
- *
923
- * In most cases, operations should treat end as exclusive.
924
- */
925
- i(this, "end");
926
- typeof t == "object" && "start" in t ? (this.start = new d(t.start), this.end = new d(t.end)) : (this.start = new d(t), this.end = new d(e));
939
+ typeof t == "object" && "start" in t ? (this.start = new n(t.start), this.end = new n(t.end)) : (this.start = new n(t), this.end = new n(e));
927
940
  }
928
941
  /** @returns The TimeSpan occupied by the TimeRange. */
929
942
  get span() {
930
- return new g(this.end.valueOf() - this.start.valueOf());
943
+ return new a(this.end.valueOf() - this.start.valueOf());
931
944
  }
932
945
  /**
933
946
  * Checks if the timestamp is valid i.e. the start is before the end.
@@ -965,7 +978,7 @@ const T = class T {
965
978
  * @returns A TimeRange with the start and end swapped.
966
979
  */
967
980
  swap() {
968
- return new T(this.end, this.start);
981
+ return new w(this.end, this.start);
969
982
  }
970
983
  get numericBounds() {
971
984
  return {
@@ -979,11 +992,11 @@ const T = class T {
979
992
  * @param other - The TimeRange to compare to.
980
993
  * @returns True if the TimeRange is equal to the given TimeRange.
981
994
  */
982
- equals(t, e = g.ZERO) {
995
+ equals(t, e = a.ZERO) {
983
996
  if (e.isZero)
984
997
  return this.start.equals(t.start) && this.end.equals(t.end);
985
- let r = this.start.sub(t.start).valueOf(), a = this.end.sub(t.end).valueOf();
986
- return r < 0 && (r = -r), a < 0 && (a = -a), r <= e.valueOf() && a <= e.valueOf();
998
+ let s = this.start.sub(t.start).valueOf(), u = this.end.sub(t.end).valueOf();
999
+ return s < 0 && (s = -s), u < 0 && (u = -u), s <= e.valueOf() && u <= e.valueOf();
987
1000
  }
988
1001
  /**
989
1002
  * Returns a string representation of the TimeRange.
@@ -1012,16 +1025,16 @@ const T = class T {
1012
1025
  * checking for overlap.
1013
1026
  * @returns True if the two TimeRanges overlap, false otherwise.
1014
1027
  */
1015
- overlapsWith(t, e = g.ZERO) {
1028
+ overlapsWith(t, e = a.ZERO) {
1016
1029
  t = t.makeValid();
1017
- const r = this.makeValid();
1030
+ const s = this.makeValid();
1018
1031
  if (this.equals(t)) return !0;
1019
- if (t.end.equals(r.start) || r.end.equals(t.start)) return !1;
1020
- const a = d.max(r.start, t.start), f = d.min(r.end, t.end);
1021
- return f.before(a) ? !1 : new g(f.sub(a)).greaterThanOrEqual(e);
1032
+ if (t.end.equals(s.start) || s.end.equals(t.start)) return !1;
1033
+ const u = n.max(s.start, t.start), f = n.min(s.end, t.end);
1034
+ return f.before(u) ? !1 : new a(f.sub(u)).greaterThanOrEqual(e);
1022
1035
  }
1023
1036
  contains(t) {
1024
- return t instanceof T ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
1037
+ return t instanceof w ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
1025
1038
  }
1026
1039
  /**
1027
1040
  * Returns a new TimeRange that is bound by the given TimeRange.
@@ -1035,31 +1048,47 @@ const T = class T {
1035
1048
  * console.log(bounded); // TimeRange(1500, 2000)
1036
1049
  */
1037
1050
  boundBy(t) {
1038
- const e = new T(this.start, this.end);
1051
+ const e = new w(this.start, this.end);
1039
1052
  return t.start.after(this.start) && (e.start = t.start), t.start.after(this.end) && (e.end = t.start), t.end.before(this.end) && (e.end = t.end), t.end.before(this.start) && (e.start = t.end), e;
1040
1053
  }
1041
1054
  static max(...t) {
1042
- return new T(
1043
- d.min(...t.map((e) => e.start)),
1044
- d.max(...t.map((e) => e.end))
1055
+ return new w(
1056
+ n.min(...t.map((e) => e.start)),
1057
+ n.max(...t.map((e) => e.end))
1045
1058
  );
1046
1059
  }
1047
- };
1048
- /** The maximum possible time range. */
1049
- i(T, "MAX", new T(d.MIN, d.MAX)), /** The minimum possible time range. */
1050
- i(T, "MIN", new T(d.MAX, d.MIN)), /** A time range whose start and end are both zero. */
1051
- i(T, "ZERO", new T(d.ZERO, d.ZERO)), /** A zod schema for validating and transforming time ranges */
1052
- i(T, "z", S([
1053
- G({ start: d.z, end: d.z }).transform((t) => new T(t.start, t.end)),
1054
- O(T)
1055
- ]));
1056
- let B = T;
1057
- const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 : n.end.before(t.end) ? -1 : n.end.after(t.end) ? 1 : 0, s = class s extends D {
1060
+ /** The maximum possible time range. */
1061
+ static MAX = new w(n.MIN, n.MAX);
1062
+ /** The minimum possible time range. */
1063
+ static MIN = new w(n.MAX, n.MIN);
1064
+ /** A time range whose start and end are both zero. */
1065
+ static ZERO = new w(n.ZERO, n.ZERO);
1066
+ /** A zod schema for validating and transforming time ranges */
1067
+ static z = o.union([
1068
+ o.object({ start: n.z, end: n.z }).transform((t) => new w(t.start, t.end)),
1069
+ o.instanceof(w)
1070
+ ]);
1071
+ /**
1072
+ * Sorts two time ranges. The range with the earlier start time is considered less than
1073
+ * the range with the later start time. If the start times are equal, the range with the
1074
+ * earlier end time is considered less than the range with the later end time.
1075
+ *
1076
+ * @param a - The first time range.
1077
+ * @param b - The second time range.
1078
+ * @returns A number indicating the order of the two time ranges. This number is
1079
+ * positive if a is earlier than b, negative if a is later than b, and 0 if they are
1080
+ * equal.
1081
+ */
1082
+ static sort(t, e) {
1083
+ return n.sort(t.start, e.start) || n.sort(t.end, e.end);
1084
+ }
1085
+ }
1086
+ class r extends M {
1058
1087
  constructor(t) {
1059
- if (t instanceof s || typeof t == "string" || typeof t.valueOf() == "string")
1088
+ if (t instanceof r || typeof t == "string" || typeof t.valueOf() == "string")
1060
1089
  super(t.valueOf());
1061
1090
  else {
1062
- const e = s.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);
1091
+ const e = r.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);
1063
1092
  if (e == null)
1064
1093
  throw new Error(`unable to find data type for ${t.toString()}`);
1065
1094
  super(e.valueOf());
@@ -1069,7 +1098,7 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
1069
1098
  * @returns the TypedArray constructor for the DataType.
1070
1099
  */
1071
1100
  get Array() {
1072
- const t = s.ARRAY_CONSTRUCTORS.get(this.toString());
1101
+ const t = r.ARRAY_CONSTRUCTORS.get(this.toString());
1073
1102
  if (t == null)
1074
1103
  throw new Error(`unable to find array constructor for ${this.valueOf()}`);
1075
1104
  return t;
@@ -1096,7 +1125,7 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
1096
1125
  * @example DataType.INT32.isVariable // false
1097
1126
  */
1098
1127
  get isVariable() {
1099
- return this.equals(s.JSON) || this.equals(s.STRING);
1128
+ return this.equals(r.JSON) || this.equals(r.STRING);
1100
1129
  }
1101
1130
  /**
1102
1131
  * @returns true if the DataType is numeric.
@@ -1104,7 +1133,7 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
1104
1133
  * @example DataType.STRING.isNumeric // false
1105
1134
  */
1106
1135
  get isNumeric() {
1107
- return !this.isVariable && !this.equals(s.UUID);
1136
+ return !this.isVariable && !this.equals(r.UUID);
1108
1137
  }
1109
1138
  /**
1110
1139
  * @returns true if the DataType is an integer.
@@ -1129,7 +1158,7 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
1129
1158
  * @example DataType.FLOAT32.density // Density.BIT32
1130
1159
  */
1131
1160
  get density() {
1132
- const t = s.DENSITIES.get(this.toString());
1161
+ const t = r.DENSITIES.get(this.toString());
1133
1162
  if (t == null) throw new Error(`unable to find density for ${this.valueOf()}`);
1134
1163
  return t;
1135
1164
  }
@@ -1139,7 +1168,7 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
1139
1168
  * @example DataType.INT32.isUnsigned // false
1140
1169
  */
1141
1170
  get isUnsignedInteger() {
1142
- return this.equals(s.UINT8) || this.equals(s.UINT16) || this.equals(s.UINT32) || this.equals(s.UINT64);
1171
+ return this.equals(r.UINT8) || this.equals(r.UINT16) || this.equals(r.UINT32) || this.equals(r.UINT64);
1143
1172
  }
1144
1173
  /**
1145
1174
  * @returns true if the DataType is a signed integer.
@@ -1147,11 +1176,11 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
1147
1176
  * @example DataType.UINT32.isSigned // false
1148
1177
  */
1149
1178
  get isSignedInteger() {
1150
- return this.equals(s.INT8) || this.equals(s.INT16) || this.equals(s.INT32) || this.equals(s.INT64);
1179
+ return this.equals(r.INT8) || this.equals(r.INT16) || this.equals(r.INT32) || this.equals(r.INT64);
1151
1180
  }
1152
1181
  /** @returns true if the data type can be cast to the other data type without loss of precision. */
1153
1182
  canSafelyCastTo(t) {
1154
- return this.equals(t) ? !0 : !this.isNumeric || !t.isNumeric || this.isVariable || t.isVariable || this.isUnsignedInteger && t.isSignedInteger ? !1 : this.isFloat ? t.isFloat && this.density.valueOf() <= t.density.valueOf() : this.equals(s.INT32) && t.equals(s.FLOAT64) || this.equals(s.INT8) && t.equals(s.FLOAT32) ? !0 : this.isInteger && t.isInteger ? this.density.valueOf() <= t.density.valueOf() && this.isUnsignedInteger === t.isUnsignedInteger : !1;
1183
+ return this.equals(t) ? !0 : !this.isNumeric || !t.isNumeric || this.isVariable || t.isVariable || this.isUnsignedInteger && t.isSignedInteger ? !1 : this.isFloat ? t.isFloat && this.density.valueOf() <= t.density.valueOf() : this.equals(r.INT32) && t.equals(r.FLOAT64) || this.equals(r.INT8) && t.equals(r.FLOAT32) ? !0 : this.isInteger && t.isInteger ? this.density.valueOf() <= t.density.valueOf() && this.isUnsignedInteger === t.isUnsignedInteger : !1;
1155
1184
  }
1156
1185
  /** @returns true if the data type can be cast to the other data type, even if there is a loss of precision. */
1157
1186
  canCastTo(t) {
@@ -1168,92 +1197,112 @@ const Te = (n, t) => n.start.before(t.start) ? -1 : n.start.after(t.start) ? 1 :
1168
1197
  }
1169
1198
  /** @returns true if the data type uses bigints to store values. */
1170
1199
  get usesBigInt() {
1171
- return s.BIG_INT_TYPES.some((t) => t.equals(this));
1172
- }
1173
- };
1174
- /** Represents an Unknown/Invalid DataType. */
1175
- i(s, "UNKNOWN", new s("unknown")), /** Represents a 64-bit floating point value. */
1176
- i(s, "FLOAT64", new s("float64")), /** Represents a 32-bit floating point value. */
1177
- i(s, "FLOAT32", new s("float32")), /** Represents a 64-bit signed integer value. */
1178
- i(s, "INT64", new s("int64")), /** Represents a 32-bit signed integer value. */
1179
- i(s, "INT32", new s("int32")), /** Represents a 16-bit signed integer value. */
1180
- i(s, "INT16", new s("int16")), /** Represents a 8-bit signed integer value. */
1181
- i(s, "INT8", new s("int8")), /** Represents a 64-bit unsigned integer value. */
1182
- i(s, "UINT64", new s("uint64")), /** Represents a 32-bit unsigned integer value. */
1183
- i(s, "UINT32", new s("uint32")), /** Represents a 16-bit unsigned integer value. */
1184
- i(s, "UINT16", new s("uint16")), /** Represents a 8-bit unsigned integer value. */
1185
- i(s, "UINT8", new s("uint8")), /** Represents a boolean value. Alias for UINT8. */
1186
- i(s, "BOOLEAN", s.UINT8), /** Represents a 64-bit unix epoch. */
1187
- i(s, "TIMESTAMP", new s("timestamp")), /** Represents a UUID data type */
1188
- i(s, "UUID", new s("uuid")), /** Represents a string data type. Strings have an unknown density, and are separate
1189
- * by a newline character. */
1190
- i(s, "STRING", new s("string")), /** Represents a JSON data type. JSON has an unknown density, and is separated by a
1191
- * newline character. */
1192
- i(s, "JSON", new s("json")), i(s, "ARRAY_CONSTRUCTORS", /* @__PURE__ */ new Map([
1193
- [s.UINT8.toString(), Uint8Array],
1194
- [s.UINT16.toString(), Uint16Array],
1195
- [s.UINT32.toString(), Uint32Array],
1196
- [s.UINT64.toString(), BigUint64Array],
1197
- [s.FLOAT32.toString(), Float32Array],
1198
- [s.FLOAT64.toString(), Float64Array],
1199
- [s.INT8.toString(), Int8Array],
1200
- [s.INT16.toString(), Int16Array],
1201
- [s.INT32.toString(), Int32Array],
1202
- [s.INT64.toString(), BigInt64Array],
1203
- [s.TIMESTAMP.toString(), BigInt64Array],
1204
- [s.STRING.toString(), Uint8Array],
1205
- [s.JSON.toString(), Uint8Array],
1206
- [s.UUID.toString(), Uint8Array]
1207
- ])), i(s, "ARRAY_CONSTRUCTOR_DATA_TYPES", /* @__PURE__ */ new Map([
1208
- [Uint8Array.name, s.UINT8],
1209
- [Uint16Array.name, s.UINT16],
1210
- [Uint32Array.name, s.UINT32],
1211
- [BigUint64Array.name, s.UINT64],
1212
- [Float32Array.name, s.FLOAT32],
1213
- [Float64Array.name, s.FLOAT64],
1214
- [Int8Array.name, s.INT8],
1215
- [Int16Array.name, s.INT16],
1216
- [Int32Array.name, s.INT32],
1217
- [BigInt64Array.name, s.INT64]
1218
- ])), i(s, "DENSITIES", /* @__PURE__ */ new Map([
1219
- [s.UINT8.toString(), I.BIT8],
1220
- [s.UINT16.toString(), I.BIT16],
1221
- [s.UINT32.toString(), I.BIT32],
1222
- [s.UINT64.toString(), I.BIT64],
1223
- [s.FLOAT32.toString(), I.BIT32],
1224
- [s.FLOAT64.toString(), I.BIT64],
1225
- [s.INT8.toString(), I.BIT8],
1226
- [s.INT16.toString(), I.BIT16],
1227
- [s.INT32.toString(), I.BIT32],
1228
- [s.INT64.toString(), I.BIT64],
1229
- [s.TIMESTAMP.toString(), I.BIT64],
1230
- [s.STRING.toString(), I.UNKNOWN],
1231
- [s.JSON.toString(), I.UNKNOWN],
1232
- [s.UUID.toString(), I.BIT128]
1233
- ])), /** All the data types. */
1234
- i(s, "ALL", [
1235
- s.UNKNOWN,
1236
- s.FLOAT64,
1237
- s.FLOAT32,
1238
- s.INT64,
1239
- s.INT32,
1240
- s.INT16,
1241
- s.INT8,
1242
- s.UINT64,
1243
- s.UINT32,
1244
- s.UINT16,
1245
- s.UINT8,
1246
- s.TIMESTAMP,
1247
- s.UUID,
1248
- s.STRING,
1249
- s.JSON
1250
- ]), i(s, "BIG_INT_TYPES", [s.INT64, s.UINT64, s.TIMESTAMP]), /** A zod schema for a DataType. */
1251
- i(s, "z", S([
1252
- $().transform((t) => new s(t)),
1253
- O(s)
1254
- ]));
1255
- let m = s;
1256
- const c = class c extends D {
1200
+ return r.BIG_INT_TYPES.some((t) => t.equals(this));
1201
+ }
1202
+ /** Represents an Unknown/Invalid DataType. */
1203
+ static UNKNOWN = new r("unknown");
1204
+ /** Represents a 64-bit floating point value. */
1205
+ static FLOAT64 = new r("float64");
1206
+ /** Represents a 32-bit floating point value. */
1207
+ static FLOAT32 = new r("float32");
1208
+ /** Represents a 64-bit signed integer value. */
1209
+ static INT64 = new r("int64");
1210
+ /** Represents a 32-bit signed integer value. */
1211
+ static INT32 = new r("int32");
1212
+ /** Represents a 16-bit signed integer value. */
1213
+ static INT16 = new r("int16");
1214
+ /** Represents a 8-bit signed integer value. */
1215
+ static INT8 = new r("int8");
1216
+ /** Represents a 64-bit unsigned integer value. */
1217
+ static UINT64 = new r("uint64");
1218
+ /** Represents a 32-bit unsigned integer value. */
1219
+ static UINT32 = new r("uint32");
1220
+ /** Represents a 16-bit unsigned integer value. */
1221
+ static UINT16 = new r("uint16");
1222
+ /** Represents a 8-bit unsigned integer value. */
1223
+ static UINT8 = new r("uint8");
1224
+ /** Represents a boolean value. Alias for UINT8. */
1225
+ static BOOLEAN = this.UINT8;
1226
+ /** Represents a 64-bit unix epoch. */
1227
+ static TIMESTAMP = new r("timestamp");
1228
+ /** Represents a UUID data type */
1229
+ static UUID = new r("uuid");
1230
+ /** Represents a string data type. Strings have an unknown density, and are separate
1231
+ * by a newline character. */
1232
+ static STRING = new r("string");
1233
+ /** Represents a JSON data type. JSON has an unknown density, and is separated by a
1234
+ * newline character. */
1235
+ static JSON = new r("json");
1236
+ static ARRAY_CONSTRUCTORS = /* @__PURE__ */ new Map([
1237
+ [r.UINT8.toString(), Uint8Array],
1238
+ [r.UINT16.toString(), Uint16Array],
1239
+ [r.UINT32.toString(), Uint32Array],
1240
+ [r.UINT64.toString(), BigUint64Array],
1241
+ [r.FLOAT32.toString(), Float32Array],
1242
+ [r.FLOAT64.toString(), Float64Array],
1243
+ [r.INT8.toString(), Int8Array],
1244
+ [r.INT16.toString(), Int16Array],
1245
+ [r.INT32.toString(), Int32Array],
1246
+ [r.INT64.toString(), BigInt64Array],
1247
+ [r.TIMESTAMP.toString(), BigInt64Array],
1248
+ [r.STRING.toString(), Uint8Array],
1249
+ [r.JSON.toString(), Uint8Array],
1250
+ [r.UUID.toString(), Uint8Array]
1251
+ ]);
1252
+ static ARRAY_CONSTRUCTOR_DATA_TYPES = /* @__PURE__ */ new Map([
1253
+ [Uint8Array.name, r.UINT8],
1254
+ [Uint16Array.name, r.UINT16],
1255
+ [Uint32Array.name, r.UINT32],
1256
+ [BigUint64Array.name, r.UINT64],
1257
+ [Float32Array.name, r.FLOAT32],
1258
+ [Float64Array.name, r.FLOAT64],
1259
+ [Int8Array.name, r.INT8],
1260
+ [Int16Array.name, r.INT16],
1261
+ [Int32Array.name, r.INT32],
1262
+ [BigInt64Array.name, r.INT64]
1263
+ ]);
1264
+ static DENSITIES = /* @__PURE__ */ new Map([
1265
+ [r.UINT8.toString(), d.BIT8],
1266
+ [r.UINT16.toString(), d.BIT16],
1267
+ [r.UINT32.toString(), d.BIT32],
1268
+ [r.UINT64.toString(), d.BIT64],
1269
+ [r.FLOAT32.toString(), d.BIT32],
1270
+ [r.FLOAT64.toString(), d.BIT64],
1271
+ [r.INT8.toString(), d.BIT8],
1272
+ [r.INT16.toString(), d.BIT16],
1273
+ [r.INT32.toString(), d.BIT32],
1274
+ [r.INT64.toString(), d.BIT64],
1275
+ [r.TIMESTAMP.toString(), d.BIT64],
1276
+ [r.STRING.toString(), d.UNKNOWN],
1277
+ [r.JSON.toString(), d.UNKNOWN],
1278
+ [r.UUID.toString(), d.BIT128]
1279
+ ]);
1280
+ /** All the data types. */
1281
+ static ALL = [
1282
+ r.UNKNOWN,
1283
+ r.FLOAT64,
1284
+ r.FLOAT32,
1285
+ r.INT64,
1286
+ r.INT32,
1287
+ r.INT16,
1288
+ r.INT8,
1289
+ r.UINT64,
1290
+ r.UINT32,
1291
+ r.UINT16,
1292
+ r.UINT8,
1293
+ r.TIMESTAMP,
1294
+ r.UUID,
1295
+ r.STRING,
1296
+ r.JSON
1297
+ ];
1298
+ static BIG_INT_TYPES = [r.INT64, r.UINT64, r.TIMESTAMP];
1299
+ /** A zod schema for a DataType. */
1300
+ static z = o.union([
1301
+ o.string().transform((t) => new r(t)),
1302
+ o.instanceof(r)
1303
+ ]);
1304
+ }
1305
+ class h extends M {
1257
1306
  constructor(t) {
1258
1307
  super(t.valueOf());
1259
1308
  }
@@ -1267,41 +1316,41 @@ const c = class c extends D {
1267
1316
  }
1268
1317
  /** @returns a new Size representing the sum of the two Sizes. */
1269
1318
  add(t) {
1270
- return c.bytes(this.valueOf() + t.valueOf());
1319
+ return h.bytes(this.valueOf() + t.valueOf());
1271
1320
  }
1272
1321
  /** @returns a new Size representing the difference of the two Sizes. */
1273
1322
  sub(t) {
1274
- return c.bytes(this.valueOf() - t.valueOf());
1323
+ return h.bytes(this.valueOf() - t.valueOf());
1275
1324
  }
1276
1325
  /** @returns a new Size representing the truncated value of the Size. */
1277
1326
  truncate(t) {
1278
- return new c(Math.trunc(this.valueOf() / t.valueOf()) * t.valueOf());
1327
+ return new h(Math.trunc(this.valueOf() / t.valueOf()) * t.valueOf());
1279
1328
  }
1280
1329
  /** @returns a new Size representing the remainder of the Size. */
1281
1330
  remainder(t) {
1282
- return c.bytes(this.valueOf() % t.valueOf());
1331
+ return h.bytes(this.valueOf() % t.valueOf());
1283
1332
  }
1284
1333
  /** @returns the number of gigabytes in the Size. */
1285
1334
  get gigabytes() {
1286
- return this.valueOf() / c.GIGABYTE.valueOf();
1335
+ return this.valueOf() / h.GIGABYTE.valueOf();
1287
1336
  }
1288
1337
  /** @returns the number of megabytes in the Size. */
1289
1338
  get megabytes() {
1290
- return this.valueOf() / c.MEGABYTE.valueOf();
1339
+ return this.valueOf() / h.MEGABYTE.valueOf();
1291
1340
  }
1292
1341
  /** @returns the number of kilobytes in the Size. */
1293
1342
  get kilobytes() {
1294
- return this.valueOf() / c.KILOBYTE.valueOf();
1343
+ return this.valueOf() / h.KILOBYTE.valueOf();
1295
1344
  }
1296
1345
  /** @returns the number of terabytes in the Size. */
1297
1346
  get terabytes() {
1298
- return this.valueOf() / c.TERABYTE.valueOf();
1347
+ return this.valueOf() / h.TERABYTE.valueOf();
1299
1348
  }
1300
1349
  /** @returns a nicely formatted string representation of the Size. */
1301
1350
  toString() {
1302
- const t = this.truncate(c.TERABYTE), e = this.truncate(c.GIGABYTE), r = this.truncate(c.MEGABYTE), a = this.truncate(c.KILOBYTE), f = this.truncate(c.BYTE), h = t, A = e.sub(t), y = r.sub(e), p = a.sub(r), E = f.sub(a);
1351
+ const t = this.truncate(h.TERABYTE), e = this.truncate(h.GIGABYTE), s = this.truncate(h.MEGABYTE), u = this.truncate(h.KILOBYTE), f = this.truncate(h.BYTE), c = t, y = e.sub(t), g = s.sub(e), b = u.sub(s), N = f.sub(u);
1303
1352
  let l = "";
1304
- return h.isZero || (l += `${h.terabytes}TB `), A.isZero || (l += `${A.gigabytes}GB `), y.isZero || (l += `${y.megabytes}MB `), p.isZero || (l += `${p.kilobytes}KB `), (!E.isZero || l === "") && (l += `${E.valueOf()}B`), l.trim();
1353
+ return c.isZero || (l += `${c.terabytes}TB `), y.isZero || (l += `${y.gigabytes}GB `), g.isZero || (l += `${g.megabytes}MB `), b.isZero || (l += `${b.kilobytes}KB `), (!N.isZero || l === "") && (l += `${N.valueOf()}B`), l.trim();
1305
1354
  }
1306
1355
  /**
1307
1356
  * Creates a Size from the given number of bytes.
@@ -1310,8 +1359,10 @@ const c = class c extends D {
1310
1359
  * @returns A Size representing the given number of bytes.
1311
1360
  */
1312
1361
  static bytes(t = 1) {
1313
- return new c(t);
1362
+ return new h(t);
1314
1363
  }
1364
+ /** A single byte */
1365
+ static BYTE = new h(1);
1315
1366
  /**
1316
1367
  * Creates a Size from the given number if kilobytes.
1317
1368
  *
@@ -1319,8 +1370,10 @@ const c = class c extends D {
1319
1370
  * @returns A Size representing the given number of kilobytes.
1320
1371
  */
1321
1372
  static kilobytes(t = 1) {
1322
- return c.bytes(t.valueOf() * 1e3);
1373
+ return h.bytes(t.valueOf() * 1e3);
1323
1374
  }
1375
+ /** A kilobyte */
1376
+ static KILOBYTE = h.kilobytes(1);
1324
1377
  /**
1325
1378
  * Creates a Size from the given number of megabytes.
1326
1379
  *
@@ -1328,8 +1381,10 @@ const c = class c extends D {
1328
1381
  * @returns A Size representing the given number of megabytes.
1329
1382
  */
1330
1383
  static megabytes(t = 1) {
1331
- return c.kilobytes(t.valueOf() * 1e3);
1384
+ return h.kilobytes(t.valueOf() * 1e3);
1332
1385
  }
1386
+ /** A megabyte */
1387
+ static MEGABYTE = h.megabytes(1);
1333
1388
  /**
1334
1389
  * Creates a Size from the given number of gigabytes.
1335
1390
  *
@@ -1337,8 +1392,10 @@ const c = class c extends D {
1337
1392
  * @returns A Size representing the given number of gigabytes.
1338
1393
  */
1339
1394
  static gigabytes(t = 1) {
1340
- return c.megabytes(t.valueOf() * 1e3);
1395
+ return h.megabytes(t.valueOf() * 1e3);
1341
1396
  }
1397
+ /** A gigabyte */
1398
+ static GIGABYTE = h.gigabytes(1);
1342
1399
  /**
1343
1400
  * Creates a Size from the given number of terabytes.
1344
1401
  *
@@ -1346,96 +1403,156 @@ const c = class c extends D {
1346
1403
  * @returns A Size representing the given number of terabytes.
1347
1404
  */
1348
1405
  static terabytes(t) {
1349
- return c.gigabytes(t.valueOf() * 1e3);
1350
- }
1406
+ return h.gigabytes(t.valueOf() * 1e3);
1407
+ }
1408
+ /** A terabyte. */
1409
+ static TERABYTE = h.terabytes(1);
1410
+ /** The zero value for Size */
1411
+ static ZERO = new h(0);
1412
+ /** A zod schema for a Size. */
1413
+ static z = o.union([
1414
+ o.number().transform((t) => new h(t)),
1415
+ o.instanceof(h)
1416
+ ]);
1351
1417
  /** @returns true if the Size is zero. */
1352
1418
  get isZero() {
1353
1419
  return this.valueOf() === 0;
1354
1420
  }
1355
- };
1356
- /** A single byte */
1357
- i(c, "BYTE", new c(1)), /** A kilobyte */
1358
- i(c, "KILOBYTE", c.kilobytes(1)), /** A megabyte */
1359
- i(c, "MEGABYTE", c.megabytes(1)), /** A gigabyte */
1360
- i(c, "GIGABYTE", c.gigabytes(1)), /** A terabyte. */
1361
- i(c, "TERABYTE", c.terabytes(1)), /** The zero value for Size */
1362
- i(c, "ZERO", new c(0)), /** A zod schema for a Size. */
1363
- i(c, "z", S([
1364
- P().transform((t) => new c(t)),
1365
- O(c)
1366
- ]));
1367
- let L = c;
1368
- const Ne = S([
1369
- O(Uint8Array),
1370
- O(Uint16Array),
1371
- O(Uint32Array),
1372
- O(BigUint64Array),
1373
- O(Float32Array),
1374
- O(Float64Array),
1375
- O(Int8Array),
1376
- O(Int16Array),
1377
- O(Int32Array),
1378
- O(BigInt64Array)
1379
- ]), ut = (n) => {
1380
- const t = typeof n;
1381
- return t === "string" || t === "number" || t === "boolean" || t === "bigint" || n instanceof d || n instanceof g || n instanceof Date;
1382
- }, kt = (n, t, e, r = 0) => n.usesBigInt && !t.usesBigInt ? Number(e) - Number(r) : !n.usesBigInt && t.usesBigInt ? BigInt(e.valueOf()) - BigInt(r.valueOf()) : Z(e, -r).valueOf(), Z = (n, t) => t == 0 ? n : n == 0 ? t : typeof n == "bigint" && typeof t == "bigint" || typeof n == "number" && typeof t == "number" ? n + t : Number(n) + Number(t), Gt = "00000000-0000-0000-0000-000000000000", Jt = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
1383
- function jt(n) {
1384
- return typeof n == "string" && Jt.test(n);
1385
1421
  }
1386
- const w = [];
1387
- for (let n = 0; n < 256; ++n)
1388
- w.push((n + 256).toString(16).slice(1));
1389
- function ot(n, t = 0) {
1390
- return (w[n[t + 0]] + w[n[t + 1]] + w[n[t + 2]] + w[n[t + 3]] + "-" + w[n[t + 4]] + w[n[t + 5]] + "-" + w[n[t + 6]] + w[n[t + 7]] + "-" + w[n[t + 8]] + w[n[t + 9]] + "-" + w[n[t + 10]] + w[n[t + 11]] + w[n[t + 12]] + w[n[t + 13]] + w[n[t + 14]] + w[n[t + 15]]).toLowerCase();
1422
+ const Yt = o.union([
1423
+ o.instanceof(Uint8Array),
1424
+ o.instanceof(Uint16Array),
1425
+ o.instanceof(Uint32Array),
1426
+ o.instanceof(BigUint64Array),
1427
+ o.instanceof(Float32Array),
1428
+ o.instanceof(Float64Array),
1429
+ o.instanceof(Int8Array),
1430
+ o.instanceof(Int16Array),
1431
+ o.instanceof(Int32Array),
1432
+ o.instanceof(BigInt64Array)
1433
+ ]), H = (i) => {
1434
+ const t = typeof i;
1435
+ return t === "string" || t === "number" || t === "boolean" || t === "bigint" || i instanceof n || i instanceof a || i instanceof Date;
1436
+ }, ot = (i, t, e, s = 0) => i.usesBigInt && !t.usesBigInt ? Number(e) - Number(s) : !i.usesBigInt && t.usesBigInt ? BigInt(e.valueOf()) - BigInt(s.valueOf()) : x(e, -s), x = (i, t) => t == 0 ? i : i == 0 ? t : typeof i == "bigint" && typeof t == "bigint" || typeof i == "number" && typeof t == "number" ? i + t : Number(i) + Number(t), lt = "00000000-0000-0000-0000-000000000000", ft = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
1437
+ function ct(i) {
1438
+ return typeof i == "string" && ft.test(i);
1391
1439
  }
1392
- function Wt(n, t = 0) {
1393
- const e = ot(n, t);
1394
- if (!jt(e))
1440
+ const O = [];
1441
+ for (let i = 0; i < 256; ++i)
1442
+ O.push((i + 256).toString(16).slice(1));
1443
+ function K(i, t = 0) {
1444
+ return (O[i[t + 0]] + O[i[t + 1]] + O[i[t + 2]] + O[i[t + 3]] + "-" + O[i[t + 4]] + O[i[t + 5]] + "-" + O[i[t + 6]] + O[i[t + 7]] + "-" + O[i[t + 8]] + O[i[t + 9]] + "-" + O[i[t + 10]] + O[i[t + 11]] + O[i[t + 12]] + O[i[t + 13]] + O[i[t + 14]] + O[i[t + 15]]).toLowerCase();
1445
+ }
1446
+ function ht(i, t = 0) {
1447
+ const e = K(i, t);
1448
+ if (!ct(e))
1395
1449
  throw TypeError("Stringified UUID is invalid");
1396
1450
  return e;
1397
1451
  }
1398
- let J;
1399
- const Ht = new Uint8Array(16);
1400
- function Kt() {
1401
- if (!J) {
1452
+ let T;
1453
+ const dt = new Uint8Array(16);
1454
+ function gt() {
1455
+ if (!T) {
1402
1456
  if (typeof crypto > "u" || !crypto.getRandomValues)
1403
1457
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1404
- J = crypto.getRandomValues.bind(crypto);
1458
+ T = crypto.getRandomValues.bind(crypto);
1405
1459
  }
1406
- return J(Ht);
1460
+ return T(dt);
1407
1461
  }
1408
- const zt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), _ = { randomUUID: zt };
1409
- function Xt(n, t, e) {
1410
- var a;
1411
- if (_.randomUUID && !n)
1412
- return _.randomUUID();
1413
- n = n || {};
1414
- const r = n.random ?? ((a = n.rng) == null ? void 0 : a.call(n)) ?? Kt();
1415
- if (r.length < 16)
1462
+ const Ot = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Z = { randomUUID: Ot };
1463
+ function wt(i, t, e) {
1464
+ if (Z.randomUUID && !i)
1465
+ return Z.randomUUID();
1466
+ i = i || {};
1467
+ const s = i.random ?? i.rng?.() ?? gt();
1468
+ if (s.length < 16)
1416
1469
  throw new Error("Random bytes length must be >= 16");
1417
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, ot(r);
1470
+ return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, K(s);
1418
1471
  }
1419
- const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1472
+ const bt = () => wt(), P = (i, t) => ht(i, t), It = lt, Zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1420
1473
  __proto__: null,
1421
- ZERO: _t,
1422
- create: Qt,
1423
- parse: lt
1424
- }, Symbol.toStringTag, { value: "Module" })), R = -1, H = {
1425
- [Symbol.iterator]: () => H,
1474
+ ZERO: It,
1475
+ create: bt,
1476
+ parse: P
1477
+ }, Symbol.toStringTag, { value: "Module" })), A = -1, p = {
1478
+ [Symbol.iterator]: () => p,
1426
1479
  next: () => ({ done: !0, value: void 0 })
1427
- }, te = $().transform(
1428
- (n) => new Uint8Array(
1429
- atob(n).split("").map((t) => t.charCodeAt(0))
1480
+ }, yt = o.string().transform(
1481
+ (i) => new Uint8Array(
1482
+ atob(i).split("").map((t) => t.charCodeAt(0))
1430
1483
  ).buffer
1431
- ), ee = S([Ct(), Rt()]).transform(() => new Uint8Array().buffer), K = 10, ft = (n, t) => {
1432
- if (n === "string" && !t.isVariable)
1433
- throw new Error(`cannot convert series of type ${t.toString()} to string`);
1434
- if (n === "number" && !t.isNumeric)
1484
+ ), Nt = o.union([o.null(), o.undefined()]).transform(() => new Uint8Array().buffer), q = 10, D = (i, t) => {
1485
+ if (i === "number" && !t.isNumeric)
1435
1486
  throw new Error(`cannot convert series of type ${t.toString()} to number`);
1436
- if (n === "bigint" && !t.usesBigInt)
1487
+ if (i === "bigint" && !t.usesBigInt)
1437
1488
  throw new Error(`cannot convert series of type ${t.toString()} to bigint`);
1438
- }, ct = "sy_x_telem_series", N = class N {
1489
+ }, X = "sy_x_telem_series";
1490
+ class I {
1491
+ /**
1492
+ * A unique identifier for the series. If specified by the user, it is their
1493
+ * responsibility to ensure that it is unique. If not specified, a new ID will be
1494
+ * generated.
1495
+ */
1496
+ key;
1497
+ /**
1498
+ * A discriminator used for identifying instances of the series class even
1499
+ * when bundlers mangle the class name.
1500
+ */
1501
+ discriminator = X;
1502
+ /** The data type of the series. */
1503
+ dataType;
1504
+ /**
1505
+ * A sample offset that can be used to shift the values of all samples upwards or
1506
+ * downwards. Useful to convert series to lower precision data types while preserving
1507
+ * the relative range of actual values.
1508
+ */
1509
+ sampleOffset;
1510
+ /**
1511
+ * Stores information about the buffer state of this array into a WebGL buffer.
1512
+ */
1513
+ gl;
1514
+ /** The underlying data. */
1515
+ _data;
1516
+ /** The time range occupied by the series' data. */
1517
+ timeRange = w.ZERO;
1518
+ /**
1519
+ * Alignment defines the location of the series relative to other series in a logical
1520
+ * group. Useful for defining the position of the series within a channel's data.
1521
+ */
1522
+ alignment = 0n;
1523
+ /** A cached minimum value. */
1524
+ cachedMin;
1525
+ /** A cached maximum value. */
1526
+ cachedMax;
1527
+ /** The write position of the buffer. */
1528
+ writePos = A;
1529
+ /** Tracks the number of entities currently using this array. */
1530
+ _refCount = 0;
1531
+ /** Caches the length of the array for variable length data types. */
1532
+ cachedLength;
1533
+ /** Caches the indexes of the array for variable length data types. */
1534
+ _cachedIndexes;
1535
+ /**
1536
+ * A zod schema that can be used to validate that a particular value
1537
+ * can be constructed into a series.
1538
+ */
1539
+ static crudeZ = o.object({
1540
+ timeRange: w.z.optional(),
1541
+ dataType: r.z,
1542
+ alignment: o.coerce.bigint().optional(),
1543
+ data: o.union([
1544
+ yt,
1545
+ Nt,
1546
+ o.instanceof(ArrayBuffer),
1547
+ o.instanceof(Uint8Array)
1548
+ ]),
1549
+ glBufferUsage: at.optional().default("static").optional()
1550
+ });
1551
+ /**
1552
+ * A zod schema that validates and constructs a series from it's crude
1553
+ * representation.
1554
+ */
1555
+ static z = I.crudeZ.transform((t) => new I(t));
1439
1556
  /**
1440
1557
  * The Series constructor accepts either a SeriesArgs object or a CrudeSeries value.
1441
1558
  *
@@ -1510,111 +1627,69 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1510
1627
  * @throws Error if data type cannot be inferred from input
1511
1628
  */
1512
1629
  constructor(t) {
1513
- /**
1514
- * A unique identifier for the series. If specified by the user, it is their
1515
- * responsibility to ensure that it is unique. If not specified, a new ID will be
1516
- * generated.
1517
- */
1518
- i(this, "key");
1519
- /**
1520
- * A discriminator used for identifying instances of the series class even
1521
- * when bundlers mangle the class name.
1522
- */
1523
- i(this, "discriminator", ct);
1524
- /** The data type of the series. */
1525
- i(this, "dataType");
1526
- /**
1527
- * A sample offset that can be used to shift the values of all samples upwards or
1528
- * downwards. Useful to convert series to lower precision data types while preserving
1529
- * the relative range of actual values.
1530
- */
1531
- i(this, "sampleOffset");
1532
- /**
1533
- * Stores information about the buffer state of this array into a WebGL buffer.
1534
- */
1535
- i(this, "gl");
1536
- /** The underlying data. */
1537
- i(this, "_data");
1538
- /** The time range occupied by the series' data. */
1539
- i(this, "timeRange", B.ZERO);
1540
- /**
1541
- * Alignment defines the location of the series relative to other series in a logical
1542
- * group. Useful for defining the position of the series within a channel's data.
1543
- */
1544
- i(this, "alignment", 0n);
1545
- /** A cached minimum value. */
1546
- i(this, "cachedMin");
1547
- /** A cached maximum value. */
1548
- i(this, "cachedMax");
1549
- /** The write position of the buffer. */
1550
- i(this, "writePos", R);
1551
- /** Tracks the number of entities currently using this array. */
1552
- i(this, "_refCount", 0);
1553
- /** Caches the length of the array for variable length data types. */
1554
- i(this, "cachedLength");
1555
- /** Caches the indexes of the array for variable length data types. */
1556
- i(this, "_cachedIndexes");
1557
- re(t) && (t = { data: t }), t.data ?? (t.data = []);
1630
+ mt(t) && (t = { data: t }), t.data ??= [];
1558
1631
  const {
1559
1632
  dataType: e,
1560
- timeRange: r,
1561
- sampleOffset: a = 0,
1633
+ timeRange: s,
1634
+ sampleOffset: u = 0,
1562
1635
  glBufferUsage: f = "static",
1563
- alignment: h = 0n,
1564
- key: A = nt(),
1565
- data: y
1636
+ alignment: c = 0n,
1637
+ key: y = J(),
1638
+ data: g
1566
1639
  } = t;
1567
- if (ht(y)) {
1568
- const l = y;
1640
+ if (Q(g)) {
1641
+ const l = g;
1569
1642
  this.key = l.key, this.dataType = l.dataType, this.sampleOffset = l.sampleOffset, this.gl = l.gl, this._data = l._data, this.timeRange = l.timeRange, this.alignment = l.alignment, this.cachedMin = l.cachedMin, this.cachedMax = l.cachedMax, this.writePos = l.writePos, this._refCount = l._refCount, this.cachedLength = l.cachedLength;
1570
1643
  return;
1571
1644
  }
1572
- const p = ut(y), E = Array.isArray(y);
1573
- if (e != null) this.dataType = new m(e);
1645
+ const b = H(g), N = Array.isArray(g);
1646
+ if (e != null) this.dataType = new r(e);
1574
1647
  else {
1575
- if (y instanceof ArrayBuffer)
1648
+ if (g instanceof ArrayBuffer)
1576
1649
  throw new Error(
1577
1650
  "cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type."
1578
1651
  );
1579
- if (E || p) {
1580
- let l = y;
1581
- if (!p) {
1582
- if (y.length === 0)
1652
+ if (N || b) {
1653
+ let l = g;
1654
+ if (!b) {
1655
+ if (g.length === 0)
1583
1656
  throw new Error(
1584
1657
  "cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type."
1585
1658
  );
1586
- l = y[0];
1659
+ l = g[0];
1587
1660
  }
1588
- if (typeof l == "string") this.dataType = m.STRING;
1589
- else if (typeof l == "number") this.dataType = m.FLOAT64;
1590
- else if (typeof l == "bigint") this.dataType = m.INT64;
1591
- else if (typeof l == "boolean") this.dataType = m.BOOLEAN;
1592
- else if (l instanceof d || l instanceof Date || l instanceof d)
1593
- this.dataType = m.TIMESTAMP;
1594
- else if (typeof l == "object") this.dataType = m.JSON;
1661
+ if (typeof l == "string") this.dataType = r.STRING;
1662
+ else if (typeof l == "number") this.dataType = r.FLOAT64;
1663
+ else if (typeof l == "bigint") this.dataType = r.INT64;
1664
+ else if (typeof l == "boolean") this.dataType = r.BOOLEAN;
1665
+ else if (l instanceof n || l instanceof Date || l instanceof n)
1666
+ this.dataType = r.TIMESTAMP;
1667
+ else if (typeof l == "object") this.dataType = r.JSON;
1595
1668
  else
1596
1669
  throw new Error(
1597
1670
  `cannot infer data type of ${typeof l} when constructing a Series from a JS array`
1598
1671
  );
1599
- } else this.dataType = new m(y);
1672
+ } else this.dataType = new r(g);
1600
1673
  }
1601
- if (!E && !p) this._data = y;
1674
+ if (!N && !b) this._data = g;
1675
+ else if (N && g.length === 0)
1676
+ this._data = new this.dataType.Array([]).buffer;
1602
1677
  else {
1603
- let l = p ? [y] : y;
1604
- const M = l[0];
1605
- (M instanceof d || M instanceof Date || M instanceof g) && (l = l.map((v) => new d(v).valueOf())), this.dataType.equals(m.STRING) ? (this.cachedLength = l.length, this._data = new TextEncoder().encode(`${l.join(`
1678
+ let l = b ? [g] : g;
1679
+ const m = l[0];
1680
+ (m instanceof n || m instanceof Date || m instanceof a) && (l = l.map((v) => new n(v).valueOf())), this.dataType.equals(r.STRING) ? (this.cachedLength = l.length, this._data = new TextEncoder().encode(`${l.join(`
1606
1681
  `)}
1607
- `).buffer) : this.dataType.equals(m.JSON) ? (this.cachedLength = l.length, this._data = new TextEncoder().encode(
1608
- `${l.map((v) => W.encodeString(v)).join(`
1682
+ `).buffer) : this.dataType.equals(r.JSON) ? (this.cachedLength = l.length, this._data = new TextEncoder().encode(
1683
+ `${l.map((v) => L.encodeString(v)).join(`
1609
1684
  `)}
1610
1685
  `
1611
- ).buffer) : this.dataType.usesBigInt && typeof M == "number" ? this._data = new this.dataType.Array(
1686
+ ).buffer) : this.dataType.usesBigInt && typeof m == "number" ? this._data = new this.dataType.Array(
1612
1687
  l.map((v) => BigInt(Math.round(v)))
1613
- ).buffer : !this.dataType.usesBigInt && typeof M == "bigint" ? this._data = new this.dataType.Array(
1614
- l.map((v) => Number(v))
1688
+ ).buffer : !this.dataType.usesBigInt && typeof m == "bigint" ? this._data = new this.dataType.Array(
1689
+ l.map(Number)
1615
1690
  ).buffer : this._data = new this.dataType.Array(l).buffer;
1616
1691
  }
1617
- this.key = A, this.alignment = h, this.sampleOffset = a ?? 0, this.timeRange = r ?? B.ZERO, this.gl = {
1692
+ this.key = y, this.alignment = c, this.sampleOffset = u ?? 0, this.timeRange = s ?? w.ZERO, this.gl = {
1618
1693
  control: null,
1619
1694
  buffer: null,
1620
1695
  prevBuffer: 0,
@@ -1628,10 +1703,10 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1628
1703
  * @param args.dataType the data type of the series.
1629
1704
  * @param args.rest the rest of the arguments to pass to the series constructor.
1630
1705
  */
1631
- static alloc({ capacity: t, dataType: e, ...r }) {
1706
+ static alloc({ capacity: t, dataType: e, ...s }) {
1632
1707
  if (t === 0)
1633
1708
  throw new Error("[Series] - cannot allocate an array of length 0");
1634
- const a = new new m(e).Array(t), f = new N({ data: a.buffer, dataType: e, ...r });
1709
+ const u = new new r(e).Array(t), f = new I({ data: u.buffer, dataType: e, ...s });
1635
1710
  return f.writePos = 0, f;
1636
1711
  }
1637
1712
  /**
@@ -1674,14 +1749,14 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1674
1749
  return this.dataType.isVariable ? this.writeVariable(t) : this.writeFixed(t);
1675
1750
  }
1676
1751
  writeVariable(t) {
1677
- if (this.writePos === R) return 0;
1678
- const e = this.byteCapacity.valueOf() - this.writePos, r = t.subBytes(0, e);
1679
- return this.writeToUnderlyingData(r), this.writePos += r.byteLength.valueOf(), this.cachedLength != null && (this.cachedLength += r.length, this.calculateCachedLength()), r.length;
1752
+ if (this.writePos === A) return 0;
1753
+ const e = this.byteCapacity.valueOf() - this.writePos, s = t.subBytes(0, e);
1754
+ return this.writeToUnderlyingData(s), this.writePos += s.byteLength.valueOf(), this.cachedLength != null && (this.cachedLength += s.length, this.calculateCachedLength()), s.length;
1680
1755
  }
1681
1756
  writeFixed(t) {
1682
- if (this.writePos === R) return 0;
1683
- const e = this.capacity - this.writePos, r = t.sub(0, e);
1684
- return this.writeToUnderlyingData(r), this.cachedLength = void 0, this.maybeRecomputeMinMax(r), this.writePos += r.length, r.length;
1757
+ if (this.writePos === A) return 0;
1758
+ const e = this.capacity - this.writePos, s = t.sub(0, e);
1759
+ return this.writeToUnderlyingData(s), this.cachedLength = void 0, this.maybeRecomputeMinMax(s), this.writePos += s.length, s.length;
1685
1760
  }
1686
1761
  writeToUnderlyingData(t) {
1687
1762
  this.underlyingData.set(
@@ -1702,7 +1777,7 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1702
1777
  * @returns A typed array containing the series data.
1703
1778
  */
1704
1779
  get data() {
1705
- return this.writePos === R ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
1780
+ return this.writePos === A ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
1706
1781
  }
1707
1782
  /**
1708
1783
  * Returns an array of the values in the series as strings.
@@ -1713,17 +1788,6 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1713
1788
  return this.dataType.isVariable ? new TextDecoder().decode(this.underlyingData).split(`
1714
1789
  `).slice(0, -1) : Array.from(this).map((t) => t.toString());
1715
1790
  }
1716
- /**
1717
- * Returns a parsed array of UUIDs from the series.
1718
- * @throws Error if the series does not have a data type of UUID.
1719
- * @returns An array of UUID strings.
1720
- */
1721
- toUUIDs() {
1722
- if (!this.dataType.equals(m.UUID))
1723
- throw new Error("cannot convert non-uuid series to uuids");
1724
- const t = m.UUID.density.valueOf(), e = new Uint8Array(this.underlyingData.buffer);
1725
- return Array.from({ length: this.length }, (r, a) => lt(e, a * t));
1726
- }
1727
1791
  /**
1728
1792
  * Parses a JSON series into an array of values using the provided zod schema.
1729
1793
  * @template Z The zod schema type.
@@ -1732,16 +1796,16 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1732
1796
  * @returns An array of values parsed from the JSON series.
1733
1797
  */
1734
1798
  parseJSON(t) {
1735
- if (!this.dataType.equals(m.JSON))
1799
+ if (!this.dataType.equals(r.JSON))
1736
1800
  throw new Error("cannot parse non-JSON series as JSON");
1737
- return this.toStrings().map((e) => t.parse(W.decodeString(e)));
1801
+ return this.toStrings().map((e) => t.parse(L.decodeString(e)));
1738
1802
  }
1739
1803
  /**
1740
1804
  * Returns the capacity of the series in bytes.
1741
1805
  * @returns The size of the underlying buffer in bytes.
1742
1806
  */
1743
1807
  get byteCapacity() {
1744
- return new L(this.underlyingData.byteLength);
1808
+ return new h(this.underlyingData.byteLength);
1745
1809
  }
1746
1810
  /**
1747
1811
  * Returns the capacity of the series in samples.
@@ -1757,7 +1821,7 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1757
1821
  * @returns The size of the data in bytes.
1758
1822
  */
1759
1823
  get byteLength() {
1760
- return this.writePos === R ? this.byteCapacity : this.dataType.isVariable ? new L(this.writePos) : this.dataType.density.size(this.writePos);
1824
+ return this.writePos === A ? this.byteCapacity : this.dataType.isVariable ? new h(this.writePos) : this.dataType.density.size(this.writePos);
1761
1825
  }
1762
1826
  /**
1763
1827
  * Returns the number of samples in this array.
@@ -1765,15 +1829,15 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1765
1829
  * @returns The number of samples in the series.
1766
1830
  */
1767
1831
  get length() {
1768
- return this.cachedLength != null ? this.cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === R ? this.byteCapacity.valueOf() / this.dataType.density.valueOf() : this.writePos;
1832
+ return this.cachedLength != null ? this.cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === A ? this.byteCapacity.valueOf() / this.dataType.density.valueOf() : this.writePos;
1769
1833
  }
1770
1834
  calculateCachedLength() {
1771
1835
  if (!this.dataType.isVariable)
1772
1836
  throw new Error("cannot calculate length of a non-variable length data type");
1773
1837
  let t = 0;
1774
1838
  const e = [0];
1775
- return this.data.forEach((r, a) => {
1776
- r === K && (t++, e.push(a + 1));
1839
+ return this.data.forEach((s, u) => {
1840
+ s === q && (t++, e.push(u + 1));
1777
1841
  }), this._cachedIndexes = e, this.cachedLength = t, t;
1778
1842
  }
1779
1843
  /**
@@ -1787,11 +1851,11 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1787
1851
  */
1788
1852
  convert(t, e = 0) {
1789
1853
  if (this.dataType.equals(t)) return this;
1790
- const r = new t.Array(this.length);
1791
- for (let a = 0; a < this.length; a++)
1792
- r[a] = kt(this.dataType, t, this.data[a], e);
1793
- return new N({
1794
- data: r.buffer,
1854
+ const s = new t.Array(this.length);
1855
+ for (let u = 0; u < this.length; u++)
1856
+ s[u] = ot(this.dataType, t, this.data[u], e);
1857
+ return new I({
1858
+ data: s.buffer,
1795
1859
  dataType: t,
1796
1860
  timeRange: this.timeRange,
1797
1861
  sampleOffset: e,
@@ -1801,14 +1865,14 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1801
1865
  }
1802
1866
  calcRawMax() {
1803
1867
  if (this.length === 0) return -1 / 0;
1804
- if (this.dataType.equals(m.TIMESTAMP))
1868
+ if (this.dataType.equals(r.TIMESTAMP))
1805
1869
  this.cachedMax = this.data[this.data.length - 1];
1806
1870
  else if (this.dataType.usesBigInt) {
1807
1871
  const t = this.data;
1808
- this.cachedMax = t.reduce((e, r) => e > r ? e : r);
1872
+ this.cachedMax = t.reduce((e, s) => e > s ? e : s);
1809
1873
  } else {
1810
1874
  const t = this.data;
1811
- this.cachedMax = t.reduce((e, r) => e > r ? e : r);
1875
+ this.cachedMax = t.reduce((e, s) => e > s ? e : s);
1812
1876
  }
1813
1877
  return this.cachedMax;
1814
1878
  }
@@ -1819,17 +1883,17 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1819
1883
  calcMax() {
1820
1884
  if (this.dataType.isVariable)
1821
1885
  throw new Error("cannot calculate maximum on a variable length data type");
1822
- return this.writePos === 0 ? -1 / 0 : (this.cachedMax ?? (this.cachedMax = this.calcRawMax()), Z(this.cachedMax, this.sampleOffset));
1886
+ return this.writePos === 0 ? -1 / 0 : (this.cachedMax ??= this.calcRawMax(), x(this.cachedMax, this.sampleOffset));
1823
1887
  }
1824
1888
  calcRawMin() {
1825
1889
  if (this.length === 0) return 1 / 0;
1826
- if (this.dataType.equals(m.TIMESTAMP)) this.cachedMin = this.data[0];
1890
+ if (this.dataType.equals(r.TIMESTAMP)) this.cachedMin = this.data[0];
1827
1891
  else if (this.dataType.usesBigInt) {
1828
1892
  const t = this.data;
1829
- this.cachedMin = t.reduce((e, r) => e < r ? e : r);
1893
+ this.cachedMin = t.reduce((e, s) => e < s ? e : s);
1830
1894
  } else {
1831
1895
  const t = this.data;
1832
- this.cachedMin = t.reduce((e, r) => e < r ? e : r);
1896
+ this.cachedMin = t.reduce((e, s) => e < s ? e : s);
1833
1897
  }
1834
1898
  return this.cachedMin;
1835
1899
  }
@@ -1840,11 +1904,11 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1840
1904
  calcMin() {
1841
1905
  if (this.dataType.isVariable)
1842
1906
  throw new Error("cannot calculate minimum on a variable length data type");
1843
- return this.writePos === 0 ? 1 / 0 : (this.cachedMin ?? (this.cachedMin = this.calcRawMin()), Z(this.cachedMin, this.sampleOffset));
1907
+ return this.writePos === 0 ? 1 / 0 : (this.cachedMin ??= this.calcRawMin(), x(this.cachedMin, this.sampleOffset));
1844
1908
  }
1845
1909
  /** @returns the bounds of the series. */
1846
1910
  get bounds() {
1847
- return q(Number(this.min), Number(this.max), { makeValid: !1 });
1911
+ return C(Number(this.min), Number(this.max), { makeValid: !1 });
1848
1912
  }
1849
1913
  maybeRecomputeMinMax(t) {
1850
1914
  if (this.cachedMin != null) {
@@ -1857,44 +1921,56 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1857
1921
  }
1858
1922
  }
1859
1923
  atAlignment(t, e) {
1860
- const r = Number(t - this.alignment);
1861
- if (r < 0 || r >= this.length) {
1862
- if (e === !0) throw new Error(`[series] - no value at index ${r}`);
1924
+ const s = Number(t - this.alignment);
1925
+ if (s < 0 || s >= this.length) {
1926
+ if (e === !0) throw new Error(`[series] - no value at index ${s}`);
1863
1927
  return;
1864
1928
  }
1865
- return this.at(r, e);
1929
+ return this.at(s, e);
1866
1930
  }
1867
- at(t, e) {
1931
+ at(t, e = !1) {
1868
1932
  if (this.dataType.isVariable) return this.atVariable(t, e ?? !1);
1933
+ if (this.dataType.equals(r.UUID)) return this.atUUID(t, e);
1869
1934
  t < 0 && (t = this.length + t);
1870
- const r = this.data[t];
1871
- if (r == null) {
1935
+ const s = this.data[t];
1936
+ if (s == null) {
1872
1937
  if (e === !0) throw new Error(`[series] - no value at index ${t}`);
1873
1938
  return;
1874
1939
  }
1875
- return Z(r, this.sampleOffset);
1940
+ return x(s, this.sampleOffset);
1941
+ }
1942
+ atUUID(t, e) {
1943
+ t < 0 && (t = this.length + t);
1944
+ const s = P(
1945
+ new Uint8Array(this.buffer, t * this.dataType.density.valueOf())
1946
+ );
1947
+ if (s == null) {
1948
+ if (e) throw new Error(`[series] - no value at index ${t}`);
1949
+ return;
1950
+ }
1951
+ return s;
1876
1952
  }
1877
1953
  atVariable(t, e) {
1878
- let r = 0, a = 0;
1954
+ let s = 0, u = 0;
1879
1955
  if (this._cachedIndexes != null)
1880
- r = this._cachedIndexes[t], a = this._cachedIndexes[t + 1] - 1;
1956
+ s = this._cachedIndexes[t], u = this._cachedIndexes[t + 1] - 1;
1881
1957
  else {
1882
1958
  t < 0 && (t = this.length + t);
1883
- for (let h = 0; h < this.data.length; h++)
1884
- if (this.data[h] === K) {
1959
+ for (let c = 0; c < this.data.length; c++)
1960
+ if (this.data[c] === q) {
1885
1961
  if (t === 0) {
1886
- a = h;
1962
+ u = c;
1887
1963
  break;
1888
1964
  }
1889
- r = h + 1, t--;
1965
+ s = c + 1, t--;
1890
1966
  }
1891
- if (a === 0 && (a = this.data.length), r >= a || t > 0) {
1967
+ if (u === 0 && (u = this.data.length), s >= u || t > 0) {
1892
1968
  if (e) throw new Error(`[series] - no value at index ${t}`);
1893
1969
  return;
1894
1970
  }
1895
1971
  }
1896
- const f = this.data.slice(r, a);
1897
- return this.dataType.equals(m.STRING) ? new TextDecoder().decode(f) : mt(JSON.parse(new TextDecoder().decode(f)));
1972
+ const f = this.data.slice(s, u);
1973
+ return this.dataType.equals(r.STRING) ? new TextDecoder().decode(f) : z(JSON.parse(new TextDecoder().decode(f)));
1898
1974
  }
1899
1975
  /**
1900
1976
  * @returns the index of the first sample that is greater than or equal to the given value.
@@ -1902,12 +1978,12 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1902
1978
  * @param value the value to search for.
1903
1979
  */
1904
1980
  binarySearch(t) {
1905
- let e = 0, r = this.length - 1;
1906
- const a = Ot(t);
1907
- for (; e <= r; ) {
1908
- const f = Math.floor((e + r) / 2), h = a(this.at(f, !0), t);
1909
- if (h === 0) return f;
1910
- h < 0 ? e = f + 1 : r = f - 1;
1981
+ let e = 0, s = this.length - 1;
1982
+ const u = _(t);
1983
+ for (; e <= s; ) {
1984
+ const f = Math.floor((e + s) / 2), c = u(this.at(f, !0), t);
1985
+ if (c === 0) return f;
1986
+ c < 0 ? e = f + 1 : s = f - 1;
1911
1987
  }
1912
1988
  return e;
1913
1989
  }
@@ -1919,23 +1995,23 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1919
1995
  * be the same buffer previously passed to {@method acquire} or {@method updateGLBuffer}.
1920
1996
  */
1921
1997
  updateGLBuffer(t) {
1922
- if (this.gl.control = t, !this.dataType.equals(m.FLOAT32) && !this.dataType.equals(m.UINT8))
1998
+ if (this.gl.control = t, !this.dataType.equals(r.FLOAT32) && !this.dataType.equals(r.UINT8))
1923
1999
  throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
1924
- const { buffer: e, bufferUsage: r, prevBuffer: a } = this.gl;
1925
- if (e == null && (this.gl.buffer = t.createBuffer()), this.writePos !== a)
1926
- if (t.bindBuffer(t.ARRAY_BUFFER, this.gl.buffer), this.writePos !== R) {
1927
- a === 0 && t.bufferData(t.ARRAY_BUFFER, this.byteCapacity.valueOf(), t.STATIC_DRAW);
1928
- const f = this.dataType.density.size(a).valueOf(), h = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
1929
- t.bufferSubData(t.ARRAY_BUFFER, f, h.buffer), this.gl.prevBuffer = this.writePos;
2000
+ const { buffer: e, bufferUsage: s, prevBuffer: u } = this.gl;
2001
+ if (e == null && (this.gl.buffer = t.createBuffer()), this.writePos !== u)
2002
+ if (t.bindBuffer(t.ARRAY_BUFFER, this.gl.buffer), this.writePos !== A) {
2003
+ u === 0 && t.bufferData(t.ARRAY_BUFFER, this.byteCapacity.valueOf(), t.STATIC_DRAW);
2004
+ const f = this.dataType.density.size(u).valueOf(), c = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
2005
+ t.bufferSubData(t.ARRAY_BUFFER, f, c.buffer), this.gl.prevBuffer = this.writePos;
1930
2006
  } else
1931
2007
  t.bufferData(
1932
2008
  t.ARRAY_BUFFER,
1933
2009
  this.buffer,
1934
- r === "static" ? t.STATIC_DRAW : t.DYNAMIC_DRAW
1935
- ), this.gl.prevBuffer = R;
2010
+ s === "static" ? t.STATIC_DRAW : t.DYNAMIC_DRAW
2011
+ ), this.gl.prevBuffer = A;
1936
2012
  }
1937
2013
  as(t) {
1938
- return ft(t, this.dataType), this;
2014
+ return D(t, this.dataType), this;
1939
2015
  }
1940
2016
  /** @returns a digest containing information about the series. */
1941
2017
  get digest() {
@@ -1944,8 +2020,8 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1944
2020
  dataType: this.dataType.toString(),
1945
2021
  sampleOffset: this.sampleOffset,
1946
2022
  alignment: {
1947
- lower: et(this.alignmentBounds.lower),
1948
- upper: et(this.alignmentBounds.upper)
2023
+ lower: k(this.alignmentBounds.lower),
2024
+ upper: k(this.alignmentBounds.upper)
1949
2025
  },
1950
2026
  timeRange: this.timeRange.toString(),
1951
2027
  length: this.length,
@@ -1962,7 +2038,7 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1962
2038
  * is exclusive.
1963
2039
  */
1964
2040
  get alignmentBounds() {
1965
- return q(this.alignment, this.alignment + BigInt(this.length));
2041
+ return C(this.alignment, this.alignment + BigInt(this.length));
1966
2042
  }
1967
2043
  maybeGarbageCollectGLBuffer(t) {
1968
2044
  this.gl.buffer != null && (t.deleteBuffer(this.gl.buffer), this.gl.buffer = null, this.gl.prevBuffer = 0, this.gl.control = null);
@@ -1979,10 +2055,10 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
1979
2055
  }
1980
2056
  [Symbol.iterator]() {
1981
2057
  if (this.dataType.isVariable) {
1982
- const t = new se(this);
1983
- return this.dataType.equals(m.JSON) ? new z(t) : t;
2058
+ const t = new vt(this);
2059
+ return this.dataType.equals(r.JSON) ? new $(t) : t;
1984
2060
  }
1985
- return new ne(this);
2061
+ return this.dataType.equals(r.UUID) ? new Ut(this) : new At(this);
1986
2062
  }
1987
2063
  /**
1988
2064
  * Returns a slice of the series from start to end.
@@ -2009,7 +2085,7 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
2009
2085
  * @returns An iterator over the specified range.
2010
2086
  */
2011
2087
  subIterator(t, e) {
2012
- return new tt(this, t, e ?? this.length);
2088
+ return new V(this, t, e ?? this.length);
2013
2089
  }
2014
2090
  /**
2015
2091
  * Returns an iterator over a portion of the series based on alignment.
@@ -2018,7 +2094,7 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
2018
2094
  * @returns An iterator over the specified alignment range.
2019
2095
  */
2020
2096
  subAlignmentIterator(t, e) {
2021
- return new tt(
2097
+ return new V(
2022
2098
  this,
2023
2099
  Number(t - this.alignment),
2024
2100
  Number(e - this.alignment)
@@ -2026,9 +2102,9 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
2026
2102
  }
2027
2103
  subBytes(t, e) {
2028
2104
  if (t >= 0 && (e == null || e >= this.byteLength.valueOf())) return this;
2029
- const r = this.data.subarray(t, e);
2030
- return new N({
2031
- data: r,
2105
+ const s = this.data.subarray(t, e);
2106
+ return new I({
2107
+ data: s,
2032
2108
  dataType: this.dataType,
2033
2109
  timeRange: this.timeRange,
2034
2110
  sampleOffset: this.sampleOffset,
@@ -2036,11 +2112,11 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
2036
2112
  alignment: this.alignment + BigInt(t)
2037
2113
  });
2038
2114
  }
2039
- sliceSub(t, e, r) {
2040
- if (e <= 0 && (r == null || r >= this.length)) return this;
2041
- let a;
2042
- return t ? a = this.data.subarray(e, r) : a = this.data.slice(e, r), new N({
2043
- data: a,
2115
+ sliceSub(t, e, s) {
2116
+ if (e <= 0 && (s == null || s >= this.length)) return this;
2117
+ let u;
2118
+ return t ? u = this.data.subarray(e, s) : u = this.data.slice(e, s), new I({
2119
+ data: u,
2044
2120
  dataType: this.dataType,
2045
2121
  timeRange: this.timeRange,
2046
2122
  sampleOffset: this.sampleOffset,
@@ -2054,10 +2130,10 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
2054
2130
  * @returns A new series with the specified alignment.
2055
2131
  */
2056
2132
  reAlign(t) {
2057
- return new N({
2133
+ return new I({
2058
2134
  data: this.buffer,
2059
2135
  dataType: this.dataType,
2060
- timeRange: B.ZERO,
2136
+ timeRange: w.ZERO,
2061
2137
  sampleOffset: this.sampleOffset,
2062
2138
  glBufferUsage: "static",
2063
2139
  alignment: t
@@ -2069,59 +2145,37 @@ const Qt = () => Xt(), lt = (n, t) => Wt(n, t), _t = Gt, pe = /* @__PURE__ */ Ob
2069
2145
  * @returns A string representation of the series.
2070
2146
  */
2071
2147
  toString() {
2072
- var e, r;
2073
2148
  let t = `Series(${this.dataType.toString()} ${this.length} [`;
2074
- if (this.length <= 10) t += Array.from(this).map((a) => a.toString());
2149
+ if (this.length <= 10) t += Array.from(this).map((e) => e.toString());
2075
2150
  else {
2076
- for (let a = 0; a < 5; a++)
2077
- t += `${(e = this.at(a)) == null ? void 0 : e.toString()}`, t += ",";
2151
+ for (let e = 0; e < 5; e++)
2152
+ t += `${this.at(e)?.toString()}`, t += ",";
2078
2153
  t += "...,";
2079
- for (let a = -5; a < 0; a++)
2080
- t += (r = this.at(a)) == null ? void 0 : r.toString(), a < -1 && (t += ",");
2154
+ for (let e = -5; e < 0; e++)
2155
+ t += this.at(e)?.toString(), e < -1 && (t += ",");
2081
2156
  }
2082
2157
  return t += "])", t;
2083
2158
  }
2084
- };
2085
- /**
2086
- * A zod schema that can be used to validate that a particular value
2087
- * can be constructed into a series.
2088
- */
2089
- i(N, "crudeZ", G({
2090
- timeRange: B.z.optional(),
2091
- dataType: m.z,
2092
- alignment: st().optional(),
2093
- data: S([
2094
- te,
2095
- ee,
2096
- O(ArrayBuffer),
2097
- O(Uint8Array)
2098
- ]),
2099
- glBufferUsage: Vt.optional().default("static").optional()
2100
- })), /**
2101
- * A zod schema that validates and constructs a series from it's crude
2102
- * representation.
2103
- */
2104
- i(N, "z", N.crudeZ.transform((t) => new N(t)));
2105
- let V = N;
2106
- const re = (n) => n == null ? !1 : Array.isArray(n) || n instanceof ArrayBuffer || ArrayBuffer.isView(n) && !(n instanceof DataView) || n instanceof V ? !0 : ut(n), ht = it(ct, V);
2107
- class tt {
2108
- constructor(t, e, r) {
2109
- i(this, "series");
2110
- i(this, "end");
2111
- i(this, "index");
2159
+ }
2160
+ const mt = (i) => i == null ? !1 : Array.isArray(i) || i instanceof ArrayBuffer || ArrayBuffer.isView(i) && !(i instanceof DataView) || i instanceof I ? !0 : H(i), Q = j(X, I);
2161
+ class V {
2162
+ series;
2163
+ end;
2164
+ index;
2165
+ constructor(t, e, s) {
2112
2166
  this.series = t;
2113
- const a = q(0, t.length);
2114
- this.end = Q(a, r), this.index = Q(a, e);
2167
+ const u = C(0, t.length);
2168
+ this.end = Y(u, s), this.index = Y(u, e);
2115
2169
  }
2116
2170
  next() {
2117
2171
  return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
2118
2172
  }
2119
2173
  }
2120
- class se {
2174
+ class vt {
2175
+ series;
2176
+ index;
2177
+ decoder;
2121
2178
  constructor(t) {
2122
- i(this, "series");
2123
- i(this, "index");
2124
- i(this, "decoder");
2125
2179
  if (!t.dataType.isVariable)
2126
2180
  throw new Error(
2127
2181
  "cannot create a variable series iterator for a non-variable series"
@@ -2130,30 +2184,45 @@ class se {
2130
2184
  }
2131
2185
  next() {
2132
2186
  const t = this.index, e = this.series.data;
2133
- for (; this.index < e.length && e[this.index] !== K; ) this.index++;
2134
- const r = this.index;
2135
- return t === r ? { done: !0, value: void 0 } : (this.index++, { done: !1, value: this.decoder.decode(this.series.buffer.slice(t, r)) });
2187
+ for (; this.index < e.length && e[this.index] !== q; ) this.index++;
2188
+ const s = this.index;
2189
+ return t === s ? { done: !0, value: void 0 } : (this.index++, { done: !1, value: this.decoder.decode(this.series.buffer.slice(t, s)) });
2136
2190
  }
2137
2191
  }
2138
- const k = class k {
2192
+ class $ {
2193
+ wrapped;
2194
+ static schema = o.record(o.string(), o.unknown());
2139
2195
  constructor(t) {
2140
- i(this, "wrapped");
2141
2196
  this.wrapped = t;
2142
2197
  }
2143
2198
  next() {
2144
2199
  const t = this.wrapped.next();
2145
2200
  return t.done === !0 ? { done: !0, value: void 0 } : {
2146
2201
  done: !1,
2147
- value: W.decodeString(t.value, k.schema)
2202
+ value: L.decodeString(t.value, $.schema)
2148
2203
  };
2149
2204
  }
2150
- };
2151
- i(k, "schema", xt($(), Lt()));
2152
- let z = k;
2153
- class ne {
2205
+ }
2206
+ class Ut {
2207
+ series;
2208
+ index;
2209
+ data;
2210
+ density;
2211
+ constructor(t) {
2212
+ if (!t.dataType.equals(r.UUID))
2213
+ throw new Error("cannot create a UUID series iterator for a non-UUID series");
2214
+ this.series = t, this.index = 0, this.data = new Uint8Array(t.buffer), this.density = r.UUID.density.valueOf();
2215
+ }
2216
+ next() {
2217
+ if (this.index >= this.series.length) return { done: !0, value: void 0 };
2218
+ const t = P(this.data, this.index * this.density);
2219
+ return this.index++, { done: !1, value: t };
2220
+ }
2221
+ }
2222
+ class At {
2223
+ series;
2224
+ index;
2154
2225
  constructor(t) {
2155
- i(this, "series");
2156
- i(this, "index");
2157
2226
  this.series = t, this.index = 0;
2158
2227
  }
2159
2228
  next() {
@@ -2163,7 +2232,9 @@ class ne {
2163
2232
  };
2164
2233
  }
2165
2234
  }
2166
- class ve {
2235
+ class Vt {
2236
+ /** The array of series in this collection */
2237
+ series;
2167
2238
  /**
2168
2239
  * The MultiSeries constructor accepts an optional array of Series instances. All series
2169
2240
  * in the collection must have the same data type.
@@ -2205,25 +2276,23 @@ class ve {
2205
2276
  * @throws Error if attempting to add a series with a different data type
2206
2277
  */
2207
2278
  constructor(t = []) {
2208
- /** The array of series in this collection */
2209
- i(this, "series");
2210
2279
  if (t.length !== 0) {
2211
2280
  const e = t[0].dataType;
2212
- for (let r = 1; r < t.length; r++)
2213
- if (!t[r].dataType.equals(e))
2281
+ for (let s = 1; s < t.length; s++)
2282
+ if (!t[s].dataType.equals(e))
2214
2283
  throw new Error("[multi-series] - series must have the same data type");
2215
2284
  }
2216
2285
  this.series = t;
2217
2286
  }
2218
2287
  as(t) {
2219
- return ft(t, this.dataType), this;
2288
+ return D(t, this.dataType), this;
2220
2289
  }
2221
2290
  /**
2222
2291
  * Returns the data type of the series in this collection. If the collection is empty,
2223
2292
  * returns DataType.UNKNOWN.
2224
2293
  */
2225
2294
  get dataType() {
2226
- return this.series.length === 0 ? m.UNKNOWN : this.series[0].dataType;
2295
+ return this.series.length === 0 ? r.UNKNOWN : this.series[0].dataType;
2227
2296
  }
2228
2297
  /**
2229
2298
  * Returns the combined time range of all series in the collection. If the collection
@@ -2231,7 +2300,7 @@ class ve {
2231
2300
  * series to the end of the last series.
2232
2301
  */
2233
2302
  get timeRange() {
2234
- return this.series.length === 0 ? B.ZERO : new B(
2303
+ return this.series.length === 0 ? w.ZERO : new w(
2235
2304
  this.series[0].timeRange.start,
2236
2305
  this.series[this.series.length - 1].timeRange.end
2237
2306
  );
@@ -2249,7 +2318,7 @@ class ve {
2249
2318
  * series + its length. If the collection is empty, returns bounds.construct(0n, 0n).
2250
2319
  */
2251
2320
  get alignmentBounds() {
2252
- return this.series.length === 0 ? q(0n, 0n) : q(
2321
+ return this.series.length === 0 ? C(0n, 0n) : C(
2253
2322
  this.series[0].alignmentBounds.lower,
2254
2323
  this.series[this.series.length - 1].alignmentBounds.upper
2255
2324
  );
@@ -2257,12 +2326,12 @@ class ve {
2257
2326
  push(t) {
2258
2327
  const e = () => new Error(
2259
2328
  `cannot push a ${t.dataType.toString()} series to a ${this.dataType.toString()} multi-series`
2260
- ), r = t.dataType.equals(this.dataType);
2261
- if (ht(t)) {
2262
- if (this.series.length !== 0 && !r) throw e();
2329
+ ), s = t.dataType.equals(this.dataType);
2330
+ if (Q(t)) {
2331
+ if (this.series.length !== 0 && !s) throw e();
2263
2332
  this.series.push(t);
2264
2333
  } else {
2265
- if (this.series.length !== 0 && t.series.length !== 0 && !r)
2334
+ if (this.series.length !== 0 && t.series.length !== 0 && !s)
2266
2335
  throw e();
2267
2336
  this.series.push(...t.series);
2268
2337
  }
@@ -2275,16 +2344,16 @@ class ve {
2275
2344
  return this.series.reduce((t, e) => t + e.length, 0);
2276
2345
  }
2277
2346
  atAlignment(t, e) {
2278
- for (const r of this.series)
2279
- if (F(r.alignmentBounds, t))
2280
- return r.atAlignment(t, e);
2347
+ for (const s of this.series)
2348
+ if (R(s.alignmentBounds, t))
2349
+ return s.atAlignment(t, e);
2281
2350
  if (e) throw new Error(`[series] - no value at alignment ${t}`);
2282
2351
  }
2283
2352
  at(t, e = !1) {
2284
2353
  t < 0 && (t = this.length + t);
2285
- for (const r of this.series) {
2286
- if (t < r.length) return r.at(t, e);
2287
- t -= r.length;
2354
+ for (const s of this.series) {
2355
+ if (t < s.length) return s.at(t, e);
2356
+ t -= s.length;
2288
2357
  }
2289
2358
  if (e) throw new Error(`[series] - no value at index ${t}`);
2290
2359
  }
@@ -2295,7 +2364,7 @@ class ve {
2295
2364
  * @returns An iterator over the specified range.
2296
2365
  */
2297
2366
  subIterator(t, e) {
2298
- return new j(this, t, e ?? this.length);
2367
+ return new S(this, t, e ?? this.length);
2299
2368
  }
2300
2369
  /**
2301
2370
  * Returns an iterator over a portion of the multi-series based on alignment.
@@ -2305,28 +2374,28 @@ class ve {
2305
2374
  */
2306
2375
  subAlignmentIterator(t, e) {
2307
2376
  if (t >= this.alignmentBounds.upper || e <= this.alignmentBounds.lower)
2308
- return H;
2309
- let r = 0;
2377
+ return p;
2378
+ let s = 0;
2310
2379
  for (let f = 0; f < this.series.length; f++) {
2311
- const h = this.series[f];
2312
- if (t < h.alignment) break;
2313
- if (t >= h.alignmentBounds.upper) r += h.length;
2314
- else if (F(h.alignmentBounds, t)) {
2315
- r += Number(t - h.alignment);
2380
+ const c = this.series[f];
2381
+ if (t < c.alignment) break;
2382
+ if (t >= c.alignmentBounds.upper) s += c.length;
2383
+ else if (R(c.alignmentBounds, t)) {
2384
+ s += Number(t - c.alignment);
2316
2385
  break;
2317
2386
  }
2318
2387
  }
2319
- let a = 0;
2388
+ let u = 0;
2320
2389
  for (let f = 0; f < this.series.length; f++) {
2321
- const h = this.series[f];
2322
- if (e < h.alignment) break;
2323
- if (e >= h.alignmentBounds.upper) a += h.length;
2324
- else if (F(h.alignmentBounds, e)) {
2325
- a += Number(e - h.alignment);
2390
+ const c = this.series[f];
2391
+ if (e < c.alignment) break;
2392
+ if (e >= c.alignmentBounds.upper) u += c.length;
2393
+ else if (R(c.alignmentBounds, e)) {
2394
+ u += Number(e - c.alignment);
2326
2395
  break;
2327
2396
  }
2328
2397
  }
2329
- return new j(this, r, a);
2398
+ return new S(this, s, u);
2330
2399
  }
2331
2400
  /**
2332
2401
  * Returns an iterator over the specified alignment range and span.
@@ -2335,19 +2404,19 @@ class ve {
2335
2404
  * @returns An iterator over the specified range.
2336
2405
  */
2337
2406
  subAlignmentSpanIterator(t, e) {
2338
- if (t >= this.alignmentBounds.upper) return H;
2407
+ if (t >= this.alignmentBounds.upper) return p;
2339
2408
  e = Math.min(e, Number(this.distance(t, this.alignmentBounds.upper)));
2340
- let r = 0;
2341
- for (let a = 0; a < this.series.length; a++) {
2342
- const f = this.series[a];
2409
+ let s = 0;
2410
+ for (let u = 0; u < this.series.length; u++) {
2411
+ const f = this.series[u];
2343
2412
  if (t < f.alignment) break;
2344
- if (t >= f.alignmentBounds.upper) r += f.length;
2345
- else if (F(f.alignmentBounds, t)) {
2346
- r += Number(t - f.alignment);
2413
+ if (t >= f.alignmentBounds.upper) s += f.length;
2414
+ else if (R(f.alignmentBounds, t)) {
2415
+ s += Number(t - f.alignment);
2347
2416
  break;
2348
2417
  }
2349
2418
  }
2350
- return new j(this, r, r + e);
2419
+ return new S(this, s, s + e);
2351
2420
  }
2352
2421
  /**
2353
2422
  * Updates the WebGL buffer for all series in the collection.
@@ -2360,13 +2429,13 @@ class ve {
2360
2429
  * Returns the bounds containing the minimum and maximum values across all series.
2361
2430
  */
2362
2431
  get bounds() {
2363
- return yt(this.series.map((t) => t.bounds));
2432
+ return tt(this.series.map((t) => t.bounds));
2364
2433
  }
2365
2434
  /**
2366
2435
  * Returns the sum of the byte lengths of all series.
2367
2436
  */
2368
2437
  get byteLength() {
2369
- return new L(this.series.reduce((t, e) => t + e.byteLength.valueOf(), 0));
2438
+ return new h(this.series.reduce((t, e) => t + e.byteLength.valueOf(), 0));
2370
2439
  }
2371
2440
  /**
2372
2441
  * Returns a combined typed array containing all data from all series.
@@ -2375,8 +2444,8 @@ class ve {
2375
2444
  get data() {
2376
2445
  const t = new this.dataType.Array(this.length);
2377
2446
  let e = 0;
2378
- for (const r of this.series)
2379
- t.set(r.data, e), e += r.length;
2447
+ for (const s of this.series)
2448
+ t.set(s.data, e), e += s.length;
2380
2449
  return new this.dataType.Array(t.buffer);
2381
2450
  }
2382
2451
  /**
@@ -2386,8 +2455,8 @@ class ve {
2386
2455
  * @returns The resulting alignment after traversal.
2387
2456
  */
2388
2457
  traverseAlignment(t, e) {
2389
- const r = this.series.map((a) => a.alignmentBounds);
2390
- return bt(r, t, e);
2458
+ const s = this.series.map((u) => u.alignmentBounds);
2459
+ return et(s, t, e);
2391
2460
  }
2392
2461
  /**
2393
2462
  * Acquires a reference to the WebGL buffer for all series.
@@ -2409,8 +2478,8 @@ class ve {
2409
2478
  * @returns The distance between the alignments.
2410
2479
  */
2411
2480
  distance(t, e) {
2412
- const r = this.series.map((a) => a.alignmentBounds);
2413
- return wt(r, t, e);
2481
+ const s = this.series.map((u) => u.alignmentBounds);
2482
+ return st(s, t, e);
2414
2483
  }
2415
2484
  /**
2416
2485
  * Parses a JSON multi-series into an array of values using the provided zod schema.
@@ -2420,7 +2489,7 @@ class ve {
2420
2489
  * @returns An array of values parsed from the JSON series.
2421
2490
  */
2422
2491
  parseJSON(t) {
2423
- if (!this.dataType.equals(m.JSON))
2492
+ if (!this.dataType.equals(r.JSON))
2424
2493
  throw new Error("cannot parse non-JSON series as JSON");
2425
2494
  return this.series.flatMap((e) => e.parseJSON(t));
2426
2495
  }
@@ -2433,14 +2502,22 @@ class ve {
2433
2502
  next() {
2434
2503
  return { done: !0, value: void 0 };
2435
2504
  }
2436
- } : new ie(this.series);
2505
+ } : new Et(this.series);
2506
+ }
2507
+ /**
2508
+ * Returns an array of the values in the multi-series as strings.
2509
+ * For variable length data types (like STRING or JSON), this decodes the underlying buffer.
2510
+ * @returns An array of string representations of the multi-series values.
2511
+ */
2512
+ toStrings() {
2513
+ return this.series.flatMap((t) => t.toStrings());
2437
2514
  }
2438
2515
  }
2439
- class ie {
2516
+ class Et {
2517
+ series;
2518
+ seriesIndex;
2519
+ internal;
2440
2520
  constructor(t) {
2441
- i(this, "series");
2442
- i(this, "seriesIndex");
2443
- i(this, "internal");
2444
2521
  this.series = t, this.seriesIndex = 0, this.internal = t[0][Symbol.iterator]();
2445
2522
  }
2446
2523
  next() {
@@ -2451,12 +2528,12 @@ class ie {
2451
2528
  return this;
2452
2529
  }
2453
2530
  }
2454
- class j {
2455
- constructor(t, e, r) {
2456
- i(this, "series");
2457
- i(this, "index");
2458
- i(this, "end");
2459
- this.series = t, this.end = r, this.index = e;
2531
+ class S {
2532
+ series;
2533
+ index;
2534
+ end;
2535
+ constructor(t, e, s) {
2536
+ this.series = t, this.end = s, this.index = e;
2460
2537
  }
2461
2538
  next() {
2462
2539
  return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
@@ -2465,28 +2542,27 @@ class j {
2465
2542
  return this;
2466
2543
  }
2467
2544
  }
2468
- const et = (n) => {
2469
- const t = n >> 32n, e = n & 0xffffffffn;
2545
+ const k = (i) => {
2546
+ const t = i >> 32n, e = i & 0xffffffffn;
2470
2547
  return { domain: t, sample: e };
2471
2548
  };
2472
2549
  export {
2473
- I as D,
2474
- ve as M,
2475
- Y as R,
2476
- V as S,
2477
- g as T,
2478
- re as a,
2479
- d as b,
2480
- be as c,
2481
- B as d,
2482
- m as e,
2483
- L as f,
2484
- ut as g,
2485
- kt as h,
2486
- we as i,
2487
- Z as j,
2488
- Ie as m,
2489
- Te as s,
2490
- Ne as t,
2491
- pe as u
2550
+ d as D,
2551
+ Vt as M,
2552
+ E as R,
2553
+ I as S,
2554
+ n as T,
2555
+ a,
2556
+ w as b,
2557
+ r as c,
2558
+ h as d,
2559
+ H as e,
2560
+ ot as f,
2561
+ x as g,
2562
+ J as h,
2563
+ mt as i,
2564
+ $t as j,
2565
+ Ft as m,
2566
+ Yt as t,
2567
+ Zt as u
2492
2568
  };