@tixyel/streamelements 7.5.0 → 7.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -9595,7 +9595,7 @@ function j(e, t, n) {
9595
9595
  b: Math.round(a * 255)
9596
9596
  };
9597
9597
  }
9598
- async function M(e, t, n) {
9598
+ async function ee(e, t, n) {
9599
9599
  let r = l, i = r[0], a = Infinity;
9600
9600
  for await (let o of r) {
9601
9601
  let r = document.createElement("canvas");
@@ -9610,7 +9610,7 @@ async function M(e, t, n) {
9610
9610
  }
9611
9611
  //#endregion
9612
9612
  //#region src/helper/classes/color.ts
9613
- var N = class {
9613
+ var M = class {
9614
9614
  opacity(e = 100, t = "") {
9615
9615
  t = t.length > 7 ? t?.substring(0, 6) : t, e = e > 1 ? e / 100 : e;
9616
9616
  let n = Math.round(Math.min(Math.max(e, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
@@ -9650,11 +9650,11 @@ var N = class {
9650
9650
  let e = A(r.r, r.g, r.b);
9651
9651
  return `hsla(${e.h}, ${e.s}%, ${e.l}%, ${r.a})`;
9652
9652
  }
9653
- case "css-color-name": return await M(r.r, r.g, r.b);
9653
+ case "css-color-name": return await ee(r.r, r.g, r.b);
9654
9654
  default: return null;
9655
9655
  }
9656
9656
  }
9657
- }, ee = class {
9657
+ }, te = class {
9658
9658
  constructor() {
9659
9659
  this.PRESETS = {};
9660
9660
  }
@@ -9876,7 +9876,7 @@ var N = class {
9876
9876
  }
9877
9877
  return r ? !a : a;
9878
9878
  }
9879
- let T = new N(), E = {
9879
+ let T = new M(), E = {
9880
9880
  BT1: (e) => p > 1 ? e : "",
9881
9881
  BT0: (e) => p > 0 ? e : "",
9882
9882
  ST1: (e) => p < 1 ? e : "",
@@ -10100,7 +10100,7 @@ var N = class {
10100
10100
  let j = e.replace(f.PLACEHOLDERS, (e, t) => typeof d[t] == "string" || typeof d[t] == "number" ? String(d[t]) : t ?? t);
10101
10101
  return j = n.method === "loop" ? k(j) : A(j), j;
10102
10102
  }
10103
- }, te = class {
10103
+ }, ne = class {
10104
10104
  constructor() {
10105
10105
  this.playing = !1;
10106
10106
  }
@@ -10119,18 +10119,18 @@ var N = class {
10119
10119
  throw Error(`Error playing sound: ${e}`);
10120
10120
  }
10121
10121
  }
10122
- }, ne = class {
10122
+ }, re = class {
10123
10123
  apply(e, t, n) {
10124
10124
  return e.apply(t, n);
10125
10125
  }
10126
10126
  call(e, t, ...n) {
10127
10127
  return e.call(t, ...n);
10128
10128
  }
10129
- }, re = class {
10129
+ }, ie = class {
10130
10130
  constructor(e, t, n = [], r = !1, i) {
10131
10131
  this.badges = [], this.isSubscriber = !1, this.id = e, this.name = t, this.login = t.toLocaleLowerCase(), this.badges = n, this.isSubscriber = r, this.tier = i;
10132
10132
  }
10133
- }, ie = {
10133
+ }, ae = {
10134
10134
  broadcaster: [
10135
10135
  "moderator",
10136
10136
  "vip",
@@ -10147,7 +10147,7 @@ var N = class {
10147
10147
  "duelyst_6",
10148
10148
  "duelyst_7"
10149
10149
  ]
10150
- }, P = [], ae = class t extends e {
10150
+ }, N = [], P = class t extends e {
10151
10151
  static fixUser(e) {
10152
10152
  return typeof e == "string" ? e.trim().replace(/^@+/, "").toLocaleLowerCase() : t.fixUser(e.name);
10153
10153
  }
@@ -10166,7 +10166,7 @@ var N = class {
10166
10166
  e.set(n, [...r, t]);
10167
10167
  }
10168
10168
  return e;
10169
- }, /* @__PURE__ */ new Map())), P.push(this);
10169
+ }, /* @__PURE__ */ new Map())), N.push(this);
10170
10170
  }
10171
10171
  start(e, n = w.badges.map((e) => e.set_id), r) {
10172
10172
  let i = e.map((e) => e && t.fixUser(e)).filter((e) => e && e.length).filter((e, t, n) => n.indexOf(e) === t), a = n.filter((e, t, n) => n.indexOf(e) === t);
@@ -10212,7 +10212,7 @@ var N = class {
10212
10212
  }
10213
10213
  return null;
10214
10214
  };
10215
- for (let [e, t] of S(ie, r?.incompatible)) if (d.has(e)) for (let n of x(t)) d.has(n) && C(e, n);
10215
+ for (let [e, t] of S(ae, r?.incompatible)) if (d.has(e)) for (let n of x(t)) d.has(n) && C(e, n);
10216
10216
  for (let e of a) {
10217
10217
  let t = b(u[e]);
10218
10218
  for (let n of t) {
@@ -10258,7 +10258,7 @@ var N = class {
10258
10258
  continue;
10259
10259
  }
10260
10260
  n.length < c && this.emit("warn", /* @__PURE__ */ Error(`User "${e}" could only receive ${n.length} badge(s), below the configured minimum of ${c}`));
10261
- let i = o.length + 1, a = n.some((e) => ["subscriber"].includes(String(e).toLocaleLowerCase())), s = new re(`fake_user_${i.toString().padStart(2, "0")}_${Math.random().toString(36).slice(2, 8)}+${this.id}`, e, n, a, a ? t.getRandomSubTier() : void 0);
10261
+ let i = o.length + 1, a = n.some((e) => ["subscriber"].includes(String(e).toLocaleLowerCase())), s = new ie(`fake_user_${i.toString().padStart(2, "0")}_${Math.random().toString(36).slice(2, 8)}+${this.id}`, e, n, a, a ? t.getRandomSubTier() : void 0);
10262
10262
  o.push(s);
10263
10263
  }
10264
10264
  return o.length < i.length && this.emit("warn", /* @__PURE__ */ Error("Some users could not be assigned badges due to limits. Consider increasing limits or adding more badges.")), o;
@@ -10367,7 +10367,7 @@ var N = class {
10367
10367
  async findSubscriptionTier({ userId: e, name: t, broadcasterId: n }, r, i = !1) {
10368
10368
  let a = (e) => e === "prime" || e === "1000" || e === 1e3 || e === 1 || e === "1" ? 1 : e === "2000" || e === 2e3 || e === 2 || e === "2" ? 2 : e === "3000" || e === 3e3 || e === 3 || e === "3" ? 3 : 1;
10369
10369
  if (e?.includes("fake_user_")) {
10370
- let t = P.find((t) => e.endsWith(`+${t.id}`));
10370
+ let t = N.find((t) => e.endsWith(`+${t.id}`));
10371
10371
  if (t) {
10372
10372
  let n = t.getById(e);
10373
10373
  if (n) return a(n.tier);
@@ -10607,7 +10607,7 @@ var N = class {
10607
10607
  }
10608
10608
  }, I;
10609
10609
  (function(e) {
10610
- e.animate = new oe(), e.number = new i(), e.element = new a(), e.object = new o(), e.message = new E(), e.event = new D(), e.string = new ee(), e.sound = new te(), e.color = new N(), e.random = new T(), e.fn = new ne(), e.utils = new F();
10610
+ e.animate = new oe(), e.number = new i(), e.element = new a(), e.object = new o(), e.message = new E(), e.event = new D(), e.string = new te(), e.sound = new ne(), e.color = new M(), e.random = new T(), e.fn = new re(), e.utils = new F();
10611
10611
  })(I ||= {});
10612
10612
  //#endregion
10613
10613
  //#region src/actions/button.ts
@@ -13005,7 +13005,17 @@ var J = class {
13005
13005
  },
13006
13006
  list: {}
13007
13007
  },
13008
- resumeQueue: () => null,
13008
+ resumeQueue: () => {
13009
+ try {
13010
+ G instanceof W && G?.resume();
13011
+ } catch (e) {
13012
+ return {
13013
+ ok: !1,
13014
+ error: e
13015
+ };
13016
+ }
13017
+ return { ok: !0 };
13018
+ },
13009
13019
  sanitize(e) {
13010
13020
  return e;
13011
13021
  },
@@ -13019,26 +13029,35 @@ var J = class {
13019
13029
  }),
13020
13030
  events: {
13021
13031
  emit(e, t) {
13022
- let n = {
13032
+ let n = new CustomEvent("onEventReceived", { detail: {
13023
13033
  listener: e,
13024
13034
  event: t,
13025
13035
  result: void 0
13026
- };
13027
- return window.dispatchEvent(new CustomEvent("onEventReceived", { detail: n })) ? { ok: !0 } : { ok: !1 };
13036
+ } });
13037
+ return this.history.push({
13038
+ ...n,
13039
+ origin: client?.id
13040
+ }), window.dispatchEvent(n) ? { ok: !0 } : { ok: !1 };
13028
13041
  },
13029
13042
  broadcast(e, t) {
13030
- let n = {
13043
+ let n = new CustomEvent("onEventReceived", { detail: {
13031
13044
  listener: e,
13032
13045
  event: t,
13033
13046
  result: void 0
13034
- };
13035
- return window.dispatchEvent(new CustomEvent("onEventReceived", { detail: n })) ? { ok: !0 } : { ok: !1 };
13036
- }
13047
+ } });
13048
+ return this.history.push({
13049
+ ...n,
13050
+ origin: client?.id
13051
+ }), window.dispatchEvent(n) ? { ok: !0 } : { ok: !1 };
13052
+ },
13053
+ history: []
13037
13054
  }
13038
13055
  };
13039
13056
  async function de() {
13040
13057
  let e = localStorage.getItem("SE_API-STORE") ?? "{}", t = e ? JSON.parse(e) : {};
13041
- return Y.store.list = t, Y;
13058
+ Y.store.list = t;
13059
+ let n = localStorage.getItem("SE_API-EVENTS") ?? "[]", r = n ? JSON.parse(n) : [];
13060
+ return Y.events.history = r, Y;
13042
13061
  }
13043
13062
  //#endregion
13044
13063
  //#region src/utils/alejo.ts
@@ -13104,7 +13123,7 @@ var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(de()), Q
13104
13123
  useQueue: W,
13105
13124
  useLogger: J,
13106
13125
  useComms: se,
13107
- FakeUserPool: ae
13126
+ FakeUserPool: P
13108
13127
  },
13109
13128
  actions: {
13110
13129
  Button: R,
@@ -13116,7 +13135,7 @@ var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(de()), Q
13116
13135
  usedComms: V,
13117
13136
  usedCommands: z,
13118
13137
  usedButtons: L,
13119
- fakeUserPools: P
13138
+ fakeUserPools: N
13120
13139
  },
13121
13140
  pronouns: { Alejo: X }
13122
13141
  };