@tspro/web-music-score 4.1.0 → 4.2.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +64 -31
  3. package/dist/audio/index.js +1 -1
  4. package/dist/audio/index.mjs +2 -2
  5. package/dist/audio-cg/index.js +1 -1
  6. package/dist/audio-cg/index.mjs +2 -2
  7. package/dist/{chunk-MHNTJ6FU.mjs → chunk-5NWLGWHS.mjs} +2 -2
  8. package/dist/chunk-7MNV5JN6.mjs +264 -0
  9. package/dist/core/index.js +2 -2
  10. package/dist/core/index.mjs +3 -3
  11. package/dist/iife/index.global.js +11 -11
  12. package/dist/{music-objects-DIaqNPjs.d.mts → music-objects-3Hxlkxy6.d.mts} +105 -19
  13. package/dist/{music-objects-xJJNlFwK.d.ts → music-objects-CI7IjsjE.d.ts} +105 -19
  14. package/dist/pieces/index.d.mts +2 -2
  15. package/dist/pieces/index.d.ts +2 -2
  16. package/dist/pieces/index.js +2 -2
  17. package/dist/pieces/index.mjs +3 -3
  18. package/dist/react-ui/index.d.mts +3 -3
  19. package/dist/react-ui/index.d.ts +3 -3
  20. package/dist/react-ui/index.js +1 -1
  21. package/dist/react-ui/index.mjs +2 -2
  22. package/dist/{scale-DQNA-YLD.d.ts → scale-DGx3tJH4.d.ts} +1 -1
  23. package/dist/{scale-bnD0WnMV.d.mts → scale-DQP3b9Zx.d.mts} +1 -1
  24. package/dist/score/index.d.mts +43 -21
  25. package/dist/score/index.d.ts +43 -21
  26. package/dist/score/index.js +776 -249
  27. package/dist/score/index.mjs +495 -219
  28. package/dist/{tempo-Bp1UzsrZ.d.ts → tempo-GrstpD9G.d.ts} +2 -0
  29. package/dist/{tempo-S85Q7uJA.d.mts → tempo-dkctPkCS.d.mts} +2 -0
  30. package/dist/theory/index.d.mts +3 -3
  31. package/dist/theory/index.d.ts +3 -3
  32. package/dist/theory/index.js +4 -1
  33. package/dist/theory/index.mjs +28 -269
  34. package/package.json +6 -2
