@synnaxlabs/freighter 0.42.1 → 0.42.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/freighter.cjs +3 -3
- package/dist/freighter.js +301 -300
- package/package.json +3 -3
package/dist/freighter.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var S = (s, e, t) =>
|
|
1
|
+
var kt = Object.defineProperty;
|
|
2
|
+
var Pt = (s, e, t) => e in s ? kt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var S = (s, e, t) => Pt(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import Y, { z as i } from "zod";
|
|
5
|
-
const
|
|
5
|
+
const jt = (s) => {
|
|
6
6
|
const e = s.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
|
|
7
7
|
return e.length > 1 && e[0] === e[0].toUpperCase() && e[1] === e[1].toUpperCase() || e.length === 0 ? e : e[0].toLowerCase() + e.slice(1);
|
|
8
|
-
},
|
|
8
|
+
}, ht = (s) => {
|
|
9
9
|
const e = (t, r = Ie) => {
|
|
10
10
|
if (typeof t == "string") return s(t);
|
|
11
11
|
if (Array.isArray(t)) return t.map((o) => e(o, r));
|
|
12
12
|
if (!be(t)) return t;
|
|
13
|
-
r =
|
|
13
|
+
r = zt(r);
|
|
14
14
|
const n = {}, a = t;
|
|
15
15
|
return Object.keys(a).forEach((o) => {
|
|
16
16
|
let c = a[o];
|
|
17
17
|
const d = s(o);
|
|
18
|
-
r.recursive && (be(c) ?
|
|
18
|
+
r.recursive && (be(c) ? qe(c, r.keepTypesOnRecursion) || (c = e(c, r)) : r.recursiveInArray && We(c) && (c = [...c].map((p) => {
|
|
19
19
|
let y = p;
|
|
20
|
-
return be(p) ?
|
|
20
|
+
return be(p) ? qe(y, r.keepTypesOnRecursion) || (y = e(p, r)) : We(p) && (y = e({ key: p }, r).key), y;
|
|
21
21
|
}))), n[d] = c;
|
|
22
22
|
}), n;
|
|
23
23
|
};
|
|
24
24
|
return e;
|
|
25
|
-
}, De =
|
|
25
|
+
}, De = ht(jt), Ft = (s) => (
|
|
26
26
|
// Don't convert the first character and don't convert a character that is after a
|
|
27
27
|
// non-alphanumeric character
|
|
28
28
|
s.replace(
|
|
29
29
|
/([a-z0-9])([A-Z])/g,
|
|
30
30
|
(e, t, r) => `${t}_${r.toLowerCase()}`
|
|
31
31
|
)
|
|
32
|
-
),
|
|
32
|
+
), ut = ht(Ft), Ie = {
|
|
33
33
|
recursive: !0,
|
|
34
34
|
recursiveInArray: !0,
|
|
35
35
|
keepTypesOnRecursion: [Number, String, Uint8Array]
|
|
36
|
-
},
|
|
37
|
-
var
|
|
38
|
-
function
|
|
36
|
+
}, zt = (s = Ie) => (s.recursive == null ? s = Ie : s.recursiveInArray ?? (s.recursiveInArray = !1), s), We = (s) => s != null && Array.isArray(s), be = (s) => s != null && typeof s == "object" && !Array.isArray(s), qe = (s, e) => (e || []).some((t) => s instanceof t), Le = (s) => s != null && typeof s == "object" && !Array.isArray(s);
|
|
37
|
+
var Yt = Object.defineProperty, Wt = (s, e, t) => e in s ? Yt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, V = (s, e, t) => Wt(s, typeof e != "symbol" ? e + "" : e, t);
|
|
38
|
+
function qt(s) {
|
|
39
39
|
const e = s.length;
|
|
40
40
|
let t = 0, r = 0;
|
|
41
41
|
for (; r < e; ) {
|
|
@@ -55,7 +55,7 @@ function Wt(s) {
|
|
|
55
55
|
}
|
|
56
56
|
return t;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Vt(s, e, t) {
|
|
59
59
|
const r = s.length;
|
|
60
60
|
let n = t, a = 0;
|
|
61
61
|
for (; a < r; ) {
|
|
@@ -75,15 +75,15 @@ function qt(s, e, t) {
|
|
|
75
75
|
e[n++] = o & 63 | 128;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
const
|
|
79
|
-
function Zt(s, e, t) {
|
|
80
|
-
Vt.encodeInto(s, e.subarray(t));
|
|
81
|
-
}
|
|
78
|
+
const Zt = new TextEncoder(), Ht = 50;
|
|
82
79
|
function Gt(s, e, t) {
|
|
83
|
-
|
|
80
|
+
Zt.encodeInto(s, e.subarray(t));
|
|
81
|
+
}
|
|
82
|
+
function Kt(s, e, t) {
|
|
83
|
+
s.length > Ht ? Gt(s, e, t) : Vt(s, e, t);
|
|
84
84
|
}
|
|
85
|
-
const
|
|
86
|
-
function
|
|
85
|
+
const Jt = 4096;
|
|
86
|
+
function ct(s, e, t) {
|
|
87
87
|
let r = e;
|
|
88
88
|
const n = r + t, a = [];
|
|
89
89
|
let o = "";
|
|
@@ -103,17 +103,17 @@ function ut(s, e, t) {
|
|
|
103
103
|
l > 65535 && (l -= 65536, a.push(l >>> 10 & 1023 | 55296), l = 56320 | l & 1023), a.push(l);
|
|
104
104
|
} else
|
|
105
105
|
a.push(c);
|
|
106
|
-
a.length >=
|
|
106
|
+
a.length >= Jt && (o += String.fromCharCode(...a), a.length = 0);
|
|
107
107
|
}
|
|
108
108
|
return a.length > 0 && (o += String.fromCharCode(...a)), o;
|
|
109
109
|
}
|
|
110
|
-
const
|
|
111
|
-
function
|
|
110
|
+
const Xt = new TextDecoder(), Qt = 200;
|
|
111
|
+
function _t(s, e, t) {
|
|
112
112
|
const r = s.subarray(e, e + t);
|
|
113
|
-
return
|
|
113
|
+
return Xt.decode(r);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
return t >
|
|
115
|
+
function es(s, e, t) {
|
|
116
|
+
return t > Qt ? _t(s, e, t) : ct(s, e, t);
|
|
117
117
|
}
|
|
118
118
|
let ce = class {
|
|
119
119
|
constructor(e, t) {
|
|
@@ -131,26 +131,26 @@ let ce = class {
|
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
133
|
const J = 4294967295;
|
|
134
|
-
function
|
|
134
|
+
function ts(s, e, t) {
|
|
135
135
|
const r = t / 4294967296, n = t;
|
|
136
136
|
s.setUint32(e, r), s.setUint32(e + 4, n);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function lt(s, e, t) {
|
|
139
139
|
const r = Math.floor(t / 4294967296), n = t;
|
|
140
140
|
s.setUint32(e, r), s.setUint32(e + 4, n);
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function dt(s, e) {
|
|
143
143
|
const t = s.getInt32(e), r = s.getUint32(e + 4);
|
|
144
144
|
return t * 4294967296 + r;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function ss(s, e) {
|
|
147
147
|
const t = s.getUint32(e), r = s.getUint32(e + 4);
|
|
148
148
|
return t * 4294967296 + r;
|
|
149
149
|
}
|
|
150
|
-
const
|
|
151
|
-
function
|
|
152
|
-
if (s >= 0 && e >= 0 && s <=
|
|
153
|
-
if (e === 0 && s <=
|
|
150
|
+
const rs = -1, ns = 4294967296 - 1, is = 17179869184 - 1;
|
|
151
|
+
function as({ sec: s, nsec: e }) {
|
|
152
|
+
if (s >= 0 && e >= 0 && s <= is)
|
|
153
|
+
if (e === 0 && s <= ns) {
|
|
154
154
|
const t = new Uint8Array(4);
|
|
155
155
|
return new DataView(t.buffer).setUint32(0, s), t;
|
|
156
156
|
} else {
|
|
@@ -159,24 +159,24 @@ function is({ sec: s, nsec: e }) {
|
|
|
159
159
|
}
|
|
160
160
|
else {
|
|
161
161
|
const t = new Uint8Array(12), r = new DataView(t.buffer);
|
|
162
|
-
return r.setUint32(0, e),
|
|
162
|
+
return r.setUint32(0, e), lt(r, 4, s), t;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function os(s) {
|
|
166
166
|
const e = s.getTime(), t = Math.floor(e / 1e3), r = (e - t * 1e3) * 1e6, n = Math.floor(r / 1e9);
|
|
167
167
|
return {
|
|
168
168
|
sec: t + n,
|
|
169
169
|
nsec: r - n * 1e9
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function hs(s) {
|
|
173
173
|
if (s instanceof Date) {
|
|
174
|
-
const e =
|
|
175
|
-
return
|
|
174
|
+
const e = os(s);
|
|
175
|
+
return as(e);
|
|
176
176
|
} else
|
|
177
177
|
return null;
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function us(s) {
|
|
180
180
|
const e = new DataView(s.buffer, s.byteOffset, s.byteLength);
|
|
181
181
|
switch (s.byteLength) {
|
|
182
182
|
case 4:
|
|
@@ -186,25 +186,25 @@ function hs(s) {
|
|
|
186
186
|
return { sec: n, nsec: a };
|
|
187
187
|
}
|
|
188
188
|
case 12: {
|
|
189
|
-
const t =
|
|
189
|
+
const t = dt(e, 4), r = e.getUint32(0);
|
|
190
190
|
return { sec: t, nsec: r };
|
|
191
191
|
}
|
|
192
192
|
default:
|
|
193
193
|
throw new C(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${s.length}`);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
const e =
|
|
196
|
+
function cs(s) {
|
|
197
|
+
const e = us(s);
|
|
198
198
|
return new Date(e.sec * 1e3 + e.nsec / 1e6);
|
|
199
199
|
}
|
|
200
|
-
const
|
|
201
|
-
type:
|
|
202
|
-
encode:
|
|
203
|
-
decode:
|
|
200
|
+
const ls = {
|
|
201
|
+
type: rs,
|
|
202
|
+
encode: hs,
|
|
203
|
+
decode: cs
|
|
204
204
|
};
|
|
205
205
|
let he = class {
|
|
206
206
|
constructor() {
|
|
207
|
-
this.builtInEncoders = [], this.builtInDecoders = [], this.encoders = [], this.decoders = [], this.register(
|
|
207
|
+
this.builtInEncoders = [], this.builtInDecoders = [], this.encoders = [], this.decoders = [], this.register(ls);
|
|
208
208
|
}
|
|
209
209
|
register({ type: e, encode: t, decode: r }) {
|
|
210
210
|
if (e >= 0)
|
|
@@ -243,19 +243,19 @@ let he = class {
|
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
245
|
he.defaultCodec = new he();
|
|
246
|
-
function
|
|
246
|
+
function ds(s) {
|
|
247
247
|
return s instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && s instanceof SharedArrayBuffer;
|
|
248
248
|
}
|
|
249
249
|
function xe(s) {
|
|
250
|
-
return s instanceof Uint8Array ? s : ArrayBuffer.isView(s) ? new Uint8Array(s.buffer, s.byteOffset, s.byteLength) :
|
|
250
|
+
return s instanceof Uint8Array ? s : ArrayBuffer.isView(s) ? new Uint8Array(s.buffer, s.byteOffset, s.byteLength) : ds(s) ? new Uint8Array(s) : Uint8Array.from(s);
|
|
251
251
|
}
|
|
252
|
-
const
|
|
253
|
-
let
|
|
252
|
+
const fs = 100, gs = 2048;
|
|
253
|
+
let ps = class ft {
|
|
254
254
|
constructor(e) {
|
|
255
|
-
this.entered = !1, this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? he.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.maxDepth = (e == null ? void 0 : e.maxDepth) ??
|
|
255
|
+
this.entered = !1, this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? he.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.maxDepth = (e == null ? void 0 : e.maxDepth) ?? fs, this.initialBufferSize = (e == null ? void 0 : e.initialBufferSize) ?? gs, this.sortKeys = (e == null ? void 0 : e.sortKeys) ?? !1, this.forceFloat32 = (e == null ? void 0 : e.forceFloat32) ?? !1, this.ignoreUndefined = (e == null ? void 0 : e.ignoreUndefined) ?? !1, this.forceIntegerToFloat = (e == null ? void 0 : e.forceIntegerToFloat) ?? !1, this.pos = 0, this.view = new DataView(new ArrayBuffer(this.initialBufferSize)), this.bytes = new Uint8Array(this.view.buffer);
|
|
256
256
|
}
|
|
257
257
|
clone() {
|
|
258
|
-
return new
|
|
258
|
+
return new ft({
|
|
259
259
|
extensionCodec: this.extensionCodec,
|
|
260
260
|
context: this.context,
|
|
261
261
|
useBigInt64: this.useBigInt64,
|
|
@@ -337,8 +337,8 @@ let gs = class dt {
|
|
|
337
337
|
throw new Error(`Too long string: ${e} bytes in UTF-8`);
|
|
338
338
|
}
|
|
339
339
|
encodeString(e) {
|
|
340
|
-
const t =
|
|
341
|
-
this.ensureBufferSizeToWrite(5 + t), this.writeStringHeader(t),
|
|
340
|
+
const t = qt(e);
|
|
341
|
+
this.ensureBufferSizeToWrite(5 + t), this.writeStringHeader(t), Kt(e, this.bytes, this.pos), this.pos += t;
|
|
342
342
|
}
|
|
343
343
|
encodeObject(e, t) {
|
|
344
344
|
const r = this.extensionCodec.tryToEncode(e, this.context);
|
|
@@ -460,10 +460,10 @@ let gs = class dt {
|
|
|
460
460
|
this.ensureBufferSizeToWrite(8), this.view.setFloat64(this.pos, e), this.pos += 8;
|
|
461
461
|
}
|
|
462
462
|
writeU64(e) {
|
|
463
|
-
this.ensureBufferSizeToWrite(8),
|
|
463
|
+
this.ensureBufferSizeToWrite(8), ts(this.view, this.pos, e), this.pos += 8;
|
|
464
464
|
}
|
|
465
465
|
writeI64(e) {
|
|
466
|
-
this.ensureBufferSizeToWrite(8),
|
|
466
|
+
this.ensureBufferSizeToWrite(8), lt(this.view, this.pos, e), this.pos += 8;
|
|
467
467
|
}
|
|
468
468
|
writeBigUint64(e) {
|
|
469
469
|
this.ensureBufferSizeToWrite(8), this.view.setBigUint64(this.pos, e), this.pos += 8;
|
|
@@ -473,14 +473,14 @@ let gs = class dt {
|
|
|
473
473
|
}
|
|
474
474
|
};
|
|
475
475
|
function Q(s, e) {
|
|
476
|
-
return new
|
|
476
|
+
return new ps(e).encodeSharedRef(s);
|
|
477
477
|
}
|
|
478
478
|
function ve(s) {
|
|
479
479
|
return `${s < 0 ? "-" : ""}0x${Math.abs(s).toString(16).padStart(2, "0")}`;
|
|
480
480
|
}
|
|
481
|
-
const
|
|
482
|
-
class
|
|
483
|
-
constructor(e =
|
|
481
|
+
const ys = 16, ws = 16;
|
|
482
|
+
class ms {
|
|
483
|
+
constructor(e = ys, t = ws) {
|
|
484
484
|
this.hit = 0, this.miss = 0, this.maxKeyLength = e, this.maxLengthPerKey = t, this.caches = [];
|
|
485
485
|
for (let r = 0; r < this.maxKeyLength; r++)
|
|
486
486
|
this.caches.push([]);
|
|
@@ -508,16 +508,16 @@ class ws {
|
|
|
508
508
|
if (n != null)
|
|
509
509
|
return this.hit++, n;
|
|
510
510
|
this.miss++;
|
|
511
|
-
const a =
|
|
511
|
+
const a = ct(e, t, r), o = Uint8Array.prototype.slice.call(e, t, t + r);
|
|
512
512
|
return this.store(o, a), a;
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
const Ne = "array", ie = "map_key",
|
|
515
|
+
const Ne = "array", ie = "map_key", gt = "map_value", bs = (s) => {
|
|
516
516
|
if (typeof s == "string" || typeof s == "number")
|
|
517
517
|
return s;
|
|
518
518
|
throw new C("The type of key must be string or number but " + typeof s);
|
|
519
519
|
};
|
|
520
|
-
class
|
|
520
|
+
class vs {
|
|
521
521
|
constructor() {
|
|
522
522
|
this.stack = [], this.stackHeadPosition = -1;
|
|
523
523
|
}
|
|
@@ -557,7 +557,7 @@ class bs {
|
|
|
557
557
|
const t = e;
|
|
558
558
|
t.size = 0, t.array = void 0, t.position = 0, t.type = void 0;
|
|
559
559
|
}
|
|
560
|
-
if (e.type === ie || e.type ===
|
|
560
|
+
if (e.type === ie || e.type === gt) {
|
|
561
561
|
const t = e;
|
|
562
562
|
t.size = 0, t.map = void 0, t.readCount = 0, t.type = void 0;
|
|
563
563
|
}
|
|
@@ -567,20 +567,20 @@ class bs {
|
|
|
567
567
|
this.stack.length = 0, this.stackHeadPosition = -1;
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
const X = -1, ke = new DataView(new ArrayBuffer(0)),
|
|
570
|
+
const X = -1, ke = new DataView(new ArrayBuffer(0)), Ts = new Uint8Array(ke.buffer);
|
|
571
571
|
try {
|
|
572
572
|
ke.getInt8(0);
|
|
573
573
|
} catch (s) {
|
|
574
574
|
if (!(s instanceof RangeError))
|
|
575
575
|
throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access");
|
|
576
576
|
}
|
|
577
|
-
const
|
|
578
|
-
let
|
|
577
|
+
const Ve = new RangeError("Insufficient data"), Os = new ms();
|
|
578
|
+
let Ss = class pt {
|
|
579
579
|
constructor(e) {
|
|
580
|
-
this.totalPos = 0, this.pos = 0, this.view = ke, this.bytes =
|
|
580
|
+
this.totalPos = 0, this.pos = 0, this.view = ke, this.bytes = Ts, this.headByte = X, this.stack = new vs(), this.entered = !1, this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? he.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.rawStrings = (e == null ? void 0 : e.rawStrings) ?? !1, this.maxStrLength = (e == null ? void 0 : e.maxStrLength) ?? J, this.maxBinLength = (e == null ? void 0 : e.maxBinLength) ?? J, this.maxArrayLength = (e == null ? void 0 : e.maxArrayLength) ?? J, this.maxMapLength = (e == null ? void 0 : e.maxMapLength) ?? J, this.maxExtLength = (e == null ? void 0 : e.maxExtLength) ?? J, this.keyDecoder = (e == null ? void 0 : e.keyDecoder) !== void 0 ? e.keyDecoder : Os, this.mapKeyConverter = (e == null ? void 0 : e.mapKeyConverter) ?? bs;
|
|
581
581
|
}
|
|
582
582
|
clone() {
|
|
583
|
-
return new
|
|
583
|
+
return new pt({
|
|
584
584
|
extensionCodec: this.extensionCodec,
|
|
585
585
|
context: this.context,
|
|
586
586
|
useBigInt64: this.useBigInt64,
|
|
@@ -836,7 +836,7 @@ let Os = class gt {
|
|
|
836
836
|
else if (n.type === ie) {
|
|
837
837
|
if (t === "__proto__")
|
|
838
838
|
throw new C("The key __proto__ is not allowed");
|
|
839
|
-
n.key = this.mapKeyConverter(t), n.type =
|
|
839
|
+
n.key = this.mapKeyConverter(t), n.type = gt;
|
|
840
840
|
continue e;
|
|
841
841
|
} else if (n.map[n.key] = t, n.readCount++, n.readCount === n.size)
|
|
842
842
|
t = n.map, r.release(n);
|
|
@@ -889,10 +889,10 @@ let Os = class gt {
|
|
|
889
889
|
if (e > this.maxStrLength)
|
|
890
890
|
throw new C(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);
|
|
891
891
|
if (this.bytes.byteLength < this.pos + t + e)
|
|
892
|
-
throw
|
|
892
|
+
throw Ve;
|
|
893
893
|
const n = this.pos + t;
|
|
894
894
|
let a;
|
|
895
|
-
return this.stateIsMapKey() && (r = this.keyDecoder) != null && r.canBeCached(e) ? a = this.keyDecoder.decode(this.bytes, n, e) : a =
|
|
895
|
+
return this.stateIsMapKey() && (r = this.keyDecoder) != null && r.canBeCached(e) ? a = this.keyDecoder.decode(this.bytes, n, e) : a = es(this.bytes, n, e), this.pos += t + e, a;
|
|
896
896
|
}
|
|
897
897
|
stateIsMapKey() {
|
|
898
898
|
return this.stack.length > 0 ? this.stack.top().type === ie : !1;
|
|
@@ -904,7 +904,7 @@ let Os = class gt {
|
|
|
904
904
|
if (e > this.maxBinLength)
|
|
905
905
|
throw new C(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);
|
|
906
906
|
if (!this.hasRemaining(e + t))
|
|
907
|
-
throw
|
|
907
|
+
throw Ve;
|
|
908
908
|
const r = this.pos + t, n = this.bytes.subarray(r, r + e);
|
|
909
909
|
return this.pos += t + e, n;
|
|
910
910
|
}
|
|
@@ -952,11 +952,11 @@ let Os = class gt {
|
|
|
952
952
|
return this.pos += 4, e;
|
|
953
953
|
}
|
|
954
954
|
readU64() {
|
|
955
|
-
const e =
|
|
955
|
+
const e = ss(this.view, this.pos);
|
|
956
956
|
return this.pos += 8, e;
|
|
957
957
|
}
|
|
958
958
|
readI64() {
|
|
959
|
-
const e =
|
|
959
|
+
const e = dt(this.view, this.pos);
|
|
960
960
|
return this.pos += 8, e;
|
|
961
961
|
}
|
|
962
962
|
readU64AsBigInt() {
|
|
@@ -976,10 +976,10 @@ let Os = class gt {
|
|
|
976
976
|
return this.pos += 8, e;
|
|
977
977
|
}
|
|
978
978
|
};
|
|
979
|
-
function
|
|
980
|
-
return new
|
|
979
|
+
function yt(s, e) {
|
|
980
|
+
return new Ss(e).decode(s);
|
|
981
981
|
}
|
|
982
|
-
let
|
|
982
|
+
let Is = class {
|
|
983
983
|
constructor() {
|
|
984
984
|
V(this, "contentType", "application/json"), V(this, "decoder"), V(this, "encoder"), this.decoder = new TextDecoder(), this.encoder = new TextEncoder();
|
|
985
985
|
}
|
|
@@ -994,12 +994,12 @@ let Ss = class {
|
|
|
994
994
|
return t != null ? t.parse(n) : n;
|
|
995
995
|
}
|
|
996
996
|
encodeString(e) {
|
|
997
|
-
const t =
|
|
997
|
+
const t = ut(e);
|
|
998
998
|
return JSON.stringify(t, (r, n) => ArrayBuffer.isView(n) ? Array.from(n) : Le(n) && "encode_value" in n ? typeof n.value == "bigint" ? n.value.toString() : n.value : typeof n == "bigint" ? n.toString() : n);
|
|
999
999
|
}
|
|
1000
1000
|
static registerCustomType() {
|
|
1001
1001
|
}
|
|
1002
|
-
},
|
|
1002
|
+
}, Us = class {
|
|
1003
1003
|
constructor() {
|
|
1004
1004
|
V(this, "contentType", "text/csv");
|
|
1005
1005
|
}
|
|
@@ -1044,7 +1044,7 @@ let Ss = class {
|
|
|
1044
1044
|
}
|
|
1045
1045
|
static registerCustomType() {
|
|
1046
1046
|
}
|
|
1047
|
-
},
|
|
1047
|
+
}, xs = class {
|
|
1048
1048
|
constructor() {
|
|
1049
1049
|
V(this, "contentType", "text/plain");
|
|
1050
1050
|
}
|
|
@@ -1066,29 +1066,29 @@ j.register({
|
|
|
1066
1066
|
}
|
|
1067
1067
|
return Le(s) && "encode_value" in s ? typeof s.value == "bigint" ? Q(s.value.toString(), { extensionCodec: j }) : Q(s.value, { extensionCodec: j }) : typeof s == "bigint" ? Q(s.toString(), { extensionCodec: j }) : null;
|
|
1068
1068
|
},
|
|
1069
|
-
decode: (s) =>
|
|
1069
|
+
decode: (s) => yt(s, { extensionCodec: j })
|
|
1070
1070
|
});
|
|
1071
|
-
let
|
|
1071
|
+
let Ns = class {
|
|
1072
1072
|
constructor() {
|
|
1073
1073
|
V(this, "contentType", "application/msgpack");
|
|
1074
1074
|
}
|
|
1075
1075
|
encode(e) {
|
|
1076
|
-
const t =
|
|
1076
|
+
const t = ut(e);
|
|
1077
1077
|
return Q(t, { extensionCodec: j }).slice();
|
|
1078
1078
|
}
|
|
1079
1079
|
decode(e, t) {
|
|
1080
|
-
const r =
|
|
1080
|
+
const r = yt(e, { extensionCodec: j }), n = De(r);
|
|
1081
1081
|
return t != null ? t.parse(n) : n;
|
|
1082
1082
|
}
|
|
1083
1083
|
static registerCustomType() {
|
|
1084
1084
|
}
|
|
1085
1085
|
};
|
|
1086
|
-
const fe = new
|
|
1087
|
-
new Is();
|
|
1086
|
+
const fe = new Is();
|
|
1088
1087
|
new Us();
|
|
1089
1088
|
new xs();
|
|
1090
|
-
|
|
1091
|
-
|
|
1089
|
+
new Ns();
|
|
1090
|
+
const Es = (s) => s != null && typeof s == "object" && "toString" in s, As = (s, e = !1) => {
|
|
1091
|
+
const t = Es(s) ? "stringer" : typeof s;
|
|
1092
1092
|
let r;
|
|
1093
1093
|
switch (t) {
|
|
1094
1094
|
case "string":
|
|
@@ -1112,28 +1112,28 @@ const Ns = (s) => s != null && typeof s == "object" && "toString" in s, Es = (s,
|
|
|
1112
1112
|
default:
|
|
1113
1113
|
return console.warn(`sortFunc: unknown type ${t}`), () => -1;
|
|
1114
1114
|
}
|
|
1115
|
-
return e ?
|
|
1116
|
-
},
|
|
1115
|
+
return e ? Bs(r) : r;
|
|
1116
|
+
}, Bs = (s) => (e, t) => s(t, e), we = i.tuple([i.number(), i.number()]);
|
|
1117
1117
|
i.tuple([i.bigint(), i.bigint()]);
|
|
1118
|
-
const
|
|
1118
|
+
const wt = i.object({ width: i.number(), height: i.number() }), $s = i.object({
|
|
1119
1119
|
signedWidth: i.number(),
|
|
1120
1120
|
signedHeight: i.number()
|
|
1121
|
-
}),
|
|
1122
|
-
i.enum($s);
|
|
1123
|
-
const Ms = ["start", "center", "end"], Cs = ["signedWidth", "signedHeight"];
|
|
1124
|
-
i.enum(Cs);
|
|
1125
|
-
const pe = i.object({ x: i.number(), y: i.number() }), Rs = i.object({ clientX: i.number(), clientY: i.number() }), Ds = ["x", "y"], wt = i.enum(Ds), mt = ["top", "right", "bottom", "left"];
|
|
1126
|
-
i.enum(mt);
|
|
1127
|
-
const Ls = ["left", "right"], bt = i.enum(Ls), ks = ["top", "bottom"], vt = i.enum(ks), Tt = ["center"], Ve = i.enum(Tt), Ps = [...mt, ...Tt], Ot = i.enum(Ps);
|
|
1121
|
+
}), Ms = ["width", "height"];
|
|
1128
1122
|
i.enum(Ms);
|
|
1129
|
-
const
|
|
1130
|
-
i.enum(
|
|
1131
|
-
const
|
|
1132
|
-
i.
|
|
1123
|
+
const Cs = ["start", "center", "end"], Rs = ["signedWidth", "signedHeight"];
|
|
1124
|
+
i.enum(Rs);
|
|
1125
|
+
const pe = i.object({ x: i.number(), y: i.number() }), Ds = i.object({ clientX: i.number(), clientY: i.number() }), Ls = ["x", "y"], mt = i.enum(Ls), bt = ["top", "right", "bottom", "left"];
|
|
1126
|
+
i.enum(bt);
|
|
1127
|
+
const ks = ["left", "right"], vt = i.enum(ks), Ps = ["top", "bottom"], Tt = i.enum(Ps), Ot = ["center"], Ze = i.enum(Ot), js = [...bt, ...Ot], St = i.enum(js);
|
|
1128
|
+
i.enum(Cs);
|
|
1129
|
+
const Fs = ["first", "last"];
|
|
1130
|
+
i.enum(Fs);
|
|
1131
|
+
const zs = i.object({ lower: i.number(), upper: i.number() }), Ys = i.object({ lower: i.bigint(), upper: i.bigint() });
|
|
1133
1132
|
i.union([zs, we]);
|
|
1134
|
-
i.
|
|
1135
|
-
i.
|
|
1136
|
-
|
|
1133
|
+
i.union([Ys, we]);
|
|
1134
|
+
i.enum([...mt.options, ...St.options]);
|
|
1135
|
+
i.union([mt, St, i.instanceof(String)]);
|
|
1136
|
+
const Ws = (s) => typeof s == "bigint" || s instanceof BigInt, W = (s, e) => Ws(s) ? s.valueOf() * BigInt(e.valueOf()) : s.valueOf() * Number(e.valueOf()), z = (s, e) => {
|
|
1137
1137
|
const t = {};
|
|
1138
1138
|
if (typeof s == "number" || typeof s == "bigint")
|
|
1139
1139
|
e != null ? (t.lower = s, t.upper = e) : (t.lower = typeof s == "bigint" ? 0n : 0, t.upper = s);
|
|
@@ -1142,28 +1142,28 @@ const Ys = (s) => typeof s == "bigint" || s instanceof BigInt, W = (s, e) => Ys(
|
|
|
1142
1142
|
[t.lower, t.upper] = s;
|
|
1143
1143
|
} else return He(s);
|
|
1144
1144
|
return He(t);
|
|
1145
|
-
}, He = (s) => s.lower > s.upper ? { lower: s.upper, upper: s.lower } : s,
|
|
1145
|
+
}, He = (s) => s.lower > s.upper ? { lower: s.upper, upper: s.lower } : s, Ge = (s, e) => {
|
|
1146
1146
|
const t = z(s);
|
|
1147
1147
|
return e < t.lower ? t.lower : e >= t.upper ? t.upper - (typeof t.upper == "number" ? 1 : 1n) : e;
|
|
1148
1148
|
};
|
|
1149
1149
|
i.object({
|
|
1150
|
-
x:
|
|
1151
|
-
y:
|
|
1150
|
+
x: vt.or(Ze),
|
|
1151
|
+
y: Tt.or(Ze)
|
|
1152
1152
|
});
|
|
1153
|
-
const
|
|
1153
|
+
const qs = i.object({ x: vt, y: Tt }), Vs = Object.freeze({ x: "left", y: "top" }), Zs = (s, e) => s.x === e.x && s.y === e.y, Ke = i.union([
|
|
1154
1154
|
i.number(),
|
|
1155
1155
|
pe,
|
|
1156
1156
|
we,
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1157
|
+
wt,
|
|
1158
|
+
$s,
|
|
1159
|
+
Ds
|
|
1160
1160
|
]), Hs = (s, e) => {
|
|
1161
1161
|
if (typeof s == "string") {
|
|
1162
1162
|
if (e === void 0) throw new Error("The y coordinate must be given.");
|
|
1163
1163
|
return s === "x" ? { x: e, y: 0 } : { x: 0, y: e };
|
|
1164
1164
|
}
|
|
1165
1165
|
return typeof s == "number" ? { x: s, y: e ?? s } : Array.isArray(s) ? { x: s[0], y: s[1] } : "signedWidth" in s ? { x: s.signedWidth, y: s.signedHeight } : "clientX" in s ? { x: s.clientX, y: s.clientY } : "width" in s ? { x: s.width, y: s.height } : { x: s.x, y: s.y };
|
|
1166
|
-
},
|
|
1166
|
+
}, Je = Object.freeze({ x: 0, y: 0 }), le = i.union([i.number(), i.string()]);
|
|
1167
1167
|
i.object({
|
|
1168
1168
|
top: le,
|
|
1169
1169
|
left: le,
|
|
@@ -1179,13 +1179,13 @@ i.object({
|
|
|
1179
1179
|
i.object({
|
|
1180
1180
|
one: pe,
|
|
1181
1181
|
two: pe,
|
|
1182
|
-
root:
|
|
1182
|
+
root: qs
|
|
1183
1183
|
});
|
|
1184
1184
|
const Pe = (s, e, t = 0, r = 0, n) => {
|
|
1185
1185
|
const a = {
|
|
1186
|
-
one: { ...
|
|
1187
|
-
two: { ...
|
|
1188
|
-
root: n ??
|
|
1186
|
+
one: { ...Je },
|
|
1187
|
+
two: { ...Je },
|
|
1188
|
+
root: n ?? Vs
|
|
1189
1189
|
};
|
|
1190
1190
|
if (typeof s == "number") {
|
|
1191
1191
|
if (typeof e != "number")
|
|
@@ -1205,32 +1205,32 @@ const Pe = (s, e, t = 0, r = 0, n) => {
|
|
|
1205
1205
|
}, Oe = (s) => {
|
|
1206
1206
|
const e = Pe(s);
|
|
1207
1207
|
return { lower: e.one.y, upper: e.two.y };
|
|
1208
|
-
},
|
|
1209
|
-
i.union([
|
|
1210
|
-
var
|
|
1211
|
-
const
|
|
1212
|
-
i.object({ offset:
|
|
1208
|
+
}, Gs = (s) => typeof s != "object" || s == null ? !1 : "one" in s && "two" in s && "root" in s, Ks = i.object({ signedWidth: i.number(), signedHeight: i.number() });
|
|
1209
|
+
i.union([wt, Ks, pe, we]);
|
|
1210
|
+
var Js = Object.defineProperty, Xs = (s, e, t) => e in s ? Js(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, k = (s, e, t) => Xs(s, typeof e != "symbol" ? e + "" : e, t);
|
|
1211
|
+
const Qs = (s, e, t) => e !== void 0 && s < e ? e : t !== void 0 && s > t ? t : s;
|
|
1212
|
+
i.object({ offset: Ke, scale: Ke });
|
|
1213
1213
|
i.object({ offset: i.number(), scale: i.number() });
|
|
1214
|
-
const
|
|
1214
|
+
const _s = (s) => (e, t, r, n) => t === "dimension" ? [e, r] : [
|
|
1215
1215
|
e,
|
|
1216
1216
|
n ? r - s : r + s
|
|
1217
|
-
],
|
|
1217
|
+
], er = (s) => (e, t, r, n) => [
|
|
1218
1218
|
e,
|
|
1219
1219
|
n ? r / s : r * s
|
|
1220
|
-
],
|
|
1220
|
+
], tr = (s) => (e, t, r) => {
|
|
1221
1221
|
if (e === null) return [s, r];
|
|
1222
1222
|
const { lower: n, upper: a } = e, { lower: o, upper: c } = s, d = a - n, p = c - o;
|
|
1223
1223
|
if (t === "dimension") return [s, r * (p / d)];
|
|
1224
1224
|
const y = (r - n) * (p / d) + o;
|
|
1225
1225
|
return [s, y];
|
|
1226
|
-
},
|
|
1226
|
+
}, sr = (s) => (e, t, r) => [s, r], rr = () => (s, e, t) => {
|
|
1227
1227
|
if (s === null) throw new Error("cannot invert without bounds");
|
|
1228
1228
|
if (e === "dimension") return [s, t];
|
|
1229
1229
|
const { lower: r, upper: n } = s;
|
|
1230
1230
|
return [s, n - (t - r)];
|
|
1231
|
-
},
|
|
1231
|
+
}, nr = (s) => (e, t, r) => {
|
|
1232
1232
|
const { lower: n, upper: a } = s;
|
|
1233
|
-
return r =
|
|
1233
|
+
return r = Qs(r, n, a), [e, r];
|
|
1234
1234
|
}, Ee = class _ {
|
|
1235
1235
|
constructor() {
|
|
1236
1236
|
k(this, "ops", []), k(this, "currBounds", null), k(this, "currType", null), k(this, "reversed", !1), this.ops = [];
|
|
@@ -1261,7 +1261,7 @@ const Qs = (s) => (e, t, r, n) => t === "dimension" ? [e, r] : [
|
|
|
1261
1261
|
* @param value - The amount to translate by.
|
|
1262
1262
|
*/
|
|
1263
1263
|
translate(e) {
|
|
1264
|
-
const t = this.new(), r =
|
|
1264
|
+
const t = this.new(), r = _s(e);
|
|
1265
1265
|
return r.type = "translate", t.ops.push(r), t;
|
|
1266
1266
|
}
|
|
1267
1267
|
/**
|
|
@@ -1271,23 +1271,23 @@ const Qs = (s) => (e, t, r, n) => t === "dimension" ? [e, r] : [
|
|
|
1271
1271
|
* @param value - The amount to magnify by.
|
|
1272
1272
|
*/
|
|
1273
1273
|
magnify(e) {
|
|
1274
|
-
const t = this.new(), r =
|
|
1274
|
+
const t = this.new(), r = er(e);
|
|
1275
1275
|
return r.type = "magnify", t.ops.push(r), t;
|
|
1276
1276
|
}
|
|
1277
1277
|
scale(e, t) {
|
|
1278
|
-
const r = z(e, t), n = this.new(), a =
|
|
1278
|
+
const r = z(e, t), n = this.new(), a = tr(r);
|
|
1279
1279
|
return a.type = "scale", n.ops.push(a), n;
|
|
1280
1280
|
}
|
|
1281
1281
|
clamp(e, t) {
|
|
1282
|
-
const r = z(e, t), n = this.new(), a =
|
|
1282
|
+
const r = z(e, t), n = this.new(), a = nr(r);
|
|
1283
1283
|
return a.type = "clamp", n.ops.push(a), n;
|
|
1284
1284
|
}
|
|
1285
1285
|
reBound(e, t) {
|
|
1286
|
-
const r = z(e, t), n = this.new(), a =
|
|
1286
|
+
const r = z(e, t), n = this.new(), a = sr(r);
|
|
1287
1287
|
return a.type = "re-bound", n.ops.push(a), n;
|
|
1288
1288
|
}
|
|
1289
1289
|
invert() {
|
|
1290
|
-
const e =
|
|
1290
|
+
const e = rr();
|
|
1291
1291
|
e.type = "invert";
|
|
1292
1292
|
const t = this.new();
|
|
1293
1293
|
return t.ops.push(e), t;
|
|
@@ -1327,9 +1327,9 @@ const Qs = (s) => (e, t, r, n) => t === "dimension" ? [e, r] : [
|
|
|
1327
1327
|
}
|
|
1328
1328
|
};
|
|
1329
1329
|
k(Ee, "IDENTITY", new Ee());
|
|
1330
|
-
let
|
|
1331
|
-
const
|
|
1332
|
-
constructor(e = new
|
|
1330
|
+
let Xe = Ee;
|
|
1331
|
+
const Qe = class L {
|
|
1332
|
+
constructor(e = new Xe(), t = new Xe(), r = null) {
|
|
1333
1333
|
k(this, "x"), k(this, "y"), k(this, "currRoot"), this.x = e, this.y = t, this.currRoot = r;
|
|
1334
1334
|
}
|
|
1335
1335
|
static translate(e, t) {
|
|
@@ -1371,9 +1371,9 @@ const Xe = class L {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
scale(e) {
|
|
1373
1373
|
const t = this.copy();
|
|
1374
|
-
if (
|
|
1374
|
+
if (Gs(e)) {
|
|
1375
1375
|
const r = this.currRoot;
|
|
1376
|
-
return t.currRoot = e.root, r != null && !
|
|
1376
|
+
return t.currRoot = e.root, r != null && !Zs(r, e.root) && (r.x !== e.root.x && (t.x = t.x.invert()), r.y !== e.root.y && (t.y = t.y.invert())), t.x = t.x.scale(Te(e)), t.y = t.y.scale(Oe(e)), t;
|
|
1377
1377
|
}
|
|
1378
1378
|
return t.x = t.x.scale(e.width), t.y = t.y.scale(e.height), t;
|
|
1379
1379
|
}
|
|
@@ -1415,15 +1415,15 @@ const Xe = class L {
|
|
|
1415
1415
|
};
|
|
1416
1416
|
}
|
|
1417
1417
|
};
|
|
1418
|
-
k(
|
|
1419
|
-
var
|
|
1420
|
-
let
|
|
1418
|
+
k(Qe, "IDENTITY", new Qe());
|
|
1419
|
+
var ir = Object.defineProperty, ar = (s, e, t) => e in s ? ir(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, h = (s, e, t) => ar(s, typeof e != "symbol" ? e + "" : e, t);
|
|
1420
|
+
let or = (s, e = 21) => (t = e) => {
|
|
1421
1421
|
let r = "", n = t | 0;
|
|
1422
1422
|
for (; n--; )
|
|
1423
1423
|
r += s[Math.random() * s.length | 0];
|
|
1424
1424
|
return r;
|
|
1425
1425
|
};
|
|
1426
|
-
const
|
|
1426
|
+
const hr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", ur = or(hr, 11), cr = () => ur(), lr = i.enum(["static", "dynamic"]), It = (s, e) => {
|
|
1427
1427
|
const t = new T(e);
|
|
1428
1428
|
if (![
|
|
1429
1429
|
w.DAY,
|
|
@@ -1783,7 +1783,7 @@ const or = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", hr
|
|
|
1783
1783
|
* @example TimeStamp.now().remainder(TimeStamp.DAY) // => TimeStamp representing the current day
|
|
1784
1784
|
*/
|
|
1785
1785
|
remainder(e) {
|
|
1786
|
-
return
|
|
1786
|
+
return It(this, e);
|
|
1787
1787
|
}
|
|
1788
1788
|
/** @returns true if the day portion TimeStamp is today, false otherwise. */
|
|
1789
1789
|
get isToday() {
|
|
@@ -1870,10 +1870,10 @@ const b = class g {
|
|
|
1870
1870
|
h(this, "value"), h(this, "encodeValue", !0), typeof e == "number" && (e = Math.trunc(e.valueOf())), this.value = BigInt(e.valueOf());
|
|
1871
1871
|
}
|
|
1872
1872
|
static fromSeconds(e) {
|
|
1873
|
-
return e instanceof g ? e : e instanceof
|
|
1873
|
+
return e instanceof g ? e : e instanceof _e ? e.period : e instanceof T ? new g(e) : ["number", "bigint"].includes(typeof e) ? g.seconds(e) : new g(e);
|
|
1874
1874
|
}
|
|
1875
1875
|
static fromMilliseconds(e) {
|
|
1876
|
-
return e instanceof g ? e : e instanceof
|
|
1876
|
+
return e instanceof g ? e : e instanceof _e ? e.period : e instanceof T ? new g(e) : ["number", "bigint"].includes(typeof e) ? g.milliseconds(e) : new g(e);
|
|
1877
1877
|
}
|
|
1878
1878
|
encode() {
|
|
1879
1879
|
return this.value.toString();
|
|
@@ -1894,7 +1894,7 @@ const b = class g {
|
|
|
1894
1894
|
return this.valueOf() >= new g(e).valueOf();
|
|
1895
1895
|
}
|
|
1896
1896
|
remainder(e) {
|
|
1897
|
-
return
|
|
1897
|
+
return It(this, e);
|
|
1898
1898
|
}
|
|
1899
1899
|
truncate(e) {
|
|
1900
1900
|
return new g(
|
|
@@ -2131,7 +2131,7 @@ h(ee, "z", i.union([
|
|
|
2131
2131
|
i.instanceof(Number).transform((s) => new ee(s)),
|
|
2132
2132
|
i.instanceof(ee)
|
|
2133
2133
|
]));
|
|
2134
|
-
let
|
|
2134
|
+
let _e = ee;
|
|
2135
2135
|
const x = class extends Number {
|
|
2136
2136
|
/**
|
|
2137
2137
|
* Creates a Density representing the given number of bytes per value.
|
|
@@ -2555,14 +2555,14 @@ i.union([
|
|
|
2555
2555
|
i.instanceof(Int32Array),
|
|
2556
2556
|
i.instanceof(BigInt64Array)
|
|
2557
2557
|
]);
|
|
2558
|
-
const
|
|
2558
|
+
const Ut = (s) => {
|
|
2559
2559
|
const e = typeof s;
|
|
2560
2560
|
return e === "string" || e === "number" || e === "boolean" || e === "bigint" || s instanceof T || s instanceof w || s instanceof Date;
|
|
2561
|
-
},
|
|
2561
|
+
}, dr = (s, e, t, r = 0) => s.usesBigInt && !e.usesBigInt ? Number(t) - Number(r) : !s.usesBigInt && e.usesBigInt ? BigInt(t.valueOf()) - BigInt(r.valueOf()) : se(t, -r).valueOf(), se = (s, e) => e == 0 ? s : s == 0 ? e : typeof s == "bigint" && typeof e == "bigint" || typeof s == "number" && typeof e == "number" ? s + e : Number(s) + Number(e), fr = (s) => s == null ? !1 : Array.isArray(s) || s instanceof ArrayBuffer || ArrayBuffer.isView(s) && !(s instanceof DataView) || s instanceof wr ? !0 : Ut(s), P = -1, gr = i.string().transform(
|
|
2562
2562
|
(s) => new Uint8Array(
|
|
2563
2563
|
atob(s).split("").map((e) => e.charCodeAt(0))
|
|
2564
2564
|
).buffer
|
|
2565
|
-
),
|
|
2565
|
+
), pr = i.union([i.null(), i.undefined()]).transform(() => new Uint8Array().buffer), Be = 10, yr = (s, e) => {
|
|
2566
2566
|
if (s === "string" && !e.isVariable)
|
|
2567
2567
|
throw new Error(`cannot convert series of type ${e.toString()} to string`);
|
|
2568
2568
|
if (s === "number" && !e.isNumeric)
|
|
@@ -2571,21 +2571,21 @@ const It = (s) => {
|
|
|
2571
2571
|
throw new Error(`cannot convert series of type ${e.toString()} to bigint`);
|
|
2572
2572
|
}, re = class M {
|
|
2573
2573
|
constructor(e) {
|
|
2574
|
-
h(this, "key", ""), h(this, "isSynnaxSeries", !0), h(this, "dataType"), h(this, "sampleOffset"), h(this, "gl"), h(this, "_data"), h(this, "timeRange", ae.ZERO), h(this, "alignment", 0n), h(this, "_cachedMin"), h(this, "_cachedMax"), h(this, "writePos", P), h(this, "_refCount", 0), h(this, "_cachedLength"), h(this, "_cachedIndexes"),
|
|
2574
|
+
h(this, "key", ""), h(this, "isSynnaxSeries", !0), h(this, "dataType"), h(this, "sampleOffset"), h(this, "gl"), h(this, "_data"), h(this, "timeRange", ae.ZERO), h(this, "alignment", 0n), h(this, "_cachedMin"), h(this, "_cachedMax"), h(this, "writePos", P), h(this, "_refCount", 0), h(this, "_cachedLength"), h(this, "_cachedIndexes"), fr(e) && (e = { data: e });
|
|
2575
2575
|
const {
|
|
2576
2576
|
dataType: t,
|
|
2577
2577
|
timeRange: r,
|
|
2578
2578
|
sampleOffset: n = 0,
|
|
2579
2579
|
glBufferUsage: a = "static",
|
|
2580
2580
|
alignment: o = 0n,
|
|
2581
|
-
key: c =
|
|
2581
|
+
key: c = cr()
|
|
2582
2582
|
} = e, d = e.data ?? [];
|
|
2583
2583
|
if (d instanceof M || typeof d == "object" && "isSynnaxSeries" in d && d.isSynnaxSeries === !0) {
|
|
2584
2584
|
const l = d;
|
|
2585
2585
|
this.key = l.key, this.dataType = l.dataType, this.sampleOffset = l.sampleOffset, this.gl = l.gl, this._data = l._data, this.timeRange = l.timeRange, this.alignment = l.alignment, this._cachedMin = l._cachedMin, this._cachedMax = l._cachedMax, this.writePos = l.writePos, this._refCount = l._refCount, this._cachedLength = l._cachedLength;
|
|
2586
2586
|
return;
|
|
2587
2587
|
}
|
|
2588
|
-
const p =
|
|
2588
|
+
const p = Ut(d), y = Array.isArray(d);
|
|
2589
2589
|
if (t != null) this.dataType = new v(t);
|
|
2590
2590
|
else {
|
|
2591
2591
|
if (d instanceof ArrayBuffer)
|
|
@@ -2785,7 +2785,7 @@ const It = (s) => {
|
|
|
2785
2785
|
if (this.dataType.equals(e)) return this;
|
|
2786
2786
|
const r = new e.Array(this.length);
|
|
2787
2787
|
for (let n = 0; n < this.length; n++)
|
|
2788
|
-
r[n] =
|
|
2788
|
+
r[n] = dr(this.dataType, e, this.data[n], t);
|
|
2789
2789
|
return new M({
|
|
2790
2790
|
data: r.buffer,
|
|
2791
2791
|
dataType: e,
|
|
@@ -2899,7 +2899,7 @@ const It = (s) => {
|
|
|
2899
2899
|
*/
|
|
2900
2900
|
binarySearch(e) {
|
|
2901
2901
|
let t = 0, r = this.length - 1;
|
|
2902
|
-
const n =
|
|
2902
|
+
const n = As(e);
|
|
2903
2903
|
for (; t <= r; ) {
|
|
2904
2904
|
const a = Math.floor((t + r) / 2), o = n(this.at(a, !0), e);
|
|
2905
2905
|
if (o === 0) return a;
|
|
@@ -2924,7 +2924,7 @@ const It = (s) => {
|
|
|
2924
2924
|
), this.gl.prevBuffer = P;
|
|
2925
2925
|
}
|
|
2926
2926
|
as(e) {
|
|
2927
|
-
return
|
|
2927
|
+
return yr(e, this.dataType), this;
|
|
2928
2928
|
}
|
|
2929
2929
|
get digest() {
|
|
2930
2930
|
var e;
|
|
@@ -2933,8 +2933,8 @@ const It = (s) => {
|
|
|
2933
2933
|
dataType: this.dataType.toString(),
|
|
2934
2934
|
sampleOffset: this.sampleOffset,
|
|
2935
2935
|
alignment: {
|
|
2936
|
-
lower:
|
|
2937
|
-
upper:
|
|
2936
|
+
lower: it(this.alignmentBounds.lower),
|
|
2937
|
+
upper: it(this.alignmentBounds.upper)
|
|
2938
2938
|
},
|
|
2939
2939
|
timeRange: (e = this.timeRange) == null ? void 0 : e.toString(),
|
|
2940
2940
|
length: this.length,
|
|
@@ -2961,10 +2961,10 @@ const It = (s) => {
|
|
|
2961
2961
|
}
|
|
2962
2962
|
[Symbol.iterator]() {
|
|
2963
2963
|
if (this.dataType.isVariable) {
|
|
2964
|
-
const e = new
|
|
2965
|
-
return this.dataType.equals(v.JSON) ? new
|
|
2964
|
+
const e = new mr(this);
|
|
2965
|
+
return this.dataType.equals(v.JSON) ? new br(e) : e;
|
|
2966
2966
|
}
|
|
2967
|
-
return new
|
|
2967
|
+
return new vr(this);
|
|
2968
2968
|
}
|
|
2969
2969
|
slice(e, t) {
|
|
2970
2970
|
return this.sliceSub(!1, e, t);
|
|
@@ -2973,10 +2973,10 @@ const It = (s) => {
|
|
|
2973
2973
|
return this.sliceSub(!0, e, t);
|
|
2974
2974
|
}
|
|
2975
2975
|
subIterator(e, t) {
|
|
2976
|
-
return new
|
|
2976
|
+
return new et(this, e, t ?? this.length);
|
|
2977
2977
|
}
|
|
2978
2978
|
subAlignmentIterator(e, t) {
|
|
2979
|
-
return new
|
|
2979
|
+
return new et(
|
|
2980
2980
|
this,
|
|
2981
2981
|
Number(e - this.alignment),
|
|
2982
2982
|
Number(t - this.alignment)
|
|
@@ -3035,18 +3035,18 @@ h(re, "crudeZ", i.object({
|
|
|
3035
3035
|
dataType: v.z,
|
|
3036
3036
|
alignment: i.coerce.bigint().optional(),
|
|
3037
3037
|
data: i.union([
|
|
3038
|
-
fr,
|
|
3039
3038
|
gr,
|
|
3039
|
+
pr,
|
|
3040
3040
|
i.instanceof(ArrayBuffer),
|
|
3041
3041
|
i.instanceof(Uint8Array)
|
|
3042
3042
|
]),
|
|
3043
|
-
glBufferUsage:
|
|
3043
|
+
glBufferUsage: lr.optional().default("static").optional()
|
|
3044
3044
|
})), h(re, "z", re.crudeZ.transform((s) => new re(s)));
|
|
3045
|
-
let
|
|
3045
|
+
let wr = re, et = class {
|
|
3046
3046
|
constructor(e, t, r) {
|
|
3047
3047
|
h(this, "series"), h(this, "end"), h(this, "index"), this.series = e;
|
|
3048
3048
|
const n = z(0, e.length);
|
|
3049
|
-
this.end =
|
|
3049
|
+
this.end = Ge(n, r), this.index = Ge(n, t);
|
|
3050
3050
|
}
|
|
3051
3051
|
next() {
|
|
3052
3052
|
return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
|
|
@@ -3055,7 +3055,7 @@ let yr = re, _e = class {
|
|
|
3055
3055
|
return this;
|
|
3056
3056
|
}
|
|
3057
3057
|
};
|
|
3058
|
-
class
|
|
3058
|
+
class mr {
|
|
3059
3059
|
constructor(e) {
|
|
3060
3060
|
if (h(this, "series"), h(this, "index"), h(this, "decoder"), !e.dataType.isVariable)
|
|
3061
3061
|
throw new Error(
|
|
@@ -3073,28 +3073,28 @@ class wr {
|
|
|
3073
3073
|
return this;
|
|
3074
3074
|
}
|
|
3075
3075
|
}
|
|
3076
|
-
var
|
|
3077
|
-
const
|
|
3076
|
+
var tt, st;
|
|
3077
|
+
const xt = class Nt {
|
|
3078
3078
|
constructor(e) {
|
|
3079
|
-
h(this, "wrapped"), h(this,
|
|
3079
|
+
h(this, "wrapped"), h(this, tt, "JSONSeriesIterator"), this.wrapped = e;
|
|
3080
3080
|
}
|
|
3081
3081
|
next() {
|
|
3082
3082
|
const e = this.wrapped.next();
|
|
3083
3083
|
return e.done === !0 ? { done: !0, value: void 0 } : {
|
|
3084
3084
|
done: !1,
|
|
3085
|
-
value: fe.decodeString(e.value,
|
|
3085
|
+
value: fe.decodeString(e.value, Nt.SCHEMA)
|
|
3086
3086
|
};
|
|
3087
3087
|
}
|
|
3088
|
-
[(
|
|
3088
|
+
[(st = Symbol.iterator, tt = Symbol.toStringTag, st)]() {
|
|
3089
3089
|
return this;
|
|
3090
3090
|
}
|
|
3091
3091
|
};
|
|
3092
|
-
h(
|
|
3093
|
-
let
|
|
3094
|
-
var
|
|
3095
|
-
class
|
|
3092
|
+
h(xt, "SCHEMA", i.record(i.string(), i.unknown()));
|
|
3093
|
+
let br = xt;
|
|
3094
|
+
var rt, nt;
|
|
3095
|
+
class vr {
|
|
3096
3096
|
constructor(e) {
|
|
3097
|
-
h(this, "series"), h(this, "index"), h(this,
|
|
3097
|
+
h(this, "series"), h(this, "index"), h(this, rt, "SeriesIterator"), this.series = e, this.index = 0;
|
|
3098
3098
|
}
|
|
3099
3099
|
next() {
|
|
3100
3100
|
return this.index >= this.series.length ? { done: !0, value: void 0 } : {
|
|
@@ -3102,11 +3102,11 @@ class br {
|
|
|
3102
3102
|
value: this.series.at(this.index++, !0)
|
|
3103
3103
|
};
|
|
3104
3104
|
}
|
|
3105
|
-
[(
|
|
3105
|
+
[(nt = Symbol.iterator, rt = Symbol.toStringTag, nt)]() {
|
|
3106
3106
|
return this;
|
|
3107
3107
|
}
|
|
3108
3108
|
}
|
|
3109
|
-
const
|
|
3109
|
+
const it = (s) => {
|
|
3110
3110
|
const e = s >> 32n, t = s & 0xffffffffn;
|
|
3111
3111
|
return { domain: e, sample: t };
|
|
3112
3112
|
};
|
|
@@ -3115,13 +3115,13 @@ i.record(
|
|
|
3115
3115
|
i.union([i.number(), i.string(), i.symbol()]),
|
|
3116
3116
|
i.unknown()
|
|
3117
3117
|
);
|
|
3118
|
-
const
|
|
3118
|
+
const Et = () => typeof process < "u" && process.versions != null && process.versions.node != null ? "node" : typeof window > "u" || window.document === void 0 ? "webworker" : "browser", Tr = Et(), At = ["macOS", "Windows", "Linux"], Or = ["macos", "windows", "linux"], Sr = {
|
|
3119
3119
|
macos: "macOS",
|
|
3120
3120
|
windows: "Windows",
|
|
3121
3121
|
linux: "Linux"
|
|
3122
|
-
},
|
|
3123
|
-
i.enum(
|
|
3124
|
-
),
|
|
3122
|
+
}, Ir = i.enum(At).or(
|
|
3123
|
+
i.enum(Or).transform((s) => Sr[s])
|
|
3124
|
+
), Ur = () => {
|
|
3125
3125
|
if (typeof window > "u") return;
|
|
3126
3126
|
const s = window.navigator.userAgent.toLowerCase();
|
|
3127
3127
|
if (s.includes("mac")) return "macOS";
|
|
@@ -3129,19 +3129,19 @@ const Nt = () => typeof process < "u" && process.versions != null && process.ver
|
|
|
3129
3129
|
if (s.includes("linux")) return "Linux";
|
|
3130
3130
|
};
|
|
3131
3131
|
let Se;
|
|
3132
|
-
const
|
|
3132
|
+
const xr = (s = {}) => {
|
|
3133
3133
|
const { force: e, default: t } = s;
|
|
3134
|
-
return e ?? Se ?? (Se =
|
|
3135
|
-
},
|
|
3134
|
+
return e ?? Se ?? (Se = Ur(), Se ?? t);
|
|
3135
|
+
}, Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3136
3136
|
__proto__: null,
|
|
3137
|
-
OPERATING_SYSTEMS:
|
|
3138
|
-
RUNTIME:
|
|
3139
|
-
detect:
|
|
3140
|
-
getOS:
|
|
3141
|
-
osZ:
|
|
3137
|
+
OPERATING_SYSTEMS: At,
|
|
3138
|
+
RUNTIME: Tr,
|
|
3139
|
+
detect: Et,
|
|
3140
|
+
getOS: xr,
|
|
3141
|
+
osZ: Ir
|
|
3142
3142
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3143
|
-
var
|
|
3144
|
-
const
|
|
3143
|
+
var Nr = Object.defineProperty, Er = (s, e, t) => e in s ? Nr(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, ne = (s, e, t) => Er(s, typeof e != "symbol" ? e + "" : e, t);
|
|
3144
|
+
const Ar = (...s) => s.map($t).join(""), $t = (s) => (s.endsWith("/") || (s += "/"), s.startsWith("/") && (s = s.slice(1)), s), Br = (s) => s.endsWith("/") ? s.slice(0, -1) : s, $r = (s, e = "") => s === null ? "" : `?${Object.entries(s).filter(([, t]) => t == null ? !1 : Array.isArray(t) ? t.length > 0 : !0).map(([t, r]) => `${e}${t}=${r}`).join("&")}`, $e = class Me {
|
|
3145
3145
|
/**
|
|
3146
3146
|
* @param host - The hostname or IP address of the server.
|
|
3147
3147
|
* @param port - The port number of the server.
|
|
@@ -3149,7 +3149,7 @@ const Er = (...s) => s.map(Bt).join(""), Bt = (s) => (s.endsWith("/") || (s += "
|
|
|
3149
3149
|
* @param pathPrefix - A path prefix to use for all requests. Defaults to "".
|
|
3150
3150
|
*/
|
|
3151
3151
|
constructor({ host: e, port: t, protocol: r = "", pathPrefix: n = "" }) {
|
|
3152
|
-
ne(this, "protocol"), ne(this, "host"), ne(this, "port"), ne(this, "path"), this.protocol = r, this.host = e, this.port = t, this.path =
|
|
3152
|
+
ne(this, "protocol"), ne(this, "host"), ne(this, "port"), ne(this, "path"), this.protocol = r, this.host = e, this.port = t, this.path = $t(n);
|
|
3153
3153
|
}
|
|
3154
3154
|
/**
|
|
3155
3155
|
* Replaces creates a new URL with the specified properties replaced.
|
|
@@ -3172,39 +3172,39 @@ const Er = (...s) => s.map(Bt).join(""), Bt = (s) => (s.endsWith("/") || (s += "
|
|
|
3172
3172
|
child(e) {
|
|
3173
3173
|
return new Me({
|
|
3174
3174
|
...this,
|
|
3175
|
-
pathPrefix:
|
|
3175
|
+
pathPrefix: Ar(this.path, e)
|
|
3176
3176
|
});
|
|
3177
3177
|
}
|
|
3178
3178
|
/** @returns a string representation of the url */
|
|
3179
3179
|
toString() {
|
|
3180
|
-
return
|
|
3180
|
+
return Br(
|
|
3181
3181
|
`${this.protocol}://${this.host}:${this.port}/${this.path}`
|
|
3182
3182
|
);
|
|
3183
3183
|
}
|
|
3184
3184
|
};
|
|
3185
3185
|
ne($e, "UNKNOWN", new $e({ host: "unknown", port: 0 }));
|
|
3186
|
-
let
|
|
3187
|
-
const
|
|
3188
|
-
i.number().int().min(
|
|
3189
|
-
const
|
|
3190
|
-
i.number().int().min(
|
|
3191
|
-
const
|
|
3192
|
-
i.number().int().min(
|
|
3193
|
-
const
|
|
3194
|
-
i.bigint().min(
|
|
3195
|
-
const
|
|
3196
|
-
i.number().int().min(0).max(Fr);
|
|
3197
|
-
const zr = 65535;
|
|
3186
|
+
let Mr = $e;
|
|
3187
|
+
const Cr = -128, Rr = 127;
|
|
3188
|
+
i.number().int().min(Cr).max(Rr);
|
|
3189
|
+
const Dr = -32768, Lr = 32767;
|
|
3190
|
+
i.number().int().min(Dr).max(Lr);
|
|
3191
|
+
const kr = -2147483648, Pr = 2147483647;
|
|
3192
|
+
i.number().int().min(kr).max(Pr);
|
|
3193
|
+
const jr = -9223372036854775808n, Fr = 9223372036854775807n;
|
|
3194
|
+
i.bigint().min(jr).max(Fr);
|
|
3195
|
+
const zr = 255;
|
|
3198
3196
|
i.number().int().min(0).max(zr);
|
|
3199
|
-
const Yr =
|
|
3197
|
+
const Yr = 65535;
|
|
3200
3198
|
i.number().int().min(0).max(Yr);
|
|
3201
|
-
const Wr =
|
|
3202
|
-
i.
|
|
3203
|
-
|
|
3199
|
+
const Wr = 4294967295;
|
|
3200
|
+
i.number().int().min(0).max(Wr);
|
|
3201
|
+
const qr = 18446744073709551615n;
|
|
3202
|
+
i.bigint().min(0n).max(qr);
|
|
3203
|
+
var Vr = Object.defineProperty, Zr = (s, e, t) => e in s ? Vr(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, R = (s, e, t) => Zr(s, typeof e != "symbol" ? e + "" : e, t);
|
|
3204
3204
|
const Hr = async (s) => await new Promise(
|
|
3205
3205
|
(e) => setTimeout(e, w.fromMilliseconds(s).milliseconds)
|
|
3206
3206
|
);
|
|
3207
|
-
class
|
|
3207
|
+
class Gr {
|
|
3208
3208
|
constructor(e) {
|
|
3209
3209
|
R(this, "config"), R(this, "retries"), R(this, "interval"), this.config = {
|
|
3210
3210
|
baseInterval: new w((e == null ? void 0 : e.baseInterval) ?? w.seconds(1)),
|
|
@@ -3221,80 +3221,81 @@ class Zr {
|
|
|
3221
3221
|
this.retries = 0, this.interval = this.config.baseInterval;
|
|
3222
3222
|
}
|
|
3223
3223
|
}
|
|
3224
|
-
const
|
|
3224
|
+
const Kr = i.object({
|
|
3225
3225
|
baseInterval: w.z.optional(),
|
|
3226
3226
|
maxRetries: i.number().optional(),
|
|
3227
3227
|
scale: i.number().optional()
|
|
3228
|
-
}),
|
|
3228
|
+
}), Jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3229
3229
|
__proto__: null,
|
|
3230
|
-
Breaker:
|
|
3231
|
-
breakerConfig:
|
|
3232
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3233
|
-
if (typeof s == "string") return
|
|
3230
|
+
Breaker: Gr,
|
|
3231
|
+
breakerConfig: Kr
|
|
3232
|
+
}, Symbol.toStringTag, { value: "Module" })), Xr = /^#?([0-9a-f]{6}|[0-9a-f]{8})$/i, je = i.string().regex(Xr), Z = i.number().min(0).max(255), Qr = i.number().min(0).max(1), Fe = i.tuple([Z, Z, Z, Qr]), Mt = i.tuple([Z, Z, Z]), Ct = i.object({ rgba255: Fe }), ze = (s, e = 1) => {
|
|
3233
|
+
if (typeof s == "string") return en(s, e);
|
|
3234
3234
|
if (Array.isArray(s)) {
|
|
3235
3235
|
if (s.length < 3 || s.length > 4)
|
|
3236
3236
|
throw new Error(`Invalid color: [${s.join(", ")}]`);
|
|
3237
3237
|
return s.length === 3 ? [...s, e] : s;
|
|
3238
3238
|
}
|
|
3239
|
+
if (typeof s == "object" && "rgba255" in s) return s.rgba255;
|
|
3239
3240
|
throw new Error(`Invalid color: ${JSON.stringify(s)}`);
|
|
3240
|
-
},
|
|
3241
|
+
}, _r = i.union([je, Fe, Mt, Ct]).transform((s) => ze(s)), en = (s, e = 1) => {
|
|
3241
3242
|
if (!je.safeParse(s).success) throw new Error(`Invalid hex color: ${s}`);
|
|
3242
|
-
return s =
|
|
3243
|
+
return s = tn(s), [
|
|
3243
3244
|
de(s, 0),
|
|
3244
3245
|
de(s, 2),
|
|
3245
3246
|
de(s, 4),
|
|
3246
3247
|
s.length === 8 ? de(s, 6) / 255 : e
|
|
3247
3248
|
];
|
|
3248
|
-
}, de = (s, e) => parseInt(s.slice(e, e + 2), 16),
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
const
|
|
3249
|
+
}, de = (s, e) => parseInt(s.slice(e, e + 2), 16), tn = (s) => s.startsWith("#") ? s.slice(1) : s, sn = i.union([je, Fe, i.string(), Mt, Ct]);
|
|
3250
|
+
ze("#000000");
|
|
3251
|
+
ze("#ffffff");
|
|
3252
|
+
const rn = i.object({
|
|
3252
3253
|
key: i.string(),
|
|
3253
|
-
color:
|
|
3254
|
+
color: sn,
|
|
3254
3255
|
position: i.number(),
|
|
3255
3256
|
switched: i.boolean().optional()
|
|
3256
3257
|
});
|
|
3257
|
-
i.array(
|
|
3258
|
-
const
|
|
3258
|
+
i.array(rn);
|
|
3259
|
+
const nn = i.object({
|
|
3259
3260
|
key: i.string(),
|
|
3260
3261
|
name: i.string(),
|
|
3261
|
-
color:
|
|
3262
|
+
color: _r
|
|
3262
3263
|
});
|
|
3263
3264
|
i.object({
|
|
3264
3265
|
key: i.string(),
|
|
3265
3266
|
name: i.string(),
|
|
3266
|
-
swatches: i.array(
|
|
3267
|
+
swatches: i.array(nn)
|
|
3267
3268
|
});
|
|
3268
|
-
const
|
|
3269
|
+
const an = i.number().int().min(0).max(255), on = i.object({
|
|
3269
3270
|
name: i.string(),
|
|
3270
3271
|
key: i.string()
|
|
3271
3272
|
}), ye = (s) => i.object({
|
|
3272
|
-
subject:
|
|
3273
|
+
subject: on,
|
|
3273
3274
|
resource: s,
|
|
3274
|
-
authority:
|
|
3275
|
-
}),
|
|
3275
|
+
authority: an
|
|
3276
|
+
}), hn = i.object({
|
|
3276
3277
|
from: ye(i.any()),
|
|
3277
3278
|
to: i.null()
|
|
3278
|
-
}),
|
|
3279
|
+
}), un = i.object({
|
|
3279
3280
|
from: i.null(),
|
|
3280
3281
|
to: ye(i.any())
|
|
3281
3282
|
});
|
|
3282
3283
|
i.union([
|
|
3283
|
-
on,
|
|
3284
3284
|
hn,
|
|
3285
|
+
un,
|
|
3285
3286
|
i.object({
|
|
3286
3287
|
from: ye(i.any()),
|
|
3287
3288
|
to: ye(i.any())
|
|
3288
3289
|
})
|
|
3289
3290
|
]);
|
|
3290
|
-
const
|
|
3291
|
+
const cn = (s) => Object.getOwnPropertySymbols(globalThis).includes(s), ln = (s, e) => {
|
|
3291
3292
|
const t = Symbol.for(s);
|
|
3292
|
-
if (!
|
|
3293
|
+
if (!cn(t)) {
|
|
3293
3294
|
const r = e();
|
|
3294
3295
|
Object.defineProperty(globalThis, t, { value: r });
|
|
3295
3296
|
}
|
|
3296
3297
|
return () => globalThis[t];
|
|
3297
|
-
},
|
|
3298
|
+
}, dn = (s) => (e) => e != null && typeof e == "object" && "type" in e && typeof e.type == "string" ? e.type.startsWith(s) : e instanceof Error ? e.message.startsWith(s) : typeof e != "string" ? !1 : e.startsWith(s), me = (s) => {
|
|
3298
3299
|
var e;
|
|
3299
3300
|
return e = class extends Error {
|
|
3300
3301
|
constructor(t, r) {
|
|
@@ -3303,8 +3304,8 @@ const un = (s) => Object.getOwnPropertySymbols(globalThis).includes(s), cn = (s,
|
|
|
3303
3304
|
static sub(t) {
|
|
3304
3305
|
return me(`${s}.${t}`);
|
|
3305
3306
|
}
|
|
3306
|
-
}, R(e, "discriminator", "FreighterError"), R(e, "TYPE", s), R(e, "matches",
|
|
3307
|
-
},
|
|
3307
|
+
}, R(e, "discriminator", "FreighterError"), R(e, "TYPE", s), R(e, "matches", dn(s)), e;
|
|
3308
|
+
}, Rt = (s) => {
|
|
3308
3309
|
if (s == null || typeof s != "object") return !1;
|
|
3309
3310
|
const e = s;
|
|
3310
3311
|
if (e.discriminator !== "FreighterError") return !1;
|
|
@@ -3314,7 +3315,7 @@ const un = (s) => Object.getOwnPropertySymbols(globalThis).includes(s), cn = (s,
|
|
|
3314
3315
|
);
|
|
3315
3316
|
return !0;
|
|
3316
3317
|
}, q = "unknown", Ce = "nil";
|
|
3317
|
-
class
|
|
3318
|
+
class fn {
|
|
3318
3319
|
constructor() {
|
|
3319
3320
|
R(this, "providers", []);
|
|
3320
3321
|
}
|
|
@@ -3323,7 +3324,7 @@ class dn {
|
|
|
3323
3324
|
}
|
|
3324
3325
|
encode(e) {
|
|
3325
3326
|
if (e == null) return { type: Ce, data: "" };
|
|
3326
|
-
if (
|
|
3327
|
+
if (Rt(e))
|
|
3327
3328
|
for (const t of this.providers) {
|
|
3328
3329
|
const r = t.encode(e);
|
|
3329
3330
|
if (r != null) return r;
|
|
@@ -3346,27 +3347,27 @@ class dn {
|
|
|
3346
3347
|
return new Re(e.data);
|
|
3347
3348
|
}
|
|
3348
3349
|
}
|
|
3349
|
-
const
|
|
3350
|
+
const Ye = ln("synnax-error-registry", () => new fn()), gn = ({
|
|
3350
3351
|
encode: s,
|
|
3351
3352
|
decode: e
|
|
3352
|
-
}) =>
|
|
3353
|
+
}) => Ye().register({ encode: s, decode: e }), pn = (s) => Ye().encode(s), yn = (s) => s == null ? null : Ye().decode(s);
|
|
3353
3354
|
class Re extends me("unknown") {
|
|
3354
3355
|
}
|
|
3355
|
-
const
|
|
3356
|
-
class
|
|
3356
|
+
const wn = i.object({ type: i.string(), data: i.string() });
|
|
3357
|
+
class mn extends me("canceled") {
|
|
3357
3358
|
}
|
|
3358
3359
|
const F = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3359
3360
|
__proto__: null,
|
|
3360
|
-
Canceled:
|
|
3361
|
+
Canceled: mn,
|
|
3361
3362
|
NONE: Ce,
|
|
3362
3363
|
UNKNOWN: q,
|
|
3363
3364
|
Unknown: Re,
|
|
3364
3365
|
createTyped: me,
|
|
3365
|
-
decode:
|
|
3366
|
-
encode:
|
|
3367
|
-
isTyped:
|
|
3368
|
-
payloadZ:
|
|
3369
|
-
register:
|
|
3366
|
+
decode: yn,
|
|
3367
|
+
encode: pn,
|
|
3368
|
+
isTyped: Rt,
|
|
3369
|
+
payloadZ: wn,
|
|
3370
|
+
register: gn
|
|
3370
3371
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3371
3372
|
Y.object({
|
|
3372
3373
|
jsonrpc: Y.string(),
|
|
@@ -3376,11 +3377,11 @@ Y.object({
|
|
|
3376
3377
|
result: Y.unknown().optional()
|
|
3377
3378
|
});
|
|
3378
3379
|
i.string().regex(/^\d+\.\d+\.\d+$/);
|
|
3379
|
-
const
|
|
3380
|
-
i.enum(
|
|
3380
|
+
const bn = ["standard", "scientific", "engineering"];
|
|
3381
|
+
i.enum(bn);
|
|
3381
3382
|
class ue extends F.createTyped("freighter") {
|
|
3382
3383
|
}
|
|
3383
|
-
class
|
|
3384
|
+
class H extends ue.sub("eof") {
|
|
3384
3385
|
constructor() {
|
|
3385
3386
|
super("EOF");
|
|
3386
3387
|
}
|
|
@@ -3392,25 +3393,25 @@ class G extends ue.sub("stream_closed") {
|
|
|
3392
3393
|
}
|
|
3393
3394
|
class K extends ue.sub("unreachable") {
|
|
3394
3395
|
constructor(t = {}) {
|
|
3395
|
-
const { message: r = "Unreachable", url: n =
|
|
3396
|
+
const { message: r = "Unreachable", url: n = Mr.UNKNOWN } = t;
|
|
3396
3397
|
super(r);
|
|
3397
3398
|
S(this, "url");
|
|
3398
3399
|
this.url = n;
|
|
3399
3400
|
}
|
|
3400
3401
|
}
|
|
3401
|
-
const
|
|
3402
|
+
const vn = (s) => {
|
|
3402
3403
|
if (!s.type.startsWith(ue.TYPE)) return null;
|
|
3403
|
-
if (
|
|
3404
|
+
if (H.matches(s)) return { type: H.TYPE, data: "EOF" };
|
|
3404
3405
|
if (G.matches(s))
|
|
3405
3406
|
return { type: G.TYPE, data: "StreamClosed" };
|
|
3406
3407
|
if (K.matches(s))
|
|
3407
3408
|
return { type: K.TYPE, data: "Unreachable" };
|
|
3408
3409
|
throw new Error(`Unknown error type: ${s.type}: ${s.message}`);
|
|
3409
|
-
},
|
|
3410
|
+
}, Tn = (s) => {
|
|
3410
3411
|
if (!s.type.startsWith(ue.TYPE)) return null;
|
|
3411
3412
|
switch (s.type) {
|
|
3412
|
-
case
|
|
3413
|
-
return new
|
|
3413
|
+
case H.TYPE:
|
|
3414
|
+
return new H();
|
|
3414
3415
|
case G.TYPE:
|
|
3415
3416
|
return new G();
|
|
3416
3417
|
case K.TYPE:
|
|
@@ -3420,10 +3421,10 @@ const bn = (s) => {
|
|
|
3420
3421
|
}
|
|
3421
3422
|
};
|
|
3422
3423
|
F.register({
|
|
3423
|
-
encode:
|
|
3424
|
-
decode:
|
|
3424
|
+
encode: vn,
|
|
3425
|
+
decode: Tn
|
|
3425
3426
|
});
|
|
3426
|
-
class
|
|
3427
|
+
class Dt {
|
|
3427
3428
|
constructor() {
|
|
3428
3429
|
S(this, "middleware", []);
|
|
3429
3430
|
}
|
|
@@ -3450,26 +3451,26 @@ class Rt {
|
|
|
3450
3451
|
return await n(e);
|
|
3451
3452
|
}
|
|
3452
3453
|
}
|
|
3453
|
-
const
|
|
3454
|
-
if (
|
|
3454
|
+
const Lt = "Content-Type", at = (s) => {
|
|
3455
|
+
if (Bt.RUNTIME !== "node") return fetch;
|
|
3455
3456
|
const e = require("node-fetch");
|
|
3456
3457
|
if (s === "http") return e;
|
|
3457
3458
|
const t = require("https"), r = new t.Agent({ rejectUnauthorized: !1 });
|
|
3458
3459
|
return async (n, a) => await e(n, { ...a, agent: r });
|
|
3459
|
-
},
|
|
3460
|
-
class
|
|
3460
|
+
}, On = (s) => "code" in s && s.code === "ECONNREFUSED" || s.message.toLowerCase().includes("load failed"), Sn = 400;
|
|
3461
|
+
class jn extends Dt {
|
|
3461
3462
|
constructor(t, r, n = !1) {
|
|
3462
3463
|
super();
|
|
3463
3464
|
S(this, "endpoint");
|
|
3464
3465
|
S(this, "encoder");
|
|
3465
3466
|
S(this, "fetch");
|
|
3466
|
-
return this.endpoint = t.replace({ protocol: n ? "https" : "http" }), this.encoder = r, this.fetch =
|
|
3467
|
+
return this.endpoint = t.replace({ protocol: n ? "https" : "http" }), this.encoder = r, this.fetch = at(this.endpoint.protocol), new Proxy(this, {
|
|
3467
3468
|
get: (a, o, c) => o === "endpoint" ? this.endpoint : Reflect.get(a, o, c)
|
|
3468
3469
|
});
|
|
3469
3470
|
}
|
|
3470
3471
|
get headers() {
|
|
3471
3472
|
return {
|
|
3472
|
-
[
|
|
3473
|
+
[Lt]: this.encoder.contentType
|
|
3473
3474
|
};
|
|
3474
3475
|
}
|
|
3475
3476
|
async send(t, r, n, a) {
|
|
@@ -3492,16 +3493,16 @@ class Pn extends Rt {
|
|
|
3492
3493
|
};
|
|
3493
3494
|
let U;
|
|
3494
3495
|
try {
|
|
3495
|
-
U = await
|
|
3496
|
+
U = await at(y.protocol)(y.target, d);
|
|
3496
3497
|
} catch (D) {
|
|
3497
3498
|
let A = D;
|
|
3498
|
-
return
|
|
3499
|
+
return On(A) && (A = new K({ url: c })), [l, A];
|
|
3499
3500
|
}
|
|
3500
3501
|
const B = new Uint8Array(await (await U.blob()).arrayBuffer());
|
|
3501
3502
|
if (U != null && U.ok)
|
|
3502
3503
|
return a != null && (o = this.encoder.decode(B, a)), [l, null];
|
|
3503
3504
|
try {
|
|
3504
|
-
if (U.status !==
|
|
3505
|
+
if (U.status !== Sn)
|
|
3505
3506
|
return [l, new Error(U.statusText)];
|
|
3506
3507
|
const D = this.encoder.decode(B, F.payloadZ), A = F.decode(D);
|
|
3507
3508
|
return [l, A];
|
|
@@ -3518,7 +3519,7 @@ class Pn extends Rt {
|
|
|
3518
3519
|
return p != null ? [null, p] : [o, null];
|
|
3519
3520
|
}
|
|
3520
3521
|
}
|
|
3521
|
-
const
|
|
3522
|
+
const Fn = (s, e) => {
|
|
3522
3523
|
class t {
|
|
3523
3524
|
constructor(n) {
|
|
3524
3525
|
S(this, "wrapped");
|
|
@@ -3528,7 +3529,7 @@ const jn = (s, e) => {
|
|
|
3528
3529
|
this.wrapped.use(...n);
|
|
3529
3530
|
}
|
|
3530
3531
|
async send(n, a, o, c) {
|
|
3531
|
-
const d = new
|
|
3532
|
+
const d = new Jr.Breaker(e);
|
|
3532
3533
|
do {
|
|
3533
3534
|
const [p, y] = await this.wrapped.send(n, a, o, c);
|
|
3534
3535
|
if (y == null) return [p, null];
|
|
@@ -3538,16 +3539,16 @@ const jn = (s, e) => {
|
|
|
3538
3539
|
}
|
|
3539
3540
|
}
|
|
3540
3541
|
return new t(s);
|
|
3541
|
-
},
|
|
3542
|
+
}, zn = async (s, e, t, r, n) => {
|
|
3542
3543
|
const [a, o] = await s.send(e, t, r, n);
|
|
3543
3544
|
if (o != null) throw o;
|
|
3544
3545
|
return a;
|
|
3545
|
-
},
|
|
3546
|
+
}, In = () => Bt.RUNTIME !== "node" ? (s) => new WebSocket(s) : (s) => new (require("ws")).WebSocket(s, { rejectUnauthorized: !1 }), Un = i.object({
|
|
3546
3547
|
type: i.enum(["data", "close", "open"]),
|
|
3547
3548
|
payload: i.unknown(),
|
|
3548
3549
|
error: i.optional(F.payloadZ)
|
|
3549
3550
|
});
|
|
3550
|
-
class
|
|
3551
|
+
class xn {
|
|
3551
3552
|
constructor(e, t, r, n) {
|
|
3552
3553
|
S(this, "codec");
|
|
3553
3554
|
S(this, "reqSchema");
|
|
@@ -3569,7 +3570,7 @@ class Un {
|
|
|
3569
3570
|
}
|
|
3570
3571
|
/** Implements the Stream protocol */
|
|
3571
3572
|
send(e) {
|
|
3572
|
-
if (this.serverClosed != null) return new
|
|
3573
|
+
if (this.serverClosed != null) return new H();
|
|
3573
3574
|
if (this.sendClosed) throw new G();
|
|
3574
3575
|
return this.ws.send(this.codec.encode({ type: "data", payload: e })), null;
|
|
3575
3576
|
}
|
|
@@ -3611,19 +3612,19 @@ class Un {
|
|
|
3611
3612
|
this.ws.onmessage = this.onMessage.bind(this), this.ws.onclose = this.onClose.bind(this);
|
|
3612
3613
|
}
|
|
3613
3614
|
onMessage(e) {
|
|
3614
|
-
this.addMessage(this.codec.decode(e.data,
|
|
3615
|
+
this.addMessage(this.codec.decode(e.data, Un));
|
|
3615
3616
|
}
|
|
3616
3617
|
onClose(e) {
|
|
3617
3618
|
this.addMessage({
|
|
3618
3619
|
type: "close",
|
|
3619
3620
|
error: {
|
|
3620
|
-
type: e.code ===
|
|
3621
|
+
type: e.code === En ? H.TYPE : G.TYPE,
|
|
3621
3622
|
data: ""
|
|
3622
3623
|
}
|
|
3623
3624
|
});
|
|
3624
3625
|
}
|
|
3625
3626
|
}
|
|
3626
|
-
const
|
|
3627
|
+
const Nn = "freighterctx", En = 1e3, oe = class oe extends Dt {
|
|
3627
3628
|
/**
|
|
3628
3629
|
* @param encoder - The encoder to use for encoding messages and decoding
|
|
3629
3630
|
* responses.
|
|
@@ -3642,7 +3643,7 @@ const xn = "freighterctx", Nn = 1e3, oe = class oe extends Rt {
|
|
|
3642
3643
|
}
|
|
3643
3644
|
/** Implements the StreamClient interface. */
|
|
3644
3645
|
async stream(t, r, n) {
|
|
3645
|
-
const a =
|
|
3646
|
+
const a = In();
|
|
3646
3647
|
let o;
|
|
3647
3648
|
const [, c] = await this.executeMiddleware(
|
|
3648
3649
|
{ target: t, protocol: "websocket", params: {}, role: "client" },
|
|
@@ -3657,19 +3658,19 @@ const xn = "freighterctx", Nn = 1e3, oe = class oe extends Rt {
|
|
|
3657
3658
|
return o;
|
|
3658
3659
|
}
|
|
3659
3660
|
buildURL(t, r) {
|
|
3660
|
-
const n =
|
|
3661
|
+
const n = $r(
|
|
3661
3662
|
{
|
|
3662
|
-
[
|
|
3663
|
+
[Lt]: this.encoder.contentType,
|
|
3663
3664
|
...r.params
|
|
3664
3665
|
},
|
|
3665
|
-
|
|
3666
|
+
Nn
|
|
3666
3667
|
);
|
|
3667
3668
|
return this.baseUrl.child(t).toString() + n;
|
|
3668
3669
|
}
|
|
3669
3670
|
async wrapSocket(t, r, n) {
|
|
3670
3671
|
return await new Promise((a) => {
|
|
3671
3672
|
t.onopen = () => {
|
|
3672
|
-
const o = new
|
|
3673
|
+
const o = new xn(t, this.encoder, r, n);
|
|
3673
3674
|
o.receiveOpenAck().then((c) => {
|
|
3674
3675
|
c != null ? a(c) : a(o);
|
|
3675
3676
|
}).catch((c) => a(c));
|
|
@@ -3681,13 +3682,13 @@ const xn = "freighterctx", Nn = 1e3, oe = class oe extends Rt {
|
|
|
3681
3682
|
}
|
|
3682
3683
|
};
|
|
3683
3684
|
S(oe, "MESSAGE_TYPE", "arraybuffer");
|
|
3684
|
-
let
|
|
3685
|
+
let ot = oe;
|
|
3685
3686
|
export {
|
|
3686
|
-
|
|
3687
|
-
|
|
3687
|
+
H as EOF,
|
|
3688
|
+
jn as HTTPClient,
|
|
3688
3689
|
G as StreamClosed,
|
|
3689
3690
|
K as Unreachable,
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3691
|
+
ot as WebSocketClient,
|
|
3692
|
+
zn as sendRequired,
|
|
3693
|
+
Fn as unaryWithBreaker
|
|
3693
3694
|
};
|