@music-lyric-player/base 0.14.0 → 0.16.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.
@@ -1,191 +1,674 @@
1
- import { freezeObjectDeep as or, ConfigManager as lr, Event as cr } from "@music-lyric-player/utils";
2
- import "lodash-es";
3
- const Wt = or({
1
+ import { freezeObjectDeep as mr, ConfigManager as dr, Event as pr } from "@music-lyric-player/utils";
2
+ const Ht = mr({
4
3
  driver: "animation",
5
4
  bridgeActive: !0,
6
5
  mergeWindow: 300,
6
+ mergeLimit: 3,
7
7
  offset: {
8
8
  global: 0,
9
9
  useMeta: !0,
10
10
  resetTempOnLyricChange: !0
11
11
  }
12
- }), es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
12
+ }), os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
13
13
  __proto__: null,
14
- DEFAULT: Wt
15
- }, Symbol.toStringTag, { value: "Module" })), We = (t = 8) => {
16
- const s = new Uint8Array(t);
17
- if (typeof globalThis.crypto?.getRandomValues == "function")
18
- crypto.getRandomValues(s);
19
- else
20
- for (let r = 0; r < s.length; r++)
21
- s[r] = Math.floor(Math.random() * 256);
22
- return Array.from(s).map((r) => r.toString(16).padStart(2, "0")).join("");
23
- };
24
- class W {
25
- start = 0;
26
- end = 0;
14
+ DEFAULT: Ht
15
+ }, Symbol.toStringTag, { value: "Module" }));
16
+ var zt = /* @__PURE__ */ ((r) => (r.ChineseSimplified = "zh-hans", r.ChineseTraditional = "zh-hant", r.English = "en", r.Japanese = "ja", r.Korean = "ko", r.Russian = "ru", r.French = "fr", r.German = "de", r.Spanish = "es", r.Italian = "it", r.Portuguese = "pt", r))(zt || {});
17
+ class Er {
18
+ /**
19
+ * Language tag.
20
+ */
21
+ tag;
22
+ /**
23
+ * Share within the lyric, ranging from 0 to 100.
24
+ * Recommended to be computed from word-level language counts.
25
+ */
26
+ percent;
27
+ constructor(e = {}) {
28
+ this.tag = e.tag ?? "", this.percent = e.percent ?? 0;
29
+ }
30
+ }
31
+ class Yt {
32
+ /**
33
+ * All languages with their shares.
34
+ *
35
+ * Shares are a snapshot filled by the language transform; stale after lines change.
36
+ */
37
+ list;
38
+ constructor(e = {}) {
39
+ this.list = e.list ?? [];
40
+ }
41
+ /**
42
+ * Whether a language of the given tag is present.
43
+ */
44
+ has(e) {
45
+ return this.list.some((t) => t.tag === e);
46
+ }
47
+ /**
48
+ * The language entry of the given tag.
49
+ */
50
+ byType(e) {
51
+ return this.list.find((t) => t.tag === e);
52
+ }
53
+ /**
54
+ * The language with the highest share.
55
+ */
56
+ get primary() {
57
+ let e;
58
+ for (let t = 0, n = this.list.length; t < n; t++)
59
+ (!e || this.list[t].percent > e.percent) && (e = this.list[t]);
60
+ return e;
61
+ }
62
+ }
63
+ class Kt {
64
+ /**
65
+ * Start time in milliseconds.
66
+ */
67
+ start;
68
+ /**
69
+ * End time in milliseconds.
70
+ */
71
+ end;
72
+ constructor(e = 0, t = 0) {
73
+ this.start = e, this.end = t;
74
+ }
75
+ /**
76
+ * Duration in milliseconds, derived from end minus start.
77
+ */
27
78
  get duration() {
28
79
  return this.end - this.start;
29
80
  }
30
- toJSON() {
31
- return {
32
- start: this.start,
33
- end: this.end,
34
- duration: this.duration
35
- };
81
+ }
82
+ class gr {
83
+ /**
84
+ * Time range of the token.
85
+ */
86
+ time;
87
+ /**
88
+ * Text content of the token.
89
+ */
90
+ content;
91
+ constructor(e = {}) {
92
+ this.time = e.time, this.content = e.content ?? "";
36
93
  }
37
94
  }
38
- var Ye = /* @__PURE__ */ ((t) => (t.Normal = "Normal", t.Space = "Space", t))(Ye || {});
39
- class Yt {
40
- stress = !1;
95
+ class ze {
96
+ /**
97
+ * Time range of the item, independent from its words.
98
+ */
99
+ time;
100
+ /**
101
+ * Tokens composing the item in order.
102
+ */
103
+ words;
104
+ /**
105
+ * Language or transliteration scheme of this item.
106
+ * Should be set when multiple languages coexist, since line-level aggregation groups items by it.
107
+ */
108
+ language;
109
+ constructor(e = {}) {
110
+ this.time = e.time, this.words = e.words ?? [], this.language = e.language;
111
+ }
112
+ /**
113
+ * Flat text joined from every word.
114
+ *
115
+ * Live: recomputed on each access.
116
+ */
117
+ get content() {
118
+ let e = "";
119
+ for (let t = 0, n = this.words.length; t < n; t++)
120
+ e += this.words[t].content;
121
+ return e;
122
+ }
123
+ }
124
+ class Rr extends ze {
125
+ /**
126
+ * Whether this ruby marks the start of a phrase.
127
+ */
128
+ phraseStart;
129
+ constructor(e = {}) {
130
+ super(e), this.phraseStart = e.phraseStart ?? !1;
131
+ }
41
132
  }
42
- class ur {
133
+ class vr extends ze {
134
+ /**
135
+ * Original annotation type name.
136
+ */
137
+ key;
138
+ constructor(e = {}) {
139
+ super(e), this.key = e.key ?? "";
140
+ }
141
+ }
142
+ class Ir {
143
+ /**
144
+ * Ruby annotation such as furigana.
145
+ */
146
+ ruby;
147
+ /**
148
+ * Romanized transliterations.
149
+ */
150
+ romans;
151
+ /**
152
+ * Unknown annotations keyed by their original type name.
153
+ */
154
+ unknowns;
155
+ constructor(e = {}) {
156
+ this.ruby = e.ruby, this.romans = e.romans, this.unknowns = e.unknowns;
157
+ }
158
+ }
159
+ var k = /* @__PURE__ */ ((r) => (r.Normal = "Normal", r.Space = "Space", r))(k || {});
160
+ class $r {
161
+ /**
162
+ * Discriminant marking this as a normal word.
163
+ */
43
164
  type = "Normal";
44
- time = new W();
45
- content = "";
46
- extended = [];
47
- config = new Yt();
165
+ /**
166
+ * Time range of the word.
167
+ */
168
+ time;
169
+ /**
170
+ * Text content of the word.
171
+ */
172
+ content;
173
+ /**
174
+ * Language of this word.
175
+ */
176
+ language;
177
+ /**
178
+ * Annotations attached to this word.
179
+ */
180
+ annotation;
181
+ /**
182
+ * Whether the word is stressed.
183
+ */
184
+ stress;
185
+ constructor(e = {}) {
186
+ this.time = e.time, this.content = e.content ?? "", this.language = e.language, this.annotation = e.annotation, this.stress = e.stress ?? !1;
187
+ }
48
188
  }
49
- class fr {
189
+ class Lr {
190
+ /**
191
+ * Discriminant marking this as a space.
192
+ */
50
193
  type = "Space";
51
- count = 1;
52
- }
53
- var zt = /* @__PURE__ */ ((t) => (t.Unknown = "Unknown", t.Translate = "Translate", t.Roman = "Roman", t))(zt || {});
54
- class hr {
55
- type = "Unknown";
56
- content = "";
194
+ /**
195
+ * Number of consecutive space characters.
196
+ */
197
+ count;
198
+ constructor(e = {}) {
199
+ this.count = e.count ?? 1;
200
+ }
57
201
  }
58
- var Jt = /* @__PURE__ */ ((t) => (t.Normal = "Normal", t.Interlude = "Interlude", t))(Jt || {});
59
- class dr {
60
- id = We(4).toUpperCase();
61
- type = "Interlude";
62
- time = new W();
202
+ var Zt = /* @__PURE__ */ ((r) => (r.Ruby = "Ruby", r.Roman = "Roman", r.Translate = "Translate", r.Unknown = "Unknown", r))(Zt || {});
203
+ const Tr = [
204
+ "Ruby",
205
+ "Roman",
206
+ "Unknown"
207
+ /* Unknown */
208
+ ];
209
+ class Jt {
210
+ /**
211
+ * All annotation items in order.
212
+ *
213
+ * Derived items are a snapshot from `deriveLineAnnotation`; re-run it after words change.
214
+ */
215
+ list;
216
+ constructor(e = {}) {
217
+ this.list = e.list ?? [];
218
+ }
219
+ /**
220
+ * Whether any item of a kind exists.
221
+ */
222
+ has(e) {
223
+ return this.list.some((t) => t.kind === e);
224
+ }
225
+ /**
226
+ * All items of a kind.
227
+ */
228
+ all(e) {
229
+ return this.list.filter((t) => t.kind === e);
230
+ }
231
+ /**
232
+ * The first item of a kind, preferring a language match then falling back to the first.
233
+ */
234
+ first(e, t) {
235
+ const n = this.all(e);
236
+ if (t !== void 0) {
237
+ const i = n.find((c) => c.language === t);
238
+ if (i)
239
+ return i;
240
+ }
241
+ return n[0];
242
+ }
63
243
  }
64
- class Kt {
65
- words = [];
66
- extended = [];
67
- get original() {
68
- return this.words.map((s) => s.type === Ye.Normal ? s.content : " ".repeat(s.count)).join("");
244
+ const H = (r, e) => ({
245
+ derived: !1,
246
+ ...e,
247
+ kind: r
248
+ }), se = (r, e, t, n) => {
249
+ const i = [];
250
+ for (let o = 0, h = r.length; o < h; o++) {
251
+ const a = r[o];
252
+ if (a.type === k.Space)
253
+ continue;
254
+ const l = e(a);
255
+ if (l)
256
+ for (const s of l) {
257
+ const u = t(s);
258
+ i.includes(u) || i.push(u);
259
+ }
69
260
  }
70
- toJSON() {
71
- return {
72
- words: this.words,
73
- extended: this.extended,
74
- original: this.original
75
- };
261
+ const c = [];
262
+ for (const o of i) {
263
+ let h = "", a = 0, l, s = !1;
264
+ for (let u = 0, f = r.length; u < f; u++) {
265
+ const E = r[u];
266
+ if (E.type === k.Space) {
267
+ a += E.count;
268
+ continue;
269
+ }
270
+ const S = e(E)?.find((d) => t(d) === o);
271
+ S && (s && (h += " ".repeat(a)), h += S.content, l ??= S.language, a = 0, s = !0);
272
+ }
273
+ s && c.push(n(o, h, l));
274
+ }
275
+ return c;
276
+ }, Nr = (r) => {
277
+ const { words: e, annotation: t } = r;
278
+ for (const n of Tr) {
279
+ const i = t.list.some((o) => o.kind === n && !o.derived);
280
+ if (t.list = t.list.filter((o) => !(o.kind === n && o.derived)), i)
281
+ continue;
282
+ let c;
283
+ switch (n) {
284
+ case "Ruby":
285
+ c = se(
286
+ e,
287
+ (o) => {
288
+ const h = o.annotation?.ruby;
289
+ return h ? [h] : void 0;
290
+ },
291
+ () => "",
292
+ (o, h, a) => H("Ruby", { content: h, language: a, derived: !0 })
293
+ );
294
+ break;
295
+ case "Roman":
296
+ c = se(
297
+ e,
298
+ (o) => o.annotation?.romans,
299
+ (o) => o.language ?? "",
300
+ (o, h) => H("Roman", { content: h, language: o || void 0, derived: !0 })
301
+ );
302
+ break;
303
+ default:
304
+ c = se(
305
+ e,
306
+ (o) => o.annotation?.unknowns,
307
+ (o) => o.key,
308
+ (o, h, a) => H("Unknown", { content: h, language: a, key: o, derived: !0 })
309
+ );
310
+ }
311
+ t.list.push(...c);
312
+ }
313
+ };
314
+ var Qt = /* @__PURE__ */ ((r) => (r.Normal = "Normal", r.Interlude = "Interlude", r))(Qt || {});
315
+ class er {
316
+ /**
317
+ * Time range of the line.
318
+ */
319
+ time;
320
+ constructor(e = {}) {
321
+ this.time = e.time ?? new Kt();
76
322
  }
77
323
  }
78
- class Zt {
324
+ class tr extends er {
325
+ /**
326
+ * Discriminant marking this as a normal line.
327
+ */
79
328
  type = "Normal";
80
- id = We(4).toUpperCase();
81
- time = new W();
82
- content = new Kt();
329
+ /**
330
+ * Performing agent of this line.
331
+ */
83
332
  agent;
333
+ /**
334
+ * Words composing the line in order.
335
+ */
336
+ words;
337
+ /**
338
+ * Annotations applied to the whole line, derived from words unless set explicitly.
339
+ */
340
+ annotation;
341
+ constructor(e = {}) {
342
+ super(e), this.agent = e.agent, this.words = e.words ?? [], this.annotation = e.annotation ?? new Jt(), e.languages && (this.languages = e.languages);
343
+ }
344
+ /**
345
+ * Plain text of the line joined from every word.
346
+ *
347
+ * Live: recomputed from words on each access.
348
+ */
349
+ get original() {
350
+ let e = "";
351
+ for (let t = 0, n = this.words.length; t < n; t++) {
352
+ const i = this.words[t];
353
+ e += i.type === k.Normal ? i.content : " ".repeat(i.count);
354
+ }
355
+ return e;
356
+ }
357
+ #e;
358
+ /**
359
+ * Language tags of this line: the explicit value, otherwise live-collected from words on each access.
360
+ */
361
+ get languages() {
362
+ if (this.#e?.length)
363
+ return this.#e;
364
+ const e = /* @__PURE__ */ new Set();
365
+ for (let t = 0, n = this.words.length; t < n; t++) {
366
+ const i = this.words[t];
367
+ i.type === k.Normal && i.language && e.add(i.language);
368
+ }
369
+ return [...e];
370
+ }
371
+ /**
372
+ * Override the words-derived languages with explicit tags.
373
+ */
374
+ set languages(e) {
375
+ this.#e = e;
376
+ }
84
377
  }
85
- class mr extends Zt {
86
- }
87
- class Er extends Zt {
378
+ class Sr extends tr {
379
+ /**
380
+ * Background lines attached to this line.
381
+ */
88
382
  background;
383
+ constructor(e = {}) {
384
+ super(e), this.background = e.background;
385
+ }
89
386
  }
90
- var Qt = /* @__PURE__ */ ((t) => (t.Offset = "Offset", t.Duration = "Duration", t.Title = "Title", t.Singer = "Singer", t.Album = "Album", t.Creator = "Creator", t.Unknown = "Unknown", t))(Qt || {});
91
- class F {
92
- id = We(4).toUpperCase();
93
- }
94
- class pr extends F {
95
- type = "Offset";
96
- content = 0;
97
- }
98
- class Rr extends F {
99
- type = "Duration";
100
- content = 0;
101
- }
102
- class vr extends F {
103
- type = "Title";
104
- content = "";
105
- }
106
- class Ir extends F {
107
- type = "Singer";
108
- content = "";
387
+ class Or extends er {
388
+ /**
389
+ * Discriminant marking this as an interlude line.
390
+ */
391
+ type = "Interlude";
109
392
  }
110
- class gr extends F {
111
- type = "Album";
112
- content = "";
393
+ var rr = /* @__PURE__ */ ((r) => (r.Offset = "Offset", r.Duration = "Duration", r.Title = "Title", r.Singer = "Singer", r.Album = "Album", r.Creator = "Creator", r.Author = "Author", r.Isrc = "Isrc", r.Unknown = "Unknown", r))(rr || {});
394
+ const Ar = (r, e, t) => ({
395
+ type: r,
396
+ key: e,
397
+ value: t
398
+ });
399
+ class sr {
400
+ /**
401
+ * All meta entries in order.
402
+ */
403
+ list;
404
+ constructor(e = {}) {
405
+ this.list = e.list ?? [];
406
+ }
407
+ /**
408
+ * Whether any entry of a meta type exists.
409
+ */
410
+ has(e) {
411
+ return this.list.some((t) => t.type === e);
412
+ }
413
+ /**
414
+ * All entries of a meta type.
415
+ */
416
+ all(e) {
417
+ return this.list.filter((t) => t.type === e);
418
+ }
419
+ /**
420
+ * The first entry of a meta type.
421
+ */
422
+ first(e) {
423
+ return this.list.find((t) => t.type === e);
424
+ }
425
+ /**
426
+ * All entries with the given original key.
427
+ */
428
+ byKey(e) {
429
+ return this.list.filter((t) => t.key === e);
430
+ }
113
431
  }
114
- class $r extends F {
115
- type = "Creator";
116
- content = {
117
- role: "",
118
- name: []
119
- };
432
+ var nr = /* @__PURE__ */ ((r) => (r.Person = "Person", r.Group = "Group", r.Other = "Other", r.Unknown = "Unknown", r))(nr || {});
433
+ class wr {
434
+ /**
435
+ * Unique identifier of the agent.
436
+ */
437
+ id;
438
+ /**
439
+ * Performing type of the agent.
440
+ */
441
+ type;
442
+ /**
443
+ * Number of lines performed by this agent.
444
+ *
445
+ * Snapshot filled by `calcAgentIndex` at parse time; stale after lines change.
446
+ */
447
+ count;
448
+ /**
449
+ * Display names of the agent; a group may carry more than one.
450
+ */
451
+ names;
452
+ constructor(e = {}) {
453
+ this.id = e.id ?? "", this.type = e.type ?? "Unknown", this.count = e.count ?? 0, this.names = e.names ?? [];
454
+ }
120
455
  }
121
- class Lr extends F {
122
- type = "Unknown";
123
- content = "";
456
+ class yr {
457
+ /**
458
+ * Identifier of the referenced agent.
459
+ */
460
+ id;
461
+ /**
462
+ * Index of this agent occurrence among all lines.
463
+ *
464
+ * Snapshot filled by `calcAgentIndex` at parse time.
465
+ */
466
+ globalIndex;
467
+ /**
468
+ * Index of this agent occurrence within its block.
469
+ *
470
+ * Snapshot filled by `calcAgentIndex` at parse time.
471
+ */
472
+ blockIndex;
473
+ constructor(e = {}) {
474
+ this.id = e.id ?? "", this.globalIndex = e.globalIndex ?? 0, this.blockIndex = e.blockIndex ?? 0;
475
+ }
124
476
  }
125
- class Tr {
126
- id = "";
127
- name = "";
128
- count = 0;
477
+ class ir {
478
+ /**
479
+ * All agents in order.
480
+ */
481
+ list;
482
+ constructor(e = {}) {
483
+ this.list = e.list ?? [];
484
+ }
485
+ /**
486
+ * Whether any agent of a type exists.
487
+ */
488
+ has(e) {
489
+ return this.list.some((t) => t.type === e);
490
+ }
491
+ /**
492
+ * All agents of a type.
493
+ */
494
+ all(e) {
495
+ return this.list.filter((t) => t.type === e);
496
+ }
497
+ /**
498
+ * The agent with the given id, used to resolve a LineAgent reference.
499
+ */
500
+ byId(e) {
501
+ return this.list.find((t) => t.id === e);
502
+ }
503
+ /**
504
+ * The agent performing the most lines.
505
+ */
506
+ get primary() {
507
+ let e;
508
+ for (let t = 0, n = this.list.length; t < n; t++)
509
+ (!e || this.list[t].count > e.count) && (e = this.list[t]);
510
+ return e;
511
+ }
129
512
  }
130
- class er {
131
- // index in global
132
- global = 0;
133
- // index in block
134
- block = 0;
135
- }
136
- class Nr {
137
- id = "";
138
- index = new er();
139
- }
140
- const tr = "0.6.0";
141
- var rr = /* @__PURE__ */ ((t) => (t.Invalid = "Invalid", t.Normal = "Normal", t.Syllable = "Syllable", t.Pure = "Pure", t.Empty = "Empty", t.NoTime = "NoTime", t))(rr || {});
142
- class Sr {
143
- version = tr;
144
- type = "Invalid";
145
- metas = [];
146
- lines = [];
147
- agents = [];
513
+ const ar = "0.9.0";
514
+ var or = /* @__PURE__ */ ((r) => (r.Invalid = "Invalid", r.Empty = "Empty", r.Normal = "Normal", r))(or || {}), lr = /* @__PURE__ */ ((r) => (r.None = "None", r.Line = "Line", r.Syllable = "Syllable", r))(lr || {});
515
+ class Cr {
516
+ /**
517
+ * Schema version of this data model.
518
+ */
519
+ version = ar;
520
+ /**
521
+ * Overall classification of the lyric.
522
+ */
523
+ type;
524
+ /**
525
+ * Timing precision of the lyric.
526
+ */
527
+ timing;
528
+ /**
529
+ * Metadata of the lyric.
530
+ */
531
+ meta;
532
+ /**
533
+ * Language distribution of the lyric.
534
+ */
535
+ language;
536
+ /**
537
+ * Performing agents referenced by lines.
538
+ */
539
+ agent;
540
+ /**
541
+ * Lyric lines in order.
542
+ */
543
+ lines;
544
+ constructor(e = {}) {
545
+ this.type = e.type ?? "Invalid", this.timing = e.timing ?? "None", this.meta = e.meta ?? new sr(), this.language = e.language ?? new Yt(), this.agent = e.agent ?? new ir(), this.lines = e.lines ?? [];
546
+ }
148
547
  }
149
548
  const X = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
150
549
  __proto__: null,
151
- Agent: Tr,
152
- Extended: hr,
153
- ExtendedType: zt,
154
- Info: Sr,
155
- InfoType: rr,
156
- LineAgent: Nr,
157
- LineAgentIndex: er,
158
- LineInterlude: dr,
159
- LineNormal: Er,
160
- LineNormalBackground: mr,
161
- LineNormalContent: Kt,
162
- LineType: Jt,
163
- MetaAlbum: gr,
164
- MetaCreator: $r,
165
- MetaDuration: Rr,
166
- MetaOffset: pr,
167
- MetaSinger: Ir,
168
- MetaTitle: vr,
169
- MetaType: Qt,
170
- MetaUnknown: Lr,
171
- Time: W,
172
- Version: tr,
173
- WordNormal: ur,
174
- WordNormalConfig: Yt,
175
- WordSpace: fr,
176
- WordType: Ye
550
+ Agent: ir,
551
+ AgentItem: wr,
552
+ AgentType: nr,
553
+ Info: Cr,
554
+ InfoTiming: lr,
555
+ InfoType: or,
556
+ Language: Yt,
557
+ LanguageItem: Er,
558
+ LanguageType: zt,
559
+ LineAgent: yr,
560
+ LineAnnotation: Jt,
561
+ LineAnnotationKind: Zt,
562
+ LineInterlude: Or,
563
+ LineNormal: Sr,
564
+ LineNormalBase: tr,
565
+ LineType: Qt,
566
+ Meta: sr,
567
+ MetaType: rr,
568
+ Time: Kt,
569
+ Version: ar,
570
+ WordAnnotation: Ir,
571
+ WordAnnotationContent: gr,
572
+ WordAnnotationItem: ze,
573
+ WordNormal: $r,
574
+ WordRubyAnnotation: Rr,
575
+ WordSpace: Lr,
576
+ WordType: k,
577
+ WordUnknownAnnotation: vr,
578
+ createLineAnnotationItem: H,
579
+ createMetaItem: Ar,
580
+ deriveLineAnnotation: Nr
177
581
  }, Symbol.toStringTag, { value: "Module" }));
178
- var H = { exports: {} }, se, tt;
179
- function Y() {
180
- if (tt) return se;
582
+ class Pr {
583
+ lines = [];
584
+ mergedEnd = [];
585
+ /**
586
+ * Raw deactivation time of a line: the later of its own end and the next line's start.
587
+ *
588
+ * The final line never deactivates, and out-of-range indices resolve to 0.
589
+ */
590
+ getRawTime(e) {
591
+ const t = this.lines;
592
+ return e < 0 || e >= t.length ? 0 : e === t.length - 1 ? 1 / 0 : Math.max(t[e].time.end, t[e + 1].time.start);
593
+ }
594
+ /**
595
+ * Rebuild the merged end-time table from the given lines and merge settings.
596
+ */
597
+ build(e, t, n) {
598
+ this.lines = e;
599
+ const i = e.length, c = new Array(i);
600
+ if (i === 0) {
601
+ this.mergedEnd = c;
602
+ return;
603
+ }
604
+ const o = Math.max(0, t), h = n > 0 ? n : 1 / 0;
605
+ let a = this.getRawTime(i - 1);
606
+ c[i - 1] = a;
607
+ let l = 1;
608
+ for (let s = i - 2; s >= 0; s--) {
609
+ const u = this.getRawTime(s);
610
+ o > 0 && l < h && Math.abs(a - u) < o ? (c[s] = Math.max(u, c[s + 1]), l++) : (c[s] = u, l = 1), a = u;
611
+ }
612
+ this.mergedEnd = c;
613
+ }
614
+ /**
615
+ * Merged deactivation time of a line, falling back to the raw time when unbuilt.
616
+ */
617
+ getMergedTime(e) {
618
+ const t = this.mergedEnd[e];
619
+ return t === void 0 ? this.getRawTime(e) : t;
620
+ }
621
+ }
622
+ class qr {
623
+ temp = 0;
624
+ meta = 0;
625
+ setTemp(e) {
626
+ this.temp = Number.isFinite(e) ? e : 0;
627
+ }
628
+ resetTemp() {
629
+ this.temp = 0;
630
+ }
631
+ refreshFromMeta(e, t) {
632
+ if (!t) {
633
+ this.meta = 0;
634
+ return;
635
+ }
636
+ const n = e.meta.first(X.MetaType.Offset)?.value;
637
+ this.meta = typeof n == "number" && Number.isFinite(n) ? n : 0;
638
+ }
639
+ resolve(e) {
640
+ const t = e + this.meta + this.temp;
641
+ return Number.isFinite(t) ? t : 0;
642
+ }
643
+ }
644
+ class br {
645
+ frameId = null;
646
+ timerId = null;
647
+ schedule(e, t) {
648
+ switch (e) {
649
+ case "animation":
650
+ this.frameId = globalThis.requestAnimationFrame(t);
651
+ break;
652
+ case "timer":
653
+ this.timerId = globalThis.setTimeout(t, 16);
654
+ break;
655
+ }
656
+ }
657
+ cancel() {
658
+ this.frameId !== null && (globalThis.cancelAnimationFrame(this.frameId), this.frameId = null), this.timerId !== null && (globalThis.clearTimeout(this.timerId), this.timerId = null);
659
+ }
660
+ }
661
+ var W = { exports: {} }, ne, tt;
662
+ function z() {
663
+ if (tt) return ne;
181
664
  tt = 1;
182
- const t = "2.0.0", s = 256, r = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
183
- 9007199254740991, n = 16, i = s - 6;
184
- return se = {
185
- MAX_LENGTH: s,
665
+ const r = "2.0.0", e = 256, t = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
666
+ 9007199254740991, n = 16, i = e - 6;
667
+ return ne = {
668
+ MAX_LENGTH: e,
186
669
  MAX_SAFE_COMPONENT_LENGTH: n,
187
670
  MAX_SAFE_BUILD_LENGTH: i,
188
- MAX_SAFE_INTEGER: r,
671
+ MAX_SAFE_INTEGER: t,
189
672
  RELEASE_TYPES: [
190
673
  "major",
191
674
  "premajor",
@@ -195,96 +678,96 @@ function Y() {
195
678
  "prepatch",
196
679
  "prerelease"
197
680
  ],
198
- SEMVER_SPEC_VERSION: t,
681
+ SEMVER_SPEC_VERSION: r,
199
682
  FLAG_INCLUDE_PRERELEASE: 1,
200
683
  FLAG_LOOSE: 2
201
- }, se;
684
+ }, ne;
202
685
  }
203
- var ne, rt;
204
- function z() {
205
- return rt || (rt = 1, ne = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...s) => console.error("SEMVER", ...s) : () => {
206
- }), ne;
686
+ var ie, rt;
687
+ function Y() {
688
+ return rt || (rt = 1, ie = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...e) => console.error("SEMVER", ...e) : () => {
689
+ }), ie;
207
690
  }
208
691
  var st;
209
692
  function B() {
210
- return st || (st = 1, (function(t, s) {
693
+ return st || (st = 1, (function(r, e) {
211
694
  const {
212
- MAX_SAFE_COMPONENT_LENGTH: r,
695
+ MAX_SAFE_COMPONENT_LENGTH: t,
213
696
  MAX_SAFE_BUILD_LENGTH: n,
214
697
  MAX_LENGTH: i
215
- } = Y(), c = z();
216
- s = t.exports = {};
217
- const l = s.re = [], h = s.safeRe = [], o = s.src = [], a = s.safeSrc = [], e = s.t = {};
698
+ } = z(), c = Y();
699
+ e = r.exports = {};
700
+ const o = e.re = [], h = e.safeRe = [], a = e.src = [], l = e.safeSrc = [], s = e.t = {};
218
701
  let u = 0;
219
- const f = "[a-zA-Z0-9-]", p = [
702
+ const f = "[a-zA-Z0-9-]", E = [
220
703
  ["\\s", 1],
221
704
  ["\\d", i],
222
705
  [f, n]
223
706
  ], S = (N) => {
224
- for (const [A, G] of p)
225
- N = N.split(`${A}*`).join(`${A}{0,${G}}`).split(`${A}+`).join(`${A}{1,${G}}`);
707
+ for (const [A, b] of E)
708
+ N = N.split(`${A}*`).join(`${A}{0,${b}}`).split(`${A}+`).join(`${A}{1,${b}}`);
226
709
  return N;
227
- }, m = (N, A, G) => {
228
- const w = S(A), x = u++;
229
- c(N, x, A), e[N] = x, o[x] = A, a[x] = w, l[x] = new RegExp(A, G ? "g" : void 0), h[x] = new RegExp(w, G ? "g" : void 0);
710
+ }, d = (N, A, b) => {
711
+ const w = S(A), G = u++;
712
+ c(N, G, A), s[N] = G, a[G] = A, l[G] = w, o[G] = new RegExp(A, b ? "g" : void 0), h[G] = new RegExp(w, b ? "g" : void 0);
230
713
  };
231
- m("NUMERICIDENTIFIER", "0|[1-9]\\d*"), m("NUMERICIDENTIFIERLOOSE", "\\d+"), m("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${f}*`), m("MAINVERSION", `(${o[e.NUMERICIDENTIFIER]})\\.(${o[e.NUMERICIDENTIFIER]})\\.(${o[e.NUMERICIDENTIFIER]})`), m("MAINVERSIONLOOSE", `(${o[e.NUMERICIDENTIFIERLOOSE]})\\.(${o[e.NUMERICIDENTIFIERLOOSE]})\\.(${o[e.NUMERICIDENTIFIERLOOSE]})`), m("PRERELEASEIDENTIFIER", `(?:${o[e.NONNUMERICIDENTIFIER]}|${o[e.NUMERICIDENTIFIER]})`), m("PRERELEASEIDENTIFIERLOOSE", `(?:${o[e.NONNUMERICIDENTIFIER]}|${o[e.NUMERICIDENTIFIERLOOSE]})`), m("PRERELEASE", `(?:-(${o[e.PRERELEASEIDENTIFIER]}(?:\\.${o[e.PRERELEASEIDENTIFIER]})*))`), m("PRERELEASELOOSE", `(?:-?(${o[e.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[e.PRERELEASEIDENTIFIERLOOSE]})*))`), m("BUILDIDENTIFIER", `${f}+`), m("BUILD", `(?:\\+(${o[e.BUILDIDENTIFIER]}(?:\\.${o[e.BUILDIDENTIFIER]})*))`), m("FULLPLAIN", `v?${o[e.MAINVERSION]}${o[e.PRERELEASE]}?${o[e.BUILD]}?`), m("FULL", `^${o[e.FULLPLAIN]}$`), m("LOOSEPLAIN", `[v=\\s]*${o[e.MAINVERSIONLOOSE]}${o[e.PRERELEASELOOSE]}?${o[e.BUILD]}?`), m("LOOSE", `^${o[e.LOOSEPLAIN]}$`), m("GTLT", "((?:<|>)?=?)"), m("XRANGEIDENTIFIERLOOSE", `${o[e.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), m("XRANGEIDENTIFIER", `${o[e.NUMERICIDENTIFIER]}|x|X|\\*`), m("XRANGEPLAIN", `[v=\\s]*(${o[e.XRANGEIDENTIFIER]})(?:\\.(${o[e.XRANGEIDENTIFIER]})(?:\\.(${o[e.XRANGEIDENTIFIER]})(?:${o[e.PRERELEASE]})?${o[e.BUILD]}?)?)?`), m("XRANGEPLAINLOOSE", `[v=\\s]*(${o[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[e.XRANGEIDENTIFIERLOOSE]})(?:${o[e.PRERELEASELOOSE]})?${o[e.BUILD]}?)?)?`), m("XRANGE", `^${o[e.GTLT]}\\s*${o[e.XRANGEPLAIN]}$`), m("XRANGELOOSE", `^${o[e.GTLT]}\\s*${o[e.XRANGEPLAINLOOSE]}$`), m("COERCEPLAIN", `(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`), m("COERCE", `${o[e.COERCEPLAIN]}(?:$|[^\\d])`), m("COERCEFULL", o[e.COERCEPLAIN] + `(?:${o[e.PRERELEASE]})?(?:${o[e.BUILD]})?(?:$|[^\\d])`), m("COERCERTL", o[e.COERCE], !0), m("COERCERTLFULL", o[e.COERCEFULL], !0), m("LONETILDE", "(?:~>?)"), m("TILDETRIM", `(\\s*)${o[e.LONETILDE]}\\s+`, !0), s.tildeTrimReplace = "$1~", m("TILDE", `^${o[e.LONETILDE]}${o[e.XRANGEPLAIN]}$`), m("TILDELOOSE", `^${o[e.LONETILDE]}${o[e.XRANGEPLAINLOOSE]}$`), m("LONECARET", "(?:\\^)"), m("CARETTRIM", `(\\s*)${o[e.LONECARET]}\\s+`, !0), s.caretTrimReplace = "$1^", m("CARET", `^${o[e.LONECARET]}${o[e.XRANGEPLAIN]}$`), m("CARETLOOSE", `^${o[e.LONECARET]}${o[e.XRANGEPLAINLOOSE]}$`), m("COMPARATORLOOSE", `^${o[e.GTLT]}\\s*(${o[e.LOOSEPLAIN]})$|^$`), m("COMPARATOR", `^${o[e.GTLT]}\\s*(${o[e.FULLPLAIN]})$|^$`), m("COMPARATORTRIM", `(\\s*)${o[e.GTLT]}\\s*(${o[e.LOOSEPLAIN]}|${o[e.XRANGEPLAIN]})`, !0), s.comparatorTrimReplace = "$1$2$3", m("HYPHENRANGE", `^\\s*(${o[e.XRANGEPLAIN]})\\s+-\\s+(${o[e.XRANGEPLAIN]})\\s*$`), m("HYPHENRANGELOOSE", `^\\s*(${o[e.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[e.XRANGEPLAINLOOSE]})\\s*$`), m("STAR", "(<|>)?=?\\s*\\*"), m("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), m("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
232
- })(H, H.exports)), H.exports;
714
+ d("NUMERICIDENTIFIER", "0|[1-9]\\d*"), d("NUMERICIDENTIFIERLOOSE", "\\d+"), d("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${f}*`), d("MAINVERSION", `(${a[s.NUMERICIDENTIFIER]})\\.(${a[s.NUMERICIDENTIFIER]})\\.(${a[s.NUMERICIDENTIFIER]})`), d("MAINVERSIONLOOSE", `(${a[s.NUMERICIDENTIFIERLOOSE]})\\.(${a[s.NUMERICIDENTIFIERLOOSE]})\\.(${a[s.NUMERICIDENTIFIERLOOSE]})`), d("PRERELEASEIDENTIFIER", `(?:${a[s.NONNUMERICIDENTIFIER]}|${a[s.NUMERICIDENTIFIER]})`), d("PRERELEASEIDENTIFIERLOOSE", `(?:${a[s.NONNUMERICIDENTIFIER]}|${a[s.NUMERICIDENTIFIERLOOSE]})`), d("PRERELEASE", `(?:-(${a[s.PRERELEASEIDENTIFIER]}(?:\\.${a[s.PRERELEASEIDENTIFIER]})*))`), d("PRERELEASELOOSE", `(?:-?(${a[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${a[s.PRERELEASEIDENTIFIERLOOSE]})*))`), d("BUILDIDENTIFIER", `${f}+`), d("BUILD", `(?:\\+(${a[s.BUILDIDENTIFIER]}(?:\\.${a[s.BUILDIDENTIFIER]})*))`), d("FULLPLAIN", `v?${a[s.MAINVERSION]}${a[s.PRERELEASE]}?${a[s.BUILD]}?`), d("FULL", `^${a[s.FULLPLAIN]}$`), d("LOOSEPLAIN", `[v=\\s]*${a[s.MAINVERSIONLOOSE]}${a[s.PRERELEASELOOSE]}?${a[s.BUILD]}?`), d("LOOSE", `^${a[s.LOOSEPLAIN]}$`), d("GTLT", "((?:<|>)?=?)"), d("XRANGEIDENTIFIERLOOSE", `${a[s.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), d("XRANGEIDENTIFIER", `${a[s.NUMERICIDENTIFIER]}|x|X|\\*`), d("XRANGEPLAIN", `[v=\\s]*(${a[s.XRANGEIDENTIFIER]})(?:\\.(${a[s.XRANGEIDENTIFIER]})(?:\\.(${a[s.XRANGEIDENTIFIER]})(?:${a[s.PRERELEASE]})?${a[s.BUILD]}?)?)?`), d("XRANGEPLAINLOOSE", `[v=\\s]*(${a[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${a[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${a[s.XRANGEIDENTIFIERLOOSE]})(?:${a[s.PRERELEASELOOSE]})?${a[s.BUILD]}?)?)?`), d("XRANGE", `^${a[s.GTLT]}\\s*${a[s.XRANGEPLAIN]}$`), d("XRANGELOOSE", `^${a[s.GTLT]}\\s*${a[s.XRANGEPLAINLOOSE]}$`), d("COERCEPLAIN", `(^|[^\\d])(\\d{1,${t}})(?:\\.(\\d{1,${t}}))?(?:\\.(\\d{1,${t}}))?`), d("COERCE", `${a[s.COERCEPLAIN]}(?:$|[^\\d])`), d("COERCEFULL", a[s.COERCEPLAIN] + `(?:${a[s.PRERELEASE]})?(?:${a[s.BUILD]})?(?:$|[^\\d])`), d("COERCERTL", a[s.COERCE], !0), d("COERCERTLFULL", a[s.COERCEFULL], !0), d("LONETILDE", "(?:~>?)"), d("TILDETRIM", `(\\s*)${a[s.LONETILDE]}\\s+`, !0), e.tildeTrimReplace = "$1~", d("TILDE", `^${a[s.LONETILDE]}${a[s.XRANGEPLAIN]}$`), d("TILDELOOSE", `^${a[s.LONETILDE]}${a[s.XRANGEPLAINLOOSE]}$`), d("LONECARET", "(?:\\^)"), d("CARETTRIM", `(\\s*)${a[s.LONECARET]}\\s+`, !0), e.caretTrimReplace = "$1^", d("CARET", `^${a[s.LONECARET]}${a[s.XRANGEPLAIN]}$`), d("CARETLOOSE", `^${a[s.LONECARET]}${a[s.XRANGEPLAINLOOSE]}$`), d("COMPARATORLOOSE", `^${a[s.GTLT]}\\s*(${a[s.LOOSEPLAIN]})$|^$`), d("COMPARATOR", `^${a[s.GTLT]}\\s*(${a[s.FULLPLAIN]})$|^$`), d("COMPARATORTRIM", `(\\s*)${a[s.GTLT]}\\s*(${a[s.LOOSEPLAIN]}|${a[s.XRANGEPLAIN]})`, !0), e.comparatorTrimReplace = "$1$2$3", d("HYPHENRANGE", `^\\s*(${a[s.XRANGEPLAIN]})\\s+-\\s+(${a[s.XRANGEPLAIN]})\\s*$`), d("HYPHENRANGELOOSE", `^\\s*(${a[s.XRANGEPLAINLOOSE]})\\s+-\\s+(${a[s.XRANGEPLAINLOOSE]})\\s*$`), d("STAR", "(<|>)?=?\\s*\\*"), d("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), d("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
715
+ })(W, W.exports)), W.exports;
233
716
  }
234
- var ie, nt;
235
- function ze() {
236
- if (nt) return ie;
717
+ var ae, nt;
718
+ function Ye() {
719
+ if (nt) return ae;
237
720
  nt = 1;
238
- const t = Object.freeze({ loose: !0 }), s = Object.freeze({});
239
- return ie = (n) => n ? typeof n != "object" ? t : n : s, ie;
721
+ const r = Object.freeze({ loose: !0 }), e = Object.freeze({});
722
+ return ae = (n) => n ? typeof n != "object" ? r : n : e, ae;
240
723
  }
241
- var ae, it;
242
- function sr() {
243
- if (it) return ae;
724
+ var oe, it;
725
+ function cr() {
726
+ if (it) return oe;
244
727
  it = 1;
245
- const t = /^[0-9]+$/, s = (n, i) => {
728
+ const r = /^[0-9]+$/, e = (n, i) => {
246
729
  if (typeof n == "number" && typeof i == "number")
247
730
  return n === i ? 0 : n < i ? -1 : 1;
248
- const c = t.test(n), l = t.test(i);
249
- return c && l && (n = +n, i = +i), n === i ? 0 : c && !l ? -1 : l && !c ? 1 : n < i ? -1 : 1;
731
+ const c = r.test(n), o = r.test(i);
732
+ return c && o && (n = +n, i = +i), n === i ? 0 : c && !o ? -1 : o && !c ? 1 : n < i ? -1 : 1;
250
733
  };
251
- return ae = {
252
- compareIdentifiers: s,
253
- rcompareIdentifiers: (n, i) => s(i, n)
254
- }, ae;
255
- }
256
- var oe, at;
257
- function b() {
258
- if (at) return oe;
734
+ return oe = {
735
+ compareIdentifiers: e,
736
+ rcompareIdentifiers: (n, i) => e(i, n)
737
+ }, oe;
738
+ }
739
+ var le, at;
740
+ function D() {
741
+ if (at) return le;
259
742
  at = 1;
260
- const t = z(), { MAX_LENGTH: s, MAX_SAFE_INTEGER: r } = Y(), { safeRe: n, t: i } = B(), c = ze(), { compareIdentifiers: l } = sr();
743
+ const r = Y(), { MAX_LENGTH: e, MAX_SAFE_INTEGER: t } = z(), { safeRe: n, t: i } = B(), c = Ye(), { compareIdentifiers: o } = cr();
261
744
  class h {
262
- constructor(a, e) {
263
- if (e = c(e), a instanceof h) {
264
- if (a.loose === !!e.loose && a.includePrerelease === !!e.includePrerelease)
265
- return a;
266
- a = a.version;
267
- } else if (typeof a != "string")
268
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof a}".`);
269
- if (a.length > s)
745
+ constructor(l, s) {
746
+ if (s = c(s), l instanceof h) {
747
+ if (l.loose === !!s.loose && l.includePrerelease === !!s.includePrerelease)
748
+ return l;
749
+ l = l.version;
750
+ } else if (typeof l != "string")
751
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof l}".`);
752
+ if (l.length > e)
270
753
  throw new TypeError(
271
- `version is longer than ${s} characters`
754
+ `version is longer than ${e} characters`
272
755
  );
273
- t("SemVer", a, e), this.options = e, this.loose = !!e.loose, this.includePrerelease = !!e.includePrerelease;
274
- const u = a.trim().match(e.loose ? n[i.LOOSE] : n[i.FULL]);
756
+ r("SemVer", l, s), this.options = s, this.loose = !!s.loose, this.includePrerelease = !!s.includePrerelease;
757
+ const u = l.trim().match(s.loose ? n[i.LOOSE] : n[i.FULL]);
275
758
  if (!u)
276
- throw new TypeError(`Invalid Version: ${a}`);
277
- if (this.raw = a, this.major = +u[1], this.minor = +u[2], this.patch = +u[3], this.major > r || this.major < 0)
759
+ throw new TypeError(`Invalid Version: ${l}`);
760
+ if (this.raw = l, this.major = +u[1], this.minor = +u[2], this.patch = +u[3], this.major > t || this.major < 0)
278
761
  throw new TypeError("Invalid major version");
279
- if (this.minor > r || this.minor < 0)
762
+ if (this.minor > t || this.minor < 0)
280
763
  throw new TypeError("Invalid minor version");
281
- if (this.patch > r || this.patch < 0)
764
+ if (this.patch > t || this.patch < 0)
282
765
  throw new TypeError("Invalid patch version");
283
766
  u[4] ? this.prerelease = u[4].split(".").map((f) => {
284
767
  if (/^[0-9]+$/.test(f)) {
285
- const p = +f;
286
- if (p >= 0 && p < r)
287
- return p;
768
+ const E = +f;
769
+ if (E >= 0 && E < t)
770
+ return E;
288
771
  }
289
772
  return f;
290
773
  }) : this.prerelease = [], this.build = u[5] ? u[5].split(".") : [], this.format();
@@ -295,28 +778,28 @@ function b() {
295
778
  toString() {
296
779
  return this.version;
297
780
  }
298
- compare(a) {
299
- if (t("SemVer.compare", this.version, this.options, a), !(a instanceof h)) {
300
- if (typeof a == "string" && a === this.version)
781
+ compare(l) {
782
+ if (r("SemVer.compare", this.version, this.options, l), !(l instanceof h)) {
783
+ if (typeof l == "string" && l === this.version)
301
784
  return 0;
302
- a = new h(a, this.options);
785
+ l = new h(l, this.options);
303
786
  }
304
- return a.version === this.version ? 0 : this.compareMain(a) || this.comparePre(a);
787
+ return l.version === this.version ? 0 : this.compareMain(l) || this.comparePre(l);
305
788
  }
306
- compareMain(a) {
307
- return a instanceof h || (a = new h(a, this.options)), this.major < a.major ? -1 : this.major > a.major ? 1 : this.minor < a.minor ? -1 : this.minor > a.minor ? 1 : this.patch < a.patch ? -1 : this.patch > a.patch ? 1 : 0;
789
+ compareMain(l) {
790
+ return l instanceof h || (l = new h(l, this.options)), this.major < l.major ? -1 : this.major > l.major ? 1 : this.minor < l.minor ? -1 : this.minor > l.minor ? 1 : this.patch < l.patch ? -1 : this.patch > l.patch ? 1 : 0;
308
791
  }
309
- comparePre(a) {
310
- if (a instanceof h || (a = new h(a, this.options)), this.prerelease.length && !a.prerelease.length)
792
+ comparePre(l) {
793
+ if (l instanceof h || (l = new h(l, this.options)), this.prerelease.length && !l.prerelease.length)
311
794
  return -1;
312
- if (!this.prerelease.length && a.prerelease.length)
795
+ if (!this.prerelease.length && l.prerelease.length)
313
796
  return 1;
314
- if (!this.prerelease.length && !a.prerelease.length)
797
+ if (!this.prerelease.length && !l.prerelease.length)
315
798
  return 0;
316
- let e = 0;
799
+ let s = 0;
317
800
  do {
318
- const u = this.prerelease[e], f = a.prerelease[e];
319
- if (t("prerelease compare", e, u, f), u === void 0 && f === void 0)
801
+ const u = this.prerelease[s], f = l.prerelease[s];
802
+ if (r("prerelease compare", s, u, f), u === void 0 && f === void 0)
320
803
  return 0;
321
804
  if (f === void 0)
322
805
  return 1;
@@ -324,15 +807,15 @@ function b() {
324
807
  return -1;
325
808
  if (u === f)
326
809
  continue;
327
- return l(u, f);
328
- } while (++e);
810
+ return o(u, f);
811
+ } while (++s);
329
812
  }
330
- compareBuild(a) {
331
- a instanceof h || (a = new h(a, this.options));
332
- let e = 0;
813
+ compareBuild(l) {
814
+ l instanceof h || (l = new h(l, this.options));
815
+ let s = 0;
333
816
  do {
334
- const u = this.build[e], f = a.build[e];
335
- if (t("build compare", e, u, f), u === void 0 && f === void 0)
817
+ const u = this.build[s], f = l.build[s];
818
+ if (r("build compare", s, u, f), u === void 0 && f === void 0)
336
819
  return 0;
337
820
  if (f === void 0)
338
821
  return 1;
@@ -340,35 +823,35 @@ function b() {
340
823
  return -1;
341
824
  if (u === f)
342
825
  continue;
343
- return l(u, f);
344
- } while (++e);
826
+ return o(u, f);
827
+ } while (++s);
345
828
  }
346
829
  // preminor will bump the version up to the next minor release, and immediately
347
830
  // down to pre-release. premajor and prepatch work the same way.
348
- inc(a, e, u) {
349
- if (a.startsWith("pre")) {
350
- if (!e && u === !1)
831
+ inc(l, s, u) {
832
+ if (l.startsWith("pre")) {
833
+ if (!s && u === !1)
351
834
  throw new Error("invalid increment argument: identifier is empty");
352
- if (e) {
353
- const f = `-${e}`.match(this.options.loose ? n[i.PRERELEASELOOSE] : n[i.PRERELEASE]);
354
- if (!f || f[1] !== e)
355
- throw new Error(`invalid identifier: ${e}`);
835
+ if (s) {
836
+ const f = `-${s}`.match(this.options.loose ? n[i.PRERELEASELOOSE] : n[i.PRERELEASE]);
837
+ if (!f || f[1] !== s)
838
+ throw new Error(`invalid identifier: ${s}`);
356
839
  }
357
840
  }
358
- switch (a) {
841
+ switch (l) {
359
842
  case "premajor":
360
- this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", e, u);
843
+ this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", s, u);
361
844
  break;
362
845
  case "preminor":
363
- this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", e, u);
846
+ this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", s, u);
364
847
  break;
365
848
  case "prepatch":
366
- this.prerelease.length = 0, this.inc("patch", e, u), this.inc("pre", e, u);
849
+ this.prerelease.length = 0, this.inc("patch", s, u), this.inc("pre", s, u);
367
850
  break;
368
851
  // If the input is a non-prerelease version, this acts the same as
369
852
  // prepatch.
370
853
  case "prerelease":
371
- this.prerelease.length === 0 && this.inc("patch", e, u), this.inc("pre", e, u);
854
+ this.prerelease.length === 0 && this.inc("patch", s, u), this.inc("pre", s, u);
372
855
  break;
373
856
  case "release":
374
857
  if (this.prerelease.length === 0)
@@ -391,328 +874,328 @@ function b() {
391
874
  if (this.prerelease.length === 0)
392
875
  this.prerelease = [f];
393
876
  else {
394
- let p = this.prerelease.length;
395
- for (; --p >= 0; )
396
- typeof this.prerelease[p] == "number" && (this.prerelease[p]++, p = -2);
397
- if (p === -1) {
398
- if (e === this.prerelease.join(".") && u === !1)
877
+ let E = this.prerelease.length;
878
+ for (; --E >= 0; )
879
+ typeof this.prerelease[E] == "number" && (this.prerelease[E]++, E = -2);
880
+ if (E === -1) {
881
+ if (s === this.prerelease.join(".") && u === !1)
399
882
  throw new Error("invalid increment argument: identifier already exists");
400
883
  this.prerelease.push(f);
401
884
  }
402
885
  }
403
- if (e) {
404
- let p = [e, f];
405
- u === !1 && (p = [e]), l(this.prerelease[0], e) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = p) : this.prerelease = p;
886
+ if (s) {
887
+ let E = [s, f];
888
+ u === !1 && (E = [s]), o(this.prerelease[0], s) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = E) : this.prerelease = E;
406
889
  }
407
890
  break;
408
891
  }
409
892
  default:
410
- throw new Error(`invalid increment argument: ${a}`);
893
+ throw new Error(`invalid increment argument: ${l}`);
411
894
  }
412
895
  return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
413
896
  }
414
897
  }
415
- return oe = h, oe;
898
+ return le = h, le;
416
899
  }
417
- var le, ot;
418
- function M() {
419
- if (ot) return le;
900
+ var ce, ot;
901
+ function j() {
902
+ if (ot) return ce;
420
903
  ot = 1;
421
- const t = b();
422
- return le = (r, n, i = !1) => {
423
- if (r instanceof t)
424
- return r;
904
+ const r = D();
905
+ return ce = (t, n, i = !1) => {
906
+ if (t instanceof r)
907
+ return t;
425
908
  try {
426
- return new t(r, n);
909
+ return new r(t, n);
427
910
  } catch (c) {
428
911
  if (!i)
429
912
  return null;
430
913
  throw c;
431
914
  }
432
- }, le;
915
+ }, ce;
433
916
  }
434
- var ce, lt;
435
- function Or() {
436
- if (lt) return ce;
917
+ var ue, lt;
918
+ function Gr() {
919
+ if (lt) return ue;
437
920
  lt = 1;
438
- const t = M();
439
- return ce = (r, n) => {
440
- const i = t(r, n);
921
+ const r = j();
922
+ return ue = (t, n) => {
923
+ const i = r(t, n);
441
924
  return i ? i.version : null;
442
- }, ce;
925
+ }, ue;
443
926
  }
444
- var ue, ct;
445
- function Ar() {
446
- if (ct) return ue;
927
+ var he, ct;
928
+ function xr() {
929
+ if (ct) return he;
447
930
  ct = 1;
448
- const t = M();
449
- return ue = (r, n) => {
450
- const i = t(r.trim().replace(/^[=v]+/, ""), n);
931
+ const r = j();
932
+ return he = (t, n) => {
933
+ const i = r(t.trim().replace(/^[=v]+/, ""), n);
451
934
  return i ? i.version : null;
452
- }, ue;
935
+ }, he;
453
936
  }
454
937
  var fe, ut;
455
- function wr() {
938
+ function Dr() {
456
939
  if (ut) return fe;
457
940
  ut = 1;
458
- const t = b();
459
- return fe = (r, n, i, c, l) => {
460
- typeof i == "string" && (l = c, c = i, i = void 0);
941
+ const r = D();
942
+ return fe = (t, n, i, c, o) => {
943
+ typeof i == "string" && (o = c, c = i, i = void 0);
461
944
  try {
462
- return new t(
463
- r instanceof t ? r.version : r,
945
+ return new r(
946
+ t instanceof r ? t.version : t,
464
947
  i
465
- ).inc(n, c, l).version;
948
+ ).inc(n, c, o).version;
466
949
  } catch {
467
950
  return null;
468
951
  }
469
952
  }, fe;
470
953
  }
471
- var he, ft;
472
- function yr() {
473
- if (ft) return he;
474
- ft = 1;
475
- const t = M();
476
- return he = (r, n) => {
477
- const i = t(r, null, !0), c = t(n, null, !0), l = i.compare(c);
478
- if (l === 0)
954
+ var me, ht;
955
+ function _r() {
956
+ if (ht) return me;
957
+ ht = 1;
958
+ const r = j();
959
+ return me = (t, n) => {
960
+ const i = r(t, null, !0), c = r(n, null, !0), o = i.compare(c);
961
+ if (o === 0)
479
962
  return null;
480
- const h = l > 0, o = h ? i : c, a = h ? c : i, e = !!o.prerelease.length;
481
- if (!!a.prerelease.length && !e) {
482
- if (!a.patch && !a.minor)
963
+ const h = o > 0, a = h ? i : c, l = h ? c : i, s = !!a.prerelease.length;
964
+ if (!!l.prerelease.length && !s) {
965
+ if (!l.patch && !l.minor)
483
966
  return "major";
484
- if (a.compareMain(o) === 0)
485
- return a.minor && !a.patch ? "minor" : "patch";
967
+ if (l.compareMain(a) === 0)
968
+ return l.minor && !l.patch ? "minor" : "patch";
486
969
  }
487
- const f = e ? "pre" : "";
970
+ const f = s ? "pre" : "";
488
971
  return i.major !== c.major ? f + "major" : i.minor !== c.minor ? f + "minor" : i.patch !== c.patch ? f + "patch" : "prerelease";
489
- }, he;
490
- }
491
- var de, ht;
492
- function Cr() {
493
- if (ht) return de;
494
- ht = 1;
495
- const t = b();
496
- return de = (r, n) => new t(r, n).major, de;
972
+ }, me;
497
973
  }
498
- var me, dt;
499
- function qr() {
500
- if (dt) return me;
501
- dt = 1;
502
- const t = b();
503
- return me = (r, n) => new t(r, n).minor, me;
974
+ var de, ft;
975
+ function Ur() {
976
+ if (ft) return de;
977
+ ft = 1;
978
+ const r = D();
979
+ return de = (t, n) => new r(t, n).major, de;
504
980
  }
505
- var Ee, mt;
506
- function Pr() {
507
- if (mt) return Ee;
981
+ var pe, mt;
982
+ function Fr() {
983
+ if (mt) return pe;
508
984
  mt = 1;
509
- const t = b();
510
- return Ee = (r, n) => new t(r, n).patch, Ee;
985
+ const r = D();
986
+ return pe = (t, n) => new r(t, n).minor, pe;
511
987
  }
512
- var pe, Et;
513
- function Gr() {
514
- if (Et) return pe;
515
- Et = 1;
516
- const t = M();
517
- return pe = (r, n) => {
518
- const i = t(r, n);
988
+ var Ee, dt;
989
+ function kr() {
990
+ if (dt) return Ee;
991
+ dt = 1;
992
+ const r = D();
993
+ return Ee = (t, n) => new r(t, n).patch, Ee;
994
+ }
995
+ var ge, pt;
996
+ function jr() {
997
+ if (pt) return ge;
998
+ pt = 1;
999
+ const r = j();
1000
+ return ge = (t, n) => {
1001
+ const i = r(t, n);
519
1002
  return i && i.prerelease.length ? i.prerelease : null;
520
- }, pe;
1003
+ }, ge;
521
1004
  }
522
- var Re, pt;
1005
+ var Re, Et;
523
1006
  function U() {
524
- if (pt) return Re;
525
- pt = 1;
526
- const t = b();
527
- return Re = (r, n, i) => new t(r, i).compare(new t(n, i)), Re;
1007
+ if (Et) return Re;
1008
+ Et = 1;
1009
+ const r = D();
1010
+ return Re = (t, n, i) => new r(t, i).compare(new r(n, i)), Re;
528
1011
  }
529
- var ve, Rt;
530
- function xr() {
531
- if (Rt) return ve;
1012
+ var ve, gt;
1013
+ function Mr() {
1014
+ if (gt) return ve;
1015
+ gt = 1;
1016
+ const r = U();
1017
+ return ve = (t, n, i) => r(n, t, i), ve;
1018
+ }
1019
+ var Ie, Rt;
1020
+ function Vr() {
1021
+ if (Rt) return Ie;
532
1022
  Rt = 1;
533
- const t = U();
534
- return ve = (r, n, i) => t(n, r, i), ve;
1023
+ const r = U();
1024
+ return Ie = (t, n) => r(t, n, !0), Ie;
535
1025
  }
536
- var Ie, vt;
537
- function Dr() {
538
- if (vt) return Ie;
1026
+ var $e, vt;
1027
+ function Ke() {
1028
+ if (vt) return $e;
539
1029
  vt = 1;
540
- const t = U();
541
- return Ie = (r, n) => t(r, n, !0), Ie;
1030
+ const r = D();
1031
+ return $e = (t, n, i) => {
1032
+ const c = new r(t, i), o = new r(n, i);
1033
+ return c.compare(o) || c.compareBuild(o);
1034
+ }, $e;
542
1035
  }
543
- var ge, It;
544
- function Je() {
545
- if (It) return ge;
1036
+ var Le, It;
1037
+ function Xr() {
1038
+ if (It) return Le;
546
1039
  It = 1;
547
- const t = b();
548
- return ge = (r, n, i) => {
549
- const c = new t(r, i), l = new t(n, i);
550
- return c.compare(l) || c.compareBuild(l);
551
- }, ge;
552
- }
553
- var $e, gt;
554
- function br() {
555
- if (gt) return $e;
556
- gt = 1;
557
- const t = Je();
558
- return $e = (r, n) => r.sort((i, c) => t(i, c, n)), $e;
1040
+ const r = Ke();
1041
+ return Le = (t, n) => t.sort((i, c) => r(i, c, n)), Le;
559
1042
  }
560
- var Le, $t;
561
- function _r() {
562
- if ($t) return Le;
1043
+ var Te, $t;
1044
+ function Br() {
1045
+ if ($t) return Te;
563
1046
  $t = 1;
564
- const t = Je();
565
- return Le = (r, n) => r.sort((i, c) => t(c, i, n)), Le;
1047
+ const r = Ke();
1048
+ return Te = (t, n) => t.sort((i, c) => r(c, i, n)), Te;
566
1049
  }
567
- var Te, Lt;
568
- function J() {
569
- if (Lt) return Te;
1050
+ var Ne, Lt;
1051
+ function K() {
1052
+ if (Lt) return Ne;
570
1053
  Lt = 1;
571
- const t = U();
572
- return Te = (r, n, i) => t(r, n, i) > 0, Te;
1054
+ const r = U();
1055
+ return Ne = (t, n, i) => r(t, n, i) > 0, Ne;
573
1056
  }
574
- var Ne, Tt;
575
- function Ke() {
576
- if (Tt) return Ne;
1057
+ var Se, Tt;
1058
+ function Ze() {
1059
+ if (Tt) return Se;
577
1060
  Tt = 1;
578
- const t = U();
579
- return Ne = (r, n, i) => t(r, n, i) < 0, Ne;
1061
+ const r = U();
1062
+ return Se = (t, n, i) => r(t, n, i) < 0, Se;
580
1063
  }
581
- var Se, Nt;
582
- function nr() {
583
- if (Nt) return Se;
1064
+ var Oe, Nt;
1065
+ function ur() {
1066
+ if (Nt) return Oe;
584
1067
  Nt = 1;
585
- const t = U();
586
- return Se = (r, n, i) => t(r, n, i) === 0, Se;
1068
+ const r = U();
1069
+ return Oe = (t, n, i) => r(t, n, i) === 0, Oe;
587
1070
  }
588
- var Oe, St;
589
- function ir() {
590
- if (St) return Oe;
1071
+ var Ae, St;
1072
+ function hr() {
1073
+ if (St) return Ae;
591
1074
  St = 1;
592
- const t = U();
593
- return Oe = (r, n, i) => t(r, n, i) !== 0, Oe;
1075
+ const r = U();
1076
+ return Ae = (t, n, i) => r(t, n, i) !== 0, Ae;
594
1077
  }
595
- var Ae, Ot;
596
- function Ze() {
597
- if (Ot) return Ae;
1078
+ var we, Ot;
1079
+ function Je() {
1080
+ if (Ot) return we;
598
1081
  Ot = 1;
599
- const t = U();
600
- return Ae = (r, n, i) => t(r, n, i) >= 0, Ae;
1082
+ const r = U();
1083
+ return we = (t, n, i) => r(t, n, i) >= 0, we;
601
1084
  }
602
- var we, At;
1085
+ var ye, At;
603
1086
  function Qe() {
604
- if (At) return we;
1087
+ if (At) return ye;
605
1088
  At = 1;
606
- const t = U();
607
- return we = (r, n, i) => t(r, n, i) <= 0, we;
1089
+ const r = U();
1090
+ return ye = (t, n, i) => r(t, n, i) <= 0, ye;
608
1091
  }
609
- var ye, wt;
610
- function ar() {
611
- if (wt) return ye;
1092
+ var Ce, wt;
1093
+ function fr() {
1094
+ if (wt) return Ce;
612
1095
  wt = 1;
613
- const t = nr(), s = ir(), r = J(), n = Ze(), i = Ke(), c = Qe();
614
- return ye = (h, o, a, e) => {
615
- switch (o) {
1096
+ const r = ur(), e = hr(), t = K(), n = Je(), i = Ze(), c = Qe();
1097
+ return Ce = (h, a, l, s) => {
1098
+ switch (a) {
616
1099
  case "===":
617
- return typeof h == "object" && (h = h.version), typeof a == "object" && (a = a.version), h === a;
1100
+ return typeof h == "object" && (h = h.version), typeof l == "object" && (l = l.version), h === l;
618
1101
  case "!==":
619
- return typeof h == "object" && (h = h.version), typeof a == "object" && (a = a.version), h !== a;
1102
+ return typeof h == "object" && (h = h.version), typeof l == "object" && (l = l.version), h !== l;
620
1103
  case "":
621
1104
  case "=":
622
1105
  case "==":
623
- return t(h, a, e);
1106
+ return r(h, l, s);
624
1107
  case "!=":
625
- return s(h, a, e);
1108
+ return e(h, l, s);
626
1109
  case ">":
627
- return r(h, a, e);
1110
+ return t(h, l, s);
628
1111
  case ">=":
629
- return n(h, a, e);
1112
+ return n(h, l, s);
630
1113
  case "<":
631
- return i(h, a, e);
1114
+ return i(h, l, s);
632
1115
  case "<=":
633
- return c(h, a, e);
1116
+ return c(h, l, s);
634
1117
  default:
635
- throw new TypeError(`Invalid operator: ${o}`);
1118
+ throw new TypeError(`Invalid operator: ${a}`);
636
1119
  }
637
- }, ye;
1120
+ }, Ce;
638
1121
  }
639
- var Ce, yt;
640
- function Ur() {
641
- if (yt) return Ce;
1122
+ var Pe, yt;
1123
+ function Wr() {
1124
+ if (yt) return Pe;
642
1125
  yt = 1;
643
- const t = b(), s = M(), { safeRe: r, t: n } = B();
644
- return Ce = (c, l) => {
645
- if (c instanceof t)
1126
+ const r = D(), e = j(), { safeRe: t, t: n } = B();
1127
+ return Pe = (c, o) => {
1128
+ if (c instanceof r)
646
1129
  return c;
647
1130
  if (typeof c == "number" && (c = String(c)), typeof c != "string")
648
1131
  return null;
649
- l = l || {};
1132
+ o = o || {};
650
1133
  let h = null;
651
- if (!l.rtl)
652
- h = c.match(l.includePrerelease ? r[n.COERCEFULL] : r[n.COERCE]);
1134
+ if (!o.rtl)
1135
+ h = c.match(o.includePrerelease ? t[n.COERCEFULL] : t[n.COERCE]);
653
1136
  else {
654
- const p = l.includePrerelease ? r[n.COERCERTLFULL] : r[n.COERCERTL];
1137
+ const E = o.includePrerelease ? t[n.COERCERTLFULL] : t[n.COERCERTL];
655
1138
  let S;
656
- for (; (S = p.exec(c)) && (!h || h.index + h[0].length !== c.length); )
657
- (!h || S.index + S[0].length !== h.index + h[0].length) && (h = S), p.lastIndex = S.index + S[1].length + S[2].length;
658
- p.lastIndex = -1;
1139
+ for (; (S = E.exec(c)) && (!h || h.index + h[0].length !== c.length); )
1140
+ (!h || S.index + S[0].length !== h.index + h[0].length) && (h = S), E.lastIndex = S.index + S[1].length + S[2].length;
1141
+ E.lastIndex = -1;
659
1142
  }
660
1143
  if (h === null)
661
1144
  return null;
662
- const o = h[2], a = h[3] || "0", e = h[4] || "0", u = l.includePrerelease && h[5] ? `-${h[5]}` : "", f = l.includePrerelease && h[6] ? `+${h[6]}` : "";
663
- return s(`${o}.${a}.${e}${u}${f}`, l);
664
- }, Ce;
1145
+ const a = h[2], l = h[3] || "0", s = h[4] || "0", u = o.includePrerelease && h[5] ? `-${h[5]}` : "", f = o.includePrerelease && h[6] ? `+${h[6]}` : "";
1146
+ return e(`${a}.${l}.${s}${u}${f}`, o);
1147
+ }, Pe;
665
1148
  }
666
1149
  var qe, Ct;
667
- function jr() {
1150
+ function Hr() {
668
1151
  if (Ct) return qe;
669
1152
  Ct = 1;
670
- class t {
1153
+ class r {
671
1154
  constructor() {
672
1155
  this.max = 1e3, this.map = /* @__PURE__ */ new Map();
673
1156
  }
674
- get(r) {
675
- const n = this.map.get(r);
1157
+ get(t) {
1158
+ const n = this.map.get(t);
676
1159
  if (n !== void 0)
677
- return this.map.delete(r), this.map.set(r, n), n;
1160
+ return this.map.delete(t), this.map.set(t, n), n;
678
1161
  }
679
- delete(r) {
680
- return this.map.delete(r);
1162
+ delete(t) {
1163
+ return this.map.delete(t);
681
1164
  }
682
- set(r, n) {
683
- if (!this.delete(r) && n !== void 0) {
1165
+ set(t, n) {
1166
+ if (!this.delete(t) && n !== void 0) {
684
1167
  if (this.map.size >= this.max) {
685
1168
  const c = this.map.keys().next().value;
686
1169
  this.delete(c);
687
1170
  }
688
- this.map.set(r, n);
1171
+ this.map.set(t, n);
689
1172
  }
690
1173
  return this;
691
1174
  }
692
1175
  }
693
- return qe = t, qe;
1176
+ return qe = r, qe;
694
1177
  }
695
- var Pe, qt;
696
- function j() {
697
- if (qt) return Pe;
698
- qt = 1;
699
- const t = /\s+/g;
700
- class s {
701
- constructor(d, I) {
702
- if (I = i(I), d instanceof s)
703
- return d.loose === !!I.loose && d.includePrerelease === !!I.includePrerelease ? d : new s(d.raw, I);
704
- if (d instanceof c)
705
- return this.raw = d.value, this.set = [[d]], this.formatted = void 0, this;
706
- if (this.options = I, this.loose = !!I.loose, this.includePrerelease = !!I.includePrerelease, this.raw = d.trim().replace(t, " "), this.set = this.raw.split("||").map((R) => this.parseRange(R.trim())).filter((R) => R.length), !this.set.length)
1178
+ var be, Pt;
1179
+ function F() {
1180
+ if (Pt) return be;
1181
+ Pt = 1;
1182
+ const r = /\s+/g;
1183
+ class e {
1184
+ constructor(m, v) {
1185
+ if (v = i(v), m instanceof e)
1186
+ return m.loose === !!v.loose && m.includePrerelease === !!v.includePrerelease ? m : new e(m.raw, v);
1187
+ if (m instanceof c)
1188
+ return this.raw = m.value, this.set = [[m]], this.formatted = void 0, this;
1189
+ if (this.options = v, this.loose = !!v.loose, this.includePrerelease = !!v.includePrerelease, this.raw = m.trim().replace(r, " "), this.set = this.raw.split("||").map((g) => this.parseRange(g.trim())).filter((g) => g.length), !this.set.length)
707
1190
  throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
708
1191
  if (this.set.length > 1) {
709
- const R = this.set[0];
710
- if (this.set = this.set.filter((g) => !m(g[0])), this.set.length === 0)
711
- this.set = [R];
1192
+ const g = this.set[0];
1193
+ if (this.set = this.set.filter((I) => !d(I[0])), this.set.length === 0)
1194
+ this.set = [g];
712
1195
  else if (this.set.length > 1) {
713
- for (const g of this.set)
714
- if (g.length === 1 && N(g[0])) {
715
- this.set = [g];
1196
+ for (const I of this.set)
1197
+ if (I.length === 1 && N(I[0])) {
1198
+ this.set = [I];
716
1199
  break;
717
1200
  }
718
1201
  }
@@ -722,11 +1205,11 @@ function j() {
722
1205
  get range() {
723
1206
  if (this.formatted === void 0) {
724
1207
  this.formatted = "";
725
- for (let d = 0; d < this.set.length; d++) {
726
- d > 0 && (this.formatted += "||");
727
- const I = this.set[d];
728
- for (let R = 0; R < I.length; R++)
729
- R > 0 && (this.formatted += " "), this.formatted += I[R].toString().trim();
1208
+ for (let m = 0; m < this.set.length; m++) {
1209
+ m > 0 && (this.formatted += "||");
1210
+ const v = this.set[m];
1211
+ for (let g = 0; g < v.length; g++)
1212
+ g > 0 && (this.formatted += " "), this.formatted += v[g].toString().trim();
730
1213
  }
731
1214
  }
732
1215
  return this.formatted;
@@ -737,335 +1220,335 @@ function j() {
737
1220
  toString() {
738
1221
  return this.range;
739
1222
  }
740
- parseRange(d) {
741
- const R = ((this.options.includePrerelease && p) | (this.options.loose && S)) + ":" + d, g = n.get(R);
742
- if (g)
743
- return g;
744
- const v = this.options.loose, $ = v ? o[a.HYPHENRANGELOOSE] : o[a.HYPHENRANGE];
745
- d = d.replace($, te(this.options.includePrerelease)), l("hyphen replace", d), d = d.replace(o[a.COMPARATORTRIM], e), l("comparator trim", d), d = d.replace(o[a.TILDETRIM], u), l("tilde trim", d), d = d.replace(o[a.CARETTRIM], f), l("caret trim", d);
746
- let O = d.split(" ").map((q) => G(q, this.options)).join(" ").split(/\s+/).map((q) => ee(q, this.options));
747
- v && (O = O.filter((q) => (l("loose invalid filter", q, this.options), !!q.match(o[a.COMPARATORLOOSE])))), l("range list", O);
748
- const T = /* @__PURE__ */ new Map(), y = O.map((q) => new c(q, this.options));
749
- for (const q of y) {
750
- if (m(q))
751
- return [q];
752
- T.set(q.value, q);
1223
+ parseRange(m) {
1224
+ const g = ((this.options.includePrerelease && E) | (this.options.loose && S)) + ":" + m, I = n.get(g);
1225
+ if (I)
1226
+ return I;
1227
+ const R = this.options.loose, $ = R ? a[l.HYPHENRANGELOOSE] : a[l.HYPHENRANGE];
1228
+ m = m.replace($, te(this.options.includePrerelease)), o("hyphen replace", m), m = m.replace(a[l.COMPARATORTRIM], s), o("comparator trim", m), m = m.replace(a[l.TILDETRIM], u), o("tilde trim", m), m = m.replace(a[l.CARETTRIM], f), o("caret trim", m);
1229
+ let O = m.split(" ").map((P) => b(P, this.options)).join(" ").split(/\s+/).map((P) => ee(P, this.options));
1230
+ R && (O = O.filter((P) => (o("loose invalid filter", P, this.options), !!P.match(a[l.COMPARATORLOOSE])))), o("range list", O);
1231
+ const T = /* @__PURE__ */ new Map(), y = O.map((P) => new c(P, this.options));
1232
+ for (const P of y) {
1233
+ if (d(P))
1234
+ return [P];
1235
+ T.set(P.value, P);
753
1236
  }
754
1237
  T.size > 1 && T.has("") && T.delete("");
755
- const D = [...T.values()];
756
- return n.set(R, D), D;
1238
+ const x = [...T.values()];
1239
+ return n.set(g, x), x;
757
1240
  }
758
- intersects(d, I) {
759
- if (!(d instanceof s))
1241
+ intersects(m, v) {
1242
+ if (!(m instanceof e))
760
1243
  throw new TypeError("a Range is required");
761
- return this.set.some((R) => A(R, I) && d.set.some((g) => A(g, I) && R.every((v) => g.every(($) => v.intersects($, I)))));
1244
+ return this.set.some((g) => A(g, v) && m.set.some((I) => A(I, v) && g.every((R) => I.every(($) => R.intersects($, v)))));
762
1245
  }
763
1246
  // if ANY of the sets match ALL of its comparators, then pass
764
- test(d) {
765
- if (!d)
1247
+ test(m) {
1248
+ if (!m)
766
1249
  return !1;
767
- if (typeof d == "string")
1250
+ if (typeof m == "string")
768
1251
  try {
769
- d = new h(d, this.options);
1252
+ m = new h(m, this.options);
770
1253
  } catch {
771
1254
  return !1;
772
1255
  }
773
- for (let I = 0; I < this.set.length; I++)
774
- if (re(this.set[I], d, this.options))
1256
+ for (let v = 0; v < this.set.length; v++)
1257
+ if (re(this.set[v], m, this.options))
775
1258
  return !0;
776
1259
  return !1;
777
1260
  }
778
1261
  }
779
- Pe = s;
780
- const r = jr(), n = new r(), i = ze(), c = K(), l = z(), h = b(), {
781
- safeRe: o,
782
- t: a,
783
- comparatorTrimReplace: e,
1262
+ be = e;
1263
+ const t = Hr(), n = new t(), i = Ye(), c = Z(), o = Y(), h = D(), {
1264
+ safeRe: a,
1265
+ t: l,
1266
+ comparatorTrimReplace: s,
784
1267
  tildeTrimReplace: u,
785
1268
  caretTrimReplace: f
786
- } = B(), { FLAG_INCLUDE_PRERELEASE: p, FLAG_LOOSE: S } = Y(), m = (E) => E.value === "<0.0.0-0", N = (E) => E.value === "", A = (E, d) => {
787
- let I = !0;
788
- const R = E.slice();
789
- let g = R.pop();
790
- for (; I && R.length; )
791
- I = R.every((v) => g.intersects(v, d)), g = R.pop();
792
- return I;
793
- }, G = (E, d) => (E = E.replace(o[a.BUILD], ""), l("comp", E, d), E = C(E, d), l("caret", E), E = x(E, d), l("tildes", E), E = L(E, d), l("xrange", E), E = Q(E, d), l("stars", E), E), w = (E) => !E || E.toLowerCase() === "x" || E === "*", x = (E, d) => E.trim().split(/\s+/).map((I) => _(I, d)).join(" "), _ = (E, d) => {
794
- const I = d.loose ? o[a.TILDELOOSE] : o[a.TILDE];
795
- return E.replace(I, (R, g, v, $, O) => {
796
- l("tilde", E, R, g, v, $, O);
1269
+ } = B(), { FLAG_INCLUDE_PRERELEASE: E, FLAG_LOOSE: S } = z(), d = (p) => p.value === "<0.0.0-0", N = (p) => p.value === "", A = (p, m) => {
1270
+ let v = !0;
1271
+ const g = p.slice();
1272
+ let I = g.pop();
1273
+ for (; v && g.length; )
1274
+ v = g.every((R) => I.intersects(R, m)), I = g.pop();
1275
+ return v;
1276
+ }, b = (p, m) => (p = p.replace(a[l.BUILD], ""), o("comp", p, m), p = C(p, m), o("caret", p), p = G(p, m), o("tildes", p), p = L(p, m), o("xrange", p), p = Q(p, m), o("stars", p), p), w = (p) => !p || p.toLowerCase() === "x" || p === "*", G = (p, m) => p.trim().split(/\s+/).map((v) => _(v, m)).join(" "), _ = (p, m) => {
1277
+ const v = m.loose ? a[l.TILDELOOSE] : a[l.TILDE];
1278
+ return p.replace(v, (g, I, R, $, O) => {
1279
+ o("tilde", p, g, I, R, $, O);
797
1280
  let T;
798
- return w(g) ? T = "" : w(v) ? T = `>=${g}.0.0 <${+g + 1}.0.0-0` : w($) ? T = `>=${g}.${v}.0 <${g}.${+v + 1}.0-0` : O ? (l("replaceTilde pr", O), T = `>=${g}.${v}.${$}-${O} <${g}.${+v + 1}.0-0`) : T = `>=${g}.${v}.${$} <${g}.${+v + 1}.0-0`, l("tilde return", T), T;
1281
+ return w(I) ? T = "" : w(R) ? T = `>=${I}.0.0 <${+I + 1}.0.0-0` : w($) ? T = `>=${I}.${R}.0 <${I}.${+R + 1}.0-0` : O ? (o("replaceTilde pr", O), T = `>=${I}.${R}.${$}-${O} <${I}.${+R + 1}.0-0`) : T = `>=${I}.${R}.${$} <${I}.${+R + 1}.0-0`, o("tilde return", T), T;
799
1282
  });
800
- }, C = (E, d) => E.trim().split(/\s+/).map((I) => P(I, d)).join(" "), P = (E, d) => {
801
- l("caret", E, d);
802
- const I = d.loose ? o[a.CARETLOOSE] : o[a.CARET], R = d.includePrerelease ? "-0" : "";
803
- return E.replace(I, (g, v, $, O, T) => {
804
- l("caret", E, g, v, $, O, T);
1283
+ }, C = (p, m) => p.trim().split(/\s+/).map((v) => q(v, m)).join(" "), q = (p, m) => {
1284
+ o("caret", p, m);
1285
+ const v = m.loose ? a[l.CARETLOOSE] : a[l.CARET], g = m.includePrerelease ? "-0" : "";
1286
+ return p.replace(v, (I, R, $, O, T) => {
1287
+ o("caret", p, I, R, $, O, T);
805
1288
  let y;
806
- return w(v) ? y = "" : w($) ? y = `>=${v}.0.0${R} <${+v + 1}.0.0-0` : w(O) ? v === "0" ? y = `>=${v}.${$}.0${R} <${v}.${+$ + 1}.0-0` : y = `>=${v}.${$}.0${R} <${+v + 1}.0.0-0` : T ? (l("replaceCaret pr", T), v === "0" ? $ === "0" ? y = `>=${v}.${$}.${O}-${T} <${v}.${$}.${+O + 1}-0` : y = `>=${v}.${$}.${O}-${T} <${v}.${+$ + 1}.0-0` : y = `>=${v}.${$}.${O}-${T} <${+v + 1}.0.0-0`) : (l("no pr"), v === "0" ? $ === "0" ? y = `>=${v}.${$}.${O}${R} <${v}.${$}.${+O + 1}-0` : y = `>=${v}.${$}.${O}${R} <${v}.${+$ + 1}.0-0` : y = `>=${v}.${$}.${O} <${+v + 1}.0.0-0`), l("caret return", y), y;
1289
+ return w(R) ? y = "" : w($) ? y = `>=${R}.0.0${g} <${+R + 1}.0.0-0` : w(O) ? R === "0" ? y = `>=${R}.${$}.0${g} <${R}.${+$ + 1}.0-0` : y = `>=${R}.${$}.0${g} <${+R + 1}.0.0-0` : T ? (o("replaceCaret pr", T), R === "0" ? $ === "0" ? y = `>=${R}.${$}.${O}-${T} <${R}.${$}.${+O + 1}-0` : y = `>=${R}.${$}.${O}-${T} <${R}.${+$ + 1}.0-0` : y = `>=${R}.${$}.${O}-${T} <${+R + 1}.0.0-0`) : (o("no pr"), R === "0" ? $ === "0" ? y = `>=${R}.${$}.${O}${g} <${R}.${$}.${+O + 1}-0` : y = `>=${R}.${$}.${O}${g} <${R}.${+$ + 1}.0-0` : y = `>=${R}.${$}.${O} <${+R + 1}.0.0-0`), o("caret return", y), y;
807
1290
  });
808
- }, L = (E, d) => (l("replaceXRanges", E, d), E.split(/\s+/).map((I) => V(I, d)).join(" ")), V = (E, d) => {
809
- E = E.trim();
810
- const I = d.loose ? o[a.XRANGELOOSE] : o[a.XRANGE];
811
- return E.replace(I, (R, g, v, $, O, T) => {
812
- l("xRange", E, R, g, v, $, O, T);
813
- const y = w(v), D = y || w($), q = D || w(O), k = q;
814
- return g === "=" && k && (g = ""), T = d.includePrerelease ? "-0" : "", y ? g === ">" || g === "<" ? R = "<0.0.0-0" : R = "*" : g && k ? (D && ($ = 0), O = 0, g === ">" ? (g = ">=", D ? (v = +v + 1, $ = 0, O = 0) : ($ = +$ + 1, O = 0)) : g === "<=" && (g = "<", D ? v = +v + 1 : $ = +$ + 1), g === "<" && (T = "-0"), R = `${g + v}.${$}.${O}${T}`) : D ? R = `>=${v}.0.0${T} <${+v + 1}.0.0-0` : q && (R = `>=${v}.${$}.0${T} <${v}.${+$ + 1}.0-0`), l("xRange return", R), R;
1291
+ }, L = (p, m) => (o("replaceXRanges", p, m), p.split(/\s+/).map((v) => M(v, m)).join(" ")), M = (p, m) => {
1292
+ p = p.trim();
1293
+ const v = m.loose ? a[l.XRANGELOOSE] : a[l.XRANGE];
1294
+ return p.replace(v, (g, I, R, $, O, T) => {
1295
+ o("xRange", p, g, I, R, $, O, T);
1296
+ const y = w(R), x = y || w($), P = x || w(O), V = P;
1297
+ return I === "=" && V && (I = ""), T = m.includePrerelease ? "-0" : "", y ? I === ">" || I === "<" ? g = "<0.0.0-0" : g = "*" : I && V ? (x && ($ = 0), O = 0, I === ">" ? (I = ">=", x ? (R = +R + 1, $ = 0, O = 0) : ($ = +$ + 1, O = 0)) : I === "<=" && (I = "<", x ? R = +R + 1 : $ = +$ + 1), I === "<" && (T = "-0"), g = `${I + R}.${$}.${O}${T}`) : x ? g = `>=${R}.0.0${T} <${+R + 1}.0.0-0` : P && (g = `>=${R}.${$}.0${T} <${R}.${+$ + 1}.0-0`), o("xRange return", g), g;
815
1298
  });
816
- }, Q = (E, d) => (l("replaceStars", E, d), E.trim().replace(o[a.STAR], "")), ee = (E, d) => (l("replaceGTE0", E, d), E.trim().replace(o[d.includePrerelease ? a.GTE0PRE : a.GTE0], "")), te = (E) => (d, I, R, g, v, $, O, T, y, D, q, k) => (w(R) ? I = "" : w(g) ? I = `>=${R}.0.0${E ? "-0" : ""}` : w(v) ? I = `>=${R}.${g}.0${E ? "-0" : ""}` : $ ? I = `>=${I}` : I = `>=${I}${E ? "-0" : ""}`, w(y) ? T = "" : w(D) ? T = `<${+y + 1}.0.0-0` : w(q) ? T = `<${y}.${+D + 1}.0-0` : k ? T = `<=${y}.${D}.${q}-${k}` : E ? T = `<${y}.${D}.${+q + 1}-0` : T = `<=${T}`, `${I} ${T}`.trim()), re = (E, d, I) => {
817
- for (let R = 0; R < E.length; R++)
818
- if (!E[R].test(d))
1299
+ }, Q = (p, m) => (o("replaceStars", p, m), p.trim().replace(a[l.STAR], "")), ee = (p, m) => (o("replaceGTE0", p, m), p.trim().replace(a[m.includePrerelease ? l.GTE0PRE : l.GTE0], "")), te = (p) => (m, v, g, I, R, $, O, T, y, x, P, V) => (w(g) ? v = "" : w(I) ? v = `>=${g}.0.0${p ? "-0" : ""}` : w(R) ? v = `>=${g}.${I}.0${p ? "-0" : ""}` : $ ? v = `>=${v}` : v = `>=${v}${p ? "-0" : ""}`, w(y) ? T = "" : w(x) ? T = `<${+y + 1}.0.0-0` : w(P) ? T = `<${y}.${+x + 1}.0-0` : V ? T = `<=${y}.${x}.${P}-${V}` : p ? T = `<${y}.${x}.${+P + 1}-0` : T = `<=${T}`, `${v} ${T}`.trim()), re = (p, m, v) => {
1300
+ for (let g = 0; g < p.length; g++)
1301
+ if (!p[g].test(m))
819
1302
  return !1;
820
- if (d.prerelease.length && !I.includePrerelease) {
821
- for (let R = 0; R < E.length; R++)
822
- if (l(E[R].semver), E[R].semver !== c.ANY && E[R].semver.prerelease.length > 0) {
823
- const g = E[R].semver;
824
- if (g.major === d.major && g.minor === d.minor && g.patch === d.patch)
1303
+ if (m.prerelease.length && !v.includePrerelease) {
1304
+ for (let g = 0; g < p.length; g++)
1305
+ if (o(p[g].semver), p[g].semver !== c.ANY && p[g].semver.prerelease.length > 0) {
1306
+ const I = p[g].semver;
1307
+ if (I.major === m.major && I.minor === m.minor && I.patch === m.patch)
825
1308
  return !0;
826
1309
  }
827
1310
  return !1;
828
1311
  }
829
1312
  return !0;
830
1313
  };
831
- return Pe;
1314
+ return be;
832
1315
  }
833
- var Ge, Pt;
834
- function K() {
835
- if (Pt) return Ge;
836
- Pt = 1;
837
- const t = /* @__PURE__ */ Symbol("SemVer ANY");
838
- class s {
1316
+ var Ge, qt;
1317
+ function Z() {
1318
+ if (qt) return Ge;
1319
+ qt = 1;
1320
+ const r = /* @__PURE__ */ Symbol("SemVer ANY");
1321
+ class e {
839
1322
  static get ANY() {
840
- return t;
1323
+ return r;
841
1324
  }
842
- constructor(e, u) {
843
- if (u = r(u), e instanceof s) {
844
- if (e.loose === !!u.loose)
845
- return e;
846
- e = e.value;
1325
+ constructor(s, u) {
1326
+ if (u = t(u), s instanceof e) {
1327
+ if (s.loose === !!u.loose)
1328
+ return s;
1329
+ s = s.value;
847
1330
  }
848
- e = e.trim().split(/\s+/).join(" "), l("comparator", e, u), this.options = u, this.loose = !!u.loose, this.parse(e), this.semver === t ? this.value = "" : this.value = this.operator + this.semver.version, l("comp", this);
1331
+ s = s.trim().split(/\s+/).join(" "), o("comparator", s, u), this.options = u, this.loose = !!u.loose, this.parse(s), this.semver === r ? this.value = "" : this.value = this.operator + this.semver.version, o("comp", this);
849
1332
  }
850
- parse(e) {
851
- const u = this.options.loose ? n[i.COMPARATORLOOSE] : n[i.COMPARATOR], f = e.match(u);
1333
+ parse(s) {
1334
+ const u = this.options.loose ? n[i.COMPARATORLOOSE] : n[i.COMPARATOR], f = s.match(u);
852
1335
  if (!f)
853
- throw new TypeError(`Invalid comparator: ${e}`);
854
- this.operator = f[1] !== void 0 ? f[1] : "", this.operator === "=" && (this.operator = ""), f[2] ? this.semver = new h(f[2], this.options.loose) : this.semver = t;
1336
+ throw new TypeError(`Invalid comparator: ${s}`);
1337
+ this.operator = f[1] !== void 0 ? f[1] : "", this.operator === "=" && (this.operator = ""), f[2] ? this.semver = new h(f[2], this.options.loose) : this.semver = r;
855
1338
  }
856
1339
  toString() {
857
1340
  return this.value;
858
1341
  }
859
- test(e) {
860
- if (l("Comparator.test", e, this.options.loose), this.semver === t || e === t)
1342
+ test(s) {
1343
+ if (o("Comparator.test", s, this.options.loose), this.semver === r || s === r)
861
1344
  return !0;
862
- if (typeof e == "string")
1345
+ if (typeof s == "string")
863
1346
  try {
864
- e = new h(e, this.options);
1347
+ s = new h(s, this.options);
865
1348
  } catch {
866
1349
  return !1;
867
1350
  }
868
- return c(e, this.operator, this.semver, this.options);
1351
+ return c(s, this.operator, this.semver, this.options);
869
1352
  }
870
- intersects(e, u) {
871
- if (!(e instanceof s))
1353
+ intersects(s, u) {
1354
+ if (!(s instanceof e))
872
1355
  throw new TypeError("a Comparator is required");
873
- return this.operator === "" ? this.value === "" ? !0 : new o(e.value, u).test(this.value) : e.operator === "" ? e.value === "" ? !0 : new o(this.value, u).test(e.semver) : (u = r(u), u.includePrerelease && (this.value === "<0.0.0-0" || e.value === "<0.0.0-0") || !u.includePrerelease && (this.value.startsWith("<0.0.0") || e.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && e.operator.startsWith(">") || this.operator.startsWith("<") && e.operator.startsWith("<") || this.semver.version === e.semver.version && this.operator.includes("=") && e.operator.includes("=") || c(this.semver, "<", e.semver, u) && this.operator.startsWith(">") && e.operator.startsWith("<") || c(this.semver, ">", e.semver, u) && this.operator.startsWith("<") && e.operator.startsWith(">")));
1356
+ return this.operator === "" ? this.value === "" ? !0 : new a(s.value, u).test(this.value) : s.operator === "" ? s.value === "" ? !0 : new a(this.value, u).test(s.semver) : (u = t(u), u.includePrerelease && (this.value === "<0.0.0-0" || s.value === "<0.0.0-0") || !u.includePrerelease && (this.value.startsWith("<0.0.0") || s.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && s.operator.startsWith(">") || this.operator.startsWith("<") && s.operator.startsWith("<") || this.semver.version === s.semver.version && this.operator.includes("=") && s.operator.includes("=") || c(this.semver, "<", s.semver, u) && this.operator.startsWith(">") && s.operator.startsWith("<") || c(this.semver, ">", s.semver, u) && this.operator.startsWith("<") && s.operator.startsWith(">")));
874
1357
  }
875
1358
  }
876
- Ge = s;
877
- const r = ze(), { safeRe: n, t: i } = B(), c = ar(), l = z(), h = b(), o = j();
1359
+ Ge = e;
1360
+ const t = Ye(), { safeRe: n, t: i } = B(), c = fr(), o = Y(), h = D(), a = F();
878
1361
  return Ge;
879
1362
  }
880
- var xe, Gt;
881
- function Z() {
882
- if (Gt) return xe;
883
- Gt = 1;
884
- const t = j();
885
- return xe = (r, n, i) => {
1363
+ var xe, bt;
1364
+ function J() {
1365
+ if (bt) return xe;
1366
+ bt = 1;
1367
+ const r = F();
1368
+ return xe = (t, n, i) => {
886
1369
  try {
887
- n = new t(n, i);
1370
+ n = new r(n, i);
888
1371
  } catch {
889
1372
  return !1;
890
1373
  }
891
- return n.test(r);
1374
+ return n.test(t);
892
1375
  }, xe;
893
1376
  }
894
- var De, xt;
895
- function Fr() {
896
- if (xt) return De;
897
- xt = 1;
898
- const t = j();
899
- return De = (r, n) => new t(r, n).set.map((i) => i.map((c) => c.value).join(" ").trim().split(" ")), De;
1377
+ var De, Gt;
1378
+ function zr() {
1379
+ if (Gt) return De;
1380
+ Gt = 1;
1381
+ const r = F();
1382
+ return De = (t, n) => new r(t, n).set.map((i) => i.map((c) => c.value).join(" ").trim().split(" ")), De;
900
1383
  }
901
- var be, Dt;
902
- function Mr() {
903
- if (Dt) return be;
904
- Dt = 1;
905
- const t = b(), s = j();
906
- return be = (n, i, c) => {
907
- let l = null, h = null, o = null;
1384
+ var _e, xt;
1385
+ function Yr() {
1386
+ if (xt) return _e;
1387
+ xt = 1;
1388
+ const r = D(), e = F();
1389
+ return _e = (n, i, c) => {
1390
+ let o = null, h = null, a = null;
908
1391
  try {
909
- o = new s(i, c);
1392
+ a = new e(i, c);
910
1393
  } catch {
911
1394
  return null;
912
1395
  }
913
- return n.forEach((a) => {
914
- o.test(a) && (!l || h.compare(a) === -1) && (l = a, h = new t(l, c));
915
- }), l;
916
- }, be;
1396
+ return n.forEach((l) => {
1397
+ a.test(l) && (!o || h.compare(l) === -1) && (o = l, h = new r(o, c));
1398
+ }), o;
1399
+ }, _e;
917
1400
  }
918
- var _e, bt;
919
- function Vr() {
920
- if (bt) return _e;
921
- bt = 1;
922
- const t = b(), s = j();
923
- return _e = (n, i, c) => {
924
- let l = null, h = null, o = null;
1401
+ var Ue, Dt;
1402
+ function Kr() {
1403
+ if (Dt) return Ue;
1404
+ Dt = 1;
1405
+ const r = D(), e = F();
1406
+ return Ue = (n, i, c) => {
1407
+ let o = null, h = null, a = null;
925
1408
  try {
926
- o = new s(i, c);
1409
+ a = new e(i, c);
927
1410
  } catch {
928
1411
  return null;
929
1412
  }
930
- return n.forEach((a) => {
931
- o.test(a) && (!l || h.compare(a) === 1) && (l = a, h = new t(l, c));
932
- }), l;
933
- }, _e;
1413
+ return n.forEach((l) => {
1414
+ a.test(l) && (!o || h.compare(l) === 1) && (o = l, h = new r(o, c));
1415
+ }), o;
1416
+ }, Ue;
934
1417
  }
935
- var Ue, _t;
936
- function kr() {
937
- if (_t) return Ue;
1418
+ var Fe, _t;
1419
+ function Zr() {
1420
+ if (_t) return Fe;
938
1421
  _t = 1;
939
- const t = b(), s = j(), r = J();
940
- return Ue = (i, c) => {
941
- i = new s(i, c);
942
- let l = new t("0.0.0");
943
- if (i.test(l) || (l = new t("0.0.0-0"), i.test(l)))
944
- return l;
945
- l = null;
1422
+ const r = D(), e = F(), t = K();
1423
+ return Fe = (i, c) => {
1424
+ i = new e(i, c);
1425
+ let o = new r("0.0.0");
1426
+ if (i.test(o) || (o = new r("0.0.0-0"), i.test(o)))
1427
+ return o;
1428
+ o = null;
946
1429
  for (let h = 0; h < i.set.length; ++h) {
947
- const o = i.set[h];
948
- let a = null;
949
- o.forEach((e) => {
950
- const u = new t(e.semver.version);
951
- switch (e.operator) {
1430
+ const a = i.set[h];
1431
+ let l = null;
1432
+ a.forEach((s) => {
1433
+ const u = new r(s.semver.version);
1434
+ switch (s.operator) {
952
1435
  case ">":
953
1436
  u.prerelease.length === 0 ? u.patch++ : u.prerelease.push(0), u.raw = u.format();
954
1437
  /* fallthrough */
955
1438
  case "":
956
1439
  case ">=":
957
- (!a || r(u, a)) && (a = u);
1440
+ (!l || t(u, l)) && (l = u);
958
1441
  break;
959
1442
  case "<":
960
1443
  case "<=":
961
1444
  break;
962
1445
  /* istanbul ignore next */
963
1446
  default:
964
- throw new Error(`Unexpected operation: ${e.operator}`);
1447
+ throw new Error(`Unexpected operation: ${s.operator}`);
965
1448
  }
966
- }), a && (!l || r(l, a)) && (l = a);
1449
+ }), l && (!o || t(o, l)) && (o = l);
967
1450
  }
968
- return l && i.test(l) ? l : null;
969
- }, Ue;
1451
+ return o && i.test(o) ? o : null;
1452
+ }, Fe;
970
1453
  }
971
- var je, Ut;
972
- function Xr() {
973
- if (Ut) return je;
1454
+ var ke, Ut;
1455
+ function Jr() {
1456
+ if (Ut) return ke;
974
1457
  Ut = 1;
975
- const t = j();
976
- return je = (r, n) => {
1458
+ const r = F();
1459
+ return ke = (t, n) => {
977
1460
  try {
978
- return new t(r, n).range || "*";
1461
+ return new r(t, n).range || "*";
979
1462
  } catch {
980
1463
  return null;
981
1464
  }
982
- }, je;
1465
+ }, ke;
983
1466
  }
984
- var Fe, jt;
1467
+ var je, Ft;
985
1468
  function et() {
986
- if (jt) return Fe;
987
- jt = 1;
988
- const t = b(), s = K(), { ANY: r } = s, n = j(), i = Z(), c = J(), l = Ke(), h = Qe(), o = Ze();
989
- return Fe = (e, u, f, p) => {
990
- e = new t(e, p), u = new n(u, p);
991
- let S, m, N, A, G;
1469
+ if (Ft) return je;
1470
+ Ft = 1;
1471
+ const r = D(), e = Z(), { ANY: t } = e, n = F(), i = J(), c = K(), o = Ze(), h = Qe(), a = Je();
1472
+ return je = (s, u, f, E) => {
1473
+ s = new r(s, E), u = new n(u, E);
1474
+ let S, d, N, A, b;
992
1475
  switch (f) {
993
1476
  case ">":
994
- S = c, m = h, N = l, A = ">", G = ">=";
1477
+ S = c, d = h, N = o, A = ">", b = ">=";
995
1478
  break;
996
1479
  case "<":
997
- S = l, m = o, N = c, A = "<", G = "<=";
1480
+ S = o, d = a, N = c, A = "<", b = "<=";
998
1481
  break;
999
1482
  default:
1000
1483
  throw new TypeError('Must provide a hilo val of "<" or ">"');
1001
1484
  }
1002
- if (i(e, u, p))
1485
+ if (i(s, u, E))
1003
1486
  return !1;
1004
1487
  for (let w = 0; w < u.set.length; ++w) {
1005
- const x = u.set[w];
1488
+ const G = u.set[w];
1006
1489
  let _ = null, C = null;
1007
- if (x.forEach((P) => {
1008
- P.semver === r && (P = new s(">=0.0.0")), _ = _ || P, C = C || P, S(P.semver, _.semver, p) ? _ = P : N(P.semver, C.semver, p) && (C = P);
1009
- }), _.operator === A || _.operator === G || (!C.operator || C.operator === A) && m(e, C.semver))
1490
+ if (G.forEach((q) => {
1491
+ q.semver === t && (q = new e(">=0.0.0")), _ = _ || q, C = C || q, S(q.semver, _.semver, E) ? _ = q : N(q.semver, C.semver, E) && (C = q);
1492
+ }), _.operator === A || _.operator === b || (!C.operator || C.operator === A) && d(s, C.semver))
1010
1493
  return !1;
1011
- if (C.operator === G && N(e, C.semver))
1494
+ if (C.operator === b && N(s, C.semver))
1012
1495
  return !1;
1013
1496
  }
1014
1497
  return !0;
1015
- }, Fe;
1498
+ }, je;
1016
1499
  }
1017
- var Me, Ft;
1018
- function Br() {
1019
- if (Ft) return Me;
1020
- Ft = 1;
1021
- const t = et();
1022
- return Me = (r, n, i) => t(r, n, ">", i), Me;
1500
+ var Me, kt;
1501
+ function Qr() {
1502
+ if (kt) return Me;
1503
+ kt = 1;
1504
+ const r = et();
1505
+ return Me = (t, n, i) => r(t, n, ">", i), Me;
1023
1506
  }
1024
- var Ve, Mt;
1025
- function Hr() {
1026
- if (Mt) return Ve;
1507
+ var Ve, jt;
1508
+ function es() {
1509
+ if (jt) return Ve;
1510
+ jt = 1;
1511
+ const r = et();
1512
+ return Ve = (t, n, i) => r(t, n, "<", i), Ve;
1513
+ }
1514
+ var Xe, Mt;
1515
+ function ts() {
1516
+ if (Mt) return Xe;
1027
1517
  Mt = 1;
1028
- const t = et();
1029
- return Ve = (r, n, i) => t(r, n, "<", i), Ve;
1518
+ const r = F();
1519
+ return Xe = (t, n, i) => (t = new r(t, i), n = new r(n, i), t.intersects(n, i)), Xe;
1030
1520
  }
1031
- var ke, Vt;
1032
- function Wr() {
1033
- if (Vt) return ke;
1521
+ var Be, Vt;
1522
+ function rs() {
1523
+ if (Vt) return Be;
1034
1524
  Vt = 1;
1035
- const t = j();
1036
- return ke = (r, n, i) => (r = new t(r, i), n = new t(n, i), r.intersects(n, i)), ke;
1037
- }
1038
- var Xe, kt;
1039
- function Yr() {
1040
- if (kt) return Xe;
1041
- kt = 1;
1042
- const t = Z(), s = U();
1043
- return Xe = (r, n, i) => {
1525
+ const r = J(), e = U();
1526
+ return Be = (t, n, i) => {
1044
1527
  const c = [];
1045
- let l = null, h = null;
1046
- const o = r.sort((f, p) => s(f, p, i));
1047
- for (const f of o)
1048
- t(f, n, i) ? (h = f, l || (l = f)) : (h && c.push([l, h]), h = null, l = null);
1049
- l && c.push([l, null]);
1050
- const a = [];
1051
- for (const [f, p] of c)
1052
- f === p ? a.push(f) : !p && f === o[0] ? a.push("*") : p ? f === o[0] ? a.push(`<=${p}`) : a.push(`${f} - ${p}`) : a.push(`>=${f}`);
1053
- const e = a.join(" || "), u = typeof n.raw == "string" ? n.raw : String(n);
1054
- return e.length < u.length ? e : n;
1055
- }, Xe;
1056
- }
1057
- var Be, Xt;
1058
- function zr() {
1059
- if (Xt) return Be;
1528
+ let o = null, h = null;
1529
+ const a = t.sort((f, E) => e(f, E, i));
1530
+ for (const f of a)
1531
+ r(f, n, i) ? (h = f, o || (o = f)) : (h && c.push([o, h]), h = null, o = null);
1532
+ o && c.push([o, null]);
1533
+ const l = [];
1534
+ for (const [f, E] of c)
1535
+ f === E ? l.push(f) : !E && f === a[0] ? l.push("*") : E ? f === a[0] ? l.push(`<=${E}`) : l.push(`${f} - ${E}`) : l.push(`>=${f}`);
1536
+ const s = l.join(" || "), u = typeof n.raw == "string" ? n.raw : String(n);
1537
+ return s.length < u.length ? s : n;
1538
+ }, Be;
1539
+ }
1540
+ var We, Xt;
1541
+ function ss() {
1542
+ if (Xt) return We;
1060
1543
  Xt = 1;
1061
- const t = j(), s = K(), { ANY: r } = s, n = Z(), i = U(), c = (u, f, p = {}) => {
1544
+ const r = F(), e = Z(), { ANY: t } = e, n = J(), i = U(), c = (u, f, E = {}) => {
1062
1545
  if (u === f)
1063
1546
  return !0;
1064
- u = new t(u, p), f = new t(f, p);
1547
+ u = new r(u, E), f = new r(f, E);
1065
1548
  let S = !1;
1066
- e: for (const m of u.set) {
1549
+ e: for (const d of u.set) {
1067
1550
  for (const N of f.set) {
1068
- const A = o(m, N, p);
1551
+ const A = a(d, N, E);
1069
1552
  if (S = S || A !== null, A)
1070
1553
  continue e;
1071
1554
  }
@@ -1073,143 +1556,142 @@ function zr() {
1073
1556
  return !1;
1074
1557
  }
1075
1558
  return !0;
1076
- }, l = [new s(">=0.0.0-0")], h = [new s(">=0.0.0")], o = (u, f, p) => {
1559
+ }, o = [new e(">=0.0.0-0")], h = [new e(">=0.0.0")], a = (u, f, E) => {
1077
1560
  if (u === f)
1078
1561
  return !0;
1079
- if (u.length === 1 && u[0].semver === r) {
1080
- if (f.length === 1 && f[0].semver === r)
1562
+ if (u.length === 1 && u[0].semver === t) {
1563
+ if (f.length === 1 && f[0].semver === t)
1081
1564
  return !0;
1082
- p.includePrerelease ? u = l : u = h;
1565
+ E.includePrerelease ? u = o : u = h;
1083
1566
  }
1084
- if (f.length === 1 && f[0].semver === r) {
1085
- if (p.includePrerelease)
1567
+ if (f.length === 1 && f[0].semver === t) {
1568
+ if (E.includePrerelease)
1086
1569
  return !0;
1087
1570
  f = h;
1088
1571
  }
1089
1572
  const S = /* @__PURE__ */ new Set();
1090
- let m, N;
1573
+ let d, N;
1091
1574
  for (const L of u)
1092
- L.operator === ">" || L.operator === ">=" ? m = a(m, L, p) : L.operator === "<" || L.operator === "<=" ? N = e(N, L, p) : S.add(L.semver);
1575
+ L.operator === ">" || L.operator === ">=" ? d = l(d, L, E) : L.operator === "<" || L.operator === "<=" ? N = s(N, L, E) : S.add(L.semver);
1093
1576
  if (S.size > 1)
1094
1577
  return null;
1095
1578
  let A;
1096
- if (m && N) {
1097
- if (A = i(m.semver, N.semver, p), A > 0)
1579
+ if (d && N) {
1580
+ if (A = i(d.semver, N.semver, E), A > 0)
1098
1581
  return null;
1099
- if (A === 0 && (m.operator !== ">=" || N.operator !== "<="))
1582
+ if (A === 0 && (d.operator !== ">=" || N.operator !== "<="))
1100
1583
  return null;
1101
1584
  }
1102
1585
  for (const L of S) {
1103
- if (m && !n(L, String(m), p) || N && !n(L, String(N), p))
1586
+ if (d && !n(L, String(d), E) || N && !n(L, String(N), E))
1104
1587
  return null;
1105
- for (const V of f)
1106
- if (!n(L, String(V), p))
1588
+ for (const M of f)
1589
+ if (!n(L, String(M), E))
1107
1590
  return !1;
1108
1591
  return !0;
1109
1592
  }
1110
- let G, w, x, _, C = N && !p.includePrerelease && N.semver.prerelease.length ? N.semver : !1, P = m && !p.includePrerelease && m.semver.prerelease.length ? m.semver : !1;
1593
+ let b, w, G, _, C = N && !E.includePrerelease && N.semver.prerelease.length ? N.semver : !1, q = d && !E.includePrerelease && d.semver.prerelease.length ? d.semver : !1;
1111
1594
  C && C.prerelease.length === 1 && N.operator === "<" && C.prerelease[0] === 0 && (C = !1);
1112
1595
  for (const L of f) {
1113
- if (_ = _ || L.operator === ">" || L.operator === ">=", x = x || L.operator === "<" || L.operator === "<=", m) {
1114
- if (P && L.semver.prerelease && L.semver.prerelease.length && L.semver.major === P.major && L.semver.minor === P.minor && L.semver.patch === P.patch && (P = !1), L.operator === ">" || L.operator === ">=") {
1115
- if (G = a(m, L, p), G === L && G !== m)
1596
+ if (_ = _ || L.operator === ">" || L.operator === ">=", G = G || L.operator === "<" || L.operator === "<=", d) {
1597
+ if (q && L.semver.prerelease && L.semver.prerelease.length && L.semver.major === q.major && L.semver.minor === q.minor && L.semver.patch === q.patch && (q = !1), L.operator === ">" || L.operator === ">=") {
1598
+ if (b = l(d, L, E), b === L && b !== d)
1116
1599
  return !1;
1117
- } else if (m.operator === ">=" && !n(m.semver, String(L), p))
1600
+ } else if (d.operator === ">=" && !n(d.semver, String(L), E))
1118
1601
  return !1;
1119
1602
  }
1120
1603
  if (N) {
1121
1604
  if (C && L.semver.prerelease && L.semver.prerelease.length && L.semver.major === C.major && L.semver.minor === C.minor && L.semver.patch === C.patch && (C = !1), L.operator === "<" || L.operator === "<=") {
1122
- if (w = e(N, L, p), w === L && w !== N)
1605
+ if (w = s(N, L, E), w === L && w !== N)
1123
1606
  return !1;
1124
- } else if (N.operator === "<=" && !n(N.semver, String(L), p))
1607
+ } else if (N.operator === "<=" && !n(N.semver, String(L), E))
1125
1608
  return !1;
1126
1609
  }
1127
- if (!L.operator && (N || m) && A !== 0)
1610
+ if (!L.operator && (N || d) && A !== 0)
1128
1611
  return !1;
1129
1612
  }
1130
- return !(m && x && !N && A !== 0 || N && _ && !m && A !== 0 || P || C);
1131
- }, a = (u, f, p) => {
1613
+ return !(d && G && !N && A !== 0 || N && _ && !d && A !== 0 || q || C);
1614
+ }, l = (u, f, E) => {
1132
1615
  if (!u)
1133
1616
  return f;
1134
- const S = i(u.semver, f.semver, p);
1617
+ const S = i(u.semver, f.semver, E);
1135
1618
  return S > 0 ? u : S < 0 || f.operator === ">" && u.operator === ">=" ? f : u;
1136
- }, e = (u, f, p) => {
1619
+ }, s = (u, f, E) => {
1137
1620
  if (!u)
1138
1621
  return f;
1139
- const S = i(u.semver, f.semver, p);
1622
+ const S = i(u.semver, f.semver, E);
1140
1623
  return S < 0 ? u : S > 0 || f.operator === "<" && u.operator === "<=" ? f : u;
1141
1624
  };
1142
- return Be = c, Be;
1625
+ return We = c, We;
1143
1626
  }
1144
1627
  var He, Bt;
1145
- function Jr() {
1628
+ function ns() {
1146
1629
  if (Bt) return He;
1147
1630
  Bt = 1;
1148
- const t = B(), s = Y(), r = b(), n = sr(), i = M(), c = Or(), l = Ar(), h = wr(), o = yr(), a = Cr(), e = qr(), u = Pr(), f = Gr(), p = U(), S = xr(), m = Dr(), N = Je(), A = br(), G = _r(), w = J(), x = Ke(), _ = nr(), C = ir(), P = Ze(), L = Qe(), V = ar(), Q = Ur(), ee = K(), te = j(), re = Z(), E = Fr(), d = Mr(), I = Vr(), R = kr(), g = Xr(), v = et(), $ = Br(), O = Hr(), T = Wr(), y = Yr(), D = zr();
1631
+ const r = B(), e = z(), t = D(), n = cr(), i = j(), c = Gr(), o = xr(), h = Dr(), a = _r(), l = Ur(), s = Fr(), u = kr(), f = jr(), E = U(), S = Mr(), d = Vr(), N = Ke(), A = Xr(), b = Br(), w = K(), G = Ze(), _ = ur(), C = hr(), q = Je(), L = Qe(), M = fr(), Q = Wr(), ee = Z(), te = F(), re = J(), p = zr(), m = Yr(), v = Kr(), g = Zr(), I = Jr(), R = et(), $ = Qr(), O = es(), T = ts(), y = rs(), x = ss();
1149
1632
  return He = {
1150
1633
  parse: i,
1151
1634
  valid: c,
1152
- clean: l,
1635
+ clean: o,
1153
1636
  inc: h,
1154
- diff: o,
1155
- major: a,
1156
- minor: e,
1637
+ diff: a,
1638
+ major: l,
1639
+ minor: s,
1157
1640
  patch: u,
1158
1641
  prerelease: f,
1159
- compare: p,
1642
+ compare: E,
1160
1643
  rcompare: S,
1161
- compareLoose: m,
1644
+ compareLoose: d,
1162
1645
  compareBuild: N,
1163
1646
  sort: A,
1164
- rsort: G,
1647
+ rsort: b,
1165
1648
  gt: w,
1166
- lt: x,
1649
+ lt: G,
1167
1650
  eq: _,
1168
1651
  neq: C,
1169
- gte: P,
1652
+ gte: q,
1170
1653
  lte: L,
1171
- cmp: V,
1654
+ cmp: M,
1172
1655
  coerce: Q,
1173
1656
  Comparator: ee,
1174
1657
  Range: te,
1175
1658
  satisfies: re,
1176
- toComparators: E,
1177
- maxSatisfying: d,
1178
- minSatisfying: I,
1179
- minVersion: R,
1180
- validRange: g,
1181
- outside: v,
1659
+ toComparators: p,
1660
+ maxSatisfying: m,
1661
+ minSatisfying: v,
1662
+ minVersion: g,
1663
+ validRange: I,
1664
+ outside: R,
1182
1665
  gtr: $,
1183
1666
  ltr: O,
1184
1667
  intersects: T,
1185
1668
  simplifyRange: y,
1186
- subset: D,
1187
- SemVer: r,
1188
- re: t.re,
1189
- src: t.src,
1190
- tokens: t.t,
1191
- SEMVER_SPEC_VERSION: s.SEMVER_SPEC_VERSION,
1192
- RELEASE_TYPES: s.RELEASE_TYPES,
1669
+ subset: x,
1670
+ SemVer: t,
1671
+ re: r.re,
1672
+ src: r.src,
1673
+ tokens: r.t,
1674
+ SEMVER_SPEC_VERSION: e.SEMVER_SPEC_VERSION,
1675
+ RELEASE_TYPES: e.RELEASE_TYPES,
1193
1676
  compareIdentifiers: n.compareIdentifiers,
1194
1677
  rcompareIdentifiers: n.rcompareIdentifiers
1195
1678
  }, He;
1196
1679
  }
1197
- var Kr = Jr();
1198
- const Ht = `^${X.Version}`;
1199
- class ts {
1200
- config = new lr(Wt);
1201
- event = new cr();
1680
+ var is = ns();
1681
+ const Wt = `^${X.Version}`;
1682
+ class ls {
1683
+ config = new dr(Ht);
1684
+ event = new pr();
1202
1685
  state;
1203
1686
  active;
1204
1687
  time;
1205
- offset;
1206
1688
  info;
1207
- mergedLineEnd = [];
1689
+ merger = new Pr();
1690
+ offset = new qr();
1691
+ driver = new br();
1208
1692
  constructor() {
1209
1693
  this.state = {
1210
1694
  playing: !1,
1211
- frameId: null,
1212
- timerId: null,
1213
1695
  scanIndex: 0
1214
1696
  }, this.active = {
1215
1697
  lines: [],
@@ -1217,14 +1699,11 @@ class ts {
1217
1699
  }, this.time = {
1218
1700
  start: 0,
1219
1701
  seek: 0
1220
- }, this.offset = {
1221
- temp: 0,
1222
- meta: 0
1223
1702
  }, this.info = new X.Info(), this.config.event.add("update", this.onConfigUpdate);
1224
1703
  }
1225
- onConfigUpdate = (s) => {
1226
- const r = s.has("offset.useMeta");
1227
- r && this.handleRefreshOffset(), (r || s.has("offset.global")) && this.handleSyncTime(), s.has("mergeWindow") && (this.handleBuildMergedLineEnd(), this.handleSyncTime());
1704
+ onConfigUpdate = (e) => {
1705
+ const t = e.has("offset.useMeta");
1706
+ t && this.offset.refreshFromMeta(this.info, this.config.current.offset.useMeta), (t || e.has("offset.global")) && this.handleSyncTime(), (e.has("mergeWindow") || e.has("mergeLimit")) && (this.handleBuildMergedLineEnd(), this.handleSyncTime());
1228
1707
  };
1229
1708
  // Get current playback time.
1230
1709
  handleGetCurrentTime() {
@@ -1234,126 +1713,91 @@ class ts {
1234
1713
  handleGetEffectiveTime() {
1235
1714
  return this.handleGetCurrentTime() + this.currentOffset;
1236
1715
  }
1237
- // Refresh meta offset.
1238
- handleRefreshOffset() {
1239
- if (this.config.current.offset.useMeta) {
1240
- const r = this.info.metas.find((i) => i.type === X.MetaType.Offset)?.content, n = typeof r == "number" && Number.isFinite(r) ? r : 0;
1241
- this.offset.meta = n;
1242
- } else
1243
- this.offset.meta = 0;
1244
- }
1245
- handleGetLineTime(s) {
1246
- if (s < 0 || s >= this.info.lines.length)
1247
- return 0;
1248
- if (s === this.info.lines.length - 1)
1249
- return 1 / 0;
1250
- const r = this.info.lines[s], n = this.info.lines[s + 1];
1251
- return Math.max(r.time.end, n.time.start);
1252
- }
1716
+ /**
1717
+ * Rebuild the merged line-end table from the current lyric and merge config.
1718
+ */
1253
1719
  handleBuildMergedLineEnd() {
1254
- const s = this.info.lines.length, r = new Array(s);
1255
- if (s === 0) {
1256
- this.mergedLineEnd = r;
1257
- return;
1258
- }
1259
- const n = Math.max(0, this.config.current.mergeWindow);
1260
- let i = this.handleGetLineTime(s - 1);
1261
- r[s - 1] = i;
1262
- for (let c = s - 2; c >= 0; c--) {
1263
- const l = this.handleGetLineTime(c);
1264
- n > 0 && Math.abs(i - l) < n ? r[c] = Math.max(l, r[c + 1]) : r[c] = l, i = l;
1265
- }
1266
- this.mergedLineEnd = r;
1267
- }
1268
- handleGetMergedLineTime(s) {
1269
- const r = this.mergedLineEnd[s];
1270
- return r === void 0 ? this.handleGetLineTime(s) : r;
1720
+ this.merger.build(this.info.lines, this.config.current.mergeWindow, this.config.current.mergeLimit);
1271
1721
  }
1272
1722
  handleGetActiveIndex() {
1273
1723
  return this.active.index.length > 0 ? this.active.index[0] : -1;
1274
1724
  }
1275
- handleBridgeActive(s, r) {
1276
- if (!this.config.current.bridgeActive || r.length < 2)
1277
- return { lines: s, index: r };
1278
- const n = r[0], i = r[r.length - 1];
1279
- if (i - n + 1 === r.length)
1280
- return { lines: s, index: r };
1725
+ handleBridgeActive(e, t) {
1726
+ if (!this.config.current.bridgeActive || t.length < 2)
1727
+ return { lines: e, index: t };
1728
+ const n = t[0], i = t[t.length - 1];
1729
+ if (i - n + 1 === t.length)
1730
+ return { lines: e, index: t };
1281
1731
  const c = /* @__PURE__ */ new Map();
1282
- for (let o = 0; o < r.length; o++)
1283
- c.set(r[o], s[o]);
1284
- const l = [], h = [];
1285
- for (let o = n; o <= i; o++) {
1286
- const a = c.get(o) ?? this.info.lines[o];
1287
- a && (l.push(a), h.push(o));
1732
+ for (let a = 0; a < t.length; a++)
1733
+ c.set(t[a], e[a]);
1734
+ const o = [], h = [];
1735
+ for (let a = n; a <= i; a++) {
1736
+ const l = c.get(a) ?? this.info.lines[a];
1737
+ l && (o.push(l), h.push(a));
1288
1738
  }
1289
- return { lines: l, index: h };
1739
+ return { lines: o, index: h };
1290
1740
  }
1291
- handleEmitLinesUpdate(s) {
1292
- const r = this.handleBridgeActive(this.active.lines, this.active.index);
1293
- this.event.emit("linesUpdate", r.lines, r.index, this.handleGetActiveIndex(), s);
1741
+ handleEmitLinesUpdate(e) {
1742
+ const t = this.handleBridgeActive(this.active.lines, this.active.index);
1743
+ this.event.emit("linesUpdate", t.lines, t.index, this.handleGetActiveIndex(), e);
1294
1744
  }
1295
- handleSyncTime(s) {
1296
- if (!this.info.lines.length || (s === void 0 && (s = this.handleGetEffectiveTime()), !Number.isFinite(s)))
1745
+ handleSyncTime(e) {
1746
+ if (!this.info.lines.length || (e === void 0 && (e = this.handleGetEffectiveTime()), !Number.isFinite(e)))
1297
1747
  return;
1298
- const r = [], n = [];
1748
+ const t = [], n = [];
1299
1749
  let i = this.info.lines.length;
1300
1750
  for (let c = 0; c < this.info.lines.length; c++) {
1301
- const l = this.info.lines[c];
1302
- if (l.time.start > s) {
1751
+ const o = this.info.lines[c];
1752
+ if (o.time.start > e) {
1303
1753
  i = c;
1304
1754
  break;
1305
1755
  }
1306
- this.handleGetMergedLineTime(c) > s && (r.push(l), n.push(c));
1756
+ this.merger.getMergedTime(c) > e && (t.push(o), n.push(c));
1307
1757
  }
1308
- this.state.scanIndex = i, this.active.lines = r, this.active.index = n, this.handleEmitLinesUpdate(!0);
1758
+ this.state.scanIndex = i, this.active.lines = t, this.active.index = n, this.handleEmitLinesUpdate(!0);
1309
1759
  }
1310
- handleUpdateActiveLines(s) {
1311
- let r = !1;
1760
+ handleUpdateActiveLines(e) {
1761
+ let t = !1;
1312
1762
  const n = [], i = [];
1313
1763
  for (let c = 0; c < this.active.lines.length; c++) {
1314
- const l = this.active.lines[c], h = this.active.index[c];
1315
- s >= this.handleGetMergedLineTime(h) ? r = !0 : (n.push(l), i.push(h));
1764
+ const o = this.active.lines[c], h = this.active.index[c];
1765
+ e >= this.merger.getMergedTime(h) ? t = !0 : (n.push(o), i.push(h));
1316
1766
  }
1317
1767
  for (; this.state.scanIndex < this.info.lines.length; ) {
1318
1768
  const c = this.info.lines[this.state.scanIndex];
1319
- if (s >= c.time.start)
1320
- s < this.handleGetMergedLineTime(this.state.scanIndex) && (n.push(c), i.push(this.state.scanIndex), r = !0), this.state.scanIndex++;
1769
+ if (e >= c.time.start)
1770
+ e < this.merger.getMergedTime(this.state.scanIndex) && (n.push(c), i.push(this.state.scanIndex), t = !0), this.state.scanIndex++;
1321
1771
  else
1322
1772
  break;
1323
1773
  }
1324
- r && (this.active.lines = n, this.active.index = i, this.handleEmitLinesUpdate(!1));
1774
+ t && (this.active.lines = n, this.active.index = i, this.handleEmitLinesUpdate(!1));
1325
1775
  }
1326
1776
  onTick = () => {
1327
1777
  if (!this.state.playing)
1328
1778
  return;
1329
- const s = this.handleGetEffectiveTime();
1330
- switch (this.handleUpdateActiveLines(s), this.config.current.driver) {
1331
- case "animation":
1332
- this.state.frameId = globalThis.requestAnimationFrame(this.onTick);
1333
- break;
1334
- case "timer":
1335
- this.state.timerId = globalThis.setTimeout(this.onTick, 16);
1336
- break;
1337
- }
1779
+ const e = this.handleGetEffectiveTime();
1780
+ this.handleUpdateActiveLines(e), this.driver.schedule(this.config.current.driver, this.onTick);
1338
1781
  };
1339
- updateLyric(s) {
1340
- if (!s)
1782
+ updateLyric(e) {
1783
+ if (!e)
1341
1784
  return;
1342
- let r = s;
1343
- Kr.satisfies(s.version, Ht) || (console.warn(`[music-lyric-player] ignored lyric with incompatible version "${s.version}", expected "${Ht}"`), r = new X.Info()), this.pause(), this.info = r, this.handleBuildMergedLineEnd(), this.handleRefreshOffset(), this.config.current.offset.resetTempOnLyricChange && (this.offset.temp = 0), this.active.lines = [], this.active.index = [], this.state.scanIndex = 0, this.time.seek = 0, this.event.emit("lyricUpdate", r), this.event.emit("linesUpdate", [], [], -1, !1);
1785
+ let t = e;
1786
+ is.satisfies(e.version, Wt) || (console.warn(`[music-lyric-player] ignored lyric with incompatible version "${e.version}", expected "${Wt}"`), t = new X.Info()), this.pause(), this.info = t, this.handleBuildMergedLineEnd(), this.offset.refreshFromMeta(this.info, this.config.current.offset.useMeta), this.config.current.offset.resetTempOnLyricChange && this.offset.resetTemp(), this.active.lines = [], this.active.index = [], this.state.scanIndex = 0, this.time.seek = 0, this.event.emit("lyricUpdate", t), this.event.emit("linesUpdate", [], [], -1, !1);
1344
1787
  }
1345
1788
  /**
1346
1789
  * Start playback
1790
+ *
1347
1791
  * @param time Optional time in ms to seek to before starting playback. If not provided, playback will start from the current position.
1348
1792
  */
1349
- play(s) {
1350
- this.pause(), typeof s == "number" && Number.isFinite(s) && (this.time.seek = s, this.handleSyncTime()), this.time.start = performance.now(), this.state.playing = !0, this.onTick(), this.event.emit("play", this.handleGetCurrentTime());
1793
+ play(e) {
1794
+ this.pause(), typeof e == "number" && Number.isFinite(e) && (this.time.seek = e, this.handleSyncTime()), this.time.start = performance.now(), this.state.playing = !0, this.onTick(), this.event.emit("play", this.handleGetCurrentTime());
1351
1795
  }
1352
1796
  /**
1353
1797
  * Pause playback
1354
1798
  */
1355
1799
  pause() {
1356
- this.state.playing && (this.time.seek = this.handleGetCurrentTime(), this.state.playing = !1, this.event.emit("pause", this.time.seek)), this.state.frameId !== null && (globalThis.cancelAnimationFrame(this.state.frameId), this.state.frameId = null), this.state.timerId !== null && (globalThis.clearTimeout(this.state.timerId), this.state.timerId = null);
1800
+ this.state.playing && (this.time.seek = this.handleGetCurrentTime(), this.state.playing = !1, this.event.emit("pause", this.time.seek)), this.driver.cancel();
1357
1801
  }
1358
1802
  /**
1359
1803
  * Stop playback
@@ -1363,34 +1807,40 @@ class ts {
1363
1807
  }
1364
1808
  /**
1365
1809
  * Update the temp offset in ms (the user's temporary adjustment).
1810
+ *
1366
1811
  * Stacked on top of the global config offset and the lyric's meta offset, then resyncs immediately.
1812
+ *
1367
1813
  * @param value temp offset in ms; non-finite values are treated as 0.
1368
1814
  */
1369
- updateTempOffset(s) {
1370
- this.offset.temp = Number.isFinite(s) ? s : 0, this.handleSyncTime();
1815
+ updateTempOffset(e) {
1816
+ this.offset.setTemp(e), this.handleSyncTime();
1371
1817
  }
1372
1818
  /**
1373
1819
  * Find all active lines at the given time (ms). Does not mutate internal state.
1820
+ *
1374
1821
  * Assumes `info.lines` is sorted by `time.start` ascending.
1822
+ *
1375
1823
  * @param time time in ms to find active lines for.
1376
1824
  */
1377
- matchLinesWithTime(s) {
1378
- const r = s + this.currentOffset, n = [], i = [];
1825
+ matchLinesWithTime(e) {
1826
+ const t = e + this.currentOffset, n = [], i = [];
1379
1827
  for (let c = 0; c < this.info.lines.length; c++) {
1380
- const l = this.info.lines[c];
1381
- if (l.time.start > r)
1828
+ const o = this.info.lines[c];
1829
+ if (o.time.start > t)
1382
1830
  break;
1383
- this.handleGetMergedLineTime(c) > r && (n.push(l), i.push(c));
1831
+ this.merger.getMergedTime(c) > t && (n.push(o), i.push(c));
1384
1832
  }
1385
1833
  return this.handleBridgeActive(n, i);
1386
1834
  }
1387
1835
  /**
1388
1836
  * Convert a content (lyric) time to the playback clock by removing the active offset.
1837
+ *
1389
1838
  * Seeking playback to the returned time makes a line at `contentTime` become active.
1839
+ *
1390
1840
  * @param contentTime content time in ms (e.g. a line's start).
1391
1841
  */
1392
- convertContentTime(s) {
1393
- return s - this.currentOffset;
1842
+ convertContentTime(e) {
1843
+ return e - this.currentOffset;
1394
1844
  }
1395
1845
  /**
1396
1846
  * Whether the player is currently playing.
@@ -1432,12 +1882,11 @@ class ts {
1432
1882
  * The current effective lyric offset in ms (config offset + lyric meta offset + temp offset).
1433
1883
  */
1434
1884
  get currentOffset() {
1435
- const s = this.config.current.offset.global + this.offset.meta + this.offset.temp;
1436
- return Number.isFinite(s) ? s : 0;
1885
+ return this.offset.resolve(this.config.current.offset.global);
1437
1886
  }
1438
1887
  }
1439
1888
  export {
1440
- ts as BaseLyricPlayer,
1441
- es as BaseLyricPlayerConfig
1889
+ ls as BaseLyricPlayer,
1890
+ os as BaseLyricPlayerConfig
1442
1891
  };
1443
1892
  //# sourceMappingURL=index.ecma.js.map