@synnaxlabs/x 0.39.0 → 0.41.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 (81) hide show
  1. package/.turbo/turbo-build.log +22 -22
  2. package/dist/{bounds-azUOoVVR.js → bounds-DQrjn60Q.js} +83 -86
  3. package/dist/bounds-M-SZ3X1Z.cjs +1 -0
  4. package/dist/bounds.cjs +1 -1
  5. package/dist/bounds.js +1 -1
  6. package/dist/box-0YrQibkB.cjs +1 -0
  7. package/dist/box-Cc8IzcNo.js +205 -0
  8. package/dist/box.cjs +1 -1
  9. package/dist/box.js +1 -1
  10. package/dist/index.cjs +3 -3
  11. package/dist/index.js +235 -198
  12. package/dist/location-BGl5Ddds.cjs +1 -0
  13. package/dist/{location-BuYbIFHD.js → location-C3aeu046.js} +16 -12
  14. package/dist/location.cjs +1 -1
  15. package/dist/location.js +1 -1
  16. package/dist/{position-DTrNGtrm.cjs → position-Cai5-wi1.cjs} +1 -1
  17. package/dist/{position-DemzGvAY.js → position-DIglP1l2.js} +2 -2
  18. package/dist/position.cjs +1 -1
  19. package/dist/position.js +1 -1
  20. package/dist/{scale-DpJM6__6.cjs → scale-DL9VFGhL.cjs} +1 -1
  21. package/dist/{scale-C0EllH-1.js → scale-DQwBWnwc.js} +4 -4
  22. package/dist/scale.cjs +1 -1
  23. package/dist/scale.js +1 -1
  24. package/dist/series-BMma2b5q.cjs +11 -0
  25. package/dist/{series-CXnO-P0V.js → series-D0zxMWxP.js} +285 -297
  26. package/dist/spatial.cjs +1 -1
  27. package/dist/spatial.js +6 -6
  28. package/dist/src/index.d.ts +1 -0
  29. package/dist/src/index.d.ts.map +1 -1
  30. package/dist/src/math/external.d.ts +3 -0
  31. package/dist/src/math/external.d.ts.map +1 -0
  32. package/dist/src/math/index.d.ts +1 -1
  33. package/dist/src/math/index.d.ts.map +1 -1
  34. package/dist/src/math/round.d.ts +40 -0
  35. package/dist/src/math/round.d.ts.map +1 -0
  36. package/dist/src/math/round.spec.d.ts +2 -0
  37. package/dist/src/math/round.spec.d.ts.map +1 -0
  38. package/dist/src/notation/index.d.ts +2 -0
  39. package/dist/src/notation/index.d.ts.map +1 -0
  40. package/dist/src/notation/notation.d.ts +33 -0
  41. package/dist/src/notation/notation.d.ts.map +1 -0
  42. package/dist/src/notation/notation.spec.d.ts +2 -0
  43. package/dist/src/notation/notation.spec.d.ts.map +1 -0
  44. package/dist/src/spatial/box/box.d.ts +4 -0
  45. package/dist/src/spatial/box/box.d.ts.map +1 -1
  46. package/dist/src/spatial/location/location.d.ts +2 -2
  47. package/dist/src/spatial/xy/xy.d.ts +10 -0
  48. package/dist/src/spatial/xy/xy.d.ts.map +1 -1
  49. package/dist/src/telem/series.d.ts.map +1 -1
  50. package/dist/src/telem/telem.d.ts +2 -0
  51. package/dist/src/telem/telem.d.ts.map +1 -1
  52. package/dist/telem.cjs +1 -1
  53. package/dist/telem.js +1 -1
  54. package/dist/{xy-DyQSETQZ.cjs → xy-B7065J2S.cjs} +1 -1
  55. package/dist/{xy-DHBO1dG_.js → xy-D_LqxaGt.js} +8 -4
  56. package/dist/xy.cjs +1 -1
  57. package/dist/xy.js +1 -1
  58. package/package.json +8 -8
  59. package/src/index.ts +1 -0
  60. package/src/math/external.ts +11 -0
  61. package/src/math/index.ts +1 -1
  62. package/src/math/round.spec.ts +81 -0
  63. package/src/math/round.ts +68 -0
  64. package/src/notation/index.ts +10 -0
  65. package/src/notation/notation.spec.ts +88 -0
  66. package/src/notation/notation.ts +61 -0
  67. package/src/spatial/box/box.spec.ts +3 -3
  68. package/src/spatial/box/box.ts +8 -0
  69. package/src/spatial/location/location.ts +4 -4
  70. package/src/spatial/position/position.spec.ts +10 -10
  71. package/src/spatial/xy/xy.spec.ts +8 -0
  72. package/src/spatial/xy/xy.ts +14 -0
  73. package/src/telem/series.spec.ts +39 -0
  74. package/src/telem/series.ts +15 -27
  75. package/src/telem/telem.ts +8 -0
  76. package/tsconfig.tsbuildinfo +1 -1
  77. package/dist/bounds-Dwq6ZFHm.cjs +0 -1
  78. package/dist/box-Bzya27QS.cjs +0 -1
  79. package/dist/box-DrsrRNSe.js +0 -201
  80. package/dist/location-BgpQ3rN2.cjs +0 -1
  81. package/dist/series-BgoCtU71.cjs +0 -11
@@ -1,60 +1,60 @@
1
- var et = Object.defineProperty;
2
- var rt = (o, t, e) => t in o ? et(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var s = (o, t, e) => rt(o, typeof t != "symbol" ? t + "" : t, e);
1
+ var rt = Object.defineProperty;
2
+ var nt = (o, t, e) => t in o ? rt(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var s = (o, t, e) => nt(o, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { z as l } from "zod";
5
5
  import { J as q } from "./index-C3QzbIwt.js";
6
- import { s as nt } from "./index-DizUWH6z.js";
7
- import { n as st } from "./index-BVC_8Cg9.js";
8
- import { m as R, c as L, a as G, d as D, t as it, e as at } from "./bounds-azUOoVVR.js";
9
- import "./box-DrsrRNSe.js";
6
+ import { s as st } from "./index-DizUWH6z.js";
7
+ import { n as it } from "./index-BVC_8Cg9.js";
8
+ import { m as R, c as L, a as V, d as D, t as at, e as ut } from "./bounds-DQrjn60Q.js";
9
+ import "./box-Cc8IzcNo.js";
10
10
  import "./dimensions-CRgergMS.js";
11
11
  import "./base-DFq0vvGn.js";
12
- import "./location-BuYbIFHD.js";
13
- import "./scale-C0EllH-1.js";
14
- import "./xy-DHBO1dG_.js";
15
- let ut = (o, t = 21) => (e = t) => {
16
- let r = "", i = e | 0;
17
- for (; i--; )
12
+ import "./location-C3aeu046.js";
13
+ import "./scale-DQwBWnwc.js";
14
+ import "./xy-D_LqxaGt.js";
15
+ let ot = (o, t = 21) => (e = t) => {
16
+ let r = "", a = e | 0;
17
+ for (; a--; )
18
18
  r += o[Math.random() * o.length | 0];
19
19
  return r;
20
20
  };
21
- const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt = ut(ot, 11), Q = () => lt(), Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
21
+ const lt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", ft = ot(lt, 11), Q = () => ft(), Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
22
22
  __proto__: null,
23
23
  create: Q
24
- }, Symbol.toStringTag, { value: "Module" })), ft = l.enum(["static", "dynamic"]), _ = (o, t) => {
24
+ }, Symbol.toStringTag, { value: "Module" })), ct = l.enum(["static", "dynamic"]), _ = (o, t) => {
25
25
  const e = new m(t);
26
26
  if (![
27
- y.DAY,
28
- y.HOUR,
29
- y.MINUTE,
30
- y.SECOND,
31
- y.MILLISECOND,
32
- y.MICROSECOND,
33
- y.NANOSECOND
34
- ].some((i) => i.equals(e)))
27
+ w.DAY,
28
+ w.HOUR,
29
+ w.MINUTE,
30
+ w.SECOND,
31
+ w.MILLISECOND,
32
+ w.MICROSECOND,
33
+ w.NANOSECOND
34
+ ].some((a) => a.equals(e)))
35
35
  throw new Error(
36
36
  "Invalid argument for remainder. Must be an even TimeSpan or Timestamp"
37
37
  );
38
38
  const r = o.valueOf() % e.valueOf();
