@synnaxlabs/freighter 0.50.0 → 0.52.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,8 +1,8 @@
1
- import b, { z as s } from "zod";
2
- const Xe = (r) => {
1
+ import Y, { z as s } from "zod";
2
+ const Ke = (r) => {
3
3
  const e = r.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
4
4
  return e.length > 1 && e[0] === e[0].toUpperCase() && e[1] === e[1].toUpperCase() || e.length === 0 ? e : e[0].toLowerCase() + e.slice(1);
5
- }, Ne = (r) => {
5
+ }, Ee = (r) => {
6
6
  const e = (t, n = se) => {
7
7
  if (typeof t == "string") return r(t);
8
8
  if (Array.isArray(t)) return t.map((c) => e(c, n));
@@ -12,24 +12,24 @@ const Xe = (r) => {
12
12
  return "toJSON" in o && typeof o.toJSON == "function" ? e(o.toJSON(), n) : (Object.keys(o).forEach((c) => {
13
13
  let d = o[c];
14
14
  const w = r(c);
15
- n.recursive && (te(d) ? pe(d) || (d = e(d, n)) : n.recursiveInArray && ye(d) && (d = [...d].map((h) => {
15
+ n.recursive && (te(d) ? we(d) || (d = e(d, n)) : n.recursiveInArray && pe(d) && (d = [...d].map((h) => {
16
16
  let g = h;
17
- return te(h) ? pe(g) || (g = e(h, n)) : ye(h) && (g = e({ key: h }, n).key), g;
17
+ return te(h) ? we(g) || (g = e(h, n)) : pe(h) && (g = e({ key: h }, n).key), g;
18
18
  }))), i[w] = d;
19
19
  }), i);
20
20
  };
21
21
  return e;
22
- }, Ee = Ne(Xe), Qe = (r) => (
22
+ }, xe = Ee(Ke), Qe = (r) => (
23
23
  // Don't convert the first character and don't convert a character that is after a
24
24
  // non-alphanumeric character
25
25
  r.replace(
26
26
  /([a-z0-9])([A-Z])/g,
27
27
  (e, t, n) => `${t}_${n.toLowerCase()}`
28
28
  )
29
- ), _e = Ne(Qe), et = [Number, String, Uint8Array], se = {
29
+ ), _e = Ee(Qe), et = [Number, String, Uint8Array], se = {
30
30
  recursive: !0,
31
31
  recursiveInArray: !0
32
- }, tt = (r = se) => (r.recursive == null ? r = se : r.recursiveInArray ??= !1, r), ye = (r) => r != null && Array.isArray(r), te = (r) => r != null && typeof r == "object" && !Array.isArray(r), pe = (r) => et.some((e) => r instanceof e);
32
+ }, tt = (r = se) => (r.recursive == null ? r = se : r.recursiveInArray ??= !1, r), pe = (r) => r != null && Array.isArray(r), te = (r) => r != null && typeof r == "object" && !Array.isArray(r), we = (r) => et.some((e) => r instanceof e);
33
33
  class rt {
34
34
  contentType = "application/json";
35
35
  decoder;
@@ -44,7 +44,7 @@ class rt {
44
44
  return this.decodeString(this.decoder.decode(e), t);
45
45
  }
46
46
  decodeString(e, t) {
47
- const n = JSON.parse(e), i = Ee(n);
47
+ const n = JSON.parse(e), i = xe(n);
48
48
  return t != null ? t.parse(i) : i;
49
49
  }
50
50
  encodeString(e) {
@@ -52,7 +52,7 @@ class rt {
52
52
  return JSON.stringify(t, (n, i) => ArrayBuffer.isView(i) ? Array.from(i) : typeof i == "bigint" ? i.toString() : i);
53
53
  }
54
54
  }
55
- const ie = new rt(), A = (r) => r != null && typeof r == "object" && "value" in r;
55
+ const ie = new rt(), E = (r) => r != null && typeof r == "object" && "value" in r;
56
56
  class Z {
57
57
  /** The underlying primitive value */
58
58
  value;
@@ -100,13 +100,13 @@ const nt = (r) => r != null && typeof r == "object" && "toString" in r, st = (r,
100
100
  }
101
101
  return e ? it(n) : n;
102
102
  }, it = (r) => (e, t) => r(t, e);
103
- let Ae = (r, e = 21) => (t = e) => {
103
+ let Ue = (r, e = 21) => (t = e) => {
104
104
  let n = "", i = t | 0;
105
105
  for (; i--; )
106
106
  n += r[Math.random() * r.length | 0];
107
107
  return n;
108
108
  };
109
- const xe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", at = `0123456789${xe}`, ot = 11, ut = Ae(xe, 1), lt = Ae(at, ot - 1), ct = () => `${ut()}${lt()}`, ht = (r, e) => (t) => t instanceof e || typeof t == "object" && t !== null && "discriminator" in t && t.discriminator === r, ft = 2 ** 12 - 1, ae = 2n ** 63n - 1n, dt = 2 ** 63 - 1, _ = (r) => (e, t) => {
109
+ const Ae = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", at = `0123456789${Ae}`, ot = 11, ut = Ue(Ae, 1), lt = Ue(at, ot - 1), ct = () => `${ut()}${lt()}`, ht = (r, e) => (t) => t instanceof e || typeof t == "object" && t !== null && "discriminator" in t && t.discriminator === r, ft = 2 ** 12 - 1, ae = 2n ** 63n - 1n, dt = 2 ** 63 - 1, _ = (r) => (e, t) => {
110
110
  if (typeof e == "bigint") {
111
111
  if (gt(t))
112
112
  return r(e, BigInt(t));
@@ -114,18 +114,18 @@ const xe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", at = `0123456
114
114
  return typeof n == "number" ? BigInt(Math.round(n)) : n;
115
115
  }
116
116
  return r(Number(e), Number(t));
117
- }, V = _((r, e) => r - e), $ = _((r, e) => r + e), gt = (r) => typeof r == "bigint" ? !0 : Number.isInteger(r), M = _((r, e) => r * e), ee = _((r, e) => r / e), Ue = s.tuple([s.number(), s.number()]), Me = s.object({ width: s.number(), height: s.number() }), mt = s.object({
117
+ }, z = _((r, e) => r - e), L = _((r, e) => r + e), gt = (r) => typeof r == "bigint" ? !0 : Number.isInteger(r), A = _((r, e) => r * e), ee = _((r, e) => r / e), Me = s.tuple([s.number(), s.number()]), Ce = s.object({ width: s.number(), height: s.number() }), mt = s.object({
118
118
  signedWidth: s.number(),
119
119
  signedHeight: s.number()
120
- }), yt = ["start", "center", "end"], G = s.object({ x: s.number(), y: s.number() }), pt = s.object({ clientX: s.number(), clientY: s.number() }), wt = ["x", "y"], Ce = s.enum(wt), Be = ["top", "right", "bottom", "left"];
121
- s.enum(Be);
122
- const bt = ["left", "right"], Re = s.enum(bt), Ot = ["top", "bottom"], De = s.enum(Ot), Le = ["center"], we = s.enum(Le), Tt = [...Be, ...Le], $e = s.enum(Tt);
120
+ }), yt = ["start", "center", "end"], W = s.object({ x: s.number(), y: s.number() }), pt = s.object({ clientX: s.number(), clientY: s.number() }), wt = ["x", "y"], Be = s.enum(wt), Re = ["top", "right", "bottom", "left"];
121
+ s.enum(Re);
122
+ const bt = ["left", "right"], De = s.enum(bt), Tt = ["top", "bottom"], $e = s.enum(Tt), Le = ["center"], be = s.enum(Le), Ot = [...Re, ...Le], ke = s.enum(Ot);
123
123
  s.enum(yt);
124
124
  const vt = ["first", "last"];
125
125
  s.enum(vt);
126
126
  s.object({ lower: s.number(), upper: s.number() });
127
- s.enum([...Ce.options, ...$e.options]);
128
- s.union([Ce, $e, s.instanceof(String)]);
127
+ s.enum([...Be.options, ...ke.options]);
128
+ s.union([Be, ke, s.instanceof(String)]);
129
129
  const k = (r, e, t) => {
130
130
  const n = {};
131
131
  if (typeof e == "object" && (t = e, e = void 0), t = { makeValid: !0, ...t }, typeof r == "number" || typeof r == "bigint")
@@ -136,19 +136,19 @@ const k = (r, e, t) => {
136
136
  } else
137
137
  n.lower = r.lower, n.upper = r.upper;
138
138
  return t?.makeValid ? St(n) : n;
139
- }, St = (r) => r.lower > r.upper ? { lower: r.upper, upper: r.lower } : r, be = (r, e) => {
139
+ }, St = (r) => r.lower > r.upper ? { lower: r.upper, upper: r.lower } : r, Te = (r, e) => {
140
140
  const t = k(r);
141
141
  return e < t.lower ? t.lower : e >= t.upper ? t.upper - (typeof t.upper == "number" ? 1 : 1n) : e;
142
142
  };
143
143
  s.object({
144
- x: Re.or(we),
145
- y: De.or(we)
144
+ x: De.or(be),
145
+ y: $e.or(be)
146
146
  });
147
- const ke = s.object({ x: Re, y: De }), It = Object.freeze({ x: "left", y: "top" }), Nt = (r, e) => r.x === e.x && r.y === e.y, Oe = s.union([
147
+ const Pe = s.object({ x: De, y: $e }), It = Object.freeze({ x: "left", y: "top" }), Nt = (r, e) => r.x === e.x && r.y === e.y, Oe = s.union([
148
148
  s.number(),
149
- G,
150
- Ue,
149
+ W,
151
150
  Me,
151
+ Ce,
152
152
  mt,
153
153
  pt
154
154
  ]), Et = (r, e) => {
@@ -157,12 +157,12 @@ const ke = s.object({ x: Re, y: De }), It = Object.freeze({ x: "left", y: "top"
157
157
  return r === "x" ? { x: e, y: 0 } : { x: 0, y: e };
158
158
  }
159
159
  return typeof r == "number" ? { x: r, y: e ?? r } : Array.isArray(r) ? { x: r[0], y: r[1] } : "signedWidth" in r ? { x: r.signedWidth, y: r.signedHeight } : "clientX" in r ? { x: r.clientX, y: r.clientY } : "width" in r ? { x: r.width, y: r.height } : { x: r.x, y: r.y };
160
- }, Te = Object.freeze({ x: 0, y: 0 }), K = s.union([s.number(), s.string()]);
160
+ }, ve = Object.freeze({ x: 0, y: 0 }), X = s.union([s.number(), s.string()]);
161
161
  s.object({
162
- top: K,
163
- left: K,
164
- width: K,
165
- height: K
162
+ top: X,
163
+ left: X,
164
+ width: X,
165
+ height: X
166
166
  });
167
167
  s.object({
168
168
  left: s.number(),
@@ -171,14 +171,14 @@ s.object({
171
171
  bottom: s.number()
172
172
  });
173
173
  s.object({
174
- one: G,
175
- two: G,
176
- root: ke
174
+ one: W,
175
+ two: W,
176
+ root: Pe
177
177
  });
178
178
  const he = (r, e, t = 0, n = 0, i) => {
179
179
  const o = {
180
- one: { ...Te },
181
- two: { ...Te },
180
+ one: { ...ve },
181
+ two: { ...ve },
182
182
  root: i ?? It
183
183
  };
184
184
  if (typeof r == "number") {
@@ -199,9 +199,9 @@ const he = (r, e, t = 0, n = 0, i) => {
199
199
  }, ne = (r) => {
200
200
  const e = he(r);
201
201
  return { lower: e.one.y, upper: e.two.y };
202
- }, At = (r) => typeof r != "object" || r == null ? !1 : "one" in r && "two" in r && "root" in r, xt = s.object({ signedWidth: s.number(), signedHeight: s.number() });
203
- s.union([Me, xt, G, Ue]);
204
- const Ut = (r, e, t) => e !== void 0 && r < e ? e : t !== void 0 && r > t ? t : r;
202
+ }, xt = (r) => typeof r != "object" || r == null ? !1 : "one" in r && "two" in r && "root" in r, Ut = s.object({ signedWidth: s.number(), signedHeight: s.number() });
203
+ s.union([Ce, Ut, W, Me]);
204
+ const At = (r, e, t) => e !== void 0 && r < e ? e : t !== void 0 && r > t ? t : r;
205
205
  s.object({ offset: Oe, scale: Oe });
206
206
  s.object({ offset: s.number(), scale: s.number() });
207
207
  const Mt = (r) => (e, t, n, i) => t === "dimension" ? [e, n] : [
@@ -221,9 +221,9 @@ const Mt = (r) => (e, t, n, i) => t === "dimension" ? [e, n] : [
221
221
  if (e === "dimension") return [r, t];
222
222
  const { lower: n, upper: i } = r;
223
223
  return [r, i - (t - n)];
224
- }, Lt = (r) => (e, t, n) => {
224
+ }, $t = (r) => (e, t, n) => {
225
225
  const { lower: i, upper: o } = r;
226
- return n = Ut(n, i, o), [e, n];
226
+ return n = At(n, i, o), [e, n];
227
227
  };
228
228
  class R {
229
229
  ops = [];
@@ -277,7 +277,7 @@ class R {
277
277
  return o.type = "scale", i.ops.push(o), i;
278
278
  }
279
279
  clamp(e, t) {
280
- const n = k(e, t), i = this.new(), o = Lt(n);
280
+ const n = k(e, t), i = this.new(), o = $t(n);
281
281
  return o.type = "clamp", i.ops.push(o), i;
282
282
  }
283
283
  reBound(e, t) {
@@ -371,7 +371,7 @@ class U {
371
371
  }
372
372
  scale(e) {
373
373
  const t = this.copy();
374
- if (At(e)) {
374
+ if (xt(e)) {
375
375
  const n = this.currRoot;
376
376
  return t.currRoot = e.root, n != null && !Nt(n, e.root) && (n.x !== e.root.x && (t.x = t.x.invert()), n.y !== e.root.y && (t.y = t.y.invert())), t.x = t.x.scale(re(e)), t.y = t.y.scale(ne(e)), t;
377
377
  }
@@ -416,19 +416,19 @@ class U {
416
416
  }
417
417
  static IDENTITY = new U();
418
418
  }
419
- const $t = G.extend({
420
- root: ke,
421
- units: b.object({
422
- x: b.enum(["px", "decimal"]),
423
- y: b.enum(["px", "decimal"])
419
+ const Lt = W.extend({
420
+ root: Pe,
421
+ units: Y.object({
422
+ x: Y.enum(["px", "decimal"]),
423
+ y: Y.enum(["px", "decimal"])
424
424
  })
425
425
  });
426
- $t.partial({ root: !0, units: !0 });
427
- const kt = s.enum(["static", "dynamic"]), ve = 365, X = 30, Pt = s.union([
426
+ Lt.partial({ root: !0, units: !0 });
427
+ const kt = s.enum(["static", "dynamic"]), Se = 365, K = 30, Pt = s.union([
428
428
  s.tuple([s.int()]),
429
429
  s.tuple([s.int(), s.int().min(1).max(12)]),
430
430
  s.tuple([s.int(), s.int().min(1).max(12), s.int().min(1).max(31)])
431
- ]), Pe = (r, e) => {
431
+ ]), Ye = (r, e) => {
432
432
  const t = new u(e);
433
433
  if (![
434
434
  l.DAY,
@@ -455,7 +455,7 @@ class u extends Z {
455
455
  else if (Array.isArray(e)) super(u.parseDate(e));
456
456
  else {
457
457
  let n = 0n;
458
- e instanceof Number && (e = e.valueOf()), t === "local" && (n = u.utcOffset.valueOf()), typeof e == "number" && (isFinite(e) ? e === dt ? e = ae : e = Math.trunc(e) : (isNaN(e) && (e = 0), e === 1 / 0 ? e = u.MAX : e = u.MIN)), A(e) && (e = e.value), super(BigInt(e.valueOf()) + n);
458
+ e instanceof Number && (e = e.valueOf()), t === "local" && (n = u.utcOffset.valueOf()), typeof e == "number" && (isFinite(e) ? e === dt ? e = ae : e = Math.trunc(e) : (isNaN(e) && (e = 0), e === 1 / 0 ? e = u.MAX : e = u.MIN)), E(e) && (e = e.value), super(BigInt(e.valueOf()) + n);
459
459
  }
460
460
  }
461
461
  static parseDate([e = 1970, t = 1, n = 1]) {
@@ -552,7 +552,7 @@ class u extends Z {
552
552
  * valid, regardless of the TimeStamp order.
553
553
  */
554
554
  range(e) {
555
- return new I(this, e).makeValid();
555
+ return new S(this, e).makeValid();
556
556
  }
557
557
  /**
558
558
  * Creates a TimeRange starting at the TimeStamp and spanning the given
@@ -621,7 +621,7 @@ class u extends Z {
621
621
  * TimeSpan.
622
622
  */
623
623
  add(e) {
624
- return new u($(this.valueOf(), new l(e).valueOf()));
624
+ return new u(L(this.valueOf(), new l(e).valueOf()));
625
625
  }
626
626
  /**
627
627
  * Subtracts a TimeSpan from the TimeStamp.
@@ -631,7 +631,7 @@ class u extends Z {
631
631
  * TimeSpan.
632
632
  */
633
633
  sub(e) {
634
- return new u(V(this.valueOf(), new l(e).valueOf()));
634
+ return new u(z(this.valueOf(), new l(e).valueOf()));
635
635
  }
636
636
  /**
637
637
  * @returns the floating point number of hours since the unix epoch to the timestamp
@@ -822,7 +822,7 @@ class u extends Z {
822
822
  * @example TimeStamp.now().remainder(TimeStamp.DAY) // => TimeStamp representing the current day
823
823
  */
824
824
  remainder(e) {
825
- return Pe(this, e);
825
+ return Ye(this, e);
826
826
  }
827
827
  /** @returns true if the day portion TimeStamp is today, false otherwise. */
828
828
  get isToday() {
@@ -967,7 +967,7 @@ class u extends Z {
967
967
  }
968
968
  class l extends Z {
969
969
  constructor(e) {
970
- typeof e == "number" && (e = Math.trunc(e.valueOf())), A(e) && (e = e.value), super(BigInt(e.valueOf()));
970
+ typeof e == "number" && (e = Math.trunc(e.valueOf())), E(e) && (e = e.value), super(BigInt(e.valueOf()));
971
971
  }
972
972
  /**
973
973
  * Creates a TimeSpan representing the given number of seconds.
@@ -976,7 +976,7 @@ class l extends Z {
976
976
  * @returns A TimeSpan representing the given number of seconds.
977
977
  */
978
978
  static fromSeconds(e) {
979
- return e instanceof l ? e : e instanceof N ? e.period : e instanceof u ? new l(e) : (A(e) && (e = e.value), ["number", "bigint"].includes(typeof e) ? l.seconds(e) : new l(e));
979
+ return e instanceof l ? e : e instanceof I ? e.period : e instanceof u ? new l(e) : (E(e) && (e = e.value), ["number", "bigint"].includes(typeof e) ? l.seconds(e) : new l(e));
980
980
  }
981
981
  /**
982
982
  * Creates a TimeSpan representing the given number of milliseconds.
@@ -985,7 +985,7 @@ class l extends Z {
985
985
  * @returns A TimeSpan representing the given number of milliseconds.
986
986
  */
987
987
  static fromMilliseconds(e) {
988
- return e instanceof l ? e : e instanceof N ? e.period : e instanceof u ? new l(e) : (A(e) && (e = e.value), ["number", "bigint"].includes(typeof e) ? l.milliseconds(e) : new l(e));
988
+ return e instanceof l ? e : e instanceof I ? e.period : e instanceof u ? new l(e) : (E(e) && (e = e.value), ["number", "bigint"].includes(typeof e) ? l.milliseconds(e) : new l(e));
989
989
  }
990
990
  /**
991
991
  * @returns the primitive value of the TimeSpan. Overrides standard JS valueOf()
@@ -1037,7 +1037,7 @@ class l extends Z {
1037
1037
  * @returns A new TimeSpan representing the remainder.
1038
1038
  */
1039
1039
  remainder(e) {
1040
- return Pe(this, e);
1040
+ return Ye(this, e);
1041
1041
  }
1042
1042
  /**
1043
1043
  * Truncates the TimeSpan to the nearest multiple of the given span.
@@ -1060,65 +1060,65 @@ class l extends Z {
1060
1060
  */
1061
1061
  toString(e = "full") {
1062
1062
  if (e === "semantic") return this.toSemanticString();
1063
- const t = this.truncate(l.DAY), n = this.truncate(l.HOUR), i = this.truncate(l.MINUTE), o = this.truncate(l.SECOND), c = this.truncate(l.MILLISECOND), d = this.truncate(l.MICROSECOND), w = this.truncate(l.NANOSECOND), h = t, g = n.sub(t), O = i.sub(n), f = o.sub(i), T = c.sub(o), E = d.sub(c), x = w.sub(d);
1063
+ const t = this.truncate(l.DAY), n = this.truncate(l.HOUR), i = this.truncate(l.MINUTE), o = this.truncate(l.SECOND), c = this.truncate(l.MILLISECOND), d = this.truncate(l.MICROSECOND), w = this.truncate(l.NANOSECOND), h = t, g = n.sub(t), b = i.sub(n), f = o.sub(i), T = c.sub(o), N = d.sub(c), x = w.sub(d);
1064
1064
  let y = "";
1065
- return h.isZero || (y += `${h.days}d `), g.isZero || (y += `${g.hours}h `), O.isZero || (y += `${O.minutes}m `), f.isZero || (y += `${f.seconds}s `), T.isZero || (y += `${T.milliseconds}ms `), E.isZero || (y += `${E.microseconds}µs `), x.isZero || (y += `${x.nanoseconds}ns`), y.trim();
1065
+ return h.isZero || (y += `${h.days}d `), g.isZero || (y += `${g.hours}h `), b.isZero || (y += `${b.minutes}m `), f.isZero || (y += `${f.seconds}s `), T.isZero || (y += `${T.milliseconds}ms `), N.isZero || (y += `${N.microseconds}µs `), x.isZero || (y += `${x.nanoseconds}ns`), y.trim();
1066
1066
  }
1067
1067
  toSemanticString() {
1068
1068
  const e = this.valueOf() < 0n ? -this.valueOf() : this.valueOf(), t = new l(e), n = this.valueOf() < 0n;
1069
1069
  if (t.valueOf() === 0n) return "0s";
1070
1070
  if (t.lessThan(l.SECOND)) return "< 1s";
1071
- const i = t.days, o = t.hours, c = t.minutes, d = t.seconds, w = Math.floor(i / ve), h = Math.floor(i / X), g = Math.floor(i / 7), O = Math.floor(i), f = Math.floor(o), T = Math.floor(c), E = Math.floor(d), x = n ? "-" : "";
1071
+ const i = t.days, o = t.hours, c = t.minutes, d = t.seconds, w = Math.floor(i / Se), h = Math.floor(i / K), g = Math.floor(i / 7), b = Math.floor(i), f = Math.floor(o), T = Math.floor(c), N = Math.floor(d), x = n ? "-" : "";
1072
1072
  if (w >= 1) {
1073
1073
  let y = `${w}y`;
1074
1074
  if (w < 2) {
1075
- const v = Math.floor(
1076
- i % ve / X
1075
+ const O = Math.floor(
1076
+ i % Se / K
1077
1077
  );
1078
- v > 0 && (y += ` ${v}mo`);
1078
+ O > 0 && (y += ` ${O}mo`);
1079
1079
  }
1080
1080
  return x + y;
1081
1081
  }
1082
- if (g >= 1 && i < X && i % 7 === 0) {
1082
+ if (g >= 1 && i < K && i % 7 === 0) {
1083
1083
  let y = `${g}w`;
1084
- const v = Math.floor(i % 7), L = Math.floor(o - g * 7 * 24);
1085
- return g < 2 && (v > 0 ? y += ` ${v}d` : L > 0 && L < 24 && (y += ` ${L}h`)), x + y;
1084
+ const O = Math.floor(i % 7), $ = Math.floor(o - g * 7 * 24);
1085
+ return g < 2 && (O > 0 ? y += ` ${O}d` : $ > 0 && $ < 24 && (y += ` ${$}h`)), x + y;
1086
1086
  }
1087
1087
  if (h >= 1) {
1088
1088
  let y = `${h}mo`;
1089
1089
  if (h < 3) {
1090
- const v = Math.floor(i % X);
1091
- v > 0 && (y += ` ${v}d`);
1090
+ const O = Math.floor(i % K);
1091
+ O > 0 && (y += ` ${O}d`);
1092
1092
  }
1093
1093
  return x + y;
1094
1094
  }
1095
1095
  if (g >= 1) {
1096
1096
  let y = `${g}w`;
1097
- const v = Math.floor(i % 7), L = Math.floor(o - g * 7 * 24);
1098
- return g < 2 && (v > 0 ? y += ` ${v}d` : L > 0 && L < 24 && (y += ` ${L}h`)), x + y;
1097
+ const O = Math.floor(i % 7), $ = Math.floor(o - g * 7 * 24);
1098
+ return g < 2 && (O > 0 ? y += ` ${O}d` : $ > 0 && $ < 24 && (y += ` ${$}h`)), x + y;
1099
1099
  }
1100
- if (O >= 1) {
1101
- let y = `${O}d`;
1102
- const v = Math.floor(o - O * 24);
1103
- return O < 2 && v > 0 && (y += ` ${v}h`), x + y;
1100
+ if (b >= 1) {
1101
+ let y = `${b}d`;
1102
+ const O = Math.floor(o - b * 24);
1103
+ return b < 2 && O > 0 && (y += ` ${O}h`), x + y;
1104
1104
  }
1105
1105
  if (f >= 1) {
1106
1106
  let y = `${f}h`;
1107
1107
  if (f < 3) {
1108
- const v = Math.floor(c - f * 60);
1109
- v > 0 && (y += ` ${v}m`);
1108
+ const O = Math.floor(c - f * 60);
1109
+ O > 0 && (y += ` ${O}m`);
1110
1110
  }
1111
1111
  return x + y;
1112
1112
  }
1113
1113
  if (T >= 1) {
1114
1114
  let y = `${T}m`;
1115
1115
  if (T < 5) {
1116
- const v = Math.floor(d - T * 60);
1117
- v > 0 && (y += ` ${v}s`);
1116
+ const O = Math.floor(d - T * 60);
1117
+ O > 0 && (y += ` ${O}s`);
1118
1118
  }
1119
1119
  return x + y;
1120
1120
  }
1121
- return `${x}${E}s`;
1121
+ return `${x}${N}s`;
1122
1122
  }
1123
1123
  /**
1124
1124
  * Multiplies the TimeSpan by a scalar value.
@@ -1127,7 +1127,7 @@ class l extends Z {
1127
1127
  * @returns A new TimeSpan that is this TimeSpan multiplied by the provided value.
1128
1128
  */
1129
1129
  mult(e) {
1130
- return new l(M(this.valueOf(), e));
1130
+ return new l(A(this.valueOf(), e));
1131
1131
  }
1132
1132
  /**
1133
1133
  * Divides the TimeSpan by a scalar value.
@@ -1216,7 +1216,7 @@ class l extends Z {
1216
1216
  * @returns A TimeSpan representing the given number of microseconds.
1217
1217
  */
1218
1218
  static microseconds(e = 1) {
1219
- return l.nanoseconds(M(e, 1e3));
1219
+ return l.nanoseconds(A(e, 1e3));
1220
1220
  }
1221
1221
  /** A microsecond. */
1222
1222
  static MICROSECOND = l.microseconds(1);
@@ -1227,7 +1227,7 @@ class l extends Z {
1227
1227
  * @returns A TimeSpan representing the given number of milliseconds.
1228
1228
  */
1229
1229
  static milliseconds(e = 1) {
1230
- return l.microseconds(M(e, 1e3));
1230
+ return l.microseconds(A(e, 1e3));
1231
1231
  }
1232
1232
  /** A millisecond. */
1233
1233
  static MILLISECOND = l.milliseconds(1);
@@ -1238,7 +1238,7 @@ class l extends Z {
1238
1238
  * @returns A TimeSpan representing the given number of seconds.
1239
1239
  */
1240
1240
  static seconds(e = 1) {
1241
- return l.milliseconds(M(e, 1e3));
1241
+ return l.milliseconds(A(e, 1e3));
1242
1242
  }
1243
1243
  /** A second. */
1244
1244
  static SECOND = l.seconds(1);
@@ -1249,7 +1249,7 @@ class l extends Z {
1249
1249
  * @returns A TimeSpan representing the given number of minutes.
1250
1250
  */
1251
1251
  static minutes(e = 1) {
1252
- return l.seconds(M(e, 60));
1252
+ return l.seconds(A(e, 60));
1253
1253
  }
1254
1254
  /** A minute. */
1255
1255
  static MINUTE = l.minutes(1);
@@ -1260,7 +1260,7 @@ class l extends Z {
1260
1260
  * @returns A TimeSpan representing the given number of hours.
1261
1261
  */
1262
1262
  static hours(e) {
1263
- return l.minutes(M(e, 60));
1263
+ return l.minutes(A(e, 60));
1264
1264
  }
1265
1265
  /** Represents an hour. */
1266
1266
  static HOUR = l.hours(1);
@@ -1271,7 +1271,7 @@ class l extends Z {
1271
1271
  * @returns A TimeSpan representing the given number of days.
1272
1272
  */
1273
1273
  static days(e) {
1274
- return l.hours(M(e, 24));
1274
+ return l.hours(A(e, 24));
1275
1275
  }
1276
1276
  /** Represents a day. */
1277
1277
  static DAY = l.days(1);
@@ -1289,12 +1289,12 @@ class l extends Z {
1289
1289
  s.bigint().transform((e) => new l(e)),
1290
1290
  s.instanceof(l),
1291
1291
  s.instanceof(u).transform((e) => new l(e)),
1292
- s.custom((e) => e instanceof N).transform((e) => new l(e))
1292
+ s.custom((e) => e instanceof I).transform((e) => new l(e))
1293
1293
  ]);
1294
1294
  }
1295
- class N extends Z {
1295
+ class I extends Z {
1296
1296
  constructor(e) {
1297
- A(e) && (e = e.value), super(e.valueOf());
1297
+ E(e) && (e = e.value), super(e.valueOf());
1298
1298
  }
1299
1299
  /** @returns a pretty string representation of the rate in the format "X Hz". */
1300
1300
  toString() {
@@ -1302,7 +1302,7 @@ class N extends Z {
1302
1302
  }
1303
1303
  /** @returns The number of seconds in the Rate. */
1304
1304
  equals(e) {
1305
- return this.valueOf() === new N(e).valueOf();
1305
+ return this.valueOf() === new I(e).valueOf();
1306
1306
  }
1307
1307
  /**
1308
1308
  * Calculates the period of the Rate as a TimeSpan.
@@ -1357,7 +1357,7 @@ class N extends Z {
1357
1357
  * @returns A new Rate representing the sum of the two rates.
1358
1358
  */
1359
1359
  add(e) {
1360
- return new N($(this.valueOf(), new N(e).valueOf()));
1360
+ return new I(L(this.valueOf(), new I(e).valueOf()));
1361
1361
  }
1362
1362
  /**
1363
1363
  * Subtracts another Rate from this Rate.
@@ -1366,7 +1366,7 @@ class N extends Z {
1366
1366
  * @returns A new Rate representing the difference of the two rates.
1367
1367
  */
1368
1368
  sub(e) {
1369
- return new N(V(this.valueOf(), new N(e).valueOf()));
1369
+ return new I(z(this.valueOf(), new I(e).valueOf()));
1370
1370
  }
1371
1371
  /**
1372
1372
  * Multiplies this Rate by a scalar value.
@@ -1375,7 +1375,7 @@ class N extends Z {
1375
1375
  * @returns A new Rate representing this Rate multiplied by the value.
1376
1376
  */
1377
1377
  mult(e) {
1378
- return new N(M(this.valueOf(), e));
1378
+ return new I(A(this.valueOf(), e));
1379
1379
  }
1380
1380
  /**
1381
1381
  * Divides this Rate by a scalar value.
@@ -1384,7 +1384,7 @@ class N extends Z {
1384
1384
  * @returns A new Rate representing this Rate divided by the value.
1385
1385
  */
1386
1386
  div(e) {
1387
- return new N(ee(this.valueOf(), e));
1387
+ return new I(ee(this.valueOf(), e));
1388
1388
  }
1389
1389
  /**
1390
1390
  * Creates a Rate representing the given number of Hz.
@@ -1393,7 +1393,7 @@ class N extends Z {
1393
1393
  * @returns A Rate representing the given number of Hz.
1394
1394
  */
1395
1395
  static hz(e) {
1396
- return new N(e);
1396
+ return new I(e);
1397
1397
  }
1398
1398
  /**
1399
1399
  * Creates a Rate representing the given number of kHz.
@@ -1402,12 +1402,12 @@ class N extends Z {
1402
1402
  * @returns A Rate representing the given number of kHz.
1403
1403
  */
1404
1404
  static khz(e) {
1405
- return N.hz(e * 1e3);
1405
+ return I.hz(e * 1e3);
1406
1406
  }
1407
1407
  /** A zod schema for validating and transforming rates */
1408
1408
  static z = s.union([
1409
- s.number().transform((e) => new N(e)),
1410
- s.instanceof(N)
1409
+ s.number().transform((e) => new I(e)),
1410
+ s.instanceof(I)
1411
1411
  ]);
1412
1412
  }
1413
1413
  class p extends Z {
@@ -1419,7 +1419,7 @@ class p extends Z {
1419
1419
  * @returns A Density representing the given number of bytes per value.
1420
1420
  */
1421
1421
  constructor(e) {
1422
- A(e) && (e = e.value), super(e.valueOf());
1422
+ E(e) && (e = e.value), super(e.valueOf());
1423
1423
  }
1424
1424
  /**
1425
1425
  * Calculates the number of values in the given Size.
@@ -1446,7 +1446,7 @@ class p extends Z {
1446
1446
  * @returns A new Density representing the sum of the two densities.
1447
1447
  */
1448
1448
  add(e) {
1449
- return new p($(this.valueOf(), new p(e).valueOf()));
1449
+ return new p(L(this.valueOf(), new p(e).valueOf()));
1450
1450
  }
1451
1451
  /**
1452
1452
  * Subtracts another Density from this Density.
@@ -1455,7 +1455,7 @@ class p extends Z {
1455
1455
  * @returns A new Density representing the difference of the two densities.
1456
1456
  */
1457
1457
  sub(e) {
1458
- return new p(V(this.valueOf(), new p(e).valueOf()));
1458
+ return new p(z(this.valueOf(), new p(e).valueOf()));
1459
1459
  }
1460
1460
  /**
1461
1461
  * Multiplies this Density by a scalar value.
@@ -1464,7 +1464,7 @@ class p extends Z {
1464
1464
  * @returns A new Density representing this Density multiplied by the value.
1465
1465
  */
1466
1466
  mult(e) {
1467
- return new p(M(this.valueOf(), e));
1467
+ return new p(A(this.valueOf(), e));
1468
1468
  }
1469
1469
  /**
1470
1470
  * Divides this Density by a scalar value.
@@ -1493,7 +1493,7 @@ class p extends Z {
1493
1493
  s.instanceof(p)
1494
1494
  ]);
1495
1495
  }
1496
- class I {
1496
+ class S {
1497
1497
  /**
1498
1498
  * The starting TimeStamp of the TimeRange.
1499
1499
  *
@@ -1561,7 +1561,7 @@ class I {
1561
1561
  * @returns A TimeRange with the start and end swapped.
1562
1562
  */
1563
1563
  swap() {
1564
- return new I(this.end, this.start);
1564
+ return new S(this.end, this.start);
1565
1565
  }
1566
1566
  get numericBounds() {
1567
1567
  return {
@@ -1617,7 +1617,7 @@ class I {
1617
1617
  return o.before(i) ? !1 : new l(o.sub(i)).greaterThanOrEqual(t);
1618
1618
  }
1619
1619
  contains(e) {
1620
- return e instanceof I ? this.contains(e.start) && this.contains(e.end) : this.start.beforeEq(e) && this.end.after(e);
1620
+ return e instanceof S ? this.contains(e.start) && this.contains(e.end) : this.start.beforeEq(e) && this.end.after(e);
1621
1621
  }
1622
1622
  /**
1623
1623
  * Returns a new TimeRange that is bound by the given TimeRange.
@@ -1631,23 +1631,23 @@ class I {
1631
1631
  * console.log(bounded); // TimeRange(1500, 2000)
1632
1632
  */
1633
1633
  boundBy(e) {
1634
- const t = new I(this.start, this.end);
1634
+ const t = new S(this.start, this.end);
1635
1635
  return e.start.after(this.start) && (t.start = e.start), e.start.after(this.end) && (t.end = e.start), e.end.before(this.end) && (t.end = e.end), e.end.before(this.start) && (t.start = e.end), t;
1636
1636
  }
1637
1637
  static max(...e) {
1638
- return new I(
1638
+ return new S(
1639
1639
  u.min(...e.map((t) => t.start)),
1640
1640
  u.max(...e.map((t) => t.end))
1641
1641
  );
1642
1642
  }
1643
1643
  /** The maximum possible time range. */
1644
- static MAX = new I(u.MIN, u.MAX);
1644
+ static MAX = new S(u.MIN, u.MAX);
1645
1645
  /** A time range whose start and end are both zero. */
1646
- static ZERO = new I(u.ZERO, u.ZERO);
1646
+ static ZERO = new S(u.ZERO, u.ZERO);
1647
1647
  /** A zod schema for validating and transforming time ranges */
1648
1648
  static z = s.union([
1649
- s.object({ start: u.z, end: u.z }).transform((e) => new I(e.start, e.end)),
1650
- s.instanceof(I)
1649
+ s.object({ start: u.z, end: u.z }).transform((e) => new S(e.start, e.end)),
1650
+ s.instanceof(S)
1651
1651
  ]);
1652
1652
  /**
1653
1653
  * Sorts two time ranges. The range with the earlier start time is considered less than
@@ -1671,12 +1671,12 @@ class I {
1671
1671
  * is the minimum of the start times and the end is the maximum of the end times.
1672
1672
  */
1673
1673
  static merge(...e) {
1674
- return I.max(...e.map((t) => new I(t).makeValid()));
1674
+ return S.max(...e.map((t) => new S(t).makeValid()));
1675
1675
  }
1676
1676
  }
1677
1677
  class a extends Z {
1678
1678
  constructor(e) {
1679
- if (A(e) && (e = e.value), e instanceof a || typeof e == "string" || typeof e.valueOf() == "string")
1679
+ if (E(e) && (e = e.value), e instanceof a || typeof e == "string" || typeof e.valueOf() == "string")
1680
1680
  super(e.valueOf());
1681
1681
  else {
1682
1682
  const t = a.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);
@@ -1913,23 +1913,23 @@ class a extends Z {
1913
1913
  }
1914
1914
  class m extends Z {
1915
1915
  constructor(e) {
1916
- A(e) && (e = e.value), super(e.valueOf());
1916
+ E(e) && (e = e.value), super(e.valueOf());
1917
1917
  }
1918
1918
  /** @returns true if the Size is larger than the other size. */
1919
1919
  largerThan(e) {
1920
- return A(e) && (e = e.value), this.valueOf() > e.valueOf();
1920
+ return E(e) && (e = e.value), this.valueOf() > e.valueOf();
1921
1921
  }
1922
1922
  /** @returns true if the Size is smaller than the other size. */
1923
1923
  smallerThan(e) {
1924
- return A(e) && (e = e.value), this.valueOf() < e.valueOf();
1924
+ return E(e) && (e = e.value), this.valueOf() < e.valueOf();
1925
1925
  }
1926
1926
  /** @returns a new Size representing the sum of the two Sizes. */
1927
1927
  add(e) {
1928
- return A(e) && (e = e.value), new m($(this.valueOf(), e.valueOf()));
1928
+ return E(e) && (e = e.value), new m(L(this.valueOf(), e.valueOf()));
1929
1929
  }
1930
1930
  /** @returns a new Size representing the difference of the two Sizes. */
1931
1931
  sub(e) {
1932
- return A(e) && (e = e.value), new m(V(this.valueOf(), e.valueOf()));
1932
+ return E(e) && (e = e.value), new m(z(this.valueOf(), e.valueOf()));
1933
1933
  }
1934
1934
  /**
1935
1935
  * Multiplies this Size by a scalar value.
@@ -1938,7 +1938,7 @@ class m extends Z {
1938
1938
  * @returns A new Size representing this Size multiplied by the value.
1939
1939
  */
1940
1940
  mult(e) {
1941
- return new m(M(this.valueOf(), e));
1941
+ return new m(A(this.valueOf(), e));
1942
1942
  }
1943
1943
  /**
1944
1944
  * Divides this Size by a scalar value.
@@ -1978,8 +1978,8 @@ class m extends Z {
1978
1978
  /** @returns a nicely formatted string representation of the Size. */
1979
1979
  toString() {
1980
1980
  const e = this.truncate(m.TERABYTE), t = this.truncate(m.GIGABYTE), n = this.truncate(m.MEGABYTE), i = this.truncate(m.KILOBYTE), o = this.truncate(m.BYTE), c = e, d = t.sub(e), w = n.sub(t), h = i.sub(n), g = o.sub(i);
1981
- let O = "";
1982
- return c.isZero || (O += `${c.terabytes}TB `), d.isZero || (O += `${d.gigabytes}GB `), w.isZero || (O += `${w.megabytes}MB `), h.isZero || (O += `${h.kilobytes}KB `), (!g.isZero || O === "") && (O += `${g.valueOf()}B`), O.trim();
1981
+ let b = "";
1982
+ return c.isZero || (b += `${c.terabytes}TB `), d.isZero || (b += `${d.gigabytes}GB `), w.isZero || (b += `${w.megabytes}MB `), h.isZero || (b += `${h.kilobytes}KB `), (!g.isZero || b === "") && (b += `${g.valueOf()}B`), b.trim();
1983
1983
  }
1984
1984
  /**
1985
1985
  * Creates a Size from the given number of bytes.
@@ -2067,15 +2067,15 @@ s.union([
2067
2067
  const je = (r) => {
2068
2068
  const e = typeof r;
2069
2069
  return e === "string" || e === "number" || e === "boolean" || e === "bigint" || r instanceof u || r instanceof l || r instanceof Date;
2070
- }, jt = (r, e, t, n = 0) => r.usesBigInt && !e.usesBigInt ? Number(t) - Number(n) : !r.usesBigInt && e.usesBigInt ? BigInt(t.valueOf()) - BigInt(n.valueOf()) : V(t, n), Yt = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
2070
+ }, Yt = (r, e, t, n = 0) => r.usesBigInt && !e.usesBigInt ? Number(t) - Number(n) : !r.usesBigInt && e.usesBigInt ? BigInt(t.valueOf()) - BigInt(n.valueOf()) : z(t, n), jt = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
2071
2071
  function qt(r) {
2072
- return typeof r == "string" && Yt.test(r);
2072
+ return typeof r == "string" && jt.test(r);
2073
2073
  }
2074
- const S = [];
2074
+ const v = [];
2075
2075
  for (let r = 0; r < 256; ++r)
2076
- S.push((r + 256).toString(16).slice(1));
2076
+ v.push((r + 256).toString(16).slice(1));
2077
2077
  function Ft(r, e = 0) {
2078
- return (S[r[e + 0]] + S[r[e + 1]] + S[r[e + 2]] + S[r[e + 3]] + "-" + S[r[e + 4]] + S[r[e + 5]] + "-" + S[r[e + 6]] + S[r[e + 7]] + "-" + S[r[e + 8]] + S[r[e + 9]] + "-" + S[r[e + 10]] + S[r[e + 11]] + S[r[e + 12]] + S[r[e + 13]] + S[r[e + 14]] + S[r[e + 15]]).toLowerCase();
2078
+ return (v[r[e + 0]] + v[r[e + 1]] + v[r[e + 2]] + v[r[e + 3]] + "-" + v[r[e + 4]] + v[r[e + 5]] + "-" + v[r[e + 6]] + v[r[e + 7]] + "-" + v[r[e + 8]] + v[r[e + 9]] + "-" + v[r[e + 10]] + v[r[e + 11]] + v[r[e + 12]] + v[r[e + 13]] + v[r[e + 14]] + v[r[e + 15]]).toLowerCase();
2079
2079
  }
2080
2080
  function Zt(r, e = 0) {
2081
2081
  const t = Ft(r, e);
@@ -2084,17 +2084,17 @@ function Zt(r, e = 0) {
2084
2084
  return t;
2085
2085
  }
2086
2086
  typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
2087
- const Ye = (r, e) => Zt(r, e), B = -1, Wt = s.string().transform(
2087
+ const qe = (r, e) => Zt(r, e), B = -1, Gt = s.string().transform(
2088
2088
  (r) => new Uint8Array(
2089
2089
  atob(r).split("").map((e) => e.charCodeAt(0))
2090
2090
  ).buffer
2091
- ), zt = s.union([s.null(), s.undefined()]).transform(() => new Uint8Array().buffer), oe = 10, Gt = (r, e) => {
2091
+ ), Vt = s.union([s.null(), s.undefined()]).transform(() => new Uint8Array().buffer), oe = 10, Wt = (r, e) => {
2092
2092
  if (r === "number" && !e.isNumeric)
2093
2093
  throw new Error(`cannot convert series of type ${e.toString()} to number`);
2094
2094
  if (r === "bigint" && !e.usesBigInt)
2095
2095
  throw new Error(`cannot convert series of type ${e.toString()} to bigint`);
2096
- }, qe = "sy_x_telem_series";
2097
- class C {
2096
+ }, Fe = "sy_x_telem_series";
2097
+ class M {
2098
2098
  /**
2099
2099
  * A unique identifier for the series. If specified by the user, it is their
2100
2100
  * responsibility to ensure that it is unique. If not specified, a new ID will be
@@ -2105,7 +2105,7 @@ class C {
2105
2105
  * A discriminator used for identifying instances of the series class even
2106
2106
  * when bundlers mangle the class name.
2107
2107
  */
2108
- discriminator = qe;
2108
+ discriminator = Fe;
2109
2109
  /** The data type of the series. */
2110
2110
  dataType;
2111
2111
  /**
@@ -2121,7 +2121,7 @@ class C {
2121
2121
  /** The underlying data. */
2122
2122
  _data;
2123
2123
  /** The time range occupied by the series' data. */
2124
- timeRange = I.ZERO;
2124
+ timeRange = S.ZERO;
2125
2125
  /**
2126
2126
  * Alignment defines the location of the series relative to other series in a logical
2127
2127
  * group. Useful for defining the position of the series within a channel's data.
@@ -2150,12 +2150,12 @@ class C {
2150
2150
  * can be constructed into a series.
2151
2151
  */
2152
2152
  static crudeZ = s.object({
2153
- timeRange: I.z.optional(),
2153
+ timeRange: S.z.optional(),
2154
2154
  dataType: a.z,
2155
2155
  alignment: s.coerce.bigint().optional(),
2156
2156
  data: s.union([
2157
- Wt,
2158
- zt,
2157
+ Gt,
2158
+ Vt,
2159
2159
  s.instanceof(ArrayBuffer),
2160
2160
  s.instanceof(Uint8Array)
2161
2161
  ]),
@@ -2165,7 +2165,7 @@ class C {
2165
2165
  * A zod schema that validates and constructs a series from it's crude
2166
2166
  * representation.
2167
2167
  */
2168
- static z = C.crudeZ.transform((e) => new C(e));
2168
+ static z = M.crudeZ.transform((e) => new M(e));
2169
2169
  /**
2170
2170
  * The Series constructor accepts either a SeriesArgs object or a CrudeSeries value.
2171
2171
  *
@@ -2240,7 +2240,7 @@ class C {
2240
2240
  * @throws Error if data type cannot be inferred from input
2241
2241
  */
2242
2242
  constructor(e) {
2243
- Vt(e) && (e = { data: e }), e.data ??= [];
2243
+ zt(e) && (e = { data: e }), e.data ??= [];
2244
2244
  const {
2245
2245
  dataType: t,
2246
2246
  timeRange: n,
@@ -2256,14 +2256,14 @@ class C {
2256
2256
  this.key = f.key, this.dataType = f.dataType, this.sampleOffset = f.sampleOffset, this.gl = f.gl, this._data = f._data, this.timeRange = f.timeRange, this.alignment = f.alignment, this.alignmentMultiple = f.alignmentMultiple, this.cachedMin = f.cachedMin, this.cachedMax = f.cachedMax, this.writePos = f.writePos, this._refCount = f._refCount, this.cachedLength = f.cachedLength;
2257
2257
  return;
2258
2258
  }
2259
- const g = je(h), O = Array.isArray(h);
2259
+ const g = je(h), b = Array.isArray(h);
2260
2260
  if (t != null) this.dataType = new a(t);
2261
2261
  else {
2262
2262
  if (h instanceof ArrayBuffer)
2263
2263
  throw new Error(
2264
2264
  "cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type."
2265
2265
  );
2266
- if (O || g) {
2266
+ if (b || g) {
2267
2267
  let f = h;
2268
2268
  if (!g) {
2269
2269
  if (h.length === 0)
@@ -2285,25 +2285,25 @@ class C {
2285
2285
  );
2286
2286
  } else this.dataType = new a(h);
2287
2287
  }
2288
- if (!O && !g) this._data = h;
2289
- else if (O && h.length === 0)
2288
+ if (!b && !g) this._data = h;
2289
+ else if (b && h.length === 0)
2290
2290
  this._data = new this.dataType.Array([]).buffer;
2291
2291
  else {
2292
2292
  let f = g ? [h] : h;
2293
2293
  const T = f[0];
2294
- (T instanceof u || T instanceof Date || T instanceof l) && (f = f.map((E) => new u(E).valueOf())), this.dataType.equals(a.STRING) ? (this.cachedLength = f.length, this._data = new TextEncoder().encode(`${f.join(`
2294
+ (T instanceof u || T instanceof Date || T instanceof l) && (f = f.map((N) => new u(N).valueOf())), this.dataType.equals(a.STRING) ? (this.cachedLength = f.length, this._data = new TextEncoder().encode(`${f.join(`
2295
2295
  `)}
2296
2296
  `).buffer) : this.dataType.equals(a.JSON) ? (this.cachedLength = f.length, this._data = new TextEncoder().encode(
2297
- `${f.map((E) => ie.encodeString(E)).join(`
2297
+ `${f.map((N) => ie.encodeString(N)).join(`
2298
2298
  `)}
2299
2299
  `
2300
2300
  ).buffer) : this.dataType.usesBigInt && typeof T == "number" ? this._data = new this.dataType.Array(
2301
- f.map((E) => BigInt(Math.round(E)))
2301
+ f.map((N) => BigInt(Math.round(N)))
2302
2302
  ).buffer : !this.dataType.usesBigInt && typeof T == "bigint" ? this._data = new this.dataType.Array(
2303
2303
  f.map(Number)
2304
2304
  ).buffer : this._data = new this.dataType.Array(f).buffer;
2305
2305
  }
2306
- this.key = w, this.alignment = c, this.alignmentMultiple = d, this.sampleOffset = i ?? 0, this.timeRange = n ?? I.ZERO, this.gl = {
2306
+ this.key = w, this.alignment = c, this.alignmentMultiple = d, this.sampleOffset = i ?? 0, this.timeRange = n ?? S.ZERO, this.gl = {
2307
2307
  control: null,
2308
2308
  buffer: null,
2309
2309
  prevBuffer: 0,
@@ -2320,7 +2320,7 @@ class C {
2320
2320
  static alloc({ capacity: e, dataType: t, ...n }) {
2321
2321
  if (e === 0)
2322
2322
  throw new Error("[Series] - cannot allocate an array of length 0");
2323
- const i = new new a(t).Array(e), o = new C({ data: i.buffer, dataType: t, ...n });
2323
+ const i = new new a(t).Array(e), o = new M({ data: i.buffer, dataType: t, ...n });
2324
2324
  return o.writePos = 0, o;
2325
2325
  }
2326
2326
  /**
@@ -2467,8 +2467,8 @@ class C {
2467
2467
  if (this.dataType.equals(e)) return this;
2468
2468
  const n = new e.Array(this.length);
2469
2469
  for (let i = 0; i < this.length; i++)
2470
- n[i] = jt(this.dataType, e, this.data[i], t);
2471
- return new C({
2470
+ n[i] = Yt(this.dataType, e, this.data[i], t);
2471
+ return new M({
2472
2472
  data: n.buffer,
2473
2473
  dataType: e,
2474
2474
  timeRange: this.timeRange,
@@ -2497,7 +2497,7 @@ class C {
2497
2497
  calcMax() {
2498
2498
  if (this.dataType.isVariable)
2499
2499
  throw new Error("cannot calculate maximum on a variable length data type");
2500
- return this.writePos === 0 ? -1 / 0 : (this.cachedMax ??= this.calcRawMax(), $(this.cachedMax, this.sampleOffset));
2500
+ return this.writePos === 0 ? -1 / 0 : (this.cachedMax ??= this.calcRawMax(), L(this.cachedMax, this.sampleOffset));
2501
2501
  }
2502
2502
  calcRawMin() {
2503
2503
  if (this.length === 0) return 1 / 0;
@@ -2518,7 +2518,7 @@ class C {
2518
2518
  calcMin() {
2519
2519
  if (this.dataType.isVariable)
2520
2520
  throw new Error("cannot calculate minimum on a variable length data type");
2521
- return this.writePos === 0 ? 1 / 0 : (this.cachedMin ??= this.calcRawMin(), $(this.cachedMin, this.sampleOffset));
2521
+ return this.writePos === 0 ? 1 / 0 : (this.cachedMin ??= this.calcRawMin(), L(this.cachedMin, this.sampleOffset));
2522
2522
  }
2523
2523
  /** @returns the bounds of the series. */
2524
2524
  get bounds() {
@@ -2551,11 +2551,11 @@ class C {
2551
2551
  if (t === !0) throw new Error(`[series] - no value at index ${e}`);
2552
2552
  return;
2553
2553
  }
2554
- return $(n, this.sampleOffset);
2554
+ return L(n, this.sampleOffset);
2555
2555
  }
2556
2556
  atUUID(e, t) {
2557
2557
  e < 0 && (e = this.length + e);
2558
- const n = Ye(
2558
+ const n = qe(
2559
2559
  new Uint8Array(this.buffer, e * this.dataType.density.valueOf())
2560
2560
  );
2561
2561
  if (n == null) {
@@ -2584,7 +2584,7 @@ class C {
2584
2584
  }
2585
2585
  }
2586
2586
  const o = this.data.slice(n, i);
2587
- return this.dataType.equals(a.STRING) ? new TextDecoder().decode(o) : Ee(JSON.parse(new TextDecoder().decode(o)));
2587
+ return this.dataType.equals(a.STRING) ? new TextDecoder().decode(o) : xe(JSON.parse(new TextDecoder().decode(o)));
2588
2588
  }
2589
2589
  /**
2590
2590
  * @returns the index of the first sample that is greater than or equal to the given value.
@@ -2625,7 +2625,7 @@ class C {
2625
2625
  ), this.gl.prevBuffer = B;
2626
2626
  }
2627
2627
  as(e) {
2628
- return Gt(e, this.dataType), this;
2628
+ return Wt(e, this.dataType), this;
2629
2629
  }
2630
2630
  /** @returns a digest containing information about the series. */
2631
2631
  get digest() {
@@ -2634,8 +2634,8 @@ class C {
2634
2634
  dataType: this.dataType.toString(),
2635
2635
  sampleOffset: this.sampleOffset,
2636
2636
  alignment: {
2637
- lower: Ie(this.alignmentBounds.lower),
2638
- upper: Ie(this.alignmentBounds.upper),
2637
+ lower: Ne(this.alignmentBounds.lower),
2638
+ upper: Ne(this.alignmentBounds.upper),
2639
2639
  multiple: this.alignmentMultiple
2640
2640
  },
2641
2641
  timeRange: this.timeRange.toString(),
@@ -2676,7 +2676,7 @@ class C {
2676
2676
  const e = new Jt(this);
2677
2677
  return this.dataType.equals(a.JSON) ? new fe(e) : e;
2678
2678
  }
2679
- return this.dataType.equals(a.UUID) ? new Kt(this) : new Xt(this);
2679
+ return this.dataType.equals(a.UUID) ? new Xt(this) : new Kt(this);
2680
2680
  }
2681
2681
  /**
2682
2682
  * Returns a slice of the series from start to end.
@@ -2703,7 +2703,7 @@ class C {
2703
2703
  * @returns An iterator over the specified range.
2704
2704
  */
2705
2705
  subIterator(e, t) {
2706
- return new Se(this, e, t ?? this.length);
2706
+ return new Ie(this, e, t ?? this.length);
2707
2707
  }
2708
2708
  /**
2709
2709
  * Returns an iterator over a portion of the series based on alignment.
@@ -2717,12 +2717,12 @@ class C {
2717
2717
  ), i = Math.ceil(
2718
2718
  Number(t - this.alignment) / Number(this.alignmentMultiple)
2719
2719
  );
2720
- return new Se(this, n, i);
2720
+ return new Ie(this, n, i);
2721
2721
  }
2722
2722
  subBytes(e, t) {
2723
2723
  if (e >= 0 && (t == null || t >= this.byteLength.valueOf())) return this;
2724
2724
  const n = this.data.subarray(e, t);
2725
- return new C({
2725
+ return new M({
2726
2726
  data: n,
2727
2727
  dataType: this.dataType,
2728
2728
  timeRange: this.timeRange,
@@ -2734,7 +2734,7 @@ class C {
2734
2734
  sliceSub(e, t, n) {
2735
2735
  if (t <= 0 && (n == null || n >= this.length)) return this;
2736
2736
  let i;
2737
- return e ? i = this.data.subarray(t, n) : i = this.data.slice(t, n), new C({
2737
+ return e ? i = this.data.subarray(t, n) : i = this.data.slice(t, n), new M({
2738
2738
  data: i,
2739
2739
  dataType: this.dataType,
2740
2740
  timeRange: this.timeRange,
@@ -2749,10 +2749,10 @@ class C {
2749
2749
  * @returns A new series with the specified alignment.
2750
2750
  */
2751
2751
  reAlign(e) {
2752
- return new C({
2752
+ return new M({
2753
2753
  data: this.buffer,
2754
2754
  dataType: this.dataType,
2755
- timeRange: I.ZERO,
2755
+ timeRange: S.ZERO,
2756
2756
  sampleOffset: this.sampleOffset,
2757
2757
  glBufferUsage: "static",
2758
2758
  alignment: e
@@ -2776,15 +2776,15 @@ class C {
2776
2776
  return e += "])", e;
2777
2777
  }
2778
2778
  }
2779
- const Vt = (r) => r == null ? !1 : Array.isArray(r) || r instanceof ArrayBuffer || ArrayBuffer.isView(r) && !(r instanceof DataView) || r instanceof C ? !0 : je(r), Ht = ht(qe, C);
2780
- class Se {
2779
+ const zt = (r) => r == null ? !1 : Array.isArray(r) || r instanceof ArrayBuffer || ArrayBuffer.isView(r) && !(r instanceof DataView) || r instanceof M ? !0 : je(r), Ht = ht(Fe, M);
2780
+ class Ie {
2781
2781
  series;
2782
2782
  end;
2783
2783
  index;
2784
2784
  constructor(e, t, n) {
2785
2785
  this.series = e;
2786
2786
  const i = k(0, e.length + 1);
2787
- this.end = be(i, n), this.index = be(i, t);
2787
+ this.end = Te(i, n), this.index = Te(i, t);
2788
2788
  }
2789
2789
  next() {
2790
2790
  return this.index >= this.end ? { done: !0, value: void 0 } : { done: !1, value: this.series.at(this.index++, !0) };
@@ -2822,7 +2822,7 @@ class fe {
2822
2822
  };
2823
2823
  }
2824
2824
  }
2825
- class Kt {
2825
+ class Xt {
2826
2826
  series;
2827
2827
  index;
2828
2828
  data;
@@ -2834,11 +2834,11 @@ class Kt {
2834
2834
  }
2835
2835
  next() {
2836
2836
  if (this.index >= this.series.length) return { done: !0, value: void 0 };
2837
- const e = Ye(this.data, this.index * this.density);
2837
+ const e = qe(this.data, this.index * this.density);
2838
2838
  return this.index++, { done: !1, value: e };
2839
2839
  }
2840
2840
  }
2841
- class Xt {
2841
+ class Kt {
2842
2842
  series;
2843
2843
  index;
2844
2844
  constructor(e) {
@@ -2851,7 +2851,7 @@ class Xt {
2851
2851
  };
2852
2852
  }
2853
2853
  }
2854
- const Ie = (r) => {
2854
+ const Ne = (r) => {
2855
2855
  const e = r >> 32n, t = r & 0xffffffffn;
2856
2856
  return { domain: e, sample: t };
2857
2857
  }, Qt = async (r) => await new Promise(
@@ -2888,25 +2888,25 @@ const er = s.object({
2888
2888
  __proto__: null,
2889
2889
  Breaker: _t,
2890
2890
  breakerConfigZ: er
2891
- }, Symbol.toStringTag, { value: "Module" })), rr = /^#?([0-9a-f]{6}|[0-9a-f]{8})$/i, Fe = s.string().regex(rr), j = s.number().min(0).max(255), Ze = s.number().min(0).max(1), We = s.tuple([j, j, j, Ze]), nr = s.tuple([j, j, j]), sr = s.object({ rgba255: We }), ir = s.number().min(0).max(360), ar = s.number().min(0).max(100), or = s.number().min(0).max(100), ur = s.tuple([ir, ar, or, Ze]), de = s.union([Fe, nr, We, ur, sr]), lr = de.transform((r) => ge(r)), ge = (r, e = 1) => {
2892
- if (r = de.parse(r), typeof r == "string") return cr(r, e);
2891
+ }, Symbol.toStringTag, { value: "Module" })), rr = /^#?([0-9a-f]{6}|[0-9a-f]{8})$/i, Ze = s.string().regex(rr), C = s.number().min(0).max(255), de = s.number().min(0).max(1), Ge = s.tuple([C, C, C, de]), nr = s.tuple([C, C, C]), sr = s.object({ rgba255: Ge }), ir = s.object({ r: C, g: C, b: C, a: de }), ar = s.number().min(0).max(360), or = s.number().min(0).max(100), ur = s.number().min(0).max(100), lr = s.tuple([ar, or, ur, de]), ge = s.union([Ze, nr, Ge, lr, sr, ir]), Ve = ge.transform((r) => me(r)), me = (r, e = 1) => {
2892
+ if (r = ge.parse(r), typeof r == "string") return cr(r, e);
2893
2893
  if (Array.isArray(r)) {
2894
2894
  if (r.length < 3 || r.length > 4)
2895
2895
  throw new Error(`Invalid color: [${r.join(", ")}]`);
2896
2896
  return r.length === 3 ? [...r, e] : r;
2897
2897
  }
2898
- return r.rgba255;
2899
- }, cr = (r, e = 1) => (r = Fe.parse(r), r = hr(r), [
2898
+ return "a" in r && "r" in r ? [r.r, r.g, r.b, r.a] : r.rgba255;
2899
+ }, cr = (r, e = 1) => (r = Ze.parse(r), r = hr(r), [
2900
2900
  Q(r, 0),
2901
2901
  Q(r, 2),
2902
2902
  Q(r, 4),
2903
2903
  r.length === 8 ? Q(r, 6) / 255 : e
2904
2904
  ]), Q = (r, e) => parseInt(r.slice(e, e + 2), 16), hr = (r) => r.startsWith("#") ? r.slice(1) : r;
2905
- ge("#000000");
2906
- ge("#ffffff");
2905
+ me("#000000");
2906
+ me("#ffffff");
2907
2907
  const fr = s.object({
2908
2908
  key: s.string(),
2909
- color: de,
2909
+ color: ge,
2910
2910
  position: s.number(),
2911
2911
  switched: s.boolean().optional()
2912
2912
  });
@@ -2914,7 +2914,7 @@ s.array(fr);
2914
2914
  const dr = s.object({
2915
2915
  key: s.string(),
2916
2916
  name: s.string(),
2917
- color: lr
2917
+ color: Ve
2918
2918
  });
2919
2919
  s.object({
2920
2920
  key: s.string(),
@@ -2933,23 +2933,23 @@ const gr = (r) => Object.getOwnPropertySymbols(globalThis).includes(r), mr = (r,
2933
2933
  Object.defineProperty(globalThis, t, { value: n });
2934
2934
  }
2935
2935
  return () => globalThis[t];
2936
- }, ze = "sy_x_error", yr = (r) => (e) => e != null && typeof e == "object" && "type" in e && typeof e.type == "string" ? e.type.startsWith(r) : e instanceof Error ? e.message.startsWith(r) : typeof e != "string" ? !1 : e.startsWith(r), H = (r) => class W extends Error {
2937
- static discriminator = ze;
2938
- discriminator = W.discriminator;
2936
+ }, We = "sy_x_error", yr = (r) => (e) => e != null && typeof e == "object" && "type" in e && typeof e.type == "string" ? e.type.startsWith(r) : e instanceof Error ? e.message.startsWith(r) : typeof e != "string" ? !1 : e.startsWith(r), H = (r) => class G extends Error {
2937
+ static discriminator = We;
2938
+ discriminator = G.discriminator;
2939
2939
  static TYPE = r;
2940
- type = W.TYPE;
2940
+ type = G.TYPE;
2941
2941
  static matches = yr(r);
2942
- matches = W.matches;
2942
+ matches = G.matches;
2943
2943
  constructor(t, n) {
2944
- super(t, n), this.name = W.TYPE;
2944
+ super(t, n), this.name = G.TYPE;
2945
2945
  }
2946
2946
  static sub(t) {
2947
2947
  return H(`${r}.${t}`);
2948
2948
  }
2949
- }, Ge = (r) => {
2949
+ }, ze = (r) => {
2950
2950
  if (r == null || typeof r != "object") return !1;
2951
2951
  const e = r;
2952
- if (e.discriminator !== ze) return !1;
2952
+ if (e.discriminator !== We) return !1;
2953
2953
  if (!("type" in e))
2954
2954
  throw new Error(
2955
2955
  `X Error is missing its type property: ${JSON.stringify(e)}`
@@ -2963,7 +2963,7 @@ class pr {
2963
2963
  }
2964
2964
  encode(e) {
2965
2965
  if (e == null) return { type: ue, data: "" };
2966
- if (Ge(e))
2966
+ if (ze(e))
2967
2967
  for (const t of this.providers) {
2968
2968
  const n = t.encode(e);
2969
2969
  if (n != null) return n;
@@ -2986,10 +2986,10 @@ class pr {
2986
2986
  return new le(e.data);
2987
2987
  }
2988
2988
  }
2989
- const me = mr("synnax-error-registry", () => new pr()), wr = ({ encode: r, decode: e }) => me().register({ encode: r, decode: e }), br = (r) => me().encode(r), Or = (r) => r == null ? null : me().decode(r);
2989
+ const ye = mr("synnax-error-registry", () => new pr()), wr = ({ encode: r, decode: e }) => ye().register({ encode: r, decode: e }), br = (r) => ye().encode(r), Tr = (r) => r == null ? null : ye().decode(r);
2990
2990
  class le extends H("unknown") {
2991
2991
  }
2992
- const Tr = s.object({ type: s.string(), data: s.string() });
2992
+ const Or = s.object({ type: s.string(), data: s.string() });
2993
2993
  class vr extends H("canceled") {
2994
2994
  }
2995
2995
  class Sr extends H("not_implemented") {
@@ -3002,55 +3002,33 @@ const D = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3002
3002
  UNKNOWN: P,
3003
3003
  Unknown: le,
3004
3004
  createTyped: H,
3005
- decode: Or,
3005
+ decode: Tr,
3006
3006
  encode: br,
3007
- isTyped: Ge,
3008
- payloadZ: Tr,
3007
+ isTyped: ze,
3008
+ payloadZ: Or,
3009
3009
  register: wr
3010
- }, Symbol.toStringTag, { value: "Module" })), Ir = b.object({
3011
- jsonrpc: b.literal("2.0"),
3012
- method: b.string(),
3013
- // params should be z.union([z.record(z.string(), z.json()),
3014
- // z.array(z.json())]).optional() but the VSCode JSON RPC implementation uses a looser
3015
- // definition of params then in the JSON-RPC spec.
3016
- params: b.any().optional(),
3017
- id: b.union([b.string(), b.number(), b.null()]).optional()
3018
- }), Ve = b.object({
3019
- jsonrpc: b.literal("2.0"),
3020
- id: b.union([b.string(), b.number(), b.null()])
3021
- }), Nr = Ve.extend({
3022
- result: b.json()
3023
- }), Er = Ve.extend({
3024
- error: b.object({
3025
- code: b.number().int(),
3026
- // This should be z.string(), but the VSCode JSON RPC implementation uses a looser
3027
- // definition of error than the JSON-RPC spec.
3028
- message: b.string().optional(),
3029
- data: b.json().optional()
3030
- })
3031
- }), Ar = b.union([Nr, Er]);
3032
- b.union([Ir, Ar]);
3010
+ }, Symbol.toStringTag, { value: "Module" }));
3033
3011
  s.object({ key: s.string(), value: s.string() });
3034
- const xr = b.uuid();
3035
- b.object({
3036
- key: xr,
3037
- name: b.string().min(1),
3038
- color: b.string()
3012
+ const Ir = Y.uuid();
3013
+ Y.object({
3014
+ key: Ir,
3015
+ name: Y.string().min(1),
3016
+ color: Ve
3039
3017
  });
3040
3018
  s.string().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/);
3041
- const Ur = ["standard", "scientific", "engineering"];
3042
- s.enum(Ur);
3043
- const Mr = s.union([s.string(), s.number()]);
3044
- s.record(Mr, s.unknown());
3045
- const Cr = () => typeof process < "u" && process.versions != null && process.versions.node != null ? "node" : typeof window > "u" || window.document === void 0 ? "webworker" : "browser";
3046
- Cr();
3047
- const Br = ["macOS", "Windows", "Linux"], Rr = ["macos", "windows", "linux"], Dr = {
3019
+ const Nr = ["standard", "scientific", "engineering"];
3020
+ s.enum(Nr);
3021
+ const Er = s.union([s.string(), s.number()]);
3022
+ s.record(Er, s.unknown());
3023
+ const xr = () => typeof process < "u" && process.versions != null && process.versions.node != null ? "node" : typeof window > "u" || window.document === void 0 ? "webworker" : "browser";
3024
+ xr();
3025
+ const Ur = ["macOS", "Windows", "Linux"], Ar = ["macos", "windows", "linux"], Mr = {
3048
3026
  macos: "macOS",
3049
3027
  windows: "Windows",
3050
3028
  linux: "Linux"
3051
3029
  };
3052
- s.enum(Br).or(
3053
- s.enum(Rr).transform((r) => Dr[r])
3030
+ s.enum(Ur).or(
3031
+ s.enum(Ar).transform((r) => Mr[r])
3054
3032
  );
3055
3033
  s.enum([
3056
3034
  "success",
@@ -3064,8 +3042,8 @@ s.object({
3064
3042
  stack: s.string(),
3065
3043
  error: s.instanceof(Error)
3066
3044
  });
3067
- const Lr = (...r) => r.map(He).join(""), He = (r) => (r.endsWith("/") || (r += "/"), r.startsWith("/") && (r = r.slice(1)), r), $r = (r) => r.endsWith("/") ? r.slice(0, -1) : r, kr = (r, e = "") => r === null ? "" : `?${Object.entries(r).filter(([, t]) => t == null ? !1 : Array.isArray(t) ? t.length > 0 : !0).map(([t, n]) => `${e}${t}=${n}`).join("&")}`;
3068
- class z {
3045
+ const Cr = (...r) => r.map(He).join(""), He = (r) => (r.endsWith("/") || (r += "/"), r.startsWith("/") && (r = r.slice(1)), r), Br = (r) => r.endsWith("/") ? r.slice(0, -1) : r, Rr = (r, e = "") => r === null ? "" : `?${Object.entries(r).filter(([, t]) => t == null ? !1 : Array.isArray(t) ? t.length > 0 : !0).map(([t, n]) => `${e}${t}=${n}`).join("&")}`;
3046
+ class V {
3069
3047
  protocol;
3070
3048
  host;
3071
3049
  port;
@@ -3085,7 +3063,7 @@ class z {
3085
3063
  * @returns a new URL.
3086
3064
  */
3087
3065
  replace(e) {
3088
- return new z({
3066
+ return new V({
3089
3067
  host: e.host ?? this.host,
3090
3068
  port: e.port ?? this.port,
3091
3069
  protocol: e.protocol ?? this.protocol,
@@ -3098,23 +3076,23 @@ class z {
3098
3076
  * @returns a new URL.
3099
3077
  */
3100
3078
  child(e) {
3101
- return new z({
3079
+ return new V({
3102
3080
  ...this,
3103
- pathPrefix: Lr(this.path, e)
3081
+ pathPrefix: Cr(this.path, e)
3104
3082
  });
3105
3083
  }
3106
3084
  /** @returns a string representation of the url */
3107
3085
  toString() {
3108
- return $r(
3086
+ return Br(
3109
3087
  `${this.protocol}://${this.host}:${this.port}/${this.path}`
3110
3088
  );
3111
3089
  }
3112
- static UNKNOWN = new z({ host: "unknown", port: 0 });
3090
+ static UNKNOWN = new V({ host: "unknown", port: 0 });
3113
3091
  }
3114
3092
  s.int().min(0).max(ft);
3115
3093
  class J extends D.createTyped("freighter") {
3116
3094
  }
3117
- class Y extends J.sub("eof") {
3095
+ class j extends J.sub("eof") {
3118
3096
  constructor() {
3119
3097
  super("EOF");
3120
3098
  }
@@ -3127,23 +3105,23 @@ class q extends J.sub("stream_closed") {
3127
3105
  class F extends J.sub("unreachable") {
3128
3106
  url;
3129
3107
  constructor(e = {}) {
3130
- const { message: t = "Unreachable", url: n = z.UNKNOWN } = e;
3108
+ const { message: t = "Unreachable", url: n = V.UNKNOWN } = e;
3131
3109
  super(t), this.url = n;
3132
3110
  }
3133
3111
  }
3134
- const Pr = (r) => {
3112
+ const Dr = (r) => {
3135
3113
  if (!r.type.startsWith(J.TYPE)) return null;
3136
- if (Y.matches(r)) return { type: Y.TYPE, data: "EOF" };
3114
+ if (j.matches(r)) return { type: j.TYPE, data: "EOF" };
3137
3115
  if (q.matches(r))
3138
3116
  return { type: q.TYPE, data: "StreamClosed" };
3139
3117
  if (F.matches(r))
3140
3118
  return { type: F.TYPE, data: "Unreachable" };
3141
3119
  throw new Error(`Unknown error type: ${r.type}: ${r.message}`);
3142
- }, jr = (r) => {
3120
+ }, $r = (r) => {
3143
3121
  if (!r.type.startsWith(J.TYPE)) return null;
3144
3122
  switch (r.type) {
3145
- case Y.TYPE:
3146
- return new Y();
3123
+ case j.TYPE:
3124
+ return new j();
3147
3125
  case q.TYPE:
3148
3126
  return new q();
3149
3127
  case F.TYPE:
@@ -3153,8 +3131,8 @@ const Pr = (r) => {
3153
3131
  }
3154
3132
  };
3155
3133
  D.register({
3156
- encode: Pr,
3157
- decode: jr
3134
+ encode: Dr,
3135
+ decode: $r
3158
3136
  });
3159
3137
  class Je {
3160
3138
  middleware = [];
@@ -3181,24 +3159,24 @@ class Je {
3181
3159
  return await i(e);
3182
3160
  }
3183
3161
  }
3184
- const Ke = "Content-Type", Yr = /* @__PURE__ */ new Set([
3162
+ const Xe = "Content-Type", Lr = /* @__PURE__ */ new Set([
3185
3163
  "ECONNREFUSED",
3186
3164
  "ECONNRESET",
3187
3165
  "ETIMEDOUT",
3188
3166
  "EPIPE",
3189
3167
  "UND_ERR_CONNECT_TIMEOUT",
3190
3168
  "UND_ERR_SOCKET"
3191
- ]), qr = (r) => {
3169
+ ]), kr = (r) => {
3192
3170
  const e = r?.cause?.code ?? r?.code ?? r?.errno;
3193
- if (typeof e == "string" && Yr.has(e)) return !0;
3171
+ if (typeof e == "string" && Lr.has(e)) return !0;
3194
3172
  if (r.name === "TypeError") {
3195
3173
  const t = String(r.message || "").toLowerCase();
3196
3174
  if (/load failed|failed to fetch|networkerror|network error/.test(t))
3197
3175
  return typeof navigator < "u" && navigator.onLine === !1, !0;
3198
3176
  }
3199
3177
  return r?.name === "AbortError" || r?.code === "ABORT_ERR", !1;
3200
- }, Fr = 400;
3201
- class Hr extends Je {
3178
+ }, Pr = 400;
3179
+ class Gr extends Je {
3202
3180
  endpoint;
3203
3181
  encoder;
3204
3182
  constructor(e, t, n = !1) {
@@ -3208,7 +3186,7 @@ class Hr extends Je {
3208
3186
  }
3209
3187
  get headers() {
3210
3188
  return {
3211
- [Ke]: this.encoder.contentType
3189
+ [Xe]: this.encoder.contentType
3212
3190
  };
3213
3191
  }
3214
3192
  async send(e, t, n, i) {
@@ -3229,26 +3207,26 @@ class Hr extends Je {
3229
3207
  ...this.headers,
3230
3208
  ...h.params
3231
3209
  };
3232
- let O;
3210
+ let b;
3233
3211
  try {
3234
- O = await fetch(h.target, d);
3212
+ b = await fetch(h.target, d);
3235
3213
  } catch (T) {
3236
3214
  if (!(T instanceof Error)) throw T;
3237
- return [g, qr(T) ? new F({ url: c }) : T];
3215
+ return [g, kr(T) ? new F({ url: c }) : T];
3238
3216
  }
3239
- const f = await O.arrayBuffer();
3240
- if (O?.ok)
3217
+ const f = await b.arrayBuffer();
3218
+ if (b?.ok)
3241
3219
  return i != null && (o = this.encoder.decode(f, i)), [g, null];
3242
3220
  try {
3243
- if (O.status !== Fr)
3244
- return [g, new Error(O.statusText)];
3245
- const T = this.encoder.decode(f, D.payloadZ), E = D.decode(T);
3246
- return [g, E];
3221
+ if (b.status !== Pr)
3222
+ return [g, new Error(b.statusText)];
3223
+ const T = this.encoder.decode(f, D.payloadZ), N = D.decode(T);
3224
+ return [g, N];
3247
3225
  } catch (T) {
3248
3226
  return [
3249
3227
  g,
3250
3228
  new Error(
3251
- `[freighter] - failed to decode error: ${O.statusText}: ${T.message}`
3229
+ `[freighter] - failed to decode error: ${b.statusText}: ${T.message}`
3252
3230
  )
3253
3231
  ];
3254
3232
  }
@@ -3259,7 +3237,7 @@ class Hr extends Je {
3259
3237
  return [o, null];
3260
3238
  }
3261
3239
  }
3262
- const Jr = (r, e) => {
3240
+ const Vr = (r, e) => {
3263
3241
  class t {
3264
3242
  wrapped;
3265
3243
  constructor(i) {
@@ -3279,16 +3257,16 @@ const Jr = (r, e) => {
3279
3257
  }
3280
3258
  }
3281
3259
  return new t(r);
3282
- }, Kr = async (r, e, t, n, i) => {
3260
+ }, Wr = async (r, e, t, n, i) => {
3283
3261
  const [o, c] = await r.send(e, t, n, i);
3284
3262
  if (c != null) throw c;
3285
3263
  return o;
3286
- }, Zr = s.object({
3264
+ }, Yr = s.object({
3287
3265
  type: s.enum(["data", "close", "open"]),
3288
3266
  payload: s.unknown(),
3289
3267
  error: s.optional(D.payloadZ)
3290
3268
  });
3291
- class Wr {
3269
+ class jr {
3292
3270
  codec;
3293
3271
  reqSchema;
3294
3272
  resSchema;
@@ -3310,7 +3288,7 @@ class Wr {
3310
3288
  }
3311
3289
  /** Implements the Stream protocol */
3312
3290
  send(e) {
3313
- if (this.serverClosed != null) return new Y();
3291
+ if (this.serverClosed != null) return new j();
3314
3292
  if (this.sendClosed) throw new q();
3315
3293
  return this.ws.send(this.codec.encode({ type: "data", payload: e })), null;
3316
3294
  }
@@ -3353,19 +3331,19 @@ class Wr {
3353
3331
  this.ws.onmessage = this.onMessage.bind(this), this.ws.onclose = this.onClose.bind(this);
3354
3332
  }
3355
3333
  onMessage(e) {
3356
- this.addMessage(this.codec.decode(e.data, Zr));
3334
+ this.addMessage(this.codec.decode(e.data, Yr));
3357
3335
  }
3358
3336
  onClose(e) {
3359
3337
  this.addMessage({
3360
3338
  type: "close",
3361
3339
  error: {
3362
- type: e.code === Gr ? Y.TYPE : q.TYPE,
3340
+ type: e.code === Fr ? j.TYPE : q.TYPE,
3363
3341
  data: ""
3364
3342
  }
3365
3343
  });
3366
3344
  }
3367
3345
  }
3368
- const zr = "freighterctx", Gr = 1e3;
3346
+ const qr = "freighterctx", Fr = 1e3;
3369
3347
  class ce extends Je {
3370
3348
  baseUrl;
3371
3349
  encoder;
@@ -3399,19 +3377,19 @@ class ce extends Je {
3399
3377
  return i;
3400
3378
  }
3401
3379
  buildURL(e, t) {
3402
- const n = kr(
3380
+ const n = Rr(
3403
3381
  {
3404
- [Ke]: this.encoder.contentType,
3382
+ [Xe]: this.encoder.contentType,
3405
3383
  ...t.params
3406
3384
  },
3407
- zr
3385
+ qr
3408
3386
  );
3409
3387
  return this.baseUrl.child(e).toString() + n;
3410
3388
  }
3411
3389
  async wrapSocket(e, t, n) {
3412
3390
  return await new Promise((i) => {
3413
3391
  e.onopen = () => {
3414
- const o = new Wr(e, this.encoder, t, n);
3392
+ const o = new jr(e, this.encoder, t, n);
3415
3393
  o.receiveOpenAck().then((c) => {
3416
3394
  c != null ? i(c) : i(o);
3417
3395
  }).catch((c) => i(c));
@@ -3423,11 +3401,11 @@ class ce extends Je {
3423
3401
  }
3424
3402
  }
3425
3403
  export {
3426
- Y as EOF,
3427
- Hr as HTTPClient,
3404
+ j as EOF,
3405
+ Gr as HTTPClient,
3428
3406
  q as StreamClosed,
3429
3407
  F as Unreachable,
3430
3408
  ce as WebSocketClient,
3431
- Kr as sendRequired,
3432
- Jr as unaryWithBreaker
3409
+ Wr as sendRequired,
3410
+ Vr as unaryWithBreaker
3433
3411
  };