@applemusic-like-lyrics/core 0.0.13 → 0.0.14

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.
@@ -1,124 +1,16 @@
1
- import { Container as z } from "@pixi/display";
2
- import { Application as A } from "@pixi/app";
1
+ import { Container as C } from "@pixi/display";
2
+ import { Application as z } from "@pixi/app";
3
3
  import { BlurFilter as y } from "@pixi/filter-blur";
4
- import { ColorMatrixFilter as v } from "@pixi/filter-color-matrix";
4
+ import { ColorMatrixFilter as P } from "@pixi/filter-color-matrix";
5
5
  import { Texture as I } from "@pixi/core";
6
6
  import { Sprite as S } from "@pixi/sprite";
7
- import { BulgePinchFilter as E } from "@pixi/filter-bulge-pinch";
8
- import { create as D } from "jss";
9
- import k from "jss-preset-default";
10
- const B = /^(((?<hour>[0-9]+):)?(?<min>[0-9]+):)?(?<sec>[0-9]+([\.:]([0-9]+))?)/;
11
- function T(h) {
12
- const e = B.exec(h);
13
- if (e) {
14
- const t = Number(e.groups?.hour || "0"), i = Number(e.groups?.min || "0"), s = Number(e.groups?.sec.replace(/:/, ".") || "0");
15
- return Math.floor((t * 3600 + i * 60 + s) * 1e3);
16
- } else
17
- throw new TypeError("时间戳字符串解析失败");
18
- }
19
- function $(h) {
20
- const t = new DOMParser().parseFromString(
21
- h,
22
- "application/xml"
23
- );
24
- let i = "v1";
25
- for (const r of t.querySelectorAll("ttm\\:agent"))
26
- if (r.getAttribute("type") === "person") {
27
- const n = r.getAttribute("xml:id");
28
- n && (i = n);
29
- }
30
- const s = [];
31
- for (const r of t.querySelectorAll("body p[begin][end]")) {
32
- const n = {
33
- words: [],
34
- startTime: T(r.getAttribute("begin") ?? "0:0"),
35
- endTime: T(r.getAttribute("end") ?? "0:0"),
36
- translatedLyric: "",
37
- romanLyric: "",
38
- isBG: !1,
39
- isDuet: r.getAttribute("ttm:agent") !== i
40
- };
41
- let a = null;
42
- for (const l of r.childNodes)
43
- if (l.nodeType === Node.TEXT_NODE) {
44
- const o = l.textContent ?? "";
45
- /^(\s+)$/.test(o) ? n.words.push({
46
- word: " ",
47
- startTime: 0,
48
- endTime: 0
49
- }) : n.words.push({
50
- word: o,
51
- startTime: 0,
52
- endTime: 0
53
- });
54
- } else if (l.nodeType === Node.ELEMENT_NODE) {
55
- const o = l, c = o.getAttribute("ttm:role");
56
- if (o.nodeName === "span" && c)
57
- if (c === "x-bg") {
58
- const m = {
59
- words: [],
60
- startTime: n.startTime,
61
- endTime: n.endTime,
62
- translatedLyric: "",
63
- romanLyric: "",
64
- isBG: !0,
65
- isDuet: n.isDuet
66
- };
67
- for (const p of o.childNodes)
68
- if (p.nodeType === Node.TEXT_NODE) {
69
- const d = p.textContent ?? "";
70
- /^(\s+)$/.test(d) ? m.words.push({
71
- word: " ",
72
- startTime: 0,
73
- endTime: 0
74
- }) : m.words.push({
75
- word: d,
76
- startTime: 0,
77
- endTime: 0
78
- });
79
- } else if (p.nodeType === Node.ELEMENT_NODE) {
80
- const d = p, g = d.getAttribute("ttm:role");
81
- if (d.nodeName === "span" && g)
82
- g === "x-translation" ? m.translatedLyric = d.innerHTML.trim() : g === "x-roman" && (m.romanLyric = d.innerHTML.trim());
83
- else if (d.hasAttribute("begin") && d.hasAttribute("end")) {
84
- const b = {
85
- word: p.textContent,
86
- startTime: T(d.getAttribute("begin")),
87
- endTime: T(d.getAttribute("end"))
88
- };
89
- m.words.push(b);
90
- }
91
- }
92
- const u = m.words[0];
93
- m.startTime = u.startTime, u?.word.startsWith("(") && (u.word = u.word.substring(1));
94
- const f = m.words[m.words.length - 1];
95
- m.endTime = f.endTime, f?.word.endsWith(")") && (f.word = f.word.substring(
96
- 0,
97
- f.word.length - 1
98
- )), a = m;
99
- } else
100
- c === "x-translation" ? n.translatedLyric = o.innerHTML : c === "x-roman" && (n.romanLyric = o.innerHTML);
101
- else if (o.hasAttribute("begin") && o.hasAttribute("end")) {
102
- const m = {
103
- word: l.textContent ?? "",
104
- startTime: T(o.getAttribute("begin")),
105
- endTime: T(o.getAttribute("end"))
106
- };
107
- n.words.push(m);
108
- }
109
- }
110
- s.push(n), a && s.push(a);
111
- }
112
- return s;
113
- }
114
- const ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
115
- __proto__: null,
116
- parseTTML: $
117
- }, Symbol.toStringTag, { value: "Module" }));
118
- class O extends z {
7
+ import { BulgePinchFilter as b } from "@pixi/filter-bulge-pinch";
8
+ import { create as k } from "jss";
9
+ import D from "jss-preset-default";
10
+ class A extends C {
119
11
  time = 0;
120
12
  }
121
- class W {
13
+ class B {
122
14
  constructor(e) {
123
15
  this.canvas = e;
124
16
  const t = e.getBoundingClientRect();
@@ -128,12 +20,12 @@ class W {
128
20
  this.canvas.width * this.currerntRenderScale,
129
21
  this.canvas.height * this.currerntRenderScale
130
22
  ), this.app.ticker.start(), this.rebuildFilters();
131
- }), this.observer.observe(e), this.app = new A({
23
+ }), this.observer.observe(e), this.app = new z({
132
24
  view: e,
133
25
  resizeTo: this.canvas,
134
26
  powerPreference: "low-power",
135
27
  backgroundAlpha: 0
136
- }), this.rebuildFilters(), this.app.ticker.add(this.onTick), this.app.ticker.start();
28
+ }), this.rebuildFilters(), this.app.ticker.maxFPS = 30, this.app.ticker.add(this.onTick), this.app.ticker.start();
137
29
  }
138
30
  observer;
139
31
  app;
@@ -179,33 +71,33 @@ class W {
179
71
  ), this.rebuildFilters();
180
72
  }
