@tixyel/streamelements 7.0.2 → 7.0.4
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.d.ts +9 -3
- package/dist/index.es.js +248 -166
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -9256,6 +9256,9 @@ var T = class {
|
|
|
9256
9256
|
return crypto.randomUUID();
|
|
9257
9257
|
}
|
|
9258
9258
|
}, E = class {
|
|
9259
|
+
constructor() {
|
|
9260
|
+
this.badgePriority = /* @__PURE__ */ "broadcaster.lead_moderator.moderator.vip.artist-badge.subscriber.sub-gift-leader.founder.sub-gifter.bits-leader.bits.admin.global_mod.staff.partner.ambassador.predictions.twitchbot.extension.game-developer.hype-train.bot-badge.turbo.premium.no_video.no_audio".split(".");
|
|
9261
|
+
}
|
|
9259
9262
|
findEmotesInText(e, t = w.emotes) {
|
|
9260
9263
|
let n = [];
|
|
9261
9264
|
return t.filter((e) => e.type !== "emoji").forEach((t) => {
|
|
@@ -9433,6 +9436,10 @@ var T = class {
|
|
|
9433
9436
|
!r.includes(e.id) && Array.isArray(r) ? r.push(e.id) : r = [e.id];
|
|
9434
9437
|
}
|
|
9435
9438
|
}
|
|
9439
|
+
r = r.sort((e, t) => {
|
|
9440
|
+
let n = this.badgePriority.indexOf(e), r = this.badgePriority.indexOf(t);
|
|
9441
|
+
return (n === -1 ? 2 ** 53 - 1 : n) - (r === -1 ? 2 ** 53 - 1 : r);
|
|
9442
|
+
});
|
|
9436
9443
|
var o;
|
|
9437
9444
|
switch (t) {
|
|
9438
9445
|
case "twitch": {
|
|
@@ -9584,7 +9591,7 @@ function j(e, t, n) {
|
|
|
9584
9591
|
b: Math.round(a * 255)
|
|
9585
9592
|
};
|
|
9586
9593
|
}
|
|
9587
|
-
async function
|
|
9594
|
+
async function ee(e, t, n) {
|
|
9588
9595
|
let r = l, i = r[0], a = Infinity;
|
|
9589
9596
|
for await (let o of r) {
|
|
9590
9597
|
let r = document.createElement("canvas");
|
|
@@ -9599,7 +9606,7 @@ async function M(e, t, n) {
|
|
|
9599
9606
|
}
|
|
9600
9607
|
//#endregion
|
|
9601
9608
|
//#region src/helper/classes/color.ts
|
|
9602
|
-
var
|
|
9609
|
+
var M = class {
|
|
9603
9610
|
opacity(e = 100, t = "") {
|
|
9604
9611
|
t = t.length > 7 ? t?.substring(0, 6) : t, e = e > 1 ? e / 100 : e;
|
|
9605
9612
|
let n = Math.round(Math.min(Math.max(e, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
|
|
@@ -9639,11 +9646,11 @@ var N = class {
|
|
|
9639
9646
|
let e = A(r.r, r.g, r.b);
|
|
9640
9647
|
return `hsla(${e.h}, ${e.s}%, ${e.l}%, ${r.a})`;
|
|
9641
9648
|
}
|
|
9642
|
-
case "css-color-name": return await
|
|
9649
|
+
case "css-color-name": return await ee(r.r, r.g, r.b);
|
|
9643
9650
|
default: return null;
|
|
9644
9651
|
}
|
|
9645
9652
|
}
|
|
9646
|
-
},
|
|
9653
|
+
}, N = class {
|
|
9647
9654
|
constructor() {
|
|
9648
9655
|
this.PRESETS = {};
|
|
9649
9656
|
}
|
|
@@ -9865,7 +9872,7 @@ var N = class {
|
|
|
9865
9872
|
}
|
|
9866
9873
|
return r ? !a : a;
|
|
9867
9874
|
}
|
|
9868
|
-
let T = new
|
|
9875
|
+
let T = new M(), E = {
|
|
9869
9876
|
BT1: (e) => p > 1 ? e : "",
|
|
9870
9877
|
BT0: (e) => p > 0 ? e : "",
|
|
9871
9878
|
ST1: (e) => p < 1 ? e : "",
|
|
@@ -10089,7 +10096,7 @@ var N = class {
|
|
|
10089
10096
|
let j = e.replace(f.PLACEHOLDERS, (e, t) => typeof d[t] == "string" || typeof d[t] == "number" ? String(d[t]) : t ?? t);
|
|
10090
10097
|
return j = n.method === "loop" ? k(j) : A(j), j;
|
|
10091
10098
|
}
|
|
10092
|
-
},
|
|
10099
|
+
}, P = class {
|
|
10093
10100
|
constructor() {
|
|
10094
10101
|
this.playing = !1;
|
|
10095
10102
|
}
|
|
@@ -10108,23 +10115,40 @@ var N = class {
|
|
|
10108
10115
|
throw Error(`Error playing sound: ${e}`);
|
|
10109
10116
|
}
|
|
10110
10117
|
}
|
|
10111
|
-
},
|
|
10118
|
+
}, F = class {
|
|
10112
10119
|
apply(e, t, n) {
|
|
10113
10120
|
return e.apply(t, n);
|
|
10114
10121
|
}
|
|
10115
10122
|
call(e, t, ...n) {
|
|
10116
10123
|
return e.call(t, ...n);
|
|
10117
10124
|
}
|
|
10118
|
-
},
|
|
10125
|
+
}, I = class {
|
|
10119
10126
|
constructor(e, t, n = [], r = !1, i) {
|
|
10120
10127
|
this.badges = [], this.isSubscriber = !1, this.id = e, this.name = t, this.login = t.toLocaleLowerCase(), this.badges = n, this.isSubscriber = r, this.tier = i;
|
|
10121
10128
|
}
|
|
10122
|
-
},
|
|
10129
|
+
}, L = {
|
|
10130
|
+
broadcaster: [
|
|
10131
|
+
"moderator",
|
|
10132
|
+
"vip",
|
|
10133
|
+
"artist-badge"
|
|
10134
|
+
],
|
|
10135
|
+
moderator: ["lead_moderator"],
|
|
10136
|
+
no_video: ["no_audio"],
|
|
10137
|
+
"60-seconds_1": ["60-seconds_2", "60-seconds_3"],
|
|
10138
|
+
duelyst_1: [
|
|
10139
|
+
"duelyst_2",
|
|
10140
|
+
"duelyst_3",
|
|
10141
|
+
"duelyst_4",
|
|
10142
|
+
"duelyst_5",
|
|
10143
|
+
"duelyst_6",
|
|
10144
|
+
"duelyst_7"
|
|
10145
|
+
]
|
|
10146
|
+
}, R = [], te = class t extends e {
|
|
10123
10147
|
static fixUser(e) {
|
|
10124
10148
|
return typeof e == "string" ? e.trim().replace(/^@+/, "").toLocaleLowerCase() : t.fixUser(e.name);
|
|
10125
10149
|
}
|
|
10126
10150
|
static getRandomSubTier() {
|
|
10127
|
-
return new
|
|
10151
|
+
return new z().probability({
|
|
10128
10152
|
prime: .4,
|
|
10129
10153
|
1e3: .3,
|
|
10130
10154
|
2e3: .2,
|
|
@@ -10138,46 +10162,104 @@ var N = class {
|
|
|
10138
10162
|
e.set(n, [...r, t]);
|
|
10139
10163
|
}
|
|
10140
10164
|
return e;
|
|
10141
|
-
}, /* @__PURE__ */ new Map())),
|
|
10165
|
+
}, /* @__PURE__ */ new Map())), R.push(this);
|
|
10142
10166
|
}
|
|
10143
10167
|
start(e, n = w.badges.map((e) => e.set_id), r) {
|
|
10144
10168
|
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);
|
|
10145
10169
|
if (!a.length || !i.length) return [];
|
|
10146
|
-
let o = [], s = r?.limits ?? {},
|
|
10147
|
-
let t =
|
|
10170
|
+
let o = [], s = typeof r?.minimumBadgesPerUser == "number" && r.minimumBadgesPerUser >= 0 ? Math.floor(r.minimumBadgesPerUser) : 1, c = Math.min(s, 3), l = r?.limits ?? {}, u = r?.fixed ?? {}, d = new Set(a), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), g = 0, _ = (e) => {
|
|
10171
|
+
let t = l[e];
|
|
10148
10172
|
return typeof t == "number" && t > 0 ? t : Infinity;
|
|
10149
|
-
},
|
|
10150
|
-
let t = f(e);
|
|
10151
|
-
|
|
10152
|
-
},
|
|
10153
|
-
let t =
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10173
|
+
}, v = (e) => {
|
|
10174
|
+
let t = f.get(e) ?? 0;
|
|
10175
|
+
f.set(e, t + 1);
|
|
10176
|
+
}, y = (e) => {
|
|
10177
|
+
let t = m.get(e) ?? 0;
|
|
10178
|
+
if (t <= 1) {
|
|
10179
|
+
m.delete(e);
|
|
10180
|
+
return;
|
|
10181
|
+
}
|
|
10182
|
+
m.set(e, t - 1);
|
|
10183
|
+
}, b = (e) => e ? typeof e == "string" ? [t.fixUser(e)].filter((e) => !!e) : Array.isArray(e) ? e.map(t.fixUser).filter((e) => !!e) : [] : [], x = (e) => e ? Array.isArray(e) ? e : [e] : [], S = (e, t) => {
|
|
10184
|
+
let n = /* @__PURE__ */ new Map();
|
|
10185
|
+
for (let r of [e, t]) for (let [e, t] of Object.entries(r ?? {})) {
|
|
10186
|
+
let r = n.get(e) ?? [], i = x(t);
|
|
10187
|
+
n.set(e, [...new Set([...r, ...i])]);
|
|
10188
|
+
}
|
|
10189
|
+
return n;
|
|
10190
|
+
}, C = (e, t) => {
|
|
10191
|
+
if (e === t) return;
|
|
10192
|
+
let n = h.get(e) ?? /* @__PURE__ */ new Set();
|
|
10193
|
+
n.add(t), h.set(e, n);
|
|
10194
|
+
let r = h.get(t) ?? /* @__PURE__ */ new Set();
|
|
10195
|
+
r.add(e), h.set(t, r);
|
|
10196
|
+
}, T = (e, t) => t.includes(e) ? !1 : t.every((t) => !h.get(t)?.has(e)), E = (e, t) => {
|
|
10197
|
+
if (!T(e, t)) return !1;
|
|
10198
|
+
let n = _(e), r = f.get(e) ?? 0, i = m.get(e) ?? 0;
|
|
10199
|
+
return r < n && r + i < n;
|
|
10200
|
+
}, D = (e, t) => {
|
|
10201
|
+
if (!T(e, t)) return !1;
|
|
10202
|
+
let n = _(e);
|
|
10203
|
+
return (f.get(e) ?? 0) < n;
|
|
10204
|
+
}, O = (e) => {
|
|
10205
|
+
for (let t = 0; t < a.length; t++) {
|
|
10206
|
+
let n = a[(g + t) % a.length];
|
|
10207
|
+
if (E(n, e)) return g = (g + t + 1) % a.length, n;
|
|
10159
10208
|
}
|
|
10160
10209
|
return null;
|
|
10161
10210
|
};
|
|
10211
|
+
for (let [e, t] of S(L, r?.incompatible)) if (d.has(e)) for (let n of x(t)) d.has(n) && C(e, n);
|
|
10162
10212
|
for (let e of a) {
|
|
10163
|
-
let
|
|
10164
|
-
for (let
|
|
10165
|
-
let
|
|
10166
|
-
|
|
10213
|
+
let t = b(u[e]);
|
|
10214
|
+
for (let n of t) {
|
|
10215
|
+
let t = p.get(n) ?? [];
|
|
10216
|
+
t.includes(e) || p.set(n, [...t, e]);
|
|
10167
10217
|
}
|
|
10168
10218
|
}
|
|
10219
|
+
for (let [e, t] of Object.entries(u)) d.has(e) || b(t).length && this.emit("warn", /* @__PURE__ */ Error(`Fixed badge "${e}" is not available in the current badge pool`));
|
|
10220
|
+
let k = /* @__PURE__ */ new Map();
|
|
10221
|
+
s > 3 && this.emit("warn", /* @__PURE__ */ Error("minimumBadgesPerUser exceeds the maximum of 3 and was clamped"));
|
|
10169
10222
|
for (let e of i) {
|
|
10170
|
-
let
|
|
10171
|
-
|
|
10223
|
+
let t = p.get(e) ?? [], n = [];
|
|
10224
|
+
for (let r of t) {
|
|
10225
|
+
if (n.length >= 3) {
|
|
10226
|
+
this.emit("warn", /* @__PURE__ */ Error(`User "${e}" has more than 3 fixed badges; extra badges were ignored`));
|
|
10227
|
+
break;
|
|
10228
|
+
}
|
|
10229
|
+
if (!T(r, n)) {
|
|
10230
|
+
this.emit("warn", /* @__PURE__ */ Error(`Fixed badge "${r}" for user "${e}" conflicts with another fixed badge and was ignored`));
|
|
10231
|
+
continue;
|
|
10232
|
+
}
|
|
10233
|
+
n.push(r);
|
|
10234
|
+
}
|
|
10235
|
+
k.set(e, n);
|
|
10236
|
+
for (let e of n) m.set(e, (m.get(e) ?? 0) + 1);
|
|
10237
|
+
}
|
|
10238
|
+
for (let e of i) {
|
|
10239
|
+
let n = [], r = k.get(e) ?? [];
|
|
10240
|
+
for (let t of r) {
|
|
10241
|
+
if (y(t), !D(t, n)) {
|
|
10242
|
+
this.emit("warn", /* @__PURE__ */ Error(`Fixed badge "${t}" for user "${e}" could not be assigned because its limit was reached`));
|
|
10243
|
+
continue;
|
|
10244
|
+
}
|
|
10245
|
+
n.push(t), v(t);
|
|
10246
|
+
}
|
|
10247
|
+
for (; n.length < c;) {
|
|
10248
|
+
let e = O(n);
|
|
10249
|
+
if (!e) break;
|
|
10250
|
+
n.push(e), v(e);
|
|
10251
|
+
}
|
|
10252
|
+
if (!n.length) {
|
|
10172
10253
|
this.emit("warn", /* @__PURE__ */ Error("Not enough badges to assign to users"));
|
|
10173
10254
|
continue;
|
|
10174
10255
|
}
|
|
10175
|
-
|
|
10256
|
+
n.length < c && this.emit("warn", /* @__PURE__ */ Error(`User "${e}" could only receive ${n.length} badge(s), below the configured minimum of ${c}`));
|
|
10257
|
+
let i = o.length + 1, a = n.some((e) => [
|
|
10176
10258
|
"subscriber",
|
|
10177
10259
|
"prime",
|
|
10178
10260
|
"founder"
|
|
10179
|
-
].includes(String(
|
|
10180
|
-
o.push(s)
|
|
10261
|
+
].includes(String(e).toLocaleLowerCase())), s = new I(`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
|
+
o.push(s);
|
|
10181
10263
|
}
|
|
10182
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;
|
|
10183
10265
|
}
|
|
@@ -10231,7 +10313,7 @@ var N = class {
|
|
|
10231
10313
|
message: new T().array(e)[0]
|
|
10232
10314
|
};
|
|
10233
10315
|
}
|
|
10234
|
-
},
|
|
10316
|
+
}, z = class {
|
|
10235
10317
|
delay(e, t) {
|
|
10236
10318
|
return new Promise((n) => setTimeout(() => {
|
|
10237
10319
|
n(t ? t() ?? null : null);
|
|
@@ -10285,7 +10367,7 @@ var N = class {
|
|
|
10285
10367
|
async findSubscriptionTier({ userId: e, name: t, broadcasterId: n }, r, i = !1) {
|
|
10286
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;
|
|
10287
10369
|
if (e?.includes("fake_user_")) {
|
|
10288
|
-
let t =
|
|
10370
|
+
let t = R.find((t) => e.endsWith(`+${t.id}`));
|
|
10289
10371
|
if (t) {
|
|
10290
10372
|
let n = t.getById(e);
|
|
10291
10373
|
if (n) return a(n.tier);
|
|
@@ -10402,30 +10484,30 @@ var N = class {
|
|
|
10402
10484
|
break;
|
|
10403
10485
|
}
|
|
10404
10486
|
}
|
|
10405
|
-
},
|
|
10487
|
+
}, B;
|
|
10406
10488
|
(function(e) {
|
|
10407
|
-
e.number = new i(), e.element = new a(), e.object = new o(), e.message = new E(), e.event = new D(), e.string = new
|
|
10408
|
-
})(
|
|
10489
|
+
e.number = new i(), e.element = new a(), e.object = new o(), e.message = new E(), e.event = new D(), e.string = new N(), e.sound = new P(), e.color = new M(), e.random = new T(), e.fn = new F(), e.utils = new z();
|
|
10490
|
+
})(B ||= {});
|
|
10409
10491
|
//#endregion
|
|
10410
10492
|
//#region src/actions/button.ts
|
|
10411
|
-
var
|
|
10493
|
+
var V = [], H = class e {
|
|
10412
10494
|
constructor(e) {
|
|
10413
|
-
this.field = "button", this.template = "button", this.name = "Button", this.value = "", this.field = e.field ?? this.field, this.template = e.template ?? (typeof this.field == "string" ? this.field : this.template), this.name = e.name ?? this.name, this.value = e.value ?? this.value, this.run = e.run,
|
|
10495
|
+
this.field = "button", this.template = "button", this.name = "Button", this.value = "", this.field = e.field ?? this.field, this.template = e.template ?? (typeof this.field == "string" ? this.field : this.template), this.name = e.name ?? this.name, this.value = e.value ?? this.value, this.run = e.run, V.push(this), window?.client instanceof r && (window?.client?.actions.buttons.push(this), window?.client?.emit("action", this, "created"));
|
|
10414
10496
|
}
|
|
10415
10497
|
generate(e) {
|
|
10416
|
-
return
|
|
10417
|
-
let r =
|
|
10498
|
+
return B.utils.typedValues(e).reduce((e, t, n) => {
|
|
10499
|
+
let r = B.string.compose(this.template, {
|
|
10418
10500
|
index: n,
|
|
10419
10501
|
...t
|
|
10420
10502
|
}, { html: !1 });
|
|
10421
10503
|
e[r] = {
|
|
10422
10504
|
type: "button",
|
|
10423
|
-
label:
|
|
10505
|
+
label: B.string.compose(this.name, {
|
|
10424
10506
|
index: n,
|
|
10425
10507
|
...t
|
|
10426
10508
|
}, { html: !1 })
|
|
10427
10509
|
};
|
|
10428
|
-
let i =
|
|
10510
|
+
let i = B.string.compose(String(this.value), {
|
|
10429
10511
|
index: n,
|
|
10430
10512
|
...t
|
|
10431
10513
|
}, { html: !1 });
|
|
@@ -10442,15 +10524,15 @@ var R = [], z = class e {
|
|
|
10442
10524
|
return this;
|
|
10443
10525
|
}
|
|
10444
10526
|
remove() {
|
|
10445
|
-
let e =
|
|
10446
|
-
if (e > -1 &&
|
|
10527
|
+
let e = V.indexOf(this);
|
|
10528
|
+
if (e > -1 && V.splice(e, 1), !(window?.client instanceof r)) return;
|
|
10447
10529
|
let t = window?.client.actions.buttons.indexOf(this);
|
|
10448
10530
|
t > -1 && (window?.client?.actions.buttons.splice(t, 1), window?.client?.emit("action", this, "removed"));
|
|
10449
10531
|
}
|
|
10450
10532
|
static execute(t, n) {
|
|
10451
10533
|
try {
|
|
10452
|
-
if (
|
|
10453
|
-
let r =
|
|
10534
|
+
if (V.length) {
|
|
10535
|
+
let r = V.filter((e) => typeof e.field == "string" ? e.field === t : typeof e.field == "function" ? e.field(t, n) : !1);
|
|
10454
10536
|
if (r.length && r.every((t) => t instanceof e)) return r.forEach((e) => {
|
|
10455
10537
|
try {
|
|
10456
10538
|
e.parse(t, n), window?.client?.emit("action", e, "executed"), Q.received(`Button executed: ${t}${n ? ` with value: ${n}` : ""}`);
|
|
@@ -10465,9 +10547,9 @@ var R = [], z = class e {
|
|
|
10465
10547
|
return !1;
|
|
10466
10548
|
}
|
|
10467
10549
|
}
|
|
10468
|
-
},
|
|
10550
|
+
}, U = [], W = class e {
|
|
10469
10551
|
constructor(e) {
|
|
10470
|
-
this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], this.prefix = e.prefix ?? this.prefix, this.name = e.name, this.description = e.description ?? this.description, this.arguments = e.arguments ?? this.arguments, this.run = e.run, this.test = e.test ?? this.test, this.aliases = e.aliases ?? this.aliases, this.permissions = e.permissions ?? this.permissions, this.admins = e.admins ?? this.admins,
|
|
10552
|
+
this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], this.prefix = e.prefix ?? this.prefix, this.name = e.name, this.description = e.description ?? this.description, this.arguments = e.arguments ?? this.arguments, this.run = e.run, this.test = e.test ?? this.test, this.aliases = e.aliases ?? this.aliases, this.permissions = e.permissions ?? this.permissions, this.admins = e.admins ?? this.admins, U.push(this), window?.client instanceof r && (window?.client?.actions.commands.push(this), window?.client?.emit("action", this, "created"));
|
|
10471
10553
|
}
|
|
10472
10554
|
run(e, t) {}
|
|
10473
10555
|
verify(e, t, n) {
|
|
@@ -10502,16 +10584,16 @@ var R = [], z = class e {
|
|
|
10502
10584
|
return o === !0 && this.run.apply(window?.client || void 0, [n, t]), o;
|
|
10503
10585
|
}
|
|
10504
10586
|
remove() {
|
|
10505
|
-
let e =
|
|
10506
|
-
if (e > -1 &&
|
|
10587
|
+
let e = U.indexOf(this);
|
|
10588
|
+
if (e > -1 && U.splice(e, 1), !(window?.client instanceof r)) return;
|
|
10507
10589
|
let t = window?.client?.actions.commands.indexOf(this);
|
|
10508
10590
|
t > -1 && (window?.client?.actions.commands.splice(t, 1), window?.client?.emit("action", this, "removed"));
|
|
10509
10591
|
}
|
|
10510
10592
|
static execute(t) {
|
|
10511
10593
|
let n = t.data;
|
|
10512
10594
|
try {
|
|
10513
|
-
if (
|
|
10514
|
-
let r =
|
|
10595
|
+
if (U.length && U.some((e) => n.event.data.text.startsWith(e.prefix))) {
|
|
10596
|
+
let r = U.filter((e) => {
|
|
10515
10597
|
var t = [e.name, ...e.aliases ?? []], r = n.event.data.text.replace(e.prefix, "").split(" ")[0];
|
|
10516
10598
|
return t.includes(r);
|
|
10517
10599
|
});
|
|
@@ -10525,9 +10607,9 @@ var R = [], z = class e {
|
|
|
10525
10607
|
return !1;
|
|
10526
10608
|
}
|
|
10527
10609
|
}
|
|
10528
|
-
},
|
|
10610
|
+
}, G = [], ne = class extends e {
|
|
10529
10611
|
constructor(e = {}) {
|
|
10530
|
-
super(), this.SE_API = null, this.id = "widget communications", this.loaded = !1, this.history = [], this.detected = /* @__PURE__ */ new Set(), this.id = e.id || this.id,
|
|
10612
|
+
super(), this.SE_API = null, this.id = "widget communications", this.loaded = !1, this.history = [], this.detected = /* @__PURE__ */ new Set(), this.id = e.id || this.id, G.push(this), Z?.then(async (e) => {
|
|
10531
10613
|
this.loaded = !0, this.SE_API = e, Promise.all([async () => {
|
|
10532
10614
|
let t = await e.store.get(this.id);
|
|
10533
10615
|
t && (this.history = t.slice(-10));
|
|
@@ -10608,7 +10690,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10608
10690
|
}
|
|
10609
10691
|
}), window.addEventListener("onEventReceived", ({ detail: e }) => {
|
|
10610
10692
|
if (window.client instanceof r && client instanceof r && client) {
|
|
10611
|
-
let r =
|
|
10693
|
+
let r = B.event.parseProvider(e);
|
|
10612
10694
|
switch (r.provider) {
|
|
10613
10695
|
case "streamelements": {
|
|
10614
10696
|
let e = r.data;
|
|
@@ -10623,7 +10705,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10623
10705
|
switch (e.event.listener) {
|
|
10624
10706
|
case "widget-button": {
|
|
10625
10707
|
let t = e.event;
|
|
10626
|
-
|
|
10708
|
+
H.execute(t.field, t.value);
|
|
10627
10709
|
break;
|
|
10628
10710
|
}
|
|
10629
10711
|
case "subscriber-latest":
|
|
@@ -10637,8 +10719,8 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10637
10719
|
var n = t.find((e) => e.id === r.data.key.replace("customWidget.", "") || e.id === r.data.key);
|
|
10638
10720
|
n && n.update(r.data.value);
|
|
10639
10721
|
}
|
|
10640
|
-
if (
|
|
10641
|
-
let e =
|
|
10722
|
+
if (G.length) {
|
|
10723
|
+
let e = G.find((e) => e.id === r.data.key.replace("customWidget.", "") || e.id === r.data.key);
|
|
10642
10724
|
e && e.update(r.data.value);
|
|
10643
10725
|
}
|
|
10644
10726
|
break;
|
|
@@ -10665,7 +10747,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10665
10747
|
e.event;
|
|
10666
10748
|
break;
|
|
10667
10749
|
case "message":
|
|
10668
|
-
e.event,
|
|
10750
|
+
e.event, W.execute({
|
|
10669
10751
|
provider: "twitch",
|
|
10670
10752
|
data: e
|
|
10671
10753
|
});
|
|
@@ -10690,7 +10772,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10690
10772
|
let e = r.data;
|
|
10691
10773
|
switch (e.listener) {
|
|
10692
10774
|
case "message":
|
|
10693
|
-
e.event,
|
|
10775
|
+
e.event, W.execute({
|
|
10694
10776
|
provider: "youtube",
|
|
10695
10777
|
data: e
|
|
10696
10778
|
});
|
|
@@ -10727,7 +10809,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10727
10809
|
});
|
|
10728
10810
|
//#endregion
|
|
10729
10811
|
//#region src/modules/useQueue.ts
|
|
10730
|
-
var
|
|
10812
|
+
var K = class extends e {
|
|
10731
10813
|
constructor(e) {
|
|
10732
10814
|
if (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, this.clientWaitRetryDelay = 50, !e.processor || typeof e.processor != "function") throw Error("A valid processor function must be provided to useQueue.");
|
|
10733
10815
|
this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0), this.waitForClientAndBindLoad(e.duration);
|
|
@@ -10798,13 +10880,13 @@ var W = class extends e {
|
|
|
10798
10880
|
on(e, t) {
|
|
10799
10881
|
return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
|
|
10800
10882
|
}
|
|
10801
|
-
},
|
|
10883
|
+
}, q;
|
|
10802
10884
|
(function(e) {
|
|
10803
|
-
e.queue = new
|
|
10885
|
+
e.queue = new K({
|
|
10804
10886
|
duration: "client",
|
|
10805
10887
|
processor: async function(e) {
|
|
10806
10888
|
if (window.dispatchEvent(new CustomEvent(e.listener, { detail: e.data })), e.listener === "onEventReceived" && e.session) {
|
|
10807
|
-
let t = await
|
|
10889
|
+
let t = await q.generate.event.onSessionUpdate(window?.client && window?.client instanceof r ? window.client.session : void 0, B.event.parseProvider(e.data));
|
|
10808
10890
|
window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: t }));
|
|
10809
10891
|
}
|
|
10810
10892
|
}
|
|
@@ -11713,10 +11795,10 @@ var W = class extends e {
|
|
|
11713
11795
|
return typeof e != "object" || !e ? e : "type" in e && typeof e.type == "string" ? ((e) => {
|
|
11714
11796
|
if (!e) return e;
|
|
11715
11797
|
switch (e.type) {
|
|
11716
|
-
case "int": return
|
|
11717
|
-
case "string": return
|
|
11718
|
-
case "date": return
|
|
11719
|
-
case "array": return
|
|
11798
|
+
case "int": return B.random.number(e.min, e.max);
|
|
11799
|
+
case "string": return B.random.array(e.options)[0];
|
|
11800
|
+
case "date": return B.random.daysOffset(e.range);
|
|
11801
|
+
case "array": return B.random.array(e.options)[0];
|
|
11720
11802
|
case "recent": return t(e);
|
|
11721
11803
|
default: return e;
|
|
11722
11804
|
}
|
|
@@ -11778,7 +11860,7 @@ var W = class extends e {
|
|
|
11778
11860
|
};
|
|
11779
11861
|
},
|
|
11780
11862
|
async onSessionUpdate(e, t) {
|
|
11781
|
-
if (e ??= await
|
|
11863
|
+
if (e ??= await q.generate.session.get(), t) {
|
|
11782
11864
|
let n = (e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime();
|
|
11783
11865
|
switch (t.provider) {
|
|
11784
11866
|
case "twitch": {
|
|
@@ -11876,7 +11958,7 @@ var W = class extends e {
|
|
|
11876
11958
|
name: t.toLowerCase(),
|
|
11877
11959
|
displayName: t,
|
|
11878
11960
|
amount: r,
|
|
11879
|
-
_id:
|
|
11961
|
+
_id: B.random.uuid(),
|
|
11880
11962
|
sessionTop: !1,
|
|
11881
11963
|
type: "superchat",
|
|
11882
11964
|
originalEventName: "superchat-latest",
|
|
@@ -11897,7 +11979,7 @@ var W = class extends e {
|
|
|
11897
11979
|
name: t.toLowerCase(),
|
|
11898
11980
|
displayName: t,
|
|
11899
11981
|
amount: r,
|
|
11900
|
-
_id:
|
|
11982
|
+
_id: B.random.uuid(),
|
|
11901
11983
|
sessionTop: !1,
|
|
11902
11984
|
type: "superchat",
|
|
11903
11985
|
originalEventName: "superchat-latest",
|
|
@@ -11968,16 +12050,16 @@ var W = class extends e {
|
|
|
11968
12050
|
switch (e) {
|
|
11969
12051
|
default:
|
|
11970
12052
|
case "random":
|
|
11971
|
-
var i =
|
|
12053
|
+
var i = B.random.array(Object.keys(r).filter((e) => r[e].length))[0], a = B.random.array(r[i])[0];
|
|
11972
12054
|
return this.onEventReceived(i, a);
|
|
11973
12055
|
case "twitch": switch (t) {
|
|
11974
12056
|
default:
|
|
11975
12057
|
case "random":
|
|
11976
|
-
var a =
|
|
12058
|
+
var a = B.random.array(r[e])[0];
|
|
11977
12059
|
return this.onEventReceived(e, a);
|
|
11978
12060
|
case "message": {
|
|
11979
12061
|
let t = n;
|
|
11980
|
-
var o = t?.name ??
|
|
12062
|
+
var o = t?.name ?? B.random.array(w.names.filter((e) => e.length))[0], s = t?.message ?? B.random.array([...w.twitch_messages, ...w.normal_messages].filter((e) => e.length))[0], c = await B.message.generateBadges(t?.badges ?? [], e), l = B.message.findEmotesInText(s), u = B.message.replaceEmotesWithHTML(s, l), d = t?.color ?? B.random.color("hex"), f = t?.userId ?? B.random.string(16), p = t?.msgId ?? B.random.string(16), m = t?.time ?? Date.now(), h = t?.channel ?? window?.client?.details?.user?.username ?? "local", g = t?.reply ? {
|
|
11981
12063
|
"reply-parent-display-name": t.reply.name,
|
|
11982
12064
|
"reply-parent-msg-body": t.reply.text,
|
|
11983
12065
|
"reply-parent-msg-id": t.reply.msgId,
|
|
@@ -11999,17 +12081,17 @@ var W = class extends e {
|
|
|
11999
12081
|
data: {
|
|
12000
12082
|
time: m,
|
|
12001
12083
|
tags: {
|
|
12002
|
-
"badge-info": `${c.keys.map((e) => `${e}/${c.amount[e] ??
|
|
12084
|
+
"badge-info": `${c.keys.map((e) => `${e}/${c.amount[e] ?? B.random.number(1, 5)}`).join(",")}`,
|
|
12003
12085
|
badges: c.keys.map((e) => `${e}/1`).join(","),
|
|
12004
12086
|
...v,
|
|
12005
12087
|
"tmi-sent-ts": m.toString(),
|
|
12006
|
-
"room-id":
|
|
12088
|
+
"room-id": B.random.string(9, "numbers"),
|
|
12007
12089
|
"user-id": f,
|
|
12008
12090
|
"user-type": "",
|
|
12009
12091
|
color: d,
|
|
12010
12092
|
"display-name": o,
|
|
12011
12093
|
emotes: "",
|
|
12012
|
-
"client-nonce":
|
|
12094
|
+
"client-nonce": B.random.string(16),
|
|
12013
12095
|
flags: "",
|
|
12014
12096
|
id: p,
|
|
12015
12097
|
"first-msg": t?.firstMsg ? "1" : "0",
|
|
@@ -12035,7 +12117,7 @@ var W = class extends e {
|
|
|
12035
12117
|
}
|
|
12036
12118
|
case "cheer":
|
|
12037
12119
|
case "cheer-latest":
|
|
12038
|
-
var y = n?.amount ??
|
|
12120
|
+
var y = n?.amount ?? B.random.number(100, 1e4), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0], s = n?.message ?? B.random.array(w.normal_messages.filter((e) => e.length))[0];
|
|
12039
12121
|
return {
|
|
12040
12122
|
listener: "cheer-latest",
|
|
12041
12123
|
event: {
|
|
@@ -12045,7 +12127,7 @@ var W = class extends e {
|
|
|
12045
12127
|
displayName: o,
|
|
12046
12128
|
message: s,
|
|
12047
12129
|
providerId: "",
|
|
12048
|
-
_id:
|
|
12130
|
+
_id: B.random.uuid(),
|
|
12049
12131
|
sessionTop: !1,
|
|
12050
12132
|
type: "cheer",
|
|
12051
12133
|
originalEventName: "cheer-latest",
|
|
@@ -12055,7 +12137,7 @@ var W = class extends e {
|
|
|
12055
12137
|
};
|
|
12056
12138
|
case "follower":
|
|
12057
12139
|
case "follower-latest":
|
|
12058
|
-
var b = n?.avatar ??
|
|
12140
|
+
var b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12059
12141
|
return {
|
|
12060
12142
|
listener: "follower-latest",
|
|
12061
12143
|
event: {
|
|
@@ -12063,7 +12145,7 @@ var W = class extends e {
|
|
|
12063
12145
|
name: o.toLowerCase(),
|
|
12064
12146
|
displayName: o,
|
|
12065
12147
|
providerId: "",
|
|
12066
|
-
_id:
|
|
12148
|
+
_id: B.random.uuid(),
|
|
12067
12149
|
sessionTop: !1,
|
|
12068
12150
|
type: "follower",
|
|
12069
12151
|
originalEventName: "follower-latest",
|
|
@@ -12073,7 +12155,7 @@ var W = class extends e {
|
|
|
12073
12155
|
};
|
|
12074
12156
|
case "raid":
|
|
12075
12157
|
case "raid-latest":
|
|
12076
|
-
var y = n?.amount ??
|
|
12158
|
+
var y = n?.amount ?? B.random.number(1, 100), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12077
12159
|
return {
|
|
12078
12160
|
listener: "raid-latest",
|
|
12079
12161
|
event: {
|
|
@@ -12082,7 +12164,7 @@ var W = class extends e {
|
|
|
12082
12164
|
name: o.toLowerCase(),
|
|
12083
12165
|
displayName: o,
|
|
12084
12166
|
providerId: "",
|
|
12085
|
-
_id:
|
|
12167
|
+
_id: B.random.uuid(),
|
|
12086
12168
|
sessionTop: !1,
|
|
12087
12169
|
type: "raid",
|
|
12088
12170
|
originalEventName: "raid-latest",
|
|
@@ -12092,12 +12174,12 @@ var W = class extends e {
|
|
|
12092
12174
|
};
|
|
12093
12175
|
case "subscriber":
|
|
12094
12176
|
case "subscriber-latest":
|
|
12095
|
-
var x = n?.tier ??
|
|
12177
|
+
var x = n?.tier ?? B.random.array([
|
|
12096
12178
|
"1000",
|
|
12097
12179
|
"2000",
|
|
12098
12180
|
"3000",
|
|
12099
12181
|
"prime"
|
|
12100
|
-
])[0], y = n?.amount ??
|
|
12182
|
+
])[0], y = n?.amount ?? B.random.number(1, 24), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0], S = n?.sender ?? B.random.array(w.names.filter((e) => e.length && e !== o))[0], s = n?.message ?? B.random.array(w.normal_messages.filter((e) => e.length))[0], C = {
|
|
12101
12183
|
default: {
|
|
12102
12184
|
avatar: b,
|
|
12103
12185
|
playedAsCommunityGift: !1
|
|
@@ -12121,7 +12203,7 @@ var W = class extends e {
|
|
|
12121
12203
|
"gift",
|
|
12122
12204
|
"community",
|
|
12123
12205
|
"spam"
|
|
12124
|
-
], E = n?.subType ??
|
|
12206
|
+
], E = n?.subType ?? B.random.array(T)[0];
|
|
12125
12207
|
return E = T.includes(E) ? E : "default", {
|
|
12126
12208
|
listener: "subscriber-latest",
|
|
12127
12209
|
event: {
|
|
@@ -12132,7 +12214,7 @@ var W = class extends e {
|
|
|
12132
12214
|
tier: x,
|
|
12133
12215
|
...C.default,
|
|
12134
12216
|
...C[E],
|
|
12135
|
-
_id:
|
|
12217
|
+
_id: B.random.uuid(),
|
|
12136
12218
|
sessionTop: !1,
|
|
12137
12219
|
type: "subscriber",
|
|
12138
12220
|
originalEventName: "subscriber-latest",
|
|
@@ -12143,7 +12225,7 @@ var W = class extends e {
|
|
|
12143
12225
|
case "delete-message": return {
|
|
12144
12226
|
listener: "delete-message",
|
|
12145
12227
|
event: {
|
|
12146
|
-
msgId: n?.id ??
|
|
12228
|
+
msgId: n?.id ?? B.random.uuid(),
|
|
12147
12229
|
provider: e
|
|
12148
12230
|
},
|
|
12149
12231
|
emulated: !0
|
|
@@ -12151,7 +12233,7 @@ var W = class extends e {
|
|
|
12151
12233
|
case "delete-messages": return {
|
|
12152
12234
|
listener: "delete-messages",
|
|
12153
12235
|
event: {
|
|
12154
|
-
userId: n?.id ??
|
|
12236
|
+
userId: n?.id ?? B.random.number(1e7, 99999999).toString(),
|
|
12155
12237
|
provider: e
|
|
12156
12238
|
},
|
|
12157
12239
|
emulated: !0
|
|
@@ -12160,11 +12242,11 @@ var W = class extends e {
|
|
|
12160
12242
|
case "streamelements": switch (t) {
|
|
12161
12243
|
default:
|
|
12162
12244
|
case "random":
|
|
12163
|
-
var a =
|
|
12245
|
+
var a = B.random.array(r[e])[0];
|
|
12164
12246
|
return this.onEventReceived(e, a);
|
|
12165
12247
|
case "tip":
|
|
12166
12248
|
case "tip-latest":
|
|
12167
|
-
var y = n?.amount ??
|
|
12249
|
+
var y = n?.amount ?? B.random.number(100, 4e3), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12168
12250
|
return {
|
|
12169
12251
|
listener: "tip-latest",
|
|
12170
12252
|
event: {
|
|
@@ -12173,7 +12255,7 @@ var W = class extends e {
|
|
|
12173
12255
|
name: o.toLowerCase(),
|
|
12174
12256
|
displayName: o,
|
|
12175
12257
|
providerId: "",
|
|
12176
|
-
_id:
|
|
12258
|
+
_id: B.random.uuid(),
|
|
12177
12259
|
sessionTop: !1,
|
|
12178
12260
|
type: "tip",
|
|
12179
12261
|
originalEventName: "tip-latest",
|
|
@@ -12196,7 +12278,7 @@ var W = class extends e {
|
|
|
12196
12278
|
listener: "bot:counter",
|
|
12197
12279
|
event: {
|
|
12198
12280
|
counter: n?.counter ?? "sampleCounter",
|
|
12199
|
-
value: n?.value ??
|
|
12281
|
+
value: n?.value ?? B.random.number(0, 100),
|
|
12200
12282
|
provider: e
|
|
12201
12283
|
},
|
|
12202
12284
|
emulated: !0
|
|
@@ -12221,12 +12303,12 @@ var W = class extends e {
|
|
|
12221
12303
|
case "youtube": switch (t) {
|
|
12222
12304
|
default:
|
|
12223
12305
|
case "random":
|
|
12224
|
-
var a =
|
|
12306
|
+
var a = B.random.array(r[e])[0];
|
|
12225
12307
|
return this.onEventReceived(e, a);
|
|
12226
12308
|
case "message": {
|
|
12227
|
-
var o = n?.name ??
|
|
12228
|
-
let t = await
|
|
12229
|
-
var l =
|
|
12309
|
+
var o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0], s = n?.message ?? B.random.array([...w.youtube_messages, ...w.normal_messages].filter((e) => e.length))[0];
|
|
12310
|
+
let t = await B.message.generateBadges(n?.badges ?? [], e);
|
|
12311
|
+
var l = B.message.findEmotesInText(s), u = B.message.replaceEmotesWithHTML(s, l), d = n?.color ?? B.random.color("hex"), f = n?.userId ?? B.random.number(1e7, 99999999).toString(), p = n?.msgId ?? B.random.uuid(), m = n?.time ?? Date.now(), b = n?.avatar ?? B.random.array(w.avatars)[0], h = n?.channel ?? window?.client?.details?.user?.username ?? "local";
|
|
12230
12312
|
return {
|
|
12231
12313
|
listener: "message",
|
|
12232
12314
|
event: {
|
|
@@ -12272,7 +12354,7 @@ var W = class extends e {
|
|
|
12272
12354
|
}
|
|
12273
12355
|
case "subscriber":
|
|
12274
12356
|
case "subscriber-latest":
|
|
12275
|
-
var b = n?.avatar ??
|
|
12357
|
+
var b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12276
12358
|
return {
|
|
12277
12359
|
listener: "subscriber-latest",
|
|
12278
12360
|
event: {
|
|
@@ -12280,7 +12362,7 @@ var W = class extends e {
|
|
|
12280
12362
|
displayName: o,
|
|
12281
12363
|
name: o.toLowerCase(),
|
|
12282
12364
|
providerId: "",
|
|
12283
|
-
_id:
|
|
12365
|
+
_id: B.random.uuid(),
|
|
12284
12366
|
sessionTop: !1,
|
|
12285
12367
|
type: "subscriber",
|
|
12286
12368
|
originalEventName: "subscriber-latest",
|
|
@@ -12290,7 +12372,7 @@ var W = class extends e {
|
|
|
12290
12372
|
};
|
|
12291
12373
|
case "superchat":
|
|
12292
12374
|
case "superchat-latest":
|
|
12293
|
-
var y = n?.amount ??
|
|
12375
|
+
var y = n?.amount ?? B.random.number(100, 4e3), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12294
12376
|
return {
|
|
12295
12377
|
listener: "superchat-latest",
|
|
12296
12378
|
event: {
|
|
@@ -12299,7 +12381,7 @@ var W = class extends e {
|
|
|
12299
12381
|
name: o.toLowerCase(),
|
|
12300
12382
|
displayName: o,
|
|
12301
12383
|
providerId: "",
|
|
12302
|
-
_id:
|
|
12384
|
+
_id: B.random.uuid(),
|
|
12303
12385
|
sessionTop: !1,
|
|
12304
12386
|
type: "superchat",
|
|
12305
12387
|
originalEventName: "superchat-latest",
|
|
@@ -12309,11 +12391,11 @@ var W = class extends e {
|
|
|
12309
12391
|
};
|
|
12310
12392
|
case "sponsor":
|
|
12311
12393
|
case "sponsor-latest":
|
|
12312
|
-
var x = n?.tier ??
|
|
12394
|
+
var x = n?.tier ?? B.random.array([
|
|
12313
12395
|
"1000",
|
|
12314
12396
|
"2000",
|
|
12315
12397
|
"3000"
|
|
12316
|
-
])[0], y = n?.amount ??
|
|
12398
|
+
])[0], y = n?.amount ?? B.random.number(1, 24), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0], S = n?.sender ?? B.random.array(w.names.filter((e) => e.length && e !== o))[0], s = n?.message ?? B.random.array(w.normal_messages.filter((e) => e.length))[0], C = {
|
|
12317
12399
|
default: {
|
|
12318
12400
|
avatar: b,
|
|
12319
12401
|
playedAsCommunityGift: !1
|
|
@@ -12337,7 +12419,7 @@ var W = class extends e {
|
|
|
12337
12419
|
"gift",
|
|
12338
12420
|
"community",
|
|
12339
12421
|
"spam"
|
|
12340
|
-
], E = n?.subType ??
|
|
12422
|
+
], E = n?.subType ?? B.random.array(T)[0];
|
|
12341
12423
|
return E = T.includes(E) ? E : "default", {
|
|
12342
12424
|
listener: "sponsor-latest",
|
|
12343
12425
|
event: {
|
|
@@ -12347,7 +12429,7 @@ var W = class extends e {
|
|
|
12347
12429
|
providerId: "",
|
|
12348
12430
|
...C.default,
|
|
12349
12431
|
...C[E],
|
|
12350
|
-
_id:
|
|
12432
|
+
_id: B.random.uuid(),
|
|
12351
12433
|
sessionTop: !1,
|
|
12352
12434
|
type: "sponsor",
|
|
12353
12435
|
originalEventName: "sponsor-latest",
|
|
@@ -12362,8 +12444,8 @@ var W = class extends e {
|
|
|
12362
12444
|
}, e.emulate = {
|
|
12363
12445
|
twitch: {
|
|
12364
12446
|
message(e = {}) {
|
|
12365
|
-
|
|
12366
|
-
e &&
|
|
12447
|
+
q.generate.event.onEventReceived("twitch", "message", e).then((e) => {
|
|
12448
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12367
12449
|
});
|
|
12368
12450
|
},
|
|
12369
12451
|
deleteMessage(e) {
|
|
@@ -12372,7 +12454,7 @@ var W = class extends e {
|
|
|
12372
12454
|
listener: "delete-message",
|
|
12373
12455
|
event: { msgId: e }
|
|
12374
12456
|
};
|
|
12375
|
-
|
|
12457
|
+
q.emulate.send("onEventReceived", t);
|
|
12376
12458
|
},
|
|
12377
12459
|
deleteMessages(e) {
|
|
12378
12460
|
if (!e || typeof e != "string") return;
|
|
@@ -12380,79 +12462,79 @@ var W = class extends e {
|
|
|
12380
12462
|
listener: "delete-messages",
|
|
12381
12463
|
event: { userId: e }
|
|
12382
12464
|
};
|
|
12383
|
-
|
|
12465
|
+
q.emulate.send("onEventReceived", t);
|
|
12384
12466
|
},
|
|
12385
12467
|
follower(e = {}) {
|
|
12386
|
-
|
|
12387
|
-
e &&
|
|
12468
|
+
q.generate.event.onEventReceived("twitch", "follower-latest", e).then((e) => {
|
|
12469
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12388
12470
|
});
|
|
12389
12471
|
},
|
|
12390
12472
|
raid(e = {}) {
|
|
12391
|
-
|
|
12392
|
-
e &&
|
|
12473
|
+
q.generate.event.onEventReceived("twitch", "raid-latest", e).then((e) => {
|
|
12474
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12393
12475
|
});
|
|
12394
12476
|
},
|
|
12395
12477
|
cheer(e = {}) {
|
|
12396
|
-
|
|
12397
|
-
e &&
|
|
12478
|
+
q.generate.event.onEventReceived("twitch", "cheer-latest", e).then((e) => {
|
|
12479
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12398
12480
|
});
|
|
12399
12481
|
},
|
|
12400
12482
|
subscriber(e = {}) {
|
|
12401
|
-
|
|
12402
|
-
e &&
|
|
12483
|
+
q.generate.event.onEventReceived("twitch", "subscriber-latest", e).then((e) => {
|
|
12484
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12403
12485
|
});
|
|
12404
12486
|
}
|
|
12405
12487
|
},
|
|
12406
12488
|
streamelements: { tip(e = {}) {
|
|
12407
|
-
|
|
12408
|
-
e &&
|
|
12489
|
+
q.generate.event.onEventReceived("streamelements", "tip-latest", e).then((e) => {
|
|
12490
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12409
12491
|
});
|
|
12410
12492
|
} },
|
|
12411
12493
|
youtube: {
|
|
12412
12494
|
message(e = {}) {
|
|
12413
|
-
|
|
12414
|
-
e &&
|
|
12495
|
+
q.generate.event.onEventReceived("youtube", "message", e).then((e) => {
|
|
12496
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12415
12497
|
});
|
|
12416
12498
|
},
|
|
12417
12499
|
subscriber(e = {}) {
|
|
12418
|
-
|
|
12419
|
-
e &&
|
|
12500
|
+
q.generate.event.onEventReceived("youtube", "subscriber-latest", e).then((e) => {
|
|
12501
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12420
12502
|
});
|
|
12421
12503
|
},
|
|
12422
12504
|
superchat(e = {}) {
|
|
12423
|
-
|
|
12424
|
-
e &&
|
|
12505
|
+
q.generate.event.onEventReceived("youtube", "superchat-latest", e).then((e) => {
|
|
12506
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12425
12507
|
});
|
|
12426
12508
|
},
|
|
12427
12509
|
sponsor(e = {}) {
|
|
12428
|
-
|
|
12429
|
-
e &&
|
|
12510
|
+
q.generate.event.onEventReceived("youtube", "sponsor-latest", e).then((e) => {
|
|
12511
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12430
12512
|
});
|
|
12431
12513
|
}
|
|
12432
12514
|
},
|
|
12433
12515
|
kick: {},
|
|
12434
12516
|
facebook: {},
|
|
12435
12517
|
send(e, t) {
|
|
12436
|
-
if (!
|
|
12518
|
+
if (!q.queue) {
|
|
12437
12519
|
Q.warn("Local queue is not initialized."), window.dispatchEvent(new CustomEvent(e, { detail: t }));
|
|
12438
12520
|
return;
|
|
12439
12521
|
}
|
|
12440
12522
|
switch (e) {
|
|
12441
12523
|
case "onEventReceived":
|
|
12442
|
-
|
|
12524
|
+
q.queue.enqueue({
|
|
12443
12525
|
listener: e,
|
|
12444
12526
|
data: t,
|
|
12445
12527
|
session: e === "onEventReceived" ? !0 : void 0
|
|
12446
12528
|
});
|
|
12447
12529
|
break;
|
|
12448
12530
|
case "onSessionUpdate":
|
|
12449
|
-
|
|
12531
|
+
q.queue.enqueue({
|
|
12450
12532
|
listener: e,
|
|
12451
12533
|
data: t
|
|
12452
12534
|
});
|
|
12453
12535
|
break;
|
|
12454
12536
|
case "onWidgetLoad":
|
|
12455
|
-
|
|
12537
|
+
q.queue.enqueue({
|
|
12456
12538
|
listener: e,
|
|
12457
12539
|
data: t
|
|
12458
12540
|
});
|
|
@@ -12488,15 +12570,15 @@ var W = class extends e {
|
|
|
12488
12570
|
})
|
|
12489
12571
|
}, i = await fetch("./" + (r.data ?? "data.json"), { cache: "no-store" }).then((e) => e.json()).catch(() => ({}));
|
|
12490
12572
|
await fetch("./" + (r.fields ?? "fields.json"), { cache: "no-store" }).then((e) => e.json()).then(async (e) => {
|
|
12491
|
-
let t = Object.entries(e).filter(([e, { value: t }]) => t != null).reduce((e, [t, { value: n }]) => (i && i[t] !== void 0 && (n = i[t]), e[t] = n, e), { ...i }), r = await
|
|
12573
|
+
let t = Object.entries(e).filter(([e, { value: t }]) => t != null).reduce((e, [t, { value: n }]) => (i && i[t] !== void 0 && (n = i[t]), e[t] = n, e), { ...i }), r = await q.generate.event.onWidgetLoad(t, await q.generate.session.get(n));
|
|
12492
12574
|
window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail: r }));
|
|
12493
12575
|
});
|
|
12494
12576
|
}
|
|
12495
12577
|
e.start = t;
|
|
12496
|
-
})(
|
|
12578
|
+
})(q ||= {});
|
|
12497
12579
|
//#endregion
|
|
12498
12580
|
//#region src/modules/useLogger.ts
|
|
12499
|
-
var
|
|
12581
|
+
var J = class {
|
|
12500
12582
|
constructor(e = {}) {
|
|
12501
12583
|
this.error = this.apply({
|
|
12502
12584
|
color: "#721c24",
|
|
@@ -12594,7 +12676,7 @@ var K = class {
|
|
|
12594
12676
|
timeEnd(e) {
|
|
12595
12677
|
!this.enabled || !console.timeEnd || console.timeEnd(e);
|
|
12596
12678
|
}
|
|
12597
|
-
},
|
|
12679
|
+
}, re = class extends e {
|
|
12598
12680
|
constructor(e, t) {
|
|
12599
12681
|
super(), this.isDebug = !1, this.init = !1, this.emulate = !1, this.username = e.username, this.password = e.password, this.channels = e.channels, this.isDebug = !!e.isDebug, this.init = !!e.init, this.emulate = t, this.load().then((e) => {
|
|
12600
12682
|
this.instance = e, this.emit("load", e), this.connect();
|
|
@@ -12631,7 +12713,7 @@ var K = class {
|
|
|
12631
12713
|
msgId: i.id,
|
|
12632
12714
|
channel: i.channel
|
|
12633
12715
|
};
|
|
12634
|
-
|
|
12716
|
+
q.emulate.twitch.message(o);
|
|
12635
12717
|
}
|
|
12636
12718
|
}, this.instance.onChat = (e, t, n, r, i) => {
|
|
12637
12719
|
if (this.emit("chat", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
|
|
@@ -12644,7 +12726,7 @@ var K = class {
|
|
|
12644
12726
|
subscriber: n.subscriber,
|
|
12645
12727
|
founder: n.founder
|
|
12646
12728
|
};
|
|
12647
|
-
|
|
12729
|
+
q.emulate.twitch.message({
|
|
12648
12730
|
name: e,
|
|
12649
12731
|
message: t,
|
|
12650
12732
|
badges: Object.entries(r).map(([e, t]) => t ? e : null).filter(Boolean),
|
|
@@ -12658,7 +12740,7 @@ var K = class {
|
|
|
12658
12740
|
}, this.instance.onWhisper = (e, t, n, r, i) => {
|
|
12659
12741
|
this.emit("whisper", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
|
|
12660
12742
|
}, this.instance.onMessageDeleted = (e, t) => {
|
|
12661
|
-
this.emit("messageDeleted", e, t), client?.debug && Q.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate &&
|
|
12743
|
+
this.emit("messageDeleted", e, t), client?.debug && Q.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && q.emulate.twitch.deleteMessage(e);
|
|
12662
12744
|
}, this.instance.onJoin = (e, t, n) => {
|
|
12663
12745
|
this.emit("join", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Join: ${e}`);
|
|
12664
12746
|
}, this.instance.onPart = (e, t, n) => {
|
|
@@ -12666,14 +12748,14 @@ var K = class {
|
|
|
12666
12748
|
}, this.instance.onHosted = (e, t, n, r) => {
|
|
12667
12749
|
this.emit("hosted", e, t, n, r), client?.debug && Q.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
|
|
12668
12750
|
}, this.instance.onRaid = (e, t, n) => {
|
|
12669
|
-
this.emit("raid", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate &&
|
|
12751
|
+
this.emit("raid", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && q.emulate.twitch.raid({
|
|
12670
12752
|
name: e,
|
|
12671
12753
|
amount: t
|
|
12672
12754
|
});
|
|
12673
12755
|
}, this.instance.onSub = (e, t, n, r) => {
|
|
12674
12756
|
if (this.emit("sub", e, t, n, r), client?.debug && Q.debug("[Client]", `ComfyJS Sub: ${e} (${n.plan})`), this.emulate) {
|
|
12675
12757
|
let r = n.plan === "Prime" ? "prime" : n.plan;
|
|
12676
|
-
|
|
12758
|
+
q.emulate.twitch.subscriber({
|
|
12677
12759
|
name: e,
|
|
12678
12760
|
message: t,
|
|
12679
12761
|
tier: r,
|
|
@@ -12683,7 +12765,7 @@ var K = class {
|
|
|
12683
12765
|
}, this.instance.onResub = (e, t, n, r, i, a) => {
|
|
12684
12766
|
if (this.emit("resub", e, t, n, r, i, a), client?.debug && Q.debug("[Client]", `ComfyJS Resub: ${e} (${r} months)`), this.emulate) {
|
|
12685
12767
|
let n = i.plan === "Prime" ? "prime" : i.plan;
|
|
12686
|
-
|
|
12768
|
+
q.emulate.twitch.subscriber({
|
|
12687
12769
|
name: e,
|
|
12688
12770
|
message: t,
|
|
12689
12771
|
tier: n,
|
|
@@ -12694,7 +12776,7 @@ var K = class {
|
|
|
12694
12776
|
}, this.instance.onSubGift = (e, t, n, r, i, a) => {
|
|
12695
12777
|
if (this.emit("subGift", e, t, n, r, i, a), client?.debug && Q.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${r} subs`), this.emulate) {
|
|
12696
12778
|
let t = i.plan === "Prime" ? "prime" : i.plan;
|
|
12697
|
-
|
|
12779
|
+
q.emulate.twitch.subscriber({
|
|
12698
12780
|
name: n,
|
|
12699
12781
|
message: "",
|
|
12700
12782
|
sender: e,
|
|
@@ -12706,7 +12788,7 @@ var K = class {
|
|
|
12706
12788
|
}, this.instance.onSubMysteryGift = (e, t, n, r, i) => {
|
|
12707
12789
|
if (this.emit("subMysteryGift", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`), this.emulate) {
|
|
12708
12790
|
let n = r.plan === "Prime" ? "prime" : r.plan;
|
|
12709
|
-
|
|
12791
|
+
q.emulate.twitch.subscriber({
|
|
12710
12792
|
name: e,
|
|
12711
12793
|
message: "",
|
|
12712
12794
|
amount: t,
|
|
@@ -12715,7 +12797,7 @@ var K = class {
|
|
|
12715
12797
|
});
|
|
12716
12798
|
}
|
|
12717
12799
|
}, this.instance.onGiftSubContinue = (e, t, n) => {
|
|
12718
|
-
this.emit("giftSubContinue", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`), this.emulate &&
|
|
12800
|
+
this.emit("giftSubContinue", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`), this.emulate && q.emulate.twitch.subscriber({
|
|
12719
12801
|
name: e,
|
|
12720
12802
|
message: "",
|
|
12721
12803
|
sender: t,
|
|
@@ -12723,7 +12805,7 @@ var K = class {
|
|
|
12723
12805
|
subType: "gift"
|
|
12724
12806
|
});
|
|
12725
12807
|
}, this.instance.onCheer = (e, t, n, r, i) => {
|
|
12726
|
-
this.emit("cheer", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${n} bits - ${t}`), this.emulate &&
|
|
12808
|
+
this.emit("cheer", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${n} bits - ${t}`), this.emulate && q.emulate.twitch.cheer({
|
|
12727
12809
|
name: e,
|
|
12728
12810
|
message: t,
|
|
12729
12811
|
amount: n
|
|
@@ -12738,7 +12820,7 @@ var K = class {
|
|
|
12738
12820
|
this.emit("reconnect", e), client?.debug && Q.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
|
|
12739
12821
|
}, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
|
|
12740
12822
|
}
|
|
12741
|
-
},
|
|
12823
|
+
}, Y = {
|
|
12742
12824
|
getOverlayStatus: () => ({
|
|
12743
12825
|
isEditorMode: !1,
|
|
12744
12826
|
muted: !1
|
|
@@ -12758,7 +12840,7 @@ var K = class {
|
|
|
12758
12840
|
setField(e, t, n) {},
|
|
12759
12841
|
store: {
|
|
12760
12842
|
set: function(e, t) {
|
|
12761
|
-
this.list[e] = t, localStorage.setItem("SE_API-STORE", JSON.stringify(
|
|
12843
|
+
this.list[e] = t, localStorage.setItem("SE_API-STORE", JSON.stringify(Y.store.list));
|
|
12762
12844
|
},
|
|
12763
12845
|
get: async function(e) {
|
|
12764
12846
|
return this.list[e] ? this.list[e] : null;
|
|
@@ -12766,9 +12848,9 @@ var K = class {
|
|
|
12766
12848
|
list: {}
|
|
12767
12849
|
}
|
|
12768
12850
|
};
|
|
12769
|
-
async function
|
|
12851
|
+
async function ie() {
|
|
12770
12852
|
let e = localStorage.getItem("SE_API-STORE") ?? "", t = e ? JSON.parse(e) : {};
|
|
12771
|
-
return
|
|
12853
|
+
return Y.store.list = t, Y;
|
|
12772
12854
|
}
|
|
12773
12855
|
//#endregion
|
|
12774
12856
|
//#region src/utils/alejo.ts
|
|
@@ -12821,40 +12903,40 @@ var X;
|
|
|
12821
12903
|
})(X ||= {});
|
|
12822
12904
|
//#endregion
|
|
12823
12905
|
//#region src/main.ts
|
|
12824
|
-
var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(
|
|
12906
|
+
var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(ie()), Q = new J(), $ = {
|
|
12825
12907
|
SeAPI: Z,
|
|
12826
12908
|
Client: r,
|
|
12827
|
-
Helper:
|
|
12828
|
-
Local:
|
|
12909
|
+
Helper: B,
|
|
12910
|
+
Local: q,
|
|
12829
12911
|
Data: w,
|
|
12830
12912
|
logger: Q,
|
|
12831
12913
|
modules: {
|
|
12832
12914
|
EventProvider: e,
|
|
12833
12915
|
useStorage: n,
|
|
12834
|
-
useQueue:
|
|
12835
|
-
useLogger:
|
|
12836
|
-
useComms:
|
|
12837
|
-
FakeUserPool:
|
|
12916
|
+
useQueue: K,
|
|
12917
|
+
useLogger: J,
|
|
12918
|
+
useComms: ne,
|
|
12919
|
+
FakeUserPool: te
|
|
12838
12920
|
},
|
|
12839
12921
|
actions: {
|
|
12840
|
-
Button:
|
|
12841
|
-
Command:
|
|
12922
|
+
Button: H,
|
|
12923
|
+
Command: W
|
|
12842
12924
|
},
|
|
12843
|
-
multistream: { useComfyJs:
|
|
12925
|
+
multistream: { useComfyJs: re },
|
|
12844
12926
|
internal: {
|
|
12845
12927
|
usedStorages: t,
|
|
12846
|
-
usedComms:
|
|
12847
|
-
usedCommands:
|
|
12848
|
-
usedButtons:
|
|
12849
|
-
fakeUserPools:
|
|
12928
|
+
usedComms: G,
|
|
12929
|
+
usedCommands: U,
|
|
12930
|
+
usedButtons: V,
|
|
12931
|
+
fakeUserPools: R
|
|
12850
12932
|
},
|
|
12851
12933
|
pronouns: { Alejo: X }
|
|
12852
12934
|
};
|
|
12853
12935
|
typeof window < "u" ? window.Tixyel = $ : globalThis.Tixyel = $;
|
|
12854
12936
|
//#endregion
|
|
12855
12937
|
//#region src/index.ts
|
|
12856
|
-
var
|
|
12938
|
+
var ae = $;
|
|
12857
12939
|
//#endregion
|
|
12858
|
-
export {
|
|
12940
|
+
export { ae as default };
|
|
12859
12941
|
|
|
12860
12942
|
//# sourceMappingURL=index.es.js.map
|