@tixyel/streamelements 6.2.0 → 6.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +35 -35
- package/dist/index.es.js +868 -850
- 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
|
@@ -168,24 +168,24 @@ class Z {
|
|
|
168
168
|
switch (t.provider) {
|
|
169
169
|
case "twitch": {
|
|
170
170
|
const c = t.data;
|
|
171
|
-
i = c.event.data.nick || c.event.data.displayName, c.event.data.tags?.badges && (s = c.event.data.tags.badges.toString().replace(/\/\d+/g, "").split(",").map((
|
|
171
|
+
i = c.event.data.nick || c.event.data.displayName, c.event.data.tags?.badges && (s = c.event.data.tags.badges.toString().replace(/\/\d+/g, "").split(",").map((p) => p in n ? n[p] : p));
|
|
172
172
|
break;
|
|
173
173
|
}
|
|
174
174
|
case "youtube": {
|
|
175
|
-
const c = t.data,
|
|
175
|
+
const c = t.data, b = {
|
|
176
176
|
isVerified: "verified",
|
|
177
177
|
isChatOwner: "owner",
|
|
178
178
|
isChatSponsor: "sponsor",
|
|
179
179
|
isChatModerator: "moderator"
|
|
180
180
|
};
|
|
181
|
-
i = c.event.data.nick || c.event.data.displayName, s = Object.entries(c.event.data.authorDetails).filter(([
|
|
181
|
+
i = c.event.data.nick || c.event.data.displayName, s = Object.entries(c.event.data.authorDetails).filter(([p, o]) => p.startsWith("is") && o).map(([p]) => b[p]).filter(Boolean), s.includes("sponsor") && (s.push("premium"), s.push("prime")), s.includes("owner") && (s.push("moderator"), s.push("broadcaster"));
|
|
182
182
|
break;
|
|
183
183
|
}
|
|
184
184
|
case "kick":
|
|
185
185
|
return !1;
|
|
186
186
|
}
|
|
187
|
-
const
|
|
188
|
-
return
|
|
187
|
+
const m = this.verify(i, s, a);
|
|
188
|
+
return m === !0 && this.run.apply(window.client, [a, t]), m;
|
|
189
189
|
}
|
|
190
190
|
remove() {
|
|
191
191
|
if (!(window.client instanceof G)) return;
|
|
@@ -203,7 +203,7 @@ class Z {
|
|
|
203
203
|
});
|
|
204
204
|
if (a.length && a.every((i) => i instanceof Z))
|
|
205
205
|
return a.forEach((i) => {
|
|
206
|
-
i.parse(t.event.data.text, e), window.client.emit("action", i, "executed"),
|
|
206
|
+
i.parse(t.event.data.text, e), window.client.emit("action", i, "executed"), N.received(`Command executed: ${t.event.data.text} by ${t.event.data.nick || t.event.data.displayName}`, t);
|
|
207
207
|
}), !0;
|
|
208
208
|
}
|
|
209
209
|
} catch {
|
|
@@ -364,17 +364,17 @@ const ut = [
|
|
|
364
364
|
"yellowgreen",
|
|
365
365
|
"transparent"
|
|
366
366
|
];
|
|
367
|
-
function ft(
|
|
367
|
+
function ft(l, e) {
|
|
368
368
|
if (!e) return null;
|
|
369
369
|
switch (e) {
|
|
370
370
|
case "hex": {
|
|
371
|
-
const t =
|
|
371
|
+
const t = l.replace("#", "");
|
|
372
372
|
let a = 0, i = 0, s = 0, n = 1;
|
|
373
373
|
return t.length === 3 ? (a = parseInt(t[0] + t[0], 16), i = parseInt(t[1] + t[1], 16), s = parseInt(t[2] + t[2], 16)) : t.length === 6 ? (a = parseInt(t.slice(0, 2), 16), i = parseInt(t.slice(2, 4), 16), s = parseInt(t.slice(4, 6), 16)) : t.length === 4 ? (a = parseInt(t[0] + t[0], 16), i = parseInt(t[1] + t[1], 16), s = parseInt(t[2] + t[2], 16), n = parseInt(t[3] + t[3], 16) / 255) : t.length === 8 && (a = parseInt(t.slice(0, 2), 16), i = parseInt(t.slice(2, 4), 16), s = parseInt(t.slice(4, 6), 16), n = parseInt(t.slice(6, 8), 16) / 255), { r: a, g: i, b: s, a: n };
|
|
374
374
|
}
|
|
375
375
|
case "rgb":
|
|
376
376
|
case "rgba": {
|
|
377
|
-
const t =
|
|
377
|
+
const t = l.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
|
|
378
378
|
return t ? {
|
|
379
379
|
r: parseInt(t[1]),
|
|
380
380
|
g: parseInt(t[2]),
|
|
@@ -384,7 +384,7 @@ function ft(d, e) {
|
|
|
384
384
|
}
|
|
385
385
|
case "hsl":
|
|
386
386
|
case "hsla": {
|
|
387
|
-
const t =
|
|
387
|
+
const t = l.match(/hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*([\d.]+))?\s*\)/);
|
|
388
388
|
if (!t) return null;
|
|
389
389
|
const a = parseInt(t[1]), i = parseInt(t[2]), s = parseInt(t[3]), n = t[4] ? parseFloat(t[4]) : 1;
|
|
390
390
|
return { ...yt(a, i, s), a: n };
|
|
@@ -394,7 +394,7 @@ function ft(d, e) {
|
|
|
394
394
|
t.width = t.height = 1;
|
|
395
395
|
const a = t.getContext("2d");
|
|
396
396
|
if (!a) return null;
|
|
397
|
-
a.fillStyle =
|
|
397
|
+
a.fillStyle = l, a.fillRect(0, 0, 1, 1);
|
|
398
398
|
const [i, s, n] = a.getImageData(0, 0, 1, 1).data;
|
|
399
399
|
return { r: i, g: s, b: n, a: 1 };
|
|
400
400
|
}
|
|
@@ -402,42 +402,42 @@ function ft(d, e) {
|
|
|
402
402
|
return null;
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
function bt(
|
|
405
|
+
function bt(l, e = !0) {
|
|
406
406
|
const t = (i) => Math.round(i).toString(16).padStart(2, "0");
|
|
407
|
-
let a = `#${t(
|
|
408
|
-
return e &&
|
|
407
|
+
let a = `#${t(l.r)}${t(l.g)}${t(l.b)}`;
|
|
408
|
+
return e && l.a < 1 && (a += t(l.a * 255)), a;
|
|
409
409
|
}
|
|
410
|
-
function lt(
|
|
411
|
-
|
|
412
|
-
const a = Math.max(
|
|
413
|
-
let n = 0,
|
|
410
|
+
function lt(l, e, t) {
|
|
411
|
+
l /= 255, e /= 255, t /= 255;
|
|
412
|
+
const a = Math.max(l, e, t), i = Math.min(l, e, t), s = a - i;
|
|
413
|
+
let n = 0, m = 0;
|
|
414
414
|
const c = (a + i) / 2;
|
|
415
415
|
if (s !== 0)
|
|
416
|
-
switch (
|
|
417
|
-
case
|
|
416
|
+
switch (m = c > 0.5 ? s / (2 - a - i) : s / (a + i), a) {
|
|
417
|
+
case l:
|
|
418
418
|
n = ((e - t) / s + (e < t ? 6 : 0)) / 6;
|
|
419
419
|
break;
|
|
420
420
|
case e:
|
|
421
|
-
n = ((t -
|
|
421
|
+
n = ((t - l) / s + 2) / 6;
|
|
422
422
|
break;
|
|
423
423
|
case t:
|
|
424
|
-
n = ((
|
|
424
|
+
n = ((l - e) / s + 4) / 6;
|
|
425
425
|
break;
|
|
426
426
|
}
|
|
427
427
|
return {
|
|
428
428
|
h: Math.round(n * 360),
|
|
429
|
-
s: Math.round(
|
|
429
|
+
s: Math.round(m * 100),
|
|
430
430
|
l: Math.round(c * 100)
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
|
-
function yt(
|
|
434
|
-
|
|
433
|
+
function yt(l, e, t) {
|
|
434
|
+
l /= 360, e /= 100, t /= 100;
|
|
435
435
|
let a, i, s;
|
|
436
436
|
if (e === 0)
|
|
437
437
|
a = i = s = t;
|
|
438
438
|
else {
|
|
439
|
-
const n = (
|
|
440
|
-
a = n(c,
|
|
439
|
+
const n = (b, p, o) => (o < 0 && (o += 1), o > 1 && (o -= 1), o < 0.16666666666666666 ? b + (p - b) * 6 * o : o < 0.5 ? p : o < 0.6666666666666666 ? b + (p - b) * (0.6666666666666666 - o) * 6 : b), m = t < 0.5 ? t * (1 + e) : t + e - t * e, c = 2 * t - m;
|
|
440
|
+
a = n(c, m, l + 1 / 3), i = n(c, m, l), s = n(c, m, l - 1 / 3);
|
|
441
441
|
}
|
|
442
442
|
return {
|
|
443
443
|
r: Math.round(a * 255),
|
|
@@ -445,17 +445,17 @@ function yt(d, e, t) {
|
|
|
445
445
|
b: Math.round(s * 255)
|
|
446
446
|
};
|
|
447
447
|
}
|
|
448
|
-
async function wt(
|
|
448
|
+
async function wt(l, e, t) {
|
|
449
449
|
const a = ut;
|
|
450
450
|
let i = a[0], s = 1 / 0;
|
|
451
451
|
for await (const n of a) {
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
const c =
|
|
452
|
+
const m = document.createElement("canvas");
|
|
453
|
+
m.width = m.height = 1;
|
|
454
|
+
const c = m.getContext("2d");
|
|
455
455
|
if (!c) continue;
|
|
456
456
|
c.fillStyle = n, c.fillRect(0, 0, 1, 1);
|
|
457
|
-
const [
|
|
458
|
-
if (
|
|
457
|
+
const [b, p, o] = c.getImageData(0, 0, 1, 1).data, h = Math.sqrt(Math.pow(l - b, 2) + Math.pow(e - p, 2) + Math.pow(t - o, 2));
|
|
458
|
+
if (h < s && (s = h, i = n), h === 0) break;
|
|
459
459
|
}
|
|
460
460
|
return i;
|
|
461
461
|
}
|
|
@@ -1909,11 +1909,11 @@ const vt = [
|
|
|
1909
1909
|
}
|
|
1910
1910
|
}
|
|
1911
1911
|
]).reduce(
|
|
1912
|
-
(
|
|
1912
|
+
(l, e) => (l.some((t) => t.name === e.name) || l.push({
|
|
1913
1913
|
...e,
|
|
1914
1914
|
start: 0,
|
|
1915
1915
|
end: 0
|
|
1916
|
-
}),
|
|
1916
|
+
}), l),
|
|
1917
1917
|
[]
|
|
1918
1918
|
), jt = [], xt = [
|
|
1919
1919
|
"Hello everyone!",
|
|
@@ -5229,15 +5229,15 @@ const vt = [
|
|
|
5229
5229
|
}
|
|
5230
5230
|
];
|
|
5231
5231
|
var A;
|
|
5232
|
-
((
|
|
5233
|
-
|
|
5232
|
+
((l) => {
|
|
5233
|
+
l.avatars = vt, l.badges = kt, l.css_color_names = ut, l.emotes = Ct, l.items = jt, l.messages = xt, l.names = Ut, l.tiers = Et, l.tts = It, l.youtube_emotes = Tt;
|
|
5234
5234
|
})(A || (A = {}));
|
|
5235
|
-
var
|
|
5236
|
-
((
|
|
5235
|
+
var w;
|
|
5236
|
+
((l) => {
|
|
5237
5237
|
let e;
|
|
5238
5238
|
((n) => {
|
|
5239
|
-
function
|
|
5240
|
-
const
|
|
5239
|
+
function m(o, h = "cardinal") {
|
|
5240
|
+
const f = {
|
|
5241
5241
|
single: ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"],
|
|
5242
5242
|
tens: [
|
|
5243
5243
|
"ten",
|
|
@@ -5252,7 +5252,7 @@ var b;
|
|
|
5252
5252
|
"nineteen"
|
|
5253
5253
|
],
|
|
5254
5254
|
decades: ["twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
|
|
5255
|
-
},
|
|
5255
|
+
}, d = {
|
|
5256
5256
|
single: [
|
|
5257
5257
|
"zeroth",
|
|
5258
5258
|
"first",
|
|
@@ -5287,7 +5287,7 @@ var b;
|
|
|
5287
5287
|
"eightieth",
|
|
5288
5288
|
"ninetieth"
|
|
5289
5289
|
]
|
|
5290
|
-
},
|
|
5290
|
+
}, g = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"], y = [
|
|
5291
5291
|
"",
|
|
5292
5292
|
"thousand",
|
|
5293
5293
|
"million",
|
|
@@ -5295,297 +5295,283 @@ var b;
|
|
|
5295
5295
|
"trillion",
|
|
5296
5296
|
"quadrillion",
|
|
5297
5297
|
"quintillion"
|
|
5298
|
-
],
|
|
5299
|
-
if (
|
|
5300
|
-
const
|
|
5301
|
-
if (
|
|
5302
|
-
const
|
|
5303
|
-
return `${
|
|
5304
|
-
}
|
|
5305
|
-
function C(
|
|
5306
|
-
if (
|
|
5307
|
-
if (
|
|
5308
|
-
const
|
|
5309
|
-
if (
|
|
5310
|
-
return
|
|
5311
|
-
const
|
|
5312
|
-
return `${
|
|
5313
|
-
}
|
|
5314
|
-
function
|
|
5315
|
-
if (
|
|
5316
|
-
const
|
|
5317
|
-
return
|
|
5318
|
-
}
|
|
5319
|
-
if (
|
|
5320
|
-
const
|
|
5321
|
-
let D =
|
|
5298
|
+
], v = y.map((j) => j ? `${j}th` : "");
|
|
5299
|
+
if (o = Math.abs(Math.floor(o)), h === "suffix") {
|
|
5300
|
+
const j = o % 100;
|
|
5301
|
+
if (j >= 11 && j <= 13) return `${o}th`;
|
|
5302
|
+
const J = o % 10;
|
|
5303
|
+
return `${o}${g[J]}`;
|
|
5304
|
+
}
|
|
5305
|
+
function C(j, J) {
|
|
5306
|
+
if (j < 10) return J === "ordinal" ? d.single[j] : f.single[j];
|
|
5307
|
+
if (j < 20) return J === "ordinal" ? d.tens[j - 10] : f.tens[j - 10];
|
|
5308
|
+
const R = Math.floor(j / 10), H = j % 10;
|
|
5309
|
+
if (H === 0)
|
|
5310
|
+
return J === "ordinal" ? d.decades[R - 2] : f.decades[R - 2];
|
|
5311
|
+
const W = f.decades[R - 2], O = J === "ordinal" ? d.single[H] : f.single[H];
|
|
5312
|
+
return `${W}-${O}`;
|
|
5313
|
+
}
|
|
5314
|
+
function x(j, J) {
|
|
5315
|
+
if (j === 0) return J === "ordinal" ? d.single[0] : f.single[0];
|
|
5316
|
+
const R = Math.floor(j / 100), H = j % 100, W = [];
|
|
5317
|
+
return R > 0 && (J === "ordinal" && H === 0 ? W.push(`${f.single[R]} hundredth`) : W.push(`${f.single[R]} hundred`)), H > 0 && W.push(C(H, J)), W.join(" ");
|
|
5318
|
+
}
|
|
5319
|
+
if (o < 1e3) return x(o, h);
|
|
5320
|
+
const S = [];
|
|
5321
|
+
let D = o;
|
|
5322
5322
|
for (; D > 0; )
|
|
5323
|
-
|
|
5324
|
-
let
|
|
5325
|
-
for (let
|
|
5326
|
-
const
|
|
5327
|
-
for (let
|
|
5328
|
-
const
|
|
5329
|
-
if (
|
|
5330
|
-
const
|
|
5331
|
-
if (
|
|
5332
|
-
let
|
|
5333
|
-
|
|
5334
|
-
} else if (
|
|
5335
|
-
if (
|
|
5336
|
-
const
|
|
5337
|
-
|
|
5323
|
+
S.push(D % 1e3), D = Math.floor(D / 1e3);
|
|
5324
|
+
let M = -1;
|
|
5325
|
+
for (let j = 0; j < S.length; j++) S[j] !== 0 && (M = j);
|
|
5326
|
+
const _ = [];
|
|
5327
|
+
for (let j = S.length - 1; j >= 0; j--) {
|
|
5328
|
+
const J = S[j];
|
|
5329
|
+
if (J === 0) continue;
|
|
5330
|
+
const R = y[j];
|
|
5331
|
+
if (h === "cardinal") {
|
|
5332
|
+
let H = x(J, "cardinal");
|
|
5333
|
+
R && (H += ` ${R}`), _.push(H);
|
|
5334
|
+
} else if (j === M)
|
|
5335
|
+
if (j > 0) {
|
|
5336
|
+
const W = x(J, "cardinal"), O = v[j];
|
|
5337
|
+
_.push(W ? `${W} ${O}` : O);
|
|
5338
5338
|
} else {
|
|
5339
|
-
const
|
|
5340
|
-
|
|
5339
|
+
const W = x(J, "ordinal");
|
|
5340
|
+
_.push(W);
|
|
5341
5341
|
}
|
|
5342
5342
|
else {
|
|
5343
|
-
let
|
|
5344
|
-
|
|
5343
|
+
let W = x(J, "cardinal");
|
|
5344
|
+
R && (W += ` ${R}`), _.push(W);
|
|
5345
5345
|
}
|
|
5346
5346
|
}
|
|
5347
|
-
return
|
|
5347
|
+
return _.join(", ");
|
|
5348
5348
|
}
|
|
5349
|
-
n.translate =
|
|
5350
|
-
function c(
|
|
5351
|
-
const
|
|
5352
|
-
return
|
|
5349
|
+
n.translate = m;
|
|
5350
|
+
function c(o, h = 0, f = 100, d = 0) {
|
|
5351
|
+
const g = Math.min(Math.max(o, h), f);
|
|
5352
|
+
return b(g, d);
|
|
5353
5353
|
}
|
|
5354
5354
|
n.balance = c;
|
|
5355
|
-
function
|
|
5356
|
-
const
|
|
5357
|
-
return Math.round(
|
|
5355
|
+
function b(o, h = 2) {
|
|
5356
|
+
const f = Math.pow(10, h);
|
|
5357
|
+
return Math.round(o * f) / f;
|
|
5358
5358
|
}
|
|
5359
|
-
n.round =
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
if (u) {
|
|
5365
|
-
const m = u();
|
|
5366
|
-
o(m ?? null);
|
|
5367
|
-
} else o(null);
|
|
5368
|
-
}, f)
|
|
5369
|
-
);
|
|
5370
|
-
}
|
|
5371
|
-
n.delay = l, n.typedEntries = a.entries, n.typedValues = a.values, n.typedKeys = a.keys;
|
|
5372
|
-
function c(f) {
|
|
5373
|
-
const u = Object.values(f).reduce((h, p) => h + p, 0), o = (0, n.typedEntries)(f).sort((h, p) => p[1] - h[1]), m = Math.random() * u;
|
|
5374
|
-
let w = 0;
|
|
5375
|
-
for (const [h, p] of o)
|
|
5376
|
-
if (w += p, m < w)
|
|
5377
|
-
return h;
|
|
5359
|
+
n.round = b;
|
|
5360
|
+
function p(o, h, f = 0) {
|
|
5361
|
+
o > h && ([o, h] = [h, o]);
|
|
5362
|
+
const d = Math.random() * (h - o) + o;
|
|
5363
|
+
return f ? Number(d.toFixed(f)) : Math.round(d);
|
|
5378
5364
|
}
|
|
5379
|
-
n.
|
|
5380
|
-
})(
|
|
5365
|
+
n.number = p;
|
|
5366
|
+
})(e = l.number || (l.number = {}));
|
|
5381
5367
|
let t;
|
|
5382
5368
|
((n) => {
|
|
5383
|
-
function
|
|
5384
|
-
const
|
|
5385
|
-
if (
|
|
5386
|
-
const y =
|
|
5387
|
-
let
|
|
5388
|
-
return
|
|
5369
|
+
function m(h, f, d) {
|
|
5370
|
+
const g = f.match(/^<span(?: class="[^"]*")? style="([^"]*)">(.*)<\/span>$/s);
|
|
5371
|
+
if (g) {
|
|
5372
|
+
const y = g[1], v = g[2], C = g[0].match(/class="([^"]*)"/)?.[1] || "";
|
|
5373
|
+
let x = [y, h].filter((S) => S.length).map((S) => S.endsWith(";") ? S.slice(0, -1) : S).join("; ").replace(/\s*;\s*/g, "; ").trim();
|
|
5374
|
+
return x.endsWith(";") || (x += ";"), `<span${C ? ` class="${C} ${d ?? ""}"` : ""}${x ? ` style="${x}"` : ""}>${v}</span>`;
|
|
5389
5375
|
} else
|
|
5390
|
-
return
|
|
5376
|
+
return h && h.length && !h.endsWith(";") && (h += ";"), `<span${d ? ` class="${d}"` : ""}${h ? ` style="${h}"` : ""}>${f}</span>`;
|
|
5391
5377
|
}
|
|
5392
|
-
n.mergeSpanStyles =
|
|
5393
|
-
function c(
|
|
5394
|
-
const { return: y = !1, parent:
|
|
5395
|
-
if (!
|
|
5378
|
+
n.mergeSpanStyles = m;
|
|
5379
|
+
function c(h, f = 0, d = 1, g) {
|
|
5380
|
+
const { return: y = !1, parent: v, base: C } = g || {}, x = v || h.parentElement || document.body;
|
|
5381
|
+
if (!x)
|
|
5396
5382
|
throw new Error("No parent element found for scaling");
|
|
5397
|
-
const
|
|
5398
|
-
if (
|
|
5383
|
+
const S = x.getBoundingClientRect(), D = h.offsetWidth, M = h.offsetHeight;
|
|
5384
|
+
if (D === 0 || M === 0)
|
|
5399
5385
|
throw new Error("Element has zero width or height, cannot scale");
|
|
5400
|
-
const
|
|
5401
|
-
let
|
|
5402
|
-
if (
|
|
5403
|
-
const
|
|
5404
|
-
|
|
5405
|
-
}
|
|
5406
|
-
const
|
|
5407
|
-
width:
|
|
5408
|
-
height:
|
|
5409
|
-
scale:
|
|
5386
|
+
const _ = S.width * d / D, j = S.height * d / M;
|
|
5387
|
+
let J = C === "width" ? _ : C === "height" ? j : Math.min(_, j);
|
|
5388
|
+
if (f > 0) {
|
|
5389
|
+
const H = S.width * f / D, W = S.height * f / M, O = Math.max(H, W);
|
|
5390
|
+
J = Math.max(O, J);
|
|
5391
|
+
}
|
|
5392
|
+
const R = {
|
|
5393
|
+
width: D * J,
|
|
5394
|
+
height: M * J,
|
|
5395
|
+
scale: J
|
|
5410
5396
|
};
|
|
5411
|
-
return y || (
|
|
5397
|
+
return y || (h.style.transform = `scale(${J})`, h.style.transformOrigin = "center center"), R;
|
|
5412
5398
|
}
|
|
5413
5399
|
n.scale = c;
|
|
5414
|
-
function
|
|
5400
|
+
function b(h, f = {}) {
|
|
5415
5401
|
const {
|
|
5416
|
-
parent:
|
|
5417
|
-
prefer:
|
|
5402
|
+
parent: d = h.parentElement,
|
|
5403
|
+
prefer: g = "auto",
|
|
5418
5404
|
min: y = 0,
|
|
5419
|
-
max:
|
|
5420
|
-
apply:
|
|
5405
|
+
max: v = 1,
|
|
5406
|
+
apply: C = () => {
|
|
5421
5407
|
}
|
|
5422
|
-
} =
|
|
5423
|
-
if (!
|
|
5408
|
+
} = f;
|
|
5409
|
+
if (!d)
|
|
5424
5410
|
throw new Error("No parent element found for scaling");
|
|
5425
|
-
const
|
|
5426
|
-
let
|
|
5427
|
-
const F = Math.max(
|
|
5428
|
-
|
|
5429
|
-
const B =
|
|
5430
|
-
return
|
|
5411
|
+
const x = d.getBoundingClientRect(), S = h.getBoundingClientRect(), D = x.width, M = x.height, _ = S.width, j = S.height;
|
|
5412
|
+
let J = D * y / _, R = M * y / j, H = D * v / _, W = M * v / j, O = Math.min(H, W);
|
|
5413
|
+
const F = Math.max(J, R);
|
|
5414
|
+
O = Math.max(O, F);
|
|
5415
|
+
const B = _ * O, st = j * O;
|
|
5416
|
+
return g === "width" ? O = Math.max(J, Math.min(H, D / _)) : g === "height" ? O = Math.max(R, Math.min(W, M / j)) : B > D ? O = Math.max(J, Math.min(H, D / _)) : st > M && (O = Math.max(R, Math.min(W, M / j))), C.apply(h, [O, h]), O;
|
|
5431
5417
|
}
|
|
5432
|
-
n.scalev2 =
|
|
5433
|
-
function
|
|
5434
|
-
const
|
|
5435
|
-
minFontSize:
|
|
5436
|
-
maxFontSize:
|
|
5437
|
-
},
|
|
5438
|
-
if (!
|
|
5418
|
+
n.scalev2 = b;
|
|
5419
|
+
function p(h, f = 1, d = {}) {
|
|
5420
|
+
const g = parseFloat(getComputedStyle(h).getPropertyValue("font-size")), y = {
|
|
5421
|
+
minFontSize: d?.minFontSize ?? 0,
|
|
5422
|
+
maxFontSize: d?.maxFontSize ?? g
|
|
5423
|
+
}, v = d?.parent || h.parentElement;
|
|
5424
|
+
if (!v)
|
|
5439
5425
|
throw new Error("No parent element found for fitting text");
|
|
5440
|
-
const
|
|
5441
|
-
return
|
|
5426
|
+
const C = v.clientWidth * f, x = h.offsetWidth, S = C / x, D = g * S, M = e.balance(D, y.minFontSize, y.maxFontSize);
|
|
5427
|
+
return h.style.fontSize = M + "px", h;
|
|
5442
5428
|
}
|
|
5443
|
-
n.fitText =
|
|
5444
|
-
function o(
|
|
5445
|
-
const
|
|
5446
|
-
let y =
|
|
5447
|
-
function
|
|
5448
|
-
if (
|
|
5449
|
-
const
|
|
5450
|
-
const
|
|
5451
|
-
return
|
|
5452
|
-
` ||
|
|
5453
|
-
}),
|
|
5454
|
-
return
|
|
5455
|
-
} else if (
|
|
5456
|
-
const
|
|
5457
|
-
return
|
|
5458
|
-
const
|
|
5459
|
-
(
|
|
5460
|
-
}),
|
|
5461
|
-
}
|
|
5462
|
-
return
|
|
5463
|
-
}
|
|
5464
|
-
const
|
|
5465
|
-
|
|
5466
|
-
if (
|
|
5429
|
+
n.fitText = p;
|
|
5430
|
+
function o(h, f = 0) {
|
|
5431
|
+
const g = new DOMParser().parseFromString(h, "text/html");
|
|
5432
|
+
let y = f;
|
|
5433
|
+
function v(D) {
|
|
5434
|
+
if (D.nodeType === Node.TEXT_NODE) {
|
|
5435
|
+
const _ = (D.textContent || "").split("").map((J, R) => {
|
|
5436
|
+
const H = document.createElement("span");
|
|
5437
|
+
return H.classList.add("char"), H.dataset.index = String(y), H.dataset.exclusivityIndex = String(y), H.style.setProperty("--char-index", String(y)), H.style.setProperty("--exclusivity-index", String(y)), (J === " " || J === `
|
|
5438
|
+
` || J === " ") && (H.style.whiteSpace = "pre-wrap"), H.textContent = J, y++, H;
|
|
5439
|
+
}), j = document.createDocumentFragment();
|
|
5440
|
+
return _.forEach((J) => j.appendChild(J)), j;
|
|
5441
|
+
} else if (D.nodeType === Node.ELEMENT_NODE) {
|
|
5442
|
+
const M = D.cloneNode(!1);
|
|
5443
|
+
return M.classList.add("container"), M.dataset.index = String(y), M.style.setProperty("--char-index", String(y)), D.childNodes.forEach((_) => {
|
|
5444
|
+
const j = v(_);
|
|
5445
|
+
(j instanceof DocumentFragment || j instanceof Node) && M.appendChild(j);
|
|
5446
|
+
}), M;
|
|
5447
|
+
}
|
|
5448
|
+
return D.cloneNode(!0);
|
|
5449
|
+
}
|
|
5450
|
+
const C = g.body, x = document.createElement("div");
|
|
5451
|
+
C.childNodes.forEach((D) => {
|
|
5452
|
+
if (D.nodeType === Node.TEXT_NODE && !D.textContent?.trim())
|
|
5467
5453
|
return;
|
|
5468
|
-
const
|
|
5469
|
-
(
|
|
5454
|
+
const M = v(D);
|
|
5455
|
+
(M instanceof DocumentFragment || M instanceof Node) && x.appendChild(M);
|
|
5470
5456
|
});
|
|
5471
|
-
let
|
|
5472
|
-
return Array.from(
|
|
5473
|
-
|
|
5474
|
-
}),
|
|
5457
|
+
let S = "";
|
|
5458
|
+
return Array.from(x.childNodes).forEach((D) => {
|
|
5459
|
+
D.nodeType === Node.TEXT_NODE ? S += D.textContent : S += D.outerHTML;
|
|
5460
|
+
}), S;
|
|
5475
5461
|
}
|
|
5476
5462
|
n.splitTextToChars = o;
|
|
5477
|
-
})(t =
|
|
5463
|
+
})(t = l.element || (l.element = {}));
|
|
5478
5464
|
let a;
|
|
5479
5465
|
((n) => {
|
|
5480
|
-
function
|
|
5481
|
-
const
|
|
5482
|
-
for (const
|
|
5483
|
-
if (!Object.prototype.hasOwnProperty.call(o,
|
|
5484
|
-
const y = o[
|
|
5466
|
+
function m(o, h = !0, f = "") {
|
|
5467
|
+
const d = {};
|
|
5468
|
+
for (const g in o) {
|
|
5469
|
+
if (!Object.prototype.hasOwnProperty.call(o, g)) continue;
|
|
5470
|
+
const y = o[g], v = f ? `${f}.${g}` : g;
|
|
5485
5471
|
if (y == null) {
|
|
5486
|
-
|
|
5472
|
+
d[v] = String(y);
|
|
5487
5473
|
continue;
|
|
5488
5474
|
}
|
|
5489
5475
|
if (typeof y == "number" && isNaN(y)) {
|
|
5490
|
-
|
|
5476
|
+
d[v] = "NaN";
|
|
5491
5477
|
continue;
|
|
5492
5478
|
}
|
|
5493
5479
|
if (typeof y == "number" && !isNaN(y)) {
|
|
5494
|
-
|
|
5480
|
+
d[v] = h ? String(y) : y;
|
|
5495
5481
|
continue;
|
|
5496
5482
|
}
|
|
5497
5483
|
if (y instanceof Date) {
|
|
5498
|
-
|
|
5484
|
+
d[v] = y.toISOString();
|
|
5499
5485
|
continue;
|
|
5500
5486
|
}
|
|
5501
5487
|
if (y instanceof Map) {
|
|
5502
|
-
y.forEach((
|
|
5503
|
-
|
|
5488
|
+
y.forEach((C, x) => {
|
|
5489
|
+
d[`${v}.${x}`] = JSON.stringify(C);
|
|
5504
5490
|
});
|
|
5505
5491
|
continue;
|
|
5506
5492
|
}
|
|
5507
5493
|
if (Array.isArray(y)) {
|
|
5508
|
-
y.forEach((
|
|
5509
|
-
const
|
|
5510
|
-
typeof
|
|
5494
|
+
y.forEach((C, x) => {
|
|
5495
|
+
const S = `${v}:${x}`;
|
|
5496
|
+
typeof C == "object" ? Object.assign(d, m(C, h, S)) : d[S] = h ? String(C) : C;
|
|
5511
5497
|
});
|
|
5512
5498
|
continue;
|
|
5513
5499
|
}
|
|
5514
5500
|
if (typeof y == "object") {
|
|
5515
|
-
Object.assign(
|
|
5501
|
+
Object.assign(d, m(y, h, v));
|
|
5516
5502
|
continue;
|
|
5517
5503
|
}
|
|
5518
|
-
|
|
5504
|
+
d[v] = String(y);
|
|
5519
5505
|
}
|
|
5520
|
-
return
|
|
5506
|
+
return d;
|
|
5521
5507
|
}
|
|
5522
|
-
n.flatten =
|
|
5508
|
+
n.flatten = m;
|
|
5523
5509
|
function c(o) {
|
|
5524
5510
|
return Object.entries(o);
|
|
5525
5511
|
}
|
|
5526
5512
|
n.entries = c;
|
|
5527
|
-
function
|
|
5513
|
+
function b(o) {
|
|
5528
5514
|
return Object.values(o);
|
|
5529
5515
|
}
|
|
5530
|
-
n.values =
|
|
5531
|
-
function
|
|
5516
|
+
n.values = b;
|
|
5517
|
+
function p(o) {
|
|
5532
5518
|
return Object.keys(o);
|
|
5533
5519
|
}
|
|
5534
|
-
n.keys =
|
|
5535
|
-
})(a =
|
|
5536
|
-
function
|
|
5537
|
-
const
|
|
5538
|
-
return
|
|
5539
|
-
const
|
|
5540
|
-
let y = 0,
|
|
5520
|
+
n.keys = p;
|
|
5521
|
+
})(a = l.object || (l.object = {})), ((n) => {
|
|
5522
|
+
function m(o, h = A.emotes) {
|
|
5523
|
+
const f = [];
|
|
5524
|
+
return h.forEach((d) => {
|
|
5525
|
+
const g = d.name;
|
|
5526
|
+
let y = 0, v = 0;
|
|
5541
5527
|
for (; y < o.length; ) {
|
|
5542
|
-
const
|
|
5543
|
-
if (
|
|
5544
|
-
const
|
|
5545
|
-
/\s/.test(
|
|
5528
|
+
const C = o.indexOf(g, v);
|
|
5529
|
+
if (C === -1) break;
|
|
5530
|
+
const x = C > 0 ? o[C - 1] : " ", S = C + g.length < o.length ? o[C + g.length] : " ";
|
|
5531
|
+
/\s/.test(x) && /\s/.test(S) && f.push({ ...d, start: C, end: C + g.length }), v = C + 1;
|
|
5546
5532
|
}
|
|
5547
|
-
}),
|
|
5533
|
+
}), f.sort((d, g) => d.start - g.start);
|
|
5548
5534
|
}
|
|
5549
|
-
n.findEmotesInText =
|
|
5550
|
-
function c(o,
|
|
5551
|
-
if (!
|
|
5552
|
-
let
|
|
5553
|
-
return
|
|
5554
|
-
|
|
5555
|
-
const
|
|
5556
|
-
|
|
5557
|
-
}),
|
|
5535
|
+
n.findEmotesInText = m;
|
|
5536
|
+
function c(o, h) {
|
|
5537
|
+
if (!h.length) return o;
|
|
5538
|
+
let f = "", d = 0;
|
|
5539
|
+
return h.forEach((g) => {
|
|
5540
|
+
f += o.substring(d, g.start);
|
|
5541
|
+
const v = Array.from({ ...g.urls, length: 5 }).slice(1).reverse().filter(Boolean)[0] || g.urls[1];
|
|
5542
|
+
f += `<img src="${v}" alt="${g.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`, d = g.end;
|
|
5543
|
+
}), f += o.substring(d), f;
|
|
5558
5544
|
}
|
|
5559
5545
|
n.replaceEmotesWithHTML = c;
|
|
5560
|
-
function
|
|
5561
|
-
return Array.from(o.matchAll(/:(.*?):/gim), (
|
|
5562
|
-
const
|
|
5563
|
-
(y) => y.shortcuts.includes(
|
|
5546
|
+
function b(o, h = A.youtube_emotes) {
|
|
5547
|
+
return Array.from(o.matchAll(/:(.*?):/gim), (d) => d[0]).forEach((d) => {
|
|
5548
|
+
const g = h.find(
|
|
5549
|
+
(y) => y.shortcuts.includes(d) || y.searchTerms.includes(d.slice(1, -1))
|
|
5564
5550
|
);
|
|
5565
|
-
if (
|
|
5566
|
-
const y =
|
|
5551
|
+
if (g) {
|
|
5552
|
+
const y = g.image.thumbnails.at(-1)?.url, v = g.image.accessibility.accessibilityData.label;
|
|
5567
5553
|
y && (o = o.replace(
|
|
5568
|
-
|
|
5569
|
-
`<img src="${y}" alt="${
|
|
5554
|
+
d,
|
|
5555
|
+
`<img src="${y}" alt="${v}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`
|
|
5570
5556
|
));
|
|
5571
5557
|
}
|
|
5572
5558
|
}), o;
|
|
5573
5559
|
}
|
|
5574
|
-
n.replaceYoutubeEmotesWithHTML =
|
|
5575
|
-
async function
|
|
5576
|
-
if (!Array.isArray(o) && typeof o == "string" && (o = o.split(",").map((
|
|
5577
|
-
var
|
|
5578
|
-
for await (const
|
|
5579
|
-
var
|
|
5580
|
-
!o.includes(
|
|
5560
|
+
n.replaceYoutubeEmotesWithHTML = b;
|
|
5561
|
+
async function p(o = [], h) {
|
|
5562
|
+
if (!Array.isArray(o) && typeof o == "string" && (o = o.split(",").map((v) => v.trim())), !o || !o.length) {
|
|
5563
|
+
var f = s.number(1, 3);
|
|
5564
|
+
for await (const v of Array.from({ length: f }, () => "")) {
|
|
5565
|
+
var d = s.array(Object.keys(A.badges))[0];
|
|
5566
|
+
!o.includes(d) && Array.isArray(o) ? o.push(d) : o = [d];
|
|
5581
5567
|
}
|
|
5582
5568
|
}
|
|
5583
|
-
var
|
|
5584
|
-
switch (
|
|
5569
|
+
var g;
|
|
5570
|
+
switch (h) {
|
|
5585
5571
|
case "twitch": {
|
|
5586
|
-
|
|
5587
|
-
keys: Array.from(o).filter((
|
|
5588
|
-
badges: Array.from(o).slice(0, 3).map((
|
|
5572
|
+
g = {
|
|
5573
|
+
keys: Array.from(o).filter((v) => v in A.badges),
|
|
5574
|
+
badges: Array.from(o).slice(0, 3).map((v) => A.badges[v]).filter(Boolean)
|
|
5589
5575
|
};
|
|
5590
5576
|
break;
|
|
5591
5577
|
}
|
|
@@ -5598,8 +5584,8 @@ var b;
|
|
|
5598
5584
|
subscriber: { isChatSponsor: !0 },
|
|
5599
5585
|
moderator: { isChatModerator: !0 }
|
|
5600
5586
|
};
|
|
5601
|
-
|
|
5602
|
-
(
|
|
5587
|
+
g = Object.entries(o).reduce(
|
|
5588
|
+
(v, [C]) => (C in y && Object.assign(v, y[C]), v),
|
|
5603
5589
|
{
|
|
5604
5590
|
isVerified: !1,
|
|
5605
5591
|
isChatOwner: !1,
|
|
@@ -5610,12 +5596,12 @@ var b;
|
|
|
5610
5596
|
break;
|
|
5611
5597
|
}
|
|
5612
5598
|
}
|
|
5613
|
-
return
|
|
5599
|
+
return g;
|
|
5614
5600
|
}
|
|
5615
|
-
n.generateBadges =
|
|
5616
|
-
})(
|
|
5617
|
-
function
|
|
5618
|
-
var
|
|
5601
|
+
n.generateBadges = p;
|
|
5602
|
+
})(l.message || (l.message = {})), ((n) => {
|
|
5603
|
+
function m(c) {
|
|
5604
|
+
var b = (
|
|
5619
5605
|
// @ts-ignore
|
|
5620
5606
|
c.event?.provider || // @ts-ignore
|
|
5621
5607
|
c.event?.service || // @ts-ignore
|
|
@@ -5629,86 +5615,86 @@ var b;
|
|
|
5629
5615
|
"tip-latest",
|
|
5630
5616
|
"event:test",
|
|
5631
5617
|
"event:skip"
|
|
5632
|
-
].some((
|
|
5618
|
+
].some((h) => h === c.listener) && (b = "streamelements"), { provider: b, data: c };
|
|
5633
5619
|
}
|
|
5634
|
-
n.parseProvider =
|
|
5635
|
-
})(
|
|
5620
|
+
n.parseProvider = m;
|
|
5621
|
+
})(l.event || (l.event = {})), ((n) => {
|
|
5636
5622
|
n.PRESETS = {};
|
|
5637
|
-
async function
|
|
5638
|
-
const
|
|
5639
|
-
|
|
5640
|
-
const
|
|
5641
|
-
return
|
|
5623
|
+
async function m(p, o, h) {
|
|
5624
|
+
const f = [];
|
|
5625
|
+
p.replace(o, (g, ...y) => {
|
|
5626
|
+
const v = typeof h == "function" ? h(g, ...y) : g;
|
|
5627
|
+
return f.push(Promise.resolve(v)), g;
|
|
5642
5628
|
});
|
|
5643
|
-
const
|
|
5644
|
-
return
|
|
5629
|
+
const d = await Promise.all(f);
|
|
5630
|
+
return p.replace(o, () => d.shift() ?? "");
|
|
5645
5631
|
}
|
|
5646
|
-
n.replace =
|
|
5647
|
-
function c(
|
|
5648
|
-
return
|
|
5632
|
+
n.replace = m;
|
|
5633
|
+
function c(p) {
|
|
5634
|
+
return p.charAt(0).toUpperCase() + p.slice(1);
|
|
5649
5635
|
}
|
|
5650
5636
|
n.capitalize = c;
|
|
5651
|
-
function
|
|
5637
|
+
function b(p, o = {}, h = {
|
|
5652
5638
|
method: "index",
|
|
5653
5639
|
html: !1,
|
|
5654
5640
|
debug: !1,
|
|
5655
5641
|
modifiers: {},
|
|
5656
5642
|
aliases: {}
|
|
5657
5643
|
}) {
|
|
5658
|
-
const { mergeSpanStyles:
|
|
5644
|
+
const { mergeSpanStyles: f } = t, d = (r, u, k) => h.html ? f(r, u, k) : u, g = {
|
|
5659
5645
|
skip: "<br/>",
|
|
5660
5646
|
newline: "<br/>",
|
|
5661
5647
|
...o
|
|
5662
5648
|
};
|
|
5663
|
-
let y = "$",
|
|
5649
|
+
let y = "$", v = "USD";
|
|
5664
5650
|
if (typeof window < "u")
|
|
5665
5651
|
try {
|
|
5666
|
-
const
|
|
5667
|
-
|
|
5652
|
+
const u = window.client?.details?.currency;
|
|
5653
|
+
u?.symbol && (y = String(u.symbol)), u?.code && (v = String(u.code));
|
|
5668
5654
|
} catch {
|
|
5669
5655
|
}
|
|
5670
|
-
const
|
|
5671
|
-
(r, [
|
|
5672
|
-
if (r[
|
|
5673
|
-
const
|
|
5674
|
-
r.username = r.username ||
|
|
5656
|
+
const C = Object.entries(a.flatten(g)).reduce(
|
|
5657
|
+
(r, [u, k]) => {
|
|
5658
|
+
if (r[u] = String(k), ["username", "name", "nick", "nickname", "sender"].some((U) => u === U)) {
|
|
5659
|
+
const U = r?.username || r?.name || r?.nick || r?.nickname || r?.sender;
|
|
5660
|
+
r.username = r.username || U, r.usernameAt = `@${r.username}`, r.name = r.name || U, r.nick = r.nick || U, r.nickname = r.nickname || U, r.sender = r.sender || U, r.senderAt = `@${r.sender}`;
|
|
5675
5661
|
}
|
|
5676
|
-
return ["amount", "count"].some((
|
|
5662
|
+
return ["amount", "count"].some((U) => u === U) && (r.amount = String(r?.amount || r.count || k), r.count = String(r?.count || r?.amount || k)), r.currency = r.currency || y, r.currencyCode = r.currencyCode || v, r;
|
|
5677
5663
|
},
|
|
5678
5664
|
{}
|
|
5679
|
-
),
|
|
5665
|
+
), x = {
|
|
5680
5666
|
PLACEHOLDERS: /{([^}]+)}/g,
|
|
5681
5667
|
MODIFIERS: /\[([^\]=]+)=([^\]]+)\]/g
|
|
5682
5668
|
};
|
|
5683
|
-
var
|
|
5684
|
-
function
|
|
5685
|
-
const
|
|
5686
|
-
if (!
|
|
5687
|
-
const
|
|
5669
|
+
var S = parseFloat(C?.amount ?? C?.count ?? 0);
|
|
5670
|
+
function D(r, u) {
|
|
5671
|
+
const k = r?.trim?.() ?? "";
|
|
5672
|
+
if (!k.length) return null;
|
|
5673
|
+
const U = u[k], I = parseFloat(String(U !== void 0 ? U : k).replace(/\s/g, ""));
|
|
5688
5674
|
return isNaN(I) ? null : I;
|
|
5689
5675
|
}
|
|
5690
|
-
function
|
|
5691
|
-
const
|
|
5692
|
-
if (
|
|
5676
|
+
function M(r, u, k) {
|
|
5677
|
+
const U = isNaN(Number(u)) ? 0 : Math.max(0, parseInt(String(u))), L = D(r, k);
|
|
5678
|
+
if (L === null) return r;
|
|
5693
5679
|
try {
|
|
5694
|
-
return
|
|
5695
|
-
minimumFractionDigits:
|
|
5696
|
-
maximumFractionDigits:
|
|
5680
|
+
return L.toLocaleString(void 0, {
|
|
5681
|
+
minimumFractionDigits: U,
|
|
5682
|
+
maximumFractionDigits: U
|
|
5697
5683
|
});
|
|
5698
5684
|
} catch {
|
|
5699
|
-
return
|
|
5685
|
+
return L.toFixed(U);
|
|
5700
5686
|
}
|
|
5701
5687
|
}
|
|
5702
|
-
function
|
|
5703
|
-
const
|
|
5704
|
-
return
|
|
5688
|
+
function _(r, u = /* @__PURE__ */ new Date()) {
|
|
5689
|
+
const k = u.getTime() - r.getTime(), U = k >= 0, L = Math.abs(k), I = Math.floor(L / 1e3), T = Math.floor(I / 60), P = Math.floor(T / 60), E = Math.floor(P / 24), z = Math.floor(E / 30), V = Math.floor(E / 365), Y = U ? "ago" : "from now";
|
|
5690
|
+
return V > 0 ? `${V}y ${Y}` : z > 0 ? `${z}mo ${Y}` : E > 0 ? `${E}d ${Y}` : P > 0 ? `${P}h ${Y}` : T > 0 ? `${T}m ${Y}` : `${Math.max(I, 0)}s ${Y}`;
|
|
5705
5691
|
}
|
|
5706
|
-
function
|
|
5707
|
-
const
|
|
5708
|
-
if (!
|
|
5709
|
-
const
|
|
5692
|
+
function j(r, u, k) {
|
|
5693
|
+
const U = r?.trim?.() ?? "";
|
|
5694
|
+
if (!U.length) return r;
|
|
5695
|
+
const L = k[U] ?? U, I = new Date(L);
|
|
5710
5696
|
if (isNaN(I.getTime())) return r;
|
|
5711
|
-
const T = (
|
|
5697
|
+
const T = (u ?? "date").toString().toLowerCase();
|
|
5712
5698
|
try {
|
|
5713
5699
|
switch (T) {
|
|
5714
5700
|
case "time":
|
|
@@ -5718,7 +5704,7 @@ var b;
|
|
|
5718
5704
|
return I.toLocaleString();
|
|
5719
5705
|
case "relative":
|
|
5720
5706
|
case "ago":
|
|
5721
|
-
return
|
|
5707
|
+
return _(I);
|
|
5722
5708
|
case "iso":
|
|
5723
5709
|
return I.toISOString();
|
|
5724
5710
|
default:
|
|
@@ -5728,187 +5714,187 @@ var b;
|
|
|
5728
5714
|
return r;
|
|
5729
5715
|
}
|
|
5730
5716
|
}
|
|
5731
|
-
function
|
|
5732
|
-
const
|
|
5733
|
-
let
|
|
5734
|
-
T &&
|
|
5735
|
-
const E = parseFloat(String(
|
|
5736
|
-
return isNaN(E) ?
|
|
5717
|
+
function J(r, u, k) {
|
|
5718
|
+
const U = r ?? "", [L, I = L] = U.split("|", 2), T = u?.trim();
|
|
5719
|
+
let P;
|
|
5720
|
+
T && k[T] !== void 0 ? P = k[T] : P = k.amount ?? k.count;
|
|
5721
|
+
const E = parseFloat(String(P));
|
|
5722
|
+
return isNaN(E) ? L : Math.abs(E) !== 1 ? I : L;
|
|
5737
5723
|
}
|
|
5738
|
-
function
|
|
5739
|
-
const
|
|
5740
|
-
let
|
|
5724
|
+
function R(r, u, k) {
|
|
5725
|
+
const U = u?.trim() ?? "", L = U && k[U] !== void 0 ? k[U] : "", I = String(L), T = (r ?? "").split("|").map((E) => E.trim()).filter((E) => E.length);
|
|
5726
|
+
let P;
|
|
5741
5727
|
for (const E of T) {
|
|
5742
|
-
const
|
|
5743
|
-
if (
|
|
5744
|
-
const
|
|
5745
|
-
if (
|
|
5746
|
-
if (
|
|
5747
|
-
|
|
5728
|
+
const z = E.indexOf(":");
|
|
5729
|
+
if (z === -1) continue;
|
|
5730
|
+
const V = E.slice(0, z).trim(), Y = E.slice(z + 1);
|
|
5731
|
+
if (V.length) {
|
|
5732
|
+
if (V.toLowerCase() === "default") {
|
|
5733
|
+
P = Y;
|
|
5748
5734
|
continue;
|
|
5749
5735
|
}
|
|
5750
|
-
if (I ===
|
|
5736
|
+
if (I === V) return Y;
|
|
5751
5737
|
}
|
|
5752
5738
|
}
|
|
5753
|
-
return
|
|
5739
|
+
return P ?? "";
|
|
5754
5740
|
}
|
|
5755
|
-
function
|
|
5741
|
+
function H(r) {
|
|
5756
5742
|
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5757
5743
|
}
|
|
5758
|
-
function
|
|
5759
|
-
let
|
|
5760
|
-
if (!
|
|
5761
|
-
const
|
|
5762
|
-
if (
|
|
5763
|
-
return
|
|
5764
|
-
const I =
|
|
5744
|
+
function W(r, u) {
|
|
5745
|
+
let k = r.trim();
|
|
5746
|
+
if (!k.length) return;
|
|
5747
|
+
const U = k[0], L = k[k.length - 1];
|
|
5748
|
+
if (U === '"' && L === '"' || U === "'" && L === "'")
|
|
5749
|
+
return k.slice(1, -1);
|
|
5750
|
+
const I = k.toLowerCase();
|
|
5765
5751
|
if (I === "true") return !0;
|
|
5766
5752
|
if (I === "false") return !1;
|
|
5767
|
-
if (/^-?\d+(\.\d+)?$/.test(
|
|
5768
|
-
const T =
|
|
5769
|
-
if (T === void 0) return
|
|
5770
|
-
const
|
|
5771
|
-
return E === "true" ? !0 : E === "false" ? !1 : /^-?\d+(\.\d+)?$/.test(
|
|
5753
|
+
if (/^-?\d+(\.\d+)?$/.test(k)) return parseFloat(k);
|
|
5754
|
+
const T = u?.[k];
|
|
5755
|
+
if (T === void 0) return k;
|
|
5756
|
+
const P = String(T).trim(), E = P.toLowerCase();
|
|
5757
|
+
return E === "true" ? !0 : E === "false" ? !1 : /^-?\d+(\.\d+)?$/.test(P) ? parseFloat(P) : T;
|
|
5772
5758
|
}
|
|
5773
|
-
function
|
|
5759
|
+
function O(r) {
|
|
5774
5760
|
if (typeof r == "boolean") return r;
|
|
5775
5761
|
if (r == null) return !1;
|
|
5776
|
-
const
|
|
5777
|
-
return !(!
|
|
5778
|
-
}
|
|
5779
|
-
function F(r,
|
|
5780
|
-
let
|
|
5781
|
-
if (!
|
|
5782
|
-
let
|
|
5783
|
-
for (;
|
|
5784
|
-
|
|
5785
|
-
const
|
|
5786
|
-
let I = null, T =
|
|
5787
|
-
for (const
|
|
5788
|
-
const
|
|
5789
|
-
if (
|
|
5790
|
-
I =
|
|
5762
|
+
const u = String(r).trim().toLowerCase();
|
|
5763
|
+
return !(!u.length || ["false", "0", "no", "off", "null", "undefined", "nan"].includes(u));
|
|
5764
|
+
}
|
|
5765
|
+
function F(r, u) {
|
|
5766
|
+
let k = r.trim();
|
|
5767
|
+
if (!k.length) return !1;
|
|
5768
|
+
let U = !1;
|
|
5769
|
+
for (; k.startsWith("!"); )
|
|
5770
|
+
U = !U, k = k.slice(1).trim();
|
|
5771
|
+
const L = ["===", "!==", "==", "!=", ">=", "<=", ">", "<"];
|
|
5772
|
+
let I = null, T = k, P = "";
|
|
5773
|
+
for (const z of L) {
|
|
5774
|
+
const V = k.indexOf(z);
|
|
5775
|
+
if (V !== -1) {
|
|
5776
|
+
I = z, T = k.slice(0, V), P = k.slice(V + z.length);
|
|
5791
5777
|
break;
|
|
5792
5778
|
}
|
|
5793
5779
|
}
|
|
5794
5780
|
let E;
|
|
5795
5781
|
if (I) {
|
|
5796
|
-
const
|
|
5782
|
+
const z = W(T, u), V = W(P, u);
|
|
5797
5783
|
switch (I) {
|
|
5798
5784
|
case "===":
|
|
5799
|
-
E =
|
|
5785
|
+
E = z === V;
|
|
5800
5786
|
break;
|
|
5801
5787
|
case "!==":
|
|
5802
|
-
E =
|
|
5788
|
+
E = z !== V;
|
|
5803
5789
|
break;
|
|
5804
5790
|
case "==":
|
|
5805
|
-
E =
|
|
5791
|
+
E = z == V;
|
|
5806
5792
|
break;
|
|
5807
5793
|
case "!=":
|
|
5808
|
-
E =
|
|
5794
|
+
E = z != V;
|
|
5809
5795
|
break;
|
|
5810
5796
|
case ">=":
|
|
5811
|
-
E =
|
|
5797
|
+
E = z >= V;
|
|
5812
5798
|
break;
|
|
5813
5799
|
case "<=":
|
|
5814
|
-
E =
|
|
5800
|
+
E = z <= V;
|
|
5815
5801
|
break;
|
|
5816
5802
|
case ">":
|
|
5817
|
-
E =
|
|
5803
|
+
E = z > V;
|
|
5818
5804
|
break;
|
|
5819
5805
|
case "<":
|
|
5820
|
-
E =
|
|
5806
|
+
E = z < V;
|
|
5821
5807
|
break;
|
|
5822
5808
|
default:
|
|
5823
5809
|
E = !1;
|
|
5824
5810
|
break;
|
|
5825
5811
|
}
|
|
5826
5812
|
} else {
|
|
5827
|
-
const
|
|
5828
|
-
E =
|
|
5829
|
-
}
|
|
5830
|
-
return
|
|
5831
|
-
}
|
|
5832
|
-
function B(r,
|
|
5833
|
-
let
|
|
5834
|
-
if (!
|
|
5835
|
-
let
|
|
5836
|
-
for (;
|
|
5837
|
-
|
|
5838
|
-
const
|
|
5839
|
-
if (!
|
|
5813
|
+
const z = W(T, u);
|
|
5814
|
+
E = O(z);
|
|
5815
|
+
}
|
|
5816
|
+
return U ? !E : E;
|
|
5817
|
+
}
|
|
5818
|
+
function B(r, u) {
|
|
5819
|
+
let k = r.trim();
|
|
5820
|
+
if (!k.length) return !1;
|
|
5821
|
+
let U = !1;
|
|
5822
|
+
for (; k.startsWith("!"); )
|
|
5823
|
+
U = !U, k = k.slice(1).trim();
|
|
5824
|
+
const L = k.split("||").map((T) => T.trim()).filter((T) => T.length);
|
|
5825
|
+
if (!L.length) return !!U;
|
|
5840
5826
|
let I = !1;
|
|
5841
|
-
for (const T of
|
|
5842
|
-
const
|
|
5843
|
-
if (!
|
|
5827
|
+
for (const T of L) {
|
|
5828
|
+
const P = T.split("&&").map((z) => z.trim()).filter((z) => z.length);
|
|
5829
|
+
if (!P.length) continue;
|
|
5844
5830
|
let E = !0;
|
|
5845
|
-
for (const
|
|
5846
|
-
const
|
|
5847
|
-
if (E = E &&
|
|
5831
|
+
for (const z of P) {
|
|
5832
|
+
const V = F(z, u);
|
|
5833
|
+
if (E = E && V, !E) break;
|
|
5848
5834
|
}
|
|
5849
5835
|
if (I = I || E, I) break;
|
|
5850
5836
|
}
|
|
5851
|
-
return
|
|
5837
|
+
return U ? !I : I;
|
|
5852
5838
|
}
|
|
5853
5839
|
const st = {
|
|
5854
|
-
COLOR: (r,
|
|
5855
|
-
WEIGHT: (r,
|
|
5856
|
-
SEMIBOLD: (r) =>
|
|
5857
|
-
BOLD: (r) =>
|
|
5858
|
-
BLACK: (r) =>
|
|
5859
|
-
LIGHT: (r) =>
|
|
5860
|
-
STRONG: (r) =>
|
|
5861
|
-
ITALIC: (r) =>
|
|
5862
|
-
UNDERLINE: (r) =>
|
|
5863
|
-
STRIKETHROUGH: (r) =>
|
|
5864
|
-
SUB: (r) =>
|
|
5865
|
-
SUP: (r) =>
|
|
5866
|
-
LARGER: (r) =>
|
|
5867
|
-
SMALL: (r) =>
|
|
5868
|
-
SHADOW: (r,
|
|
5869
|
-
SIZE: (r,
|
|
5840
|
+
COLOR: (r, u) => d(u && i.validate(u) ? `color: ${u}` : "", r, "color"),
|
|
5841
|
+
WEIGHT: (r, u) => d(u && !isNaN(parseInt(u)) ? `font-weight: ${u}` : "", r, "weight"),
|
|
5842
|
+
SEMIBOLD: (r) => d("font-weight: 600", r, "semibold"),
|
|
5843
|
+
BOLD: (r) => d("font-weight: bold", r, "bold"),
|
|
5844
|
+
BLACK: (r) => d("font-weight: 900", r, "black"),
|
|
5845
|
+
LIGHT: (r) => d("font-weight: lighter", r, "light"),
|
|
5846
|
+
STRONG: (r) => d("font-weight: bolder", r, "strong"),
|
|
5847
|
+
ITALIC: (r) => d("font-style: italic", r, "italic"),
|
|
5848
|
+
UNDERLINE: (r) => d("text-decoration: underline", r, "underline"),
|
|
5849
|
+
STRIKETHROUGH: (r) => d("text-decoration: line-through", r, "strikethrough"),
|
|
5850
|
+
SUB: (r) => d("vertical-align: sub", r, "sub"),
|
|
5851
|
+
SUP: (r) => d("vertical-align: super", r, "sup"),
|
|
5852
|
+
LARGER: (r) => d("font-size: larger", r, "larger"),
|
|
5853
|
+
SMALL: (r) => d("font-size: smaller", r, "small"),
|
|
5854
|
+
SHADOW: (r, u) => d(`text-shadow: ${u}`, r, "shadow"),
|
|
5855
|
+
SIZE: (r, u) => d(u ? `font-size: ${u}` : "", r, "size")
|
|
5870
5856
|
}, dt = {
|
|
5871
5857
|
...{
|
|
5872
|
-
BT1: (r) =>
|
|
5873
|
-
BT0: (r) =>
|
|
5874
|
-
ST1: (r) =>
|
|
5875
|
-
ST0: (r) =>
|
|
5858
|
+
BT1: (r) => S > 1 ? r : "",
|
|
5859
|
+
BT0: (r) => S > 0 ? r : "",
|
|
5860
|
+
ST1: (r) => S < 1 ? r : "",
|
|
5861
|
+
ST0: (r) => S < 0 ? r : "",
|
|
5876
5862
|
UPC: (r) => r.toUpperCase(),
|
|
5877
5863
|
LOW: (r) => r.toLowerCase(),
|
|
5878
5864
|
REV: (r) => r.split("").reverse().join(""),
|
|
5879
5865
|
CAP: (r) => r.charAt(0).toUpperCase() + r.slice(1).toLowerCase(),
|
|
5880
|
-
NUMBER: (r,
|
|
5881
|
-
PLURAL: (r,
|
|
5882
|
-
DATE: (r,
|
|
5883
|
-
MAP: (r,
|
|
5884
|
-
ESCAPE: (r) =>
|
|
5885
|
-
IF: (r,
|
|
5886
|
-
const
|
|
5887
|
-
if (!I) return
|
|
5888
|
-
const [T,
|
|
5866
|
+
NUMBER: (r, u, k) => M(r, u, k),
|
|
5867
|
+
PLURAL: (r, u, k) => J(r, u, k),
|
|
5868
|
+
DATE: (r, u, k) => j(r, u, k),
|
|
5869
|
+
MAP: (r, u, k) => R(r, u, k),
|
|
5870
|
+
ESCAPE: (r) => H(r),
|
|
5871
|
+
IF: (r, u, k) => {
|
|
5872
|
+
const U = r ?? "", [L, I] = U.split("?", 2);
|
|
5873
|
+
if (!I) return U;
|
|
5874
|
+
const [T, P = ""] = I.split("|", 2);
|
|
5889
5875
|
return B(
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
) ? T :
|
|
5876
|
+
L,
|
|
5877
|
+
k
|
|
5878
|
+
) ? T : P;
|
|
5893
5879
|
},
|
|
5894
|
-
PRESET: (r,
|
|
5895
|
-
const
|
|
5896
|
-
if (!
|
|
5897
|
-
const
|
|
5898
|
-
if (!
|
|
5899
|
-
const
|
|
5900
|
-
const [
|
|
5901
|
-
return { name:
|
|
5880
|
+
PRESET: (r, u) => {
|
|
5881
|
+
const k = u?.trim() ?? "";
|
|
5882
|
+
if (!k.length) return r;
|
|
5883
|
+
const U = n.PRESETS[k];
|
|
5884
|
+
if (!U || !U.length) return r;
|
|
5885
|
+
const L = U.split(",").map((T) => T.trim()).filter((T) => T.length).map((T) => {
|
|
5886
|
+
const [P, E] = T.split(":");
|
|
5887
|
+
return { name: P.trim(), param: E?.trim() ?? null };
|
|
5902
5888
|
});
|
|
5903
5889
|
let I = r;
|
|
5904
|
-
for (const { name: T, param:
|
|
5905
|
-
I = K(I, T,
|
|
5890
|
+
for (const { name: T, param: P } of L)
|
|
5891
|
+
I = K(I, T, P);
|
|
5906
5892
|
return I;
|
|
5907
5893
|
},
|
|
5908
|
-
FALLBACK: (r,
|
|
5894
|
+
FALLBACK: (r, u) => r.length ? r : u ?? r
|
|
5909
5895
|
},
|
|
5910
|
-
...
|
|
5911
|
-
...
|
|
5896
|
+
...h?.html ? st : {},
|
|
5897
|
+
...h.modifiers ?? {}
|
|
5912
5898
|
}, ht = {
|
|
5913
5899
|
UPC: ["UPPERCASE", "UPPER", "UPP"],
|
|
5914
5900
|
LOW: ["LOWERCASE", "LOWER", "LWC"],
|
|
@@ -5937,181 +5923,181 @@ var b;
|
|
|
5937
5923
|
SHADOW: ["SHADOW", "SHD"],
|
|
5938
5924
|
FALLBACK: ["FALLBACK", "FB"],
|
|
5939
5925
|
IF: ["IF", "COND", "CONDITION"],
|
|
5940
|
-
...
|
|
5926
|
+
...h.aliases ?? {}
|
|
5941
5927
|
};
|
|
5942
|
-
function K(r,
|
|
5943
|
-
const
|
|
5928
|
+
function K(r, u, k) {
|
|
5929
|
+
const U = Object.entries(ht).find(([I, T]) => T.some((P) => P.toUpperCase() === u.toUpperCase()) ? !0 : I.toUpperCase() === u.toUpperCase()), L = U ? U[0] : u.toUpperCase();
|
|
5944
5930
|
try {
|
|
5945
|
-
return dt[
|
|
5931
|
+
return dt[L] ? dt[L](r, typeof k == "string" ? k.trim() : null, C) : h?.html ? d("", r, L.toLowerCase()) : r;
|
|
5946
5932
|
} catch (I) {
|
|
5947
|
-
return
|
|
5933
|
+
return h?.debug && typeof console < "u" && typeof console.error == "function" && console.error("[Helper.string.compose] Modifier error", { name: u, param: k, error: I }), r;
|
|
5948
5934
|
}
|
|
5949
5935
|
}
|
|
5950
5936
|
function nt(r) {
|
|
5951
|
-
let
|
|
5952
|
-
for (; (
|
|
5953
|
-
const [
|
|
5954
|
-
const [
|
|
5955
|
-
return { name:
|
|
5937
|
+
let u = r, k;
|
|
5938
|
+
for (; (k = x.MODIFIERS.exec(u)) !== null; ) {
|
|
5939
|
+
const [U, L, I] = k, T = L.split(",").map((E) => E.trim()).filter((E) => E.length).map((E) => {
|
|
5940
|
+
const [z, V] = E.split(":");
|
|
5941
|
+
return { name: z.trim(), param: V?.trim() ?? null };
|
|
5956
5942
|
});
|
|
5957
|
-
let
|
|
5958
|
-
for (const { name: E, param:
|
|
5959
|
-
|
|
5960
|
-
|
|
5943
|
+
let P = nt(I);
|
|
5944
|
+
for (const { name: E, param: z } of T)
|
|
5945
|
+
P = K(P, E, z);
|
|
5946
|
+
u = u.replace(U, P ?? ""), x.MODIFIERS.lastIndex = 0;
|
|
5961
5947
|
}
|
|
5962
|
-
return
|
|
5948
|
+
return u;
|
|
5963
5949
|
}
|
|
5964
5950
|
function Q(r) {
|
|
5965
|
-
let
|
|
5966
|
-
const
|
|
5967
|
-
function
|
|
5951
|
+
let u = 0;
|
|
5952
|
+
const k = r.length;
|
|
5953
|
+
function U(I) {
|
|
5968
5954
|
let T = "";
|
|
5969
|
-
for (;
|
|
5970
|
-
if (r[
|
|
5971
|
-
|
|
5972
|
-
else if (r[
|
|
5973
|
-
T +=
|
|
5974
|
-
else if (I && r[
|
|
5975
|
-
|
|
5955
|
+
for (; u < k; )
|
|
5956
|
+
if (r[u] === "\\")
|
|
5957
|
+
u + 1 < k ? (T += r[u + 1], u += 2) : u++;
|
|
5958
|
+
else if (r[u] === "[" && (!I || I !== "["))
|
|
5959
|
+
T += L();
|
|
5960
|
+
else if (I && r[u] === I) {
|
|
5961
|
+
u++;
|
|
5976
5962
|
break;
|
|
5977
5963
|
} else
|
|
5978
|
-
T += r[
|
|
5964
|
+
T += r[u++];
|
|
5979
5965
|
return T;
|
|
5980
5966
|
}
|
|
5981
|
-
function
|
|
5982
|
-
|
|
5967
|
+
function L() {
|
|
5968
|
+
u++;
|
|
5983
5969
|
const I = [];
|
|
5984
|
-
for (;
|
|
5985
|
-
if (r[
|
|
5986
|
-
|
|
5970
|
+
for (; u < k && r[u] !== "="; ) {
|
|
5971
|
+
if (r[u] === ",") {
|
|
5972
|
+
u++;
|
|
5987
5973
|
continue;
|
|
5988
5974
|
}
|
|
5989
|
-
let
|
|
5990
|
-
for (;
|
|
5975
|
+
let P = "";
|
|
5976
|
+
for (; u < k && /[A-Za-z0-9]/.test(r[u]); ) P += r[u++];
|
|
5991
5977
|
let E = null;
|
|
5992
|
-
if (r[
|
|
5993
|
-
|
|
5994
|
-
const
|
|
5995
|
-
for (;
|
|
5996
|
-
E = r.slice(
|
|
5978
|
+
if (r[u] === ":") {
|
|
5979
|
+
u++;
|
|
5980
|
+
const z = u;
|
|
5981
|
+
for (; u < k && r[u] !== "," && r[u] !== "="; ) u++;
|
|
5982
|
+
E = r.slice(z, u);
|
|
5997
5983
|
}
|
|
5998
|
-
|
|
5984
|
+
P.length && I.push({ name: P, param: E }), r[u] === "," && u++;
|
|
5999
5985
|
}
|
|
6000
|
-
r[
|
|
6001
|
-
const T =
|
|
6002
|
-
return I.reduce((
|
|
5986
|
+
r[u] === "=" && u++;
|
|
5987
|
+
const T = U("]");
|
|
5988
|
+
return I.reduce((P, { name: E, param: z }) => K(P, E, z), T);
|
|
6003
5989
|
}
|
|
6004
|
-
return
|
|
5990
|
+
return U();
|
|
6005
5991
|
}
|
|
6006
|
-
let $ =
|
|
6007
|
-
|
|
6008
|
-
(r,
|
|
5992
|
+
let $ = p.replace(
|
|
5993
|
+
x.PLACEHOLDERS,
|
|
5994
|
+
(r, u) => typeof C[u] == "string" || typeof C[u] == "number" ? String(C[u]) : u ?? u
|
|
6009
5995
|
);
|
|
6010
|
-
return $ =
|
|
5996
|
+
return $ = h.method === "loop" ? nt($) : Q($), $;
|
|
6011
5997
|
}
|
|
6012
|
-
n.compose =
|
|
6013
|
-
})(
|
|
5998
|
+
n.compose = b;
|
|
5999
|
+
})(l.string || (l.string = {})), ((n) => {
|
|
6014
6000
|
n.playing = !1;
|
|
6015
|
-
function
|
|
6001
|
+
function m(c, b = 100, p = !1) {
|
|
6016
6002
|
if (!c || !c.length)
|
|
6017
6003
|
throw new Error("No sound URL provided");
|
|
6018
6004
|
try {
|
|
6019
|
-
|
|
6020
|
-
let o = new AudioContext(),
|
|
6021
|
-
|
|
6005
|
+
p && n.playing && n.audio && n.audio.state !== "closed" && n.audio.close();
|
|
6006
|
+
let o = new AudioContext(), h = o.createGain();
|
|
6007
|
+
h.connect(o.destination), p && (n.audio = o, n.playing = !0), fetch(c).then((f) => f.arrayBuffer()).then((f) => o.decodeAudioData(f)).then((f) => {
|
|
6022
6008
|
if (o.state !== "closed") {
|
|
6023
|
-
const
|
|
6024
|
-
|
|
6009
|
+
const d = o.createBufferSource();
|
|
6010
|
+
d.buffer = f, d.connect(h), h.gain.value = b / 100, d.start(o.currentTime);
|
|
6025
6011
|
}
|
|
6026
6012
|
});
|
|
6027
6013
|
} catch (o) {
|
|
6028
6014
|
throw new Error(`Error playing sound: ${o}`);
|
|
6029
6015
|
}
|
|
6030
6016
|
}
|
|
6031
|
-
n.play =
|
|
6032
|
-
})(
|
|
6017
|
+
n.play = m;
|
|
6018
|
+
})(l.sound || (l.sound = {}));
|
|
6033
6019
|
let i;
|
|
6034
6020
|
((n) => {
|
|
6035
|
-
function
|
|
6036
|
-
|
|
6037
|
-
let
|
|
6038
|
-
return
|
|
6021
|
+
function m(o = 100, h = "") {
|
|
6022
|
+
h = h.length > 7 ? h?.substring(0, 6) : h, o = o > 1 ? o / 100 : o;
|
|
6023
|
+
let f = Math.round(Math.min(Math.max(o, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
|
|
6024
|
+
return h + f;
|
|
6039
6025
|
}
|
|
6040
|
-
n.opacity =
|
|
6026
|
+
n.opacity = m;
|
|
6041
6027
|
function c(o) {
|
|
6042
6028
|
if (!o.startsWith("#") || o.length <= 7)
|
|
6043
6029
|
return {
|
|
6044
6030
|
color: o,
|
|
6045
6031
|
opacity: 100
|
|
6046
6032
|
};
|
|
6047
|
-
var
|
|
6033
|
+
var d = o.slice(-2), h = parseInt(d, 16) / 255, f = Math.round(h * 100), d = o.length > 7 ? o.slice(0, 7) : o;
|
|
6048
6034
|
return {
|
|
6049
|
-
color:
|
|
6050
|
-
opacity:
|
|
6035
|
+
color: d,
|
|
6036
|
+
opacity: f
|
|
6051
6037
|
};
|
|
6052
6038
|
}
|
|
6053
6039
|
n.extract = c;
|
|
6054
|
-
function
|
|
6040
|
+
function b(o) {
|
|
6055
6041
|
if (typeof o != "string" || !String(o).trim().length) return !1;
|
|
6056
|
-
const
|
|
6057
|
-
return /^#([A-Fa-f0-9]{3}){1,2}$/.test(
|
|
6042
|
+
const h = o.trim();
|
|
6043
|
+
return /^#([A-Fa-f0-9]{3}){1,2}$/.test(h) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(h) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(h) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(h) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(h) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(h) ? "hsla" : A.css_color_names.includes(h.toLowerCase()) ? "css-color-name" : !1;
|
|
6058
6044
|
}
|
|
6059
|
-
n.validate =
|
|
6060
|
-
async function
|
|
6061
|
-
const
|
|
6062
|
-
if (!
|
|
6063
|
-
if (
|
|
6064
|
-
const
|
|
6065
|
-
if (!
|
|
6066
|
-
switch (
|
|
6045
|
+
n.validate = b;
|
|
6046
|
+
async function p(o, h) {
|
|
6047
|
+
const f = b(o);
|
|
6048
|
+
if (!f) throw new Error(`Invalid color format: ${o}`);
|
|
6049
|
+
if (f === h) throw new Error(`Color is already in the desired format: ${h}`);
|
|
6050
|
+
const d = ft(o.trim(), f);
|
|
6051
|
+
if (!d) throw new Error(`Failed to parse color: ${o}`);
|
|
6052
|
+
switch (h) {
|
|
6067
6053
|
case "hex":
|
|
6068
|
-
return bt(
|
|
6054
|
+
return bt(d, !1);
|
|
6069
6055
|
case "rgb":
|
|
6070
|
-
return `rgb(${
|
|
6056
|
+
return `rgb(${d.r}, ${d.g}, ${d.b})`;
|
|
6071
6057
|
case "rgba":
|
|
6072
|
-
return `rgba(${
|
|
6058
|
+
return `rgba(${d.r}, ${d.g}, ${d.b}, ${d.a})`;
|
|
6073
6059
|
case "hsl": {
|
|
6074
|
-
const
|
|
6075
|
-
return `hsl(${
|
|
6060
|
+
const g = lt(d.r, d.g, d.b);
|
|
6061
|
+
return `hsl(${g.h}, ${g.s}%, ${g.l}%)`;
|
|
6076
6062
|
}
|
|
6077
6063
|
case "hsla": {
|
|
6078
|
-
const
|
|
6079
|
-
return `hsla(${
|
|
6064
|
+
const g = lt(d.r, d.g, d.b);
|
|
6065
|
+
return `hsla(${g.h}, ${g.s}%, ${g.l}%, ${d.a})`;
|
|
6080
6066
|
}
|
|
6081
6067
|
case "css-color-name":
|
|
6082
|
-
return await wt(
|
|
6068
|
+
return await wt(d.r, d.g, d.b);
|
|
6083
6069
|
default:
|
|
6084
6070
|
return null;
|
|
6085
6071
|
}
|
|
6086
6072
|
}
|
|
6087
|
-
n.convert =
|
|
6088
|
-
})(i =
|
|
6073
|
+
n.convert = p;
|
|
6074
|
+
})(i = l.color || (l.color = {}));
|
|
6089
6075
|
let s;
|
|
6090
6076
|
((n) => {
|
|
6091
|
-
function
|
|
6092
|
-
switch (
|
|
6077
|
+
function m(g = "hex") {
|
|
6078
|
+
switch (g) {
|
|
6093
6079
|
default:
|
|
6094
6080
|
case "hex":
|
|
6095
6081
|
return `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
|
|
6096
6082
|
case "hexa": {
|
|
6097
|
-
const
|
|
6098
|
-
return
|
|
6083
|
+
const v = `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`, C = Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
|
|
6084
|
+
return v + C;
|
|
6099
6085
|
}
|
|
6100
6086
|
case "rgb": {
|
|
6101
|
-
const
|
|
6102
|
-
return `rgb(${
|
|
6087
|
+
const v = Math.floor(Math.random() * 256), C = Math.floor(Math.random() * 256), x = Math.floor(Math.random() * 256);
|
|
6088
|
+
return `rgb(${v}, ${C}, ${x})`;
|
|
6103
6089
|
}
|
|
6104
6090
|
case "rgba": {
|
|
6105
|
-
const
|
|
6106
|
-
return `rgba(${
|
|
6091
|
+
const v = Math.floor(Math.random() * 256), C = Math.floor(Math.random() * 256), x = Math.floor(Math.random() * 256), S = Math.random().toFixed(2);
|
|
6092
|
+
return `rgba(${v}, ${C}, ${x}, ${S})`;
|
|
6107
6093
|
}
|
|
6108
6094
|
case "hsl": {
|
|
6109
|
-
const
|
|
6110
|
-
return `hsl(${
|
|
6095
|
+
const v = Math.floor(Math.random() * 361), C = Math.floor(Math.random() * 101), x = Math.floor(Math.random() * 101);
|
|
6096
|
+
return `hsl(${v}, ${C}%, ${x}%)`;
|
|
6111
6097
|
}
|
|
6112
6098
|
case "hsla": {
|
|
6113
|
-
const
|
|
6114
|
-
return `hsla(${
|
|
6099
|
+
const v = Math.floor(Math.random() * 361), C = Math.floor(Math.random() * 101), x = Math.floor(Math.random() * 101), S = Math.random().toFixed(2);
|
|
6100
|
+
return `hsla(${v}, ${C}%, ${x}%, ${S})`;
|
|
6115
6101
|
}
|
|
6116
6102
|
case "css-color-name": {
|
|
6117
6103
|
var y = A.css_color_names;
|
|
@@ -6119,66 +6105,98 @@ var b;
|
|
|
6119
6105
|
}
|
|
6120
6106
|
}
|
|
6121
6107
|
}
|
|
6122
|
-
n.color =
|
|
6123
|
-
function c(
|
|
6124
|
-
|
|
6125
|
-
const
|
|
6126
|
-
return
|
|
6108
|
+
n.color = m;
|
|
6109
|
+
function c(g, y, v = 0) {
|
|
6110
|
+
g > y && ([g, y] = [y, g]);
|
|
6111
|
+
const C = Math.random() * (y - g) + g;
|
|
6112
|
+
return v ? Number(C.toFixed(v)) : Math.round(C);
|
|
6127
6113
|
}
|
|
6128
6114
|
n.number = c;
|
|
6129
|
-
function
|
|
6130
|
-
return Math.random() >
|
|
6115
|
+
function b(g = 0.5) {
|
|
6116
|
+
return Math.random() > g;
|
|
6131
6117
|
}
|
|
6132
|
-
n.boolean =
|
|
6133
|
-
function
|
|
6134
|
-
let
|
|
6135
|
-
for (let
|
|
6136
|
-
|
|
6137
|
-
return
|
|
6118
|
+
n.boolean = b;
|
|
6119
|
+
function p(g, y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
|
|
6120
|
+
let v = "";
|
|
6121
|
+
for (let C = 0; C < g; C++)
|
|
6122
|
+
v += y.charAt(Math.floor(Math.random() * y.length));
|
|
6123
|
+
return v;
|
|
6138
6124
|
}
|
|
6139
|
-
n.string =
|
|
6140
|
-
function o(
|
|
6141
|
-
const y = c(0,
|
|
6142
|
-
return [
|
|
6125
|
+
n.string = p;
|
|
6126
|
+
function o(g) {
|
|
6127
|
+
const y = c(0, g.length - 1);
|
|
6128
|
+
return [g[y], y];
|
|
6143
6129
|
}
|
|
6144
6130
|
n.array = o;
|
|
6145
|
-
function
|
|
6146
|
-
return new Date(c(
|
|
6131
|
+
function h(g = new Date(2e3, 0, 1), y = /* @__PURE__ */ new Date()) {
|
|
6132
|
+
return new Date(c(g.getTime(), y.getTime()));
|
|
6147
6133
|
}
|
|
6148
|
-
n.date =
|
|
6149
|
-
function
|
|
6150
|
-
const
|
|
6151
|
-
return new Date(
|
|
6134
|
+
n.date = h;
|
|
6135
|
+
function f(g) {
|
|
6136
|
+
const v = Date.now() - c(0, g * 24 * 60 * 60 * 1e3);
|
|
6137
|
+
return new Date(v).toISOString();
|
|
6152
6138
|
}
|
|
6153
|
-
n.daysOffset =
|
|
6154
|
-
function
|
|
6139
|
+
n.daysOffset = f;
|
|
6140
|
+
function d() {
|
|
6155
6141
|
return crypto.randomUUID();
|
|
6156
6142
|
}
|
|
6157
|
-
n.uuid =
|
|
6158
|
-
})(s =
|
|
6159
|
-
function
|
|
6160
|
-
return
|
|
6143
|
+
n.uuid = d;
|
|
6144
|
+
})(s = l.random || (l.random = {})), ((n) => {
|
|
6145
|
+
function m(b, p, o) {
|
|
6146
|
+
return b.apply(p, o);
|
|
6161
6147
|
}
|
|
6162
|
-
n.apply =
|
|
6163
|
-
function c(
|
|
6164
|
-
return
|
|
6148
|
+
n.apply = m;
|
|
6149
|
+
function c(b, p, ...o) {
|
|
6150
|
+
return b.call(p, ...o);
|
|
6165
6151
|
}
|
|
6166
6152
|
n.call = c;
|
|
6167
|
-
})(
|
|
6168
|
-
|
|
6153
|
+
})(l.fn || (l.fn = {})), ((n) => {
|
|
6154
|
+
function m(h, f) {
|
|
6155
|
+
return new Promise(
|
|
6156
|
+
(d) => setTimeout(() => {
|
|
6157
|
+
if (f) {
|
|
6158
|
+
const g = f();
|
|
6159
|
+
d(g ?? null);
|
|
6160
|
+
} else d(null);
|
|
6161
|
+
}, h)
|
|
6162
|
+
);
|
|
6163
|
+
}
|
|
6164
|
+
n.delay = m;
|
|
6165
|
+
function c(h) {
|
|
6166
|
+
return Object.entries(h);
|
|
6167
|
+
}
|
|
6168
|
+
n.typedEntries = c;
|
|
6169
|
+
function b(h) {
|
|
6170
|
+
return Object.values(h);
|
|
6171
|
+
}
|
|
6172
|
+
n.typedValues = b;
|
|
6173
|
+
function p(h) {
|
|
6174
|
+
return Object.keys(h);
|
|
6175
|
+
}
|
|
6176
|
+
n.typedKeys = p;
|
|
6177
|
+
function o(h) {
|
|
6178
|
+
const f = Object.values(h).reduce((v, C) => v + C, 0), d = c(h).sort((v, C) => C[1] - v[1]), g = Math.random() * f;
|
|
6179
|
+
let y = 0;
|
|
6180
|
+
for (const [v, C] of d)
|
|
6181
|
+
if (y += C, g < y)
|
|
6182
|
+
return v;
|
|
6183
|
+
}
|
|
6184
|
+
n.probability = o;
|
|
6185
|
+
})(l.utils || (l.utils = {}));
|
|
6186
|
+
})(w || (w = {}));
|
|
6169
6187
|
class at {
|
|
6170
6188
|
constructor(e) {
|
|
6171
6189
|
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"));
|
|
6172
6190
|
}
|
|
6173
6191
|
generate(e) {
|
|
6174
|
-
return
|
|
6192
|
+
return w.utils.typedValues(e).reduce(
|
|
6175
6193
|
(a, i, s) => {
|
|
6176
|
-
const n =
|
|
6194
|
+
const n = w.string.compose(this.template, { index: s, ...i }, { html: !1 }), m = w.string.compose(this.name, { index: s, ...i }, { html: !1 });
|
|
6177
6195
|
a[n] = {
|
|
6178
6196
|
type: "button",
|
|
6179
|
-
label:
|
|
6197
|
+
label: m
|
|
6180
6198
|
};
|
|
6181
|
-
let c =
|
|
6199
|
+
let c = w.string.compose(String(this.value), { index: s, ...i }, { html: !1 });
|
|
6182
6200
|
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;
|
|
6183
6201
|
},
|
|
6184
6202
|
{}
|
|
@@ -6206,9 +6224,9 @@ class at {
|
|
|
6206
6224
|
if (a.length && a.every((i) => i instanceof at))
|
|
6207
6225
|
return a.forEach((i) => {
|
|
6208
6226
|
try {
|
|
6209
|
-
i.parse(e, t), window.client.emit("action", i, "executed"),
|
|
6227
|
+
i.parse(e, t), window.client.emit("action", i, "executed"), N.received(`Button executed: ${e}${t ? ` with value: ${t}` : ""}`);
|
|
6210
6228
|
} catch (s) {
|
|
6211
|
-
|
|
6229
|
+
N.error(`Error executing button "${e}": ${s instanceof Error ? s.message : s}`);
|
|
6212
6230
|
}
|
|
6213
6231
|
}), !0;
|
|
6214
6232
|
}
|
|
@@ -6220,8 +6238,8 @@ class at {
|
|
|
6220
6238
|
}
|
|
6221
6239
|
}
|
|
6222
6240
|
var q;
|
|
6223
|
-
((
|
|
6224
|
-
|
|
6241
|
+
((l) => {
|
|
6242
|
+
l.generate = {
|
|
6225
6243
|
session: {
|
|
6226
6244
|
types: {
|
|
6227
6245
|
name: { type: "string", options: A.names.filter((t) => t.length) },
|
|
@@ -6599,45 +6617,45 @@ var q;
|
|
|
6599
6617
|
const a = this.available();
|
|
6600
6618
|
if (t) return t;
|
|
6601
6619
|
const i = (n) => {
|
|
6602
|
-
const
|
|
6603
|
-
if (!
|
|
6620
|
+
const m = (p) => {
|
|
6621
|
+
if (!p || !("amount" in p)) return [];
|
|
6604
6622
|
const o = [];
|
|
6605
|
-
for (let
|
|
6606
|
-
o.push(i(
|
|
6623
|
+
for (let h = 0; h < p.amount; h++)
|
|
6624
|
+
o.push(i(p.value));
|
|
6607
6625
|
return o.sort(
|
|
6608
|
-
(
|
|
6626
|
+
(h, f) => new Date(f.createdAt).getTime() - new Date(h.createdAt).getTime()
|
|
6609
6627
|
);
|
|
6610
|
-
}, c = (
|
|
6628
|
+
}, c = (p) => {
|
|
6611
6629
|
const o = {};
|
|
6612
|
-
for (const
|
|
6613
|
-
const
|
|
6614
|
-
o[
|
|
6630
|
+
for (const h in p) {
|
|
6631
|
+
const f = h.replace("_type", "type");
|
|
6632
|
+
o[f] = i(p[h]);
|
|
6615
6633
|
}
|
|
6616
6634
|
return o;
|
|
6617
|
-
},
|
|
6618
|
-
if (!
|
|
6619
|
-
switch (
|
|
6635
|
+
}, b = (p) => {
|
|
6636
|
+
if (!p) return p;
|
|
6637
|
+
switch (p.type) {
|
|
6620
6638
|
case "int":
|
|
6621
|
-
return
|
|
6639
|
+
return w.random.number(p.min, p.max);
|
|
6622
6640
|
case "string":
|
|
6623
|
-
return
|
|
6641
|
+
return w.random.array(p.options)[0];
|
|
6624
6642
|
case "date":
|
|
6625
|
-
return
|
|
6643
|
+
return w.random.daysOffset(p.range);
|
|
6626
6644
|
case "array":
|
|
6627
|
-
return
|
|
6645
|
+
return w.random.array(p.options)[0];
|
|
6628
6646
|
case "recent":
|
|
6629
|
-
return
|
|
6647
|
+
return m(p);
|
|
6630
6648
|
default:
|
|
6631
|
-
return
|
|
6649
|
+
return p;
|
|
6632
6650
|
}
|
|
6633
6651
|
};
|
|
6634
|
-
return typeof n != "object" || n === null ? n : "type" in n && typeof n.type == "string" ?
|
|
6652
|
+
return typeof n != "object" || n === null ? n : "type" in n && typeof n.type == "string" ? b(n) : c(n);
|
|
6635
6653
|
};
|
|
6636
6654
|
var s = Object.entries(i(a)).reduce(
|
|
6637
|
-
(n, [
|
|
6638
|
-
([
|
|
6655
|
+
(n, [m, c]) => (Object.entries(c).forEach(
|
|
6656
|
+
([b, p]) => (
|
|
6639
6657
|
//
|
|
6640
|
-
n[`${
|
|
6658
|
+
n[`${m}-${b}`] = p
|
|
6641
6659
|
)
|
|
6642
6660
|
), n),
|
|
6643
6661
|
{}
|
|
@@ -6691,27 +6709,27 @@ var q;
|
|
|
6691
6709
|
* @returns A Promise that resolves to the simulated onSessionUpdate event data.
|
|
6692
6710
|
*/
|
|
6693
6711
|
async onSessionUpdate(t, a) {
|
|
6694
|
-
if (t ??= await
|
|
6712
|
+
if (t ??= await l.generate.session.get(), a) {
|
|
6695
6713
|
const i = (s, n) => new Date(n.createdAt).getTime() - new Date(s.createdAt).getTime();
|
|
6696
6714
|
switch (a.provider) {
|
|
6697
6715
|
case "twitch": {
|
|
6698
6716
|
const s = a.data;
|
|
6699
6717
|
switch (s.listener) {
|
|
6700
6718
|
case "cheer-latest": {
|
|
6701
|
-
const n = s.event.amount,
|
|
6702
|
-
t["cheer-latest"] = { name:
|
|
6703
|
-
const
|
|
6704
|
-
if (
|
|
6705
|
-
|
|
6719
|
+
const n = s.event.amount, m = s.event.displayName ?? s.event.name, c = s.event.message;
|
|
6720
|
+
t["cheer-latest"] = { name: m, amount: n, message: c };
|
|
6721
|
+
const b = (p) => {
|
|
6722
|
+
if (p === "all") {
|
|
6723
|
+
b("alltime"), b("monthly"), b("weekly"), b("session");
|
|
6706
6724
|
return;
|
|
6707
6725
|
}
|
|
6708
|
-
const o = t[`cheer-${
|
|
6709
|
-
o && n > o.amount && (o.amount = n, o.name =
|
|
6710
|
-
const
|
|
6711
|
-
|
|
6726
|
+
const o = t[`cheer-${p}-top-donation`];
|
|
6727
|
+
o && n > o.amount && (o.amount = n, o.name = m);
|
|
6728
|
+
const h = t[`cheer-${p}-top-donator`], f = t["cheer-recent"].filter((g) => g.name.toLowerCase() === h.name.toLowerCase()).reduce((g, y) => g + y.amount, 0), d = t["cheer-recent"].filter((g) => g.name.toLowerCase() === m.toLowerCase()).reduce((g, y) => g + y.amount, 0);
|
|
6729
|
+
d > f && (h.amount = d, h.name = m);
|
|
6712
6730
|
};
|
|
6713
|
-
|
|
6714
|
-
name:
|
|
6731
|
+
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({
|
|
6732
|
+
name: m,
|
|
6715
6733
|
amount: n,
|
|
6716
6734
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6717
6735
|
}), t["cheer-recent"] = (t["cheer-recent"] || []).sort(i);
|
|
@@ -6728,22 +6746,22 @@ var q;
|
|
|
6728
6746
|
break;
|
|
6729
6747
|
}
|
|
6730
6748
|
case "subscriber-latest": {
|
|
6731
|
-
const n = s.event.displayName ?? s.event.name,
|
|
6732
|
-
if (t["subscriber-latest"] = { name: n, amount:
|
|
6733
|
-
(
|
|
6734
|
-
) ?
|
|
6735
|
-
const
|
|
6749
|
+
const n = s.event.displayName ?? s.event.name, m = s.event.amount, c = s.event.tier, b = s.event.message;
|
|
6750
|
+
if (t["subscriber-latest"] = { name: n, amount: m, tier: c, message: b ?? "" }, t["subscriber-recent"].find(
|
|
6751
|
+
(p) => p.name.toLowerCase() === n.toLowerCase()
|
|
6752
|
+
) ? m > 1 && (t["subscriber-resub-latest"] = { name: n, amount: m, message: b ?? "" }, t["subscriber-resub-session"].count += 1) : (t["subscriber-new-latest"] = { name: n, amount: m, message: b ?? "" }, t["subscriber-new-session"].count += 1), !(!s.event.gifted && !s.event.bulkGifted && !s.event.isCommunityGift)) if (s.event.gifted && !s.event.bulkGifted && !s.event.isCommunityGift) {
|
|
6753
|
+
const p = s.event.sender;
|
|
6736
6754
|
t["subscriber-gifted-latest"] = {
|
|
6737
6755
|
name: n,
|
|
6738
|
-
amount:
|
|
6756
|
+
amount: m,
|
|
6739
6757
|
tier: c,
|
|
6740
|
-
message:
|
|
6741
|
-
sender:
|
|
6742
|
-
}, t["subscriber-gifted-session"].count += 1, t["subscriber-alltime-gifter"] = { name:
|
|
6758
|
+
message: b ?? "",
|
|
6759
|
+
sender: p
|
|
6760
|
+
}, t["subscriber-gifted-session"].count += 1, t["subscriber-alltime-gifter"] = { name: p, amount: m };
|
|
6743
6761
|
} else s.event.gifted && !s.event.bulkGifted && s.event.isCommunityGift || !s.event.gifted && s.event.bulkGifted && s.event.isCommunityGift;
|
|
6744
|
-
t["subscriber-session"].count +=
|
|
6762
|
+
t["subscriber-session"].count += m, t["subscriber-week"].count += m, t["subscriber-month"].count += m, t["subscriber-total"].count += m, t["subscriber-goal"].amount += m, t["subscriber-points"].amount += m, t["subscriber-recent"].unshift({
|
|
6745
6763
|
name: n,
|
|
6746
|
-
amount:
|
|
6764
|
+
amount: m,
|
|
6747
6765
|
tier: c,
|
|
6748
6766
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6749
6767
|
}), t["subscriber-recent"] = (t["subscriber-recent"] || []).sort(
|
|
@@ -6752,10 +6770,10 @@ var q;
|
|
|
6752
6770
|
break;
|
|
6753
6771
|
}
|
|
6754
6772
|
case "raid-latest": {
|
|
6755
|
-
const n = s.event.displayName ?? s.event.name,
|
|
6756
|
-
t["raid-latest"] = { name: n, amount:
|
|
6773
|
+
const n = s.event.displayName ?? s.event.name, m = s.event.amount;
|
|
6774
|
+
t["raid-latest"] = { name: n, amount: m }, t["raid-recent"].unshift({
|
|
6757
6775
|
name: n,
|
|
6758
|
-
amount:
|
|
6776
|
+
amount: m,
|
|
6759
6777
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6760
6778
|
}), t["raid-recent"] = (t["raid-recent"] || []).sort(i);
|
|
6761
6779
|
break;
|
|
@@ -6766,33 +6784,33 @@ var q;
|
|
|
6766
6784
|
case "youtube": {
|
|
6767
6785
|
const s = a.data;
|
|
6768
6786
|
if (s.listener === "superchat-latest") {
|
|
6769
|
-
const n = s.event.displayName ?? s.event.name,
|
|
6787
|
+
const n = s.event.displayName ?? s.event.name, m = s.event.amount;
|
|
6770
6788
|
t["superchat-latest"] = {
|
|
6771
6789
|
name: n.toLowerCase(),
|
|
6772
6790
|
displayName: n,
|
|
6773
|
-
amount:
|
|
6774
|
-
_id:
|
|
6791
|
+
amount: m,
|
|
6792
|
+
_id: w.random.uuid(),
|
|
6775
6793
|
sessionTop: !1,
|
|
6776
6794
|
type: "superchat",
|
|
6777
6795
|
originalEventName: "superchat-latest",
|
|
6778
6796
|
providerId: "",
|
|
6779
6797
|
avatar: ""
|
|
6780
6798
|
};
|
|
6781
|
-
const c = (
|
|
6782
|
-
if (
|
|
6799
|
+
const c = (b) => {
|
|
6800
|
+
if (b === "all") {
|
|
6783
6801
|
c("alltime"), c("monthly"), c("weekly"), c("session");
|
|
6784
6802
|
return;
|
|
6785
6803
|
}
|
|
6786
|
-
const
|
|
6787
|
-
|
|
6788
|
-
const o = t[`superchat-${
|
|
6789
|
-
|
|
6804
|
+
const p = t[`superchat-${b}-top-donation`];
|
|
6805
|
+
p && m > p.amount && (p.amount = m, p.name = n);
|
|
6806
|
+
const o = t[`superchat-${b}-top-donator`], h = t["superchat-recent"].filter((d) => d.name.toLowerCase() === o.name.toLowerCase()).reduce((d, g) => d + g.amount, 0), f = t["superchat-recent"].filter((d) => d.name.toLowerCase() === n.toLowerCase()).reduce((d, g) => d + g.amount, 0);
|
|
6807
|
+
f > h && (o.amount = f, o.name = n);
|
|
6790
6808
|
};
|
|
6791
|
-
c("all"), t["superchat-session"].amount +=
|
|
6809
|
+
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({
|
|
6792
6810
|
name: n.toLowerCase(),
|
|
6793
6811
|
displayName: n,
|
|
6794
|
-
amount:
|
|
6795
|
-
_id:
|
|
6812
|
+
amount: m,
|
|
6813
|
+
_id: w.random.uuid(),
|
|
6796
6814
|
sessionTop: !1,
|
|
6797
6815
|
type: "superchat",
|
|
6798
6816
|
originalEventName: "superchat-latest",
|
|
@@ -6805,21 +6823,21 @@ var q;
|
|
|
6805
6823
|
case "streamelements": {
|
|
6806
6824
|
const s = a.data;
|
|
6807
6825
|
if (s.listener === "tip-latest") {
|
|
6808
|
-
const n = s.event.displayName ?? s.event.name,
|
|
6809
|
-
t["tip-latest"] = { name: n, amount:
|
|
6810
|
-
const c = (
|
|
6811
|
-
if (
|
|
6826
|
+
const n = s.event.displayName ?? s.event.name, m = s.event.amount;
|
|
6827
|
+
t["tip-latest"] = { name: n, amount: m };
|
|
6828
|
+
const c = (b) => {
|
|
6829
|
+
if (b === "all") {
|
|
6812
6830
|
c("alltime"), c("monthly"), c("weekly"), c("session");
|
|
6813
6831
|
return;
|
|
6814
6832
|
}
|
|
6815
|
-
const
|
|
6816
|
-
|
|
6817
|
-
const o = t[`tip-${
|
|
6818
|
-
|
|
6833
|
+
const p = t[`tip-${b}-top-donation`];
|
|
6834
|
+
p && m > p.amount && (p.amount = m, p.name = n);
|
|
6835
|
+
const o = t[`tip-${b}-top-donator`], h = t["tip-recent"].filter((d) => d.name.toLowerCase() === o.name.toLowerCase()).reduce((d, g) => d + g.amount, 0), f = t["tip-recent"].filter((d) => d.name.toLowerCase() === n.toLowerCase()).reduce((d, g) => d + g.amount, 0);
|
|
6836
|
+
f > h && (o.amount = f, o.name = n);
|
|
6819
6837
|
};
|
|
6820
|
-
c("all"), t["tip-session"].amount +=
|
|
6838
|
+
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({
|
|
6821
6839
|
name: n,
|
|
6822
|
-
amount:
|
|
6840
|
+
amount: m,
|
|
6823
6841
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6824
6842
|
}), t["tip-recent"] = (t["tip-recent"] || []).sort(i);
|
|
6825
6843
|
}
|
|
@@ -6861,27 +6879,27 @@ var q;
|
|
|
6861
6879
|
switch (t) {
|
|
6862
6880
|
default:
|
|
6863
6881
|
case "random": {
|
|
6864
|
-
var n =
|
|
6865
|
-
Object.keys(s).filter((
|
|
6866
|
-
)[0],
|
|
6882
|
+
var n = w.random.array(
|
|
6883
|
+
Object.keys(s).filter((R) => s[R].length)
|
|
6884
|
+
)[0], m = w.random.array(
|
|
6867
6885
|
s[n]
|
|
6868
6886
|
)[0];
|
|
6869
|
-
return this.onEventReceived(n,
|
|
6887
|
+
return this.onEventReceived(n, m);
|
|
6870
6888
|
}
|
|
6871
6889
|
case "twitch":
|
|
6872
6890
|
switch (a) {
|
|
6873
6891
|
default:
|
|
6874
6892
|
case "random": {
|
|
6875
|
-
var
|
|
6893
|
+
var m = w.random.array(
|
|
6876
6894
|
s[t]
|
|
6877
6895
|
)[0];
|
|
6878
|
-
return this.onEventReceived(t,
|
|
6896
|
+
return this.onEventReceived(t, m);
|
|
6879
6897
|
}
|
|
6880
6898
|
case "message": {
|
|
6881
|
-
var c = i?.name ??
|
|
6899
|
+
var c = i?.name ?? w.random.array(A.names.filter((H) => H.length))[0], b = i?.message ?? w.random.array(A.messages.filter((H) => H.length))[0], p = await w.message.generateBadges(
|
|
6882
6900
|
i?.badges ?? [],
|
|
6883
6901
|
t
|
|
6884
|
-
), o =
|
|
6902
|
+
), o = w.message.findEmotesInText(b), h = w.message.replaceEmotesWithHTML(b, o), f = i?.color ?? w.random.color("hex"), d = i?.userId ?? w.random.number(1e7, 99999999).toString(), g = i?.msgId ?? w.random.uuid(), y = i?.time ?? Date.now(), v = i?.channel ?? client.details.user.username;
|
|
6885
6903
|
return {
|
|
6886
6904
|
listener: "message",
|
|
6887
6905
|
event: {
|
|
@@ -6889,35 +6907,35 @@ var q;
|
|
|
6889
6907
|
data: {
|
|
6890
6908
|
time: y,
|
|
6891
6909
|
tags: {
|
|
6892
|
-
"badge-info": `${
|
|
6893
|
-
badges:
|
|
6894
|
-
mod:
|
|
6895
|
-
subscriber:
|
|
6896
|
-
turbo:
|
|
6910
|
+
"badge-info": `${p.keys.map((H) => `${H}/${w.random.number(1, 5)}`).join(",")}`,
|
|
6911
|
+
badges: p.keys.join("/1,"),
|
|
6912
|
+
mod: p.keys.includes("moderator") ? "1" : "0",
|
|
6913
|
+
subscriber: p.keys.includes("subscriber") ? "1" : "0",
|
|
6914
|
+
turbo: p.keys.includes("turbo") ? "1" : "0",
|
|
6897
6915
|
"tmi-sent-ts": y.toString(),
|
|
6898
|
-
"user-id":
|
|
6916
|
+
"user-id": d,
|
|
6899
6917
|
"user-type": "",
|
|
6900
|
-
color:
|
|
6918
|
+
color: f,
|
|
6901
6919
|
"display-name": c,
|
|
6902
6920
|
emotes: "",
|
|
6903
|
-
"client-nonce":
|
|
6921
|
+
"client-nonce": w.random.string(16),
|
|
6904
6922
|
flags: "",
|
|
6905
|
-
id:
|
|
6923
|
+
id: g,
|
|
6906
6924
|
"first-msg": "0",
|
|
6907
6925
|
"returning-chatter": "0"
|
|
6908
6926
|
},
|
|
6909
6927
|
nick: c.toLowerCase(),
|
|
6910
6928
|
displayName: c,
|
|
6911
|
-
displayColor:
|
|
6912
|
-
channel:
|
|
6913
|
-
text:
|
|
6929
|
+
displayColor: f,
|
|
6930
|
+
channel: v,
|
|
6931
|
+
text: b,
|
|
6914
6932
|
isAction: !1,
|
|
6915
|
-
userId:
|
|
6916
|
-
msgId:
|
|
6917
|
-
badges:
|
|
6933
|
+
userId: d,
|
|
6934
|
+
msgId: g,
|
|
6935
|
+
badges: p.badges,
|
|
6918
6936
|
emotes: o
|
|
6919
6937
|
},
|
|
6920
|
-
renderedText:
|
|
6938
|
+
renderedText: h
|
|
6921
6939
|
},
|
|
6922
6940
|
// @ts-ignore
|
|
6923
6941
|
emulated: !0
|
|
@@ -6925,17 +6943,17 @@ var q;
|
|
|
6925
6943
|
}
|
|
6926
6944
|
case "cheer":
|
|
6927
6945
|
case "cheer-latest": {
|
|
6928
|
-
var
|
|
6946
|
+
var C = i?.amount ?? w.random.number(100, 1e4), x = i?.avatar ?? w.random.array(A.avatars)[0], c = i?.name ?? w.random.array(A.names.filter((O) => O.length))[0], b = i?.message ?? w.random.array(A.messages.filter((O) => O.length))[0];
|
|
6929
6947
|
return {
|
|
6930
6948
|
listener: "cheer-latest",
|
|
6931
6949
|
event: {
|
|
6932
|
-
amount:
|
|
6933
|
-
avatar:
|
|
6950
|
+
amount: C,
|
|
6951
|
+
avatar: x,
|
|
6934
6952
|
name: c.toLowerCase(),
|
|
6935
6953
|
displayName: c,
|
|
6936
|
-
message:
|
|
6954
|
+
message: b,
|
|
6937
6955
|
providerId: "",
|
|
6938
|
-
_id:
|
|
6956
|
+
_id: w.random.uuid(),
|
|
6939
6957
|
sessionTop: !1,
|
|
6940
6958
|
type: "cheer",
|
|
6941
6959
|
originalEventName: "cheer-latest",
|
|
@@ -6947,15 +6965,15 @@ var q;
|
|
|
6947
6965
|
}
|
|
6948
6966
|
case "follower":
|
|
6949
6967
|
case "follower-latest": {
|
|
6950
|
-
var
|
|
6968
|
+
var x = i?.avatar ?? w.random.array(A.avatars)[0], c = i?.name ?? w.random.array(A.names.filter((O) => O.length))[0];
|
|
6951
6969
|
return {
|
|
6952
6970
|
listener: "follower-latest",
|
|
6953
6971
|
event: {
|
|
6954
|
-
avatar:
|
|
6972
|
+
avatar: x,
|
|
6955
6973
|
name: c.toLowerCase(),
|
|
6956
6974
|
displayName: c,
|
|
6957
6975
|
providerId: "",
|
|
6958
|
-
_id:
|
|
6976
|
+
_id: w.random.uuid(),
|
|
6959
6977
|
sessionTop: !1,
|
|
6960
6978
|
type: "follower",
|
|
6961
6979
|
originalEventName: "follower-latest",
|
|
@@ -6967,16 +6985,16 @@ var q;
|
|
|
6967
6985
|
}
|
|
6968
6986
|
case "raid":
|
|
6969
6987
|
case "raid-latest": {
|
|
6970
|
-
var
|
|
6988
|
+
var C = i?.amount ?? w.random.number(1, 100), x = i?.avatar ?? w.random.array(A.avatars)[0], c = i?.name ?? w.random.array(A.names.filter((F) => F.length))[0];
|
|
6971
6989
|
return {
|
|
6972
6990
|
listener: "raid-latest",
|
|
6973
6991
|
event: {
|
|
6974
|
-
amount:
|
|
6975
|
-
avatar:
|
|
6992
|
+
amount: C,
|
|
6993
|
+
avatar: x,
|
|
6976
6994
|
name: c.toLowerCase(),
|
|
6977
6995
|
displayName: c,
|
|
6978
6996
|
providerId: "",
|
|
6979
|
-
_id:
|
|
6997
|
+
_id: w.random.uuid(),
|
|
6980
6998
|
sessionTop: !1,
|
|
6981
6999
|
type: "raid",
|
|
6982
7000
|
originalEventName: "raid-latest",
|
|
@@ -6988,37 +7006,37 @@ var q;
|
|
|
6988
7006
|
}
|
|
6989
7007
|
case "subscriber":
|
|
6990
7008
|
case "subscriber-latest": {
|
|
6991
|
-
var
|
|
7009
|
+
var S = i?.tier ?? w.random.array(["1000", "2000", "3000", "prime"])[0], C = i?.amount ?? w.random.number(1, 24), x = i?.avatar ?? w.random.array(A.avatars)[0], c = i?.name ?? w.random.array(A.names.filter((B) => B.length))[0], D = i?.sender ?? w.random.array(A.names.filter((B) => B.length && B !== c))[0], b = i?.message ?? w.random.array(A.messages.filter((B) => B.length))[0], M = {
|
|
6992
7010
|
default: {
|
|
6993
|
-
avatar:
|
|
7011
|
+
avatar: x,
|
|
6994
7012
|
playedAsCommunityGift: !1
|
|
6995
7013
|
},
|
|
6996
7014
|
gift: {
|
|
6997
|
-
sender:
|
|
7015
|
+
sender: D,
|
|
6998
7016
|
gifted: !0
|
|
6999
7017
|
},
|
|
7000
7018
|
community: {
|
|
7001
|
-
message:
|
|
7002
|
-
sender:
|
|
7019
|
+
message: b,
|
|
7020
|
+
sender: D,
|
|
7003
7021
|
bulkGifted: !0
|
|
7004
7022
|
},
|
|
7005
7023
|
spam: {
|
|
7006
|
-
sender:
|
|
7024
|
+
sender: D,
|
|
7007
7025
|
gifted: !0,
|
|
7008
7026
|
isCommunityGift: !0
|
|
7009
7027
|
}
|
|
7010
|
-
},
|
|
7011
|
-
return
|
|
7028
|
+
}, _ = ["default", "gift", "community", "spam"], j = i?.subType ?? w.random.array(_)[0];
|
|
7029
|
+
return j = _.includes(j) ? j : "default", {
|
|
7012
7030
|
listener: "subscriber-latest",
|
|
7013
7031
|
event: {
|
|
7014
|
-
amount:
|
|
7032
|
+
amount: C,
|
|
7015
7033
|
name: c.toLowerCase(),
|
|
7016
7034
|
displayName: c,
|
|
7017
7035
|
providerId: "",
|
|
7018
|
-
tier:
|
|
7019
|
-
...
|
|
7020
|
-
...
|
|
7021
|
-
_id:
|
|
7036
|
+
tier: S,
|
|
7037
|
+
...M.default,
|
|
7038
|
+
...M[j],
|
|
7039
|
+
_id: w.random.uuid(),
|
|
7022
7040
|
sessionTop: !1,
|
|
7023
7041
|
type: "subscriber",
|
|
7024
7042
|
originalEventName: "subscriber-latest",
|
|
@@ -7032,7 +7050,7 @@ var q;
|
|
|
7032
7050
|
return {
|
|
7033
7051
|
listener: "delete-message",
|
|
7034
7052
|
event: {
|
|
7035
|
-
msgId: i?.id ??
|
|
7053
|
+
msgId: i?.id ?? w.random.uuid(),
|
|
7036
7054
|
provider: t
|
|
7037
7055
|
},
|
|
7038
7056
|
// @ts-ignore
|
|
@@ -7042,7 +7060,7 @@ var q;
|
|
|
7042
7060
|
return {
|
|
7043
7061
|
listener: "delete-messages",
|
|
7044
7062
|
event: {
|
|
7045
|
-
userId: i?.id ??
|
|
7063
|
+
userId: i?.id ?? w.random.number(1e7, 99999999).toString(),
|
|
7046
7064
|
provider: t
|
|
7047
7065
|
},
|
|
7048
7066
|
// @ts-ignore
|
|
@@ -7053,23 +7071,23 @@ var q;
|
|
|
7053
7071
|
switch (a) {
|
|
7054
7072
|
default:
|
|
7055
7073
|
case "random": {
|
|
7056
|
-
var
|
|
7074
|
+
var m = w.random.array(
|
|
7057
7075
|
s[t]
|
|
7058
7076
|
)[0];
|
|
7059
|
-
return this.onEventReceived(t,
|
|
7077
|
+
return this.onEventReceived(t, m);
|
|
7060
7078
|
}
|
|
7061
7079
|
case "tip":
|
|
7062
7080
|
case "tip-latest": {
|
|
7063
|
-
var
|
|
7081
|
+
var C = i?.amount ?? w.random.number(100, 4e3), x = i?.avatar ?? w.random.array(A.avatars)[0], c = i?.name ?? w.random.array(A.names.filter((F) => F.length))[0];
|
|
7064
7082
|
return {
|
|
7065
7083
|
listener: "tip-latest",
|
|
7066
7084
|
event: {
|
|
7067
|
-
amount:
|
|
7068
|
-
avatar:
|
|
7085
|
+
amount: C,
|
|
7086
|
+
avatar: x,
|
|
7069
7087
|
name: c.toLowerCase(),
|
|
7070
7088
|
displayName: c,
|
|
7071
7089
|
providerId: "",
|
|
7072
|
-
_id:
|
|
7090
|
+
_id: w.random.uuid(),
|
|
7073
7091
|
sessionTop: !1,
|
|
7074
7092
|
type: "tip",
|
|
7075
7093
|
originalEventName: "tip-latest",
|
|
@@ -7097,7 +7115,7 @@ var q;
|
|
|
7097
7115
|
listener: "bot:counter",
|
|
7098
7116
|
event: {
|
|
7099
7117
|
counter: i?.counter ?? "sampleCounter",
|
|
7100
|
-
value: i?.value ??
|
|
7118
|
+
value: i?.value ?? w.random.number(0, 100),
|
|
7101
7119
|
provider: t
|
|
7102
7120
|
},
|
|
7103
7121
|
// @ts-ignore
|
|
@@ -7106,11 +7124,11 @@ var q;
|
|
|
7106
7124
|
case "mute":
|
|
7107
7125
|
case "unmute":
|
|
7108
7126
|
case "alertService:toggleSound": {
|
|
7109
|
-
var
|
|
7127
|
+
var J = i?.muted ?? !client.details.overlay.muted;
|
|
7110
7128
|
return {
|
|
7111
7129
|
listener: "alertService:toggleSound",
|
|
7112
7130
|
event: {
|
|
7113
|
-
muted:
|
|
7131
|
+
muted: J,
|
|
7114
7132
|
provider: t
|
|
7115
7133
|
},
|
|
7116
7134
|
// @ts-ignore
|
|
@@ -7132,18 +7150,18 @@ var q;
|
|
|
7132
7150
|
switch (a) {
|
|
7133
7151
|
default:
|
|
7134
7152
|
case "random": {
|
|
7135
|
-
var
|
|
7153
|
+
var m = w.random.array(
|
|
7136
7154
|
s[t]
|
|
7137
7155
|
)[0];
|
|
7138
|
-
return this.onEventReceived(t,
|
|
7156
|
+
return this.onEventReceived(t, m);
|
|
7139
7157
|
}
|
|
7140
7158
|
case "message": {
|
|
7141
|
-
var c = i?.name ??
|
|
7142
|
-
const
|
|
7159
|
+
var c = i?.name ?? w.random.array(A.names.filter((Q) => Q.length))[0], b = i?.message ?? w.random.array(A.messages.filter((Q) => Q.length))[0];
|
|
7160
|
+
const W = await w.message.generateBadges(
|
|
7143
7161
|
i?.badges ?? [],
|
|
7144
7162
|
t
|
|
7145
7163
|
);
|
|
7146
|
-
var o =
|
|
7164
|
+
var o = w.message.findEmotesInText(b), h = w.message.replaceEmotesWithHTML(b, o), f = i?.color ?? w.random.color("hex"), d = i?.userId ?? w.random.number(1e7, 99999999).toString(), g = i?.msgId ?? w.random.uuid(), y = i?.time ?? Date.now(), x = i?.avatar ?? w.random.array(A.avatars)[0], v = i?.channel ?? client.details.user.username;
|
|
7147
7165
|
return {
|
|
7148
7166
|
listener: "message",
|
|
7149
7167
|
event: {
|
|
@@ -7155,36 +7173,36 @@ var q;
|
|
|
7155
7173
|
snippet: {
|
|
7156
7174
|
type: "",
|
|
7157
7175
|
liveChatId: "",
|
|
7158
|
-
authorChannelId:
|
|
7176
|
+
authorChannelId: v,
|
|
7159
7177
|
publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7160
7178
|
hasDisplayContent: !0,
|
|
7161
|
-
displayMessage:
|
|
7179
|
+
displayMessage: b,
|
|
7162
7180
|
textMessageDetails: {
|
|
7163
|
-
messageText:
|
|
7181
|
+
messageText: b
|
|
7164
7182
|
}
|
|
7165
7183
|
},
|
|
7166
7184
|
authorDetails: {
|
|
7167
|
-
channelId:
|
|
7185
|
+
channelId: v,
|
|
7168
7186
|
channelUrl: "",
|
|
7169
7187
|
displayName: c,
|
|
7170
|
-
profileImageUrl:
|
|
7171
|
-
...
|
|
7188
|
+
profileImageUrl: x,
|
|
7189
|
+
...W
|
|
7172
7190
|
},
|
|
7173
|
-
msgId:
|
|
7174
|
-
userId:
|
|
7191
|
+
msgId: g,
|
|
7192
|
+
userId: d,
|
|
7175
7193
|
nick: c.toLowerCase(),
|
|
7176
7194
|
badges: [],
|
|
7177
7195
|
displayName: c,
|
|
7178
7196
|
isAction: !1,
|
|
7179
7197
|
time: y,
|
|
7180
7198
|
tags: [],
|
|
7181
|
-
displayColor:
|
|
7182
|
-
channel:
|
|
7183
|
-
text:
|
|
7184
|
-
avatar:
|
|
7199
|
+
displayColor: f,
|
|
7200
|
+
channel: v,
|
|
7201
|
+
text: b,
|
|
7202
|
+
avatar: x,
|
|
7185
7203
|
emotes: []
|
|
7186
7204
|
},
|
|
7187
|
-
renderedText:
|
|
7205
|
+
renderedText: b
|
|
7188
7206
|
},
|
|
7189
7207
|
// @ts-ignore
|
|
7190
7208
|
emulated: !0
|
|
@@ -7192,15 +7210,15 @@ var q;
|
|
|
7192
7210
|
}
|
|
7193
7211
|
case "subscriber":
|
|
7194
7212
|
case "subscriber-latest": {
|
|
7195
|
-
var
|
|
7213
|
+
var x = i?.avatar ?? w.random.array(A.avatars)[0], c = i?.name ?? w.random.array(A.names.filter((O) => O.length))[0];
|
|
7196
7214
|
return {
|
|
7197
7215
|
listener: "subscriber-latest",
|
|
7198
7216
|
event: {
|
|
7199
|
-
avatar:
|
|
7217
|
+
avatar: x,
|
|
7200
7218
|
displayName: c,
|
|
7201
7219
|
name: c.toLowerCase(),
|
|
7202
7220
|
providerId: "",
|
|
7203
|
-
_id:
|
|
7221
|
+
_id: w.random.uuid(),
|
|
7204
7222
|
sessionTop: !1,
|
|
7205
7223
|
type: "subscriber",
|
|
7206
7224
|
originalEventName: "subscriber-latest",
|
|
@@ -7212,16 +7230,16 @@ var q;
|
|
|
7212
7230
|
}
|
|
7213
7231
|
case "superchat":
|
|
7214
7232
|
case "superchat-latest": {
|
|
7215
|
-
var
|
|
7233
|
+
var C = i?.amount ?? w.random.number(100, 4e3), x = i?.avatar ?? w.random.array(A.avatars)[0], c = i?.name ?? w.random.array(A.names.filter((F) => F.length))[0];
|
|
7216
7234
|
return {
|
|
7217
7235
|
listener: "superchat-latest",
|
|
7218
7236
|
event: {
|
|
7219
|
-
amount:
|
|
7220
|
-
avatar:
|
|
7237
|
+
amount: C,
|
|
7238
|
+
avatar: x,
|
|
7221
7239
|
name: c.toLowerCase(),
|
|
7222
7240
|
displayName: c,
|
|
7223
7241
|
providerId: "",
|
|
7224
|
-
_id:
|
|
7242
|
+
_id: w.random.uuid(),
|
|
7225
7243
|
sessionTop: !1,
|
|
7226
7244
|
type: "superchat",
|
|
7227
7245
|
originalEventName: "superchat-latest",
|
|
@@ -7233,36 +7251,36 @@ var q;
|
|
|
7233
7251
|
}
|
|
7234
7252
|
case "sponsor":
|
|
7235
7253
|
case "sponsor-latest": {
|
|
7236
|
-
var
|
|
7254
|
+
var S = i?.tier ?? w.random.array(["1000", "2000", "3000"])[0], C = i?.amount ?? w.random.number(1, 24), x = i?.avatar ?? w.random.array(A.avatars)[0], c = i?.name ?? w.random.array(A.names.filter((K) => K.length))[0], D = i?.sender ?? w.random.array(A.names.filter((K) => K.length && K !== c))[0], b = i?.message ?? w.random.array(A.messages.filter((K) => K.length))[0], M = {
|
|
7237
7255
|
default: {
|
|
7238
|
-
avatar:
|
|
7256
|
+
avatar: x,
|
|
7239
7257
|
playedAsCommunityGift: !1
|
|
7240
7258
|
},
|
|
7241
7259
|
gift: {
|
|
7242
|
-
sender:
|
|
7260
|
+
sender: D,
|
|
7243
7261
|
gifted: !0
|
|
7244
7262
|
},
|
|
7245
7263
|
community: {
|
|
7246
|
-
message:
|
|
7247
|
-
sender:
|
|
7264
|
+
message: b,
|
|
7265
|
+
sender: D,
|
|
7248
7266
|
bulkGifted: !0
|
|
7249
7267
|
},
|
|
7250
7268
|
spam: {
|
|
7251
|
-
sender:
|
|
7269
|
+
sender: D,
|
|
7252
7270
|
gifted: !0,
|
|
7253
7271
|
isCommunityGift: !0
|
|
7254
7272
|
}
|
|
7255
|
-
},
|
|
7256
|
-
return
|
|
7273
|
+
}, _ = ["default", "gift", "community", "spam"], j = i?.subType ?? w.random.array(_)[0];
|
|
7274
|
+
return j = _.includes(j) ? j : "default", {
|
|
7257
7275
|
listener: "sponsor-latest",
|
|
7258
7276
|
event: {
|
|
7259
|
-
amount:
|
|
7277
|
+
amount: C,
|
|
7260
7278
|
name: c.toLowerCase(),
|
|
7261
7279
|
displayName: c,
|
|
7262
7280
|
providerId: "",
|
|
7263
|
-
...
|
|
7264
|
-
...
|
|
7265
|
-
_id:
|
|
7281
|
+
...M.default,
|
|
7282
|
+
...M[j],
|
|
7283
|
+
_id: w.random.uuid(),
|
|
7266
7284
|
sessionTop: !1,
|
|
7267
7285
|
type: "sponsor",
|
|
7268
7286
|
originalEventName: "sponsor-latest",
|
|
@@ -7276,15 +7294,15 @@ var q;
|
|
|
7276
7294
|
}
|
|
7277
7295
|
}
|
|
7278
7296
|
}
|
|
7279
|
-
},
|
|
7297
|
+
}, l.emulate = {
|
|
7280
7298
|
twitch: {
|
|
7281
7299
|
message(t = {}) {
|
|
7282
|
-
|
|
7300
|
+
l.generate.event.onEventReceived(
|
|
7283
7301
|
"twitch",
|
|
7284
7302
|
"message",
|
|
7285
7303
|
t
|
|
7286
7304
|
).then((a) => {
|
|
7287
|
-
a &&
|
|
7305
|
+
a && l.emulate.send("onEventReceived", a);
|
|
7288
7306
|
});
|
|
7289
7307
|
},
|
|
7290
7308
|
deleteMessage(t) {
|
|
@@ -7295,7 +7313,7 @@ var q;
|
|
|
7295
7313
|
msgId: t
|
|
7296
7314
|
}
|
|
7297
7315
|
};
|
|
7298
|
-
|
|
7316
|
+
l.emulate.send("onEventReceived", a);
|
|
7299
7317
|
},
|
|
7300
7318
|
deleteMessages(t) {
|
|
7301
7319
|
if (!t || typeof t != "string") return;
|
|
@@ -7305,104 +7323,104 @@ var q;
|
|
|
7305
7323
|
userId: t
|
|
7306
7324
|
}
|
|
7307
7325
|
};
|
|
7308
|
-
|
|
7326
|
+
l.emulate.send("onEventReceived", a);
|
|
7309
7327
|
},
|
|
7310
7328
|
follower(t = {}) {
|
|
7311
|
-
|
|
7329
|
+
l.generate.event.onEventReceived(
|
|
7312
7330
|
"twitch",
|
|
7313
7331
|
"follower-latest",
|
|
7314
7332
|
t
|
|
7315
7333
|
).then((a) => {
|
|
7316
|
-
a &&
|
|
7334
|
+
a && l.emulate.send("onEventReceived", a);
|
|
7317
7335
|
});
|
|
7318
7336
|
},
|
|
7319
7337
|
raid(t = {}) {
|
|
7320
|
-
|
|
7338
|
+
l.generate.event.onEventReceived(
|
|
7321
7339
|
"twitch",
|
|
7322
7340
|
"raid-latest",
|
|
7323
7341
|
t
|
|
7324
7342
|
).then((a) => {
|
|
7325
|
-
a &&
|
|
7343
|
+
a && l.emulate.send("onEventReceived", a);
|
|
7326
7344
|
});
|
|
7327
7345
|
},
|
|
7328
7346
|
cheer(t = {}) {
|
|
7329
|
-
|
|
7347
|
+
l.generate.event.onEventReceived(
|
|
7330
7348
|
"twitch",
|
|
7331
7349
|
"cheer-latest",
|
|
7332
7350
|
t
|
|
7333
7351
|
).then((a) => {
|
|
7334
|
-
a &&
|
|
7352
|
+
a && l.emulate.send("onEventReceived", a);
|
|
7335
7353
|
});
|
|
7336
7354
|
},
|
|
7337
7355
|
subscriber(t = {}) {
|
|
7338
|
-
|
|
7356
|
+
l.generate.event.onEventReceived(
|
|
7339
7357
|
"twitch",
|
|
7340
7358
|
"subscriber-latest",
|
|
7341
7359
|
t
|
|
7342
7360
|
).then((a) => {
|
|
7343
|
-
a &&
|
|
7361
|
+
a && l.emulate.send("onEventReceived", a);
|
|
7344
7362
|
});
|
|
7345
7363
|
}
|
|
7346
7364
|
},
|
|
7347
7365
|
streamelements: {
|
|
7348
7366
|
tip(t = {}) {
|
|
7349
|
-
|
|
7367
|
+
l.generate.event.onEventReceived(
|
|
7350
7368
|
"streamelements",
|
|
7351
7369
|
"tip-latest",
|
|
7352
7370
|
t
|
|
7353
7371
|
).then((a) => {
|
|
7354
|
-
a &&
|
|
7372
|
+
a && l.emulate.send("onEventReceived", a);
|
|
7355
7373
|
});
|
|
7356
7374
|
}
|
|
7357
7375
|
},
|
|
7358
7376
|
youtube: {
|
|
7359
7377
|
message(t = {}) {
|
|
7360
|
-
|
|
7378
|
+
l.generate.event.onEventReceived(
|
|
7361
7379
|
"youtube",
|
|
7362
7380
|
"message",
|
|
7363
7381
|
t
|
|
7364
7382
|
).then((a) => {
|
|
7365
|
-
a &&
|
|
7383
|
+
a && l.emulate.send("onEventReceived", a);
|
|
7366
7384
|
});
|
|
7367
7385
|
},
|
|
7368
7386
|
subscriber(t = {}) {
|
|
7369
|
-
|
|
7387
|
+
l.generate.event.onEventReceived(
|
|
7370
7388
|
"youtube",
|
|
7371
7389
|
"subscriber-latest",
|
|
7372
7390
|
t
|
|
7373
7391
|
).then((a) => {
|
|
7374
|
-
a &&
|
|
7392
|
+
a && l.emulate.send("onEventReceived", a);
|
|
7375
7393
|
});
|
|
7376
7394
|
},
|
|
7377
7395
|
superchat(t = {}) {
|
|
7378
|
-
|
|
7396
|
+
l.generate.event.onEventReceived(
|
|
7379
7397
|
"youtube",
|
|
7380
7398
|
"superchat-latest",
|
|
7381
7399
|
t
|
|
7382
7400
|
).then((a) => {
|
|
7383
|
-
a &&
|
|
7401
|
+
a && l.emulate.send("onEventReceived", a);
|
|
7384
7402
|
});
|
|
7385
7403
|
},
|
|
7386
7404
|
sponsor(t = {}) {
|
|
7387
|
-
|
|
7405
|
+
l.generate.event.onEventReceived(
|
|
7388
7406
|
"youtube",
|
|
7389
7407
|
"sponsor-latest",
|
|
7390
7408
|
t
|
|
7391
7409
|
).then((a) => {
|
|
7392
|
-
a &&
|
|
7410
|
+
a && l.emulate.send("onEventReceived", a);
|
|
7393
7411
|
});
|
|
7394
7412
|
}
|
|
7395
7413
|
},
|
|
7396
7414
|
kick: {},
|
|
7397
7415
|
facebook: {},
|
|
7398
7416
|
send(t, a) {
|
|
7399
|
-
if (!
|
|
7400
|
-
|
|
7417
|
+
if (!l.queue) {
|
|
7418
|
+
N.warn("Local queue is not initialized."), window.dispatchEvent(new CustomEvent(t, { detail: a }));
|
|
7401
7419
|
return;
|
|
7402
7420
|
}
|
|
7403
7421
|
switch (t) {
|
|
7404
7422
|
case "onEventReceived": {
|
|
7405
|
-
|
|
7423
|
+
l.queue.enqueue({
|
|
7406
7424
|
listener: t,
|
|
7407
7425
|
data: a,
|
|
7408
7426
|
session: t === "onEventReceived" ? !0 : void 0
|
|
@@ -7410,14 +7428,14 @@ var q;
|
|
|
7410
7428
|
break;
|
|
7411
7429
|
}
|
|
7412
7430
|
case "onSessionUpdate": {
|
|
7413
|
-
|
|
7431
|
+
l.queue.enqueue({
|
|
7414
7432
|
listener: t,
|
|
7415
7433
|
data: a
|
|
7416
7434
|
});
|
|
7417
7435
|
break;
|
|
7418
7436
|
}
|
|
7419
7437
|
case "onWidgetLoad": {
|
|
7420
|
-
|
|
7438
|
+
l.queue.enqueue({
|
|
7421
7439
|
listener: t,
|
|
7422
7440
|
data: a
|
|
7423
7441
|
});
|
|
@@ -7428,16 +7446,16 @@ var q;
|
|
|
7428
7446
|
};
|
|
7429
7447
|
async function e(t = ["fields.json", "cf.json", "field.json", "customfields.json"], a = ["data.json", "fielddata.json", "fd.json", "DATA.json"], i) {
|
|
7430
7448
|
const s = {
|
|
7431
|
-
fields: t.find((
|
|
7449
|
+
fields: t.find((m) => {
|
|
7432
7450
|
try {
|
|
7433
|
-
return new URL("./" +
|
|
7451
|
+
return new URL("./" + m, window.location.href), !0;
|
|
7434
7452
|
} catch {
|
|
7435
7453
|
return !1;
|
|
7436
7454
|
}
|
|
7437
7455
|
}),
|
|
7438
|
-
data: a.find((
|
|
7456
|
+
data: a.find((m) => {
|
|
7439
7457
|
try {
|
|
7440
|
-
return new URL("./" +
|
|
7458
|
+
return new URL("./" + m, window.location.href), !0;
|
|
7441
7459
|
} catch {
|
|
7442
7460
|
return !1;
|
|
7443
7461
|
}
|
|
@@ -7447,23 +7465,23 @@ var q;
|
|
|
7447
7465
|
{
|
|
7448
7466
|
cache: "no-store"
|
|
7449
7467
|
}
|
|
7450
|
-
).then((
|
|
7468
|
+
).then((m) => m.json()).catch(() => ({}));
|
|
7451
7469
|
await fetch("./" + (s.fields ?? "fields.json"), {
|
|
7452
7470
|
cache: "no-store"
|
|
7453
|
-
}).then((
|
|
7454
|
-
const c = Object.entries(
|
|
7455
|
-
(
|
|
7471
|
+
}).then((m) => m.json()).then(async (m) => {
|
|
7472
|
+
const c = Object.entries(m).filter(([p, { value: o }]) => o != null).reduce(
|
|
7473
|
+
(p, [o, { value: h }]) => (n && n[o] !== void 0 && (h = n[o]), p[o] = h, p),
|
|
7456
7474
|
{
|
|
7457
7475
|
...n
|
|
7458
7476
|
}
|
|
7459
|
-
),
|
|
7477
|
+
), b = await l.generate.event.onWidgetLoad(
|
|
7460
7478
|
c,
|
|
7461
|
-
await
|
|
7479
|
+
await l.generate.session.get(i)
|
|
7462
7480
|
);
|
|
7463
|
-
window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail:
|
|
7481
|
+
window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail: b }));
|
|
7464
7482
|
});
|
|
7465
7483
|
}
|
|
7466
|
-
|
|
7484
|
+
l.start = e;
|
|
7467
7485
|
})(q || (q = {}));
|
|
7468
7486
|
class gt extends X {
|
|
7469
7487
|
constructor(e) {
|
|
@@ -7510,7 +7528,7 @@ class gt extends X {
|
|
|
7510
7528
|
try {
|
|
7511
7529
|
await this.processor.apply(this, [e.value, this]), this.emit("process", e, this);
|
|
7512
7530
|
} catch (a) {
|
|
7513
|
-
|
|
7531
|
+
N.error(
|
|
7514
7532
|
`Error during item processing: ${a instanceof Error ? a.message : String(a)}`
|
|
7515
7533
|
);
|
|
7516
7534
|
}
|
|
@@ -7608,14 +7626,14 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
|
|
|
7608
7626
|
if (window.dispatchEvent(new CustomEvent(e.listener, { detail: e.data })), e.listener === "onEventReceived" && e.session) {
|
|
7609
7627
|
const t = await q.generate.event.onSessionUpdate(
|
|
7610
7628
|
client.session,
|
|
7611
|
-
|
|
7629
|
+
w.event.parseProvider(e.data)
|
|
7612
7630
|
);
|
|
7613
7631
|
window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: t }));
|
|
7614
7632
|
}
|
|
7615
7633
|
}
|
|
7616
7634
|
}));
|
|
7617
|
-
}), window.addEventListener("onWidgetLoad", async (
|
|
7618
|
-
const { detail: e } =
|
|
7635
|
+
}), window.addEventListener("onWidgetLoad", async (l) => {
|
|
7636
|
+
const { detail: e } = l;
|
|
7619
7637
|
if (window.client instanceof G) {
|
|
7620
7638
|
const t = window.client;
|
|
7621
7639
|
if (t.fields = e.fieldData, t.session = e.session.data, t.details = {
|
|
@@ -7630,37 +7648,37 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
|
|
|
7630
7648
|
}).catch(() => {
|
|
7631
7649
|
t.details.provider = "local";
|
|
7632
7650
|
}) : t.details.provider = "local", t.emit("load", e), t.debug) {
|
|
7633
|
-
|
|
7634
|
-
const a =
|
|
7635
|
-
Object.keys(a).length &&
|
|
7651
|
+
N.received("Widget loaded!", l.detail);
|
|
7652
|
+
const a = l.detail.fieldData;
|
|
7653
|
+
Object.keys(a).length && N.received("Field data:", a);
|
|
7636
7654
|
}
|
|
7637
7655
|
t.loaded = !0, t.storage.on("load", (a) => {
|
|
7638
|
-
if (t.debug && a ?
|
|
7656
|
+
if (t.debug && a ? N.debug(
|
|
7639
7657
|
"[Client]",
|
|
7640
7658
|
"Storage loaded for client",
|
|
7641
7659
|
`"${t.id}";`,
|
|
7642
7660
|
`Provider: "${t.details.provider}";`,
|
|
7643
7661
|
a
|
|
7644
|
-
) : t.debug &&
|
|
7662
|
+
) : t.debug && N.debug(
|
|
7645
7663
|
"[Client]",
|
|
7646
7664
|
"Storage loaded for client",
|
|
7647
7665
|
`"${t.id}";`,
|
|
7648
7666
|
`Provider: "${t.details.provider}";`,
|
|
7649
7667
|
"No data found."
|
|
7650
7668
|
), a) {
|
|
7651
|
-
const i = (
|
|
7652
|
-
const
|
|
7653
|
-
for (const
|
|
7654
|
-
if (
|
|
7655
|
-
const
|
|
7656
|
-
|
|
7669
|
+
const i = (b) => {
|
|
7670
|
+
const p = Date.now(), o = {};
|
|
7671
|
+
for (const h in b)
|
|
7672
|
+
if (b.hasOwnProperty(h)) {
|
|
7673
|
+
const f = b[h];
|
|
7674
|
+
f.expire && f.expire > p && (o[h] = f);
|
|
7657
7675
|
}
|
|
7658
7676
|
return o;
|
|
7659
|
-
}, s = i(a.user || {}), n = i(a.avatar || {}),
|
|
7677
|
+
}, s = i(a.user || {}), n = i(a.avatar || {}), m = i(a.pronoun || {}), c = i(a.emote || {});
|
|
7660
7678
|
t.storage.update({
|
|
7661
7679
|
user: s,
|
|
7662
7680
|
avatar: n,
|
|
7663
|
-
pronoun:
|
|
7681
|
+
pronoun: m,
|
|
7664
7682
|
emote: c
|
|
7665
7683
|
});
|
|
7666
7684
|
}
|
|
@@ -7671,15 +7689,15 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
|
|
|
7671
7689
|
});
|
|
7672
7690
|
});
|
|
7673
7691
|
}
|
|
7674
|
-
}), window.addEventListener("onSessionUpdate", (
|
|
7675
|
-
const { detail: e } =
|
|
7692
|
+
}), window.addEventListener("onSessionUpdate", (l) => {
|
|
7693
|
+
const { detail: e } = l;
|
|
7676
7694
|
if (window.client instanceof G) {
|
|
7677
7695
|
const t = window.client;
|
|
7678
|
-
t.session = e.session, t.emit("session", e.session), t.debug &&
|
|
7696
|
+
t.session = e.session, t.emit("session", e.session), t.debug && N.debug("[Client]", "Session updated", e.session);
|
|
7679
7697
|
}
|
|
7680
|
-
}), window.addEventListener("onEventReceived", ({ detail:
|
|
7698
|
+
}), window.addEventListener("onEventReceived", ({ detail: l }) => {
|
|
7681
7699
|
if (window.client instanceof G) {
|
|
7682
|
-
const t =
|
|
7700
|
+
const t = w.event.parseProvider(l);
|
|
7683
7701
|
switch (t.provider) {
|
|
7684
7702
|
case "streamelements": {
|
|
7685
7703
|
const i = t.data;
|
|
@@ -7716,7 +7734,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
|
|
|
7716
7734
|
}
|
|
7717
7735
|
if (et.length) {
|
|
7718
7736
|
const n = et.find(
|
|
7719
|
-
(
|
|
7737
|
+
(m) => m.id === s.data.key.replace("customWidget.", "") || m.id === s.data.key
|
|
7720
7738
|
);
|
|
7721
7739
|
n && n.update(s.data.value);
|
|
7722
7740
|
}
|
|
@@ -7810,7 +7828,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
|
|
|
7810
7828
|
"event:test",
|
|
7811
7829
|
"kvstore:update"
|
|
7812
7830
|
];
|
|
7813
|
-
client.debug && !a.some((i) => i === t.data.listener) &&
|
|
7831
|
+
client.debug && !a.some((i) => i === t.data.listener) && N.received(
|
|
7814
7832
|
"[Client]",
|
|
7815
7833
|
`Event ${t.data.listener} received from ${t.provider}`,
|
|
7816
7834
|
t.data.event
|
|
@@ -7825,55 +7843,55 @@ const rt = {
|
|
|
7825
7843
|
resumeQueue: () => {
|
|
7826
7844
|
},
|
|
7827
7845
|
responses: {},
|
|
7828
|
-
sendMessage(
|
|
7846
|
+
sendMessage(l, e) {
|
|
7829
7847
|
},
|
|
7830
7848
|
counters: {
|
|
7831
|
-
get(
|
|
7849
|
+
get(l) {
|
|
7832
7850
|
return null;
|
|
7833
7851
|
}
|
|
7834
7852
|
},
|
|
7835
|
-
sanitize(
|
|
7836
|
-
return
|
|
7853
|
+
sanitize(l) {
|
|
7854
|
+
return l;
|
|
7837
7855
|
},
|
|
7838
|
-
cheerFilter(
|
|
7839
|
-
return
|
|
7856
|
+
cheerFilter(l) {
|
|
7857
|
+
return l;
|
|
7840
7858
|
},
|
|
7841
|
-
setField(
|
|
7859
|
+
setField(l, e, t) {
|
|
7842
7860
|
},
|
|
7843
7861
|
store: {
|
|
7844
|
-
set: function(
|
|
7845
|
-
this.list[
|
|
7862
|
+
set: function(l, e) {
|
|
7863
|
+
this.list[l] = e, localStorage.setItem("SE_API-STORE", JSON.stringify(rt.store.list));
|
|
7846
7864
|
},
|
|
7847
|
-
get: async function(
|
|
7848
|
-
return this.list[
|
|
7865
|
+
get: async function(l) {
|
|
7866
|
+
return this.list[l] ? this.list[l] : null;
|
|
7849
7867
|
},
|
|
7850
7868
|
list: {}
|
|
7851
7869
|
}
|
|
7852
7870
|
};
|
|
7853
7871
|
async function Dt() {
|
|
7854
|
-
let
|
|
7872
|
+
let l = localStorage.getItem("SE_API-STORE") ?? "", e = l ? JSON.parse(l) : {};
|
|
7855
7873
|
return rt.store.list = e, rt;
|
|
7856
7874
|
}
|
|
7857
7875
|
var ot;
|
|
7858
|
-
((
|
|
7876
|
+
((l) => {
|
|
7859
7877
|
let e;
|
|
7860
7878
|
((i) => {
|
|
7861
7879
|
((s) => {
|
|
7862
7880
|
s.hehim = "He/Him", s.sheher = "She/Her", s.theythem = "They/Them", s.shethem = "She/They", s.hethem = "He/They", s.heshe = "He/She", s.xexem = "Xe/Xem", s.faefaer = "Fae/Faer", s.vever = "Ve/Ver", s.aeaer = "Ae/Aer", s.ziehir = "Zie/Hir", s.perper = "Per/Per", s.eem = "E/Em", s.itits = "It/Its";
|
|
7863
7881
|
})(i.map || (i.map = {}));
|
|
7864
|
-
})(e =
|
|
7882
|
+
})(e = l.Pronouns || (l.Pronouns = {}));
|
|
7865
7883
|
async function t() {
|
|
7866
7884
|
try {
|
|
7867
7885
|
const i = await fetch("https://pronouns.alejo.io/api/pronouns").then((s) => s.json());
|
|
7868
7886
|
if (Array.isArray(i) && i.length) {
|
|
7869
|
-
const s = Object.fromEntries(i.map(({ name: n, display:
|
|
7887
|
+
const s = Object.fromEntries(i.map(({ name: n, display: m }) => [n, m]));
|
|
7870
7888
|
return { ...e.map, ...s };
|
|
7871
7889
|
}
|
|
7872
7890
|
} catch {
|
|
7873
7891
|
}
|
|
7874
7892
|
return { ...e.map };
|
|
7875
7893
|
}
|
|
7876
|
-
|
|
7894
|
+
l.list = t;
|
|
7877
7895
|
async function a(i) {
|
|
7878
7896
|
if (!i) throw new Error("Username is required to fetch Alejo data.");
|
|
7879
7897
|
if (i = i.toLowerCase(), i in client.storage.data.pronoun && client.storage.data.pronoun[i].expire > Date.now())
|
|
@@ -7890,7 +7908,7 @@ var ot;
|
|
|
7890
7908
|
throw new Error(`Failed to fetch pronoun data for user "${i}": ${s instanceof Error ? s.message : s}`);
|
|
7891
7909
|
}
|
|
7892
7910
|
}
|
|
7893
|
-
|
|
7911
|
+
l.get = a;
|
|
7894
7912
|
})(ot || (ot = {}));
|
|
7895
7913
|
class At extends X {
|
|
7896
7914
|
/**
|
|
@@ -7902,7 +7920,7 @@ class At extends X {
|
|
|
7902
7920
|
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) => {
|
|
7903
7921
|
this.instance = a, this.emit("load", a), this.connect();
|
|
7904
7922
|
}).catch((a) => {
|
|
7905
|
-
|
|
7923
|
+
N.error("useComfyJs: Failed to load ComfyJS", a);
|
|
7906
7924
|
});
|
|
7907
7925
|
}
|
|
7908
7926
|
/**
|
|
@@ -7924,9 +7942,9 @@ class At extends X {
|
|
|
7924
7942
|
*/
|
|
7925
7943
|
connect() {
|
|
7926
7944
|
this.instance.onError = (e) => {
|
|
7927
|
-
this.emit("error", e), client.debug &&
|
|
7945
|
+
this.emit("error", e), client.debug && N.error("[Client]", "ComfyJS Error:", e);
|
|
7928
7946
|
}, this.instance.onCommand = (e, t, a, i, s) => {
|
|
7929
|
-
if (this.emit("command", e, t, a, i, s), client.debug &&
|
|
7947
|
+
if (this.emit("command", e, t, a, i, s), client.debug && N.debug("[Client]", `ComfyJS Command: !${t} ${a} (User: ${e})`), this.emulate) {
|
|
7930
7948
|
const n = {
|
|
7931
7949
|
...i,
|
|
7932
7950
|
broadcaster: i.broadcaster,
|
|
@@ -7934,20 +7952,20 @@ class At extends X {
|
|
|
7934
7952
|
vip: i.vip,
|
|
7935
7953
|
subscriber: i.subscriber,
|
|
7936
7954
|
founder: i.founder
|
|
7937
|
-
},
|
|
7955
|
+
}, m = {
|
|
7938
7956
|
name: e,
|
|
7939
7957
|
message: `!${t} ${a}`,
|
|
7940
|
-
badges: Object.entries(n).map(([c,
|
|
7958
|
+
badges: Object.entries(n).map(([c, b]) => b ? c : null).filter(Boolean),
|
|
7941
7959
|
color: s.userColor,
|
|
7942
7960
|
time: new Date(s.timestamp).getTime(),
|
|
7943
7961
|
userId: s.userId,
|
|
7944
7962
|
msgId: s.id,
|
|
7945
7963
|
channel: s.channel
|
|
7946
7964
|
};
|
|
7947
|
-
q.emulate.twitch.message(
|
|
7965
|
+
q.emulate.twitch.message(m);
|
|
7948
7966
|
}
|
|
7949
7967
|
}, this.instance.onChat = (e, t, a, i, s) => {
|
|
7950
|
-
if (this.emit("chat", e, t, a, i, s), client.debug &&
|
|
7968
|
+
if (this.emit("chat", e, t, a, i, s), client.debug && N.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
|
|
7951
7969
|
const n = {
|
|
7952
7970
|
...a,
|
|
7953
7971
|
...s.userBadges,
|
|
@@ -7960,7 +7978,7 @@ class At extends X {
|
|
|
7960
7978
|
q.emulate.twitch.message({
|
|
7961
7979
|
name: e,
|
|
7962
7980
|
message: t,
|
|
7963
|
-
badges: Object.entries(n).map(([
|
|
7981
|
+
badges: Object.entries(n).map(([m, c]) => c ? m : null).filter(Boolean),
|
|
7964
7982
|
color: s.userColor,
|
|
7965
7983
|
time: new Date(s.timestamp).getTime(),
|
|
7966
7984
|
userId: s.userId,
|
|
@@ -7969,22 +7987,22 @@ class At extends X {
|
|
|
7969
7987
|
});
|
|
7970
7988
|
}
|
|
7971
7989
|
}, this.instance.onWhisper = (e, t, a, i, s) => {
|
|
7972
|
-
this.emit("whisper", e, t, a, i, s), client.debug &&
|
|
7990
|
+
this.emit("whisper", e, t, a, i, s), client.debug && N.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
|
|
7973
7991
|
}, this.instance.onMessageDeleted = (e, t) => {
|
|
7974
|
-
this.emit("messageDeleted", e, t), client.debug &&
|
|
7992
|
+
this.emit("messageDeleted", e, t), client.debug && N.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && q.emulate.twitch.deleteMessage(e);
|
|
7975
7993
|
}, this.instance.onJoin = (e, t, a) => {
|
|
7976
|
-
this.emit("join", e, t, a), client.debug &&
|
|
7994
|
+
this.emit("join", e, t, a), client.debug && N.debug("[Client]", `ComfyJS Join: ${e}`);
|
|
7977
7995
|
}, this.instance.onPart = (e, t, a) => {
|
|
7978
|
-
this.emit("part", e, t, a), client.debug &&
|
|
7996
|
+
this.emit("part", e, t, a), client.debug && N.debug("[Client]", `ComfyJS Part: ${e}`);
|
|
7979
7997
|
}, this.instance.onHosted = (e, t, a, i) => {
|
|
7980
|
-
this.emit("hosted", e, t, a, i), client.debug &&
|
|
7998
|
+
this.emit("hosted", e, t, a, i), client.debug && N.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
|
|
7981
7999
|
}, this.instance.onRaid = (e, t, a) => {
|
|
7982
|
-
this.emit("raid", e, t, a), client.debug &&
|
|
8000
|
+
this.emit("raid", e, t, a), client.debug && N.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && q.emulate.twitch.raid({
|
|
7983
8001
|
name: e,
|
|
7984
8002
|
amount: t
|
|
7985
8003
|
});
|
|
7986
8004
|
}, this.instance.onSub = (e, t, a, i) => {
|
|
7987
|
-
if (this.emit("sub", e, t, a, i), client.debug &&
|
|
8005
|
+
if (this.emit("sub", e, t, a, i), client.debug && N.debug("[Client]", `ComfyJS Sub: ${e} (${a.plan})`), this.emulate) {
|
|
7988
8006
|
const s = a.plan === "Prime" ? "prime" : a.plan;
|
|
7989
8007
|
q.emulate.twitch.subscriber({
|
|
7990
8008
|
name: e,
|
|
@@ -7994,12 +8012,12 @@ class At extends X {
|
|
|
7994
8012
|
});
|
|
7995
8013
|
}
|
|
7996
8014
|
}, this.instance.onResub = (e, t, a, i, s, n) => {
|
|
7997
|
-
if (this.emit("resub", e, t, a, i, s, n), client.debug &&
|
|
7998
|
-
const
|
|
8015
|
+
if (this.emit("resub", e, t, a, i, s, n), client.debug && N.debug("[Client]", `ComfyJS Resub: ${e} (${i} months)`), this.emulate) {
|
|
8016
|
+
const m = s.plan === "Prime" ? "prime" : s.plan;
|
|
7999
8017
|
q.emulate.twitch.subscriber({
|
|
8000
8018
|
name: e,
|
|
8001
8019
|
message: t,
|
|
8002
|
-
tier:
|
|
8020
|
+
tier: m,
|
|
8003
8021
|
amount: i,
|
|
8004
8022
|
subType: "default"
|
|
8005
8023
|
});
|
|
@@ -8013,19 +8031,19 @@ class At extends X {
|
|
|
8013
8031
|
i,
|
|
8014
8032
|
s,
|
|
8015
8033
|
n
|
|
8016
|
-
), client.debug &&
|
|
8017
|
-
const
|
|
8034
|
+
), client.debug && N.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${i} subs`), this.emulate) {
|
|
8035
|
+
const m = s.plan === "Prime" ? "prime" : s.plan;
|
|
8018
8036
|
q.emulate.twitch.subscriber({
|
|
8019
8037
|
name: a,
|
|
8020
8038
|
message: "",
|
|
8021
8039
|
sender: e,
|
|
8022
|
-
tier:
|
|
8040
|
+
tier: m,
|
|
8023
8041
|
amount: i,
|
|
8024
8042
|
subType: "gift"
|
|
8025
8043
|
});
|
|
8026
8044
|
}
|
|
8027
8045
|
}, this.instance.onSubMysteryGift = (e, t, a, i, s) => {
|
|
8028
|
-
if (this.emit("subMysteryGift", e, t, a, i, s), client.debug &&
|
|
8046
|
+
if (this.emit("subMysteryGift", e, t, a, i, s), client.debug && N.debug(
|
|
8029
8047
|
"[Client]",
|
|
8030
8048
|
`ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`
|
|
8031
8049
|
), this.emulate) {
|
|
@@ -8039,7 +8057,7 @@ class At extends X {
|
|
|
8039
8057
|
});
|
|
8040
8058
|
}
|
|
8041
8059
|
}, this.instance.onGiftSubContinue = (e, t, a) => {
|
|
8042
|
-
this.emit("giftSubContinue", e, t, a), client.debug &&
|
|
8060
|
+
this.emit("giftSubContinue", e, t, a), client.debug && N.debug(
|
|
8043
8061
|
"[Client]",
|
|
8044
8062
|
`ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`
|
|
8045
8063
|
), this.emulate && q.emulate.twitch.subscriber({
|
|
@@ -8050,25 +8068,25 @@ class At extends X {
|
|
|
8050
8068
|
subType: "gift"
|
|
8051
8069
|
});
|
|
8052
8070
|
}, this.instance.onCheer = (e, t, a, i, s) => {
|
|
8053
|
-
this.emit("cheer", e, t, a, i, s), client.debug &&
|
|
8071
|
+
this.emit("cheer", e, t, a, i, s), client.debug && N.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${a} bits - ${t}`), this.emulate && q.emulate.twitch.cheer({
|
|
8054
8072
|
name: e,
|
|
8055
8073
|
message: t,
|
|
8056
8074
|
amount: a
|
|
8057
8075
|
});
|
|
8058
8076
|
}, this.instance.onChatMode = (e, t) => {
|
|
8059
|
-
this.emit("chatMode", e, t), client.debug &&
|
|
8077
|
+
this.emit("chatMode", e, t), client.debug && N.debug("[Client]", `ComfyJS Chat Mode Changed on ${t}`);
|
|
8060
8078
|
}, this.instance.onReward = (e, t, a, i, s) => {
|
|
8061
|
-
this.emit("reward", e, t, a, i, s), client.debug &&
|
|
8079
|
+
this.emit("reward", e, t, a, i, s), client.debug && N.debug(
|
|
8062
8080
|
"[Client]",
|
|
8063
8081
|
`ComfyJS Reward: ${e} redeemed ${t} for ${a} - ${i}`
|
|
8064
8082
|
);
|
|
8065
8083
|
}, this.instance.onConnected = (e, t, a) => {
|
|
8066
|
-
this.emit("connected", e, t, a), client.debug &&
|
|
8084
|
+
this.emit("connected", e, t, a), client.debug && N.debug(
|
|
8067
8085
|
"[Client]",
|
|
8068
8086
|
`ComfyJS Connected: ${e}:${t} (First Connect: ${a})`
|
|
8069
8087
|
);
|
|
8070
8088
|
}, this.instance.onReconnect = (e) => {
|
|
8071
|
-
this.emit("reconnect", e), client.debug &&
|
|
8089
|
+
this.emit("reconnect", e), client.debug && N.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
|
|
8072
8090
|
}, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
|
|
8073
8091
|
}
|
|
8074
8092
|
}
|
|
@@ -8139,13 +8157,13 @@ class pt {
|
|
|
8139
8157
|
if (!this.enabled || typeof console > "u") return;
|
|
8140
8158
|
let s = "";
|
|
8141
8159
|
typeof this.prefix == "function" ? s = this.prefix() : typeof this.prefix == "string" && (s = this.prefix);
|
|
8142
|
-
const n = [],
|
|
8160
|
+
const n = [], m = [];
|
|
8143
8161
|
if (i.forEach((c) => {
|
|
8144
|
-
typeof c == "string" || typeof c == "number" || typeof c == "boolean" ? n.push(c) :
|
|
8162
|
+
typeof c == "string" || typeof c == "number" || typeof c == "boolean" ? n.push(c) : m.push(c);
|
|
8145
8163
|
}), n.length > 0) {
|
|
8146
8164
|
const c = n.join(" ");
|
|
8147
|
-
console.log(`%c${s.endsWith(" ") ? s : s.trim() + " "}${a}${c}`, t, ...
|
|
8148
|
-
} else
|
|
8165
|
+
console.log(`%c${s.endsWith(" ") ? s : s.trim() + " "}${a}${c}`, t, ...m);
|
|
8166
|
+
} else m.length > 0 && console.log(`%c${s.endsWith(" ") ? s : s.trim() + " "}${a}`, t, ...m);
|
|
8149
8167
|
};
|
|
8150
8168
|
}
|
|
8151
8169
|
style(e) {
|
|
@@ -8171,13 +8189,13 @@ class pt {
|
|
|
8171
8189
|
!this.enabled || !console.timeEnd || console.timeEnd(e);
|
|
8172
8190
|
}
|
|
8173
8191
|
}
|
|
8174
|
-
const ct = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(Dt()),
|
|
8192
|
+
const ct = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(Dt()), N = new pt(), mt = {
|
|
8175
8193
|
SeAPI: ct,
|
|
8176
8194
|
Client: G,
|
|
8177
|
-
Helper:
|
|
8195
|
+
Helper: w,
|
|
8178
8196
|
Local: q,
|
|
8179
8197
|
Data: A,
|
|
8180
|
-
logger:
|
|
8198
|
+
logger: N,
|
|
8181
8199
|
modules: { EventProvider: X, useStorage: it, useQueue: gt, useLogger: pt, useComms: St },
|
|
8182
8200
|
actions: { Button: at, Command: Z },
|
|
8183
8201
|
multistream: { useComfyJs: At },
|