@tixyel/streamelements 7.10.0 → 7.12.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
@@ -10073,6 +10073,12 @@ var j = class {
10073
10073
  let M = e.replace(f.PLACEHOLDERS, (e, t) => typeof d[t] == "string" || typeof d[t] == "number" ? String(d[t]) : t ?? t);
10074
10074
  return M = n.method === "loop" ? k(M) : A(M), M;
10075
10075
  }
10076
+ removeNewlines(e) {
10077
+ return e.replace(/\r?\n|\r/g, " ");
10078
+ }
10079
+ removeExtraSpaces(e) {
10080
+ return e.replace(/\s+/g, " ").trim();
10081
+ }
10076
10082
  }, ee = class {
10077
10083
  constructor() {
10078
10084
  this.playing = !1;
@@ -10181,93 +10187,96 @@ var j = class {
10181
10187
  }
10182
10188
  return 1;
10183
10189
  }
10184
- async identifyUser(e, t, n) {
10185
- let r = (e) => ({
10186
- gifter: n["subscriber-alltime-gifter"].name === e,
10190
+ async identifyUser(t, n, r) {
10191
+ let { getTops: i } = new e();
10192
+ switch (t) {
10193
+ case "twitch": {
10194
+ let e = n.event.data, t = !1;
10195
+ return e.tags["badge-info"]?.includes("subscriber") && (t = await this.findSubscriptionTier({
10196
+ userId: e.userId,
10197
+ name: e.displayName,
10198
+ broadcasterId: e.tags["room-id"]
10199
+ }, r ?? {}, !1)), {
10200
+ id: e.userId,
10201
+ name: e.displayName,
10202
+ color: e.displayColor,
10203
+ role: e.tags.badges.split(",")[0].split("/")[0],
10204
+ tags: e.tags.badges.split(",").map((e) => e.split("/")[0]),
10205
+ badges: e.badges,
10206
+ tier: t || void 0,
10207
+ top: i(e.displayName, r)
10208
+ };
10209
+ }
10210
+ case "youtube": {
10211
+ let e = n.event.data, t = e.authorDetails.isChatOwner ? "broadcaster" : e.authorDetails.isChatModerator ? "moderator" : e.authorDetails.isChatSponsor ? "sponsor" : e.authorDetails.isVerified ? "verified" : "viewer";
10212
+ return {
10213
+ id: e.userId,
10214
+ name: e.displayName,
10215
+ role: t,
10216
+ badges: e.badges,
10217
+ top: i(e.displayName, r)
10218
+ };
10219
+ }
10220
+ }
10221
+ }
10222
+ getTops(e, t) {
10223
+ return {
10224
+ gifter: t["subscriber-alltime-gifter"].name === e,
10187
10225
  tip: {
10188
10226
  session: {
10189
- donator: n["tip-session-top-donator"].name === e,
10190
- donation: n["tip-session-top-donation"].name === e
10227
+ donator: t["tip-session-top-donator"].name === e,
10228
+ donation: t["tip-session-top-donation"].name === e
10191
10229
  },
10192
10230
  weekly: {
10193
- donator: n["tip-weekly-top-donator"].name === e,
10194
- donation: n["tip-weekly-top-donation"].name === e
10231
+ donator: t["tip-weekly-top-donator"].name === e,
10232
+ donation: t["tip-weekly-top-donation"].name === e
10195
10233
  },
10196
10234
  monthly: {
10197
- donator: n["tip-monthly-top-donator"].name === e,
10198
- donation: n["tip-monthly-top-donation"].name === e
10235
+ donator: t["tip-monthly-top-donator"].name === e,
10236
+ donation: t["tip-monthly-top-donation"].name === e
10199
10237
  },
10200
10238
  alltime: {
10201
- donator: n["tip-alltime-top-donator"].name === e,
10202
- donation: n["tip-alltime-top-donation"].name === e
10239
+ donator: t["tip-alltime-top-donator"].name === e,
10240
+ donation: t["tip-alltime-top-donation"].name === e
10203
10241
  }
10204
10242
  },
10205
10243
  cheer: {
10206
10244
  session: {
10207
- donator: n["cheer-session-top-donator"].name === e,
10208
- amount: n["cheer-session-top-donation"].name === e
10245
+ donator: t["cheer-session-top-donator"].name === e,
10246
+ amount: t["cheer-session-top-donation"].name === e
10209
10247
  },
10210
10248
  weekly: {
10211
- donator: n["cheer-weekly-top-donator"].name === e,
10212
- amount: n["cheer-weekly-top-donation"].name === e
10249
+ donator: t["cheer-weekly-top-donator"].name === e,
10250
+ amount: t["cheer-weekly-top-donation"].name === e
10213
10251
  },
10214
10252
  monthly: {
10215
- donator: n["cheer-monthly-top-donator"].name === e,
10216
- amount: n["cheer-monthly-top-donation"].name === e
10253
+ donator: t["cheer-monthly-top-donator"].name === e,
10254
+ amount: t["cheer-monthly-top-donation"].name === e
10217
10255
  },
10218
10256
  alltime: {
10219
- donator: n["cheer-alltime-top-donator"].name === e,
10220
- amount: n["cheer-alltime-top-donation"].name === e
10257
+ donator: t["cheer-alltime-top-donator"].name === e,
10258
+ amount: t["cheer-alltime-top-donation"].name === e
10221
10259
  }
10222
10260
  },
10223
10261
  superchat: {
10224
10262
  session: {
10225
- donator: n["superchat-session-top-donator"].name === e,
10226
- amount: n["superchat-session-top-donation"].name === e
10263
+ donator: t["superchat-session-top-donator"].name === e,
10264
+ amount: t["superchat-session-top-donation"].name === e
10227
10265
  },
10228
10266
  weekly: {
10229
- donator: n["superchat-weekly-top-donator"].name === e,
10230
- amount: n["superchat-weekly-top-donation"].name === e
10267
+ donator: t["superchat-weekly-top-donator"].name === e,
10268
+ amount: t["superchat-weekly-top-donation"].name === e
10231
10269
  },
10232
10270
  monthly: {
10233
- donator: n["superchat-monthly-top-donator"].name === e,
10234
- amount: n["superchat-monthly-top-donation"].name === e
10271
+ donator: t["superchat-monthly-top-donator"].name === e,
10272
+ amount: t["superchat-monthly-top-donation"].name === e
10235
10273
  },
10236
10274
  alltime: {
10237
- donator: n["superchat-alltime-top-donator"].name === e,
10238
- amount: n["superchat-alltime-top-donation"].name === e
10275
+ donator: t["superchat-alltime-top-donator"].name === e,
10276
+ amount: t["superchat-alltime-top-donation"].name === e
10239
10277
  }
10240
10278
  }
10241
- });
10242
- switch (e) {
10243
- case "twitch": {
10244
- let e = t.event.data, i = !1;
10245
- return e.tags["badge-info"]?.includes("subscriber") && (i = await this.findSubscriptionTier({
10246
- userId: e.userId,
10247
- name: e.displayName,
10248
- broadcasterId: e.tags["room-id"]
10249
- }, n ?? {}, !1)), {
10250
- id: e.userId,
10251
- name: e.displayName,
10252
- color: e.displayColor,
10253
- role: e.tags.badges.split(",")[0].split("/")[0],
10254
- tags: e.tags.badges.split(",").map((e) => e.split("/")[0]),
10255
- badges: e.badges,
10256
- tier: i || void 0,
10257
- top: r(e.displayName)
10258
- };
10259
- }
10260
- case "youtube": {
10261
- let e = t.event.data, n = e.authorDetails.isChatOwner ? "broadcaster" : e.authorDetails.isChatModerator ? "moderator" : e.authorDetails.isChatSponsor ? "sponsor" : e.authorDetails.isVerified ? "verified" : "viewer";
10262
- return {
10263
- id: e.userId,
10264
- name: e.displayName,
10265
- role: n,
10266
- badges: e.badges,
10267
- top: r(e.displayName)
10268
- };
10269
- }
10270
- }
10279
+ };
10271
10280
  }
10272
10281
  identifyMessage(e, t, n) {
10273
10282
  let r = /<img[^>]*class="emote"[^>]*>/gi;
@@ -10425,7 +10434,19 @@ var j = class {
10425
10434
  label: a.capitalize(d),
10426
10435
  value: l
10427
10436
  };
10428
- else if ([
10437
+ else if (["gradient"].some((e) => n.endsWith(e))) {
10438
+ let t = l.match(ae);
10439
+ t && (e[`${n}-gradient`] = {
10440
+ type: "hidden",
10441
+ label: "• Gradient colors"
10442
+ }, t.forEach((t, r) => {
10443
+ e[`${n}-gradient-${r}`] = {
10444
+ type: "colorpicker",
10445
+ label: a.capitalize(d) + ` ${s.translate(r + 1, "suffix")} color`,
10446
+ value: t
10447
+ };
10448
+ }));
10449
+ } else if ([
10429
10450
  "size",
10430
10451
  "width",
10431
10452
  "height",
@@ -10457,11 +10478,15 @@ var j = class {
10457
10478
  800: "Extra Bold 800",
10458
10479
  900: "Black 900"
10459
10480
  }
10460
- } : n.endsWith("font-family") && (e[n] = {
10481
+ } : n.endsWith("font-family") ? e[n] = {
10461
10482
  type: "googleFont",
10462
10483
  label: a.capitalize(d),
10463
10484
  value: l.split(",")[0].trim().replaceAll("'", "")
10464
- });
10485
+ } : e[n] = {
10486
+ type: "text",
10487
+ label: a.capitalize(d),
10488
+ value: String(l)
10489
+ };
10465
10490
  break;
10466
10491
  case "value":
10467
10492
  if (o.validate(l)) e[n] = {
@@ -10471,16 +10496,16 @@ var j = class {
10471
10496
  };
10472
10497
  else if (l.startsWith("linear-gradient(") || l.startsWith("radial-gradient(")) {
10473
10498
  let t = l.match(ae);
10474
- t && t.forEach((t, r) => {
10475
- e[`${n}-gradient`] = {
10476
- type: "hidden",
10477
- label: "• Gradient colors"
10478
- }, e[`${n}-gradient-${r}`] = {
10499
+ t && (e[`${n}-gradient`] = {
10500
+ type: "hidden",
10501
+ label: "• Gradient colors"
10502
+ }, t.forEach((t, r) => {
10503
+ e[`${n}-gradient-${r}`] = {
10479
10504
  type: "colorpicker",
10480
10505
  label: a.capitalize(d) + ` ${s.translate(r + 1, "suffix")} color`,
10481
10506
  value: t
10482
10507
  };
10483
- });
10508
+ }));
10484
10509
  } else if (l.endsWith("px")) {
10485
10510
  var f = c[n + "-min"] ? parseFloat(c[n + "-min"]) : void 0, p = c[n + "-max"] ? parseFloat(c[n + "-max"]) : void 0, m = c[n + "-step"] ? parseFloat(c[n + "-step"]) : void 0;
10486
10511
  e[n] = {
@@ -10504,7 +10529,7 @@ var j = class {
10504
10529
  } else if (isNaN(parseFloat(l))) e[n] = {
10505
10530
  type: "text",
10506
10531
  label: a.capitalize(d),
10507
- value: l
10532
+ value: String(l)
10508
10533
  };
10509
10534
  else {
10510
10535
  var f = c[n + "-min"] ? parseFloat(c[n + "-min"]) : void 0, p = c[n + "-max"] ? parseFloat(c[n + "-max"]) : void 0, m = c[n + "-step"] ? parseFloat(c[n + "-step"]) : void 0;