@@ -1,7 +1,10 @@
1
- /* WebMusicScore v4.1.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v4.2.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
+ import {
3
+ RhythmProps
4
+ } from "../chunk-7MNV5JN6.mjs";
2
5
  import {
3
6
  __publicField
4
- } from "../chunk-MHNTJ6FU.mjs";
7
+ } from "../chunk-5NWLGWHS.mjs";
5
8
 
6
9
  // src/score/pub/div-rect.ts
7
10
  import { Utils } from "@tspro/ts-utils-lib";
@@ -283,7 +286,7 @@ var DivRect = class _DivRect {
283
286
  };
284
287
 
285
288
  // src/score/pub/document-builder.ts
286
- import { Utils as Utils13 } from "@tspro/ts-utils-lib";
289
+ import { Utils as Utils14 } from "@tspro/ts-utils-lib";
287
290
 
288
291
  // src/score/pub/types.ts
289
292
  var StaffPreset = /* @__PURE__ */ ((StaffPreset3) => {
@@ -306,6 +309,9 @@ function getVoiceIds() {
306
309
  function getStringNumbers() {
307
310
  return [1, 2, 3, 4, 5, 6];
308
311
  }
312
+ function getVerseNumbers() {
313
+ return [1, 2, 3];
314
+ }
309
315
  var Stem = /* @__PURE__ */ ((Stem2) => {
310
316
  Stem2["Auto"] = "auto";
311
317
  Stem2["Up"] = "up";
@@ -343,6 +349,17 @@ var VerticalPosition = /* @__PURE__ */ ((VerticalPosition4) => {
343
349
  VerticalPosition4["Both"] = "both";
344
350
  return VerticalPosition4;
345
351
  })(VerticalPosition || {});
352
+ var LyricsAlign = /* @__PURE__ */ ((LyricsAlign2) => {
353
+ LyricsAlign2["Left"] = "left";
354
+ LyricsAlign2["Center"] = "center";
355
+ LyricsAlign2["Right"] = "right";
356
+ return LyricsAlign2;
357
+ })(LyricsAlign || {});
358
+ var LyricsHyphen = /* @__PURE__ */ ((LyricsHyphen2) => {
359
+ LyricsHyphen2["Hyphen"] = "-";
360
+ LyricsHyphen2["Extender"] = "---";
361
+ return LyricsHyphen2;
362
+ })(LyricsHyphen || {});
346
363
  var Fermata = /* @__PURE__ */ ((Fermata2) => {
347
364
  Fermata2["AtNote"] = "atNote";
348
365
  Fermata2["AtMeasureEnd"] = "atMeasureEnd";
@@ -897,11 +914,11 @@ var Renderer = class {
897
914
 
898
915
  // src/score/engine/obj-staff-and-tab.ts
899
916
  import { MusicError as MusicError15, MusicErrorType as MusicErrorType15 } from "@tspro/web-music-score/core";
900
- import { Utils as Utils11 } from "@tspro/ts-utils-lib";
917
+ import { Utils as Utils12 } from "@tspro/ts-utils-lib";
901
918
 
902
919
  // src/score/engine/obj-measure.ts
903
- import { Utils as Utils10 } from "@tspro/ts-utils-lib";
904
- import { getScale, Scale, validateScaleType, Note as Note7, RhythmProps as RhythmProps4, KeySignature as KeySignature2, getDefaultKeySignature, PitchNotation, SymbolSet, validateNoteLength, NoteLengthProps as NoteLengthProps4 } from "@tspro/web-music-score/theory";
920
+ import { Utils as Utils11 } from "@tspro/ts-utils-lib";
921
+ import { getScale, Scale, validateScaleType, Note as Note7, RhythmProps as RhythmProps5, KeySignature as KeySignature2, getDefaultKeySignature, PitchNotation, SymbolSet, validateNoteLength as validateNoteLength2, NoteLengthProps as NoteLengthProps4 } from "@tspro/web-music-score/theory";
905
922
  import { getDefaultTempo, getDefaultTimeSignature } from "@tspro/web-music-score/theory";
906
923
 
907
924
  // src/score/engine/acc-state.ts
@@ -1491,12 +1508,12 @@ var ObjSignature = class extends MusicObject {
1491
1508
  };
1492
1509
 
1493
1510
  // src/score/engine/player.ts
1494
- import { Utils as Utils6 } from "@tspro/ts-utils-lib";
1495
- import { NoteLength as NoteLength5, RhythmProps as RhythmProps3, alterTempoSpeed } from "@tspro/web-music-score/theory";
1511
+ import { Utils as Utils7 } from "@tspro/ts-utils-lib";
1512
+ import { NoteLength as NoteLength6, RhythmProps as RhythmProps4, alterTempoSpeed } from "@tspro/web-music-score/theory";
1496
1513
  import * as Audio from "@tspro/web-music-score/audio";
1497
1514
 
1498
1515
  // src/score/engine/obj-rhythm-column.ts
1499
- import { Note as Note5 } from "@tspro/web-music-score/theory";
1516
+ import { Note as Note5, validateNoteLength } from "@tspro/web-music-score/theory";
1500
1517
 
1501
1518
  // src/score/engine/obj-arpeggio.ts
1502
1519
  var ObjArpeggio = class extends MusicObject {
@@ -1569,7 +1586,7 @@ var ObjArpeggio = class extends MusicObject {
1569
1586
  };
1570
1587
 
1571
1588
  // src/score/engine/obj-rest.ts
1572
- import { Note as Note3, NoteLength, NoteLengthProps, RhythmProps, Tuplet } from "@tspro/web-music-score/theory";
1589
+ import { Note as Note3, NoteLength, NoteLengthProps, RhythmProps as RhythmProps2, Tuplet } from "@tspro/web-music-score/theory";
1573
1590
  import { MusicError as MusicError5, MusicErrorType as MusicErrorType5 } from "@tspro/web-music-score/core";
1574
1591
  function getDiatonicIdFromStaffPos(staffPos) {
1575
1592
  if (typeof staffPos === "number") {
@@ -1646,7 +1663,7 @@ var ObjRest = class extends MusicObject {
1646
1663
  this.hide = (_b = options == null ? void 0 : options.hide) != null ? _b : false;
1647
1664
  this.oldStyleTriplet = tupletRatio === void 0 && ((options == null ? void 0 : options.triplet) === true || NoteLengthProps.get(noteLength).isTriplet);
1648
1665
  let dotCount = typeof (options == null ? void 0 : options.dotted) === "number" ? options.dotted > 0 ? options.dotted : void 0 : (options == null ? void 0 : options.dotted) === true ? 1 : void 0;
1649
- this.rhythmProps = RhythmProps.get(noteLength, dotCount, (tupletRatio != null ? tupletRatio : this.oldStyleTriplet) ? Tuplet.Triplet : void 0);
1666
+ this.rhythmProps = RhythmProps2.get(noteLength, dotCount, (tupletRatio != null ? tupletRatio : this.oldStyleTriplet) ? Tuplet.Triplet : void 0);
1650
1667
  this.mi = new MRest(this);
1651
1668
  }
1652
1669
  getMusicInterface() {
@@ -1887,7 +1904,7 @@ var ObjRest = class extends MusicObject {
1887
1904
 
1888
1905
  // src/score/engine/obj-note-group.ts
1889
1906
  import { Utils as Utils4 } from "@tspro/ts-utils-lib";
1890
- import { Note as Note4, NoteLengthProps as NoteLengthProps3, RhythmProps as RhythmProps2, Tuplet as Tuplet3 } from "@tspro/web-music-score/theory";
1907
+ import { Note as Note4, NoteLengthProps as NoteLengthProps3, RhythmProps as RhythmProps3, Tuplet as Tuplet3 } from "@tspro/web-music-score/theory";
1891
1908
 
1892
1909
  // src/score/engine/obj-beam-group.ts
1893
1910
  import { Utils as Utils3 } from "@tspro/ts-utils-lib";
@@ -2427,7 +2444,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2427
2444
  this.arpeggio = getArpeggio(options == null ? void 0 : options.arpeggio);
2428
2445
  this.oldStyleTriplet = tupletRatio === void 0 && ((options == null ? void 0 : options.triplet) === true || NoteLengthProps3.get(noteLength).isTriplet);
2429
2446
  let dotCount = typeof (options == null ? void 0 : options.dotted) === "number" ? options.dotted > 0 ? options.dotted : void 0 : (options == null ? void 0 : options.dotted) === true ? 1 : void 0;
2430
- this.rhythmProps = RhythmProps2.get(noteLength, dotCount, (tupletRatio != null ? tupletRatio : this.oldStyleTriplet) ? Tuplet3.Triplet : void 0);
2447
+ this.rhythmProps = RhythmProps3.get(noteLength, dotCount, (tupletRatio != null ? tupletRatio : this.oldStyleTriplet) ? Tuplet3.Triplet : void 0);
2431
2448
  this.mi = new MNoteGroup(this);
2432
2449
  }
2433
2450
  getMusicInterface() {
@@ -2999,12 +3016,93 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2999
3016
 
3000
3017
  // src/score/engine/obj-rhythm-column.ts
3001
3018
  import { MusicError as MusicError8, MusicErrorType as MusicErrorType8 } from "@tspro/web-music-score/core";
3019
+
3020
+ // src/score/engine/obj-lyrics.ts
3021
+ import { Utils as Utils5 } from "@tspro/ts-utils-lib";
3022
+ var LyricsContainer = class {
3023
+ constructor(col, lyricsLength) {
3024
+ this.col = col;
3025
+ __publicField(this, "lyricsObjects", []);
3026
+ __publicField(this, "rhythmProps");
3027
+ this.rhythmProps = RhythmProps.get(lyricsLength);
3028
+ }
3029
+ addLyricsObject(lyricsObj) {
3030
+ var _a;
3031
+ this.lyricsObjects.push(lyricsObj);
3032
+ (_a = lyricsObj.measure.getPrevLyricsObject(lyricsObj)) == null ? void 0 : _a.setNextLyricsObject(lyricsObj);
3033
+ }
3034
+ };
3035
+ var ObjLyrics = class extends MusicObject {
3036
+ constructor(col, verse, line, vpos, lyricsText, lyricsOptions) {
3037
+ super(col);
3038
+ this.col = col;
3039
+ this.verse = verse;
3040
+ this.line = line;
3041
+ this.vpos = vpos;
3042
+ __publicField(this, "nextLyricsObject");
3043
+ __publicField(this, "color", "black");
3044
+ __publicField(this, "hyphen");
3045
+ __publicField(this, "text");
3046
+ __publicField(this, "mi");
3047
+ let halign = (lyricsOptions == null ? void 0 : lyricsOptions.align) === "left" /* Left */ ? 0 : (lyricsOptions == null ? void 0 : lyricsOptions.align) === "right" /* Right */ ? 1 : 0.5;
3048
+ this.hyphen = Utils5.Is.isEnumValue(lyricsOptions == null ? void 0 : lyricsOptions.hyphen, LyricsHyphen) ? lyricsOptions == null ? void 0 : lyricsOptions.hyphen : void 0;
3049
+ this.text = new ObjText(this, { text: lyricsText, color: this.color, scale: 0.8 }, halign, 0);
3050
+ this.rect = new DivRect();
3051
+ this.mi = new MLyrics(this);
3052
+ }
3053
+ getMusicInterface() {
3054
+ return this.mi;
3055
+ }
3056
+ get measure() {
3057
+ return this.col.measure;
3058
+ }
3059
+ getText() {
3060
+ return this.text.getText();
3061
+ }
3062
+ setNextLyricsObject(lyricsObj) {
3063
+ this.nextLyricsObject = lyricsObj;
3064
+ }
3065
+ pick(x, y) {
3066
+ return this.rect.contains(x, y) ? [this] : [];
3067
+ }
3068
+ layout(renderer) {
3069
+ this.text.layout(renderer);
3070
+ this.rect = this.text.getRect().copy();
3071
+ }
3072
+ offset(dx, dy) {
3073
+ this.text.offset(dx, dy);
3074
+ this.rect.offsetInPlace(dx, dy);
3075
+ }
3076
+ draw(renderer) {
3077
+ var _a;
3078
+ this.text.draw(renderer);
3079
+ const ctx = renderer.getCanvasContext();
3080
+ if (ctx && this.hyphen !== void 0) {
3081
+ let l = this.getRect();
3082
+ let r = (_a = this.nextLyricsObject) == null ? void 0 : _a.getRect();
3083
+ let hyphenw = renderer.unitSize * 1.5;
3084
+ let maxw = r ? (r.left - l.right) * 0.85 : hyphenw;
3085
+ let w = this.hyphen === "-" /* Hyphen */ ? Math.min(hyphenw, maxw) : maxw;
3086
+ if (w > 0) {
3087
+ ctx.lineWidth = renderer.lineWidth;
3088
+ ctx.strokeStyle = ctx.fillStyle = this.color;
3089
+ let cx = r ? (r.left + l.right) / 2 : l.right + w / 0.85;
3090
+ let cy = (l.top + l.bottom) / 2;
3091
+ ctx.moveTo(cx - w / 2, cy);
3092
+ ctx.lineTo(cx + w / 2, cy);
3093
+ ctx.stroke();
3094
+ }
3095
+ }
3096
+ }
3097
+ };
3098
+
3099
+ // src/score/engine/obj-rhythm-column.ts
3002
3100
  var noteHeadDataCompareFunc = (a, b) => {
3003
- let cmp = Note5.compareFunc(a.note, b.note);
3004
- if (cmp === 0) {
3005
- cmp = a.noteGroup.stemDir === b.noteGroup.stemDir ? 0 : a.noteGroup.stemDir === "up" /* Up */ ? 1 : -1;
3101
+ let cmp2 = Note5.compareFunc(a.note, b.note);
3102
+ if (cmp2 === 0) {
3103
+ cmp2 = a.noteGroup.stemDir === b.noteGroup.stemDir ? 0 : a.noteGroup.stemDir === "up" /* Up */ ? 1 : -1;
3006
3104
  }
3007
- return cmp;
3105
+ return cmp2;
3008
3106
  };
3009
3107
  var ObjRhythmColumn = class extends MusicObject {
3010
3108
  constructor(measure, positionTicks) {
@@ -3012,6 +3110,7 @@ var ObjRhythmColumn = class extends MusicObject {
3012
3110
  this.measure = measure;
3013
3111
  this.positionTicks = positionTicks;
3014
3112
  __publicField(this, "voiceSymbol", []);
3113
+ __publicField(this, "lyricsContainers", []);
3015
3114
  __publicField(this, "minDiatonicId");
3016
3115
  __publicField(this, "maxDiatonicId");
3017
3116
  __publicField(this, "staffMinDiatonicId", /* @__PURE__ */ new Map());
@@ -3137,6 +3236,19 @@ var ObjRhythmColumn = class extends MusicObject {
3137
3236
  getVoiceSymbol(voiceId) {
3138
3237
  return this.voiceSymbol[voiceId];
3139
3238
  }
3239
+ getLyricsContainerDatas() {
3240
+ return this.lyricsContainers;
3241
+ }
3242
+ getLyricsContainer(verse, line, vpos, lyricsLength) {
3243
+ let data = this.lyricsContainers.find((data2) => data2.verse === verse && data2.line === line && data2.vpos === vpos);
3244
+ if (data === void 0 && lyricsLength !== void 0) {
3245
+ data = { lyricsContainer: new LyricsContainer(this, validateNoteLength(lyricsLength)), verse, line, vpos };
3246
+ this.lyricsContainers.push(data);
3247
+ this.requestLayout();
3248
+ this.requestRectUpdate();
3249
+ }
3250
+ return data == null ? void 0 : data.lyricsContainer;
3251
+ }
3140
3252
  getMinWidth() {
3141
3253
  let maxNoteSize = Math.max(...this.voiceSymbol.map((s) => s.rhythmProps.noteSize));
3142
3254
  let w = DocumentSettings.NoteHeadWidth;
@@ -3356,7 +3468,7 @@ var ObjRhythmColumn = class extends MusicObject {
3356
3468
  import { MusicError as MusicError9, MusicErrorType as MusicErrorType9 } from "@tspro/web-music-score/core";
3357
3469
 
3358
3470
  // src/score/engine/element-data.ts
3359
- import { Utils as Utils5 } from "@tspro/ts-utils-lib";
3471
+ import { Utils as Utils6 } from "@tspro/ts-utils-lib";
3360
3472
 
3361
3473
  // src/score/engine/obj-special-text.ts
3362
3474
  var _ObjSpecialText = class _ObjSpecialText extends MusicObject {
@@ -3478,23 +3590,23 @@ function getNavigationString(navigation) {
3478
3590
  }
3479
3591
  }
3480
3592
  function isDynamicsText(text) {
3481
- return Utils5.Is.isEnumValue(text, DynamicsAnnotation);
3593
+ return Utils6.Is.isEnumValue(text, DynamicsAnnotation);
3482
3594
  }
3483
3595
  function getDynamicsVolume(text) {
3484
3596
  if (/^(p+|f+|m|mp|mf)$/.test(text)) {
3485
- let volume = 0.5 - Utils5.Str.charCount(text, "p") * 0.1 + Utils5.Str.charCount(text, "f") * 0.1;
3486
- return Utils5.Math.clamp(volume, 0, 1);
3597
+ let volume = 0.5 - Utils6.Str.charCount(text, "p") * 0.1 + Utils6.Str.charCount(text, "f") * 0.1;
3598
+ return Utils6.Math.clamp(volume, 0, 1);
3487
3599
  } else {
3488
3600
  return void 0;
3489
3601
  }
3490
3602
  }
3491
3603
  function isTempoText(text) {
3492
- return Utils5.Is.isEnumValue(text, TempoAnnotation);
3604
+ return Utils6.Is.isEnumValue(text, TempoAnnotation);
3493
3605
  }
3494
3606
  function getAnnotation(text) {
3495
- if (Utils5.Is.isEnumValue(text, DynamicsAnnotation)) {
3607
+ if (Utils6.Is.isEnumValue(text, DynamicsAnnotation)) {
3496
3608
  return "dynamics" /* Dynamics */;
3497
- } else if (Utils5.Is.isEnumValue(text, TempoAnnotation)) {
3609
+ } else if (Utils6.Is.isEnumValue(text, TempoAnnotation)) {
3498
3610
  return "tempo" /* Tempo */;
3499
3611
  } else {
3500
3612
  return void 0;
@@ -3617,7 +3729,7 @@ var RitardandoSpeedDiv = 2;
3617
3729
  var CrescendoVolumeAdd = 0.5;
3618
3730
  var DiminuendoVolumeSub = 0.5;
3619
3731
  function calcTicksDuration(ticks, tempo) {
3620
- let beatTicks = RhythmProps3.get(tempo.options.beatLength, tempo.options.dotCount).ticks;
3732
+ let beatTicks = RhythmProps4.get(tempo.options.beatLength, tempo.options.dotCount).ticks;
3621
3733
  let ticksPerMinute = tempo.beatsPerMinute * beatTicks;
3622
3734
  return 60 * ticks / ticksPerMinute;
3623
3735
  }
@@ -3650,7 +3762,7 @@ var PlayerColumnProps = class {
3650
3762
  return this.speed;
3651
3763
  }
3652
3764
  getTempo() {
3653
- let speed = Utils6.Math.clamp(this.getSpeed(), 0.1, 10);
3765
+ let speed = Utils7.Math.clamp(this.getSpeed(), 0.1, 10);
3654
3766
  return alterTempoSpeed(this.measure.getTempo(), speed);
3655
3767
  }
3656
3768
  setVolume(volume) {
@@ -3675,7 +3787,7 @@ var PlayerColumnProps = class {
3675
3787
  if (symbolsTicks.length === 0) {
3676
3788
  return 0;
3677
3789
  } else {
3678
- return Utils6.Math.sum(symbolsTicks) / symbolsTicks.length;
3790
+ return Utils7.Math.sum(symbolsTicks) / symbolsTicks.length;
3679
3791
  }
3680
3792
  }
3681
3793
  }
@@ -3824,7 +3936,7 @@ var Player = class _Player {
3824
3936
  } else if (layoutObj.musicObj.getLink() instanceof Extension) {
3825
3937
  let extension = layoutObj.musicObj.getLink();
3826
3938
  let { columnRange, extensionBreakText } = extension.getExtensionRangeInfo();
3827
- let totalTicks = Utils6.Math.sum(columnRange.map((c) => c.getTicksToNextColumn()));
3939
+ let totalTicks = Utils7.Math.sum(columnRange.map((c) => c.getTicksToNextColumn()));
3828
3940
  switch (text) {
3829
3941
  case "accel." /* accel */: {
3830
3942
  let startSpeed = curSpeed;
@@ -3878,11 +3990,11 @@ var Player = class _Player {
3878
3990
  });
3879
3991
  let speedArr = (_a = speedMap.get(col)) != null ? _a : [];
3880
3992
  if (speedArr.length > 0) {
3881
- curSpeed = Utils6.Math.sum(speedArr) / speedArr.length;
3993
+ curSpeed = Utils7.Math.sum(speedArr) / speedArr.length;
3882
3994
  }
3883
3995
  let volumeArr = (_b = volumeMap.get(col)) != null ? _b : [];
3884
3996
  if (volumeArr.length > 0) {
3885
- curVolume = Utils6.Math.sum(volumeArr) / volumeArr.length;
3997
+ curVolume = Utils7.Math.sum(volumeArr) / volumeArr.length;
3886
3998
  }
3887
3999
  col.getPlayerProps().setSpeed(curSpeed);
3888
4000
  col.getPlayerProps().setVolume(curVolume);
@@ -3920,11 +4032,11 @@ var Player = class _Player {
3920
4032
  } else {
3921
4033
  let playerNotes = col.getPlayerNotes();
3922
4034
  playerNotes.forEach((note, i) => {
3923
- let arpeggioDelayTicks = col.hasArpeggio() ? RhythmProps3.get(NoteLength5.ThirtySecond).ticks * i : 0;
4035
+ let arpeggioDelayTicks = col.hasArpeggio() ? RhythmProps4.get(NoteLength6.ThirtySecond).ticks * i : 0;
3924
4036
  let noteSeconds = getDuration(note.ticks + fermataHoldTicks - arpeggioDelayTicks, tempo);
3925
4037
  if (noteSeconds > 0) {
3926
4038
  if (note.staccato) {
3927
- noteSeconds = Math.min(getDuration(RhythmProps3.get(NoteLength5.Eighth).ticks, tempo) / 2, noteSeconds / 2);
4039
+ noteSeconds = Math.min(getDuration(RhythmProps4.get(NoteLength6.Eighth).ticks, tempo) / 2, noteSeconds / 2);
3928
4040
  }
3929
4041
  let volume = adjustVolume(col.getPlayerProps().getVolume());
3930
4042
  if (note.slur === "slurred") {
@@ -4212,7 +4324,7 @@ var ObjBarLineRight = class extends ObjBarLine {
4212
4324
  };
4213
4325
 
4214
4326
  // src/score/engine/obj-ending.ts
4215
- import { Utils as Utils7 } from "@tspro/ts-utils-lib";
4327
+ import { Utils as Utils8 } from "@tspro/ts-utils-lib";
4216
4328
  import { MusicError as MusicError10, MusicErrorType as MusicErrorType10 } from "@tspro/web-music-score/core";
4217
4329
  var ObjEnding = class extends MusicObject {
4218
4330
  constructor(measure, passages) {
@@ -4223,9 +4335,9 @@ var ObjEnding = class extends MusicObject {
4223
4335
  __publicField(this, "shapeRects", []);
4224
4336
  __publicField(this, "mi");
4225
4337
  this.mi = new MEnding(this);
4226
- if (!Utils7.Is.isIntegerGte(passages.length, 1)) {
4338
+ if (!Utils8.Is.isIntegerGte(passages.length, 1)) {
4227
4339
  throw new MusicError10(MusicErrorType10.Score, "Passages is empty.");
4228
- } else if (!this.passages.every((p) => Utils7.Is.isIntegerGte(p, 1))) {
4340
+ } else if (!this.passages.every((p) => Utils8.Is.isIntegerGte(p, 1))) {
4229
4341
  throw new MusicError10(MusicErrorType10.Score, "Invalid passages: " + this.passages);
4230
4342
  }
4231
4343
  this.passages.sort((a, b) => a - b);
@@ -4440,7 +4552,7 @@ import { MusicError as MusicError13, MusicErrorType as MusicErrorType13 } from "
4440
4552
  import { Note as Note6 } from "@tspro/web-music-score/theory";
4441
4553
 
4442
4554
  // src/score/engine/obj-connective.ts
4443
- import { Utils as Utils8 } from "@tspro/ts-utils-lib";
4555
+ import { Utils as Utils9 } from "@tspro/ts-utils-lib";
4444
4556
  import { MusicError as MusicError11, MusicErrorType as MusicErrorType11 } from "@tspro/web-music-score/core";
4445
4557
  var ObjConnective = class extends MusicObject {
4446
4558
  constructor(connectiveProps, line, measure, leftNoteGroup, leftNoteId, ...args) {
@@ -4469,7 +4581,7 @@ var ObjConnective = class extends MusicObject {
4469
4581
  this.rightNoteGroup = args[0];
4470
4582
  this.rightNoteId = args[1];
4471
4583
  this.tieType = void 0;
4472
- } else if (Utils8.Is.isEnumValue(args[0], TieType)) {
4584
+ } else if (Utils9.Is.isEnumValue(args[0], TieType)) {
4473
4585
  this.rightNoteGroup = void 0;
4474
4586
  this.rightNoteId = void 0;
4475
4587
  this.tieType = args[0];
@@ -4539,7 +4651,7 @@ var ObjConnective = class extends MusicObject {
4539
4651
  this.rx = rx;
4540
4652
  this.ry = ry;
4541
4653
  this.arcHeight = this.connectiveProps.connective === "slide" /* Slide */ ? 0 : arcHeight;
4542
- let { nx, ny } = Utils8.Math.calcNormal(lx, ly, rx, ry);
4654
+ let { nx, ny } = Utils9.Math.calcNormal(lx, ly, rx, ry);
4543
4655
  this.cp1x = lx * 0.7 + rx * 0.3 + nx * this.arcHeight;
4544
4656
  this.cp1y = ly * 0.7 + ry * 0.3 + ny * this.arcHeight;
4545
4657
  this.cp2x = lx * 0.3 + rx * 0.7 + nx * this.arcHeight;
@@ -4600,7 +4712,7 @@ var ObjConnective = class extends MusicObject {
4600
4712
 
4601
4713
  // src/score/engine/connective-props.ts
4602
4714
  import { MusicError as MusicError12, MusicErrorType as MusicErrorType12 } from "@tspro/web-music-score/core";
4603
- import { Utils as Utils9 } from "@tspro/ts-utils-lib";
4715
+ import { Utils as Utils10 } from "@tspro/ts-utils-lib";
4604
4716
  var ConnectiveProps = class {
4605
4717
  constructor(connective, span, noteAnchor, startNoteGroup) {
4606
4718
  this.connective = connective;
@@ -4670,7 +4782,7 @@ var ConnectiveProps = class {
4670
4782
  this.computeParams();
4671
4783
  let { connective, span } = this;
4672
4784
  if (connective === "tie" /* Tie */) {
4673
- if (Utils9.Is.isEnumValue(span, TieType)) {
4785
+ if (Utils10.Is.isEnumValue(span, TieType)) {
4674
4786
  let leftNoteGroup = this.noteGroups[0];
4675
4787
  for (let noteId = 0; noteId < leftNoteGroup.notes.length; noteId++) {
4676
4788
  this.createObjConnectiveWithTieType(leftNoteGroup, noteId, span);
@@ -4741,8 +4853,9 @@ var ConnectiveProps = class {
4741
4853
  };
4742
4854
 
4743
4855
  // src/score/engine/obj-measure.ts
4856
+ var cmp = (a, b) => a === b ? 0 : a < b ? -1 : 1;
4744
4857
  function validateVoiceId(voiceId) {
4745
- if (getVoiceIds().indexOf(voiceId) < 0) {
4858
+ if (typeof voiceId === "number" && getVoiceIds().indexOf(voiceId) < 0) {
4746
4859
  throw new MusicError13(MusicErrorType13.Score, "Invalid voiceId: " + voiceId);
4747
4860
  } else {
4748
4861
  return voiceId;
@@ -4752,14 +4865,14 @@ function getExtensionTicks(extensionLength) {
4752
4865
  if (typeof extensionLength === "string") {
4753
4866
  extensionLength = [extensionLength];
4754
4867
  }
4755
- if (Utils10.Is.isArray(extensionLength)) {
4868
+ if (Utils11.Is.isArray(extensionLength)) {
4756
4869
  let totalTicks = 0;
4757
4870
  for (let i = 0; i < extensionLength.length; ) {
4758
4871
  let str = extensionLength[i];
4759
4872
  let num = extensionLength[i + 1];
4760
4873
  if (typeof str === "string") {
4761
4874
  i++;
4762
- let ticks = RhythmProps4.get(str).ticks;
4875
+ let ticks = RhythmProps5.get(str).ticks;
4763
4876
  if (typeof num === "number") {
4764
4877
  i++;
4765
4878
  ticks *= num;
@@ -4774,6 +4887,18 @@ function getExtensionTicks(extensionLength) {
4774
4887
  return extensionLength;
4775
4888
  }
4776
4889
  }
4890
+ function getVerseLayoutGroupId(verse) {
4891
+ switch (verse) {
4892
+ case 1:
4893
+ return 7 /* LyricsVerse1 */;
4894
+ case 2:
4895
+ return 8 /* LyricsVerse2 */;
4896
+ case 3:
4897
+ return 9 /* LyricsVerse3 */;
4898
+ default:
4899
+ throw new MusicError13(MusicErrorType13.Unknown, "VerseNumber is not 1, 2 or 3.");
4900
+ }
4901
+ }
4777
4902
  var _ObjMeasure = class _ObjMeasure extends MusicObject {
4778
4903
  constructor(row) {
4779
4904
  super(row);
@@ -4818,6 +4943,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
4818
4943
  // play twice.
4819
4944
  __publicField(this, "endRepeatPlayCountText");
4820
4945
  __publicField(this, "staticObjectsCache", /* @__PURE__ */ new Map());
4946
+ __publicField(this, "lyricsObjectsCache", /* @__PURE__ */ new Map());
4821
4947
  __publicField(this, "mi");
4822
4948
  this.mi = new MMeasure(this);
4823
4949
  this.prevMeasure = row.doc.getLastMeasure();
@@ -5001,7 +5127,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5001
5127
  this.alterKeySignature = args[0];
5002
5128
  } else if (args[0] instanceof Scale) {
5003
5129
  this.alterKeySignature = args[0];
5004
- } else if (Utils10.Is.isNonEmptyString(args[0])) {
5130
+ } else if (Utils11.Is.isNonEmptyString(args[0])) {
5005
5131
  if (args.length === 1) {
5006
5132
  this.alterKeySignature = getScale(args[0]);
5007
5133
  } else if (args.length === 2) {
@@ -5056,7 +5182,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5056
5182
  } else {
5057
5183
  let dotCount = typeof dotted === "number" && dotted > 0 ? dotted : dotted === true ? 1 : NoteLengthProps4.get(beatLength).dotCount;
5058
5184
  let options = {
5059
- beatLength: validateNoteLength(beatLength),
5185
+ beatLength: validateNoteLength2(beatLength),
5060
5186
  dotCount: dotCount > 0 ? dotCount : void 0
5061
5187
  };
5062
5188
  this.alterTempo = { beatsPerMinute, options };
@@ -5112,7 +5238,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5112
5238
  let grp = this.doc.getStaffGroup(staffTabOrGroup);
5113
5239
  if (grp && !prevGroups.includes(staffTabOrGroup)) {
5114
5240
  let curGroups = [...prevGroups, staffTabOrGroup];
5115
- (Utils10.Is.isArray(grp.staffsTabsAndGroups) ? grp.staffsTabsAndGroups : [grp.staffsTabsAndGroups]).forEach((staffTabOrGroup2) => {
5241
+ (Utils11.Is.isArray(grp.staffsTabsAndGroups) ? grp.staffsTabsAndGroups : [grp.staffsTabsAndGroups]).forEach((staffTabOrGroup2) => {
5116
5242
  switch (grp.verticalPosition) {
5117
5243
  case "above" /* Above */:
5118
5244
  addToStaffTabOrGroup(staffTabOrGroup2, 0 /* Above */, curGroups);
@@ -5139,7 +5265,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5139
5265
  } else {
5140
5266
  addToStaffTabOrGroup(0, defaultVerticalPos);
5141
5267
  }
5142
- } else if (Utils10.Is.isArray(staffTabOrGroups)) {
5268
+ } else if (Utils11.Is.isArray(staffTabOrGroups)) {
5143
5269
  staffTabOrGroups.forEach((staffTabOrGroup) => addToStaffTabOrGroup(staffTabOrGroup, defaultVerticalPos));
5144
5270
  } else {
5145
5271
  addToStaffTabOrGroup(staffTabOrGroups, defaultVerticalPos);
@@ -5223,7 +5349,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5223
5349
  case "endRepeat" /* EndRepeat */:
5224
5350
  if (args.length === 0) {
5225
5351
  this.endRepeatPlayCount = 2;
5226
- } else if (Utils10.Is.isIntegerGte(args[0], 2)) {
5352
+ } else if (Utils11.Is.isIntegerGte(args[0], 2)) {
5227
5353
  this.endRepeatPlayCount = args[0];
5228
5354
  } else {
5229
5355
  throw new MusicError13(MusicErrorType13.Score, "Invalid end repeat play count (should be 2 or greater integer): " + args[0]);
@@ -5310,15 +5436,15 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5310
5436
  throw new MusicError13(MusicErrorType13.Score, "Connective can be added to note group only.");
5311
5437
  }
5312
5438
  if (connective === "tie" /* Tie */) {
5313
- let tieSpan = Utils10.Is.isInteger(args[0]) || Utils10.Is.isEnumValue(args[0], TieType) ? args[0] : 2;
5314
- let noteAnchor = Utils10.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : "auto" /* Auto */;
5439
+ let tieSpan = Utils11.Is.isInteger(args[0]) || Utils11.Is.isEnumValue(args[0], TieType) ? args[0] : 2;
5440
+ let noteAnchor = Utils11.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : "auto" /* Auto */;
5315
5441
  anchor.startConnective(new ConnectiveProps("tie" /* Tie */, tieSpan, noteAnchor, anchor));
5316
5442
  } else if (connective === "slur" /* Slur */) {
5317
- let slurSpan = Utils10.Is.isInteger(args[0]) ? args[0] : 2;
5318
- let noteAnchor = Utils10.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : "auto" /* Auto */;
5443
+ let slurSpan = Utils11.Is.isInteger(args[0]) ? args[0] : 2;
5444
+ let noteAnchor = Utils11.Is.isEnumValue(args[1], NoteAnchor) ? args[1] : "auto" /* Auto */;
5319
5445
  anchor.startConnective(new ConnectiveProps("slur" /* Slur */, slurSpan, noteAnchor, anchor));
5320
5446
  } else if (connective === "slide" /* Slide */) {
5321
- let noteAnchor = Utils10.Is.isEnumValue(args[0], NoteAnchor) ? args[0] : "auto" /* Auto */;
5447
+ let noteAnchor = Utils11.Is.isEnumValue(args[0], NoteAnchor) ? args[0] : "auto" /* Auto */;
5322
5448
  anchor.startConnective(new ConnectiveProps("slide" /* Slide */, 2, noteAnchor, anchor));
5323
5449
  }
5324
5450
  }
@@ -5372,10 +5498,11 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5372
5498
  this.doc.requestNewRow();
5373
5499
  this.disableExtension();
5374
5500
  }
5375
- addRhythmSymbol(voiceId, symbol) {
5376
- let { col } = symbol;
5501
+ addRhythmSymbol(symbol) {
5502
+ var _a, _b;
5503
+ let { col, voiceId } = symbol;
5377
5504
  col.setVoiceSymbol(voiceId, symbol);
5378
- this.getVoiceSymbols(voiceId);
5505
+ (_b = (_a = this.voiceSymbols)[voiceId]) != null ? _b : _a[voiceId] = [];
5379
5506
  this.voiceSymbols[voiceId].push(symbol);
5380
5507
  if (symbol.oldStyleTriplet) {
5381
5508
  this.createOldStyleTriplets(voiceId);
@@ -5388,25 +5515,40 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5388
5515
  let realNotes = notes.map((note) => typeof note === "string" ? Note7.getNote(note) : note);
5389
5516
  let col = this.getRhythmColumn(voiceId);
5390
5517
  let noteGroup = new ObjNoteGroup(col, voiceId, realNotes, noteLength, options, tupletRatio);
5391
- this.addRhythmSymbol(voiceId, noteGroup);
5518
+ this.addRhythmSymbol(noteGroup);
5392
5519
  return noteGroup;
5393
5520
  }
5394
5521
  addRest(voiceId, restLength, options, tupletRatio) {
5395
5522
  let col = this.getRhythmColumn(voiceId);
5396
5523
  let rest = new ObjRest(col, voiceId, restLength, options, tupletRatio);
5397
- this.addRhythmSymbol(voiceId, rest);
5524
+ this.addRhythmSymbol(rest);
5398
5525
  return rest;
5399
5526
  }
5527
+ addLyrics(staffTabOrGroups, verse, lyricsLength, lyricsText, lyricsOptions) {
5528
+ this.forEachStaffGroup(staffTabOrGroups, 1 /* Below */, (line, vpos) => {
5529
+ let col = this.getRhythmColumn({ verse, line, vpos });
5530
+ let lyricsContainer = col.getLyricsContainer(verse, line, vpos, validateNoteLength2(lyricsLength));
5531
+ if (lyricsContainer) {
5532
+ let lyricsObj = new ObjLyrics(col, verse, line, vpos, lyricsText, lyricsOptions);
5533
+ let lyricsArr = this.getLyricsObjects(lyricsObj.line, lyricsObj.vpos, lyricsObj.verse);
5534
+ lyricsArr.push(lyricsObj);
5535
+ lyricsArr.sort((a, b) => cmp(a.col.positionTicks, b.col.positionTicks));
5536
+ lyricsContainer.addLyricsObject(lyricsObj);
5537
+ this.addLayoutObject(lyricsObj, line, getVerseLayoutGroupId(verse), vpos);
5538
+ }
5539
+ this.lastAddedRhythmColumn = col;
5540
+ });
5541
+ }
5400
5542
  /**
5401
5543
  *
5402
5544
  * @param positionTicks - get ObjRhythmColumn with positionTicks. Insert new if necessary.
5403
5545
  * @returns
5404
5546
  */
5405
- getRhythmColumn(voiceId) {
5547
+ getRhythmColumn(arg) {
5406
5548
  let positionTicks = 0;
5407
5549
  for (let i = this.columns.length - 1; i >= 0 && positionTicks === 0; i--) {
5408
5550
  let col = this.columns[i];
5409
- let symbol = col.getVoiceSymbol(voiceId);
5551
+ let symbol = typeof arg === "number" ? col.getVoiceSymbol(arg) : col.getLyricsContainer(arg.verse, arg.line, arg.vpos);
5410
5552
  if (symbol) {
5411
5553
  positionTicks = col.positionTicks + symbol.rhythmProps.ticks;
5412
5554
  }
@@ -5473,6 +5615,38 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5473
5615
  getStaffLineRight() {
5474
5616
  return this.barLineRight.getRect().centerX;
5475
5617
  }
5618
+ getLyricsObjects(line, vpos, verse) {
5619
+ let vposMap = this.lyricsObjectsCache.get(line);
5620
+ if (vposMap === void 0) {
5621
+ vposMap = /* @__PURE__ */ new Map();
5622
+ this.lyricsObjectsCache.set(line, vposMap);
5623
+ }
5624
+ let verseMap = vposMap.get(vpos);
5625
+ if (verseMap === void 0) {
5626
+ verseMap = /* @__PURE__ */ new Map();
5627
+ vposMap.set(vpos, verseMap);
5628
+ }
5629
+ let lyricsArr = verseMap.get(verse);
5630
+ if (lyricsArr === void 0) {
5631
+ lyricsArr = [];
5632
+ verseMap.set(verse, lyricsArr);
5633
+ }
5634
+ return lyricsArr;
5635
+ }
5636
+ getPrevLyricsObject(lyricsObj) {
5637
+ var _a;
5638
+ let lyricsArr = this.getLyricsObjects(lyricsObj.line, lyricsObj.vpos, lyricsObj.verse);
5639
+ let i = lyricsArr.indexOf(lyricsObj);
5640
+ if (i > 0) {
5641
+ return lyricsArr[i - 1];
5642
+ } else if (i === 0) {
5643
+ let lyricsArr2 = (_a = lyricsObj.measure.getPrevMeasure()) == null ? void 0 : _a.getLyricsObjects(lyricsObj.line, lyricsObj.vpos, lyricsObj.verse);
5644
+ if (lyricsArr2 && lyricsArr2.length > 0) {
5645
+ return lyricsArr2[lyricsArr2.length - 1];
5646
+ }
5647
+ }
5648
+ return void 0;
5649
+ }
5476
5650
  getStaticObjects(line) {
5477
5651
  let staticObjects = this.staticObjectsCache.get(line);
5478
5652
  if (!staticObjects) {
@@ -5641,10 +5815,9 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5641
5815
  return this.barLineRight;
5642
5816
  }
5643
5817
  getVoiceSymbols(voiceId) {
5818
+ var _a, _b;
5644
5819
  validateVoiceId(voiceId);
5645
- if (this.voiceSymbols[voiceId] === void 0) {
5646
- this.voiceSymbols[voiceId] = [];
5647
- }
5820
+ (_b = (_a = this.voiceSymbols)[voiceId]) != null ? _b : _a[voiceId] = [];
5648
5821
  return this.voiceSymbols[voiceId];
5649
5822
  }
5650
5823
  completeRests(voiceId) {
@@ -5655,7 +5828,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5655
5828
  this.completeRests(getVoiceIds().filter((id) => this.getConsumedTicks(id) > 0));
5656
5829
  }
5657
5830
  return;
5658
- } else if (Utils10.Is.isArray(voiceId)) {
5831
+ } else if (Utils11.Is.isArray(voiceId)) {
5659
5832
  voiceId.forEach((id) => this.completeRests(id));
5660
5833
  return;
5661
5834
  } else {
@@ -5668,7 +5841,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5668
5841
  for (let noteSize = NoteLengthProps4.LongestNoteSize; noteSize <= NoteLengthProps4.ShortestNoteSize; noteSize *= 2) {
5669
5842
  let restLength = NoteLengthProps4.create(noteSize).noteLength;
5670
5843
  for (let dotCount = NoteLengthProps4.get(restLength).maxDotCount; dotCount >= 0; dotCount--) {
5671
- let restProps = RhythmProps4.get(restLength, dotCount);
5844
+ let restProps = RhythmProps5.get(restLength, dotCount);
5672
5845
  while (restProps.ticks <= remainingTicks) {
5673
5846
  rests.push(restProps);
5674
5847
  remainingTicks -= restProps.ticks;
@@ -5770,7 +5943,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5770
5943
  let columnsAreaLeft = this.rect.left + this.leftSolidAreaWidth;
5771
5944
  let columnsAreaRight = this.rect.right - this.rightSolidAreaWidth;
5772
5945
  let columnsAreaWidth = columnsAreaRight - columnsAreaLeft;
5773
- let columnsWidth = Utils10.Math.sum(this.columns.map((col) => col.getRect().width));
5946
+ let columnsWidth = Utils11.Math.sum(this.columns.map((col) => col.getRect().width));
5774
5947
  let columnScale = columnsAreaWidth / columnsWidth;
5775
5948
  let columnLeft = columnsAreaLeft;
5776
5949
  this.columns.forEach((col) => {
@@ -5890,8 +6063,20 @@ var ObjMeasure2 = _ObjMeasure;
5890
6063
 
5891
6064
  // src/score/engine/layout-object.ts
5892
6065
  import { MusicError as MusicError14, MusicErrorType as MusicErrorType14 } from "@tspro/web-music-score/core";
5893
- var WidenColumnList = [1 /* NoteLabel */, 6 /* ChordLabel */];
5894
- var RowAlignList = [2 /* Navigation */, 3 /* Ending */, 4 /* TempoAnnotation */, 5 /* DynamicsAnnotation */, 6 /* ChordLabel */];
6066
+ var WidenColumnList = [
6067
+ 1 /* NoteLabel */,
6068
+ 6 /* ChordLabel */
6069
+ ];
6070
+ var RowAlignList = [
6071
+ 2 /* Navigation */,
6072
+ 3 /* Ending */,
6073
+ 4 /* TempoAnnotation */,
6074
+ 5 /* DynamicsAnnotation */,
6075
+ 6 /* ChordLabel */,
6076
+ 7 /* LyricsVerse1 */,
6077
+ 8 /* LyricsVerse2 */,
6078
+ 9 /* LyricsVerse3 */
6079
+ ];
5895
6080
  function requireParentMeasure(p) {
5896
6081
  while (p) {
5897
6082
  if (p instanceof ObjMeasure2) {
@@ -6251,7 +6436,7 @@ var ObjTab = class extends ObjNotationLine4 {
6251
6436
  __publicField(this, "tuningName");
6252
6437
  __publicField(this, "tuningStrings");
6253
6438
  __publicField(this, "mi");
6254
- if (Utils11.Is.isArray(tabConfig.tuning)) {
6439
+ if (Utils12.Is.isArray(tabConfig.tuning)) {
6255
6440
  this.tuningName = void 0;
6256
6441
  this.tuningStrings = tabConfig.tuning.map((noteName) => Note8.getNote(noteName)).reverse();
6257
6442
  } else if (typeof tabConfig.tuning === "string") {
@@ -6706,7 +6891,7 @@ var ObjHeader = class extends MusicObject {
6706
6891
  };
6707
6892
 
6708
6893
  // src/score/engine/obj-document.ts
6709
- import { Utils as Utils12 } from "@tspro/ts-utils-lib";
6894
+ import { Utils as Utils13 } from "@tspro/ts-utils-lib";
6710
6895
  var ObjDocument = class extends MusicObject {
6711
6896
  constructor() {
6712
6897
  super(void 0);
@@ -6727,7 +6912,7 @@ var ObjDocument = class extends MusicObject {
6727
6912
  return this.mi;
6728
6913
  }
6729
6914
  setScoreConfiguration(config) {
6730
- if (Utils12.Is.isEnumValue(config, StaffPreset)) {
6915
+ if (Utils13.Is.isEnumValue(config, StaffPreset)) {
6731
6916
  switch (config) {
6732
6917
  default:
6733
6918
  case "treble" /* Treble */:
@@ -6755,7 +6940,7 @@ var ObjDocument = class extends MusicObject {
6755
6940
  ];
6756
6941
  break;
6757
6942
  }
6758
- } else if (Utils12.Is.isArray(config)) {
6943
+ } else if (Utils13.Is.isArray(config)) {
6759
6944
  this.curScoreConfig = config;
6760
6945
  } else {
6761
6946
  this.curScoreConfig = [config];
@@ -6981,7 +7166,7 @@ var ObjDocument = class extends MusicObject {
6981
7166
  };
6982
7167
 
6983
7168
  // src/score/pub/document-builder.ts
6984
- import { BeamGrouping, KeySignature as KeySignature3, Note as Note10, NoteLength as NoteLength7, RhythmProps as RhythmProps5, Scale as Scale2, ScaleType, SymbolSet as SymbolSet2, TimeSignature as TimeSignature2, TimeSignatures, TuningNameList, validateNoteLength as validateNoteLength2, validateTupletRatio } from "@tspro/web-music-score/theory";
7169
+ import { BeamGrouping, KeySignature as KeySignature3, Note as Note10, NoteLength as NoteLength8, RhythmProps as RhythmProps6, Scale as Scale2, ScaleType, SymbolSet as SymbolSet2, TimeSignature as TimeSignature2, TimeSignatures, TuningNameList, validateNoteLength as validateNoteLength3, validateTupletRatio } from "@tspro/web-music-score/theory";
6985
7170
  import { MusicError as MusicError17, MusicErrorType as MusicErrorType17 } from "@tspro/web-music-score/core";
6986
7171
  function assertArg(condition, argName, argValue) {
6987
7172
  if (!condition) {
@@ -6997,56 +7182,64 @@ function isNote(note) {
6997
7182
  }
6998
7183
  }
6999
7184
  function isVoiceId(value) {
7000
- return Utils13.Is.isNumber(value) && getVoiceIds().indexOf(value) >= 0;
7185
+ return Utils14.Is.isNumber(value) && getVoiceIds().indexOf(value) >= 0;
7001
7186
  }
7002
7187
  function isStringNumber(value) {
7003
- return Utils13.Is.isNumber(value) && getStringNumbers().indexOf(value) >= 0;
7188
+ return Utils14.Is.isNumber(value) && getStringNumbers().indexOf(value) >= 0;
7189
+ }
7190
+ function isVerseNumber(value) {
7191
+ return Utils14.Is.isNumber(value) && getVerseNumbers().indexOf(value) >= 0;
7004
7192
  }
7005
7193
  function assertStaffConfig(staffConfig) {
7006
- assertArg(Utils13.Is.isObject(staffConfig), "staffConfig", staffConfig);
7194
+ assertArg(Utils14.Is.isObject(staffConfig), "staffConfig", staffConfig);
7007
7195
  assertArg(staffConfig.type === "staff", "staffConfig.type", staffConfig.type);
7008
- assertArg(Utils13.Is.isEnumValue(staffConfig.clef, Clef), "staffConfig.clef", staffConfig.clef);
7009
- assertArg(Utils13.Is.isBooleanOrUndefined(staffConfig.isOctaveDown), "staffConfig.isOctaveDown", staffConfig.isOctaveDown);
7010
- assertArg(Utils13.Is.isUndefined(staffConfig.minNote) || isNote(staffConfig.minNote), "staffConfig.minNote", staffConfig.minNote);
7011
- assertArg(Utils13.Is.isUndefined(staffConfig.maxNote) || isNote(staffConfig.maxNote), "staffConfig.maxNote", staffConfig.maxNote);
7012
- assertArg(Utils13.Is.isUndefined(staffConfig.voiceIds) || Utils13.Is.isArray(staffConfig.voiceIds) && staffConfig.voiceIds.every((voiceId) => Utils13.Is.isNumber(voiceId)), "staffConfig.voiceIds", staffConfig.voiceIds);
7013
- assertArg(Utils13.Is.isBooleanOrUndefined(staffConfig.isGrand), "staffConfig.isGrand", staffConfig.isGrand);
7196
+ assertArg(Utils14.Is.isEnumValue(staffConfig.clef, Clef), "staffConfig.clef", staffConfig.clef);
7197
+ assertArg(Utils14.Is.isBooleanOrUndefined(staffConfig.isOctaveDown), "staffConfig.isOctaveDown", staffConfig.isOctaveDown);
7198
+ assertArg(Utils14.Is.isUndefined(staffConfig.minNote) || isNote(staffConfig.minNote), "staffConfig.minNote", staffConfig.minNote);
7199
+ assertArg(Utils14.Is.isUndefined(staffConfig.maxNote) || isNote(staffConfig.maxNote), "staffConfig.maxNote", staffConfig.maxNote);
7200
+ assertArg(Utils14.Is.isUndefined(staffConfig.voiceIds) || Utils14.Is.isArray(staffConfig.voiceIds) && staffConfig.voiceIds.every((voiceId) => Utils14.Is.isNumber(voiceId)), "staffConfig.voiceIds", staffConfig.voiceIds);
7201
+ assertArg(Utils14.Is.isBooleanOrUndefined(staffConfig.isGrand), "staffConfig.isGrand", staffConfig.isGrand);
7014
7202
  }
7015
7203
  function assertTabConfig(tabConfig) {
7016
- assertArg(Utils13.Is.isObject(tabConfig), "tabConfig", tabConfig);
7204
+ assertArg(Utils14.Is.isObject(tabConfig), "tabConfig", tabConfig);
7017
7205
  assertArg(tabConfig.type === "tab", "tabConfig.type", tabConfig.type);
7018
7206
  if (typeof tabConfig.tuning === "string") {
7019
7207
  assertArg(TuningNameList.includes(tabConfig.tuning), "tabConfig.tuning", tabConfig.tuning);
7020
- } else if (Utils13.Is.isArray(tabConfig.tuning)) {
7208
+ } else if (Utils14.Is.isArray(tabConfig.tuning)) {
7021
7209
  assertArg(tabConfig.tuning.length === getStringNumbers().length && tabConfig.tuning.every((s) => isNote(s)), "tabConfig.tuning", tabConfig.tuning);
7022
7210
  }
7023
- assertArg(Utils13.Is.isUndefined(tabConfig.voiceIds) || Utils13.Is.isArray(tabConfig.voiceIds) && tabConfig.voiceIds.every((voiceId) => Utils13.Is.isNumber(voiceId)), "tabConfig.voiceIds", tabConfig.voiceIds);
7211
+ assertArg(Utils14.Is.isUndefined(tabConfig.voiceIds) || Utils14.Is.isArray(tabConfig.voiceIds) && tabConfig.voiceIds.every((voiceId) => Utils14.Is.isNumber(voiceId)), "tabConfig.voiceIds", tabConfig.voiceIds);
7212
+ }
7213
+ function assertNoteOptions(noteOptions) {
7214
+ assertArg(Utils14.Is.isObject(noteOptions), "noteOptions", noteOptions);
7215
+ assertArg(Utils14.Is.isBooleanOrUndefined(noteOptions.dotted) || Utils14.Is.isIntegerGte(noteOptions.dotted, 0), "noteOptions.dotted", noteOptions.dotted);
7216
+ assertArg(Utils14.Is.isEnumValueOrUndefined(noteOptions.stem, Stem), "noteOptions.stem", noteOptions.stem);
7217
+ assertArg(Utils14.Is.isStringOrUndefined(noteOptions.color), "noteOptions.color", noteOptions.color);
7218
+ assertArg(Utils14.Is.isBooleanOrUndefined(noteOptions.arpeggio) || Utils14.Is.isEnumValue(noteOptions.arpeggio, Arpeggio), "noteOptions.arpeggio", noteOptions.arpeggio);
7219
+ assertArg(Utils14.Is.isBooleanOrUndefined(noteOptions.staccato), "noteOptions.staccato", noteOptions.staccato);
7220
+ assertArg(Utils14.Is.isBooleanOrUndefined(noteOptions.diamond), "noteOptions.diamond", noteOptions.diamond);
7221
+ assertArg(Utils14.Is.isBooleanOrUndefined(noteOptions.triplet), "noteOptions.triplet", noteOptions.triplet);
7222
+ assertArg(Utils14.Is.isUndefined(noteOptions.string) || isStringNumber(noteOptions.string) || Utils14.Is.isNonEmptyArray(noteOptions.string) && noteOptions.string.every((string) => isStringNumber(string)), "noteOptions.string", noteOptions.string);
7223
+ assertArg(Utils14.Is.isUndefined(noteOptions.tieSpan), 'NoteOptions.tieSpan was removed. Use addConnective("tie", tieSpan)', "");
7224
+ assertArg(Utils14.Is.isUndefined(noteOptions.slurSpan), 'NoteOptions.slurSpan was removed. Use addConnective("slur", slurSpan)', "");
7024
7225
  }
7025
- function assertNoteOptions(options) {
7026
- assertArg(Utils13.Is.isObject(options), "noteOptions", options);
7027
- assertArg(Utils13.Is.isBooleanOrUndefined(options.dotted) || Utils13.Is.isIntegerGte(options.dotted, 0), "noteOptions.dotted", options.dotted);
7028
- assertArg(Utils13.Is.isEnumValueOrUndefined(options.stem, Stem), "noteOptions.stem", options.stem);
7029
- assertArg(Utils13.Is.isStringOrUndefined(options.color), "noteOptions.color", options.color);
7030
- assertArg(Utils13.Is.isBooleanOrUndefined(options.arpeggio) || Utils13.Is.isEnumValue(options.arpeggio, Arpeggio), "noteOptions.arpeggio", options.arpeggio);
7031
- assertArg(Utils13.Is.isBooleanOrUndefined(options.staccato), "noteOptions.staccato", options.staccato);
7032
- assertArg(Utils13.Is.isBooleanOrUndefined(options.diamond), "noteOptions.diamond", options.diamond);
7033
- assertArg(Utils13.Is.isBooleanOrUndefined(options.triplet), "noteOptions.triplet", options.triplet);
7034
- assertArg(Utils13.Is.isUndefined(options.string) || isStringNumber(options.string) || Utils13.Is.isNonEmptyArray(options.string) && options.string.every((string) => isStringNumber(string)), "noteOptions.string", options.string);
7035
- assertArg(Utils13.Is.isUndefined(options.tieSpan), 'NoteOptions.tieSpan was removed. Use addConnective("tie", tieSpan)', "");
7036
- assertArg(Utils13.Is.isUndefined(options.slurSpan), 'NoteOptions.slurSpan was removed. Use addConnective("slur", slurSpan)', "");
7226
+ function assertRestOptions(restOptions) {
7227
+ assertArg(Utils14.Is.isObject(restOptions), "restOptions", restOptions);
7228
+ assertArg(Utils14.Is.isBooleanOrUndefined(restOptions.dotted) || Utils14.Is.isIntegerGte(restOptions.dotted, 0), "restOptions.dotted", restOptions.dotted);
7229
+ assertArg(Utils14.Is.isStringOrUndefined(restOptions.staffPos) || Utils14.Is.isInteger(restOptions.staffPos) || restOptions.staffPos instanceof Note10, "restOptions.staffPos", restOptions.staffPos);
7230
+ assertArg(Utils14.Is.isStringOrUndefined(restOptions.color), "restOptions.color", restOptions.color);
7231
+ assertArg(Utils14.Is.isBooleanOrUndefined(restOptions.hide), "restOptions.hide", restOptions.hide);
7232
+ assertArg(Utils14.Is.isBooleanOrUndefined(restOptions.triplet), "restOptions.triplet", restOptions.triplet);
7037
7233
  }
7038
- function assertRestOptions(options) {
7039
- assertArg(Utils13.Is.isObject(options), "restOptions", options);
7040
- assertArg(Utils13.Is.isBooleanOrUndefined(options.dotted) || Utils13.Is.isIntegerGte(options.dotted, 0), "restOptions.dotted", options.dotted);
7041
- assertArg(Utils13.Is.isStringOrUndefined(options.staffPos) || Utils13.Is.isInteger(options.staffPos) || options.staffPos instanceof Note10, "restOptions.staffPos", options.staffPos);
7042
- assertArg(Utils13.Is.isStringOrUndefined(options.color), "restOptions.color", options.color);
7043
- assertArg(Utils13.Is.isBooleanOrUndefined(options.hide), "restOptions.hide", options.hide);
7044
- assertArg(Utils13.Is.isBooleanOrUndefined(options.triplet), "restOptions.triplet", options.triplet);
7234
+ function assertLyricsOptions(lyricsOptions) {
7235
+ assertArg(Utils14.Is.isObject(lyricsOptions), "lyricsOptions", lyricsOptions);
7236
+ assertArg(Utils14.Is.isEnumValueOrUndefined(lyricsOptions.align, LyricsAlign), "lyricsOptions.align", lyricsOptions.align);
7237
+ assertArg(Utils14.Is.isEnumValueOrUndefined(lyricsOptions.hyphen, LyricsHyphen), "lyricsOptions.hyphen", lyricsOptions.hyphen);
7045
7238
  }
7046
7239
  function assertStaffTabOrGRoups(staffTabOrGroups) {
7047
7240
  assertArg(
7048
- Utils13.Is.isStringOrUndefined(staffTabOrGroups) || Utils13.Is.isIntegerGte(staffTabOrGroups, 0) || Utils13.Is.isNonEmptyArray(staffTabOrGroups) && staffTabOrGroups.every(
7049
- (staffTabOrGroup) => Utils13.Is.isString(staffTabOrGroup) || Utils13.Is.isIntegerGte(staffTabOrGroup, 0)
7241
+ Utils14.Is.isStringOrUndefined(staffTabOrGroups) || Utils14.Is.isIntegerGte(staffTabOrGroups, 0) || Utils14.Is.isNonEmptyArray(staffTabOrGroups) && staffTabOrGroups.every(
7242
+ (staffTabOrGroup) => Utils14.Is.isString(staffTabOrGroup) || Utils14.Is.isIntegerGte(staffTabOrGroup, 0)
7050
7243
  ),
7051
7244
  "staffTabOrGroup",
7052
7245
  staffTabOrGroups
@@ -7054,7 +7247,7 @@ function assertStaffTabOrGRoups(staffTabOrGroups) {
7054
7247
  }
7055
7248
  function isNoteLength(noteLen) {
7056
7249
  try {
7057
- validateNoteLength2(noteLen);
7250
+ validateNoteLength3(noteLen);
7058
7251
  return true;
7059
7252
  } catch (e) {
7060
7253
  return false;
@@ -7074,22 +7267,23 @@ var DocumentBuilder = class {
7074
7267
  */
7075
7268
  constructor() {
7076
7269
  __publicField(this, "doc");
7270
+ __publicField(this, "currentLyricsAlign", "center" /* Center */);
7077
7271
  this.doc = new ObjDocument();
7078
7272
  }
7079
7273
  setScoreConfiguration(config) {
7080
- if (Utils13.Is.isEnumValue(config, StaffPreset)) {
7274
+ if (Utils14.Is.isEnumValue(config, StaffPreset)) {
7081
7275
  this.doc.setScoreConfiguration(config);
7082
- } else if (Utils13.Is.isObject(config) && config.type === "staff") {
7276
+ } else if (Utils14.Is.isObject(config) && config.type === "staff") {
7083
7277
  assertStaffConfig(config);
7084
7278
  this.doc.setScoreConfiguration(config);
7085
- } else if (Utils13.Is.isObject(config) && config.type === "tab") {
7279
+ } else if (Utils14.Is.isObject(config) && config.type === "tab") {
7086
7280
  assertTabConfig(config);
7087
7281
  this.doc.setScoreConfiguration(config);
7088
- } else if (Utils13.Is.isNonEmptyArray(config)) {
7282
+ } else if (Utils14.Is.isNonEmptyArray(config)) {
7089
7283
  config.forEach((c) => {
7090
- if (Utils13.Is.isObject(c) && c.type === "staff") {
7284
+ if (Utils14.Is.isObject(c) && c.type === "staff") {
7091
7285
  assertStaffConfig(c);
7092
- } else if (Utils13.Is.isObject(c) && c.type === "tab") {
7286
+ } else if (Utils14.Is.isObject(c) && c.type === "tab") {
7093
7287
  assertTabConfig(c);
7094
7288
  } else {
7095
7289
  assertArg(false, "config", config);
@@ -7120,9 +7314,9 @@ var DocumentBuilder = class {
7120
7314
  * @returns - This document builder instance.
7121
7315
  */
7122
7316
  setHeader(title, composer, arranger) {
7123
- assertArg(Utils13.Is.isStringOrUndefined(title), "title", title);
7124
- assertArg(Utils13.Is.isStringOrUndefined(composer), "composer", composer);
7125
- assertArg(Utils13.Is.isStringOrUndefined(arranger), "arranger", arranger);
7317
+ assertArg(Utils14.Is.isStringOrUndefined(title), "title", title);
7318
+ assertArg(Utils14.Is.isStringOrUndefined(composer), "composer", composer);
7319
+ assertArg(Utils14.Is.isStringOrUndefined(arranger), "arranger", arranger);
7126
7320
  this.doc.setHeader(title, composer, arranger);
7127
7321
  return this;
7128
7322
  }
@@ -7132,7 +7326,7 @@ var DocumentBuilder = class {
7132
7326
  * @returns - This document builder instance.
7133
7327
  */
7134
7328
  setMeasuresPerRow(measuresPerRow) {
7135
- assertArg(Utils13.Is.isIntegerGte(measuresPerRow, 1) || Utils13.Is.isPosInfinity(measuresPerRow), "measuresPerRow", measuresPerRow);
7329
+ assertArg(Utils14.Is.isIntegerGte(measuresPerRow, 1) || Utils14.Is.isPosInfinity(measuresPerRow), "measuresPerRow", measuresPerRow);
7136
7330
  this.doc.setMeasuresPerRow(measuresPerRow);
7137
7331
  return this;
7138
7332
  }
@@ -7145,16 +7339,16 @@ var DocumentBuilder = class {
7145
7339
  return this;
7146
7340
  }
7147
7341
  setKeySignature(...args) {
7148
- assertArg(args[0] instanceof Scale2 || args[0] instanceof KeySignature3 || Utils13.Is.isNonEmptyString(args[0]) && (args.length === 1 || Utils13.Is.isEnumValue(args[1], ScaleType)), "keySignature", args);
7342
+ assertArg(args[0] instanceof Scale2 || args[0] instanceof KeySignature3 || Utils14.Is.isNonEmptyString(args[0]) && (args.length === 1 || Utils14.Is.isEnumValue(args[1], ScaleType)), "keySignature", args);
7149
7343
  this.getMeasure().setKeySignature(...args);
7150
7344
  return this;
7151
7345
  }
7152
7346
  setTimeSignature(...args) {
7153
7347
  if (args[0] instanceof TimeSignature2) {
7154
7348
  this.getMeasure().setTimeSignature(args[0]);
7155
- } else if (Utils13.Is.isEnumValue(args[0], TimeSignatures) && Utils13.Is.isEnumValueOrUndefined(args[1], BeamGrouping)) {
7349
+ } else if (Utils14.Is.isEnumValue(args[0], TimeSignatures) && Utils14.Is.isEnumValueOrUndefined(args[1], BeamGrouping)) {
7156
7350
  this.getMeasure().setTimeSignature(new TimeSignature2(args[0], args[1]));
7157
- } else if (Utils13.Is.isIntegerGte(args[0], 1) && Utils13.Is.isIntegerGte(args[1], 1) && Utils13.Is.isEnumValueOrUndefined(args[2], BeamGrouping)) {
7351
+ } else if (Utils14.Is.isIntegerGte(args[0], 1) && Utils14.Is.isIntegerGte(args[1], 1) && Utils14.Is.isEnumValueOrUndefined(args[2], BeamGrouping)) {
7158
7352
  this.getMeasure().setTimeSignature(new TimeSignature2(args[0], args[1], args[2]));
7159
7353
  } else {
7160
7354
  assertArg(false, "timeSignature args", args);
@@ -7162,65 +7356,71 @@ var DocumentBuilder = class {
7162
7356
  return this;
7163
7357
  }
7164
7358
  setTempo(beatsPerMinute, beatLength, dotted) {
7165
- assertArg(Utils13.Is.isIntegerGte(beatsPerMinute, 1), "beatsPerMinute", beatsPerMinute);
7359
+ assertArg(Utils14.Is.isIntegerGte(beatsPerMinute, 1), "beatsPerMinute", beatsPerMinute);
7166
7360
  if (beatLength === void 0) {
7167
- assertArg(Utils13.Is.isUndefined(dotted), "dotted", dotted);
7361
+ assertArg(Utils14.Is.isUndefined(dotted), "dotted", dotted);
7168
7362
  } else {
7169
- assertArg(Utils13.Is.isEnumValue(beatLength, NoteLength7) || isNoteLength(beatLength), "beatLength", beatLength);
7170
- assertArg(Utils13.Is.isBooleanOrUndefined(dotted) || Utils13.Is.isIntegerGte(dotted, 0), "dotted", dotted);
7363
+ assertArg(Utils14.Is.isEnumValue(beatLength, NoteLength8) || isNoteLength(beatLength), "beatLength", beatLength);
7364
+ assertArg(Utils14.Is.isBooleanOrUndefined(dotted) || Utils14.Is.isIntegerGte(dotted, 0), "dotted", dotted);
7171
7365
  }
7172
7366
  this.getMeasure().setTempo(beatsPerMinute, beatLength, dotted);
7173
7367
  return this;
7174
7368
  }
7175
7369
  /**
7176
- * Add note o current measure.
7370
+ * Add note to current measure.
7177
7371
  * @param voiceId - Voice id to add note to.
7178
- * @param note - Note instance of Note or string (e.g. "D4").
7372
+ * @param note - Instance of Note or string, single value (e.g. "C4") or array (e.g. ["C4", "E4", "G4"]).
7179
7373
  * @param noteLength - Note length (e.g. "4n").
7180
- * @param options - Note options.
7374
+ * @param noteOptions - Note options.
7181
7375
  * @returns - This document builder instance.
7182
7376
  */
7183
- addNote(voiceId, note, noteLength, options) {
7377
+ addNote(voiceId, note, noteLength, noteOptions) {
7184
7378
  assertArg(isVoiceId(voiceId), "voiceId", voiceId);
7185
- assertArg(note instanceof Note10 || Utils13.Is.isNonEmptyString(note), "note", note);
7186
- assertArg(Utils13.Is.isEnumValue(noteLength, NoteLength7) || isNoteLength(noteLength), "noteLength", noteLength);
7187
- if (options !== void 0) {
7188
- assertNoteOptions(options);
7379
+ assertArg(
7380
+ note instanceof Note10 || Utils14.Is.isNonEmptyString(note) || Utils14.Is.isArray(note) && note.every((note2) => note2 instanceof Note10 || Utils14.Is.isNonEmptyString(note2)),
7381
+ "note",
7382
+ note
7383
+ );
7384
+ assertArg(Utils14.Is.isEnumValue(noteLength, NoteLength8) || isNoteLength(noteLength), "noteLength", noteLength);
7385
+ noteOptions != null ? noteOptions : noteOptions = {};
7386
+ assertNoteOptions(noteOptions);
7387
+ if (Utils14.Is.isArray(note)) {
7388
+ note.forEach((note2) => this.getMeasure().addNoteGroup(voiceId, [note2], noteLength, noteOptions));
7389
+ } else {
7390
+ this.getMeasure().addNoteGroup(voiceId, [note], noteLength, noteOptions);
7189
7391
  }
7190
- this.getMeasure().addNoteGroup(voiceId, [note], noteLength, options);
7191
7392
  return this;
7192
7393
  }
7193
7394
  /**
7395
+ * Add chord to current measure.
7194
7396
  * @param voiceId - Voice id to add chord to.
7195
7397
  * @param notes - Array of notes, each instance of Note or string (e.g. "D4").
7196
7398
  * @param noteLength - Note length (e.g. "4n").
7197
- * @param options - Note options.
7399
+ * @param noteOptions - Note options.
7198
7400
  * @returns - This document builder instance.
7199
7401
  */
7200
- addChord(voiceId, notes, noteLength, options) {
7402
+ addChord(voiceId, notes, noteLength, noteOptions) {
7201
7403
  assertArg(isVoiceId(voiceId), "voiceId", voiceId);
7202
- assertArg(Utils13.Is.isNonEmptyArray(notes) && notes.every((note) => note instanceof Note10 || Utils13.Is.isNonEmptyString(note)), "notes", notes);
7203
- assertArg(Utils13.Is.isEnumValue(noteLength, NoteLength7) || isNoteLength(noteLength), "noteLength", noteLength);
7204
- if (options !== void 0) {
7205
- assertNoteOptions(options);
7206
- }
7207
- this.getMeasure().addNoteGroup(voiceId, notes, noteLength, options);
7404
+ assertArg(Utils14.Is.isNonEmptyArray(notes) && notes.every((note) => note instanceof Note10 || Utils14.Is.isNonEmptyString(note)), "notes", notes);
7405
+ assertArg(Utils14.Is.isEnumValue(noteLength, NoteLength8) || isNoteLength(noteLength), "noteLength", noteLength);
7406
+ noteOptions != null ? noteOptions : noteOptions = {};
7407
+ assertNoteOptions(noteOptions);
7408
+ this.getMeasure().addNoteGroup(voiceId, notes, noteLength, noteOptions);
7208
7409
  return this;
7209
7410
  }
7210
7411
  /**
7211
- *
7412
+ * Add rest to current measure.
7212
7413
  * @param voiceId - Voice id to add rest to.
7213
7414
  * @param restLength - Rest length (e.g. "4n").
7214
- * @param options - Rest options.
7415
+ * @param restOptions - Rest options.
7215
7416
  * @returns - This document builder instance.
7216
7417
  */
7217
- addRest(voiceId, restLength, options) {
7418
+ addRest(voiceId, restLength, restOptions) {
7218
7419
  assertArg(isVoiceId(voiceId), "voiceId", voiceId);
7219
- assertArg(Utils13.Is.isEnumValue(restLength, NoteLength7) || isNoteLength(restLength), "restLength", restLength);
7220
- if (options !== void 0) {
7221
- assertRestOptions(options);
7222
- }
7223
- this.getMeasure().addRest(voiceId, restLength, options);
7420
+ assertArg(Utils14.Is.isEnumValue(restLength, NoteLength8) || isNoteLength(restLength), "restLength", restLength);
7421
+ restOptions != null ? restOptions : restOptions = {};
7422
+ assertRestOptions(restOptions);
7423
+ this.getMeasure().addRest(voiceId, restLength, restOptions);
7224
7424
  return this;
7225
7425
  }
7226
7426
  /**
@@ -7240,39 +7440,47 @@ var DocumentBuilder = class {
7240
7440
  */
7241
7441
  addTuplet(voiceId, tupletRatio, tupletBuilder) {
7242
7442
  assertArg(isVoiceId(voiceId), "voiceId", voiceId);
7243
- assertArg(Utils13.Is.isFunction(tupletBuilder), "tupletBuilder", tupletBuilder);
7244
- assertArg(isTupletRatio(tupletRatio) && Utils13.Is.isBooleanOrUndefined(tupletRatio.showRatio), "tupletRatio", tupletRatio);
7443
+ assertArg(Utils14.Is.isFunction(tupletBuilder), "tupletBuilder", tupletBuilder);
7444
+ assertArg(isTupletRatio(tupletRatio) && Utils14.Is.isBooleanOrUndefined(tupletRatio.showRatio), "tupletRatio", tupletRatio);
7245
7445
  let tupletSymbols = [];
7246
7446
  const helper = {
7247
- addNote: (note, noteLength, options) => {
7248
- assertArg(note instanceof Note10 || Utils13.Is.isNonEmptyString(note), "note", note);
7249
- assertArg(Utils13.Is.isEnumValue(noteLength, NoteLength7) || isNoteLength(noteLength), "noteLength", noteLength);
7250
- if (options !== void 0) {
7251
- delete options.triplet;
7252
- assertNoteOptions(options);
7447
+ addNote: (note, noteLength, noteOptions) => {
7448
+ assertArg(
7449
+ note instanceof Note10 || Utils14.Is.isNonEmptyString(note) || Utils14.Is.isArray(note) && note.every((note2) => note2 instanceof Note10 || Utils14.Is.isNonEmptyString(note2)),
7450
+ "note",
7451
+ note
7452
+ );
7453
+ assertArg(Utils14.Is.isEnumValue(noteLength, NoteLength8) || isNoteLength(noteLength), "noteLength", noteLength);
7454
+ noteOptions != null ? noteOptions : noteOptions = {};
7455
+ delete noteOptions.triplet;
7456
+ assertNoteOptions(noteOptions);
7457
+ if (Utils14.Is.isArray(note)) {
7458
+ note.forEach((note2) => {
7459
+ let s = this.getMeasure().addNoteGroup(voiceId, [note2], noteLength, noteOptions, tupletRatio);
7460
+ tupletSymbols.push(s);
7461
+ });
7462
+ } else {
7463
+ let s = this.getMeasure().addNoteGroup(voiceId, [note], noteLength, noteOptions, tupletRatio);
7464
+ tupletSymbols.push(s);
7253
7465
  }
7254
- let s = this.getMeasure().addNoteGroup(voiceId, [note], noteLength, options, tupletRatio);
7255
- tupletSymbols.push(s);
7256
7466
  return helper;
7257
7467
  },
7258
- addChord: (notes, noteLength, options) => {
7259
- assertArg(Utils13.Is.isNonEmptyArray(notes) && notes.every((note) => note instanceof Note10 || Utils13.Is.isNonEmptyString(note)), "notes", notes);
7260
- assertArg(Utils13.Is.isEnumValue(noteLength, NoteLength7) || isNoteLength(noteLength), "noteLength", noteLength);
7261
- if (options !== void 0) {
7262
- delete options.triplet;
7263
- assertNoteOptions(options);
7264
- }
7265
- let s = this.getMeasure().addNoteGroup(voiceId, notes, noteLength, options, tupletRatio);
7468
+ addChord: (notes, noteLength, noteOptions) => {
7469
+ assertArg(Utils14.Is.isNonEmptyArray(notes) && notes.every((note) => note instanceof Note10 || Utils14.Is.isNonEmptyString(note)), "notes", notes);
7470
+ assertArg(Utils14.Is.isEnumValue(noteLength, NoteLength8) || isNoteLength(noteLength), "noteLength", noteLength);
7471
+ noteOptions != null ? noteOptions : noteOptions = {};
7472
+ delete noteOptions.triplet;
7473
+ assertNoteOptions(noteOptions);
7474
+ let s = this.getMeasure().addNoteGroup(voiceId, notes, noteLength, noteOptions, tupletRatio);
7266
7475
  tupletSymbols.push(s);
7267
7476
  return helper;
7268
7477
  },
7269
- addRest: (restLength, options) => {
7270
- assertArg(Utils13.Is.isEnumValue(restLength, NoteLength7) || isNoteLength(restLength), "restLength", restLength);
7271
- if (options !== void 0) {
7272
- delete options.triplet;
7273
- assertRestOptions(options);
7274
- }
7275
- let s = this.getMeasure().addRest(voiceId, restLength, options, tupletRatio);
7478
+ addRest: (restLength, restOptions) => {
7479
+ assertArg(Utils14.Is.isEnumValue(restLength, NoteLength8) || isNoteLength(restLength), "restLength", restLength);
7480
+ restOptions != null ? restOptions : restOptions = {};
7481
+ delete restOptions.triplet;
7482
+ assertRestOptions(restOptions);
7483
+ let s = this.getMeasure().addRest(voiceId, restLength, restOptions, tupletRatio);
7276
7484
  tupletSymbols.push(s);
7277
7485
  return helper;
7278
7486
  }
@@ -7281,9 +7489,52 @@ var DocumentBuilder = class {
7281
7489
  ObjBeamGroup.createTuplet(tupletSymbols, tupletRatio);
7282
7490
  return this;
7283
7491
  }
7492
+ addLyricsInternal(staffTabOrGroups, verse, lyricsLength, lyricsText, lyricsOptions) {
7493
+ var _a;
7494
+ assertStaffTabOrGRoups(staffTabOrGroups);
7495
+ assertArg(isVerseNumber(verse), "verse", verse);
7496
+ assertArg(Utils14.Is.isEnumValue(lyricsLength, NoteLength8), "lyricsLength", lyricsLength);
7497
+ assertArg(Utils14.Is.isString(lyricsText) || Utils14.Is.isArray(lyricsText) && lyricsText.every((text) => Utils14.Is.isString(text)), "lyricsText", lyricsText);
7498
+ lyricsOptions != null ? lyricsOptions : lyricsOptions = {};
7499
+ assertLyricsOptions(lyricsOptions);
7500
+ if (lyricsOptions.align !== void 0) {
7501
+ this.currentLyricsAlign = lyricsOptions.align;
7502
+ } else {
7503
+ (_a = lyricsOptions.align) != null ? _a : lyricsOptions.align = this.currentLyricsAlign;
7504
+ }
7505
+ if (Utils14.Is.isArray(lyricsText)) {
7506
+ lyricsText.forEach((text) => this.getMeasure().addLyrics(staffTabOrGroups, verse, lyricsLength, text, lyricsOptions));
7507
+ } else {
7508
+ this.getMeasure().addLyrics(staffTabOrGroups, verse, lyricsLength, lyricsText, lyricsOptions);
7509
+ }
7510
+ return this;
7511
+ }
7512
+ /**
7513
+ * Add lyrics to current measure.
7514
+ * @param verse - Verse number (e.g. 1).
7515
+ * @param lyricsLength - Lyrics text length (e.g. "2n").
7516
+ * @param lyricsText - Lyrics text (empty space if omitted), single value or array.
7517
+ * @param lyricsOptions - Lyrics options.
7518
+ * @returns - This document builder instance.
7519
+ */
7520
+ addLyrics(verse, lyricsLength, lyricsText, lyricsOptions) {
7521
+ return this.addLyricsInternal(void 0, verse, lyricsLength, lyricsText != null ? lyricsText : "", lyricsOptions);
7522
+ }
7523
+ /**
7524
+ * Add lyrics to current measure to given staff/tab/group.
7525
+ * @param staffTabOrGroups - staff/tab index (0=top), staff/tab name, or staff group name.
7526
+ * @param verse - Verse number (e.g. 1).
7527
+ * @param lyricsLength - Lyrics text length (e.g. "2n").
7528
+ * @param lyricsText - Lyrics text (empty space if omitted), single value or array.
7529
+ * @param lyricsOptions - Lyrics options.
7530
+ * @returns - This document builder instance.
7531
+ */
7532
+ addLyricsTo(staffTabOrGroups, verse, lyricsLength, lyricsText, lyricsOptions) {
7533
+ return this.addLyricsInternal(staffTabOrGroups, verse, lyricsLength, lyricsText != null ? lyricsText : "", lyricsOptions);
7534
+ }
7284
7535
  addFermataInternal(staffTabOrGroups, fermata) {
7285
7536
  assertStaffTabOrGRoups(staffTabOrGroups);
7286
- assertArg(Utils13.Is.isEnumValue(fermata, Fermata), "fermata", fermata);
7537
+ assertArg(Utils14.Is.isEnumValue(fermata, Fermata), "fermata", fermata);
7287
7538
  this.getMeasure().addFermata(staffTabOrGroups, fermata);
7288
7539
  return this;
7289
7540
  }
@@ -7306,11 +7557,11 @@ var DocumentBuilder = class {
7306
7557
  }
7307
7558
  addNavigationInternal(staffTabOrGroups, navigation, ...args) {
7308
7559
  assertStaffTabOrGRoups(staffTabOrGroups);
7309
- assertArg(Utils13.Is.isEnumValue(navigation, Navigation), "navigation", navigation);
7560
+ assertArg(Utils14.Is.isEnumValue(navigation, Navigation), "navigation", navigation);
7310
7561
  if (navigation === "endRepeat" /* EndRepeat */ && args.length > 0) {
7311
- assertArg(Utils13.Is.isIntegerGte(args[0], 1), "playCount", args[0]);
7562
+ assertArg(Utils14.Is.isIntegerGte(args[0], 1), "playCount", args[0]);
7312
7563
  } else if (navigation === "ending" /* Ending */ && args.length > 0) {
7313
- assertArg(args.every((passage) => Utils13.Is.isIntegerGte(passage, 1)), "passages", args);
7564
+ assertArg(args.every((passage) => Utils14.Is.isIntegerGte(passage, 1)), "passages", args);
7314
7565
  }
7315
7566
  this.getMeasure().addNavigation(staffTabOrGroups, navigation, ...args);
7316
7567
  return this;
@@ -7327,8 +7578,8 @@ var DocumentBuilder = class {
7327
7578
  throw new MusicError17(MusicErrorType17.Score, `Annotation text "${text}" is not known annotation.`);
7328
7579
  }
7329
7580
  assertStaffTabOrGRoups(staffTabOrGroups);
7330
- assertArg(Utils13.Is.isEnumValue(annotation, Annotation), "annotation", annotation);
7331
- assertArg(Utils13.Is.isNonEmptyString(text), "text", text);
7581
+ assertArg(Utils14.Is.isEnumValue(annotation, Annotation), "annotation", annotation);
7582
+ assertArg(Utils14.Is.isNonEmptyString(text), "text", text);
7332
7583
  this.getMeasure().addAnnotation(staffTabOrGroups, annotation, text);
7333
7584
  return this;
7334
7585
  }
@@ -7348,8 +7599,8 @@ var DocumentBuilder = class {
7348
7599
  }
7349
7600
  addLabelInternal(staffTabOrGroups, label, text) {
7350
7601
  assertStaffTabOrGRoups(staffTabOrGroups);
7351
- assertArg(Utils13.Is.isEnumValue(label, Label), "label", label);
7352
- assertArg(Utils13.Is.isNonEmptyString(text), "text", text);
7602
+ assertArg(Utils14.Is.isEnumValue(label, Label), "label", label);
7603
+ assertArg(Utils14.Is.isNonEmptyString(text), "text", text);
7353
7604
  this.getMeasure().addLabel(staffTabOrGroups, label, text);
7354
7605
  return this;
7355
7606
  }
@@ -7373,21 +7624,21 @@ var DocumentBuilder = class {
7373
7624
  return this.addLabelInternal(staffTabOrGroups, label, text);
7374
7625
  }
7375
7626
  addConnective(connective, ...args) {
7376
- assertArg(Utils13.Is.isEnumValue(connective, Connective), "connective", connective);
7627
+ assertArg(Utils14.Is.isEnumValue(connective, Connective), "connective", connective);
7377
7628
  if (connective === "tie" /* Tie */) {
7378
- assertArg(Utils13.Is.isIntegerOrUndefined(args[0]) || Utils13.Is.isEnumValue(args[0], TieType), "tieSpan", args[0]);
7379
- assertArg(Utils13.Is.isEnumValueOrUndefined(args[1], NoteAnchor), "noteAnchor", args[1]);
7629
+ assertArg(Utils14.Is.isIntegerOrUndefined(args[0]) || Utils14.Is.isEnumValue(args[0], TieType), "tieSpan", args[0]);
7630
+ assertArg(Utils14.Is.isEnumValueOrUndefined(args[1], NoteAnchor), "noteAnchor", args[1]);
7380
7631
  let tieSpan = args[0];
7381
7632
  let noteAnchor = args[1];
7382
7633
  this.getMeasure().addConnective(connective, tieSpan, noteAnchor);
7383
7634
  } else if (connective === "slur" /* Slur */) {
7384
- assertArg(Utils13.Is.isIntegerOrUndefined(args[0]), "slurSpan", args[0]);
7385
- assertArg(Utils13.Is.isEnumValueOrUndefined(args[1], NoteAnchor), "noteAnchor", args[1]);
7635
+ assertArg(Utils14.Is.isIntegerOrUndefined(args[0]), "slurSpan", args[0]);
7636
+ assertArg(Utils14.Is.isEnumValueOrUndefined(args[1], NoteAnchor), "noteAnchor", args[1]);
7386
7637
  let slurSpan = args[0];
7387
7638
  let noteAnchor = args[1];
7388
7639
  this.getMeasure().addConnective(connective, slurSpan, noteAnchor);
7389
7640
  } else if (connective === "slide" /* Slide */) {
7390
- assertArg(Utils13.Is.isEnumValueOrUndefined(args[0], NoteAnchor), "noteAnchor", args[0]);
7641
+ assertArg(Utils14.Is.isEnumValueOrUndefined(args[0], NoteAnchor), "noteAnchor", args[0]);
7391
7642
  let noteAnchor = args[0];
7392
7643
  this.getMeasure().addConnective(connective, noteAnchor);
7393
7644
  }
@@ -7406,18 +7657,18 @@ var DocumentBuilder = class {
7406
7657
  * @returns - This document builder instance.
7407
7658
  */
7408
7659
  addExtension(extensionBuilder) {
7409
- assertArg(Utils13.Is.isFunctionOrUndefined(extensionBuilder), "addExtension() has new usage, for e.g. addExtension(ext => ext.measures(2)). Please refer to README or API Reference.", extensionBuilder);
7660
+ assertArg(Utils14.Is.isFunctionOrUndefined(extensionBuilder), "addExtension() has new usage, for e.g. addExtension(ext => ext.measures(2)). Please refer to README or API Reference.", extensionBuilder);
7410
7661
  let ticks = 0;
7411
7662
  let visible = true;
7412
7663
  const helper = {
7413
7664
  notes: (noteLength, noteCount) => {
7414
- assertArg(Utils13.Is.isEnumValue(noteLength, NoteLength7) || isNoteLength(noteLength), "noteLength", noteLength);
7415
- assertArg(Utils13.Is.isUndefined(noteCount) || Utils13.Is.isNumber(noteCount) && noteCount >= 0, "noteCount", noteCount);
7416
- ticks += RhythmProps5.get(noteLength).ticks * (noteCount != null ? noteCount : 1);
7665
+ assertArg(Utils14.Is.isEnumValue(noteLength, NoteLength8) || isNoteLength(noteLength), "noteLength", noteLength);
7666
+ assertArg(Utils14.Is.isUndefined(noteCount) || Utils14.Is.isNumber(noteCount) && noteCount >= 0, "noteCount", noteCount);
7667
+ ticks += RhythmProps6.get(noteLength).ticks * (noteCount != null ? noteCount : 1);
7417
7668
  return helper;
7418
7669
  },
7419
7670
  measures: (measureCount) => {
7420
- assertArg(Utils13.Is.isNumber(measureCount) && measureCount >= 1, "measureCount", measureCount);
7671
+ assertArg(Utils14.Is.isNumber(measureCount) && measureCount >= 1, "measureCount", measureCount);
7421
7672
  ticks += this.getMeasure().getMeasureTicks() * measureCount;
7422
7673
  return helper;
7423
7674
  },
@@ -7446,13 +7697,13 @@ var DocumentBuilder = class {
7446
7697
  * @returns - This document builder instance.
7447
7698
  */
7448
7699
  addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition = "auto" /* Auto */) {
7449
- assertArg(Utils13.Is.isNonEmptyString(groupName), "groupName", groupName);
7700
+ assertArg(Utils14.Is.isNonEmptyString(groupName), "groupName", groupName);
7450
7701
  assertArg(
7451
- Utils13.Is.isNonEmptyString(staffsTabsAndGroups) || Utils13.Is.isIntegerGte(staffsTabsAndGroups, 0) || Utils13.Is.isNonEmptyArray(staffsTabsAndGroups) && staffsTabsAndGroups.every((line) => Utils13.Is.isNonEmptyString(line) || Utils13.Is.isIntegerGte(line, 0)),
7702
+ Utils14.Is.isNonEmptyString(staffsTabsAndGroups) || Utils14.Is.isIntegerGte(staffsTabsAndGroups, 0) || Utils14.Is.isNonEmptyArray(staffsTabsAndGroups) && staffsTabsAndGroups.every((line) => Utils14.Is.isNonEmptyString(line) || Utils14.Is.isIntegerGte(line, 0)),
7452
7703
  "staffsTabsAndGroups",
7453
7704
  staffsTabsAndGroups
7454
7705
  );
7455
- assertArg(Utils13.Is.isEnumValue(verticalPosition, VerticalPosition), "verticalPosition", verticalPosition);
7706
+ assertArg(Utils14.Is.isEnumValue(verticalPosition, VerticalPosition), "verticalPosition", verticalPosition);
7456
7707
  this.doc.addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition);
7457
7708
  return this;
7458
7709
  }
@@ -7487,7 +7738,7 @@ var DocumentBuilder = class {
7487
7738
  * @returns - This document builder instance.
7488
7739
  */
7489
7740
  completeRests(voiceId) {
7490
- assertArg(Utils13.Is.isUndefined(voiceId) || isVoiceId(voiceId) || Utils13.Is.isArray(voiceId) && voiceId.every((id) => isVoiceId(id)), "voiceId", voiceId);
7741
+ assertArg(Utils14.Is.isUndefined(voiceId) || isVoiceId(voiceId) || Utils14.Is.isArray(voiceId) && voiceId.every((id) => isVoiceId(id)), "voiceId", voiceId);
7491
7742
  this.getMeasure().completeRests(voiceId);
7492
7743
  return this;
7493
7744
  }
@@ -7499,8 +7750,8 @@ var DocumentBuilder = class {
7499
7750
  * @returns - This document builder instance.
7500
7751
  */
7501
7752
  addScaleArpeggio(scale, bottomNote, numOctaves) {
7502
- assertArg(Utils13.Is.isNonEmptyString(bottomNote), "bottomNote", bottomNote);
7503
- assertArg(Utils13.Is.isIntegerGte(numOctaves, 1), "numOctaves", numOctaves);
7753
+ assertArg(Utils14.Is.isNonEmptyString(bottomNote), "bottomNote", bottomNote);
7754
+ assertArg(Utils14.Is.isIntegerGte(numOctaves, 1), "numOctaves", numOctaves);
7504
7755
  let ts = this.getMeasure().getTimeSignature();
7505
7756
  let notes = scale.getScaleNotes(bottomNote, numOctaves);
7506
7757
  for (let i = 0; i < notes.length; i++) {
@@ -7572,10 +7823,10 @@ var ScoreObjectEvent = class extends ScoreEvent {
7572
7823
 
7573
7824
  // src/score/pub/music-interface.ts
7574
7825
  import * as Audio2 from "@tspro/web-music-score/audio";
7575
- import { Utils as Utils15 } from "@tspro/ts-utils-lib";
7826
+ import { Utils as Utils16 } from "@tspro/ts-utils-lib";
7576
7827
 
7577
7828
  // src/score/pub/music-objects.ts
7578
- import { Utils as Utils14 } from "@tspro/ts-utils-lib";
7829
+ import { Utils as Utils15 } from "@tspro/ts-utils-lib";
7579
7830
  import { MusicError as MusicError19, MusicErrorType as MusicErrorType19 } from "@tspro/web-music-score/core";
7580
7831
  function assertArg2(condition, argName, argValue) {
7581
7832
  if (!condition) {
@@ -7583,7 +7834,7 @@ function assertArg2(condition, argName, argValue) {
7583
7834
  }
7584
7835
  }
7585
7836
  function isVoiceId2(value) {
7586
- return Utils14.Is.isNumber(value) && getVoiceIds().indexOf(value) >= 0;
7837
+ return Utils15.Is.isNumber(value) && getVoiceIds().indexOf(value) >= 0;
7587
7838
  }
7588
7839
  function getNotationLine(line) {
7589
7840
  if (line instanceof ObjStaff || line instanceof ObjTab) {
@@ -7759,7 +8010,7 @@ var _MDocument = class _MDocument extends MusicInterface6 {
7759
8010
  * @returns - Player instance.
7760
8011
  */
7761
8012
  play(playStateChangeListener) {
7762
- assertArg2(Utils14.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
8013
+ assertArg2(Utils15.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
7763
8014
  return new MPlayer(this, playStateChangeListener).play();
7764
8015
  }
7765
8016
  };
@@ -7789,7 +8040,7 @@ var _MEnding = class _MEnding extends MusicInterface6 {
7789
8040
  * @returns - Boolean whether this ending has asked passage number.
7790
8041
  */
7791
8042
  hasPassage(passage) {
7792
- assertArg2(Utils14.Is.isIntegerGte(passage, 1), "passage", passage);
8043
+ assertArg2(Utils15.Is.isIntegerGte(passage, 1), "passage", passage);
7793
8044
  return this.obj.hasPassage(passage);
7794
8045
  }
7795
8046
  };
@@ -8368,6 +8619,27 @@ var _MText = class _MText extends MusicInterface6 {
8368
8619
  /** Object name. */
8369
8620
  __publicField(_MText, "Name", "Text");
8370
8621
  var MText = _MText;
8622
+ var _MLyrics = class _MLyrics extends MusicInterface6 {
8623
+ /** @internal */
8624
+ constructor(obj) {
8625
+ super(_MLyrics.Name);
8626
+ this.obj = obj;
8627
+ }
8628
+ /** @internal */
8629
+ getMusicObject() {
8630
+ return this.obj;
8631
+ }
8632
+ /**
8633
+ * Get lyrics text.
8634
+ * @returns - Lyrics text.
8635
+ */
8636
+ getText() {
8637
+ return this.obj.getText();
8638
+ }
8639
+ };
8640
+ /** Object name. */
8641
+ __publicField(_MLyrics, "Name", "Lyrics");
8642
+ var MLyrics = _MLyrics;
8371
8643
  var _MExtensionLine = class _MExtensionLine extends MusicInterface6 {
8372
8644
  /** @internal */
8373
8645
  constructor(obj) {
@@ -8406,7 +8678,7 @@ var _MPlayer = class _MPlayer {
8406
8678
  constructor(doc, playStateChangeListener) {
8407
8679
  __publicField(this, "player");
8408
8680
  assertArg3(doc instanceof MDocument2, "doc", doc);
8409
- assertArg3(Utils15.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
8681
+ assertArg3(Utils16.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
8410
8682
  this.player = new Player();
8411
8683
  this.player.setDocument(doc.getMusicObject());
8412
8684
  this.player.setCursorPositionChangeListener((cursorRect) => doc.getMusicObject().updateCursorRect(cursorRect));
@@ -8464,7 +8736,7 @@ var MRenderer2 = class {
8464
8736
  * @returns - This renderer instance.
8465
8737
  */
8466
8738
  setDocument(doc) {
8467
- assertArg3(Utils15.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
8739
+ assertArg3(Utils16.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
8468
8740
  this.renderer.setDocument(doc);
8469
8741
  return this;
8470
8742
  }
@@ -8474,7 +8746,7 @@ var MRenderer2 = class {
8474
8746
  * @returns - This renderer instance.
8475
8747
  */
8476
8748
  setCanvas(canvas) {
8477
- canvas = require_t(Utils15.Dom.getCanvas(canvas), typeof canvas === "string" ? "Cannot set renderer canvas because invalid canvas id: " + canvas : "Cannot set renderer canvas because given canvas is undefined.");
8749
+ canvas = require_t(Utils16.Dom.getCanvas(canvas), typeof canvas === "string" ? "Cannot set renderer canvas because invalid canvas id: " + canvas : "Cannot set renderer canvas because given canvas is undefined.");
8478
8750
  this.renderer.setCanvas(canvas);
8479
8751
  return this;
8480
8752
  }
@@ -8483,7 +8755,7 @@ var MRenderer2 = class {
8483
8755
  * @param scoreEventListener - Score event listener.
8484
8756
  */
8485
8757
  setScoreEventListener(scoreEventListener) {
8486
- assertArg3(Utils15.Is.isFunctionOrUndefined(scoreEventListener), "scoreEventListener", scoreEventListener);
8758
+ assertArg3(Utils16.Is.isFunctionOrUndefined(scoreEventListener), "scoreEventListener", scoreEventListener);
8487
8759
  this.renderer.setScoreEventListener(scoreEventListener);
8488
8760
  }
8489
8761
  /**
@@ -8557,7 +8829,7 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8557
8829
  * @returns
8558
8830
  */
8559
8831
  setDocument(doc) {
8560
- assertArg3(Utils15.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
8832
+ assertArg3(Utils16.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
8561
8833
  this.onStop();
8562
8834
  if (doc) {
8563
8835
  this.player = new MPlayer(doc, (playState) => {
@@ -8601,9 +8873,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8601
8873
  * @returns - This playback buttons class instance.
8602
8874
  */
8603
8875
  setPlayButton(btn, btnLabel) {
8604
- assertArg3(Utils15.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8876
+ assertArg3(Utils16.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8605
8877
  _MPlaybackButtons.removeOnClickListeners(this.playButton, this.onPlay);
8606
- this.playButton = require_t(Utils15.Dom.getButton(btn), "Play button required!");
8878
+ this.playButton = require_t(Utils16.Dom.getButton(btn), "Play button required!");
8607
8879
  this.playLabel = btnLabel != null ? btnLabel : "Play";
8608
8880
  _MPlaybackButtons.removeOnClickListeners(this.playButton, "all");
8609
8881
  _MPlaybackButtons.addOnClickListener(this.playButton, this.onPlay);
@@ -8617,9 +8889,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8617
8889
  * @returns - This playback buttons class instance.
8618
8890
  */
8619
8891
  setStopButton(btn, btnLabel) {
8620
- assertArg3(Utils15.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8892
+ assertArg3(Utils16.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8621
8893
  _MPlaybackButtons.removeOnClickListeners(this.stopButton, this.onStop);
8622
- this.stopButton = require_t(Utils15.Dom.getButton(btn), "Stop button required!");
8894
+ this.stopButton = require_t(Utils16.Dom.getButton(btn), "Stop button required!");
8623
8895
  this.stopLabel = btnLabel != null ? btnLabel : "Stop";
8624
8896
  _MPlaybackButtons.removeOnClickListeners(this.stopButton, "all");
8625
8897
  _MPlaybackButtons.addOnClickListener(this.stopButton, this.onStop);
@@ -8634,10 +8906,10 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8634
8906
  * @returns - This playback buttons class instance.
8635
8907
  */
8636
8908
  setPlayStopButton(btn, playLabel, stopLabel) {
8637
- assertArg3(Utils15.Is.isStringOrUndefined(playLabel), "playLabel", playLabel);
8638
- assertArg3(Utils15.Is.isStringOrUndefined(stopLabel), "stopLabel", stopLabel);
8909
+ assertArg3(Utils16.Is.isStringOrUndefined(playLabel), "playLabel", playLabel);
8910
+ assertArg3(Utils16.Is.isStringOrUndefined(stopLabel), "stopLabel", stopLabel);
8639
8911
  _MPlaybackButtons.removeOnClickListeners(this.playStopButton, this.onPlayStop);
8640
- this.playStopButton = require_t(Utils15.Dom.getButton(btn), "Play/stop button required!");
8912
+ this.playStopButton = require_t(Utils16.Dom.getButton(btn), "Play/stop button required!");
8641
8913
  this.playLabel = playLabel != null ? playLabel : "Play";
8642
8914
  this.stopLabel = stopLabel != null ? stopLabel : "Stop";
8643
8915
  _MPlaybackButtons.removeOnClickListeners(this.playStopButton, "all");
@@ -8652,9 +8924,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8652
8924
  * @returns - This playback buttons class instance.
8653
8925
  */
8654
8926
  setPauseButton(btn, btnLabel) {
8655
- assertArg3(Utils15.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8927
+ assertArg3(Utils16.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8656
8928
  _MPlaybackButtons.removeOnClickListeners(this.pauseButton, this.onPause);
8657
- this.pauseButton = require_t(Utils15.Dom.getButton(btn), "Pause button required!");
8929
+ this.pauseButton = require_t(Utils16.Dom.getButton(btn), "Pause button required!");
8658
8930
  this.pauseLabel = btnLabel != null ? btnLabel : "Pause";
8659
8931
  _MPlaybackButtons.removeOnClickListeners(this.pauseButton, "all");
8660
8932
  _MPlaybackButtons.addOnClickListener(this.pauseButton, this.onPause);
@@ -8676,7 +8948,7 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8676
8948
  }
8677
8949
  }
8678
8950
  static addOnClickListener(btn, onClick) {
8679
- assertArg3(Utils15.Is.isFunction(onClick), "onClick", onClick);
8951
+ assertArg3(Utils16.Is.isFunction(onClick), "onClick", onClick);
8680
8952
  btn.addEventListener("click", onClick);
8681
8953
  let clickListeners = this.savedOnClickListeners.get(btn) || [];
8682
8954
  this.savedOnClickListeners.set(btn, [...clickListeners, onClick]);
@@ -8698,6 +8970,8 @@ export {
8698
8970
  DynamicsAnnotation,
8699
8971
  Fermata,
8700
8972
  Label,
8973
+ LyricsAlign,
8974
+ LyricsHyphen,
8701
8975
  MAccidental,
8702
8976
  MArpeggio,
8703
8977
  MBarLineLeft,
@@ -8710,6 +8984,7 @@ export {
8710
8984
  MFermata,
8711
8985
  MHeader,
8712
8986
  MImage,
8987
+ MLyrics,
8713
8988
  MMeasure,
8714
8989
  MNoteGroup,
8715
8990
  MPlaybackButtons,
@@ -8741,6 +9016,7 @@ export {
8741
9016
  TieType,
8742
9017
  VerticalPosition,
8743
9018
  getStringNumbers,
9019
+ getVerseNumbers,
8744
9020
  getVoiceIds
8745
9021
  };
8746
9022
  //# sourceMappingURL=index.mjs.map