@synnaxlabs/drift 0.54.0 → 0.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -148,7 +148,7 @@ function re(e) {
148
148
  return e == null;
149
149
  }
150
150
  function ie(e) {
151
- let t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
151
+ let t = +!!e.startsWith("^"), n = e.endsWith("$") ? e.length - 1 : e.length;
152
152
  return e.slice(t, n);
153
153
  }
154
154
  function ae(e, t) {
@@ -2273,7 +2273,7 @@ var Hi = /* @__PURE__ */ r("$ZodTemplateLiteral", (e, t) => {
2273
2273
  if (!e._zod.pattern) throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);
2274
2274
  let t = e._zod.pattern instanceof RegExp ? e._zod.pattern.source : e._zod.pattern;
2275
2275
  if (!t) throw Error(`Invalid template literal part: ${e._zod.traits}`);
2276
- let r = t.startsWith("^") ? 1 : 0, i = t.endsWith("$") ? t.length - 1 : t.length;
2276
+ let r = +!!t.startsWith("^"), i = t.endsWith("$") ? t.length - 1 : t.length;
2277
2277
  n.push(t.slice(r, i));
2278
2278
  } else if (e === null || we.has(typeof e)) n.push(Te(`${e}`));
2279
2279
  else throw Error(`Invalid template literal part: ${e}`);
@@ -10011,7 +10011,7 @@ function W(e, t) {
10011
10011
  }
10012
10012
  if (e.allOf && Array.isArray(e.allOf)) if (e.allOf.length === 0) n = r ? n : U.any();
10013
10013
  else {
10014
- let i = r ? n : W(e.allOf[0], t), a = r ? 0 : 1;
10014
+ let i = r ? n : W(e.allOf[0], t), a = +!r;
10015
10015
  for (let n = a; n < e.allOf.length; n++) i = U.intersection(i, W(e.allOf[n], t));
10016
10016
  n = i;
10017
10017
  }
@@ -10396,149 +10396,687 @@ var kp = Op, Ap = Object.defineProperty, jp = (e, t) => {
10396
10396
  recursive: !0,
10397
10397
  recursiveInArray: !0,
10398
10398
  schema: void 0
10399
- }, Up = (e) => typeof e == "object" && !!e && !Array.isArray(e), Wp = (e) => e instanceof Uint8Array || e instanceof Number || e instanceof String, Gp = (e) => typeof e == "object" && !!e && !Array.isArray(e), Kp = class {
10400
- contentType = "application/json";
10401
- decoder;
10402
- encoder;
10403
- constructor() {
10404
- this.decoder = new TextDecoder(), this.encoder = new TextEncoder();
10405
- }
10406
- encode(e, t) {
10407
- return this.encoder.encode(this.encodeString(e, t));
10408
- }
10409
- decode(e, t) {
10410
- return this.decodeString(this.decoder.decode(e), t);
10411
- }
10412
- decodeString(e, t) {
10413
- let n = Bp(JSON.parse(e), { schema: t });
10414
- return t == null ? n : t.parse(n);
10415
- }
10416
- encodeString(e, t) {
10417
- let n = Vp((t == null ? e : t.parse(e)) ?? {}, { schema: t });
10418
- return JSON.stringify(n, (e, t) => ArrayBuffer.isView(t) ? Array.from(t) : typeof t == "bigint" ? t.toString() : t);
10419
- }
10420
- }, qp = class {
10421
- contentType = "text/csv";
10422
- encode(e) {
10423
- let t = this.encodeString(e);
10424
- return new TextEncoder().encode(t);
10399
+ }, Up = (e) => typeof e == "object" && !!e && !Array.isArray(e), Wp = (e) => e instanceof Uint8Array || e instanceof Number || e instanceof String, Gp = (e) => typeof e == "object" && !!e && !Array.isArray(e), Kp = (e) => {
10400
+ if (typeof e != "object" || !e || Array.isArray(e)) return !1;
10401
+ let t = Object.getPrototypeOf(e);
10402
+ return t === Object.prototype || t === null;
10403
+ }, qp = (e, t) => {
10404
+ let n = e;
10405
+ for (let e of t) {
10406
+ if (typeof n != "object" || !n) return {
10407
+ present: !1,
10408
+ value: void 0
10409
+ };
10410
+ let t = n;
10411
+ if (!(e in t)) return {
10412
+ present: !1,
10413
+ value: void 0
10414
+ };
10415
+ n = t[e];
10425
10416
  }
10426
- decode(e, t) {
10427
- let n = new TextDecoder().decode(e);
10428
- return this.decodeString(n, t);
10417
+ return {
10418
+ present: !0,
10419
+ value: n
10420
+ };
10421
+ }, Jp = (e) => {
10422
+ try {
10423
+ return structuredClone(e);
10424
+ } catch {
10425
+ return console.warn("Failed to deep copy object, falling back to JSON.parse(JSON.stringify)", e), console.trace(), JSON.parse(JSON.stringify(e));
10429
10426
  }
10430
- encodeString(e) {
10431
- if (!Array.isArray(e) || e.length === 0 || !Gp(e[0])) throw Error("Payload must be an array of objects");
10432
- let t = Object.keys(e[0]), n = [t.join(",")];
10433
- return e.forEach((e) => {
10434
- let r = t.map((t) => JSON.stringify(e[t] ?? ""));
10435
- n.push(r.join(","));
10436
- }), n.join("\n");
10427
+ }, Yp = (e, t, n = "") => {
10428
+ let r = {}, i = (e, t, n) => {
10429
+ if (typeof e != typeof t || e === null || t === null) {
10430
+ r[n] = [e, t];
10431
+ return;
10432
+ }
10433
+ if (typeof e == "object" && typeof t == "object") if (Array.isArray(e) && Array.isArray(t)) {
10434
+ if (e.length !== t.length) {
10435
+ r[n] = [e, t];
10436
+ return;
10437
+ }
10438
+ for (let r = 0; r < e.length; r++) i(e[r], t[r], `${n}[${r}]`);
10439
+ } else new Set([...Object.keys(e), ...Object.keys(t)]).forEach((r) => {
10440
+ i(e[r], t[r], n === "" ? r : `${n}.${r}`);
10441
+ });
10442
+ else e !== t && (r[n] = [e, t]);
10443
+ };
10444
+ return i(e, t, n), r;
10445
+ }, Xp = (e, t) => {
10446
+ let n = Array.isArray(e), r = Array.isArray(t);
10447
+ if (n !== r) return !1;
10448
+ if (n && r) {
10449
+ let n = e, r = t;
10450
+ if (n.length !== r.length) return !1;
10451
+ for (let e = 0; e < n.length; e++) if (!Xp(n[e], r[e])) return !1;
10452
+ return !0;
10437
10453
  }
10438
- decodeString(e, t) {
10439
- let [n, ...r] = e.trim().split("\n").map((e) => e.trim());
10440
- if (n.length === 0) return t == null ? {} : t.parse({});
10441
- let i = n.split(",").map((e) => e.trim()), a = {};
10442
- return i.forEach((e) => {
10443
- a[e] = [];
10444
- }), r.forEach((e) => {
10445
- let t = e.split(",").map((e) => e.trim());
10446
- i.forEach((e, n) => {
10447
- let r = this.parseValue(t[n]);
10448
- r != null && a[e].push(r);
10449
- });
10450
- }), t == null ? a : t.parse(a);
10454
+ if (e == null || t == null || typeof e != "object" || typeof t != "object") return e === t;
10455
+ if ("equals" in e) return e.equals(t);
10456
+ let i = Object.keys(e), a = Object.keys(t);
10457
+ if (i.length !== a.length) return !1;
10458
+ for (let n of i) {
10459
+ let r = e[n], i = t[n];
10460
+ if (typeof r == "object" && typeof i == "object") {
10461
+ if (!Xp(r, i)) return !1;
10462
+ } else if (r !== i) return !1;
10451
10463
  }
10452
- parseValue(e) {
10453
- if (e == null || e.length === 0) return null;
10454
- let t = Number(e);
10455
- return isNaN(t) ? e.startsWith("\"") && e.endsWith("\"") ? e.slice(1, -1) : e : t;
10464
+ return !0;
10465
+ }, Zp = (e, t) => {
10466
+ if (typeof e != "object" || !e) return e === t;
10467
+ let n = Object.keys(e), r = Object.keys(t);
10468
+ if (r.length > n.length) return !1;
10469
+ for (let n of r) {
10470
+ let r = e[n], i = t[n];
10471
+ if (typeof r == "object" && typeof i == "object") {
10472
+ if (!Zp(r, i)) return !1;
10473
+ } else if (r !== i) return !1;
10456
10474
  }
10457
- }, Jp = class {
10458
- contentType = "text/plain";
10459
- encode(e) {
10460
- if (typeof e != "string") throw Error("TextCodec.encode payload must be a string");
10461
- return new TextEncoder().encode(e);
10475
+ return !0;
10476
+ }, Qp = (e, t, n = ".") => {
10477
+ let r = e.split(n);
10478
+ return r.map((e, i) => {
10479
+ let a = t(e, i, r);
10480
+ return a == null ? null : typeof a == "string" ? a : a.join(n);
10481
+ }).filter((e) => e != null).join(n);
10482
+ }, $p = (e, t) => {
10483
+ if (!Array.isArray(e)) return e[t];
10484
+ let n = e[t];
10485
+ if (n != null || e.length == 0) return n;
10486
+ let r = e[0];
10487
+ if (typeof r == "object" && "key" in r) return e.find((e) => e.key === t);
10488
+ }, em = (e, t) => {
10489
+ let n = e.split(".");
10490
+ return n.forEach((e, r) => {
10491
+ t = $p(t, e), typeof t == "object" && t && "key" in t && (n[r] = t.key);
10492
+ }), n.join(".");
10493
+ }, tm = (e, t) => {
10494
+ let n = e.split(".");
10495
+ return t < 0 ? n[n.length + t] : n[t];
10496
+ }, nm = (e, t) => {
10497
+ if (t.length === 0) return !0;
10498
+ let n = e.split("."), r = t.split(".");
10499
+ if (r.length > n.length) return !1;
10500
+ for (let e = 0; e < r.length; e++) {
10501
+ let t = n[e], i = r[e];
10502
+ if (i !== "*" && t !== i) return !1;
10462
10503
  }
10463
- decode(e, t) {
10464
- let n = new TextDecoder().decode(e);
10465
- return t == null ? n : t.parse(n);
10504
+ return !0;
10505
+ }, rm = (e) => {
10506
+ let t = parseInt(e, 10);
10507
+ return isNaN(t) || t < 0 || t.toString() !== e ? null : t;
10508
+ }, im = (e, t) => {
10509
+ for (let n = 1; n <= t.length; n++) {
10510
+ let r = t.slice(0, n).join(".");
10511
+ if ($p(e, r) != null) return [r, n];
10466
10512
  }
10467
- }, Yp = new Kp();
10468
- new qp(), new Jp();
10469
- var G = (e) => typeof e == "object" && !!e && "value" in e, Xp = class {
10470
- value;
10471
- constructor(e) {
10472
- this.value = e;
10513
+ return null;
10514
+ }, am = ((e, t, n = { optional: !1 }) => {
10515
+ let { optional: r, getter: i = $p } = n;
10516
+ if (t === "") return e;
10517
+ let a = t.split(".");
10518
+ if (a.length === 1) {
10519
+ let n = i(e, a[0]);
10520
+ if (n === void 0) {
10521
+ if (r) return null;
10522
+ throw Error(`Path ${t} does not exist. ${a[0]} is undefined`);
10523
+ }
10524
+ return n;
10473
10525
  }
10474
- valueOf() {
10475
- return this.value;
10526
+ let o = (e, n) => {
10527
+ if (n >= a.length) return e;
10528
+ for (let s = a.length - n; s >= 1; s--) {
10529
+ let c = a.slice(n, n + s).join("."), l = i(e, c);
10530
+ if (l !== void 0) {
10531
+ if (n + s === a.length) return l;
10532
+ if (l === null) {
10533
+ if (r) return null;
10534
+ throw Error(`Path ${t} does not exist. ${c} is null`);
10535
+ }
10536
+ return o(l, n + s);
10537
+ }
10538
+ }
10539
+ if (r) return null;
10540
+ throw Error(`Path ${t} does not exist. ${a[n]} is undefined`);
10541
+ };
10542
+ return o(e, 0);
10543
+ }), om = (e, t) => am(e, t, { optional: !0 }) !== null, sm = (e, ...t) => {
10544
+ if (t.length === 0) return e;
10545
+ let n = t.shift();
10546
+ if (Gp(e) && Gp(n)) for (let t in n) try {
10547
+ Gp(n[t]) ? (t in e || Object.assign(e, { [t]: {} }), sm(e[t], n[t])) : Object.assign(e, { [t]: n[t] });
10548
+ } catch (e) {
10549
+ throw e instanceof TypeError ? TypeError(`.${t}: ${e.message}`, { cause: e }) : e;
10476
10550
  }
10477
- toJSON() {
10478
- return this.value;
10551
+ return sm(e, ...t);
10552
+ }, cm = (e, t, n) => {
10553
+ let r = (e, t, n) => {
10554
+ if (n.def?.type === "union") return n.def.options.reduce((e, n) => r(e, t, n), e);
10555
+ if (n.def?.type === "intersection") return r(r(e, t, n.def.left), t, n.def.right);
10556
+ for (let i in t) {
10557
+ let a = t[i], o = n?.shape;
10558
+ if (o != null) for (; o != null;) {
10559
+ if (o[i] != null) {
10560
+ let t = o[i].safeParse(a);
10561
+ if (t.success) {
10562
+ e[i] = t.data;
10563
+ break;
10564
+ }
10565
+ }
10566
+ o = o.def?.shape;
10567
+ }
10568
+ typeof a == "object" && !Array.isArray(a) && a !== null && n && n.shape && n.shape[i] && (e[i] ||= {}, r(e[i], a, n.shape[i]));
10569
+ }
10570
+ return e;
10571
+ };
10572
+ return r({ ...e }, t, n);
10573
+ }, lm = (e, t) => {
10574
+ let n = t.split("."), r = e, i = 0;
10575
+ for (; i < n.length;) {
10576
+ if (i === n.length - 1) {
10577
+ let e = n[i];
10578
+ if (Array.isArray(r)) {
10579
+ let t = parseInt(e, 10);
10580
+ if (!isNaN(t) && t < r.length) {
10581
+ r.splice(t, 1);
10582
+ return;
10583
+ }
10584
+ let n = r[0];
10585
+ if (typeof n == "object" && "key" in n) {
10586
+ let t = r.findIndex((t) => t.key === e);
10587
+ if (t !== -1) {
10588
+ r.splice(t, 1);
10589
+ return;
10590
+ }
10591
+ }
10592
+ return;
10593
+ }
10594
+ delete r[e];
10595
+ return;
10596
+ }
10597
+ let e = !1;
10598
+ if (Array.isArray(r) && r.length > 0) {
10599
+ let t = r[0];
10600
+ if (typeof t == "object" && "key" in t) for (let t = n.length - i; t >= 1; t--) {
10601
+ let a = n.slice(i, i + t).join("."), o = r.find((e) => e.key === a);
10602
+ if (o != null) {
10603
+ if (i + t === n.length) {
10604
+ let e = r.findIndex((e) => e.key === a);
10605
+ e !== -1 && r.splice(e, 1);
10606
+ return;
10607
+ }
10608
+ r = o, i += t, e = !0;
10609
+ break;
10610
+ }
10611
+ }
10612
+ }
10613
+ if (!e) for (let t = n.length - i; t >= 1; t--) {
10614
+ let a = n.slice(i, i + t).join(".");
10615
+ if (!Array.isArray(r) && typeof r == "object" && r && a in r) {
10616
+ if (i + t === n.length) {
10617
+ delete r[a];
10618
+ return;
10619
+ }
10620
+ r = r[a], i += t, e = !0;
10621
+ break;
10622
+ }
10623
+ }
10624
+ if (!e) {
10625
+ let e = $p(r, n[i]);
10626
+ if (e == null) return;
10627
+ r = e, i++;
10628
+ }
10479
10629
  }
10480
- toString() {
10481
- return this.value.toString();
10630
+ }, um = (e, t, n) => {
10631
+ let r = t.split("."), i = e, a = 0;
10632
+ for (; a < r.length - 1;) {
10633
+ let e = im(i, r.slice(a, r.length - 1)), t;
10634
+ e == null ? (t = r[a], a++) : [t, a] = [e[0], a + e[1]];
10635
+ let n = $p(i, t);
10636
+ if (n == null) {
10637
+ let e = r[a], o = rm(e);
10638
+ o == null && e.startsWith("-") && rm(e.substring(1)) != null && (o = 0), n = o == null ? {} : [], i[t] = n;
10639
+ }
10640
+ i = n;
10482
10641
  }
10483
- }, Zp = (e) => typeof e == "object" && !!e && "toString" in e, Qp = /* @__PURE__ */ jp({
10484
- by: () => em,
10485
- unique: () => $p
10486
- }), $p = (e) => [...new Set(e)], em = (e, t, n = !0) => {
10487
- let r = /* @__PURE__ */ new Map();
10488
- return e.forEach((e) => {
10489
- let i = t(e);
10490
- if (r.has(i)) {
10491
- if (n) return;
10492
- r.delete(i);
10642
+ try {
10643
+ let e = r[r.length - 1];
10644
+ if (Array.isArray(i)) {
10645
+ let t = rm(e);
10646
+ if (t == null) {
10647
+ if (e.startsWith("-")) {
10648
+ let n = rm(e.substring(1));
10649
+ n != null && (t = i.length - n);
10650
+ }
10651
+ if (t == null) {
10652
+ if (i.length === 0) {
10653
+ let t = rm(e);
10654
+ if (t != null) {
10655
+ i[t] = n;
10656
+ return;
10657
+ }
10658
+ }
10659
+ let t = i[0];
10660
+ if (typeof t == "object" && "key" in t) {
10661
+ let t = i.findIndex((t) => t.key === e);
10662
+ if (t !== -1) {
10663
+ i[t] = n;
10664
+ return;
10665
+ }
10666
+ }
10667
+ return;
10668
+ }
10669
+ }
10670
+ i[t] = n;
10671
+ return;
10493
10672
  }
10494
- r.set(i, e);
10495
- }), Array.from(r.values());
10496
- }, tm = (e, t = !1) => {
10497
- let n = Zp(e) ? "stringer" : typeof e, r;
10498
- switch (n) {
10499
- case "string":
10500
- r = (e, t) => e.localeCompare(t);
10501
- break;
10502
- case "stringer":
10503
- r = (e, t) => e.toString().localeCompare(t.toString());
10504
- break;
10505
- case "number":
10506
- r = (e, t) => Number(e) - Number(t);
10507
- break;
10508
- case "bigint":
10509
- r = (e, t) => BigInt(e) - BigInt(t) > 0n ? 1 : -1;
10510
- break;
10511
- case "boolean":
10512
- r = (e, t) => Number(e) - Number(t);
10513
- break;
10514
- case "undefined":
10515
- r = () => 0;
10516
- break;
10517
- default: return console.warn(`sortFunc: unknown type ${n}`), () => -1;
10673
+ let t = im(i, [e]);
10674
+ if (t != null) {
10675
+ i[t[0]] = n;
10676
+ return;
10677
+ }
10678
+ i[e] = n;
10679
+ } catch (r) {
10680
+ throw console.error("failed to set value", n, "at path", t, "on object", e), r;
10518
10681
  }
10519
- return t ? nm(r) : r;
10520
- }, nm = (e) => (t, n) => e(n, t), rm = (e, t = 21) => (n = t) => {
10521
- let r = "", i = n | 0;
10522
- for (; i--;) r += e[Math.random() * e.length | 0];
10523
- return r;
10524
- }, im = /* @__PURE__ */ jp({
10525
- LENGTH: () => 11,
10526
- create: () => lm
10527
- }), am = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", om = `0123456789${am}`, sm = rm(am, 1), cm = rm(om, 10), lm = () => `${sm()}${cm()}`, um = (e, t) => (n) => n instanceof t || typeof n == "object" && !!n && "discriminator" in n && n.discriminator === e, dm = 2 ** 12 - 1, fm = 2 ** 16 - 1, pm = 2 ** 20 - 1, mm = -128, hm = -(2 ** 15), gm = 2 ** 15 - 1, _m = -(2n ** 63n), vm = 2n ** 63n - 1n, ym = -(2 ** 63), bm = 2 ** 63 - 1, xm = (e) => (t, n) => {
10682
+ }, dm = /* @__PURE__ */ jp({
10683
+ SEPARATOR: () => ".",
10684
+ atKeys: () => qp,
10685
+ copy: () => Jp,
10686
+ defaultGetter: () => $p,
10687
+ difference: () => Yp,
10688
+ element: () => tm,
10689
+ equal: () => Xp,
10690
+ findBestKey: () => im,
10691
+ get: () => am,
10692
+ getIndex: () => rm,
10693
+ has: () => om,
10694
+ override: () => sm,
10695
+ overrideValidItems: () => cm,
10696
+ partialEqual: () => Zp,
10697
+ pathsMatch: () => nm,
10698
+ remove: () => lm,
10699
+ resolvePath: () => em,
10700
+ set: () => um,
10701
+ transformPath: () => Qp
10702
+ }), fm = (e) => Object.getOwnPropertySymbols(globalThis).includes(e), pm = (e, t) => {
10703
+ let n = Symbol.for(e);
10704
+ if (!fm(n)) {
10705
+ let e = t();
10706
+ Object.defineProperty(globalThis, n, { value: e });
10707
+ }
10708
+ return () => globalThis[n];
10709
+ }, mm = "sy_x_error", hm = (e) => (t) => typeof t == "object" && t && "type" in t && typeof t.type == "string" ? t.type.startsWith(e) : t instanceof Error ? t.message.startsWith(e) : typeof t == "string" ? t.startsWith(e) : !1, gm = (e) => class t extends Error {
10710
+ static discriminator = mm;
10711
+ discriminator = t.discriminator;
10712
+ static TYPE = e;
10713
+ type = t.TYPE;
10714
+ static matches = hm(e);
10715
+ matches = t.matches;
10716
+ constructor(e, n) {
10717
+ super(e, n), this.name = t.TYPE;
10718
+ }
10719
+ static sub(t) {
10720
+ return gm(`${e}.${t}`);
10721
+ }
10722
+ }, _m = (e) => {
10723
+ if (typeof e != "object" || !e) return !1;
10724
+ let t = e;
10725
+ if (t.discriminator !== mm) return !1;
10726
+ if (!("type" in t)) throw Error(`X Error is missing its type property: ${JSON.stringify(t)}`);
10727
+ return !0;
10728
+ }, vm = "unknown", ym = class {
10729
+ providers = [];
10730
+ register(e) {
10731
+ this.providers.push(e);
10732
+ }
10733
+ encode(e) {
10734
+ if (e == null) return {
10735
+ type: "nil",
10736
+ data: ""
10737
+ };
10738
+ if (_m(e)) for (let t of this.providers) {
10739
+ let n = t.encode(e);
10740
+ if (n != null) return n;
10741
+ }
10742
+ if (e instanceof Error) return {
10743
+ type: vm,
10744
+ data: e.message
10745
+ };
10746
+ if (typeof e == "string") return {
10747
+ type: vm,
10748
+ data: e
10749
+ };
10750
+ try {
10751
+ return {
10752
+ type: vm,
10753
+ data: JSON.stringify(e)
10754
+ };
10755
+ } catch {
10756
+ return {
10757
+ type: vm,
10758
+ data: "unable to encode error information"
10759
+ };
10760
+ }
10761
+ }
10762
+ decode(e) {
10763
+ if (e == null || e.type === "nil") return null;
10764
+ if (e.type === "unknown") return new Sm(e.data);
10765
+ for (let t of this.providers) {
10766
+ let n = t.decode(e);
10767
+ if (n != null) return n;
10768
+ }
10769
+ return new Sm(e.data);
10770
+ }
10771
+ }, bm = pm("synnax-error-registry", () => new ym()), xm = ({ encode: e, decode: t }) => bm().register({
10772
+ encode: e,
10773
+ decode: t
10774
+ }), Sm = class extends gm("unknown") {};
10775
+ z({
10776
+ type: P(),
10777
+ data: P()
10778
+ }), gm("canceled"), gm("not_implemented");
10779
+ var Cm = (e) => {
10780
+ if (e.length === 0) return "<root>";
10781
+ let t = "";
10782
+ return e.forEach((e, n) => {
10783
+ typeof e == "number" ? t += `[${e}]` : n === 0 ? t += String(e) : t += `.${String(e)}`;
10784
+ }), t;
10785
+ }, wm = 200, Tm = 10, Em = 8, Dm = (e, t = {}) => {
10786
+ let n = t.maxStringLength ?? wm, r = t.maxArrayLength ?? Tm, i = t.maxDepth ?? Em, a = (e, t) => {
10787
+ if (e === null) return null;
10788
+ if (e === void 0) return "[undefined]";
10789
+ let o = typeof e;
10790
+ if (o === "string") {
10791
+ let t = e;
10792
+ return t.length > n ? `${t.slice(0, n)}…(+${t.length - n} chars)` : t;
10793
+ }
10794
+ if (o === "number" || o === "boolean") return e;
10795
+ if (o === "bigint") return `${e.toString()}n`;
10796
+ if (o === "symbol" || o === "function") return `[${o}]`;
10797
+ if (Array.isArray(e)) {
10798
+ if (t >= i) return `[Array(${e.length})]`;
10799
+ let n = e.slice(0, r).map((e) => a(e, t + 1));
10800
+ return e.length > r && n.push(`…(+${e.length - r} more)`), n;
10801
+ }
10802
+ if (Kp(e)) {
10803
+ if (t >= i) return "[Object]";
10804
+ let n = {};
10805
+ for (let [r, i] of Object.entries(e)) n[r] = a(i, t + 1);
10806
+ return n;
10807
+ }
10808
+ if (e instanceof Date) return e.toISOString();
10809
+ if (e instanceof Error) return `[Error: ${e.message}]`;
10810
+ try {
10811
+ return `[${Object.prototype.toString.call(e)}]`;
10812
+ } catch {
10813
+ return "[unknown]";
10814
+ }
10815
+ };
10816
+ return a(e, 0);
10817
+ }, Om = (e, t = {}) => JSON.stringify(Dm(e, t), null, 2), G = (e) => typeof e == "object" && !!e && "value" in e, km = class {
10818
+ value;
10819
+ constructor(e) {
10820
+ this.value = e;
10821
+ }
10822
+ valueOf() {
10823
+ return this.value;
10824
+ }
10825
+ toJSON() {
10826
+ return this.value;
10827
+ }
10828
+ toString() {
10829
+ return this.value.toString();
10830
+ }
10831
+ }, Am = (e) => typeof e == "object" && !!e && "toString" in e, jm = (e) => e == null || typeof e != "object" && typeof e != "function", Mm = "value", Nm = "zod.parse", Pm = "✗", Fm = 60, Im = {
10832
+ maxStringLength: 60,
10833
+ maxArrayLength: 3,
10834
+ maxDepth: 3
10835
+ }, Lm = (e) => e.slice(0, -1), Rm = (e) => {
10836
+ switch (e.code) {
10837
+ case "invalid_type": return `expected ${e.expected}`;
10838
+ case "invalid_value": return `expected one of ${JSON.stringify(e.values)}`;
10839
+ case "unrecognized_keys": return "unexpected key";
10840
+ case "too_small": {
10841
+ let t = e.inclusive === !1 ? ">" : ">=";
10842
+ return `${e.origin} too small: expected ${t}${e.minimum}`;
10843
+ }
10844
+ case "too_big": {
10845
+ let t = e.inclusive === !1 ? "<" : "<=";
10846
+ return `${e.origin} too large: expected ${t}${e.maximum}`;
10847
+ }
10848
+ case "invalid_format": return `expected ${e.format} format`;
10849
+ case "not_multiple_of": return `expected multiple of ${e.divisor}`;
10850
+ case "custom": return e.message || "custom validation failed";
10851
+ default: return e.message;
10852
+ }
10853
+ }, zm = (e, t, n) => {
10854
+ let r = JSON.stringify(Dm(t, n));
10855
+ return `${Rm(e)}, received ${r}`;
10856
+ }, Bm = (e) => {
10857
+ let t = 0;
10858
+ for (let n of e) {
10859
+ if (n.path.length > t && (t = n.path.length), n.code === "invalid_union" && "errors" in n) for (let e of n.errors) {
10860
+ let n = Bm(e);
10861
+ n > t && (t = n);
10862
+ }
10863
+ if ((n.code === "invalid_key" || n.code === "invalid_element") && "issues" in n) {
10864
+ let e = Bm(n.issues);
10865
+ e > t && (t = e);
10866
+ }
10867
+ }
10868
+ return t;
10869
+ }, Vm = (e, t = []) => {
10870
+ let n = [];
10871
+ for (let r of e) {
10872
+ let e = [...t, ...r.path];
10873
+ if (r.code === "invalid_union" && "errors" in r && r.errors.length > 0) {
10874
+ let t = r.errors[0], i = Bm(t);
10875
+ for (let e = 1; e < r.errors.length; e++) {
10876
+ let n = Bm(r.errors[e]);
10877
+ n > i && (t = r.errors[e], i = n);
10878
+ }
10879
+ n.push(...Vm(t, e));
10880
+ continue;
10881
+ }
10882
+ if (r.code === "invalid_element" && "issues" in r && "key" in r && (typeof r.key == "string" || typeof r.key == "number")) {
10883
+ n.push(...Vm(r.issues, [...e, r.key]));
10884
+ continue;
10885
+ }
10886
+ if (r.code === "invalid_key" && "issues" in r) {
10887
+ n.push(...Vm(r.issues, e));
10888
+ continue;
10889
+ }
10890
+ n.push({
10891
+ ...r,
10892
+ path: e
10893
+ });
10894
+ }
10895
+ return n;
10896
+ }, Hm = (e) => {
10897
+ let t = [];
10898
+ for (let n of e) {
10899
+ if (n.code === "unrecognized_keys" && "keys" in n && Array.isArray(n.keys)) {
10900
+ for (let e of n.keys) t.push({
10901
+ ...n,
10902
+ path: [...n.path, e]
10903
+ });
10904
+ continue;
10905
+ }
10906
+ t.push(n);
10907
+ }
10908
+ return t;
10909
+ }, Um = (e, t, n, r) => {
10910
+ let i = `${n} `, a = `${n + Pm} `, o = {
10911
+ ...Im,
10912
+ ...r
10913
+ };
10914
+ if (Array.isArray(e)) {
10915
+ let e = -1;
10916
+ for (let n of t.keys()) {
10917
+ let t = Number(n);
10918
+ Number.isInteger(t) && t > e && (e = t);
10919
+ }
10920
+ let n = o.maxArrayLength ?? 3;
10921
+ e >= n && (o = {
10922
+ ...o,
10923
+ maxArrayLength: e + 2
10924
+ });
10925
+ }
10926
+ let s = Dm(e, o);
10927
+ if (typeof s != "object" || !s) {
10928
+ let e = JSON.stringify(s), n = t.values().next().value;
10929
+ return [`${a}${e}${n ? ` × ${n.reason}` : ""}`];
10930
+ }
10931
+ let c = [], l = Array.isArray(s);
10932
+ c.push(`${n}${l ? "[" : "{"}`);
10933
+ let u = [];
10934
+ if (l) {
10935
+ let e = s;
10936
+ for (let n = 0; n < e.length; n++) {
10937
+ let r = t.get(String(n));
10938
+ u.push({
10939
+ content: JSON.stringify(e[n]),
10940
+ mark: r && !r.missing ? r : void 0
10941
+ });
10942
+ }
10943
+ } else {
10944
+ let e = s;
10945
+ for (let n of Object.keys(e)) {
10946
+ let r = t.get(n);
10947
+ u.push({
10948
+ content: `"${n}": ${JSON.stringify(e[n])}`,
10949
+ mark: r && !r.missing ? r : void 0
10950
+ });
10951
+ }
10952
+ for (let [e, n] of t.entries()) n.missing && u.push({
10953
+ content: `"${e}": <missing>`,
10954
+ mark: n
10955
+ });
10956
+ }
10957
+ let d = 0;
10958
+ return u.forEach((e, t) => {
10959
+ if (e.mark == null) return;
10960
+ let n = +(t < u.length - 1), r = e.content.length + n;
10961
+ r > d && r <= Fm && (d = r);
10962
+ }), u.forEach((e, t) => {
10963
+ let n = t < u.length - 1 ? "," : "", r = e.content + n;
10964
+ if (e.mark != null) {
10965
+ let t = " ".repeat(Math.max(2, d - r.length + 2));
10966
+ c.push(`${a}${r}${t}× ${e.mark.reason}`);
10967
+ } else c.push(`${i}${r}`);
10968
+ }), c.push(n + (l ? "]" : "}")), c;
10969
+ }, Wm = "__root__", Gm = (e, t, n) => {
10970
+ let r = /* @__PURE__ */ new Map();
10971
+ for (let t of e) {
10972
+ let e = t.path.length === 0 ? Wm : `::${Cm(Lm(t.path))}`, n = r.get(e);
10973
+ n == null ? r.set(e, [t]) : n.push(t);
10974
+ }
10975
+ let i = [];
10976
+ for (let [e, a] of r) {
10977
+ if (e === Wm) {
10978
+ i.push(a.map((e) => ` × ${zm(e, t, n)}`).join("\n"));
10979
+ continue;
10980
+ }
10981
+ let r = Lm(a[0].path), { present: o, value: s } = qp(t, r);
10982
+ if (!o) {
10983
+ i.push(a.map((e) => ` at ${Cm(e.path)}\n × ${zm(e, t, n)}`).join("\n"));
10984
+ continue;
10985
+ }
10986
+ let c = /* @__PURE__ */ new Map();
10987
+ for (let e of a) {
10988
+ let n = String(e.path[e.path.length - 1]), r = qp(t, e.path);
10989
+ c.set(n, {
10990
+ reason: Rm(e),
10991
+ missing: !r.present
10992
+ });
10993
+ }
10994
+ let l = r.length === 0, u = Um(s, c, l ? " " : " ", n);
10995
+ l ? i.push(u.join("\n")) : i.push([` at ${Cm(r)}`, ...u].join("\n"));
10996
+ }
10997
+ return i.join("\n\n");
10998
+ }, Km = (e, t) => {
10999
+ let n = Object.entries(e);
11000
+ return n.every(([, e]) => jm(e)) ? n.map(([e, t]) => `${e}=${typeof t == "string" ? t : String(t)}`).join(", ") : Om(e, t);
11001
+ }, qm = ({ issues: e, input: t, label: n, context: r, formatOptions: i }) => {
11002
+ let a = i ?? {}, o = Hm(Vm(e)), s = [`Failed to parse ${n} (${o.length === 1 ? "1 issue" : `${o.length} issues`})`];
11003
+ return s.push(Gm(o, t, a)), r != null && Object.keys(r).length > 0 && s.push(` context: ${Km(r, a)}`), s.join("\n\n");
11004
+ }, Jm = class extends gm(Nm) {
11005
+ issues;
11006
+ input;
11007
+ label;
11008
+ context;
11009
+ constructor({ issues: e, input: t, label: n, context: r, cause: i, formatOptions: a }) {
11010
+ super(qm({
11011
+ issues: e,
11012
+ input: t,
11013
+ label: n,
11014
+ context: r,
11015
+ formatOptions: a
11016
+ }), { cause: i }), this.issues = e, this.input = t, this.label = n, this.context = r;
11017
+ }
11018
+ toStatus() {
11019
+ let e = {
11020
+ input: Dm(this.input),
11021
+ issues: this.issues
11022
+ };
11023
+ return this.context != null && (e.context = this.context), {
11024
+ message: `Failed to parse ${this.label}`,
11025
+ description: this.message,
11026
+ details: e
11027
+ };
11028
+ }
11029
+ };
11030
+ xm({
11031
+ encode: (e) => {
11032
+ if (!Jm.matches(e)) return null;
11033
+ let t = e, n = {
11034
+ label: t.label,
11035
+ context: t.context,
11036
+ issues: t.issues,
11037
+ input: Dm(t.input)
11038
+ };
11039
+ return {
11040
+ type: Nm,
11041
+ data: JSON.stringify(n)
11042
+ };
11043
+ },
11044
+ decode: (e) => {
11045
+ if (e.type !== Nm) return null;
11046
+ let t = JSON.parse(e.data);
11047
+ return new Jm({
11048
+ issues: t.issues,
11049
+ input: t.input,
11050
+ label: t.label,
11051
+ context: t.context
11052
+ });
11053
+ }
11054
+ });
11055
+ var Ym = (e, t, n = {}) => {
11056
+ let r = e.safeParse(t);
11057
+ if (r.success) return r.data;
11058
+ throw new Jm({
11059
+ issues: r.error.issues,
11060
+ input: t,
11061
+ label: n.label ?? Mm,
11062
+ context: n.context,
11063
+ cause: r.error
11064
+ });
11065
+ }, Xm = 2 ** 12 - 1, Zm = 2 ** 16 - 1, Qm = 2 ** 20 - 1, $m = -128, eh = -(2 ** 15), th = 2 ** 15 - 1, nh = -(2n ** 63n), rh = 2n ** 63n - 1n, ih = -(2 ** 63), ah = 2 ** 63 - 1, oh = (e) => (t, n) => {
10528
11066
  if (typeof t == "bigint") {
10529
- if (wm(n)) return e(t, BigInt(n));
11067
+ if (lh(n)) return e(t, BigInt(n));
10530
11068
  let r = e(Number(t), Number(n));
10531
11069
  return typeof r == "number" ? BigInt(Math.round(r)) : r;
10532
11070
  }
10533
11071
  return e(Number(t), Number(n));
10534
- }, Sm = xm((e, t) => e - t), Cm = xm((e, t) => e + t), wm = (e) => typeof e == "bigint" ? !0 : Number.isInteger(e), Tm = xm((e, t) => e * t), Em = xm((e, t) => e / t), Dm = sf([I(), I()]), Om = ["x", "y"], km = V(Om), Am = [
11072
+ }, sh = oh((e, t) => e - t), ch = oh((e, t) => e + t), lh = (e) => typeof e == "bigint" ? !0 : Number.isInteger(e), uh = oh((e, t) => e * t), dh = oh((e, t) => e / t), fh = sf([I(), I()]), ph = ["x", "y"], mh = V(ph), hh = [
10535
11073
  "top",
10536
11074
  "right",
10537
11075
  "bottom",
10538
11076
  "left"
10539
11077
  ];
10540
- V(Am);
10541
- var jm = ["left", "right"], Mm = V(jm), Nm = ["top", "bottom"], Pm = V(Nm), Fm = ["center"], Im = V(Fm);
11078
+ V(hh);
11079
+ var gh = ["left", "right"], _h = V(gh), vh = ["top", "bottom"], yh = V(vh), bh = ["center"], xh = V(bh);
10542
11080
  V([
10543
11081
  "top",
10544
11082
  "right",
@@ -10550,13 +11088,13 @@ V([
10550
11088
  "center",
10551
11089
  "end"
10552
11090
  ]), V(["first", "last"]);
10553
- var Lm = z({
11091
+ var Sh = z({
10554
11092
  clientX: I(),
10555
11093
  clientY: I()
10556
- }), Rm = z({
11094
+ }), Ch = z({
10557
11095
  width: I(),
10558
11096
  height: I()
10559
- }), zm = z({
11097
+ }), wh = z({
10560
11098
  signedWidth: I(),
10561
11099
  signedHeight: I()
10562
11100
  });
@@ -10566,14 +11104,14 @@ z({
10566
11104
  }), V([
10567
11105
  "x",
10568
11106
  "y",
10569
- ...Am,
10570
- ...Fm
11107
+ ...hh,
11108
+ ...bh
10571
11109
  ]), B([
10572
- km,
10573
- V([...Am, ...Fm]),
11110
+ mh,
11111
+ V([...hh, ...bh]),
10574
11112
  H(String)
10575
11113
  ]);
10576
- var Bm = (e, t, n) => {
11114
+ var Th = (e, t, n) => {
10577
11115
  let r = {};
10578
11116
  if (typeof t == "object" && (n = t, t = void 0), n = {
10579
11117
  makeValid: !0,
@@ -10583,7 +11121,7 @@ var Bm = (e, t, n) => {
10583
11121
  if (e.length !== 2) throw Error("bounds: expected array of length 2");
10584
11122
  [r.lower, r.upper] = e;
10585
11123
  } else r.lower = e.lower, r.upper = e.upper;
10586
- return n?.makeValid ? Vm(r) : r;
11124
+ return n?.makeValid ? Eh(r) : r;
10587
11125
  };
10588
11126
  Object.freeze({
10589
11127
  lower: 0,
@@ -10598,793 +11136,87 @@ Object.freeze({
10598
11136
  lower: -1,
10599
11137
  upper: 1
10600
11138
  });
10601
- var Vm = (e) => e.lower > e.upper ? {
11139
+ var Eh = (e) => e.lower > e.upper ? {
10602
11140
  lower: e.upper,
10603
11141
  upper: e.lower
10604
- } : e, Hm = (e, t) => {
10605
- let n = Bm(e);
11142
+ } : e, Dh = (e, t) => {
11143
+ let n = Th(e);
10606
11144
  return t < n.lower ? n.lower : t >= n.upper ? n.upper - (typeof n.upper == "number" ? 1 : 1n) : t;
10607
- }, Um = (e) => Om.includes(e) ? e : Nm.includes(e) ? "y" : "x";
10608
- z({
10609
- x: Mm.or(Im),
10610
- y: Pm.or(Im)
10611
- });
10612
- var Wm = z({
10613
- x: Mm,
10614
- y: Pm
10615
- }), Gm = Object.freeze({
10616
- x: "left",
10617
- y: "top"
10618
- }), Km = Object.freeze({
10619
- x: "right",
10620
- y: "top"
10621
- }), qm = Object.freeze({
10622
- x: "left",
10623
- y: "bottom"
10624
- }), Jm = Object.freeze({
10625
- x: "right",
10626
- y: "bottom"
10627
- }), Ym = Object.freeze({
10628
- x: "center",
10629
- y: "center"
10630
- }), Xm = Object.freeze({
10631
- x: "center",
10632
- y: "top"
10633
- }), Zm = Object.freeze({
10634
- x: "center",
10635
- y: "bottom"
10636
- }), Qm = Object.freeze({
10637
- x: "right",
10638
- y: "center"
10639
- }), $m = Object.freeze({
10640
- x: "left",
10641
- y: "center"
10642
- });
10643
- Object.freeze([
10644
- $m,
10645
- Qm,
10646
- Xm,
10647
- Zm,
10648
- Gm,
10649
- Km,
10650
- qm,
10651
- Jm,
10652
- Ym
10653
- ]);
10654
- var eh = (e, t) => e.x === t.x && e.y === t.y, th = (e) => [e.x, e.y];
10655
- V([
10656
- "top",
10657
- "right",
10658
- "bottom",
10659
- "left"
10660
- ]);
10661
- //#endregion
10662
- //#region ../x/ts/dist/x.js
10663
- var nh = z({
10664
- x: I(),
10665
- y: I()
10666
- }), rh = /* @__PURE__ */ jp({
10667
- INFINITY: () => sh,
10668
- NAN: () => ch,
10669
- ONE: () => oh,
10670
- ZERO: () => ah,
10671
- average: () => Eh,
10672
- calculateMiters: () => Dh,
10673
- clientXyZ: () => Lm,
10674
- construct: () => K,
10675
- couple: () => bh,
10676
- crudeZ: () => ih,
10677
- css: () => xh,
10678
- distance: () => gh,
10679
- equals: () => lh,
10680
- isFinite: () => yh,
10681
- isNan: () => vh,
10682
- isZero: () => uh,
10683
- normal: () => wh,
10684
- normalize: () => Th,
10685
- reciprocal: () => Ah,
10686
- rotate: () => jh,
10687
- round: () => kh,
10688
- scale: () => dh,
10689
- set: () => hh,
10690
- sub: () => Ch,
10691
- swap: () => Oh,
10692
- translate: () => mh,
10693
- translateX: () => fh,
10694
- translateY: () => ph,
10695
- translation: () => _h,
10696
- truncate: () => Sh,
10697
- xyZ: () => nh
10698
- }), ih = B([
10699
- I(),
10700
- nh,
10701
- Dm,
10702
- Rm,
10703
- zm,
10704
- Lm
10705
- ]), K = (e, t) => {
10706
- if (typeof e == "string") {
10707
- if (t === void 0) throw Error("The y coordinate must be given.");
10708
- return e === "x" ? {
10709
- x: t,
10710
- y: 0
10711
- } : {
10712
- x: 0,
10713
- y: t
10714
- };
11145
+ };
11146
+ L().min($m).max(127), L().min(eh).max(th), L().min(ih).max(ah);
11147
+ var Oh = L().min(0).max(255);
11148
+ L().min(0).max(Xm), L().min(0).max(Zm), L().min(0).max(Qm);
11149
+ var kh = class {
11150
+ contentType = "application/json";
11151
+ decoder;
11152
+ encoder;
11153
+ constructor() {
11154
+ this.decoder = new TextDecoder(), this.encoder = new TextEncoder();
10715
11155
  }
10716
- return typeof e == "number" ? {
10717
- x: e,
10718
- y: t ?? e
10719
- } : Array.isArray(e) ? {
10720
- x: e[0],
10721
- y: e[1]
10722
- } : "signedWidth" in e ? {
10723
- x: e.signedWidth,
10724
- y: e.signedHeight
10725
- } : "clientX" in e ? {
10726
- x: e.clientX,
10727
- y: e.clientY
10728
- } : "width" in e ? {
10729
- x: e.width,
10730
- y: e.height
10731
- } : {
10732
- x: e.x,
10733
- y: e.y
10734
- };
10735
- }, ah = Object.freeze({
10736
- x: 0,
10737
- y: 0
10738
- }), oh = Object.freeze({
10739
- x: 1,
10740
- y: 1
10741
- }), sh = Object.freeze({
10742
- x: Infinity,
10743
- y: Infinity
10744
- }), ch = Object.freeze({
10745
- x: NaN,
10746
- y: NaN
10747
- }), lh = (e, t, n = 0) => {
10748
- let r = K(e), i = K(t);
10749
- return n === 0 ? r.x === i.x && r.y === i.y : Math.abs(r.x - i.x) <= n && Math.abs(r.y - i.y) <= n;
10750
- }, uh = (e) => lh(e, ah), dh = (e, t, n) => {
10751
- let r = K(e), i = K(t, n);
10752
- return {
10753
- x: r.x * i.x,
10754
- y: r.y * i.y
10755
- };
10756
- }, fh = (e, t) => {
10757
- let n = K(e);
10758
- return {
10759
- x: n.x + t,
10760
- y: n.y
10761
- };
10762
- }, ph = (e, t) => {
10763
- let n = K(e);
10764
- return {
10765
- x: n.x,
10766
- y: n.y + t
10767
- };
10768
- }, mh = (e, t, n, ...r) => {
10769
- if (typeof t == "string") {
10770
- if (typeof n != "number") throw Error("The value must be a number.");
10771
- return t === "x" ? fh(e, n) : ph(e, n);
10772
- }
10773
- if (typeof t == "object" && "x" in t && typeof t.x == "string") {
10774
- let r = K(n), i = K(e);
10775
- return t.x === "left" ? r.x = -r.x : t.x === "center" && (r.x = 0), t.y === "top" ? r.y = -r.y : t.y === "center" && (r.y = 0), {
10776
- x: i.x + r.x,
10777
- y: i.y + r.y
10778
- };
10779
- }
10780
- return [
10781
- e,
10782
- t,
10783
- n ?? ah,
10784
- ...r
10785
- ].reduce((e, t) => {
10786
- let n = K(t);
10787
- return {
10788
- x: e.x + n.x,
10789
- y: e.y + n.y
10790
- };
10791
- }, ah);
10792
- }, hh = (e, t, n) => {
10793
- let r = K(e);
10794
- return Um(t) === "x" ? {
10795
- x: n,
10796
- y: r.y
10797
- } : {
10798
- x: r.x,
10799
- y: n
10800
- };
10801
- }, gh = (e, t) => {
10802
- let n = K(e), r = K(t);
10803
- return Math.sqrt((n.x - r.x) ** 2 + (n.y - r.y) ** 2);
10804
- }, _h = (e, t) => {
10805
- let n = K(e), r = K(t);
10806
- return {
10807
- x: r.x - n.x,
10808
- y: r.y - n.y
10809
- };
10810
- }, vh = (e) => {
10811
- let t = K(e);
10812
- return Number.isNaN(t.x) || Number.isNaN(t.y);
10813
- }, yh = (e) => {
10814
- let t = K(e);
10815
- return Number.isFinite(t.x) && Number.isFinite(t.y);
10816
- }, bh = (e) => {
10817
- let t = K(e);
10818
- return [t.x, t.y];
10819
- }, xh = (e) => {
10820
- let t = K(e);
10821
- return {
10822
- left: t.x,
10823
- top: t.y
10824
- };
10825
- }, Sh = (e, t = 0) => {
10826
- let n = K(e);
10827
- return {
10828
- x: Number(n.x.toFixed(t)),
10829
- y: Number(n.y.toFixed(t))
10830
- };
10831
- }, Ch = (e, t) => {
10832
- let n = K(e), r = K(t);
10833
- return {
10834
- x: n.x - r.x,
10835
- y: n.y - r.y
10836
- };
10837
- }, wh = (e) => {
10838
- let t = K(e), n = Math.hypot(t.x, t.y);
10839
- return n === 0 ? {
10840
- x: 0,
10841
- y: 0
10842
- } : {
10843
- x: -t.y / n,
10844
- y: t.x / n
10845
- };
10846
- }, Th = (e) => {
10847
- let t = K(e), n = Math.hypot(t.x, t.y);
10848
- return n === 0 ? {
10849
- x: 0,
10850
- y: 0
10851
- } : {
10852
- x: t.x / n,
10853
- y: t.y / n
10854
- };
10855
- }, Eh = (...e) => dh(e.reduce((e, t) => mh(e, t), ah), 1 / e.length), Dh = (e, t) => {
10856
- let n = [];
10857
- for (let r = 0; r < e.length; r++) {
10858
- let i = e[r], a, o, s, c;
10859
- if (r === 0) {
10860
- let n = e[r + 1];
10861
- o = wh(Ch(n, i)), s = o, c = t;
10862
- } else if (r === e.length - 1) {
10863
- let n = e[r - 1];
10864
- a = wh(Ch(i, n)), s = a, c = t;
10865
- } else {
10866
- let n = e[r - 1], l = e[r + 1], u = Ch(i, n), d = Ch(l, i);
10867
- a = wh(u), o = wh(d);
10868
- let f = Math.acos((u.x * d.x + u.y * d.y) / (Math.hypot(u.x, u.y) * Math.hypot(d.x, d.y))), p = Math.sin(f / 2);
10869
- c = p === 0 ? t : t / p, s = Th(Eh(a, o));
10870
- }
10871
- n.push(dh(s, c));
10872
- }
10873
- return n;
10874
- }, Oh = (e) => {
10875
- let t = K(e);
10876
- return {
10877
- x: t.y,
10878
- y: t.x
10879
- };
10880
- }, kh = (e) => {
10881
- let t = K(e);
10882
- return {
10883
- x: Math.round(t.x),
10884
- y: Math.round(t.y)
10885
- };
10886
- }, Ah = (e) => {
10887
- let t = K(e);
10888
- return {
10889
- x: 1 / t.x,
10890
- y: 1 / t.y
10891
- };
10892
- }, jh = (e, t, n) => {
10893
- let r = K(e), i = K(t), a = n === "clockwise" ? Math.PI / 2 : -Math.PI / 2, o = r.x - i.x, s = r.y - i.y, c = o * Math.cos(a) - s * Math.sin(a), l = o * Math.sin(a) + s * Math.cos(a);
10894
- return {
10895
- x: c + i.x,
10896
- y: l + i.y
10897
- };
10898
- }, Mh = /* @__PURE__ */ jp({
10899
- DECIMAL: () => Rh,
10900
- ZERO: () => Lh,
10901
- area: () => Tg,
10902
- areaIsZero: () => Yh,
10903
- aspect: () => Sg,
10904
- bottom: () => lg,
10905
- bottomCenter: () => ig,
10906
- bottomLeft: () => rg,
10907
- bottomRight: () => ag,
10908
- box: () => Ih,
10909
- center: () => fg,
10910
- centerLeft: () => og,
10911
- centerRight: () => sg,
10912
- construct: () => q,
10913
- constructWithAlternateRoot: () => Dg,
10914
- contains: () => Vh,
10915
- copy: () => zh,
10916
- css: () => Gh,
10917
- cssBox: () => Ph,
10918
- dim: () => Kh,
10919
- dims: () => Uh,
10920
- domRect: () => Fh,
10921
- edgePoints: () => yg,
10922
- equals: () => Hh,
10923
- height: () => Zh,
10924
- intersection: () => wg,
10925
- isBox: () => xg,
10926
- left: () => ug,
10927
- loc: () => Jh,
10928
- positionInCenter: () => bg,
10929
- reRoot: () => vg,
10930
- resize: () => Bh,
10931
- right: () => cg,
10932
- root: () => hg,
10933
- round: () => Og,
10934
- signedDims: () => Wh,
10935
- signedHeight: () => $h,
10936
- signedWidth: () => Qh,
10937
- top: () => dg,
10938
- topCenter: () => tg,
10939
- topLeft: () => eg,
10940
- topRight: () => ng,
10941
- translate: () => Cg,
10942
- truncate: () => Eg,
10943
- width: () => Xh,
10944
- x: () => pg,
10945
- xBounds: () => gg,
10946
- xyLoc: () => qh,
10947
- y: () => mg,
10948
- yBounds: () => _g
10949
- }), Nh = B([I(), P()]), Ph = z({
10950
- top: Nh,
10951
- left: Nh,
10952
- width: Nh,
10953
- height: Nh
10954
- }), Fh = z({
10955
- left: I(),
10956
- top: I(),
10957
- right: I(),
10958
- bottom: I()
10959
- }), Ih = z({
10960
- one: nh,
10961
- two: nh,
10962
- root: Wm
10963
- }), Lh = {
10964
- one: ah,
10965
- two: ah,
10966
- root: Gm
10967
- }, Rh = {
10968
- one: ah,
10969
- two: oh,
10970
- root: qm
10971
- }, zh = (e, t) => ({
10972
- one: e.one,
10973
- two: e.two,
10974
- root: t ?? e.root
10975
- }), q = (e, t, n = 0, r = 0, i) => {
10976
- let a = {
10977
- one: { ...ah },
10978
- two: { ...ah },
10979
- root: i ?? Gm
10980
- };
10981
- if (typeof e == "number") {
10982
- if (typeof t != "number") throw Error("Box constructor called with invalid arguments");
10983
- return a.one = {
10984
- x: e,
10985
- y: t
10986
- }, a.two = {
10987
- x: a.one.x + n,
10988
- y: a.one.y + r
10989
- }, a;
10990
- }
10991
- return "one" in e && "two" in e && "root" in e ? {
10992
- ...e,
10993
- root: i ?? e.root
10994
- } : ("getBoundingClientRect" in e && (e = e.getBoundingClientRect()), "left" in e ? (a.one = {
10995
- x: e.left,
10996
- y: e.top
10997
- }, a.two = {
10998
- x: e.right,
10999
- y: e.bottom
11000
- }, a) : (a.one = e, t == null ? a.two = {
11001
- x: a.one.x + n,
11002
- y: a.one.y + r
11003
- } : typeof t == "number" ? a.two = {
11004
- x: a.one.x + t,
11005
- y: a.one.y + n
11006
- } : "width" in t ? a.two = {
11007
- x: a.one.x + t.width,
11008
- y: a.one.y + t.height
11009
- } : "signedWidth" in t ? a.two = {
11010
- x: a.one.x + t.signedWidth,
11011
- y: a.one.y + t.signedHeight
11012
- } : a.two = t, a));
11013
- }, Bh = (e, t, n) => {
11014
- let r = q(e);
11015
- if (typeof t == "string") {
11016
- if (n == null) throw Error("Invalid arguments for resize");
11017
- let e = Um(t);
11018
- return q(r.one, void 0, e === "x" ? n : Xh(r), e === "y" ? n : Zh(r), r.root);
11019
- }
11020
- return q(r.one, t, void 0, void 0, r.root);
11021
- }, Vh = (e, t, n = !0) => {
11022
- let r = q(e), i = (e, t) => e < t;
11023
- return n && (i = (e, t) => e <= t), "one" in t ? i(ug(r), ug(t)) && i(cg(t), cg(r)) && i(dg(r), dg(t)) && i(lg(t), lg(r)) : i(ug(r), t.x) && i(t.x, cg(r)) && i(dg(r), t.y) && i(t.y, lg(r));
11024
- }, Hh = (e, t) => lh(e.one, t.one) && lh(e.two, t.two) && eh(e.root, t.root), Uh = (e) => ({
11025
- width: Xh(e),
11026
- height: Zh(e)
11027
- }), Wh = (e) => ({
11028
- signedWidth: Qh(e),
11029
- signedHeight: $h(e)
11030
- }), Gh = (e) => ({
11031
- top: dg(e),
11032
- left: ug(e),
11033
- width: Xh(e),
11034
- height: Zh(e)
11035
- }), Kh = (e, t, n = !1) => {
11036
- let r = Um(t) === "y" ? $h(e) : Qh(e);
11037
- return n ? r : Math.abs(r);
11038
- }, qh = (e, t) => {
11039
- let n = q(e);
11040
- return {
11041
- x: t.x === "center" ? fg(n).x : Jh(n, t.x),
11042
- y: t.y === "center" ? fg(n).y : Jh(n, t.y)
11043
- };
11044
- }, Jh = (e, t) => {
11045
- let n = q(e), r = th(n.root).includes(t) ? Math.min : Math.max;
11046
- return jm.includes(t) ? r(n.one.x, n.two.x) : r(n.one.y, n.two.y);
11047
- }, Yh = (e) => Tg(e) === 0, Xh = (e) => Kh(e, "x"), Zh = (e) => Kh(e, "y"), Qh = (e) => {
11048
- let t = q(e);
11049
- return t.two.x - t.one.x;
11050
- }, $h = (e) => {
11051
- let t = q(e);
11052
- return t.two.y - t.one.y;
11053
- }, eg = (e) => qh(e, Gm), tg = (e) => qh(e, Xm), ng = (e) => qh(e, Km), rg = (e) => qh(e, qm), ig = (e) => qh(e, Zm), ag = (e) => qh(e, Jm), og = (e) => qh(e, $m), sg = (e) => qh(e, Qm), cg = (e) => Jh(e, "right"), lg = (e) => Jh(e, "bottom"), ug = (e) => Jh(e, "left"), dg = (e) => Jh(e, "top"), fg = (e) => mh(eg(e), {
11054
- x: Qh(e) / 2,
11055
- y: $h(e) / 2
11056
- }), pg = (e) => {
11057
- let t = q(e);
11058
- return t.root.x === "left" ? ug(t) : cg(t);
11059
- }, mg = (e) => {
11060
- let t = q(e);
11061
- return t.root.y === "top" ? dg(t) : lg(t);
11062
- }, hg = (e) => ({
11063
- x: pg(e),
11064
- y: mg(e)
11065
- }), gg = (e) => {
11066
- let t = q(e);
11067
- return {
11068
- lower: t.one.x,
11069
- upper: t.two.x
11070
- };
11071
- }, _g = (e) => {
11072
- let t = q(e);
11073
- return {
11074
- lower: t.one.y,
11075
- upper: t.two.y
11076
- };
11077
- }, vg = (e, t) => zh(e, t), yg = (e, t) => {
11078
- let n = q(e), r = jm.includes(t) ? "x" : Nm.includes(t) ? "y" : null;
11079
- if (r === null) throw Error(`Invalid location: ${t}`);
11080
- let i = t === "top" || t === "left" ? Math.min : Math.max, a = { ...n.one }, o = { ...n.two };
11081
- return a[r] = i(n.one[r], n.two[r]), o[r] = i(n.one[r], n.two[r]), [a, o];
11082
- }, bg = (e, t) => {
11083
- let n = q(e), r = q(t);
11084
- return q({
11085
- x: pg(r) + (Xh(r) - Xh(n)) / 2,
11086
- y: mg(r) + (Zh(r) - Zh(n)) / 2
11087
- }, Uh(n));
11088
- }, xg = (e) => typeof e != "object" || !e ? !1 : "one" in e && "two" in e && "root" in e, Sg = (e) => Xh(e) / Zh(e), Cg = (e, t, n) => {
11089
- if (typeof t == "string") {
11090
- if (n == null) throw Error("Undefined amount passed into box.translate");
11091
- t = K(Um(t), n);
11092
- }
11093
- let r = q(e);
11094
- return q(mh(r.one, t), mh(r.two, t), void 0, void 0, r.root);
11095
- }, wg = (e, t) => {
11096
- let n = Math.max(ug(e), ug(t)), r = Math.max(dg(e), dg(t)), i = Math.min(cg(e), cg(t)), a = Math.min(lg(e), lg(t));
11097
- return n > i || r > a ? Lh : q({
11098
- x: n,
11099
- y: r
11100
- }, {
11101
- x: i,
11102
- y: a
11103
- }, void 0, void 0, e.root);
11104
- }, Tg = (e) => Xh(e) * Zh(e), Eg = (e, t) => {
11105
- let n = q(e);
11106
- return q(Sh(n.one, t), Sh(n.two, t), void 0, void 0, n.root);
11107
- }, Dg = (e, t, n, r, i, a) => {
11108
- let o = {
11109
- x: e,
11110
- y: t
11111
- }, s = {
11112
- x: e + n,
11113
- y: t + r
11114
- };
11115
- return i.x !== a.x && (i.x === "center" ? (o.x -= n / 2, s.x -= n / 2) : (o.x -= n, s.x -= n)), i.y !== a.y && (i.y === "center" ? (o.y -= r / 2, s.y -= r / 2) : (o.y -= r, s.y -= r)), q(o, s, void 0, void 0, a);
11116
- }, Og = (e) => {
11117
- let t = q(e);
11118
- return q(kh(t.one), kh(t.two), void 0, void 0, t.root);
11119
- }, kg = /* @__PURE__ */ jp({
11120
- DECIMAL: () => Mg,
11121
- ZERO: () => jg,
11122
- construct: () => J,
11123
- couple: () => Ig,
11124
- crude: () => Ag,
11125
- dimensionsZ: () => Rm,
11126
- equals: () => Ng,
11127
- max: () => Lg,
11128
- min: () => Rg,
11129
- scale: () => zg,
11130
- signedDimensionsZ: () => zm,
11131
- svgViewBox: () => Fg,
11132
- swap: () => Pg
11133
- }), Ag = B([
11134
- Rm,
11135
- zm,
11136
- nh,
11137
- Dm
11138
- ]), jg = {
11139
- width: 0,
11140
- height: 0
11141
- }, Mg = {
11142
- width: 1,
11143
- height: 1
11144
- }, J = (e, t) => typeof e == "number" ? {
11145
- width: e,
11146
- height: t ?? e
11147
- } : Array.isArray(e) ? {
11148
- width: e[0],
11149
- height: e[1]
11150
- } : "x" in e ? {
11151
- width: e.x,
11152
- height: e.y
11153
- } : "signedWidth" in e ? {
11154
- width: e.signedWidth,
11155
- height: e.signedHeight
11156
- } : { ...e }, Ng = (e, t) => {
11157
- if (t == null) return !1;
11158
- let n = J(e), r = J(t);
11159
- return n.width === r.width && n.height === r.height;
11160
- }, Pg = (e) => {
11161
- let t = J(e);
11162
- return {
11163
- width: t.height,
11164
- height: t.width
11165
- };
11166
- }, Fg = (e) => {
11167
- let t = J(e);
11168
- return `0 0 ${t.width} ${t.height}`;
11169
- }, Ig = (e) => {
11170
- let t = J(e);
11171
- return [t.width, t.height];
11172
- }, Lg = (e) => ({
11173
- width: Math.max(...e.map((e) => J(e).width)),
11174
- height: Math.max(...e.map((e) => J(e).height))
11175
- }), Rg = (e) => ({
11176
- width: Math.min(...e.map((e) => J(e).width)),
11177
- height: Math.min(...e.map((e) => J(e).height))
11178
- }), zg = (e, t) => {
11179
- let n = J(e);
11180
- return {
11181
- width: n.width * t,
11182
- height: n.height * t
11183
- };
11184
- }, Bg = (e, t, n) => t !== void 0 && e < t ? t : n !== void 0 && e > n ? n : e;
11185
- z({
11186
- offset: ih,
11187
- scale: ih
11188
- }), z({
11189
- offset: I(),
11190
- scale: I()
11191
- });
11192
- var Vg = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r + e], Hg = (e) => (t, n, r, i) => [t, i ? r / e : r * e], Ug = (e) => (t, n, r) => {
11193
- if (t === null) return [e, r];
11194
- let { lower: i, upper: a } = t, { lower: o, upper: s } = e, c = a - i, l = s - o;
11195
- return n === "dimension" ? [e, l / c * r] : [e, (r - i) * (l / c) + o];
11196
- }, Wg = (e) => (t, n, r) => [e, r], Gg = () => (e, t, n) => {
11197
- if (e === null) throw Error("cannot invert without bounds");
11198
- if (t === "dimension") return [e, n];
11199
- let { lower: r, upper: i } = e;
11200
- return [e, i - (n - r)];
11201
- }, Kg = (e) => (t, n, r) => {
11202
- let { lower: i, upper: a } = e;
11203
- return r = Bg(r, i, a), [t, r];
11204
- }, qg = class e {
11205
- ops = [];
11206
- currBounds = null;
11207
- currType = null;
11208
- reversed = !1;
11209
- constructor() {
11210
- this.ops = [];
11211
- }
11212
- static translate(t) {
11213
- return new e().translate(t);
11214
- }
11215
- static magnify(t) {
11216
- return new e().magnify(t);
11217
- }
11218
- static scale(t, n) {
11219
- return new e().scale(t, n);
11220
- }
11221
- translate(e) {
11222
- let t = this.new(), n = Vg(e);
11223
- return n.type = "translate", t.ops.push(n), t;
11224
- }
11225
- magnify(e) {
11226
- let t = this.new(), n = Hg(e);
11227
- return n.type = "magnify", t.ops.push(n), t;
11228
- }
11229
- scale(e, t) {
11230
- let n = Bm(e, t), r = this.new(), i = Ug(n);
11231
- return i.type = "scale", r.ops.push(i), r;
11232
- }
11233
- clamp(e, t) {
11234
- let n = Bm(e, t), r = this.new(), i = Kg(n);
11235
- return i.type = "clamp", r.ops.push(i), r;
11236
- }
11237
- reBound(e, t) {
11238
- let n = Bm(e, t), r = this.new(), i = Wg(n);
11239
- return i.type = "re-bound", r.ops.push(i), r;
11240
- }
11241
- invert() {
11242
- let e = Gg();
11243
- e.type = "invert";
11244
- let t = this.new();
11245
- return t.ops.push(e), t;
11246
- }
11247
- pos(e) {
11248
- return this.exec("position", e);
11249
- }
11250
- dim(e) {
11251
- return this.exec("dimension", e);
11252
- }
11253
- new() {
11254
- let t = new e();
11255
- return t.ops = this.ops.slice(), t.reversed = this.reversed, t;
11256
- }
11257
- exec(e, t) {
11258
- return this.currBounds = null, this.ops.reduce(([t, n], r) => r(t, e, n, this.reversed), [null, t])[1];
11259
- }
11260
- reverse() {
11261
- let e = this.new();
11262
- e.ops.reverse();
11263
- let t = [];
11264
- return e.ops.forEach((n, r) => {
11265
- if (n.type === "scale" || t.some(([e, t]) => r >= e && r <= t)) return;
11266
- let i = e.ops.findIndex((e, t) => e.type === "scale" && t > r);
11267
- i !== -1 && t.push([r, i]);
11268
- }), t.forEach(([t, n]) => {
11269
- let r = e.ops.slice(t, n);
11270
- r.unshift(e.ops[n]), e.ops.splice(t, n - t + 1, ...r);
11271
- }), e.reversed = !e.reversed, e;
11272
- }
11273
- get transform() {
11274
- return {
11275
- scale: this.dim(1),
11276
- offset: this.pos(0)
11277
- };
11278
- }
11279
- static IDENTITY = new e();
11280
- };
11281
- (class e {
11282
- x;
11283
- y;
11284
- currRoot;
11285
- constructor(e = new qg(), t = new qg(), n = null) {
11286
- this.x = e, this.y = t, this.currRoot = n;
11287
- }
11288
- static translate(t, n) {
11289
- return new e().translate(t, n);
11290
- }
11291
- static translateX(t) {
11292
- return new e().translateX(t);
11293
- }
11294
- static translateY(t) {
11295
- return new e().translateY(t);
11296
- }
11297
- static clamp(t) {
11298
- return new e().clamp(t);
11299
- }
11300
- static magnify(t) {
11301
- return new e().magnify(t);
11302
- }
11303
- static scale(t) {
11304
- return new e().scale(t);
11305
- }
11306
- static reBound(t) {
11307
- return new e().reBound(t);
11308
- }
11309
- translate(e, t) {
11310
- let n = K(e, t), r = this.copy();
11311
- return r.x = this.x.translate(n.x), r.y = this.y.translate(n.y), r;
11312
- }
11313
- translateX(e) {
11314
- let t = this.copy();
11315
- return t.x = this.x.translate(e), t;
11316
- }
11317
- translateY(e) {
11318
- let t = this.copy();
11319
- return t.y = this.y.translate(e), t;
11320
- }
11321
- magnify(e) {
11322
- let t = this.copy();
11323
- return t.x = this.x.magnify(e.x), t.y = this.y.magnify(e.y), t;
11156
+ encode(e, t) {
11157
+ return this.encoder.encode(this.encodeString(e, t));
11324
11158
  }
11325
- scale(e) {
11326
- let t = this.copy();
11327
- if (xg(e)) {
11328
- let n = this.currRoot;
11329
- return t.currRoot = e.root, n != null && !eh(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(gg(e)), t.y = t.y.scale(_g(e)), t;
11330
- }
11331
- return t.x = t.x.scale(e.width), t.y = t.y.scale(e.height), t;
11159
+ decode(e, t) {
11160
+ return this.decodeString(this.decoder.decode(e), t);
11332
11161
  }
11333
- reBound(e) {
11334
- let t = this.copy();
11335
- return t.x = this.x.reBound(gg(e)), t.y = this.y.reBound(_g(e)), t;
11162
+ decodeString(e, t) {
11163
+ let n = Bp(JSON.parse(e), { schema: t });
11164
+ return t == null ? n : Ym(t, n);
11336
11165
  }
11337
- clamp(e) {
11338
- let t = this.copy();
11339
- return t.x = this.x.clamp(gg(e)), t.y = this.y.clamp(_g(e)), t;
11166
+ encodeString(e, t) {
11167
+ let n = Vp((t == null ? e : Ym(t, e)) ?? {}, { schema: t });
11168
+ return JSON.stringify(n, (e, t) => ArrayBuffer.isView(t) ? Array.from(t) : typeof t == "bigint" ? t.toString() : t);
11340
11169
  }
11341
- copy() {
11342
- let t = new e();
11343
- return t.currRoot = this.currRoot, t.x = this.x, t.y = this.y, t;
11170
+ }, Ah = class {
11171
+ contentType = "text/csv";
11172
+ encode(e) {
11173
+ let t = this.encodeString(e);
11174
+ return new TextEncoder().encode(t);
11344
11175
  }
11345
- reverse() {
11346
- let e = this.copy();
11347
- return e.x = this.x.reverse(), e.y = this.y.reverse(), e;
11176
+ decode(e, t) {
11177
+ let n = new TextDecoder().decode(e);
11178
+ return this.decodeString(n, t);
11348
11179
  }
11349
- pos(e) {
11350
- return {
11351
- x: this.x.pos(e.x),
11352
- y: this.y.pos(e.y)
11353
- };
11180
+ encodeString(e) {
11181
+ if (!Array.isArray(e) || e.length === 0 || !Gp(e[0])) throw Error("Payload must be an array of objects");
11182
+ let t = Object.keys(e[0]), n = [t.join(",")];
11183
+ return e.forEach((e) => {
11184
+ let r = t.map((t) => JSON.stringify(e[t] ?? ""));
11185
+ n.push(r.join(","));
11186
+ }), n.join("\n");
11354
11187
  }
11355
- dim(e) {
11356
- return {
11357
- x: this.x.dim(e.x),
11358
- y: this.y.dim(e.y)
11359
- };
11188
+ decodeString(e, t) {
11189
+ let [n, ...r] = e.trim().split("\n").map((e) => e.trim());
11190
+ if (n.length === 0) return t == null ? {} : t.parse({});
11191
+ let i = n.split(",").map((e) => e.trim()), a = {};
11192
+ return i.forEach((e) => {
11193
+ a[e] = [];
11194
+ }), r.forEach((e) => {
11195
+ let t = e.split(",").map((e) => e.trim());
11196
+ i.forEach((e, n) => {
11197
+ let r = this.parseValue(t[n]);
11198
+ r != null && a[e].push(r);
11199
+ });
11200
+ }), t == null ? a : t.parse(a);
11360
11201
  }
11361
- box(e) {
11362
- return q(this.pos(e.one), this.pos(e.two), 0, 0, this.currRoot ?? e.root);
11202
+ parseValue(e) {
11203
+ if (e == null || e.length === 0) return null;
11204
+ let t = Number(e);
11205
+ return isNaN(t) ? e.startsWith("\"") && e.endsWith("\"") ? e.slice(1, -1) : e : t;
11363
11206
  }
11364
- get transform() {
11365
- return {
11366
- scale: this.dim({
11367
- x: 1,
11368
- y: 1
11369
- }),
11370
- offset: this.pos({
11371
- x: 0,
11372
- y: 0
11373
- })
11374
- };
11207
+ }, jh = class {
11208
+ contentType = "text/plain";
11209
+ encode(e) {
11210
+ if (typeof e != "string") throw Error("TextCodec.encode payload must be a string");
11211
+ return new TextEncoder().encode(e);
11375
11212
  }
11376
- static IDENTITY = new e();
11377
- }), nh.extend({
11378
- root: Wm,
11379
- units: kp.object({
11380
- x: kp.enum(["px", "decimal"]),
11381
- y: kp.enum(["px", "decimal"])
11382
- })
11383
- }).partial({
11384
- root: !0,
11385
- units: !0
11386
- });
11387
- var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11213
+ decode(e, t) {
11214
+ let n = new TextDecoder().decode(e);
11215
+ return t == null ? n : t.parse(n);
11216
+ }
11217
+ }, Mh = new kh();
11218
+ new Ah(), new jh();
11219
+ var Nh = 365, Ph = 30, Fh = B([
11388
11220
  sf([L()]),
11389
11221
  sf([L(), L().min(1).max(12)]),
11390
11222
  sf([
@@ -11392,20 +11224,20 @@ var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11392
11224
  L().min(1).max(12),
11393
11225
  L().min(1).max(31)
11394
11226
  ])
11395
- ]), Qg = (e, t) => {
11396
- let n = new Y(t);
11227
+ ]), Ih = (e, t) => {
11228
+ let n = new K(t);
11397
11229
  if (![
11398
- X.DAY,
11399
- X.HOUR,
11400
- X.MINUTE,
11401
- X.SECOND,
11402
- X.MILLISECOND,
11403
- X.MICROSECOND,
11404
- X.NANOSECOND
11230
+ q.DAY,
11231
+ q.HOUR,
11232
+ q.MINUTE,
11233
+ q.SECOND,
11234
+ q.MILLISECOND,
11235
+ q.MICROSECOND,
11236
+ q.NANOSECOND
11405
11237
  ].some((e) => e.equals(n))) throw Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");
11406
11238
  let r = e.valueOf() % n.valueOf();
11407
- return e instanceof Y ? new Y(r) : new X(r);
11408
- }, Y = class e extends Xp {
11239
+ return e instanceof K ? new K(r) : new q(r);
11240
+ }, K = class e extends km {
11409
11241
  constructor(t, n = "UTC") {
11410
11242
  if (t == null) super(e.now().valueOf());
11411
11243
  else if (t instanceof Date) super(BigInt(t.getTime()) * e.MILLISECOND.valueOf());
@@ -11413,7 +11245,7 @@ var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11413
11245
  else if (Array.isArray(t)) super(e.parseDate(t));
11414
11246
  else {
11415
11247
  let r = 0n;
11416
- t instanceof Number && (t = t.valueOf()), n === "local" && (r = e.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = t === bm ? vm : Math.trunc(t) : (isNaN(t) && (t = 0), t = t === Infinity ? e.MAX : e.MIN)), G(t) && (t = t.value), super(BigInt(t.valueOf()) + r);
11248
+ t instanceof Number && (t = t.valueOf()), n === "local" && (r = e.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = t === ah ? rh : Math.trunc(t) : (isNaN(t) && (t = 0), t = t === Infinity ? e.MAX : e.MIN)), G(t) && (t = t.value), super(BigInt(t.valueOf()) + r);
11417
11249
  }
11418
11250
  }
11419
11251
  static parseDate([t = 1970, n = 1, r = 1]) {
@@ -11447,7 +11279,7 @@ var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11447
11279
  }
11448
11280
  toISOString(t = "UTC") {
11449
11281
  if (t === "UTC") return this.date().toISOString();
11450
- let n = this.date(), r = new X(BigInt(n.getTimezoneOffset()) * e.MINUTE.valueOf());
11282
+ let n = this.date(), r = new q(BigInt(n.getTimezoneOffset()) * e.MINUTE.valueOf());
11451
11283
  return this.sub(r).date().toISOString();
11452
11284
  }
11453
11285
  timeString(e = !1, t = "UTC") {
@@ -11459,7 +11291,7 @@ var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11459
11291
  return `${e.toLocaleString("default", { month: "short" })} ${e.toLocaleString("default", { day: "numeric" })}`;
11460
11292
  }
11461
11293
  static get utcOffset() {
11462
- return new X(BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * e.MINUTE.valueOf());
11294
+ return new q(BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * e.MINUTE.valueOf());
11463
11295
  }
11464
11296
  static since(t) {
11465
11297
  return new e().span(t);
@@ -11474,7 +11306,7 @@ var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11474
11306
  return this.range(e).span;
11475
11307
  }
11476
11308
  range(e) {
11477
- return new e_(this, e).makeValid();
11309
+ return new Rh(this, e).makeValid();
11478
11310
  }
11479
11311
  spanRange(e) {
11480
11312
  return this.range(this.add(e)).makeValid();
@@ -11495,22 +11327,22 @@ var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11495
11327
  return this.valueOf() <= new e(t).valueOf();
11496
11328
  }
11497
11329
  add(t) {
11498
- return new e(Cm(this.valueOf(), new X(t).valueOf()));
11330
+ return new e(ch(this.valueOf(), new q(t).valueOf()));
11499
11331
  }
11500
11332
  sub(t) {
11501
- return new e(Sm(this.valueOf(), new X(t).valueOf()));
11333
+ return new e(sh(this.valueOf(), new q(t).valueOf()));
11502
11334
  }
11503
11335
  get hours() {
11504
- return Number(this.valueOf()) / Number(X.HOUR.valueOf());
11336
+ return Number(this.valueOf()) / Number(q.HOUR.valueOf());
11505
11337
  }
11506
11338
  get minutes() {
11507
- return Number(this.valueOf()) / Number(X.MINUTE.valueOf());
11339
+ return Number(this.valueOf()) / Number(q.MINUTE.valueOf());
11508
11340
  }
11509
11341
  get days() {
11510
- return Number(this.valueOf()) / Number(X.DAY.valueOf());
11342
+ return Number(this.valueOf()) / Number(q.DAY.valueOf());
11511
11343
  }
11512
11344
  get seconds() {
11513
- return Number(this.valueOf()) / Number(X.SECOND.valueOf());
11345
+ return Number(this.valueOf()) / Number(q.SECOND.valueOf());
11514
11346
  }
11515
11347
  get milliseconds() {
11516
11348
  return Number(this.valueOf()) / Number(e.MILLISECOND.valueOf());
@@ -11632,16 +11464,16 @@ var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11632
11464
  }
11633
11465
  }
11634
11466
  remainder(e) {
11635
- return Qg(this, e);
11467
+ return Ih(this, e);
11636
11468
  }
11637
11469
  get isToday() {
11638
- return this.truncate(X.DAY).equals(e.now().truncate(X.DAY));
11470
+ return this.truncate(q.DAY).equals(e.now().truncate(q.DAY));
11639
11471
  }
11640
11472
  truncate(e) {
11641
11473
  return this.sub(this.remainder(e));
11642
11474
  }
11643
11475
  formatBySpan(e) {
11644
- return e.greaterThanOrEqual(X.days(30)) ? "shortDate" : e.greaterThanOrEqual(X.DAY) ? "dateTime" : e.greaterThanOrEqual(X.HOUR) ? "time" : e.greaterThanOrEqual(X.SECOND) ? "preciseTime" : "ISOTime";
11476
+ return e.greaterThanOrEqual(q.days(30)) ? "shortDate" : e.greaterThanOrEqual(q.DAY) ? "dateTime" : e.greaterThanOrEqual(q.HOUR) ? "time" : e.greaterThanOrEqual(q.SECOND) ? "preciseTime" : "ISOTime";
11645
11477
  }
11646
11478
  static now() {
11647
11479
  return new e(/* @__PURE__ */ new Date());
@@ -11690,7 +11522,7 @@ var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11690
11522
  return e.hours(t * 24, n);
11691
11523
  }
11692
11524
  static DAY = e.days(1);
11693
- static MAX = new e(vm);
11525
+ static MAX = new e(rh);
11694
11526
  static MIN = new e(0);
11695
11527
  static ZERO = new e(0);
11696
11528
  static z = B([
@@ -11700,21 +11532,21 @@ var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11700
11532
  I().transform((t) => new e(t)),
11701
11533
  Ed().transform((t) => new e(t)),
11702
11534
  Gd().transform((t) => new e(t)),
11703
- ap((e) => e instanceof X).transform((t) => new e(t)),
11704
- Zg.transform((t) => new e(t))
11535
+ ap((e) => e instanceof q).transform((t) => new e(t)),
11536
+ Fh.transform((t) => new e(t))
11705
11537
  ]);
11706
11538
  static sort(e, t) {
11707
11539
  return Number(e.valueOf() - t.valueOf());
11708
11540
  }
11709
- }, X = class e extends Xp {
11541
+ }, q = class e extends km {
11710
11542
  constructor(e) {
11711
11543
  typeof e == "number" && (e = Math.trunc(e.valueOf())), G(e) && (e = e.value), super(BigInt(e.valueOf()));
11712
11544
  }
11713
11545
  static fromSeconds(t) {
11714
- return t instanceof e ? t : t instanceof $g ? t.period : t instanceof Y ? new e(t) : (G(t) && (t = t.value), ["number", "bigint"].includes(typeof t) ? e.seconds(t) : new e(t));
11546
+ return t instanceof e ? t : t instanceof Lh ? t.period : t instanceof K ? new e(t) : (G(t) && (t = t.value), ["number", "bigint"].includes(typeof t) ? e.seconds(t) : new e(t));
11715
11547
  }
11716
11548
  static fromMilliseconds(t) {
11717
- return t instanceof e ? t : t instanceof $g ? t.period : t instanceof Y ? new e(t) : (G(t) && (t = t.value), ["number", "bigint"].includes(typeof t) ? e.milliseconds(t) : new e(t));
11549
+ return t instanceof e ? t : t instanceof Lh ? t.period : t instanceof K ? new e(t) : (G(t) && (t = t.value), ["number", "bigint"].includes(typeof t) ? e.milliseconds(t) : new e(t));
11718
11550
  }
11719
11551
  valueOf() {
11720
11552
  return this.value;
@@ -11732,7 +11564,7 @@ var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11732
11564
  return this.valueOf() >= new e(t).valueOf();
11733
11565
  }
11734
11566
  remainder(e) {
11735
- return Qg(this, e);
11567
+ return Ih(this, e);
11736
11568
  }
11737
11569
  truncate(t) {
11738
11570
  return new e(BigInt(Math.trunc(Number(this.valueOf() / t.valueOf()))) * t.valueOf());
@@ -11746,23 +11578,23 @@ var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11746
11578
  let t = new e(this.valueOf() < 0n ? -this.valueOf() : this.valueOf()), n = this.valueOf() < 0n;
11747
11579
  if (t.valueOf() === 0n) return "0s";
11748
11580
  if (t.lessThan(e.SECOND)) return "< 1s";
11749
- let r = t.days, i = t.hours, a = t.minutes, o = t.seconds, s = Math.floor(r / Yg), c = Math.floor(r / Xg), l = Math.floor(r / 7), u = Math.floor(r), d = Math.floor(i), f = Math.floor(a), p = Math.floor(o), m = n ? "-" : "";
11581
+ let r = t.days, i = t.hours, a = t.minutes, o = t.seconds, s = Math.floor(r / Nh), c = Math.floor(r / Ph), l = Math.floor(r / 7), u = Math.floor(r), d = Math.floor(i), f = Math.floor(a), p = Math.floor(o), m = n ? "-" : "";
11750
11582
  if (s >= 1) {
11751
11583
  let e = `${s}y`;
11752
11584
  if (s < 2) {
11753
- let t = Math.floor(r % Yg / Xg);
11585
+ let t = Math.floor(r % Nh / Ph);
11754
11586
  t > 0 && (e += ` ${t}mo`);
11755
11587
  }
11756
11588
  return m + e;
11757
11589
  }
11758
- if (l >= 1 && r < Xg && r % 7 == 0) {
11590
+ if (l >= 1 && r < Ph && r % 7 == 0) {
11759
11591
  let e = `${l}w`, t = Math.floor(r % 7), n = Math.floor(i - l * 7 * 24);
11760
11592
  return l < 2 && (t > 0 ? e += ` ${t}d` : n > 0 && n < 24 && (e += ` ${n}h`)), m + e;
11761
11593
  }
11762
11594
  if (c >= 1) {
11763
11595
  let e = `${c}mo`;
11764
11596
  if (c < 3) {
11765
- let t = Math.floor(r % Xg);
11597
+ let t = Math.floor(r % Ph);
11766
11598
  t > 0 && (e += ` ${t}d`);
11767
11599
  }
11768
11600
  return m + e;
@@ -11794,10 +11626,10 @@ var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11794
11626
  return `${m}${p}s`;
11795
11627
  }
11796
11628
  mult(t) {
11797
- return new e(Tm(this.valueOf(), t));
11629
+ return new e(uh(this.valueOf(), t));
11798
11630
  }
11799
11631
  div(t) {
11800
- return new e(Em(this.valueOf(), t));
11632
+ return new e(dh(this.valueOf(), t));
11801
11633
  }
11802
11634
  get days() {
11803
11635
  return Number(this.valueOf()) / Number(e.DAY.valueOf());
@@ -11832,509 +11664,1335 @@ var Jg = V(["static", "dynamic"]), Yg = 365, Xg = 30, Zg = B([
11832
11664
  sub(t) {
11833
11665
  return new e(this.valueOf() - new e(t).valueOf());
11834
11666
  }
11667
+ abs() {
11668
+ let t = this.valueOf();
11669
+ return new e(t < 0n ? -t : t);
11670
+ }
11835
11671
  static nanoseconds(t = 1) {
11836
11672
  return new e(t);
11837
11673
  }
11838
11674
  static NANOSECOND = e.nanoseconds(1);
11839
11675
  static microseconds(t = 1) {
11840
- return e.nanoseconds(Tm(t, 1e3));
11676
+ return e.nanoseconds(uh(t, 1e3));
11841
11677
  }
11842
11678
  static MICROSECOND = e.microseconds(1);
11843
11679
  static milliseconds(t = 1) {
11844
- return e.microseconds(Tm(t, 1e3));
11680
+ return e.microseconds(uh(t, 1e3));
11845
11681
  }
11846
11682
  static MILLISECOND = e.milliseconds(1);
11847
11683
  static seconds(t = 1) {
11848
- return e.milliseconds(Tm(t, 1e3));
11684
+ return e.milliseconds(uh(t, 1e3));
11849
11685
  }
11850
11686
  static SECOND = e.seconds(1);
11851
11687
  static minutes(t = 1) {
11852
- return e.seconds(Tm(t, 60));
11688
+ return e.seconds(uh(t, 60));
11853
11689
  }
11854
11690
  static MINUTE = e.minutes(1);
11855
11691
  static hours(t) {
11856
- return e.minutes(Tm(t, 60));
11692
+ return e.minutes(uh(t, 60));
11693
+ }
11694
+ static HOUR = e.hours(1);
11695
+ static days(t) {
11696
+ return e.hours(uh(t, 24));
11697
+ }
11698
+ static DAY = e.days(1);
11699
+ static MAX = new e(rh);
11700
+ static MIN = new e(0);
11701
+ static ZERO = new e(0);
11702
+ static z = B([
11703
+ z({ value: Ed() }).transform((t) => new e(t.value)),
11704
+ P().transform((t) => new e(BigInt(t))),
11705
+ I().transform((t) => new e(t)),
11706
+ Ed().transform((t) => new e(t)),
11707
+ H(e),
11708
+ H(K).transform((t) => new e(t)),
11709
+ ap((e) => e instanceof Lh).transform((t) => new e(t))
11710
+ ]);
11711
+ }, Lh = class e extends km {
11712
+ constructor(e) {
11713
+ G(e) && (e = e.value), super(e.valueOf());
11714
+ }
11715
+ toString() {
11716
+ return `${this.valueOf()} Hz`;
11717
+ }
11718
+ equals(t) {
11719
+ return this.valueOf() === new e(t).valueOf();
11720
+ }
11721
+ get period() {
11722
+ return q.seconds(1 / this.valueOf());
11723
+ }
11724
+ sampleCount(e) {
11725
+ return new q(e).seconds * this.valueOf();
11726
+ }
11727
+ byteCount(e, t) {
11728
+ return this.sampleCount(e) * new J(t).valueOf();
11729
+ }
11730
+ span(e) {
11731
+ return q.seconds(e / this.valueOf());
11732
+ }
11733
+ byteSpan(e, t) {
11734
+ return this.span(e.valueOf() / new J(t).valueOf());
11735
+ }
11736
+ add(t) {
11737
+ return new e(ch(this.valueOf(), new e(t).valueOf()));
11738
+ }
11739
+ sub(t) {
11740
+ return new e(sh(this.valueOf(), new e(t).valueOf()));
11741
+ }
11742
+ mult(t) {
11743
+ return new e(uh(this.valueOf(), t));
11744
+ }
11745
+ div(t) {
11746
+ return new e(dh(this.valueOf(), t));
11747
+ }
11748
+ static hz(t) {
11749
+ return new e(t);
11750
+ }
11751
+ static khz(t) {
11752
+ return e.hz(t * 1e3);
11753
+ }
11754
+ static z = B([I().transform((t) => new e(t)), H(e)]);
11755
+ }, J = class e extends km {
11756
+ constructor(e) {
11757
+ G(e) && (e = e.value), super(e.valueOf());
11758
+ }
11759
+ length(e) {
11760
+ return e.valueOf() / this.valueOf();
11761
+ }
11762
+ size(e) {
11763
+ return new zh(e * this.valueOf());
11764
+ }
11765
+ add(t) {
11766
+ return new e(ch(this.valueOf(), new e(t).valueOf()));
11767
+ }
11768
+ sub(t) {
11769
+ return new e(sh(this.valueOf(), new e(t).valueOf()));
11770
+ }
11771
+ mult(t) {
11772
+ return new e(uh(this.valueOf(), t));
11773
+ }
11774
+ div(t) {
11775
+ return new e(dh(this.valueOf(), t));
11776
+ }
11777
+ static UNKNOWN = new e(0);
11778
+ static BIT128 = new e(16);
11779
+ static BIT64 = new e(8);
11780
+ static BIT32 = new e(4);
11781
+ static BIT16 = new e(2);
11782
+ static BIT8 = new e(1);
11783
+ static z = B([I().transform((t) => new e(t)), H(e)]);
11784
+ }, Rh = class e {
11785
+ start;
11786
+ end;
11787
+ constructor(e, t) {
11788
+ typeof e == "object" && "start" in e ? (this.start = new K(e.start), this.end = new K(e.end)) : (this.start = new K(e), this.end = new K(t));
11789
+ }
11790
+ get span() {
11791
+ return new q(this.end.valueOf() - this.start.valueOf());
11792
+ }
11793
+ get isValid() {
11794
+ return this.start.valueOf() <= this.end.valueOf();
11795
+ }
11796
+ makeValid() {
11797
+ return this.isValid ? this : this.swap();
11798
+ }
11799
+ get isZero() {
11800
+ return this.start.isZero && this.end.isZero;
11801
+ }
11802
+ get numeric() {
11803
+ return {
11804
+ start: Number(this.start.valueOf()),
11805
+ end: Number(this.end.valueOf())
11806
+ };
11807
+ }
11808
+ swap() {
11809
+ return new e(this.end, this.start);
11810
+ }
11811
+ get numericBounds() {
11812
+ return {
11813
+ lower: Number(this.start.valueOf()),
11814
+ upper: Number(this.end.valueOf())
11815
+ };
11816
+ }
11817
+ equals(e, t = q.ZERO) {
11818
+ if (t.isZero) return this.start.equals(e.start) && this.end.equals(e.end);
11819
+ let n = this.start.sub(e.start).valueOf(), r = this.end.sub(e.end).valueOf();
11820
+ return n < 0 && (n = -n), r < 0 && (r = -r), n <= t.valueOf() && r <= t.valueOf();
11821
+ }
11822
+ toString() {
11823
+ return `${this.start.toString()} - ${this.end.toString()}`;
11824
+ }
11825
+ toPrettyString() {
11826
+ return `${this.start.toString("preciseDate")} - ${this.span.toString()}`;
11827
+ }
11828
+ overlapsWith(e, t = q.ZERO) {
11829
+ e = e.makeValid();
11830
+ let n = this.makeValid();
11831
+ if (this.equals(e)) return !0;
11832
+ if (e.end.equals(n.start) || n.end.equals(e.start)) return !1;
11833
+ let r = K.max(n.start, e.start), i = K.min(n.end, e.end);
11834
+ return i.before(r) ? !1 : new q(i.sub(r)).greaterThanOrEqual(t);
11835
+ }
11836
+ contains(t) {
11837
+ return t instanceof e ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
11838
+ }
11839
+ boundBy(t) {
11840
+ let n = new e(this.start, this.end);
11841
+ return t.start.after(this.start) && (n.start = t.start), t.start.after(this.end) && (n.end = t.start), t.end.before(this.end) && (n.end = t.end), t.end.before(this.start) && (n.start = t.end), n;
11842
+ }
11843
+ static max(...t) {
11844
+ return new e(K.min(...t.map((e) => e.start)), K.max(...t.map((e) => e.end)));
11845
+ }
11846
+ static MAX = new e(K.MIN, K.MAX);
11847
+ static ZERO = new e(K.ZERO, K.ZERO);
11848
+ static z = B([z({
11849
+ start: K.z,
11850
+ end: K.z
11851
+ }).transform((t) => new e(t.start, t.end)), H(e)]);
11852
+ static boundedZ = e.z.refine(({ isValid: e }) => e, { message: "Time range start time must be before or equal to time range end time" }).refine(({ end: e }) => e.valueOf() <= rh, { message: "Time range end time must be less than or equal to the maximum value of an int64" }).refine(({ start: e }) => e.valueOf() >= nh, { message: "Time range start time must be greater than or equal to the minimum value of an int64" });
11853
+ static sort(e, t) {
11854
+ return K.sort(e.start, t.start) || K.sort(e.end, t.end);
11855
+ }
11856
+ static merge(...t) {
11857
+ return e.max(...t.map((t) => new e(t).makeValid()));
11858
+ }
11859
+ }, Y = class e extends km {
11860
+ constructor(t) {
11861
+ if (G(t) && (t = t.value), t instanceof e || typeof t == "string" || typeof t.valueOf() == "string") super(t.valueOf());
11862
+ else {
11863
+ let n = e.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);
11864
+ if (n == null) throw Error(`unable to find data type for ${t.toString()}`);
11865
+ super(n.valueOf());
11866
+ }
11867
+ }
11868
+ get Array() {
11869
+ let t = e.ARRAY_CONSTRUCTORS.get(this.toString());
11870
+ if (t == null) throw Error(`unable to find array constructor for ${this.valueOf()}`);
11871
+ return t;
11872
+ }
11873
+ equals(e) {
11874
+ return this.valueOf() === e.valueOf();
11875
+ }
11876
+ matches(...e) {
11877
+ return e.some((e) => this.equals(e));
11878
+ }
11879
+ toString(t = !1) {
11880
+ return t ? e.SHORT_STRINGS.get(this.valueOf()) ?? this.valueOf() : this.valueOf();
11881
+ }
11882
+ get isVariable() {
11883
+ return this.equals(e.JSON) || this.equals(e.STRING) || this.equals(e.BYTES);
11884
+ }
11885
+ get isNumeric() {
11886
+ return !this.isVariable && !this.equals(e.UUID);
11887
+ }
11888
+ get isInteger() {
11889
+ let e = this.toString();
11890
+ return e.startsWith("int") || e.startsWith("uint");
11891
+ }
11892
+ get isFloat() {
11893
+ return this.toString().startsWith("float");
11894
+ }
11895
+ get density() {
11896
+ let t = e.DENSITIES.get(this.toString());
11897
+ if (t == null) throw Error(`unable to find density for ${this.valueOf()}`);
11898
+ return t;
11857
11899
  }
11858
- static HOUR = e.hours(1);
11859
- static days(t) {
11860
- return e.hours(Tm(t, 24));
11900
+ get isUnsignedInteger() {
11901
+ return this.equals(e.UINT8) || this.equals(e.UINT16) || this.equals(e.UINT32) || this.equals(e.UINT64);
11861
11902
  }
11862
- static DAY = e.days(1);
11863
- static MAX = new e(vm);
11864
- static MIN = new e(0);
11865
- static ZERO = new e(0);
11866
- static z = B([
11867
- z({ value: Ed() }).transform((t) => new e(t.value)),
11868
- P().transform((t) => new e(BigInt(t))),
11869
- I().transform((t) => new e(t)),
11870
- Ed().transform((t) => new e(t)),
11871
- H(e),
11872
- H(Y).transform((t) => new e(t)),
11873
- ap((e) => e instanceof $g).transform((t) => new e(t))
11874
- ]);
11875
- }, $g = class e extends Xp {
11876
- constructor(e) {
11877
- G(e) && (e = e.value), super(e.valueOf());
11903
+ get isSignedInteger() {
11904
+ return this.equals(e.INT8) || this.equals(e.INT16) || this.equals(e.INT32) || this.equals(e.INT64);
11878
11905
  }
11879
- toString() {
11880
- return `${this.valueOf()} Hz`;
11906
+ canSafelyCastTo(t) {
11907
+ return this.equals(t) ? !0 : !this.isNumeric || !t.isNumeric || this.isVariable || t.isVariable || this.isUnsignedInteger && t.isSignedInteger ? !1 : this.isFloat ? t.isFloat && this.density.valueOf() <= t.density.valueOf() : this.equals(e.INT32) && t.equals(e.FLOAT64) || this.equals(e.INT8) && t.equals(e.FLOAT32) ? !0 : this.isInteger && t.isInteger ? this.density.valueOf() <= t.density.valueOf() && this.isUnsignedInteger === t.isUnsignedInteger : !1;
11881
11908
  }
11882
- equals(t) {
11883
- return this.valueOf() === new e(t).valueOf();
11909
+ canCastTo(e) {
11910
+ return this.isNumeric && e.isNumeric ? !0 : this.equals(e);
11884
11911
  }
11885
- get period() {
11886
- return X.seconds(1 / this.valueOf());
11912
+ checkArray(e) {
11913
+ return e.constructor === this.Array;
11887
11914
  }
11888
- sampleCount(e) {
11889
- return new X(e).seconds * this.valueOf();
11915
+ get usesBigInt() {
11916
+ return e.BIG_INT_TYPES.some((e) => e.equals(this));
11890
11917
  }
11891
- byteCount(e, t) {
11892
- return this.sampleCount(e) * new Z(t).valueOf();
11918
+ static UNKNOWN = new e("unknown");
11919
+ static FLOAT64 = new e("float64");
11920
+ static FLOAT32 = new e("float32");
11921
+ static INT64 = new e("int64");
11922
+ static INT32 = new e("int32");
11923
+ static INT16 = new e("int16");
11924
+ static INT8 = new e("int8");
11925
+ static UINT64 = new e("uint64");
11926
+ static UINT32 = new e("uint32");
11927
+ static UINT16 = new e("uint16");
11928
+ static UINT8 = new e("uint8");
11929
+ static TIMESTAMP = new e("timestamp");
11930
+ static UUID = new e("uuid");
11931
+ static STRING = new e("string");
11932
+ static JSON = new e("json");
11933
+ static BYTES = new e("bytes");
11934
+ static ARRAY_CONSTRUCTORS = new Map([
11935
+ [e.UINT8.toString(), Uint8Array],
11936
+ [e.UINT16.toString(), Uint16Array],
11937
+ [e.UINT32.toString(), Uint32Array],
11938
+ [e.UINT64.toString(), BigUint64Array],
11939
+ [e.FLOAT32.toString(), Float32Array],
11940
+ [e.FLOAT64.toString(), Float64Array],
11941
+ [e.INT8.toString(), Int8Array],
11942
+ [e.INT16.toString(), Int16Array],
11943
+ [e.INT32.toString(), Int32Array],
11944
+ [e.INT64.toString(), BigInt64Array],
11945
+ [e.TIMESTAMP.toString(), BigInt64Array],
11946
+ [e.STRING.toString(), Uint8Array],
11947
+ [e.JSON.toString(), Uint8Array],
11948
+ [e.UUID.toString(), Uint8Array],
11949
+ [e.BYTES.toString(), Uint8Array]
11950
+ ]);
11951
+ static ARRAY_CONSTRUCTOR_DATA_TYPES = new Map([
11952
+ [Uint8Array.name, e.UINT8],
11953
+ [Uint16Array.name, e.UINT16],
11954
+ [Uint32Array.name, e.UINT32],
11955
+ [BigUint64Array.name, e.UINT64],
11956
+ [Float32Array.name, e.FLOAT32],
11957
+ [Float64Array.name, e.FLOAT64],
11958
+ [Int8Array.name, e.INT8],
11959
+ [Int16Array.name, e.INT16],
11960
+ [Int32Array.name, e.INT32],
11961
+ [BigInt64Array.name, e.INT64]
11962
+ ]);
11963
+ static DENSITIES = new Map([
11964
+ [e.UINT8.toString(), J.BIT8],
11965
+ [e.UINT16.toString(), J.BIT16],
11966
+ [e.UINT32.toString(), J.BIT32],
11967
+ [e.UINT64.toString(), J.BIT64],
11968
+ [e.FLOAT32.toString(), J.BIT32],
11969
+ [e.FLOAT64.toString(), J.BIT64],
11970
+ [e.INT8.toString(), J.BIT8],
11971
+ [e.INT16.toString(), J.BIT16],
11972
+ [e.INT32.toString(), J.BIT32],
11973
+ [e.INT64.toString(), J.BIT64],
11974
+ [e.TIMESTAMP.toString(), J.BIT64],
11975
+ [e.STRING.toString(), J.UNKNOWN],
11976
+ [e.JSON.toString(), J.UNKNOWN],
11977
+ [e.UUID.toString(), J.BIT128],
11978
+ [e.BYTES.toString(), J.UNKNOWN]
11979
+ ]);
11980
+ static ALL = [
11981
+ e.UNKNOWN,
11982
+ e.UINT8,
11983
+ e.UINT16,
11984
+ e.UINT32,
11985
+ e.UINT64,
11986
+ e.INT8,
11987
+ e.INT16,
11988
+ e.INT32,
11989
+ e.INT64,
11990
+ e.FLOAT32,
11991
+ e.FLOAT64,
11992
+ e.TIMESTAMP,
11993
+ e.UUID,
11994
+ e.STRING,
11995
+ e.JSON,
11996
+ e.BYTES
11997
+ ];
11998
+ static SHORT_STRINGS = new Map([
11999
+ [e.UINT8.toString(), "u8"],
12000
+ [e.UINT16.toString(), "u16"],
12001
+ [e.UINT32.toString(), "u32"],
12002
+ [e.UINT64.toString(), "u64"],
12003
+ [e.INT8.toString(), "i8"],
12004
+ [e.INT16.toString(), "i16"],
12005
+ [e.INT32.toString(), "i32"],
12006
+ [e.INT64.toString(), "i64"],
12007
+ [e.FLOAT32.toString(), "f32"],
12008
+ [e.FLOAT64.toString(), "f64"],
12009
+ [e.TIMESTAMP.toString(), "ts"],
12010
+ [e.UUID.toString(), "uuid"],
12011
+ [e.STRING.toString(), "str"],
12012
+ [e.JSON.toString(), "json"],
12013
+ [e.BYTES.toString(), "bytes"]
12014
+ ]);
12015
+ static BIG_INT_TYPES = [
12016
+ e.INT64,
12017
+ e.UINT64,
12018
+ e.TIMESTAMP
12019
+ ];
12020
+ static z = B([P().transform((t) => new e(t)), H(e)]);
12021
+ }, zh = class e extends km {
12022
+ constructor(e) {
12023
+ G(e) && (e = e.value), super(e.valueOf());
11893
12024
  }
11894
- span(e) {
11895
- return X.seconds(e / this.valueOf());
12025
+ largerThan(e) {
12026
+ return G(e) && (e = e.value), this.valueOf() > e.valueOf();
11896
12027
  }
11897
- byteSpan(e, t) {
11898
- return this.span(e.valueOf() / new Z(t).valueOf());
12028
+ smallerThan(e) {
12029
+ return G(e) && (e = e.value), this.valueOf() < e.valueOf();
11899
12030
  }
11900
12031
  add(t) {
11901
- return new e(Cm(this.valueOf(), new e(t).valueOf()));
12032
+ return G(t) && (t = t.value), new e(ch(this.valueOf(), t.valueOf()));
11902
12033
  }
11903
12034
  sub(t) {
11904
- return new e(Sm(this.valueOf(), new e(t).valueOf()));
12035
+ return G(t) && (t = t.value), new e(sh(this.valueOf(), t.valueOf()));
11905
12036
  }
11906
12037
  mult(t) {
11907
- return new e(Tm(this.valueOf(), t));
12038
+ return new e(uh(this.valueOf(), t));
11908
12039
  }
11909
12040
  div(t) {
11910
- return new e(Em(this.valueOf(), t));
12041
+ return new e(dh(this.valueOf(), t));
11911
12042
  }
11912
- static hz(t) {
11913
- return new e(t);
12043
+ truncate(t) {
12044
+ return new e(Math.trunc(this.valueOf() / new e(t).valueOf()) * new e(t).valueOf());
11914
12045
  }
11915
- static khz(t) {
11916
- return e.hz(t * 1e3);
12046
+ remainder(t) {
12047
+ return e.bytes(this.valueOf() % new e(t).valueOf());
11917
12048
  }
11918
- static z = B([I().transform((t) => new e(t)), H(e)]);
11919
- }, Z = class e extends Xp {
11920
- constructor(e) {
11921
- G(e) && (e = e.value), super(e.valueOf());
12049
+ get gigabytes() {
12050
+ return this.valueOf() / e.GIGABYTE.valueOf();
11922
12051
  }
11923
- length(e) {
11924
- return e.valueOf() / this.valueOf();
12052
+ get megabytes() {
12053
+ return this.valueOf() / e.MEGABYTE.valueOf();
11925
12054
  }
11926
- size(e) {
11927
- return new t_(e * this.valueOf());
12055
+ get kilobytes() {
12056
+ return this.valueOf() / e.KILOBYTE.valueOf();
11928
12057
  }
11929
- add(t) {
11930
- return new e(Cm(this.valueOf(), new e(t).valueOf()));
12058
+ get terabytes() {
12059
+ return this.valueOf() / e.TERABYTE.valueOf();
11931
12060
  }
11932
- sub(t) {
11933
- return new e(Sm(this.valueOf(), new e(t).valueOf()));
12061
+ toString() {
12062
+ let t = this.truncate(e.TERABYTE), n = this.truncate(e.GIGABYTE), r = this.truncate(e.MEGABYTE), i = this.truncate(e.KILOBYTE), a = this.truncate(e.BYTE), o = t, s = n.sub(t), c = r.sub(n), l = i.sub(r), u = a.sub(i), d = "";
12063
+ return o.isZero || (d += `${o.terabytes}TB `), s.isZero || (d += `${s.gigabytes}GB `), c.isZero || (d += `${c.megabytes}MB `), l.isZero || (d += `${l.kilobytes}KB `), (!u.isZero || d === "") && (d += `${u.valueOf()}B`), d.trim();
11934
12064
  }
11935
- mult(t) {
11936
- return new e(Tm(this.valueOf(), t));
12065
+ static bytes(t = 1) {
12066
+ return new e(t);
11937
12067
  }
11938
- div(t) {
11939
- return new e(Em(this.valueOf(), t));
12068
+ static BYTE = new e(1);
12069
+ static kilobytes(t = 1) {
12070
+ return e.bytes(new e(t).valueOf() * 1e3);
11940
12071
  }
11941
- static UNKNOWN = new e(0);
11942
- static BIT128 = new e(16);
11943
- static BIT64 = new e(8);
11944
- static BIT32 = new e(4);
11945
- static BIT16 = new e(2);
11946
- static BIT8 = new e(1);
11947
- static z = B([I().transform((t) => new e(t)), H(e)]);
11948
- }, e_ = class e {
11949
- start;
11950
- end;
11951
- constructor(e, t) {
11952
- typeof e == "object" && "start" in e ? (this.start = new Y(e.start), this.end = new Y(e.end)) : (this.start = new Y(e), this.end = new Y(t));
12072
+ static KILOBYTE = e.kilobytes(1);
12073
+ static megabytes(t = 1) {
12074
+ return e.kilobytes(new e(t).valueOf() * 1e3);
11953
12075
  }
11954
- get span() {
11955
- return new X(this.end.valueOf() - this.start.valueOf());
12076
+ static MEGABYTE = e.megabytes(1);
12077
+ static gigabytes(t = 1) {
12078
+ return e.megabytes(new e(t).valueOf() * 1e3);
11956
12079
  }
11957
- get isValid() {
11958
- return this.start.valueOf() <= this.end.valueOf();
12080
+ static GIGABYTE = e.gigabytes(1);
12081
+ static terabytes(t) {
12082
+ return e.gigabytes(new e(t).valueOf() * 1e3);
11959
12083
  }
11960
- makeValid() {
11961
- return this.isValid ? this : this.swap();
12084
+ static TERABYTE = e.terabytes(1);
12085
+ static ZERO = new e(0);
12086
+ static z = B([I().transform((t) => new e(t)), H(e)]);
12087
+ get isZero() {
12088
+ return this.valueOf() === 0;
12089
+ }
12090
+ };
12091
+ z({
12092
+ start: I(),
12093
+ end: I()
12094
+ }), B([
12095
+ H(Uint8Array),
12096
+ H(Uint16Array),
12097
+ H(Uint32Array),
12098
+ H(BigUint64Array),
12099
+ H(Float32Array),
12100
+ H(Float64Array),
12101
+ H(Int8Array),
12102
+ H(Int16Array),
12103
+ H(Int32Array),
12104
+ H(BigInt64Array)
12105
+ ]);
12106
+ var Bh = (e) => {
12107
+ let t = typeof e;
12108
+ return t === "string" || t === "number" || t === "boolean" || t === "bigint" || e instanceof K || e instanceof q || e instanceof Date;
12109
+ }, Vh = (e, t, n, r = 0) => e.usesBigInt && !t.usesBigInt ? Number(n) - Number(r) : !e.usesBigInt && t.usesBigInt ? BigInt(n.valueOf()) - BigInt(r.valueOf()) : sh(n, r);
12110
+ Rh.z, K.z, q.z, Lh.z, zh.z, Y.z, Rh.boundedZ;
12111
+ var Hh = /* @__PURE__ */ jp({
12112
+ by: () => Wh,
12113
+ unique: () => Uh
12114
+ }), Uh = (e) => [...new Set(e)], Wh = (e, t, n = !0) => {
12115
+ let r = /* @__PURE__ */ new Map();
12116
+ return e.forEach((e) => {
12117
+ let i = t(e);
12118
+ if (r.has(i)) {
12119
+ if (n) return;
12120
+ r.delete(i);
12121
+ }
12122
+ r.set(i, e);
12123
+ }), Array.from(r.values());
12124
+ }, Gh = (e, t = !1) => {
12125
+ let n = Am(e) ? "stringer" : typeof e, r;
12126
+ switch (n) {
12127
+ case "string":
12128
+ r = (e, t) => e.localeCompare(t);
12129
+ break;
12130
+ case "stringer":
12131
+ r = (e, t) => e.toString().localeCompare(t.toString());
12132
+ break;
12133
+ case "number":
12134
+ r = (e, t) => Number(e) - Number(t);
12135
+ break;
12136
+ case "bigint":
12137
+ r = (e, t) => BigInt(e) - BigInt(t) > 0n ? 1 : -1;
12138
+ break;
12139
+ case "boolean":
12140
+ r = (e, t) => Number(e) - Number(t);
12141
+ break;
12142
+ case "undefined":
12143
+ r = () => 0;
12144
+ break;
12145
+ default: return console.warn(`sortFunc: unknown type ${n}`), () => -1;
12146
+ }
12147
+ return t ? Kh(r) : r;
12148
+ }, Kh = (e) => (t, n) => e(n, t), qh = (e, t = 21) => (n = t) => {
12149
+ let r = "", i = n | 0;
12150
+ for (; i--;) r += e[Math.random() * e.length | 0];
12151
+ return r;
12152
+ }, Jh = /* @__PURE__ */ jp({
12153
+ LENGTH: () => 11,
12154
+ create: () => $h
12155
+ }), Yh = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Xh = `0123456789${Yh}`, Zh = qh(Yh, 1), Qh = qh(Xh, 10), $h = () => `${Zh()}${Qh()}`, eg = (e, t) => (n) => n instanceof t || typeof n == "object" && !!n && "discriminator" in n && n.discriminator === e, tg = (e) => ph.includes(e) ? e : vh.includes(e) ? "y" : "x";
12156
+ z({
12157
+ x: _h.or(xh),
12158
+ y: yh.or(xh)
12159
+ });
12160
+ var ng = z({
12161
+ x: _h,
12162
+ y: yh
12163
+ }), rg = Object.freeze({
12164
+ x: "left",
12165
+ y: "top"
12166
+ }), ig = Object.freeze({
12167
+ x: "right",
12168
+ y: "top"
12169
+ }), ag = Object.freeze({
12170
+ x: "left",
12171
+ y: "bottom"
12172
+ }), og = Object.freeze({
12173
+ x: "right",
12174
+ y: "bottom"
12175
+ }), sg = Object.freeze({
12176
+ x: "center",
12177
+ y: "center"
12178
+ }), cg = Object.freeze({
12179
+ x: "center",
12180
+ y: "top"
12181
+ }), lg = Object.freeze({
12182
+ x: "center",
12183
+ y: "bottom"
12184
+ }), ug = Object.freeze({
12185
+ x: "right",
12186
+ y: "center"
12187
+ }), dg = Object.freeze({
12188
+ x: "left",
12189
+ y: "center"
12190
+ });
12191
+ Object.freeze([
12192
+ dg,
12193
+ ug,
12194
+ cg,
12195
+ lg,
12196
+ rg,
12197
+ ig,
12198
+ ag,
12199
+ og,
12200
+ sg
12201
+ ]);
12202
+ var fg = (e, t) => e.x === t.x && e.y === t.y, pg = (e) => [e.x, e.y];
12203
+ V([
12204
+ "top",
12205
+ "right",
12206
+ "bottom",
12207
+ "left"
12208
+ ]);
12209
+ var mg = z({
12210
+ x: I(),
12211
+ y: I()
12212
+ }), hg = /* @__PURE__ */ jp({
12213
+ INFINITY: () => yg,
12214
+ NAN: () => bg,
12215
+ ONE: () => vg,
12216
+ ZERO: () => _g,
12217
+ average: () => Rg,
12218
+ calculateMiters: () => zg,
12219
+ clientXyZ: () => Sh,
12220
+ construct: () => X,
12221
+ couple: () => Mg,
12222
+ crudeZ: () => gg,
12223
+ css: () => Ng,
12224
+ distance: () => Og,
12225
+ equals: () => xg,
12226
+ isFinite: () => jg,
12227
+ isNan: () => Ag,
12228
+ isZero: () => Sg,
12229
+ normal: () => Ig,
12230
+ normalize: () => Lg,
12231
+ reciprocal: () => Hg,
12232
+ rotate: () => Ug,
12233
+ round: () => Vg,
12234
+ scale: () => Cg,
12235
+ set: () => Dg,
12236
+ sub: () => Fg,
12237
+ swap: () => Bg,
12238
+ translate: () => Eg,
12239
+ translateX: () => wg,
12240
+ translateY: () => Tg,
12241
+ translation: () => kg,
12242
+ truncate: () => Pg,
12243
+ xyZ: () => mg
12244
+ }), gg = B([
12245
+ I(),
12246
+ mg,
12247
+ fh,
12248
+ Ch,
12249
+ wh,
12250
+ Sh
12251
+ ]), X = (e, t) => {
12252
+ if (typeof e == "string") {
12253
+ if (t === void 0) throw Error("The y coordinate must be given.");
12254
+ return e === "x" ? {
12255
+ x: t,
12256
+ y: 0
12257
+ } : {
12258
+ x: 0,
12259
+ y: t
12260
+ };
11962
12261
  }
11963
- get isZero() {
11964
- return this.start.isZero && this.end.isZero;
12262
+ return typeof e == "number" ? {
12263
+ x: e,
12264
+ y: t ?? e
12265
+ } : Array.isArray(e) ? {
12266
+ x: e[0],
12267
+ y: e[1]
12268
+ } : "signedWidth" in e ? {
12269
+ x: e.signedWidth,
12270
+ y: e.signedHeight
12271
+ } : "clientX" in e ? {
12272
+ x: e.clientX,
12273
+ y: e.clientY
12274
+ } : "width" in e ? {
12275
+ x: e.width,
12276
+ y: e.height
12277
+ } : {
12278
+ x: e.x,
12279
+ y: e.y
12280
+ };
12281
+ }, _g = Object.freeze({
12282
+ x: 0,
12283
+ y: 0
12284
+ }), vg = Object.freeze({
12285
+ x: 1,
12286
+ y: 1
12287
+ }), yg = Object.freeze({
12288
+ x: Infinity,
12289
+ y: Infinity
12290
+ }), bg = Object.freeze({
12291
+ x: NaN,
12292
+ y: NaN
12293
+ }), xg = (e, t, n = 0) => {
12294
+ let r = X(e), i = X(t);
12295
+ return n === 0 ? r.x === i.x && r.y === i.y : Math.abs(r.x - i.x) <= n && Math.abs(r.y - i.y) <= n;
12296
+ }, Sg = (e) => xg(e, _g), Cg = (e, t, n) => {
12297
+ let r = X(e), i = X(t, n);
12298
+ return {
12299
+ x: r.x * i.x,
12300
+ y: r.y * i.y
12301
+ };
12302
+ }, wg = (e, t) => {
12303
+ let n = X(e);
12304
+ return {
12305
+ x: n.x + t,
12306
+ y: n.y
12307
+ };
12308
+ }, Tg = (e, t) => {
12309
+ let n = X(e);
12310
+ return {
12311
+ x: n.x,
12312
+ y: n.y + t
12313
+ };
12314
+ }, Eg = (e, t, n, ...r) => {
12315
+ if (typeof t == "string") {
12316
+ if (typeof n != "number") throw Error("The value must be a number.");
12317
+ return t === "x" ? wg(e, n) : Tg(e, n);
11965
12318
  }
11966
- get numeric() {
11967
- return {
11968
- start: Number(this.start.valueOf()),
11969
- end: Number(this.end.valueOf())
12319
+ if (typeof t == "object" && "x" in t && typeof t.x == "string") {
12320
+ let r = X(n), i = X(e);
12321
+ return t.x === "left" ? r.x = -r.x : t.x === "center" && (r.x = 0), t.y === "top" ? r.y = -r.y : t.y === "center" && (r.y = 0), {
12322
+ x: i.x + r.x,
12323
+ y: i.y + r.y
11970
12324
  };
11971
12325
  }
11972
- swap() {
11973
- return new e(this.end, this.start);
11974
- }
11975
- get numericBounds() {
12326
+ return [
12327
+ e,
12328
+ t,
12329
+ n ?? _g,
12330
+ ...r
12331
+ ].reduce((e, t) => {
12332
+ let n = X(t);
11976
12333
  return {
11977
- lower: Number(this.start.valueOf()),
11978
- upper: Number(this.end.valueOf())
12334
+ x: e.x + n.x,
12335
+ y: e.y + n.y
11979
12336
  };
12337
+ }, _g);
12338
+ }, Dg = (e, t, n) => {
12339
+ let r = X(e);
12340
+ return tg(t) === "x" ? {
12341
+ x: n,
12342
+ y: r.y
12343
+ } : {
12344
+ x: r.x,
12345
+ y: n
12346
+ };
12347
+ }, Og = (e, t) => {
12348
+ let n = X(e), r = X(t);
12349
+ return Math.sqrt((n.x - r.x) ** 2 + (n.y - r.y) ** 2);
12350
+ }, kg = (e, t) => {
12351
+ let n = X(e), r = X(t);
12352
+ return {
12353
+ x: r.x - n.x,
12354
+ y: r.y - n.y
12355
+ };
12356
+ }, Ag = (e) => {
12357
+ let t = X(e);
12358
+ return Number.isNaN(t.x) || Number.isNaN(t.y);
12359
+ }, jg = (e) => {
12360
+ let t = X(e);
12361
+ return Number.isFinite(t.x) && Number.isFinite(t.y);
12362
+ }, Mg = (e) => {
12363
+ let t = X(e);
12364
+ return [t.x, t.y];
12365
+ }, Ng = (e) => {
12366
+ let t = X(e);
12367
+ return {
12368
+ left: t.x,
12369
+ top: t.y
12370
+ };
12371
+ }, Pg = (e, t = 0) => {
12372
+ let n = X(e);
12373
+ return {
12374
+ x: Number(n.x.toFixed(t)),
12375
+ y: Number(n.y.toFixed(t))
12376
+ };
12377
+ }, Fg = (e, t) => {
12378
+ let n = X(e), r = X(t);
12379
+ return {
12380
+ x: n.x - r.x,
12381
+ y: n.y - r.y
12382
+ };
12383
+ }, Ig = (e) => {
12384
+ let t = X(e), n = Math.hypot(t.x, t.y);
12385
+ return n === 0 ? {
12386
+ x: 0,
12387
+ y: 0
12388
+ } : {
12389
+ x: -t.y / n,
12390
+ y: t.x / n
12391
+ };
12392
+ }, Lg = (e) => {
12393
+ let t = X(e), n = Math.hypot(t.x, t.y);
12394
+ return n === 0 ? {
12395
+ x: 0,
12396
+ y: 0
12397
+ } : {
12398
+ x: t.x / n,
12399
+ y: t.y / n
12400
+ };
12401
+ }, Rg = (...e) => Cg(e.reduce((e, t) => Eg(e, t), _g), 1 / e.length), zg = (e, t) => {
12402
+ let n = [];
12403
+ for (let r = 0; r < e.length; r++) {
12404
+ let i = e[r], a, o, s, c;
12405
+ if (r === 0) {
12406
+ let n = e[r + 1];
12407
+ o = Ig(Fg(n, i)), s = o, c = t;
12408
+ } else if (r === e.length - 1) {
12409
+ let n = e[r - 1];
12410
+ a = Ig(Fg(i, n)), s = a, c = t;
12411
+ } else {
12412
+ let n = e[r - 1], l = e[r + 1], u = Fg(i, n), d = Fg(l, i);
12413
+ a = Ig(u), o = Ig(d);
12414
+ let f = Math.acos((u.x * d.x + u.y * d.y) / (Math.hypot(u.x, u.y) * Math.hypot(d.x, d.y))), p = Math.sin(f / 2);
12415
+ c = p === 0 ? t : t / p, s = Lg(Rg(a, o));
12416
+ }
12417
+ n.push(Cg(s, c));
11980
12418
  }
11981
- equals(e, t = X.ZERO) {
11982
- if (t.isZero) return this.start.equals(e.start) && this.end.equals(e.end);
11983
- let n = this.start.sub(e.start).valueOf(), r = this.end.sub(e.end).valueOf();
11984
- return n < 0 && (n = -n), r < 0 && (r = -r), n <= t.valueOf() && r <= t.valueOf();
11985
- }
11986
- toString() {
11987
- return `${this.start.toString()} - ${this.end.toString()}`;
11988
- }
11989
- toPrettyString() {
11990
- return `${this.start.toString("preciseDate")} - ${this.span.toString()}`;
11991
- }
11992
- overlapsWith(e, t = X.ZERO) {
11993
- e = e.makeValid();
11994
- let n = this.makeValid();
11995
- if (this.equals(e)) return !0;
11996
- if (e.end.equals(n.start) || n.end.equals(e.start)) return !1;
11997
- let r = Y.max(n.start, e.start), i = Y.min(n.end, e.end);
11998
- return i.before(r) ? !1 : new X(i.sub(r)).greaterThanOrEqual(t);
11999
- }
12000
- contains(t) {
12001
- return t instanceof e ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
12002
- }
12003
- boundBy(t) {
12004
- let n = new e(this.start, this.end);
12005
- return t.start.after(this.start) && (n.start = t.start), t.start.after(this.end) && (n.end = t.start), t.end.before(this.end) && (n.end = t.end), t.end.before(this.start) && (n.start = t.end), n;
12006
- }
12007
- static max(...t) {
12008
- return new e(Y.min(...t.map((e) => e.start)), Y.max(...t.map((e) => e.end)));
12419
+ return n;
12420
+ }, Bg = (e) => {
12421
+ let t = X(e);
12422
+ return {
12423
+ x: t.y,
12424
+ y: t.x
12425
+ };
12426
+ }, Vg = (e) => {
12427
+ let t = X(e);
12428
+ return {
12429
+ x: Math.round(t.x),
12430
+ y: Math.round(t.y)
12431
+ };
12432
+ }, Hg = (e) => {
12433
+ let t = X(e);
12434
+ return {
12435
+ x: 1 / t.x,
12436
+ y: 1 / t.y
12437
+ };
12438
+ }, Ug = (e, t, n) => {
12439
+ let r = X(e), i = X(t), a = n === "clockwise" ? Math.PI / 2 : -Math.PI / 2, o = r.x - i.x, s = r.y - i.y, c = o * Math.cos(a) - s * Math.sin(a), l = o * Math.sin(a) + s * Math.cos(a);
12440
+ return {
12441
+ x: c + i.x,
12442
+ y: l + i.y
12443
+ };
12444
+ }, Wg = /* @__PURE__ */ jp({
12445
+ DECIMAL: () => Xg,
12446
+ ZERO: () => Yg,
12447
+ area: () => L_,
12448
+ areaIsZero: () => s_,
12449
+ aspect: () => P_,
12450
+ bottom: () => x_,
12451
+ bottomCenter: () => g_,
12452
+ bottomLeft: () => h_,
12453
+ bottomRight: () => __,
12454
+ box: () => Jg,
12455
+ center: () => w_,
12456
+ centerLeft: () => v_,
12457
+ centerRight: () => y_,
12458
+ construct: () => Z,
12459
+ constructWithAlternateRoot: () => z_,
12460
+ contains: () => $g,
12461
+ copy: () => Zg,
12462
+ css: () => r_,
12463
+ cssBox: () => Kg,
12464
+ dim: () => i_,
12465
+ dims: () => t_,
12466
+ domRect: () => qg,
12467
+ edgePoints: () => j_,
12468
+ equals: () => e_,
12469
+ height: () => l_,
12470
+ intersection: () => I_,
12471
+ isBox: () => N_,
12472
+ left: () => S_,
12473
+ loc: () => o_,
12474
+ positionInCenter: () => M_,
12475
+ reRoot: () => A_,
12476
+ resize: () => Qg,
12477
+ right: () => b_,
12478
+ root: () => D_,
12479
+ round: () => B_,
12480
+ signedDims: () => n_,
12481
+ signedHeight: () => d_,
12482
+ signedWidth: () => u_,
12483
+ top: () => C_,
12484
+ topCenter: () => p_,
12485
+ topLeft: () => f_,
12486
+ topRight: () => m_,
12487
+ translate: () => F_,
12488
+ truncate: () => R_,
12489
+ width: () => c_,
12490
+ x: () => T_,
12491
+ xBounds: () => O_,
12492
+ xyLoc: () => a_,
12493
+ y: () => E_,
12494
+ yBounds: () => k_
12495
+ }), Gg = B([I(), P()]), Kg = z({
12496
+ top: Gg,
12497
+ left: Gg,
12498
+ width: Gg,
12499
+ height: Gg
12500
+ }), qg = z({
12501
+ left: I(),
12502
+ top: I(),
12503
+ right: I(),
12504
+ bottom: I()
12505
+ }), Jg = z({
12506
+ one: mg,
12507
+ two: mg,
12508
+ root: ng
12509
+ }), Yg = {
12510
+ one: _g,
12511
+ two: _g,
12512
+ root: rg
12513
+ }, Xg = {
12514
+ one: _g,
12515
+ two: vg,
12516
+ root: ag
12517
+ }, Zg = (e, t) => ({
12518
+ one: e.one,
12519
+ two: e.two,
12520
+ root: t ?? e.root
12521
+ }), Z = (e, t, n = 0, r = 0, i) => {
12522
+ let a = {
12523
+ one: { ..._g },
12524
+ two: { ..._g },
12525
+ root: i ?? rg
12526
+ };
12527
+ if (typeof e == "number") {
12528
+ if (typeof t != "number") throw Error("Box constructor called with invalid arguments");
12529
+ return a.one = {
12530
+ x: e,
12531
+ y: t
12532
+ }, a.two = {
12533
+ x: a.one.x + n,
12534
+ y: a.one.y + r
12535
+ }, a;
12009
12536
  }
12010
- static MAX = new e(Y.MIN, Y.MAX);
12011
- static ZERO = new e(Y.ZERO, Y.ZERO);
12012
- static z = B([z({
12013
- start: Y.z,
12014
- end: Y.z
12015
- }).transform((t) => new e(t.start, t.end)), H(e)]);
12016
- static boundedZ = e.z.refine(({ isValid: e }) => e, { message: "Time range start time must be before or equal to time range end time" }).refine(({ end: e }) => e.valueOf() <= vm, { message: "Time range end time must be less than or equal to the maximum value of an int64" }).refine(({ start: e }) => e.valueOf() >= _m, { message: "Time range start time must be greater than or equal to the minimum value of an int64" });
12017
- static sort(e, t) {
12018
- return Y.sort(e.start, t.start) || Y.sort(e.end, t.end);
12537
+ return "one" in e && "two" in e && "root" in e ? {
12538
+ ...e,
12539
+ root: i ?? e.root
12540
+ } : ("getBoundingClientRect" in e && (e = e.getBoundingClientRect()), "left" in e ? (a.one = {
12541
+ x: e.left,
12542
+ y: e.top
12543
+ }, a.two = {
12544
+ x: e.right,
12545
+ y: e.bottom
12546
+ }, a) : (a.one = e, t == null ? a.two = {
12547
+ x: a.one.x + n,
12548
+ y: a.one.y + r
12549
+ } : typeof t == "number" ? a.two = {
12550
+ x: a.one.x + t,
12551
+ y: a.one.y + n
12552
+ } : "width" in t ? a.two = {
12553
+ x: a.one.x + t.width,
12554
+ y: a.one.y + t.height
12555
+ } : "signedWidth" in t ? a.two = {
12556
+ x: a.one.x + t.signedWidth,
12557
+ y: a.one.y + t.signedHeight
12558
+ } : a.two = t, a));
12559
+ }, Qg = (e, t, n) => {
12560
+ let r = Z(e);
12561
+ if (typeof t == "string") {
12562
+ if (n == null) throw Error("Invalid arguments for resize");
12563
+ let e = tg(t);
12564
+ return Z(r.one, void 0, e === "x" ? n : c_(r), e === "y" ? n : l_(r), r.root);
12565
+ }
12566
+ return Z(r.one, t, void 0, void 0, r.root);
12567
+ }, $g = (e, t, n = !0) => {
12568
+ let r = Z(e), i = (e, t) => e < t;
12569
+ return n && (i = (e, t) => e <= t), "one" in t ? i(S_(r), S_(t)) && i(b_(t), b_(r)) && i(C_(r), C_(t)) && i(x_(t), x_(r)) : i(S_(r), t.x) && i(t.x, b_(r)) && i(C_(r), t.y) && i(t.y, x_(r));
12570
+ }, e_ = (e, t) => xg(e.one, t.one) && xg(e.two, t.two) && fg(e.root, t.root), t_ = (e) => ({
12571
+ width: c_(e),
12572
+ height: l_(e)
12573
+ }), n_ = (e) => ({
12574
+ signedWidth: u_(e),
12575
+ signedHeight: d_(e)
12576
+ }), r_ = (e) => ({
12577
+ top: C_(e),
12578
+ left: S_(e),
12579
+ width: c_(e),
12580
+ height: l_(e)
12581
+ }), i_ = (e, t, n = !1) => {
12582
+ let r = tg(t) === "y" ? d_(e) : u_(e);
12583
+ return n ? r : Math.abs(r);
12584
+ }, a_ = (e, t) => {
12585
+ let n = Z(e);
12586
+ return {
12587
+ x: t.x === "center" ? w_(n).x : o_(n, t.x),
12588
+ y: t.y === "center" ? w_(n).y : o_(n, t.y)
12589
+ };
12590
+ }, o_ = (e, t) => {
12591
+ let n = Z(e), r = pg(n.root).includes(t) ? Math.min : Math.max;
12592
+ return gh.includes(t) ? r(n.one.x, n.two.x) : r(n.one.y, n.two.y);
12593
+ }, s_ = (e) => L_(e) === 0, c_ = (e) => i_(e, "x"), l_ = (e) => i_(e, "y"), u_ = (e) => {
12594
+ let t = Z(e);
12595
+ return t.two.x - t.one.x;
12596
+ }, d_ = (e) => {
12597
+ let t = Z(e);
12598
+ return t.two.y - t.one.y;
12599
+ }, f_ = (e) => a_(e, rg), p_ = (e) => a_(e, cg), m_ = (e) => a_(e, ig), h_ = (e) => a_(e, ag), g_ = (e) => a_(e, lg), __ = (e) => a_(e, og), v_ = (e) => a_(e, dg), y_ = (e) => a_(e, ug), b_ = (e) => o_(e, "right"), x_ = (e) => o_(e, "bottom"), S_ = (e) => o_(e, "left"), C_ = (e) => o_(e, "top"), w_ = (e) => Eg(f_(e), {
12600
+ x: u_(e) / 2,
12601
+ y: d_(e) / 2
12602
+ }), T_ = (e) => {
12603
+ let t = Z(e);
12604
+ return t.root.x === "left" ? S_(t) : b_(t);
12605
+ }, E_ = (e) => {
12606
+ let t = Z(e);
12607
+ return t.root.y === "top" ? C_(t) : x_(t);
12608
+ }, D_ = (e) => ({
12609
+ x: T_(e),
12610
+ y: E_(e)
12611
+ }), O_ = (e) => {
12612
+ let t = Z(e);
12613
+ return {
12614
+ lower: t.one.x,
12615
+ upper: t.two.x
12616
+ };
12617
+ }, k_ = (e) => {
12618
+ let t = Z(e);
12619
+ return {
12620
+ lower: t.one.y,
12621
+ upper: t.two.y
12622
+ };
12623
+ }, A_ = (e, t) => Zg(e, t), j_ = (e, t) => {
12624
+ let n = Z(e), r = gh.includes(t) ? "x" : vh.includes(t) ? "y" : null;
12625
+ if (r === null) throw Error(`Invalid location: ${t}`);
12626
+ let i = t === "top" || t === "left" ? Math.min : Math.max, a = { ...n.one }, o = { ...n.two };
12627
+ return a[r] = i(n.one[r], n.two[r]), o[r] = i(n.one[r], n.two[r]), [a, o];
12628
+ }, M_ = (e, t) => {
12629
+ let n = Z(e), r = Z(t);
12630
+ return Z({
12631
+ x: T_(r) + (c_(r) - c_(n)) / 2,
12632
+ y: E_(r) + (l_(r) - l_(n)) / 2
12633
+ }, t_(n));
12634
+ }, N_ = (e) => typeof e != "object" || !e ? !1 : "one" in e && "two" in e && "root" in e, P_ = (e) => c_(e) / l_(e), F_ = (e, t, n) => {
12635
+ if (typeof t == "string") {
12636
+ if (n == null) throw Error("Undefined amount passed into box.translate");
12637
+ t = X(tg(t), n);
12019
12638
  }
12020
- static merge(...t) {
12021
- return e.max(...t.map((t) => new e(t).makeValid()));
12639
+ let r = Z(e);
12640
+ return Z(Eg(r.one, t), Eg(r.two, t), void 0, void 0, r.root);
12641
+ }, I_ = (e, t) => {
12642
+ let n = Math.max(S_(e), S_(t)), r = Math.max(C_(e), C_(t)), i = Math.min(b_(e), b_(t)), a = Math.min(x_(e), x_(t));
12643
+ return n > i || r > a ? Yg : Z({
12644
+ x: n,
12645
+ y: r
12646
+ }, {
12647
+ x: i,
12648
+ y: a
12649
+ }, void 0, void 0, e.root);
12650
+ }, L_ = (e) => c_(e) * l_(e), R_ = (e, t) => {
12651
+ let n = Z(e);
12652
+ return Z(Pg(n.one, t), Pg(n.two, t), void 0, void 0, n.root);
12653
+ }, z_ = (e, t, n, r, i, a) => {
12654
+ let o = {
12655
+ x: e,
12656
+ y: t
12657
+ }, s = {
12658
+ x: e + n,
12659
+ y: t + r
12660
+ };
12661
+ return i.x !== a.x && (i.x === "center" ? (o.x -= n / 2, s.x -= n / 2) : (o.x -= n, s.x -= n)), i.y !== a.y && (i.y === "center" ? (o.y -= r / 2, s.y -= r / 2) : (o.y -= r, s.y -= r)), Z(o, s, void 0, void 0, a);
12662
+ }, B_ = (e) => {
12663
+ let t = Z(e);
12664
+ return Z(Vg(t.one), Vg(t.two), void 0, void 0, t.root);
12665
+ }, V_ = /* @__PURE__ */ jp({
12666
+ DECIMAL: () => W_,
12667
+ ZERO: () => U_,
12668
+ construct: () => G_,
12669
+ couple: () => Y_,
12670
+ crude: () => H_,
12671
+ dimensionsZ: () => Ch,
12672
+ equals: () => K_,
12673
+ max: () => X_,
12674
+ min: () => Z_,
12675
+ scale: () => Q_,
12676
+ signedDimensionsZ: () => wh,
12677
+ svgViewBox: () => J_,
12678
+ swap: () => q_
12679
+ }), H_ = B([
12680
+ Ch,
12681
+ wh,
12682
+ mg,
12683
+ fh
12684
+ ]), U_ = {
12685
+ width: 0,
12686
+ height: 0
12687
+ }, W_ = {
12688
+ width: 1,
12689
+ height: 1
12690
+ }, G_ = (e, t) => typeof e == "number" ? {
12691
+ width: e,
12692
+ height: t ?? e
12693
+ } : Array.isArray(e) ? {
12694
+ width: e[0],
12695
+ height: e[1]
12696
+ } : "x" in e ? {
12697
+ width: e.x,
12698
+ height: e.y
12699
+ } : "signedWidth" in e ? {
12700
+ width: e.signedWidth,
12701
+ height: e.signedHeight
12702
+ } : { ...e }, K_ = (e, t) => {
12703
+ if (t == null) return !1;
12704
+ let n = G_(e), r = G_(t);
12705
+ return n.width === r.width && n.height === r.height;
12706
+ }, q_ = (e) => {
12707
+ let t = G_(e);
12708
+ return {
12709
+ width: t.height,
12710
+ height: t.width
12711
+ };
12712
+ }, J_ = (e) => {
12713
+ let t = G_(e);
12714
+ return `0 0 ${t.width} ${t.height}`;
12715
+ }, Y_ = (e) => {
12716
+ let t = G_(e);
12717
+ return [t.width, t.height];
12718
+ }, X_ = (e) => ({
12719
+ width: Math.max(...e.map((e) => G_(e).width)),
12720
+ height: Math.max(...e.map((e) => G_(e).height))
12721
+ }), Z_ = (e) => ({
12722
+ width: Math.min(...e.map((e) => G_(e).width)),
12723
+ height: Math.min(...e.map((e) => G_(e).height))
12724
+ }), Q_ = (e, t) => {
12725
+ let n = G_(e);
12726
+ return {
12727
+ width: n.width * t,
12728
+ height: n.height * t
12729
+ };
12730
+ }, $_ = (e, t, n) => t !== void 0 && e < t ? t : n !== void 0 && e > n ? n : e;
12731
+ z({
12732
+ offset: gg,
12733
+ scale: gg
12734
+ }), z({
12735
+ offset: I(),
12736
+ scale: I()
12737
+ });
12738
+ var ev = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r + e], tv = (e) => (t, n, r, i) => [t, i ? r / e : r * e], nv = (e) => (t, n, r) => {
12739
+ if (t === null) return [e, r];
12740
+ let { lower: i, upper: a } = t, { lower: o, upper: s } = e, c = a - i, l = s - o;
12741
+ return n === "dimension" ? [e, l / c * r] : [e, (r - i) * (l / c) + o];
12742
+ }, rv = (e) => (t, n, r) => [e, r], iv = () => (e, t, n) => {
12743
+ if (e === null) throw Error("cannot invert without bounds");
12744
+ if (t === "dimension") return [e, n];
12745
+ let { lower: r, upper: i } = e;
12746
+ return [e, i - (n - r)];
12747
+ }, av = (e) => (t, n, r) => {
12748
+ let { lower: i, upper: a } = e;
12749
+ return r = $_(r, i, a), [t, r];
12750
+ }, ov = class e {
12751
+ ops = [];
12752
+ currBounds = null;
12753
+ currType = null;
12754
+ reversed = !1;
12755
+ constructor() {
12756
+ this.ops = [];
12022
12757
  }
12023
- }, Q = class e extends Xp {
12024
- constructor(t) {
12025
- if (G(t) && (t = t.value), t instanceof e || typeof t == "string" || typeof t.valueOf() == "string") super(t.valueOf());
12026
- else {
12027
- let n = e.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);
12028
- if (n == null) throw Error(`unable to find data type for ${t.toString()}`);
12029
- super(n.valueOf());
12030
- }
12758
+ static translate(t) {
12759
+ return new e().translate(t);
12031
12760
  }
12032
- get Array() {
12033
- let t = e.ARRAY_CONSTRUCTORS.get(this.toString());
12034
- if (t == null) throw Error(`unable to find array constructor for ${this.valueOf()}`);
12035
- return t;
12761
+ static magnify(t) {
12762
+ return new e().magnify(t);
12036
12763
  }
12037
- equals(e) {
12038
- return this.valueOf() === e.valueOf();
12764
+ static scale(t, n) {
12765
+ return new e().scale(t, n);
12039
12766
  }
12040
- matches(...e) {
12041
- return e.some((e) => this.equals(e));
12767
+ translate(e) {
12768
+ let t = this.new(), n = ev(e);
12769
+ return n.type = "translate", t.ops.push(n), t;
12042
12770
  }
12043
- toString(t = !1) {
12044
- return t ? e.SHORT_STRINGS.get(this.valueOf()) ?? this.valueOf() : this.valueOf();
12771
+ magnify(e) {
12772
+ let t = this.new(), n = tv(e);
12773
+ return n.type = "magnify", t.ops.push(n), t;
12045
12774
  }
12046
- get isVariable() {
12047
- return this.equals(e.JSON) || this.equals(e.STRING) || this.equals(e.BYTES);
12775
+ scale(e, t) {
12776
+ let n = Th(e, t), r = this.new(), i = nv(n);
12777
+ return i.type = "scale", r.ops.push(i), r;
12048
12778
  }
12049
- get isNumeric() {
12050
- return !this.isVariable && !this.equals(e.UUID);
12779
+ clamp(e, t) {
12780
+ let n = Th(e, t), r = this.new(), i = av(n);
12781
+ return i.type = "clamp", r.ops.push(i), r;
12051
12782
  }
12052
- get isInteger() {
12053
- let e = this.toString();
12054
- return e.startsWith("int") || e.startsWith("uint");
12783
+ reBound(e, t) {
12784
+ let n = Th(e, t), r = this.new(), i = rv(n);
12785
+ return i.type = "re-bound", r.ops.push(i), r;
12055
12786
  }
12056
- get isFloat() {
12057
- return this.toString().startsWith("float");
12787
+ invert() {
12788
+ let e = iv();
12789
+ e.type = "invert";
12790
+ let t = this.new();
12791
+ return t.ops.push(e), t;
12058
12792
  }
12059
- get density() {
12060
- let t = e.DENSITIES.get(this.toString());
12061
- if (t == null) throw Error(`unable to find density for ${this.valueOf()}`);
12062
- return t;
12793
+ pos(e) {
12794
+ return this.exec("position", e);
12063
12795
  }
12064
- get isUnsignedInteger() {
12065
- return this.equals(e.UINT8) || this.equals(e.UINT16) || this.equals(e.UINT32) || this.equals(e.UINT64);
12796
+ dim(e) {
12797
+ return this.exec("dimension", e);
12066
12798
  }
12067
- get isSignedInteger() {
12068
- return this.equals(e.INT8) || this.equals(e.INT16) || this.equals(e.INT32) || this.equals(e.INT64);
12799
+ new() {
12800
+ let t = new e();
12801
+ return t.ops = this.ops.slice(), t.reversed = this.reversed, t;
12069
12802
  }
12070
- canSafelyCastTo(t) {
12071
- return this.equals(t) ? !0 : !this.isNumeric || !t.isNumeric || this.isVariable || t.isVariable || this.isUnsignedInteger && t.isSignedInteger ? !1 : this.isFloat ? t.isFloat && this.density.valueOf() <= t.density.valueOf() : this.equals(e.INT32) && t.equals(e.FLOAT64) || this.equals(e.INT8) && t.equals(e.FLOAT32) ? !0 : this.isInteger && t.isInteger ? this.density.valueOf() <= t.density.valueOf() && this.isUnsignedInteger === t.isUnsignedInteger : !1;
12803
+ exec(e, t) {
12804
+ return this.currBounds = null, this.ops.reduce(([t, n], r) => r(t, e, n, this.reversed), [null, t])[1];
12072
12805
  }
12073
- canCastTo(e) {
12074
- return this.isNumeric && e.isNumeric ? !0 : this.equals(e);
12806
+ reverse() {
12807
+ let e = this.new();
12808
+ e.ops.reverse();
12809
+ let t = [];
12810
+ return e.ops.forEach((n, r) => {
12811
+ if (n.type === "scale" || t.some(([e, t]) => r >= e && r <= t)) return;
12812
+ let i = e.ops.findIndex((e, t) => e.type === "scale" && t > r);
12813
+ i !== -1 && t.push([r, i]);
12814
+ }), t.forEach(([t, n]) => {
12815
+ let r = e.ops.slice(t, n);
12816
+ r.unshift(e.ops[n]), e.ops.splice(t, n - t + 1, ...r);
12817
+ }), e.reversed = !e.reversed, e;
12075
12818
  }
12076
- checkArray(e) {
12077
- return e.constructor === this.Array;
12819
+ get transform() {
12820
+ return {
12821
+ scale: this.dim(1),
12822
+ offset: this.pos(0)
12823
+ };
12078
12824
  }
12079
- get usesBigInt() {
12080
- return e.BIG_INT_TYPES.some((e) => e.equals(this));
12825
+ static IDENTITY = new e();
12826
+ };
12827
+ (class e {
12828
+ x;
12829
+ y;
12830
+ currRoot;
12831
+ constructor(e = new ov(), t = new ov(), n = null) {
12832
+ this.x = e, this.y = t, this.currRoot = n;
12081
12833
  }
12082
- static UNKNOWN = new e("unknown");
12083
- static FLOAT64 = new e("float64");
12084
- static FLOAT32 = new e("float32");
12085
- static INT64 = new e("int64");
12086
- static INT32 = new e("int32");
12087
- static INT16 = new e("int16");
12088
- static INT8 = new e("int8");
12089
- static UINT64 = new e("uint64");
12090
- static UINT32 = new e("uint32");
12091
- static UINT16 = new e("uint16");
12092
- static UINT8 = new e("uint8");
12093
- static TIMESTAMP = new e("timestamp");
12094
- static UUID = new e("uuid");
12095
- static STRING = new e("string");
12096
- static JSON = new e("json");
12097
- static BYTES = new e("bytes");
12098
- static ARRAY_CONSTRUCTORS = new Map([
12099
- [e.UINT8.toString(), Uint8Array],
12100
- [e.UINT16.toString(), Uint16Array],
12101
- [e.UINT32.toString(), Uint32Array],
12102
- [e.UINT64.toString(), BigUint64Array],
12103
- [e.FLOAT32.toString(), Float32Array],
12104
- [e.FLOAT64.toString(), Float64Array],
12105
- [e.INT8.toString(), Int8Array],
12106
- [e.INT16.toString(), Int16Array],
12107
- [e.INT32.toString(), Int32Array],
12108
- [e.INT64.toString(), BigInt64Array],
12109
- [e.TIMESTAMP.toString(), BigInt64Array],
12110
- [e.STRING.toString(), Uint8Array],
12111
- [e.JSON.toString(), Uint8Array],
12112
- [e.UUID.toString(), Uint8Array],
12113
- [e.BYTES.toString(), Uint8Array]
12114
- ]);
12115
- static ARRAY_CONSTRUCTOR_DATA_TYPES = new Map([
12116
- [Uint8Array.name, e.UINT8],
12117
- [Uint16Array.name, e.UINT16],
12118
- [Uint32Array.name, e.UINT32],
12119
- [BigUint64Array.name, e.UINT64],
12120
- [Float32Array.name, e.FLOAT32],
12121
- [Float64Array.name, e.FLOAT64],
12122
- [Int8Array.name, e.INT8],
12123
- [Int16Array.name, e.INT16],
12124
- [Int32Array.name, e.INT32],
12125
- [BigInt64Array.name, e.INT64]
12126
- ]);
12127
- static DENSITIES = new Map([
12128
- [e.UINT8.toString(), Z.BIT8],
12129
- [e.UINT16.toString(), Z.BIT16],
12130
- [e.UINT32.toString(), Z.BIT32],
12131
- [e.UINT64.toString(), Z.BIT64],
12132
- [e.FLOAT32.toString(), Z.BIT32],
12133
- [e.FLOAT64.toString(), Z.BIT64],
12134
- [e.INT8.toString(), Z.BIT8],
12135
- [e.INT16.toString(), Z.BIT16],
12136
- [e.INT32.toString(), Z.BIT32],
12137
- [e.INT64.toString(), Z.BIT64],
12138
- [e.TIMESTAMP.toString(), Z.BIT64],
12139
- [e.STRING.toString(), Z.UNKNOWN],
12140
- [e.JSON.toString(), Z.UNKNOWN],
12141
- [e.UUID.toString(), Z.BIT128],
12142
- [e.BYTES.toString(), Z.UNKNOWN]
12143
- ]);
12144
- static ALL = [
12145
- e.UNKNOWN,
12146
- e.UINT8,
12147
- e.UINT16,
12148
- e.UINT32,
12149
- e.UINT64,
12150
- e.INT8,
12151
- e.INT16,
12152
- e.INT32,
12153
- e.INT64,
12154
- e.FLOAT32,
12155
- e.FLOAT64,
12156
- e.TIMESTAMP,
12157
- e.UUID,
12158
- e.STRING,
12159
- e.JSON,
12160
- e.BYTES
12161
- ];
12162
- static SHORT_STRINGS = new Map([
12163
- [e.UINT8.toString(), "u8"],
12164
- [e.UINT16.toString(), "u16"],
12165
- [e.UINT32.toString(), "u32"],
12166
- [e.UINT64.toString(), "u64"],
12167
- [e.INT8.toString(), "i8"],
12168
- [e.INT16.toString(), "i16"],
12169
- [e.INT32.toString(), "i32"],
12170
- [e.INT64.toString(), "i64"],
12171
- [e.FLOAT32.toString(), "f32"],
12172
- [e.FLOAT64.toString(), "f64"],
12173
- [e.TIMESTAMP.toString(), "ts"],
12174
- [e.UUID.toString(), "uuid"],
12175
- [e.STRING.toString(), "str"],
12176
- [e.JSON.toString(), "json"],
12177
- [e.BYTES.toString(), "bytes"]
12178
- ]);
12179
- static BIG_INT_TYPES = [
12180
- e.INT64,
12181
- e.UINT64,
12182
- e.TIMESTAMP
12183
- ];
12184
- static z = B([P().transform((t) => new e(t)), H(e)]);
12185
- }, t_ = class e extends Xp {
12186
- constructor(e) {
12187
- G(e) && (e = e.value), super(e.valueOf());
12834
+ static translate(t, n) {
12835
+ return new e().translate(t, n);
12188
12836
  }
12189
- largerThan(e) {
12190
- return G(e) && (e = e.value), this.valueOf() > e.valueOf();
12837
+ static translateX(t) {
12838
+ return new e().translateX(t);
12191
12839
  }
12192
- smallerThan(e) {
12193
- return G(e) && (e = e.value), this.valueOf() < e.valueOf();
12840
+ static translateY(t) {
12841
+ return new e().translateY(t);
12194
12842
  }
12195
- add(t) {
12196
- return G(t) && (t = t.value), new e(Cm(this.valueOf(), t.valueOf()));
12843
+ static clamp(t) {
12844
+ return new e().clamp(t);
12197
12845
  }
12198
- sub(t) {
12199
- return G(t) && (t = t.value), new e(Sm(this.valueOf(), t.valueOf()));
12846
+ static magnify(t) {
12847
+ return new e().magnify(t);
12200
12848
  }
12201
- mult(t) {
12202
- return new e(Tm(this.valueOf(), t));
12849
+ static scale(t) {
12850
+ return new e().scale(t);
12203
12851
  }
12204
- div(t) {
12205
- return new e(Em(this.valueOf(), t));
12852
+ static reBound(t) {
12853
+ return new e().reBound(t);
12206
12854
  }
12207
- truncate(t) {
12208
- return new e(Math.trunc(this.valueOf() / new e(t).valueOf()) * new e(t).valueOf());
12855
+ translate(e, t) {
12856
+ let n = X(e, t), r = this.copy();
12857
+ return r.x = this.x.translate(n.x), r.y = this.y.translate(n.y), r;
12209
12858
  }
12210
- remainder(t) {
12211
- return e.bytes(this.valueOf() % new e(t).valueOf());
12859
+ translateX(e) {
12860
+ let t = this.copy();
12861
+ return t.x = this.x.translate(e), t;
12212
12862
  }
12213
- get gigabytes() {
12214
- return this.valueOf() / e.GIGABYTE.valueOf();
12863
+ translateY(e) {
12864
+ let t = this.copy();
12865
+ return t.y = this.y.translate(e), t;
12215
12866
  }
12216
- get megabytes() {
12217
- return this.valueOf() / e.MEGABYTE.valueOf();
12867
+ magnify(e) {
12868
+ let t = this.copy();
12869
+ return t.x = this.x.magnify(e.x), t.y = this.y.magnify(e.y), t;
12218
12870
  }
12219
- get kilobytes() {
12220
- return this.valueOf() / e.KILOBYTE.valueOf();
12871
+ scale(e) {
12872
+ let t = this.copy();
12873
+ if (N_(e)) {
12874
+ let n = this.currRoot;
12875
+ return t.currRoot = e.root, n != null && !fg(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(O_(e)), t.y = t.y.scale(k_(e)), t;
12876
+ }
12877
+ return t.x = t.x.scale(e.width), t.y = t.y.scale(e.height), t;
12221
12878
  }
12222
- get terabytes() {
12223
- return this.valueOf() / e.TERABYTE.valueOf();
12879
+ reBound(e) {
12880
+ let t = this.copy();
12881
+ return t.x = this.x.reBound(O_(e)), t.y = this.y.reBound(k_(e)), t;
12224
12882
  }
12225
- toString() {
12226
- let t = this.truncate(e.TERABYTE), n = this.truncate(e.GIGABYTE), r = this.truncate(e.MEGABYTE), i = this.truncate(e.KILOBYTE), a = this.truncate(e.BYTE), o = t, s = n.sub(t), c = r.sub(n), l = i.sub(r), u = a.sub(i), d = "";
12227
- return o.isZero || (d += `${o.terabytes}TB `), s.isZero || (d += `${s.gigabytes}GB `), c.isZero || (d += `${c.megabytes}MB `), l.isZero || (d += `${l.kilobytes}KB `), (!u.isZero || d === "") && (d += `${u.valueOf()}B`), d.trim();
12883
+ clamp(e) {
12884
+ let t = this.copy();
12885
+ return t.x = this.x.clamp(O_(e)), t.y = this.y.clamp(k_(e)), t;
12228
12886
  }
12229
- static bytes(t = 1) {
12230
- return new e(t);
12887
+ copy() {
12888
+ let t = new e();
12889
+ return t.currRoot = this.currRoot, t.x = this.x, t.y = this.y, t;
12231
12890
  }
12232
- static BYTE = new e(1);
12233
- static kilobytes(t = 1) {
12234
- return e.bytes(new e(t).valueOf() * 1e3);
12891
+ reverse() {
12892
+ let e = this.copy();
12893
+ return e.x = this.x.reverse(), e.y = this.y.reverse(), e;
12235
12894
  }
12236
- static KILOBYTE = e.kilobytes(1);
12237
- static megabytes(t = 1) {
12238
- return e.kilobytes(new e(t).valueOf() * 1e3);
12895
+ pos(e) {
12896
+ return {
12897
+ x: this.x.pos(e.x),
12898
+ y: this.y.pos(e.y)
12899
+ };
12239
12900
  }
12240
- static MEGABYTE = e.megabytes(1);
12241
- static gigabytes(t = 1) {
12242
- return e.megabytes(new e(t).valueOf() * 1e3);
12901
+ dim(e) {
12902
+ return {
12903
+ x: this.x.dim(e.x),
12904
+ y: this.y.dim(e.y)
12905
+ };
12243
12906
  }
12244
- static GIGABYTE = e.gigabytes(1);
12245
- static terabytes(t) {
12246
- return e.gigabytes(new e(t).valueOf() * 1e3);
12907
+ box(e) {
12908
+ return Z(this.pos(e.one), this.pos(e.two), 0, 0, this.currRoot ?? e.root);
12247
12909
  }
12248
- static TERABYTE = e.terabytes(1);
12249
- static ZERO = new e(0);
12250
- static z = B([I().transform((t) => new e(t)), H(e)]);
12251
- get isZero() {
12252
- return this.valueOf() === 0;
12910
+ get transform() {
12911
+ return {
12912
+ scale: this.dim({
12913
+ x: 1,
12914
+ y: 1
12915
+ }),
12916
+ offset: this.pos({
12917
+ x: 0,
12918
+ y: 0
12919
+ })
12920
+ };
12253
12921
  }
12254
- };
12255
- z({
12256
- start: I(),
12257
- end: I()
12258
- }), B([
12259
- H(Uint8Array),
12260
- H(Uint16Array),
12261
- H(Uint32Array),
12262
- H(BigUint64Array),
12263
- H(Float32Array),
12264
- H(Float64Array),
12265
- H(Int8Array),
12266
- H(Int16Array),
12267
- H(Int32Array),
12268
- H(BigInt64Array)
12269
- ]);
12270
- var n_ = (e) => {
12271
- let t = typeof e;
12272
- return t === "string" || t === "number" || t === "boolean" || t === "bigint" || e instanceof Y || e instanceof X || e instanceof Date;
12273
- }, r_ = (e, t, n, r = 0) => e.usesBigInt && !t.usesBigInt ? Number(n) - Number(r) : !e.usesBigInt && t.usesBigInt ? BigInt(n.valueOf()) - BigInt(r.valueOf()) : Sm(n, r);
12274
- e_.z, Y.z, X.z, $g.z, t_.z, Q.z, e_.boundedZ;
12275
- var i_ = /^(?:[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;
12276
- function a_(e) {
12277
- return typeof e == "string" && i_.test(e);
12278
- }
12279
- var $ = [];
12280
- for (let e = 0; e < 256; ++e) $.push((e + 256).toString(16).slice(1));
12281
- function o_(e, t = 0) {
12282
- return ($[e[t + 0]] + $[e[t + 1]] + $[e[t + 2]] + $[e[t + 3]] + "-" + $[e[t + 4]] + $[e[t + 5]] + "-" + $[e[t + 6]] + $[e[t + 7]] + "-" + $[e[t + 8]] + $[e[t + 9]] + "-" + $[e[t + 10]] + $[e[t + 11]] + $[e[t + 12]] + $[e[t + 13]] + $[e[t + 14]] + $[e[t + 15]]).toLowerCase();
12283
- }
12284
- function s_(e, t = 0) {
12285
- let n = o_(e, t);
12286
- if (!a_(n)) throw TypeError("Stringified UUID is invalid");
12922
+ static IDENTITY = new e();
12923
+ }), mg.extend({
12924
+ root: ng,
12925
+ units: kp.object({
12926
+ x: kp.enum(["px", "decimal"]),
12927
+ y: kp.enum(["px", "decimal"])
12928
+ })
12929
+ }).partial({
12930
+ root: !0,
12931
+ units: !0
12932
+ });
12933
+ var sv = V(["static", "dynamic"]), cv = /^(?:[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;
12934
+ function lv(e) {
12935
+ return typeof e == "string" && cv.test(e);
12936
+ }
12937
+ var Q = [];
12938
+ for (let e = 0; e < 256; ++e) Q.push((e + 256).toString(16).slice(1));
12939
+ function uv(e, t = 0) {
12940
+ return (Q[e[t + 0]] + Q[e[t + 1]] + Q[e[t + 2]] + Q[e[t + 3]] + "-" + Q[e[t + 4]] + Q[e[t + 5]] + "-" + Q[e[t + 6]] + Q[e[t + 7]] + "-" + Q[e[t + 8]] + Q[e[t + 9]] + "-" + Q[e[t + 10]] + Q[e[t + 11]] + Q[e[t + 12]] + Q[e[t + 13]] + Q[e[t + 14]] + Q[e[t + 15]]).toLowerCase();
12941
+ }
12942
+ function dv(e, t = 0) {
12943
+ let n = uv(e, t);
12944
+ if (!lv(n)) throw TypeError("Stringified UUID is invalid");
12287
12945
  return n;
12288
12946
  }
12289
12947
  typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
12290
- var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12291
- [Symbol.iterator]: () => u_,
12948
+ var fv = (e, t) => dv(e, t), pv = -1, mv = {
12949
+ [Symbol.iterator]: () => mv,
12292
12950
  next: () => ({
12293
12951
  done: !0,
12294
12952
  value: void 0
12295
12953
  })
12296
- }, d_ = P().transform((e) => new Uint8Array(atob(e).split("").map((e) => e.charCodeAt(0))).buffer), f_ = B([Fd(), Nd()]).transform(() => new Uint8Array().buffer), p_ = 10, m_ = (e, t) => {
12954
+ }, hv = P().transform((e) => new Uint8Array(atob(e).split("").map((e) => e.charCodeAt(0))).buffer), gv = B([Fd(), Nd()]).transform(() => new Uint8Array().buffer), $ = 4, _v = (e, t) => {
12297
12955
  if (e === "number" && !t.isNumeric) throw Error(`cannot convert series of type ${t.toString()} to number`);
12298
12956
  if (e === "bigint" && !t.usesBigInt) throw Error(`cannot convert series of type ${t.toString()} to bigint`);
12299
- }, h_ = "sy_x_telem_series", g_ = class e {
12957
+ }, vv = "sy_x_telem_series", yv = class e {
12300
12958
  key;
12301
- discriminator = h_;
12959
+ discriminator = vv;
12302
12960
  dataType;
12303
12961
  sampleOffset;
12304
12962
  gl;
12305
12963
  _data;
12306
- timeRange = e_.ZERO;
12964
+ timeRange = Rh.ZERO;
12307
12965
  alignment = 0n;
12308
12966
  alignmentMultiple = 1n;
12309
12967
  cachedMin;
12310
12968
  cachedMax;
12311
- writePos = l_;
12969
+ writePos = pv;
12312
12970
  _refCount = 0;
12313
12971
  cachedLength;
12314
12972
  _cachedIndexes;
12315
12973
  static crudeZ = z({
12316
- timeRange: e_.z.optional(),
12317
- dataType: Q.z,
12974
+ timeRange: Rh.z.optional(),
12975
+ dataType: Y.z,
12318
12976
  alignment: Ep().optional(),
12319
12977
  data: B([
12320
- d_,
12321
- f_,
12978
+ hv,
12979
+ gv,
12322
12980
  H(ArrayBuffer),
12323
12981
  H(Uint8Array)
12324
12982
  ]),
12325
- glBufferUsage: Jg.default("static").optional()
12983
+ glBufferUsage: sv.default("static").optional()
12326
12984
  });
12327
12985
  static z = e.crudeZ.transform((t) => new e(t));
12328
12986
  constructor(e) {
12329
- __(e) && (e = { data: e }), e.data ??= [];
12330
- let { dataType: t, timeRange: n, sampleOffset: r = 0, glBufferUsage: i = "static", alignment: a = 0n, alignmentMultiple: o = 1n, key: s = lm(), data: c } = e;
12331
- if (v_(c)) {
12987
+ bv(e) && (e = { data: e }), e.data ??= [];
12988
+ let { dataType: t, timeRange: n, sampleOffset: r = 0, glBufferUsage: i = "static", alignment: a = 0n, alignmentMultiple: o = 1n, key: s = $h(), data: c } = e;
12989
+ if (xv(c)) {
12332
12990
  let e = c;
12333
12991
  this.key = e.key, this.dataType = e.dataType, this.sampleOffset = e.sampleOffset, this.gl = e.gl, this._data = e._data, this.timeRange = e.timeRange, this.alignment = e.alignment, this.alignmentMultiple = e.alignmentMultiple, this.cachedMin = e.cachedMin, this.cachedMax = e.cachedMax, this.writePos = e.writePos, this._refCount = e._refCount, this.cachedLength = e.cachedLength;
12334
12992
  return;
12335
12993
  }
12336
- let l = n_(c), u = Array.isArray(c);
12337
- if (t != null) this.dataType = new Q(t);
12994
+ let l = Bh(c), u = Array.isArray(c);
12995
+ if (t != null) this.dataType = new Y(t);
12338
12996
  else if (c instanceof ArrayBuffer) throw Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");
12339
12997
  else if (u || l) {
12340
12998
  let e = c;
@@ -12342,21 +13000,31 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12342
13000
  if (c.length === 0) throw Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");
12343
13001
  e = c[0];
12344
13002
  }
12345
- if (typeof e == "string") this.dataType = Q.STRING;
12346
- else if (typeof e == "number") this.dataType = Q.FLOAT64;
12347
- else if (typeof e == "bigint") this.dataType = Q.INT64;
12348
- else if (typeof e == "boolean") this.dataType = Q.UINT8;
12349
- else if (e instanceof Y || e instanceof Date || e instanceof Y) this.dataType = Q.TIMESTAMP;
12350
- else if (typeof e == "object") this.dataType = Q.JSON;
13003
+ if (typeof e == "string") this.dataType = Y.STRING;
13004
+ else if (typeof e == "number") this.dataType = Y.FLOAT64;
13005
+ else if (typeof e == "bigint") this.dataType = Y.INT64;
13006
+ else if (typeof e == "boolean") this.dataType = Y.UINT8;
13007
+ else if (e instanceof K || e instanceof Date || e instanceof K) this.dataType = Y.TIMESTAMP;
13008
+ else if (typeof e == "object") this.dataType = Y.JSON;
12351
13009
  else throw Error(`cannot infer data type of ${typeof e} when constructing a Series from a JS array`);
12352
- } else this.dataType = new Q(c);
13010
+ } else this.dataType = new Y(c);
12353
13011
  if (!u && !l) this._data = c;
12354
13012
  else if (u && c.length === 0) this._data = new this.dataType.Array([]).buffer;
12355
13013
  else {
12356
13014
  let e = l ? [c] : c, t = e[0];
12357
- (t instanceof Y || t instanceof Date || t instanceof X) && (e = e.map((e) => new Y(e).valueOf())), this.dataType.equals(Q.STRING) ? (this.cachedLength = e.length, this._data = new TextEncoder().encode(`${e.join("\n")}\n`).buffer) : this.dataType.equals(Q.JSON) ? (this.cachedLength = e.length, this._data = new TextEncoder().encode(`${e.map((e) => Yp.encodeString(e)).join("\n")}\n`).buffer) : this.dataType.usesBigInt && typeof t == "number" ? this._data = new this.dataType.Array(e.map((e) => BigInt(Math.round(e)))).buffer : !this.dataType.usesBigInt && typeof t == "bigint" ? this._data = new this.dataType.Array(e.map(Number)).buffer : this._data = new this.dataType.Array(e).buffer;
12358
- }
12359
- this.key = s, this.alignment = a, this.alignmentMultiple = o, this.sampleOffset = r ?? 0, this.timeRange = n ?? e_.ZERO, this.gl = {
13015
+ if ((t instanceof K || t instanceof Date || t instanceof q) && (e = e.map((e) => new K(e).valueOf())), this.dataType.equals(Y.STRING)) {
13016
+ this.cachedLength = e.length;
13017
+ let t = e.map((e) => new TextEncoder().encode(e)), n = t.reduce((e, t) => e + $ + t.byteLength, 0), r = new ArrayBuffer(n), i = new DataView(r), a = new Uint8Array(r), o = 0;
13018
+ for (let e of t) i.setUint32(o, e.byteLength, !0), o += $, a.set(e, o), o += e.byteLength;
13019
+ this._data = r;
13020
+ } else if (this.dataType.equals(Y.JSON)) {
13021
+ this.cachedLength = e.length;
13022
+ let t = e.map((e) => new TextEncoder().encode(Mh.encodeString(e))), n = t.reduce((e, t) => e + $ + t.byteLength, 0), r = new ArrayBuffer(n), i = new DataView(r), a = new Uint8Array(r), o = 0;
13023
+ for (let e of t) i.setUint32(o, e.byteLength, !0), o += $, a.set(e, o), o += e.byteLength;
13024
+ this._data = r;
13025
+ } else this.dataType.usesBigInt && typeof t == "number" ? this._data = new this.dataType.Array(e.map((e) => BigInt(Math.round(e)))).buffer : !this.dataType.usesBigInt && typeof t == "bigint" ? this._data = new this.dataType.Array(e.map(Number)).buffer : this._data = new this.dataType.Array(e).buffer;
13026
+ }
13027
+ this.key = s, this.alignment = a, this.alignmentMultiple = o, this.sampleOffset = r ?? 0, this.timeRange = n ?? Rh.ZERO, this.gl = {
12360
13028
  control: null,
12361
13029
  buffer: null,
12362
13030
  prevBuffer: 0,
@@ -12366,7 +13034,7 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12366
13034
  static alloc({ capacity: t, dataType: n, ...r }) {
12367
13035
  if (t === 0) throw Error("[Series] - cannot allocate an array of length 0");
12368
13036
  let i = new e({
12369
- data: new new Q(n).Array(t).buffer,
13037
+ data: new new Y(n).Array(t).buffer,
12370
13038
  dataType: n,
12371
13039
  ...r
12372
13040
  });
@@ -12386,12 +13054,19 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12386
13054
  return this.dataType.isVariable ? this.writeVariable(e) : this.writeFixed(e);
12387
13055
  }
12388
13056
  writeVariable(e) {
12389
- if (this.writePos === l_) return 0;
12390
- let t = this.byteCapacity.valueOf() - this.writePos, n = e.subBytes(0, t);
12391
- return this.writeToUnderlyingData(n), this.writePos += n.byteLength.valueOf(), this.cachedLength != null && (this.cachedLength += n.length, this.calculateCachedLength()), n.length;
13057
+ if (this.writePos === pv) return 0;
13058
+ let t = this.byteCapacity.valueOf() - this.writePos, n = e.buffer, r = e.byteLength.valueOf(), i = new DataView(n), a = 0, o = 0;
13059
+ for (; a + $ <= r;) {
13060
+ let e = $ + i.getUint32(a, !0);
13061
+ if (a + e > t) break;
13062
+ a += e, o++;
13063
+ }
13064
+ if (a === 0) return 0;
13065
+ let s = e.subBytes(0, a);
13066
+ return this.writeToUnderlyingData(s), this.writePos += a, this.cachedLength = (this.cachedLength ?? 0) + o, this._cachedIndexes = void 0, o;
12392
13067
  }
12393
13068
  writeFixed(e) {
12394
- if (this.writePos === l_) return 0;
13069
+ if (this.writePos === pv) return 0;
12395
13070
  let t = this.capacity - this.writePos, n = e.sub(0, t);
12396
13071
  return this.writeToUnderlyingData(n), this.cachedLength = void 0, this.maybeRecomputeMinMax(n), this.writePos += n.length, n.length;
12397
13072
  }
@@ -12405,38 +13080,48 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12405
13080
  return new this.dataType.Array(this._data);
12406
13081
  }
12407
13082
  get data() {
12408
- return this.writePos === l_ ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
13083
+ return this.writePos === pv ? this.underlyingData : new this.dataType.Array(this._data, 0, this.writePos);
12409
13084
  }
12410
13085
  toStrings() {
12411
- return this.dataType.isVariable ? new TextDecoder().decode(this.underlyingData).split("\n").slice(0, -1) : Array.from(this).map((e) => e.toString());
13086
+ if (this.dataType.isVariable) {
13087
+ let e = [], t = this.buffer, n = this.byteLength.valueOf(), r = new DataView(t), i = new TextDecoder(), a = 0;
13088
+ for (; a + $ <= n;) {
13089
+ let n = r.getUint32(a, !0);
13090
+ a += $, e.push(i.decode(new Uint8Array(t, a, n))), a += n;
13091
+ }
13092
+ return e;
13093
+ }
13094
+ return Array.from(this).map((e) => e.toString());
12412
13095
  }
12413
13096
  parseJSON(e) {
12414
- if (!this.dataType.equals(Q.JSON)) throw Error("cannot parse non-JSON series as JSON");
12415
- return this.toStrings().map((t) => e.parse(Yp.decodeString(t)));
13097
+ if (!this.dataType.equals(Y.JSON)) throw Error("cannot parse non-JSON series as JSON");
13098
+ return this.toStrings().map((t) => e.parse(Mh.decodeString(t)));
12416
13099
  }
12417
13100
  get byteCapacity() {
12418
- return new t_(this.underlyingData.byteLength);
13101
+ return new zh(this.underlyingData.byteLength);
12419
13102
  }
12420
13103
  get capacity() {
12421
13104
  return this.dataType.isVariable ? this.byteCapacity.valueOf() : this.dataType.density.length(this.byteCapacity);
12422
13105
  }
12423
13106
  get byteLength() {
12424
- return this.writePos === l_ ? this.byteCapacity : this.dataType.isVariable ? new t_(this.writePos) : this.dataType.density.size(this.writePos);
13107
+ return this.writePos === pv ? this.byteCapacity : this.dataType.isVariable ? new zh(this.writePos) : this.dataType.density.size(this.writePos);
12425
13108
  }
12426
13109
  get length() {
12427
- return this.cachedLength == null ? this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === l_ ? this.byteCapacity.valueOf() / this.dataType.density.valueOf() : this.writePos : this.cachedLength;
13110
+ return this.cachedLength == null ? this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === pv ? this.byteCapacity.valueOf() / this.dataType.density.valueOf() : this.writePos : this.cachedLength;
12428
13111
  }
12429
13112
  calculateCachedLength() {
12430
13113
  if (!this.dataType.isVariable) throw Error("cannot calculate length of a non-variable length data type");
12431
- let e = 0, t = [0];
12432
- return this.data.forEach((n, r) => {
12433
- n === p_ && (e++, t.push(r + 1));
12434
- }), this._cachedIndexes = t, this.cachedLength = e, e;
13114
+ let e = 0, t = [], n = this.buffer, r = this.byteLength.valueOf(), i = new DataView(n), a = 0;
13115
+ for (; a + $ <= r;) {
13116
+ let n = i.getUint32(a, !0);
13117
+ a += $, t.push(a), a += n, e++;
13118
+ }
13119
+ return this._cachedIndexes = t, this.cachedLength = e, e;
12435
13120
  }
12436
13121
  convert(t, n = 0) {
12437
13122
  if (this.dataType.equals(t)) return this;
12438
13123
  let r = new t.Array(this.length);
12439
- for (let e = 0; e < this.length; e++) r[e] = r_(this.dataType, t, this.data[e], n);
13124
+ for (let e = 0; e < this.length; e++) r[e] = Vh(this.dataType, t, this.data[e], n);
12440
13125
  return new e({
12441
13126
  data: r.buffer,
12442
13127
  dataType: t,
@@ -12447,27 +13132,27 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12447
13132
  });
12448
13133
  }
12449
13134
  calcRawMax() {
12450
- return this.length === 0 ? -Infinity : (this.dataType.equals(Q.TIMESTAMP) ? this.cachedMax = this.data[this.data.length - 1] : (this.dataType.usesBigInt, this.cachedMax = this.data.reduce((e, t) => e > t ? e : t)), this.cachedMax);
13135
+ return this.length === 0 ? -Infinity : (this.dataType.equals(Y.TIMESTAMP) ? this.cachedMax = this.data[this.data.length - 1] : (this.dataType.usesBigInt, this.cachedMax = this.data.reduce((e, t) => e > t ? e : t)), this.cachedMax);
12451
13136
  }
12452
13137
  get max() {
12453
13138
  return this.calcMax();
12454
13139
  }
12455
13140
  calcMax() {
12456
13141
  if (this.dataType.isVariable) throw Error("cannot calculate maximum on a variable length data type");
12457
- return this.writePos === 0 ? -Infinity : (this.cachedMax ??= this.calcRawMax(), Cm(this.cachedMax, this.sampleOffset));
13142
+ return this.writePos === 0 ? -Infinity : (this.cachedMax ??= this.calcRawMax(), ch(this.cachedMax, this.sampleOffset));
12458
13143
  }
12459
13144
  calcRawMin() {
12460
- return this.length === 0 ? Infinity : (this.dataType.equals(Q.TIMESTAMP) ? this.cachedMin = this.data[0] : (this.dataType.usesBigInt, this.cachedMin = this.data.reduce((e, t) => e < t ? e : t)), this.cachedMin);
13145
+ return this.length === 0 ? Infinity : (this.dataType.equals(Y.TIMESTAMP) ? this.cachedMin = this.data[0] : (this.dataType.usesBigInt, this.cachedMin = this.data.reduce((e, t) => e < t ? e : t)), this.cachedMin);
12461
13146
  }
12462
13147
  get min() {
12463
13148
  return this.calcMin();
12464
13149
  }
12465
13150
  calcMin() {
12466
13151
  if (this.dataType.isVariable) throw Error("cannot calculate minimum on a variable length data type");
12467
- return this.writePos === 0 ? Infinity : (this.cachedMin ??= this.calcRawMin(), Cm(this.cachedMin, this.sampleOffset));
13152
+ return this.writePos === 0 ? Infinity : (this.cachedMin ??= this.calcRawMin(), ch(this.cachedMin, this.sampleOffset));
12468
13153
  }
12469
13154
  get bounds() {
12470
- return Bm(Number(this.min), Number(this.max), { makeValid: !1 });
13155
+ return Th(Number(this.min), Number(this.max), { makeValid: !1 });
12471
13156
  }
12472
13157
  maybeRecomputeMinMax(e) {
12473
13158
  if (this.cachedMin != null) {
@@ -12489,18 +13174,18 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12489
13174
  }
12490
13175
  at(e, t = !1) {
12491
13176
  if (this.dataType.isVariable) return this.atVariable(e, t ?? !1);
12492
- if (this.dataType.equals(Q.UUID)) return this.atUUID(e, t);
13177
+ if (this.dataType.equals(Y.UUID)) return this.atUUID(e, t);
12493
13178
  e < 0 && (e = this.length + e);
12494
13179
  let n = this.data[e];
12495
13180
  if (n == null) {
12496
13181
  if (t === !0) throw Error(`[series] - no value at index ${e}`);
12497
13182
  return;
12498
13183
  }
12499
- return Cm(n, this.sampleOffset);
13184
+ return ch(n, this.sampleOffset);
12500
13185
  }
12501
13186
  atUUID(e, t) {
12502
13187
  e < 0 && (e = this.length + e);
12503
- let n = c_(new Uint8Array(this.buffer, e * this.dataType.density.valueOf()));
13188
+ let n = fv(new Uint8Array(this.buffer, e * this.dataType.density.valueOf()));
12504
13189
  if (n == null) {
12505
13190
  if (t) throw Error(`[series] - no value at index ${e}`);
12506
13191
  return;
@@ -12508,27 +13193,34 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12508
13193
  return n;
12509
13194
  }
12510
13195
  atVariable(e, t) {
12511
- let n = 0, r = 0;
12512
- if (this._cachedIndexes != null) n = this._cachedIndexes[e], r = this._cachedIndexes[e + 1] - 1;
12513
- else {
13196
+ let n = 0, r = 0, i = this.buffer, a = new DataView(i);
13197
+ if (this._cachedIndexes != null) {
13198
+ if (e < 0 && (e = this._cachedIndexes.length + e), e < 0 || e >= this._cachedIndexes.length) {
13199
+ if (t) throw Error(`[series] - no value at index ${e}`);
13200
+ return;
13201
+ }
13202
+ n = this._cachedIndexes[e], r = a.getUint32(n - $, !0);
13203
+ } else {
12514
13204
  e < 0 && (e = this.length + e);
12515
- for (let t = 0; t < this.data.length; t++) if (this.data[t] === p_) {
12516
- if (e === 0) {
12517
- r = t;
13205
+ let i = this.byteLength.valueOf(), o = 0, s = !1;
13206
+ for (; o + $ <= i;) {
13207
+ let t = a.getUint32(o, !0);
13208
+ if (o += $, e === 0) {
13209
+ n = o, r = t, s = !0;
12518
13210
  break;
12519
13211
  }
12520
- n = t + 1, e--;
13212
+ o += t, e--;
12521
13213
  }
12522
- if (r === 0 && (r = this.data.length), n >= r || e > 0) {
13214
+ if (!s) {
12523
13215
  if (t) throw Error(`[series] - no value at index ${e}`);
12524
13216
  return;
12525
13217
  }
12526
13218
  }
12527
- let i = this.data.slice(n, r);
12528
- return this.dataType.equals(Q.STRING) ? new TextDecoder().decode(i) : Bp(JSON.parse(new TextDecoder().decode(i)));
13219
+ let o = new Uint8Array(i, n, r);
13220
+ return this.dataType.equals(Y.STRING) ? new TextDecoder().decode(o) : Bp(JSON.parse(new TextDecoder().decode(o)));
12529
13221
  }
12530
13222
  binarySearch(e) {
12531
- let t = 0, n = this.length - 1, r = tm(e);
13223
+ let t = 0, n = this.length - 1, r = Gh(e);
12532
13224
  for (; t <= n;) {
12533
13225
  let i = Math.floor((t + n) / 2), a = r(this.at(i, !0), e);
12534
13226
  if (a === 0) return i;
@@ -12537,16 +13229,16 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12537
13229
  return t;
12538
13230
  }
12539
13231
  updateGLBuffer(e) {
12540
- if (this.gl.control = e, !this.dataType.equals(Q.FLOAT32) && !this.dataType.equals(Q.UINT8)) throw Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
13232
+ if (this.gl.control = e, !this.dataType.equals(Y.FLOAT32) && !this.dataType.equals(Y.UINT8)) throw Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
12541
13233
  let { buffer: t, bufferUsage: n, prevBuffer: r } = this.gl;
12542
- if (t ?? (this.gl.buffer = e.createBuffer()), this.writePos !== r) if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !== l_) {
13234
+ if (t ?? (this.gl.buffer = e.createBuffer()), this.writePos !== r) if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !== pv) {
12543
13235
  r === 0 && e.bufferData(e.ARRAY_BUFFER, this.byteCapacity.valueOf(), e.STATIC_DRAW);
12544
13236
  let t = this.dataType.density.size(r).valueOf(), n = this.underlyingData.slice(this.gl.prevBuffer, this.writePos);
12545
13237
  e.bufferSubData(e.ARRAY_BUFFER, t, n.buffer), this.gl.prevBuffer = this.writePos;
12546
- } else e.bufferData(e.ARRAY_BUFFER, this.buffer, n === "static" ? e.STATIC_DRAW : e.DYNAMIC_DRAW), this.gl.prevBuffer = l_;
13238
+ } else e.bufferData(e.ARRAY_BUFFER, this.buffer, n === "static" ? e.STATIC_DRAW : e.DYNAMIC_DRAW), this.gl.prevBuffer = pv;
12547
13239
  }
12548
13240
  as(e) {
12549
- return m_(e, this.dataType), this;
13241
+ return _v(e, this.dataType), this;
12550
13242
  }
12551
13243
  get digest() {
12552
13244
  return {
@@ -12554,8 +13246,8 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12554
13246
  dataType: this.dataType.toString(),
12555
13247
  sampleOffset: this.sampleOffset,
12556
13248
  alignment: {
12557
- lower: w_(this.alignmentBounds.lower),
12558
- upper: w_(this.alignmentBounds.upper),
13249
+ lower: Dv(this.alignmentBounds.lower),
13250
+ upper: Dv(this.alignmentBounds.upper),
12559
13251
  multiple: this.alignmentMultiple
12560
13252
  },
12561
13253
  timeRange: this.timeRange.toString(),
@@ -12564,7 +13256,7 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12564
13256
  };
12565
13257
  }
12566
13258
  get alignmentBounds() {
12567
- return Bm(this.alignment, this.alignment + BigInt(this.length) * this.alignmentMultiple);
13259
+ return Th(this.alignment, this.alignment + BigInt(this.length) * this.alignmentMultiple);
12568
13260
  }
12569
13261
  maybeGarbageCollectGLBuffer(e) {
12570
13262
  this.gl.buffer != null && (e.deleteBuffer(this.gl.buffer), this.gl.buffer = null, this.gl.prevBuffer = 0, this.gl.control = null);
@@ -12575,10 +13267,10 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12575
13267
  }
12576
13268
  [Symbol.iterator]() {
12577
13269
  if (this.dataType.isVariable) {
12578
- let e = new b_(this);
12579
- return this.dataType.equals(Q.JSON) ? new x_(e) : e;
13270
+ let e = new Cv(this);
13271
+ return this.dataType.equals(Y.JSON) ? new wv(e) : e;
12580
13272
  }
12581
- return this.dataType.equals(Q.UUID) ? new S_(this) : new C_(this);
13273
+ return this.dataType.equals(Y.UUID) ? new Tv(this) : new Ev(this);
12582
13274
  }
12583
13275
  slice(e, t) {
12584
13276
  return this.sliceSub(!1, e, t);
@@ -12587,11 +13279,11 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12587
13279
  return this.sliceSub(!0, e, t);
12588
13280
  }
12589
13281
  subIterator(e, t) {
12590
- return new y_(this, e, t ?? this.length);
13282
+ return new Sv(this, e, t ?? this.length);
12591
13283
  }
12592
13284
  subAlignmentIterator(e, t) {
12593
13285
  let n = Math.ceil(Number(e - this.alignment) / Number(this.alignmentMultiple)), r = Math.ceil(Number(t - this.alignment) / Number(this.alignmentMultiple));
12594
- return new y_(this, n, r);
13286
+ return new Sv(this, n, r);
12595
13287
  }
12596
13288
  subBytes(t, n) {
12597
13289
  return t >= 0 && (n == null || n >= this.byteLength.valueOf()) ? this : new e({
@@ -12619,7 +13311,7 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12619
13311
  return new e({
12620
13312
  data: this.buffer,
12621
13313
  dataType: this.dataType,
12622
- timeRange: e_.ZERO,
13314
+ timeRange: Rh.ZERO,
12623
13315
  sampleOffset: this.sampleOffset,
12624
13316
  glBufferUsage: "static",
12625
13317
  alignment: t
@@ -12635,14 +13327,14 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12635
13327
  }
12636
13328
  return e += "])", e;
12637
13329
  }
12638
- }, __ = (e) => e == null ? !1 : Array.isArray(e) || e instanceof ArrayBuffer || ArrayBuffer.isView(e) && !(e instanceof DataView) || e instanceof g_ ? !0 : n_(e), v_ = um(h_, g_), y_ = class {
13330
+ }, bv = (e) => e == null ? !1 : Array.isArray(e) || e instanceof ArrayBuffer || ArrayBuffer.isView(e) && !(e instanceof DataView) || e instanceof yv ? !0 : Bh(e), xv = eg(vv, yv), Sv = class {
12639
13331
  series;
12640
13332
  end;
12641
13333
  index;
12642
13334
  constructor(e, t, n) {
12643
13335
  this.series = e;
12644
- let r = Bm(0, e.length + 1);
12645
- this.end = Hm(r, n), this.index = Hm(r, t);
13336
+ let r = Th(0, e.length + 1);
13337
+ this.end = Dh(r, n), this.index = Dh(r, t);
12646
13338
  }
12647
13339
  next() {
12648
13340
  return this.index >= this.end ? {
@@ -12653,396 +13345,117 @@ var c_ = (e, t) => s_(e, t), l_ = -1, u_ = {
12653
13345
  value: this.series.at(this.index++, !0)
12654
13346
  };
12655
13347
  }
12656
- }, b_ = class {
13348
+ }, Cv = class {
12657
13349
  series;
12658
- index;
13350
+ byteOffset;
12659
13351
  decoder;
13352
+ view;
12660
13353
  constructor(e) {
12661
13354
  if (!e.dataType.isVariable) throw Error("cannot create a variable series iterator for a non-variable series");
12662
- this.series = e, this.index = 0, this.decoder = new TextDecoder();
12663
- }
12664
- next() {
12665
- let e = this.index, t = this.series.data;
12666
- for (; this.index < t.length && t[this.index] !== p_;) this.index++;
12667
- let n = this.index;
12668
- return e === n ? {
12669
- done: !0,
12670
- value: void 0
12671
- } : (this.index++, {
12672
- done: !1,
12673
- value: this.decoder.decode(this.series.buffer.slice(e, n))
12674
- });
12675
- }
12676
- }, x_ = class e {
12677
- wrapped;
12678
- static schema = lf(P(), zd());
12679
- constructor(e) {
12680
- this.wrapped = e;
12681
- }
12682
- next() {
12683
- let t = this.wrapped.next();
12684
- return t.done === !0 ? {
12685
- done: !0,
12686
- value: void 0
12687
- } : {
12688
- done: !1,
12689
- value: Yp.decodeString(t.value, e.schema)
12690
- };
12691
- }
12692
- }, S_ = class {
12693
- series;
12694
- index;
12695
- data;
12696
- density;
12697
- constructor(e) {
12698
- if (!e.dataType.equals(Q.UUID)) throw Error("cannot create a UUID series iterator for a non-UUID series");
12699
- this.series = e, this.index = 0, this.data = new Uint8Array(e.buffer), this.density = Q.UUID.density.valueOf();
12700
- }
12701
- next() {
12702
- if (this.index >= this.series.length) return {
12703
- done: !0,
12704
- value: void 0
12705
- };
12706
- let e = c_(this.data, this.index * this.density);
12707
- return this.index++, {
12708
- done: !1,
12709
- value: e
12710
- };
12711
- }
12712
- }, C_ = class {
12713
- series;
12714
- index;
12715
- constructor(e) {
12716
- this.series = e, this.index = 0;
13355
+ this.series = e, this.byteOffset = 0, this.decoder = new TextDecoder(), this.view = new DataView(e.buffer);
12717
13356
  }
12718
13357
  next() {
12719
- return this.index >= this.series.length ? {
13358
+ let e = this.series.byteLength.valueOf();
13359
+ if (this.byteOffset + $ > e) return {
12720
13360
  done: !0,
12721
13361
  value: void 0
12722
- } : {
12723
- done: !1,
12724
- value: this.series.at(this.index++, !0)
12725
- };
12726
- }
12727
- }, w_ = (e) => ({
12728
- domain: e >> 32n,
12729
- sample: e & 4294967295n
12730
- });
12731
- z({
12732
- baseInterval: X.z.optional(),
12733
- maxRetries: I().optional(),
12734
- scale: I().optional()
12735
- }), L().min(mm).max(127), L().min(hm).max(gm), L().min(ym).max(bm);
12736
- var T_ = L().min(0).max(255);
12737
- L().min(0).max(dm), L().min(0).max(fm), L().min(0).max(pm);
12738
- var E_ = (e) => {
12739
- try {
12740
- return structuredClone(e);
12741
- } catch {
12742
- return console.warn("Failed to deep copy object, falling back to JSON.parse(JSON.stringify)", e), console.trace(), JSON.parse(JSON.stringify(e));
12743
- }
12744
- }, D_ = (e, t, n = "") => {
12745
- let r = {}, i = (e, t, n) => {
12746
- if (typeof e != typeof t || e === null || t === null) {
12747
- r[n] = [e, t];
12748
- return;
12749
- }
12750
- if (typeof e == "object" && typeof t == "object") if (Array.isArray(e) && Array.isArray(t)) {
12751
- if (e.length !== t.length) {
12752
- r[n] = [e, t];
12753
- return;
12754
- }
12755
- for (let r = 0; r < e.length; r++) i(e[r], t[r], `${n}[${r}]`);
12756
- } else new Set([...Object.keys(e), ...Object.keys(t)]).forEach((r) => {
12757
- i(e[r], t[r], n === "" ? r : `${n}.${r}`);
12758
- });
12759
- else e !== t && (r[n] = [e, t]);
12760
- };
12761
- return i(e, t, n), r;
12762
- }, O_ = (e, t) => {
12763
- let n = Array.isArray(e), r = Array.isArray(t);
12764
- if (n !== r) return !1;
12765
- if (n && r) {
12766
- let n = e, r = t;
12767
- if (n.length !== r.length) return !1;
12768
- for (let e = 0; e < n.length; e++) if (!O_(n[e], r[e])) return !1;
12769
- return !0;
12770
- }
12771
- if (e == null || t == null || typeof e != "object" || typeof t != "object") return e === t;
12772
- if ("equals" in e) return e.equals(t);
12773
- let i = Object.keys(e), a = Object.keys(t);
12774
- if (i.length !== a.length) return !1;
12775
- for (let n of i) {
12776
- let r = e[n], i = t[n];
12777
- if (typeof r == "object" && typeof i == "object") {
12778
- if (!O_(r, i)) return !1;
12779
- } else if (r !== i) return !1;
12780
- }
12781
- return !0;
12782
- }, k_ = (e, t) => {
12783
- if (typeof e != "object" || !e) return e === t;
12784
- let n = Object.keys(e), r = Object.keys(t);
12785
- if (r.length > n.length) return !1;
12786
- for (let n of r) {
12787
- let r = e[n], i = t[n];
12788
- if (typeof r == "object" && typeof i == "object") {
12789
- if (!k_(r, i)) return !1;
12790
- } else if (r !== i) return !1;
12791
- }
12792
- return !0;
12793
- }, A_ = (e, t, n = ".") => {
12794
- let r = e.split(n);
12795
- return r.map((e, i) => {
12796
- let a = t(e, i, r);
12797
- return a == null ? null : typeof a == "string" ? a : a.join(n);
12798
- }).filter((e) => e != null).join(n);
12799
- }, j_ = (e, t) => {
12800
- if (!Array.isArray(e)) return e[t];
12801
- let n = e[t];
12802
- if (n != null || e.length == 0) return n;
12803
- let r = e[0];
12804
- if (typeof r == "object" && "key" in r) return e.find((e) => e.key === t);
12805
- }, M_ = (e, t) => {
12806
- let n = e.split(".");
12807
- return n.forEach((e, r) => {
12808
- t = j_(t, e), typeof t == "object" && t && "key" in t && (n[r] = t.key);
12809
- }), n.join(".");
12810
- }, N_ = (e, t) => {
12811
- let n = e.split(".");
12812
- return t < 0 ? n[n.length + t] : n[t];
12813
- }, P_ = (e, t) => {
12814
- if (t.length === 0) return !0;
12815
- let n = e.split("."), r = t.split(".");
12816
- if (r.length > n.length) return !1;
12817
- for (let e = 0; e < r.length; e++) {
12818
- let t = n[e], i = r[e];
12819
- if (i !== "*" && t !== i) return !1;
12820
- }
12821
- return !0;
12822
- }, F_ = (e) => {
12823
- let t = parseInt(e, 10);
12824
- return isNaN(t) || t < 0 || t.toString() !== e ? null : t;
12825
- }, I_ = (e, t) => {
12826
- for (let n = 1; n <= t.length; n++) {
12827
- let r = t.slice(0, n).join(".");
12828
- if (j_(e, r) != null) return [r, n];
13362
+ };
13363
+ let t = this.view.getUint32(this.byteOffset, !0);
13364
+ this.byteOffset += $;
13365
+ let n = this.decoder.decode(new Uint8Array(this.series.buffer, this.byteOffset, t));
13366
+ return this.byteOffset += t, {
13367
+ done: !1,
13368
+ value: n
13369
+ };
12829
13370
  }
12830
- return null;
12831
- }, L_ = ((e, t, n = { optional: !1 }) => {
12832
- let { optional: r, getter: i = j_ } = n;
12833
- if (t === "") return e;
12834
- let a = t.split(".");
12835
- if (a.length === 1) {
12836
- let n = i(e, a[0]);
12837
- if (n === void 0) {
12838
- if (r) return null;
12839
- throw Error(`Path ${t} does not exist. ${a[0]} is undefined`);
12840
- }
12841
- return n;
13371
+ }, wv = class e {
13372
+ wrapped;
13373
+ static schema = lf(P(), zd());
13374
+ constructor(e) {
13375
+ this.wrapped = e;
12842
13376
  }
12843
- let o = (e, n) => {
12844
- if (n >= a.length) return e;
12845
- for (let s = a.length - n; s >= 1; s--) {
12846
- let c = a.slice(n, n + s).join("."), l = i(e, c);
12847
- if (l !== void 0) {
12848
- if (n + s === a.length) return l;
12849
- if (l === null) {
12850
- if (r) return null;
12851
- throw Error(`Path ${t} does not exist. ${c} is null`);
12852
- }
12853
- return o(l, n + s);
12854
- }
12855
- }
12856
- if (r) return null;
12857
- throw Error(`Path ${t} does not exist. ${a[n]} is undefined`);
12858
- };
12859
- return o(e, 0);
12860
- }), R_ = (e, t) => L_(e, t, { optional: !0 }) !== null, z_ = (e, ...t) => {
12861
- if (t.length === 0) return e;
12862
- let n = t.shift();
12863
- if (Gp(e) && Gp(n)) for (let t in n) try {
12864
- Gp(n[t]) ? (t in e || Object.assign(e, { [t]: {} }), z_(e[t], n[t])) : Object.assign(e, { [t]: n[t] });
12865
- } catch (e) {
12866
- throw e instanceof TypeError ? TypeError(`.${t}: ${e.message}`, { cause: e }) : e;
13377
+ next() {
13378
+ let t = this.wrapped.next();
13379
+ return t.done === !0 ? {
13380
+ done: !0,
13381
+ value: void 0
13382
+ } : {
13383
+ done: !1,
13384
+ value: Mh.decodeString(t.value, e.schema)
13385
+ };
12867
13386
  }
12868
- return z_(e, ...t);
12869
- }, B_ = (e, t, n) => {
12870
- let r = (e, t, n) => {
12871
- if (n.def?.type === "union") return n.def.options.reduce((e, n) => r(e, t, n), e);
12872
- if (n.def?.type === "intersection") return r(r(e, t, n.def.left), t, n.def.right);
12873
- for (let i in t) {
12874
- let a = t[i], o = n?.shape;
12875
- if (o != null) for (; o != null;) {
12876
- if (o[i] != null) {
12877
- let t = o[i].safeParse(a);
12878
- if (t.success) {
12879
- e[i] = t.data;
12880
- break;
12881
- }
12882
- }
12883
- o = o.def?.shape;
12884
- }
12885
- typeof a == "object" && !Array.isArray(a) && a !== null && n && n.shape && n.shape[i] && (e[i] ||= {}, r(e[i], a, n.shape[i]));
12886
- }
12887
- return e;
12888
- };
12889
- return r({ ...e }, t, n);
12890
- }, V_ = (e, t) => {
12891
- let n = t.split("."), r = e, i = 0;
12892
- for (; i < n.length;) {
12893
- if (i === n.length - 1) {
12894
- let e = n[i];
12895
- if (Array.isArray(r)) {
12896
- let t = parseInt(e, 10);
12897
- if (!isNaN(t) && t < r.length) {
12898
- r.splice(t, 1);
12899
- return;
12900
- }
12901
- let n = r[0];
12902
- if (typeof n == "object" && "key" in n) {
12903
- let t = r.findIndex((t) => t.key === e);
12904
- if (t !== -1) {
12905
- r.splice(t, 1);
12906
- return;
12907
- }
12908
- }
12909
- return;
12910
- }
12911
- delete r[e];
12912
- return;
12913
- }
12914
- let e = !1;
12915
- if (Array.isArray(r) && r.length > 0) {
12916
- let t = r[0];
12917
- if (typeof t == "object" && "key" in t) for (let t = n.length - i; t >= 1; t--) {
12918
- let a = n.slice(i, i + t).join("."), o = r.find((e) => e.key === a);
12919
- if (o != null) {
12920
- if (i + t === n.length) {
12921
- let e = r.findIndex((e) => e.key === a);
12922
- e !== -1 && r.splice(e, 1);
12923
- return;
12924
- }
12925
- r = o, i += t, e = !0;
12926
- break;
12927
- }
12928
- }
12929
- }
12930
- if (!e) for (let t = n.length - i; t >= 1; t--) {
12931
- let a = n.slice(i, i + t).join(".");
12932
- if (!Array.isArray(r) && typeof r == "object" && r && a in r) {
12933
- if (i + t === n.length) {
12934
- delete r[a];
12935
- return;
12936
- }
12937
- r = r[a], i += t, e = !0;
12938
- break;
12939
- }
12940
- }
12941
- if (!e) {
12942
- let e = j_(r, n[i]);
12943
- if (e == null) return;
12944
- r = e, i++;
12945
- }
13387
+ }, Tv = class {
13388
+ series;
13389
+ index;
13390
+ data;
13391
+ density;
13392
+ constructor(e) {
13393
+ if (!e.dataType.equals(Y.UUID)) throw Error("cannot create a UUID series iterator for a non-UUID series");
13394
+ this.series = e, this.index = 0, this.data = new Uint8Array(e.buffer), this.density = Y.UUID.density.valueOf();
12946
13395
  }
12947
- }, H_ = (e, t, n) => {
12948
- let r = t.split("."), i = e, a = 0;
12949
- for (; a < r.length - 1;) {
12950
- let e = I_(i, r.slice(a, r.length - 1)), t;
12951
- e == null ? (t = r[a], a++) : [t, a] = [e[0], a + e[1]];
12952
- let n = j_(i, t);
12953
- if (n == null) {
12954
- let e = r[a], o = F_(e);
12955
- o == null && e.startsWith("-") && F_(e.substring(1)) != null && (o = 0), n = o == null ? {} : [], i[t] = n;
12956
- }
12957
- i = n;
13396
+ next() {
13397
+ if (this.index >= this.series.length) return {
13398
+ done: !0,
13399
+ value: void 0
13400
+ };
13401
+ let e = fv(this.data, this.index * this.density);
13402
+ return this.index++, {
13403
+ done: !1,
13404
+ value: e
13405
+ };
12958
13406
  }
12959
- try {
12960
- let e = r[r.length - 1];
12961
- if (Array.isArray(i)) {
12962
- let t = F_(e);
12963
- if (t == null) {
12964
- if (e.startsWith("-")) {
12965
- let n = F_(e.substring(1));
12966
- n != null && (t = i.length - n);
12967
- }
12968
- if (t == null) {
12969
- if (i.length === 0) {
12970
- let t = F_(e);
12971
- if (t != null) {
12972
- i[t] = n;
12973
- return;
12974
- }
12975
- }
12976
- let t = i[0];
12977
- if (typeof t == "object" && "key" in t) {
12978
- let t = i.findIndex((t) => t.key === e);
12979
- if (t !== -1) {
12980
- i[t] = n;
12981
- return;
12982
- }
12983
- }
12984
- return;
12985
- }
12986
- }
12987
- i[t] = n;
12988
- return;
12989
- }
12990
- let t = I_(i, [e]);
12991
- if (t != null) {
12992
- i[t[0]] = n;
12993
- return;
12994
- }
12995
- i[e] = n;
12996
- } catch (r) {
12997
- throw console.error("failed to set value", n, "at path", t, "on object", e), r;
13407
+ }, Ev = class {
13408
+ series;
13409
+ index;
13410
+ constructor(e) {
13411
+ this.series = e, this.index = 0;
12998
13412
  }
12999
- }, U_ = /* @__PURE__ */ jp({
13000
- SEPARATOR: () => ".",
13001
- copy: () => E_,
13002
- defaultGetter: () => j_,
13003
- difference: () => D_,
13004
- element: () => N_,
13005
- equal: () => O_,
13006
- findBestKey: () => I_,
13007
- get: () => L_,
13008
- getIndex: () => F_,
13009
- has: () => R_,
13010
- override: () => z_,
13011
- overrideValidItems: () => B_,
13012
- partialEqual: () => k_,
13013
- pathsMatch: () => P_,
13014
- remove: () => V_,
13015
- resolvePath: () => M_,
13016
- set: () => H_,
13017
- transformPath: () => A_
13018
- }), W_ = P().regex(/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i), G_ = T_, K_ = I().min(0).max(1), q_ = sf([
13019
- G_,
13020
- G_,
13021
- G_,
13022
- K_
13023
- ]), J_ = sf([
13024
- G_,
13025
- G_,
13026
- G_
13027
- ]), Y_ = z({ rgba255: q_ }), X_ = z({
13028
- r: G_,
13029
- g: G_,
13030
- b: G_,
13031
- a: K_
13032
- }), Z_ = B([
13033
- W_,
13034
- J_,
13035
- q_,
13413
+ next() {
13414
+ return this.index >= this.series.length ? {
13415
+ done: !0,
13416
+ value: void 0
13417
+ } : {
13418
+ done: !1,
13419
+ value: this.series.at(this.index++, !0)
13420
+ };
13421
+ }
13422
+ }, Dv = (e) => ({
13423
+ domain: e >> 32n,
13424
+ sample: e & 4294967295n
13425
+ });
13426
+ z({
13427
+ baseInterval: q.z.optional(),
13428
+ maxRetries: I().optional(),
13429
+ scale: I().optional()
13430
+ });
13431
+ var Ov = P().regex(/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i), kv = Oh, Av = I().min(0).max(1), jv = sf([
13432
+ kv,
13433
+ kv,
13434
+ kv,
13435
+ Av
13436
+ ]), Mv = sf([
13437
+ kv,
13438
+ kv,
13439
+ kv
13440
+ ]), Nv = z({ rgba255: jv }), Pv = z({
13441
+ r: kv,
13442
+ g: kv,
13443
+ b: kv,
13444
+ a: Av
13445
+ }), Fv = B([
13446
+ Ov,
13447
+ Mv,
13448
+ jv,
13036
13449
  sf([
13037
13450
  I().min(0).max(360),
13038
13451
  I().min(0).max(100),
13039
13452
  I().min(0).max(100),
13040
- K_
13453
+ Av
13041
13454
  ]),
13042
- Y_,
13043
- X_
13044
- ]), Q_ = Z_.transform((e) => $_(e)), $_ = (e, t = 1) => {
13045
- if (e = Z_.parse(e), typeof e == "string") return ev(e, t);
13455
+ Nv,
13456
+ Pv
13457
+ ]), Iv = Fv.transform((e) => Lv(e)), Lv = (e, t = 1) => {
13458
+ if (e = Fv.parse(e), typeof e == "string") return Rv(e, t);
13046
13459
  if (Array.isArray(e)) {
13047
13460
  if (e.length < 3 || e.length > 4) throw Error(`Invalid color: [${e.join(", ")}]`);
13048
13461
  return e.length === 3 ? [...e, t] : e;
@@ -13053,27 +13466,27 @@ var E_ = (e) => {
13053
13466
  e.b,
13054
13467
  e.a
13055
13468
  ] : e.rgba255;
13056
- }, ev = (e, t = 1) => (e = W_.parse(e), e = nv(e), [
13057
- tv(e, 0),
13058
- tv(e, 2),
13059
- tv(e, 4),
13060
- e.length === 8 ? tv(e, 6) / 255 : t
13061
- ]), tv = (e, t) => parseInt(e.slice(t, t + 2), 16), nv = (e) => e.startsWith("#") ? e.slice(1) : e;
13062
- $_("#000000"), $_("#ffffff"), z({
13469
+ }, Rv = (e, t = 1) => (e = Ov.parse(e), e = Bv(e), [
13470
+ zv(e, 0),
13471
+ zv(e, 2),
13472
+ zv(e, 4),
13473
+ e.length === 8 ? zv(e, 6) / 255 : t
13474
+ ]), zv = (e, t) => parseInt(e.slice(t, t + 2), 16), Bv = (e) => e.startsWith("#") ? e.slice(1) : e;
13475
+ Lv("#000000"), Lv("#ffffff"), z({
13063
13476
  key: P(),
13064
- color: Z_,
13477
+ color: Fv,
13065
13478
  position: I(),
13066
13479
  switched: R().optional()
13067
13480
  });
13068
- var rv = z({
13481
+ var Vv = z({
13069
13482
  key: P(),
13070
13483
  name: P(),
13071
- color: Q_
13484
+ color: Iv
13072
13485
  });
13073
13486
  z({
13074
13487
  key: P(),
13075
13488
  name: P(),
13076
- swatches: qd(rv)
13489
+ swatches: qd(Vv)
13077
13490
  }), V(/* @__PURE__ */ function(e) {
13078
13491
  return e[e.exclusive = 0] = "exclusive", e[e.shared = 1] = "shared", e;
13079
13492
  }({})), z({
@@ -13081,87 +13494,13 @@ z({
13081
13494
  name: P(),
13082
13495
  group: Cd().optional()
13083
13496
  });
13084
- var iv = (e, t) => {
13497
+ var Hv = (e, t) => {
13085
13498
  let n = null;
13086
13499
  return t === 0 ? e : (...r) => {
13087
13500
  n !== null && (clearTimeout(n), n = null), n = setTimeout(() => e(...r), t);
13088
13501
  };
13089
- }, av = (e) => Object.getOwnPropertySymbols(globalThis).includes(e), ov = (e, t) => {
13090
- let n = Symbol.for(e);
13091
- if (!av(n)) {
13092
- let e = t();
13093
- Object.defineProperty(globalThis, n, { value: e });
13094
- }
13095
- return () => globalThis[n];
13096
- }, sv = "sy_x_error", cv = (e) => (t) => typeof t == "object" && t && "type" in t && typeof t.type == "string" ? t.type.startsWith(e) : t instanceof Error ? t.message.startsWith(e) : typeof t == "string" ? t.startsWith(e) : !1, lv = (e) => class t extends Error {
13097
- static discriminator = sv;
13098
- discriminator = t.discriminator;
13099
- static TYPE = e;
13100
- type = t.TYPE;
13101
- static matches = cv(e);
13102
- matches = t.matches;
13103
- constructor(e, n) {
13104
- super(e, n), this.name = t.TYPE;
13105
- }
13106
- static sub(t) {
13107
- return lv(`${e}.${t}`);
13108
- }
13109
- }, uv = (e) => {
13110
- if (typeof e != "object" || !e) return !1;
13111
- let t = e;
13112
- if (t.discriminator !== sv) return !1;
13113
- if (!("type" in t)) throw Error(`X Error is missing its type property: ${JSON.stringify(t)}`);
13114
- return !0;
13115
- }, dv = "unknown", fv = class {
13116
- providers = [];
13117
- register(e) {
13118
- this.providers.push(e);
13119
- }
13120
- encode(e) {
13121
- if (e == null) return {
13122
- type: "nil",
13123
- data: ""
13124
- };
13125
- if (uv(e)) for (let t of this.providers) {
13126
- let n = t.encode(e);
13127
- if (n != null) return n;
13128
- }
13129
- if (e instanceof Error) return {
13130
- type: dv,
13131
- data: e.message
13132
- };
13133
- if (typeof e == "string") return {
13134
- type: dv,
13135
- data: e
13136
- };
13137
- try {
13138
- return {
13139
- type: dv,
13140
- data: JSON.stringify(e)
13141
- };
13142
- } catch {
13143
- return {
13144
- type: dv,
13145
- data: "unable to encode error information"
13146
- };
13147
- }
13148
- }
13149
- decode(e) {
13150
- if (e == null || e.type === "nil") return null;
13151
- if (e.type === "unknown") return new pv(e.data);
13152
- for (let t of this.providers) {
13153
- let n = t.decode(e);
13154
- if (n != null) return n;
13155
- }
13156
- return new pv(e.data);
13157
- }
13158
13502
  };
13159
- ov("synnax-error-registry", () => new fv());
13160
- var pv = class extends lv("unknown") {};
13161
- z({
13162
- type: P(),
13163
- data: P()
13164
- }), lv("canceled"), lv("not_implemented"), P().regex(/^(?:$|(?:\/(?:[^~/]|~0|~1)*)+)$/, "must be a valid JSON pointer (RFC 6901)"), B([
13503
+ P().regex(/^(?:$|(?:\/(?:[^~/]|~0|~1)*)+)$/, "must be a valid JSON pointer (RFC 6901)"), B([
13165
13504
  P(),
13166
13505
  I(),
13167
13506
  R(),
@@ -13177,44 +13516,48 @@ z({
13177
13516
  }), z({
13178
13517
  key: Ou(),
13179
13518
  name: P().min(1),
13180
- color: Q_
13519
+ color: Iv
13181
13520
  }).partial({ key: !0 }), P().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/), V([
13182
13521
  "standard",
13183
13522
  "scientific",
13184
13523
  "engineering"
13185
- ]), B([P(), I()]);
13186
- var mv = () => typeof process < "u" && process.versions != null && process.versions.node != null ? "node" : typeof window > "u" || window.document === void 0 ? "webworker" : "browser", hv = mv(), gv = [
13524
+ ]);
13525
+ var Uv = B([P(), I()]), Wv = () => lf(Uv, zd()), Gv = () => typeof process < "u" && process.versions != null && process.versions.node != null ? "node" : typeof window > "u" || window.document === void 0 ? "webworker" : "browser", Kv = Gv(), qv = [
13187
13526
  "macOS",
13188
13527
  "Windows",
13189
13528
  "Linux"
13190
- ], _v = [
13529
+ ], Jv = [
13191
13530
  "macos",
13192
13531
  "windows",
13193
13532
  "linux"
13194
- ], vv = {
13533
+ ], Yv = {
13195
13534
  macos: "macOS",
13196
13535
  windows: "Windows",
13197
13536
  linux: "Linux"
13198
- }, yv = V(gv).or(V(_v).transform((e) => vv[e])), bv = () => {
13537
+ }, Xv = V(qv).or(V(Jv).transform((e) => Yv[e])), Zv = () => {
13199
13538
  if (typeof window > "u") return;
13200
13539
  let e = window.navigator.userAgent.toLowerCase();
13201
13540
  if (e.includes("mac")) return "macOS";
13202
13541
  if (e.includes("win")) return "Windows";
13203
13542
  if (e.includes("linux")) return "Linux";
13204
- }, xv, Sv = ((e = {}) => {
13543
+ }, Qv, $v = ((e = {}) => {
13205
13544
  let { force: t, default: n } = e;
13206
- return t ?? xv ?? (xv = bv(), xv ?? n);
13207
- }), Cv = /* @__PURE__ */ jp({
13208
- OPERATING_SYSTEMS: () => gv,
13209
- RUNTIME: () => hv,
13210
- detect: () => mv,
13211
- getOS: () => Sv,
13212
- osZ: () => yv
13545
+ return t ?? Qv ?? (Qv = Zv(), Qv ?? n);
13546
+ }), ey = /* @__PURE__ */ jp({
13547
+ OPERATING_SYSTEMS: () => qv,
13548
+ RUNTIME: () => Kv,
13549
+ detect: () => Gv,
13550
+ getOS: () => $v,
13551
+ osZ: () => Xv
13213
13552
  });
13214
13553
  z({
13554
+ message: P().optional(),
13555
+ description: P().optional(),
13556
+ details: Wv().optional()
13557
+ }), z({
13215
13558
  stack: P(),
13216
13559
  error: H(Error)
13217
- }), V([
13560
+ }).and(Wv()), V([
13218
13561
  "success",
13219
13562
  "info",
13220
13563
  "warning",
@@ -13222,14 +13565,14 @@ z({
13222
13565
  "loading",
13223
13566
  "disabled"
13224
13567
  ]), yf("success"), yf("info"), yf("warning"), yf("error"), yf("loading"), yf("disabled");
13225
- var wv = (...e) => e.map(Tv).join(""), Tv = (e) => (e.endsWith("/") || (e += "/"), e.startsWith("/") && (e = e.slice(1)), e), Ev = (e) => e.endsWith("/") ? e.slice(0, -1) : e;
13568
+ var ty = (...e) => e.map(ny).join(""), ny = (e) => (e.endsWith("/") || (e += "/"), e.startsWith("/") && (e = e.slice(1)), e), ry = (e) => e.endsWith("/") ? e.slice(0, -1) : e;
13226
13569
  (class e {
13227
13570
  protocol;
13228
13571
  host;
13229
13572
  port;
13230
13573
  path;
13231
13574
  constructor({ host: e, port: t, protocol: n = "", pathPrefix: r = "" }) {
13232
- this.protocol = n, this.host = e, this.port = t, this.path = Tv(r);
13575
+ this.protocol = n, this.host = e, this.port = t, this.path = ny(r);
13233
13576
  }
13234
13577
  replace(t) {
13235
13578
  return new e({
@@ -13242,36 +13585,36 @@ var wv = (...e) => e.map(Tv).join(""), Tv = (e) => (e.endsWith("/") || (e += "/"
13242
13585
  child(t) {
13243
13586
  return new e({
13244
13587
  ...this,
13245
- pathPrefix: wv(this.path, t)
13588
+ pathPrefix: ty(this.path, t)
13246
13589
  });
13247
13590
  }
13248
13591
  toString() {
13249
- return Ev(`${this.protocol}://${this.host}:${this.port}/${this.path}`);
13592
+ return ry(`${this.protocol}://${this.host}:${this.port}/${this.path}`);
13250
13593
  }
13251
13594
  static UNKNOWN = new e({
13252
13595
  host: "unknown",
13253
13596
  port: 0
13254
13597
  });
13255
13598
  });
13256
- var Dv = "main", Ov = "prerender", kv = {
13599
+ var iy = "main", ay = "prerender", oy = {
13257
13600
  stage: "creating",
13258
13601
  processCount: 0,
13259
13602
  reserved: !1,
13260
13603
  focusCount: 0,
13261
13604
  centerCount: 0
13262
- }, Av = {
13263
- ...kv,
13264
- key: Ov,
13605
+ }, sy = {
13606
+ ...oy,
13607
+ key: ay,
13265
13608
  visible: !1
13266
- }, jv = z({
13609
+ }, cy = z({
13267
13610
  key: P(),
13268
13611
  url: P().optional(),
13269
13612
  title: P().optional(),
13270
13613
  center: R().optional(),
13271
- position: rh.xyZ.optional(),
13272
- size: kg.dimensionsZ.optional(),
13273
- minSize: kg.dimensionsZ.optional(),
13274
- maxSize: kg.dimensionsZ.optional(),
13614
+ position: hg.xyZ.optional(),
13615
+ size: V_.dimensionsZ.optional(),
13616
+ minSize: V_.dimensionsZ.optional(),
13617
+ maxSize: V_.dimensionsZ.optional(),
13275
13618
  resizable: R().optional(),
13276
13619
  fullscreen: R().optional(),
13277
13620
  focus: R().optional(),
@@ -13285,4 +13628,4 @@ var Dv = "main", Ov = "prerender", kv = {
13285
13628
  alwaysOnTop: R().optional()
13286
13629
  });
13287
13630
  //#endregion
13288
- export { jv as a, iv as c, im as d, rh as f, t as h, Ov as i, Mh as l, Qp as m, kv as n, U_ as o, Cv as p, Dv as r, X as s, Av as t, kg as u };
13631
+ export { cy as a, dm as c, Jh as d, Wg as f, t as h, ay as i, Hv as l, ey as m, oy as n, Hh as o, V_ as p, iy as r, q as s, sy as t, hg as u };