@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.js CHANGED
@@ -1,41 +1,41 @@
1
- var Lt = Object.defineProperty;
2
- var kt = (s, e, t) => e in s ? Lt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var S = (s, e, t) => kt(s, typeof e != "symbol" ? e + "" : 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 Pt = (s) => {
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
- }, ot = (s) => {
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 = Ft(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) ? We(c, r.keepTypesOnRecursion) || (c = e(c, r)) : r.recursiveInArray && Ye(c) && (c = [...c].map((p) => {
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) ? We(y, r.keepTypesOnRecursion) || (y = e(p, r)) : Ye(p) && (y = e({ key: p }, r).key), y;
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 = ot(Pt), jt = (s) => (
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
- ), ht = ot(jt), Ie = {
32
+ ), ut = ht(Ft), Ie = {
33
33
  recursive: !0,
34
34
  recursiveInArray: !0,
35
35
  keepTypesOnRecursion: [Number, String, Uint8Array]
36
- }, Ft = (s = Ie) => (s.recursive == null ? s = Ie : s.recursiveInArray ?? (s.recursiveInArray = !1), s), Ye = (s) => s != null && Array.isArray(s), be = (s) => s != null && typeof s == "object" && !Array.isArray(s), We = (s, e) => (e || []).some((t) => s instanceof t), Le = (s) => s != null && typeof s == "object" && !Array.isArray(s);
37
- var zt = Object.defineProperty, Yt = (s, e, t) => e in s ? zt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, V = (s, e, t) => Yt(s, typeof e != "symbol" ? e + "" : e, t);
38
- function Wt(s) {
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 qt(s, e, t) {
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 Vt = new TextEncoder(), Ht = 50;
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
- s.length > Ht ? Zt(s, e, t) : qt(s, e, t);
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 Kt = 4096;
86
- function ut(s, e, t) {
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 >= Kt && (o += String.fromCharCode(...a), a.length = 0);
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 Jt = new TextDecoder(), Xt = 200;
111
- function Qt(s, e, t) {
110
+ const Xt = new TextDecoder(), Qt = 200;
111
+ function _t(s, e, t) {
112
112
  const r = s.subarray(e, e + t);
113
- return Jt.decode(r);
113
+ return Xt.decode(r);
114
114
  }
115
- function _t(s, e, t) {
116
- return t > Xt ? Qt(s, e, t) : ut(s, e, 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 es(s, e, t) {
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 ct(s, e, t) {
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 lt(s, e) {
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 ts(s, e) {
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 ss = -1, rs = 4294967296 - 1, ns = 17179869184 - 1;
151
- function is({ sec: s, nsec: e }) {
152
- if (s >= 0 && e >= 0 && s <= ns)
153
- if (e === 0 && s <= rs) {
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), ct(r, 4, s), t;
162
+ return r.setUint32(0, e), lt(r, 4, s), t;
163
163
  }
164
164
  }
165
- function as(s) {
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 os(s) {
172
+ function hs(s) {
173
173
  if (s instanceof Date) {
174
- const e = as(s);
175
- return is(e);
174
+ const e = os(s);
175
+ return as(e);
176
176
  } else
177
177
  return null;
178
178
  }
179
- function hs(s) {
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 = lt(e, 4), r = e.getUint32(0);
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 us(s) {
197
- const e = hs(s);
196
+ function cs(s) {
197
+ const e = us(s);
198
198
  return new Date(e.sec * 1e3 + e.nsec / 1e6);
199
199
  }
200
- const cs = {
201
- type: ss,
202
- encode: os,
203
- decode: us
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(cs);
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 ls(s) {
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) : ls(s) ? new Uint8Array(s) : Uint8Array.from(s);
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 ds = 100, fs = 2048;
253
- let gs = class dt {
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) ?? ds, this.initialBufferSize = (e == null ? void 0 : e.initialBufferSize) ?? fs, 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);
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 dt({
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 = Wt(e);
341
- this.ensureBufferSizeToWrite(5 + t), this.writeStringHeader(t), Gt(e, this.bytes, this.pos), this.pos += 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), es(this.view, this.pos, e), this.pos += 8;
463
+ this.ensureBufferSizeToWrite(8), ts(this.view, this.pos, e), this.pos += 8;
464
464
  }
465
465
  writeI64(e) {
466
- this.ensureBufferSizeToWrite(8), ct(this.view, this.pos, e), this.pos += 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 gs(e).encodeSharedRef(s);
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 ps = 16, ys = 16;
482
- class ws {
483
- constructor(e = ps, t = ys) {
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 = ut(e, t, r), o = Uint8Array.prototype.slice.call(e, t, t + r);
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", ft = "map_value", ms = (s) => {
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 bs {
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 === ft) {
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)), vs = new Uint8Array(ke.buffer);
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 qe = new RangeError("Insufficient data"), Ts = new ws();
578
- let Os = class gt {
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 = vs, this.headByte = X, this.stack = new bs(), 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 : Ts, this.mapKeyConverter = (e == null ? void 0 : e.mapKeyConverter) ?? ms;
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 gt({
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 = ft;
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 qe;
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 = _t(this.bytes, n, e), this.pos += t + 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 qe;
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 = ts(this.view, this.pos);
955
+ const e = ss(this.view, this.pos);
956
956
  return this.pos += 8, e;
957
957
  }
958
958
  readI64() {
959
- const e = lt(this.view, this.pos);
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 pt(s, e) {
980
- return new Os(e).decode(s);
979
+ function yt(s, e) {
980
+ return new Ss(e).decode(s);
981
981
  }
982
- let Ss = class {
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 = ht(e);
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
- }, Is = class {
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
- }, Us = class {
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) => pt(s, { extensionCodec: j })
1069
+ decode: (s) => yt(s, { extensionCodec: j })
1070
1070
  });
1071
- let xs = class {
1071
+ let Ns = class {
1072
1072
  constructor() {
1073
1073
  V(this, "contentType", "application/msgpack");
1074
1074
  }
1075
1075
  encode(e) {
1076
- const t = ht(e);
1076
+ const t = ut(e);
1077
1077
  return Q(t, { extensionCodec: j }).slice();
1078
1078
  }
1079
1079
  decode(e, t) {
1080
- const r = pt(e, { extensionCodec: j }), n = De(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 Ss();
1087
- new Is();
1086
+ const fe = new Is();
1088
1087
  new Us();
1089
1088
  new xs();
1090
- const Ns = (s) => s != null && typeof s == "object" && "toString" in s, Es = (s, e = !1) => {
1091
- const t = Ns(s) ? "stringer" : typeof s;
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 ? As(r) : r;
1116
- }, As = (s) => (e, t) => s(t, e), we = i.tuple([i.number(), i.number()]);
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 yt = i.object({ width: i.number(), height: i.number() }), Bs = i.object({
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
- }), $s = ["width", "height"];
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 js = ["first", "last"];
1130
- i.enum(js);
1131
- const Fs = i.object({ lower: i.number(), upper: i.number() }), zs = i.object({ lower: i.bigint(), upper: i.bigint() });
1132
- i.union([Fs, we]);
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.enum([...wt.options, ...Ot.options]);
1135
- i.union([wt, Ot, i.instanceof(String)]);
1136
- const Ys = (s) => typeof s == "bigint" || s instanceof BigInt, W = (s, e) => Ys(s) ? s.valueOf() * BigInt(e.valueOf()) : s.valueOf() * Number(e.valueOf()), z = (s, e) => {
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, Ze = (s, e) => {
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: bt.or(Ve),
1151
- y: vt.or(Ve)
1150
+ x: vt.or(Ze),
1151
+ y: Tt.or(Ze)
1152
1152
  });
1153
- const Ws = i.object({ x: bt, y: vt }), qs = Object.freeze({ x: "left", y: "top" }), Vs = (s, e) => s.x === e.x && s.y === e.y, Ge = i.union([
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
- yt,
1158
- Bs,
1159
- Rs
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
- }, Ke = Object.freeze({ x: 0, y: 0 }), le = i.union([i.number(), i.string()]);
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: Ws
1182
+ root: qs
1183
1183
  });
1184
1184
  const Pe = (s, e, t = 0, r = 0, n) => {
1185
1185
  const a = {
1186
- one: { ...Ke },
1187
- two: { ...Ke },
1188
- root: n ?? qs
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
- }, Zs = (s) => typeof s != "object" || s == null ? !1 : "one" in s && "two" in s && "root" in s, Gs = i.object({ signedWidth: i.number(), signedHeight: i.number() });
1209
- i.union([yt, Gs, pe, we]);
1210
- var Ks = Object.defineProperty, Js = (s, e, t) => e in s ? Ks(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, k = (s, e, t) => Js(s, typeof e != "symbol" ? e + "" : e, t);
1211
- const Xs = (s, e, t) => e !== void 0 && s < e ? e : t !== void 0 && s > t ? t : s;
1212
- i.object({ offset: Ge, scale: Ge });
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 Qs = (s) => (e, t, r, n) => t === "dimension" ? [e, r] : [
1214
+ const _s = (s) => (e, t, r, n) => t === "dimension" ? [e, r] : [
1215
1215
  e,
1216
1216
  n ? r - s : r + s
1217
- ], _s = (s) => (e, t, r, n) => [
1217
+ ], er = (s) => (e, t, r, n) => [
1218
1218
  e,
1219
1219
  n ? r / s : r * s
1220
- ], er = (s) => (e, t, r) => {
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
- }, tr = (s) => (e, t, r) => [s, r], sr = () => (s, e, t) => {
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
- }, rr = (s) => (e, t, r) => {
1231
+ }, nr = (s) => (e, t, r) => {
1232
1232
  const { lower: n, upper: a } = s;
1233
- return r = Xs(r, n, a), [e, 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 = Qs(e);
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 = _s(e);
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 = er(r);
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 = rr(r);
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 = tr(r);
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 = sr();
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 Je = Ee;
1331
- const Xe = class L {
1332
- constructor(e = new Je(), t = new Je(), r = null) {
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 (Zs(e)) {
1374
+ if (Gs(e)) {
1375
1375
  const r = this.currRoot;
1376
- return t.currRoot = e.root, r != null && !Vs(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;
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(Xe, "IDENTITY", new Xe());
1419
- var nr = Object.defineProperty, ir = (s, e, t) => e in s ? nr(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, h = (s, e, t) => ir(s, typeof e != "symbol" ? e + "" : e, t);
1420
- let ar = (s, e = 21) => (t = e) => {
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 or = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", hr = ar(or, 11), ur = () => hr(), cr = i.enum(["static", "dynamic"]), St = (s, e) => {
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 St(this, e);
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 Qe ? e.period : e instanceof T ? new g(e) : ["number", "bigint"].includes(typeof e) ? g.seconds(e) : new g(e);
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 Qe ? e.period : e instanceof T ? new g(e) : ["number", "bigint"].includes(typeof e) ? g.milliseconds(e) : new g(e);
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 St(this, e);
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 Qe = ee;
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 It = (s) => {
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
- }, lr = (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), dr = (s) => s == null ? !1 : Array.isArray(s) || s instanceof ArrayBuffer || ArrayBuffer.isView(s) && !(s instanceof DataView) || s instanceof yr ? !0 : It(s), P = -1, fr = i.string().transform(
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
- ), gr = i.union([i.null(), i.undefined()]).transform(() => new Uint8Array().buffer), Be = 10, pr = (s, e) => {
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"), dr(e) && (e = { data: 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"), 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 = ur()
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 = It(d), y = Array.isArray(d);
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] = lr(this.dataType, e, this.data[n], t);
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 = Es(e);
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 pr(e, this.dataType), this;
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: nt(this.alignmentBounds.lower),
2937
- upper: nt(this.alignmentBounds.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 wr(this);
2965
- return this.dataType.equals(v.JSON) ? new mr(e) : e;
2964
+ const e = new mr(this);
2965
+ return this.dataType.equals(v.JSON) ? new br(e) : e;
2966
2966
  }
2967
- return new br(this);
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 _e(this, e, t ?? this.length);
2976
+ return new et(this, e, t ?? this.length);
2977
2977
  }
2978
2978
  subAlignmentIterator(e, t) {
2979
- return new _e(
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: cr.optional().default("static").optional()
3043
+ glBufferUsage: lr.optional().default("static").optional()
3044
3044
  })), h(re, "z", re.crudeZ.transform((s) => new re(s)));
3045
- let yr = re, _e = class {
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 = Ze(n, r), this.index = Ze(n, t);
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 wr {
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 et, tt;
3077
- const Ut = class xt {
3076
+ var tt, st;
3077
+ const xt = class Nt {
3078
3078
  constructor(e) {
3079
- h(this, "wrapped"), h(this, et, "JSONSeriesIterator"), this.wrapped = e;
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, xt.SCHEMA)
3085
+ value: fe.decodeString(e.value, Nt.SCHEMA)
3086
3086
  };
3087
3087
  }
3088
- [(tt = Symbol.iterator, et = Symbol.toStringTag, tt)]() {
3088
+ [(st = Symbol.iterator, tt = Symbol.toStringTag, st)]() {
3089
3089
  return this;
3090
3090
  }
3091
3091
  };
3092
- h(Ut, "SCHEMA", i.record(i.string(), i.unknown()));
3093
- let mr = Ut;
3094
- var st, rt;
3095
- class br {
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, st, "SeriesIterator"), this.series = e, this.index = 0;
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
- [(rt = Symbol.iterator, st = Symbol.toStringTag, rt)]() {
3105
+ [(nt = Symbol.iterator, rt = Symbol.toStringTag, nt)]() {
3106
3106
  return this;
3107
3107
  }
3108
3108
  }
3109
- const nt = (s) => {
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 Nt = () => typeof process < "u" && process.versions != null && process.versions.node != null ? "node" : typeof window > "u" || window.document === void 0 ? "webworker" : "browser", vr = Nt(), Et = ["macOS", "Windows", "Linux"], Tr = ["macos", "windows", "linux"], Or = {
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
- }, Sr = i.enum(Et).or(
3123
- i.enum(Tr).transform((s) => Or[s])
3124
- ), Ir = () => {
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 Ur = (s = {}) => {
3132
+ const xr = (s = {}) => {
3133
3133
  const { force: e, default: t } = s;
3134
- return e ?? Se ?? (Se = Ir(), Se ?? t);
3135
- }, At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3134
+ return e ?? Se ?? (Se = Ur(), Se ?? t);
3135
+ }, Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3136
3136
  __proto__: null,
3137
- OPERATING_SYSTEMS: Et,
3138
- RUNTIME: vr,
3139
- detect: Nt,
3140
- getOS: Ur,
3141
- osZ: Sr
3137
+ OPERATING_SYSTEMS: At,
3138
+ RUNTIME: Tr,
3139
+ detect: Et,
3140
+ getOS: xr,
3141
+ osZ: Ir
3142
3142
  }, Symbol.toStringTag, { value: "Module" }));
3143
- var xr = Object.defineProperty, Nr = (s, e, t) => e in s ? xr(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, ne = (s, e, t) => Nr(s, typeof e != "symbol" ? e + "" : e, t);
3144
- const Er = (...s) => s.map(Bt).join(""), Bt = (s) => (s.endsWith("/") || (s += "/"), s.startsWith("/") && (s = s.slice(1)), s), Ar = (s) => s.endsWith("/") ? s.slice(0, -1) : s, Br = (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 {
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 = Bt(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 = $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: Er(this.path, e)
3175
+ pathPrefix: Ar(this.path, e)
3176
3176
  });
3177
3177
  }
3178
3178
  /** @returns a string representation of the url */
3179
3179
  toString() {
3180
- return Ar(
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 $r = $e;
3187
- const Mr = -128, Cr = 127;
3188
- i.number().int().min(Mr).max(Cr);
3189
- const Rr = -32768, Dr = 32767;
3190
- i.number().int().min(Rr).max(Dr);
3191
- const Lr = -2147483648, kr = 2147483647;
3192
- i.number().int().min(Lr).max(kr);
3193
- const Pr = -9223372036854775808n, jr = 9223372036854775807n;
3194
- i.bigint().min(Pr).max(jr);
3195
- const Fr = 255;
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 = 4294967295;
3197
+ const Yr = 65535;
3200
3198
  i.number().int().min(0).max(Yr);
3201
- const Wr = 18446744073709551615n;
3202
- i.bigint().min(0n).max(Wr);
3203
- var qr = Object.defineProperty, Vr = (s, e, t) => e in s ? qr(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, R = (s, e, t) => Vr(s, typeof e != "symbol" ? e + "" : e, t);
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 Zr {
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 Gr = i.object({
3224
+ const Kr = i.object({
3225
3225
  baseInterval: w.z.optional(),
3226
3226
  maxRetries: i.number().optional(),
3227
3227
  scale: i.number().optional()
3228
- }), Kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3228
+ }), Jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3229
3229
  __proto__: null,
3230
- Breaker: Zr,
3231
- breakerConfig: Gr
3232
- }, Symbol.toStringTag, { value: "Module" })), Jr = /^#?([0-9a-f]{6}|[0-9a-f]{8})$/i, je = i.string().regex(Jr), H = i.number().min(0).max(255), Xr = i.number().min(0).max(1), $t = i.tuple([H, H, H, Xr]), Mt = i.tuple([H, H, H]), Fe = (s, e = 1) => {
3233
- if (typeof s == "string") return _r(s, e);
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
- }, Qr = i.union([je, $t, Mt]).transform((s) => Fe(s)), _r = (s, e = 1) => {
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 = en(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), en = (s) => s.startsWith("#") ? s.slice(1) : s, tn = i.union([je, $t, i.string(), Mt]);
3249
- Fe("#000000");
3250
- Fe("#ffffff");
3251
- const sn = i.object({
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: tn,
3254
+ color: sn,
3254
3255
  position: i.number(),
3255
3256
  switched: i.boolean().optional()
3256
3257
  });
3257
- i.array(sn);
3258
- const rn = i.object({
3258
+ i.array(rn);
3259
+ const nn = i.object({
3259
3260
  key: i.string(),
3260
3261
  name: i.string(),
3261
- color: Qr
3262
+ color: _r
3262
3263
  });
3263
3264
  i.object({
3264
3265
  key: i.string(),
3265
3266
  name: i.string(),
3266
- swatches: i.array(rn)
3267
+ swatches: i.array(nn)
3267
3268
  });
3268
- const nn = i.number().int().min(0).max(255), an = i.object({
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: an,
3273
+ subject: on,
3273
3274
  resource: s,
3274
- authority: nn
3275
- }), on = i.object({
3275
+ authority: an
3276
+ }), hn = i.object({
3276
3277
  from: ye(i.any()),
3277
3278
  to: i.null()
3278
- }), hn = i.object({
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 un = (s) => Object.getOwnPropertySymbols(globalThis).includes(s), cn = (s, e) => {
3291
+ const cn = (s) => Object.getOwnPropertySymbols(globalThis).includes(s), ln = (s, e) => {
3291
3292
  const t = Symbol.for(s);
3292
- if (!un(t)) {
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
- }, ln = (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
+ }, 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", ln(s)), e;
3307
- }, Ct = (s) => {
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 dn {
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 (Ct(e))
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 ze = cn("synnax-error-registry", () => new dn()), fn = ({
3350
+ const Ye = ln("synnax-error-registry", () => new fn()), gn = ({
3350
3351
  encode: s,
3351
3352
  decode: e
3352
- }) => ze().register({ encode: s, decode: e }), gn = (s) => ze().encode(s), pn = (s) => s == null ? null : ze().decode(s);
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 yn = i.object({ type: i.string(), data: i.string() });
3356
- class wn extends me("canceled") {
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: wn,
3361
+ Canceled: mn,
3361
3362
  NONE: Ce,
3362
3363
  UNKNOWN: q,
3363
3364
  Unknown: Re,
3364
3365
  createTyped: me,
3365
- decode: pn,
3366
- encode: gn,
3367
- isTyped: Ct,
3368
- payloadZ: yn,
3369
- register: fn
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 mn = ["standard", "scientific", "engineering"];
3380
- i.enum(mn);
3380
+ const bn = ["standard", "scientific", "engineering"];
3381
+ i.enum(bn);
3381
3382
  class ue extends F.createTyped("freighter") {
3382
3383
  }
3383
- class Z extends ue.sub("eof") {
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 = $r.UNKNOWN } = t;
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 bn = (s) => {
3402
+ const vn = (s) => {
3402
3403
  if (!s.type.startsWith(ue.TYPE)) return null;
3403
- if (Z.matches(s)) return { type: Z.TYPE, data: "EOF" };
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
- }, vn = (s) => {
3410
+ }, Tn = (s) => {
3410
3411
  if (!s.type.startsWith(ue.TYPE)) return null;
3411
3412
  switch (s.type) {
3412
- case Z.TYPE:
3413
- return new Z();
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: bn,
3424
- decode: vn
3424
+ encode: vn,
3425
+ decode: Tn
3425
3426
  });
3426
- class Rt {
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 Dt = "Content-Type", it = (s) => {
3454
- if (At.RUNTIME !== "node") return fetch;
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
- }, Tn = (s) => "code" in s && s.code === "ECONNREFUSED" || s.message.toLowerCase().includes("load failed"), On = 400;
3460
- class Pn extends Rt {
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 = it(this.endpoint.protocol), new Proxy(this, {
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
- [Dt]: this.encoder.contentType
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 it(y.protocol)(y.target, d);
3496
+ U = await at(y.protocol)(y.target, d);
3496
3497
  } catch (D) {
3497
3498
  let A = D;
3498
- return Tn(A) && (A = new K({ url: c })), [l, A];
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 !== On)
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 jn = (s, e) => {
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 Kr.Breaker(e);
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
- }, Fn = async (s, e, t, r, n) => {
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
- }, Sn = () => At.RUNTIME !== "node" ? (s) => new WebSocket(s) : (s) => new (require("ws")).WebSocket(s, { rejectUnauthorized: !1 }), In = i.object({
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 Un {
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 Z();
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, In));
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 === Nn ? Z.TYPE : G.TYPE,
3621
+ type: e.code === En ? H.TYPE : G.TYPE,
3621
3622
  data: ""
3622
3623
  }
3623
3624
  });
3624
3625
  }
3625
3626
  }
3626
- const xn = "freighterctx", Nn = 1e3, oe = class oe extends Rt {
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 = Sn();
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 = Br(
3661
+ const n = $r(
3661
3662
  {
3662
- [Dt]: this.encoder.contentType,
3663
+ [Lt]: this.encoder.contentType,
3663
3664
  ...r.params
3664
3665
  },
3665
- xn
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 Un(t, this.encoder, r, n);
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 at = oe;
3685
+ let ot = oe;
3685
3686
  export {
3686
- Z as EOF,
3687
- Pn as HTTPClient,
3687
+ H as EOF,
3688
+ jn as HTTPClient,
3688
3689
  G as StreamClosed,
3689
3690
  K as Unreachable,
3690
- at as WebSocketClient,
3691
- Fn as sendRequired,
3692
- jn as unaryWithBreaker
3691
+ ot as WebSocketClient,
3692
+ zn as sendRequired,
3693
+ Fn as unaryWithBreaker
3693
3694
  };