39
- return o instanceof m ? new m(r) : new y(r);
40
- }, a = class a {
39
+ return o instanceof m ? new m(r) : new w(r);
40
+ }, i = class i {
41
41
  constructor(t, e = "UTC") {
42
42
  s(this, "value");
43
43
  s(this, "encodeValue", !0);
44
- if (t == null) this.value = a.now().valueOf();
44
+ if (t == null) this.value = i.now().valueOf();
45
45
  else if (t instanceof Date)
46
- this.value = BigInt(t.getTime()) * a.MILLISECOND.valueOf();
46
+ this.value = BigInt(t.getTime()) * i.MILLISECOND.valueOf();
47
47
  else if (typeof t == "string")
48
- this.value = a.parseDateTimeString(t, e).valueOf();
49
- else if (Array.isArray(t)) this.value = a.parseDate(t);
48
+ this.value = i.parseDateTimeString(t, e).valueOf();
49
+ else if (Array.isArray(t)) this.value = i.parseDate(t);
50
50
  else {
51
51
  let r = BigInt(0);
52
- t instanceof Number && (t = t.valueOf()), e === "local" && (r = a.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = Math.trunc(t) : (isNaN(t) && (t = 0), t === 1 / 0 ? t = a.MAX : t = a.MIN)), this.value = BigInt(t.valueOf()) + r;
52
+ t instanceof Number && (t = t.valueOf()), e === "local" && (r = i.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = Math.trunc(t) : (isNaN(t) && (t = 0), t === 1 / 0 ? t = i.MAX : t = i.MIN)), this.value = BigInt(t.valueOf()) + r;
53
53
  }
54
54
  }
55
55
  static parseDate([t = 1970, e = 1, r = 1]) {
56
- const i = new Date(t, e - 1, r, 0, 0, 0, 0);
57
- return new a(BigInt(i.getTime()) * a.MILLISECOND.valueOf()).truncate(a.DAY).valueOf();
56
+ const a = new Date(t, e - 1, r, 0, 0, 0, 0);
57
+ return new i(BigInt(a.getTime()) * i.MILLISECOND.valueOf()).truncate(i.DAY).valueOf();
58
58
  }
59
59
  encode() {
60
60
  return this.value.toString();
@@ -63,18 +63,18 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
63
63
  return this.value;
64
64
  }
65
65
  static parseTimeString(t, e = "UTC") {
66
- const [r, i, h] = t.split(":");
67
- let c = "00", p = "00";
68
- h != null && ([c, p] = h.split("."));
69
- let O = a.hours(parseInt(r ?? "00")).add(a.minutes(parseInt(i ?? "00"))).add(a.seconds(parseInt(c ?? "00"))).add(a.milliseconds(parseInt(p ?? "00")));
70
- return e === "local" && (O = O.add(a.utcOffset)), O.valueOf();
66
+ const [r, a, c] = t.split(":");
67
+ let h = "00", v = "00";
68
+ c != null && ([h, v] = c.split("."));
69
+ let O = i.hours(parseInt(r ?? "00")).add(i.minutes(parseInt(a ?? "00"))).add(i.seconds(parseInt(h ?? "00"))).add(i.milliseconds(parseInt(v ?? "00")));
70
+ return e === "local" && (O = O.add(i.utcOffset)), O.valueOf();
71
71
  }
72
72
  static parseDateTimeString(t, e = "UTC") {
73
73
  if (!t.includes("/") && !t.includes("-"))
74
- return a.parseTimeString(t, e);
74
+ return i.parseTimeString(t, e);
75
75
  const r = new Date(t);
76
- return t.includes(":") || r.setUTCHours(0, 0, 0, 0), new a(
77
- BigInt(r.getTime()) * a.MILLISECOND.valueOf(),
76
+ return t.includes(":") || r.setUTCHours(0, 0, 0, 0), new i(
77
+ BigInt(r.getTime()) * i.MILLISECOND.valueOf(),
78
78
  e
79
79
  ).valueOf();
80
80
  }
@@ -99,7 +99,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
99
99
  }
100
100
  }
101
101
  toISOString(t = "UTC") {
102
- return t === "UTC" ? this.date().toISOString() : this.sub(a.utcOffset).date().toISOString();
102
+ return t === "UTC" ? this.date().toISOString() : this.sub(i.utcOffset).date().toISOString();
103
103
  }
104
104
  timeString(t = !1, e = "UTC") {
105
105
  const r = this.toISOString(e);
@@ -110,8 +110,8 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
110
110
  return `${e} ${r}`;
111
111
  }
