@tixyel/streamelements 5.5.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- class V {
1
+ class Z {
2
2
  constructor() {
3
3
  this.registeredEvents = {};
4
4
  }
@@ -49,13 +49,13 @@ class V {
49
49
  return this.registeredEvents[e] = [], this;
50
50
  }
51
51
  }
52
- var q = [];
53
- class G extends V {
52
+ var tt = [];
53
+ class et extends Z {
54
54
  constructor(e) {
55
- super(), this.id = "default", this.loaded = !1, this.SE_API = null, this.id = e.id || this.id, this.data = e.data ?? {}, q.push(this), this.start();
55
+ super(), this.id = "default", this.loaded = !1, this.SE_API = null, this.id = e.id || this.id, this.data = e.data ?? {}, tt.push(this), this.start();
56
56
  }
57
57
  start() {
58
- et?.then((e) => {
58
+ gt?.then((e) => {
59
59
  this.SE_API = e, e.store.get(this.id).then((t) => {
60
60
  this.data = t ?? this.data, this.loaded = !0, this.emit("load", this.data), JSON.stringify(this.data) !== JSON.stringify(t) && this.emit("update", this.data);
61
61
  }).catch(() => {
@@ -86,7 +86,7 @@ class G extends V {
86
86
  * @param value Value to add
87
87
  */
88
88
  add(e, t) {
89
- this.loaded && (G.setByPath(this.data, e, t), this.save(this.data));
89
+ this.loaded && (et.setByPath(this.data, e, t), this.save(this.data));
90
90
  }
91
91
  /**
92
92
  * Clears all data from the storage.
@@ -112,7 +112,7 @@ class G extends V {
112
112
  return e === "load" && this.loaded ? (t.apply(this, [this.data]), this) : (super.on(e, t), this);
113
113
  }
114
114
  }
115
- class M extends V {
115
+ class G extends Z {
116
116
  constructor(e) {
117
117
  super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
118
118
  commands: [],
@@ -121,7 +121,7 @@ class M extends V {
121
121
  avatar: 30,
122
122
  pronoun: 60,
123
123
  emote: 120
124
- }, this.id = e.id || this.id, this.storage = new G({
124
+ }, this.id = e.id || this.id, this.storage = new et({
125
125
  id: this.id,
126
126
  data: {
127
127
  user: {},
@@ -154,9 +154,9 @@ class M extends V {
154
154
  ]), this) : (super.on(e, t), this);
155
155
  }
156
156
  }
157
- class _ {
157
+ class Q {
158
158
  constructor(e) {
159
- this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], window.client instanceof M && (this.prefix = e.prefix ?? this.prefix, this.name = e.name, this.description = e.description ?? this.description, this.arguments = e.arguments ?? this.arguments, this.run = e.run, this.test = e.test ?? this.test, this.aliases = e.aliases ?? this.aliases, this.permissions = e.permissions ?? this.permissions, this.admins = e.admins ?? this.admins, window.client.actions.commands.push(this), window.client.emit("action", this, "created"));
159
+ this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], window.client instanceof G && (this.prefix = e.prefix ?? this.prefix, this.name = e.name, this.description = e.description ?? this.description, this.arguments = e.arguments ?? this.arguments, this.run = e.run, this.test = e.test ?? this.test, this.aliases = e.aliases ?? this.aliases, this.permissions = e.permissions ?? this.permissions, this.admins = e.admins ?? this.admins, window.client.actions.commands.push(this), window.client.emit("action", this, "created"));
160
160
  }
161
161
  run(e, t) {
162
162
  }
@@ -164,7 +164,7 @@ class _ {
164
164
  return this.arguments === !0 && (!a || !a.length) ? !1 : !!(this.admins.some((i) => e.toLocaleLowerCase() === i.toLocaleLowerCase()) || this.permissions === !0 || typeof this.permissions > "u" || Array.isArray(this.permissions) && !this.permissions.length || Array.isArray(this.permissions) && (this.permissions.some((i) => e.toLowerCase() === i.toLowerCase() || t.map((s) => s.toLowerCase()).includes(i.toLowerCase())) || this.permissions.includes("*")));
165
165
  }
166
166
  parse(e, t) {
167
- if (!(window.client instanceof M)) return !1;
167
+ if (!(window.client instanceof G)) return !1;
168
168
  const a = e.replace(this.prefix, "").split(" ").slice(1).map((o) => o.trim());
169
169
  var i = "", s = [];
170
170
  const n = { bits: "cheer", premium: "prime" };
@@ -181,22 +181,22 @@ class _ {
181
181
  isChatSponsor: "sponsor",
182
182
  isChatModerator: "moderator"
183
183
  };
184
- i = o.event.data.nick || o.event.data.displayName, s = Object.entries(o.event.data.authorDetails).filter(([g, r]) => g.startsWith("is") && r).map(([g]) => b[g]).filter(Boolean), s.includes("sponsor") && (s.push("premium"), s.push("prime")), s.includes("owner") && (s.push("moderator"), s.push("broadcaster"));
184
+ i = o.event.data.nick || o.event.data.displayName, s = Object.entries(o.event.data.authorDetails).filter(([g, c]) => g.startsWith("is") && c).map(([g]) => b[g]).filter(Boolean), s.includes("sponsor") && (s.push("premium"), s.push("prime")), s.includes("owner") && (s.push("moderator"), s.push("broadcaster"));
185
185
  break;
186
186
  }
187
187
  case "kick":
188
188
  return !1;
189
189
  }
190
- const l = this.verify(i, s, a);
191
- return l === !0 && this.run.apply(window.client, [a, t]), l;
190
+ const m = this.verify(i, s, a);
191
+ return m === !0 && this.run.apply(window.client, [a, t]), m;
192
192
  }
193
193
  remove() {
194
- if (!(window.client instanceof M)) return;
194
+ if (!(window.client instanceof G)) return;
195
195
  const e = window.client.actions.commands.indexOf(this);
196
196
  e > -1 && (window.client.actions.commands.splice(e, 1), window.client.emit("action", this, "removed"));
197
197
  }
198
198
  static execute(e) {
199
- if (!(window.client instanceof M)) return !1;
199
+ if (!(window.client instanceof G)) return !1;
200
200
  const t = e.data;
201
201
  try {
202
202
  if (window.client.actions.commands.length && window.client.actions.commands.some((a) => t.event.data.text.startsWith(a.prefix))) {
@@ -204,9 +204,9 @@ class _ {
204
204
  var s = [i.name, ...i.aliases ?? []], n = t.event.data.text.replace(i.prefix, "").split(" ")[0];
205
205
  return s.includes(n);
206
206
  });
207
- if (a.length && a.every((i) => i instanceof _))
207
+ if (a.length && a.every((i) => i instanceof Q))
208
208
  return a.forEach((i) => {
209
- i.parse(t.event.data.text, e), window.client.emit("action", i, "executed"), A.received(`Command executed: ${t.event.data.text} by ${t.event.data.nick || t.event.data.displayName}`, t);
209
+ i.parse(t.event.data.text, e), window.client.emit("action", i, "executed"), R.received(`Command executed: ${t.event.data.text} by ${t.event.data.nick || t.event.data.displayName}`, t);
210
210
  }), !0;
211
211
  }
212
212
  } catch {
@@ -216,7 +216,7 @@ class _ {
216
216
  }
217
217
  }
218
218
  }
219
- const Z = [
219
+ const lt = [
220
220
  "aliceblue",
221
221
  "antiquewhite",
222
222
  "aqua",
@@ -367,7 +367,7 @@ const Z = [
367
367
  "yellowgreen",
368
368
  "transparent"
369
369
  ];
370
- function it(h, e) {
370
+ function pt(h, e) {
371
371
  if (!e) return null;
372
372
  switch (e) {
373
373
  case "hex": {
@@ -390,7 +390,7 @@ function it(h, e) {
390
390
  const t = h.match(/hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*([\d.]+))?\s*\)/);
391
391
  if (!t) return null;
392
392
  const a = parseInt(t[1]), i = parseInt(t[2]), s = parseInt(t[3]), n = t[4] ? parseFloat(t[4]) : 1;
393
- return { ...st(a, i, s), a: n };
393
+ return { ...bt(a, i, s), a: n };
394
394
  }
395
395
  case "css-color-name": {
396
396
  const t = document.createElement("canvas");
@@ -405,18 +405,18 @@ function it(h, e) {
405
405
  return null;
406
406
  }
407
407
  }
408
- function at(h, e = !0) {
408
+ function ft(h, e = !0) {
409
409
  const t = (i) => Math.round(i).toString(16).padStart(2, "0");
410
410
  let a = `#${t(h.r)}${t(h.g)}${t(h.b)}`;
411
411
  return e && h.a < 1 && (a += t(h.a * 255)), a;
412
412
  }
413
- function X(h, e, t) {
413
+ function dt(h, e, t) {
414
414
  h /= 255, e /= 255, t /= 255;
415
415
  const a = Math.max(h, e, t), i = Math.min(h, e, t), s = a - i;
416
- let n = 0, l = 0;
416
+ let n = 0, m = 0;
417
417
  const o = (a + i) / 2;
418
418
  if (s !== 0)
419
- switch (l = o > 0.5 ? s / (2 - a - i) : s / (a + i), a) {
419
+ switch (m = o > 0.5 ? s / (2 - a - i) : s / (a + i), a) {
420
420
  case h:
421
421
  n = ((e - t) / s + (e < t ? 6 : 0)) / 6;
422
422
  break;
@@ -429,18 +429,18 @@ function X(h, e, t) {
429
429
  }
430
430
  return {
431
431
  h: Math.round(n * 360),
432
- s: Math.round(l * 100),
432
+ s: Math.round(m * 100),
433
433
  l: Math.round(o * 100)
434
434
  };
435
435
  }
436
- function st(h, e, t) {
436
+ function bt(h, e, t) {
437
437
  h /= 360, e /= 100, t /= 100;
438
438
  let a, i, s;
439
439
  if (e === 0)
440
440
  a = i = s = t;
441
441
  else {
442
- const n = (b, g, r) => (r < 0 && (r += 1), r > 1 && (r -= 1), r < 0.16666666666666666 ? b + (g - b) * 6 * r : r < 0.5 ? g : r < 0.6666666666666666 ? b + (g - b) * (0.6666666666666666 - r) * 6 : b), l = t < 0.5 ? t * (1 + e) : t + e - t * e, o = 2 * t - l;
443
- a = n(o, l, h + 1 / 3), i = n(o, l, h), s = n(o, l, h - 1 / 3);
442
+ const n = (b, g, c) => (c < 0 && (c += 1), c > 1 && (c -= 1), c < 0.16666666666666666 ? b + (g - b) * 6 * c : c < 0.5 ? g : c < 0.6666666666666666 ? b + (g - b) * (0.6666666666666666 - c) * 6 : b), m = t < 0.5 ? t * (1 + e) : t + e - t * e, o = 2 * t - m;
443
+ a = n(o, m, h + 1 / 3), i = n(o, m, h), s = n(o, m, h - 1 / 3);
444
444
  }
445
445
  return {
446
446
  r: Math.round(a * 255),
@@ -448,21 +448,21 @@ function st(h, e, t) {
448
448
  b: Math.round(s * 255)
449
449
  };
450
450
  }
451
- async function nt(h, e, t) {
452
- const a = Z;
451
+ async function yt(h, e, t) {
452
+ const a = lt;
453
453
  let i = a[0], s = 1 / 0;
454
454
  for await (const n of a) {
455
- const l = document.createElement("canvas");
456
- l.width = l.height = 1;
457
- const o = l.getContext("2d");
455
+ const m = document.createElement("canvas");
456
+ m.width = m.height = 1;
457
+ const o = m.getContext("2d");
458
458
  if (!o) continue;
459
459
  o.fillStyle = n, o.fillRect(0, 0, 1, 1);
460
- const [b, g, r] = o.getImageData(0, 0, 1, 1).data, d = Math.sqrt(Math.pow(h - b, 2) + Math.pow(e - g, 2) + Math.pow(t - r, 2));
460
+ const [b, g, c] = o.getImageData(0, 0, 1, 1).data, d = Math.sqrt(Math.pow(h - b, 2) + Math.pow(e - g, 2) + Math.pow(t - c, 2));
461
461
  if (d < s && (s = d, i = n), d === 0) break;
462
462
  }
463
463
  return i;
464
464
  }
465
- const rt = [
465
+ const wt = [
466
466
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/13e5fa74-defa-11e9-809c-784f43822e80-profile_image-300x300.png",
467
467
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/dbdc9198-def8-11e9-8681-784f43822e80-profile_image-300x300.png",
468
468
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/998f01ae-def8-11e9-b95c-784f43822e80-profile_image-300x300.png",
@@ -470,7 +470,7 @@ const rt = [
470
470
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/ebe4cd89-b4f4-4cd9-adac-2f30151b4209-profile_image-300x300.png",
471
471
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/215b7342-def9-11e9-9a66-784f43822e80-profile_image-300x300.png",
472
472
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/ead5c8b2-a4c9-4724-b1dd-9f00b46cbd3d-profile_image-300x300.png"
473
- ], ot = {
473
+ ], vt = {
474
474
  "100 bits": {
475
475
  type: "100 bits",
476
476
  version: "1",
@@ -561,7 +561,7 @@ const rt = [
561
561
  url: "https://static-cdn.jtvnw.net/badges/v1/b817aba4-fad8-49e2-b88a-7cc744dfa6ec/3",
562
562
  description: "VIP"
563
563
  }
564
- }, ct = Object.values([
564
+ }, kt = Object.values([
565
565
  {
566
566
  type: "twitch",
567
567
  name: "TheIlluminati",
@@ -1918,7 +1918,7 @@ const rt = [
1918
1918
  end: 0
1919
1919
  }), h),
1920
1920
  []
1921
- ), dt = [], ht = [
1921
+ ), Ct = [], jt = [
1922
1922
  "Hello everyone!",
1923
1923
  "PogChamp",
1924
1924
  "This stream is amazing!",
@@ -1969,7 +1969,7 @@ const rt = [
1969
1969
  "BloodTrail hunting time",
1970
1970
  "CatBag kitty!",
1971
1971
  "c! poggers"
1972
- ], lt = ["Local", "Tixyel", "Urie_s2", "itzzcatt", "BeniArts", "Cupidiko", "shy_madeit"], mt = ["1000", "2000", "3000", "prime"], ut = [
1972
+ ], xt = ["Local", "Tixyel", "Urie_s2", "itzzcatt", "BeniArts", "Cupidiko", "shy_madeit"], Ut = ["1000", "2000", "3000", "prime"], Et = [
1973
1973
  "Filiz",
1974
1974
  "Astrid",
1975
1975
  "Tatyana",
@@ -2057,7 +2057,7 @@ const rt = [
2057
2057
  "Szabolcs",
2058
2058
  "Hoda",
2059
2059
  "Naayf"
2060
- ], gt = [
2060
+ ], It = [
2061
2061
  {
2062
2062
  emojiId: "UCkszU2WH9gy1mb0dV-11UJg/flower-rainbow-heart-red",
2063
2063
  shortcuts: [":pride-flower-rainbow-heart:"],
@@ -5231,15 +5231,15 @@ const rt = [
5231
5231
  index: 121
5232
5232
  }
5233
5233
  ];
5234
- var E;
5234
+ var D;
5235
5235
  ((h) => {
5236
- h.avatars = rt, h.badges = ot, h.css_color_names = Z, h.emotes = ct, h.items = dt, h.messages = ht, h.names = lt, h.tiers = mt, h.tts = ut, h.youtube_emotes = gt;
5237
- })(E || (E = {}));
5236
+ h.avatars = wt, h.badges = vt, h.css_color_names = lt, h.emotes = kt, h.items = Ct, h.messages = jt, h.names = xt, h.tiers = Ut, h.tts = Et, h.youtube_emotes = It;
5237
+ })(D || (D = {}));
5238
5238
  var y;
5239
5239
  ((h) => {
5240
5240
  let e;
5241
5241
  ((n) => {
5242
- function l(g, r = "cardinal") {
5242
+ function m(g, c = "cardinal") {
5243
5243
  const d = {
5244
5244
  single: ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"],
5245
5245
  tens: ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"],
@@ -5248,78 +5248,78 @@ var y;
5248
5248
  single: ["zeroth", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth"],
5249
5249
  tens: ["tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth"],
5250
5250
  decades: ["twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", "seventieth", "eightieth", "ninetieth"]
5251
- }, m = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"], u = ["", "thousand", "million", "billion", "trillion", "quadrillion", "quintillion"], v = u.map((C) => C ? `${C}th` : "");
5252
- if (g = Math.abs(Math.floor(g)), r === "suffix") {
5253
- const C = g % 100;
5254
- if (C >= 11 && C <= 13) return `${g}th`;
5255
- const x = g % 10;
5256
- return `${g}${m[x]}`;
5257
- }
5258
- function w(C, x) {
5259
- if (C < 10) return x === "ordinal" ? f.single[C] : d.single[C];
5260
- if (C < 20) return x === "ordinal" ? f.tens[C - 10] : d.tens[C - 10];
5261
- const D = Math.floor(C / 10), c = C % 10;
5262
- if (c === 0) return x === "ordinal" ? f.decades[D - 2] : d.decades[D - 2];
5263
- const p = d.decades[D - 2], J = x === "ordinal" ? f.single[c] : d.single[c];
5264
- return `${p}-${J}`;
5265
- }
5266
- function k(C, x) {
5267
- if (C === 0) return x === "ordinal" ? f.single[0] : d.single[0];
5268
- const D = Math.floor(C / 100), c = C % 100, p = [];
5269
- return D > 0 && (x === "ordinal" && c === 0 ? p.push(`${d.single[D]} hundredth`) : p.push(`${d.single[D]} hundred`)), c > 0 && p.push(w(c, x)), p.join(" ");
5270
- }
5271
- if (g < 1e3) return k(g, r);
5251
+ }, l = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"], p = ["", "thousand", "million", "billion", "trillion", "quadrillion", "quintillion"], C = p.map((U) => U ? `${U}th` : "");
5252
+ if (g = Math.abs(Math.floor(g)), c === "suffix") {
5253
+ const U = g % 100;
5254
+ if (U >= 11 && U <= 13) return `${g}th`;
5255
+ const S = g % 10;
5256
+ return `${g}${l[S]}`;
5257
+ }
5258
+ function v(U, S) {
5259
+ if (U < 10) return S === "ordinal" ? f.single[U] : d.single[U];
5260
+ if (U < 20) return S === "ordinal" ? f.tens[U - 10] : d.tens[U - 10];
5261
+ const L = Math.floor(U / 10), O = U % 10;
5262
+ if (O === 0) return S === "ordinal" ? f.decades[L - 2] : d.decades[L - 2];
5263
+ const z = d.decades[L - 2], V = S === "ordinal" ? f.single[O] : d.single[O];
5264
+ return `${z}-${V}`;
5265
+ }
5266
+ function k(U, S) {
5267
+ if (U === 0) return S === "ordinal" ? f.single[0] : d.single[0];
5268
+ const L = Math.floor(U / 100), O = U % 100, z = [];
5269
+ return L > 0 && (S === "ordinal" && O === 0 ? z.push(`${d.single[L]} hundredth`) : z.push(`${d.single[L]} hundred`)), O > 0 && z.push(v(O, S)), z.join(" ");
5270
+ }
5271
+ if (g < 1e3) return k(g, c);
5272
5272
  const j = [];
5273
- let S = g;
5274
- for (; S > 0; )
5275
- j.push(S % 1e3), S = Math.floor(S / 1e3);
5276
- let I = -1;
5277
- for (let C = 0; C < j.length; C++) j[C] !== 0 && (I = C);
5278
- const T = [];
5279
- for (let C = j.length - 1; C >= 0; C--) {
5280
- const x = j[C];
5281
- if (x === 0) continue;
5282
- const D = u[C];
5283
- if (r === "cardinal") {
5284
- let c = k(x, "cardinal");
5285
- D && (c += ` ${D}`), T.push(c);
5286
- } else if (C === I)
5287
- if (C > 0) {
5288
- const p = k(x, "cardinal"), J = v[C];
5289
- T.push(p ? `${p} ${J}` : J);
5273
+ let P = g;
5274
+ for (; P > 0; )
5275
+ j.push(P % 1e3), P = Math.floor(P / 1e3);
5276
+ let A = -1;
5277
+ for (let U = 0; U < j.length; U++) j[U] !== 0 && (A = U);
5278
+ const J = [];
5279
+ for (let U = j.length - 1; U >= 0; U--) {
5280
+ const S = j[U];
5281
+ if (S === 0) continue;
5282
+ const L = p[U];
5283
+ if (c === "cardinal") {
5284
+ let O = k(S, "cardinal");
5285
+ L && (O += ` ${L}`), J.push(O);
5286
+ } else if (U === A)
5287
+ if (U > 0) {
5288
+ const z = k(S, "cardinal"), V = C[U];
5289
+ J.push(z ? `${z} ${V}` : V);
5290
5290
  } else {
5291
- const p = k(x, "ordinal");
5292
- T.push(p);
5291
+ const z = k(S, "ordinal");
5292
+ J.push(z);
5293
5293
  }
5294
5294
  else {
5295
- let p = k(x, "cardinal");
5296
- D && (p += ` ${D}`), T.push(p);
5295
+ let z = k(S, "cardinal");
5296
+ L && (z += ` ${L}`), J.push(z);
5297
5297
  }
5298
5298
  }
5299
- return T.join(", ");
5299
+ return J.join(", ");
5300
5300
  }
5301
- n.translate = l;
5302
- function o(g, r = 0, d = 100) {
5303
- return Math.min(Math.max(g, r), d);
5301
+ n.translate = m;
5302
+ function o(g, c = 0, d = 100) {
5303
+ return Math.min(Math.max(g, c), d);
5304
5304
  }
5305
5305
  n.balance = o;
5306
- function b(g, r = 2) {
5307
- const d = Math.pow(10, r);
5306
+ function b(g, c = 2) {
5307
+ const d = Math.pow(10, c);
5308
5308
  return Math.round(g * d) / d;
5309
5309
  }
5310
5310
  n.round = b;
5311
5311
  })(e = h.number || (h.number = {})), ((n) => {
5312
- function l(d, f) {
5312
+ function m(d, f) {
5313
5313
  return new Promise(
5314
- (m) => setTimeout(() => {
5314
+ (l) => setTimeout(() => {
5315
5315
  if (f) {
5316
- const u = f();
5317
- m(u ?? null);
5318
- } else m(null);
5316
+ const p = f();
5317
+ l(p ?? null);
5318
+ } else l(null);
5319
5319
  }, d)
5320
5320
  );
5321
5321
  }
5322
- n.delay = l;
5322
+ n.delay = m;
5323
5323
  function o(d) {
5324
5324
  return Object.entries(d);
5325
5325
  }
@@ -5332,205 +5332,205 @@ var y;
5332
5332
  return Object.keys(d);
5333
5333
  }
5334
5334
  n.typedKeys = g;
5335
- function r(d) {
5336
- const f = Object.values(d).reduce((w, k) => w + k, 0), m = o(d).sort((w, k) => k[1] - w[1]), u = Math.random() * f;
5337
- let v = 0;
5338
- for (const [w, k] of m)
5339
- if (v += k, u < v)
5340
- return w;
5335
+ function c(d) {
5336
+ const f = Object.values(d).reduce((v, k) => v + k, 0), l = o(d).sort((v, k) => k[1] - v[1]), p = Math.random() * f;
5337
+ let C = 0;
5338
+ for (const [v, k] of l)
5339
+ if (C += k, p < C)
5340
+ return v;
5341
5341
  }
5342
- n.probability = r;
5342
+ n.probability = c;
5343
5343
  })(h.utils || (h.utils = {}));
5344
5344
  let t;
5345
5345
  ((n) => {
5346
- function l(d, f, m) {
5347
- const u = f.match(/^<span(?: class="[^"]*")? style="([^"]*)">(.*)<\/span>$/s);
5348
- if (u) {
5349
- const v = u[1], w = u[2], k = u[0].match(/class="([^"]*)"/)?.[1] || "";
5350
- let j = [v, d].filter((S) => S.length).map((S) => S.endsWith(";") ? S.slice(0, -1) : S).join("; ").replace(/\s*;\s*/g, "; ").trim();
5351
- return j.endsWith(";") || (j += ";"), `<span${k ? ` class="${k} ${m ?? ""}"` : ""}${j ? ` style="${j}"` : ""}>${w}</span>`;
5346
+ function m(d, f, l) {
5347
+ const p = f.match(/^<span(?: class="[^"]*")? style="([^"]*)">(.*)<\/span>$/s);
5348
+ if (p) {
5349
+ const C = p[1], v = p[2], k = p[0].match(/class="([^"]*)"/)?.[1] || "";
5350
+ let j = [C, d].filter((P) => P.length).map((P) => P.endsWith(";") ? P.slice(0, -1) : P).join("; ").replace(/\s*;\s*/g, "; ").trim();
5351
+ return j.endsWith(";") || (j += ";"), `<span${k ? ` class="${k} ${l ?? ""}"` : ""}${j ? ` style="${j}"` : ""}>${v}</span>`;
5352
5352
  } else
5353
- return d && d.length && !d.endsWith(";") && (d += ";"), `<span${m ? ` class="${m}"` : ""}${d ? ` style="${d}"` : ""}>${f}</span>`;
5353
+ return d && d.length && !d.endsWith(";") && (d += ";"), `<span${l ? ` class="${l}"` : ""}${d ? ` style="${d}"` : ""}>${f}</span>`;
5354
5354
  }
5355
- n.mergeSpanStyles = l;
5356
- function o(d, f = 0, m = 1, u) {
5357
- const { return: v = !1, parent: w, base: k } = u || {}, j = w || d.parentElement || document.body;
5355
+ n.mergeSpanStyles = m;
5356
+ function o(d, f = 0, l = 1, p) {
5357
+ const { return: C = !1, parent: v, base: k } = p || {}, j = v || d.parentElement || document.body;
5358
5358
  if (!j)
5359
5359
  throw new Error("No parent element found for scaling");
5360
- const S = j.getBoundingClientRect(), I = d.offsetWidth, T = d.offsetHeight;
5361
- if (I === 0 || T === 0)
5360
+ const P = j.getBoundingClientRect(), A = d.offsetWidth, J = d.offsetHeight;
5361
+ if (A === 0 || J === 0)
5362
5362
  throw new Error("Element has zero width or height, cannot scale");
5363
- const C = S.width * m / I, x = S.height * m / T;
5364
- let D = k === "width" ? C : k === "height" ? x : Math.min(C, x);
5363
+ const U = P.width * l / A, S = P.height * l / J;
5364
+ let L = k === "width" ? U : k === "height" ? S : Math.min(U, S);
5365
5365
  if (f > 0) {
5366
- const p = S.width * f / I, J = S.height * f / T, U = Math.max(p, J);
5367
- D = Math.max(U, D);
5366
+ const z = P.width * f / A, V = P.height * f / J, W = Math.max(z, V);
5367
+ L = Math.max(W, L);
5368
5368
  }
5369
- const c = {
5370
- width: I * D,
5371
- height: T * D,
5372
- scale: D
5369
+ const O = {
5370
+ width: A * L,
5371
+ height: J * L,
5372
+ scale: L
5373
5373
  };
5374
- return v || (d.style.transform = `scale(${D})`, d.style.transformOrigin = "center center"), c;
5374
+ return C || (d.style.transform = `scale(${L})`, d.style.transformOrigin = "center center"), O;
5375
5375
  }
5376
5376
  n.scale = o;
5377
5377
  function b(d, f = {}) {
5378
- const { parent: m = d.parentElement, prefer: u = "auto", min: v = 0, max: w = 1, apply: k = () => {
5378
+ const { parent: l = d.parentElement, prefer: p = "auto", min: C = 0, max: v = 1, apply: k = () => {
5379
5379
  } } = f;
5380
- if (!m)
5380
+ if (!l)
5381
5381
  throw new Error("No parent element found for scaling");
5382
- const j = m.getBoundingClientRect(), S = d.getBoundingClientRect(), I = j.width, T = j.height, C = S.width, x = S.height;
5383
- let D = I * v / C, c = T * v / x, p = I * w / C, J = T * w / x, U = Math.min(p, J);
5384
- const P = Math.max(D, c);
5385
- U = Math.max(U, P);
5386
- const z = C * U, N = x * U;
5387
- return u === "width" ? U = Math.max(D, Math.min(p, I / C)) : u === "height" ? U = Math.max(c, Math.min(J, T / x)) : z > I ? U = Math.max(D, Math.min(p, I / C)) : N > T && (U = Math.max(c, Math.min(J, T / x))), k.apply(d, [U, d]), U;
5382
+ const j = l.getBoundingClientRect(), P = d.getBoundingClientRect(), A = j.width, J = j.height, U = P.width, S = P.height;
5383
+ let L = A * C / U, O = J * C / S, z = A * v / U, V = J * v / S, W = Math.min(z, V);
5384
+ const F = Math.max(L, O);
5385
+ W = Math.max(W, F);
5386
+ const B = U * W, at = S * W;
5387
+ return p === "width" ? W = Math.max(L, Math.min(z, A / U)) : p === "height" ? W = Math.max(O, Math.min(V, J / S)) : B > A ? W = Math.max(L, Math.min(z, A / U)) : at > J && (W = Math.max(O, Math.min(V, J / S))), k.apply(d, [W, d]), W;
5388
5388
  }
5389
5389
  n.scalev2 = b;
5390
- function g(d, f = 1, m = {}) {
5391
- const u = parseFloat(getComputedStyle(d).getPropertyValue("font-size")), v = {
5392
- minFontSize: m?.minFontSize ?? 0,
5393
- maxFontSize: m?.maxFontSize ?? u
5394
- }, w = m?.parent || d.parentElement;
5395
- if (!w)
5390
+ function g(d, f = 1, l = {}) {
5391
+ const p = parseFloat(getComputedStyle(d).getPropertyValue("font-size")), C = {
5392
+ minFontSize: l?.minFontSize ?? 0,
5393
+ maxFontSize: l?.maxFontSize ?? p
5394
+ }, v = l?.parent || d.parentElement;
5395
+ if (!v)
5396
5396
  throw new Error("No parent element found for fitting text");
5397
- const k = w.clientWidth * f, j = d.offsetWidth, S = k / j, I = u * S, T = e.balance(I, v.minFontSize, v.maxFontSize);
5398
- return d.style.fontSize = T + "px", d;
5397
+ const k = v.clientWidth * f, j = d.offsetWidth, P = k / j, A = p * P, J = e.balance(A, C.minFontSize, C.maxFontSize);
5398
+ return d.style.fontSize = J + "px", d;
5399
5399
  }
5400
5400
  n.fitText = g;
5401
- function r(d, f = 0) {
5402
- const u = new DOMParser().parseFromString(d, "text/html");
5403
- let v = f;
5404
- function w(I) {
5405
- if (I.nodeType === Node.TEXT_NODE) {
5406
- const C = (I.textContent || "").split("").map((D, c) => {
5407
- const p = document.createElement("span");
5408
- return p.classList.add("char"), p.dataset.index = String(v), p.dataset.exclusivityIndex = String(v), p.style.setProperty("--char-index", String(v)), p.style.setProperty("--exclusivity-index", String(v)), (D === " " || D === `
5409
- ` || D === " ") && (p.style.whiteSpace = "pre-wrap"), p.textContent = D, v++, p;
5410
- }), x = document.createDocumentFragment();
5411
- return C.forEach((D) => x.appendChild(D)), x;
5412
- } else if (I.nodeType === Node.ELEMENT_NODE) {
5413
- const T = I.cloneNode(!1);
5414
- return T.classList.add("container"), T.dataset.index = String(v), T.style.setProperty("--char-index", String(v)), I.childNodes.forEach((C) => {
5415
- const x = w(C);
5416
- (x instanceof DocumentFragment || x instanceof Node) && T.appendChild(x);
5417
- }), T;
5418
- }
5419
- return I.cloneNode(!0);
5420
- }
5421
- const k = u.body, j = document.createElement("div");
5422
- k.childNodes.forEach((I) => {
5423
- if (I.nodeType === Node.TEXT_NODE && !I.textContent?.trim())
5401
+ function c(d, f = 0) {
5402
+ const p = new DOMParser().parseFromString(d, "text/html");
5403
+ let C = f;
5404
+ function v(A) {
5405
+ if (A.nodeType === Node.TEXT_NODE) {
5406
+ const U = (A.textContent || "").split("").map((L, O) => {
5407
+ const z = document.createElement("span");
5408
+ return z.classList.add("char"), z.dataset.index = String(C), z.dataset.exclusivityIndex = String(C), z.style.setProperty("--char-index", String(C)), z.style.setProperty("--exclusivity-index", String(C)), (L === " " || L === `
5409
+ ` || L === " ") && (z.style.whiteSpace = "pre-wrap"), z.textContent = L, C++, z;
5410
+ }), S = document.createDocumentFragment();
5411
+ return U.forEach((L) => S.appendChild(L)), S;
5412
+ } else if (A.nodeType === Node.ELEMENT_NODE) {
5413
+ const J = A.cloneNode(!1);
5414
+ return J.classList.add("container"), J.dataset.index = String(C), J.style.setProperty("--char-index", String(C)), A.childNodes.forEach((U) => {
5415
+ const S = v(U);
5416
+ (S instanceof DocumentFragment || S instanceof Node) && J.appendChild(S);
5417
+ }), J;
5418
+ }
5419
+ return A.cloneNode(!0);
5420
+ }
5421
+ const k = p.body, j = document.createElement("div");
5422
+ k.childNodes.forEach((A) => {
5423
+ if (A.nodeType === Node.TEXT_NODE && !A.textContent?.trim())
5424
5424
  return;
5425
- const T = w(I);
5426
- (T instanceof DocumentFragment || T instanceof Node) && j.appendChild(T);
5425
+ const J = v(A);
5426
+ (J instanceof DocumentFragment || J instanceof Node) && j.appendChild(J);
5427
5427
  });
5428
- let S = "";
5429
- return Array.from(j.childNodes).forEach((I) => {
5430
- I.nodeType === Node.TEXT_NODE ? S += I.textContent : S += I.outerHTML;
5431
- }), S;
5428
+ let P = "";
5429
+ return Array.from(j.childNodes).forEach((A) => {
5430
+ A.nodeType === Node.TEXT_NODE ? P += A.textContent : P += A.outerHTML;
5431
+ }), P;
5432
5432
  }
5433
- n.splitTextToChars = r;
5433
+ n.splitTextToChars = c;
5434
5434
  })(t = h.element || (h.element = {}));
5435
5435
  let a;
5436
5436
  ((n) => {
5437
- function l(o, b = !0, g = "") {
5438
- const r = {};
5437
+ function m(o, b = !0, g = "") {
5438
+ const c = {};
5439
5439
  for (const d in o) {
5440
5440
  if (!Object.prototype.hasOwnProperty.call(o, d)) continue;
5441
- const f = o[d], m = g ? `${g}.${d}` : d;
5441
+ const f = o[d], l = g ? `${g}.${d}` : d;
5442
5442
  if (f == null) {
5443
- r[m] = String(f);
5443
+ c[l] = String(f);
5444
5444
  continue;
5445
5445
  }
5446
5446
  if (typeof f == "number" && isNaN(f)) {
5447
- r[m] = "NaN";
5447
+ c[l] = "NaN";
5448
5448
  continue;
5449
5449
  }
5450
5450
  if (typeof f == "number" && !isNaN(f)) {
5451
- r[m] = b ? String(f) : f;
5451
+ c[l] = b ? String(f) : f;
5452
5452
  continue;
5453
5453
  }
5454
5454
  if (f instanceof Date) {
5455
- r[m] = f.toISOString();
5455
+ c[l] = f.toISOString();
5456
5456
  continue;
5457
5457
  }
5458
5458
  if (f instanceof Map) {
5459
- f.forEach((u, v) => {
5460
- r[`${m}.${v}`] = JSON.stringify(u);
5459
+ f.forEach((p, C) => {
5460
+ c[`${l}.${C}`] = JSON.stringify(p);
5461
5461
  });
5462
5462
  continue;
5463
5463
  }
5464
5464
  if (Array.isArray(f)) {
5465
- f.forEach((u, v) => {
5466
- const w = `${m}:${v}`;
5467
- typeof u == "object" ? Object.assign(r, l(u, b, w)) : r[w] = b ? String(u) : u;
5465
+ f.forEach((p, C) => {
5466
+ const v = `${l}:${C}`;
5467
+ typeof p == "object" ? Object.assign(c, m(p, b, v)) : c[v] = b ? String(p) : p;
5468
5468
  });
5469
5469
  continue;
5470
5470
  }
5471
5471
  if (typeof f == "object") {
5472
- Object.assign(r, l(f, b, m));
5472
+ Object.assign(c, m(f, b, l));
5473
5473
  continue;
5474
5474
  }
5475
- r[m] = String(f);
5475
+ c[l] = String(f);
5476
5476
  }
5477
- return r;
5477
+ return c;
5478
5478
  }
5479
- n.flatten = l;
5479
+ n.flatten = m;
5480
5480
  })(a = h.object || (h.object = {})), ((n) => {
5481
- function l(r, d = E.emotes) {
5481
+ function m(c, d = D.emotes) {
5482
5482
  const f = [];
5483
- return d.forEach((m) => {
5484
- const u = m.name;
5485
- let v = 0, w = 0;
5486
- for (; v < r.length; ) {
5487
- const k = r.indexOf(u, w);
5483
+ return d.forEach((l) => {
5484
+ const p = l.name;
5485
+ let C = 0, v = 0;
5486
+ for (; C < c.length; ) {
5487
+ const k = c.indexOf(p, v);
5488
5488
  if (k === -1) break;
5489
- const j = k > 0 ? r[k - 1] : " ", S = k + u.length < r.length ? r[k + u.length] : " ";
5490
- /\s/.test(j) && /\s/.test(S) && f.push({ ...m, start: k, end: k + u.length }), w = k + 1;
5489
+ const j = k > 0 ? c[k - 1] : " ", P = k + p.length < c.length ? c[k + p.length] : " ";
5490
+ /\s/.test(j) && /\s/.test(P) && f.push({ ...l, start: k, end: k + p.length }), v = k + 1;
5491
5491
  }
5492
- }), f.sort((m, u) => m.start - u.start);
5492
+ }), f.sort((l, p) => l.start - p.start);
5493
5493
  }
5494
- n.findEmotesInText = l;
5495
- function o(r, d) {
5496
- if (!d.length) return r;
5497
- let f = "", m = 0;
5498
- return d.forEach((u) => {
5499
- f += r.substring(m, u.start);
5500
- const w = Array.from({ ...u.urls, length: 5 }).slice(1).reverse().filter(Boolean)[0] || u.urls[1];
5501
- f += `<img src="${w}" alt="${u.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`, m = u.end;
5502
- }), f += r.substring(m), f;
5494
+ n.findEmotesInText = m;
5495
+ function o(c, d) {
5496
+ if (!d.length) return c;
5497
+ let f = "", l = 0;
5498
+ return d.forEach((p) => {
5499
+ f += c.substring(l, p.start);
5500
+ const v = Array.from({ ...p.urls, length: 5 }).slice(1).reverse().filter(Boolean)[0] || p.urls[1];
5501
+ f += `<img src="${v}" alt="${p.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`, l = p.end;
5502
+ }), f += c.substring(l), f;
5503
5503
  }
5504
5504
  n.replaceEmotesWithHTML = o;
5505
- function b(r, d = E.youtube_emotes) {
5506
- return Array.from(r.matchAll(/:(.*?):/gim), (m) => m[0]).forEach((m) => {
5507
- const u = d.find((v) => v.shortcuts.includes(m) || v.searchTerms.includes(m.slice(1, -1)));
5508
- if (u) {
5509
- const v = u.image.thumbnails.at(-1)?.url, w = u.image.accessibility.accessibilityData.label;
5510
- v && (r = r.replace(m, `<img src="${v}" alt="${w}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`));
5511
- }
5512
- }), r;
5505
+ function b(c, d = D.youtube_emotes) {
5506
+ return Array.from(c.matchAll(/:(.*?):/gim), (l) => l[0]).forEach((l) => {
5507
+ const p = d.find((C) => C.shortcuts.includes(l) || C.searchTerms.includes(l.slice(1, -1)));
5508
+ if (p) {
5509
+ const C = p.image.thumbnails.at(-1)?.url, v = p.image.accessibility.accessibilityData.label;
5510
+ C && (c = c.replace(l, `<img src="${C}" alt="${v}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`));
5511
+ }
5512
+ }), c;
5513
5513
  }
5514
5514
  n.replaceYoutubeEmotesWithHTML = b;
5515
- async function g(r = [], d) {
5516
- if (!Array.isArray(r) && typeof r == "string" && (r = r.split(",").map((w) => w.trim())), !r || !r.length) {
5515
+ async function g(c = [], d) {
5516
+ if (!Array.isArray(c) && typeof c == "string" && (c = c.split(",").map((v) => v.trim())), !c || !c.length) {
5517
5517
  var f = s.number(1, 3);
5518
- for await (const w of Array.from({ length: f }, () => "")) {
5519
- var m = s.array(Object.keys(E.badges))[0];
5520
- !r.includes(m) && Array.isArray(r) ? r.push(m) : r = [m];
5518
+ for await (const v of Array.from({ length: f }, () => "")) {
5519
+ var l = s.array(Object.keys(D.badges))[0];
5520
+ !c.includes(l) && Array.isArray(c) ? c.push(l) : c = [l];
5521
5521
  }
5522
5522
  }
5523
- var u;
5523
+ var p;
5524
5524
  switch (d) {
5525
5525
  case "twitch": {
5526
- u = {
5527
- keys: Array.from(r).filter((w) => w in E.badges),
5528
- badges: Array.from(r).slice(0, 3).map((w) => E.badges[w]).filter(Boolean)
5526
+ p = {
5527
+ keys: Array.from(c).filter((v) => v in D.badges),
5528
+ badges: Array.from(c).slice(0, 3).map((v) => D.badges[v]).filter(Boolean)
5529
5529
  };
5530
5530
  break;
5531
5531
  }
5532
5532
  case "youtube": {
5533
- var v = {
5533
+ var C = {
5534
5534
  verified: { isVerified: !0 },
5535
5535
  broadcaster: { isChatOwner: !0 },
5536
5536
  host: { isChatOwner: !0 },
@@ -5538,8 +5538,8 @@ var y;
5538
5538
  subscriber: { isChatSponsor: !0 },
5539
5539
  moderator: { isChatModerator: !0 }
5540
5540
  };
5541
- u = Object.entries(r).reduce(
5542
- (w, [k]) => (k in v && Object.assign(w, v[k]), w),
5541
+ p = Object.entries(c).reduce(
5542
+ (v, [k]) => (k in C && Object.assign(v, C[k]), v),
5543
5543
  {
5544
5544
  isVerified: !1,
5545
5545
  isChatOwner: !1,
@@ -5550,11 +5550,11 @@ var y;
5550
5550
  break;
5551
5551
  }
5552
5552
  }
5553
- return u;
5553
+ return p;
5554
5554
  }
5555
5555
  n.generateBadges = g;
5556
5556
  })(h.message || (h.message = {})), ((n) => {
5557
- function l(o) {
5557
+ function m(o) {
5558
5558
  var b = o.event?.provider || o.event?.service || o.event?.data?.provider || window.client.details.provider;
5559
5559
  return [
5560
5560
  "kvstore:update",
@@ -5565,78 +5565,292 @@ var y;
5565
5565
  "event:skip"
5566
5566
  ].some((d) => d === o.listener) && (b = "streamelements"), { provider: b, data: o };
5567
5567
  }
5568
- n.parseProvider = l;
5568
+ n.parseProvider = m;
5569
5569
  })(h.event || (h.event = {})), ((n) => {
5570
- async function l(g, r, d) {
5570
+ n.PRESETS = {};
5571
+ async function m(g, c, d) {
5571
5572
  const f = [];
5572
- g.replace(r, (u, ...v) => {
5573
- const w = typeof d == "function" ? d(u, ...v) : u;
5574
- return f.push(Promise.resolve(w)), u;
5573
+ g.replace(c, (p, ...C) => {
5574
+ const v = typeof d == "function" ? d(p, ...C) : p;
5575
+ return f.push(Promise.resolve(v)), p;
5575
5576
  });
5576
- const m = await Promise.all(f);
5577
- return g.replace(r, () => m.shift() ?? "");
5577
+ const l = await Promise.all(f);
5578
+ return g.replace(c, () => l.shift() ?? "");
5578
5579
  }
5579
- n.replace = l;
5580
+ n.replace = m;
5580
5581
  function o(g) {
5581
5582
  return g.charAt(0).toUpperCase() + g.slice(1);
5582
5583
  }
5583
5584
  n.capitalize = o;
5584
- function b(g, r = {}, d = {
5585
+ function b(g, c = {}, d = {
5585
5586
  method: "index",
5586
5587
  html: !1,
5588
+ debug: !1,
5587
5589
  modifiers: {},
5588
5590
  aliases: {}
5589
5591
  }) {
5590
- const { mergeSpanStyles: f } = t, m = (c, p, J) => d.html ? f(c, p, J) : p;
5591
- r.skip = "<br/>", r.newline = "<br/>";
5592
- const u = Object.entries(a.flatten(r)).reduce(
5593
- (c, [p, J]) => {
5594
- if (c[p] = String(J), ["username", "name", "nick", "nickname", "sender"].some((U) => p === U)) {
5595
- const U = c?.username || c?.name || c?.nick || c?.nickname || c?.sender;
5596
- c.username = c.username || U, c.usernameAt = `@${c.username}`, c.name = c.name || U, c.nick = c.nick || U, c.nickname = c.nickname || U, c.sender = c.sender || U, c.senderAt = `@${c.sender}`;
5592
+ const { mergeSpanStyles: f } = t, l = (r, u, w) => d.html ? f(r, u, w) : u, p = {
5593
+ skip: "<br/>",
5594
+ newline: "<br/>",
5595
+ ...c
5596
+ };
5597
+ let C = "$", v = "USD";
5598
+ if (typeof window < "u")
5599
+ try {
5600
+ const u = window.client?.details?.currency;
5601
+ u?.symbol && (C = String(u.symbol)), u?.code && (v = String(u.code));
5602
+ } catch {
5603
+ }
5604
+ const k = Object.entries(a.flatten(p)).reduce(
5605
+ (r, [u, w]) => {
5606
+ if (r[u] = String(w), ["username", "name", "nick", "nickname", "sender"].some((x) => u === x)) {
5607
+ const x = r?.username || r?.name || r?.nick || r?.nickname || r?.sender;
5608
+ r.username = r.username || x, r.usernameAt = `@${r.username}`, r.name = r.name || x, r.nick = r.nick || x, r.nickname = r.nickname || x, r.sender = r.sender || x, r.senderAt = `@${r.sender}`;
5597
5609
  }
5598
- return ["amount", "count"].some((U) => p === U) && (c.amount = String(c?.amount || c.count || J), c.count = String(c?.count || c?.amount || J)), c.currency = c.currency || window?.client?.details.currency.symbol || "$", c.currencyCode = c.currencyCode || window?.client?.details.currency.code || "USD", c;
5610
+ return ["amount", "count"].some((x) => u === x) && (r.amount = String(r?.amount || r.count || w), r.count = String(r?.count || r?.amount || w)), r.currency = r.currency || C, r.currencyCode = r.currencyCode || v, r;
5599
5611
  },
5600
5612
  {}
5601
- ), v = {
5613
+ ), j = {
5602
5614
  PLACEHOLDERS: /{([^}]+)}/g,
5603
5615
  MODIFIERS: /\[([^\]=]+)=([^\]]+)\]/g
5604
5616
  };
5605
- var w = parseFloat(u?.amount ?? u?.count ?? 0);
5606
- const k = {
5607
- COLOR: (c, p) => m(p && i.validate(p) ? `color: ${p}` : "", c, "color"),
5608
- WEIGHT: (c, p) => m(p && !isNaN(parseInt(p)) ? `font-weight: ${p}` : "", c, "weight"),
5609
- BOLD: (c) => m("font-weight: bold", c, "bold"),
5610
- LIGHT: (c) => m("font-weight: lighter", c, "light"),
5611
- STRONG: (c) => m("font-weight: bolder", c, "strong"),
5612
- ITALIC: (c) => m("font-style: italic", c, "italic"),
5613
- UNDERLINE: (c) => m("text-decoration: underline", c, "underline"),
5614
- STRIKETHROUGH: (c) => m("text-decoration: line-through", c, "strikethrough"),
5615
- SUB: (c) => m("vertical-align: sub", c, "sub"),
5616
- SUP: (c) => m("vertical-align: super", c, "sup"),
5617
- LARGER: (c) => m("font-size: larger", c, "larger"),
5618
- SMALL: (c) => m("font-size: smaller", c, "small"),
5619
- SHADOW: (c, p) => m(`text-shadow: ${p}`, c, "shadow"),
5620
- SIZE: (c, p) => m(p ? `font-size: ${p}` : "", c, "size")
5621
- }, S = {
5617
+ var P = parseFloat(k?.amount ?? k?.count ?? 0);
5618
+ function A(r, u) {
5619
+ const w = r?.trim?.() ?? "";
5620
+ if (!w.length) return null;
5621
+ const x = u[w], I = parseFloat(String(x !== void 0 ? x : w).replace(/\s/g, ""));
5622
+ return isNaN(I) ? null : I;
5623
+ }
5624
+ function J(r, u, w) {
5625
+ const x = isNaN(Number(u)) ? 0 : Math.max(0, parseInt(String(u))), N = A(r, w);
5626
+ if (N === null) return r;
5627
+ try {
5628
+ return N.toLocaleString(void 0, {
5629
+ minimumFractionDigits: x,
5630
+ maximumFractionDigits: x
5631
+ });
5632
+ } catch {
5633
+ return N.toFixed(x);
5634
+ }
5635
+ }
5636
+ function U(r, u = /* @__PURE__ */ new Date()) {
5637
+ const w = u.getTime() - r.getTime(), x = w >= 0, N = Math.abs(w), I = Math.floor(N / 1e3), T = Math.floor(I / 60), M = Math.floor(T / 60), E = Math.floor(M / 24), H = Math.floor(E / 30), _ = Math.floor(E / 365), Y = x ? "ago" : "from now";
5638
+ return _ > 0 ? `${_}y ${Y}` : H > 0 ? `${H}mo ${Y}` : E > 0 ? `${E}d ${Y}` : M > 0 ? `${M}h ${Y}` : T > 0 ? `${T}m ${Y}` : `${Math.max(I, 0)}s ${Y}`;
5639
+ }
5640
+ function S(r, u, w) {
5641
+ const x = r?.trim?.() ?? "";
5642
+ if (!x.length) return r;
5643
+ const N = w[x] ?? x, I = new Date(N);
5644
+ if (isNaN(I.getTime())) return r;
5645
+ const T = (u ?? "date").toString().toLowerCase();
5646
+ try {
5647
+ switch (T) {
5648
+ case "time":
5649
+ return I.toLocaleTimeString();
5650
+ case "datetime":
5651
+ case "full":
5652
+ return I.toLocaleString();
5653
+ case "relative":
5654
+ case "ago":
5655
+ return U(I);
5656
+ case "iso":
5657
+ return I.toISOString();
5658
+ default:
5659
+ return I.toLocaleDateString();
5660
+ }
5661
+ } catch {
5662
+ return r;
5663
+ }
5664
+ }
5665
+ function L(r, u, w) {
5666
+ const x = r ?? "", [N, I = N] = x.split("|", 2), T = u?.trim();
5667
+ let M;
5668
+ T && w[T] !== void 0 ? M = w[T] : M = w.amount ?? w.count;
5669
+ const E = parseFloat(String(M));
5670
+ return isNaN(E) ? N : Math.abs(E) !== 1 ? I : N;
5671
+ }
5672
+ function O(r, u, w) {
5673
+ const x = u?.trim() ?? "", N = x && w[x] !== void 0 ? w[x] : "", I = String(N), T = (r ?? "").split("|").map((E) => E.trim()).filter((E) => E.length);
5674
+ let M;
5675
+ for (const E of T) {
5676
+ const H = E.indexOf(":");
5677
+ if (H === -1) continue;
5678
+ const _ = E.slice(0, H).trim(), Y = E.slice(H + 1);
5679
+ if (_.length) {
5680
+ if (_.toLowerCase() === "default") {
5681
+ M = Y;
5682
+ continue;
5683
+ }
5684
+ if (I === _) return Y;
5685
+ }
5686
+ }
5687
+ return M ?? "";
5688
+ }
5689
+ function z(r) {
5690
+ return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
5691
+ }
5692
+ function V(r, u) {
5693
+ let w = r.trim();
5694
+ if (!w.length) return;
5695
+ const x = w[0], N = w[w.length - 1];
5696
+ if (x === '"' && N === '"' || x === "'" && N === "'")
5697
+ return w.slice(1, -1);
5698
+ const I = w.toLowerCase();
5699
+ if (I === "true") return !0;
5700
+ if (I === "false") return !1;
5701
+ if (/^-?\d+(\.\d+)?$/.test(w)) return parseFloat(w);
5702
+ const T = u?.[w];
5703
+ if (T === void 0) return w;
5704
+ const M = String(T).trim(), E = M.toLowerCase();
5705
+ return E === "true" ? !0 : E === "false" ? !1 : /^-?\d+(\.\d+)?$/.test(M) ? parseFloat(M) : T;
5706
+ }
5707
+ function W(r) {
5708
+ if (typeof r == "boolean") return r;
5709
+ if (r == null) return !1;
5710
+ const u = String(r).trim().toLowerCase();
5711
+ return !(!u.length || ["false", "0", "no", "off", "null", "undefined", "nan"].includes(u));
5712
+ }
5713
+ function F(r, u) {
5714
+ let w = r.trim();
5715
+ if (!w.length) return !1;
5716
+ let x = !1;
5717
+ for (; w.startsWith("!"); )
5718
+ x = !x, w = w.slice(1).trim();
5719
+ const N = ["===", "!==", "==", "!=", ">=", "<=", ">", "<"];
5720
+ let I = null, T = w, M = "";
5721
+ for (const H of N) {
5722
+ const _ = w.indexOf(H);
5723
+ if (_ !== -1) {
5724
+ I = H, T = w.slice(0, _), M = w.slice(_ + H.length);
5725
+ break;
5726
+ }
5727
+ }
5728
+ let E;
5729
+ if (I) {
5730
+ const H = V(T, u), _ = V(M, u);
5731
+ switch (I) {
5732
+ case "===":
5733
+ E = H === _;
5734
+ break;
5735
+ case "!==":
5736
+ E = H !== _;
5737
+ break;
5738
+ case "==":
5739
+ E = H == _;
5740
+ break;
5741
+ case "!=":
5742
+ E = H != _;
5743
+ break;
5744
+ case ">=":
5745
+ E = H >= _;
5746
+ break;
5747
+ case "<=":
5748
+ E = H <= _;
5749
+ break;
5750
+ case ">":
5751
+ E = H > _;
5752
+ break;
5753
+ case "<":
5754
+ E = H < _;
5755
+ break;
5756
+ default:
5757
+ E = !1;
5758
+ break;
5759
+ }
5760
+ } else {
5761
+ const H = V(T, u);
5762
+ E = W(H);
5763
+ }
5764
+ return x ? !E : E;
5765
+ }
5766
+ function B(r, u) {
5767
+ let w = r.trim();
5768
+ if (!w.length) return !1;
5769
+ let x = !1;
5770
+ for (; w.startsWith("!"); )
5771
+ x = !x, w = w.slice(1).trim();
5772
+ const N = w.split("||").map((T) => T.trim()).filter((T) => T.length);
5773
+ if (!N.length) return !!x;
5774
+ let I = !1;
5775
+ for (const T of N) {
5776
+ const M = T.split("&&").map((H) => H.trim()).filter((H) => H.length);
5777
+ if (!M.length) continue;
5778
+ let E = !0;
5779
+ for (const H of M) {
5780
+ const _ = F(H, u);
5781
+ if (E = E && _, !E) break;
5782
+ }
5783
+ if (I = I || E, I) break;
5784
+ }
5785
+ return x ? !I : I;
5786
+ }
5787
+ const at = {
5788
+ COLOR: (r, u) => l(u && i.validate(u) ? `color: ${u}` : "", r, "color"),
5789
+ WEIGHT: (r, u) => l(u && !isNaN(parseInt(u)) ? `font-weight: ${u}` : "", r, "weight"),
5790
+ SEMIBOLD: (r) => l("font-weight: 600", r, "semibold"),
5791
+ BOLD: (r) => l("font-weight: bold", r, "bold"),
5792
+ BLACK: (r) => l("font-weight: 900", r, "black"),
5793
+ LIGHT: (r) => l("font-weight: lighter", r, "light"),
5794
+ STRONG: (r) => l("font-weight: bolder", r, "strong"),
5795
+ ITALIC: (r) => l("font-style: italic", r, "italic"),
5796
+ UNDERLINE: (r) => l("text-decoration: underline", r, "underline"),
5797
+ STRIKETHROUGH: (r) => l("text-decoration: line-through", r, "strikethrough"),
5798
+ SUB: (r) => l("vertical-align: sub", r, "sub"),
5799
+ SUP: (r) => l("vertical-align: super", r, "sup"),
5800
+ LARGER: (r) => l("font-size: larger", r, "larger"),
5801
+ SMALL: (r) => l("font-size: smaller", r, "small"),
5802
+ SHADOW: (r, u) => l(`text-shadow: ${u}`, r, "shadow"),
5803
+ SIZE: (r, u) => l(u ? `font-size: ${u}` : "", r, "size")
5804
+ }, ot = {
5622
5805
  ...{
5623
- BT1: (c) => w > 1 ? c : "",
5624
- BT0: (c) => w > 0 ? c : "",
5625
- ST1: (c) => w < 1 ? c : "",
5626
- ST0: (c) => w < 0 ? c : "",
5627
- UPC: (c) => c.toUpperCase(),
5628
- LOW: (c) => c.toLowerCase(),
5629
- REV: (c) => c.split("").reverse().join(""),
5630
- CAP: (c) => c.charAt(0).toUpperCase() + c.slice(1).toLowerCase(),
5631
- FALLBACK: (c, p) => c.length ? c : p ?? c
5806
+ BT1: (r) => P > 1 ? r : "",
5807
+ BT0: (r) => P > 0 ? r : "",
5808
+ ST1: (r) => P < 1 ? r : "",
5809
+ ST0: (r) => P < 0 ? r : "",
5810
+ UPC: (r) => r.toUpperCase(),
5811
+ LOW: (r) => r.toLowerCase(),
5812
+ REV: (r) => r.split("").reverse().join(""),
5813
+ CAP: (r) => r.charAt(0).toUpperCase() + r.slice(1).toLowerCase(),
5814
+ NUMBER: (r, u, w) => J(r, u, w),
5815
+ PLURAL: (r, u, w) => L(r, u, w),
5816
+ DATE: (r, u, w) => S(r, u, w),
5817
+ MAP: (r, u, w) => O(r, u, w),
5818
+ ESCAPE: (r) => z(r),
5819
+ IF: (r, u, w) => {
5820
+ const x = r ?? "", [N, I] = x.split("?", 2);
5821
+ if (!I) return x;
5822
+ const [T, M = ""] = I.split("|", 2);
5823
+ return B(N, w) ? T : M;
5824
+ },
5825
+ PRESET: (r, u) => {
5826
+ const w = u?.trim() ?? "";
5827
+ if (!w.length) return r;
5828
+ const x = n.PRESETS[w];
5829
+ if (!x || !x.length) return r;
5830
+ const N = x.split(",").map((T) => T.trim()).filter((T) => T.length).map((T) => {
5831
+ const [M, E] = T.split(":");
5832
+ return { name: M.trim(), param: E?.trim() ?? null };
5833
+ });
5834
+ let I = r;
5835
+ for (const { name: T, param: M } of N)
5836
+ I = K(I, T, M);
5837
+ return I;
5838
+ },
5839
+ FALLBACK: (r, u) => r.length ? r : u ?? r
5632
5840
  },
5633
- ...d?.html ? k : {},
5841
+ ...d?.html ? at : {},
5634
5842
  ...d.modifiers ?? {}
5635
- }, I = {
5843
+ }, ct = {
5636
5844
  UPC: ["UPPERCASE", "UPPER", "UPP"],
5637
5845
  LOW: ["LOWERCASE", "LOWER", "LWC"],
5638
5846
  REV: ["REVERSE", "RVS"],
5639
5847
  CAP: ["CAPITALIZE", "CAPITAL"],
5848
+ NUMBER: ["NUMBER", "NUM", "FORMAT_NUMBER", "FMT_NUM"],
5849
+ PLURAL: ["PLURAL", "PL", "PLR"],
5850
+ DATE: ["DATE", "DATETIME", "TIME", "DT"],
5851
+ MAP: ["MAP", "SWITCH"],
5852
+ ESCAPE: ["ESCAPE", "ESC", "ESC_HTML", "ESCAPE_HTML"],
5853
+ PRESET: ["PRESET", "STYLE", "THEME"],
5640
5854
  BT1: ["BIGGER_THAN_1", "GREATER_THAN_1", "GT1"],
5641
5855
  BT0: ["BIGGER_THAN_0", "GREATER_THAN_0", "GT0"],
5642
5856
  ST1: ["SMALLER_THAN_1", "LESS_THAN_1", "LT1"],
@@ -5653,149 +5867,150 @@ var y;
5653
5867
  SMALL: ["SMALLER", "SM"],
5654
5868
  SHADOW: ["SHADOW", "SHD"],
5655
5869
  FALLBACK: ["FALLBACK", "FB"],
5870
+ IF: ["IF", "COND", "CONDITION"],
5656
5871
  ...d.aliases ?? {}
5657
5872
  };
5658
- function T(c, p, J) {
5659
- const U = Object.entries(I).find(([z, N]) => N.some((R) => R.toUpperCase() === p.toUpperCase()) ? !0 : z.toUpperCase() === p.toUpperCase()), P = U ? U[0] : p.toUpperCase();
5873
+ function K(r, u, w) {
5874
+ const x = Object.entries(ct).find(([I, T]) => T.some((M) => M.toUpperCase() === u.toUpperCase()) ? !0 : I.toUpperCase() === u.toUpperCase()), N = x ? x[0] : u.toUpperCase();
5660
5875
  try {
5661
- return S[P] ? S[P](c, typeof J == "string" ? J.trim() : null, u) : d?.html ? m("", c, P.toLowerCase()) : c;
5662
- } catch {
5663
- return c;
5876
+ return ot[N] ? ot[N](r, typeof w == "string" ? w.trim() : null, k) : d?.html ? l("", r, N.toLowerCase()) : r;
5877
+ } catch (I) {
5878
+ return d?.debug && typeof console < "u" && typeof console.error == "function" && console.error("[Helper.string.compose] Modifier error", { name: u, param: w, error: I }), r;
5664
5879
  }
5665
5880
  }
5666
- function C(c) {
5667
- let p = c, J;
5668
- for (; (J = v.MODIFIERS.exec(p)) !== null; ) {
5669
- const [U, P, z] = J, N = P.split(",").map((L) => L.trim()).filter((L) => L.length).map((L) => {
5670
- const [O, W] = L.split(":");
5671
- return { name: O.trim(), param: W?.trim() ?? null };
5881
+ function st(r) {
5882
+ let u = r, w;
5883
+ for (; (w = j.MODIFIERS.exec(u)) !== null; ) {
5884
+ const [x, N, I] = w, T = N.split(",").map((E) => E.trim()).filter((E) => E.length).map((E) => {
5885
+ const [H, _] = E.split(":");
5886
+ return { name: H.trim(), param: _?.trim() ?? null };
5672
5887
  });
5673
- let R = C(z);
5674
- for (const { name: L, param: O } of N)
5675
- R = T(R, L, O);
5676
- p = p.replace(U, R ?? ""), v.MODIFIERS.lastIndex = 0;
5677
- }
5678
- return p;
5679
- }
5680
- function x(c) {
5681
- let p = 0;
5682
- const J = c.length;
5683
- function U(z) {
5684
- let N = "";
5685
- for (; p < J; )
5686
- if (c[p] === "\\")
5687
- p + 1 < J ? (N += c[p + 1], p += 2) : p++;
5688
- else if (c[p] === "[" && (!z || z !== "["))
5689
- N += P();
5690
- else if (z && c[p] === z) {
5691
- p++;
5888
+ let M = st(I);
5889
+ for (const { name: E, param: H } of T)
5890
+ M = K(M, E, H);
5891
+ u = u.replace(x, M ?? ""), j.MODIFIERS.lastIndex = 0;
5892
+ }
5893
+ return u;
5894
+ }
5895
+ function X(r) {
5896
+ let u = 0;
5897
+ const w = r.length;
5898
+ function x(I) {
5899
+ let T = "";
5900
+ for (; u < w; )
5901
+ if (r[u] === "\\")
5902
+ u + 1 < w ? (T += r[u + 1], u += 2) : u++;
5903
+ else if (r[u] === "[" && (!I || I !== "["))
5904
+ T += N();
5905
+ else if (I && r[u] === I) {
5906
+ u++;
5692
5907
  break;
5693
5908
  } else
5694
- N += c[p++];
5695
- return N;
5696
- }
5697
- function P() {
5698
- p++;
5699
- const z = [];
5700
- for (; p < J && c[p] !== "="; ) {
5701
- if (c[p] === ",") {
5702
- p++;
5909
+ T += r[u++];
5910
+ return T;
5911
+ }
5912
+ function N() {
5913
+ u++;
5914
+ const I = [];
5915
+ for (; u < w && r[u] !== "="; ) {
5916
+ if (r[u] === ",") {
5917
+ u++;
5703
5918
  continue;
5704
5919
  }
5705
- let R = "";
5706
- for (; p < J && /[A-Za-z0-9]/.test(c[p]); ) R += c[p++];
5707
- let L = null;
5708
- if (c[p] === ":") {
5709
- p++;
5710
- const O = p;
5711
- for (; p < J && c[p] !== "," && c[p] !== "="; ) p++;
5712
- L = c.slice(O, p);
5920
+ let M = "";
5921
+ for (; u < w && /[A-Za-z0-9]/.test(r[u]); ) M += r[u++];
5922
+ let E = null;
5923
+ if (r[u] === ":") {
5924
+ u++;
5925
+ const H = u;
5926
+ for (; u < w && r[u] !== "," && r[u] !== "="; ) u++;
5927
+ E = r.slice(H, u);
5713
5928
  }
5714
- R.length && z.push({ name: R, param: L }), c[p] === "," && p++;
5929
+ M.length && I.push({ name: M, param: E }), r[u] === "," && u++;
5715
5930
  }
5716
- c[p] === "=" && p++;
5717
- const N = U("]");
5718
- return z.reduce((R, { name: L, param: O }) => T(R, L, O), N);
5931
+ r[u] === "=" && u++;
5932
+ const T = x("]");
5933
+ return I.reduce((M, { name: E, param: H }) => K(M, E, H), T);
5719
5934
  }
5720
- return U();
5935
+ return x();
5721
5936
  }
5722
- let D = g.replace(
5723
- v.PLACEHOLDERS,
5724
- (c, p) => typeof u[p] == "string" || typeof u[p] == "number" ? String(u[p]) : p ?? p
5937
+ let $ = g.replace(
5938
+ j.PLACEHOLDERS,
5939
+ (r, u) => typeof k[u] == "string" || typeof k[u] == "number" ? String(k[u]) : u ?? u
5725
5940
  );
5726
- return D = d.method === "loop" ? C(D) : x(D), D;
5941
+ return $ = d.method === "loop" ? st($) : X($), $;
5727
5942
  }
5728
5943
  n.compose = b;
5729
5944
  })(h.string || (h.string = {})), ((n) => {
5730
5945
  n.playing = !1;
5731
- function l(o, b = 100, g = !1) {
5946
+ function m(o, b = 100, g = !1) {
5732
5947
  if (!o || !o.length)
5733
5948
  throw new Error("No sound URL provided");
5734
5949
  try {
5735
5950
  g && n.playing && n.audio && n.audio.state !== "closed" && n.audio.close();
5736
- let r = new AudioContext(), d = r.createGain();
5737
- d.connect(r.destination), g && (n.audio = r, n.playing = !0), fetch(o).then((f) => f.arrayBuffer()).then((f) => r.decodeAudioData(f)).then((f) => {
5738
- if (r.state !== "closed") {
5739
- const m = r.createBufferSource();
5740
- m.buffer = f, m.connect(d), d.gain.value = b / 100, m.start(r.currentTime);
5951
+ let c = new AudioContext(), d = c.createGain();
5952
+ d.connect(c.destination), g && (n.audio = c, n.playing = !0), fetch(o).then((f) => f.arrayBuffer()).then((f) => c.decodeAudioData(f)).then((f) => {
5953
+ if (c.state !== "closed") {
5954
+ const l = c.createBufferSource();
5955
+ l.buffer = f, l.connect(d), d.gain.value = b / 100, l.start(c.currentTime);
5741
5956
  }
5742
5957
  });
5743
- } catch (r) {
5744
- throw new Error(`Error playing sound: ${r}`);
5958
+ } catch (c) {
5959
+ throw new Error(`Error playing sound: ${c}`);
5745
5960
  }
5746
5961
  }
5747
- n.play = l;
5962
+ n.play = m;
5748
5963
  })(h.sound || (h.sound = {}));
5749
5964
  let i;
5750
5965
  ((n) => {
5751
- function l(r = 100, d = "") {
5752
- d = d.length > 7 ? d?.substring(0, 6) : d, r = r > 1 ? r / 100 : r;
5753
- let f = Math.round(Math.min(Math.max(r, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
5966
+ function m(c = 100, d = "") {
5967
+ d = d.length > 7 ? d?.substring(0, 6) : d, c = c > 1 ? c / 100 : c;
5968
+ let f = Math.round(Math.min(Math.max(c, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
5754
5969
  return d + f;
5755
5970
  }
5756
- n.opacity = l;
5757
- function o(r) {
5758
- if (!r.startsWith("#") || r.length <= 7)
5971
+ n.opacity = m;
5972
+ function o(c) {
5973
+ if (!c.startsWith("#") || c.length <= 7)
5759
5974
  return {
5760
- color: r,
5975
+ color: c,
5761
5976
  opacity: 100
5762
5977
  };
5763
- var m = r.slice(-2), d = parseInt(m, 16) / 255, f = Math.round(d * 100), m = r.length > 7 ? r.slice(0, 7) : r;
5978
+ var l = c.slice(-2), d = parseInt(l, 16) / 255, f = Math.round(d * 100), l = c.length > 7 ? c.slice(0, 7) : c;
5764
5979
  return {
5765
- color: m,
5980
+ color: l,
5766
5981
  opacity: f
5767
5982
  };
5768
5983
  }
5769
5984
  n.extract = o;
5770
- function b(r) {
5771
- if (typeof r != "string" || !String(r).trim().length) return !1;
5772
- const d = r.trim();
5773
- return /^#([A-Fa-f0-9]{3}){1,2}$/.test(d) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(d) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(d) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(d) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(d) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(d) ? "hsla" : E.css_color_names.includes(d.toLowerCase()) ? "css-color-name" : !1;
5985
+ function b(c) {
5986
+ if (typeof c != "string" || !String(c).trim().length) return !1;
5987
+ const d = c.trim();
5988
+ return /^#([A-Fa-f0-9]{3}){1,2}$/.test(d) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(d) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(d) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(d) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(d) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(d) ? "hsla" : D.css_color_names.includes(d.toLowerCase()) ? "css-color-name" : !1;
5774
5989
  }
5775
5990
  n.validate = b;
5776
- async function g(r, d) {
5777
- const f = b(r);
5778
- if (!f) throw new Error(`Invalid color format: ${r}`);
5991
+ async function g(c, d) {
5992
+ const f = b(c);
5993
+ if (!f) throw new Error(`Invalid color format: ${c}`);
5779
5994
  if (f === d) throw new Error(`Color is already in the desired format: ${d}`);
5780
- const m = it(r.trim(), f);
5781
- if (!m) throw new Error(`Failed to parse color: ${r}`);
5995
+ const l = pt(c.trim(), f);
5996
+ if (!l) throw new Error(`Failed to parse color: ${c}`);
5782
5997
  switch (d) {
5783
5998
  case "hex":
5784
- return at(m, !1);
5999
+ return ft(l, !1);
5785
6000
  case "rgb":
5786
- return `rgb(${m.r}, ${m.g}, ${m.b})`;
6001
+ return `rgb(${l.r}, ${l.g}, ${l.b})`;
5787
6002
  case "rgba":
5788
- return `rgba(${m.r}, ${m.g}, ${m.b}, ${m.a})`;
6003
+ return `rgba(${l.r}, ${l.g}, ${l.b}, ${l.a})`;
5789
6004
  case "hsl": {
5790
- const u = X(m.r, m.g, m.b);
5791
- return `hsl(${u.h}, ${u.s}%, ${u.l}%)`;
6005
+ const p = dt(l.r, l.g, l.b);
6006
+ return `hsl(${p.h}, ${p.s}%, ${p.l}%)`;
5792
6007
  }
5793
6008
  case "hsla": {
5794
- const u = X(m.r, m.g, m.b);
5795
- return `hsla(${u.h}, ${u.s}%, ${u.l}%, ${m.a})`;
6009
+ const p = dt(l.r, l.g, l.b);
6010
+ return `hsla(${p.h}, ${p.s}%, ${p.l}%, ${l.a})`;
5796
6011
  }
5797
6012
  case "css-color-name":
5798
- return await nt(m.r, m.g, m.b);
6013
+ return await yt(l.r, l.g, l.b);
5799
6014
  default:
5800
6015
  return null;
5801
6016
  }
@@ -5804,86 +6019,86 @@ var y;
5804
6019
  })(i = h.color || (h.color = {}));
5805
6020
  let s;
5806
6021
  ((n) => {
5807
- function l(u = "hex") {
5808
- switch (u) {
6022
+ function m(p = "hex") {
6023
+ switch (p) {
5809
6024
  default:
5810
6025
  case "hex":
5811
6026
  return `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
5812
6027
  case "hexa": {
5813
- const w = `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`, k = Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
5814
- return w + k;
6028
+ const v = `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`, k = Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
6029
+ return v + k;
5815
6030
  }
5816
6031
  case "rgb": {
5817
- const w = Math.floor(Math.random() * 256), k = Math.floor(Math.random() * 256), j = Math.floor(Math.random() * 256);
5818
- return `rgb(${w}, ${k}, ${j})`;
6032
+ const v = Math.floor(Math.random() * 256), k = Math.floor(Math.random() * 256), j = Math.floor(Math.random() * 256);
6033
+ return `rgb(${v}, ${k}, ${j})`;
5819
6034
  }
5820
6035
  case "rgba": {
5821
- const w = Math.floor(Math.random() * 256), k = Math.floor(Math.random() * 256), j = Math.floor(Math.random() * 256), S = Math.random().toFixed(2);
5822
- return `rgba(${w}, ${k}, ${j}, ${S})`;
6036
+ const v = Math.floor(Math.random() * 256), k = Math.floor(Math.random() * 256), j = Math.floor(Math.random() * 256), P = Math.random().toFixed(2);
6037
+ return `rgba(${v}, ${k}, ${j}, ${P})`;
5823
6038
  }
5824
6039
  case "hsl": {
5825
- const w = Math.floor(Math.random() * 361), k = Math.floor(Math.random() * 101), j = Math.floor(Math.random() * 101);
5826
- return `hsl(${w}, ${k}%, ${j}%)`;
6040
+ const v = Math.floor(Math.random() * 361), k = Math.floor(Math.random() * 101), j = Math.floor(Math.random() * 101);
6041
+ return `hsl(${v}, ${k}%, ${j}%)`;
5827
6042
  }
5828
6043
  case "hsla": {
5829
- const w = Math.floor(Math.random() * 361), k = Math.floor(Math.random() * 101), j = Math.floor(Math.random() * 101), S = Math.random().toFixed(2);
5830
- return `hsla(${w}, ${k}%, ${j}%, ${S})`;
6044
+ const v = Math.floor(Math.random() * 361), k = Math.floor(Math.random() * 101), j = Math.floor(Math.random() * 101), P = Math.random().toFixed(2);
6045
+ return `hsla(${v}, ${k}%, ${j}%, ${P})`;
5831
6046
  }
5832
6047
  case "css-color-name": {
5833
- var v = E.css_color_names;
5834
- return r(v)[0];
6048
+ var C = D.css_color_names;
6049
+ return c(C)[0];
5835
6050
  }
5836
6051
  }
5837
6052
  }
5838
- n.color = l;
5839
- function o(u, v, w = 0) {
5840
- u > v && ([u, v] = [v, u]);
5841
- const k = Math.random() * (v - u) + u;
5842
- return w ? Number(k.toFixed(w)) : Math.round(k);
6053
+ n.color = m;
6054
+ function o(p, C, v = 0) {
6055
+ p > C && ([p, C] = [C, p]);
6056
+ const k = Math.random() * (C - p) + p;
6057
+ return v ? Number(k.toFixed(v)) : Math.round(k);
5843
6058
  }
5844
6059
  n.number = o;
5845
- function b(u = 0.5) {
5846
- return Math.random() > u;
6060
+ function b(p = 0.5) {
6061
+ return Math.random() > p;
5847
6062
  }
5848
6063
  n.boolean = b;
5849
- function g(u, v = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
5850
- let w = "";
5851
- for (let k = 0; k < u; k++)
5852
- w += v.charAt(Math.floor(Math.random() * v.length));
5853
- return w;
6064
+ function g(p, C = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
6065
+ let v = "";
6066
+ for (let k = 0; k < p; k++)
6067
+ v += C.charAt(Math.floor(Math.random() * C.length));
6068
+ return v;
5854
6069
  }
5855
6070
  n.string = g;
5856
- function r(u) {
5857
- const v = o(0, u.length - 1);
5858
- return [u[v], v];
6071
+ function c(p) {
6072
+ const C = o(0, p.length - 1);
6073
+ return [p[C], C];
5859
6074
  }
5860
- n.array = r;
5861
- function d(u = new Date(2e3, 0, 1), v = /* @__PURE__ */ new Date()) {
5862
- return new Date(o(u.getTime(), v.getTime()));
6075
+ n.array = c;
6076
+ function d(p = new Date(2e3, 0, 1), C = /* @__PURE__ */ new Date()) {
6077
+ return new Date(o(p.getTime(), C.getTime()));
5863
6078
  }
5864
6079
  n.date = d;
5865
- function f(u) {
5866
- const w = Date.now() - o(0, u * 24 * 60 * 60 * 1e3);
5867
- return new Date(w).toISOString();
6080
+ function f(p) {
6081
+ const v = Date.now() - o(0, p * 24 * 60 * 60 * 1e3);
6082
+ return new Date(v).toISOString();
5868
6083
  }
5869
6084
  n.daysOffset = f;
5870
- function m() {
6085
+ function l() {
5871
6086
  return crypto.randomUUID();
5872
6087
  }
5873
- n.uuid = m;
6088
+ n.uuid = l;
5874
6089
  })(s = h.random || (h.random = {}));
5875
6090
  })(y || (y = {}));
5876
- class F {
6091
+ class it {
5877
6092
  constructor(e) {
5878
- this.field = "button", this.template = "button", this.name = "Button", this.value = "", window.client instanceof M && (this.field = e.field ?? this.field, this.template = e.template ?? 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"));
6093
+ 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 ?? 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"));
5879
6094
  }
5880
6095
  generate(e) {
5881
6096
  return y.utils.typedValues(e).reduce(
5882
6097
  (a, i, s) => {
5883
- const n = y.string.compose(this.template, { index: s, ...i }, { html: !1 }), l = y.string.compose(this.name, { index: s, ...i }, { html: !1 });
6098
+ const n = y.string.compose(this.template, { index: s, ...i }, { html: !1 }), m = y.string.compose(this.name, { index: s, ...i }, { html: !1 });
5884
6099
  a[n] = {
5885
6100
  type: "button",
5886
- label: l
6101
+ label: m
5887
6102
  };
5888
6103
  let o = y.string.compose(String(this.value), { index: s, ...i }, { html: !1 });
5889
6104
  return isNaN(Number(o)) ? o.toLowerCase() === "true" ? o = !0 : o.toLowerCase() === "false" && (o = !1) : o = Number(o), typeof o < "u" && o && (typeof o != "string" || o.length) && (a[n].value = o), a;
@@ -5901,21 +6116,21 @@ class F {
5901
6116
  return this;
5902
6117
  }
5903
6118
  remove() {
5904
- if (!(window.client instanceof M)) return;
6119
+ if (!(window.client instanceof G)) return;
5905
6120
  const e = window.client.actions.buttons.indexOf(this);
5906
6121
  e > -1 && (window.client.actions.buttons.splice(e, 1), window.client.emit("action", this, "removed"));
5907
6122
  }
5908
6123
  static execute(e, t) {
5909
6124
  try {
5910
- if (!(window.client instanceof M)) return !1;
6125
+ if (!(window.client instanceof G)) return !1;
5911
6126
  if (window.client.actions.buttons.length) {
5912
6127
  const a = window.client.actions.buttons.filter((i) => typeof i.field == "string" ? i.field === e : typeof i.field == "function" ? i.field(e, t) : !1);
5913
- if (a.length && a.every((i) => i instanceof F))
6128
+ if (a.length && a.every((i) => i instanceof it))
5914
6129
  return a.forEach((i) => {
5915
6130
  try {
5916
- i.parse(e, t), window.client.emit("action", i, "executed"), A.received(`Button executed: ${e}${t ? ` with value: ${t}` : ""}`);
6131
+ i.parse(e, t), window.client.emit("action", i, "executed"), R.received(`Button executed: ${e}${t ? ` with value: ${t}` : ""}`);
5917
6132
  } catch (s) {
5918
- A.error(`Error executing button "${e}": ${s instanceof Error ? s.message : s}`);
6133
+ R.error(`Error executing button "${e}": ${s instanceof Error ? s.message : s}`);
5919
6134
  }
5920
6135
  }), !0;
5921
6136
  }
@@ -5926,16 +6141,16 @@ class F {
5926
6141
  }
5927
6142
  }
5928
6143
  }
5929
- var H;
6144
+ var q;
5930
6145
  ((h) => {
5931
6146
  h.generate = {
5932
6147
  session: {
5933
6148
  types: {
5934
- name: { type: "string", options: E.names.filter((t) => t.length) },
5935
- tier: { type: "string", options: E.tiers.filter((t) => t.length) },
5936
- message: { type: "string", options: E.messages.filter((t) => t.length) },
5937
- item: { type: "array", options: E.items },
5938
- avatar: { type: "string", options: E.avatars.filter((t) => t.length) }
6149
+ name: { type: "string", options: D.names.filter((t) => t.length) },
6150
+ tier: { type: "string", options: D.tiers.filter((t) => t.length) },
6151
+ message: { type: "string", options: D.messages.filter((t) => t.length) },
6152
+ item: { type: "array", options: D.items },
6153
+ avatar: { type: "string", options: D.avatars.filter((t) => t.length) }
5939
6154
  },
5940
6155
  available() {
5941
6156
  const t = this.types;
@@ -6184,19 +6399,19 @@ var H;
6184
6399
  const a = this.available();
6185
6400
  if (t) return t;
6186
6401
  const i = (n) => {
6187
- const l = (g) => {
6402
+ const m = (g) => {
6188
6403
  if (!g || !("amount" in g)) return [];
6189
- const r = [];
6404
+ const c = [];
6190
6405
  for (let d = 0; d < g.amount; d++)
6191
- r.push(i(g.value));
6192
- return r.sort((d, f) => new Date(f.createdAt).getTime() - new Date(d.createdAt).getTime());
6406
+ c.push(i(g.value));
6407
+ return c.sort((d, f) => new Date(f.createdAt).getTime() - new Date(d.createdAt).getTime());
6193
6408
  }, o = (g) => {
6194
- const r = {};
6409
+ const c = {};
6195
6410
  for (const d in g) {
6196
6411
  const f = d.replace("_type", "type");
6197
- r[f] = i(g[d]);
6412
+ c[f] = i(g[d]);
6198
6413
  }
6199
- return r;
6414
+ return c;
6200
6415
  }, b = (g) => {
6201
6416
  if (!g) return g;
6202
6417
  switch (g.type) {
@@ -6209,7 +6424,7 @@ var H;
6209
6424
  case "array":
6210
6425
  return y.random.array(g.options)[0];
6211
6426
  case "recent":
6212
- return l(g);
6427
+ return m(g);
6213
6428
  default:
6214
6429
  return g;
6215
6430
  }
@@ -6217,10 +6432,10 @@ var H;
6217
6432
  return typeof n != "object" || n === null ? n : "type" in n && typeof n.type == "string" ? b(n) : o(n);
6218
6433
  };
6219
6434
  var s = Object.entries(i(a)).reduce(
6220
- (n, [l, o]) => (Object.entries(o).forEach(
6435
+ (n, [m, o]) => (Object.entries(o).forEach(
6221
6436
  ([b, g]) => (
6222
6437
  //
6223
- n[`${l}-${b}`] = g
6438
+ n[`${m}-${b}`] = g
6224
6439
  )
6225
6440
  ), n),
6226
6441
  {}
@@ -6281,19 +6496,19 @@ var H;
6281
6496
  const s = a.data;
6282
6497
  switch (s.listener) {
6283
6498
  case "cheer-latest": {
6284
- const n = s.event.amount, l = s.event.displayName ?? s.event.name, o = s.event.message;
6285
- t["cheer-latest"] = { name: l, amount: n, message: o };
6499
+ const n = s.event.amount, m = s.event.displayName ?? s.event.name, o = s.event.message;
6500
+ t["cheer-latest"] = { name: m, amount: n, message: o };
6286
6501
  const b = (g) => {
6287
6502
  if (g === "all") {
6288
6503
  b("alltime"), b("monthly"), b("weekly"), b("session");
6289
6504
  return;
6290
6505
  }
6291
- const r = t[`cheer-${g}-top-donation`];
6292
- r && n > r.amount && (r.amount = n, r.name = l);
6293
- const d = t[`cheer-${g}-top-donator`], f = t["cheer-recent"].filter((u) => u.name.toLowerCase() === d.name.toLowerCase()).reduce((u, v) => u + v.amount, 0), m = t["cheer-recent"].filter((u) => u.name.toLowerCase() === l.toLowerCase()).reduce((u, v) => u + v.amount, 0);
6294
- m > f && (d.amount = m, d.name = l);
6506
+ const c = t[`cheer-${g}-top-donation`];
6507
+ c && n > c.amount && (c.amount = n, c.name = m);
6508
+ const d = t[`cheer-${g}-top-donator`], f = t["cheer-recent"].filter((p) => p.name.toLowerCase() === d.name.toLowerCase()).reduce((p, C) => p + C.amount, 0), l = t["cheer-recent"].filter((p) => p.name.toLowerCase() === m.toLowerCase()).reduce((p, C) => p + C.amount, 0);
6509
+ l > f && (d.amount = l, d.name = m);
6295
6510
  };
6296
- 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({ name: l, amount: n, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["cheer-recent"] = (t["cheer-recent"] || []).sort(i);
6511
+ 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({ name: m, amount: n, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["cheer-recent"] = (t["cheer-recent"] || []).sort(i);
6297
6512
  break;
6298
6513
  }
6299
6514
  case "follower-latest": {
@@ -6302,23 +6517,23 @@ var H;
6302
6517
  break;
6303
6518
  }
6304
6519
  case "subscriber-latest": {
6305
- const n = s.event.displayName ?? s.event.name, l = s.event.amount, o = s.event.tier, b = s.event.message;
6306
- if (t["subscriber-latest"] = { name: n, amount: l, tier: o, message: b ?? "" }, t["subscriber-recent"].find((g) => g.name.toLowerCase() === n.toLowerCase()) ? l > 1 && (t["subscriber-resub-latest"] = { name: n, amount: l, message: b ?? "" }, t["subscriber-resub-session"].count += 1) : (t["subscriber-new-latest"] = { name: n, amount: l, 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) {
6520
+ const n = s.event.displayName ?? s.event.name, m = s.event.amount, o = s.event.tier, b = s.event.message;
6521
+ if (t["subscriber-latest"] = { name: n, amount: m, tier: o, message: b ?? "" }, t["subscriber-recent"].find((g) => g.name.toLowerCase() === n.toLowerCase()) ? 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) {
6307
6522
  const g = s.event.sender;
6308
6523
  t["subscriber-gifted-latest"] = {
6309
6524
  name: n,
6310
- amount: l,
6525
+ amount: m,
6311
6526
  tier: o,
6312
6527
  message: b ?? "",
6313
6528
  sender: g
6314
- }, t["subscriber-gifted-session"].count += 1, t["subscriber-alltime-gifter"] = { name: g, amount: l };
6529
+ }, t["subscriber-gifted-session"].count += 1, t["subscriber-alltime-gifter"] = { name: g, amount: m };
6315
6530
  } else s.event.gifted && !s.event.bulkGifted && s.event.isCommunityGift || !s.event.gifted && s.event.bulkGifted && s.event.isCommunityGift;
6316
- t["subscriber-session"].count += l, t["subscriber-week"].count += l, t["subscriber-month"].count += l, t["subscriber-total"].count += l, t["subscriber-goal"].amount += l, t["subscriber-points"].amount += l, t["subscriber-recent"].unshift({ name: n, amount: l, tier: o, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["subscriber-recent"] = (t["subscriber-recent"] || []).sort(i);
6531
+ 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({ name: n, amount: m, tier: o, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["subscriber-recent"] = (t["subscriber-recent"] || []).sort(i);
6317
6532
  break;
6318
6533
  }
6319
6534
  case "raid-latest": {
6320
- const n = s.event.displayName ?? s.event.name, l = s.event.amount;
6321
- t["raid-latest"] = { name: n, amount: l }, t["raid-recent"].unshift({ name: n, amount: l, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["raid-recent"] = (t["raid-recent"] || []).sort(i);
6535
+ const n = s.event.displayName ?? s.event.name, m = s.event.amount;
6536
+ t["raid-latest"] = { name: n, amount: m }, t["raid-recent"].unshift({ name: n, amount: m, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["raid-recent"] = (t["raid-recent"] || []).sort(i);
6322
6537
  break;
6323
6538
  }
6324
6539
  }
@@ -6327,11 +6542,11 @@ var H;
6327
6542
  case "youtube": {
6328
6543
  const s = a.data;
6329
6544
  if (s.listener === "superchat-latest") {
6330
- const n = s.event.displayName ?? s.event.name, l = s.event.amount;
6545
+ const n = s.event.displayName ?? s.event.name, m = s.event.amount;
6331
6546
  t["superchat-latest"] = {
6332
6547
  name: n.toLowerCase(),
6333
6548
  displayName: n,
6334
- amount: l,
6549
+ amount: m,
6335
6550
  _id: y.random.uuid(),
6336
6551
  sessionTop: !1,
6337
6552
  type: "superchat",
@@ -6345,14 +6560,14 @@ var H;
6345
6560
  return;
6346
6561
  }
6347
6562
  const g = t[`superchat-${b}-top-donation`];
6348
- g && l > g.amount && (g.amount = l, g.name = n);
6349
- const r = t[`superchat-${b}-top-donator`], d = t["superchat-recent"].filter((m) => m.name.toLowerCase() === r.name.toLowerCase()).reduce((m, u) => m + u.amount, 0), f = t["superchat-recent"].filter((m) => m.name.toLowerCase() === n.toLowerCase()).reduce((m, u) => m + u.amount, 0);
6350
- f > d && (r.amount = f, r.name = n);
6563
+ g && m > g.amount && (g.amount = m, g.name = n);
6564
+ const c = t[`superchat-${b}-top-donator`], d = t["superchat-recent"].filter((l) => l.name.toLowerCase() === c.name.toLowerCase()).reduce((l, p) => l + p.amount, 0), f = t["superchat-recent"].filter((l) => l.name.toLowerCase() === n.toLowerCase()).reduce((l, p) => l + p.amount, 0);
6565
+ f > d && (c.amount = f, c.name = n);
6351
6566
  };
6352
- o("all"), t["superchat-session"].amount += l, t["superchat-week"].amount += l, t["superchat-month"].amount += l, t["superchat-total"].amount += l, t["superchat-count"].count += 1, t["superchat-goal"].amount += l, t["superchat-recent"].unshift({
6567
+ o("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({
6353
6568
  name: n.toLowerCase(),
6354
6569
  displayName: n,
6355
- amount: l,
6570
+ amount: m,
6356
6571
  _id: y.random.uuid(),
6357
6572
  sessionTop: !1,
6358
6573
  type: "superchat",
@@ -6366,19 +6581,19 @@ var H;
6366
6581
  case "streamelements": {
6367
6582
  const s = a.data;
6368
6583
  if (s.listener === "tip-latest") {
6369
- const n = s.event.displayName ?? s.event.name, l = s.event.amount;
6370
- t["tip-latest"] = { name: n, amount: l };
6584
+ const n = s.event.displayName ?? s.event.name, m = s.event.amount;
6585
+ t["tip-latest"] = { name: n, amount: m };
6371
6586
  const o = (b) => {
6372
6587
  if (b === "all") {
6373
6588
  o("alltime"), o("monthly"), o("weekly"), o("session");
6374
6589
  return;
6375
6590
  }
6376
6591
  const g = t[`tip-${b}-top-donation`];
6377
- g && l > g.amount && (g.amount = l, g.name = n);
6378
- const r = t[`tip-${b}-top-donator`], d = t["tip-recent"].filter((m) => m.name.toLowerCase() === r.name.toLowerCase()).reduce((m, u) => m + u.amount, 0), f = t["tip-recent"].filter((m) => m.name.toLowerCase() === n.toLowerCase()).reduce((m, u) => m + u.amount, 0);
6379
- f > d && (r.amount = f, r.name = n);
6592
+ g && m > g.amount && (g.amount = m, g.name = n);
6593
+ const c = t[`tip-${b}-top-donator`], d = t["tip-recent"].filter((l) => l.name.toLowerCase() === c.name.toLowerCase()).reduce((l, p) => l + p.amount, 0), f = t["tip-recent"].filter((l) => l.name.toLowerCase() === n.toLowerCase()).reduce((l, p) => l + p.amount, 0);
6594
+ f > d && (c.amount = f, c.name = n);
6380
6595
  };
6381
- o("all"), t["tip-session"].amount += l, t["tip-week"].amount += l, t["tip-month"].amount += l, t["tip-total"].amount += l, t["tip-count"].count += 1, t["tip-goal"].amount += l, t["tip-recent"].unshift({ name: n, amount: l, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["tip-recent"] = (t["tip-recent"] || []).sort(i);
6596
+ o("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({ name: n, amount: m, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["tip-recent"] = (t["tip-recent"] || []).sort(i);
6382
6597
  }
6383
6598
  break;
6384
6599
  }
@@ -6412,52 +6627,52 @@ var H;
6412
6627
  switch (t) {
6413
6628
  default:
6414
6629
  case "random": {
6415
- var n = y.random.array(Object.keys(s).filter((c) => s[c].length))[0], l = y.random.array(s[n])[0];
6416
- return this.onEventReceived(n, l);
6630
+ var n = y.random.array(Object.keys(s).filter((O) => s[O].length))[0], m = y.random.array(s[n])[0];
6631
+ return this.onEventReceived(n, m);
6417
6632
  }
6418
6633
  case "twitch":
6419
6634
  switch (a) {
6420
6635
  default:
6421
6636
  case "random": {
6422
- var l = y.random.array(s[t])[0];
6423
- return this.onEventReceived(t, l);
6637
+ var m = y.random.array(s[t])[0];
6638
+ return this.onEventReceived(t, m);
6424
6639
  }
6425
6640
  case "message": {
6426
- var o = i?.name ?? y.random.array(E.names.filter((p) => p.length))[0], b = i?.message ?? y.random.array(E.messages.filter((p) => p.length))[0], g = await y.message.generateBadges(i?.badges ?? [], t), r = y.message.findEmotesInText(b), d = y.message.replaceEmotesWithHTML(b, r), f = i?.color ?? y.random.color("hex"), m = i?.userId ?? y.random.number(1e7, 99999999).toString(), u = i?.msgId ?? y.random.uuid(), v = i?.time ?? Date.now(), w = i?.channel ?? client.details.user.username;
6641
+ var o = i?.name ?? y.random.array(D.names.filter((z) => z.length))[0], b = i?.message ?? y.random.array(D.messages.filter((z) => z.length))[0], g = await y.message.generateBadges(i?.badges ?? [], t), c = y.message.findEmotesInText(b), d = y.message.replaceEmotesWithHTML(b, c), f = i?.color ?? y.random.color("hex"), l = i?.userId ?? y.random.number(1e7, 99999999).toString(), p = i?.msgId ?? y.random.uuid(), C = i?.time ?? Date.now(), v = i?.channel ?? client.details.user.username;
6427
6642
  return {
6428
6643
  listener: "message",
6429
6644
  event: {
6430
6645
  service: t,
6431
6646
  data: {
6432
- time: v,
6647
+ time: C,
6433
6648
  tags: {
6434
- "badge-info": `${g.keys.map((p) => `${p}/${y.random.number(1, 5)}`).join(",")}`,
6649
+ "badge-info": `${g.keys.map((z) => `${z}/${y.random.number(1, 5)}`).join(",")}`,
6435
6650
  badges: g.keys.join("/1,"),
6436
6651
  mod: g.keys.includes("moderator") ? "1" : "0",
6437
6652
  subscriber: g.keys.includes("subscriber") ? "1" : "0",
6438
6653
  turbo: g.keys.includes("turbo") ? "1" : "0",
6439
- "tmi-sent-ts": v.toString(),
6440
- "user-id": m,
6654
+ "tmi-sent-ts": C.toString(),
6655
+ "user-id": l,
6441
6656
  "user-type": "",
6442
6657
  color: f,
6443
6658
  "display-name": o,
6444
6659
  emotes: "",
6445
6660
  "client-nonce": y.random.string(16),
6446
6661
  flags: "",
6447
- id: u,
6662
+ id: p,
6448
6663
  "first-msg": "0",
6449
6664
  "returning-chatter": "0"
6450
6665
  },
6451
6666
  nick: o.toLowerCase(),
6452
6667
  displayName: o,
6453
6668
  displayColor: f,
6454
- channel: w,
6669
+ channel: v,
6455
6670
  text: b,
6456
6671
  isAction: !1,
6457
- userId: m,
6458
- msgId: u,
6672
+ userId: l,
6673
+ msgId: p,
6459
6674
  badges: g.badges,
6460
- emotes: r
6675
+ emotes: c
6461
6676
  },
6462
6677
  renderedText: d
6463
6678
  },
@@ -6467,7 +6682,7 @@ var H;
6467
6682
  }
6468
6683
  case "cheer":
6469
6684
  case "cheer-latest": {
6470
- var k = i?.amount ?? y.random.number(100, 1e4), j = i?.avatar ?? y.random.array(E.avatars)[0], o = i?.name ?? y.random.array(E.names.filter((U) => U.length))[0], b = i?.message ?? y.random.array(E.messages.filter((U) => U.length))[0];
6685
+ var k = i?.amount ?? y.random.number(100, 1e4), j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((W) => W.length))[0], b = i?.message ?? y.random.array(D.messages.filter((W) => W.length))[0];
6471
6686
  return {
6472
6687
  listener: "cheer-latest",
6473
6688
  event: {
@@ -6489,7 +6704,7 @@ var H;
6489
6704
  }
6490
6705
  case "follower":
6491
6706
  case "follower-latest": {
6492
- var j = i?.avatar ?? y.random.array(E.avatars)[0], o = i?.name ?? y.random.array(E.names.filter((U) => U.length))[0];
6707
+ var j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((W) => W.length))[0];
6493
6708
  return {
6494
6709
  listener: "follower-latest",
6495
6710
  event: {
@@ -6509,7 +6724,7 @@ var H;
6509
6724
  }
6510
6725
  case "raid":
6511
6726
  case "raid-latest": {
6512
- var k = i?.amount ?? y.random.number(1, 100), j = i?.avatar ?? y.random.array(E.avatars)[0], o = i?.name ?? y.random.array(E.names.filter((P) => P.length))[0];
6727
+ var k = i?.amount ?? y.random.number(1, 100), j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((F) => F.length))[0];
6513
6728
  return {
6514
6729
  listener: "raid-latest",
6515
6730
  event: {
@@ -6530,36 +6745,36 @@ var H;
6530
6745
  }
6531
6746
  case "subscriber":
6532
6747
  case "subscriber-latest": {
6533
- var S = i?.tier ?? y.random.array(["1000", "2000", "3000", "prime"])[0], k = i?.amount ?? y.random.number(1, 24), j = i?.avatar ?? y.random.array(E.avatars)[0], o = i?.name ?? y.random.array(E.names.filter((z) => z.length))[0], I = i?.sender ?? y.random.array(E.names.filter((z) => z.length && z !== o))[0], b = i?.message ?? y.random.array(E.messages.filter((z) => z.length))[0], T = {
6748
+ var P = i?.tier ?? y.random.array(["1000", "2000", "3000", "prime"])[0], k = i?.amount ?? y.random.number(1, 24), j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((B) => B.length))[0], A = i?.sender ?? y.random.array(D.names.filter((B) => B.length && B !== o))[0], b = i?.message ?? y.random.array(D.messages.filter((B) => B.length))[0], J = {
6534
6749
  default: {
6535
6750
  avatar: j,
6536
6751
  playedAsCommunityGift: !1
6537
6752
  },
6538
6753
  gift: {
6539
- sender: I,
6754
+ sender: A,
6540
6755
  gifted: !0
6541
6756
  },
6542
6757
  community: {
6543
6758
  message: b,
6544
- sender: I,
6759
+ sender: A,
6545
6760
  bulkGifted: !0
6546
6761
  },
6547
6762
  spam: {
6548
- sender: I,
6763
+ sender: A,
6549
6764
  gifted: !0,
6550
6765
  isCommunityGift: !0
6551
6766
  }
6552
- }, C = ["default", "gift", "community", "spam"], x = i?.subType ?? y.random.array(C)[0];
6553
- return x = C.includes(x) ? x : "default", {
6767
+ }, U = ["default", "gift", "community", "spam"], S = i?.subType ?? y.random.array(U)[0];
6768
+ return S = U.includes(S) ? S : "default", {
6554
6769
  listener: "subscriber-latest",
6555
6770
  event: {
6556
6771
  amount: k,
6557
6772
  name: o.toLowerCase(),
6558
6773
  displayName: o,
6559
6774
  providerId: "",
6560
- tier: S,
6561
- ...T.default,
6562
- ...T[x],
6775
+ tier: P,
6776
+ ...J.default,
6777
+ ...J[S],
6563
6778
  _id: y.random.uuid(),
6564
6779
  sessionTop: !1,
6565
6780
  type: "subscriber",
@@ -6595,12 +6810,12 @@ var H;
6595
6810
  switch (a) {
6596
6811
  default:
6597
6812
  case "random": {
6598
- var l = y.random.array(s[t])[0];
6599
- return this.onEventReceived(t, l);
6813
+ var m = y.random.array(s[t])[0];
6814
+ return this.onEventReceived(t, m);
6600
6815
  }
6601
6816
  case "tip":
6602
6817
  case "tip-latest": {
6603
- var k = i?.amount ?? y.random.number(100, 4e3), j = i?.avatar ?? y.random.array(E.avatars)[0], o = i?.name ?? y.random.array(E.names.filter((P) => P.length))[0];
6818
+ var k = i?.amount ?? y.random.number(100, 4e3), j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((F) => F.length))[0];
6604
6819
  return {
6605
6820
  listener: "tip-latest",
6606
6821
  event: {
@@ -6646,11 +6861,11 @@ var H;
6646
6861
  case "mute":
6647
6862
  case "unmute":
6648
6863
  case "alertService:toggleSound": {
6649
- var D = i?.muted ?? !client.details.overlay.muted;
6864
+ var L = i?.muted ?? !client.details.overlay.muted;
6650
6865
  return {
6651
6866
  listener: "alertService:toggleSound",
6652
6867
  event: {
6653
- muted: D,
6868
+ muted: L,
6654
6869
  provider: t
6655
6870
  },
6656
6871
  // @ts-ignore
@@ -6672,13 +6887,13 @@ var H;
6672
6887
  switch (a) {
6673
6888
  default:
6674
6889
  case "random": {
6675
- var l = y.random.array(s[t])[0];
6676
- return this.onEventReceived(t, l);
6890
+ var m = y.random.array(s[t])[0];
6891
+ return this.onEventReceived(t, m);
6677
6892
  }
6678
6893
  case "message": {
6679
- var o = i?.name ?? y.random.array(E.names.filter((B) => B.length))[0], b = i?.message ?? y.random.array(E.messages.filter((B) => B.length))[0];
6680
- const J = await y.message.generateBadges(i?.badges ?? [], t);
6681
- var r = y.message.findEmotesInText(b), d = y.message.replaceEmotesWithHTML(b, r), f = i?.color ?? y.random.color("hex"), m = i?.userId ?? y.random.number(1e7, 99999999).toString(), u = i?.msgId ?? y.random.uuid(), v = i?.time ?? Date.now(), j = i?.avatar ?? y.random.array(E.avatars)[0], w = i?.channel ?? client.details.user.username;
6894
+ var o = i?.name ?? y.random.array(D.names.filter((X) => X.length))[0], b = i?.message ?? y.random.array(D.messages.filter((X) => X.length))[0];
6895
+ const V = await y.message.generateBadges(i?.badges ?? [], t);
6896
+ var c = y.message.findEmotesInText(b), d = y.message.replaceEmotesWithHTML(b, c), f = i?.color ?? y.random.color("hex"), l = i?.userId ?? y.random.number(1e7, 99999999).toString(), p = i?.msgId ?? y.random.uuid(), C = i?.time ?? Date.now(), j = i?.avatar ?? y.random.array(D.avatars)[0], v = i?.channel ?? client.details.user.username;
6682
6897
  return {
6683
6898
  listener: "message",
6684
6899
  event: {
@@ -6690,7 +6905,7 @@ var H;
6690
6905
  snippet: {
6691
6906
  type: "",
6692
6907
  liveChatId: "",
6693
- authorChannelId: w,
6908
+ authorChannelId: v,
6694
6909
  publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
6695
6910
  hasDisplayContent: !0,
6696
6911
  displayMessage: b,
@@ -6699,22 +6914,22 @@ var H;
6699
6914
  }
6700
6915
  },
6701
6916
  authorDetails: {
6702
- channelId: w,
6917
+ channelId: v,
6703
6918
  channelUrl: "",
6704
6919
  displayName: o,
6705
6920
  profileImageUrl: j,
6706
- ...J
6921
+ ...V
6707
6922
  },
6708
- msgId: u,
6709
- userId: m,
6923
+ msgId: p,
6924
+ userId: l,
6710
6925
  nick: o.toLowerCase(),
6711
6926
  badges: [],
6712
6927
  displayName: o,
6713
6928
  isAction: !1,
6714
- time: v,
6929
+ time: C,
6715
6930
  tags: [],
6716
6931
  displayColor: f,
6717
- channel: w,
6932
+ channel: v,
6718
6933
  text: b,
6719
6934
  avatar: j,
6720
6935
  emotes: []
@@ -6727,7 +6942,7 @@ var H;
6727
6942
  }
6728
6943
  case "subscriber":
6729
6944
  case "subscriber-latest": {
6730
- var j = i?.avatar ?? y.random.array(E.avatars)[0], o = i?.name ?? y.random.array(E.names.filter((U) => U.length))[0];
6945
+ var j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((W) => W.length))[0];
6731
6946
  return {
6732
6947
  listener: "subscriber-latest",
6733
6948
  event: {
@@ -6747,7 +6962,7 @@ var H;
6747
6962
  }
6748
6963
  case "superchat":
6749
6964
  case "superchat-latest": {
6750
- var k = i?.amount ?? y.random.number(100, 4e3), j = i?.avatar ?? y.random.array(E.avatars)[0], o = i?.name ?? y.random.array(E.names.filter((P) => P.length))[0];
6965
+ var k = i?.amount ?? y.random.number(100, 4e3), j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((F) => F.length))[0];
6751
6966
  return {
6752
6967
  listener: "superchat-latest",
6753
6968
  event: {
@@ -6768,35 +6983,35 @@ var H;
6768
6983
  }
6769
6984
  case "sponsor":
6770
6985
  case "sponsor-latest": {
6771
- var S = i?.tier ?? y.random.array(["1000", "2000", "3000"])[0], k = i?.amount ?? y.random.number(1, 24), j = i?.avatar ?? y.random.array(E.avatars)[0], o = i?.name ?? y.random.array(E.names.filter((W) => W.length))[0], I = i?.sender ?? y.random.array(E.names.filter((W) => W.length && W !== o))[0], b = i?.message ?? y.random.array(E.messages.filter((W) => W.length))[0], T = {
6986
+ var P = i?.tier ?? y.random.array(["1000", "2000", "3000"])[0], k = i?.amount ?? y.random.number(1, 24), j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((K) => K.length))[0], A = i?.sender ?? y.random.array(D.names.filter((K) => K.length && K !== o))[0], b = i?.message ?? y.random.array(D.messages.filter((K) => K.length))[0], J = {
6772
6987
  default: {
6773
6988
  avatar: j,
6774
6989
  playedAsCommunityGift: !1
6775
6990
  },
6776
6991
  gift: {
6777
- sender: I,
6992
+ sender: A,
6778
6993
  gifted: !0
6779
6994
  },
6780
6995
  community: {
6781
6996
  message: b,
6782
- sender: I,
6997
+ sender: A,
6783
6998
  bulkGifted: !0
6784
6999
  },
6785
7000
  spam: {
6786
- sender: I,
7001
+ sender: A,
6787
7002
  gifted: !0,
6788
7003
  isCommunityGift: !0
6789
7004
  }
6790
- }, C = ["default", "gift", "community", "spam"], x = i?.subType ?? y.random.array(C)[0];
6791
- return x = C.includes(x) ? x : "default", {
7005
+ }, U = ["default", "gift", "community", "spam"], S = i?.subType ?? y.random.array(U)[0];
7006
+ return S = U.includes(S) ? S : "default", {
6792
7007
  listener: "sponsor-latest",
6793
7008
  event: {
6794
7009
  amount: k,
6795
7010
  name: o.toLowerCase(),
6796
7011
  displayName: o,
6797
7012
  providerId: "",
6798
- ...T.default,
6799
- ...T[x],
7013
+ ...J.default,
7014
+ ...J[S],
6800
7015
  _id: y.random.uuid(),
6801
7016
  sessionTop: !1,
6802
7017
  type: "sponsor",
@@ -6892,7 +7107,7 @@ var H;
6892
7107
  facebook: {},
6893
7108
  send(t, a) {
6894
7109
  if (!h.queue) {
6895
- A.warn("Local queue is not initialized."), window.dispatchEvent(new CustomEvent(t, { detail: a }));
7110
+ R.warn("Local queue is not initialized."), window.dispatchEvent(new CustomEvent(t, { detail: a }));
6896
7111
  return;
6897
7112
  }
6898
7113
  switch (t) {
@@ -6923,28 +7138,28 @@ var H;
6923
7138
  };
6924
7139
  async function e(t = ["fields.json", "cf.json", "field.json", "customfields.json"], a = ["data.json", "fielddata.json", "fd.json", "DATA.json"], i) {
6925
7140
  const s = {
6926
- fields: t.find((l) => {
7141
+ fields: t.find((m) => {
6927
7142
  try {
6928
- return new URL("./" + l, window.location.href), !0;
7143
+ return new URL("./" + m, window.location.href), !0;
6929
7144
  } catch {
6930
7145
  return !1;
6931
7146
  }
6932
7147
  }),
6933
- data: a.find((l) => {
7148
+ data: a.find((m) => {
6934
7149
  try {
6935
- return new URL("./" + l, window.location.href), !0;
7150
+ return new URL("./" + m, window.location.href), !0;
6936
7151
  } catch {
6937
7152
  return !1;
6938
7153
  }
6939
7154
  })
6940
7155
  }, n = await fetch("./" + (s.data ?? "data.json"), {
6941
7156
  cache: "no-store"
6942
- }).then((l) => l.json()).catch(() => ({}));
7157
+ }).then((m) => m.json()).catch(() => ({}));
6943
7158
  await fetch("./" + (s.fields ?? "fields.json"), {
6944
7159
  cache: "no-store"
6945
- }).then((l) => l.json()).then(async (l) => {
6946
- const o = Object.entries(l).filter(([g, { value: r }]) => r != null).reduce(
6947
- (g, [r, { value: d }]) => (n && n[r] !== void 0 && (d = n[r]), g[r] = d, g),
7160
+ }).then((m) => m.json()).then(async (m) => {
7161
+ const o = Object.entries(m).filter(([g, { value: c }]) => c != null).reduce(
7162
+ (g, [c, { value: d }]) => (n && n[c] !== void 0 && (d = n[c]), g[c] = d, g),
6948
7163
  {
6949
7164
  ...n
6950
7165
  }
@@ -6953,10 +7168,10 @@ var H;
6953
7168
  });
6954
7169
  }
6955
7170
  h.start = e;
6956
- })(H || (H = {}));
6957
- class $ extends V {
7171
+ })(q || (q = {}));
7172
+ class mt extends Z {
6958
7173
  constructor(e) {
6959
- if (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, !(window.client instanceof M))
7174
+ if (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, !(window.client instanceof G))
6960
7175
  throw new Error("useQueue can only be instantiated after the Client is initialized.");
6961
7176
  if (!e.processor || typeof e.processor != "function")
6962
7177
  throw new Error("A valid processor function must be provided to useQueue.");
@@ -6990,7 +7205,7 @@ class $ extends V {
6990
7205
  try {
6991
7206
  await this.processor.apply(this, [e.value, this]), this.emit("process", e, this);
6992
7207
  } catch (a) {
6993
- A.error(`Error during item processing: ${a instanceof Error ? a.message : String(a)}`);
7208
+ R.error(`Error during item processing: ${a instanceof Error ? a.message : String(a)}`);
6994
7209
  }
6995
7210
  this.history.push(e);
6996
7211
  const t = e.isPriority ? this.priorityQueue : this.queue;
@@ -7013,18 +7228,18 @@ class $ extends V {
7013
7228
  }
7014
7229
  }
7015
7230
  typeof window !== void 0 && (window.addEventListener("load", () => {
7016
- window.client instanceof M && (H.queue = new $({
7231
+ window.client instanceof G && (q.queue = new mt({
7017
7232
  duration: "client",
7018
7233
  processor: async function(e) {
7019
7234
  if (window.dispatchEvent(new CustomEvent(e.listener, { detail: e.data })), e.listener === "onEventReceived" && e.session) {
7020
- const t = await H.generate.event.onSessionUpdate(client.session, y.event.parseProvider(e.data));
7235
+ const t = await q.generate.event.onSessionUpdate(client.session, y.event.parseProvider(e.data));
7021
7236
  window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: t }));
7022
7237
  }
7023
7238
  }
7024
7239
  }));
7025
7240
  }), window.addEventListener("onWidgetLoad", async (h) => {
7026
7241
  const { detail: e } = h;
7027
- if (window.client instanceof M) {
7242
+ if (window.client instanceof G) {
7028
7243
  const t = window.client;
7029
7244
  if (t.fields = e.fieldData, t.session = e.session.data, t.details = {
7030
7245
  ...t.details,
@@ -7038,25 +7253,25 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7038
7253
  }).catch(() => {
7039
7254
  t.details.provider = "local";
7040
7255
  }) : t.details.provider = "local", t.emit("load", e), t.debug) {
7041
- A.received("Widget loaded!", h.detail);
7256
+ R.received("Widget loaded!", h.detail);
7042
7257
  const a = h.detail.fieldData;
7043
- Object.keys(a).length && A.received("Field data:", a);
7258
+ Object.keys(a).length && R.received("Field data:", a);
7044
7259
  }
7045
7260
  t.loaded = !0, t.storage.on("load", (a) => {
7046
- if (t.debug && a ? A.debug("[Client]", "Storage loaded for client", `"${t.id}";`, `Provider: "${t.details.provider}";`, a) : t.debug && A.debug("[Client]", "Storage loaded for client", `"${t.id}";`, `Provider: "${t.details.provider}";`, "No data found."), a) {
7261
+ if (t.debug && a ? R.debug("[Client]", "Storage loaded for client", `"${t.id}";`, `Provider: "${t.details.provider}";`, a) : t.debug && R.debug("[Client]", "Storage loaded for client", `"${t.id}";`, `Provider: "${t.details.provider}";`, "No data found."), a) {
7047
7262
  const i = (b) => {
7048
- const g = Date.now(), r = {};
7263
+ const g = Date.now(), c = {};
7049
7264
  for (const d in b)
7050
7265
  if (b.hasOwnProperty(d)) {
7051
7266
  const f = b[d];
7052
- f.expire && f.expire > g && (r[d] = f);
7267
+ f.expire && f.expire > g && (c[d] = f);
7053
7268
  }
7054
- return r;
7055
- }, s = i(a.user || {}), n = i(a.avatar || {}), l = i(a.pronoun || {}), o = i(a.emote || {});
7269
+ return c;
7270
+ }, s = i(a.user || {}), n = i(a.avatar || {}), m = i(a.pronoun || {}), o = i(a.emote || {});
7056
7271
  t.storage.update({
7057
7272
  user: s,
7058
7273
  avatar: n,
7059
- pronoun: l,
7274
+ pronoun: m,
7060
7275
  emote: o
7061
7276
  });
7062
7277
  }
@@ -7069,12 +7284,12 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7069
7284
  }
7070
7285
  }), window.addEventListener("onSessionUpdate", (h) => {
7071
7286
  const { detail: e } = h;
7072
- if (window.client instanceof M) {
7287
+ if (window.client instanceof G) {
7073
7288
  const t = window.client;
7074
- t.session = e.session, t.emit("session", e.session), t.debug && A.debug("[Client]", "Session updated", e.session);
7289
+ t.session = e.session, t.emit("session", e.session), t.debug && R.debug("[Client]", "Session updated", e.session);
7075
7290
  }
7076
7291
  }), window.addEventListener("onEventReceived", ({ detail: h }) => {
7077
- if (window.client instanceof M) {
7292
+ if (window.client instanceof G) {
7078
7293
  const t = y.event.parseProvider(h);
7079
7294
  switch (t.provider) {
7080
7295
  case "streamelements": {
@@ -7092,7 +7307,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7092
7307
  switch (i.event.listener) {
7093
7308
  case "widget-button": {
7094
7309
  const s = i.event;
7095
- F.execute(s.field, s.value);
7310
+ it.execute(s.field, s.value);
7096
7311
  break;
7097
7312
  }
7098
7313
  case "subscriber-latest": {
@@ -7104,8 +7319,8 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7104
7319
  }
7105
7320
  case "kvstore:update": {
7106
7321
  const s = i.event;
7107
- if (q.length) {
7108
- var e = q.find((n) => n.id === s.data.key.replace("customWidget.", "") || n.id === s.data.key);
7322
+ if (tt.length) {
7323
+ var e = tt.find((n) => n.id === s.data.key.replace("customWidget.", "") || n.id === s.data.key);
7109
7324
  e && e.update(s.data.value);
7110
7325
  }
7111
7326
  break;
@@ -7135,7 +7350,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7135
7350
  break;
7136
7351
  }
7137
7352
  case "message": {
7138
- i.event, _.execute({ provider: "twitch", data: i });
7353
+ i.event, Q.execute({ provider: "twitch", data: i });
7139
7354
  break;
7140
7355
  }
7141
7356
  case "follower-latest": {
@@ -7162,7 +7377,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7162
7377
  const i = t.data;
7163
7378
  switch (i.listener) {
7164
7379
  case "message": {
7165
- i.event, _.execute({ provider: "youtube", data: i });
7380
+ i.event, Q.execute({ provider: "youtube", data: i });
7166
7381
  break;
7167
7382
  }
7168
7383
  case "subscriber-latest": {
@@ -7198,10 +7413,10 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7198
7413
  "event:test",
7199
7414
  "kvstore:update"
7200
7415
  ];
7201
- client.debug && !a.some((i) => i === t.data.listener) && A.received("[Client]", `Event ${t.data.listener} received from ${t.provider}`, t.data.event);
7416
+ client.debug && !a.some((i) => i === t.data.listener) && R.received("[Client]", `Event ${t.data.listener} received from ${t.provider}`, t.data.event);
7202
7417
  }
7203
7418
  }));
7204
- const K = {
7419
+ const nt = {
7205
7420
  getOverlayStatus: () => ({
7206
7421
  isEditorMode: !1,
7207
7422
  muted: !1
@@ -7226,7 +7441,7 @@ const K = {
7226
7441
  },
7227
7442
  store: {
7228
7443
  set: function(h, e) {
7229
- this.list[h] = e, localStorage.setItem("SE_API-STORE", JSON.stringify(K.store.list));
7444
+ this.list[h] = e, localStorage.setItem("SE_API-STORE", JSON.stringify(nt.store.list));
7230
7445
  },
7231
7446
  get: async function(h) {
7232
7447
  return this.list[h] ? this.list[h] : null;
@@ -7234,11 +7449,11 @@ const K = {
7234
7449
  list: {}
7235
7450
  }
7236
7451
  };
7237
- async function pt() {
7452
+ async function Tt() {
7238
7453
  let h = localStorage.getItem("SE_API-STORE") ?? "", e = h ? JSON.parse(h) : {};
7239
- return K.store.list = e, K;
7454
+ return nt.store.list = e, nt;
7240
7455
  }
7241
- var Y;
7456
+ var rt;
7242
7457
  ((h) => {
7243
7458
  let e;
7244
7459
  ((i) => {
@@ -7250,7 +7465,7 @@ var Y;
7250
7465
  try {
7251
7466
  const i = await fetch("https://pronouns.alejo.io/api/pronouns").then((s) => s.json());
7252
7467
  if (Array.isArray(i) && i.length) {
7253
- const s = Object.fromEntries(i.map(({ name: n, display: l }) => [n, l]));
7468
+ const s = Object.fromEntries(i.map(({ name: n, display: m }) => [n, m]));
7254
7469
  return { ...e.map, ...s };
7255
7470
  }
7256
7471
  } catch {
@@ -7275,8 +7490,8 @@ var Y;
7275
7490
  }
7276
7491
  }
7277
7492
  h.get = a;
7278
- })(Y || (Y = {}));
7279
- class ft extends V {
7493
+ })(rt || (rt = {}));
7494
+ class St extends Z {
7280
7495
  /**
7281
7496
  * Initializes a new ComfyJS instance and connects to Twitch chat.
7282
7497
  * @param options - Configuration options for ComfyJS instance.
@@ -7286,7 +7501,7 @@ class ft extends V {
7286
7501
  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) => {
7287
7502
  this.instance = a, this.emit("load", a), this.connect();
7288
7503
  }).catch((a) => {
7289
- A.error("useComfyJs: Failed to load ComfyJS", a);
7504
+ R.error("useComfyJs: Failed to load ComfyJS", a);
7290
7505
  });
7291
7506
  }
7292
7507
  /**
@@ -7306,9 +7521,9 @@ class ft extends V {
7306
7521
  */
7307
7522
  connect() {
7308
7523
  this.instance.onError = (e) => {
7309
- this.emit("error", e), client.debug && A.error("[Client]", "ComfyJS Error:", e);
7524
+ this.emit("error", e), client.debug && R.error("[Client]", "ComfyJS Error:", e);
7310
7525
  }, this.instance.onCommand = (e, t, a, i, s) => {
7311
- if (this.emit("command", e, t, a, i, s), client.debug && A.debug("[Client]", `ComfyJS Command: !${t} ${a} (User: ${e})`), this.emulate) {
7526
+ if (this.emit("command", e, t, a, i, s), client.debug && R.debug("[Client]", `ComfyJS Command: !${t} ${a} (User: ${e})`), this.emulate) {
7312
7527
  const n = {
7313
7528
  ...i,
7314
7529
  broadcaster: i.broadcaster,
@@ -7316,7 +7531,7 @@ class ft extends V {
7316
7531
  vip: i.vip,
7317
7532
  subscriber: i.subscriber,
7318
7533
  founder: i.founder
7319
- }, l = {
7534
+ }, m = {
7320
7535
  name: e,
7321
7536
  message: `!${t} ${a}`,
7322
7537
  badges: Object.entries(n).map(([o, b]) => b ? o : null).filter(Boolean),
@@ -7326,10 +7541,10 @@ class ft extends V {
7326
7541
  msgId: s.id,
7327
7542
  channel: s.channel
7328
7543
  };
7329
- H.emulate.twitch.message(l);
7544
+ q.emulate.twitch.message(m);
7330
7545
  }
7331
7546
  }, this.instance.onChat = (e, t, a, i, s) => {
7332
- if (this.emit("chat", e, t, a, i, s), client.debug && A.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
7547
+ if (this.emit("chat", e, t, a, i, s), client.debug && R.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
7333
7548
  const n = {
7334
7549
  ...a,
7335
7550
  ...s.userBadges,
@@ -7339,10 +7554,10 @@ class ft extends V {
7339
7554
  subscriber: a.subscriber,
7340
7555
  founder: a.founder
7341
7556
  };
7342
- H.emulate.twitch.message({
7557
+ q.emulate.twitch.message({
7343
7558
  name: e,
7344
7559
  message: t,
7345
- badges: Object.entries(n).map(([l, o]) => o ? l : null).filter(Boolean),
7560
+ badges: Object.entries(n).map(([m, o]) => o ? m : null).filter(Boolean),
7346
7561
  color: s.userColor,
7347
7562
  time: new Date(s.timestamp).getTime(),
7348
7563
  userId: s.userId,
@@ -7351,24 +7566,24 @@ class ft extends V {
7351
7566
  });
7352
7567
  }
7353
7568
  }, this.instance.onWhisper = (e, t, a, i, s) => {
7354
- this.emit("whisper", e, t, a, i, s), client.debug && A.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
7569
+ this.emit("whisper", e, t, a, i, s), client.debug && R.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
7355
7570
  }, this.instance.onMessageDeleted = (e, t) => {
7356
- this.emit("messageDeleted", e, t), client.debug && A.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && H.emulate.twitch.deleteMessage(e);
7571
+ this.emit("messageDeleted", e, t), client.debug && R.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && q.emulate.twitch.deleteMessage(e);
7357
7572
  }, this.instance.onJoin = (e, t, a) => {
7358
- this.emit("join", e, t, a), client.debug && A.debug("[Client]", `ComfyJS Join: ${e}`);
7573
+ this.emit("join", e, t, a), client.debug && R.debug("[Client]", `ComfyJS Join: ${e}`);
7359
7574
  }, this.instance.onPart = (e, t, a) => {
7360
- this.emit("part", e, t, a), client.debug && A.debug("[Client]", `ComfyJS Part: ${e}`);
7575
+ this.emit("part", e, t, a), client.debug && R.debug("[Client]", `ComfyJS Part: ${e}`);
7361
7576
  }, this.instance.onHosted = (e, t, a, i) => {
7362
- this.emit("hosted", e, t, a, i), client.debug && A.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
7577
+ this.emit("hosted", e, t, a, i), client.debug && R.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
7363
7578
  }, this.instance.onRaid = (e, t, a) => {
7364
- this.emit("raid", e, t, a), client.debug && A.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && H.emulate.twitch.raid({
7579
+ this.emit("raid", e, t, a), client.debug && R.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && q.emulate.twitch.raid({
7365
7580
  name: e,
7366
7581
  amount: t
7367
7582
  });
7368
7583
  }, this.instance.onSub = (e, t, a, i) => {
7369
- if (this.emit("sub", e, t, a, i), client.debug && A.debug("[Client]", `ComfyJS Sub: ${e} (${a.plan})`), this.emulate) {
7584
+ if (this.emit("sub", e, t, a, i), client.debug && R.debug("[Client]", `ComfyJS Sub: ${e} (${a.plan})`), this.emulate) {
7370
7585
  const s = a.plan === "Prime" ? "prime" : a.plan;
7371
- H.emulate.twitch.subscriber({
7586
+ q.emulate.twitch.subscriber({
7372
7587
  name: e,
7373
7588
  message: t,
7374
7589
  tier: s,
@@ -7376,32 +7591,32 @@ class ft extends V {
7376
7591
  });
7377
7592
  }
7378
7593
  }, this.instance.onResub = (e, t, a, i, s, n) => {
7379
- if (this.emit("resub", e, t, a, i, s, n), client.debug && A.debug("[Client]", `ComfyJS Resub: ${e} (${i} months)`), this.emulate) {
7380
- const l = s.plan === "Prime" ? "prime" : s.plan;
7381
- H.emulate.twitch.subscriber({
7594
+ if (this.emit("resub", e, t, a, i, s, n), client.debug && R.debug("[Client]", `ComfyJS Resub: ${e} (${i} months)`), this.emulate) {
7595
+ const m = s.plan === "Prime" ? "prime" : s.plan;
7596
+ q.emulate.twitch.subscriber({
7382
7597
  name: e,
7383
7598
  message: t,
7384
- tier: l,
7599
+ tier: m,
7385
7600
  amount: i,
7386
7601
  subType: "default"
7387
7602
  });
7388
7603
  }
7389
7604
  }, this.instance.onSubGift = (e, t, a, i, s, n) => {
7390
- if (this.emit("subGift", e, t, a, i, s, n), client.debug && A.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${i} subs`), this.emulate) {
7391
- const l = s.plan === "Prime" ? "prime" : s.plan;
7392
- H.emulate.twitch.subscriber({
7605
+ if (this.emit("subGift", e, t, a, i, s, n), client.debug && R.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${i} subs`), this.emulate) {
7606
+ const m = s.plan === "Prime" ? "prime" : s.plan;
7607
+ q.emulate.twitch.subscriber({
7393
7608
  name: a,
7394
7609
  message: "",
7395
7610
  sender: e,
7396
- tier: l,
7611
+ tier: m,
7397
7612
  amount: i,
7398
7613
  subType: "gift"
7399
7614
  });
7400
7615
  }
7401
7616
  }, this.instance.onSubMysteryGift = (e, t, a, i, s) => {
7402
- if (this.emit("subMysteryGift", e, t, a, i, s), client.debug && A.debug("[Client]", `ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`), this.emulate) {
7617
+ if (this.emit("subMysteryGift", e, t, a, i, s), client.debug && R.debug("[Client]", `ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`), this.emulate) {
7403
7618
  const n = i.plan === "Prime" ? "prime" : i.plan;
7404
- H.emulate.twitch.subscriber({
7619
+ q.emulate.twitch.subscriber({
7405
7620
  name: e,
7406
7621
  message: "",
7407
7622
  amount: t,
@@ -7410,7 +7625,7 @@ class ft extends V {
7410
7625
  });
7411
7626
  }
7412
7627
  }, this.instance.onGiftSubContinue = (e, t, a) => {
7413
- this.emit("giftSubContinue", e, t, a), client.debug && A.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`), this.emulate && H.emulate.twitch.subscriber({
7628
+ this.emit("giftSubContinue", e, t, a), client.debug && R.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`), this.emulate && q.emulate.twitch.subscriber({
7414
7629
  name: e,
7415
7630
  message: "",
7416
7631
  sender: t,
@@ -7418,23 +7633,23 @@ class ft extends V {
7418
7633
  subType: "gift"
7419
7634
  });
7420
7635
  }, this.instance.onCheer = (e, t, a, i, s) => {
7421
- this.emit("cheer", e, t, a, i, s), client.debug && A.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${a} bits - ${t}`), this.emulate && H.emulate.twitch.cheer({
7636
+ this.emit("cheer", e, t, a, i, s), client.debug && R.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${a} bits - ${t}`), this.emulate && q.emulate.twitch.cheer({
7422
7637
  name: e,
7423
7638
  message: t,
7424
7639
  amount: a
7425
7640
  });
7426
7641
  }, this.instance.onChatMode = (e, t) => {
7427
- this.emit("chatMode", e, t), client.debug && A.debug("[Client]", `ComfyJS Chat Mode Changed on ${t}`);
7642
+ this.emit("chatMode", e, t), client.debug && R.debug("[Client]", `ComfyJS Chat Mode Changed on ${t}`);
7428
7643
  }, this.instance.onReward = (e, t, a, i, s) => {
7429
- this.emit("reward", e, t, a, i, s), client.debug && A.debug("[Client]", `ComfyJS Reward: ${e} redeemed ${t} for ${a} - ${i}`);
7644
+ this.emit("reward", e, t, a, i, s), client.debug && R.debug("[Client]", `ComfyJS Reward: ${e} redeemed ${t} for ${a} - ${i}`);
7430
7645
  }, this.instance.onConnected = (e, t, a) => {
7431
- this.emit("connected", e, t, a), client.debug && A.debug("[Client]", `ComfyJS Connected: ${e}:${t} (First Connect: ${a})`);
7646
+ this.emit("connected", e, t, a), client.debug && R.debug("[Client]", `ComfyJS Connected: ${e}:${t} (First Connect: ${a})`);
7432
7647
  }, this.instance.onReconnect = (e) => {
7433
- this.emit("reconnect", e), client.debug && A.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
7648
+ this.emit("reconnect", e), client.debug && R.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
7434
7649
  }, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
7435
7650
  }
7436
7651
  }
7437
- class tt {
7652
+ class ut {
7438
7653
  constructor(e = {}) {
7439
7654
  this.error = this.apply({
7440
7655
  color: "#721c24",
@@ -7501,13 +7716,13 @@ class tt {
7501
7716
  if (!this.enabled || typeof console > "u") return;
7502
7717
  let s = "";
7503
7718
  typeof this.prefix == "function" ? s = this.prefix() : typeof this.prefix == "string" && (s = this.prefix);
7504
- const n = [], l = [];
7719
+ const n = [], m = [];
7505
7720
  if (i.forEach((o) => {
7506
- typeof o == "string" || typeof o == "number" || typeof o == "boolean" ? n.push(o) : l.push(o);
7721
+ typeof o == "string" || typeof o == "number" || typeof o == "boolean" ? n.push(o) : m.push(o);
7507
7722
  }), n.length > 0) {
7508
7723
  const o = n.join(" ");
7509
- console.log(`%c${s.endsWith(" ") ? s : s.trim() + " "}${a}${o}`, t, ...l);
7510
- } else l.length > 0 && console.log(`%c${s.endsWith(" ") ? s : s.trim() + " "}${a}`, t, ...l);
7724
+ console.log(`%c${s.endsWith(" ") ? s : s.trim() + " "}${a}${o}`, t, ...m);
7725
+ } else m.length > 0 && console.log(`%c${s.endsWith(" ") ? s : s.trim() + " "}${a}`, t, ...m);
7511
7726
  };
7512
7727
  }
7513
7728
  style(e) {
@@ -7533,21 +7748,21 @@ class tt {
7533
7748
  !this.enabled || !console.timeEnd || console.timeEnd(e);
7534
7749
  }
7535
7750
  }
7536
- const et = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(pt()), A = new tt(), Q = {
7537
- SeAPI: et,
7538
- Client: M,
7751
+ const gt = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(Tt()), R = new ut(), ht = {
7752
+ SeAPI: gt,
7753
+ Client: G,
7539
7754
  Helper: y,
7540
- Local: H,
7541
- Data: E,
7542
- logger: A,
7543
- modules: { EventProvider: V, useStorage: G, useQueue: $, useLogger: tt },
7544
- actions: { Button: F, Command: _ },
7545
- multistream: { useComfyJs: ft },
7546
- data: { usedStorages: q },
7547
- pronouns: { Alejo: Y }
7755
+ Local: q,
7756
+ Data: D,
7757
+ logger: R,
7758
+ modules: { EventProvider: Z, useStorage: et, useQueue: mt, useLogger: ut },
7759
+ actions: { Button: it, Command: Q },
7760
+ multistream: { useComfyJs: St },
7761
+ data: { usedStorages: tt },
7762
+ pronouns: { Alejo: rt }
7548
7763
  };
7549
- typeof window < "u" ? window.Tixyel = Q : globalThis.Tixyel = Q;
7764
+ typeof window < "u" ? window.Tixyel = ht : globalThis.Tixyel = ht;
7550
7765
  export {
7551
- Q as default
7766
+ ht as default
7552
7767
  };
7553
7768
  //# sourceMappingURL=index.es.js.map