181
73
  rebuildFilters() {
182
- const e = Math.min(this.canvas.width, this.canvas.height), t = Math.max(this.canvas.width, this.canvas.height), i = new v();
74
+ const e = Math.min(this.canvas.width, this.canvas.height), t = Math.max(this.canvas.width, this.canvas.height), i = new P();
183
75
  i.saturate(1.2, !1);
184
- const s = new v();
76
+ const s = new P();
185
77
  s.brightness(0.6, !1);
186
- const r = new v();
78
+ const r = new P();
187
79
  r.contrast(0.3, !0), this.app.stage.filters?.forEach((n) => {
188
80
  n.destroy();
189
81
  }), this.app.stage.filters = [], this.app.stage.filters.push(new y(5, 1)), this.app.stage.filters.push(new y(10, 1)), this.app.stage.filters.push(new y(20, 2)), this.app.stage.filters.push(new y(40, 2)), this.app.stage.filters.push(new y(80, 2)), e > 768 && this.app.stage.filters.push(new y(160, 4)), e > 768 * 2 && this.app.stage.filters.push(new y(320, 4)), this.app.stage.filters.push(i, s, r), this.app.stage.filters.push(new y(5, 1)), Math.random() > 0.5 ? (this.app.stage.filters.push(
190
- new E({
82
+ new b({
191
83
  radius: (t + e) / 2,
192
84
  strength: 1,
193
85
  center: [0.25, 1]
194
86
  })
195
87
  ), this.app.stage.filters.push(
196
- new E({
88
+ new b({
197
89
  radius: (t + e) / 2,
198
90
  strength: 1,
199
91
  center: [0.75, 0]
200
92
  })
201
93
  )) : (this.app.stage.filters.push(
202
- new E({
94
+ new b({
203
95
  radius: (t + e) / 2,
204
96
  strength: 1,
205
97
  center: [0.75, 1]
206
98
  })
207
99
  ), this.app.stage.filters.push(
208
- new E({
100
+ new b({
209
101
  radius: (t + e) / 2,
210
102
  strength: 1,
211
103
  center: [0.25, 0]
@@ -264,18 +156,18 @@ class W {
264
156
  }
265
157
  if (!s)
266
158
  return;
267
- const r = new O(), n = new S(s), a = new S(s), l = new S(s), o = new S(s);
268
- n.anchor.set(0.5, 0.5), a.anchor.set(0.5, 0.5), l.anchor.set(0.5, 0.5), o.anchor.set(0.5, 0.5), n.rotation = Math.random() * Math.PI * 2, a.rotation = Math.random() * Math.PI * 2, l.rotation = Math.random() * Math.PI * 2, o.rotation = Math.random() * Math.PI * 2, r.addChild(n, a, l, o), this.curContainer && this.lastContainer.add(this.curContainer), this.curContainer = r, this.app.stage.addChild(this.curContainer), this.curContainer.alpha = 0, this.app.ticker.start();
159
+ const r = new A(), n = new S(s), a = new S(s), h = new S(s), l = new S(s);
160
+ n.anchor.set(0.5, 0.5), a.anchor.set(0.5, 0.5), h.anchor.set(0.5, 0.5), l.anchor.set(0.5, 0.5), n.rotation = Math.random() * Math.PI * 2, a.rotation = Math.random() * Math.PI * 2, h.rotation = Math.random() * Math.PI * 2, l.rotation = Math.random() * Math.PI * 2, r.addChild(n, a, h, l), this.curContainer && this.lastContainer.add(this.curContainer), this.curContainer = r, this.app.stage.addChild(this.curContainer), this.curContainer.alpha = 0, this.app.ticker.start();
269
161
  }
270
162
  dispose() {
271
163
  this.observer.disconnect(), this.app.ticker.remove(this.onTick), this.app.destroy(!0);
272
164
  }
273
165
  }
274
- class oe extends W {
166
+ class se extends B {
275
167
  element;
276
168
  constructor() {
277
169
  const e = document.createElement("canvas");
278
- super(e), this.element = e, e.style.pointerEvents = "none", e.style.zIndex = "-1";
170
+ super(e), this.element = e, e.style.pointerEvents = "none", e.style.zIndex = "-1", e.style.contain = "strict";
279
171
  }
280
172
  getElement() {
281
173
  return this.element;
@@ -284,8 +176,8 @@ class oe extends W {
284
176
  super.dispose(), this.element.remove();
285
177
  }
286
178
  }
287
- const N = (h, e) => h.size === e.size && [...h].every((t) => e.has(t));
288
- class w {
179
+ const $ = (o, e) => o.size === e.size && [...o].every((t) => e.has(t));
180
+ class L {
289
181
  currentPosition = 0;
290
182
  targetPosition = 0;
291
183
  currentTime = 0;
@@ -300,13 +192,13 @@ class w {
300
192
  }
301
193
  resetSolver() {
302
194
  const e = this.getV(this.currentTime);
303
- this.currentTime = 0, this.currentSolver = q(
195
+ this.currentTime = 0, this.currentSolver = F(
304
196
  this.currentPosition,
305
197
  e,
306
198
  this.targetPosition,
307
199
  0,
308
200
  this.params
309
- ), this.getV = M(this.currentSolver), this.getV2 = M(this.getV);
201
+ ), this.getV = x(this.currentSolver), this.getV2 = x(this.getV);
310
202
  }
311
203
  arrived() {
312
204
  return Math.abs(this.targetPosition - this.currentPosition) < 0.01 && this.getV(this.currentTime) < 0.01 && this.getV2(this.currentTime) < 0.01 && this.queueParams === void 0 && this.queuePosition === void 0;
@@ -340,25 +232,25 @@ class w {
340
232
  return this.currentPosition;
341
233
  }
342
234
  }
343
- function q(h, e, t, i = 0, s) {
344
- const r = s?.soft ?? !1, n = s?.stiffness ?? 100, a = s?.damping ?? 10, l = s?.mass ?? 1, o = t - h;
345
- if (r || 1 <= a / (2 * Math.sqrt(n * l))) {
346
- const c = -Math.sqrt(n / l), m = -c * o - e;
347
- return (u) => (u -= i, u < 0 ? h : t - (o + u * m) * Math.E ** (u * c));
235
+ function F(o, e, t, i = 0, s) {
236
+ const r = s?.soft ?? !1, n = s?.stiffness ?? 100, a = s?.damping ?? 10, h = s?.mass ?? 1, l = t - o;
237
+ if (r || 1 <= a / (2 * Math.sqrt(n * h))) {
238
+ const c = -Math.sqrt(n / h), p = -c * l - e;
239
+ return (u) => (u -= i, u < 0 ? o : t - (l + u * p) * Math.E ** (u * c));
348
240
  } else {
349
241
  const c = Math.sqrt(
350
- 4 * l * n - a ** 2
351
- ), m = (a * o - 2 * l * e) / c, u = 0.5 * c / l, f = -(0.5 * a) / l;
352
- return (p) => (p -= i, p < 0 ? h : t - (Math.cos(p * u) * o + Math.sin(p * u) * m) * Math.E ** (p * f));
242
+ 4 * h * n - a ** 2
243
+ ), p = (a * l - 2 * h * e) / c, u = 0.5 * c / h, f = -(0.5 * a) / h;
244
+ return (d) => (d -= i, d < 0 ? o : t - (Math.cos(d * u) * l + Math.sin(d * u) * p) * Math.E ** (d * f));
353
245
  }
354
246
  }
355
- function F(h) {
356
- return (t) => (h(t + 1e-3) - h(t - 1e-3)) / (2 * 1e-3);
247
+ function _(o) {
248
+ return (t) => (o(t + 1e-3) - o(t - 1e-3)) / (2 * 1e-3);
357
249
  }
358
- function M(h) {
359
- return F(h);
250
+ function x(o) {
251
+ return _(o);
360
252
  }
361
- class R {
253
+ class O {
362
254
  constructor(e) {
363
255
  this.lyricPlayer = e, this.element.setAttribute(
364
256
  "class",
@@ -372,8 +264,8 @@ class R {
372
264
  // 由 LyricPlayer 来设置
373
265
  lineSize = [0, 0];
374
266
  lineTransforms = {
375
- posX: new w(0),
376
- posY: new w(0)
267
+ posX: new L(0),
268
+ posY: new L(0)
377
269
  };
378
270
  measureSize() {
379
271
  return [
@@ -389,7 +281,7 @@ class R {
389
281
  this.rebuildStyle();
390
282
  }
391
283
  rebuildStyle() {
392
- let e = `transform:translate(${this.lineTransforms.posX.getCurrentPosition()}px,${this.lineTransforms.posY.getCurrentPosition()}px);`;
284
+ let e = `transform:translate(${this.lineTransforms.posX.getCurrentPosition().toFixed(2)}px,${this.lineTransforms.posY.getCurrentPosition().toFixed(2)}px);`;
393
285
  !this.lyricPlayer.getEnableSpring() && this.isInSight && (e += `transition-delay:${this.delay}ms;`), e !== this.lastStyle && (this.lastStyle = e, this.element.setAttribute("style", e));
394
286
  }
395
287
  getElement() {
@@ -415,12 +307,12 @@ class R {
415
307
  this.element.remove();
416
308
  }
417
309
  }
418
- function _(h) {
310
+ function W(o) {
419
311
  const t = 2.5949095;
420
- return h < 0.5 ? Math.pow(2 * h, 2) * ((t + 1) * 2 * h - t) / 2 : (Math.pow(2 * h - 2, 2) * ((t + 1) * (h * 2 - 2) + t) + 2) / 2;
312
+ return o < 0.5 ? Math.pow(2 * o, 2) * ((t + 1) * 2 * o - t) / 2 : (Math.pow(2 * o - 2, 2) * ((t + 1) * (o * 2 - 2) + t) + 2) / 2;
421
313
  }
422
- const L = (h, e, t) => Math.max(h, Math.min(e, t));
423
- class X {
314
+ const g = (o, e, t) => Math.max(o, Math.min(e, t));
315
+ class q {
424
316
  constructor(e) {
425
317
  this.lyricPlayer = e, this.element.className = this.lyricPlayer.style.classes.interludeDots, this.element.appendChild(this.dot0), this.element.appendChild(this.dot1), this.element.appendChild(this.dot2);
426
318
  }
@@ -447,40 +339,42 @@ class X {
447
339
  update(e = 0) {
448
340
  this.currentTime += e;
449
341
  let t = "";
450
- if (t += `transform:translate(${this.left}px, ${this.top}px)`, this.currentInterlude) {
342
+ if (t += `transform:translate(${this.left.toFixed(
343
+ 2
344
+ )}px, ${this.top.toFixed(2)}px)`, this.currentInterlude) {
451
345
  const i = this.currentInterlude[1] - this.currentInterlude[0], s = this.currentTime - this.currentInterlude[0];
452
346
  if (s <= i) {
453
347
  const r = i / Math.ceil(i / this.targetBreatheDuration);
454
348
  let n = 1, a = 1;
455
- n *= Math.sin(1.5 * Math.PI - s / r * 2) / 10 + 1, s < 1e3 && (n *= 1 - Math.pow((1e3 - s) / 1e3, 2)), s < 500 ? a = 0 : s < 1e3 && (a *= (s - 500) / 500), i - s < 750 && (n *= 1 - _(
349
+ n *= Math.sin(1.5 * Math.PI - s / r * 2) / 10 + 1, s < 1e3 && (n *= 1 - Math.pow((1e3 - s) / 1e3, 2)), s < 500 ? a = 0 : s < 1e3 && (a *= (s - 500) / 500), i - s < 750 && (n *= 1 - W(
456
350
  (750 - (i - s)) / 750 / 2
457
- )), i - s < 375 && (a *= L(
351
+ )), i - s < 375 && (a *= g(
458
352
  0,
459
353
  (i - s) / 375,
460
354
  1
461
355
  )), n = Math.max(0, n), t += ` scale(${n})`;
462
- const l = L(
356
+ const h = g(
463
357
  0.25,
464
358
  s * 3 / i * 0.75,
465
359
  1
466
- ), o = L(
360
+ ), l = g(
467
361
  0.25,
468
362
  (s - i / 3) * 3 / i * 0.75,
469
363
  1
470
- ), c = L(
364
+ ), c = g(
471
365
  0.25,
472
366
  (s - i / 3 * 2) * 3 / i * 0.75,
473
367
  1
474
368
  );
475
- this.dot0.style.opacity = `${L(
369
+ this.dot0.style.opacity = `${g(
476
370
  0,
477
- Math.max(0, a * l),
371
+ Math.max(0, a * h),
478
372
  1
479
- )}`, this.dot1.style.opacity = `${L(
373
+ )}`, this.dot1.style.opacity = `${g(
480
374
  0,
481
- Math.max(0, a * o),
375
+ Math.max(0, a * l),
482
376
  1
483
- )}`, this.dot2.style.opacity = `${L(
377
+ )}`, this.dot2.style.opacity = `${g(
484
378
  0,
485
379
  Math.max(0, a * c),
486
380
  1
@@ -495,33 +389,33 @@ class X {
495
389
  this.element.remove();
496
390
  }
497
391
  }
498
- const Y = /^[\p{Unified_Ideograph}\u0800-\u9FFC]+$/u;
499
- function G(h, e = "rgba(0,0,0,1)", t = "rgba(0,0,0,0.5)") {
500
- const i = 2 + h, s = h / i, r = (1 - s) / 2;
392
+ const R = /^[\p{Unified_Ideograph}\u0800-\u9FFC]+$/u;
393
+ function Y(o, e = "rgba(0,0,0,1)", t = "rgba(0,0,0,0.5)") {
394
+ const i = 2 + o, s = o / i, r = (1 - s) / 2;
501
395
  return [
502
396
  `linear-gradient(to right,${e} ${r * 100}%,${t} ${(r + s) * 100}%)`,
503
397
  s,
504
398
  i
505
399
  ];
506
400
  }
507
- function V(h, e) {
401
+ function X(o, e) {
508
402
  let t = [], i = [];
509
403
  const s = [];
510
- for (const r of h) {
404
+ for (const r of o) {
511
405
  const n = e(r);
512
- t.push(n), i.push(r), n.length > 0 && n.trim().length === 0 ? (t.pop(), i.pop(), i.length === 1 ? s.push(i[0]) : i.length > 1 && s.push(i), s.push(r), t = [], i = []) : (!/^\s*[^\s]*\s*$/.test(t.join("")) || Y.test(n)) && (t.pop(), i.pop(), i.length === 1 ? s.push(i[0]) : i.length > 1 && s.push(i), t = [n], i = [r]);
406
+ t.push(n), i.push(r), n.length > 0 && n.trim().length === 0 ? (t.pop(), i.pop(), i.length === 1 ? s.push(i[0]) : i.length > 1 && s.push(i), s.push(r), t = [], i = []) : (!/^\s*[^\s]*\s*$/.test(t.join("")) || R.test(n)) && (t.pop(), i.pop(), i.length === 1 ? s.push(i[0]) : i.length > 1 && s.push(i), t = [n], i = [r]);
513
407
  }
514
408
  return i.length === 1 ? s.push(i[0]) : s.push(i), s;
515
409
  }
516
- function x(h) {
517
- return h.endTime - h.startTime >= 1e3 && h.word.length <= 7;
410
+ function v(o) {
411
+ return o.endTime - o.startTime >= 1e3 && o.word.length <= 7;
518
412
  }
519
- class H extends MouseEvent {
413
+ class G extends MouseEvent {
520
414
  constructor(e, t) {
521
415
  super(t.type, t), this.line = e;
522
416
  }
523
417
  }
524
- class j extends EventTarget {
418
+ class V extends EventTarget {
525
419
  // rome-ignore lint/correctness/noUnreachableSuper: <explanation>
526
420
  constructor(e, t = {
527
421
  words: [],
@@ -532,7 +426,7 @@ class j extends EventTarget {
532
426
  isBG: !1,
533
427
  isDuet: !1
534
428
  }) {
535
- super(), this.lyricPlayer = e, this.lyricLine = t, this.element.setAttribute(
429
+ super(), this.lyricPlayer = e, this.lyricLine = t, this._prevParentEl = e.getElement(), this.element.setAttribute(
536
430
  "class",
537
431
  this.lyricPlayer.style.classes.lyricLine
538
432
  ), this.lyricLine.isBG && this.element.classList.add(this.lyricPlayer.style.classes.lyricBgLine), this.lyricLine.isDuet && this.element.classList.add(this.lyricPlayer.style.classes.lyricDuetLine), this.element.appendChild(document.createElement("div")), this.element.appendChild(document.createElement("div")), this.element.appendChild(document.createElement("div"));
@@ -549,13 +443,13 @@ class j extends EventTarget {
549
443
  // 由 LyricPlayer 来设置
550
444
  lineSize = [0, 0];
551
445
  lineTransforms = {
552
- posX: new w(0),
553
- posY: new w(0),
554
- scale: new w(1)
446
+ posX: new L(0),
447
+ posY: new L(0),
448
+ scale: new L(1)
555
449
  };
556
450
  listenersMap = /* @__PURE__ */ new Map();
557
451
  onMouseEvent = (e) => {
558
- if (!this.dispatchEvent(new H(this, e)))
452
+ if (!this.dispatchEvent(new G(this, e)))
559
453
  return e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), !1;
560
454
  };
561
455
  addEventListener(e, t, i) {
@@ -581,12 +475,12 @@ class j extends EventTarget {
581
475
  }), e.classList.add("active");
582
476
  }
583
477
  measureSize() {
584
- this._hide && (this.element.style.display = "", this.element.style.visibility = "hidden");
478
+ this._hide && (this._prevParentEl && this._prevParentEl.appendChild(this.element), this.element.style.display = "", this.element.style.visibility = "hidden");
585
479
  const e = [
586
480
  this.element.clientWidth,
587
481
  this.element.clientHeight
588
482
  ];
589
- return this._hide && (this.element.style.display = "none", this.element.style.visibility = ""), e;
483
+ return this._hide && (this._prevParentEl && this.element.remove(), this.element.style.display = "none", this.element.style.visibility = ""), e;
590
484
  }
591
485
  disable() {
592
486
  this.isEnabled = !1, this.element.classList.remove("active");
@@ -606,12 +500,13 @@ class j extends EventTarget {
606
500
  return this.lyricLine;
607
501
  }
608
502
  _hide = !0;
503
+ _prevParentEl = null;
609
504
  lastStyle = "";
610
505
  show() {
611
- this._hide = !1, this.rebuildStyle();
506
+ this._hide = !1, this._prevParentEl && (this._prevParentEl.appendChild(this.element), this._prevParentEl = null), this.rebuildStyle();
612
507
  }
613
508
  hide() {
614
- this._hide = !0, this.rebuildStyle();
509
+ this._hide = !0, this.element.parentElement && (this._prevParentEl = this.element.parentElement, this.element.remove()), this.rebuildStyle();
615
510
  }
616
511
  rebuildStyle() {
617
512
  if (this._hide) {
@@ -621,7 +516,7 @@ class j extends EventTarget {
621
516
  ));
622
517
  return;
623
518
  }
624
- let e = `transform:translate(${this.lineTransforms.posX.getCurrentPosition()}px,${this.lineTransforms.posY.getCurrentPosition()}px) scale(${this.lineTransforms.scale.getCurrentPosition()});`;
519
+ let e = `transform:translate(${this.lineTransforms.posX.getCurrentPosition().toFixed(2)}px,${this.lineTransforms.posY.getCurrentPosition().toFixed(2)}px) scale(${this.lineTransforms.scale.getCurrentPosition().toFixed(4)});`;
625
520
  !this.lyricPlayer.getEnableSpring() && this.isInSight && (e += `transition-delay:${this.delay}ms;`), e += `filter:blur(${Math.min(32, this.blur)}px);`, e !== this.lastStyle && (this.lastStyle = e, this.element.setAttribute("style", e));
626
521
  }
627
522
  rebuildElement() {
@@ -630,31 +525,31 @@ class j extends EventTarget {
630
525
  e.innerText = this.lyricLine.words.map((r) => r.word).join(""), t.innerText = this.lyricLine.translatedLyric, i.innerText = this.lyricLine.romanLyric;
631
526
  return;
632
527
  }
633
- const s = V(this.lyricLine.words, (r) => r.word);
528
+ const s = X(this.lyricLine.words, (r) => r.word);
634
529
  e.innerHTML = "", this.splittedWords = [];
635
530
  for (const r of s)
636
531
  if (r instanceof Array) {
637
- const n = r.map((o) => x(o)).reduce((o, c) => o || c, !1), a = r.reduce(
638
- (o, c) => (o.endTime = Math.max(o.endTime, c.endTime), o.startTime = Math.min(o.startTime, c.startTime), o.word += c.word, o),
532
+ const n = r.map((l) => v(l)).reduce((l, c) => l || c, !1), a = r.reduce(
533
+ (l, c) => (l.endTime = Math.max(l.endTime, c.endTime), l.startTime = Math.min(l.startTime, c.startTime), l.word += c.word, l),
639
534
  { word: "", startTime: 1 / 0, endTime: -1 / 0 }
640
- ), l = document.createElement("span");
641
- for (const o of r) {
642
- const c = document.createElement("span"), m = this.initFloatAnimation(
535
+ ), h = document.createElement("span");
536
+ for (const l of r) {
537
+ const c = document.createElement("span"), p = this.initFloatAnimation(
643
538
  a,
644
539
  c
645
540
  );
646
541
  if (n) {
647
542
  c.classList.add("emphasize");
648
543
  const u = [];
649
- for (const p of o.word.trim().split("")) {
650
- const d = document.createElement("span");
651
- d.innerText = p, u.push(d), c.appendChild(d);
544
+ for (const d of l.word.trim().split("")) {
545
+ const m = document.createElement("span");
546
+ m.innerText = d, u.push(m), c.appendChild(m);
652
547
  }
653
548
  const f = {
654
- ...o,
549
+ ...l,
655
550
  mainElement: c,
656
551
  subElements: u,
657
- elementAnimations: [m],
552
+ elementAnimations: [p],
658
553
  width: 0,
659
554
  height: 0,
660
555
  shouldEmphasize: n
@@ -663,22 +558,22 @@ class j extends EventTarget {
663
558
  ...this.initEmphasizeAnimation(f)
664
559
  ), this.splittedWords.push(f);
665
560
  } else
666
- c.innerText = o.word, this.splittedWords.push({
667
- ...o,
561
+ c.innerText = l.word, this.splittedWords.push({
562
+ ...l,
668
563
  mainElement: c,
669
564
  subElements: [],
670
- elementAnimations: [m],
565
+ elementAnimations: [p],
671
566
  width: 0,
672
567
  height: 0,
673
568
  shouldEmphasize: n
674
569
  });
675
- l.appendChild(c);
570
+ h.appendChild(c);
676
571
  }
677
- a.word.trimStart() !== a.word && e.appendChild(document.createTextNode(" ")), e.appendChild(l), a.word.trimEnd() !== a.word && e.appendChild(document.createTextNode(" "));
572
+ a.word.trimStart() !== a.word && e.appendChild(document.createTextNode(" ")), e.appendChild(h), a.word.trimEnd() !== a.word && e.appendChild(document.createTextNode(" "));
678
573
  } else if (r.word.trim().length === 0)
679
574
  e.appendChild(document.createTextNode(" "));
680
575
  else {
681
- const n = x(r), a = document.createElement("span"), l = {
576
+ const n = v(r), a = document.createElement("span"), h = {
682
577
  ...r,
683
578
  mainElement: a,
684
579
  subElements: [],
@@ -689,17 +584,17 @@ class j extends EventTarget {
689
584
  };
690
585
  if (n) {
691
586
  a.classList.add("emphasize");
692
- const o = [];
587
+ const l = [];
693
588
  for (const c of r.word.trim().split("")) {
694
- const m = document.createElement("span");
695
- m.innerText = c, o.push(m), a.appendChild(m);
589
+ const p = document.createElement("span");
590
+ p.innerText = c, l.push(p), a.appendChild(p);
696
591
  }
697
- l.subElements = o, l.elementAnimations.push(
698
- ...this.initEmphasizeAnimation(l)
592
+ h.subElements = l, h.elementAnimations.push(
593
+ ...this.initEmphasizeAnimation(h)
699
594
  );
700
595
  } else
701
596
  a.innerText = r.word.trim();
702
- r.word.trimStart() !== r.word && e.appendChild(document.createTextNode(" ")), e.appendChild(a), r.word.trimEnd() !== r.word && e.appendChild(document.createTextNode(" ")), this.splittedWords.push(l);
597
+ r.word.trimStart() !== r.word && e.appendChild(document.createTextNode(" ")), e.appendChild(a), r.word.trimEnd() !== r.word && e.appendChild(document.createTextNode(" ")), this.splittedWords.push(h);
703
598
  }
704
599
  t.innerText = this.lyricLine.translatedLyric, i.innerText = this.lyricLine.romanLyric;
705
600
  }
@@ -726,7 +621,7 @@ class j extends EventTarget {
726
621
  initEmphasizeAnimation(e) {
727
622
  const t = e.startTime - this.lyricLine.startTime, i = e.endTime - e.startTime;
728
623
  return e.subElements.map((s, r, n) => {
729
- const a = Math.max(1e3, e.endTime - e.startTime), l = t + i / n.length * r, o = s.animate(
624
+ const a = Math.max(1e3, e.endTime - e.startTime), h = t + i / n.length * r, l = s.animate(
730
625
  [
731
626
  {
732
627
  offset: 0,
@@ -746,7 +641,7 @@ class j extends EventTarget {
746
641
  ],
747
642
  {
748
643
  duration: isFinite(a) ? a : 0,
749
- delay: isFinite(l) ? l : 0,
644
+ delay: isFinite(h) ? h : 0,
750
645
  id: "glow-word",
751
646
  iterations: 1,
752
647
  composite: "replace",
@@ -754,40 +649,40 @@ class j extends EventTarget {
754
649
  fill: "both"
755
650
  }
756
651
  );
757
- return o.pause(), o;
652
+ return l.pause(), l;
758
653
  });
759
654
  }
760
655
  updateMaskImage() {
761
- this._hide && (this.element.style.display = "", this.element.style.visibility = "hidden"), this.splittedWords.forEach((e) => {
656
+ this._hide && (this._prevParentEl && this._prevParentEl.appendChild(this.element), this.element.style.display = "", this.element.style.visibility = "hidden"), this.splittedWords.forEach((e) => {
762
657
  const t = e.mainElement;
763
658
  if (t) {
764
659
  e.width = t.clientWidth, e.height = t.clientHeight;
765
- const i = e.height / 2, [s, r, n] = G(
660
+ const i = e.height / 2, [s, r, n] = Y(
766
661
  i / e.width,
767
662
  "rgba(0,0,0,1)",
768
663
  "rgba(0,0,0,0.25)"
769
664
  ), a = `${n * 100}% 100%`;
770
665
  this.lyricPlayer.supportMaskImage ? (t.style.maskImage = s, t.style.maskOrigin = "left", t.style.maskSize = a) : (t.style.webkitMaskImage = s, t.style.webkitMaskOrigin = "left", t.style.webkitMaskSize = a);
771
- const l = e.width + i, o = `clamp(${-l}px,calc(${-l}px + (var(--amll-player-time) - ${e.startTime})*${l / Math.abs(e.endTime - e.startTime)}px),0px) 0px, left top`;
772
- t.style.maskPosition = o, t.style.webkitMaskPosition = o;
666
+ const h = e.width + i, l = `clamp(${-h}px,calc(${-h}px + (var(--amll-player-time) - ${e.startTime})*${h / Math.abs(e.endTime - e.startTime)}px),0px) 0px, left top`;
667
+ t.style.maskPosition = l, t.style.webkitMaskPosition = l;
773
668
  }
774
- }), this._hide && (this.element.style.display = "none", this.element.style.visibility = "");
669
+ }), this._hide && (this._prevParentEl && this.element.remove(), this.element.style.display = "none", this.element.style.visibility = "");
775
670
  }
776
671
  getElement() {
777
672
  return this.element;
778
673
  }
779
674
  setTransform(e = this.left, t = this.top, i = this.scale, s = 1, r = 0, n = !1, a = 0) {
780
- const l = this.isInSight, o = this.lyricPlayer.getEnableSpring();
675
+ const h = this.isInSight, l = this.lyricPlayer.getEnableSpring();
781
676
  this.left = e, this.top = t, this.scale = i, this.delay = a * 1e3 | 0;
782
- const c = this.element.children[0], m = this.element.children[1], u = this.element.children[2];
783
- if (c.style.opacity = `${s}`, m.style.opacity = `${s / 2}`, u.style.opacity = `${s / 2}`, n || !o) {
677
+ const c = this.element.children[0], p = this.element.children[1], u = this.element.children[2];
678
+ if (c.style.opacity = `${s}`, p.style.opacity = `${s / 2}`, u.style.opacity = `${s / 2}`, n || !l) {
784
679
  if (this.blur = Math.min(32, r), n && this.element.classList.add(
785
680
  this.lyricPlayer.style.classes.tmpDisableTransition
786
- ), this.lineTransforms.posX.setPosition(e), this.lineTransforms.posY.setPosition(t), this.lineTransforms.scale.setPosition(i), o)
681
+ ), this.lineTransforms.posX.setPosition(e), this.lineTransforms.posY.setPosition(t), this.lineTransforms.scale.setPosition(i), l)
787
682
  this.rebuildStyle();
788
683
  else {
789
684
  const f = this.isInSight;
790
- l || f ? this.show() : this.hide();
685
+ h || f ? this.show() : this.hide();
791
686
  }
792
687
  n && requestAnimationFrame(() => {
793
688
  this.element.classList.remove(
@@ -811,13 +706,13 @@ class j extends EventTarget {
811
706
  this.element.remove();
812
707
  }
813
708
  }
814
- const U = D(k());
815
- class J extends MouseEvent {
709
+ const N = k(D());
710
+ class H extends MouseEvent {
816
711
  constructor(e, t, i) {
817
712
  super(`line-${i.type}`, i), this.lineIndex = e, this.line = t;
818
713
  }
819
714
  }
820
- class le extends EventTarget {
715
+ class ne extends EventTarget {
821
716
  element = document.createElement("div");
822
717
  currentTime = 0;
823
718
  lyricLines = [];
@@ -871,7 +766,7 @@ class le extends EventTarget {
871
766
  size = [0, 0];
872
767
  innerSize = [0, 0];
873
768
  onLineClickedHandler = (e) => {
874
- const t = new J(
769
+ const t = new H(
875
770
  this.lyricLinesIndexes.get(e.line) ?? -1,
876
771
  e.line,
877
772
  e
@@ -916,7 +811,7 @@ class le extends EventTarget {
916
811
  getEnableScale() {
917
812
  return this.enableScale;
918
813
  }
919
- style = U.createStyleSheet({
814
+ style = N.createStyleSheet({
920
815
  lyricPlayer: {
921
816
  userSelect: "none",
922
817
  fontSize: "var(--amll-lyric-player-font-size,max(min(5vh, 10vw), 12px))",
@@ -925,6 +820,7 @@ class le extends EventTarget {
925
820
  width: "100%",
926
821
  height: "100%",
927
822
  overflow: "hidden",
823
+ boxSizing: "content-box",
928
824
  maxWidth: "100%",
929
825
  maxHeight: "100%",
930
826
  zIndex: 1,
@@ -940,9 +836,8 @@ class le extends EventTarget {
940
836
  lyricLine: {
941
837
  position: "absolute",
942
838
  transformOrigin: "left",
943
- maxWidth: "var(--amll-lyric-player-width,100%)",
944
- minWidth: "var(--amll-lyric-player-width,100%)",
945
839
  width: "var(--amll-lyric-player-width,100%)",
840
+ height: "fit-content",
946
841
  padding: "2vh 1.05em",
947
842
  margin: "0 -1em",
948
843
  contain: "content",
@@ -1041,7 +936,7 @@ class le extends EventTarget {
1041
936
  this.calcLayout(!0, !0);
1042
937
  };
1043
938
  constructor() {
1044
- super(), this.interludeDots = new X(this), this.bottomLine = new R(this), this.element.setAttribute("class", this.style.classes.lyricPlayer), this.disableSpring && this.element.classList.add(this.style.classes.disableSpring), this.rebuildStyle(), this.resizeObserver.observe(this.element), this.element.appendChild(this.interludeDots.getElement()), this.element.appendChild(this.bottomLine.getElement()), this.style.attach(), this.interludeDots.setTransform(0, 200), window.addEventListener("pageshow", this.onPageShow), this.element.addEventListener("wheel", (e) => {
939
+ super(), this.interludeDots = new q(this), this.bottomLine = new O(this), this.element.setAttribute("class", this.style.classes.lyricPlayer), this.disableSpring && this.element.classList.add(this.style.classes.disableSpring), this.rebuildStyle(), this.resizeObserver.observe(this.element), this.element.appendChild(this.interludeDots.getElement()), this.element.appendChild(this.bottomLine.getElement()), this.style.attach(), this.interludeDots.setTransform(0, 200), window.addEventListener("pageshow", this.onPageShow), this.element.addEventListener("wheel", (e) => {
1045
940
  this.allowScroll && (this.isScrolled = !0, clearTimeout(this.scrolledHandler), this.scrolledHandler = setTimeout(() => {
1046
941
  this.isScrolled = !1, this.scrollOffset = 0;
1047
942
  }, 5e3), this.invokedByScrollEvent = !0, e.deltaMode === e.DOM_DELTA_PIXEL ? (this.scrollOffset += e.deltaY, this.calcLayout(!0)) : (this.scrollOffset += e.deltaY * 50, this.calcLayout(!1)), this.invokedByScrollEvent = !1);
@@ -1082,7 +977,7 @@ class le extends EventTarget {
1082
977
  */
1083
978
  rebuildStyle() {
1084
979
  let e = "";
1085
- e += "--amll-lyric-player-width:", e += this.innerSize[0] - this.padding * 2, e += "px;", e += "--amll-lyric-player-height:", e += this.innerSize[1] - this.padding * 2, e += "px;", e += "--amll-player-time:", e += this.currentTime, e += ";", this.element.setAttribute("style", e);
980
+ e += "--amll-lyric-player-width:", e += this.innerSize[0] - this.padding * 2, e += "px;", e += "--amll-lyric-player-height:", e += this.innerSize[1] - this.padding * 2, e += "px;", this.element.setAttribute("style", e);
1086
981
  }
1087
982
  /**
1088
983
  * 设置是否隐藏已经播放过的歌词行,默认不隐藏
@@ -1142,7 +1037,7 @@ class le extends EventTarget {
1142
1037
  }
1143
1038
  this.processedLines.forEach((i, s, r) => {
1144
1039
  const n = r[s + 1], a = i.words[i.words.length - 1];
1145
- a && x(a) && (n ? n.startTime > i.endTime && (i.endTime = Math.min(i.endTime + 1500, n.startTime)) : i.endTime = i.endTime + 1500);
1040
+ a && v(a) && (n ? n.startTime > i.endTime && (i.endTime = Math.min(i.endTime + 1500, n.startTime)) : i.endTime = i.endTime + 1500);
1146
1041
  }), this.processedLines.forEach((i, s, r) => {
1147
1042
  if (i.isBG)
1148
1043
  return;
@@ -1151,7 +1046,7 @@ class le extends EventTarget {
1151
1046
  }), this.lyricLinesEl.forEach((i) => {
1152
1047
  i.removeEventListener("click", this.onLineClickedHandler), i.removeEventListener("contextmenu", this.onLineClickedHandler), i.dispose();
1153
1048
  }), this.lyricLinesEl = this.processedLines.map((i) => {
1154
- const s = new j(this, i);
1049
+ const s = new V(this, i);
1155
1050
  return s.addEventListener("click", this.onLineClickedHandler), s.addEventListener("contextmenu", this.onLineClickedHandler), s;
1156
1051
  }), this.lyricLinesEl.forEach((i, s) => {
1157
1052
  this.element.appendChild(i.getElement()), this.lyricLinesIndexes.set(i, s), i.updateMaskImage();
@@ -1183,46 +1078,46 @@ class le extends EventTarget {
1183
1078
  * @param reflow 是否进行重新布局(重新计算每行歌词大小)
1184
1079
  */
1185
1080
  calcLayout(e = !1, t = !1) {
1186
- t && (this.emUnit = parseFloat(getComputedStyle(this.element).fontSize), this.lyricLinesEl.forEach((p) => {
1187
- const d = p.measureSize();
1188
- this.lyricLinesSize.set(p, d), p.lineSize = d;
1081
+ t && (this.emUnit = parseFloat(getComputedStyle(this.element).fontSize), this.lyricLinesEl.forEach((d) => {
1082
+ const m = d.measureSize();
1083
+ this.lyricLinesSize.set(d, m), d.lineSize = m;
1189
1084
  }), this.interludeDotsSize[0] = this.interludeDots.getElement().clientWidth, this.interludeDotsSize[1] = this.interludeDots.getElement().clientHeight, this.bottomLine.lineSize = this.bottomLine.measureSize());
1190
1085
  const i = this.getCurrentInterlude();
1191
1086
  let s = -this.scrollOffset, r = this.scrollToIndex, n = 0;
1192
1087
  i ? (n = i[1] - i[0], n >= 5e3 && this.lyricLinesEl[i[2] + 1] && (r = i[2] + 1)) : this.interludeDots.setInterlude(void 0);
1193
- const a = this.enableScale ? 0.95 : 1, l = this.lyricLinesEl.slice(0, r).reduce(
1194
- (p, d) => p + (d.getLine().isBG ? 0 : this.lyricLinesSize.get(d)?.[1] ?? 0),
1088
+ const a = this.enableScale ? 0.95 : 1, h = this.lyricLinesEl.slice(0, r).reduce(
1089
+ (d, m) => d + (m.getLine().isBG ? 0 : this.lyricLinesSize.get(m)?.[1] ?? 0),
1195
1090
  0
1196
1091
  );
1197
- s -= l, s += this.size[1] * this.alignPosition;
1198
- const o = this.lyricLinesEl[r];
1199
- if (o) {
1200
- const p = this.lyricLinesSize.get(o)?.[1] ?? 0;
1092
+ s -= h, s += this.size[1] * this.alignPosition;
1093
+ const l = this.lyricLinesEl[r];
1094
+ if (l) {
1095
+ const d = this.lyricLinesSize.get(l)?.[1] ?? 0;
1201
1096
  switch (this.alignAnchor) {
1202
1097
  case "bottom":
1203
- s -= p;
1098
+ s -= d;
1204
1099
  break;
1205
1100
  case "center":
1206
- s -= p / 2;
1101
+ s -= d / 2;
1207
1102
  break;
1208
1103
  }
1209
1104
  }
1210
1105
  const c = Math.max(...this.bufferedLines);
1211
- let m = 0, u = 0.05, f = !1;
1212
- this.lyricLinesEl.forEach((p, d) => {
1213
- const g = this.bufferedLines.has(d), b = g || d >= this.scrollToIndex && d < c, P = p.getLine();
1214
- P.isDuet && this.size[0] - (this.lyricLinesSize.get(p)?.[0] ?? 0), !f && n >= 5e3 && (d === this.scrollToIndex && i?.[2] === -2 || d === this.scrollToIndex + 1) && (f = !0, this.interludeDots.setTransform(this.padding, s), i && this.interludeDots.setInterlude([i[0], i[1]]), s += this.interludeDotsSize[1]);
1215
- const C = this.hidePassedLines && d < (i ? i[2] + 1 : this.scrollToIndex) ? 0 : g ? 1 : 1 / 3;
1216
- p.setTransform(
1106
+ let p = 0, u = 0.05, f = !1;
1107
+ this.lyricLinesEl.forEach((d, m) => {
1108
+ const T = this.bufferedLines.has(m), w = T || m >= this.scrollToIndex && m < c, E = d.getLine();
1109
+ E.isDuet && this.size[0] - (this.lyricLinesSize.get(d)?.[0] ?? 0), !f && n >= 5e3 && (m === this.scrollToIndex && i?.[2] === -2 || m === this.scrollToIndex + 1) && (f = !0, this.interludeDots.setTransform(this.padding, s), i && this.interludeDots.setInterlude([i[0], i[1]]), s += this.interludeDotsSize[1]);
1110
+ const M = this.hidePassedLines && m < (i ? i[2] + 1 : this.scrollToIndex) ? 0 : T ? 1 : 1 / 3;
1111
+ d.setTransform(
1217
1112
  this.padding,
1218
1113
  s,
1219
- b ? 1 : a,
1220
- C,
1221
- !this.invokedByScrollEvent && this.enableBlur ? b ? 0 : 1 + (d < this.scrollToIndex ? Math.abs(this.scrollToIndex - d) : Math.abs(d - Math.max(this.scrollToIndex, c))) : 0,
1114
+ w ? 1 : a,
1115
+ M,
1116
+ !this.invokedByScrollEvent && this.enableBlur ? w ? 0 : 1 + (m < this.scrollToIndex ? Math.abs(this.scrollToIndex - m) : Math.abs(m - Math.max(this.scrollToIndex, c))) : 0,
1222
1117
  e,
1223
- m
1224
- ), P.isBG && b ? s += this.lyricLinesSize.get(p)?.[1] ?? 0 : P.isBG || (s += this.lyricLinesSize.get(p)?.[1] ?? 0), s >= 0 && (m += u, u /= 1.2);
1225
- }), this.bottomLine.setTransform(this.padding, s, e, m);
1118
+ p
1119
+ ), E.isBG && w ? s += this.lyricLinesSize.get(d)?.[1] ?? 0 : E.isBG || (s += this.lyricLinesSize.get(d)?.[1] ?? 0), s >= 0 && (p += u, u /= 1.2);
1120
+ }), this.bottomLine.setTransform(this.padding, s, e, p);
1226
1121
  }
1227
1122
  /**
1228
1123
  * 获取当前歌词的播放位置
@@ -1283,7 +1178,7 @@ class le extends EventTarget {
1283
1178
  * @param time 当前播放进度,单位为毫秒
1284
1179
  */
1285
1180
  setCurrentTime(e, t = !1) {
1286
- if (this.currentTime = e, this.element.style.setProperty("--amll-player-time", `${e}`), this.isScrolled)
1181
+ if (this.currentTime = e, this._getIsNonDynamic() || this.element.style.setProperty("--amll-player-time", `${e}`), this.isScrolled)
1287
1182
  return;
1288
1183
  const i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
1289
1184
  this.hotLines.forEach((n) => {
@@ -1291,23 +1186,23 @@ class le extends EventTarget {
1291
1186
  if (a) {
1292
1187
  if (a.isBG)
1293
1188
  return;
1294
- const l = this.processedLines[n + 1];
1295
- if (l?.isBG) {
1296
- const o = Math.min(a.startTime, l?.startTime), c = Math.max(a.endTime, l?.endTime);
1297
- (o > e || c <= e) && (this.hotLines.delete(n), i.add(n), this.hotLines.delete(n + 1), i.add(n + 1), t && (this.lyricLinesEl[n].disable(), this.lyricLinesEl[n + 1].disable()));
1189
+ const h = this.processedLines[n + 1];
1190
+ if (h?.isBG) {
1191
+ const l = Math.min(a.startTime, h?.startTime), c = Math.max(a.endTime, h?.endTime);
1192
+ (l > e || c <= e) && (this.hotLines.delete(n), i.add(n), this.hotLines.delete(n + 1), i.add(n + 1), t && (this.lyricLinesEl[n].disable(), this.lyricLinesEl[n + 1].disable()));
1298
1193
  } else
1299
1194
  (a.startTime > e || a.endTime <= e) && (this.hotLines.delete(n), i.add(n), t && this.lyricLinesEl[n].disable());
1300
1195
  } else
1301
1196
  this.hotLines.delete(n), i.add(n), t && this.lyricLinesEl[n].disable();
1302
- }), this.processedLines.forEach((n, a, l) => {
1303
- !n.isBG && n.startTime <= e && n.endTime > e && (this.hotLines.has(a) || (this.hotLines.add(a), r.add(a), t && this.lyricLinesEl[a].enable(), l[a + 1]?.isBG && (this.hotLines.add(a + 1), r.add(a + 1), t && this.lyricLinesEl[a + 1].enable())));
1197
+ }), this.processedLines.forEach((n, a, h) => {
1198
+ !n.isBG && n.startTime <= e && n.endTime > e && (this.hotLines.has(a) || (this.hotLines.add(a), r.add(a), t && this.lyricLinesEl[a].enable(), h[a + 1]?.isBG && (this.hotLines.add(a + 1), r.add(a + 1), t && this.lyricLinesEl[a + 1].enable())));
1304
1199
  }), this.bufferedLines.forEach((n) => {
1305
1200
  this.hotLines.has(n) || (s.add(n), t && this.lyricLinesEl[n].disable());
1306
1201
  }), t ? (this.bufferedLines.size > 0 ? this.scrollToIndex = Math.min(...this.bufferedLines) : this.scrollToIndex = this.processedLines.findIndex(
1307
1202
  (n) => n.startTime >= e
1308
1203
  ), this.bufferedLines.clear(), this.hotLines.forEach((n) => this.bufferedLines.add(n)), this.calcLayout(!0)) : (s.size > 0 || r.size > 0) && (s.size === 0 && r.size > 0 ? (r.forEach((n) => {
1309
1204
  this.bufferedLines.add(n), this.lyricLinesEl[n].enable();
1310
- }), this.scrollToIndex = Math.min(...this.bufferedLines), this.calcLayout()) : r.size === 0 && s.size > 0 ? N(s, this.bufferedLines) && (this.bufferedLines.forEach((n) => {
1205
+ }), this.scrollToIndex = Math.min(...this.bufferedLines), this.calcLayout()) : r.size === 0 && s.size > 0 ? $(s, this.bufferedLines) && (this.bufferedLines.forEach((n) => {
1311
1206
  this.hotLines.has(n) || (this.bufferedLines.delete(n), this.lyricLinesEl[n].disable());
1312
1207
  }), this.calcLayout()) : (r.forEach((n) => {
1313
1208
  this.bufferedLines.add(n), this.lyricLinesEl[n].enable();
@@ -1369,8 +1264,7 @@ class le extends EventTarget {
1369
1264
  }
1370
1265
  }
1371
1266
  export {
1372
- oe as BackgroundRender,
1373
- le as LyricPlayer,
1374
- ae as ttml
1267
+ se as BackgroundRender,
1268
+ ne as LyricPlayer
1375
1269
  };
1376
1270
  //# sourceMappingURL=amll-core.mjs.map