@synnaxlabs/x 0.32.0 → 0.34.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.
- package/.turbo/turbo-build.log +32 -32
- package/dist/binary.cjs +1 -1
- package/dist/binary.js +1 -1
- package/dist/bounds-CFI9wDXn.js +171 -0
- package/dist/bounds-DzCDHgdE.cjs +1 -0
- package/dist/bounds.cjs +1 -1
- package/dist/bounds.js +1 -1
- package/dist/box-DVCNGsJG.js +201 -0
- package/dist/box-Mf8E1Ypp.cjs +1 -0
- package/dist/box.cjs +1 -1
- package/dist/box.js +1 -1
- package/dist/caseconv.cjs +1 -1
- package/dist/caseconv.js +1 -1
- package/dist/compare.js +1 -1
- package/dist/deep.cjs +1 -1
- package/dist/deep.js +46 -48
- package/dist/{direction-DZbN47uL.cjs → direction-D7qoo_GJ.cjs} +1 -1
- package/dist/direction.cjs +1 -1
- package/dist/external-B3XSLDq5.cjs +1 -0
- package/dist/{external-CO221aaF.js → external-sVtvYJS6.js} +3 -3
- package/dist/{index-B5THJ1eb.js → index-BBa2mWG1.js} +1 -1
- package/dist/{index-DgaYJC35.cjs → index-CYxQwEdX.cjs} +1 -1
- package/dist/{index-B3BUDIdi.js → index-HQonyH7n.js} +1 -2
- package/dist/index-YsO0EMN8.cjs +1 -0
- package/dist/{index-Duv1uH08.js → index-eue4dSQX.js} +14 -10
- package/dist/index.cjs +2 -2
- package/dist/index.js +162 -145
- package/dist/{location-DjcaXEps.js → location-CI9x53qR.js} +8 -8
- package/dist/{location-gPB1RtfA.cjs → location-DetomF8Z.cjs} +1 -1
- package/dist/location.cjs +1 -1
- package/dist/location.js +1 -1
- package/dist/path-BBCx3K6k.cjs +1 -0
- package/dist/{path-B-1-i3qC.js → path-CmnoH3RC.js} +26 -26
- package/dist/{position-DkON65EZ.js → position-CFc9RsSn.js} +2 -2
- package/dist/{position-C71OiHiw.cjs → position-DKhPhvPh.cjs} +1 -1
- package/dist/position.cjs +1 -1
- package/dist/position.js +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +1 -1
- package/dist/{scale-COPgp55a.cjs → scale-CT61XD_X.cjs} +1 -1
- package/dist/{scale-qw6vRO4s.js → scale-DNQE1LMm.js} +25 -3
- package/dist/scale.cjs +1 -1
- package/dist/scale.js +1 -1
- package/dist/series-DWLXo7J6.cjs +11 -0
- package/dist/{series-B5eA90Ci.js → series-sjWkW8qe.js} +627 -466
- package/dist/spatial.cjs +1 -1
- package/dist/spatial.js +5 -5
- package/dist/src/binary/encoder.d.ts.map +1 -1
- package/dist/src/caseconv/caseconv.d.ts.map +1 -1
- package/dist/src/clamp/clamp.d.ts.map +1 -1
- package/dist/src/compare/compare.d.ts.map +1 -1
- package/dist/src/debounce/debounce.d.ts.map +1 -1
- package/dist/src/deep/difference.d.ts.map +1 -1
- package/dist/src/deep/merge.d.ts.map +1 -1
- package/dist/src/deep/path.d.ts +2 -2
- package/dist/src/deep/path.d.ts.map +1 -1
- package/dist/src/math/math.d.ts +26 -6
- package/dist/src/math/math.d.ts.map +1 -1
- package/dist/src/math/math.spec.d.ts +2 -0
- package/dist/src/math/math.spec.d.ts.map +1 -0
- package/dist/src/migrate/migrate.d.ts.map +1 -1
- package/dist/src/record.d.ts +4 -0
- package/dist/src/record.d.ts.map +1 -1
- package/dist/src/spatial/bounds/bounds.d.ts +208 -4
- package/dist/src/spatial/bounds/bounds.d.ts.map +1 -1
- package/dist/src/spatial/box/box.d.ts +4 -4
- package/dist/src/spatial/box/box.d.ts.map +1 -1
- package/dist/src/spatial/scale/scale.d.ts +177 -5
- package/dist/src/spatial/scale/scale.d.ts.map +1 -1
- package/dist/src/strings/strings.d.ts +14 -0
- package/dist/src/strings/strings.d.ts.map +1 -1
- package/dist/src/telem/generate.d.ts.map +1 -1
- package/dist/src/telem/series.d.ts +35 -10
- package/dist/src/telem/series.d.ts.map +1 -1
- package/dist/src/telem/telem.d.ts +12 -10
- package/dist/src/telem/telem.d.ts.map +1 -1
- package/dist/src/url/url.d.ts.map +1 -1
- package/dist/telem.cjs +1 -1
- package/dist/telem.js +1 -1
- package/dist/url.cjs +1 -1
- package/dist/url.js +1 -1
- package/dist/{zodutil-BWvwKcpb.cjs → zodutil-C6RYzvXd.cjs} +1 -1
- package/dist/{zodutil-qNM8aVYC.js → zodutil-Tmuc4CNq.js} +1 -1
- package/dist/zodutil.cjs +1 -1
- package/dist/zodutil.js +1 -1
- package/package.json +10 -9
- package/src/binary/encoder.ts +1 -2
- package/src/caseconv/caseconv.ts +8 -15
- package/src/clamp/clamp.ts +1 -1
- package/src/compare/compare.ts +1 -3
- package/src/debounce/debounce.ts +1 -2
- package/src/deep/difference.ts +3 -9
- package/src/deep/merge.ts +8 -15
- package/src/deep/path.spec.ts +1 -1
- package/src/deep/path.ts +4 -4
- package/src/math/math.spec.ts +149 -0
- package/src/math/math.ts +61 -10
- package/src/migrate/migrate.ts +4 -5
- package/src/record.ts +5 -0
- package/src/runtime/os.ts +2 -2
- package/src/spatial/bounds/bounds.spec.ts +135 -270
- package/src/spatial/bounds/bounds.ts +296 -29
- package/src/spatial/box/box.ts +13 -12
- package/src/spatial/direction/direction.ts +1 -1
- package/src/spatial/location/location.ts +5 -5
- package/src/spatial/scale/scale.ts +196 -12
- package/src/strings/strings.spec.ts +33 -1
- package/src/strings/strings.ts +52 -0
- package/src/telem/generate.ts +1 -3
- package/src/telem/series.spec.ts +235 -0
- package/src/telem/series.ts +310 -100
- package/src/telem/telem.spec.ts +27 -11
- package/src/telem/telem.ts +56 -36
- package/src/url/url.ts +9 -12
- package/src/zodutil/zodutil.spec.ts +5 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/bounds-CpboA0q6.js +0 -127
- package/dist/bounds-ZZc1c-_Z.cjs +0 -1
- package/dist/box-BQID-0jO.cjs +0 -1
- package/dist/box-xRqO6NvI.js +0 -202
- package/dist/external-B-DoBvh7.cjs +0 -1
- package/dist/index-xk130iQA.cjs +0 -1
- package/dist/path-577Fmn5N.cjs +0 -1
- package/dist/series-CJ65b1Uz.cjs +0 -11
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var s = (
|
|
1
|
+
var tt = Object.defineProperty;
|
|
2
|
+
var et = (l, t, e) => t in l ? tt(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
|
|
3
|
+
var s = (l, t, e) => et(l, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import { z as o } from "zod";
|
|
5
|
-
import { J as
|
|
6
|
-
import { s as
|
|
7
|
-
import { n as
|
|
8
|
-
import { c as
|
|
9
|
-
import "./box-
|
|
5
|
+
import { J as $ } from "./index-BBa2mWG1.js";
|
|
6
|
+
import { s as nt } from "./index-eue4dSQX.js";
|
|
7
|
+
import { n as rt } from "./index-HQonyH7n.js";
|
|
8
|
+
import { m as R, c as L, a as k, d as D, t as st, e as it } from "./bounds-CFI9wDXn.js";
|
|
9
|
+
import "./box-DVCNGsJG.js";
|
|
10
10
|
import "./dimensions-D-1PnJVI.js";
|
|
11
11
|
import "./base-DnZzEvvz.js";
|
|
12
|
-
import "./location-
|
|
13
|
-
import "./scale-
|
|
12
|
+
import "./location-CI9x53qR.js";
|
|
13
|
+
import "./scale-DNQE1LMm.js";
|
|
14
14
|
import "./xy-CrgPnICw.js";
|
|
15
|
-
import { b as
|
|
16
|
-
let
|
|
17
|
-
let
|
|
18
|
-
for (;
|
|
19
|
-
|
|
20
|
-
return
|
|
15
|
+
import { b as at } from "./zodutil-Tmuc4CNq.js";
|
|
16
|
+
let ut = (l, t = 21) => (e = t) => {
|
|
17
|
+
let n = "", i = e;
|
|
18
|
+
for (; i--; )
|
|
19
|
+
n += l[Math.random() * l.length | 0];
|
|
20
|
+
return n;
|
|
21
21
|
};
|
|
22
|
-
const
|
|
22
|
+
const ot = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", X = ut(ot, 11), Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
23
23
|
__proto__: null,
|
|
24
|
-
id:
|
|
25
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
24
|
+
id: X
|
|
25
|
+
}, Symbol.toStringTag, { value: "Module" })), lt = o.enum(["static", "dynamic"]), Q = (l, t) => {
|
|
26
26
|
const e = new m(t);
|
|
27
27
|
if (![
|
|
28
28
|
y.DAY,
|
|
@@ -32,30 +32,30 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
32
32
|
y.MILLISECOND,
|
|
33
33
|
y.MICROSECOND,
|
|
34
34
|
y.NANOSECOND
|
|
35
|
-
].some((
|
|
35
|
+
].some((i) => i.equals(e)))
|
|
36
36
|
throw new Error(
|
|
37
37
|
"Invalid argument for remainder. Must be an even TimeSpan or Timestamp"
|
|
38
38
|
);
|
|
39
|
-
const
|
|
40
|
-
return
|
|
41
|
-
},
|
|
39
|
+
const n = l.valueOf() % e.valueOf();
|
|
40
|
+
return l instanceof m ? new m(n) : new y(n);
|
|
41
|
+
}, a = class a {
|
|
42
42
|
constructor(t, e = "UTC") {
|
|
43
43
|
s(this, "value");
|
|
44
44
|
s(this, "encodeValue", !0);
|
|
45
|
-
if (t == null) this.value =
|
|
45
|
+
if (t == null) this.value = a.now().valueOf();
|
|
46
46
|
else if (t instanceof Date)
|
|
47
|
-
this.value = BigInt(t.getTime()) *
|
|
47
|
+
this.value = BigInt(t.getTime()) * a.MILLISECOND.valueOf();
|
|
48
48
|
else if (typeof t == "string")
|
|
49
|
-
this.value =
|
|
50
|
-
else if (Array.isArray(t)) this.value =
|
|
49
|
+
this.value = a.parseDateTimeString(t, e).valueOf();
|
|
50
|
+
else if (Array.isArray(t)) this.value = a.parseDate(t);
|
|
51
51
|
else {
|
|
52
|
-
let
|
|
53
|
-
t instanceof Number && (t = t.valueOf()), e === "local" && (
|
|
52
|
+
let n = BigInt(0);
|
|
53
|
+
t instanceof Number && (t = t.valueOf()), e === "local" && (n = 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()) + n;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
static parseDate([t = 1970, e = 1,
|
|
57
|
-
const
|
|
58
|
-
return new
|
|
56
|
+
static parseDate([t = 1970, e = 1, n = 1]) {
|
|
57
|
+
const i = new Date(t, e - 1, n, 0, 0, 0, 0);
|
|
58
|
+
return new a(BigInt(i.getTime()) * a.MILLISECOND.valueOf()).truncate(a.DAY).valueOf();
|
|
59
59
|
}
|
|
60
60
|
encode() {
|
|
61
61
|
return this.value.toString();
|
|
@@ -64,18 +64,18 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
64
64
|
return this.value;
|
|
65
65
|
}
|
|
66
66
|
static parseTimeString(t, e = "UTC") {
|
|
67
|
-
const [
|
|
68
|
-
let
|
|
69
|
-
|
|
70
|
-
let O =
|
|
71
|
-
return e === "local" && (O = O.add(
|
|
67
|
+
const [n, i, c] = t.split(":");
|
|
68
|
+
let h = "00", S = "00";
|
|
69
|
+
c != null && ([h, S] = c.split("."));
|
|
70
|
+
let O = a.hours(parseInt(n ?? "00")).add(a.minutes(parseInt(i ?? "00"))).add(a.seconds(parseInt(h ?? "00"))).add(a.milliseconds(parseInt(S ?? "00")));
|
|
71
|
+
return e === "local" && (O = O.add(a.utcOffset)), O.valueOf();
|
|
72
72
|
}
|
|
73
73
|
static parseDateTimeString(t, e = "UTC") {
|
|
74
74
|
if (!t.includes("/") && !t.includes("-"))
|
|
75
|
-
return
|
|
76
|
-
const
|
|
77
|
-
return t.includes(":") ||
|
|
78
|
-
BigInt(
|
|
75
|
+
return a.parseTimeString(t, e);
|
|
76
|
+
const n = new Date(t);
|
|
77
|
+
return t.includes(":") || n.setUTCHours(0, 0, 0, 0), new a(
|
|
78
|
+
BigInt(n.getTime()) * a.MILLISECOND.valueOf(),
|
|
79
79
|
e
|
|
80
80
|
).valueOf();
|
|
81
81
|
}
|
|
@@ -100,19 +100,19 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
toISOString(t = "UTC") {
|
|
103
|
-
return t === "UTC" ? this.date().toISOString() : this.sub(
|
|
103
|
+
return t === "UTC" ? this.date().toISOString() : this.sub(a.utcOffset).date().toISOString();
|
|
104
104
|
}
|
|
105
105
|
timeString(t = !1, e = "UTC") {
|
|
106
|
-
const
|
|
107
|
-
return t ?
|
|
106
|
+
const n = this.toISOString(e);
|
|
107
|
+
return t ? n.slice(11, 23) : n.slice(11, 19);
|
|
108
108
|
}
|
|
109
109
|
dateString() {
|
|
110
|
-
const t = this.date(), e = t.toLocaleString("default", { month: "short" }),
|
|
111
|
-
return `${e} ${
|
|
110
|
+
const t = this.date(), e = t.toLocaleString("default", { month: "short" }), n = t.toLocaleString("default", { day: "numeric" });
|
|
111
|
+
return `${e} ${n}`;
|
|
112
112
|
}
|
|
113
113
|
static get utcOffset() {
|
|
114
114
|
return new y(
|
|
115
|
-
BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) *
|
|
115
|
+
BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * a.MINUTE.valueOf()
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
@@ -121,7 +121,7 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
121
121
|
* @param other - The other timestamp.
|
|
122
122
|
*/
|
|
123
123
|
static since(t) {
|
|
124
|
-
return new
|
|
124
|
+
return new a().span(t);
|
|
125
125
|
}
|
|
126
126
|
/** @returns A JavaScript Date object representing the TimeStamp. */
|
|
127
127
|
date() {
|
|
@@ -134,7 +134,7 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
134
134
|
* @returns True if the TimeStamps are equal, false otherwise.
|
|
135
135
|
*/
|
|
136
136
|
equals(t) {
|
|
137
|
-
return this.valueOf() === new
|
|
137
|
+
return this.valueOf() === new a(t).valueOf();
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
140
|
* Creates a TimeSpan representing the duration between the two timestamps.
|
|
@@ -154,7 +154,7 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
154
154
|
* valid, regardless of the TimeStamp order.
|
|
155
155
|
*/
|
|
156
156
|
range(t) {
|
|
157
|
-
return new
|
|
157
|
+
return new E(this, t).makeValid();
|
|
158
158
|
}
|
|
159
159
|
/**
|
|
160
160
|
* Creates a TimeRange starting at the TimeStamp and spanning the given
|
|
@@ -183,7 +183,7 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
183
183
|
* otherwise.
|
|
184
184
|
*/
|
|
185
185
|
after(t) {
|
|
186
|
-
return this.valueOf() > new
|
|
186
|
+
return this.valueOf() > new a(t).valueOf();
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* Checks if the TimeStamp is after or equal to the given TimeStamp.
|
|
@@ -193,7 +193,7 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
193
193
|
* false otherwise.
|
|
194
194
|
*/
|
|
195
195
|
afterEq(t) {
|
|
196
|
-
return this.valueOf() >= new
|
|
196
|
+
return this.valueOf() >= new a(t).valueOf();
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
199
199
|
* Checks if the TimeStamp is before the given TimeStamp.
|
|
@@ -203,7 +203,7 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
203
203
|
* otherwise.
|
|
204
204
|
*/
|
|
205
205
|
before(t) {
|
|
206
|
-
return this.valueOf() < new
|
|
206
|
+
return this.valueOf() < new a(t).valueOf();
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
209
209
|
* Checks if TimeStamp is before or equal to the current timestamp.
|
|
@@ -213,7 +213,7 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
213
213
|
* false otherwise.
|
|
214
214
|
*/
|
|
215
215
|
beforeEq(t) {
|
|
216
|
-
return this.valueOf() <= new
|
|
216
|
+
return this.valueOf() <= new a(t).valueOf();
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
219
219
|
* Adds a TimeSpan to the TimeStamp.
|
|
@@ -223,7 +223,7 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
223
223
|
* TimeSpan.
|
|
224
224
|
*/
|
|
225
225
|
add(t) {
|
|
226
|
-
return new
|
|
226
|
+
return new a(this.valueOf() + BigInt(t.valueOf()));
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* Subtracts a TimeSpan from the TimeStamp.
|
|
@@ -233,13 +233,13 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
233
233
|
* TimeSpan.
|
|
234
234
|
*/
|
|
235
235
|
sub(t) {
|
|
236
|
-
return new
|
|
236
|
+
return new a(this.valueOf() - BigInt(t.valueOf()));
|
|
237
237
|
}
|
|
238
238
|
/**
|
|
239
239
|
* @returns The number of milliseconds since the unix epoch.
|
|
240
240
|
*/
|
|
241
241
|
milliseconds() {
|
|
242
|
-
return Number(this.valueOf()) / Number(
|
|
242
|
+
return Number(this.valueOf()) / Number(a.MILLISECOND.valueOf());
|
|
243
243
|
}
|
|
244
244
|
toString() {
|
|
245
245
|
return this.date().toISOString();
|
|
@@ -256,11 +256,11 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
256
256
|
* @example TimeStamp.now().remainder(TimeStamp.DAY) // => TimeStamp representing the current day
|
|
257
257
|
*/
|
|
258
258
|
remainder(t) {
|
|
259
|
-
return
|
|
259
|
+
return Q(this, t);
|
|
260
260
|
}
|
|
261
261
|
/** @returns true if the day portion TimeStamp is today, false otherwise. */
|
|
262
262
|
get isToday() {
|
|
263
|
-
return this.truncate(y.DAY).equals(
|
|
263
|
+
return this.truncate(y.DAY).equals(a.now().truncate(y.DAY));
|
|
264
264
|
}
|
|
265
265
|
truncate(t) {
|
|
266
266
|
return this.sub(this.remainder(t));
|
|
@@ -271,78 +271,84 @@ const _ = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", k =
|
|
|
271
271
|
* JavaScript can do).
|
|
272
272
|
*/
|
|
273
273
|
static now() {
|
|
274
|
-
return new
|
|
274
|
+
return new a(/* @__PURE__ */ new Date());
|
|
275
275
|
}
|
|
276
276
|
static max(...t) {
|
|
277
|
-
let e =
|
|
278
|
-
for (const
|
|
279
|
-
const
|
|
280
|
-
|
|
277
|
+
let e = a.MIN;
|
|
278
|
+
for (const n of t) {
|
|
279
|
+
const i = new a(n);
|
|
280
|
+
i.after(e) && (e = i);
|
|
281
281
|
}
|
|
282
282
|
return e;
|
|
283
283
|
}
|
|
284
284
|
static min(...t) {
|
|
285
|
-
let e =
|
|
286
|
-
for (const
|
|
287
|
-
const
|
|
288
|
-
|
|
285
|
+
let e = a.MAX;
|
|
286
|
+
for (const n of t) {
|
|
287
|
+
const i = new a(n);
|
|
288
|
+
i.before(e) && (e = i);
|
|
289
289
|
}
|
|
290
290
|
return e;
|
|
291
291
|
}
|
|
292
292
|
/** @returns a new TimeStamp n nanoseconds after the unix epoch */
|
|
293
293
|
static nanoseconds(t) {
|
|
294
|
-
return new
|
|
294
|
+
return new a(t);
|
|
295
295
|
}
|
|
296
296
|
/** @returns a new TimeStamp n microseconds after the unix epoch */
|
|
297
297
|
static microseconds(t) {
|
|
298
|
-
return
|
|
298
|
+
return a.nanoseconds(t * 1e3);
|
|
299
299
|
}
|
|
300
300
|
/** @returns a new TimeStamp n milliseconds after the unix epoch */
|
|
301
301
|
static milliseconds(t) {
|
|
302
|
-
return
|
|
302
|
+
return a.microseconds(t * 1e3);
|
|
303
303
|
}
|
|
304
304
|
/** @returns a new TimeStamp n seconds after the unix epoch */
|
|
305
305
|
static seconds(t) {
|
|
306
|
-
return
|
|
306
|
+
return a.milliseconds(t * 1e3);
|
|
307
307
|
}
|
|
308
308
|
/** @returns a new TimeStamp n minutes after the unix epoch */
|
|
309
309
|
static minutes(t) {
|
|
310
|
-
return
|
|
310
|
+
return a.seconds(t * 60);
|
|
311
311
|
}
|
|
312
312
|
/** @returns a new TimeStamp n hours after the unix epoch */
|
|
313
313
|
static hours(t) {
|
|
314
|
-
return
|
|
314
|
+
return a.minutes(t * 60);
|
|
315
315
|
}
|
|
316
316
|
/** @returns a new TimeStamp n days after the unix epoch */
|
|
317
317
|
static days(t) {
|
|
318
|
-
return
|
|
318
|
+
return a.hours(t * 24);
|
|
319
319
|
}
|
|
320
320
|
};
|
|
321
321
|
/* One nanosecond after the unix epoch */
|
|
322
|
-
s(
|
|
323
|
-
s(
|
|
324
|
-
s(
|
|
325
|
-
s(
|
|
326
|
-
s(
|
|
327
|
-
s(
|
|
328
|
-
s(
|
|
329
|
-
s(
|
|
330
|
-
s(
|
|
331
|
-
s(
|
|
332
|
-
s(
|
|
333
|
-
o.object({ value: o.bigint() }).transform((t) => new
|
|
334
|
-
o.string().transform((t) => new
|
|
335
|
-
o.instanceof(Number).transform((t) => new
|
|
336
|
-
o.number().transform((t) => new
|
|
337
|
-
o.instanceof(
|
|
322
|
+
s(a, "NANOSECOND", a.nanoseconds(1)), /** One microsecond after the unix epoch */
|
|
323
|
+
s(a, "MICROSECOND", a.microseconds(1)), /** One millisecond after the unix epoch */
|
|
324
|
+
s(a, "MILLISECOND", a.milliseconds(1)), /** One second after the unix epoch */
|
|
325
|
+
s(a, "SECOND", a.seconds(1)), /** One minute after the unix epoch */
|
|
326
|
+
s(a, "MINUTE", a.minutes(1)), /** One hour after the unix epoch */
|
|
327
|
+
s(a, "HOUR", a.hours(1)), /** One day after the unix epoch */
|
|
328
|
+
s(a, "DAY", a.days(1)), /** The maximum possible value for a timestamp */
|
|
329
|
+
s(a, "MAX", new a((1n << 63n) - 1n)), /** The minimum possible value for a timestamp */
|
|
330
|
+
s(a, "MIN", new a(0)), /** The unix epoch */
|
|
331
|
+
s(a, "ZERO", new a(0)), /** A zod schema for validating timestamps */
|
|
332
|
+
s(a, "z", o.union([
|
|
333
|
+
o.object({ value: o.bigint() }).transform((t) => new a(t.value)),
|
|
334
|
+
o.string().transform((t) => new a(BigInt(t))),
|
|
335
|
+
o.instanceof(Number).transform((t) => new a(t)),
|
|
336
|
+
o.number().transform((t) => new a(t)),
|
|
337
|
+
o.instanceof(a)
|
|
338
338
|
]));
|
|
339
|
-
let m =
|
|
340
|
-
const
|
|
339
|
+
let m = a;
|
|
340
|
+
const u = class u {
|
|
341
341
|
constructor(t) {
|
|
342
342
|
s(this, "value");
|
|
343
343
|
s(this, "encodeValue", !0);
|
|
344
344
|
typeof t == "number" && (t = Math.trunc(t.valueOf())), this.value = BigInt(t.valueOf());
|
|
345
345
|
}
|
|
346
|
+
static fromSeconds(t) {
|
|
347
|
+
return t instanceof u ? t : t instanceof P ? t.period : t instanceof m ? new u(t) : ["number", "bigint"].includes(typeof t) ? u.seconds(t) : new u(t);
|
|
348
|
+
}
|
|
349
|
+
static fromMilliseconds(t) {
|
|
350
|
+
return t instanceof u ? t : t instanceof P ? t.period : t instanceof m ? new u(t) : ["number", "bigint"].includes(typeof t) ? u.milliseconds(t) : new u(t);
|
|
351
|
+
}
|
|
346
352
|
encode() {
|
|
347
353
|
return this.value.toString();
|
|
348
354
|
}
|
|
@@ -350,52 +356,52 @@ const a = class a {
|
|
|
350
356
|
return this.value;
|
|
351
357
|
}
|
|
352
358
|
lessThan(t) {
|
|
353
|
-
return this.valueOf() < new
|
|
359
|
+
return this.valueOf() < new u(t).valueOf();
|
|
354
360
|
}
|
|
355
361
|
greaterThan(t) {
|
|
356
|
-
return this.valueOf() > new
|
|
362
|
+
return this.valueOf() > new u(t).valueOf();
|
|
357
363
|
}
|
|
358
364
|
lessThanOrEqual(t) {
|
|
359
|
-
return this.valueOf() <= new
|
|
365
|
+
return this.valueOf() <= new u(t).valueOf();
|
|
360
366
|
}
|
|
361
367
|
greaterThanOrEqual(t) {
|
|
362
|
-
return this.valueOf() >= new
|
|
368
|
+
return this.valueOf() >= new u(t).valueOf();
|
|
363
369
|
}
|
|
364
370
|
remainder(t) {
|
|
365
|
-
return
|
|
371
|
+
return Q(this, t);
|
|
366
372
|
}
|
|
367
373
|
truncate(t) {
|
|
368
|
-
return new
|
|
374
|
+
return new u(
|
|
369
375
|
BigInt(Math.trunc(Number(this.valueOf() / t.valueOf()))) * t.valueOf()
|
|
370
376
|
);
|
|
371
377
|
}
|
|
372
378
|
toString() {
|
|
373
|
-
const t = this.truncate(
|
|
379
|
+
const t = this.truncate(u.DAY), e = this.truncate(u.HOUR), n = this.truncate(u.MINUTE), i = this.truncate(u.SECOND), c = this.truncate(u.MILLISECOND), h = this.truncate(u.MICROSECOND), S = this.truncate(u.NANOSECOND), O = t, N = e.sub(t), p = n.sub(e), f = i.sub(n), M = c.sub(i), U = h.sub(c), Z = S.sub(h);
|
|
374
380
|
let A = "";
|
|
375
|
-
return O.isZero || (A += `${O.days}d `), N.isZero || (A += `${N.hours}h `), p.isZero || (A += `${p.minutes}m `),
|
|
381
|
+
return O.isZero || (A += `${O.days}d `), N.isZero || (A += `${N.hours}h `), p.isZero || (A += `${p.minutes}m `), f.isZero || (A += `${f.seconds}s `), M.isZero || (A += `${M.milliseconds}ms `), U.isZero || (A += `${U.microseconds}µs `), Z.isZero || (A += `${Z.nanoseconds}ns`), A.trim();
|
|
376
382
|
}
|
|
377
383
|
/** @returns the decimal number of days in the timespan */
|
|
378
384
|
get days() {
|
|
379
|
-
return Number(this.valueOf()) / Number(
|
|
385
|
+
return Number(this.valueOf()) / Number(u.DAY.valueOf());
|
|
380
386
|
}
|
|
381
387
|
/** @returns the decimal number of hours in the timespan */
|
|
382
388
|
get hours() {
|
|
383
|
-
return Number(this.valueOf()) / Number(
|
|
389
|
+
return Number(this.valueOf()) / Number(u.HOUR.valueOf());
|
|
384
390
|
}
|
|
385
391
|
/** @returns the decimal number of minutes in the timespan */
|
|
386
392
|
get minutes() {
|
|
387
|
-
return Number(this.valueOf()) / Number(
|
|
393
|
+
return Number(this.valueOf()) / Number(u.MINUTE.valueOf());
|
|
388
394
|
}
|
|
389
395
|
/** @returns The number of seconds in the TimeSpan. */
|
|
390
396
|
get seconds() {
|
|
391
|
-
return Number(this.valueOf()) / Number(
|
|
397
|
+
return Number(this.valueOf()) / Number(u.SECOND.valueOf());
|
|
392
398
|
}
|
|
393
399
|
/** @returns The number of milliseconds in the TimeSpan. */
|
|
394
400
|
get milliseconds() {
|
|
395
|
-
return Number(this.valueOf()) / Number(
|
|
401
|
+
return Number(this.valueOf()) / Number(u.MILLISECOND.valueOf());
|
|
396
402
|
}
|
|
397
403
|
get microseconds() {
|
|
398
|
-
return Number(this.valueOf()) / Number(
|
|
404
|
+
return Number(this.valueOf()) / Number(u.MICROSECOND.valueOf());
|
|
399
405
|
}
|
|
400
406
|
get nanoseconds() {
|
|
401
407
|
return Number(this.valueOf());
|
|
@@ -414,7 +420,7 @@ const a = class a {
|
|
|
414
420
|
* @returns True if the TimeSpans are equal, false otherwise.
|
|
415
421
|
*/
|
|
416
422
|
equals(t) {
|
|
417
|
-
return this.valueOf() === new
|
|
423
|
+
return this.valueOf() === new u(t).valueOf();
|
|
418
424
|
}
|
|
419
425
|
/**
|
|
420
426
|
* Adds a TimeSpan to the TimeSpan.
|
|
@@ -422,7 +428,7 @@ const a = class a {
|
|
|
422
428
|
* @returns A new TimeSpan representing the sum of the two TimeSpans.
|
|
423
429
|
*/
|
|
424
430
|
add(t) {
|
|
425
|
-
return new
|
|
431
|
+
return new u(this.valueOf() + new u(t).valueOf());
|
|
426
432
|
}
|
|
427
433
|
/**
|
|
428
434
|
* Creates a TimeSpan representing the duration between the two timestamps.
|
|
@@ -430,7 +436,7 @@ const a = class a {
|
|
|
430
436
|
* @param other
|
|
431
437
|
*/
|
|
432
438
|
sub(t) {
|
|
433
|
-
return new
|
|
439
|
+
return new u(this.valueOf() - new u(t).valueOf());
|
|
434
440
|
}
|
|
435
441
|
/**
|
|
436
442
|
* Creates a TimeSpan representing the given number of nanoseconds.
|
|
@@ -439,7 +445,7 @@ const a = class a {
|
|
|
439
445
|
* @returns A TimeSpan representing the given number of nanoseconds.
|
|
440
446
|
*/
|
|
441
447
|
static nanoseconds(t = 1) {
|
|
442
|
-
return new
|
|
448
|
+
return new u(t);
|
|
443
449
|
}
|
|
444
450
|
/**
|
|
445
451
|
* Creates a TimeSpan representing the given number of microseconds.
|
|
@@ -448,7 +454,7 @@ const a = class a {
|
|
|
448
454
|
* @returns A TimeSpan representing the given number of microseconds.
|
|
449
455
|
*/
|
|
450
456
|
static microseconds(t = 1) {
|
|
451
|
-
return
|
|
457
|
+
return u.nanoseconds(R(t, 1e3));
|
|
452
458
|
}
|
|
453
459
|
/**
|
|
454
460
|
* Creates a TimeSpan representing the given number of milliseconds.
|
|
@@ -457,7 +463,7 @@ const a = class a {
|
|
|
457
463
|
* @returns A TimeSpan representing the given number of milliseconds.
|
|
458
464
|
*/
|
|
459
465
|
static milliseconds(t = 1) {
|
|
460
|
-
return
|
|
466
|
+
return u.microseconds(R(t, 1e3));
|
|
461
467
|
}
|
|
462
468
|
/**
|
|
463
469
|
* Creates a TimeSpan representing the given number of seconds.
|
|
@@ -466,7 +472,7 @@ const a = class a {
|
|
|
466
472
|
* @returns A TimeSpan representing the given number of seconds.
|
|
467
473
|
*/
|
|
468
474
|
static seconds(t = 1) {
|
|
469
|
-
return
|
|
475
|
+
return u.milliseconds(R(t, 1e3));
|
|
470
476
|
}
|
|
471
477
|
/**
|
|
472
478
|
* Creates a TimeSpan representing the given number of minutes.
|
|
@@ -474,8 +480,8 @@ const a = class a {
|
|
|
474
480
|
* @param value - The number of minutes.
|
|
475
481
|
* @returns A TimeSpan representing the given number of minutes.
|
|
476
482
|
*/
|
|
477
|
-
static minutes(t) {
|
|
478
|
-
return
|
|
483
|
+
static minutes(t = 1) {
|
|
484
|
+
return u.seconds(R(t, 60));
|
|
479
485
|
}
|
|
480
486
|
/**
|
|
481
487
|
* Creates a TimeSpan representing the given number of hours.
|
|
@@ -484,7 +490,7 @@ const a = class a {
|
|
|
484
490
|
* @returns A TimeSpan representing the given number of hours.
|
|
485
491
|
*/
|
|
486
492
|
static hours(t) {
|
|
487
|
-
return
|
|
493
|
+
return u.minutes(R(t, 60));
|
|
488
494
|
}
|
|
489
495
|
/**
|
|
490
496
|
* Creates a TimeSpan representing the given number of days.
|
|
@@ -493,28 +499,28 @@ const a = class a {
|
|
|
493
499
|
* @returns A TimeSpan representing the given number of days.
|
|
494
500
|
*/
|
|
495
501
|
static days(t) {
|
|
496
|
-
return
|
|
502
|
+
return u.hours(R(t, 24));
|
|
497
503
|
}
|
|
498
504
|
};
|
|
499
505
|
/** A nanosecond. */
|
|
500
|
-
s(
|
|
501
|
-
s(
|
|
502
|
-
s(
|
|
503
|
-
s(
|
|
504
|
-
s(
|
|
505
|
-
s(
|
|
506
|
-
s(
|
|
507
|
-
s(
|
|
508
|
-
s(
|
|
509
|
-
s(
|
|
510
|
-
s(
|
|
511
|
-
o.object({ value: o.bigint() }).transform((t) => new
|
|
512
|
-
o.string().transform((t) => new
|
|
513
|
-
o.instanceof(Number).transform((t) => new
|
|
514
|
-
o.number().transform((t) => new
|
|
515
|
-
o.instanceof(
|
|
506
|
+
s(u, "NANOSECOND", u.nanoseconds(1)), /** A microsecond. */
|
|
507
|
+
s(u, "MICROSECOND", u.microseconds(1)), /** A millisecond. */
|
|
508
|
+
s(u, "MILLISECOND", u.milliseconds(1)), /** A second. */
|
|
509
|
+
s(u, "SECOND", u.seconds(1)), /** A minute. */
|
|
510
|
+
s(u, "MINUTE", u.minutes(1)), /** Represents an hour. */
|
|
511
|
+
s(u, "HOUR", u.hours(1)), /** Represents a day. */
|
|
512
|
+
s(u, "DAY", u.days(1)), /** The maximum possible value for a TimeSpan. */
|
|
513
|
+
s(u, "MAX", new u((1n << 63n) - 1n)), /** The minimum possible value for a TimeSpan. */
|
|
514
|
+
s(u, "MIN", new u(0)), /** The zero value for a TimeSpan. */
|
|
515
|
+
s(u, "ZERO", new u(0)), /** A zod schema for validating and transforming timespans */
|
|
516
|
+
s(u, "z", o.union([
|
|
517
|
+
o.object({ value: o.bigint() }).transform((t) => new u(t.value)),
|
|
518
|
+
o.string().transform((t) => new u(BigInt(t))),
|
|
519
|
+
o.instanceof(Number).transform((t) => new u(t)),
|
|
520
|
+
o.number().transform((t) => new u(t)),
|
|
521
|
+
o.instanceof(u)
|
|
516
522
|
]));
|
|
517
|
-
let y =
|
|
523
|
+
let y = u;
|
|
518
524
|
const v = class v extends Number {
|
|
519
525
|
constructor(t) {
|
|
520
526
|
t instanceof Number ? super(t.valueOf()) : super(t);
|
|
@@ -598,7 +604,7 @@ s(v, "z", o.union([
|
|
|
598
604
|
o.instanceof(Number).transform((t) => new v(t)),
|
|
599
605
|
o.instanceof(v)
|
|
600
606
|
]));
|
|
601
|
-
let
|
|
607
|
+
let P = v;
|
|
602
608
|
const w = class w extends Number {
|
|
603
609
|
/**
|
|
604
610
|
* Creates a Density representing the given number of bytes per value.
|
|
@@ -614,7 +620,7 @@ const w = class w extends Number {
|
|
|
614
620
|
return t.valueOf() / this.valueOf();
|
|
615
621
|
}
|
|
616
622
|
size(t) {
|
|
617
|
-
return new
|
|
623
|
+
return new x(t * this.valueOf());
|
|
618
624
|
}
|
|
619
625
|
};
|
|
620
626
|
/** Unknown/Invalid Density. */
|
|
@@ -630,7 +636,7 @@ s(w, "z", o.union([
|
|
|
630
636
|
o.instanceof(w)
|
|
631
637
|
]));
|
|
632
638
|
let b = w;
|
|
633
|
-
const
|
|
639
|
+
const T = class T {
|
|
634
640
|
/**
|
|
635
641
|
* Creates a TimeRange from the given start and end TimeStamps.
|
|
636
642
|
*
|
|
@@ -698,7 +704,7 @@ const I = class I {
|
|
|
698
704
|
* @returns A TimeRange with the start and end swapped.
|
|
699
705
|
*/
|
|
700
706
|
swap() {
|
|
701
|
-
return new
|
|
707
|
+
return new T(this.end, this.start);
|
|
702
708
|
}
|
|
703
709
|
/**
|
|
704
710
|
* Checks if the TimeRange is equal to the given TimeRange.
|
|
@@ -725,52 +731,51 @@ const I = class I {
|
|
|
725
731
|
*/
|
|
726
732
|
overlapsWith(t, e = y.ZERO) {
|
|
727
733
|
t = t.makeValid();
|
|
728
|
-
const
|
|
734
|
+
const n = this.makeValid();
|
|
729
735
|
if (this.equals(t)) return !0;
|
|
730
|
-
if (t.end.equals(
|
|
731
|
-
const
|
|
732
|
-
return
|
|
736
|
+
if (t.end.equals(n.start) || n.end.equals(t.start)) return !1;
|
|
737
|
+
const i = m.max(n.start, t.start), c = m.min(n.end, t.end);
|
|
738
|
+
return c.before(i) ? !1 : new y(c.sub(i)).greaterThanOrEqual(e);
|
|
733
739
|
}
|
|
734
740
|
roughlyEquals(t, e) {
|
|
735
|
-
let
|
|
736
|
-
return
|
|
741
|
+
let n = this.start.sub(t.start).valueOf(), i = this.end.sub(t.end).valueOf();
|
|
742
|
+
return n < 0 && (n = -n), i < 0 && (i = -i), n <= e.valueOf() && i <= e.valueOf();
|
|
737
743
|
}
|
|
738
744
|
contains(t) {
|
|
739
|
-
return t instanceof
|
|
745
|
+
return t instanceof T ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
|
|
740
746
|
}
|
|
741
747
|
boundBy(t) {
|
|
742
|
-
const e = new
|
|
748
|
+
const e = new T(this.start, this.end);
|
|
743
749
|
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;
|
|
744
750
|
}
|
|
745
751
|
};
|
|
746
752
|
/** The maximum possible time range. */
|
|
747
|
-
s(
|
|
748
|
-
s(
|
|
749
|
-
s(
|
|
750
|
-
s(
|
|
751
|
-
o.object({ start: m.z, end: m.z }).transform((t) => new
|
|
752
|
-
o.instanceof(
|
|
753
|
+
s(T, "MAX", new T(m.MIN, m.MAX)), /** The minimum possible time range. */
|
|
754
|
+
s(T, "MIN", new T(m.MAX, m.MIN)), /** A zero time range. */
|
|
755
|
+
s(T, "ZERO", new T(m.ZERO, m.ZERO)), /** A zod schema for validating and transforming time ranges */
|
|
756
|
+
s(T, "z", o.union([
|
|
757
|
+
o.object({ start: m.z, end: m.z }).transform((t) => new T(t.start, t.end)),
|
|
758
|
+
o.instanceof(T)
|
|
753
759
|
]));
|
|
754
|
-
let
|
|
755
|
-
const
|
|
760
|
+
let E = T;
|
|
761
|
+
const r = class r extends String {
|
|
756
762
|
constructor(t) {
|
|
757
|
-
if (t instanceof
|
|
763
|
+
if (t instanceof r || typeof t == "string" || typeof t.valueOf() == "string") {
|
|
758
764
|
super(t.valueOf());
|
|
759
765
|
return;
|
|
760
|
-
} else {
|
|
761
|
-
const e = n.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);
|
|
762
|
-
if (e != null) {
|
|
763
|
-
super(e.valueOf());
|
|
764
|
-
return;
|
|
765
|
-
}
|
|
766
766
|
}
|
|
767
|
-
|
|
767
|
+
const e = r.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);
|
|
768
|
+
if (e != null) {
|
|
769
|
+
super(e.valueOf());
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
throw super(r.UNKNOWN.valueOf()), new Error(`unable to find data type for ${t.toString()}`);
|
|
768
773
|
}
|
|
769
774
|
/**
|
|
770
775
|
* @returns the TypedArray constructor for the DataType.
|
|
771
776
|
*/
|
|
772
777
|
get Array() {
|
|
773
|
-
const t =
|
|
778
|
+
const t = r.ARRAY_CONSTRUCTORS.get(this.toString());
|
|
774
779
|
if (t == null)
|
|
775
780
|
throw new Error(`unable to find array constructor for ${this.valueOf()}`);
|
|
776
781
|
return t;
|
|
@@ -792,10 +797,10 @@ const n = class n extends String {
|
|
|
792
797
|
return this.valueOf();
|
|
793
798
|
}
|
|
794
799
|
get isVariable() {
|
|
795
|
-
return this.equals(
|
|
800
|
+
return this.equals(r.JSON) || this.equals(r.STRING);
|
|
796
801
|
}
|
|
797
802
|
get isNumeric() {
|
|
798
|
-
return !this.isVariable && !this.equals(
|
|
803
|
+
return !this.isVariable && !this.equals(r.UUID);
|
|
799
804
|
}
|
|
800
805
|
get isInteger() {
|
|
801
806
|
return this.toString().startsWith("int");
|
|
@@ -804,7 +809,7 @@ const n = class n extends String {
|
|
|
804
809
|
return this.toString().startsWith("float");
|
|
805
810
|
}
|
|
806
811
|
get density() {
|
|
807
|
-
const t =
|
|
812
|
+
const t = r.DENSITIES.get(this.toString());
|
|
808
813
|
if (t == null) throw new Error(`unable to find density for ${this.valueOf()}`);
|
|
809
814
|
return t;
|
|
810
815
|
}
|
|
@@ -829,92 +834,92 @@ const n = class n extends String {
|
|
|
829
834
|
return this.toString();
|
|
830
835
|
}
|
|
831
836
|
get usesBigInt() {
|
|
832
|
-
return
|
|
837
|
+
return r.BIG_INT_TYPES.some((t) => t.equals(this));
|
|
833
838
|
}
|
|
834
839
|
};
|
|
835
840
|
/** Represents an Unknown/Invalid DataType. */
|
|
836
|
-
s(
|
|
837
|
-
s(
|
|
838
|
-
s(
|
|
839
|
-
s(
|
|
840
|
-
s(
|
|
841
|
-
s(
|
|
842
|
-
s(
|
|
843
|
-
s(
|
|
844
|
-
s(
|
|
845
|
-
s(
|
|
846
|
-
s(
|
|
847
|
-
s(
|
|
848
|
-
s(
|
|
849
|
-
s(
|
|
841
|
+
s(r, "UNKNOWN", new r("unknown")), /** Represents a 64-bit floating point value. */
|
|
842
|
+
s(r, "FLOAT64", new r("float64")), /** Represents a 32-bit floating point value. */
|
|
843
|
+
s(r, "FLOAT32", new r("float32")), /** Represents a 64-bit signed integer value. */
|
|
844
|
+
s(r, "INT64", new r("int64")), /** Represents a 32-bit signed integer value. */
|
|
845
|
+
s(r, "INT32", new r("int32")), /** Represents a 16-bit signed integer value. */
|
|
846
|
+
s(r, "INT16", new r("int16")), /** Represents a 8-bit signed integer value. */
|
|
847
|
+
s(r, "INT8", new r("int8")), /** Represents a 64-bit unsigned integer value. */
|
|
848
|
+
s(r, "UINT64", new r("uint64")), /** Represents a 32-bit unsigned integer value. */
|
|
849
|
+
s(r, "UINT32", new r("uint32")), /** Represents a 16-bit unsigned integer value. */
|
|
850
|
+
s(r, "UINT16", new r("uint16")), /** Represents a 8-bit unsigned integer value. */
|
|
851
|
+
s(r, "UINT8", new r("uint8")), /** Represents a boolean value. Alias for UINT8. */
|
|
852
|
+
s(r, "BOOLEAN", r.UINT8), /** Represents a 64-bit unix epoch. */
|
|
853
|
+
s(r, "TIMESTAMP", new r("timestamp")), /** Represents a UUID data type */
|
|
854
|
+
s(r, "UUID", new r("uuid")), /** Represents a string data type. Strings have an unknown density, and are separate
|
|
850
855
|
* by a newline character. */
|
|
851
|
-
s(
|
|
856
|
+
s(r, "STRING", new r("string")), /** Represents a JSON data type. JSON has an unknown density, and is separated by a
|
|
852
857
|
* newline character. */
|
|
853
|
-
s(
|
|
854
|
-
[
|
|
855
|
-
[
|
|
856
|
-
[
|
|
857
|
-
[
|
|
858
|
-
[
|
|
859
|
-
[
|
|
860
|
-
[
|
|
861
|
-
[
|
|
862
|
-
[
|
|
863
|
-
[
|
|
864
|
-
[
|
|
865
|
-
[
|
|
866
|
-
[
|
|
867
|
-
[
|
|
868
|
-
])), s(
|
|
869
|
-
[Uint8Array.name,
|
|
870
|
-
[Uint16Array.name,
|
|
871
|
-
[Uint32Array.name,
|
|
872
|
-
[BigUint64Array.name,
|
|
873
|
-
[Float32Array.name,
|
|
874
|
-
[Float64Array.name,
|
|
875
|
-
[Int8Array.name,
|
|
876
|
-
[Int16Array.name,
|
|
877
|
-
[Int32Array.name,
|
|
878
|
-
[BigInt64Array.name,
|
|
879
|
-
])), s(
|
|
880
|
-
[
|
|
881
|
-
[
|
|
882
|
-
[
|
|
883
|
-
[
|
|
884
|
-
[
|
|
885
|
-
[
|
|
886
|
-
[
|
|
887
|
-
[
|
|
888
|
-
[
|
|
889
|
-
[
|
|
890
|
-
[
|
|
891
|
-
[
|
|
892
|
-
[
|
|
893
|
-
[
|
|
858
|
+
s(r, "JSON", new r("json")), s(r, "ARRAY_CONSTRUCTORS", /* @__PURE__ */ new Map([
|
|
859
|
+
[r.UINT8.toString(), Uint8Array],
|
|
860
|
+
[r.UINT16.toString(), Uint16Array],
|
|
861
|
+
[r.UINT32.toString(), Uint32Array],
|
|
862
|
+
[r.UINT64.toString(), BigUint64Array],
|
|
863
|
+
[r.FLOAT32.toString(), Float32Array],
|
|
864
|
+
[r.FLOAT64.toString(), Float64Array],
|
|
865
|
+
[r.INT8.toString(), Int8Array],
|
|
866
|
+
[r.INT16.toString(), Int16Array],
|
|
867
|
+
[r.INT32.toString(), Int32Array],
|
|
868
|
+
[r.INT64.toString(), BigInt64Array],
|
|
869
|
+
[r.TIMESTAMP.toString(), BigInt64Array],
|
|
870
|
+
[r.STRING.toString(), Uint8Array],
|
|
871
|
+
[r.JSON.toString(), Uint8Array],
|
|
872
|
+
[r.UUID.toString(), Uint8Array]
|
|
873
|
+
])), s(r, "ARRAY_CONSTRUCTOR_DATA_TYPES", /* @__PURE__ */ new Map([
|
|
874
|
+
[Uint8Array.name, r.UINT8],
|
|
875
|
+
[Uint16Array.name, r.UINT16],
|
|
876
|
+
[Uint32Array.name, r.UINT32],
|
|
877
|
+
[BigUint64Array.name, r.UINT64],
|
|
878
|
+
[Float32Array.name, r.FLOAT32],
|
|
879
|
+
[Float64Array.name, r.FLOAT64],
|
|
880
|
+
[Int8Array.name, r.INT8],
|
|
881
|
+
[Int16Array.name, r.INT16],
|
|
882
|
+
[Int32Array.name, r.INT32],
|
|
883
|
+
[BigInt64Array.name, r.INT64]
|
|
884
|
+
])), s(r, "DENSITIES", /* @__PURE__ */ new Map([
|
|
885
|
+
[r.UINT8.toString(), b.BIT8],
|
|
886
|
+
[r.UINT16.toString(), b.BIT16],
|
|
887
|
+
[r.UINT32.toString(), b.BIT32],
|
|
888
|
+
[r.UINT64.toString(), b.BIT64],
|
|
889
|
+
[r.FLOAT32.toString(), b.BIT32],
|
|
890
|
+
[r.FLOAT64.toString(), b.BIT64],
|
|
891
|
+
[r.INT8.toString(), b.BIT8],
|
|
892
|
+
[r.INT16.toString(), b.BIT16],
|
|
893
|
+
[r.INT32.toString(), b.BIT32],
|
|
894
|
+
[r.INT64.toString(), b.BIT64],
|
|
895
|
+
[r.TIMESTAMP.toString(), b.BIT64],
|
|
896
|
+
[r.STRING.toString(), b.UNKNOWN],
|
|
897
|
+
[r.JSON.toString(), b.UNKNOWN],
|
|
898
|
+
[r.UUID.toString(), b.BIT128]
|
|
894
899
|
])), /** All the data types. */
|
|
895
|
-
s(
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
]), s(
|
|
912
|
-
s(
|
|
913
|
-
o.string().transform((t) => new
|
|
914
|
-
o.instanceof(
|
|
900
|
+
s(r, "ALL", [
|
|
901
|
+
r.UNKNOWN,
|
|
902
|
+
r.FLOAT64,
|
|
903
|
+
r.FLOAT32,
|
|
904
|
+
r.INT64,
|
|
905
|
+
r.INT32,
|
|
906
|
+
r.INT16,
|
|
907
|
+
r.INT8,
|
|
908
|
+
r.UINT64,
|
|
909
|
+
r.UINT32,
|
|
910
|
+
r.UINT16,
|
|
911
|
+
r.UINT8,
|
|
912
|
+
r.TIMESTAMP,
|
|
913
|
+
r.UUID,
|
|
914
|
+
r.STRING,
|
|
915
|
+
r.JSON
|
|
916
|
+
]), s(r, "BIG_INT_TYPES", [r.INT64, r.UINT64, r.TIMESTAMP]), /** A zod schema for a DataType. */
|
|
917
|
+
s(r, "z", o.union([
|
|
918
|
+
o.string().transform((t) => new r(t)),
|
|
919
|
+
o.instanceof(r)
|
|
915
920
|
]));
|
|
916
|
-
let
|
|
917
|
-
const
|
|
921
|
+
let g = r;
|
|
922
|
+
const d = class d extends Number {
|
|
918
923
|
constructor(t) {
|
|
919
924
|
super(t.valueOf());
|
|
920
925
|
}
|
|
@@ -927,33 +932,33 @@ const l = class l extends Number {
|
|
|
927
932
|
return this.valueOf() < t.valueOf();
|
|
928
933
|
}
|
|
929
934
|
add(t) {
|
|
930
|
-
return
|
|
935
|
+
return d.bytes(this.valueOf() + t.valueOf());
|
|
931
936
|
}
|
|
932
937
|
sub(t) {
|
|
933
|
-
return
|
|
938
|
+
return d.bytes(this.valueOf() - t.valueOf());
|
|
934
939
|
}
|
|
935
940
|
truncate(t) {
|
|
936
|
-
return new
|
|
941
|
+
return new d(Math.trunc(this.valueOf() / t.valueOf()) * t.valueOf());
|
|
937
942
|
}
|
|
938
943
|
remainder(t) {
|
|
939
|
-
return
|
|
944
|
+
return d.bytes(this.valueOf() % t.valueOf());
|
|
940
945
|
}
|
|
941
946
|
get gigabytes() {
|
|
942
|
-
return this.valueOf() /
|
|
947
|
+
return this.valueOf() / d.GIGABYTE.valueOf();
|
|
943
948
|
}
|
|
944
949
|
get megabytes() {
|
|
945
|
-
return this.valueOf() /
|
|
950
|
+
return this.valueOf() / d.MEGABYTE.valueOf();
|
|
946
951
|
}
|
|
947
952
|
get kilobytes() {
|
|
948
|
-
return this.valueOf() /
|
|
953
|
+
return this.valueOf() / d.KILOBYTE.valueOf();
|
|
949
954
|
}
|
|
950
955
|
get terabytes() {
|
|
951
|
-
return this.valueOf() /
|
|
956
|
+
return this.valueOf() / d.TERABYTE.valueOf();
|
|
952
957
|
}
|
|
953
958
|
toString() {
|
|
954
|
-
const t = this.truncate(
|
|
955
|
-
let
|
|
956
|
-
return
|
|
959
|
+
const t = this.truncate(d.TERABYTE), e = this.truncate(d.GIGABYTE), n = this.truncate(d.MEGABYTE), i = this.truncate(d.KILOBYTE), c = this.truncate(d.BYTE), h = t, S = e.sub(t), O = n.sub(e), N = i.sub(n), p = c.sub(i);
|
|
960
|
+
let f = "";
|
|
961
|
+
return h.isZero || (f += `${h.terabytes}TB `), S.isZero || (f += `${S.gigabytes}GB `), O.isZero || (f += `${O.megabytes}MB `), N.isZero || (f += `${N.kilobytes}KB `), (!p.isZero || f === "") && (f += `${p.valueOf()}B`), f.trim();
|
|
957
962
|
}
|
|
958
963
|
/**
|
|
959
964
|
* Creates a Size from the given number of bytes.
|
|
@@ -962,7 +967,7 @@ const l = class l extends Number {
|
|
|
962
967
|
* @returns A Size representing the given number of bytes.
|
|
963
968
|
*/
|
|
964
969
|
static bytes(t = 1) {
|
|
965
|
-
return new
|
|
970
|
+
return new d(t);
|
|
966
971
|
}
|
|
967
972
|
/**
|
|
968
973
|
* Creates a Size from the given number if kilobytes.
|
|
@@ -971,7 +976,7 @@ const l = class l extends Number {
|
|
|
971
976
|
* @returns A Size representing the given number of kilobytes.
|
|
972
977
|
*/
|
|
973
978
|
static kilobytes(t = 1) {
|
|
974
|
-
return
|
|
979
|
+
return d.bytes(t.valueOf() * 1e3);
|
|
975
980
|
}
|
|
976
981
|
/**
|
|
977
982
|
* Creates a Size from the given number of megabytes.
|
|
@@ -980,7 +985,7 @@ const l = class l extends Number {
|
|
|
980
985
|
* @returns A Size representing the given number of megabytes.
|
|
981
986
|
*/
|
|
982
987
|
static megabytes(t = 1) {
|
|
983
|
-
return
|
|
988
|
+
return d.kilobytes(t.valueOf() * 1e3);
|
|
984
989
|
}
|
|
985
990
|
/**
|
|
986
991
|
* Creates a Size from the given number of gigabytes.
|
|
@@ -989,7 +994,7 @@ const l = class l extends Number {
|
|
|
989
994
|
* @returns A Size representing the given number of gigabytes.
|
|
990
995
|
*/
|
|
991
996
|
static gigabytes(t = 1) {
|
|
992
|
-
return
|
|
997
|
+
return d.megabytes(t.valueOf() * 1e3);
|
|
993
998
|
}
|
|
994
999
|
/**
|
|
995
1000
|
* Creates a Size from the given number of terabytes.
|
|
@@ -998,25 +1003,25 @@ const l = class l extends Number {
|
|
|
998
1003
|
* @returns A Size representing the given number of terabytes.
|
|
999
1004
|
*/
|
|
1000
1005
|
static terabytes(t) {
|
|
1001
|
-
return
|
|
1006
|
+
return d.gigabytes(t.valueOf() * 1e3);
|
|
1002
1007
|
}
|
|
1003
1008
|
get isZero() {
|
|
1004
1009
|
return this.valueOf() === 0;
|
|
1005
1010
|
}
|
|
1006
1011
|
};
|
|
1007
1012
|
/** A single byte */
|
|
1008
|
-
s(
|
|
1009
|
-
s(
|
|
1010
|
-
s(
|
|
1011
|
-
s(
|
|
1012
|
-
s(
|
|
1013
|
-
s(
|
|
1014
|
-
s(
|
|
1015
|
-
o.number().transform((t) => new
|
|
1016
|
-
o.instanceof(
|
|
1013
|
+
s(d, "BYTE", new d(1)), /** A kilobyte */
|
|
1014
|
+
s(d, "KILOBYTE", d.kilobytes(1)), /** A megabyte */
|
|
1015
|
+
s(d, "MEGABYTE", d.megabytes(1)), /** A gigabyte */
|
|
1016
|
+
s(d, "GIGABYTE", d.gigabytes(1)), /** A terabyte. */
|
|
1017
|
+
s(d, "TERABYTE", d.terabytes(1)), /** The zero value for Size */
|
|
1018
|
+
s(d, "ZERO", new d(0)), /** A zod schema for a Size. */
|
|
1019
|
+
s(d, "z", o.union([
|
|
1020
|
+
o.number().transform((t) => new d(t)),
|
|
1021
|
+
o.instanceof(d)
|
|
1017
1022
|
]));
|
|
1018
|
-
let
|
|
1019
|
-
const
|
|
1023
|
+
let x = d;
|
|
1024
|
+
const xt = o.union([
|
|
1020
1025
|
o.instanceof(Uint8Array),
|
|
1021
1026
|
o.instanceof(Uint16Array),
|
|
1022
1027
|
o.instanceof(Uint32Array),
|
|
@@ -1027,14 +1032,17 @@ const St = o.union([
|
|
|
1027
1032
|
o.instanceof(Int16Array),
|
|
1028
1033
|
o.instanceof(Int32Array),
|
|
1029
1034
|
o.instanceof(BigInt64Array)
|
|
1030
|
-
]),
|
|
1031
|
-
const t = typeof
|
|
1032
|
-
return t === "string" || t === "number" || t === "boolean" || t === "bigint" ||
|
|
1033
|
-
},
|
|
1034
|
-
(
|
|
1035
|
-
|
|
1035
|
+
]), _ = (l) => {
|
|
1036
|
+
const t = typeof l;
|
|
1037
|
+
return t === "string" || t === "number" || t === "boolean" || t === "bigint" || l instanceof m || l instanceof y || l instanceof Date;
|
|
1038
|
+
}, ct = (l, t, e, n = 0) => l.usesBigInt && !t.usesBigInt ? Number(e) - Number(n) : !l.usesBigInt && t.usesBigInt ? BigInt(e.valueOf()) - BigInt(n.valueOf()) : C(e, -n).valueOf(), ft = (l) => l == null ? !1 : Array.isArray(l) || l instanceof ArrayBuffer || ArrayBuffer.isView(l) && !(l instanceof DataView) || l instanceof V ? !0 : _(l), B = -1, q = {
|
|
1039
|
+
[Symbol.iterator]: () => q,
|
|
1040
|
+
next: () => ({ done: !0, value: void 0 })
|
|
1041
|
+
}, ht = o.string().transform(
|
|
1042
|
+
(l) => new Uint8Array(
|
|
1043
|
+
atob(l).split("").map((t) => t.charCodeAt(0))
|
|
1036
1044
|
).buffer
|
|
1037
|
-
),
|
|
1045
|
+
), dt = o.union([o.null(), o.undefined()]).transform(() => new Uint8Array().buffer), Y = 10, I = class I {
|
|
1038
1046
|
constructor(t) {
|
|
1039
1047
|
s(this, "key", "");
|
|
1040
1048
|
s(this, "isSynnaxSeries", !0);
|
|
@@ -1059,104 +1067,107 @@ const St = o.union([
|
|
|
1059
1067
|
/** A cached maximum value. */
|
|
1060
1068
|
s(this, "_cachedMax");
|
|
1061
1069
|
/** The write position of the buffer. */
|
|
1062
|
-
s(this, "writePos",
|
|
1070
|
+
s(this, "writePos", B);
|
|
1063
1071
|
/** Tracks the number of entities currently using this array. */
|
|
1064
1072
|
s(this, "_refCount", 0);
|
|
1073
|
+
/** Caches the length of the array for variable length data types. */
|
|
1065
1074
|
s(this, "_cachedLength");
|
|
1066
|
-
|
|
1075
|
+
/** Caches the indexes of the array for variable length data types. */
|
|
1076
|
+
s(this, "_cachedIndexes");
|
|
1077
|
+
ft(t) && (t = { data: t });
|
|
1067
1078
|
const {
|
|
1068
1079
|
dataType: e,
|
|
1069
|
-
timeRange:
|
|
1070
|
-
sampleOffset:
|
|
1071
|
-
glBufferUsage:
|
|
1072
|
-
alignment:
|
|
1073
|
-
key: S =
|
|
1080
|
+
timeRange: n,
|
|
1081
|
+
sampleOffset: i = 0,
|
|
1082
|
+
glBufferUsage: c = "static",
|
|
1083
|
+
alignment: h = 0n,
|
|
1084
|
+
key: S = X()
|
|
1074
1085
|
} = t, O = t.data ?? [];
|
|
1075
|
-
if (O instanceof
|
|
1076
|
-
const
|
|
1077
|
-
this.key =
|
|
1086
|
+
if (O instanceof I || typeof O == "object" && "isSynnaxSeries" in O && O.isSynnaxSeries === !0) {
|
|
1087
|
+
const f = O;
|
|
1088
|
+
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;
|
|
1078
1089
|
return;
|
|
1079
1090
|
}
|
|
1080
|
-
const N =
|
|
1081
|
-
if (e != null) this.dataType = new
|
|
1091
|
+
const N = _(O), p = Array.isArray(O);
|
|
1092
|
+
if (e != null) this.dataType = new g(e);
|
|
1082
1093
|
else {
|
|
1083
1094
|
if (O instanceof ArrayBuffer)
|
|
1084
1095
|
throw new Error(
|
|
1085
1096
|
"cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type."
|
|
1086
1097
|
);
|
|
1087
1098
|
if (p || N) {
|
|
1088
|
-
let
|
|
1099
|
+
let f = O;
|
|
1089
1100
|
if (!N) {
|
|
1090
1101
|
if (O.length === 0)
|
|
1091
1102
|
throw new Error(
|
|
1092
1103
|
"cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type."
|
|
1093
1104
|
);
|
|
1094
|
-
|
|
1105
|
+
f = O[0];
|
|
1095
1106
|
}
|
|
1096
|
-
if (typeof
|
|
1097
|
-
else if (typeof
|
|
1098
|
-
else if (typeof
|
|
1099
|
-
else if (typeof
|
|
1100
|
-
else if (
|
|
1101
|
-
this.dataType =
|
|
1102
|
-
else if (typeof
|
|
1107
|
+
if (typeof f == "string") this.dataType = g.STRING;
|
|
1108
|
+
else if (typeof f == "number") this.dataType = g.FLOAT64;
|
|
1109
|
+
else if (typeof f == "bigint") this.dataType = g.INT64;
|
|
1110
|
+
else if (typeof f == "boolean") this.dataType = g.BOOLEAN;
|
|
1111
|
+
else if (f instanceof m || f instanceof Date || f instanceof m)
|
|
1112
|
+
this.dataType = g.TIMESTAMP;
|
|
1113
|
+
else if (typeof f == "object") this.dataType = g.JSON;
|
|
1103
1114
|
else
|
|
1104
1115
|
throw new Error(
|
|
1105
|
-
`cannot infer data type of ${typeof
|
|
1116
|
+
`cannot infer data type of ${typeof f} when constructing a Series from a JS array`
|
|
1106
1117
|
);
|
|
1107
|
-
} else this.dataType = new
|
|
1118
|
+
} else this.dataType = new g(O);
|
|
1108
1119
|
}
|
|
1109
1120
|
if (!p && !N) this._data = O;
|
|
1110
1121
|
else {
|
|
1111
|
-
let
|
|
1112
|
-
const M =
|
|
1113
|
-
(M instanceof m || M instanceof Date || M instanceof y) && (
|
|
1114
|
-
`)
|
|
1115
|
-
`)) : this.dataType.equals(
|
|
1116
|
-
|
|
1117
|
-
`)
|
|
1122
|
+
let f = N ? [O] : O;
|
|
1123
|
+
const M = f[0];
|
|
1124
|
+
(M instanceof m || M instanceof Date || M instanceof y) && (f = f.map((U) => new m(U).valueOf())), this.dataType.equals(g.STRING) ? (this._cachedLength = f.length, this._data = new TextEncoder().encode(`${f.join(`
|
|
1125
|
+
`)}
|
|
1126
|
+
`)) : this.dataType.equals(g.JSON) ? (this._cachedLength = f.length, this._data = new TextEncoder().encode(
|
|
1127
|
+
`${f.map((U) => $.encodeString(U)).join(`
|
|
1128
|
+
`)}
|
|
1118
1129
|
`
|
|
1119
|
-
)) : this._data = new this.dataType.Array(
|
|
1130
|
+
)) : this._data = new this.dataType.Array(f).buffer;
|
|
1120
1131
|
}
|
|
1121
|
-
this.key = S, this.alignment =
|
|
1132
|
+
this.key = S, this.alignment = h, this.sampleOffset = i ?? 0, this._timeRange = n, this.gl = {
|
|
1122
1133
|
control: null,
|
|
1123
1134
|
buffer: null,
|
|
1124
1135
|
prevBuffer: 0,
|
|
1125
|
-
bufferUsage:
|
|
1136
|
+
bufferUsage: c
|
|
1126
1137
|
};
|
|
1127
1138
|
}
|
|
1128
|
-
static alloc({ capacity: t, dataType: e, ...
|
|
1139
|
+
static alloc({ capacity: t, dataType: e, ...n }) {
|
|
1129
1140
|
if (t === 0)
|
|
1130
1141
|
throw new Error("[Series] - cannot allocate an array of length 0");
|
|
1131
|
-
const
|
|
1132
|
-
data:
|
|
1142
|
+
const i = new new g(e).Array(t), c = new I({
|
|
1143
|
+
data: i.buffer,
|
|
1133
1144
|
dataType: e,
|
|
1134
|
-
...
|
|
1145
|
+
...n
|
|
1135
1146
|
});
|
|
1136
|
-
return
|
|
1147
|
+
return c.writePos = 0, c;
|
|
1137
1148
|
}
|
|
1138
|
-
static generateTimestamps(t, e,
|
|
1139
|
-
const
|
|
1140
|
-
for (let
|
|
1141
|
-
|
|
1142
|
-
return new
|
|
1149
|
+
static generateTimestamps(t, e, n) {
|
|
1150
|
+
const i = n.spanRange(e.span(t)), c = new BigInt64Array(t);
|
|
1151
|
+
for (let h = 0; h < t; h++)
|
|
1152
|
+
c[h] = BigInt(n.add(e.span(h)).valueOf());
|
|
1153
|
+
return new I({ data: c, dataType: g.TIMESTAMP, timeRange: i });
|
|
1143
1154
|
}
|
|
1144
1155
|
get refCount() {
|
|
1145
1156
|
return this._refCount;
|
|
1146
1157
|
}
|
|
1147
1158
|
static fromStrings(t, e) {
|
|
1148
|
-
const
|
|
1149
|
-
`)
|
|
1159
|
+
const n = new TextEncoder().encode(`${t.join(`
|
|
1160
|
+
`)}
|
|
1150
1161
|
`);
|
|
1151
|
-
return new
|
|
1162
|
+
return new I({ data: n, dataType: g.STRING, timeRange: e });
|
|
1152
1163
|
}
|
|
1153
1164
|
static fromJSON(t, e) {
|
|
1154
|
-
const
|
|
1155
|
-
t.map((
|
|
1156
|
-
`)
|
|
1165
|
+
const n = new TextEncoder().encode(
|
|
1166
|
+
`${t.map((i) => $.encodeString(i)).join(`
|
|
1167
|
+
`)}
|
|
1157
1168
|
`
|
|
1158
1169
|
);
|
|
1159
|
-
return new
|
|
1170
|
+
return new I({ data: n, dataType: g.JSON, timeRange: e });
|
|
1160
1171
|
}
|
|
1161
1172
|
acquire(t) {
|
|
1162
1173
|
this._refCount++, t != null && this.updateGLBuffer(t);
|
|
@@ -1178,45 +1189,56 @@ const St = o.union([
|
|
|
1178
1189
|
write(t) {
|
|
1179
1190
|
if (!t.dataType.equals(this.dataType))
|
|
1180
1191
|
throw new Error("buffer must be of the same type as this array");
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1192
|
+
return this.dataType.isVariable ? this.writeVariable(t) : this.writeFixed(t);
|
|
1193
|
+
}
|
|
1194
|
+
writeVariable(t) {
|
|
1195
|
+
if (this.writePos === B) return 0;
|
|
1196
|
+
const e = this.byteCapacity.valueOf() - this.writePos, n = t.subBytes(0, e);
|
|
1197
|
+
return this.writeToUnderlyingData(n), this.writePos += n.byteLength.valueOf(), this._cachedLength != null && (this._cachedLength += n.length, this.calculateCachedLength()), n.length;
|
|
1198
|
+
}
|
|
1199
|
+
writeFixed(t) {
|
|
1200
|
+
if (this.writePos === B) return 0;
|
|
1201
|
+
const e = this.capacity - this.writePos, n = t.sub(0, e);
|
|
1202
|
+
return this.writeToUnderlyingData(n), this._cachedLength = void 0, this.maybeRecomputeMinMax(n), this.writePos += n.length, n.length;
|
|
1203
|
+
}
|
|
1204
|
+
writeToUnderlyingData(t) {
|
|
1205
|
+
this.underlyingData.set(
|
|
1206
|
+
t.data,
|
|
1185
1207
|
this.writePos
|
|
1186
|
-
)
|
|
1208
|
+
);
|
|
1187
1209
|
}
|
|
1188
1210
|
/** @returns the underlying buffer backing this array. */
|
|
1189
1211
|
get buffer() {
|
|
1190
|
-
return this._data;
|
|
1212
|
+
return this._data instanceof ArrayBuffer || this._data instanceof SharedArrayBuffer ? this._data : this._data.buffer;
|
|
1191
1213
|
}
|
|
1192
1214
|
get underlyingData() {
|
|
1193
1215
|
return new this.dataType.Array(this._data);
|
|
1194
1216
|
}
|
|
1195
1217
|
/** @returns a native typed array with the proper data type. */
|
|
1196
1218
|
get data() {
|
|
1197
|
-
return this.writePos ===
|
|
1219
|
+
return this.writePos === B ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
|
|
1198
1220
|
}
|
|
1199
1221
|
toStrings() {
|
|
1200
|
-
if (!this.dataType.matches(
|
|
1222
|
+
if (!this.dataType.matches(g.STRING, g.UUID))
|
|
1201
1223
|
throw new Error("cannot convert non-string series to strings");
|
|
1202
|
-
return new TextDecoder().decode(this.
|
|
1224
|
+
return new TextDecoder().decode(this.underlyingData).split(`
|
|
1203
1225
|
`).slice(0, -1);
|
|
1204
1226
|
}
|
|
1205
1227
|
toUUIDs() {
|
|
1206
|
-
if (!this.dataType.equals(
|
|
1228
|
+
if (!this.dataType.equals(g.UUID))
|
|
1207
1229
|
throw new Error("cannot convert non-uuid series to uuids");
|
|
1208
|
-
const t =
|
|
1209
|
-
for (let
|
|
1210
|
-
const
|
|
1211
|
-
e[
|
|
1230
|
+
const t = g.UUID.density.valueOf(), e = Array(this.length);
|
|
1231
|
+
for (let n = 0; n < this.length; n++) {
|
|
1232
|
+
const i = this.underlyingData.slice(n * t, (n + 1) * t), c = Array.from(new Uint8Array(i), (h) => h.toString(16).padStart(2, "0")).join("").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5");
|
|
1233
|
+
e[n] = c;
|
|
1212
1234
|
}
|
|
1213
1235
|
return e;
|
|
1214
1236
|
}
|
|
1215
1237
|
parseJSON(t) {
|
|
1216
|
-
if (!this.dataType.equals(
|
|
1238
|
+
if (!this.dataType.equals(g.JSON))
|
|
1217
1239
|
throw new Error("cannot convert non-string series to strings");
|
|
1218
|
-
return new TextDecoder().decode(this.
|
|
1219
|
-
`).slice(0, -1).map((e) => t.parse(
|
|
1240
|
+
return new TextDecoder().decode(this.underlyingData).split(`
|
|
1241
|
+
`).slice(0, -1).map((e) => t.parse($.decodeString(e)));
|
|
1220
1242
|
}
|
|
1221
1243
|
/** @returns the time range of this array. */
|
|
1222
1244
|
get timeRange() {
|
|
@@ -1225,27 +1247,28 @@ const St = o.union([
|
|
|
1225
1247
|
}
|
|
1226
1248
|
/** @returns the capacity of the series in bytes. */
|
|
1227
1249
|
get byteCapacity() {
|
|
1228
|
-
return new
|
|
1250
|
+
return new x(this.underlyingData.byteLength);
|
|
1229
1251
|
}
|
|
1230
1252
|
/** @returns the capacity of the series in samples. */
|
|
1231
1253
|
get capacity() {
|
|
1232
|
-
return this.dataType.density.length(this.byteCapacity);
|
|
1254
|
+
return this.dataType.isVariable ? this.byteCapacity.valueOf() : this.dataType.density.length(this.byteCapacity);
|
|
1233
1255
|
}
|
|
1234
1256
|
/** @returns the length of the series in bytes. */
|
|
1235
1257
|
get byteLength() {
|
|
1236
|
-
return this.writePos ===
|
|
1258
|
+
return this.writePos === B ? this.byteCapacity : this.dataType.isVariable ? new x(this.writePos) : this.dataType.density.size(this.writePos);
|
|
1237
1259
|
}
|
|
1238
1260
|
/** @returns the number of samples in this array. */
|
|
1239
1261
|
get length() {
|
|
1240
|
-
return this._cachedLength != null ? this._cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos ===
|
|
1262
|
+
return this._cachedLength != null ? this._cachedLength : this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === B ? this.data.length : this.writePos;
|
|
1241
1263
|
}
|
|
1242
1264
|
calculateCachedLength() {
|
|
1243
1265
|
if (!this.dataType.isVariable)
|
|
1244
1266
|
throw new Error("cannot calculate length of a non-variable length data type");
|
|
1245
1267
|
let t = 0;
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1268
|
+
const e = [0];
|
|
1269
|
+
return this.data.forEach((n, i) => {
|
|
1270
|
+
n === Y && (t++, e.push(i + 1));
|
|
1271
|
+
}), this._cachedIndexes = e, this._cachedLength = t, t;
|
|
1249
1272
|
}
|
|
1250
1273
|
/**
|
|
1251
1274
|
* Creates a new array with a different data type.
|
|
@@ -1258,11 +1281,11 @@ const St = o.union([
|
|
|
1258
1281
|
*/
|
|
1259
1282
|
convert(t, e = 0) {
|
|
1260
1283
|
if (this.dataType.equals(t)) return this;
|
|
1261
|
-
const
|
|
1262
|
-
for (let
|
|
1263
|
-
|
|
1264
|
-
return new
|
|
1265
|
-
data:
|
|
1284
|
+
const n = new t.Array(this.length);
|
|
1285
|
+
for (let i = 0; i < this.length; i++)
|
|
1286
|
+
n[i] = ct(this.dataType, t, this.data[i], e);
|
|
1287
|
+
return new I({
|
|
1288
|
+
data: n.buffer,
|
|
1266
1289
|
dataType: t,
|
|
1267
1290
|
timeRange: this._timeRange,
|
|
1268
1291
|
sampleOffset: e,
|
|
@@ -1272,14 +1295,14 @@ const St = o.union([
|
|
|
1272
1295
|
}
|
|
1273
1296
|
calcRawMax() {
|
|
1274
1297
|
if (this.length === 0) return -1 / 0;
|
|
1275
|
-
if (this.dataType.equals(
|
|
1298
|
+
if (this.dataType.equals(g.TIMESTAMP))
|
|
1276
1299
|
this._cachedMax = this.data[this.data.length - 1];
|
|
1277
1300
|
else if (this.dataType.usesBigInt) {
|
|
1278
1301
|
const t = this.data;
|
|
1279
|
-
this._cachedMax = t.reduce((e,
|
|
1302
|
+
this._cachedMax = t.reduce((e, n) => e > n ? e : n);
|
|
1280
1303
|
} else {
|
|
1281
1304
|
const t = this.data;
|
|
1282
|
-
this._cachedMax = t.reduce((e,
|
|
1305
|
+
this._cachedMax = t.reduce((e, n) => e > n ? e : n);
|
|
1283
1306
|
}
|
|
1284
1307
|
return this._cachedMax;
|
|
1285
1308
|
}
|
|
@@ -1287,18 +1310,17 @@ const St = o.union([
|
|
|
1287
1310
|
get max() {
|
|
1288
1311
|
if (this.dataType.isVariable)
|
|
1289
1312
|
throw new Error("cannot calculate maximum on a variable length data type");
|
|
1290
|
-
return this.writePos === 0 ? -1 / 0 : (this._cachedMax
|
|
1313
|
+
return this.writePos === 0 ? -1 / 0 : (this._cachedMax ?? (this._cachedMax = this.calcRawMax()), C(this._cachedMax, this.sampleOffset));
|
|
1291
1314
|
}
|
|
1292
1315
|
calcRawMin() {
|
|
1293
1316
|
if (this.length === 0) return 1 / 0;
|
|
1294
|
-
if (this.dataType.equals(
|
|
1295
|
-
this._cachedMin = this.data[0];
|
|
1317
|
+
if (this.dataType.equals(g.TIMESTAMP)) this._cachedMin = this.data[0];
|
|
1296
1318
|
else if (this.dataType.usesBigInt) {
|
|
1297
1319
|
const t = this.data;
|
|
1298
|
-
this._cachedMin = t.reduce((e,
|
|
1320
|
+
this._cachedMin = t.reduce((e, n) => e < n ? e : n);
|
|
1299
1321
|
} else {
|
|
1300
1322
|
const t = this.data;
|
|
1301
|
-
this._cachedMin = t.reduce((e,
|
|
1323
|
+
this._cachedMin = t.reduce((e, n) => e < n ? e : n);
|
|
1302
1324
|
}
|
|
1303
1325
|
return this._cachedMin;
|
|
1304
1326
|
}
|
|
@@ -1306,11 +1328,11 @@ const St = o.union([
|
|
|
1306
1328
|
get min() {
|
|
1307
1329
|
if (this.dataType.isVariable)
|
|
1308
1330
|
throw new Error("cannot calculate minimum on a variable length data type");
|
|
1309
|
-
return this.writePos === 0 ? 1 / 0 : (this._cachedMin
|
|
1331
|
+
return this.writePos === 0 ? 1 / 0 : (this._cachedMin ?? (this._cachedMin = this.calcRawMin()), C(this._cachedMin, this.sampleOffset));
|
|
1310
1332
|
}
|
|
1311
1333
|
/** @returns the bounds of this array. */
|
|
1312
1334
|
get bounds() {
|
|
1313
|
-
return
|
|
1335
|
+
return L(Number(this.min), Number(this.max));
|
|
1314
1336
|
}
|
|
1315
1337
|
maybeRecomputeMinMax(t) {
|
|
1316
1338
|
if (this._cachedMin != null) {
|
|
@@ -1326,36 +1348,48 @@ const St = o.union([
|
|
|
1326
1348
|
this.max, this.min;
|
|
1327
1349
|
}
|
|
1328
1350
|
get range() {
|
|
1329
|
-
return
|
|
1351
|
+
return C(this.max, -this.min);
|
|
1352
|
+
}
|
|
1353
|
+
atAlignment(t, e) {
|
|
1354
|
+
const n = Number(t - this.alignment);
|
|
1355
|
+
if (n < 0 || n >= this.length) {
|
|
1356
|
+
if (e === !0) throw new Error(`[series] - no value at index ${n}`);
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
return this.at(n, e);
|
|
1330
1360
|
}
|
|
1331
1361
|
at(t, e) {
|
|
1332
1362
|
if (this.dataType.isVariable) return this.atVariable(t, e ?? !1);
|
|
1333
1363
|
t < 0 && (t = this.length + t);
|
|
1334
|
-
const
|
|
1335
|
-
if (
|
|
1364
|
+
const n = this.data[t];
|
|
1365
|
+
if (n == null) {
|
|
1336
1366
|
if (e === !0) throw new Error(`[series] - no value at index ${t}`);
|
|
1337
1367
|
return;
|
|
1338
1368
|
}
|
|
1339
|
-
return
|
|
1369
|
+
return C(n, this.sampleOffset);
|
|
1340
1370
|
}
|
|
1341
1371
|
atVariable(t, e) {
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1372
|
+
let n = 0, i = 0;
|
|
1373
|
+
if (this._cachedIndexes != null)
|
|
1374
|
+
n = this._cachedIndexes[t], i = this._cachedIndexes[t + 1] - 1;
|
|
1375
|
+
else {
|
|
1376
|
+
t < 0 && (t = this.length + t);
|
|
1377
|
+
for (let h = 0; h < this.data.length; h++)
|
|
1378
|
+
if (this.data[h] === Y) {
|
|
1379
|
+
if (t === 0) {
|
|
1380
|
+
i = h;
|
|
1381
|
+
break;
|
|
1382
|
+
}
|
|
1383
|
+
n = h + 1, t--;
|
|
1349
1384
|
}
|
|
1350
|
-
|
|
1385
|
+
if (i === 0 && (i = this.data.length), n >= i || t > 0) {
|
|
1386
|
+
if (e) throw new Error(`[series] - no value at index ${t}`);
|
|
1387
|
+
return;
|
|
1351
1388
|
}
|
|
1352
|
-
if (u === 0 && (u = this.data.length), r >= u || t > 0) {
|
|
1353
|
-
if (e) throw new Error(`[series] - no value at index ${t}`);
|
|
1354
|
-
return;
|
|
1355
1389
|
}
|
|
1356
|
-
const
|
|
1357
|
-
return this.dataType.equals(
|
|
1358
|
-
JSON.parse(new TextDecoder().decode(
|
|
1390
|
+
const c = this.data.slice(n, i);
|
|
1391
|
+
return this.dataType.equals(g.STRING) ? new TextDecoder().decode(c) : nt(
|
|
1392
|
+
JSON.parse(new TextDecoder().decode(c))
|
|
1359
1393
|
);
|
|
1360
1394
|
}
|
|
1361
1395
|
/**
|
|
@@ -1364,34 +1398,34 @@ const St = o.union([
|
|
|
1364
1398
|
* @param value the value to search for.
|
|
1365
1399
|
*/
|
|
1366
1400
|
binarySearch(t) {
|
|
1367
|
-
let e = 0,
|
|
1368
|
-
const
|
|
1369
|
-
for (; e <=
|
|
1370
|
-
const
|
|
1371
|
-
if (
|
|
1372
|
-
|
|
1401
|
+
let e = 0, n = this.length - 1;
|
|
1402
|
+
const i = rt(t);
|
|
1403
|
+
for (; e <= n; ) {
|
|
1404
|
+
const c = Math.floor((e + n) / 2), h = i(this.at(c, !0), t);
|
|
1405
|
+
if (h === 0) return c;
|
|
1406
|
+
h < 0 ? e = c + 1 : n = c - 1;
|
|
1373
1407
|
}
|
|
1374
1408
|
return e;
|
|
1375
1409
|
}
|
|
1376
1410
|
updateGLBuffer(t) {
|
|
1377
|
-
if (this.gl.control = t, !this.dataType.equals(
|
|
1411
|
+
if (this.gl.control = t, !this.dataType.equals(g.FLOAT32))
|
|
1378
1412
|
throw new Error("Only FLOAT32 arrays can be used in WebGL");
|
|
1379
|
-
const { buffer: e, bufferUsage:
|
|
1380
|
-
if (e == null && (this.gl.buffer = t.createBuffer()), this.writePos !==
|
|
1381
|
-
if (t.bindBuffer(t.ARRAY_BUFFER, this.gl.buffer), this.writePos !==
|
|
1382
|
-
|
|
1383
|
-
const
|
|
1384
|
-
t.bufferSubData(t.ARRAY_BUFFER,
|
|
1413
|
+
const { buffer: e, bufferUsage: n, prevBuffer: i } = this.gl;
|
|
1414
|
+
if (e == null && (this.gl.buffer = t.createBuffer()), this.writePos !== i)
|
|
1415
|
+
if (t.bindBuffer(t.ARRAY_BUFFER, this.gl.buffer), this.writePos !== B) {
|
|
1416
|
+
i === 0 && t.bufferData(t.ARRAY_BUFFER, this.byteCapacity.valueOf(), t.STATIC_DRAW);
|
|
1417
|
+
const c = this.dataType.density.size(i).valueOf(), h = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
|
|
1418
|
+
t.bufferSubData(t.ARRAY_BUFFER, c, h.buffer), this.gl.prevBuffer = this.writePos;
|
|
1385
1419
|
} else
|
|
1386
1420
|
t.bufferData(
|
|
1387
1421
|
t.ARRAY_BUFFER,
|
|
1388
|
-
this.
|
|
1389
|
-
|
|
1390
|
-
), this.gl.prevBuffer =
|
|
1422
|
+
this.underlyingData,
|
|
1423
|
+
n === "static" ? t.STATIC_DRAW : t.DYNAMIC_DRAW
|
|
1424
|
+
), this.gl.prevBuffer = B;
|
|
1391
1425
|
}
|
|
1392
1426
|
as(t) {
|
|
1393
1427
|
if (t === "string") {
|
|
1394
|
-
if (!this.dataType.equals(
|
|
1428
|
+
if (!this.dataType.equals(g.STRING))
|
|
1395
1429
|
throw new Error(
|
|
1396
1430
|
`cannot convert series of type ${this.dataType.toString()} to string`
|
|
1397
1431
|
);
|
|
@@ -1405,7 +1439,7 @@ const St = o.union([
|
|
|
1405
1439
|
return this;
|
|
1406
1440
|
}
|
|
1407
1441
|
if (t === "bigint") {
|
|
1408
|
-
if (!this.dataType.equals(
|
|
1442
|
+
if (!this.dataType.equals(g.INT64))
|
|
1409
1443
|
throw new Error(
|
|
1410
1444
|
`cannot convert series of type ${this.dataType.toString()} to bigint`
|
|
1411
1445
|
);
|
|
@@ -1434,7 +1468,7 @@ const St = o.union([
|
|
|
1434
1468
|
};
|
|
1435
1469
|
}
|
|
1436
1470
|
get alignmentBounds() {
|
|
1437
|
-
return
|
|
1471
|
+
return L(this.alignment, this.alignment + BigInt(this.length));
|
|
1438
1472
|
}
|
|
1439
1473
|
maybeGarbageCollectGLBuffer(t) {
|
|
1440
1474
|
this.gl.buffer != null && (t.deleteBuffer(this.gl.buffer), this.gl.buffer = null, this.gl.prevBuffer = 0, this.gl.control = null);
|
|
@@ -1445,16 +1479,32 @@ const St = o.union([
|
|
|
1445
1479
|
}
|
|
1446
1480
|
[Symbol.iterator]() {
|
|
1447
1481
|
if (this.dataType.isVariable) {
|
|
1448
|
-
const t = new
|
|
1449
|
-
return this.dataType.equals(
|
|
1482
|
+
const t = new gt(this);
|
|
1483
|
+
return this.dataType.equals(g.JSON) ? new mt(t) : t;
|
|
1450
1484
|
}
|
|
1451
|
-
return new
|
|
1485
|
+
return new Ot(this);
|
|
1452
1486
|
}
|
|
1453
1487
|
slice(t, e) {
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1488
|
+
return this.sliceSub(!1, t, e);
|
|
1489
|
+
}
|
|
1490
|
+
sub(t, e) {
|
|
1491
|
+
return this.sliceSub(!0, t, e);
|
|
1492
|
+
}
|
|
1493
|
+
subIterator(t, e) {
|
|
1494
|
+
return new G(this, t, e ?? this.length);
|
|
1495
|
+
}
|
|
1496
|
+
subAlignmentIterator(t, e) {
|
|
1497
|
+
return new G(
|
|
1498
|
+
this,
|
|
1499
|
+
Number(t - this.alignment),
|
|
1500
|
+
Number(e - this.alignment)
|
|
1501
|
+
);
|
|
1502
|
+
}
|
|
1503
|
+
subBytes(t, e) {
|
|
1504
|
+
if (t >= 0 && (e == null || e >= this.byteLength.valueOf())) return this;
|
|
1505
|
+
const n = this.data.subarray(t, e);
|
|
1506
|
+
return new I({
|
|
1507
|
+
data: n,
|
|
1458
1508
|
dataType: this.dataType,
|
|
1459
1509
|
timeRange: this._timeRange,
|
|
1460
1510
|
sampleOffset: this.sampleOffset,
|
|
@@ -1462,26 +1512,54 @@ const St = o.union([
|
|
|
1462
1512
|
alignment: this.alignment + BigInt(t)
|
|
1463
1513
|
});
|
|
1464
1514
|
}
|
|
1515
|
+
sliceSub(t, e, n) {
|
|
1516
|
+
if (e <= 0 && (n == null || n >= this.length)) return this;
|
|
1517
|
+
let i;
|
|
1518
|
+
return t ? i = this.data.subarray(e, n) : i = this.data.slice(e, n), new I({
|
|
1519
|
+
data: i,
|
|
1520
|
+
dataType: this.dataType,
|
|
1521
|
+
timeRange: this._timeRange,
|
|
1522
|
+
sampleOffset: this.sampleOffset,
|
|
1523
|
+
glBufferUsage: this.gl.bufferUsage,
|
|
1524
|
+
alignment: this.alignment + BigInt(e)
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1465
1527
|
reAlign(t) {
|
|
1466
|
-
return new
|
|
1528
|
+
return new I({
|
|
1467
1529
|
data: this.buffer,
|
|
1468
1530
|
dataType: this.dataType,
|
|
1469
|
-
timeRange:
|
|
1531
|
+
timeRange: E.ZERO,
|
|
1470
1532
|
sampleOffset: this.sampleOffset,
|
|
1471
1533
|
glBufferUsage: "static",
|
|
1472
1534
|
alignment: t
|
|
1473
1535
|
});
|
|
1474
1536
|
}
|
|
1475
1537
|
};
|
|
1476
|
-
s(
|
|
1477
|
-
timeRange:
|
|
1478
|
-
dataType:
|
|
1479
|
-
alignment:
|
|
1480
|
-
data: o.union([
|
|
1481
|
-
glBufferUsage:
|
|
1482
|
-
})), s(
|
|
1483
|
-
let
|
|
1484
|
-
class
|
|
1538
|
+
s(I, "crudeZ", o.object({
|
|
1539
|
+
timeRange: E.z.optional(),
|
|
1540
|
+
dataType: g.z,
|
|
1541
|
+
alignment: at.optional(),
|
|
1542
|
+
data: o.union([ht, dt, o.instanceof(ArrayBuffer)]),
|
|
1543
|
+
glBufferUsage: lt.optional().default("static").optional()
|
|
1544
|
+
})), s(I, "z", I.crudeZ.transform((t) => new I(t)));
|
|
1545
|
+
let V = I;
|
|
1546
|
+
class G {
|
|
1547
|
+
constructor(t, e, n) {
|
|
1548
|
+
s(this, "series");
|
|
1549
|
+
s(this, "end");
|
|
1550
|
+
s(this, "index");
|
|
1551
|
+
this.series = t;
|
|
1552
|
+
const i = L(0, t.length);
|
|
1553
|
+
this.end = k(i, n), this.index = k(i, e);
|
|
1554
|
+
}
|
|
1555
|
+
next() {
|
|
1556
|
+
return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
|
|
1557
|
+
}
|
|
1558
|
+
[Symbol.iterator]() {
|
|
1559
|
+
return this;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
class gt {
|
|
1485
1563
|
constructor(t) {
|
|
1486
1564
|
s(this, "series");
|
|
1487
1565
|
s(this, "index");
|
|
@@ -1494,38 +1572,38 @@ class it {
|
|
|
1494
1572
|
}
|
|
1495
1573
|
next() {
|
|
1496
1574
|
const t = this.index, e = this.series.data;
|
|
1497
|
-
for (; this.index < e.length && e[this.index] !==
|
|
1498
|
-
const
|
|
1499
|
-
return t ===
|
|
1575
|
+
for (; this.index < e.length && e[this.index] !== Y; ) this.index++;
|
|
1576
|
+
const n = this.index;
|
|
1577
|
+
return t === n ? { done: !0, value: void 0 } : (this.index++, { done: !1, value: this.decoder.decode(this.series.buffer.slice(t, n)) });
|
|
1500
1578
|
}
|
|
1501
1579
|
[Symbol.iterator]() {
|
|
1502
1580
|
return this;
|
|
1503
1581
|
}
|
|
1504
1582
|
}
|
|
1505
|
-
var
|
|
1506
|
-
class
|
|
1583
|
+
var J, W;
|
|
1584
|
+
class mt {
|
|
1507
1585
|
constructor(t) {
|
|
1508
1586
|
s(this, "wrapped");
|
|
1509
|
-
s(this,
|
|
1587
|
+
s(this, J, "JSONSeriesIterator");
|
|
1510
1588
|
this.wrapped = t;
|
|
1511
1589
|
}
|
|
1512
1590
|
next() {
|
|
1513
1591
|
const t = this.wrapped.next();
|
|
1514
1592
|
return t.done === !0 ? { done: !0, value: void 0 } : {
|
|
1515
1593
|
done: !1,
|
|
1516
|
-
value:
|
|
1594
|
+
value: $.decodeString(t.value)
|
|
1517
1595
|
};
|
|
1518
1596
|
}
|
|
1519
|
-
[(
|
|
1597
|
+
[(W = Symbol.iterator, J = Symbol.toStringTag, W)]() {
|
|
1520
1598
|
return this;
|
|
1521
1599
|
}
|
|
1522
1600
|
}
|
|
1523
|
-
var
|
|
1524
|
-
class
|
|
1601
|
+
var j, K;
|
|
1602
|
+
class Ot {
|
|
1525
1603
|
constructor(t) {
|
|
1526
1604
|
s(this, "series");
|
|
1527
1605
|
s(this, "index");
|
|
1528
|
-
s(this,
|
|
1606
|
+
s(this, j, "SeriesIterator");
|
|
1529
1607
|
this.series = t, this.index = 0;
|
|
1530
1608
|
}
|
|
1531
1609
|
next() {
|
|
@@ -1534,101 +1612,184 @@ class ut {
|
|
|
1534
1612
|
value: this.series.at(this.index++, !0)
|
|
1535
1613
|
};
|
|
1536
1614
|
}
|
|
1537
|
-
[(
|
|
1615
|
+
[(K = Symbol.iterator, j = Symbol.toStringTag, K)]() {
|
|
1538
1616
|
return this;
|
|
1539
1617
|
}
|
|
1540
1618
|
}
|
|
1541
|
-
const
|
|
1542
|
-
class
|
|
1619
|
+
const C = (l, t) => typeof l == "bigint" && typeof t == "bigint" || typeof l == "number" && typeof t == "number" ? l + t : t === 0 ? l : l === 0 ? t : Number(l) + Number(t);
|
|
1620
|
+
class Ct {
|
|
1543
1621
|
constructor(t) {
|
|
1544
1622
|
s(this, "series");
|
|
1545
1623
|
if (t.length !== 0) {
|
|
1546
1624
|
const e = t[0].dataType;
|
|
1547
|
-
for (let
|
|
1548
|
-
if (!t[
|
|
1625
|
+
for (let n = 1; n < t.length; n++)
|
|
1626
|
+
if (!t[n].dataType.equals(e))
|
|
1549
1627
|
throw new Error("[multi-series] - series must have the same data type");
|
|
1550
1628
|
}
|
|
1551
1629
|
this.series = t;
|
|
1552
1630
|
}
|
|
1553
1631
|
as(t) {
|
|
1554
|
-
if (!new
|
|
1632
|
+
if (!new g(t).equals(this.dataType))
|
|
1555
1633
|
throw new Error(
|
|
1556
1634
|
`cannot convert series of type ${this.dataType.toString()} to ${t.toString()}`
|
|
1557
1635
|
);
|
|
1558
1636
|
return this;
|
|
1559
1637
|
}
|
|
1560
1638
|
get dataType() {
|
|
1561
|
-
return this.series.length === 0 ?
|
|
1639
|
+
return this.series.length === 0 ? g.UNKNOWN : this.series[0].dataType;
|
|
1562
1640
|
}
|
|
1563
1641
|
get timeRange() {
|
|
1564
|
-
return this.series.length === 0 ?
|
|
1642
|
+
return this.series.length === 0 ? E.ZERO : new E(
|
|
1565
1643
|
this.series[0].timeRange.start,
|
|
1566
1644
|
this.series[this.series.length - 1].timeRange.end
|
|
1567
1645
|
);
|
|
1568
1646
|
}
|
|
1647
|
+
get alignment() {
|
|
1648
|
+
return this.series.length === 0 ? 0n : this.series[0].alignment;
|
|
1649
|
+
}
|
|
1650
|
+
get alignmentBounds() {
|
|
1651
|
+
return this.series.length === 0 ? L(0n, 0n) : L(
|
|
1652
|
+
this.series[0].alignmentBounds.lower,
|
|
1653
|
+
this.series[this.series.length - 1].alignmentBounds.upper
|
|
1654
|
+
);
|
|
1655
|
+
}
|
|
1569
1656
|
push(t) {
|
|
1570
1657
|
this.series.push(t);
|
|
1571
1658
|
}
|
|
1572
1659
|
get length() {
|
|
1573
1660
|
return this.series.reduce((t, e) => t + e.length, 0);
|
|
1574
1661
|
}
|
|
1662
|
+
atAlignment(t, e) {
|
|
1663
|
+
if (this.series.length === 0) {
|
|
1664
|
+
if (e) throw new Error(`[series] - no value at alignment ${t}`);
|
|
1665
|
+
return;
|
|
1666
|
+
}
|
|
1667
|
+
for (const n of this.series)
|
|
1668
|
+
if (D(n.alignmentBounds, t))
|
|
1669
|
+
return n.atAlignment(t, e);
|
|
1670
|
+
if (e) throw new Error(`[series] - no value at alignment ${t}`);
|
|
1671
|
+
}
|
|
1575
1672
|
at(t, e = !1) {
|
|
1576
1673
|
t < 0 && (t = this.length + t);
|
|
1577
|
-
for (const
|
|
1578
|
-
if (t <
|
|
1579
|
-
t -=
|
|
1674
|
+
for (const n of this.series) {
|
|
1675
|
+
if (t < n.length) return n.at(t, e);
|
|
1676
|
+
t -= n.length;
|
|
1580
1677
|
}
|
|
1581
1678
|
if (e) throw new Error(`[series] - no value at index ${t}`);
|
|
1582
1679
|
}
|
|
1680
|
+
subIterator(t, e) {
|
|
1681
|
+
return new F(this, t, e ?? this.length);
|
|
1682
|
+
}
|
|
1683
|
+
subAlignmentIterator(t, e) {
|
|
1684
|
+
if (t >= this.alignmentBounds.upper || e <= this.alignmentBounds.lower)
|
|
1685
|
+
return q;
|
|
1686
|
+
let n = 0;
|
|
1687
|
+
for (let c = 0; c < this.series.length; c++) {
|
|
1688
|
+
const h = this.series[c];
|
|
1689
|
+
if (t < h.alignment) break;
|
|
1690
|
+
if (t >= h.alignmentBounds.upper) n += h.length;
|
|
1691
|
+
else if (D(h.alignmentBounds, t)) {
|
|
1692
|
+
n += Number(t - h.alignment);
|
|
1693
|
+
break;
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
let i = 0;
|
|
1697
|
+
for (let c = 0; c < this.series.length; c++) {
|
|
1698
|
+
const h = this.series[c];
|
|
1699
|
+
if (e < h.alignment) break;
|
|
1700
|
+
if (e >= h.alignmentBounds.upper) i += h.length;
|
|
1701
|
+
else if (D(h.alignmentBounds, e)) {
|
|
1702
|
+
i += Number(e - h.alignment);
|
|
1703
|
+
break;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
return new F(this, n, i);
|
|
1707
|
+
}
|
|
1708
|
+
subAlignmentSpanIterator(t, e) {
|
|
1709
|
+
if (t >= this.alignmentBounds.upper) return q;
|
|
1710
|
+
let n = 0;
|
|
1711
|
+
for (let i = 0; i < this.series.length; i++) {
|
|
1712
|
+
const c = this.series[i];
|
|
1713
|
+
if (t < c.alignment) break;
|
|
1714
|
+
if (t >= c.alignmentBounds.upper) n += c.length;
|
|
1715
|
+
else if (D(c.alignmentBounds, t)) {
|
|
1716
|
+
n += Number(t - c.alignment);
|
|
1717
|
+
break;
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
return new F(this, n, n + e);
|
|
1721
|
+
}
|
|
1583
1722
|
get byteLength() {
|
|
1584
|
-
return new
|
|
1723
|
+
return new x(this.series.reduce((t, e) => t + e.byteLength.valueOf(), 0));
|
|
1585
1724
|
}
|
|
1586
1725
|
get data() {
|
|
1587
1726
|
const t = new this.dataType.Array(this.length);
|
|
1588
1727
|
let e = 0;
|
|
1589
|
-
for (const
|
|
1590
|
-
t.set(
|
|
1728
|
+
for (const n of this.series)
|
|
1729
|
+
t.set(n.data, e), e += n.length;
|
|
1591
1730
|
return new this.dataType.Array(t);
|
|
1592
1731
|
}
|
|
1732
|
+
traverseAlignment(t, e) {
|
|
1733
|
+
const n = this.series.map((i) => i.alignmentBounds);
|
|
1734
|
+
return st(n, t, e);
|
|
1735
|
+
}
|
|
1736
|
+
distance(t, e) {
|
|
1737
|
+
const n = this.series.map((i) => i.alignmentBounds);
|
|
1738
|
+
return it(n, t, e);
|
|
1739
|
+
}
|
|
1593
1740
|
[Symbol.iterator]() {
|
|
1594
1741
|
return this.series.length === 0 ? {
|
|
1595
1742
|
next() {
|
|
1596
1743
|
return { done: !0, value: void 0 };
|
|
1597
1744
|
}
|
|
1598
|
-
} : new
|
|
1745
|
+
} : new yt(this.series);
|
|
1599
1746
|
}
|
|
1600
1747
|
}
|
|
1601
|
-
var
|
|
1602
|
-
class
|
|
1748
|
+
var z, H;
|
|
1749
|
+
class yt {
|
|
1603
1750
|
constructor(t) {
|
|
1604
1751
|
s(this, "series");
|
|
1605
1752
|
s(this, "seriesIndex");
|
|
1606
1753
|
s(this, "internal");
|
|
1607
|
-
s(this,
|
|
1754
|
+
s(this, z, "MultiSeriesIterator");
|
|
1608
1755
|
this.series = t, this.seriesIndex = 0, this.internal = t[0][Symbol.iterator]();
|
|
1609
1756
|
}
|
|
1610
1757
|
next() {
|
|
1611
1758
|
const t = this.internal.next();
|
|
1612
1759
|
return t.done === !1 ? t : this.seriesIndex === this.series.length - 1 ? { done: !0, value: void 0 } : (this.internal = this.series[++this.seriesIndex][Symbol.iterator](), this.next());
|
|
1613
1760
|
}
|
|
1614
|
-
[(
|
|
1761
|
+
[(H = Symbol.iterator, z = Symbol.toStringTag, H)]() {
|
|
1762
|
+
return this;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
class F {
|
|
1766
|
+
constructor(t, e, n) {
|
|
1767
|
+
s(this, "series");
|
|
1768
|
+
s(this, "index");
|
|
1769
|
+
s(this, "end");
|
|
1770
|
+
this.series = t, this.end = n, this.index = e;
|
|
1771
|
+
}
|
|
1772
|
+
next() {
|
|
1773
|
+
return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
|
|
1774
|
+
}
|
|
1775
|
+
[Symbol.iterator]() {
|
|
1615
1776
|
return this;
|
|
1616
1777
|
}
|
|
1617
1778
|
}
|
|
1618
1779
|
export {
|
|
1619
1780
|
b as D,
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1781
|
+
Ct as M,
|
|
1782
|
+
P as R,
|
|
1783
|
+
V as S,
|
|
1623
1784
|
m as T,
|
|
1624
|
-
|
|
1785
|
+
C as a,
|
|
1625
1786
|
y as b,
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1787
|
+
E as c,
|
|
1788
|
+
g as d,
|
|
1789
|
+
x as e,
|
|
1790
|
+
_ as f,
|
|
1791
|
+
ct as g,
|
|
1792
|
+
Rt as h,
|
|
1793
|
+
ft as i,
|
|
1794
|
+
xt as t
|
|
1634
1795
|
};
|