@tspro/web-music-score 4.0.1 → 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 +13 -0
  2. package/README.md +70 -28
  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-YFPLOHP2.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-DJQ4d2OA.d.mts → music-objects-3Hxlkxy6.d.mts} +172 -80
  13. package/dist/{music-objects-Dc3kR-XF.d.ts → music-objects-CI7IjsjE.d.ts} +172 -80
  14. package/dist/pieces/index.d.mts +2 -2
  15. package/dist/pieces/index.d.ts +2 -2
  16. package/dist/pieces/index.js +3 -3
  17. package/dist/pieces/index.mjs +4 -4
  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-B2Icbetz.d.ts → scale-DGx3tJH4.d.ts} +1 -1
  23. package/dist/{scale-BbDJTbrG.d.mts → scale-DQP3b9Zx.d.mts} +1 -1
  24. package/dist/score/index.d.mts +60 -23
  25. package/dist/score/index.d.ts +60 -23
  26. package/dist/score/index.js +910 -349
  27. package/dist/score/index.mjs +630 -320
  28. package/dist/{tempo-Dt8aHpol.d.ts → tempo-GrstpD9G.d.ts} +42 -10
  29. package/dist/{tempo-CtUhvJbr.d.mts → tempo-dkctPkCS.d.mts} +42 -10
  30. package/dist/theory/index.d.mts +3 -3
  31. package/dist/theory/index.d.ts +3 -3
  32. package/dist/theory/index.js +70 -20
  33. package/dist/theory/index.mjs +84 -280
  34. package/package.json +8 -3
@@ -1,7 +1,10 @@
1
- /* WebMusicScore v4.0.1 | (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-YFPLOHP2.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";
@@ -38,11 +41,11 @@ var DivRect = class _DivRect {
38
41
  /**
39
42
  * Create rect from basic left, top, width and height arguments.
40
43
  *
41
- * @param left -
42
- * @param top -
43
- * @param width -
44
- * @param height -
45
- * @returns
44
+ * @param left - Left coordinate.
45
+ * @param top - Top coordinate.
46
+ * @param width - With.
47
+ * @param height - Height.
48
+ * @returns - DivRect.
46
49
  */
