@tixyel/streamelements 6.4.2 → 6.4.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 +18 -2
- package/dist/index.es.js +669 -636
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Z {
|
|
2
2
|
constructor() {
|
|
3
3
|
this.registeredEvents = {};
|
|
4
4
|
}
|
|
@@ -49,10 +49,10 @@ class X {
|
|
|
49
49
|
return this.registeredEvents[e] = [], this;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
class
|
|
52
|
+
const et = [];
|
|
53
|
+
class at extends Z {
|
|
54
54
|
constructor(e) {
|
|
55
|
-
super(), this.SE_API = null, this.id = "default", this.loaded = !1, this.id = e.id || this.id, this.data = e.data ?? {},
|
|
55
|
+
super(), this.SE_API = null, this.id = "default", this.loaded = !1, this.id = e.id || this.id, this.data = e.data ?? {}, et.push(this), ct?.then((t) => {
|
|
56
56
|
this.SE_API = t, t.store.get(this.id).then((a) => {
|
|
57
57
|
this.data = a ?? this.data, this.loaded = !0, this.emit("load", this.data), JSON.stringify(this.data) !== JSON.stringify(a) && this.emit("update", this.data);
|
|
58
58
|
}).catch(() => {
|
|
@@ -83,7 +83,7 @@ class it extends X {
|
|
|
83
83
|
* @param value Value to add
|
|
84
84
|
*/
|
|
85
85
|
add(e, t) {
|
|
86
|
-
this.loaded && (
|
|
86
|
+
this.loaded && (at.setByPath(this.data, e, t), this.save(this.data));
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Clears all data from the storage.
|
|
@@ -109,7 +109,7 @@ class it extends X {
|
|
|
109
109
|
return e === "load" && this.loaded ? (t.apply(this, [this.data]), this) : (super.on(e, t), this);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
class
|
|
112
|
+
class G extends Z {
|
|
113
113
|
constructor(e) {
|
|
114
114
|
super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
|
|
115
115
|
commands: [],
|
|
@@ -118,7 +118,7 @@ class q extends X {
|
|
|
118
118
|
avatar: 30,
|
|
119
119
|
pronoun: 60,
|
|
120
120
|
emote: 120
|
|
121
|
-
}, this.id = e.id || this.id, this.storage = new
|
|
121
|
+
}, this.id = e.id || this.id, this.storage = new at({
|
|
122
122
|
id: this.id,
|
|
123
123
|
data: {
|
|
124
124
|
user: {},
|
|
@@ -151,17 +151,19 @@ class q extends X {
|
|
|
151
151
|
]), this) : (super.on(e, t), this);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
class
|
|
154
|
+
class $ {
|
|
155
155
|
constructor(e) {
|
|
156
|
-
this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], window.client instanceof
|
|
156
|
+
this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], window.client instanceof G && (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, window.client.actions.commands.push(this), window.client.emit("action", this, "created"));
|
|
157
157
|
}
|
|
158
158
|
run(e, t) {
|
|
159
159
|
}
|
|
160
160
|
verify(e, t, a) {
|
|
161
|
-
return this.arguments === !0 && (!a || !a.length) ? !1 : !!(this.admins.some((i) => e.toLocaleLowerCase() === i.toLocaleLowerCase()) || this.permissions === !0 || typeof this.permissions > "u" || Array.isArray(this.permissions) && !this.permissions.length || Array.isArray(this.permissions) && (this.permissions.some(
|
|
161
|
+
return this.arguments === !0 && (!a || !a.length) ? !1 : !!(this.admins.some((i) => e.toLocaleLowerCase() === i.toLocaleLowerCase()) || this.permissions === !0 || typeof this.permissions > "u" || Array.isArray(this.permissions) && !this.permissions.length || Array.isArray(this.permissions) && (this.permissions.some(
|
|
162
|
+
(i) => e.toLowerCase() === i.toLowerCase() || t.map((s) => s.toLowerCase()).includes(i.toLowerCase())
|
|
163
|
+
) || this.permissions.includes("*")));
|
|
162
164
|
}
|
|
163
165
|
parse(e, t) {
|
|
164
|
-
if (!(window.client instanceof
|
|
166
|
+
if (!(window.client instanceof G)) return !1;
|
|
165
167
|
const a = e.replace(this.prefix, "").split(" ").slice(1).map((c) => c.trim());
|
|
166
168
|
var i = "", s = [];
|
|
167
169
|
const n = { bits: "cheer", premium: "prime" };
|
|
@@ -188,12 +190,12 @@ class Z {
|
|
|
188
190
|
return m === !0 && this.run.apply(window.client, [a, t]), m;
|
|
189
191
|
}
|
|
190
192
|
remove() {
|
|
191
|
-
if (!(window.client instanceof
|
|
193
|
+
if (!(window.client instanceof G)) return;
|
|
192
194
|
const e = window.client.actions.commands.indexOf(this);
|
|
193
195
|
e > -1 && (window.client.actions.commands.splice(e, 1), window.client.emit("action", this, "removed"));
|
|
194
196
|
}
|
|
195
197
|
static execute(e) {
|
|
196
|
-
if (!(window.client instanceof
|
|
198
|
+
if (!(window.client instanceof G)) return !1;
|
|
197
199
|
const t = e.data;
|
|
198
200
|
try {
|
|
199
201
|
if (window.client.actions.commands.length && window.client.actions.commands.some((a) => t.event.data.text.startsWith(a.prefix))) {
|
|
@@ -201,9 +203,12 @@ class Z {
|
|
|
201
203
|
var s = [i.name, ...i.aliases ?? []], n = t.event.data.text.replace(i.prefix, "").split(" ")[0];
|
|
202
204
|
return s.includes(n);
|
|
203
205
|
});
|
|
204
|
-
if (a.length && a.every((i) => i instanceof
|
|
206
|
+
if (a.length && a.every((i) => i instanceof $))
|
|
205
207
|
return a.forEach((i) => {
|
|
206
|
-
i.parse(t.event.data.text, e), window
|
|
208
|
+
i.parse(t.event.data.text, e), window?.client?.emit("action", i, "executed"), R.received(
|
|
209
|
+
`Command executed: ${t.event.data.text} by ${t.event.data.nick || t.event.data.displayName}`,
|
|
210
|
+
t
|
|
211
|
+
);
|
|
207
212
|
}), !0;
|
|
208
213
|
}
|
|
209
214
|
} catch {
|
|
@@ -364,7 +369,7 @@ const ut = [
|
|
|
364
369
|
"yellowgreen",
|
|
365
370
|
"transparent"
|
|
366
371
|
];
|
|
367
|
-
function
|
|
372
|
+
function bt(l, e) {
|
|
368
373
|
if (!e) return null;
|
|
369
374
|
switch (e) {
|
|
370
375
|
case "hex": {
|
|
@@ -387,7 +392,7 @@ function ft(l, e) {
|
|
|
387
392
|
const t = l.match(/hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*([\d.]+))?\s*\)/);
|
|
388
393
|
if (!t) return null;
|
|
389
394
|
const a = parseInt(t[1]), i = parseInt(t[2]), s = parseInt(t[3]), n = t[4] ? parseFloat(t[4]) : 1;
|
|
390
|
-
return { ...
|
|
395
|
+
return { ...wt(a, i, s), a: n };
|
|
391
396
|
}
|
|
392
397
|
case "css-color-name": {
|
|
393
398
|
const t = document.createElement("canvas");
|
|
@@ -402,7 +407,7 @@ function ft(l, e) {
|
|
|
402
407
|
return null;
|
|
403
408
|
}
|
|
404
409
|
}
|
|
405
|
-
function
|
|
410
|
+
function yt(l, e = !0) {
|
|
406
411
|
const t = (i) => Math.round(i).toString(16).padStart(2, "0");
|
|
407
412
|
let a = `#${t(l.r)}${t(l.g)}${t(l.b)}`;
|
|
408
413
|
return e && l.a < 1 && (a += t(l.a * 255)), a;
|
|
@@ -430,7 +435,7 @@ function lt(l, e, t) {
|
|
|
430
435
|
l: Math.round(c * 100)
|
|
431
436
|
};
|
|
432
437
|
}
|
|
433
|
-
function
|
|
438
|
+
function wt(l, e, t) {
|
|
434
439
|
l /= 360, e /= 100, t /= 100;
|
|
435
440
|
let a, i, s;
|
|
436
441
|
if (e === 0)
|
|
@@ -445,7 +450,7 @@ function yt(l, e, t) {
|
|
|
445
450
|
b: Math.round(s * 255)
|
|
446
451
|
};
|
|
447
452
|
}
|
|
448
|
-
async function
|
|
453
|
+
async function vt(l, e, t) {
|
|
449
454
|
const a = ut;
|
|
450
455
|
let i = a[0], s = 1 / 0;
|
|
451
456
|
for await (const n of a) {
|
|
@@ -454,12 +459,12 @@ async function wt(l, e, t) {
|
|
|
454
459
|
const c = m.getContext("2d");
|
|
455
460
|
if (!c) continue;
|
|
456
461
|
c.fillStyle = n, c.fillRect(0, 0, 1, 1);
|
|
457
|
-
const [b, p, o] = c.getImageData(0, 0, 1, 1).data,
|
|
458
|
-
if (
|
|
462
|
+
const [b, p, o] = c.getImageData(0, 0, 1, 1).data, d = Math.sqrt(Math.pow(l - b, 2) + Math.pow(e - p, 2) + Math.pow(t - o, 2));
|
|
463
|
+
if (d < s && (s = d, i = n), d === 0) break;
|
|
459
464
|
}
|
|
460
465
|
return i;
|
|
461
466
|
}
|
|
462
|
-
const
|
|
467
|
+
const kt = [
|
|
463
468
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/13e5fa74-defa-11e9-809c-784f43822e80-profile_image-300x300.png",
|
|
464
469
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/dbdc9198-def8-11e9-8681-784f43822e80-profile_image-300x300.png",
|
|
465
470
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/998f01ae-def8-11e9-b95c-784f43822e80-profile_image-300x300.png",
|
|
@@ -467,7 +472,7 @@ const vt = [
|
|
|
467
472
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/ebe4cd89-b4f4-4cd9-adac-2f30151b4209-profile_image-300x300.png",
|
|
468
473
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/215b7342-def9-11e9-9a66-784f43822e80-profile_image-300x300.png",
|
|
469
474
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/ead5c8b2-a4c9-4724-b1dd-9f00b46cbd3d-profile_image-300x300.png"
|
|
470
|
-
],
|
|
475
|
+
], Ct = {
|
|
471
476
|
"100 bits": {
|
|
472
477
|
type: "100 bits",
|
|
473
478
|
version: "1",
|
|
@@ -558,7 +563,7 @@ const vt = [
|
|
|
558
563
|
url: "https://static-cdn.jtvnw.net/badges/v1/b817aba4-fad8-49e2-b88a-7cc744dfa6ec/3",
|
|
559
564
|
description: "VIP"
|
|
560
565
|
}
|
|
561
|
-
},
|
|
566
|
+
}, jt = Object.values([
|
|
562
567
|
{
|
|
563
568
|
type: "twitch",
|
|
564
569
|
name: "TheIlluminati",
|
|
@@ -1915,7 +1920,7 @@ const vt = [
|
|
|
1915
1920
|
end: 0
|
|
1916
1921
|
}), l),
|
|
1917
1922
|
[]
|
|
1918
|
-
),
|
|
1923
|
+
), xt = [], Ut = [
|
|
1919
1924
|
"Hello everyone!",
|
|
1920
1925
|
"PogChamp",
|
|
1921
1926
|
"This stream is amazing!",
|
|
@@ -1966,7 +1971,7 @@ const vt = [
|
|
|
1966
1971
|
"BloodTrail hunting time",
|
|
1967
1972
|
"CatBag kitty!",
|
|
1968
1973
|
"c! poggers"
|
|
1969
|
-
],
|
|
1974
|
+
], Et = ["Local", "Tixyel", "Urie_s2", "itzzcatt", "BeniArts", "Cupidiko", "shy_madeit"], It = ["1000", "2000", "3000", "prime"], Tt = [
|
|
1970
1975
|
"Filiz",
|
|
1971
1976
|
"Astrid",
|
|
1972
1977
|
"Tatyana",
|
|
@@ -2054,7 +2059,7 @@ const vt = [
|
|
|
2054
2059
|
"Szabolcs",
|
|
2055
2060
|
"Hoda",
|
|
2056
2061
|
"Naayf"
|
|
2057
|
-
],
|
|
2062
|
+
], St = [
|
|
2058
2063
|
{
|
|
2059
2064
|
emojiId: "UCkszU2WH9gy1mb0dV-11UJg/flower-rainbow-heart-red",
|
|
2060
2065
|
shortcuts: [":pride-flower-rainbow-heart:"],
|
|
@@ -5228,15 +5233,15 @@ const vt = [
|
|
|
5228
5233
|
index: 121
|
|
5229
5234
|
}
|
|
5230
5235
|
];
|
|
5231
|
-
var
|
|
5236
|
+
var M;
|
|
5232
5237
|
((l) => {
|
|
5233
|
-
l.avatars =
|
|
5234
|
-
})(
|
|
5238
|
+
l.avatars = kt, l.badges = Ct, l.css_color_names = ut, l.emotes = jt, l.items = xt, l.messages = Ut, l.names = Et, l.tiers = It, l.tts = Tt, l.youtube_emotes = St;
|
|
5239
|
+
})(M || (M = {}));
|
|
5235
5240
|
var w;
|
|
5236
5241
|
((l) => {
|
|
5237
5242
|
let e;
|
|
5238
5243
|
((n) => {
|
|
5239
|
-
function m(o,
|
|
5244
|
+
function m(o, d = "cardinal") {
|
|
5240
5245
|
const f = {
|
|
5241
5246
|
single: ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"],
|
|
5242
5247
|
tens: [
|
|
@@ -5252,7 +5257,7 @@ var w;
|
|
|
5252
5257
|
"nineteen"
|
|
5253
5258
|
],
|
|
5254
5259
|
decades: ["twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
|
|
5255
|
-
},
|
|
5260
|
+
}, h = {
|
|
5256
5261
|
single: [
|
|
5257
5262
|
"zeroth",
|
|
5258
5263
|
"first",
|
|
@@ -5295,215 +5300,215 @@ var w;
|
|
|
5295
5300
|
"trillion",
|
|
5296
5301
|
"quadrillion",
|
|
5297
5302
|
"quintillion"
|
|
5298
|
-
],
|
|
5299
|
-
if (o = Math.abs(Math.floor(o)),
|
|
5303
|
+
], C = y.map((j) => j ? `${j}th` : "");
|
|
5304
|
+
if (o = Math.abs(Math.floor(o)), d === "suffix") {
|
|
5300
5305
|
const j = o % 100;
|
|
5301
5306
|
if (j >= 11 && j <= 13) return `${o}th`;
|
|
5302
|
-
const
|
|
5303
|
-
return `${o}${g[
|
|
5304
|
-
}
|
|
5305
|
-
function
|
|
5306
|
-
if (j < 10) return
|
|
5307
|
-
if (j < 20) return
|
|
5308
|
-
const
|
|
5309
|
-
if (
|
|
5310
|
-
return
|
|
5311
|
-
const W = f.decades[
|
|
5312
|
-
return `${W}-${
|
|
5313
|
-
}
|
|
5314
|
-
function
|
|
5315
|
-
if (j === 0) return
|
|
5316
|
-
const
|
|
5317
|
-
return
|
|
5318
|
-
}
|
|
5319
|
-
if (o < 1e3) return
|
|
5320
|
-
const
|
|
5321
|
-
let
|
|
5322
|
-
for (;
|
|
5323
|
-
|
|
5324
|
-
let
|
|
5325
|
-
for (let j = 0; j <
|
|
5307
|
+
const P = o % 10;
|
|
5308
|
+
return `${o}${g[P]}`;
|
|
5309
|
+
}
|
|
5310
|
+
function k(j, P) {
|
|
5311
|
+
if (j < 10) return P === "ordinal" ? h.single[j] : f.single[j];
|
|
5312
|
+
if (j < 20) return P === "ordinal" ? h.tens[j - 10] : f.tens[j - 10];
|
|
5313
|
+
const O = Math.floor(j / 10), z = j % 10;
|
|
5314
|
+
if (z === 0)
|
|
5315
|
+
return P === "ordinal" ? h.decades[O - 2] : f.decades[O - 2];
|
|
5316
|
+
const W = f.decades[O - 2], D = P === "ordinal" ? h.single[z] : f.single[z];
|
|
5317
|
+
return `${W}-${D}`;
|
|
5318
|
+
}
|
|
5319
|
+
function S(j, P) {
|
|
5320
|
+
if (j === 0) return P === "ordinal" ? h.single[0] : f.single[0];
|
|
5321
|
+
const O = Math.floor(j / 100), z = j % 100, W = [];
|
|
5322
|
+
return O > 0 && (P === "ordinal" && z === 0 ? W.push(`${f.single[O]} hundredth`) : W.push(`${f.single[O]} hundred`)), z > 0 && W.push(k(z, P)), W.join(" ");
|
|
5323
|
+
}
|
|
5324
|
+
if (o < 1e3) return S(o, d);
|
|
5325
|
+
const J = [];
|
|
5326
|
+
let E = o;
|
|
5327
|
+
for (; E > 0; )
|
|
5328
|
+
J.push(E % 1e3), E = Math.floor(E / 1e3);
|
|
5329
|
+
let T = -1;
|
|
5330
|
+
for (let j = 0; j < J.length; j++) J[j] !== 0 && (T = j);
|
|
5326
5331
|
const _ = [];
|
|
5327
|
-
for (let j =
|
|
5328
|
-
const
|
|
5329
|
-
if (
|
|
5330
|
-
const
|
|
5331
|
-
if (
|
|
5332
|
-
let
|
|
5333
|
-
|
|
5334
|
-
} else if (j ===
|
|
5332
|
+
for (let j = J.length - 1; j >= 0; j--) {
|
|
5333
|
+
const P = J[j];
|
|
5334
|
+
if (P === 0) continue;
|
|
5335
|
+
const O = y[j];
|
|
5336
|
+
if (d === "cardinal") {
|
|
5337
|
+
let z = S(P, "cardinal");
|
|
5338
|
+
O && (z += ` ${O}`), _.push(z);
|
|
5339
|
+
} else if (j === T)
|
|
5335
5340
|
if (j > 0) {
|
|
5336
|
-
const W =
|
|
5337
|
-
_.push(W ? `${W} ${
|
|
5341
|
+
const W = S(P, "cardinal"), D = C[j];
|
|
5342
|
+
_.push(W ? `${W} ${D}` : D);
|
|
5338
5343
|
} else {
|
|
5339
|
-
const W =
|
|
5344
|
+
const W = S(P, "ordinal");
|
|
5340
5345
|
_.push(W);
|
|
5341
5346
|
}
|
|
5342
5347
|
else {
|
|
5343
|
-
let W =
|
|
5344
|
-
|
|
5348
|
+
let W = S(P, "cardinal");
|
|
5349
|
+
O && (W += ` ${O}`), _.push(W);
|
|
5345
5350
|
}
|
|
5346
5351
|
}
|
|
5347
5352
|
return _.join(", ");
|
|
5348
5353
|
}
|
|
5349
5354
|
n.translate = m;
|
|
5350
|
-
function c(o,
|
|
5351
|
-
const g = Math.min(Math.max(o,
|
|
5352
|
-
return b(g,
|
|
5355
|
+
function c(o, d = 0, f = 100, h = 0) {
|
|
5356
|
+
const g = Math.min(Math.max(o, d), f);
|
|
5357
|
+
return b(g, h);
|
|
5353
5358
|
}
|
|
5354
5359
|
n.balance = c;
|
|
5355
|
-
function b(o,
|
|
5356
|
-
const f = Math.pow(10,
|
|
5360
|
+
function b(o, d = 2) {
|
|
5361
|
+
const f = Math.pow(10, d);
|
|
5357
5362
|
return Math.round(o * f) / f;
|
|
5358
5363
|
}
|
|
5359
5364
|
n.round = b;
|
|
5360
|
-
function p(o,
|
|
5361
|
-
o >
|
|
5362
|
-
const
|
|
5363
|
-
return f ? Number(
|
|
5365
|
+
function p(o, d, f = 0) {
|
|
5366
|
+
o > d && ([o, d] = [d, o]);
|
|
5367
|
+
const h = Math.random() * (d - o) + o;
|
|
5368
|
+
return f ? Number(h.toFixed(f)) : Math.round(h);
|
|
5364
5369
|
}
|
|
5365
5370
|
n.number = p;
|
|
5366
5371
|
})(e = l.number || (l.number = {}));
|
|
5367
5372
|
let t;
|
|
5368
5373
|
((n) => {
|
|
5369
|
-
function m(
|
|
5374
|
+
function m(d, f, h) {
|
|
5370
5375
|
const g = f.match(/^<span(?: class="[^"]*")? style="([^"]*)">(.*)<\/span>$/s);
|
|
5371
5376
|
if (g) {
|
|
5372
|
-
const y = g[1],
|
|
5373
|
-
let
|
|
5374
|
-
return
|
|
5377
|
+
const y = g[1], C = g[2], k = g[0].match(/class="([^"]*)"/)?.[1] || "";
|
|
5378
|
+
let S = [y, d].filter((J) => J.length).map((J) => J.endsWith(";") ? J.slice(0, -1) : J).join("; ").replace(/\s*;\s*/g, "; ").trim();
|
|
5379
|
+
return S.endsWith(";") || (S += ";"), `<span${k ? ` class="${k} ${h ?? ""}"` : ""}${S ? ` style="${S}"` : ""}>${C}</span>`;
|
|
5375
5380
|
} else
|
|
5376
|
-
return
|
|
5381
|
+
return d && d.length && !d.endsWith(";") && (d += ";"), `<span${h ? ` class="${h}"` : ""}${d ? ` style="${d}"` : ""}>${f}</span>`;
|
|
5377
5382
|
}
|
|
5378
5383
|
n.mergeSpanStyles = m;
|
|
5379
|
-
function c(
|
|
5380
|
-
const { return: y = !1, parent:
|
|
5381
|
-
if (!
|
|
5384
|
+
function c(d, f = 0, h = 1, g) {
|
|
5385
|
+
const { return: y = !1, parent: C, base: k } = g || {}, S = C || d.parentElement || document.body;
|
|
5386
|
+
if (!S)
|
|
5382
5387
|
throw new Error("No parent element found for scaling");
|
|
5383
|
-
const
|
|
5384
|
-
if (
|
|
5388
|
+
const J = S.getBoundingClientRect(), E = d.offsetWidth, T = d.offsetHeight;
|
|
5389
|
+
if (E === 0 || T === 0)
|
|
5385
5390
|
throw new Error("Element has zero width or height, cannot scale");
|
|
5386
|
-
const _ =
|
|
5387
|
-
let
|
|
5391
|
+
const _ = J.width * h / E, j = J.height * h / T;
|
|
5392
|
+
let P = k === "width" ? _ : k === "height" ? j : Math.min(_, j);
|
|
5388
5393
|
if (f > 0) {
|
|
5389
|
-
const
|
|
5390
|
-
|
|
5394
|
+
const z = J.width * f / E, W = J.height * f / T, D = Math.max(z, W);
|
|
5395
|
+
P = Math.max(D, P);
|
|
5391
5396
|
}
|
|
5392
|
-
const
|
|
5393
|
-
width:
|
|
5394
|
-
height:
|
|
5395
|
-
scale:
|
|
5397
|
+
const O = {
|
|
5398
|
+
width: E * P,
|
|
5399
|
+
height: T * P,
|
|
5400
|
+
scale: P
|
|
5396
5401
|
};
|
|
5397
|
-
return y || (
|
|
5402
|
+
return y || (d.style.transform = `scale(${P})`, d.style.transformOrigin = "center center"), O;
|
|
5398
5403
|
}
|
|
5399
5404
|
n.scale = c;
|
|
5400
|
-
function b(
|
|
5405
|
+
function b(d, f = {}) {
|
|
5401
5406
|
const {
|
|
5402
|
-
parent:
|
|
5407
|
+
parent: h = d.parentElement,
|
|
5403
5408
|
prefer: g = "auto",
|
|
5404
5409
|
min: y = 0,
|
|
5405
|
-
max:
|
|
5406
|
-
apply:
|
|
5410
|
+
max: C = 1,
|
|
5411
|
+
apply: k = () => {
|
|
5407
5412
|
}
|
|
5408
5413
|
} = f;
|
|
5409
|
-
if (!
|
|
5414
|
+
if (!h)
|
|
5410
5415
|
throw new Error("No parent element found for scaling");
|
|
5411
|
-
const
|
|
5412
|
-
let
|
|
5413
|
-
const
|
|
5414
|
-
|
|
5415
|
-
const
|
|
5416
|
-
return g === "width" ?
|
|
5416
|
+
const S = h.getBoundingClientRect(), J = d.getBoundingClientRect(), E = S.width, T = S.height, _ = J.width, j = J.height;
|
|
5417
|
+
let P = E * y / _, O = T * y / j, z = E * C / _, W = T * C / j, D = Math.min(z, W);
|
|
5418
|
+
const tt = Math.max(P, O);
|
|
5419
|
+
D = Math.max(D, tt);
|
|
5420
|
+
const q = _ * D, F = j * D;
|
|
5421
|
+
return g === "width" ? D = Math.max(P, Math.min(z, E / _)) : g === "height" ? D = Math.max(O, Math.min(W, T / j)) : q > E ? D = Math.max(P, Math.min(z, E / _)) : F > T && (D = Math.max(O, Math.min(W, T / j))), k.apply(d, [D, d]), D;
|
|
5417
5422
|
}
|
|
5418
5423
|
n.scalev2 = b;
|
|
5419
|
-
function p(
|
|
5420
|
-
const g = parseFloat(getComputedStyle(
|
|
5421
|
-
minFontSize:
|
|
5422
|
-
maxFontSize:
|
|
5423
|
-
},
|
|
5424
|
-
if (!
|
|
5424
|
+
function p(d, f = 1, h = {}) {
|
|
5425
|
+
const g = parseFloat(getComputedStyle(d).getPropertyValue("font-size")), y = {
|
|
5426
|
+
minFontSize: h?.minFontSize ?? 0,
|
|
5427
|
+
maxFontSize: h?.maxFontSize ?? g
|
|
5428
|
+
}, C = h?.parent || d.parentElement;
|
|
5429
|
+
if (!C)
|
|
5425
5430
|
throw new Error("No parent element found for fitting text");
|
|
5426
|
-
const
|
|
5427
|
-
return
|
|
5431
|
+
const k = C.clientWidth * f, S = d.offsetWidth, J = k / S, E = g * J, T = e.balance(E, y.minFontSize, y.maxFontSize);
|
|
5432
|
+
return d.style.fontSize = T + "px", d;
|
|
5428
5433
|
}
|
|
5429
5434
|
n.fitText = p;
|
|
5430
|
-
function o(
|
|
5431
|
-
const g = new DOMParser().parseFromString(
|
|
5435
|
+
function o(d, f = 0) {
|
|
5436
|
+
const g = new DOMParser().parseFromString(d, "text/html");
|
|
5432
5437
|
let y = f;
|
|
5433
|
-
function
|
|
5434
|
-
if (
|
|
5435
|
-
const _ = (
|
|
5436
|
-
const
|
|
5437
|
-
return
|
|
5438
|
-
` ||
|
|
5438
|
+
function C(E) {
|
|
5439
|
+
if (E.nodeType === Node.TEXT_NODE) {
|
|
5440
|
+
const _ = (E.textContent || "").split("").map((P, O) => {
|
|
5441
|
+
const z = document.createElement("span");
|
|
5442
|
+
return z.classList.add("char"), z.dataset.index = String(y), z.dataset.exclusivityIndex = String(y), z.style.setProperty("--char-index", String(y)), z.style.setProperty("--exclusivity-index", String(y)), (P === " " || P === `
|
|
5443
|
+
` || P === " ") && (z.style.whiteSpace = "pre-wrap"), z.textContent = P, y++, z;
|
|
5439
5444
|
}), j = document.createDocumentFragment();
|
|
5440
|
-
return _.forEach((
|
|
5441
|
-
} else if (
|
|
5442
|
-
const
|
|
5443
|
-
return
|
|
5444
|
-
const j =
|
|
5445
|
-
(j instanceof DocumentFragment || j instanceof Node) &&
|
|
5446
|
-
}),
|
|
5447
|
-
}
|
|
5448
|
-
return
|
|
5449
|
-
}
|
|
5450
|
-
const
|
|
5451
|
-
|
|
5452
|
-
if (
|
|
5445
|
+
return _.forEach((P) => j.appendChild(P)), j;
|
|
5446
|
+
} else if (E.nodeType === Node.ELEMENT_NODE) {
|
|
5447
|
+
const T = E.cloneNode(!1);
|
|
5448
|
+
return T.classList.add("container"), T.dataset.index = String(y), T.style.setProperty("--char-index", String(y)), E.childNodes.forEach((_) => {
|
|
5449
|
+
const j = C(_);
|
|
5450
|
+
(j instanceof DocumentFragment || j instanceof Node) && T.appendChild(j);
|
|
5451
|
+
}), T;
|
|
5452
|
+
}
|
|
5453
|
+
return E.cloneNode(!0);
|
|
5454
|
+
}
|
|
5455
|
+
const k = g.body, S = document.createElement("div");
|
|
5456
|
+
k.childNodes.forEach((E) => {
|
|
5457
|
+
if (E.nodeType === Node.TEXT_NODE && !E.textContent?.trim())
|
|
5453
5458
|
return;
|
|
5454
|
-
const
|
|
5455
|
-
(
|
|
5459
|
+
const T = C(E);
|
|
5460
|
+
(T instanceof DocumentFragment || T instanceof Node) && S.appendChild(T);
|
|
5456
5461
|
});
|
|
5457
|
-
let
|
|
5458
|
-
return Array.from(
|
|
5459
|
-
|
|
5460
|
-
}),
|
|
5462
|
+
let J = "";
|
|
5463
|
+
return Array.from(S.childNodes).forEach((E) => {
|
|
5464
|
+
E.nodeType === Node.TEXT_NODE ? J += E.textContent : J += E.outerHTML;
|
|
5465
|
+
}), J;
|
|
5461
5466
|
}
|
|
5462
5467
|
n.splitTextToChars = o;
|
|
5463
5468
|
})(t = l.element || (l.element = {}));
|
|
5464
5469
|
let a;
|
|
5465
5470
|
((n) => {
|
|
5466
|
-
function m(o,
|
|
5467
|
-
const
|
|
5471
|
+
function m(o, d = !0, f = "") {
|
|
5472
|
+
const h = {};
|
|
5468
5473
|
for (const g in o) {
|
|
5469
5474
|
if (!Object.prototype.hasOwnProperty.call(o, g)) continue;
|
|
5470
|
-
const y = o[g],
|
|
5475
|
+
const y = o[g], C = f ? `${f}.${g}` : g;
|
|
5471
5476
|
if (y == null) {
|
|
5472
|
-
|
|
5477
|
+
h[C] = String(y);
|
|
5473
5478
|
continue;
|
|
5474
5479
|
}
|
|
5475
5480
|
if (typeof y == "number" && isNaN(y)) {
|
|
5476
|
-
|
|
5481
|
+
h[C] = "NaN";
|
|
5477
5482
|
continue;
|
|
5478
5483
|
}
|
|
5479
5484
|
if (typeof y == "number" && !isNaN(y)) {
|
|
5480
|
-
|
|
5485
|
+
h[C] = d ? String(y) : y;
|
|
5481
5486
|
continue;
|
|
5482
5487
|
}
|
|
5483
5488
|
if (y instanceof Date) {
|
|
5484
|
-
|
|
5489
|
+
h[C] = y.toISOString();
|
|
5485
5490
|
continue;
|
|
5486
5491
|
}
|
|
5487
5492
|
if (y instanceof Map) {
|
|
5488
|
-
y.forEach((
|
|
5489
|
-
|
|
5493
|
+
y.forEach((k, S) => {
|
|
5494
|
+
h[`${C}.${S}`] = JSON.stringify(k);
|
|
5490
5495
|
});
|
|
5491
5496
|
continue;
|
|
5492
5497
|
}
|
|
5493
5498
|
if (Array.isArray(y)) {
|
|
5494
|
-
y.forEach((
|
|
5495
|
-
const
|
|
5496
|
-
typeof
|
|
5499
|
+
y.forEach((k, S) => {
|
|
5500
|
+
const J = `${C}:${S}`;
|
|
5501
|
+
typeof k == "object" ? Object.assign(h, m(k, d, J)) : h[J] = d ? String(k) : k;
|
|
5497
5502
|
});
|
|
5498
5503
|
continue;
|
|
5499
5504
|
}
|
|
5500
5505
|
if (typeof y == "object") {
|
|
5501
|
-
Object.assign(
|
|
5506
|
+
Object.assign(h, m(y, d, C));
|
|
5502
5507
|
continue;
|
|
5503
5508
|
}
|
|
5504
|
-
|
|
5509
|
+
h[C] = String(y);
|
|
5505
5510
|
}
|
|
5506
|
-
return
|
|
5511
|
+
return h;
|
|
5507
5512
|
}
|
|
5508
5513
|
n.flatten = m;
|
|
5509
5514
|
function c(o) {
|
|
@@ -5519,64 +5524,73 @@ var w;
|
|
|
5519
5524
|
}
|
|
5520
5525
|
n.keys = p;
|
|
5521
5526
|
})(a = l.object || (l.object = {})), ((n) => {
|
|
5522
|
-
function m(o,
|
|
5527
|
+
function m(o, d = M.emotes) {
|
|
5523
5528
|
const f = [];
|
|
5524
|
-
return
|
|
5525
|
-
const g =
|
|
5526
|
-
let y = 0,
|
|
5529
|
+
return d.forEach((h) => {
|
|
5530
|
+
const g = h.name;
|
|
5531
|
+
let y = 0, C = 0;
|
|
5527
5532
|
for (; y < o.length; ) {
|
|
5528
|
-
const
|
|
5529
|
-
if (
|
|
5530
|
-
const
|
|
5531
|
-
/\s/.test(
|
|
5533
|
+
const k = o.indexOf(g, C);
|
|
5534
|
+
if (k === -1) break;
|
|
5535
|
+
const S = k > 0 ? o[k - 1] : " ", J = k + g.length < o.length ? o[k + g.length] : " ";
|
|
5536
|
+
/\s/.test(S) && /\s/.test(J) && f.push({ ...h, start: k, end: k + g.length }), C = k + 1;
|
|
5532
5537
|
}
|
|
5533
|
-
}), f.sort((
|
|
5538
|
+
}), f.sort((h, g) => h.start - g.start);
|
|
5534
5539
|
}
|
|
5535
5540
|
n.findEmotesInText = m;
|
|
5536
|
-
function c(o,
|
|
5537
|
-
if (!
|
|
5538
|
-
let f = "",
|
|
5539
|
-
return
|
|
5540
|
-
f += o.substring(
|
|
5541
|
-
const
|
|
5542
|
-
f += `<img src="${
|
|
5543
|
-
}), f += o.substring(
|
|
5541
|
+
function c(o, d) {
|
|
5542
|
+
if (!d.length) return o;
|
|
5543
|
+
let f = "", h = 0;
|
|
5544
|
+
return d.forEach((g) => {
|
|
5545
|
+
f += o.substring(h, g.start);
|
|
5546
|
+
const C = Array.from({ ...g.urls, length: 5 }).slice(1).reverse().filter(Boolean)[0] || g.urls[1];
|
|
5547
|
+
f += `<img src="${C}" alt="${g.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`, h = g.end;
|
|
5548
|
+
}), f += o.substring(h), f;
|
|
5544
5549
|
}
|
|
5545
5550
|
n.replaceEmotesWithHTML = c;
|
|
5546
|
-
function b(o,
|
|
5547
|
-
return Array.from(o.matchAll(/:(.*?):/gim), (
|
|
5548
|
-
const g =
|
|
5549
|
-
(y) => y.shortcuts.includes(
|
|
5551
|
+
function b(o, d = M.youtube_emotes) {
|
|
5552
|
+
return Array.from(o.matchAll(/:(.*?):/gim), (h) => h[0]).forEach((h) => {
|
|
5553
|
+
const g = d.find(
|
|
5554
|
+
(y) => y.shortcuts.includes(h) || y.searchTerms.includes(h.slice(1, -1))
|
|
5550
5555
|
);
|
|
5551
5556
|
if (g) {
|
|
5552
|
-
const y = g.image.thumbnails.at(-1)?.url,
|
|
5557
|
+
const y = g.image.thumbnails.at(-1)?.url, C = g.image.accessibility.accessibilityData.label;
|
|
5553
5558
|
y && (o = o.replace(
|
|
5554
|
-
|
|
5555
|
-
`<img src="${y}" alt="${
|
|
5559
|
+
h,
|
|
5560
|
+
`<img src="${y}" alt="${C}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`
|
|
5556
5561
|
));
|
|
5557
5562
|
}
|
|
5558
5563
|
}), o;
|
|
5559
5564
|
}
|
|
5560
5565
|
n.replaceYoutubeEmotesWithHTML = b;
|
|
5561
|
-
async function p(o = [],
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5566
|
+
async function p(o = [], d) {
|
|
5567
|
+
!Array.isArray(o) && typeof o == "string" && (o = o.split(",").map((k) => k.trim()));
|
|
5568
|
+
var f = o.map((k) => k.split("/")[0]);
|
|
5569
|
+
if (!f || !f.length) {
|
|
5570
|
+
var h = s.number(1, 3);
|
|
5571
|
+
for await (const k of Array.from({ length: h }, () => "")) {
|
|
5572
|
+
var g = s.array(Object.keys(M.badges))[0];
|
|
5573
|
+
!f.includes(g) && Array.isArray(f) ? f.push(g) : f = [g];
|
|
5574
|
+
}
|
|
5575
|
+
}
|
|
5576
|
+
var y;
|
|
5577
|
+
switch (d) {
|
|
5571
5578
|
case "twitch": {
|
|
5572
|
-
|
|
5573
|
-
keys: Array.from(
|
|
5574
|
-
badges: Array.from(
|
|
5579
|
+
y = {
|
|
5580
|
+
keys: Array.from(f).filter((k) => k in M.badges),
|
|
5581
|
+
badges: Array.from(f).slice(0, 3).map((k) => M.badges[k]).filter(Boolean),
|
|
5582
|
+
amount: o.reduce(
|
|
5583
|
+
(k, S) => {
|
|
5584
|
+
var [J, E = "1"] = S.split("/");
|
|
5585
|
+
return (isNaN(parseInt(E)) || !E.length) && (E = "1"), k[J] = parseInt(E) || 1, k;
|
|
5586
|
+
},
|
|
5587
|
+
{}
|
|
5588
|
+
)
|
|
5575
5589
|
};
|
|
5576
5590
|
break;
|
|
5577
5591
|
}
|
|
5578
5592
|
case "youtube": {
|
|
5579
|
-
var
|
|
5593
|
+
var C = {
|
|
5580
5594
|
verified: { isVerified: !0 },
|
|
5581
5595
|
broadcaster: { isChatOwner: !0 },
|
|
5582
5596
|
host: { isChatOwner: !0 },
|
|
@@ -5584,8 +5598,8 @@ var w;
|
|
|
5584
5598
|
subscriber: { isChatSponsor: !0 },
|
|
5585
5599
|
moderator: { isChatModerator: !0 }
|
|
5586
5600
|
};
|
|
5587
|
-
|
|
5588
|
-
(
|
|
5601
|
+
y = Object.entries(f).reduce(
|
|
5602
|
+
(k, [S]) => (S in C && Object.assign(k, C[S]), k),
|
|
5589
5603
|
{
|
|
5590
5604
|
isVerified: !1,
|
|
5591
5605
|
isChatOwner: !1,
|
|
@@ -5596,7 +5610,7 @@ var w;
|
|
|
5596
5610
|
break;
|
|
5597
5611
|
}
|
|
5598
5612
|
}
|
|
5599
|
-
return
|
|
5613
|
+
return y;
|
|
5600
5614
|
}
|
|
5601
5615
|
n.generateBadges = p;
|
|
5602
5616
|
})(l.message || (l.message = {})), ((n) => {
|
|
@@ -5615,88 +5629,88 @@ var w;
|
|
|
5615
5629
|
"tip-latest",
|
|
5616
5630
|
"event:test",
|
|
5617
5631
|
"event:skip"
|
|
5618
|
-
].some((
|
|
5632
|
+
].some((d) => d === c.listener) && (b = "streamelements"), { provider: b, data: c };
|
|
5619
5633
|
}
|
|
5620
5634
|
n.parseProvider = m;
|
|
5621
5635
|
})(l.event || (l.event = {})), ((n) => {
|
|
5622
5636
|
n.PRESETS = {};
|
|
5623
|
-
async function m(p, o,
|
|
5637
|
+
async function m(p, o, d) {
|
|
5624
5638
|
const f = [];
|
|
5625
5639
|
p.replace(o, (g, ...y) => {
|
|
5626
|
-
const
|
|
5627
|
-
return f.push(Promise.resolve(
|
|
5640
|
+
const C = typeof d == "function" ? d(g, ...y) : g;
|
|
5641
|
+
return f.push(Promise.resolve(C)), g;
|
|
5628
5642
|
});
|
|
5629
|
-
const
|
|
5630
|
-
return p.replace(o, () =>
|
|
5643
|
+
const h = await Promise.all(f);
|
|
5644
|
+
return p.replace(o, () => h.shift() ?? "");
|
|
5631
5645
|
}
|
|
5632
5646
|
n.replace = m;
|
|
5633
5647
|
function c(p) {
|
|
5634
5648
|
return p.charAt(0).toUpperCase() + p.slice(1);
|
|
5635
5649
|
}
|
|
5636
5650
|
n.capitalize = c;
|
|
5637
|
-
function b(p, o = {},
|
|
5651
|
+
function b(p, o = {}, d = {
|
|
5638
5652
|
method: "index",
|
|
5639
5653
|
html: !1,
|
|
5640
5654
|
debug: !1,
|
|
5641
5655
|
modifiers: {},
|
|
5642
5656
|
aliases: {}
|
|
5643
5657
|
}) {
|
|
5644
|
-
const { mergeSpanStyles: f } = t,
|
|
5658
|
+
const { mergeSpanStyles: f } = t, h = (r, u, v) => d.html ? f(r, u, v) : u, g = {
|
|
5645
5659
|
skip: "<br/>",
|
|
5646
5660
|
newline: "<br/>",
|
|
5647
5661
|
...o
|
|
5648
5662
|
};
|
|
5649
|
-
let y = "$",
|
|
5663
|
+
let y = "$", C = "USD";
|
|
5650
5664
|
if (typeof window < "u")
|
|
5651
5665
|
try {
|
|
5652
5666
|
const u = window?.client?.details?.currency;
|
|
5653
|
-
u?.symbol && (y = String(u.symbol)), u?.code && (
|
|
5667
|
+
u?.symbol && (y = String(u.symbol)), u?.code && (C = String(u.code));
|
|
5654
5668
|
} catch {
|
|
5655
5669
|
}
|
|
5656
|
-
const
|
|
5657
|
-
(r, [u,
|
|
5658
|
-
if (r[u] = String(
|
|
5659
|
-
const
|
|
5660
|
-
r.username = r.username ||
|
|
5670
|
+
const k = Object.entries(a.flatten(g)).reduce(
|
|
5671
|
+
(r, [u, v]) => {
|
|
5672
|
+
if (r[u] = String(v), ["username", "name", "nick", "nickname", "sender"].some((x) => u === x)) {
|
|
5673
|
+
const x = r?.username || r?.name || r?.nick || r?.nickname || r?.sender;
|
|
5674
|
+
r.username = r.username || x, r.usernameAt = `@${r.username}`, r.name = r.name || x, r.nick = r.nick || x, r.nickname = r.nickname || x, r.sender = r.sender || x, r.senderAt = `@${r.sender}`;
|
|
5661
5675
|
}
|
|
5662
|
-
return ["amount", "count"].some((
|
|
5676
|
+
return ["amount", "count"].some((x) => u === x) && (r.amount = String(r?.amount || r.count || v), r.count = String(r?.count || r?.amount || v)), r.currency = r.currency || y, r.currencyCode = r.currencyCode || C, r;
|
|
5663
5677
|
},
|
|
5664
5678
|
{}
|
|
5665
|
-
),
|
|
5679
|
+
), S = {
|
|
5666
5680
|
PLACEHOLDERS: /{([^}]+)}/g,
|
|
5667
5681
|
MODIFIERS: /\[([^\]=]+)=([^\]]+)\]/g
|
|
5668
5682
|
};
|
|
5669
|
-
var
|
|
5670
|
-
function
|
|
5671
|
-
const
|
|
5672
|
-
if (!
|
|
5673
|
-
const
|
|
5683
|
+
var J = parseFloat(k?.amount ?? k?.count ?? 0);
|
|
5684
|
+
function E(r, u) {
|
|
5685
|
+
const v = r?.trim?.() ?? "";
|
|
5686
|
+
if (!v.length) return null;
|
|
5687
|
+
const x = u[v], I = parseFloat(String(x !== void 0 ? x : v).replace(/\s/g, ""));
|
|
5674
5688
|
return isNaN(I) ? null : I;
|
|
5675
5689
|
}
|
|
5676
|
-
function
|
|
5677
|
-
const
|
|
5678
|
-
if (
|
|
5690
|
+
function T(r, u, v) {
|
|
5691
|
+
const x = isNaN(Number(u)) ? 0 : Math.max(0, parseInt(String(u))), N = E(r, v);
|
|
5692
|
+
if (N === null) return r;
|
|
5679
5693
|
try {
|
|
5680
|
-
return
|
|
5681
|
-
minimumFractionDigits:
|
|
5682
|
-
maximumFractionDigits:
|
|
5694
|
+
return N.toLocaleString(void 0, {
|
|
5695
|
+
minimumFractionDigits: x,
|
|
5696
|
+
maximumFractionDigits: x
|
|
5683
5697
|
});
|
|
5684
5698
|
} catch {
|
|
5685
|
-
return
|
|
5699
|
+
return N.toFixed(x);
|
|
5686
5700
|
}
|
|
5687
5701
|
}
|
|
5688
5702
|
function _(r, u = /* @__PURE__ */ new Date()) {
|
|
5689
|
-
const
|
|
5690
|
-
return V > 0 ? `${V}y ${
|
|
5703
|
+
const v = u.getTime() - r.getTime(), x = v >= 0, N = Math.abs(v), I = Math.floor(N / 1e3), A = Math.floor(I / 60), H = Math.floor(A / 60), U = Math.floor(H / 24), L = Math.floor(U / 30), V = Math.floor(U / 365), X = x ? "ago" : "from now";
|
|
5704
|
+
return V > 0 ? `${V}y ${X}` : L > 0 ? `${L}mo ${X}` : U > 0 ? `${U}d ${X}` : H > 0 ? `${H}h ${X}` : A > 0 ? `${A}m ${X}` : `${Math.max(I, 0)}s ${X}`;
|
|
5691
5705
|
}
|
|
5692
|
-
function j(r, u,
|
|
5693
|
-
const
|
|
5694
|
-
if (!
|
|
5695
|
-
const
|
|
5706
|
+
function j(r, u, v) {
|
|
5707
|
+
const x = r?.trim?.() ?? "";
|
|
5708
|
+
if (!x.length) return r;
|
|
5709
|
+
const N = v[x] ?? x, I = new Date(N);
|
|
5696
5710
|
if (isNaN(I.getTime())) return r;
|
|
5697
|
-
const
|
|
5711
|
+
const A = (u ?? "date").toString().toLowerCase();
|
|
5698
5712
|
try {
|
|
5699
|
-
switch (
|
|
5713
|
+
switch (A) {
|
|
5700
5714
|
case "time":
|
|
5701
5715
|
return I.toLocaleTimeString();
|
|
5702
5716
|
case "datetime":
|
|
@@ -5714,188 +5728,188 @@ var w;
|
|
|
5714
5728
|
return r;
|
|
5715
5729
|
}
|
|
5716
5730
|
}
|
|
5717
|
-
function
|
|
5718
|
-
const
|
|
5719
|
-
let
|
|
5720
|
-
|
|
5721
|
-
const
|
|
5722
|
-
return isNaN(
|
|
5723
|
-
}
|
|
5724
|
-
function
|
|
5725
|
-
const
|
|
5726
|
-
let
|
|
5727
|
-
for (const
|
|
5728
|
-
const
|
|
5729
|
-
if (
|
|
5730
|
-
const V =
|
|
5731
|
+
function P(r, u, v) {
|
|
5732
|
+
const x = r ?? "", [N, I = N] = x.split("|", 2), A = u?.trim();
|
|
5733
|
+
let H;
|
|
5734
|
+
A && v[A] !== void 0 ? H = v[A] : H = v.amount ?? v.count;
|
|
5735
|
+
const U = parseFloat(String(H));
|
|
5736
|
+
return isNaN(U) ? N : Math.abs(U) !== 1 ? I : N;
|
|
5737
|
+
}
|
|
5738
|
+
function O(r, u, v) {
|
|
5739
|
+
const x = u?.trim() ?? "", N = x && v[x] !== void 0 ? v[x] : "", I = String(N), A = (r ?? "").split("|").map((U) => U.trim()).filter((U) => U.length);
|
|
5740
|
+
let H;
|
|
5741
|
+
for (const U of A) {
|
|
5742
|
+
const L = U.indexOf(":");
|
|
5743
|
+
if (L === -1) continue;
|
|
5744
|
+
const V = U.slice(0, L).trim(), X = U.slice(L + 1);
|
|
5731
5745
|
if (V.length) {
|
|
5732
5746
|
if (V.toLowerCase() === "default") {
|
|
5733
|
-
|
|
5747
|
+
H = X;
|
|
5734
5748
|
continue;
|
|
5735
5749
|
}
|
|
5736
|
-
if (I === V) return
|
|
5750
|
+
if (I === V) return X;
|
|
5737
5751
|
}
|
|
5738
5752
|
}
|
|
5739
|
-
return
|
|
5753
|
+
return H ?? "";
|
|
5740
5754
|
}
|
|
5741
|
-
function
|
|
5755
|
+
function z(r) {
|
|
5742
5756
|
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5743
5757
|
}
|
|
5744
5758
|
function W(r, u) {
|
|
5745
|
-
let
|
|
5746
|
-
if (!
|
|
5747
|
-
const
|
|
5748
|
-
if (
|
|
5749
|
-
return
|
|
5750
|
-
const I =
|
|
5759
|
+
let v = r.trim();
|
|
5760
|
+
if (!v.length) return;
|
|
5761
|
+
const x = v[0], N = v[v.length - 1];
|
|
5762
|
+
if (x === '"' && N === '"' || x === "'" && N === "'")
|
|
5763
|
+
return v.slice(1, -1);
|
|
5764
|
+
const I = v.toLowerCase();
|
|
5751
5765
|
if (I === "true") return !0;
|
|
5752
5766
|
if (I === "false") return !1;
|
|
5753
|
-
if (/^-?\d+(\.\d+)?$/.test(
|
|
5754
|
-
const
|
|
5755
|
-
if (
|
|
5756
|
-
const
|
|
5757
|
-
return
|
|
5767
|
+
if (/^-?\d+(\.\d+)?$/.test(v)) return parseFloat(v);
|
|
5768
|
+
const A = u?.[v];
|
|
5769
|
+
if (A === void 0) return v;
|
|
5770
|
+
const H = String(A).trim(), U = H.toLowerCase();
|
|
5771
|
+
return U === "true" ? !0 : U === "false" ? !1 : /^-?\d+(\.\d+)?$/.test(H) ? parseFloat(H) : A;
|
|
5758
5772
|
}
|
|
5759
|
-
function
|
|
5773
|
+
function D(r) {
|
|
5760
5774
|
if (typeof r == "boolean") return r;
|
|
5761
5775
|
if (r == null) return !1;
|
|
5762
5776
|
const u = String(r).trim().toLowerCase();
|
|
5763
5777
|
return !(!u.length || ["false", "0", "no", "off", "null", "undefined", "nan"].includes(u));
|
|
5764
5778
|
}
|
|
5765
|
-
function
|
|
5766
|
-
let
|
|
5767
|
-
if (!
|
|
5768
|
-
let
|
|
5769
|
-
for (;
|
|
5770
|
-
|
|
5771
|
-
const
|
|
5772
|
-
let I = null,
|
|
5773
|
-
for (const
|
|
5774
|
-
const V =
|
|
5779
|
+
function tt(r, u) {
|
|
5780
|
+
let v = r.trim();
|
|
5781
|
+
if (!v.length) return !1;
|
|
5782
|
+
let x = !1;
|
|
5783
|
+
for (; v.startsWith("!"); )
|
|
5784
|
+
x = !x, v = v.slice(1).trim();
|
|
5785
|
+
const N = ["===", "!==", "==", "!=", ">=", "<=", ">", "<"];
|
|
5786
|
+
let I = null, A = v, H = "";
|
|
5787
|
+
for (const L of N) {
|
|
5788
|
+
const V = v.indexOf(L);
|
|
5775
5789
|
if (V !== -1) {
|
|
5776
|
-
I =
|
|
5790
|
+
I = L, A = v.slice(0, V), H = v.slice(V + L.length);
|
|
5777
5791
|
break;
|
|
5778
5792
|
}
|
|
5779
5793
|
}
|
|
5780
|
-
let
|
|
5794
|
+
let U;
|
|
5781
5795
|
if (I) {
|
|
5782
|
-
const
|
|
5796
|
+
const L = W(A, u), V = W(H, u);
|
|
5783
5797
|
switch (I) {
|
|
5784
5798
|
case "===":
|
|
5785
|
-
|
|
5799
|
+
U = L === V;
|
|
5786
5800
|
break;
|
|
5787
5801
|
case "!==":
|
|
5788
|
-
|
|
5802
|
+
U = L !== V;
|
|
5789
5803
|
break;
|
|
5790
5804
|
case "==":
|
|
5791
|
-
|
|
5805
|
+
U = L == V;
|
|
5792
5806
|
break;
|
|
5793
5807
|
case "!=":
|
|
5794
|
-
|
|
5808
|
+
U = L != V;
|
|
5795
5809
|
break;
|
|
5796
5810
|
case ">=":
|
|
5797
|
-
|
|
5811
|
+
U = L >= V;
|
|
5798
5812
|
break;
|
|
5799
5813
|
case "<=":
|
|
5800
|
-
|
|
5814
|
+
U = L <= V;
|
|
5801
5815
|
break;
|
|
5802
5816
|
case ">":
|
|
5803
|
-
|
|
5817
|
+
U = L > V;
|
|
5804
5818
|
break;
|
|
5805
5819
|
case "<":
|
|
5806
|
-
|
|
5820
|
+
U = L < V;
|
|
5807
5821
|
break;
|
|
5808
5822
|
default:
|
|
5809
|
-
|
|
5823
|
+
U = !1;
|
|
5810
5824
|
break;
|
|
5811
5825
|
}
|
|
5812
5826
|
} else {
|
|
5813
|
-
const
|
|
5814
|
-
|
|
5815
|
-
}
|
|
5816
|
-
return
|
|
5817
|
-
}
|
|
5818
|
-
function
|
|
5819
|
-
let
|
|
5820
|
-
if (!
|
|
5821
|
-
let
|
|
5822
|
-
for (;
|
|
5823
|
-
|
|
5824
|
-
const
|
|
5825
|
-
if (!
|
|
5827
|
+
const L = W(A, u);
|
|
5828
|
+
U = D(L);
|
|
5829
|
+
}
|
|
5830
|
+
return x ? !U : U;
|
|
5831
|
+
}
|
|
5832
|
+
function q(r, u) {
|
|
5833
|
+
let v = r.trim();
|
|
5834
|
+
if (!v.length) return !1;
|
|
5835
|
+
let x = !1;
|
|
5836
|
+
for (; v.startsWith("!"); )
|
|
5837
|
+
x = !x, v = v.slice(1).trim();
|
|
5838
|
+
const N = v.split("||").map((A) => A.trim()).filter((A) => A.length);
|
|
5839
|
+
if (!N.length) return !!x;
|
|
5826
5840
|
let I = !1;
|
|
5827
|
-
for (const
|
|
5828
|
-
const
|
|
5829
|
-
if (!
|
|
5830
|
-
let
|
|
5831
|
-
for (const
|
|
5832
|
-
const V =
|
|
5833
|
-
if (
|
|
5841
|
+
for (const A of N) {
|
|
5842
|
+
const H = A.split("&&").map((L) => L.trim()).filter((L) => L.length);
|
|
5843
|
+
if (!H.length) continue;
|
|
5844
|
+
let U = !0;
|
|
5845
|
+
for (const L of H) {
|
|
5846
|
+
const V = tt(L, u);
|
|
5847
|
+
if (U = U && V, !U) break;
|
|
5834
5848
|
}
|
|
5835
|
-
if (I = I ||
|
|
5836
|
-
}
|
|
5837
|
-
return
|
|
5838
|
-
}
|
|
5839
|
-
const
|
|
5840
|
-
COLOR: (r, u) =>
|
|
5841
|
-
WEIGHT: (r, u) =>
|
|
5842
|
-
SEMIBOLD: (r) =>
|
|
5843
|
-
BOLD: (r) =>
|
|
5844
|
-
BLACK: (r) =>
|
|
5845
|
-
LIGHT: (r) =>
|
|
5846
|
-
STRONG: (r) =>
|
|
5847
|
-
ITALIC: (r) =>
|
|
5848
|
-
UNDERLINE: (r) =>
|
|
5849
|
-
STRIKETHROUGH: (r) =>
|
|
5850
|
-
SUB: (r) =>
|
|
5851
|
-
SUP: (r) =>
|
|
5852
|
-
LARGER: (r) =>
|
|
5853
|
-
SMALL: (r) =>
|
|
5854
|
-
SHADOW: (r, u) =>
|
|
5855
|
-
SIZE: (r, u) =>
|
|
5856
|
-
},
|
|
5849
|
+
if (I = I || U, I) break;
|
|
5850
|
+
}
|
|
5851
|
+
return x ? !I : I;
|
|
5852
|
+
}
|
|
5853
|
+
const F = {
|
|
5854
|
+
COLOR: (r, u) => h(u && i.validate(u) ? `color: ${u}` : "", r, "color"),
|
|
5855
|
+
WEIGHT: (r, u) => h(u && !isNaN(parseInt(u)) ? `font-weight: ${u}` : "", r, "weight"),
|
|
5856
|
+
SEMIBOLD: (r) => h("font-weight: 600", r, "semibold"),
|
|
5857
|
+
BOLD: (r) => h("font-weight: bold", r, "bold"),
|
|
5858
|
+
BLACK: (r) => h("font-weight: 900", r, "black"),
|
|
5859
|
+
LIGHT: (r) => h("font-weight: lighter", r, "light"),
|
|
5860
|
+
STRONG: (r) => h("font-weight: bolder", r, "strong"),
|
|
5861
|
+
ITALIC: (r) => h("font-style: italic", r, "italic"),
|
|
5862
|
+
UNDERLINE: (r) => h("text-decoration: underline", r, "underline"),
|
|
5863
|
+
STRIKETHROUGH: (r) => h("text-decoration: line-through", r, "strikethrough"),
|
|
5864
|
+
SUB: (r) => h("vertical-align: sub", r, "sub"),
|
|
5865
|
+
SUP: (r) => h("vertical-align: super", r, "sup"),
|
|
5866
|
+
LARGER: (r) => h("font-size: larger", r, "larger"),
|
|
5867
|
+
SMALL: (r) => h("font-size: smaller", r, "small"),
|
|
5868
|
+
SHADOW: (r, u) => h(`text-shadow: ${u}`, r, "shadow"),
|
|
5869
|
+
SIZE: (r, u) => h(u ? `font-size: ${u}` : "", r, "size")
|
|
5870
|
+
}, Y = {
|
|
5857
5871
|
...{
|
|
5858
|
-
BT1: (r) =>
|
|
5859
|
-
BT0: (r) =>
|
|
5860
|
-
ST1: (r) =>
|
|
5861
|
-
ST0: (r) =>
|
|
5872
|
+
BT1: (r) => J > 1 ? r : "",
|
|
5873
|
+
BT0: (r) => J > 0 ? r : "",
|
|
5874
|
+
ST1: (r) => J < 1 ? r : "",
|
|
5875
|
+
ST0: (r) => J < 0 ? r : "",
|
|
5862
5876
|
UPC: (r) => r.toUpperCase(),
|
|
5863
5877
|
LOW: (r) => r.toLowerCase(),
|
|
5864
5878
|
REV: (r) => r.split("").reverse().join(""),
|
|
5865
5879
|
CAP: (r) => r.charAt(0).toUpperCase() + r.slice(1).toLowerCase(),
|
|
5866
|
-
NUMBER: (r, u,
|
|
5867
|
-
PLURAL: (r, u,
|
|
5868
|
-
DATE: (r, u,
|
|
5869
|
-
MAP: (r, u,
|
|
5870
|
-
ESCAPE: (r) =>
|
|
5871
|
-
IF: (r, u,
|
|
5872
|
-
const
|
|
5873
|
-
if (!I) return
|
|
5874
|
-
const [
|
|
5875
|
-
return
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
) ?
|
|
5880
|
+
NUMBER: (r, u, v) => T(r, u, v),
|
|
5881
|
+
PLURAL: (r, u, v) => P(r, u, v),
|
|
5882
|
+
DATE: (r, u, v) => j(r, u, v),
|
|
5883
|
+
MAP: (r, u, v) => O(r, u, v),
|
|
5884
|
+
ESCAPE: (r) => z(r),
|
|
5885
|
+
IF: (r, u, v) => {
|
|
5886
|
+
const x = r ?? "", [N, I] = x.split("?", 2);
|
|
5887
|
+
if (!I) return x;
|
|
5888
|
+
const [A, H = ""] = I.split("|", 2);
|
|
5889
|
+
return q(
|
|
5890
|
+
N,
|
|
5891
|
+
v
|
|
5892
|
+
) ? A : H;
|
|
5879
5893
|
},
|
|
5880
5894
|
PRESET: (r, u) => {
|
|
5881
|
-
const
|
|
5882
|
-
if (!
|
|
5883
|
-
const
|
|
5884
|
-
if (!
|
|
5885
|
-
const
|
|
5886
|
-
const [
|
|
5887
|
-
return { name:
|
|
5895
|
+
const v = u?.trim() ?? "";
|
|
5896
|
+
if (!v.length) return r;
|
|
5897
|
+
const x = n.PRESETS[v];
|
|
5898
|
+
if (!x || !x.length) return r;
|
|
5899
|
+
const N = x.split(",").map((A) => A.trim()).filter((A) => A.length).map((A) => {
|
|
5900
|
+
const [H, U] = A.split(":");
|
|
5901
|
+
return { name: H.trim(), param: U?.trim() ?? null };
|
|
5888
5902
|
});
|
|
5889
5903
|
let I = r;
|
|
5890
|
-
for (const { name:
|
|
5891
|
-
I =
|
|
5904
|
+
for (const { name: A, param: H } of N)
|
|
5905
|
+
I = nt(I, A, H);
|
|
5892
5906
|
return I;
|
|
5893
5907
|
},
|
|
5894
5908
|
FALLBACK: (r, u) => r.length ? r : u ?? r
|
|
5895
5909
|
},
|
|
5896
|
-
...
|
|
5897
|
-
...
|
|
5898
|
-
},
|
|
5910
|
+
...d?.html ? F : {},
|
|
5911
|
+
...d.modifiers ?? {}
|
|
5912
|
+
}, ft = {
|
|
5899
5913
|
UPC: ["UPPERCASE", "UPPER", "UPP"],
|
|
5900
5914
|
LOW: ["LOWERCASE", "LOWER", "LWC"],
|
|
5901
5915
|
REV: ["REVERSE", "RVS"],
|
|
@@ -5923,77 +5937,77 @@ var w;
|
|
|
5923
5937
|
SHADOW: ["SHADOW", "SHD"],
|
|
5924
5938
|
FALLBACK: ["FALLBACK", "FB"],
|
|
5925
5939
|
IF: ["IF", "COND", "CONDITION"],
|
|
5926
|
-
...
|
|
5940
|
+
...d.aliases ?? {}
|
|
5927
5941
|
};
|
|
5928
|
-
function
|
|
5929
|
-
const
|
|
5942
|
+
function nt(r, u, v) {
|
|
5943
|
+
const x = Object.entries(ft).find(([I, A]) => A.some((H) => H.toUpperCase() === u.toUpperCase()) ? !0 : I.toUpperCase() === u.toUpperCase()), N = x ? x[0] : u.toUpperCase();
|
|
5930
5944
|
try {
|
|
5931
|
-
return
|
|
5945
|
+
return Y[N] ? Y[N](r, typeof v == "string" ? v.trim() : null, k) : d?.html ? h("", r, N.toLowerCase()) : r;
|
|
5932
5946
|
} catch (I) {
|
|
5933
|
-
return
|
|
5947
|
+
return d?.debug && typeof console < "u" && typeof console.error == "function" && console.error("[Helper.string.compose] Modifier error", { name: u, param: v, error: I }), r;
|
|
5934
5948
|
}
|
|
5935
5949
|
}
|
|
5936
|
-
function
|
|
5937
|
-
let u = r,
|
|
5938
|
-
for (; (
|
|
5939
|
-
const [
|
|
5940
|
-
const [
|
|
5941
|
-
return { name:
|
|
5950
|
+
function dt(r) {
|
|
5951
|
+
let u = r, v;
|
|
5952
|
+
for (; (v = S.MODIFIERS.exec(u)) !== null; ) {
|
|
5953
|
+
const [x, N, I] = v, A = N.split(",").map((U) => U.trim()).filter((U) => U.length).map((U) => {
|
|
5954
|
+
const [L, V] = U.split(":");
|
|
5955
|
+
return { name: L.trim(), param: V?.trim() ?? null };
|
|
5942
5956
|
});
|
|
5943
|
-
let
|
|
5944
|
-
for (const { name:
|
|
5945
|
-
|
|
5946
|
-
u = u.replace(
|
|
5957
|
+
let H = dt(I);
|
|
5958
|
+
for (const { name: U, param: L } of A)
|
|
5959
|
+
H = nt(H, U, L);
|
|
5960
|
+
u = u.replace(x, H ?? ""), S.MODIFIERS.lastIndex = 0;
|
|
5947
5961
|
}
|
|
5948
5962
|
return u;
|
|
5949
5963
|
}
|
|
5950
|
-
function
|
|
5964
|
+
function ht(r) {
|
|
5951
5965
|
let u = 0;
|
|
5952
|
-
const
|
|
5953
|
-
function
|
|
5954
|
-
let
|
|
5955
|
-
for (; u <
|
|
5966
|
+
const v = r.length;
|
|
5967
|
+
function x(I) {
|
|
5968
|
+
let A = "";
|
|
5969
|
+
for (; u < v; )
|
|
5956
5970
|
if (r[u] === "\\")
|
|
5957
|
-
u + 1 <
|
|
5971
|
+
u + 1 < v ? (A += r[u + 1], u += 2) : u++;
|
|
5958
5972
|
else if (r[u] === "[" && (!I || I !== "["))
|
|
5959
|
-
|
|
5973
|
+
A += N();
|
|
5960
5974
|
else if (I && r[u] === I) {
|
|
5961
5975
|
u++;
|
|
5962
5976
|
break;
|
|
5963
5977
|
} else
|
|
5964
|
-
|
|
5965
|
-
return
|
|
5978
|
+
A += r[u++];
|
|
5979
|
+
return A;
|
|
5966
5980
|
}
|
|
5967
|
-
function
|
|
5981
|
+
function N() {
|
|
5968
5982
|
u++;
|
|
5969
5983
|
const I = [];
|
|
5970
|
-
for (; u <
|
|
5984
|
+
for (; u < v && r[u] !== "="; ) {
|
|
5971
5985
|
if (r[u] === ",") {
|
|
5972
5986
|
u++;
|
|
5973
5987
|
continue;
|
|
5974
5988
|
}
|
|
5975
|
-
let
|
|
5976
|
-
for (; u <
|
|
5977
|
-
let
|
|
5989
|
+
let H = "";
|
|
5990
|
+
for (; u < v && /[A-Za-z0-9]/.test(r[u]); ) H += r[u++];
|
|
5991
|
+
let U = null;
|
|
5978
5992
|
if (r[u] === ":") {
|
|
5979
5993
|
u++;
|
|
5980
|
-
const
|
|
5981
|
-
for (; u <
|
|
5982
|
-
|
|
5994
|
+
const L = u;
|
|
5995
|
+
for (; u < v && r[u] !== "," && r[u] !== "="; ) u++;
|
|
5996
|
+
U = r.slice(L, u);
|
|
5983
5997
|
}
|
|
5984
|
-
|
|
5998
|
+
H.length && I.push({ name: H, param: U }), r[u] === "," && u++;
|
|
5985
5999
|
}
|
|
5986
6000
|
r[u] === "=" && u++;
|
|
5987
|
-
const
|
|
5988
|
-
return I.reduce((
|
|
6001
|
+
const A = x("]");
|
|
6002
|
+
return I.reduce((H, { name: U, param: L }) => nt(H, U, L), A);
|
|
5989
6003
|
}
|
|
5990
|
-
return
|
|
6004
|
+
return x();
|
|
5991
6005
|
}
|
|
5992
|
-
let
|
|
5993
|
-
|
|
5994
|
-
(r, u) => typeof
|
|
6006
|
+
let K = p.replace(
|
|
6007
|
+
S.PLACEHOLDERS,
|
|
6008
|
+
(r, u) => typeof k[u] == "string" || typeof k[u] == "number" ? String(k[u]) : u ?? u
|
|
5995
6009
|
);
|
|
5996
|
-
return
|
|
6010
|
+
return K = d.method === "loop" ? dt(K) : ht(K), K;
|
|
5997
6011
|
}
|
|
5998
6012
|
n.compose = b;
|
|
5999
6013
|
})(l.string || (l.string = {})), ((n) => {
|
|
@@ -6003,11 +6017,11 @@ var w;
|
|
|
6003
6017
|
throw new Error("No sound URL provided");
|
|
6004
6018
|
try {
|
|
6005
6019
|
p && n.playing && n.audio && n.audio.state !== "closed" && n.audio.close();
|
|
6006
|
-
let o = new AudioContext(),
|
|
6007
|
-
|
|
6020
|
+
let o = new AudioContext(), d = o.createGain();
|
|
6021
|
+
d.connect(o.destination), p && (n.audio = o, n.playing = !0), fetch(c).then((f) => f.arrayBuffer()).then((f) => o.decodeAudioData(f)).then((f) => {
|
|
6008
6022
|
if (o.state !== "closed") {
|
|
6009
|
-
const
|
|
6010
|
-
|
|
6023
|
+
const h = o.createBufferSource();
|
|
6024
|
+
h.buffer = f, h.connect(d), d.gain.value = b / 100, h.start(o.currentTime);
|
|
6011
6025
|
}
|
|
6012
6026
|
});
|
|
6013
6027
|
} catch (o) {
|
|
@@ -6018,10 +6032,10 @@ var w;
|
|
|
6018
6032
|
})(l.sound || (l.sound = {}));
|
|
6019
6033
|
let i;
|
|
6020
6034
|
((n) => {
|
|
6021
|
-
function m(o = 100,
|
|
6022
|
-
|
|
6035
|
+
function m(o = 100, d = "") {
|
|
6036
|
+
d = d.length > 7 ? d?.substring(0, 6) : d, o = o > 1 ? o / 100 : o;
|
|
6023
6037
|
let f = Math.round(Math.min(Math.max(o, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
|
|
6024
|
-
return
|
|
6038
|
+
return d + f;
|
|
6025
6039
|
}
|
|
6026
6040
|
n.opacity = m;
|
|
6027
6041
|
function c(o) {
|
|
@@ -6030,42 +6044,42 @@ var w;
|
|
|
6030
6044
|
color: o,
|
|
6031
6045
|
opacity: 100
|
|
6032
6046
|
};
|
|
6033
|
-
var
|
|
6047
|
+
var h = o.slice(-2), d = parseInt(h, 16) / 255, f = Math.round(d * 100), h = o.length > 7 ? o.slice(0, 7) : o;
|
|
6034
6048
|
return {
|
|
6035
|
-
color:
|
|
6049
|
+
color: h,
|
|
6036
6050
|
opacity: f
|
|
6037
6051
|
};
|
|
6038
6052
|
}
|
|
6039
6053
|
n.extract = c;
|
|
6040
6054
|
function b(o) {
|
|
6041
6055
|
if (typeof o != "string" || !String(o).trim().length) return !1;
|
|
6042
|
-
const
|
|
6043
|
-
return /^#([A-Fa-f0-9]{3}){1,2}$/.test(
|
|
6056
|
+
const d = o.trim();
|
|
6057
|
+
return /^#([A-Fa-f0-9]{3}){1,2}$/.test(d) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(d) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(d) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(d) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(d) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(d) ? "hsla" : M.css_color_names.includes(d.toLowerCase()) ? "css-color-name" : !1;
|
|
6044
6058
|
}
|
|
6045
6059
|
n.validate = b;
|
|
6046
|
-
async function p(o,
|
|
6060
|
+
async function p(o, d) {
|
|
6047
6061
|
const f = b(o);
|
|
6048
6062
|
if (!f) throw new Error(`Invalid color format: ${o}`);
|
|
6049
|
-
if (f ===
|
|
6050
|
-
const
|
|
6051
|
-
if (!
|
|
6052
|
-
switch (
|
|
6063
|
+
if (f === d) throw new Error(`Color is already in the desired format: ${d}`);
|
|
6064
|
+
const h = bt(o.trim(), f);
|
|
6065
|
+
if (!h) throw new Error(`Failed to parse color: ${o}`);
|
|
6066
|
+
switch (d) {
|
|
6053
6067
|
case "hex":
|
|
6054
|
-
return
|
|
6068
|
+
return yt(h, !1);
|
|
6055
6069
|
case "rgb":
|
|
6056
|
-
return `rgb(${
|
|
6070
|
+
return `rgb(${h.r}, ${h.g}, ${h.b})`;
|
|
6057
6071
|
case "rgba":
|
|
6058
|
-
return `rgba(${
|
|
6072
|
+
return `rgba(${h.r}, ${h.g}, ${h.b}, ${h.a})`;
|
|
6059
6073
|
case "hsl": {
|
|
6060
|
-
const g = lt(
|
|
6074
|
+
const g = lt(h.r, h.g, h.b);
|
|
6061
6075
|
return `hsl(${g.h}, ${g.s}%, ${g.l}%)`;
|
|
6062
6076
|
}
|
|
6063
6077
|
case "hsla": {
|
|
6064
|
-
const g = lt(
|
|
6065
|
-
return `hsla(${g.h}, ${g.s}%, ${g.l}%, ${
|
|
6078
|
+
const g = lt(h.r, h.g, h.b);
|
|
6079
|
+
return `hsla(${g.h}, ${g.s}%, ${g.l}%, ${h.a})`;
|
|
6066
6080
|
}
|
|
6067
6081
|
case "css-color-name":
|
|
6068
|
-
return await
|
|
6082
|
+
return await vt(h.r, h.g, h.b);
|
|
6069
6083
|
default:
|
|
6070
6084
|
return null;
|
|
6071
6085
|
}
|
|
@@ -6080,36 +6094,36 @@ var w;
|
|
|
6080
6094
|
case "hex":
|
|
6081
6095
|
return `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
|
|
6082
6096
|
case "hexa": {
|
|
6083
|
-
const
|
|
6084
|
-
return
|
|
6097
|
+
const C = `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`, k = Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
|
|
6098
|
+
return C + k;
|
|
6085
6099
|
}
|
|
6086
6100
|
case "rgb": {
|
|
6087
|
-
const
|
|
6088
|
-
return `rgb(${
|
|
6101
|
+
const C = Math.floor(Math.random() * 256), k = Math.floor(Math.random() * 256), S = Math.floor(Math.random() * 256);
|
|
6102
|
+
return `rgb(${C}, ${k}, ${S})`;
|
|
6089
6103
|
}
|
|
6090
6104
|
case "rgba": {
|
|
6091
|
-
const
|
|
6092
|
-
return `rgba(${
|
|
6105
|
+
const C = Math.floor(Math.random() * 256), k = Math.floor(Math.random() * 256), S = Math.floor(Math.random() * 256), J = Math.random().toFixed(2);
|
|
6106
|
+
return `rgba(${C}, ${k}, ${S}, ${J})`;
|
|
6093
6107
|
}
|
|
6094
6108
|
case "hsl": {
|
|
6095
|
-
const
|
|
6096
|
-
return `hsl(${
|
|
6109
|
+
const C = Math.floor(Math.random() * 361), k = Math.floor(Math.random() * 101), S = Math.floor(Math.random() * 101);
|
|
6110
|
+
return `hsl(${C}, ${k}%, ${S}%)`;
|
|
6097
6111
|
}
|
|
6098
6112
|
case "hsla": {
|
|
6099
|
-
const
|
|
6100
|
-
return `hsla(${
|
|
6113
|
+
const C = Math.floor(Math.random() * 361), k = Math.floor(Math.random() * 101), S = Math.floor(Math.random() * 101), J = Math.random().toFixed(2);
|
|
6114
|
+
return `hsla(${C}, ${k}%, ${S}%, ${J})`;
|
|
6101
6115
|
}
|
|
6102
6116
|
case "css-color-name": {
|
|
6103
|
-
var y =
|
|
6117
|
+
var y = M.css_color_names;
|
|
6104
6118
|
return o(y)[0];
|
|
6105
6119
|
}
|
|
6106
6120
|
}
|
|
6107
6121
|
}
|
|
6108
6122
|
n.color = m;
|
|
6109
|
-
function c(g, y,
|
|
6123
|
+
function c(g, y, C = 0) {
|
|
6110
6124
|
g > y && ([g, y] = [y, g]);
|
|
6111
|
-
const
|
|
6112
|
-
return
|
|
6125
|
+
const k = Math.random() * (y - g) + g;
|
|
6126
|
+
return C ? Number(k.toFixed(C)) : Math.round(k);
|
|
6113
6127
|
}
|
|
6114
6128
|
n.number = c;
|
|
6115
6129
|
function b(g = 0.5) {
|
|
@@ -6117,10 +6131,10 @@ var w;
|
|
|
6117
6131
|
}
|
|
6118
6132
|
n.boolean = b;
|
|
6119
6133
|
function p(g, y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
|
|
6120
|
-
let
|
|
6121
|
-
for (let
|
|
6122
|
-
|
|
6123
|
-
return
|
|
6134
|
+
let C = "";
|
|
6135
|
+
for (let k = 0; k < g; k++)
|
|
6136
|
+
C += y.charAt(Math.floor(Math.random() * y.length));
|
|
6137
|
+
return C;
|
|
6124
6138
|
}
|
|
6125
6139
|
n.string = p;
|
|
6126
6140
|
function o(g) {
|
|
@@ -6128,19 +6142,19 @@ var w;
|
|
|
6128
6142
|
return [g[y], y];
|
|
6129
6143
|
}
|
|
6130
6144
|
n.array = o;
|
|
6131
|
-
function
|
|
6145
|
+
function d(g = new Date(2e3, 0, 1), y = /* @__PURE__ */ new Date()) {
|
|
6132
6146
|
return new Date(c(g.getTime(), y.getTime()));
|
|
6133
6147
|
}
|
|
6134
|
-
n.date =
|
|
6148
|
+
n.date = d;
|
|
6135
6149
|
function f(g) {
|
|
6136
|
-
const
|
|
6137
|
-
return new Date(
|
|
6150
|
+
const C = Date.now() - c(0, g * 24 * 60 * 60 * 1e3);
|
|
6151
|
+
return new Date(C).toISOString();
|
|
6138
6152
|
}
|
|
6139
6153
|
n.daysOffset = f;
|
|
6140
|
-
function
|
|
6154
|
+
function h() {
|
|
6141
6155
|
return crypto.randomUUID();
|
|
6142
6156
|
}
|
|
6143
|
-
n.uuid =
|
|
6157
|
+
n.uuid = h;
|
|
6144
6158
|
})(s = l.random || (l.random = {})), ((n) => {
|
|
6145
6159
|
function m(b, p, o) {
|
|
6146
6160
|
return b.apply(p, o);
|
|
@@ -6151,42 +6165,42 @@ var w;
|
|
|
6151
6165
|
}
|
|
6152
6166
|
n.call = c;
|
|
6153
6167
|
})(l.fn || (l.fn = {})), ((n) => {
|
|
6154
|
-
function m(
|
|
6168
|
+
function m(d, f) {
|
|
6155
6169
|
return new Promise(
|
|
6156
|
-
(
|
|
6170
|
+
(h) => setTimeout(() => {
|
|
6157
6171
|
if (f) {
|
|
6158
6172
|
const g = f();
|
|
6159
|
-
|
|
6160
|
-
} else
|
|
6161
|
-
},
|
|
6173
|
+
h(g ?? null);
|
|
6174
|
+
} else h(null);
|
|
6175
|
+
}, d)
|
|
6162
6176
|
);
|
|
6163
6177
|
}
|
|
6164
6178
|
n.delay = m;
|
|
6165
|
-
function c(
|
|
6166
|
-
return Object.entries(
|
|
6179
|
+
function c(d) {
|
|
6180
|
+
return Object.entries(d);
|
|
6167
6181
|
}
|
|
6168
6182
|
n.typedEntries = c;
|
|
6169
|
-
function b(
|
|
6170
|
-
return Object.values(
|
|
6183
|
+
function b(d) {
|
|
6184
|
+
return Object.values(d);
|
|
6171
6185
|
}
|
|
6172
6186
|
n.typedValues = b;
|
|
6173
|
-
function p(
|
|
6174
|
-
return Object.keys(
|
|
6187
|
+
function p(d) {
|
|
6188
|
+
return Object.keys(d);
|
|
6175
6189
|
}
|
|
6176
6190
|
n.typedKeys = p;
|
|
6177
|
-
function o(
|
|
6178
|
-
const f = Object.values(
|
|
6191
|
+
function o(d) {
|
|
6192
|
+
const f = Object.values(d).reduce((C, k) => C + k, 0), h = c(d).sort((C, k) => k[1] - C[1]), g = Math.random() * f;
|
|
6179
6193
|
let y = 0;
|
|
6180
|
-
for (const [
|
|
6181
|
-
if (y +=
|
|
6182
|
-
return
|
|
6194
|
+
for (const [C, k] of h)
|
|
6195
|
+
if (y += k, g < y)
|
|
6196
|
+
return C;
|
|
6183
6197
|
}
|
|
6184
6198
|
n.probability = o;
|
|
6185
6199
|
})(l.utils || (l.utils = {}));
|
|
6186
6200
|
})(w || (w = {}));
|
|
6187
|
-
class
|
|
6201
|
+
class st {
|
|
6188
6202
|
constructor(e) {
|
|
6189
|
-
this.field = "button", this.template = "button", this.name = "Button", this.value = "", window.client instanceof
|
|
6203
|
+
this.field = "button", this.template = "button", this.name = "Button", this.value = "", window.client instanceof G && (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, window.client.actions.buttons.push(this), window.client.emit("action", this, "created"));
|
|
6190
6204
|
}
|
|
6191
6205
|
generate(e) {
|
|
6192
6206
|
return w.utils.typedValues(e).reduce(
|
|
@@ -6196,37 +6210,48 @@ class at {
|
|
|
6196
6210
|
type: "button",
|
|
6197
6211
|
label: m
|
|
6198
6212
|
};
|
|
6199
|
-
let c = w.string.compose(
|
|
6213
|
+
let c = w.string.compose(
|
|
6214
|
+
String(this.value),
|
|
6215
|
+
{ index: s, ...i },
|
|
6216
|
+
{ html: !1 }
|
|
6217
|
+
);
|
|
6200
6218
|
return isNaN(Number(c)) ? c.toLowerCase() === "true" ? c = !0 : c.toLowerCase() === "false" && (c = !1) : c = Number(c), typeof c < "u" && c && (typeof c != "string" || c.length) && (a[n].value = c), a;
|
|
6201
6219
|
},
|
|
6202
6220
|
{}
|
|
6203
6221
|
);
|
|
6204
6222
|
}
|
|
6205
6223
|
parse(e, t) {
|
|
6206
|
-
var a = e.replace(
|
|
6224
|
+
var a = e.replace(
|
|
6225
|
+
typeof this.field == "string" ? this.field : this.template.replace(/\{[^}]*\}/g, "") ?? "",
|
|
6226
|
+
""
|
|
6227
|
+
).trim();
|
|
6207
6228
|
try {
|
|
6208
6229
|
this.run.apply(window.client, [a.length ? a : e ?? e, t]);
|
|
6209
6230
|
} catch (i) {
|
|
6210
|
-
throw new Error(
|
|
6231
|
+
throw new Error(
|
|
6232
|
+
`Error running button "${this.field}": ${i instanceof Error ? i.message : i}`
|
|
6233
|
+
);
|
|
6211
6234
|
}
|
|
6212
6235
|
return this;
|
|
6213
6236
|
}
|
|
6214
6237
|
remove() {
|
|
6215
|
-
if (!(window.client instanceof
|
|
6238
|
+
if (!(window.client instanceof G)) return;
|
|
6216
6239
|
const e = window.client.actions.buttons.indexOf(this);
|
|
6217
6240
|
e > -1 && (window.client.actions.buttons.splice(e, 1), window.client.emit("action", this, "removed"));
|
|
6218
6241
|
}
|
|
6219
6242
|
static execute(e, t) {
|
|
6220
6243
|
try {
|
|
6221
|
-
if (!(window.client instanceof
|
|
6244
|
+
if (!(window.client instanceof G)) return !1;
|
|
6222
6245
|
if (window.client.actions.buttons.length) {
|
|
6223
6246
|
const a = window.client.actions.buttons.filter((i) => typeof i.field == "string" ? i.field === e : typeof i.field == "function" ? i.field(e, t) : !1);
|
|
6224
|
-
if (a.length && a.every((i) => i instanceof
|
|
6247
|
+
if (a.length && a.every((i) => i instanceof st))
|
|
6225
6248
|
return a.forEach((i) => {
|
|
6226
6249
|
try {
|
|
6227
|
-
i.parse(e, t), window
|
|
6250
|
+
i.parse(e, t), window?.client?.emit("action", i, "executed"), R.received(`Button executed: ${e}${t ? ` with value: ${t}` : ""}`);
|
|
6228
6251
|
} catch (s) {
|
|
6229
|
-
|
|
6252
|
+
R.error(
|
|
6253
|
+
`Error executing button "${e}": ${s instanceof Error ? s.message : s}`
|
|
6254
|
+
);
|
|
6230
6255
|
}
|
|
6231
6256
|
}), !0;
|
|
6232
6257
|
}
|
|
@@ -6237,10 +6262,10 @@ class at {
|
|
|
6237
6262
|
}
|
|
6238
6263
|
}
|
|
6239
6264
|
}
|
|
6240
|
-
const
|
|
6241
|
-
class
|
|
6265
|
+
const it = [];
|
|
6266
|
+
class Dt extends Z {
|
|
6242
6267
|
constructor(e = {}) {
|
|
6243
|
-
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,
|
|
6268
|
+
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, it.push(this), ct?.then(async (t) => {
|
|
6244
6269
|
this.loaded = !0, this.SE_API = t, Promise.all([
|
|
6245
6270
|
async () => {
|
|
6246
6271
|
const a = await t.store.get(this.id);
|
|
@@ -6277,7 +6302,7 @@ class St extends X {
|
|
|
6277
6302
|
}
|
|
6278
6303
|
typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) => {
|
|
6279
6304
|
const { detail: e } = l;
|
|
6280
|
-
if (window.client instanceof
|
|
6305
|
+
if (window.client instanceof G && client instanceof G && client) {
|
|
6281
6306
|
const t = window.client;
|
|
6282
6307
|
if (t.fields = e.fieldData, t.session = e.session.data, t.details = {
|
|
6283
6308
|
...t.details,
|
|
@@ -6291,18 +6316,18 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6291
6316
|
}).catch(() => {
|
|
6292
6317
|
t.details.provider = "local";
|
|
6293
6318
|
}) : t.details.provider = "local", t.emit("load", e), t.debug) {
|
|
6294
|
-
|
|
6319
|
+
R.received("Widget loaded!", l.detail);
|
|
6295
6320
|
const a = l.detail.fieldData;
|
|
6296
|
-
Object.keys(a).length &&
|
|
6321
|
+
Object.keys(a).length && R.received("Field data:", a);
|
|
6297
6322
|
}
|
|
6298
6323
|
t.loaded = !0, t.storage.on("load", (a) => {
|
|
6299
|
-
if (t.debug && a ?
|
|
6324
|
+
if (t.debug && a ? R.debug(
|
|
6300
6325
|
"[Client]",
|
|
6301
6326
|
"Storage loaded for client",
|
|
6302
6327
|
`"${t.id}";`,
|
|
6303
6328
|
`Provider: "${t.details.provider}";`,
|
|
6304
6329
|
a
|
|
6305
|
-
) : t.debug &&
|
|
6330
|
+
) : t.debug && R.debug(
|
|
6306
6331
|
"[Client]",
|
|
6307
6332
|
"Storage loaded for client",
|
|
6308
6333
|
`"${t.id}";`,
|
|
@@ -6311,10 +6336,10 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6311
6336
|
), a) {
|
|
6312
6337
|
const i = (b) => {
|
|
6313
6338
|
const p = Date.now(), o = {};
|
|
6314
|
-
for (const
|
|
6315
|
-
if (b.hasOwnProperty(
|
|
6316
|
-
const f = b[
|
|
6317
|
-
f.expire && f.expire > p && (o[
|
|
6339
|
+
for (const d in b)
|
|
6340
|
+
if (b.hasOwnProperty(d)) {
|
|
6341
|
+
const f = b[d];
|
|
6342
|
+
f.expire && f.expire > p && (o[d] = f);
|
|
6318
6343
|
}
|
|
6319
6344
|
return o;
|
|
6320
6345
|
}, s = i(a.user || {}), n = i(a.avatar || {}), m = i(a.pronoun || {}), c = i(a.emote || {});
|
|
@@ -6334,12 +6359,12 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6334
6359
|
}
|
|
6335
6360
|
}), window.addEventListener("onSessionUpdate", (l) => {
|
|
6336
6361
|
const { detail: e } = l;
|
|
6337
|
-
if (window.client instanceof
|
|
6362
|
+
if (window.client instanceof G && client instanceof G && client) {
|
|
6338
6363
|
const t = window.client;
|
|
6339
|
-
t.session = e.session, t.emit("session", e.session), t.debug &&
|
|
6364
|
+
t.session = e.session, t.emit("session", e.session), t.debug && R.debug("[Client]", "Session updated", e.session);
|
|
6340
6365
|
}
|
|
6341
6366
|
}), window.addEventListener("onEventReceived", ({ detail: l }) => {
|
|
6342
|
-
if (window.client instanceof
|
|
6367
|
+
if (window.client instanceof G && client instanceof G && client) {
|
|
6343
6368
|
const t = w.event.parseProvider(l);
|
|
6344
6369
|
switch (t.provider) {
|
|
6345
6370
|
case "streamelements": {
|
|
@@ -6357,7 +6382,7 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6357
6382
|
switch (i.event.listener) {
|
|
6358
6383
|
case "widget-button": {
|
|
6359
6384
|
const s = i.event;
|
|
6360
|
-
|
|
6385
|
+
st.execute(s.field, s.value);
|
|
6361
6386
|
break;
|
|
6362
6387
|
}
|
|
6363
6388
|
case "subscriber-latest": {
|
|
@@ -6369,14 +6394,14 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6369
6394
|
}
|
|
6370
6395
|
case "kvstore:update": {
|
|
6371
6396
|
const s = i.event;
|
|
6372
|
-
if (
|
|
6373
|
-
var e =
|
|
6397
|
+
if (et.length) {
|
|
6398
|
+
var e = et.find(
|
|
6374
6399
|
(n) => n.id === s.data.key.replace("customWidget.", "") || n.id === s.data.key
|
|
6375
6400
|
);
|
|
6376
6401
|
e && e.update(s.data.value);
|
|
6377
6402
|
}
|
|
6378
|
-
if (
|
|
6379
|
-
const n =
|
|
6403
|
+
if (it.length) {
|
|
6404
|
+
const n = it.find(
|
|
6380
6405
|
(m) => m.id === s.data.key.replace("customWidget.", "") || m.id === s.data.key
|
|
6381
6406
|
);
|
|
6382
6407
|
n && n.update(s.data.value);
|
|
@@ -6408,7 +6433,7 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6408
6433
|
break;
|
|
6409
6434
|
}
|
|
6410
6435
|
case "message": {
|
|
6411
|
-
i.event,
|
|
6436
|
+
i.event, $.execute({ provider: "twitch", data: i });
|
|
6412
6437
|
break;
|
|
6413
6438
|
}
|
|
6414
6439
|
case "follower-latest": {
|
|
@@ -6435,7 +6460,7 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6435
6460
|
const i = t.data;
|
|
6436
6461
|
switch (i.listener) {
|
|
6437
6462
|
case "message": {
|
|
6438
|
-
i.event,
|
|
6463
|
+
i.event, $.execute({ provider: "youtube", data: i });
|
|
6439
6464
|
break;
|
|
6440
6465
|
}
|
|
6441
6466
|
case "subscriber-latest": {
|
|
@@ -6471,21 +6496,21 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6471
6496
|
"event:test",
|
|
6472
6497
|
"kvstore:update"
|
|
6473
6498
|
];
|
|
6474
|
-
client.debug && !a.some((i) => i === t.data.listener) &&
|
|
6499
|
+
client.debug && !a.some((i) => i === t.data.listener) && R.received(
|
|
6475
6500
|
"[Client]",
|
|
6476
6501
|
`Event ${t.data.listener} received from ${t.provider}`,
|
|
6477
6502
|
t.data.event
|
|
6478
6503
|
);
|
|
6479
6504
|
}
|
|
6480
6505
|
}));
|
|
6481
|
-
class gt extends
|
|
6506
|
+
class gt extends Z {
|
|
6482
6507
|
constructor(e) {
|
|
6483
6508
|
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")
|
|
6484
6509
|
throw new Error("A valid processor function must be provided to useQueue.");
|
|
6485
6510
|
this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0), this.waitForClientAndBindLoad(e.duration);
|
|
6486
6511
|
}
|
|
6487
6512
|
waitForClientAndBindLoad(e = this.duration, t) {
|
|
6488
|
-
if (!(window?.client instanceof
|
|
6513
|
+
if (!(window?.client instanceof G)) {
|
|
6489
6514
|
setTimeout(
|
|
6490
6515
|
() => this.waitForClientAndBindLoad(e, t),
|
|
6491
6516
|
this.clientWaitRetryDelay
|
|
@@ -6493,7 +6518,7 @@ class gt extends X {
|
|
|
6493
6518
|
return;
|
|
6494
6519
|
}
|
|
6495
6520
|
window.client.on("load", () => {
|
|
6496
|
-
e === "client" && (this.duration = window
|
|
6521
|
+
e === "client" && (this.duration = window?.client?.fields?.widgetDuration ?? 0), this.emit("load"), this.loaded = !0, t && t();
|
|
6497
6522
|
});
|
|
6498
6523
|
}
|
|
6499
6524
|
enqueue(e, t = {}) {
|
|
@@ -6526,7 +6551,7 @@ class gt extends X {
|
|
|
6526
6551
|
try {
|
|
6527
6552
|
await this.processor.apply(this, [e.value, this]), this.emit("process", e, this);
|
|
6528
6553
|
} catch (a) {
|
|
6529
|
-
|
|
6554
|
+
R.error(
|
|
6530
6555
|
`Error during item processing: ${a instanceof Error ? a.message : String(a)}`
|
|
6531
6556
|
);
|
|
6532
6557
|
}
|
|
@@ -6579,14 +6604,14 @@ class gt extends X {
|
|
|
6579
6604
|
return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
|
|
6580
6605
|
}
|
|
6581
6606
|
}
|
|
6582
|
-
var
|
|
6607
|
+
var B;
|
|
6583
6608
|
((l) => {
|
|
6584
6609
|
l.queue = new gt({
|
|
6585
6610
|
duration: "client",
|
|
6586
6611
|
processor: async function(a) {
|
|
6587
|
-
if (window.dispatchEvent(new CustomEvent(a.listener, { detail: a.data })), a.listener === "onEventReceived" && a.session
|
|
6612
|
+
if (window.dispatchEvent(new CustomEvent(a.listener, { detail: a.data })), a.listener === "onEventReceived" && a.session) {
|
|
6588
6613
|
const i = await l.generate.event.onSessionUpdate(
|
|
6589
|
-
window?.client?.session,
|
|
6614
|
+
window?.client && window?.client instanceof G ? window.client.session : void 0,
|
|
6590
6615
|
w.event.parseProvider(a.data)
|
|
6591
6616
|
);
|
|
6592
6617
|
window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: i }));
|
|
@@ -6595,11 +6620,11 @@ var G;
|
|
|
6595
6620
|
}), l.generate = {
|
|
6596
6621
|
session: {
|
|
6597
6622
|
types: {
|
|
6598
|
-
name: { type: "string", options:
|
|
6599
|
-
tier: { type: "string", options:
|
|
6600
|
-
message: { type: "string", options:
|
|
6601
|
-
item: { type: "array", options:
|
|
6602
|
-
avatar: { type: "string", options:
|
|
6623
|
+
name: { type: "string", options: M.names.filter((t) => t.length) },
|
|
6624
|
+
tier: { type: "string", options: M.tiers.filter((t) => t.length) },
|
|
6625
|
+
message: { type: "string", options: M.messages.filter((t) => t.length) },
|
|
6626
|
+
item: { type: "array", options: M.items },
|
|
6627
|
+
avatar: { type: "string", options: M.avatars.filter((t) => t.length) }
|
|
6603
6628
|
},
|
|
6604
6629
|
available() {
|
|
6605
6630
|
const t = this.types;
|
|
@@ -6973,16 +6998,16 @@ var G;
|
|
|
6973
6998
|
const m = (p) => {
|
|
6974
6999
|
if (!p || !("amount" in p)) return [];
|
|
6975
7000
|
const o = [];
|
|
6976
|
-
for (let
|
|
7001
|
+
for (let d = 0; d < p.amount; d++)
|
|
6977
7002
|
o.push(i(p.value));
|
|
6978
7003
|
return o.sort(
|
|
6979
|
-
(
|
|
7004
|
+
(d, f) => new Date(f.createdAt).getTime() - new Date(d.createdAt).getTime()
|
|
6980
7005
|
);
|
|
6981
7006
|
}, c = (p) => {
|
|
6982
7007
|
const o = {};
|
|
6983
|
-
for (const
|
|
6984
|
-
const f =
|
|
6985
|
-
o[f] = i(p[
|
|
7008
|
+
for (const d in p) {
|
|
7009
|
+
const f = d.replace("_type", "type");
|
|
7010
|
+
o[f] = i(p[d]);
|
|
6986
7011
|
}
|
|
6987
7012
|
return o;
|
|
6988
7013
|
}, b = (p) => {
|
|
@@ -7078,8 +7103,8 @@ var G;
|
|
|
7078
7103
|
}
|
|
7079
7104
|
const o = t[`cheer-${p}-top-donation`];
|
|
7080
7105
|
o && n > o.amount && (o.amount = n, o.name = m);
|
|
7081
|
-
const
|
|
7082
|
-
|
|
7106
|
+
const d = t[`cheer-${p}-top-donator`], f = t["cheer-recent"].filter((g) => g.name.toLowerCase() === d.name.toLowerCase()).reduce((g, y) => g + y.amount, 0), h = t["cheer-recent"].filter((g) => g.name.toLowerCase() === m.toLowerCase()).reduce((g, y) => g + y.amount, 0);
|
|
7107
|
+
h > f && (d.amount = h, d.name = m);
|
|
7083
7108
|
};
|
|
7084
7109
|
b("all"), t["cheer-session"].amount += n, t["cheer-week"].amount += n, t["cheer-month"].amount += n, t["cheer-total"].amount += n, t["cheer-count"].count += 1, t["cheer-goal"].amount += n, t["cheer-recent"].unshift({
|
|
7085
7110
|
name: m,
|
|
@@ -7156,8 +7181,8 @@ var G;
|
|
|
7156
7181
|
}
|
|
7157
7182
|
const p = t[`superchat-${b}-top-donation`];
|
|
7158
7183
|
p && m > p.amount && (p.amount = m, p.name = n);
|
|
7159
|
-
const o = t[`superchat-${b}-top-donator`],
|
|
7160
|
-
f >
|
|
7184
|
+
const o = t[`superchat-${b}-top-donator`], d = t["superchat-recent"].filter((h) => h.name.toLowerCase() === o.name.toLowerCase()).reduce((h, g) => h + g.amount, 0), f = t["superchat-recent"].filter((h) => h.name.toLowerCase() === n.toLowerCase()).reduce((h, g) => h + g.amount, 0);
|
|
7185
|
+
f > d && (o.amount = f, o.name = n);
|
|
7161
7186
|
};
|
|
7162
7187
|
c("all"), t["superchat-session"].amount += m, t["superchat-week"].amount += m, t["superchat-month"].amount += m, t["superchat-total"].amount += m, t["superchat-count"].count += 1, t["superchat-goal"].amount += m, t["superchat-recent"].unshift({
|
|
7163
7188
|
name: n.toLowerCase(),
|
|
@@ -7185,8 +7210,8 @@ var G;
|
|
|
7185
7210
|
}
|
|
7186
7211
|
const p = t[`tip-${b}-top-donation`];
|
|
7187
7212
|
p && m > p.amount && (p.amount = m, p.name = n);
|
|
7188
|
-
const o = t[`tip-${b}-top-donator`],
|
|
7189
|
-
f >
|
|
7213
|
+
const o = t[`tip-${b}-top-donator`], d = t["tip-recent"].filter((h) => h.name.toLowerCase() === o.name.toLowerCase()).reduce((h, g) => h + g.amount, 0), f = t["tip-recent"].filter((h) => h.name.toLowerCase() === n.toLowerCase()).reduce((h, g) => h + g.amount, 0);
|
|
7214
|
+
f > d && (o.amount = f, o.name = n);
|
|
7190
7215
|
};
|
|
7191
7216
|
c("all"), t["tip-session"].amount += m, t["tip-week"].amount += m, t["tip-month"].amount += m, t["tip-total"].amount += m, t["tip-count"].count += 1, t["tip-goal"].amount += m, t["tip-recent"].unshift({
|
|
7192
7217
|
name: n,
|
|
@@ -7233,7 +7258,7 @@ var G;
|
|
|
7233
7258
|
default:
|
|
7234
7259
|
case "random": {
|
|
7235
7260
|
var n = w.random.array(
|
|
7236
|
-
Object.keys(s).filter((
|
|
7261
|
+
Object.keys(s).filter((D) => s[D].length)
|
|
7237
7262
|
)[0], m = w.random.array(
|
|
7238
7263
|
s[n]
|
|
7239
7264
|
)[0];
|
|
@@ -7249,10 +7274,22 @@ var G;
|
|
|
7249
7274
|
return this.onEventReceived(t, m);
|
|
7250
7275
|
}
|
|
7251
7276
|
case "message": {
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7277
|
+
const D = i;
|
|
7278
|
+
var c = D?.name ?? w.random.array(M.names.filter((q) => q.length))[0], b = D?.message ?? w.random.array(M.messages.filter((q) => q.length))[0], p = await w.message.generateBadges(D?.badges ?? [], t), o = w.message.findEmotesInText(b), d = w.message.replaceEmotesWithHTML(b, o), f = D?.color ?? w.random.color("hex"), h = D?.userId ?? w.random.string(16), g = D?.msgId ?? w.random.string(16), y = D?.time ?? Date.now(), C = D?.channel ?? window?.client?.details?.user?.username ?? "local", k = D?.reply ? {
|
|
7279
|
+
"reply-parent-display-name": D.reply.name,
|
|
7280
|
+
"reply-parent-msg-body": D.reply.text,
|
|
7281
|
+
"reply-parent-msg-id": D.reply.msgId,
|
|
7282
|
+
"reply-parent-user-id": D.reply.userId,
|
|
7283
|
+
"reply-parent-user-login": D.reply.name.toLowerCase()
|
|
7284
|
+
} : {}, S = D?.thread ? {
|
|
7285
|
+
"reply-thread-parent-msg-id": D.thread.msgId,
|
|
7286
|
+
"reply-thread-parent-user-login": D.thread.name.toLowerCase()
|
|
7287
|
+
} : {}, J = {
|
|
7288
|
+
vip: p.keys.includes("vip") ? "" : void 0,
|
|
7289
|
+
subscriber: p.keys.includes("subscriber") ? "1" : "0",
|
|
7290
|
+
mod: p.keys.includes("moderator") ? "1" : "0",
|
|
7291
|
+
turbo: p.keys.includes("turbo") ? "1" : "0"
|
|
7292
|
+
};
|
|
7256
7293
|
return {
|
|
7257
7294
|
listener: "message",
|
|
7258
7295
|
event: {
|
|
@@ -7260,13 +7297,11 @@ var G;
|
|
|
7260
7297
|
data: {
|
|
7261
7298
|
time: y,
|
|
7262
7299
|
tags: {
|
|
7263
|
-
"badge-info": `${p.keys.map((
|
|
7264
|
-
badges: p.keys.join("
|
|
7265
|
-
|
|
7266
|
-
subscriber: p.keys.includes("subscriber") ? "1" : "0",
|
|
7267
|
-
turbo: p.keys.includes("turbo") ? "1" : "0",
|
|
7300
|
+
"badge-info": `${p.keys.map((q) => `${q}/${p.amount[q] ?? w.random.number(1, 5)}`).join(",")}`,
|
|
7301
|
+
badges: p.keys.map((q) => `${q}/1`).join(","),
|
|
7302
|
+
...J,
|
|
7268
7303
|
"tmi-sent-ts": y.toString(),
|
|
7269
|
-
"user-id":
|
|
7304
|
+
"user-id": h,
|
|
7270
7305
|
"user-type": "",
|
|
7271
7306
|
color: f,
|
|
7272
7307
|
"display-name": c,
|
|
@@ -7274,21 +7309,23 @@ var G;
|
|
|
7274
7309
|
"client-nonce": w.random.string(16),
|
|
7275
7310
|
flags: "",
|
|
7276
7311
|
id: g,
|
|
7277
|
-
"first-msg": "0",
|
|
7278
|
-
"returning-chatter": "0"
|
|
7312
|
+
"first-msg": D?.firstMsg ? "1" : "0",
|
|
7313
|
+
"returning-chatter": D?.returningChatter ? "1" : "0",
|
|
7314
|
+
...k,
|
|
7315
|
+
...S
|
|
7279
7316
|
},
|
|
7280
7317
|
nick: c.toLowerCase(),
|
|
7281
7318
|
displayName: c,
|
|
7282
7319
|
displayColor: f,
|
|
7283
|
-
channel:
|
|
7320
|
+
channel: C,
|
|
7284
7321
|
text: b,
|
|
7285
7322
|
isAction: !1,
|
|
7286
|
-
userId:
|
|
7323
|
+
userId: h,
|
|
7287
7324
|
msgId: g,
|
|
7288
7325
|
badges: p.badges,
|
|
7289
7326
|
emotes: o
|
|
7290
7327
|
},
|
|
7291
|
-
renderedText:
|
|
7328
|
+
renderedText: d
|
|
7292
7329
|
},
|
|
7293
7330
|
// @ts-ignore
|
|
7294
7331
|
emulated: !0
|
|
@@ -7296,12 +7333,12 @@ var G;
|
|
|
7296
7333
|
}
|
|
7297
7334
|
case "cheer":
|
|
7298
7335
|
case "cheer-latest": {
|
|
7299
|
-
var
|
|
7336
|
+
var E = i?.amount ?? w.random.number(100, 1e4), T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((F) => F.length))[0], b = i?.message ?? w.random.array(M.messages.filter((F) => F.length))[0];
|
|
7300
7337
|
return {
|
|
7301
7338
|
listener: "cheer-latest",
|
|
7302
7339
|
event: {
|
|
7303
|
-
amount:
|
|
7304
|
-
avatar:
|
|
7340
|
+
amount: E,
|
|
7341
|
+
avatar: T,
|
|
7305
7342
|
name: c.toLowerCase(),
|
|
7306
7343
|
displayName: c,
|
|
7307
7344
|
message: b,
|
|
@@ -7318,11 +7355,11 @@ var G;
|
|
|
7318
7355
|
}
|
|
7319
7356
|
case "follower":
|
|
7320
7357
|
case "follower-latest": {
|
|
7321
|
-
var
|
|
7358
|
+
var T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((F) => F.length))[0];
|
|
7322
7359
|
return {
|
|
7323
7360
|
listener: "follower-latest",
|
|
7324
7361
|
event: {
|
|
7325
|
-
avatar:
|
|
7362
|
+
avatar: T,
|
|
7326
7363
|
name: c.toLowerCase(),
|
|
7327
7364
|
displayName: c,
|
|
7328
7365
|
providerId: "",
|
|
@@ -7338,12 +7375,12 @@ var G;
|
|
|
7338
7375
|
}
|
|
7339
7376
|
case "raid":
|
|
7340
7377
|
case "raid-latest": {
|
|
7341
|
-
var
|
|
7378
|
+
var E = i?.amount ?? w.random.number(1, 100), T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((Q) => Q.length))[0];
|
|
7342
7379
|
return {
|
|
7343
7380
|
listener: "raid-latest",
|
|
7344
7381
|
event: {
|
|
7345
|
-
amount:
|
|
7346
|
-
avatar:
|
|
7382
|
+
amount: E,
|
|
7383
|
+
avatar: T,
|
|
7347
7384
|
name: c.toLowerCase(),
|
|
7348
7385
|
displayName: c,
|
|
7349
7386
|
providerId: "",
|
|
@@ -7359,36 +7396,36 @@ var G;
|
|
|
7359
7396
|
}
|
|
7360
7397
|
case "subscriber":
|
|
7361
7398
|
case "subscriber-latest": {
|
|
7362
|
-
var
|
|
7399
|
+
var _ = i?.tier ?? w.random.array(["1000", "2000", "3000", "prime"])[0], E = i?.amount ?? w.random.number(1, 24), T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((Y) => Y.length))[0], j = i?.sender ?? w.random.array(M.names.filter((Y) => Y.length && Y !== c))[0], b = i?.message ?? w.random.array(M.messages.filter((Y) => Y.length))[0], P = {
|
|
7363
7400
|
default: {
|
|
7364
|
-
avatar:
|
|
7401
|
+
avatar: T,
|
|
7365
7402
|
playedAsCommunityGift: !1
|
|
7366
7403
|
},
|
|
7367
7404
|
gift: {
|
|
7368
|
-
sender:
|
|
7405
|
+
sender: j,
|
|
7369
7406
|
gifted: !0
|
|
7370
7407
|
},
|
|
7371
7408
|
community: {
|
|
7372
7409
|
message: b,
|
|
7373
|
-
sender:
|
|
7410
|
+
sender: j,
|
|
7374
7411
|
bulkGifted: !0
|
|
7375
7412
|
},
|
|
7376
7413
|
spam: {
|
|
7377
|
-
sender:
|
|
7414
|
+
sender: j,
|
|
7378
7415
|
gifted: !0,
|
|
7379
7416
|
isCommunityGift: !0
|
|
7380
7417
|
}
|
|
7381
|
-
},
|
|
7382
|
-
return
|
|
7418
|
+
}, O = ["default", "gift", "community", "spam"], z = i?.subType ?? w.random.array(O)[0];
|
|
7419
|
+
return z = O.includes(z) ? z : "default", {
|
|
7383
7420
|
listener: "subscriber-latest",
|
|
7384
7421
|
event: {
|
|
7385
|
-
amount:
|
|
7422
|
+
amount: E,
|
|
7386
7423
|
name: c.toLowerCase(),
|
|
7387
7424
|
displayName: c,
|
|
7388
7425
|
providerId: "",
|
|
7389
|
-
tier:
|
|
7390
|
-
...
|
|
7391
|
-
...
|
|
7426
|
+
tier: _,
|
|
7427
|
+
...P.default,
|
|
7428
|
+
...P[z],
|
|
7392
7429
|
_id: w.random.uuid(),
|
|
7393
7430
|
sessionTop: !1,
|
|
7394
7431
|
type: "subscriber",
|
|
@@ -7431,12 +7468,12 @@ var G;
|
|
|
7431
7468
|
}
|
|
7432
7469
|
case "tip":
|
|
7433
7470
|
case "tip-latest": {
|
|
7434
|
-
var
|
|
7471
|
+
var E = i?.amount ?? w.random.number(100, 4e3), T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((Q) => Q.length))[0];
|
|
7435
7472
|
return {
|
|
7436
7473
|
listener: "tip-latest",
|
|
7437
7474
|
event: {
|
|
7438
|
-
amount:
|
|
7439
|
-
avatar:
|
|
7475
|
+
amount: E,
|
|
7476
|
+
avatar: T,
|
|
7440
7477
|
name: c.toLowerCase(),
|
|
7441
7478
|
displayName: c,
|
|
7442
7479
|
providerId: "",
|
|
@@ -7477,11 +7514,11 @@ var G;
|
|
|
7477
7514
|
case "mute":
|
|
7478
7515
|
case "unmute":
|
|
7479
7516
|
case "alertService:toggleSound": {
|
|
7480
|
-
var
|
|
7517
|
+
var W = i?.muted ?? window?.client?.details?.overlay?.muted ?? !1;
|
|
7481
7518
|
return {
|
|
7482
7519
|
listener: "alertService:toggleSound",
|
|
7483
7520
|
event: {
|
|
7484
|
-
muted:
|
|
7521
|
+
muted: W,
|
|
7485
7522
|
provider: t
|
|
7486
7523
|
},
|
|
7487
7524
|
// @ts-ignore
|
|
@@ -7509,12 +7546,12 @@ var G;
|
|
|
7509
7546
|
return this.onEventReceived(t, m);
|
|
7510
7547
|
}
|
|
7511
7548
|
case "message": {
|
|
7512
|
-
var c = i?.name ?? w.random.array(
|
|
7513
|
-
const
|
|
7549
|
+
var c = i?.name ?? w.random.array(M.names.filter((u) => u.length))[0], b = i?.message ?? w.random.array(M.messages.filter((u) => u.length))[0];
|
|
7550
|
+
const q = await w.message.generateBadges(
|
|
7514
7551
|
i?.badges ?? [],
|
|
7515
7552
|
t
|
|
7516
7553
|
);
|
|
7517
|
-
var o = w.message.findEmotesInText(b),
|
|
7554
|
+
var o = w.message.findEmotesInText(b), d = w.message.replaceEmotesWithHTML(b, o), f = i?.color ?? w.random.color("hex"), h = i?.userId ?? w.random.number(1e7, 99999999).toString(), g = i?.msgId ?? w.random.uuid(), y = i?.time ?? Date.now(), T = i?.avatar ?? w.random.array(M.avatars)[0], C = i?.channel ?? window?.client?.details?.user?.username ?? "local";
|
|
7518
7555
|
return {
|
|
7519
7556
|
listener: "message",
|
|
7520
7557
|
event: {
|
|
@@ -7526,7 +7563,7 @@ var G;
|
|
|
7526
7563
|
snippet: {
|
|
7527
7564
|
type: "",
|
|
7528
7565
|
liveChatId: "",
|
|
7529
|
-
authorChannelId:
|
|
7566
|
+
authorChannelId: C,
|
|
7530
7567
|
publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7531
7568
|
hasDisplayContent: !0,
|
|
7532
7569
|
displayMessage: b,
|
|
@@ -7535,14 +7572,14 @@ var G;
|
|
|
7535
7572
|
}
|
|
7536
7573
|
},
|
|
7537
7574
|
authorDetails: {
|
|
7538
|
-
channelId:
|
|
7575
|
+
channelId: C,
|
|
7539
7576
|
channelUrl: "",
|
|
7540
7577
|
displayName: c,
|
|
7541
|
-
profileImageUrl:
|
|
7542
|
-
...
|
|
7578
|
+
profileImageUrl: T,
|
|
7579
|
+
...q
|
|
7543
7580
|
},
|
|
7544
7581
|
msgId: g,
|
|
7545
|
-
userId:
|
|
7582
|
+
userId: h,
|
|
7546
7583
|
nick: c.toLowerCase(),
|
|
7547
7584
|
badges: [],
|
|
7548
7585
|
displayName: c,
|
|
@@ -7550,9 +7587,9 @@ var G;
|
|
|
7550
7587
|
time: y,
|
|
7551
7588
|
tags: [],
|
|
7552
7589
|
displayColor: f,
|
|
7553
|
-
channel:
|
|
7590
|
+
channel: C,
|
|
7554
7591
|
text: b,
|
|
7555
|
-
avatar:
|
|
7592
|
+
avatar: T,
|
|
7556
7593
|
emotes: []
|
|
7557
7594
|
},
|
|
7558
7595
|
renderedText: b
|
|
@@ -7563,11 +7600,11 @@ var G;
|
|
|
7563
7600
|
}
|
|
7564
7601
|
case "subscriber":
|
|
7565
7602
|
case "subscriber-latest": {
|
|
7566
|
-
var
|
|
7603
|
+
var T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((F) => F.length))[0];
|
|
7567
7604
|
return {
|
|
7568
7605
|
listener: "subscriber-latest",
|
|
7569
7606
|
event: {
|
|
7570
|
-
avatar:
|
|
7607
|
+
avatar: T,
|
|
7571
7608
|
displayName: c,
|
|
7572
7609
|
name: c.toLowerCase(),
|
|
7573
7610
|
providerId: "",
|
|
@@ -7583,12 +7620,12 @@ var G;
|
|
|
7583
7620
|
}
|
|
7584
7621
|
case "superchat":
|
|
7585
7622
|
case "superchat-latest": {
|
|
7586
|
-
var
|
|
7623
|
+
var E = i?.amount ?? w.random.number(100, 4e3), T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((Q) => Q.length))[0];
|
|
7587
7624
|
return {
|
|
7588
7625
|
listener: "superchat-latest",
|
|
7589
7626
|
event: {
|
|
7590
|
-
amount:
|
|
7591
|
-
avatar:
|
|
7627
|
+
amount: E,
|
|
7628
|
+
avatar: T,
|
|
7592
7629
|
name: c.toLowerCase(),
|
|
7593
7630
|
displayName: c,
|
|
7594
7631
|
providerId: "",
|
|
@@ -7604,35 +7641,35 @@ var G;
|
|
|
7604
7641
|
}
|
|
7605
7642
|
case "sponsor":
|
|
7606
7643
|
case "sponsor-latest": {
|
|
7607
|
-
var
|
|
7644
|
+
var _ = i?.tier ?? w.random.array(["1000", "2000", "3000"])[0], E = i?.amount ?? w.random.number(1, 24), T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((K) => K.length))[0], j = i?.sender ?? w.random.array(M.names.filter((K) => K.length && K !== c))[0], b = i?.message ?? w.random.array(M.messages.filter((K) => K.length))[0], P = {
|
|
7608
7645
|
default: {
|
|
7609
|
-
avatar:
|
|
7646
|
+
avatar: T,
|
|
7610
7647
|
playedAsCommunityGift: !1
|
|
7611
7648
|
},
|
|
7612
7649
|
gift: {
|
|
7613
|
-
sender:
|
|
7650
|
+
sender: j,
|
|
7614
7651
|
gifted: !0
|
|
7615
7652
|
},
|
|
7616
7653
|
community: {
|
|
7617
7654
|
message: b,
|
|
7618
|
-
sender:
|
|
7655
|
+
sender: j,
|
|
7619
7656
|
bulkGifted: !0
|
|
7620
7657
|
},
|
|
7621
7658
|
spam: {
|
|
7622
|
-
sender:
|
|
7659
|
+
sender: j,
|
|
7623
7660
|
gifted: !0,
|
|
7624
7661
|
isCommunityGift: !0
|
|
7625
7662
|
}
|
|
7626
|
-
},
|
|
7627
|
-
return
|
|
7663
|
+
}, O = ["default", "gift", "community", "spam"], z = i?.subType ?? w.random.array(O)[0];
|
|
7664
|
+
return z = O.includes(z) ? z : "default", {
|
|
7628
7665
|
listener: "sponsor-latest",
|
|
7629
7666
|
event: {
|
|
7630
|
-
amount:
|
|
7667
|
+
amount: E,
|
|
7631
7668
|
name: c.toLowerCase(),
|
|
7632
7669
|
displayName: c,
|
|
7633
7670
|
providerId: "",
|
|
7634
|
-
...
|
|
7635
|
-
...
|
|
7671
|
+
...P.default,
|
|
7672
|
+
...P[z],
|
|
7636
7673
|
_id: w.random.uuid(),
|
|
7637
7674
|
sessionTop: !1,
|
|
7638
7675
|
type: "sponsor",
|
|
@@ -7650,11 +7687,7 @@ var G;
|
|
|
7650
7687
|
}, l.emulate = {
|
|
7651
7688
|
twitch: {
|
|
7652
7689
|
message(t = {}) {
|
|
7653
|
-
l.generate.event.onEventReceived(
|
|
7654
|
-
"twitch",
|
|
7655
|
-
"message",
|
|
7656
|
-
t
|
|
7657
|
-
).then((a) => {
|
|
7690
|
+
l.generate.event.onEventReceived("twitch", "message", t).then((a) => {
|
|
7658
7691
|
a && l.emulate.send("onEventReceived", a);
|
|
7659
7692
|
});
|
|
7660
7693
|
},
|
|
@@ -7768,7 +7801,7 @@ var G;
|
|
|
7768
7801
|
facebook: {},
|
|
7769
7802
|
send(t, a) {
|
|
7770
7803
|
if (!l.queue) {
|
|
7771
|
-
|
|
7804
|
+
R.warn("Local queue is not initialized."), window.dispatchEvent(new CustomEvent(t, { detail: a }));
|
|
7772
7805
|
return;
|
|
7773
7806
|
}
|
|
7774
7807
|
switch (t) {
|
|
@@ -7823,7 +7856,7 @@ var G;
|
|
|
7823
7856
|
cache: "no-store"
|
|
7824
7857
|
}).then((m) => m.json()).then(async (m) => {
|
|
7825
7858
|
const c = Object.entries(m).filter(([p, { value: o }]) => o != null).reduce(
|
|
7826
|
-
(p, [o, { value:
|
|
7859
|
+
(p, [o, { value: d }]) => (n && n[o] !== void 0 && (d = n[o]), p[o] = d, p),
|
|
7827
7860
|
{
|
|
7828
7861
|
...n
|
|
7829
7862
|
}
|
|
@@ -7835,7 +7868,7 @@ var G;
|
|
|
7835
7868
|
});
|
|
7836
7869
|
}
|
|
7837
7870
|
l.start = e;
|
|
7838
|
-
})(
|
|
7871
|
+
})(B || (B = {}));
|
|
7839
7872
|
const rt = {
|
|
7840
7873
|
getOverlayStatus: () => ({
|
|
7841
7874
|
isEditorMode: !1,
|
|
@@ -7869,7 +7902,7 @@ const rt = {
|
|
|
7869
7902
|
list: {}
|
|
7870
7903
|
}
|
|
7871
7904
|
};
|
|
7872
|
-
async function
|
|
7905
|
+
async function At() {
|
|
7873
7906
|
let l = localStorage.getItem("SE_API-STORE") ?? "", e = l ? JSON.parse(l) : {};
|
|
7874
7907
|
return rt.store.list = e, rt;
|
|
7875
7908
|
}
|
|
@@ -7929,7 +7962,7 @@ var ot;
|
|
|
7929
7962
|
}
|
|
7930
7963
|
l.get = a;
|
|
7931
7964
|
})(ot || (ot = {}));
|
|
7932
|
-
class
|
|
7965
|
+
class Jt extends Z {
|
|
7933
7966
|
/**
|
|
7934
7967
|
* Initializes a new ComfyJS instance and connects to Twitch chat.
|
|
7935
7968
|
* @param options - Configuration options for ComfyJS instance.
|
|
@@ -7939,7 +7972,7 @@ class At extends X {
|
|
|
7939
7972
|
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((a) => {
|
|
7940
7973
|
this.instance = a, this.emit("load", a), this.connect();
|
|
7941
7974
|
}).catch((a) => {
|
|
7942
|
-
|
|
7975
|
+
R.error("useComfyJs: Failed to load ComfyJS", a);
|
|
7943
7976
|
});
|
|
7944
7977
|
}
|
|
7945
7978
|
/**
|
|
@@ -7961,9 +7994,9 @@ class At extends X {
|
|
|
7961
7994
|
*/
|
|
7962
7995
|
connect() {
|
|
7963
7996
|
this.instance.onError = (e) => {
|
|
7964
|
-
this.emit("error", e), client?.debug &&
|
|
7997
|
+
this.emit("error", e), client?.debug && R.error("[Client]", "ComfyJS Error:", e);
|
|
7965
7998
|
}, this.instance.onCommand = (e, t, a, i, s) => {
|
|
7966
|
-
if (this.emit("command", e, t, a, i, s), client?.debug &&
|
|
7999
|
+
if (this.emit("command", e, t, a, i, s), client?.debug && R.debug("[Client]", `ComfyJS Command: !${t} ${a} (User: ${e})`), this.emulate) {
|
|
7967
8000
|
const n = {
|
|
7968
8001
|
...i,
|
|
7969
8002
|
broadcaster: i.broadcaster,
|
|
@@ -7981,10 +8014,10 @@ class At extends X {
|
|
|
7981
8014
|
msgId: s.id,
|
|
7982
8015
|
channel: s.channel
|
|
7983
8016
|
};
|
|
7984
|
-
|
|
8017
|
+
B.emulate.twitch.message(m);
|
|
7985
8018
|
}
|
|
7986
8019
|
}, this.instance.onChat = (e, t, a, i, s) => {
|
|
7987
|
-
if (this.emit("chat", e, t, a, i, s), client?.debug &&
|
|
8020
|
+
if (this.emit("chat", e, t, a, i, s), client?.debug && R.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
|
|
7988
8021
|
const n = {
|
|
7989
8022
|
...a,
|
|
7990
8023
|
...s.userBadges,
|
|
@@ -7994,7 +8027,7 @@ class At extends X {
|
|
|
7994
8027
|
subscriber: a.subscriber,
|
|
7995
8028
|
founder: a.founder
|
|
7996
8029
|
};
|
|
7997
|
-
|
|
8030
|
+
B.emulate.twitch.message({
|
|
7998
8031
|
name: e,
|
|
7999
8032
|
message: t,
|
|
8000
8033
|
badges: Object.entries(n).map(([m, c]) => c ? m : null).filter(Boolean),
|
|
@@ -8006,24 +8039,24 @@ class At extends X {
|
|
|
8006
8039
|
});
|
|
8007
8040
|
}
|
|
8008
8041
|
}, this.instance.onWhisper = (e, t, a, i, s) => {
|
|
8009
|
-
this.emit("whisper", e, t, a, i, s), client?.debug &&
|
|
8042
|
+
this.emit("whisper", e, t, a, i, s), client?.debug && R.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
|
|
8010
8043
|
}, this.instance.onMessageDeleted = (e, t) => {
|
|
8011
|
-
this.emit("messageDeleted", e, t), client?.debug &&
|
|
8044
|
+
this.emit("messageDeleted", e, t), client?.debug && R.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && B.emulate.twitch.deleteMessage(e);
|
|
8012
8045
|
}, this.instance.onJoin = (e, t, a) => {
|
|
8013
|
-
this.emit("join", e, t, a), client?.debug &&
|
|
8046
|
+
this.emit("join", e, t, a), client?.debug && R.debug("[Client]", `ComfyJS Join: ${e}`);
|
|
8014
8047
|
}, this.instance.onPart = (e, t, a) => {
|
|
8015
|
-
this.emit("part", e, t, a), client?.debug &&
|
|
8048
|
+
this.emit("part", e, t, a), client?.debug && R.debug("[Client]", `ComfyJS Part: ${e}`);
|
|
8016
8049
|
}, this.instance.onHosted = (e, t, a, i) => {
|
|
8017
|
-
this.emit("hosted", e, t, a, i), client?.debug &&
|
|
8050
|
+
this.emit("hosted", e, t, a, i), client?.debug && R.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
|
|
8018
8051
|
}, this.instance.onRaid = (e, t, a) => {
|
|
8019
|
-
this.emit("raid", e, t, a), client?.debug &&
|
|
8052
|
+
this.emit("raid", e, t, a), client?.debug && R.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && B.emulate.twitch.raid({
|
|
8020
8053
|
name: e,
|
|
8021
8054
|
amount: t
|
|
8022
8055
|
});
|
|
8023
8056
|
}, this.instance.onSub = (e, t, a, i) => {
|
|
8024
|
-
if (this.emit("sub", e, t, a, i), client?.debug &&
|
|
8057
|
+
if (this.emit("sub", e, t, a, i), client?.debug && R.debug("[Client]", `ComfyJS Sub: ${e} (${a.plan})`), this.emulate) {
|
|
8025
8058
|
const s = a.plan === "Prime" ? "prime" : a.plan;
|
|
8026
|
-
|
|
8059
|
+
B.emulate.twitch.subscriber({
|
|
8027
8060
|
name: e,
|
|
8028
8061
|
message: t,
|
|
8029
8062
|
tier: s,
|
|
@@ -8031,9 +8064,9 @@ class At extends X {
|
|
|
8031
8064
|
});
|
|
8032
8065
|
}
|
|
8033
8066
|
}, this.instance.onResub = (e, t, a, i, s, n) => {
|
|
8034
|
-
if (this.emit("resub", e, t, a, i, s, n), client?.debug &&
|
|
8067
|
+
if (this.emit("resub", e, t, a, i, s, n), client?.debug && R.debug("[Client]", `ComfyJS Resub: ${e} (${i} months)`), this.emulate) {
|
|
8035
8068
|
const m = s.plan === "Prime" ? "prime" : s.plan;
|
|
8036
|
-
|
|
8069
|
+
B.emulate.twitch.subscriber({
|
|
8037
8070
|
name: e,
|
|
8038
8071
|
message: t,
|
|
8039
8072
|
tier: m,
|
|
@@ -8050,9 +8083,9 @@ class At extends X {
|
|
|
8050
8083
|
i,
|
|
8051
8084
|
s,
|
|
8052
8085
|
n
|
|
8053
|
-
), client?.debug &&
|
|
8086
|
+
), client?.debug && R.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${i} subs`), this.emulate) {
|
|
8054
8087
|
const m = s.plan === "Prime" ? "prime" : s.plan;
|
|
8055
|
-
|
|
8088
|
+
B.emulate.twitch.subscriber({
|
|
8056
8089
|
name: a,
|
|
8057
8090
|
message: "",
|
|
8058
8091
|
sender: e,
|
|
@@ -8062,12 +8095,12 @@ class At extends X {
|
|
|
8062
8095
|
});
|
|
8063
8096
|
}
|
|
8064
8097
|
}, this.instance.onSubMysteryGift = (e, t, a, i, s) => {
|
|
8065
|
-
if (this.emit("subMysteryGift", e, t, a, i, s), client?.debug &&
|
|
8098
|
+
if (this.emit("subMysteryGift", e, t, a, i, s), client?.debug && R.debug(
|
|
8066
8099
|
"[Client]",
|
|
8067
8100
|
`ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`
|
|
8068
8101
|
), this.emulate) {
|
|
8069
8102
|
const n = i.plan === "Prime" ? "prime" : i.plan;
|
|
8070
|
-
|
|
8103
|
+
B.emulate.twitch.subscriber({
|
|
8071
8104
|
name: e,
|
|
8072
8105
|
message: "",
|
|
8073
8106
|
amount: t,
|
|
@@ -8076,10 +8109,10 @@ class At extends X {
|
|
|
8076
8109
|
});
|
|
8077
8110
|
}
|
|
8078
8111
|
}, this.instance.onGiftSubContinue = (e, t, a) => {
|
|
8079
|
-
this.emit("giftSubContinue", e, t, a), client?.debug &&
|
|
8112
|
+
this.emit("giftSubContinue", e, t, a), client?.debug && R.debug(
|
|
8080
8113
|
"[Client]",
|
|
8081
8114
|
`ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`
|
|
8082
|
-
), this.emulate &&
|
|
8115
|
+
), this.emulate && B.emulate.twitch.subscriber({
|
|
8083
8116
|
name: e,
|
|
8084
8117
|
message: "",
|
|
8085
8118
|
sender: t,
|
|
@@ -8087,25 +8120,25 @@ class At extends X {
|
|
|
8087
8120
|
subType: "gift"
|
|
8088
8121
|
});
|
|
8089
8122
|
}, this.instance.onCheer = (e, t, a, i, s) => {
|
|
8090
|
-
this.emit("cheer", e, t, a, i, s), client?.debug &&
|
|
8123
|
+
this.emit("cheer", e, t, a, i, s), client?.debug && R.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${a} bits - ${t}`), this.emulate && B.emulate.twitch.cheer({
|
|
8091
8124
|
name: e,
|
|
8092
8125
|
message: t,
|
|
8093
8126
|
amount: a
|
|
8094
8127
|
});
|
|
8095
8128
|
}, this.instance.onChatMode = (e, t) => {
|
|
8096
|
-
this.emit("chatMode", e, t), client?.debug &&
|
|
8129
|
+
this.emit("chatMode", e, t), client?.debug && R.debug("[Client]", `ComfyJS Chat Mode Changed on ${t}`);
|
|
8097
8130
|
}, this.instance.onReward = (e, t, a, i, s) => {
|
|
8098
|
-
this.emit("reward", e, t, a, i, s), client?.debug &&
|
|
8131
|
+
this.emit("reward", e, t, a, i, s), client?.debug && R.debug(
|
|
8099
8132
|
"[Client]",
|
|
8100
8133
|
`ComfyJS Reward: ${e} redeemed ${t} for ${a} - ${i}`
|
|
8101
8134
|
);
|
|
8102
8135
|
}, this.instance.onConnected = (e, t, a) => {
|
|
8103
|
-
this.emit("connected", e, t, a), client?.debug &&
|
|
8136
|
+
this.emit("connected", e, t, a), client?.debug && R.debug(
|
|
8104
8137
|
"[Client]",
|
|
8105
8138
|
`ComfyJS Connected: ${e}:${t} (First Connect: ${a})`
|
|
8106
8139
|
);
|
|
8107
8140
|
}, this.instance.onReconnect = (e) => {
|
|
8108
|
-
this.emit("reconnect", e), client?.debug &&
|
|
8141
|
+
this.emit("reconnect", e), client?.debug && R.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
|
|
8109
8142
|
}, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
|
|
8110
8143
|
}
|
|
8111
8144
|
}
|
|
@@ -8208,30 +8241,30 @@ class pt {
|
|
|
8208
8241
|
!this.enabled || !console.timeEnd || console.timeEnd(e);
|
|
8209
8242
|
}
|
|
8210
8243
|
}
|
|
8211
|
-
const ct = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(
|
|
8244
|
+
const ct = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(At()), R = new pt(), mt = {
|
|
8212
8245
|
SeAPI: ct,
|
|
8213
|
-
Client:
|
|
8246
|
+
Client: G,
|
|
8214
8247
|
Helper: w,
|
|
8215
|
-
Local:
|
|
8216
|
-
Data:
|
|
8217
|
-
logger:
|
|
8248
|
+
Local: B,
|
|
8249
|
+
Data: M,
|
|
8250
|
+
logger: R,
|
|
8218
8251
|
modules: {
|
|
8219
|
-
EventProvider:
|
|
8220
|
-
useStorage:
|
|
8252
|
+
EventProvider: Z,
|
|
8253
|
+
useStorage: at,
|
|
8221
8254
|
useQueue: gt,
|
|
8222
8255
|
useLogger: pt,
|
|
8223
|
-
useComms:
|
|
8256
|
+
useComms: Dt
|
|
8224
8257
|
},
|
|
8225
8258
|
actions: {
|
|
8226
|
-
Button:
|
|
8227
|
-
Command:
|
|
8259
|
+
Button: st,
|
|
8260
|
+
Command: $
|
|
8228
8261
|
},
|
|
8229
8262
|
multistream: {
|
|
8230
|
-
useComfyJs:
|
|
8263
|
+
useComfyJs: Jt
|
|
8231
8264
|
},
|
|
8232
8265
|
data: {
|
|
8233
|
-
usedStorages:
|
|
8234
|
-
usedComms:
|
|
8266
|
+
usedStorages: et,
|
|
8267
|
+
usedComms: it
|
|
8235
8268
|
},
|
|
8236
8269
|
pronouns: {
|
|
8237
8270
|
Alejo: ot
|