112
112
  static get utcOffset() {
113
- return new y(
114
- BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * a.MINUTE.valueOf()
113
+ return new w(
114
+ BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * i.MINUTE.valueOf()
115
115
  );
116
116
  }
117
117
  /**
@@ -120,7 +120,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
120
120
  * @param other - The other timestamp.
121
121
  */
122
122
  static since(t) {
123
- return new a().span(t);
123
+ return new i().span(t);
124
124
  }
125
125
  /** @returns A JavaScript Date object representing the TimeStamp. */
126
126
  date() {
@@ -133,7 +133,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
133
133
  * @returns True if the TimeStamps are equal, false otherwise.
134
134
  */
135
135
  equals(t) {
136
- return this.valueOf() === new a(t).valueOf();
136
+ return this.valueOf() === new i(t).valueOf();
137
137
  }
138
138
  /**
139
139
  * Creates a TimeSpan representing the duration between the two timestamps.
@@ -182,7 +182,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
182
182
  * otherwise.
183
183
  */
184
184
  after(t) {
185
- return this.valueOf() > new a(t).valueOf();
185
+ return this.valueOf() > new i(t).valueOf();
186
186
  }
187
187
  /**
188
188
  * Checks if the TimeStamp is after or equal to the given TimeStamp.
@@ -192,7 +192,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
192
192
  * false otherwise.
193
193
  */
194
194
  afterEq(t) {
195
- return this.valueOf() >= new a(t).valueOf();
195
+ return this.valueOf() >= new i(t).valueOf();
196
196
  }
197
197
  /**
198
198
  * Checks if the TimeStamp is before the given TimeStamp.
@@ -202,7 +202,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
202
202
  * otherwise.
203
203
  */
204
204
  before(t) {
205
- return this.valueOf() < new a(t).valueOf();
205
+ return this.valueOf() < new i(t).valueOf();
206
206
  }
207
207
  /**
208
208
  * Checks if TimeStamp is before or equal to the current timestamp.
@@ -212,7 +212,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
212
212
  * false otherwise.
213
213
  */
214
214
  beforeEq(t) {
215
- return this.valueOf() <= new a(t).valueOf();
215
+ return this.valueOf() <= new i(t).valueOf();
216
216
  }
217
217
  /**
218
218
  * Adds a TimeSpan to the TimeStamp.
@@ -222,7 +222,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
222
222
  * TimeSpan.
223
223
  */
224
224
  add(t) {
225
- return new a(this.valueOf() + BigInt(t.valueOf()));
225
+ return new i(this.valueOf() + BigInt(t.valueOf()));
226
226
  }
227
227
  /**
228
228
  * Subtracts a TimeSpan from the TimeStamp.
@@ -232,41 +232,47 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
232
232
  * TimeSpan.
233
233
  */
234
234
  sub(t) {
235
- return new a(this.valueOf() - BigInt(t.valueOf()));
235
+ return new i(this.valueOf() - BigInt(t.valueOf()));
236
236
  }
237
237
  /**
238
238
  * @returns the floating point number of hours since the unix epoch to the timestamp
239
239
  * value.
240
240
  */
241
241
  get hours() {
242
- return Number(this.valueOf()) / Number(y.HOUR.valueOf());
242
+ return Number(this.valueOf()) / Number(w.HOUR.valueOf());
243
243
  }
244
244
  /**
245
245
  * @returns the floating point number of minutes since the unix epoch to the timestamp
246
246
  * value.
247
247
  */
248
248
  get minutes() {
249
- return Number(this.valueOf()) / Number(y.MINUTE.valueOf());
249
+ return Number(this.valueOf()) / Number(w.MINUTE.valueOf());
250
250
  }
251
251
  /**
252
252
  * @returns the floating point number of days since the unix epoch to the timestamp
253
253
  * value.
254
254
  */
255
255
  get days() {
256
- return Number(this.valueOf()) / Number(y.DAY.valueOf());
256
+ return Number(this.valueOf()) / Number(w.DAY.valueOf());
257
257
  }
258
258
  /**
259
259
  * @returns the floating point number of seconds since the unix epoch to the timestamp
260
260
  * value.
261
261
  */
262
262
  get seconds() {
263
- return Number(this.valueOf()) / Number(y.SECOND.valueOf());
263
+ return Number(this.valueOf()) / Number(w.SECOND.valueOf());
264
264
  }
265
265
  /**
266
266
  * @returns The number of milliseconds since the unix epoch.
267
267
  */
268
268
  get milliseconds() {
269
- return Number(this.valueOf()) / Number(a.MILLISECOND.valueOf());
269
+ return Number(this.valueOf()) / Number(i.MILLISECOND.valueOf());
270
+ }
271
+ get microseconds() {
272
+ return Number(this.valueOf()) / Number(i.MICROSECOND.valueOf());
273
+ }
274
+ get nanoseconds() {
275
+ return Number(this.valueOf());
270
276
  }
271
277
  /** @returns the integer year that the timestamp corresponds to. */
272
278
  get year() {
@@ -274,7 +280,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
274
280
  }
275
281
  setYear(t) {
276
282
  const e = this.date();
277
- return e.setFullYear(t), new a(e);
283
+ return e.setFullYear(t), new i(e);
278
284
  }
279
285
  /** @returns the integer month that the timestamp corresponds to with its year. */
280
286
  get month() {
@@ -282,7 +288,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
282
288
  }
283
289
  setMonth(t) {
284
290
  const e = this.date();
285
- return e.setMonth(t), new a(e);
291
+ return e.setMonth(t), new i(e);
286
292
  }
287
293
  /** @returns the integer day that the timestamp corresponds to within its month. */
288
294
  get day() {
@@ -290,7 +296,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
290
296
  }
291
297
  setDay(t) {
292
298
  const e = this.date();
293
- return e.setDate(t), new a(e);
299
+ return e.setDate(t), new i(e);
294
300
  }
295
301
  /** @returns the integer hour that the timestamp corresponds to within its day. */
296
302
  get hour() {
@@ -298,7 +304,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
298
304
  }
299
305
  setHour(t) {
300
306
  const e = this.date();
301
- return e.setHours(t), new a(e);
307
+ return e.setHours(t), new i(e);
302
308
  }
303
309
  /** @returns the integer minute that the timestamp corresponds to within its hour. */
304
310
  get minute() {
@@ -306,21 +312,21 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
306
312
  }
307
313
  setMinute(t) {
308
314
  const e = this.date();
309
- return e.setMinutes(t), new a(e);
315
+ return e.setMinutes(t), new i(e);
310
316
  }
311
317
  get second() {
312
318
  return this.date().getSeconds();
313
319
  }
314
320
  setSecond(t) {
315
321
  const e = this.date();
316
- return e.setSeconds(t), new a(e);
322
+ return e.setSeconds(t), new i(e);
317
323
  }
318
324
  get millisecond() {
319
325
  return this.date().getMilliseconds();
320
326
  }
321
327
  setMillisecond(t) {
322
328
  const e = this.date();
323
- return e.setMilliseconds(t), new a(e);
329
+ return e.setMilliseconds(t), new i(e);
324
330
  }
325
331
  toString() {
326
332
  return this.date().toISOString();
@@ -341,7 +347,7 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
341
347
  }
342
348
  /** @returns true if the day portion TimeStamp is today, false otherwise. */
343
349
  get isToday() {
344
- return this.truncate(y.DAY).equals(a.now().truncate(y.DAY));
350
+ return this.truncate(w.DAY).equals(i.now().truncate(w.DAY));
345
351
  }
346
352
  truncate(t) {
347
353
  return this.sub(this.remainder(t));
@@ -352,72 +358,72 @@ const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", lt
352
358
  * JavaScript can do).
353
359
  */
354
360
  static now() {
355
- return new a(/* @__PURE__ */ new Date());
361
+ return new i(/* @__PURE__ */ new Date());
356
362
  }
357
363
  static max(...t) {
358
- let e = a.MIN;
364
+ let e = i.MIN;
359
365
  for (const r of t) {
360
- const i = new a(r);
361
- i.after(e) && (e = i);
366
+ const a = new i(r);
367
+ a.after(e) && (e = a);
362
368
  }
363
369
  return e;
364
370
  }
365
371
  static min(...t) {
366
- let e = a.MAX;
372
+ let e = i.MAX;
367
373
  for (const r of t) {
368
- const i = new a(r);
369
- i.before(e) && (e = i);
374
+ const a = new i(r);
375
+ a.before(e) && (e = a);
370
376
  }
371
377
  return e;
372
378
  }
373
379
  /** @returns a new TimeStamp n nanoseconds after the unix epoch */
374
380
  static nanoseconds(t) {
375
- return new a(t);
381
+ return new i(t);
376
382
  }
377
383
  /** @returns a new TimeStamp n microseconds after the unix epoch */
378
384
  static microseconds(t) {
379
- return a.nanoseconds(t * 1e3);
385
+ return i.nanoseconds(t * 1e3);
380
386
  }
381
387
  /** @returns a new TimeStamp n milliseconds after the unix epoch */
382
388
  static milliseconds(t) {
383
- return a.microseconds(t * 1e3);
389
+ return i.microseconds(t * 1e3);
384
390
  }
385
391
  /** @returns a new TimeStamp n seconds after the unix epoch */
386
392
  static seconds(t) {
387
- return a.milliseconds(t * 1e3);
393
+ return i.milliseconds(t * 1e3);
388
394
  }
389
395
  /** @returns a new TimeStamp n minutes after the unix epoch */
390
396
  static minutes(t) {
391
- return a.seconds(t * 60);
397
+ return i.seconds(t * 60);
392
398
  }
393
399
  /** @returns a new TimeStamp n hours after the unix epoch */
394
400
  static hours(t) {
395
- return a.minutes(t * 60);
401
+ return i.minutes(t * 60);
396
402
  }
397
403
  /** @returns a new TimeStamp n days after the unix epoch */
398
404
  static days(t) {
399
- return a.hours(t * 24);
405
+ return i.hours(t * 24);
400
406
  }
401
407
  };
402
408
  /* One nanosecond after the unix epoch */
403
- s(a, "NANOSECOND", a.nanoseconds(1)), /** One microsecond after the unix epoch */
404
- s(a, "MICROSECOND", a.microseconds(1)), /** One millisecond after the unix epoch */
405
- s(a, "MILLISECOND", a.milliseconds(1)), /** One second after the unix epoch */
406
- s(a, "SECOND", a.seconds(1)), /** One minute after the unix epoch */
407
- s(a, "MINUTE", a.minutes(1)), /** One hour after the unix epoch */
408
- s(a, "HOUR", a.hours(1)), /** One day after the unix epoch */
409
- s(a, "DAY", a.days(1)), /** The maximum possible value for a timestamp */
410
- s(a, "MAX", new a((1n << 63n) - 1n)), /** The minimum possible value for a timestamp */
411
- s(a, "MIN", new a(0)), /** The unix epoch */
412
- s(a, "ZERO", new a(0)), /** A zod schema for validating timestamps */
413
- s(a, "z", l.union([
414
- l.object({ value: l.bigint() }).transform((t) => new a(t.value)),
415
- l.string().transform((t) => new a(BigInt(t))),
416
- l.instanceof(Number).transform((t) => new a(t)),
417
- l.number().transform((t) => new a(t)),
418
- l.instanceof(a)
409
+ s(i, "NANOSECOND", i.nanoseconds(1)), /** One microsecond after the unix epoch */
410
+ s(i, "MICROSECOND", i.microseconds(1)), /** One millisecond after the unix epoch */
411
+ s(i, "MILLISECOND", i.milliseconds(1)), /** One second after the unix epoch */
412
+ s(i, "SECOND", i.seconds(1)), /** One minute after the unix epoch */
413
+ s(i, "MINUTE", i.minutes(1)), /** One hour after the unix epoch */
414
+ s(i, "HOUR", i.hours(1)), /** One day after the unix epoch */
415
+ s(i, "DAY", i.days(1)), /** The maximum possible value for a timestamp */
416
+ s(i, "MAX", new i((1n << 63n) - 1n)), /** The minimum possible value for a timestamp */
417
+ s(i, "MIN", new i(0)), /** The unix epoch */
418
+ s(i, "ZERO", new i(0)), /** A zod schema for validating timestamps */
419
+ s(i, "z", l.union([
420
+ l.object({ value: l.bigint() }).transform((t) => new i(t.value)),
421
+ l.string().transform((t) => new i(BigInt(t))),
422
+ l.instanceof(Number).transform((t) => new i(t)),
423
+ l.number().transform((t) => new i(t)),
424
+ l.instanceof(i)
419
425
  ]));
420
- let m = a;
426
+ let m = i;
421
427
  const u = class u {
422
428
  constructor(t) {
423
429
  s(this, "value");
@@ -457,9 +463,9 @@ const u = class u {
457
463
  );
458
464
  }
459
465
  toString() {
460
- const t = this.truncate(u.DAY), e = this.truncate(u.HOUR), r = this.truncate(u.MINUTE), i = this.truncate(u.SECOND), h = this.truncate(u.MILLISECOND), c = this.truncate(u.MICROSECOND), p = this.truncate(u.NANOSECOND), O = t, N = e.sub(t), A = r.sub(e), f = i.sub(r), B = h.sub(i), S = c.sub(h), k = p.sub(c);
466
+ const t = this.truncate(u.DAY), e = this.truncate(u.HOUR), r = this.truncate(u.MINUTE), a = this.truncate(u.SECOND), c = this.truncate(u.MILLISECOND), h = this.truncate(u.MICROSECOND), v = this.truncate(u.NANOSECOND), O = t, T = e.sub(t), A = r.sub(e), f = a.sub(r), B = c.sub(a), S = h.sub(c), Z = v.sub(h);
461
467
  let E = "";
462
- return O.isZero || (E += `${O.days}d `), N.isZero || (E += `${N.hours}h `), A.isZero || (E += `${A.minutes}m `), f.isZero || (E += `${f.seconds}s `), B.isZero || (E += `${B.milliseconds}ms `), S.isZero || (E += `${S.microseconds}µs `), k.isZero || (E += `${k.nanoseconds}ns`), E.trim();
468
+ return O.isZero || (E += `${O.days}d `), T.isZero || (E += `${T.hours}h `), A.isZero || (E += `${A.minutes}m `), f.isZero || (E += `${f.seconds}s `), B.isZero || (E += `${B.milliseconds}ms `), S.isZero || (E += `${S.microseconds}µs `), Z.isZero || (E += `${Z.nanoseconds}ns`), E.trim();
463
469
  }
464
470
  mult(t) {
465
471
  return new u(this.valueOf() * BigInt(t));
@@ -604,8 +610,8 @@ s(u, "z", l.union([
604
610
  l.number().transform((t) => new u(t)),
605
611
  l.instanceof(u)
606
612
  ]));
607
- let y = u;
608
- const v = class v extends Number {
613
+ let w = u;
614
+ const p = class p extends Number {
609
615
  constructor(t) {
610
616
  t instanceof Number ? super(t.valueOf()) : super(t);
611
617
  }
@@ -615,7 +621,7 @@ const v = class v extends Number {
615
621
  }
616
622
  /** @returns The number of seconds in the Rate. */
617
623
  equals(t) {
618
- return this.valueOf() === new v(t).valueOf();
624
+ return this.valueOf() === new p(t).valueOf();
619
625
  }
620
626
  /**
621
627
  * Calculates the period of the Rate as a TimeSpan.
@@ -623,7 +629,7 @@ const v = class v extends Number {
623
629
  * @returns A TimeSpan representing the period of the Rate.
624
630
  */
625
631
  get period() {
626
- return y.seconds(1 / this.valueOf());
632
+ return w.seconds(1 / this.valueOf());
627
633
  }
628
634
  /**
629
635
  * Calculates the number of samples in the given TimeSpan at this rate.
@@ -632,7 +638,7 @@ const v = class v extends Number {
632
638
  * @returns The number of samples in the given TimeSpan at this rate.
633
639
  */
634
640
  sampleCount(t) {
635
- return new y(t).seconds * this.valueOf();
641
+ return new w(t).seconds * this.valueOf();
636
642
  }
637
643
  /**
638
644
  * Calculates the number of bytes in the given TimeSpan at this rate.
@@ -642,7 +648,7 @@ const v = class v extends Number {
642
648
  * @returns The number of bytes in the given TimeSpan at this rate.
643
649
  */
644
650
  byteCount(t, e) {
645
- return this.sampleCount(t) * new b(e).valueOf();
651
+ return this.sampleCount(t) * new y(e).valueOf();
646
652
  }
647
653
  /**
648
654
  * Calculates a TimeSpan given the number of samples at this rate.
@@ -651,7 +657,7 @@ const v = class v extends Number {
651
657
  * @returns A TimeSpan that corresponds to the given number of samples.
652
658
  */
653
659
  span(t) {
654
- return y.seconds(t / this.valueOf());
660
+ return w.seconds(t / this.valueOf());
655
661
  }
656
662
  /**
657
663
  * Calculates a TimeSpan given the number of bytes at this rate.
@@ -670,7 +676,7 @@ const v = class v extends Number {
670
676
  * @returns A Rate representing the given number of Hz.
671
677
  */
672
678
  static hz(t) {
673
- return new v(t);
679
+ return new p(t);
674
680
  }
675
681
  /**
676
682
  * Creates a Rate representing the given number of kHz.
@@ -679,17 +685,17 @@ const v = class v extends Number {
679
685
  * @returns A Rate representing the given number of kHz.
680
686
  */
681
687
  static khz(t) {
682
- return v.hz(t * 1e3);
688
+ return p.hz(t * 1e3);
683
689
  }
684
690
  };
685
691
  /** A zod schema for validating and transforming rates */
686
- s(v, "z", l.union([
687
- l.number().transform((t) => new v(t)),
688
- l.instanceof(Number).transform((t) => new v(t)),
689
- l.instanceof(v)
692
+ s(p, "z", l.union([
693
+ l.number().transform((t) => new p(t)),
694
+ l.instanceof(Number).transform((t) => new p(t)),
695
+ l.instanceof(p)
690
696
  ]));
691
- let $ = v;
692
- const w = class w extends Number {
697
+ let $ = p;
698
+ const b = class b extends Number {
693
699
  /**
694
700
  * Creates a Density representing the given number of bytes per value.
695
701
  *
@@ -704,23 +710,23 @@ const w = class w extends Number {
704
710
  return t.valueOf() / this.valueOf();
705
711
  }
706
712
  size(t) {
707
- return new x(t * this.valueOf());
713
+ return new C(t * this.valueOf());
708
714
  }
709
715
  };
710
716
  /** Unknown/Invalid Density. */
711
- s(w, "UNKNOWN", new w(0)), /** 128 bits per value. */
712
- s(w, "BIT128", new w(16)), /** 64 bits per value. */
713
- s(w, "BIT64", new w(8)), /** 32 bits per value. */
714
- s(w, "BIT32", new w(4)), /** 16 bits per value. */
715
- s(w, "BIT16", new w(2)), /** 8 bits per value. */
716
- s(w, "BIT8", new w(1)), /** A zod schema for validating and transforming densities */
717
- s(w, "z", l.union([
718
- l.number().transform((t) => new w(t)),
719
- l.instanceof(Number).transform((t) => new w(t)),
720
- l.instanceof(w)
717
+ s(b, "UNKNOWN", new b(0)), /** 128 bits per value. */
718
+ s(b, "BIT128", new b(16)), /** 64 bits per value. */
719
+ s(b, "BIT64", new b(8)), /** 32 bits per value. */
720
+ s(b, "BIT32", new b(4)), /** 16 bits per value. */
721
+ s(b, "BIT16", new b(2)), /** 8 bits per value. */
722
+ s(b, "BIT8", new b(1)), /** A zod schema for validating and transforming densities */
723
+ s(b, "z", l.union([
724
+ l.number().transform((t) => new b(t)),
725
+ l.instanceof(Number).transform((t) => new b(t)),
726
+ l.instanceof(b)
721
727
  ]));
722
- let b = w;
723
- const T = class T {
728
+ let y = b;
729
+ const N = class N {
724
730
  /**
725
731
  * Creates a TimeRange from the given start and end TimeStamps.
726
732
  *
@@ -750,7 +756,7 @@ const T = class T {
750
756
  }
751
757
  /** @returns The TimeSpan occupied by the TimeRange. */
752
758
  get span() {
753
- return new y(this.end.valueOf() - this.start.valueOf());
759
+ return new w(this.end.valueOf() - this.start.valueOf());
754
760
  }
755
761
  /**
756
762
  * Checks if the timestamp is valid i.e. the start is before the end.
@@ -788,7 +794,7 @@ const T = class T {
788
794
  * @returns A TimeRange with the start and end swapped.
789
795
  */
790
796
  swap() {
791
- return new T(this.end, this.start);
797
+ return new N(this.end, this.start);
792
798
  }
793
799
  /**
794
800
  * Checks if the TimeRange is equal to the given TimeRange.
@@ -813,35 +819,35 @@ const T = class T {
813
819
  * @param other - The other TimeRange to compare to.
814
820
  * @returns True if the two TimeRanges overlap, false otherwise.
815
821
  */
816
- overlapsWith(t, e = y.ZERO) {
822
+ overlapsWith(t, e = w.ZERO) {
817
823
  t = t.makeValid();
818
824
  const r = this.makeValid();
819
825
  if (this.equals(t)) return !0;
820
826
  if (t.end.equals(r.start) || r.end.equals(t.start)) return !1;
821
- const i = m.max(r.start, t.start), h = m.min(r.end, t.end);
822
- return h.before(i) ? !1 : new y(h.sub(i)).greaterThanOrEqual(e);
827
+ const a = m.max(r.start, t.start), c = m.min(r.end, t.end);
828
+ return c.before(a) ? !1 : new w(c.sub(a)).greaterThanOrEqual(e);
823
829
  }
824
830
  roughlyEquals(t, e) {
825
- let r = this.start.sub(t.start).valueOf(), i = this.end.sub(t.end).valueOf();
826
- return r < 0 && (r = -r), i < 0 && (i = -i), r <= e.valueOf() && i <= e.valueOf();
831
+ let r = this.start.sub(t.start).valueOf(), a = this.end.sub(t.end).valueOf();
832
+ return r < 0 && (r = -r), a < 0 && (a = -a), r <= e.valueOf() && a <= e.valueOf();
827
833
  }
828
834
  contains(t) {
829
- return t instanceof T ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
835
+ return t instanceof N ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
830
836
  }
831
837
  boundBy(t) {
832
- const e = new T(this.start, this.end);
838
+ const e = new N(this.start, this.end);
833
839
  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;
834
840
  }
835
841
  };
836
842
  /** The maximum possible time range. */
837
- s(T, "MAX", new T(m.MIN, m.MAX)), /** The minimum possible time range. */
838
- s(T, "MIN", new T(m.MAX, m.MIN)), /** A zero time range. */
839
- s(T, "ZERO", new T(m.ZERO, m.ZERO)), /** A zod schema for validating and transforming time ranges */
840
- s(T, "z", l.union([
841
- l.object({ start: m.z, end: m.z }).transform((t) => new T(t.start, t.end)),
842
- l.instanceof(T)
843
+ s(N, "MAX", new N(m.MIN, m.MAX)), /** The minimum possible time range. */
844
+ s(N, "MIN", new N(m.MAX, m.MIN)), /** A zero time range. */
845
+ s(N, "ZERO", new N(m.ZERO, m.ZERO)), /** A zod schema for validating and transforming time ranges */
846
+ s(N, "z", l.union([
847
+ l.object({ start: m.z, end: m.z }).transform((t) => new N(t.start, t.end)),
848
+ l.instanceof(N)
843
849
  ]));
844
- let U = T;
850
+ let U = N;
845
851
  const xt = (o, t) => o.start.before(t.start) ? -1 : o.start.after(t.start) ? 1 : o.end.before(t.end) ? -1 : o.end.after(t.end) ? 1 : 0, n = class n extends String {
846
852
  constructor(t) {
847
853
  if (t instanceof n || typeof t == "string" || typeof t.valueOf() == "string") {
@@ -973,20 +979,20 @@ s(n, "JSON", new n("json")), s(n, "ARRAY_CONSTRUCTORS", /* @__PURE__ */ new Map(
973
979
  [Int32Array.name, n.INT32],
974
980
  [BigInt64Array.name, n.INT64]
975
981
  ])), s(n, "DENSITIES", /* @__PURE__ */ new Map([
976
- [n.UINT8.toString(), b.BIT8],
977
- [n.UINT16.toString(), b.BIT16],
978
- [n.UINT32.toString(), b.BIT32],
979
- [n.UINT64.toString(), b.BIT64],
980
- [n.FLOAT32.toString(), b.BIT32],
981
- [n.FLOAT64.toString(), b.BIT64],
982
- [n.INT8.toString(), b.BIT8],
983
- [n.INT16.toString(), b.BIT16],
984
- [n.INT32.toString(), b.BIT32],
985
- [n.INT64.toString(), b.BIT64],
986
- [n.TIMESTAMP.toString(), b.BIT64],
987
- [n.STRING.toString(), b.UNKNOWN],
988
- [n.JSON.toString(), b.UNKNOWN],
989
- [n.UUID.toString(), b.BIT128]
982
+ [n.UINT8.toString(), y.BIT8],
983
+ [n.UINT16.toString(), y.BIT16],
984
+ [n.UINT32.toString(), y.BIT32],
985
+ [n.UINT64.toString(), y.BIT64],
986
+ [n.FLOAT32.toString(), y.BIT32],
987
+ [n.FLOAT64.toString(), y.BIT64],
988
+ [n.INT8.toString(), y.BIT8],
989
+ [n.INT16.toString(), y.BIT16],
990
+ [n.INT32.toString(), y.BIT32],
991
+ [n.INT64.toString(), y.BIT64],
992
+ [n.TIMESTAMP.toString(), y.BIT64],
993
+ [n.STRING.toString(), y.UNKNOWN],
994
+ [n.JSON.toString(), y.UNKNOWN],
995
+ [n.UUID.toString(), y.BIT128]
990
996
  ])), /** All the data types. */
991
997
  s(n, "ALL", [
992
998
  n.UNKNOWN,
@@ -1047,9 +1053,9 @@ const d = class d extends Number {
1047
1053
  return this.valueOf() / d.TERABYTE.valueOf();
1048
1054
  }
1049
1055
  toString() {
1050
- const t = this.truncate(d.TERABYTE), e = this.truncate(d.GIGABYTE), r = this.truncate(d.MEGABYTE), i = this.truncate(d.KILOBYTE), h = this.truncate(d.BYTE), c = t, p = e.sub(t), O = r.sub(e), N = i.sub(r), A = h.sub(i);
1056
+ const t = this.truncate(d.TERABYTE), e = this.truncate(d.GIGABYTE), r = this.truncate(d.MEGABYTE), a = this.truncate(d.KILOBYTE), c = this.truncate(d.BYTE), h = t, v = e.sub(t), O = r.sub(e), T = a.sub(r), A = c.sub(a);
1051
1057
  let f = "";
1052
- return c.isZero || (f += `${c.terabytes}TB `), p.isZero || (f += `${p.gigabytes}GB `), O.isZero || (f += `${O.megabytes}MB `), N.isZero || (f += `${N.kilobytes}KB `), (!A.isZero || f === "") && (f += `${A.valueOf()}B`), f.trim();
1058
+ return h.isZero || (f += `${h.terabytes}TB `), v.isZero || (f += `${v.gigabytes}GB `), O.isZero || (f += `${O.megabytes}MB `), T.isZero || (f += `${T.kilobytes}KB `), (!A.isZero || f === "") && (f += `${A.valueOf()}B`), f.trim();
1053
1059
  }
1054
1060
  /**
1055
1061
  * Creates a Size from the given number of bytes.
@@ -1111,8 +1117,8 @@ s(d, "z", l.union([
1111
1117
  l.number().transform((t) => new d(t)),
1112
1118
  l.instanceof(d)
1113
1119
  ]));
1114
- let x = d;
1115
- const Ct = l.union([
1120
+ let C = d;
1121
+ const Lt = l.union([
1116
1122
  l.instanceof(Uint8Array),
1117
1123
  l.instanceof(Uint16Array),
1118
1124
  l.instanceof(Uint32Array),
@@ -1125,15 +1131,22 @@ const Ct = l.union([
1125
1131
  l.instanceof(BigInt64Array)
1126
1132
  ]), tt = (o) => {
1127
1133
  const t = typeof o;
1128
- return t === "string" || t === "number" || t === "boolean" || t === "bigint" || o instanceof m || o instanceof y || o instanceof Date;
1129
- }, ht = (o, t, e, r = 0) => o.usesBigInt && !t.usesBigInt ? Number(e) - Number(r) : !o.usesBigInt && t.usesBigInt ? BigInt(e.valueOf()) - BigInt(r.valueOf()) : C(e, -r).valueOf(), C = (o, t) => typeof o == "bigint" && typeof t == "bigint" || typeof o == "number" && typeof t == "number" ? o + t : t === 0 ? o : o === 0 ? t : Number(o) + Number(t), ct = (o) => o == null ? !1 : Array.isArray(o) || o instanceof ArrayBuffer || ArrayBuffer.isView(o) && !(o instanceof DataView) || o instanceof Z ? !0 : tt(o), M = -1, F = {
1134
+ return t === "string" || t === "number" || t === "boolean" || t === "bigint" || o instanceof m || o instanceof w || o instanceof Date;
1135
+ }, ht = (o, t, e, r = 0) => o.usesBigInt && !t.usesBigInt ? Number(e) - Number(r) : !o.usesBigInt && t.usesBigInt ? BigInt(e.valueOf()) - BigInt(r.valueOf()) : x(e, -r).valueOf(), x = (o, t) => typeof o == "bigint" && typeof t == "bigint" || typeof o == "number" && typeof t == "number" ? o + t : t === 0 ? o : o === 0 ? t : Number(o) + Number(t), dt = (o) => o == null ? !1 : Array.isArray(o) || o instanceof ArrayBuffer || ArrayBuffer.isView(o) && !(o instanceof DataView) || o instanceof k ? !0 : tt(o), M = -1, F = {
1130
1136
  [Symbol.iterator]: () => F,
1131
1137
  next: () => ({ done: !0, value: void 0 })
1132
- }, dt = l.string().transform(
1138
+ }, gt = l.string().transform(
1133
1139
  (o) => new Uint8Array(
1134
1140
  atob(o).split("").map((t) => t.charCodeAt(0))
1135
1141
  ).buffer
1136
- ), gt = l.union([l.null(), l.undefined()]).transform(() => new Uint8Array().buffer), Y = 10, I = class I {
1142
+ ), mt = l.union([l.null(), l.undefined()]).transform(() => new Uint8Array().buffer), Y = 10, et = (o, t) => {
1143
+ if (o === "string" && !t.isVariable)
1144
+ throw new Error(`cannot convert series of type ${t.toString()} to string`);
1145
+ if (o === "number" && !t.isNumeric)
1146
+ throw new Error(`cannot convert series of type ${t.toString()} to number`);
1147
+ if (o === "bigint" && !t.usesBigInt)
1148
+ throw new Error(`cannot convert series of type ${t.toString()} to bigint`);
1149
+ }, I = class I {
1137
1150
  constructor(t) {
1138
1151
  s(this, "key", "");
1139
1152
  s(this, "isSynnaxSeries", !0);
@@ -1165,30 +1178,30 @@ const Ct = l.union([
1165
1178
  s(this, "_cachedLength");
1166
1179
  /** Caches the indexes of the array for variable length data types. */
1167
1180
  s(this, "_cachedIndexes");
1168
- ct(t) && (t = { data: t });
1181
+ dt(t) && (t = { data: t });
1169
1182
  const {
1170
1183
  dataType: e,
1171
1184
  timeRange: r,
1172
- sampleOffset: i = 0,
1173
- glBufferUsage: h = "static",
1174
- alignment: c = 0n,
1175
- key: p = Q()
1185
+ sampleOffset: a = 0,
1186
+ glBufferUsage: c = "static",
1187
+ alignment: h = 0n,
1188
+ key: v = Q()
1176
1189
  } = t, O = t.data ?? [];
1177
1190
  if (O instanceof I || typeof O == "object" && "isSynnaxSeries" in O && O.isSynnaxSeries === !0) {
1178
1191
  const f = O;
1179
1192
  this.key = f.key, this.dataType = f.dataType, this.sampleOffset = f.sampleOffset, this.gl = f.gl, this._data = f._data, this._timeRange = f._timeRange, this.alignment = f.alignment, this._cachedMin = f._cachedMin, this._cachedMax = f._cachedMax, this.writePos = f.writePos, this._refCount = f._refCount, this._cachedLength = f._cachedLength;
1180
1193
  return;
1181
1194
  }
1182
- const N = tt(O), A = Array.isArray(O);
1195
+ const T = tt(O), A = Array.isArray(O);
1183
1196
  if (e != null) this.dataType = new g(e);
1184
1197
  else {
1185
1198
  if (O instanceof ArrayBuffer)
1186
1199
  throw new Error(
1187
1200
  "cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type."
1188
1201
  );
1189
- if (A || N) {
1202
+ if (A || T) {
1190
1203
  let f = O;
1191
- if (!N) {
1204
+ if (!T) {
1192
1205
  if (O.length === 0)
1193
1206
  throw new Error(
1194
1207
  "cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type."
@@ -1208,11 +1221,11 @@ const Ct = l.union([
1208
1221
  );
1209
1222
  } else this.dataType = new g(O);
1210
1223
  }
1211
- if (!A && !N) this._data = O;
1224
+ if (!A && !T) this._data = O;
1212
1225
  else {
1213
- let f = N ? [O] : O;
1226
+ let f = T ? [O] : O;
1214
1227
  const B = f[0];
1215
- (B instanceof m || B instanceof Date || B instanceof y) && (f = f.map((S) => new m(S).valueOf())), this.dataType.equals(g.STRING) ? (this._cachedLength = f.length, this._data = new TextEncoder().encode(`${f.join(`
1228
+ (B instanceof m || B instanceof Date || B instanceof w) && (f = f.map((S) => new m(S).valueOf())), this.dataType.equals(g.STRING) ? (this._cachedLength = f.length, this._data = new TextEncoder().encode(`${f.join(`
1216
1229
  `)}
1217
1230
  `).buffer) : this.dataType.equals(g.JSON) ? (this._cachedLength = f.length, this._data = new TextEncoder().encode(
1218
1231
  `${f.map((S) => q.encodeString(S)).join(`
@@ -1224,28 +1237,28 @@ const Ct = l.union([
1224
1237
  f.map((S) => Number(S))
1225
1238
  ).buffer : this._data = new this.dataType.Array(f).buffer;
1226
1239
  }
1227
- this.key = p, this.alignment = c, this.sampleOffset = i ?? 0, this._timeRange = r, this.gl = {
1240
+ this.key = v, this.alignment = h, this.sampleOffset = a ?? 0, this._timeRange = r, this.gl = {
1228
1241
  control: null,
1229
1242
  buffer: null,
1230
1243
  prevBuffer: 0,
1231
- bufferUsage: h
1244
+ bufferUsage: c
1232
1245
  };
1233
1246
  }
1234
1247
  static alloc({ capacity: t, dataType: e, ...r }) {
1235
1248
  if (t === 0)
1236
1249
  throw new Error("[Series] - cannot allocate an array of length 0");
1237
- const i = new new g(e).Array(t), h = new I({
1238
- data: i.buffer,
1250
+ const a = new new g(e).Array(t), c = new I({
1251
+ data: a.buffer,
1239
1252
  dataType: e,
1240
1253
  ...r
1241
1254
  });
1242
- return h.writePos = 0, h;
1255
+ return c.writePos = 0, c;
1243
1256
  }
1244
1257
  static createTimestamps(t, e, r) {
1245
- const i = r.spanRange(e.span(t)), h = new BigInt64Array(t);
1246
- for (let c = 0; c < t; c++)
1247
- h[c] = BigInt(r.add(e.span(c)).valueOf());
1248
- return new I({ data: h, dataType: g.TIMESTAMP, timeRange: i });
1258
+ const a = r.spanRange(e.span(t)), c = new BigInt64Array(t);
1259
+ for (let h = 0; h < t; h++)
1260
+ c[h] = BigInt(r.add(e.span(h)).valueOf());
1261
+ return new I({ data: c, dataType: g.TIMESTAMP, timeRange: a });
1249
1262
  }
1250
1263
  get refCount() {
1251
1264
  return this._refCount;
@@ -1260,7 +1273,7 @@ const Ct = l.union([
1260
1273
  }
1261
1274
  static fromJSON(t, e) {
1262
1275
  const r = new TextEncoder().encode(
1263
- `${t.map((i) => q.encodeString(i)).join(`
1276
+ `${t.map((a) => q.encodeString(a)).join(`
1264
1277
  `)}
1265
1278
  `
1266
1279
  );
@@ -1326,11 +1339,11 @@ const Ct = l.union([
1326
1339
  throw new Error("cannot convert non-uuid series to uuids");
1327
1340
  const t = g.UUID.density.valueOf(), e = Array(this.length);
1328
1341
  for (let r = 0; r < this.length; r++) {
1329
- const i = this.underlyingData.slice(r * t, (r + 1) * t), h = Array.from(
1330
- new Uint8Array(i.buffer),
1331
- (c) => c.toString(16).padStart(2, "0")
1342
+ const a = this.underlyingData.slice(r * t, (r + 1) * t), c = Array.from(
1343
+ new Uint8Array(a.buffer),
1344
+ (h) => h.toString(16).padStart(2, "0")
1332
1345
  ).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5");
1333
- e[r] = h;
1346
+ e[r] = c;
1334
1347
  }
1335
1348
  return e;
1336
1349
  }
@@ -1347,7 +1360,7 @@ const Ct = l.union([
1347
1360
  }
1348
1361
  /** @returns the capacity of the series in bytes. */
1349
1362
  get byteCapacity() {
1350
- return new x(this.underlyingData.byteLength);
1363
+ return new C(this.underlyingData.byteLength);
1351
1364
  }
1352
1365
  /** @returns the capacity of the series in samples. */
1353
1366
  get capacity() {
@@ -1355,7 +1368,7 @@ const Ct = l.union([
1355
1368
  }
1356
1369
  /** @returns the length of the series in bytes. */
1357
1370
  get byteLength() {
1358
- return this.writePos === M ? this.byteCapacity : this.dataType.isVariable ? new x(this.writePos) : this.dataType.density.size(this.writePos);
1371
+ return this.writePos === M ? this.byteCapacity : this.dataType.isVariable ? new C(this.writePos) : this.dataType.density.size(this.writePos);
1359
1372
  }
1360
1373
  /** @returns the number of samples in this array. */
1361
1374
  get length() {
@@ -1366,8 +1379,8 @@ const Ct = l.union([
1366
1379
  throw new Error("cannot calculate length of a non-variable length data type");
1367
1380
  let t = 0;
1368
1381
  const e = [0];
1369
- return this.data.forEach((r, i) => {
1370
- r === Y && (t++, e.push(i + 1));
1382
+ return this.data.forEach((r, a) => {
1383
+ r === Y && (t++, e.push(a + 1));
1371
1384
  }), this._cachedIndexes = e, this._cachedLength = t, t;
1372
1385
  }
1373
1386
  /**
@@ -1382,8 +1395,8 @@ const Ct = l.union([
1382
1395
  convert(t, e = 0) {
1383
1396
  if (this.dataType.equals(t)) return this;
1384
1397
  const r = new t.Array(this.length);
1385
- for (let i = 0; i < this.length; i++)
1386
- r[i] = ht(this.dataType, t, this.data[i], e);
1398
+ for (let a = 0; a < this.length; a++)
1399
+ r[a] = ht(this.dataType, t, this.data[a], e);
1387
1400
  return new I({
1388
1401
  data: r.buffer,
1389
1402
  dataType: t,
@@ -1410,7 +1423,7 @@ const Ct = l.union([
1410
1423
  get max() {
1411
1424
  if (this.dataType.isVariable)
1412
1425
  throw new Error("cannot calculate maximum on a variable length data type");
1413
- return this.writePos === 0 ? -1 / 0 : (this._cachedMax ?? (this._cachedMax = this.calcRawMax()), C(this._cachedMax, this.sampleOffset));
1426
+ return this.writePos === 0 ? -1 / 0 : (this._cachedMax ?? (this._cachedMax = this.calcRawMax()), x(this._cachedMax, this.sampleOffset));
1414
1427
  }
1415
1428
  calcRawMin() {
1416
1429
  if (this.length === 0) return 1 / 0;
@@ -1428,7 +1441,7 @@ const Ct = l.union([
1428
1441
  get min() {
1429
1442
  if (this.dataType.isVariable)
1430
1443
  throw new Error("cannot calculate minimum on a variable length data type");
1431
- return this.writePos === 0 ? 1 / 0 : (this._cachedMin ?? (this._cachedMin = this.calcRawMin()), C(this._cachedMin, this.sampleOffset));
1444
+ return this.writePos === 0 ? 1 / 0 : (this._cachedMin ?? (this._cachedMin = this.calcRawMin()), x(this._cachedMin, this.sampleOffset));
1432
1445
  }
1433
1446
  /** @returns the bounds of this array. */
1434
1447
  get bounds() {
@@ -1448,7 +1461,7 @@ const Ct = l.union([
1448
1461
  this.max, this.min;
1449
1462
  }
1450
1463
  get range() {
1451
- return C(this.max, -this.min);
1464
+ return x(this.max, -this.min);
1452
1465
  }
1453
1466
  atAlignment(t, e) {
1454
1467
  const r = Number(t - this.alignment);
@@ -1466,29 +1479,29 @@ const Ct = l.union([
1466
1479
  if (e === !0) throw new Error(`[series] - no value at index ${t}`);
1467
1480
  return;
1468
1481
  }
1469
- return C(r, this.sampleOffset);
1482
+ return x(r, this.sampleOffset);
1470
1483
  }
1471
1484
  atVariable(t, e) {
1472
- let r = 0, i = 0;
1485
+ let r = 0, a = 0;
1473
1486
  if (this._cachedIndexes != null)
1474
- r = this._cachedIndexes[t], i = this._cachedIndexes[t + 1] - 1;
1487
+ r = this._cachedIndexes[t], a = this._cachedIndexes[t + 1] - 1;
1475
1488
  else {
1476
1489
  t < 0 && (t = this.length + t);
1477
- for (let c = 0; c < this.data.length; c++)
1478
- if (this.data[c] === Y) {
1490
+ for (let h = 0; h < this.data.length; h++)
1491
+ if (this.data[h] === Y) {
1479
1492
  if (t === 0) {
1480
- i = c;
1493
+ a = h;
1481
1494
  break;
1482
1495
  }
1483
- r = c + 1, t--;
1496
+ r = h + 1, t--;
1484
1497
  }
1485
- if (i === 0 && (i = this.data.length), r >= i || t > 0) {
1498
+ if (a === 0 && (a = this.data.length), r >= a || t > 0) {
1486
1499
  if (e) throw new Error(`[series] - no value at index ${t}`);
1487
1500
  return;
1488
1501
  }
1489
1502
  }
1490
- const h = this.data.slice(r, i);
1491
- return this.dataType.equals(g.STRING) ? new TextDecoder().decode(h) : nt(JSON.parse(new TextDecoder().decode(h)));
1503
+ const c = this.data.slice(r, a);
1504
+ return this.dataType.equals(g.STRING) ? new TextDecoder().decode(c) : st(JSON.parse(new TextDecoder().decode(c)));
1492
1505
  }
1493
1506
  /**
1494
1507
  * @returns the index of the first sample that is greater than or equal to the given value.
@@ -1497,23 +1510,23 @@ const Ct = l.union([
1497
1510
  */
1498
1511
  binarySearch(t) {
1499
1512
  let e = 0, r = this.length - 1;
1500
- const i = st(t);
1513
+ const a = it(t);
1501
1514
  for (; e <= r; ) {
1502
- const h = Math.floor((e + r) / 2), c = i(this.at(h, !0), t);
1503
- if (c === 0) return h;
1504
- c < 0 ? e = h + 1 : r = h - 1;
1515
+ const c = Math.floor((e + r) / 2), h = a(this.at(c, !0), t);
1516
+ if (h === 0) return c;
1517
+ h < 0 ? e = c + 1 : r = c - 1;
1505
1518
  }
1506
1519
  return e;
1507
1520
  }
1508
1521
  updateGLBuffer(t) {
1509
1522
  if (this.gl.control = t, !this.dataType.equals(g.FLOAT32) && !this.dataType.equals(g.UINT8))
1510
1523
  throw new Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
1511
- const { buffer: e, bufferUsage: r, prevBuffer: i } = this.gl;
1512
- if (e == null && (this.gl.buffer = t.createBuffer()), this.writePos !== i)
1524
+ const { buffer: e, bufferUsage: r, prevBuffer: a } = this.gl;
1525
+ if (e == null && (this.gl.buffer = t.createBuffer()), this.writePos !== a)
1513
1526
  if (t.bindBuffer(t.ARRAY_BUFFER, this.gl.buffer), this.writePos !== M) {
1514
- i === 0 && t.bufferData(t.ARRAY_BUFFER, this.byteCapacity.valueOf(), t.STATIC_DRAW);
1515
- const h = this.dataType.density.size(i).valueOf(), c = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
1516
- t.bufferSubData(t.ARRAY_BUFFER, h, c.buffer), this.gl.prevBuffer = this.writePos;
1527
+ a === 0 && t.bufferData(t.ARRAY_BUFFER, this.byteCapacity.valueOf(), t.STATIC_DRAW);
1528
+ const c = this.dataType.density.size(a).valueOf(), h = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
1529
+ t.bufferSubData(t.ARRAY_BUFFER, c, h.buffer), this.gl.prevBuffer = this.writePos;
1517
1530
  } else
1518
1531
  t.bufferData(
1519
1532
  t.ARRAY_BUFFER,
@@ -1522,28 +1535,7 @@ const Ct = l.union([
1522
1535
  ), this.gl.prevBuffer = M;
1523
1536
  }
1524
1537
  as(t) {
1525
- if (t === "string") {
1526
- if (!this.dataType.equals(g.STRING))
1527
- throw new Error(
1528
- `cannot convert series of type ${this.dataType.toString()} to string`
1529
- );
1530
- return this;
1531
- }
1532
- if (t === "number") {
1533
- if (!this.dataType.isNumeric)
1534
- throw new Error(
1535
- `cannot convert series of type ${this.dataType.toString()} to number`
1536
- );
1537
- return this;
1538
- }
1539
- if (t === "bigint") {
1540
- if (!this.dataType.equals(g.INT64))
1541
- throw new Error(
1542
- `cannot convert series of type ${this.dataType.toString()} to bigint`
1543
- );
1544
- return this;
1545
- }
1546
- throw new Error(`cannot convert series to ${t}`);
1538
+ return et(t, this.dataType), this;
1547
1539
  }
1548
1540
  get digest() {
1549
1541
  var t;
@@ -1580,10 +1572,10 @@ const Ct = l.union([
1580
1572
  }
1581
1573
  [Symbol.iterator]() {
1582
1574
  if (this.dataType.isVariable) {
1583
- const t = new mt(this);
1584
- return this.dataType.equals(g.JSON) ? new Ot(t) : t;
1575
+ const t = new Ot(this);
1576
+ return this.dataType.equals(g.JSON) ? new wt(t) : t;
1585
1577
  }
1586
- return new yt(this);
1578
+ return new bt(this);
1587
1579
  }
1588
1580
  slice(t, e) {
1589
1581
  return this.sliceSub(!1, t, e);
@@ -1592,10 +1584,10 @@ const Ct = l.union([
1592
1584
  return this.sliceSub(!0, t, e);
1593
1585
  }
1594
1586
  subIterator(t, e) {
1595
- return new V(this, t, e ?? this.length);
1587
+ return new G(this, t, e ?? this.length);
1596
1588
  }
1597
1589
  subAlignmentIterator(t, e) {
1598
- return new V(
1590
+ return new G(
1599
1591
  this,
1600
1592
  Number(t - this.alignment),
1601
1593
  Number(e - this.alignment)
@@ -1615,9 +1607,9 @@ const Ct = l.union([
1615
1607
  }
1616
1608
  sliceSub(t, e, r) {
1617
1609
  if (e <= 0 && (r == null || r >= this.length)) return this;
1618
- let i;
1619
- return t ? i = this.data.subarray(e, r) : i = this.data.slice(e, r), new I({
1620
- data: i,
1610
+ let a;
1611
+ return t ? a = this.data.subarray(e, r) : a = this.data.slice(e, r), new I({
1612
+ data: a,
1621
1613
  dataType: this.dataType,
1622
1614
  timeRange: this._timeRange,
1623
1615
  sampleOffset: this.sampleOffset,
@@ -1641,22 +1633,22 @@ s(I, "crudeZ", l.object({
1641
1633
  dataType: g.z,
1642
1634
  alignment: l.coerce.bigint().optional(),
1643
1635
  data: l.union([
1644
- dt,
1645
1636
  gt,
1637
+ mt,
1646
1638
  l.instanceof(ArrayBuffer),
1647
1639
  l.instanceof(Uint8Array)
1648
1640
  ]),
1649
- glBufferUsage: ft.optional().default("static").optional()
1641
+ glBufferUsage: ct.optional().default("static").optional()
1650
1642
  })), s(I, "z", I.crudeZ.transform((t) => new I(t)));
1651
- let Z = I;
1652
- class V {
1643
+ let k = I;
1644
+ class G {
1653
1645
  constructor(t, e, r) {
1654
1646
  s(this, "series");
1655
1647
  s(this, "end");
1656
1648
  s(this, "index");
1657
1649
  this.series = t;
1658
- const i = L(0, t.length);
1659
- this.end = G(i, r), this.index = G(i, e);
1650
+ const a = L(0, t.length);
1651
+ this.end = V(a, r), this.index = V(a, e);
1660
1652
  }
1661
1653
  next() {
1662
1654
  return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
@@ -1665,7 +1657,7 @@ class V {
1665
1657
  return this;
1666
1658
  }
1667
1659
  }
1668
- class mt {
1660
+ class Ot {
1669
1661
  constructor(t) {
1670
1662
  s(this, "series");
1671
1663
  s(this, "index");
@@ -1687,7 +1679,7 @@ class mt {
1687
1679
  }
1688
1680
  }
1689
1681
  var W, j;
1690
- class Ot {
1682
+ class wt {
1691
1683
  constructor(t) {
1692
1684
  s(this, "wrapped");
1693
1685
  s(this, W, "JSONSeriesIterator");
@@ -1705,7 +1697,7 @@ class Ot {
1705
1697
  }
1706
1698
  }
1707
1699
  var H, K;
1708
- class yt {
1700
+ class bt {
1709
1701
  constructor(t) {
1710
1702
  s(this, "series");
1711
1703
  s(this, "index");
@@ -1722,7 +1714,7 @@ class yt {
1722
1714
  return this;
1723
1715
  }
1724
1716
  }
1725
- class Lt {
1717
+ class Dt {
1726
1718
  constructor(t) {
1727
1719
  s(this, "series");
1728
1720
  if (t.length !== 0) {
@@ -1734,11 +1726,7 @@ class Lt {
1734
1726
  this.series = t;
1735
1727
  }
1736
1728
  as(t) {
1737
- if (!new g(t).equals(this.dataType))
1738
- throw new Error(
1739
- `cannot convert series of type ${this.dataType.toString()} to ${t.toString()}`
1740
- );
1741
- return this;
1729
+ return et(t, this.dataType), this;
1742
1730
  }
1743
1731
  get dataType() {
1744
1732
  return this.series.length === 0 ? g.UNKNOWN : this.series[0].dataType;
@@ -1789,43 +1777,43 @@ class Lt {
1789
1777
  if (t >= this.alignmentBounds.upper || e <= this.alignmentBounds.lower)
1790
1778
  return F;
1791
1779
  let r = 0;
1792
- for (let h = 0; h < this.series.length; h++) {
1793
- const c = this.series[h];
1794
- if (t < c.alignment) break;
1795
- if (t >= c.alignmentBounds.upper) r += c.length;
1796
- else if (D(c.alignmentBounds, t)) {
1797
- r += Number(t - c.alignment);
1780
+ for (let c = 0; c < this.series.length; c++) {
1781
+ const h = this.series[c];
1782
+ if (t < h.alignment) break;
1783
+ if (t >= h.alignmentBounds.upper) r += h.length;
1784
+ else if (D(h.alignmentBounds, t)) {
1785
+ r += Number(t - h.alignment);
1798
1786
  break;
1799
1787
  }
1800
1788
  }
1801
- let i = 0;
1802
- for (let h = 0; h < this.series.length; h++) {
1803
- const c = this.series[h];
1804
- if (e < c.alignment) break;
1805
- if (e >= c.alignmentBounds.upper) i += c.length;
1806
- else if (D(c.alignmentBounds, e)) {
1807
- i += Number(e - c.alignment);
1789
+ let a = 0;
1790
+ for (let c = 0; c < this.series.length; c++) {
1791
+ const h = this.series[c];
1792
+ if (e < h.alignment) break;
1793
+ if (e >= h.alignmentBounds.upper) a += h.length;
1794
+ else if (D(h.alignmentBounds, e)) {
1795
+ a += Number(e - h.alignment);
1808
1796
  break;
1809
1797
  }
1810
1798
  }
1811
- return new P(this, r, i);
1799
+ return new P(this, r, a);
1812
1800
  }
1813
1801
  subAlignmentSpanIterator(t, e) {
1814
1802
  if (t >= this.alignmentBounds.upper) return F;
1815
1803
  let r = 0;
1816
- for (let i = 0; i < this.series.length; i++) {
1817
- const h = this.series[i];
1818
- if (t < h.alignment) break;
1819
- if (t >= h.alignmentBounds.upper) r += h.length;
1820
- else if (D(h.alignmentBounds, t)) {
1821
- r += Number(t - h.alignment);
1804
+ for (let a = 0; a < this.series.length; a++) {
1805
+ const c = this.series[a];
1806
+ if (t < c.alignment) break;
1807
+ if (t >= c.alignmentBounds.upper) r += c.length;
1808
+ else if (D(c.alignmentBounds, t)) {
1809
+ r += Number(t - c.alignment);
1822
1810
  break;
1823
1811
  }
1824
1812
  }
1825
1813
  return new P(this, r, r + e);
1826
1814
  }
1827
1815
  get byteLength() {
1828
- return new x(this.series.reduce((t, e) => t + e.byteLength.valueOf(), 0));
1816
+ return new C(this.series.reduce((t, e) => t + e.byteLength.valueOf(), 0));
1829
1817
  }
1830
1818
  get data() {
1831
1819
  const t = new this.dataType.Array(this.length);
@@ -1835,12 +1823,12 @@ class Lt {
1835
1823
  return new this.dataType.Array(t.buffer);
1836
1824
  }
1837
1825
  traverseAlignment(t, e) {
1838
- const r = this.series.map((i) => i.alignmentBounds);
1839
- return it(r, t, e);
1826
+ const r = this.series.map((a) => a.alignmentBounds);
1827
+ return at(r, t, e);
1840
1828
  }
1841
1829
  distance(t, e) {
1842
- const r = this.series.map((i) => i.alignmentBounds);
1843
- return at(r, t, e);
1830
+ const r = this.series.map((a) => a.alignmentBounds);
1831
+ return ut(r, t, e);
1844
1832
  }
1845
1833
  parseJSON(t) {
1846
1834
  if (!this.dataType.equals(g.JSON))
@@ -1852,11 +1840,11 @@ class Lt {
1852
1840
  next() {
1853
1841
  return { done: !0, value: void 0 };
1854
1842
  }
1855
- } : new wt(this.series);
1843
+ } : new yt(this.series);
1856
1844
  }
1857
1845
  }
1858
1846
  var z, X;
1859
- class wt {
1847
+ class yt {
1860
1848
  constructor(t) {
1861
1849
  s(this, "series");
1862
1850
  s(this, "seriesIndex");
@@ -1891,20 +1879,20 @@ const J = (o) => {
1891
1879
  return { domain: t, sample: e };
1892
1880
  };
1893
1881
  export {
1894
- b as D,
1895
- Lt as M,
1882
+ y as D,
1883
+ Dt as M,
1896
1884
  $ as R,
1897
- Z as S,
1885
+ k as S,
1898
1886
  m as T,
1899
- y as a,
1887
+ w as a,
1900
1888
  U as b,
1901
1889
  g as c,
1902
- x as d,
1890
+ C as d,
1903
1891
  tt as e,
1904
1892
  ht as f,
1905
- C as g,
1906
- Rt as h,
1907
- ct as i,
1893
+ x as g,
1894
+ Ct as h,
1895
+ dt as i,
1908
1896
  xt as s,
1909
- Ct as t
1897
+ Lt as t
1910
1898
  };