47
50
  static create(left, top, width, height) {
48
51
  return new _DivRect(left, left + width, top, top + height);
@@ -52,9 +55,9 @@ var DivRect = class _DivRect {
52
55
  *
53
56
  * @param centerX - Center x-coordinate.
54
57
  * @param centerY - Center y-coordinate.
55
- * @param width -
56
- * @param height -
57
- * @returns
58
+ * @param width - Width.
59
+ * @param height - Height.
60
+ * @returns - DivRect.
58
61
  */
59
62
  static createCentered(centerX, centerY, width, height) {
60
63
  return new _DivRect(centerX - width / 2, centerX + width / 2, centerY - height / 2, centerY + height / 2);
@@ -66,43 +69,43 @@ var DivRect = class _DivRect {
66
69
  * @param rightw - Right section width.
67
70
  * @param toph - Top section height.
68
71
  * @param bottomh - Bottomsection height.
69
- * @returns
72
+ * @returns - DivRect.
70
73
  */
71
74
  static createSections(leftw, rightw, toph, bottomh) {
72
75
  return new _DivRect(-leftw, 0, rightw, -toph, 0, bottomh);
73
76
  }
74
77
  /**
75
- * Width.
78
+ * Width getter.
76
79
  */
77
80
  get width() {
78
81
  return this.right - this.left;
79
82
  }
80
83
  /**
81
- * Height.
84
+ * Height getter.
82
85
  */
83
86
  get height() {
84
87
  return this.bottom - this.top;
85
88
  }
86
89
  /**
87
- * Left section width.
90
+ * Left section width getter.
88
91
  */
89
92
  get leftw() {
90
93
  return this.centerX - this.left;
91
94
  }
92
95
  /**
93
- * Right section width.
96
+ * Right section width getter.
94
97
  */
95
98
  get rightw() {
96
99
  return this.right - this.centerX;
97
100
  }
98
101
  /**
99
- * Top section height.
102
+ * Top section height getter.
100
103
  */
101
104
  get toph() {
102
105
  return this.centerY - this.top;
103
106
  }
104
107
  /**
105
- * Bottom section height.
108
+ * Bottom section height getter.
106
109
  */
107
110
  get bottomh() {
108
111
  return this.bottom - this.centerY;
@@ -110,9 +113,9 @@ var DivRect = class _DivRect {
110
113
  /**
111
114
  * Does this Rect contain given (x, y)-point?
112
115
  *
113
- * @param x -
114
- * @param y -
115
- * @returns
116
+ * @param x - X-coordinate.
117
+ * @param y - Y-coordinate.
118
+ * @returns - True/false.
116
119
  */
117
120
  contains(x, y) {
118
121
  return x >= this.left && x <= this.right && y >= this.top && y <= this.bottom;
@@ -120,9 +123,9 @@ var DivRect = class _DivRect {
120
123
  /**
121
124
  * Do a and b rects overlap?
122
125
  *
123
- * @param a -
124
- * @param b -
125
- * @returns
126
+ * @param a - DivRect a.
127
+ * @param b - DivRect b.
128
+ * @returns - True/false.
126
129
  */
127
130
  static overlap(a, b) {
128
131
  return a.right > b.left && a.left < b.right && a.bottom > b.top && a.top < b.bottom;
@@ -130,17 +133,18 @@ var DivRect = class _DivRect {
130
133
  /**
131
134
  * Do horizontal measures of a and b rects overlap?
132
135
  *
133
- * @param a -
134
- * @param b -
135
- * @returns
136
+ * @param a - DivRect a.
137
+ * @param b - DivRect b.
138
+ * @returns - True/false.
136
139
  */
137
140
  static overlapX(a, b) {
138
141
  return a.right > b.left && a.left < b.right;
139
142
  }
140
143
  /**
141
144
  * Check if this Rect equals with given Rect.
142
- * @param b -
143
- * @returns
145
+ * @param a - DivRect a.
146
+ * @param b - DivRect b.
147
+ * @returns - True/false.
144
148
  */
145
149
  static equals(a, b) {
146
150
  if (a == null && b == null) {
@@ -152,10 +156,11 @@ var DivRect = class _DivRect {
152
156
  }
153
157
  }
154
158
  /**
155
- * Check if frame (ignoring centerX/Y) of this Rect equals with given Rect, ignoring centerX and centerY.
159
+ * Check if frame of this Rect equals with given Rect, ignoring center x- and center y-coordinates.
156
160
  *
157
- * @param b -
158
- * @returns
161
+ * @param a - DivRect a.
162
+ * @param b - DivRect b.
163
+ * @returns - True/false.
159
164
  */
160
165
  static equalsFrame(a, b) {
161
166
  if (a == null && b == null) {
@@ -169,7 +174,7 @@ var DivRect = class _DivRect {
169
174
  /**
170
175
  * Created duplicate of this Rect.
171
176
  *
172
- * @returns
177
+ * @returns - Duplicate.
173
178
  */
174
179
  copy() {
175
180
  return new _DivRect(this.left, this.centerX, this.right, this.top, this.centerY, this.bottom);
@@ -177,9 +182,9 @@ var DivRect = class _DivRect {
177
182
  /**
178
183
  * Move this rect by (dx, dy). Modifies this Rect.
179
184
  *
180
- * @param dx -
181
- * @param dy -
182
- * @returns
185
+ * @param dx - Offset amount in x-direction.
186
+ * @param dy - Offset amount in y-direction.
187
+ * @returns - This DivRect instance.
183
188
  */
184
189
  offsetInPlace(dx, dy) {
185
190
  this.left += dx;
@@ -193,9 +198,9 @@ var DivRect = class _DivRect {
193
198
  /**
194
199
  * Move this rect by (dx, dy). Immutable, returns modified copy.
195
200
  *
196
- * @param dx -
197
- * @param dy -
198
- * @returns
201
+ * @param dx - Offset amount in x-direction.
202
+ * @param dy - Offset amount in y-direction.
203
+ * @returns - DivRect copy with applied offset.
199
204
  */
200
205
  offsetCopy(dx, dy) {
201
206
  return this.copy().offsetInPlace(dx, dy);
@@ -203,8 +208,8 @@ var DivRect = class _DivRect {
203
208
  /**
204
209
  * Expand this Rect by given Rect. Modifies this Rect.
205
210
  *
206
- * @param rect -
207
- * @returns
211
+ * @param rect - DivRect to expand this instance with.
212
+ * @returns - This DivRect instance.
208
213
  */
209
214
  expandInPlace(rect) {
210
215
  this.left = Math.min(this.left, rect.left);
@@ -216,8 +221,8 @@ var DivRect = class _DivRect {
216
221
  /**
217
222
  * Expand this Rect by given Rect. Immutable, returns modified copy.
218
223
  *
219
- * @param rect -
220
- * @returns
224
+ * @param rect - DivRect to expand this instance with.
225
+ * @returns - Expanded copy of this DivRect.
221
226
  */
222
227
  expandCopy(rect) {
223
228
  return this.copy().expandInPlace(rect);
@@ -225,8 +230,8 @@ var DivRect = class _DivRect {
225
230
  /**
226
231
  * Clip this Rect by given Rect. Mmodifies this Rect.
227
232
  *
228
- * @param clipRect -
229
- * @returns
233
+ * @param clipRect - DivRect to clip this instance with.
234
+ * @returns - This DivRect instance.
230
235
  */
231
236
  clipInPlace(clipRect) {
232
237
  this.left = Math.max(this.left, clipRect.left);
@@ -240,8 +245,8 @@ var DivRect = class _DivRect {
240
245
  /**
241
246
  * Clip this Rect by given Rect. Immutable, return modified copy.
242
247
  *
243
- * @param clipRect -
244
- * @returns
248
+ * @param clipRect - DivRecto to clip this instance with.
249
+ * @returns - Clipped DivRect copy.
245
250
  */
246
251
  clipCopy(clipRect) {
247
252
  return this.copy().clipInPlace(clipRect);
@@ -249,9 +254,9 @@ var DivRect = class _DivRect {
249
254
  /**
250
255
  * Scale Rect. Anchor pos is (centerX, centerY). Modifies this Rect.
251
256
  *
252
- * @param scaleX -
253
- * @param scaleY -
254
- * @returns Copy of scaled Rect.
257
+ * @param scaleX - Scale x-amount.
258
+ * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
259
+ * @returns This DivRect instance.
255
260
  */
256
261
  scaleInPlace(scaleX, scaleY) {
257
262
  scaleY = scaleY != null ? scaleY : scaleX;
@@ -264,20 +269,24 @@ var DivRect = class _DivRect {
264
269
  /**
265
270
  * Scale Rect. Anchor pos is (centerX, centerY). Immutable, returns modified copy.
266
271
  *
267
- * @param scaleX -
268
- * @param scaleY -
269
- * @returns Copy of scaled Rect.
272
+ * @param scaleX - Scale x-amount.
273
+ * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
274
+ * @returns Scaled copy of this DivRect.
270
275
  */
271
276
  scaleCopy(scaleX, scaleY) {
272
277
  return this.copy().scaleInPlace(scaleX, scaleY);
273
278
  }
279
+ /**
280
+ * Get this DivRect instance.
281
+ * @returns - This DivRect instance.
282
+ */
274
283
  getRect() {
275
284
  return this;
276
285
  }
277
286
  };
278
287
 
279
288
  // src/score/pub/document-builder.ts
280
- import { Utils as Utils13 } from "@tspro/ts-utils-lib";
289
+ import { Utils as Utils14 } from "@tspro/ts-utils-lib";
281
290
 
282
291
  // src/score/pub/types.ts
283
292
  var StaffPreset = /* @__PURE__ */ ((StaffPreset3) => {
@@ -300,6 +309,9 @@ function getVoiceIds() {
300
309
  function getStringNumbers() {
301
310
  return [1, 2, 3, 4, 5, 6];
302
311
  }
312
+ function getVerseNumbers() {
313
+ return [1, 2, 3];
314
+ }
303
315
  var Stem = /* @__PURE__ */ ((Stem2) => {
304
316
  Stem2["Auto"] = "auto";
305
317
  Stem2["Up"] = "up";
@@ -337,6 +349,17 @@ var VerticalPosition = /* @__PURE__ */ ((VerticalPosition4) => {
337
349
  VerticalPosition4["Both"] = "both";
338
350
  return VerticalPosition4;
339
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 || {});
340
363
  var Fermata = /* @__PURE__ */ ((Fermata2) => {
341
364
  Fermata2["AtNote"] = "atNote";
342
365
  Fermata2["AtMeasureEnd"] = "atMeasureEnd";
@@ -891,12 +914,12 @@ var Renderer = class {
891
914
 
892
915
  // src/score/engine/obj-staff-and-tab.ts
893
916
  import { MusicError as MusicError15, MusicErrorType as MusicErrorType15 } from "@tspro/web-music-score/core";
894
- import { Utils as Utils11 } from "@tspro/ts-utils-lib";
917
+ import { Utils as Utils12 } from "@tspro/ts-utils-lib";
895
918
 
896
919
  // src/score/engine/obj-measure.ts
897
- import { Utils as Utils10 } from "@tspro/ts-utils-lib";
898
- 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";
899
- import { getDefaultTempo, TimeSignature, getDefaultTimeSignature } 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";
922
+ import { getDefaultTempo, getDefaultTimeSignature } from "@tspro/web-music-score/theory";
900
923
 
901
924
  // src/score/engine/acc-state.ts
902
925
  import { Note } from "@tspro/web-music-score/theory";
@@ -1279,9 +1302,9 @@ var ObjSignature = class extends MusicObject {
1279
1302
  if (showTimeSignature) {
1280
1303
  let timeSignature = this.measure.getTimeSignature();
1281
1304
  let beatCount = timeSignature.beatCount.toString();
1282
- this.beatCountText = new ObjText(this, { text: beatCount, scale: 1.4 }, 0, 0.5);
1305
+ this.beatCountText = new ObjText(this, { text: beatCount, scale: 1.4 }, 0.5, 0.5);
1283
1306
  let beatSize = timeSignature.beatSize.toString();
1284
- this.beatSizeText = new ObjText(this, { text: beatSize, scale: 1.4 }, 0, 0.5);
1307
+ this.beatSizeText = new ObjText(this, { text: beatSize, scale: 1.4 }, 0.5, 0.5);
1285
1308
  } else {
1286
1309
  this.beatCountText = this.beatSizeText = void 0;
1287
1310
  }
@@ -1371,6 +1394,7 @@ var ObjSignature = class extends MusicObject {
1371
1394
  return [this];
1372
1395
  }
1373
1396
  layout(renderer) {
1397
+ var _a, _b, _c, _d, _e, _f;
1374
1398
  let { unitSize } = renderer;
1375
1399
  let { staff } = this;
1376
1400
  let paddingX = unitSize;
@@ -1415,15 +1439,16 @@ var ObjSignature = class extends MusicObject {
1415
1439
  });
1416
1440
  }
1417
1441
  let right = x;
1442
+ (_a = this.beatCountText) == null ? void 0 : _a.layout(renderer);
1443
+ (_b = this.beatSizeText) == null ? void 0 : _b.layout(renderer);
1444
+ let tsWidth = Math.max((_d = (_c = this.beatCountText) == null ? void 0 : _c.getRect().width) != null ? _d : 0, (_f = (_e = this.beatSizeText) == null ? void 0 : _e.getRect().width) != null ? _f : 0);
1418
1445
  if (this.beatCountText) {
1419
- this.beatCountText.layout(renderer);
1420
- this.beatCountText.offset(x + paddingX, staff.getDiatonicIdY(staff.middleLineDiatonicId + 2));
1446
+ this.beatCountText.offset(x + tsWidth / 2 + paddingX, staff.getDiatonicIdY(staff.middleLineDiatonicId + 2));
1421
1447
  this.rect.expandInPlace(this.beatCountText.getRect());
1422
1448
  right = Math.max(right, this.rect.right);
1423
1449
  }
1424
1450
  if (this.beatSizeText) {
1425
- this.beatSizeText.layout(renderer);
1426
- this.beatSizeText.offset(x + paddingX, staff.getDiatonicIdY(staff.bottomLineDiatonicId + 2));
1451
+ this.beatSizeText.offset(x + tsWidth / 2 + paddingX, staff.getDiatonicIdY(staff.bottomLineDiatonicId + 2));
1427
1452
  this.rect.expandInPlace(this.beatSizeText.getRect());
1428
1453
  right = Math.max(right, this.rect.right);
1429
1454
  }
@@ -1483,12 +1508,12 @@ var ObjSignature = class extends MusicObject {
1483
1508
  };
1484
1509
 
1485
1510
  // src/score/engine/player.ts
1486
- import { Utils as Utils6 } from "@tspro/ts-utils-lib";
1487
- 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";
1488
1513
  import * as Audio from "@tspro/web-music-score/audio";
1489
1514
 
1490
1515
  // src/score/engine/obj-rhythm-column.ts
1491
- import { Note as Note5 } from "@tspro/web-music-score/theory";
1516
+ import { Note as Note5, validateNoteLength } from "@tspro/web-music-score/theory";
1492
1517
 
1493
1518
  // src/score/engine/obj-arpeggio.ts
1494
1519
  var ObjArpeggio = class extends MusicObject {
@@ -1561,7 +1586,7 @@ var ObjArpeggio = class extends MusicObject {
1561
1586
  };
1562
1587
 
1563
1588
  // src/score/engine/obj-rest.ts
1564
- 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";
1565
1590
  import { MusicError as MusicError5, MusicErrorType as MusicErrorType5 } from "@tspro/web-music-score/core";
1566
1591
  function getDiatonicIdFromStaffPos(staffPos) {
1567
1592
  if (typeof staffPos === "number") {
@@ -1638,7 +1663,7 @@ var ObjRest = class extends MusicObject {
1638
1663
  this.hide = (_b = options == null ? void 0 : options.hide) != null ? _b : false;
1639
1664
  this.oldStyleTriplet = tupletRatio === void 0 && ((options == null ? void 0 : options.triplet) === true || NoteLengthProps.get(noteLength).isTriplet);
1640
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;
1641
- 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);
1642
1667
  this.mi = new MRest(this);
1643
1668
  }
1644
1669
  getMusicInterface() {
@@ -1879,7 +1904,7 @@ var ObjRest = class extends MusicObject {
1879
1904
 
1880
1905
  // src/score/engine/obj-note-group.ts
1881
1906
  import { Utils as Utils4 } from "@tspro/ts-utils-lib";
1882
- 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";
1883
1908
 
1884
1909
  // src/score/engine/obj-beam-group.ts
1885
1910
  import { Utils as Utils3 } from "@tspro/ts-utils-lib";
@@ -2419,7 +2444,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2419
2444
  this.arpeggio = getArpeggio(options == null ? void 0 : options.arpeggio);
2420
2445
  this.oldStyleTriplet = tupletRatio === void 0 && ((options == null ? void 0 : options.triplet) === true || NoteLengthProps3.get(noteLength).isTriplet);
2421
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;
2422
- 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);
2423
2448
  this.mi = new MNoteGroup(this);
2424
2449
  }
2425
2450
  getMusicInterface() {
@@ -2812,11 +2837,10 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2812
2837
  }
2813
2838
  setStemTipY(staff, stemTipY) {
2814
2839
  let obj = this.staffObjects.find((obj2) => obj2.staff === staff);
2815
- if (!(obj == null ? void 0 : obj.stemTip) || stemTipY === obj.stemTip.centerY) {
2816
- return;
2840
+ if (this.hasBeamCount() && (obj == null ? void 0 : obj.stemTip) && stemTipY !== obj.stemTip.centerY) {
2841
+ obj.stemTip.top = obj.stemTip.centerY = obj.stemTip.bottom = stemTipY;
2842
+ this.requestRectUpdate();
2817
2843
  }
2818
- obj.stemTip.top = obj.stemTip.centerY = obj.stemTip.bottom = stemTipY;
2819
- this.requestRectUpdate();
2820
2844
  }
2821
2845
  offset(dx, dy) {
2822
2846
  this.staffObjects.forEach((obj) => obj.offset(dx, 0));
@@ -2992,12 +3016,93 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2992
3016
 
2993
3017
  // src/score/engine/obj-rhythm-column.ts
2994
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
2995
3100
  var noteHeadDataCompareFunc = (a, b) => {
2996
- let cmp = Note5.compareFunc(a.note, b.note);
2997
- if (cmp === 0) {
2998
- 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;
2999
3104
  }
3000
- return cmp;
3105
+ return cmp2;
3001
3106
  };
3002
3107
  var ObjRhythmColumn = class extends MusicObject {
3003
3108
  constructor(measure, positionTicks) {
@@ -3005,6 +3110,7 @@ var ObjRhythmColumn = class extends MusicObject {
3005
3110
  this.measure = measure;
3006
3111
  this.positionTicks = positionTicks;
3007
3112
  __publicField(this, "voiceSymbol", []);
3113
+ __publicField(this, "lyricsContainers", []);
3008
3114
  __publicField(this, "minDiatonicId");
3009
3115
  __publicField(this, "maxDiatonicId");
3010
3116
  __publicField(this, "staffMinDiatonicId", /* @__PURE__ */ new Map());
@@ -3130,6 +3236,19 @@ var ObjRhythmColumn = class extends MusicObject {
3130
3236
  getVoiceSymbol(voiceId) {
3131
3237
  return this.voiceSymbol[voiceId];
3132
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
+ }
3133
3252
  getMinWidth() {
3134
3253
  let maxNoteSize = Math.max(...this.voiceSymbol.map((s) => s.rhythmProps.noteSize));
3135
3254
  let w = DocumentSettings.NoteHeadWidth;
@@ -3349,7 +3468,7 @@ var ObjRhythmColumn = class extends MusicObject {
3349
3468
  import { MusicError as MusicError9, MusicErrorType as MusicErrorType9 } from "@tspro/web-music-score/core";
3350
3469
 
3351
3470
  // src/score/engine/element-data.ts
3352
- import { Utils as Utils5 } from "@tspro/ts-utils-lib";
3471
+ import { Utils as Utils6 } from "@tspro/ts-utils-lib";
3353
3472
 
3354
3473
  // src/score/engine/obj-special-text.ts
3355
3474
  var _ObjSpecialText = class _ObjSpecialText extends MusicObject {
@@ -3471,23 +3590,23 @@ function getNavigationString(navigation) {
3471
3590
  }
3472
3591
  }
3473
3592
  function isDynamicsText(text) {
3474
- return Utils5.Is.isEnumValue(text, DynamicsAnnotation);
3593
+ return Utils6.Is.isEnumValue(text, DynamicsAnnotation);
3475
3594
  }
3476
3595
  function getDynamicsVolume(text) {
3477
3596
  if (/^(p+|f+|m|mp|mf)$/.test(text)) {
3478
- let volume = 0.5 - Utils5.Str.charCount(text, "p") * 0.1 + Utils5.Str.charCount(text, "f") * 0.1;
3479
- 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);
3480
3599
  } else {
3481
3600
  return void 0;
3482
3601
  }
3483
3602
  }
3484
3603
  function isTempoText(text) {
3485
- return Utils5.Is.isEnumValue(text, TempoAnnotation);
3604
+ return Utils6.Is.isEnumValue(text, TempoAnnotation);
3486
3605
  }
3487
3606
  function getAnnotation(text) {
3488
- if (Utils5.Is.isEnumValue(text, DynamicsAnnotation)) {
3607
+ if (Utils6.Is.isEnumValue(text, DynamicsAnnotation)) {
3489
3608
  return "dynamics" /* Dynamics */;
3490
- } else if (Utils5.Is.isEnumValue(text, TempoAnnotation)) {
3609
+ } else if (Utils6.Is.isEnumValue(text, TempoAnnotation)) {
3491
3610
  return "tempo" /* Tempo */;
3492
3611
  } else {
3493
3612
  return void 0;
@@ -3610,7 +3729,7 @@ var RitardandoSpeedDiv = 2;
3610
3729
  var CrescendoVolumeAdd = 0.5;
3611
3730
  var DiminuendoVolumeSub = 0.5;
3612
3731
  function calcTicksDuration(ticks, tempo) {
3613
- let beatTicks = RhythmProps3.get(tempo.options.beatLength, tempo.options.dotCount).ticks;
3732
+ let beatTicks = RhythmProps4.get(tempo.options.beatLength, tempo.options.dotCount).ticks;
3614
3733
  let ticksPerMinute = tempo.beatsPerMinute * beatTicks;
3615
3734
  return 60 * ticks / ticksPerMinute;
3616
3735
  }
@@ -3643,7 +3762,7 @@ var PlayerColumnProps = class {
3643
3762
  return this.speed;
3644
3763
  }
3645
3764
  getTempo() {
3646
- let speed = Utils6.Math.clamp(this.getSpeed(), 0.1, 10);
3765
+ let speed = Utils7.Math.clamp(this.getSpeed(), 0.1, 10);
3647
3766
  return alterTempoSpeed(this.measure.getTempo(), speed);
3648
3767
  }
3649
3768
  setVolume(volume) {
@@ -3668,7 +3787,7 @@ var PlayerColumnProps = class {
3668
3787
  if (symbolsTicks.length === 0) {
3669
3788
  return 0;
3670
3789
  } else {
3671
- return Utils6.Math.sum(symbolsTicks) / symbolsTicks.length;
3790
+ return Utils7.Math.sum(symbolsTicks) / symbolsTicks.length;
3672
3791
  }
3673
3792
  }
3674
3793
  }
@@ -3817,7 +3936,7 @@ var Player = class _Player {
3817
3936
  } else if (layoutObj.musicObj.getLink() instanceof Extension) {
3818
3937
  let extension = layoutObj.musicObj.getLink();
3819
3938
  let { columnRange, extensionBreakText } = extension.getExtensionRangeInfo();
3820
- let totalTicks = Utils6.Math.sum(columnRange.map((c) => c.getTicksToNextColumn()));
3939
+ let totalTicks = Utils7.Math.sum(columnRange.map((c) => c.getTicksToNextColumn()));
3821
3940
  switch (text) {
3822
3941
  case "accel." /* accel */: {
3823
3942
  let startSpeed = curSpeed;
@@ -3871,11 +3990,11 @@ var Player = class _Player {
3871
3990
  });
3872
3991
  let speedArr = (_a = speedMap.get(col)) != null ? _a : [];
3873
3992
  if (speedArr.length > 0) {
3874
- curSpeed = Utils6.Math.sum(speedArr) / speedArr.length;
3993
+ curSpeed = Utils7.Math.sum(speedArr) / speedArr.length;
3875
3994
  }
3876
3995
  let volumeArr = (_b = volumeMap.get(col)) != null ? _b : [];
3877
3996
  if (volumeArr.length > 0) {
3878
- curVolume = Utils6.Math.sum(volumeArr) / volumeArr.length;
3997
+ curVolume = Utils7.Math.sum(volumeArr) / volumeArr.length;
3879
3998
  }
3880
3999
  col.getPlayerProps().setSpeed(curSpeed);
3881
4000
  col.getPlayerProps().setVolume(curVolume);
@@ -3913,11 +4032,11 @@ var Player = class _Player {
3913
4032
  } else {
3914
4033
  let playerNotes = col.getPlayerNotes();
3915
4034
  playerNotes.forEach((note, i) => {
3916
- let arpeggioDelayTicks = col.hasArpeggio() ? RhythmProps3.get(NoteLength5.ThirtySecond).ticks * i : 0;
4035
+ let arpeggioDelayTicks = col.hasArpeggio() ? RhythmProps4.get(NoteLength6.ThirtySecond).ticks * i : 0;
3917
4036
  let noteSeconds = getDuration(note.ticks + fermataHoldTicks - arpeggioDelayTicks, tempo);
3918
4037
  if (noteSeconds > 0) {
3919
4038
  if (note.staccato) {
3920
- 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);
3921
4040
  }
3922
4041
  let volume = adjustVolume(col.getPlayerProps().getVolume());
3923
4042
  if (note.slur === "slurred") {
@@ -4205,7 +4324,7 @@ var ObjBarLineRight = class extends ObjBarLine {
4205
4324
  };
4206
4325
 
4207
4326
  // src/score/engine/obj-ending.ts
4208
- import { Utils as Utils7 } from "@tspro/ts-utils-lib";
4327
+ import { Utils as Utils8 } from "@tspro/ts-utils-lib";
4209
4328
  import { MusicError as MusicError10, MusicErrorType as MusicErrorType10 } from "@tspro/web-music-score/core";
4210
4329
  var ObjEnding = class extends MusicObject {
4211
4330
  constructor(measure, passages) {
@@ -4216,9 +4335,9 @@ var ObjEnding = class extends MusicObject {
4216
4335
  __publicField(this, "shapeRects", []);
4217
4336
  __publicField(this, "mi");
4218
4337
  this.mi = new MEnding(this);
4219
- if (!Utils7.Is.isIntegerGte(passages.length, 1)) {
4338
+ if (!Utils8.Is.isIntegerGte(passages.length, 1)) {
4220
4339
  throw new MusicError10(MusicErrorType10.Score, "Passages is empty.");
4221
- } else if (!this.passages.every((p) => Utils7.Is.isIntegerGte(p, 1))) {
4340
+ } else if (!this.passages.every((p) => Utils8.Is.isIntegerGte(p, 1))) {
4222
4341
  throw new MusicError10(MusicErrorType10.Score, "Invalid passages: " + this.passages);
4223
4342
  }
4224
4343
  this.passages.sort((a, b) => a - b);
@@ -4433,7 +4552,7 @@ import { MusicError as MusicError13, MusicErrorType as MusicErrorType13 } from "
4433
4552
  import { Note as Note6 } from "@tspro/web-music-score/theory";
4434
4553
 
4435
4554
  // src/score/engine/obj-connective.ts
4436
- import { Utils as Utils8 } from "@tspro/ts-utils-lib";
4555
+ import { Utils as Utils9 } from "@tspro/ts-utils-lib";
4437
4556
  import { MusicError as MusicError11, MusicErrorType as MusicErrorType11 } from "@tspro/web-music-score/core";
4438
4557
  var ObjConnective = class extends MusicObject {
4439
4558
  constructor(connectiveProps, line, measure, leftNoteGroup, leftNoteId, ...args) {
@@ -4462,7 +4581,7 @@ var ObjConnective = class extends MusicObject {
4462
4581
  this.rightNoteGroup = args[0];
4463
4582
  this.rightNoteId = args[1];
4464
4583
  this.tieType = void 0;
4465
- } else if (Utils8.Is.isEnumValue(args[0], TieType)) {
4584
+ } else if (Utils9.Is.isEnumValue(args[0], TieType)) {
4466
4585
  this.rightNoteGroup = void 0;
4467
4586
  this.rightNoteId = void 0;
4468
4587
  this.tieType = args[0];
@@ -4532,7 +4651,7 @@ var ObjConnective = class extends MusicObject {
4532
4651
  this.rx = rx;
4533
4652
  this.ry = ry;
4534
4653
  this.arcHeight = this.connectiveProps.connective === "slide" /* Slide */ ? 0 : arcHeight;
4535
- let { nx, ny } = Utils8.Math.calcNormal(lx, ly, rx, ry);
4654
+ let { nx, ny } = Utils9.Math.calcNormal(lx, ly, rx, ry);
4536
4655
  this.cp1x = lx * 0.7 + rx * 0.3 + nx * this.arcHeight;
4537
4656
  this.cp1y = ly * 0.7 + ry * 0.3 + ny * this.arcHeight;
4538
4657
  this.cp2x = lx * 0.3 + rx * 0.7 + nx * this.arcHeight;
@@ -4593,7 +4712,7 @@ var ObjConnective = class extends MusicObject {
4593
4712
 
4594
4713
  // src/score/engine/connective-props.ts
4595
4714
  import { MusicError as MusicError12, MusicErrorType as MusicErrorType12 } from "@tspro/web-music-score/core";
4596
- import { Utils as Utils9 } from "@tspro/ts-utils-lib";
4715
+ import { Utils as Utils10 } from "@tspro/ts-utils-lib";
4597
4716
  var ConnectiveProps = class {
4598
4717
  constructor(connective, span, noteAnchor, startNoteGroup) {
4599
4718
  this.connective = connective;
@@ -4663,7 +4782,7 @@ var ConnectiveProps = class {
4663
4782
  this.computeParams();
4664
4783
  let { connective, span } = this;
4665
4784
  if (connective === "tie" /* Tie */) {
4666
- if (Utils9.Is.isEnumValue(span, TieType)) {
4785
+ if (Utils10.Is.isEnumValue(span, TieType)) {
4667
4786
  let leftNoteGroup = this.noteGroups[0];
4668
4787
  for (let noteId = 0; noteId < leftNoteGroup.notes.length; noteId++) {
4669
4788
  this.createObjConnectiveWithTieType(leftNoteGroup, noteId, span);
@@ -4734,8 +4853,9 @@ var ConnectiveProps = class {
4734
4853
  };
4735
4854
 
4736
4855
  // src/score/engine/obj-measure.ts
4856
+ var cmp = (a, b) => a === b ? 0 : a < b ? -1 : 1;
4737
4857
  function validateVoiceId(voiceId) {
4738
- if (getVoiceIds().indexOf(voiceId) < 0) {
4858
+ if (typeof voiceId === "number" && getVoiceIds().indexOf(voiceId) < 0) {
4739
4859
  throw new MusicError13(MusicErrorType13.Score, "Invalid voiceId: " + voiceId);
4740
4860
  } else {
4741
4861
  return voiceId;
@@ -4745,14 +4865,14 @@ function getExtensionTicks(extensionLength) {
4745
4865
  if (typeof extensionLength === "string") {
4746
4866
  extensionLength = [extensionLength];
4747
4867
  }
4748
- if (Utils10.Is.isArray(extensionLength)) {
4868
+ if (Utils11.Is.isArray(extensionLength)) {
4749
4869
  let totalTicks = 0;
4750
4870
  for (let i = 0; i < extensionLength.length; ) {
4751
4871
  let str = extensionLength[i];
4752
4872
  let num = extensionLength[i + 1];
4753
4873
  if (typeof str === "string") {
4754
4874
  i++;
4755
- let ticks = RhythmProps4.get(str).ticks;
4875
+ let ticks = RhythmProps5.get(str).ticks;
4756
4876
  if (typeof num === "number") {
4757
4877
  i++;
4758
4878
  ticks *= num;
@@ -4767,6 +4887,18 @@ function getExtensionTicks(extensionLength) {
4767
4887
  return extensionLength;
4768
4888
  }
4769
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
+ }
4770
4902
  var _ObjMeasure = class _ObjMeasure extends MusicObject {
4771
4903
  constructor(row) {
4772
4904
  super(row);
@@ -4811,6 +4943,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
4811
4943
  // play twice.
4812
4944
  __publicField(this, "endRepeatPlayCountText");
4813
4945
  __publicField(this, "staticObjectsCache", /* @__PURE__ */ new Map());
4946
+ __publicField(this, "lyricsObjectsCache", /* @__PURE__ */ new Map());
4814
4947
  __publicField(this, "mi");
4815
4948
  this.mi = new MMeasure(this);
4816
4949
  this.prevMeasure = row.doc.getLastMeasure();
@@ -4994,7 +5127,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
4994
5127
  this.alterKeySignature = args[0];
4995
5128
  } else if (args[0] instanceof Scale) {
4996
5129
  this.alterKeySignature = args[0];
4997
- } else if (Utils10.Is.isNonEmptyString(args[0])) {
5130
+ } else if (Utils11.Is.isNonEmptyString(args[0])) {
4998
5131
  if (args.length === 1) {
4999
5132
  this.alterKeySignature = getScale(args[0]);
5000
5133
  } else if (args.length === 2) {
@@ -5025,7 +5158,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5025
5158
  setTimeSignature(timeSignature) {
5026
5159
  var _a;
5027
5160
  (_a = this.getPrevMeasure()) == null ? void 0 : _a.endSection();
5028
- this.alterTimeSignature = timeSignature instanceof TimeSignature ? timeSignature : new TimeSignature(timeSignature);
5161
+ this.alterTimeSignature = timeSignature;
5029
5162
  this.updateTimeSignature();
5030
5163
  }
5031
5164
  updateTimeSignature() {
@@ -5049,7 +5182,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5049
5182
  } else {
5050
5183
  let dotCount = typeof dotted === "number" && dotted > 0 ? dotted : dotted === true ? 1 : NoteLengthProps4.get(beatLength).dotCount;
5051
5184
  let options = {
5052
- beatLength: validateNoteLength(beatLength),
5185
+ beatLength: validateNoteLength2(beatLength),
5053
5186
  dotCount: dotCount > 0 ? dotCount : void 0
5054
5187
  };
5055
5188
  this.alterTempo = { beatsPerMinute, options };
@@ -5105,7 +5238,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5105
5238
  let grp = this.doc.getStaffGroup(staffTabOrGroup);
5106
5239
  if (grp && !prevGroups.includes(staffTabOrGroup)) {
5107
5240
  let curGroups = [...prevGroups, staffTabOrGroup];
5108
- (Utils10.Is.isArray(grp.staffsTabsAndGroups) ? grp.staffsTabsAndGroups : [grp.staffsTabsAndGroups]).forEach((staffTabOrGroup2) => {
5241
+ (Utils11.Is.isArray(grp.staffsTabsAndGroups) ? grp.staffsTabsAndGroups : [grp.staffsTabsAndGroups]).forEach((staffTabOrGroup2) => {
5109
5242
  switch (grp.verticalPosition) {
5110
5243
  case "above" /* Above */:
5111
5244
  addToStaffTabOrGroup(staffTabOrGroup2, 0 /* Above */, curGroups);
@@ -5132,7 +5265,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5132
5265
  } else {
5133
5266
  addToStaffTabOrGroup(0, defaultVerticalPos);
5134
5267
  }
5135
- } else if (Utils10.Is.isArray(staffTabOrGroups)) {
5268
+ } else if (Utils11.Is.isArray(staffTabOrGroups)) {
5136
5269
  staffTabOrGroups.forEach((staffTabOrGroup) => addToStaffTabOrGroup(staffTabOrGroup, defaultVerticalPos));
5137
5270
  } else {
5138
5271
  addToStaffTabOrGroup(staffTabOrGroups, defaultVerticalPos);
@@ -5216,7 +5349,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5216
5349
  case "endRepeat" /* EndRepeat */:
5217
5350
  if (args.length === 0) {
5218
5351
  this.endRepeatPlayCount = 2;
5219
- } else if (Utils10.Is.isIntegerGte(args[0], 2)) {
5352
+ } else if (Utils11.Is.isIntegerGte(args[0], 2)) {
5220
5353
  this.endRepeatPlayCount = args[0];
5221
5354
  } else {
5222
5355
  throw new MusicError13(MusicErrorType13.Score, "Invalid end repeat play count (should be 2 or greater integer): " + args[0]);
@@ -5303,15 +5436,15 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5303
5436
  throw new MusicError13(MusicErrorType13.Score, "Connective can be added to note group only.");
5304
5437
  }
5305
5438
  if (connective === "tie" /* Tie */) {
5306
- let tieSpan = Utils10.Is.isInteger(args[0]) || Utils10.Is.isEnumValue(args[0], TieType) ? args[0] : 2;
5307
- 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 */;
5308
5441
  anchor.startConnective(new ConnectiveProps("tie" /* Tie */, tieSpan, noteAnchor, anchor));
5309
5442
  } else if (connective === "slur" /* Slur */) {
5310
- let slurSpan = Utils10.Is.isInteger(args[0]) ? args[0] : 2;
5311
- 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 */;
5312
5445
  anchor.startConnective(new ConnectiveProps("slur" /* Slur */, slurSpan, noteAnchor, anchor));
5313
5446
  } else if (connective === "slide" /* Slide */) {
5314
- 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 */;
5315
5448
  anchor.startConnective(new ConnectiveProps("slide" /* Slide */, 2, noteAnchor, anchor));
5316
5449
  }
5317
5450
  }
@@ -5365,10 +5498,11 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5365
5498
  this.doc.requestNewRow();
5366
5499
  this.disableExtension();
5367
5500
  }
5368
- addRhythmSymbol(voiceId, symbol) {
5369
- let { col } = symbol;
5501
+ addRhythmSymbol(symbol) {
5502
+ var _a, _b;
5503
+ let { col, voiceId } = symbol;
5370
5504
  col.setVoiceSymbol(voiceId, symbol);
5371
- this.getVoiceSymbols(voiceId);
5505
+ (_b = (_a = this.voiceSymbols)[voiceId]) != null ? _b : _a[voiceId] = [];
5372
5506
  this.voiceSymbols[voiceId].push(symbol);
5373
5507
  if (symbol.oldStyleTriplet) {
5374
5508
  this.createOldStyleTriplets(voiceId);
@@ -5381,25 +5515,40 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5381
5515
  let realNotes = notes.map((note) => typeof note === "string" ? Note7.getNote(note) : note);
5382
5516
  let col = this.getRhythmColumn(voiceId);
5383
5517
  let noteGroup = new ObjNoteGroup(col, voiceId, realNotes, noteLength, options, tupletRatio);
5384
- this.addRhythmSymbol(voiceId, noteGroup);
5518
+ this.addRhythmSymbol(noteGroup);
5385
5519
  return noteGroup;
5386
5520
  }
5387
5521
  addRest(voiceId, restLength, options, tupletRatio) {
5388
5522
  let col = this.getRhythmColumn(voiceId);
5389
5523
  let rest = new ObjRest(col, voiceId, restLength, options, tupletRatio);
5390
- this.addRhythmSymbol(voiceId, rest);
5524
+ this.addRhythmSymbol(rest);
5391
5525
  return rest;
5392
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
+ }
5393
5542
  /**
5394
5543
  *
5395
5544
  * @param positionTicks - get ObjRhythmColumn with positionTicks. Insert new if necessary.
5396
5545
  * @returns
5397
5546
  */
5398
- getRhythmColumn(voiceId) {
5547
+ getRhythmColumn(arg) {
5399
5548
  let positionTicks = 0;
5400
5549
  for (let i = this.columns.length - 1; i >= 0 && positionTicks === 0; i--) {
5401
5550
  let col = this.columns[i];
5402
- let symbol = col.getVoiceSymbol(voiceId);
5551
+ let symbol = typeof arg === "number" ? col.getVoiceSymbol(arg) : col.getLyricsContainer(arg.verse, arg.line, arg.vpos);
5403
5552
  if (symbol) {
5404
5553
  positionTicks = col.positionTicks + symbol.rhythmProps.ticks;
5405
5554
  }
@@ -5466,6 +5615,38 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5466
5615
  getStaffLineRight() {
5467
5616
  return this.barLineRight.getRect().centerX;
5468
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
+ }
5469
5650
  getStaticObjects(line) {
5470
5651
  let staticObjects = this.staticObjectsCache.get(line);
5471
5652
  if (!staticObjects) {
@@ -5555,52 +5736,77 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5555
5736
  return false;
5556
5737
  }
5557
5738
  });
5739
+ let ts = this.getTimeSignature();
5740
+ if (!this.needBeamsUpdate || ts.beamGroupSizes.length === 0) {
5741
+ return;
5742
+ }
5558
5743
  getVoiceIds().forEach((voiceId) => {
5559
- let symbols = this.getVoiceSymbols(voiceId);
5560
- if (symbols.length <= 2) {
5561
- return;
5562
- }
5563
- if (!DebugSettings.DisableBeams) {
5564
- let groupSymbols = [];
5744
+ let symbols = this.getVoiceSymbols(voiceId).slice();
5745
+ if (symbols.length >= 2) {
5746
+ let symbolsStartTicks = this.isUpBeat() ? Math.max(0, this.getMeasureTicks() - this.getConsumedTicks()) : 0;
5565
5747
  let groupStartTicks = 0;
5566
- let groupEndTicks = 0;
5567
- if (this.isUpBeat()) {
5568
- let startTicks = Math.max(0, this.getMeasureTicks() - this.getConsumedTicks());
5569
- groupStartTicks = groupEndTicks = startTicks;
5570
- }
5571
- let ts = this.getTimeSignature();
5572
- symbols.forEach((symbol) => {
5573
- groupSymbols.push(symbol);
5574
- groupEndTicks += symbol.rhythmProps.ticks;
5575
- if (groupStartTicks === 0 && groupEndTicks === ts.beamGroupLength) {
5576
- _ObjMeasure.setupBeamGroup(groupSymbols);
5577
- }
5578
- while (groupEndTicks >= ts.beamGroupLength) {
5579
- groupSymbols = [];
5580
- groupStartTicks = groupEndTicks = groupEndTicks - ts.beamGroupLength;
5748
+ for (let groupId = 0; groupId < ts.beamGroupSizes.length; groupId++) {
5749
+ let beamGroupSize = ts.beamGroupSizes[groupId];
5750
+ let groupSizeSum = 0;
5751
+ beamGroupSize.forEach((s) => groupSizeSum += s);
5752
+ let groupLength = groupSizeSum * NoteLengthProps4.get("8n").ticks;
5753
+ let groupSymbols = [];
5754
+ let groupSymbolsLength = 0;
5755
+ while (symbols.length > 0 && groupSymbolsLength < groupLength) {
5756
+ let symbol = symbols[0];
5757
+ if (symbol.col.positionTicks >= groupStartTicks) {
5758
+ groupSymbols.push(symbol);
5759
+ groupSymbolsLength += symbol.rhythmProps.ticks;
5760
+ symbols.shift();
5761
+ } else {
5762
+ break;
5763
+ }
5581
5764
  }
5582
- });
5765
+ _ObjMeasure.setupBeamGroup(groupSymbols, beamGroupSize);
5766
+ symbolsStartTicks += groupSymbolsLength;
5767
+ groupStartTicks += groupLength;
5768
+ }
5583
5769
  }
5584
5770
  });
5585
5771
  this.needBeamsUpdate = false;
5586
5772
  this.requestLayout();
5587
5773
  }
5588
- static setupBeamGroup(groupSymbols) {
5774
+ static setupBeamGroup(groupSymbols, mainBeamGroupSizeArr) {
5775
+ if (mainBeamGroupSizeArr.length === 0) {
5776
+ return false;
5777
+ }
5589
5778
  let groupNotes = groupSymbols.map((s) => {
5590
5779
  var _a;
5591
5780
  return s instanceof ObjNoteGroup && ((_a = s.getBeamGroup()) == null ? void 0 : _a.isTuplet()) !== true ? s : void 0;
5592
5781
  });
5593
5782
  ObjNoteGroup.setBeamCounts(groupNotes);
5594
- let beamNotes = [];
5595
- groupNotes.forEach((noteGroup) => {
5596
- if (noteGroup && noteGroup.hasBeamCount()) {
5597
- beamNotes.push(noteGroup);
5598
- } else {
5599
- ObjBeamGroup.createBeam(beamNotes);
5600
- beamNotes = [];
5601
- }
5602
- });
5603
- ObjBeamGroup.createBeam(beamNotes);
5783
+ let beamGroupSizeArrList = [mainBeamGroupSizeArr];
5784
+ if (mainBeamGroupSizeArr.length > 1) {
5785
+ let sum = 0;
5786
+ mainBeamGroupSizeArr.forEach((s) => sum += s);
5787
+ beamGroupSizeArrList.unshift([sum]);
5788
+ }
5789
+ let beamsCreated = false;
5790
+ while (beamGroupSizeArrList.length > 0 && !beamsCreated) {
5791
+ let beamGroupSizeArr = beamGroupSizeArrList.shift();
5792
+ let groupSymbolsCopy = groupSymbols.slice();
5793
+ beamGroupSizeArr.forEach((beamGroupSize) => {
5794
+ var _a;
5795
+ let beamGroupLength = beamGroupSize * NoteLengthProps4.get("8n").ticks;
5796
+ let beamNotesLength = 0;
5797
+ let beamNotes = [];
5798
+ while (beamNotesLength < beamGroupLength && groupSymbolsCopy.length > 0) {
5799
+ let symbol = groupSymbolsCopy.shift();
5800
+ beamNotesLength += symbol.rhythmProps.ticks;
5801
+ beamNotes.push(symbol instanceof ObjNoteGroup && ((_a = symbol.getBeamGroup()) == null ? void 0 : _a.isTuplet()) !== true ? symbol : void 0);
5802
+ }
5803
+ if (beamNotesLength === beamGroupLength && beamNotes.every((n) => n !== void 0) && (beamNotes.every((n) => n.rhythmProps.flagCount === 1) || beamGroupSizeArrList.length === 0)) {
5804
+ ObjBeamGroup.createBeam(beamNotes);
5805
+ beamsCreated = true;
5806
+ }
5807
+ });
5808
+ }
5809
+ return beamsCreated;
5604
5810
  }
5605
5811
  getBarLineLeft() {
5606
5812
  return this.barLineLeft;
@@ -5609,10 +5815,9 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5609
5815
  return this.barLineRight;
5610
5816
  }
5611
5817
  getVoiceSymbols(voiceId) {
5818
+ var _a, _b;
5612
5819
  validateVoiceId(voiceId);
5613
- if (this.voiceSymbols[voiceId] === void 0) {
5614
- this.voiceSymbols[voiceId] = [];
5615
- }
5820
+ (_b = (_a = this.voiceSymbols)[voiceId]) != null ? _b : _a[voiceId] = [];
5616
5821
  return this.voiceSymbols[voiceId];
5617
5822
  }
5618
5823
  completeRests(voiceId) {
@@ -5623,7 +5828,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5623
5828
  this.completeRests(getVoiceIds().filter((id) => this.getConsumedTicks(id) > 0));
5624
5829
  }
5625
5830
  return;
5626
- } else if (Utils10.Is.isArray(voiceId)) {
5831
+ } else if (Utils11.Is.isArray(voiceId)) {
5627
5832
  voiceId.forEach((id) => this.completeRests(id));
5628
5833
  return;
5629
5834
  } else {
@@ -5636,7 +5841,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5636
5841
  for (let noteSize = NoteLengthProps4.LongestNoteSize; noteSize <= NoteLengthProps4.ShortestNoteSize; noteSize *= 2) {
5637
5842
  let restLength = NoteLengthProps4.create(noteSize).noteLength;
5638
5843
  for (let dotCount = NoteLengthProps4.get(restLength).maxDotCount; dotCount >= 0; dotCount--) {
5639
- let restProps = RhythmProps4.get(restLength, dotCount);
5844
+ let restProps = RhythmProps5.get(restLength, dotCount);
5640
5845
  while (restProps.ticks <= remainingTicks) {
5641
5846
  rests.push(restProps);
5642
5847
  remainingTicks -= restProps.ticks;
@@ -5738,7 +5943,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5738
5943
  let columnsAreaLeft = this.rect.left + this.leftSolidAreaWidth;
5739
5944
  let columnsAreaRight = this.rect.right - this.rightSolidAreaWidth;
5740
5945
  let columnsAreaWidth = columnsAreaRight - columnsAreaLeft;
5741
- 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));
5742
5947
  let columnScale = columnsAreaWidth / columnsWidth;
5743
5948
  let columnLeft = columnsAreaLeft;
5744
5949
  this.columns.forEach((col) => {
@@ -5858,8 +6063,20 @@ var ObjMeasure2 = _ObjMeasure;
5858
6063
 
5859
6064
  // src/score/engine/layout-object.ts
5860
6065
  import { MusicError as MusicError14, MusicErrorType as MusicErrorType14 } from "@tspro/web-music-score/core";
5861
- var WidenColumnList = [1 /* NoteLabel */, 6 /* ChordLabel */];
5862
- 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
+ ];
5863
6080
  function requireParentMeasure(p) {
5864
6081
  while (p) {
5865
6082
  if (p instanceof ObjMeasure2) {
@@ -6219,7 +6436,7 @@ var ObjTab = class extends ObjNotationLine4 {
6219
6436
  __publicField(this, "tuningName");
6220
6437
  __publicField(this, "tuningStrings");
6221
6438
  __publicField(this, "mi");
6222
- if (Utils11.Is.isArray(tabConfig.tuning)) {
6439
+ if (Utils12.Is.isArray(tabConfig.tuning)) {
6223
6440
  this.tuningName = void 0;
6224
6441
  this.tuningStrings = tabConfig.tuning.map((noteName) => Note8.getNote(noteName)).reverse();
6225
6442
  } else if (typeof tabConfig.tuning === "string") {
@@ -6674,7 +6891,7 @@ var ObjHeader = class extends MusicObject {
6674
6891
  };
6675
6892
 
6676
6893
  // src/score/engine/obj-document.ts
6677
- import { Utils as Utils12 } from "@tspro/ts-utils-lib";
6894
+ import { Utils as Utils13 } from "@tspro/ts-utils-lib";
6678
6895
  var ObjDocument = class extends MusicObject {
6679
6896
  constructor() {
6680
6897
  super(void 0);
@@ -6695,7 +6912,7 @@ var ObjDocument = class extends MusicObject {
6695
6912
  return this.mi;
6696
6913
  }
6697
6914
  setScoreConfiguration(config) {
6698
- if (Utils12.Is.isEnumValue(config, StaffPreset)) {
6915
+ if (Utils13.Is.isEnumValue(config, StaffPreset)) {
6699
6916
  switch (config) {
6700
6917
  default:
6701
6918
  case "treble" /* Treble */:
@@ -6723,7 +6940,7 @@ var ObjDocument = class extends MusicObject {
6723
6940
  ];
6724
6941
  break;
6725
6942
  }
6726
- } else if (Utils12.Is.isArray(config)) {
6943
+ } else if (Utils13.Is.isArray(config)) {
6727
6944
  this.curScoreConfig = config;
6728
6945
  } else {
6729
6946
  this.curScoreConfig = [config];
@@ -6949,7 +7166,7 @@ var ObjDocument = class extends MusicObject {
6949
7166
  };
6950
7167
 
6951
7168
  // src/score/pub/document-builder.ts
6952
- import { KeySignature as KeySignature3, Note as Note10, NoteLength as NoteLength7, RhythmProps as RhythmProps5, Scale as Scale2, ScaleType, SymbolSet as SymbolSet2, TimeSignature as TimeSignature2, 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";
6953
7170
  import { MusicError as MusicError17, MusicErrorType as MusicErrorType17 } from "@tspro/web-music-score/core";
6954
7171
  function assertArg(condition, argName, argValue) {
6955
7172
  if (!condition) {
@@ -6965,56 +7182,64 @@ function isNote(note) {
6965
7182
  }
6966
7183
  }
6967
7184
  function isVoiceId(value) {
6968
- return Utils13.Is.isNumber(value) && getVoiceIds().indexOf(value) >= 0;
7185
+ return Utils14.Is.isNumber(value) && getVoiceIds().indexOf(value) >= 0;
6969
7186
  }
6970
7187
  function isStringNumber(value) {
6971
- 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;
6972
7192
  }
6973
7193
  function assertStaffConfig(staffConfig) {
6974
- assertArg(Utils13.Is.isObject(staffConfig), "staffConfig", staffConfig);
7194
+ assertArg(Utils14.Is.isObject(staffConfig), "staffConfig", staffConfig);
6975
7195
  assertArg(staffConfig.type === "staff", "staffConfig.type", staffConfig.type);
6976
- assertArg(Utils13.Is.isEnumValue(staffConfig.clef, Clef), "staffConfig.clef", staffConfig.clef);
6977
- assertArg(Utils13.Is.isBooleanOrUndefined(staffConfig.isOctaveDown), "staffConfig.isOctaveDown", staffConfig.isOctaveDown);
6978
- assertArg(Utils13.Is.isUndefined(staffConfig.minNote) || isNote(staffConfig.minNote), "staffConfig.minNote", staffConfig.minNote);
6979
- assertArg(Utils13.Is.isUndefined(staffConfig.maxNote) || isNote(staffConfig.maxNote), "staffConfig.maxNote", staffConfig.maxNote);
6980
- assertArg(Utils13.Is.isUndefined(staffConfig.voiceIds) || Utils13.Is.isArray(staffConfig.voiceIds) && staffConfig.voiceIds.every((voiceId) => Utils13.Is.isNumber(voiceId)), "staffConfig.voiceIds", staffConfig.voiceIds);
6981
- 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);
6982
7202
  }
6983
7203
  function assertTabConfig(tabConfig) {
6984
- assertArg(Utils13.Is.isObject(tabConfig), "tabConfig", tabConfig);
7204
+ assertArg(Utils14.Is.isObject(tabConfig), "tabConfig", tabConfig);
6985
7205
  assertArg(tabConfig.type === "tab", "tabConfig.type", tabConfig.type);
6986
7206
  if (typeof tabConfig.tuning === "string") {
6987
7207
  assertArg(TuningNameList.includes(tabConfig.tuning), "tabConfig.tuning", tabConfig.tuning);
6988
- } else if (Utils13.Is.isArray(tabConfig.tuning)) {
7208
+ } else if (Utils14.Is.isArray(tabConfig.tuning)) {
6989
7209
  assertArg(tabConfig.tuning.length === getStringNumbers().length && tabConfig.tuning.every((s) => isNote(s)), "tabConfig.tuning", tabConfig.tuning);
6990
7210
  }
6991
- 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)', "");
6992
7225
  }
6993
- function assertNoteOptions(options) {
6994
- assertArg(Utils13.Is.isObject(options), "noteOptions", options);
6995
- assertArg(Utils13.Is.isBooleanOrUndefined(options.dotted) || Utils13.Is.isIntegerGte(options.dotted, 0), "noteOptions.dotted", options.dotted);
6996
- assertArg(Utils13.Is.isEnumValueOrUndefined(options.stem, Stem), "noteOptions.stem", options.stem);
6997
- assertArg(Utils13.Is.isStringOrUndefined(options.color), "noteOptions.color", options.color);
6998
- assertArg(Utils13.Is.isBooleanOrUndefined(options.arpeggio) || Utils13.Is.isEnumValue(options.arpeggio, Arpeggio), "noteOptions.arpeggio", options.arpeggio);
6999
- assertArg(Utils13.Is.isBooleanOrUndefined(options.staccato), "noteOptions.staccato", options.staccato);
7000
- assertArg(Utils13.Is.isBooleanOrUndefined(options.diamond), "noteOptions.diamond", options.diamond);
7001
- assertArg(Utils13.Is.isBooleanOrUndefined(options.triplet), "noteOptions.triplet", options.triplet);
7002
- assertArg(Utils13.Is.isUndefined(options.string) || isStringNumber(options.string) || Utils13.Is.isNonEmptyArray(options.string) && options.string.every((string) => isStringNumber(string)), "noteOptions.string", options.string);
7003
- assertArg(Utils13.Is.isUndefined(options.tieSpan), 'NoteOptions.tieSpan was removed. Use addConnective("tie", tieSpan)', "");
7004
- 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);
7005
7233
  }
7006
- function assertRestOptions(options) {
7007
- assertArg(Utils13.Is.isObject(options), "restOptions", options);
7008
- assertArg(Utils13.Is.isBooleanOrUndefined(options.dotted) || Utils13.Is.isIntegerGte(options.dotted, 0), "restOptions.dotted", options.dotted);
7009
- assertArg(Utils13.Is.isStringOrUndefined(options.staffPos) || Utils13.Is.isInteger(options.staffPos) || options.staffPos instanceof Note10, "restOptions.staffPos", options.staffPos);
7010
- assertArg(Utils13.Is.isStringOrUndefined(options.color), "restOptions.color", options.color);
7011
- assertArg(Utils13.Is.isBooleanOrUndefined(options.hide), "restOptions.hide", options.hide);
7012
- 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);
7013
7238
  }
7014
7239
  function assertStaffTabOrGRoups(staffTabOrGroups) {
7015
7240
  assertArg(
7016
- Utils13.Is.isStringOrUndefined(staffTabOrGroups) || Utils13.Is.isIntegerGte(staffTabOrGroups, 0) || Utils13.Is.isNonEmptyArray(staffTabOrGroups) && staffTabOrGroups.every(
7017
- (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)
7018
7243
  ),
7019
7244
  "staffTabOrGroup",
7020
7245
  staffTabOrGroups
@@ -7022,7 +7247,7 @@ function assertStaffTabOrGRoups(staffTabOrGroups) {
7022
7247
  }
7023
7248
  function isNoteLength(noteLen) {
7024
7249
  try {
7025
- validateNoteLength2(noteLen);
7250
+ validateNoteLength3(noteLen);
7026
7251
  return true;
7027
7252
  } catch (e) {
7028
7253
  return false;
@@ -7042,22 +7267,23 @@ var DocumentBuilder = class {
7042
7267
  */
7043
7268
  constructor() {
7044
7269
  __publicField(this, "doc");
7270
+ __publicField(this, "currentLyricsAlign", "center" /* Center */);
7045
7271
  this.doc = new ObjDocument();
7046
7272
  }
7047
7273
  setScoreConfiguration(config) {
7048
- if (Utils13.Is.isEnumValue(config, StaffPreset)) {
7274
+ if (Utils14.Is.isEnumValue(config, StaffPreset)) {
7049
7275
  this.doc.setScoreConfiguration(config);
7050
- } else if (Utils13.Is.isObject(config) && config.type === "staff") {
7276
+ } else if (Utils14.Is.isObject(config) && config.type === "staff") {
7051
7277
  assertStaffConfig(config);
7052
7278
  this.doc.setScoreConfiguration(config);
7053
- } else if (Utils13.Is.isObject(config) && config.type === "tab") {
7279
+ } else if (Utils14.Is.isObject(config) && config.type === "tab") {
7054
7280
  assertTabConfig(config);
7055
7281
  this.doc.setScoreConfiguration(config);
7056
- } else if (Utils13.Is.isNonEmptyArray(config)) {
7282
+ } else if (Utils14.Is.isNonEmptyArray(config)) {
7057
7283
  config.forEach((c) => {
7058
- if (Utils13.Is.isObject(c) && c.type === "staff") {
7284
+ if (Utils14.Is.isObject(c) && c.type === "staff") {
7059
7285
  assertStaffConfig(c);
7060
- } else if (Utils13.Is.isObject(c) && c.type === "tab") {
7286
+ } else if (Utils14.Is.isObject(c) && c.type === "tab") {
7061
7287
  assertTabConfig(c);
7062
7288
  } else {
7063
7289
  assertArg(false, "config", config);
@@ -7088,9 +7314,9 @@ var DocumentBuilder = class {
7088
7314
  * @returns - This document builder instance.
7089
7315
  */
7090
7316
  setHeader(title, composer, arranger) {
7091
- assertArg(Utils13.Is.isStringOrUndefined(title), "title", title);
7092
- assertArg(Utils13.Is.isStringOrUndefined(composer), "composer", composer);
7093
- 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);
7094
7320
  this.doc.setHeader(title, composer, arranger);
7095
7321
  return this;
7096
7322
  }
@@ -7100,7 +7326,7 @@ var DocumentBuilder = class {
7100
7326
  * @returns - This document builder instance.
7101
7327
  */
7102
7328
  setMeasuresPerRow(measuresPerRow) {
7103
- 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);
7104
7330
  this.doc.setMeasuresPerRow(measuresPerRow);
7105
7331
  return this;
7106
7332
  }
@@ -7113,80 +7339,88 @@ var DocumentBuilder = class {
7113
7339
  return this;
7114
7340
  }
7115
7341
  setKeySignature(...args) {
7116
- 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);
7117
7343
  this.getMeasure().setKeySignature(...args);
7118
7344
  return this;
7119
7345
  }
7120
- /**
7121
- * Set time signature for current measure and forward.
7122
- * @param timeSignature - TimeSignature object instance or string (e.g. "3/4").
7123
- * @returns - This document builder instance.
7124
- */
7125
- setTimeSignature(timeSignature) {
7126
- assertArg(timeSignature instanceof TimeSignature2 || Utils13.Is.isNonEmptyString(timeSignature), "timeSignature", timeSignature);
7127
- this.getMeasure().setTimeSignature(timeSignature);
7346
+ setTimeSignature(...args) {
7347
+ if (args[0] instanceof TimeSignature2) {
7348
+ this.getMeasure().setTimeSignature(args[0]);
7349
+ } else if (Utils14.Is.isEnumValue(args[0], TimeSignatures) && Utils14.Is.isEnumValueOrUndefined(args[1], BeamGrouping)) {
7350
+ this.getMeasure().setTimeSignature(new TimeSignature2(args[0], args[1]));
7351
+ } else if (Utils14.Is.isIntegerGte(args[0], 1) && Utils14.Is.isIntegerGte(args[1], 1) && Utils14.Is.isEnumValueOrUndefined(args[2], BeamGrouping)) {
7352
+ this.getMeasure().setTimeSignature(new TimeSignature2(args[0], args[1], args[2]));
7353
+ } else {
7354
+ assertArg(false, "timeSignature args", args);
7355
+ }
7128
7356
  return this;
7129
7357
  }
7130
7358
  setTempo(beatsPerMinute, beatLength, dotted) {
7131
- assertArg(Utils13.Is.isIntegerGte(beatsPerMinute, 1), "beatsPerMinute", beatsPerMinute);
7359
+ assertArg(Utils14.Is.isIntegerGte(beatsPerMinute, 1), "beatsPerMinute", beatsPerMinute);
7132
7360
  if (beatLength === void 0) {
7133
- assertArg(Utils13.Is.isUndefined(dotted), "dotted", dotted);
7361
+ assertArg(Utils14.Is.isUndefined(dotted), "dotted", dotted);
7134
7362
  } else {
7135
- assertArg(Utils13.Is.isEnumValue(beatLength, NoteLength7) || isNoteLength(beatLength), "beatLength", beatLength);
7136
- 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);
7137
7365
  }
7138
7366
  this.getMeasure().setTempo(beatsPerMinute, beatLength, dotted);
7139
7367
  return this;
7140
7368
  }
7141
7369
  /**
7142
- * Add note o current measure.
7370
+ * Add note to current measure.
7143
7371
  * @param voiceId - Voice id to add note to.
7144
- * @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"]).
7145
7373
  * @param noteLength - Note length (e.g. "4n").
7146
- * @param options - Note options.
7374
+ * @param noteOptions - Note options.
7147
7375
  * @returns - This document builder instance.
7148
7376
  */
7149
- addNote(voiceId, note, noteLength, options) {
7377
+ addNote(voiceId, note, noteLength, noteOptions) {
7150
7378
  assertArg(isVoiceId(voiceId), "voiceId", voiceId);
7151
- assertArg(note instanceof Note10 || Utils13.Is.isNonEmptyString(note), "note", note);
7152
- assertArg(Utils13.Is.isEnumValue(noteLength, NoteLength7) || isNoteLength(noteLength), "noteLength", noteLength);
7153
- if (options !== void 0) {
7154
- 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);
7155
7391
  }
7156
- this.getMeasure().addNoteGroup(voiceId, [note], noteLength, options);
7157
7392
  return this;
7158
7393
  }
7159
7394
  /**
7395
+ * Add chord to current measure.
7160
7396
  * @param voiceId - Voice id to add chord to.
7161
7397
  * @param notes - Array of notes, each instance of Note or string (e.g. "D4").
7162
7398
  * @param noteLength - Note length (e.g. "4n").
7163
- * @param options - Note options.
7399
+ * @param noteOptions - Note options.
7164
7400
  * @returns - This document builder instance.
7165
7401
  */
7166
- addChord(voiceId, notes, noteLength, options) {
7402
+ addChord(voiceId, notes, noteLength, noteOptions) {
7167
7403
  assertArg(isVoiceId(voiceId), "voiceId", voiceId);
7168
- assertArg(Utils13.Is.isNonEmptyArray(notes) && notes.every((note) => note instanceof Note10 || Utils13.Is.isNonEmptyString(note)), "notes", notes);
7169
- assertArg(Utils13.Is.isEnumValue(noteLength, NoteLength7) || isNoteLength(noteLength), "noteLength", noteLength);
7170
- if (options !== void 0) {
7171
- assertNoteOptions(options);
7172
- }
7173
- 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);
7174
7409
  return this;
7175
7410
  }
7176
7411
  /**
7177
- *
7412
+ * Add rest to current measure.
7178
7413
  * @param voiceId - Voice id to add rest to.
7179
7414
  * @param restLength - Rest length (e.g. "4n").
7180
- * @param options - Rest options.
7415
+ * @param restOptions - Rest options.
7181
7416
  * @returns - This document builder instance.
7182
7417
  */
7183
- addRest(voiceId, restLength, options) {
7418
+ addRest(voiceId, restLength, restOptions) {
7184
7419
  assertArg(isVoiceId(voiceId), "voiceId", voiceId);
7185
- assertArg(Utils13.Is.isEnumValue(restLength, NoteLength7) || isNoteLength(restLength), "restLength", restLength);
7186
- if (options !== void 0) {
7187
- assertRestOptions(options);
7188
- }
7189
- 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);
7190
7424
  return this;
7191
7425
  }
7192
7426
  /**
@@ -7206,39 +7440,47 @@ var DocumentBuilder = class {
7206
7440
  */
7207
7441
  addTuplet(voiceId, tupletRatio, tupletBuilder) {
7208
7442
  assertArg(isVoiceId(voiceId), "voiceId", voiceId);
7209
- assertArg(Utils13.Is.isFunction(tupletBuilder), "tupletBuilder", tupletBuilder);
7210
- 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);
7211
7445
  let tupletSymbols = [];
7212
7446
  const helper = {
7213
- addNote: (note, noteLength, options) => {
7214
- assertArg(note instanceof Note10 || Utils13.Is.isNonEmptyString(note), "note", note);
7215
- assertArg(Utils13.Is.isEnumValue(noteLength, NoteLength7) || isNoteLength(noteLength), "noteLength", noteLength);
7216
- if (options !== void 0) {
7217
- delete options.triplet;
7218
- 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);
7219
7465
  }
7220
- let s = this.getMeasure().addNoteGroup(voiceId, [note], noteLength, options, tupletRatio);
7221
- tupletSymbols.push(s);
7222
7466
  return helper;
7223
7467
  },
7224
- addChord: (notes, noteLength, options) => {
7225
- assertArg(Utils13.Is.isNonEmptyArray(notes) && notes.every((note) => note instanceof Note10 || Utils13.Is.isNonEmptyString(note)), "notes", notes);
7226
- assertArg(Utils13.Is.isEnumValue(noteLength, NoteLength7) || isNoteLength(noteLength), "noteLength", noteLength);
7227
- if (options !== void 0) {
7228
- delete options.triplet;
7229
- assertNoteOptions(options);
7230
- }
7231
- 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);
7232
7475
  tupletSymbols.push(s);
7233
7476
  return helper;
7234
7477
  },
7235
- addRest: (restLength, options) => {
7236
- assertArg(Utils13.Is.isEnumValue(restLength, NoteLength7) || isNoteLength(restLength), "restLength", restLength);
7237
- if (options !== void 0) {
7238
- delete options.triplet;
7239
- assertRestOptions(options);
7240
- }
7241
- 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);
7242
7484
  tupletSymbols.push(s);
7243
7485
  return helper;
7244
7486
  }
@@ -7247,9 +7489,52 @@ var DocumentBuilder = class {
7247
7489
  ObjBeamGroup.createTuplet(tupletSymbols, tupletRatio);
7248
7490
  return this;
7249
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
+ }
7250
7535
  addFermataInternal(staffTabOrGroups, fermata) {
7251
7536
  assertStaffTabOrGRoups(staffTabOrGroups);
7252
- assertArg(Utils13.Is.isEnumValue(fermata, Fermata), "fermata", fermata);
7537
+ assertArg(Utils14.Is.isEnumValue(fermata, Fermata), "fermata", fermata);
7253
7538
  this.getMeasure().addFermata(staffTabOrGroups, fermata);
7254
7539
  return this;
7255
7540
  }
@@ -7272,11 +7557,11 @@ var DocumentBuilder = class {
7272
7557
  }
7273
7558
  addNavigationInternal(staffTabOrGroups, navigation, ...args) {
7274
7559
  assertStaffTabOrGRoups(staffTabOrGroups);
7275
- assertArg(Utils13.Is.isEnumValue(navigation, Navigation), "navigation", navigation);
7560
+ assertArg(Utils14.Is.isEnumValue(navigation, Navigation), "navigation", navigation);
7276
7561
  if (navigation === "endRepeat" /* EndRepeat */ && args.length > 0) {
7277
- assertArg(Utils13.Is.isIntegerGte(args[0], 1), "playCount", args[0]);
7562
+ assertArg(Utils14.Is.isIntegerGte(args[0], 1), "playCount", args[0]);
7278
7563
  } else if (navigation === "ending" /* Ending */ && args.length > 0) {
7279
- assertArg(args.every((passage) => Utils13.Is.isIntegerGte(passage, 1)), "passages", args);
7564
+ assertArg(args.every((passage) => Utils14.Is.isIntegerGte(passage, 1)), "passages", args);
7280
7565
  }
7281
7566
  this.getMeasure().addNavigation(staffTabOrGroups, navigation, ...args);
7282
7567
  return this;
@@ -7293,8 +7578,8 @@ var DocumentBuilder = class {
7293
7578
  throw new MusicError17(MusicErrorType17.Score, `Annotation text "${text}" is not known annotation.`);
7294
7579
  }
7295
7580
  assertStaffTabOrGRoups(staffTabOrGroups);
7296
- assertArg(Utils13.Is.isEnumValue(annotation, Annotation), "annotation", annotation);
7297
- assertArg(Utils13.Is.isNonEmptyString(text), "text", text);
7581
+ assertArg(Utils14.Is.isEnumValue(annotation, Annotation), "annotation", annotation);
7582
+ assertArg(Utils14.Is.isNonEmptyString(text), "text", text);
7298
7583
  this.getMeasure().addAnnotation(staffTabOrGroups, annotation, text);
7299
7584
  return this;
7300
7585
  }
@@ -7314,8 +7599,8 @@ var DocumentBuilder = class {
7314
7599
  }
7315
7600
  addLabelInternal(staffTabOrGroups, label, text) {
7316
7601
  assertStaffTabOrGRoups(staffTabOrGroups);
7317
- assertArg(Utils13.Is.isEnumValue(label, Label), "label", label);
7318
- assertArg(Utils13.Is.isNonEmptyString(text), "text", text);
7602
+ assertArg(Utils14.Is.isEnumValue(label, Label), "label", label);
7603
+ assertArg(Utils14.Is.isNonEmptyString(text), "text", text);
7319
7604
  this.getMeasure().addLabel(staffTabOrGroups, label, text);
7320
7605
  return this;
7321
7606
  }
@@ -7339,21 +7624,21 @@ var DocumentBuilder = class {
7339
7624
  return this.addLabelInternal(staffTabOrGroups, label, text);
7340
7625
  }
7341
7626
  addConnective(connective, ...args) {
7342
- assertArg(Utils13.Is.isEnumValue(connective, Connective), "connective", connective);
7627
+ assertArg(Utils14.Is.isEnumValue(connective, Connective), "connective", connective);
7343
7628
  if (connective === "tie" /* Tie */) {
7344
- assertArg(Utils13.Is.isIntegerOrUndefined(args[0]) || Utils13.Is.isEnumValue(args[0], TieType), "tieSpan", args[0]);
7345
- 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]);
7346
7631
  let tieSpan = args[0];
7347
7632
  let noteAnchor = args[1];
7348
7633
  this.getMeasure().addConnective(connective, tieSpan, noteAnchor);
7349
7634
  } else if (connective === "slur" /* Slur */) {
7350
- assertArg(Utils13.Is.isIntegerOrUndefined(args[0]), "slurSpan", args[0]);
7351
- 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]);
7352
7637
  let slurSpan = args[0];
7353
7638
  let noteAnchor = args[1];
7354
7639
  this.getMeasure().addConnective(connective, slurSpan, noteAnchor);
7355
7640
  } else if (connective === "slide" /* Slide */) {
7356
- assertArg(Utils13.Is.isEnumValueOrUndefined(args[0], NoteAnchor), "noteAnchor", args[0]);
7641
+ assertArg(Utils14.Is.isEnumValueOrUndefined(args[0], NoteAnchor), "noteAnchor", args[0]);
7357
7642
  let noteAnchor = args[0];
7358
7643
  this.getMeasure().addConnective(connective, noteAnchor);
7359
7644
  }
@@ -7372,18 +7657,18 @@ var DocumentBuilder = class {
7372
7657
  * @returns - This document builder instance.
7373
7658
  */
7374
7659
  addExtension(extensionBuilder) {
7375
- 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);
7376
7661
  let ticks = 0;
7377
7662
  let visible = true;
7378
7663
  const helper = {
7379
7664
  notes: (noteLength, noteCount) => {
7380
- assertArg(Utils13.Is.isEnumValue(noteLength, NoteLength7) || isNoteLength(noteLength), "noteLength", noteLength);
7381
- assertArg(Utils13.Is.isUndefined(noteCount) || Utils13.Is.isNumber(noteCount) && noteCount >= 0, "noteCount", noteCount);
7382
- 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);
7383
7668
  return helper;
7384
7669
  },
7385
7670
  measures: (measureCount) => {
7386
- assertArg(Utils13.Is.isNumber(measureCount) && measureCount >= 1, "measureCount", measureCount);
7671
+ assertArg(Utils14.Is.isNumber(measureCount) && measureCount >= 1, "measureCount", measureCount);
7387
7672
  ticks += this.getMeasure().getMeasureTicks() * measureCount;
7388
7673
  return helper;
7389
7674
  },
@@ -7412,13 +7697,13 @@ var DocumentBuilder = class {
7412
7697
  * @returns - This document builder instance.
7413
7698
  */
7414
7699
  addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition = "auto" /* Auto */) {
7415
- assertArg(Utils13.Is.isNonEmptyString(groupName), "groupName", groupName);
7700
+ assertArg(Utils14.Is.isNonEmptyString(groupName), "groupName", groupName);
7416
7701
  assertArg(
7417
- 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)),
7418
7703
  "staffsTabsAndGroups",
7419
7704
  staffsTabsAndGroups
7420
7705
  );
7421
- assertArg(Utils13.Is.isEnumValue(verticalPosition, VerticalPosition), "verticalPosition", verticalPosition);
7706
+ assertArg(Utils14.Is.isEnumValue(verticalPosition, VerticalPosition), "verticalPosition", verticalPosition);
7422
7707
  this.doc.addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition);
7423
7708
  return this;
7424
7709
  }
@@ -7453,7 +7738,7 @@ var DocumentBuilder = class {
7453
7738
  * @returns - This document builder instance.
7454
7739
  */
7455
7740
  completeRests(voiceId) {
7456
- 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);
7457
7742
  this.getMeasure().completeRests(voiceId);
7458
7743
  return this;
7459
7744
  }
@@ -7465,8 +7750,8 @@ var DocumentBuilder = class {
7465
7750
  * @returns - This document builder instance.
7466
7751
  */
7467
7752
  addScaleArpeggio(scale, bottomNote, numOctaves) {
7468
- assertArg(Utils13.Is.isNonEmptyString(bottomNote), "bottomNote", bottomNote);
7469
- 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);
7470
7755
  let ts = this.getMeasure().getTimeSignature();
7471
7756
  let notes = scale.getScaleNotes(bottomNote, numOctaves);
7472
7757
  for (let i = 0; i < notes.length; i++) {
@@ -7538,10 +7823,10 @@ var ScoreObjectEvent = class extends ScoreEvent {
7538
7823
 
7539
7824
  // src/score/pub/music-interface.ts
7540
7825
  import * as Audio2 from "@tspro/web-music-score/audio";
7541
- import { Utils as Utils15 } from "@tspro/ts-utils-lib";
7826
+ import { Utils as Utils16 } from "@tspro/ts-utils-lib";
7542
7827
 
7543
7828
  // src/score/pub/music-objects.ts
7544
- import { Utils as Utils14 } from "@tspro/ts-utils-lib";
7829
+ import { Utils as Utils15 } from "@tspro/ts-utils-lib";
7545
7830
  import { MusicError as MusicError19, MusicErrorType as MusicErrorType19 } from "@tspro/web-music-score/core";
7546
7831
  function assertArg2(condition, argName, argValue) {
7547
7832
  if (!condition) {
@@ -7549,7 +7834,7 @@ function assertArg2(condition, argName, argValue) {
7549
7834
  }
7550
7835
  }
7551
7836
  function isVoiceId2(value) {
7552
- return Utils14.Is.isNumber(value) && getVoiceIds().indexOf(value) >= 0;
7837
+ return Utils15.Is.isNumber(value) && getVoiceIds().indexOf(value) >= 0;
7553
7838
  }
7554
7839
  function getNotationLine(line) {
7555
7840
  if (line instanceof ObjStaff || line instanceof ObjTab) {
@@ -7725,7 +8010,7 @@ var _MDocument = class _MDocument extends MusicInterface6 {
7725
8010
  * @returns - Player instance.
7726
8011
  */
7727
8012
  play(playStateChangeListener) {
7728
- assertArg2(Utils14.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
8013
+ assertArg2(Utils15.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
7729
8014
  return new MPlayer(this, playStateChangeListener).play();
7730
8015
  }
7731
8016
  };
@@ -7755,7 +8040,7 @@ var _MEnding = class _MEnding extends MusicInterface6 {
7755
8040
  * @returns - Boolean whether this ending has asked passage number.
7756
8041
  */
7757
8042
  hasPassage(passage) {
7758
- assertArg2(Utils14.Is.isIntegerGte(passage, 1), "passage", passage);
8043
+ assertArg2(Utils15.Is.isIntegerGte(passage, 1), "passage", passage);
7759
8044
  return this.obj.hasPassage(passage);
7760
8045
  }
7761
8046
  };
@@ -8334,6 +8619,27 @@ var _MText = class _MText extends MusicInterface6 {
8334
8619
  /** Object name. */
8335
8620
  __publicField(_MText, "Name", "Text");
8336
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;
8337
8643
  var _MExtensionLine = class _MExtensionLine extends MusicInterface6 {
8338
8644
  /** @internal */
8339
8645
  constructor(obj) {
@@ -8372,7 +8678,7 @@ var _MPlayer = class _MPlayer {
8372
8678
  constructor(doc, playStateChangeListener) {
8373
8679
  __publicField(this, "player");
8374
8680
  assertArg3(doc instanceof MDocument2, "doc", doc);
8375
- assertArg3(Utils15.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
8681
+ assertArg3(Utils16.Is.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
8376
8682
  this.player = new Player();
8377
8683
  this.player.setDocument(doc.getMusicObject());
8378
8684
  this.player.setCursorPositionChangeListener((cursorRect) => doc.getMusicObject().updateCursorRect(cursorRect));
@@ -8430,7 +8736,7 @@ var MRenderer2 = class {
8430
8736
  * @returns - This renderer instance.
8431
8737
  */
8432
8738
  setDocument(doc) {
8433
- assertArg3(Utils15.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
8739
+ assertArg3(Utils16.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
8434
8740
  this.renderer.setDocument(doc);
8435
8741
  return this;
8436
8742
  }
@@ -8440,7 +8746,7 @@ var MRenderer2 = class {
8440
8746
  * @returns - This renderer instance.
8441
8747
  */
8442
8748
  setCanvas(canvas) {
8443
- 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.");
8444
8750
  this.renderer.setCanvas(canvas);
8445
8751
  return this;
8446
8752
  }
@@ -8449,7 +8755,7 @@ var MRenderer2 = class {
8449
8755
  * @param scoreEventListener - Score event listener.
8450
8756
  */
8451
8757
  setScoreEventListener(scoreEventListener) {
8452
- assertArg3(Utils15.Is.isFunctionOrUndefined(scoreEventListener), "scoreEventListener", scoreEventListener);
8758
+ assertArg3(Utils16.Is.isFunctionOrUndefined(scoreEventListener), "scoreEventListener", scoreEventListener);
8453
8759
  this.renderer.setScoreEventListener(scoreEventListener);
8454
8760
  }
8455
8761
  /**
@@ -8523,7 +8829,7 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8523
8829
  * @returns
8524
8830
  */
8525
8831
  setDocument(doc) {
8526
- assertArg3(Utils15.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
8832
+ assertArg3(Utils16.Is.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
8527
8833
  this.onStop();
8528
8834
  if (doc) {
8529
8835
  this.player = new MPlayer(doc, (playState) => {
@@ -8567,9 +8873,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8567
8873
  * @returns - This playback buttons class instance.
8568
8874
  */
8569
8875
  setPlayButton(btn, btnLabel) {
8570
- assertArg3(Utils15.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8876
+ assertArg3(Utils16.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8571
8877
  _MPlaybackButtons.removeOnClickListeners(this.playButton, this.onPlay);
8572
- this.playButton = require_t(Utils15.Dom.getButton(btn), "Play button required!");
8878
+ this.playButton = require_t(Utils16.Dom.getButton(btn), "Play button required!");
8573
8879
  this.playLabel = btnLabel != null ? btnLabel : "Play";
8574
8880
  _MPlaybackButtons.removeOnClickListeners(this.playButton, "all");
8575
8881
  _MPlaybackButtons.addOnClickListener(this.playButton, this.onPlay);
@@ -8583,9 +8889,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8583
8889
  * @returns - This playback buttons class instance.
8584
8890
  */
8585
8891
  setStopButton(btn, btnLabel) {
8586
- assertArg3(Utils15.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8892
+ assertArg3(Utils16.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8587
8893
  _MPlaybackButtons.removeOnClickListeners(this.stopButton, this.onStop);
8588
- this.stopButton = require_t(Utils15.Dom.getButton(btn), "Stop button required!");
8894
+ this.stopButton = require_t(Utils16.Dom.getButton(btn), "Stop button required!");
8589
8895
  this.stopLabel = btnLabel != null ? btnLabel : "Stop";
8590
8896
  _MPlaybackButtons.removeOnClickListeners(this.stopButton, "all");
8591
8897
  _MPlaybackButtons.addOnClickListener(this.stopButton, this.onStop);
@@ -8600,10 +8906,10 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8600
8906
  * @returns - This playback buttons class instance.
8601
8907
  */
8602
8908
  setPlayStopButton(btn, playLabel, stopLabel) {
8603
- assertArg3(Utils15.Is.isStringOrUndefined(playLabel), "playLabel", playLabel);
8604
- assertArg3(Utils15.Is.isStringOrUndefined(stopLabel), "stopLabel", stopLabel);
8909
+ assertArg3(Utils16.Is.isStringOrUndefined(playLabel), "playLabel", playLabel);
8910
+ assertArg3(Utils16.Is.isStringOrUndefined(stopLabel), "stopLabel", stopLabel);
8605
8911
  _MPlaybackButtons.removeOnClickListeners(this.playStopButton, this.onPlayStop);
8606
- 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!");
8607
8913
  this.playLabel = playLabel != null ? playLabel : "Play";
8608
8914
  this.stopLabel = stopLabel != null ? stopLabel : "Stop";
8609
8915
  _MPlaybackButtons.removeOnClickListeners(this.playStopButton, "all");
@@ -8618,9 +8924,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8618
8924
  * @returns - This playback buttons class instance.
8619
8925
  */
8620
8926
  setPauseButton(btn, btnLabel) {
8621
- assertArg3(Utils15.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8927
+ assertArg3(Utils16.Is.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
8622
8928
  _MPlaybackButtons.removeOnClickListeners(this.pauseButton, this.onPause);
8623
- this.pauseButton = require_t(Utils15.Dom.getButton(btn), "Pause button required!");
8929
+ this.pauseButton = require_t(Utils16.Dom.getButton(btn), "Pause button required!");
8624
8930
  this.pauseLabel = btnLabel != null ? btnLabel : "Pause";
8625
8931
  _MPlaybackButtons.removeOnClickListeners(this.pauseButton, "all");
8626
8932
  _MPlaybackButtons.addOnClickListener(this.pauseButton, this.onPause);
@@ -8642,7 +8948,7 @@ var _MPlaybackButtons = class _MPlaybackButtons {
8642
8948
  }
8643
8949
  }
8644
8950
  static addOnClickListener(btn, onClick) {
8645
- assertArg3(Utils15.Is.isFunction(onClick), "onClick", onClick);
8951
+ assertArg3(Utils16.Is.isFunction(onClick), "onClick", onClick);
8646
8952
  btn.addEventListener("click", onClick);
8647
8953
  let clickListeners = this.savedOnClickListeners.get(btn) || [];
8648
8954
  this.savedOnClickListeners.set(btn, [...clickListeners, onClick]);
@@ -8664,6 +8970,8 @@ export {
8664
8970
  DynamicsAnnotation,
8665
8971
  Fermata,
8666
8972
  Label,
8973
+ LyricsAlign,
8974
+ LyricsHyphen,
8667
8975
  MAccidental,
8668
8976
  MArpeggio,
8669
8977
  MBarLineLeft,
@@ -8676,6 +8984,7 @@ export {
8676
8984
  MFermata,
8677
8985
  MHeader,
8678
8986
  MImage,
8987
+ MLyrics,
8679
8988
  MMeasure,
8680
8989
  MNoteGroup,
8681
8990
  MPlaybackButtons,
@@ -8707,6 +9016,7 @@ export {
8707
9016
  TieType,
8708
9017
  VerticalPosition,
8709
9018
  getStringNumbers,
9019
+ getVerseNumbers,
8710
9020
  getVoiceIds
8711
9021
  };
8712
9022
  //# sourceMappingURL=index.mjs.map