@tspro/web-music-score 5.4.2 → 5.5.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 (43) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +24 -0
  3. package/README.md +13 -6
  4. package/dist/audio/index.d.ts +1 -1
  5. package/dist/audio/index.js +1637 -5
  6. package/dist/audio/index.mjs +9 -6
  7. package/dist/audio-cg/index.js +17487 -46
  8. package/dist/audio-cg/index.mjs +7 -5
  9. package/dist/audio-synth/index.js +18434 -32
  10. package/dist/audio-synth/index.mjs +12 -7
  11. package/dist/{chunk-MMWSQGVR.mjs → chunk-2DCCUAGC.mjs} +3 -3
  12. package/dist/{chunk-CVYTUTL6.mjs → chunk-2PEB4HWS.mjs} +2 -2
  13. package/dist/{chunk-42IBAVOC.mjs → chunk-33HIE3HR.mjs} +18 -13
  14. package/dist/chunk-BMKUAUSJ.mjs +101 -0
  15. package/dist/chunk-PCQGQM63.mjs +18381 -0
  16. package/dist/chunk-T6TYLAJE.mjs +3766 -0
  17. package/dist/core/index.js +2 -2
  18. package/dist/core/index.mjs +4 -4
  19. package/dist/{guitar-CNOxM4ZK.d.ts → guitar-CarHGDAt.d.ts} +1 -1
  20. package/dist/iife/audio-cg.global.js +1 -1
  21. package/dist/iife/index.global.js +11 -11
  22. package/dist/{music-objects-DqoO-Sfv.d.mts → music-objects-CcJvZxS6.d.mts} +123 -96
  23. package/dist/{music-objects-T8u8bnNP.d.ts → music-objects-l5Ai97QA.d.ts} +125 -98
  24. package/dist/{note-RVXvpfyV.d.ts → note-CJuq5aBy.d.ts} +1 -1
  25. package/dist/pieces/index.d.mts +12 -6
  26. package/dist/pieces/index.d.ts +14 -8
  27. package/dist/pieces/index.js +25 -13
  28. package/dist/pieces/index.mjs +25 -14
  29. package/dist/react-ui/index.d.mts +1 -1
  30. package/dist/react-ui/index.d.ts +5 -5
  31. package/dist/react-ui/index.js +2163 -22
  32. package/dist/react-ui/index.mjs +18 -15
  33. package/dist/{scale-CUYFBo-8.d.ts → scale-DulPFco_.d.ts} +2 -2
  34. package/dist/score/index.d.mts +51 -3
  35. package/dist/score/index.d.ts +54 -6
  36. package/dist/score/index.js +4828 -872
  37. package/dist/score/index.mjs +1280 -729
  38. package/dist/{tempo-DwuZsv2T.d.ts → tempo-BnUjm25M.d.ts} +1 -1
  39. package/dist/theory/index.d.ts +6 -6
  40. package/dist/theory/index.js +2576 -136
  41. package/dist/theory/index.mjs +41 -49
  42. package/package.json +4 -5
  43. package/dist/chunk-ROBXPR34.mjs +0 -9
@@ -1,18 +1,126 @@
1
- /* WebMusicScore v5.4.2 | (c) 2023-2025 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v5.5.0 | (c) 2023-2025 PahkaSoft | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
2
2
  import {
3
3
  MusicError
4
- } from "../chunk-MMWSQGVR.mjs";
4
+ } from "../chunk-2DCCUAGC.mjs";
5
5
  import {
6
6
  NoteLengthProps,
7
7
  RhythmProps,
8
8
  validateNoteLength
9
- } from "../chunk-42IBAVOC.mjs";
9
+ } from "../chunk-33HIE3HR.mjs";
10
10
  import {
11
- __publicField
12
- } from "../chunk-ROBXPR34.mjs";
11
+ AnchoredRect,
12
+ BiMap,
13
+ IndexArray,
14
+ Rect,
15
+ TriMap,
16
+ UniMap,
17
+ ValueSet,
18
+ Vec,
19
+ asMulti,
20
+ device_exports,
21
+ guard_exports,
22
+ utils_exports
23
+ } from "../chunk-T6TYLAJE.mjs";
24
+ import {
25
+ __publicField,
26
+ __spreadProps,
27
+ __spreadValues
28
+ } from "../chunk-BMKUAUSJ.mjs";
29
+
30
+ // src/score/engine/settings.ts
31
+ var DebugSettings = {
32
+ DrawDebugRects: false,
33
+ DisableBeams: false
34
+ };
35
+ var DocumentSettings = {
36
+ DocumentScale: 1,
37
+ MinStaffWidth: 75,
38
+ MinColumnsWidth: 10,
39
+ ColumnWidthScale: 1.7,
40
+ PostMeasureBreakWidth: 10,
41
+ NoteDotSpace: 0.5,
42
+ NoteAccSpace: 0.5,
43
+ NoteHeadWidth: 2,
44
+ NoteHeadHeight: 1.3,
45
+ DiamondNoteHeadSize: 1.8,
46
+ DotSize: 0.8,
47
+ StemHeight: 7,
48
+ // One octave
49
+ FlagWidth: 1.5,
50
+ FlagHeight: 4,
51
+ FlagSeparation: 2,
52
+ BeamSeparation: 1.25,
53
+ BeamAngleFactor: 0.5,
54
+ BeamThickness: 4,
55
+ RestDotSpace: 0.5,
56
+ LedgerLineWidth: 3.6,
57
+ StubTieLength: 5,
58
+ StaffHeight: 8,
59
+ TabHeight: 20
60
+ };
61
+ var DocumentColor = {
62
+ HilightStaffPos: "#55cc55",
63
+ HilightObject: "#55cc55",
64
+ PlayCursor: "#44aa44",
65
+ Background: "white",
66
+ Header_Title: "black",
67
+ Header_Composer: "black",
68
+ Header_Arranger: "black",
69
+ RowGroup_Instrument: "black",
70
+ RowGroup_Frame: "black",
71
+ Staff_Frame: "black",
72
+ Staff_Note: "black",
73
+ Staff_Rest: "black",
74
+ Staff_Connective: "black",
75
+ Staff_Signature_Clef: "black",
76
+ Staff_Signature_Key: "black",
77
+ Staff_Signature_Time: "black",
78
+ Staff_Signature_Tempo: "black",
79
+ Staff_Signature_MeasureNum: "black",
80
+ Staff_Element_Fermata: "black",
81
+ Staff_Element_Annotation: "black",
82
+ Staff_Element_Navigation: "black",
83
+ Staff_Element_Label: "black",
84
+ Tab_Frame: "black",
85
+ Tab_Note: "black",
86
+ Tab_Rest: "black",
87
+ Tab_Connective: "black",
88
+ Tab_Tuning: "black",
89
+ //Tab_Signature_Clef: "black",
90
+ //Tab_Signature_Key: "black",
91
+ Tab_Signature_Time: "black",
92
+ Tab_Signature_Tempo: "black",
93
+ Tab_Signature_MeasureNum: "black",
94
+ Tab_Element_Fermata: "black",
95
+ Tab_Element_Annotation: "black",
96
+ Tab_Element_Navigation: "black",
97
+ Tab_Element_Label: "black"
98
+ };
99
+
100
+ // src/score/pub/color.ts
101
+ function eq(a, b) {
102
+ return a.toLocaleLowerCase() === b.toLocaleLowerCase();
103
+ }
104
+ function setColor(color, ...colorAttrs) {
105
+ const setBacground = colorAttrs.length === 1 && eq(colorAttrs[0], "background");
106
+ const setAllColors = colorAttrs.length === 0;
107
+ if (eq(color, ""))
108
+ color = setBacground ? "white" : "black";
109
+ let noMatch = true;
110
+ for (const key in DocumentColor) {
111
+ const keyAttrs = key.split("_");
112
+ const isColorMatch = colorAttrs.length > 0 && colorAttrs.every((a) => keyAttrs.some((b) => eq(a, b)));
113
+ const isBgColorMatch = keyAttrs.length === 1 && eq(keyAttrs[0], "background");
114
+ if (setAllColors && !isBgColorMatch || isColorMatch) {
115
+ DocumentColor[key] = color;
116
+ noMatch = false;
117
+ }
118
+ }
119
+ if (noMatch)
120
+ console.error(`Color attrs ${utils_exports.Str.stringify(colorAttrs)} did not match any color.`);
121
+ }
13
122
 
14
123
  // src/score/pub/div-rect.ts
15
- import { Utils } from "@tspro/ts-utils-lib";
16
124
  var DivRect = class _DivRect {
17
125
  constructor(...args) {
18
126
  __publicField(this, "left");
@@ -284,10 +392,10 @@ var DivRect = class _DivRect {
284
392
  clipInPlace(clipRect) {
285
393
  this.left = Math.max(this.left, clipRect.left);
286
394
  this.right = Math.min(this.right, clipRect.right);
287
- this.anchorX = Utils.Math.clamp(this.anchorX, this.left, this.right);
395
+ this.anchorX = utils_exports.Math.clamp(this.anchorX, this.left, this.right);
288
396
  this.top = Math.max(this.top, clipRect.top);
289
397
  this.bottom = Math.min(this.bottom, clipRect.bottom);
290
- this.anchorY = Utils.Math.clamp(this.anchorY, this.top, this.bottom);
398
+ this.anchorY = utils_exports.Math.clamp(this.anchorY, this.top, this.bottom);
291
399
  return this;
292
400
  }
293
401
  /**
@@ -333,11 +441,7 @@ var DivRect = class _DivRect {
333
441
  }
334
442
  };
335
443
 
336
- // src/score/pub/document-builder.ts
337
- import { Guard as Guard12, Utils as Utils12 } from "@tspro/ts-utils-lib";
338
-
339
444
  // src/score/pub/types.ts
340
- import { Guard } from "@tspro/ts-utils-lib";
341
445
  var StaffPreset = /* @__PURE__ */ ((StaffPreset2) => {
342
446
  StaffPreset2["Treble"] = "treble";
343
447
  StaffPreset2["Bass"] = "bass";
@@ -356,7 +460,7 @@ function getVoiceIds() {
356
460
  return [0, 1, 2, 3];
357
461
  }
358
462
  function isVoiceId(voiceId) {
359
- return Guard.isIncluded(voiceId, getVoiceIds());
463
+ return guard_exports.isIncluded(voiceId, getVoiceIds());
360
464
  }
361
465
  function validateVoiceId(voiceId) {
362
466
  if (isVoiceId(voiceId)) {
@@ -369,7 +473,7 @@ function getStringNumbers() {
369
473
  return [1, 2, 3, 4, 5, 6];
370
474
  }
371
475
  function isStringNumber(stringNum) {
372
- return Guard.isIncluded(stringNum, getStringNumbers());
476
+ return guard_exports.isIncluded(stringNum, getStringNumbers());
373
477
  }
374
478
  function validateStringNumber(stringNum) {
375
479
  if (isStringNumber(stringNum)) {
@@ -382,7 +486,7 @@ function getVerseNumbers() {
382
486
  return [1, 2, 3];
383
487
  }
384
488
  function isVerseNumber(verse) {
385
- return Guard.isIncluded(verse, getVerseNumbers());
489
+ return guard_exports.isIncluded(verse, getVerseNumbers());
386
490
  }
387
491
  function validateVerseNumber(verseNum) {
388
492
  if (isVerseNumber(verseNum)) {
@@ -497,7 +601,6 @@ var PlayState = /* @__PURE__ */ ((PlayState2) => {
497
601
  })(PlayState || {});
498
602
 
499
603
  // src/score/engine/music-object.ts
500
- import { AnchoredRect } from "@tspro/ts-utils-lib";
501
604
  var MusicObjectLink = class {
502
605
  constructor(head) {
503
606
  __publicField(this, "head");
@@ -526,6 +629,7 @@ var MusicObject = class {
526
629
  this.parent = parent;
527
630
  __publicField(this, "anchoredLayoutObjects", []);
528
631
  __publicField(this, "link");
632
+ __publicField(this, "userData", {});
529
633
  __publicField(this, "rect", new AnchoredRect());
530
634
  __publicField(this, "needRectUpdate", true);
531
635
  }
@@ -616,58 +720,411 @@ import { Note as Note9 } from "@tspro/web-music-score/theory";
616
720
  // src/score/engine/obj-staff-and-tab.ts
617
721
  import { getTuningStrings, Note as Note8, validateTuningName } from "@tspro/web-music-score/theory";
618
722
 
619
- // src/score/engine/render-context.ts
620
- import { Utils as Utils2, Vec, Device, UniMap, AnchoredRect as AnchoredRect2 } from "@tspro/ts-utils-lib";
723
+ // node_modules/color-name-to-code/dist/color-name.enum.js
724
+ var ColorName;
725
+ (function(ColorName2) {
726
+ ColorName2["AliceBlue"] = "aliceblue";
727
+ ColorName2["AntiqueWhite"] = "antiquewhite";
728
+ ColorName2["Aqua"] = "aqua";
729
+ ColorName2["Aquamarine"] = "aquamarine";
730
+ ColorName2["Azure"] = "azure";
731
+ ColorName2["Beige"] = "beige";
732
+ ColorName2["Bisque"] = "bisque";
733
+ ColorName2["Black"] = "black";
734
+ ColorName2["BlanchedAlmond"] = "blanchedalmond";
735
+ ColorName2["Blue"] = "blue";
736
+ ColorName2["BlueViolet"] = "blueviolet";
737
+ ColorName2["Brown"] = "brown";
738
+ ColorName2["BurlyWood"] = "burlywood";
739
+ ColorName2["CadetBlue"] = "cadetblue";
740
+ ColorName2["Chartreuse"] = "chartreuse";
741
+ ColorName2["Chocolate"] = "chocolate";
742
+ ColorName2["Coral"] = "coral";
743
+ ColorName2["CornflowerBlue"] = "cornflowerblue";
744
+ ColorName2["CornSilk"] = "cornsilk";
745
+ ColorName2["Crimson"] = "crimson";
746
+ ColorName2["Cyan"] = "cyan";
747
+ ColorName2["DarkBlue"] = "darkblue";
748
+ ColorName2["DarkCyan"] = "darkcyan";
749
+ ColorName2["DarkGoldenRod"] = "darkgoldenrod";
750
+ ColorName2["DarkGray"] = "darkgray";
751
+ ColorName2["DarkGreen"] = "darkgreen";
752
+ ColorName2["DarkGrey"] = "darkgrey";
753
+ ColorName2["DarkKhaki"] = "darkkhaki";
754
+ ColorName2["DarkMagenta"] = "darkmagenta";
755
+ ColorName2["DarkOliveGreen"] = "darkolivegreen";
756
+ ColorName2["DarkOrange"] = "darkorange";
757
+ ColorName2["DarkOrchid"] = "darkorchid";
758
+ ColorName2["DarkRed"] = "darkred";
759
+ ColorName2["DarkSalmon"] = "darksalmon";
760
+ ColorName2["DarkSeaGreen"] = "darkseagreen";
761
+ ColorName2["DarkSlateBlue"] = "darkslateblue";
762
+ ColorName2["DarkSlateGray"] = "darkslategray";
763
+ ColorName2["DarkSlateGrey"] = "darkslategrey";
764
+ ColorName2["DarkTurquoise"] = "darkturquoise";
765
+ ColorName2["DarkViolet"] = "darkviolet";
766
+ ColorName2["DeepPink"] = "deeppink";
767
+ ColorName2["DeepSkyBlue"] = "deepskyblue";
768
+ ColorName2["DimGray"] = "dimgray";
769
+ ColorName2["DimGrey"] = "dimgrey";
770
+ ColorName2["DodgerBlue"] = "dodgerblue";
771
+ ColorName2["FireBrick"] = "firebrick";
772
+ ColorName2["FloralWhite"] = "floralwhite";
773
+ ColorName2["ForestGreen"] = "forestgreen";
774
+ ColorName2["Fuchsia"] = "fuchsia";
775
+ ColorName2["Gainsboro"] = "gainsboro";
776
+ ColorName2["GhostWhite"] = "ghostwhite";
777
+ ColorName2["Gold"] = "gold";
778
+ ColorName2["GoldenRod"] = "goldenrod";
779
+ ColorName2["Gray"] = "gray";
780
+ ColorName2["Green"] = "green";
781
+ ColorName2["GreenYellow"] = "greenyellow";
782
+ ColorName2["Grey"] = "grey";
783
+ ColorName2["Honeydew"] = "honeydew";
784
+ ColorName2["HotPink"] = "hotpink";
785
+ ColorName2["IndianRed"] = "indianred";
786
+ ColorName2["Indigo"] = "indigo";
787
+ ColorName2["Ivory"] = "ivory";
788
+ ColorName2["Khaki"] = "khaki";
789
+ ColorName2["Lavender"] = "lavender";
790
+ ColorName2["LavenderBlush"] = "lavenderblush";
791
+ ColorName2["LawnGreen"] = "lawngreen";
792
+ ColorName2["LemonChiffon"] = "lemonchiffon";
793
+ ColorName2["LightBlue"] = "lightblue";
794
+ ColorName2["LightCoral"] = "lightcoral";
795
+ ColorName2["LightCyan"] = "lightcyan";
796
+ ColorName2["LightGoldenRodYellow"] = "lightgoldenrodyellow";
797
+ ColorName2["LightGray"] = "lightgray";
798
+ ColorName2["LightGreen"] = "lightgreen";
799
+ ColorName2["LightGrey"] = "lightgrey";
800
+ ColorName2["LightPink"] = "lightpink";
801
+ ColorName2["LightSalmon"] = "lightsalmon";
802
+ ColorName2["LightSeaGreen"] = "lightseagreen";
803
+ ColorName2["LightSkyBlue"] = "lightskyblue";
804
+ ColorName2["LightSlateGray"] = "lightslategray";
805
+ ColorName2["LightSlateGrey"] = "lightslategrey";
806
+ ColorName2["LightSteelBlue"] = "lightsteelblue";
807
+ ColorName2["LightYellow"] = "lightyellow";
808
+ ColorName2["Lime"] = "lime";
809
+ ColorName2["LimeGreen"] = "limegreen";
810
+ ColorName2["Linen"] = "linen";
811
+ ColorName2["Magenta"] = "magenta";
812
+ ColorName2["Maroon"] = "maroon";
813
+ ColorName2["MediumAquamarine"] = "mediumaquamarine";
814
+ ColorName2["MediumBlue"] = "mediumblue";
815
+ ColorName2["MediumOrchid"] = "mediumorchid";
816
+ ColorName2["MediumPurple"] = "mediumpurple";
817
+ ColorName2["MediumSeaGreen"] = "mediumseagreen";
818
+ ColorName2["MediumSlateBlue"] = "mediumslateblue";
819
+ ColorName2["MediumSpringGreen"] = "mediumspringgreen";
820
+ ColorName2["MediumTurquoise"] = "mediumturquoise";
821
+ ColorName2["MediumVioletRed"] = "mediumvioletred";
822
+ ColorName2["MidnightBlue"] = "midnightblue";
823
+ ColorName2["MintCream"] = "mintcream";
824
+ ColorName2["MistyRose"] = "mistyrose";
825
+ ColorName2["Moccasin"] = "moccasin";
826
+ ColorName2["NavajoWhite"] = "navajowhite";
827
+ ColorName2["Navy"] = "navy";
828
+ ColorName2["OldLace"] = "oldlace";
829
+ ColorName2["Olive"] = "olive";
830
+ ColorName2["OliveDrab"] = "olivedrab";
831
+ ColorName2["Orange"] = "orange";
832
+ ColorName2["OrangeRed"] = "orangered";
833
+ ColorName2["Orchid"] = "orchid";
834
+ ColorName2["PaleGoldenRod"] = "palegoldenrod";
835
+ ColorName2["PaleGreen"] = "palegreen";
836
+ ColorName2["PaleTurquoise"] = "paleturquoise";
837
+ ColorName2["PaleVioletRed"] = "palevioletred";
838
+ ColorName2["PapayaWhip"] = "papayawhip";
839
+ ColorName2["PeachPuff"] = "peachpuff";
840
+ ColorName2["Peru"] = "peru";
841
+ ColorName2["Pink"] = "pink";
842
+ ColorName2["Plum"] = "plum";
843
+ ColorName2["PowderBlue"] = "powderblue";
844
+ ColorName2["Purple"] = "purple";
845
+ ColorName2["RebeccaPurple"] = "rebeccapurple";
846
+ ColorName2["Red"] = "red";
847
+ ColorName2["RosyBrown"] = "rosybrown";
848
+ ColorName2["RoyalBlue"] = "royalblue";
849
+ ColorName2["SaddleBrown"] = "saddlebrown";
850
+ ColorName2["Salmon"] = "salmon";
851
+ ColorName2["SandyBrown"] = "sandybrown";
852
+ ColorName2["SeaGreen"] = "seagreen";
853
+ ColorName2["SeaShell"] = "seashell";
854
+ ColorName2["Sienna"] = "sienna";
855
+ ColorName2["Silver"] = "silver";
856
+ ColorName2["SkyBlue"] = "skyblue";
857
+ ColorName2["SlateBlue"] = "slateblue";
858
+ ColorName2["SlateGray"] = "slategray";
859
+ ColorName2["SlateGrey"] = "slategrey";
860
+ ColorName2["Snow"] = "snow";
861
+ ColorName2["SpringGreen"] = "springgreen";
862
+ ColorName2["SteelBlue"] = "steelblue";
863
+ ColorName2["Tan"] = "tan";
864
+ ColorName2["Teal"] = "teal";
865
+ ColorName2["Thistle"] = "thistle";
866
+ ColorName2["Tomato"] = "tomato";
867
+ ColorName2["Turquoise"] = "turquoise";
868
+ ColorName2["Violet"] = "violet";
869
+ ColorName2["Wheat"] = "wheat";
870
+ ColorName2["White"] = "white";
871
+ ColorName2["WhiteSmoke"] = "whitesmoke";
872
+ ColorName2["Yellow"] = "yellow";
873
+ ColorName2["YellowGreen"] = "yellowgreen";
874
+ })(ColorName = ColorName || (ColorName = {}));
621
875
 
622
- // src/score/engine/settings.ts
623
- var DebugSettings = {
624
- DrawDebugRects: false,
625
- DisableBeams: false
876
+ // node_modules/color-name-to-code/dist/color-code-format.enum.js
877
+ var ColorCodeFormat;
878
+ (function(ColorCodeFormat2) {
879
+ ColorCodeFormat2["Hex"] = "hex";
880
+ ColorCodeFormat2["RGB"] = "rgb";
881
+ ColorCodeFormat2["Array"] = "array";
882
+ })(ColorCodeFormat = ColorCodeFormat || (ColorCodeFormat = {}));
883
+
884
+ // node_modules/color-name-to-code/node_modules/color-name/index.js
885
+ var color_name_default = {
886
+ aliceblue: [240, 248, 255],
887
+ antiquewhite: [250, 235, 215],
888
+ aqua: [0, 255, 255],
889
+ aquamarine: [127, 255, 212],
890
+ azure: [240, 255, 255],
891
+ beige: [245, 245, 220],
892
+ bisque: [255, 228, 196],
893
+ black: [0, 0, 0],
894
+ blanchedalmond: [255, 235, 205],
895
+ blue: [0, 0, 255],
896
+ blueviolet: [138, 43, 226],
897
+ brown: [165, 42, 42],
898
+ burlywood: [222, 184, 135],
899
+ cadetblue: [95, 158, 160],
900
+ chartreuse: [127, 255, 0],
901
+ chocolate: [210, 105, 30],
902
+ coral: [255, 127, 80],
903
+ cornflowerblue: [100, 149, 237],
904
+ cornsilk: [255, 248, 220],
905
+ crimson: [220, 20, 60],
906
+ cyan: [0, 255, 255],
907
+ darkblue: [0, 0, 139],
908
+ darkcyan: [0, 139, 139],
909
+ darkgoldenrod: [184, 134, 11],
910
+ darkgray: [169, 169, 169],
911
+ darkgreen: [0, 100, 0],
912
+ darkgrey: [169, 169, 169],
913
+ darkkhaki: [189, 183, 107],
914
+ darkmagenta: [139, 0, 139],
915
+ darkolivegreen: [85, 107, 47],
916
+ darkorange: [255, 140, 0],
917
+ darkorchid: [153, 50, 204],
918
+ darkred: [139, 0, 0],
919
+ darksalmon: [233, 150, 122],
920
+ darkseagreen: [143, 188, 143],
921
+ darkslateblue: [72, 61, 139],
922
+ darkslategray: [47, 79, 79],
923
+ darkslategrey: [47, 79, 79],
924
+ darkturquoise: [0, 206, 209],
925
+ darkviolet: [148, 0, 211],
926
+ deeppink: [255, 20, 147],
927
+ deepskyblue: [0, 191, 255],
928
+ dimgray: [105, 105, 105],
929
+ dimgrey: [105, 105, 105],
930
+ dodgerblue: [30, 144, 255],
931
+ firebrick: [178, 34, 34],
932
+ floralwhite: [255, 250, 240],
933
+ forestgreen: [34, 139, 34],
934
+ fuchsia: [255, 0, 255],
935
+ gainsboro: [220, 220, 220],
936
+ ghostwhite: [248, 248, 255],
937
+ gold: [255, 215, 0],
938
+ goldenrod: [218, 165, 32],
939
+ gray: [128, 128, 128],
940
+ green: [0, 128, 0],
941
+ greenyellow: [173, 255, 47],
942
+ grey: [128, 128, 128],
943
+ honeydew: [240, 255, 240],
944
+ hotpink: [255, 105, 180],
945
+ indianred: [205, 92, 92],
946
+ indigo: [75, 0, 130],
947
+ ivory: [255, 255, 240],
948
+ khaki: [240, 230, 140],
949
+ lavender: [230, 230, 250],
950
+ lavenderblush: [255, 240, 245],
951
+ lawngreen: [124, 252, 0],
952
+ lemonchiffon: [255, 250, 205],
953
+ lightblue: [173, 216, 230],
954
+ lightcoral: [240, 128, 128],
955
+ lightcyan: [224, 255, 255],
956
+ lightgoldenrodyellow: [250, 250, 210],
957
+ lightgray: [211, 211, 211],
958
+ lightgreen: [144, 238, 144],
959
+ lightgrey: [211, 211, 211],
960
+ lightpink: [255, 182, 193],
961
+ lightsalmon: [255, 160, 122],
962
+ lightseagreen: [32, 178, 170],
963
+ lightskyblue: [135, 206, 250],
964
+ lightslategray: [119, 136, 153],
965
+ lightslategrey: [119, 136, 153],
966
+ lightsteelblue: [176, 196, 222],
967
+ lightyellow: [255, 255, 224],
968
+ lime: [0, 255, 0],
969
+ limegreen: [50, 205, 50],
970
+ linen: [250, 240, 230],
971
+ magenta: [255, 0, 255],
972
+ maroon: [128, 0, 0],
973
+ mediumaquamarine: [102, 205, 170],
974
+ mediumblue: [0, 0, 205],
975
+ mediumorchid: [186, 85, 211],
976
+ mediumpurple: [147, 112, 219],
977
+ mediumseagreen: [60, 179, 113],
978
+ mediumslateblue: [123, 104, 238],
979
+ mediumspringgreen: [0, 250, 154],
980
+ mediumturquoise: [72, 209, 204],
981
+ mediumvioletred: [199, 21, 133],
982
+ midnightblue: [25, 25, 112],
983
+ mintcream: [245, 255, 250],
984
+ mistyrose: [255, 228, 225],
985
+ moccasin: [255, 228, 181],
986
+ navajowhite: [255, 222, 173],
987
+ navy: [0, 0, 128],
988
+ oldlace: [253, 245, 230],
989
+ olive: [128, 128, 0],
990
+ olivedrab: [107, 142, 35],
991
+ orange: [255, 165, 0],
992
+ orangered: [255, 69, 0],
993
+ orchid: [218, 112, 214],
994
+ palegoldenrod: [238, 232, 170],
995
+ palegreen: [152, 251, 152],
996
+ paleturquoise: [175, 238, 238],
997
+ palevioletred: [219, 112, 147],
998
+ papayawhip: [255, 239, 213],
999
+ peachpuff: [255, 218, 185],
1000
+ peru: [205, 133, 63],
1001
+ pink: [255, 192, 203],
1002
+ plum: [221, 160, 221],
1003
+ powderblue: [176, 224, 230],
1004
+ purple: [128, 0, 128],
1005
+ rebeccapurple: [102, 51, 153],
1006
+ red: [255, 0, 0],
1007
+ rosybrown: [188, 143, 143],
1008
+ royalblue: [65, 105, 225],
1009
+ saddlebrown: [139, 69, 19],
1010
+ salmon: [250, 128, 114],
1011
+ sandybrown: [244, 164, 96],
1012
+ seagreen: [46, 139, 87],
1013
+ seashell: [255, 245, 238],
1014
+ sienna: [160, 82, 45],
1015
+ silver: [192, 192, 192],
1016
+ skyblue: [135, 206, 235],
1017
+ slateblue: [106, 90, 205],
1018
+ slategray: [112, 128, 144],
1019
+ slategrey: [112, 128, 144],
1020
+ snow: [255, 250, 250],
1021
+ springgreen: [0, 255, 127],
1022
+ steelblue: [70, 130, 180],
1023
+ tan: [210, 180, 140],
1024
+ teal: [0, 128, 128],
1025
+ thistle: [216, 191, 216],
1026
+ tomato: [255, 99, 71],
1027
+ turquoise: [64, 224, 208],
1028
+ violet: [238, 130, 238],
1029
+ wheat: [245, 222, 179],
1030
+ white: [255, 255, 255],
1031
+ whitesmoke: [245, 245, 245],
1032
+ yellow: [255, 255, 0],
1033
+ yellowgreen: [154, 205, 50]
626
1034
  };
627
- var DocumentSettings = {
628
- DocumentScale: 1,
629
- MinStaffWidth: 75,
630
- MinColumnsWidth: 10,
631
- ColumnWidthScale: 1.7,
632
- PostMeasureBreakWidth: 10,
633
- NoteDotSpace: 0.5,
634
- NoteAccSpace: 0.5,
635
- NoteHeadWidth: 2,
636
- NoteHeadHeight: 1.3,
637
- DiamondNoteHeadSize: 1.8,
638
- DotSize: 0.8,
639
- StemHeight: 7,
640
- // One octave
641
- FlagWidth: 1.5,
642
- FlagHeight: 4,
643
- FlagSeparation: 2,
644
- BeamSeparation: 1.25,
645
- BeamAngleFactor: 0.5,
646
- BeamThickness: 4,
647
- RestDotSpace: 0.5,
648
- LedgerLineWidth: 3.6,
649
- StubTieLength: 5,
650
- StaffHeight: 8,
651
- TabHeight: 20
1035
+
1036
+ // node_modules/color-name-to-code/dist/color-names.js
1037
+ var colorNames = color_name_default;
1038
+
1039
+ // node_modules/color-name-to-code/dist/color-array-to-hex.js
1040
+ var colorArrayToHexDefaultOptions = {
1041
+ hash: true,
1042
+ lowercase: false,
1043
+ short: false
652
1044
  };
1045
+ function colorArrayToHex(arr, partialOptions) {
1046
+ const options = __spreadValues(__spreadValues({}, colorArrayToHexDefaultOptions), partialOptions);
1047
+ const { hash, lowercase, short } = options;
1048
+ let hex = arr.map((num) => {
1049
+ let str = num.toString(16);
1050
+ str = str.length === 1 ? `0${str}` : str;
1051
+ return str;
1052
+ }).join("");
1053
+ if (short) {
1054
+ const chars = [...hex];
1055
+ if (chars[0] === chars[1] && chars[2] === chars[3] && chars[4] === chars[5]) {
1056
+ hex = `${chars[0]}${chars[2]}${chars[4]}`;
1057
+ }
1058
+ }
1059
+ hex = lowercase ? hex.toLowerCase() : hex.toUpperCase();
1060
+ if (hash) {
1061
+ hex = `#${hex}`;
1062
+ }
1063
+ return hex;
1064
+ }
653
1065
 
654
- // src/score/engine/render-context.ts
655
- import { MusicError as MusicError2, MusicErrorType as MusicErrorType2 } from "@tspro/web-music-score/core";
1066
+ // node_modules/color-name-to-code/dist/color-array-to-rgb.js
1067
+ function colorArrayToRGB(arr, alpha = 1) {
1068
+ alpha = Math.min(1, Math.max(0, alpha));
1069
+ if (alpha < 1) {
1070
+ return `rgba(${arr[0]}, ${arr[1]}, ${arr[2]}, ${alpha})`;
1071
+ }
1072
+ return `rgb(${arr[0]}, ${arr[1]}, ${arr[2]})`;
1073
+ }
656
1074
 
657
- // src/score/engine/assets/F-clef.png
658
- var F_clef_default = "data:image/png;base64,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IHhtcE1NOkRvY3VtZW50SUQ9ImdpbXA6ZG9jaWQ6Z2ltcDo0MDc4NWMzNi00MDFkLTRhNmUtOTE4Ny0wNDU1MjgyYzRkZjYiCiAgIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Nzg3YjYxN2YtMjg1MS00YzhlLTg2MTYtZWM3NGMwYzYwMWVlIgogICB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6ZTdhYTQxY2EtM2JiMy00ZTliLTk0NDEtOWU1M2ZlMmJmMzlmIgogICBkYzpGb3JtYXQ9ImltYWdlL3BuZyIKICAgR0lNUDpBUEk9IjIuMCIKICAgR0lNUDpQbGF0Zm9ybT0iV2luZG93cyIKICAgR0lNUDpUaW1lU3RhbXA9IjE2ODY2MTM5NDcxOTU2ODAiCiAgIEdJTVA6VmVyc2lvbj0iMi4xMC4zNCIKICAgdGlmZjpPcmllbnRhdGlvbj0iMSIKICAgeG1wOkNyZWF0b3JUb29sPSJHSU1QIDIuMTAiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjM6MDY6MTNUMDI6NTI6MjUrMDM6MDAiCiAgIHhtcDpNb2RpZnlEYXRlPSIyMDIzOjA2OjEzVDAyOjUyOjI1KzAzOjAwIj4KICAgPHhtcE1NOkhpc3Rvcnk+CiAgICA8cmRmOlNlcT4KICAgICA8cmRmOmxpCiAgICAgIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiCiAgICAgIHN0RXZ0OmNoYW5nZWQ9Ii8iCiAgICAgIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MjczNjZiZjQtZWRkMy00MTk4LTk2MmEtZTllMzkxMGU1OGJlIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJHaW1wIDIuMTAgKFdpbmRvd3MpIgogICAgICBzdEV2dDp3aGVuPSIyMDIyLTA4LTIyVDAyOjU1OjM2Ii8+CiAgICAgPHJkZjpsaQogICAgICBzdEV2dDphY3Rpb249InNhdmVkIgogICAgICBzdEV2dDpjaGFuZ2VkPSIvIgogICAgICBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjk2NWUxMzc5LTBkOWYtNDk4Mi1hZDcwLTkzOGM5YzM5YTRmMyIKICAgICAgc3RFdnQ6c29mdHdhcmVBZ2VudD0iR2ltcCAyLjEwIChXaW5kb3dzKSIKICAgICAgc3RFdnQ6d2hlbj0iMjAyMi0wOS0xMVQxNjozNTowMCIvPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJzYXZlZCIKICAgICAgc3RFdnQ6Y2hhbmdlZD0iLyIKICAgICAgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDoxMGZiYTBhMy05MjliLTQ1NGUtOGM0Yy04ZWQ4YzhhYmFkZGMiCiAgICAgIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkdpbXAgMi4xMCAoV2luZG93cykiCiAgICAgIHN0RXZ0OndoZW49IjIwMjMtMDYtMTBUMTc6NTA6MDkiLz4KICAgICA8cmRmOmxpCiAgICAgIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiCiAgICAgIHN0RXZ0OmNoYW5nZWQ9Ii8iCiAgICAgIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MDBmYjM4YTMtZjZiMi00NjQ1LTliMTYtMjlhNWE0ODZlMjhhIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJHaW1wIDIuMTAgKFdpbmRvd3MpIgogICAgICBzdEV2dDp3aGVuPSIyMDIzLTA2LTEzVDAyOjUyOjI3Ii8+CiAgICA8L3JkZjpTZXE+CiAgIDwveG1wTU06SGlzdG9yeT4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/PsIRrtIAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfnBgwXNBsqJURsAAAAGXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBHSU1QV4EOFwAABF9JREFUeNrtmluIF1Ucxz9/E8P1VnnJ9dJWC4Frmq2JJmqolGEILoQvK2gZeXlRCSm1Fx9UEsJQERWsXhRftECs0Gq70EK9ZHlbFyHbds3VVXFX91+7664P81tYhpnfmft//st84TzMzDm/8/vOnPO7nYEMGTJkyJAhQ4YMGSJBLkJZw4FyYAIwDHgU+A9oAxqBv4C7xfyySoBlwKfAFaAb6DG0euAzoAoYXCxEnwH2A60eCGrtFrALGJNWokNEwY6QRO2tFXgPGJAmss8DlyImam/fASPTQHaeGJueBFod8FQhrfSLwM+ynDX8L1/oV+BP4LZY58eBUUAlMB94ycPSvQTMERmJ4jGgwYPh2Qg84VFmGbAP6DTI/aoQS/lzg1JfA2MDyn4ZuGaQvyZJspUGv3oKGBhyjmeBJmWOmxLMJIITiiIXIgwaZgFdylxbDeNHANXAZmAVUBpEiScNe2xRxC/3Y2WuRmUlLRHD1rd/HljvV4F3FAVqYlhNo4B7Pl/wdPEMbmOq/ShwRBH0Vkxb6LAy536fW64HuOpn8vOKoLKYCC9Q5rzs0L/JQxDjyYPkgHYXAW0xGslByrLuFuPUFw0eCI92mmiAQ4LgZoEbYyTcAZxVPsJk271ag7x6cWueCLvhfsyu8LzybKLtersUF9ywxe2BnXBnAZOUJuXZeNv1OSki3LLdzwPrgONuguw+7g7wAHjEoW+vEagAXgeelr1yUSZoCUn4hvJsqMO9byRaWyLGtFkiwOtBJnYzBKcVg/ZuSMIrlHl3RrWMnFK1OqX/q8oXOAisDqFLVxL7xonw9yHk7Q5RoxpuyLdjI3wmhLzBwMqAY0ck4SGcCNeKIQqKOTF84RtxEu4BPgohc2QM467HSRjgqBL5mBDUPU1Rnl1JwqBNUuJqrW0M+OLdYuk8Cdas38Rf4b3FR0HP/nLdZNYaioKbxSVuA6ZGQfoNvNWlO6VvEKxW5O5yGbNc4ml7ZrUtCtLjgGMSdjop9Q+wMIT8GoXwKw79ZxrKUG9r+a8flMoyr5AA4ybwo1QgggYHpZJ6Ou3Ta5IpddvufwEsVWQ2xFisCI1Nypf6RMmsIql4JI0S8bFuSs9UvmCgikeh8b6i8C/KuKOYD+VShzGSwLsprRnByYYYoSqNhE8qCv/kYfxrYjT7jmuPIC+PBWsVsl1YRzBeE45qqWGtwjo1SR0WoZ8a7KAfYa5h7/2OVaPuF1gqtS83srclpi565IAP0c+b7wOz+wPZckOc3Jt0LC52oiXABx7y6VasGnfRYgiwwRAu9raGqPLXQmAGcADvvyN+m9bgXnP4i4E9wN8+KiJ5WQG5QilumnioJP9lwHPANKw/fF7A+fxJw2ms/y9SFdiPBf4Vn9hJNL8T/iFxbyoxgej+m6zBOtnLpXlvhiXcDOyVJV8UCEL4KnBI/OnAtBP0q+ADMTq/SfshrdUFr4TzwJdY9d57WIdYzRIk1GMdeXSQIUOGDBmSwUMtd8u2ArdcUAAAAABJRU5ErkJggg==";
1075
+ // node_modules/color-name-to-code/dist/color-name-to-code.js
1076
+ var colorNameToCodeDefaultOptions = __spreadProps(__spreadValues({}, colorArrayToHexDefaultOptions), {
1077
+ fallback: true,
1078
+ alpha: 1,
1079
+ format: ColorCodeFormat.Hex
1080
+ });
1081
+ function colorNameToCode(value, partialOptions = {}) {
1082
+ const options = __spreadValues(__spreadValues({}, colorNameToCodeDefaultOptions), partialOptions);
1083
+ const { fallback, format, hash, lowercase, short, alpha } = options;
1084
+ value = `${value}`;
1085
+ const colorName = value.toLowerCase().replaceAll(/[^a-z]/g, "");
1086
+ let colorArray = colorNames[colorName];
1087
+ if (!colorArray) {
1088
+ if (!fallback) {
1089
+ throw new Error(`no matching color found for '${value}'`);
1090
+ }
1091
+ const hex = value.toLowerCase().replaceAll(/[^\da-f]/g, "");
1092
+ colorArray = (hex.length <= 3 ? [hex.slice(0, 1).repeat(2), hex.slice(1, 2).repeat(2), hex.slice(2, 3).repeat(2)] : [hex.slice(0, 2), hex.slice(2, 4), hex.slice(4, 6)]).map((str) => Number.parseInt(str.length < 2 ? `${"0".repeat(2 - str.length)}${str}` : str, 16));
1093
+ }
1094
+ switch (format) {
1095
+ case ColorCodeFormat.Array: {
1096
+ return [...colorArray];
1097
+ }
1098
+ case ColorCodeFormat.RGB: {
1099
+ return colorArrayToRGB(colorArray, alpha);
1100
+ }
1101
+ default: {
1102
+ return colorArrayToHex(colorArray, { hash, lowercase, short });
1103
+ }
1104
+ }
1105
+ }
659
1106
 
660
1107
  // src/score/engine/assets/G-clef.png
661
1108
  var G_clef_default = "data:image/png;base64,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TTpEb2N1bWVudElEPSJnaW1wOmRvY2lkOmdpbXA6NDA3ODVjMzYtNDAxZC00YTZlLTkxODctMDQ1NTI4MmM0ZGY2IgogICB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjhiZTJkYzc1LTVlYjQtNDk0Yy1iNWRlLWQ2MzZkNzZhNjI2YiIKICAgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOmU3YWE0MWNhLTNiYjMtNGU5Yi05NDQxLTllNTNmZTJiZjM5ZiIKICAgZGM6Rm9ybWF0PSJpbWFnZS9wbmciCiAgIEdJTVA6QVBJPSIyLjAiCiAgIEdJTVA6UGxhdGZvcm09IldpbmRvd3MiCiAgIEdJTVA6VGltZVN0YW1wPSIxNjg2NDA4NjA5MzE2NDM4IgogICBHSU1QOlZlcnNpb249IjIuMTAuMzQiCiAgIHRpZmY6T3JpZW50YXRpb249IjEiCiAgIHhtcDpDcmVhdG9yVG9vbD0iR0lNUCAyLjEwIgogICB4bXA6TWV0YWRhdGFEYXRlPSIyMDIzOjA2OjEwVDE3OjUwOjA5KzAzOjAwIgogICB4bXA6TW9kaWZ5RGF0ZT0iMjAyMzowNjoxMFQxNzo1MDowOSswMzowMCI+CiAgIDx4bXBNTTpIaXN0b3J5PgogICAgPHJkZjpTZXE+CiAgICAgPHJkZjpsaQogICAgICBzdEV2dDphY3Rpb249InNhdmVkIgogICAgICBzdEV2dDpjaGFuZ2VkPSIvIgogICAgICBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjI3MzY2YmY0LWVkZDMtNDE5OC05NjJhLWU5ZTM5MTBlNThiZSIKICAgICAgc3RFdnQ6c29mdHdhcmVBZ2VudD0iR2ltcCAyLjEwIChXaW5kb3dzKSIKICAgICAgc3RFdnQ6d2hlbj0iMjAyMi0wOC0yMlQwMjo1NTozNiIvPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJzYXZlZCIKICAgICAgc3RFdnQ6Y2hhbmdlZD0iLyIKICAgICAgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo5NjVlMTM3OS0wZDlmLTQ5ODItYWQ3MC05MzhjOWMzOWE0ZjMiCiAgICAgIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkdpbXAgMi4xMCAoV2luZG93cykiCiAgICAgIHN0RXZ0OndoZW49IjIwMjItMDktMTFUMTY6MzU6MDAiLz4KICAgICA8cmRmOmxpCiAgICAgIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiCiAgICAgIHN0RXZ0OmNoYW5nZWQ9Ii8iCiAgICAgIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MTBmYmEwYTMtOTI5Yi00NTRlLThjNGMtOGVkOGM4YWJhZGRjIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJHaW1wIDIuMTAgKFdpbmRvd3MpIgogICAgICBzdEV2dDp3aGVuPSIyMDIzLTA2LTEwVDE3OjUwOjA5Ii8+CiAgICA8L3JkZjpTZXE+CiAgIDwveG1wTU06SGlzdG9yeT4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/Ppn4NIQAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfnBgoOMgm5WlWBAAAAGXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBHSU1QV4EOFwAACHtJREFUeNrtnXuQVmMcxz+77cauTWUpbGSVu2w3BpnUEBq3chkmBjGayG1GBuNWLtUgw5SJkBkjl4QKg1wyQyarK0lRSlstU20bWam9+OM8O3P6vc8553nOe97tnO18Z84f57zP7XvOc/ndnueFfQx5e6neUmAI0B3oDPwD/AJ8Dvzcml5we+Al4D+gyeOaB1S0BrLHAut9iLqv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";
662
1109
 
1110
+ // src/score/engine/assets/F-clef.png
1111
+ var F_clef_default = "data:image/png;base64,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IHhtcE1NOkRvY3VtZW50SUQ9ImdpbXA6ZG9jaWQ6Z2ltcDo0MDc4NWMzNi00MDFkLTRhNmUtOTE4Ny0wNDU1MjgyYzRkZjYiCiAgIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Nzg3YjYxN2YtMjg1MS00YzhlLTg2MTYtZWM3NGMwYzYwMWVlIgogICB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6ZTdhYTQxY2EtM2JiMy00ZTliLTk0NDEtOWU1M2ZlMmJmMzlmIgogICBkYzpGb3JtYXQ9ImltYWdlL3BuZyIKICAgR0lNUDpBUEk9IjIuMCIKICAgR0lNUDpQbGF0Zm9ybT0iV2luZG93cyIKICAgR0lNUDpUaW1lU3RhbXA9IjE2ODY2MTM5NDcxOTU2ODAiCiAgIEdJTVA6VmVyc2lvbj0iMi4xMC4zNCIKICAgdGlmZjpPcmllbnRhdGlvbj0iMSIKICAgeG1wOkNyZWF0b3JUb29sPSJHSU1QIDIuMTAiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjM6MDY6MTNUMDI6NTI6MjUrMDM6MDAiCiAgIHhtcDpNb2RpZnlEYXRlPSIyMDIzOjA2OjEzVDAyOjUyOjI1KzAzOjAwIj4KICAgPHhtcE1NOkhpc3Rvcnk+CiAgICA8cmRmOlNlcT4KICAgICA8cmRmOmxpCiAgICAgIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiCiAgICAgIHN0RXZ0OmNoYW5nZWQ9Ii8iCiAgICAgIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MjczNjZiZjQtZWRkMy00MTk4LTk2MmEtZTllMzkxMGU1OGJlIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJHaW1wIDIuMTAgKFdpbmRvd3MpIgogICAgICBzdEV2dDp3aGVuPSIyMDIyLTA4LTIyVDAyOjU1OjM2Ii8+CiAgICAgPHJkZjpsaQogICAgICBzdEV2dDphY3Rpb249InNhdmVkIgogICAgICBzdEV2dDpjaGFuZ2VkPSIvIgogICAgICBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjk2NWUxMzc5LTBkOWYtNDk4Mi1hZDcwLTkzOGM5YzM5YTRmMyIKICAgICAgc3RFdnQ6c29mdHdhcmVBZ2VudD0iR2ltcCAyLjEwIChXaW5kb3dzKSIKICAgICAgc3RFdnQ6d2hlbj0iMjAyMi0wOS0xMVQxNjozNTowMCIvPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJzYXZlZCIKICAgICAgc3RFdnQ6Y2hhbmdlZD0iLyIKICAgICAgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDoxMGZiYTBhMy05MjliLTQ1NGUtOGM0Yy04ZWQ4YzhhYmFkZGMiCiAgICAgIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkdpbXAgMi4xMCAoV2luZG93cykiCiAgICAgIHN0RXZ0OndoZW49IjIwMjMtMDYtMTBUMTc6NTA6MDkiLz4KICAgICA8cmRmOmxpCiAgICAgIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiCiAgICAgIHN0RXZ0OmNoYW5nZWQ9Ii8iCiAgICAgIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MDBmYjM4YTMtZjZiMi00NjQ1LTliMTYtMjlhNWE0ODZlMjhhIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJHaW1wIDIuMTAgKFdpbmRvd3MpIgogICAgICBzdEV2dDp3aGVuPSIyMDIzLTA2LTEzVDAyOjUyOjI3Ii8+CiAgICA8L3JkZjpTZXE+CiAgIDwveG1wTU06SGlzdG9yeT4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/PsIRrtIAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfnBgwXNBsqJURsAAAAGXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBHSU1QV4EOFwAABF9JREFUeNrtmluIF1Ucxz9/E8P1VnnJ9dJWC4Frmq2JJmqolGEILoQvK2gZeXlRCSm1Fx9UEsJQERWsXhRftECs0Gq70EK9ZHlbFyHbds3VVXFX91+7664P81tYhpnfmft//st84TzMzDm/8/vOnPO7nYEMGTJkyJAhQ4YMGSJBLkJZw4FyYAIwDHgU+A9oAxqBv4C7xfyySoBlwKfAFaAb6DG0euAzoAoYXCxEnwH2A60eCGrtFrALGJNWokNEwY6QRO2tFXgPGJAmss8DlyImam/fASPTQHaeGJueBFod8FQhrfSLwM+ynDX8L1/oV+BP4LZY58eBUUAlMB94ycPSvQTMERmJ4jGgwYPh2Qg84VFmGbAP6DTI/aoQS/lzg1JfA2MDyn4ZuGaQvyZJspUGv3oKGBhyjmeBJmWOmxLMJIITiiIXIgwaZgFdylxbDeNHANXAZmAVUBpEiScNe2xRxC/3Y2WuRmUlLRHD1rd/HljvV4F3FAVqYlhNo4B7Pl/wdPEMbmOq/ShwRBH0Vkxb6LAy536fW64HuOpn8vOKoLKYCC9Q5rzs0L/JQxDjyYPkgHYXAW0xGslByrLuFuPUFw0eCI92mmiAQ4LgZoEbYyTcAZxVPsJk271ag7x6cWueCLvhfsyu8LzybKLtersUF9ywxe2BnXBnAZOUJuXZeNv1OSki3LLdzwPrgONuguw+7g7wAHjEoW+vEagAXgeelr1yUSZoCUn4hvJsqMO9byRaWyLGtFkiwOtBJnYzBKcVg/ZuSMIrlHl3RrWMnFK1OqX/q8oXOAisDqFLVxL7xonw9yHk7Q5RoxpuyLdjI3wmhLzBwMqAY0ck4SGcCNeKIQqKOTF84RtxEu4BPgohc2QM467HSRjgqBL5mBDUPU1Rnl1JwqBNUuJqrW0M+OLdYuk8Cdas38Rf4b3FR0HP/nLdZNYaioKbxSVuA6ZGQfoNvNWlO6VvEKxW5O5yGbNc4ml7ZrUtCtLjgGMSdjop9Q+wMIT8GoXwKw79ZxrKUG9r+a8flMoyr5AA4ybwo1QgggYHpZJ6Ou3Ta5IpddvufwEsVWQ2xFisCI1Nypf6RMmsIql4JI0S8bFuSs9UvmCgikeh8b6i8C/KuKOYD+VShzGSwLsprRnByYYYoSqNhE8qCv/kYfxrYjT7jmuPIC+PBWsVsl1YRzBeE45qqWGtwjo1SR0WoZ8a7KAfYa5h7/2OVaPuF1gqtS83srclpi565IAP0c+b7wOz+wPZckOc3Jt0LC52oiXABx7y6VasGnfRYgiwwRAu9raGqPLXQmAGcADvvyN+m9bgXnP4i4E9wN8+KiJ5WQG5QilumnioJP9lwHPANKw/fF7A+fxJw2ms/y9SFdiPBf4Vn9hJNL8T/iFxbyoxgej+m6zBOtnLpXlvhiXcDOyVJV8UCEL4KnBI/OnAtBP0q+ADMTq/SfshrdUFr4TzwJdY9d57WIdYzRIk1GMdeXSQIUOGDBmSwUMtd8u2ArdcUAAAAABJRU5ErkJggg==";
1112
+
663
1113
  // src/score/engine/render-context.ts
664
- var HilightStaffPosRectColor = "#55cc55";
665
- var HilightObjectRectColor = "#55cc55";
666
- var PlayPosIndicatorColor = "#44aa44";
667
- var ImageAssets = new UniMap([
668
- [0 /* G_Clef */, { src: G_clef_default }],
669
- [1 /* F_Clef */, { src: F_clef_default }]
1114
+ var ImageData = new UniMap([
1115
+ [0 /* G_Clef */, G_clef_default],
1116
+ [1 /* F_Clef */, F_clef_default]
670
1117
  ]);
1118
+ var getImageData = (asset) => ImageData.getOrDefault(asset, "");
1119
+ var ImageCache = new BiMap();
1120
+ function colorNameToRGBA(name, alpha = 1) {
1121
+ const hex = colorNameToCode(name).replace("#", "");
1122
+ const r = parseInt(hex.slice(0, 2), 16);
1123
+ const g = parseInt(hex.slice(2, 4), 16);
1124
+ const b = parseInt(hex.slice(4, 6), 16);
1125
+ const a = Math.round(alpha * 255);
1126
+ return [r, g, b, a];
1127
+ }
671
1128
  function staffPosEquals(a, b) {
672
1129
  if (!a && !b) return true;
673
1130
  else if (!a || !b) return false;
@@ -702,23 +1159,9 @@ var RenderContext = class {
702
1159
  __publicField(this, "onMouseLeaveFn");
703
1160
  __publicField(this, "onTouchEndFn");
704
1161
  this.devicePixelRatio = window.devicePixelRatio;
705
- this.fontSize = Device.FontSize * DocumentSettings.DocumentScale * this.devicePixelRatio;
1162
+ this.fontSize = device_exports.FontSize * DocumentSettings.DocumentScale * this.devicePixelRatio;
706
1163
  this.unitSize = this.fontSize * 0.3;
707
1164
  this._lineWidth = this.unitSize * 0.2;
708
- ImageAssets.forEach((asset) => {
709
- if (asset.finished !== true) {
710
- const img = new Image();
711
- img.src = asset.src;
712
- img.onload = () => {
713
- asset.img = img;
714
- this.finishImageAsset(asset);
715
- };
716
- img.onerror = () => {
717
- this.finishImageAsset(asset);
718
- throw new MusicError2(MusicErrorType2.Score, "Failed to load image: " + asset.src);
719
- };
720
- }
721
- });
722
1165
  this.onClickFn = this.onClick.bind(this);
723
1166
  this.onMouseMoveFn = this.onMouseMove.bind(this);
724
1167
  this.onMouseLeaveFn = this.onMouseLeave.bind(this);
@@ -731,16 +1174,66 @@ var RenderContext = class {
731
1174
  var _a;
732
1175
  return (_a = this.mdoc) == null ? void 0 : _a.getMusicObject();
733
1176
  }
734
- finishImageAsset(asset) {
735
- asset.finished = true;
736
- let allFinished = ImageAssets.every((asset2) => asset2.finished === true);
737
- if (allFinished) {
738
- this.onLoad();
739
- }
1177
+ getImageAsset(asset, color) {
1178
+ var _a;
1179
+ color != null ? color : color = "";
1180
+ return (_a = ImageCache.getOrCreate(asset, color, () => {
1181
+ const a = { src: getImageData(asset), color, loaded: false, colorized: false };
1182
+ const img = new Image();
1183
+ img.src = a.src;
1184
+ img.onload = () => {
1185
+ a.img = img;
1186
+ this.onImageLoaded(a);
1187
+ };
1188
+ img.onerror = () => {
1189
+ console.error("Failed to load image: " + a.src);
1190
+ };
1191
+ return a;
1192
+ })) == null ? void 0 : _a.img;
740
1193
  }
741
- getImageAsset(imageAsset) {
1194
+ forceDraw() {
742
1195
  var _a;
743
- return (_a = ImageAssets.get(imageAsset)) == null ? void 0 : _a.img;
1196
+ (_a = this.doc) == null ? void 0 : _a.requestFullLayout();
1197
+ this.draw();
1198
+ }
1199
+ onImageLoaded(data) {
1200
+ if (data.loaded || !data.img) return;
1201
+ if (data.colorized || data.color === "") {
1202
+ this.forceDraw();
1203
+ data.loaded = true;
1204
+ return;
1205
+ }
1206
+ const [nr, ng, nb, na] = colorNameToRGBA(data.color);
1207
+ const threshold = 40;
1208
+ const canvas = document.createElement("canvas");
1209
+ canvas.width = data.img.width;
1210
+ canvas.height = data.img.height;
1211
+ const ctx = canvas.getContext("2d");
1212
+ if (ctx == null) {
1213
+ console.error("Failed to colorize image: ctx = null.");
1214
+ return;
1215
+ }
1216
+ ctx.drawImage(data.img, 0, 0);
1217
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
1218
+ const d = imageData.data;
1219
+ for (let i = 0; i < d.length; i += 4) {
1220
+ const r = d[i], g = d[i + 1], b = d[i + 2], a = d[i + 3];
1221
+ if (a === 0) continue;
1222
+ if (r < threshold && g < threshold && b < threshold) {
1223
+ d[i + 0] = nr;
1224
+ d[i + 1] = ng;
1225
+ d[i + 2] = nb;
1226
+ }
1227
+ }
1228
+ ctx.putImageData(imageData, 0, 0);
1229
+ data.img.src = canvas.toDataURL("image/png");
1230
+ data.img.onload = () => {
1231
+ data.colorized = true;
1232
+ this.onImageLoaded(data);
1233
+ };
1234
+ data.img.onerror = () => {
1235
+ console.error("Failed to colorize image.");
1236
+ };
744
1237
  }
745
1238
  setDocument(mdoc) {
746
1239
  if (this.mdoc === mdoc) {
@@ -860,12 +1353,6 @@ var RenderContext = class {
860
1353
  onTouchEnd(e) {
861
1354
  this.usingTouch = true;
862
1355
  }
863
- onLoad() {
864
- if (this.doc) {
865
- this.doc.requestFullLayout();
866
- this.draw();
867
- }
868
- }
869
1356
  hilightObject(obj) {
870
1357
  this.hilightedObj = obj;
871
1358
  }
@@ -914,7 +1401,7 @@ var RenderContext = class {
914
1401
  if (!staff) {
915
1402
  return;
916
1403
  }
917
- this.fillColor(HilightStaffPosRectColor);
1404
+ this.fillColor(DocumentColor.HilightStaffPos);
918
1405
  this.fillRect(staff.row.getRect().left, staff.getDiatonicIdY(diatonicId) - unitSize, staff.row.getRect().width, 2 * unitSize);
919
1406
  if (mousePos !== void 0) {
920
1407
  this.drawLedgerLines(staff, diatonicId, mousePos.x);
@@ -926,13 +1413,13 @@ var RenderContext = class {
926
1413
  return;
927
1414
  }
928
1415
  let rect = hilightedObj.getRect();
929
- this.lineColor(HilightObjectRectColor);
1416
+ this.lineColor(DocumentColor.HilightObject);
930
1417
  this.strokeRect(rect.left, rect.top, rect.width, rect.height);
931
1418
  }
932
1419
  drawPlayCursor() {
933
1420
  let { cursorRect: r } = this;
934
1421
  if (r) {
935
- this.color(PlayPosIndicatorColor).lineWidth(2).strokeLine(r.centerX, r.top, r.centerX, r.bottom);
1422
+ this.color(DocumentColor.PlayCursor).lineWidth(2).strokeLine(r.centerX, r.top, r.centerX, r.bottom);
936
1423
  }
937
1424
  }
938
1425
  txFromScreenCoord(screenCoord) {
@@ -942,8 +1429,10 @@ var RenderContext = class {
942
1429
  return coord.div(this.devicePixelRatio);
943
1430
  }
944
1431
  clearCanvas() {
945
- var _a;
946
- (_a = this.ctx) == null ? void 0 : _a.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
1432
+ if (this.ctx) {
1433
+ this.ctx.canvas.style.background = DocumentColor.Background;
1434
+ this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
1435
+ }
947
1436
  }
948
1437
  drawDebugRect(r) {
949
1438
  if (DebugSettings.DrawDebugRects) {
@@ -998,7 +1487,7 @@ var RenderContext = class {
998
1487
  toph = unitSize * (0.5 + flagCount - adj);
999
1488
  bottomh = unitSize * (1 + flagCount + adj);
1000
1489
  }
1001
- return new AnchoredRect2(-leftw, 0, rightw, -toph, 0, bottomh);
1490
+ return new AnchoredRect(-leftw, 0, rightw, -toph, 0, bottomh);
1002
1491
  }
1003
1492
  drawRest(restSize, x, y) {
1004
1493
  let { unitSize } = this;
@@ -1184,7 +1673,7 @@ var RenderContext = class {
1184
1673
  this.ctx.font = savedFont;
1185
1674
  return metrics.width;
1186
1675
  } else {
1187
- return Utils2.Dom.getCanvasTextWidth(text, font);
1676
+ return utils_exports.Dom.getCanvasTextWidth(text, font);
1188
1677
  }
1189
1678
  }
1190
1679
  arc(x, y, radius, startRadians, endRadians) {
@@ -1289,11 +1778,9 @@ var RenderContext = class {
1289
1778
  };
1290
1779
 
1291
1780
  // src/score/engine/obj-staff-and-tab.ts
1292
- import { MusicError as MusicError15, MusicErrorType as MusicErrorType15 } from "@tspro/web-music-score/core";
1293
- import { AnchoredRect as AnchoredRect22, Guard as Guard9, UniMap as UniMap8, Utils as Utils10 } from "@tspro/ts-utils-lib";
1781
+ import { MusicError as MusicError13, MusicErrorType as MusicErrorType13 } from "@tspro/web-music-score/core";
1294
1782
 
1295
1783
  // src/score/engine/obj-measure.ts
1296
- import { Guard as Guard8, IndexArray as IndexArray2, UniMap as UniMap6, TriMap as TriMap2, ValueSet, Utils as Utils9, asMulti, AnchoredRect as AnchoredRect20 } from "@tspro/ts-utils-lib";
1297
1784
  import { getScale, Scale, validateScaleType, Note as Note7, RhythmProps as RhythmProps5, KeySignature as KeySignature2, getDefaultKeySignature, PitchNotation, SymbolSet, validateNoteLength as validateNoteLength2, NoteLengthProps as NoteLengthProps5 } from "@tspro/web-music-score/theory";
1298
1785
  import { getDefaultTempo, getDefaultTimeSignature } from "@tspro/web-music-score/theory";
1299
1786
 
@@ -1323,7 +1810,6 @@ var AccidentalState = class {
1323
1810
  import { Note as Note2, getTempoString, KeySignature } from "@tspro/web-music-score/theory";
1324
1811
 
1325
1812
  // src/score/engine/obj-image.ts
1326
- import { AnchoredRect as AnchoredRect3 } from "@tspro/ts-utils-lib";
1327
1813
  var ObjImage = class extends MusicObject {
1328
1814
  constructor(parent, image, anchorX, anchorY, imageScale) {
1329
1815
  super(parent);
@@ -1346,9 +1832,9 @@ var ObjImage = class extends MusicObject {
1346
1832
  try {
1347
1833
  let w = image.naturalWidth * imageScale * unitSize;
1348
1834
  let h = image.naturalHeight * imageScale * unitSize;
1349
- this.rect = AnchoredRect3.createSections(w * anchorX, w * (1 - anchorX), h * anchorY, h * (1 - anchorY));
1835
+ this.rect = AnchoredRect.createSections(w * anchorX, w * (1 - anchorX), h * anchorY, h * (1 - anchorY));
1350
1836
  } catch (err) {
1351
- this.rect = new AnchoredRect3();
1837
+ this.rect = new AnchoredRect();
1352
1838
  }
1353
1839
  }
1354
1840
  offset(dx, dy) {
@@ -1362,8 +1848,7 @@ var ObjImage = class extends MusicObject {
1362
1848
  };
1363
1849
 
1364
1850
  // src/score/engine/obj-accidental.ts
1365
- import { MusicError as MusicError3, MusicErrorType as MusicErrorType3 } from "@tspro/web-music-score/core";
1366
- import { AnchoredRect as AnchoredRect4 } from "@tspro/ts-utils-lib";
1851
+ import { MusicError as MusicError2, MusicErrorType as MusicErrorType2 } from "@tspro/web-music-score/core";
1367
1852
  var ObjAccidental = class extends MusicObject {
1368
1853
  constructor(parent, diatonicId, accidental, color = "black") {
1369
1854
  super(parent);
@@ -1383,22 +1868,22 @@ var ObjAccidental = class extends MusicObject {
1383
1868
  let { unitSize } = ctx;
1384
1869
  switch (this.accidental) {
1385
1870
  case -2:
1386
- this.rect = AnchoredRect4.createSections(unitSize * 1.25, unitSize * 1.25, unitSize * 4, unitSize * 1.2);
1871
+ this.rect = AnchoredRect.createSections(unitSize * 1.25, unitSize * 1.25, unitSize * 4, unitSize * 1.2);
1387
1872
  break;
1388
1873
  case -1:
1389
- this.rect = AnchoredRect4.createSections(unitSize * 0.75, unitSize * 0.75, unitSize * 4, unitSize * 1.2);
1874
+ this.rect = AnchoredRect.createSections(unitSize * 0.75, unitSize * 0.75, unitSize * 4, unitSize * 1.2);
1390
1875
  break;
1391
1876
  case 0:
1392
- this.rect = AnchoredRect4.createSections(unitSize * 0.75, unitSize * 0.75, unitSize * 2.2, unitSize * 2.2);
1877
+ this.rect = AnchoredRect.createSections(unitSize * 0.75, unitSize * 0.75, unitSize * 2.2, unitSize * 2.2);
1393
1878
  break;
1394
1879
  case 1:
1395
- this.rect = AnchoredRect4.createSections(unitSize * 0.75, unitSize * 0.75, unitSize * 2, unitSize * 2);
1880
+ this.rect = AnchoredRect.createSections(unitSize * 0.75, unitSize * 0.75, unitSize * 2, unitSize * 2);
1396
1881
  break;
1397
1882
  case 2:
1398
- this.rect = AnchoredRect4.createSections(unitSize * 1, unitSize * 1, unitSize * 1, unitSize * 1);
1883
+ this.rect = AnchoredRect.createSections(unitSize * 1, unitSize * 1, unitSize * 1, unitSize * 1);
1399
1884
  break;
1400
1885
  default:
1401
- throw new MusicError3(MusicErrorType3.Score, "Invalid accidental value: " + this.accidental);
1886
+ throw new MusicError2(MusicErrorType2.Score, "Invalid accidental value: " + this.accidental);
1402
1887
  }
1403
1888
  }
1404
1889
  offset(dx, dy) {
@@ -1438,7 +1923,6 @@ var ObjAccidental = class extends MusicObject {
1438
1923
  };
1439
1924
 
1440
1925
  // src/score/engine/obj-text.ts
1441
- import { AnchoredRect as AnchoredRect5 } from "@tspro/ts-utils-lib";
1442
1926
  var DefaultBoxedPadding = 0.5;
1443
1927
  var ObjText = class extends MusicObject {
1444
1928
  constructor(parent, text, anchorX, anchorY) {
@@ -1475,7 +1959,7 @@ var ObjText = class extends MusicObject {
1475
1959
  if (this.textLines.length === 0) {
1476
1960
  this.textLines = [""];
1477
1961
  }
1478
- this.rect = new AnchoredRect5();
1962
+ this.rect = new AnchoredRect();
1479
1963
  this.mi = new MText(this);
1480
1964
  }
1481
1965
  getMusicInterface() {
@@ -1484,18 +1968,6 @@ var ObjText = class extends MusicObject {
1484
1968
  getText() {
1485
1969
  return this.text;
1486
1970
  }
1487
- updateAnchorX(anchorX) {
1488
- this.anchorX = anchorX;
1489
- let { width } = this.rect;
1490
- this.rect.left = this.rect.anchorX - width * anchorX;
1491
- this.rect.right = this.rect.anchorX + width * (1 - anchorX);
1492
- }
1493
- updateAnchorY(anchorY) {
1494
- this.anchorY = anchorY;
1495
- let { height } = this.rect;
1496
- this.rect.top = this.rect.anchorY - height * anchorY;
1497
- this.rect.bottom = this.rect.anchorY + height * (1 - anchorY);
1498
- }
1499
1971
  pick(x, y) {
1500
1972
  return this.rect.contains(x, y) ? [this] : [];
1501
1973
  }
@@ -1511,7 +1983,7 @@ var ObjText = class extends MusicObject {
1511
1983
  if (this.boxed === "square" || this.boxed === "circle") {
1512
1984
  h = w = Math.max(h, w);
1513
1985
  }
1514
- this.rect = AnchoredRect5.createSections(w * anchorX, w * (1 - anchorX), h * anchorY, h * (1 - anchorY));
1986
+ this.rect = AnchoredRect.createSections(w * anchorX, w * (1 - anchorX), h * anchorY, h * (1 - anchorY));
1515
1987
  }
1516
1988
  offset(dx, dy) {
1517
1989
  this.rect.offsetInPlace(dx, dy);
@@ -1557,8 +2029,7 @@ var ObjText = class extends MusicObject {
1557
2029
  };
1558
2030
 
1559
2031
  // src/score/engine/obj-signature.ts
1560
- import { MusicError as MusicError4, MusicErrorType as MusicErrorType4 } from "@tspro/web-music-score/core";
1561
- import { AnchoredRect as AnchoredRect6 } from "@tspro/ts-utils-lib";
2032
+ import { MusicError as MusicError3, MusicErrorType as MusicErrorType3 } from "@tspro/web-music-score/core";
1562
2033
  var ObjStaffSignature = class extends MusicObject {
1563
2034
  constructor(measure, staff) {
1564
2035
  super(measure);
@@ -1575,22 +2046,29 @@ var ObjStaffSignature = class extends MusicObject {
1575
2046
  __publicField(this, "mi");
1576
2047
  this.mi = new MStaffSignature(this);
1577
2048
  }
2049
+ get doc() {
2050
+ return this.measure.doc;
2051
+ }
1578
2052
  getMusicInterface() {
1579
2053
  return this.mi;
1580
2054
  }
1581
2055
  updateClefImage(ctx, showClef) {
1582
2056
  if (showClef) {
1583
- let img = ctx.getImageAsset(this.staff.clefImageAsset);
2057
+ let color = DocumentColor.Staff_Signature_Clef;
2058
+ if (["black", "#000", "#000000"].includes(color))
2059
+ color = "";
2060
+ let img = ctx.getImageAsset(this.staff.clefImageAsset, color);
1584
2061
  this.clefImage = img ? new ObjImage(this, img, 0, 0.5, 0.1) : void 0;
1585
- this.eightBelowClef = this.clefImage && this.staff.isOctaveDown ? new ObjText(this, "8", 0.5, 0) : void 0;
2062
+ this.eightBelowClef = this.clefImage && this.staff.isOctaveDown ? new ObjText(this, { text: "8", color }, 0.5, 0) : void 0;
1586
2063
  } else {
1587
2064
  this.clefImage = void 0;
1588
2065
  }
1589
2066
  }
1590
2067
  updateMeasureNumber(showMeasureNumber) {
1591
2068
  if (showMeasureNumber) {
2069
+ let color = DocumentColor.Staff_Signature_MeasureNum;
1592
2070
  let text = this.measure.getMeasureNumber().toString();
1593
- this.measureNumber = new ObjText(this, text, 0, 1);
2071
+ this.measureNumber = new ObjText(this, { text, color }, 0, 1);
1594
2072
  } else {
1595
2073
  this.measureNumber = void 0;
1596
2074
  }
@@ -1598,6 +2076,7 @@ var ObjStaffSignature = class extends MusicObject {
1598
2076
  updateKeySignature(showKeySignature) {
1599
2077
  if (showKeySignature) {
1600
2078
  let { measure } = this;
2079
+ let color = DocumentColor.Staff_Signature_Key;
1601
2080
  let prevMeasure = measure.getPrevMeasure();
1602
2081
  let prevKeySignature = prevMeasure ? prevMeasure.getKeySignature() : void 0;
1603
2082
  let newKeySignature = measure.getKeySignature();
@@ -1605,11 +2084,11 @@ var ObjStaffSignature = class extends MusicObject {
1605
2084
  this.ksNewAccidentals = [];
1606
2085
  if (prevKeySignature && !KeySignature.equals(newKeySignature, prevKeySignature)) {
1607
2086
  prevKeySignature.getOrderedAccidentalNotes().forEach((accNote) => {
1608
- this.ksNeutralizeAccidentals.push(new ObjAccidental(this, this.getAccidentalDiatonicId(accNote), 0));
2087
+ this.ksNeutralizeAccidentals.push(new ObjAccidental(this, this.getAccidentalDiatonicId(accNote), 0, color));
1609
2088
  });
1610
2089
  }
1611
2090
  newKeySignature.getOrderedAccidentalNotes().forEach((accNote) => {
1612
- this.ksNewAccidentals.push(new ObjAccidental(this, this.getAccidentalDiatonicId(accNote), accNote.accidental));
2091
+ this.ksNewAccidentals.push(new ObjAccidental(this, this.getAccidentalDiatonicId(accNote), accNote.accidental, color));
1613
2092
  });
1614
2093
  } else {
1615
2094
  this.ksNeutralizeAccidentals = [];
@@ -1619,18 +2098,20 @@ var ObjStaffSignature = class extends MusicObject {
1619
2098
  updateTimeSignature(showTimeSignature) {
1620
2099
  if (showTimeSignature) {
1621
2100
  let timeSignature = this.measure.getTimeSignature();
2101
+ let color = DocumentColor.Staff_Signature_Time;
1622
2102
  let beatCount = timeSignature.beatCount.toString();
1623
- this.beatCountText = new ObjText(this, { text: beatCount, scale: 1.4 }, 0.5, 0.5);
2103
+ this.beatCountText = new ObjText(this, { text: beatCount, color, scale: 1.4 }, 0.5, 0.5);
1624
2104
  let beatSize = timeSignature.beatSize.toString();
1625
- this.beatSizeText = new ObjText(this, { text: beatSize, scale: 1.4 }, 0.5, 0.5);
2105
+ this.beatSizeText = new ObjText(this, { text: beatSize, color, scale: 1.4 }, 0.5, 0.5);
1626
2106
  } else {
1627
2107
  this.beatCountText = this.beatSizeText = void 0;
1628
2108
  }
1629
2109
  }
1630
2110
  updateTempo(showTempo) {
1631
2111
  if (showTempo) {
1632
- let tempoStr = getTempoString(this.measure.getTempo());
1633
- this.tempoText = new ObjText(this, tempoStr, 0.5, 1);
2112
+ let color = DocumentColor.Staff_Signature_Tempo;
2113
+ let text = getTempoString(this.measure.getTempo());
2114
+ this.tempoText = new ObjText(this, { text, color }, 0.5, 1);
1634
2115
  } else {
1635
2116
  this.tempoText = void 0;
1636
2117
  }
@@ -1654,7 +2135,7 @@ var ObjStaffSignature = class extends MusicObject {
1654
2135
  if (bottomAccidentalDiatonicId !== void 0) {
1655
2136
  return Note2.findNextDiatonicIdAbove(accNote.diatonicId, bottomAccidentalDiatonicId, false);
1656
2137
  } else {
1657
- throw new MusicError4(MusicErrorType4.Score, "Cannot get accidental diatonicId because note has no accidental.");
2138
+ throw new MusicError3(MusicErrorType3.Score, "Cannot get accidental diatonicId because note has no accidental.");
1658
2139
  }
1659
2140
  }
1660
2141
  pick(x, y) {
@@ -1717,7 +2198,7 @@ var ObjStaffSignature = class extends MusicObject {
1717
2198
  let { staff } = this;
1718
2199
  let paddingX = unitSize;
1719
2200
  let x = 0;
1720
- this.rect = new AnchoredRect6();
2201
+ this.rect = new AnchoredRect();
1721
2202
  if (this.clefImage) {
1722
2203
  x += paddingX;
1723
2204
  this.clefImage.layout(ctx);
@@ -1784,11 +2265,11 @@ var ObjStaffSignature = class extends MusicObject {
1784
2265
  this.tempoText.layout(ctx);
1785
2266
  this.tempoText.setCenterX(x);
1786
2267
  this.tempoText.setBottom(staff.getTopLineY());
1787
- if (this.clefImage && AnchoredRect6.overlap(this.clefImage.getRect(), this.tempoText.getRect())) {
2268
+ if (this.clefImage && AnchoredRect.overlap(this.clefImage.getRect(), this.tempoText.getRect())) {
1788
2269
  this.tempoText.setBottom(this.clefImage.getRect().top);
1789
2270
  }
1790
2271
  [...this.ksNeutralizeAccidentals, ...this.ksNewAccidentals].forEach((acc) => {
1791
- if (this.tempoText && AnchoredRect6.overlap(acc.getRect(), this.tempoText.getRect())) {
2272
+ if (this.tempoText && AnchoredRect.overlap(acc.getRect(), this.tempoText.getRect())) {
1792
2273
  this.tempoText.setBottom(acc.getRect().top);
1793
2274
  }
1794
2275
  });
@@ -1835,10 +2316,14 @@ var ObjTabSignature = class extends MusicObject {
1835
2316
  getMusicInterface() {
1836
2317
  return this.mi;
1837
2318
  }
2319
+ get doc() {
2320
+ return this.measure.doc;
2321
+ }
1838
2322
  updateMeasureNumber(showMeasureNumber) {
1839
2323
  if (showMeasureNumber) {
2324
+ let color = DocumentColor.Tab_Signature_MeasureNum;
1840
2325
  let text = this.measure.getMeasureNumber().toString();
1841
- this.measureNumber = new ObjText(this, text, 0, 1);
2326
+ this.measureNumber = new ObjText(this, { text, color }, 0, 1);
1842
2327
  } else {
1843
2328
  this.measureNumber = void 0;
1844
2329
  }
@@ -1846,18 +2331,20 @@ var ObjTabSignature = class extends MusicObject {
1846
2331
  updateTimeSignature(showTimeSignature) {
1847
2332
  if (showTimeSignature) {
1848
2333
  let timeSignature = this.measure.getTimeSignature();
2334
+ let color = DocumentColor.Tab_Signature_Time;
1849
2335
  let beatCount = timeSignature.beatCount.toString();
1850
- this.beatCountText = new ObjText(this, { text: beatCount, scale: 1.4 }, 0.5, 0.5);
2336
+ this.beatCountText = new ObjText(this, { text: beatCount, color, scale: 1.4 }, 0.5, 0.5);
1851
2337
  let beatSize = timeSignature.beatSize.toString();
1852
- this.beatSizeText = new ObjText(this, { text: beatSize, scale: 1.4 }, 0.5, 0.5);
2338
+ this.beatSizeText = new ObjText(this, { text: beatSize, color, scale: 1.4 }, 0.5, 0.5);
1853
2339
  } else {
1854
2340
  this.beatCountText = this.beatSizeText = void 0;
1855
2341
  }
1856
2342
  }
1857
2343
  updateTempo(showTempo) {
1858
2344
  if (showTempo) {
1859
- let tempoStr = getTempoString(this.measure.getTempo());
1860
- this.tempoText = new ObjText(this, tempoStr, 0, 1);
2345
+ let color = DocumentColor.Tab_Signature_Tempo;
2346
+ let text = getTempoString(this.measure.getTempo());
2347
+ this.tempoText = new ObjText(this, { text, color }, 0, 1);
1861
2348
  } else {
1862
2349
  this.tempoText = void 0;
1863
2350
  }
@@ -1899,7 +2386,7 @@ var ObjTabSignature = class extends MusicObject {
1899
2386
  let paddingX = unitSize;
1900
2387
  let x = 0;
1901
2388
  let topLineY = tab.getTopLineY();
1902
- this.rect = new AnchoredRect6();
2389
+ this.rect = new AnchoredRect();
1903
2390
  if (this.measureNumber) {
1904
2391
  this.measureNumber.layout(ctx);
1905
2392
  this.measureNumber.setLeft(0);
@@ -1950,7 +2437,6 @@ var ObjTabSignature = class extends MusicObject {
1950
2437
  };
1951
2438
 
1952
2439
  // src/score/engine/player.ts
1953
- import { Rect as Rect2, UniMap as UniMap3, Utils as Utils5 } from "@tspro/ts-utils-lib";
1954
2440
  import { NoteLength as NoteLength4, RhythmProps as RhythmProps4, alterTempoSpeed } from "@tspro/web-music-score/theory";
1955
2441
  import * as Audio from "@tspro/web-music-score/audio";
1956
2442
 
@@ -1958,7 +2444,6 @@ import * as Audio from "@tspro/web-music-score/audio";
1958
2444
  import { Note as Note5 } from "@tspro/web-music-score/theory";
1959
2445
 
1960
2446
  // src/score/engine/obj-arpeggio.ts
1961
- import { AnchoredRect as AnchoredRect7 } from "@tspro/ts-utils-lib";
1962
2447
  var ObjArpeggio = class extends MusicObject {
1963
2448
  constructor(col, line, arpeggioDir) {
1964
2449
  super(col);
@@ -1989,7 +2474,7 @@ var ObjArpeggio = class extends MusicObject {
1989
2474
  this.numCycles = Math.ceil((bottom - top) / this.cycleHeight) + 2;
1990
2475
  let width = unitSize * 2;
1991
2476
  let height = this.numCycles * this.cycleHeight;
1992
- this.rect = new AnchoredRect7(-width / 2, width / 2, -height / 2 - this.topArrowHeight, height / 2 + this.bottomArrowHeight);
2477
+ this.rect = new AnchoredRect(-width / 2, width / 2, -height / 2 - this.topArrowHeight, height / 2 + this.bottomArrowHeight);
1993
2478
  }
1994
2479
  offset(dx, dy) {
1995
2480
  this.rect.offsetInPlace(dx, dy);
@@ -2025,8 +2510,7 @@ var ObjArpeggio = class extends MusicObject {
2025
2510
 
2026
2511
  // src/score/engine/obj-rest.ts
2027
2512
  import { Note as Note3, NoteLengthProps as NoteLengthProps2, RhythmProps as RhythmProps2, Tuplet } from "@tspro/web-music-score/theory";
2028
- import { MusicError as MusicError5, MusicErrorType as MusicErrorType5 } from "@tspro/web-music-score/core";
2029
- import { AnchoredRect as AnchoredRect8 } from "@tspro/ts-utils-lib";
2513
+ import { MusicError as MusicError4, MusicErrorType as MusicErrorType4 } from "@tspro/web-music-score/core";
2030
2514
  function getDiatonicIdFromStaffPos(staffPos) {
2031
2515
  if (typeof staffPos === "number") {
2032
2516
  return Note3.getChromaticNote(staffPos).diatonicId;
@@ -2043,7 +2527,7 @@ var ObjStaffRest = class extends MusicObject {
2043
2527
  super(staff);
2044
2528
  this.staff = staff;
2045
2529
  this.rest = rest;
2046
- __publicField(this, "restRect", new AnchoredRect8());
2530
+ __publicField(this, "restRect", new AnchoredRect());
2047
2531
  __publicField(this, "dotRects", []);
2048
2532
  __publicField(this, "mi");
2049
2533
  staff.addObject(this);
@@ -2091,7 +2575,7 @@ var _ObjRest = class _ObjRest extends MusicObject {
2091
2575
  }
2092
2576
  this.runningDiatonicId = this.setDiatonicId;
2093
2577
  this.runningStemDir = "up" /* Up */;
2094
- this.color = (_c = options == null ? void 0 : options.color) != null ? _c : "black";
2578
+ this.color = (_c = options == null ? void 0 : options.color) != null ? _c : DocumentColor.Staff_Rest;
2095
2579
  this.hide = (_d = options == null ? void 0 : options.hide) != null ? _d : false;
2096
2580
  this.oldStyleTriplet = tupletRatio === void 0 && ((options == null ? void 0 : options.triplet) === true || NoteLengthProps2.get(noteLength).isTriplet);
2097
2581
  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;
@@ -2200,7 +2684,7 @@ var _ObjRest = class _ObjRest extends MusicObject {
2200
2684
  case 64:
2201
2685
  return -3;
2202
2686
  default:
2203
- throw new MusicError5(MusicErrorType5.Score, `Get rest dot vertical displacement: Invalid note size: ${noteSize}`);
2687
+ throw new MusicError4(MusicErrorType4.Score, `Get rest dot vertical displacement: Invalid note size: ${noteSize}`);
2204
2688
  }
2205
2689
  }
2206
2690
  updateAccidentalState(accState) {
@@ -2224,7 +2708,7 @@ var _ObjRest = class _ObjRest extends MusicObject {
2224
2708
  let dotWidth = DocumentSettings.DotSize * unitSize;
2225
2709
  let dotX = obj.restRect.rightw + (DocumentSettings.RestDotSpace + DocumentSettings.DotSize * unitSize) + i * DocumentSettings.DotSize * unitSize * 1.5;
2226
2710
  let dotY = this.getRestDotVerticalDisplacement(noteSize) * unitSize;
2227
- obj.dotRects.push(AnchoredRect8.createCentered(dotX, dotY, dotWidth, dotWidth));
2711
+ obj.dotRects.push(AnchoredRect.createCentered(dotX, dotY, dotWidth, dotWidth));
2228
2712
  }
2229
2713
  obj.setAnchor(0, staff.getDiatonicIdY(diatonicId));
2230
2714
  this.staffObjects.push(obj);
@@ -2233,7 +2717,7 @@ var _ObjRest = class _ObjRest extends MusicObject {
2233
2717
  }
2234
2718
  updateRect() {
2235
2719
  if (this.staffObjects.length === 0) {
2236
- this.rect = new AnchoredRect8();
2720
+ this.rect = new AnchoredRect();
2237
2721
  } else {
2238
2722
  this.rect = this.staffObjects[0].getRect().clone();
2239
2723
  if (this.staffObjects.length > 1) {
@@ -2265,18 +2749,17 @@ __publicField(_ObjRest, "UndefinedDiatonicId", Infinity);
2265
2749
  var ObjRest = _ObjRest;
2266
2750
 
2267
2751
  // src/score/engine/obj-note-group.ts
2268
- import { AnchoredRect as AnchoredRect9, Guard as Guard2, Utils as Utils3 } from "@tspro/ts-utils-lib";
2269
2752
  import { Note as Note4, NoteLengthProps as NoteLengthProps3, RhythmProps as RhythmProps3, Tuplet as Tuplet2 } from "@tspro/web-music-score/theory";
2270
- import { MusicError as MusicError6, MusicErrorType as MusicErrorType6 } from "@tspro/web-music-score/core";
2753
+ import { MusicError as MusicError5, MusicErrorType as MusicErrorType5 } from "@tspro/web-music-score/core";
2271
2754
  function getArpeggio(a) {
2272
- return Guard2.isEnumValue(a, Arpeggio) ? a : a === true ? "up" /* Up */ : void 0;
2755
+ return guard_exports.isEnumValue(a, Arpeggio) ? a : a === true ? "up" /* Up */ : void 0;
2273
2756
  }
2274
2757
  function sortNotesAndStrings(notes, strings) {
2275
- let stringArr = Utils3.Arr.isArray(strings) ? strings : strings !== void 0 ? [strings] : [];
2758
+ let stringArr = utils_exports.Arr.isArray(strings) ? strings : strings !== void 0 ? [strings] : [];
2276
2759
  let noteStringData = notes.map((note, i) => {
2277
2760
  return { note, string: stringArr[i] };
2278
2761
  });
2279
- noteStringData = Utils3.Arr.removeDuplicates(noteStringData, (a, b) => Note4.equals(a.note, b.note)).sort((a, b) => Note4.compareFunc(a.note, b.note));
2762
+ noteStringData = utils_exports.Arr.removeDuplicates(noteStringData, (a, b) => Note4.equals(a.note, b.note)).sort((a, b) => Note4.compareFunc(a.note, b.note));
2280
2763
  return {
2281
2764
  sortedNotes: noteStringData.map((e) => e.note),
2282
2765
  sortedStrings: noteStringData.every((e) => e.string === void 0) ? void 0 : noteStringData.map((e) => e.string)
@@ -2398,8 +2881,8 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2398
2881
  __publicField(this, "tabObjects", []);
2399
2882
  __publicField(this, "isNoteDisplaced");
2400
2883
  __publicField(this, "mi");
2401
- if (!Guard2.isIntegerGte(notes.length, 1)) {
2402
- throw new MusicError6(MusicErrorType6.Score, "Cannot create note group object because notes array is empty.");
2884
+ if (!guard_exports.isIntegerGte(notes.length, 1)) {
2885
+ throw new MusicError5(MusicErrorType5.Score, "Cannot create note group object because notes array is empty.");
2403
2886
  }
2404
2887
  let { sortedNotes, sortedStrings } = sortNotesAndStrings(notes, options == null ? void 0 : options.string);
2405
2888
  this.notes = sortedNotes;
@@ -2409,7 +2892,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2409
2892
  this.runningDiatonicId = this.setDiatonicId;
2410
2893
  this.runningStemDir = "up" /* Up */;
2411
2894
  this.runningStringNumbers = [];
2412
- this.color = (_a = options == null ? void 0 : options.color) != null ? _a : "black";
2895
+ this.color = (_a = options == null ? void 0 : options.color) != null ? _a : DocumentColor.Staff_Note;
2413
2896
  this.staccato = (_b = options == null ? void 0 : options.staccato) != null ? _b : false;
2414
2897
  this.diamond = (_c = options == null ? void 0 : options.diamond) != null ? _c : false;
2415
2898
  this.arpeggio = getArpeggio(options == null ? void 0 : options.arpeggio);
@@ -2451,9 +2934,9 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2451
2934
  }
2452
2935
  startConnective(connectiveProps) {
2453
2936
  if (!this.row.hasStaff && connectiveProps.connective === "tie" /* Tie */) {
2454
- throw new MusicError6(MusicErrorType6.Score, "Ties not implemented for guitar tabs alone, staff is required!");
2937
+ throw new MusicError5(MusicErrorType5.Score, "Ties not implemented for guitar tabs alone, staff is required!");
2455
2938
  } else if (!this.row.hasStaff && connectiveProps.connective === "slur" /* Slur */) {
2456
- throw new MusicError6(MusicErrorType6.Score, "Slurs not implemented for guitar tabs alone, staff is required!");
2939
+ throw new MusicError5(MusicErrorType5.Score, "Slurs not implemented for guitar tabs alone, staff is required!");
2457
2940
  }
2458
2941
  this.startConnnectives.push(connectiveProps);
2459
2942
  this.doc.addConnectiveProps(connectiveProps);
@@ -2491,7 +2974,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2491
2974
  var _a;
2492
2975
  if (line instanceof ObjStaff) {
2493
2976
  if (noteIndex < 0 || noteIndex >= this.notes.length) {
2494
- throw new MusicError6(MusicErrorType6.Score, "Invalid noteIndex: " + noteIndex);
2977
+ throw new MusicError5(MusicErrorType5.Score, "Invalid noteIndex: " + noteIndex);
2495
2978
  }
2496
2979
  let obj = this.staffObjects.find((obj2) => obj2.staff === line);
2497
2980
  if (!obj || noteIndex < 0 || noteIndex >= obj.noteHeadRects.length) {
@@ -2539,7 +3022,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2539
3022
  case "stemTip" /* StemTip */:
2540
3023
  return { x: anchorX, y: stemTip.anchorY + (stemDir === "up" /* Up */ ? -padding : padding) };
2541
3024
  default:
2542
- throw new MusicError6(MusicErrorType6.Score, "Invalid noteAnchor: " + noteAnchor);
3025
+ throw new MusicError5(MusicErrorType5.Score, "Invalid noteAnchor: " + noteAnchor);
2543
3026
  }
2544
3027
  } else if (line instanceof ObjTab) {
2545
3028
  let fretNumber = (_a = this.tabObjects.find((obj) => obj.tab === line)) == null ? void 0 : _a.fretNumbers[noteIndex];
@@ -2689,7 +3172,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2689
3172
  if (j >= 0) {
2690
3173
  tieNoteGroups = tieNoteGroups.slice(0, j);
2691
3174
  }
2692
- return Utils3.Math.sum(tieNoteGroups.map((ng) => ng.rhythmProps.ticks));
3175
+ return utils_exports.Math.sum(tieNoteGroups.map((ng) => ng.rhythmProps.ticks));
2693
3176
  });
2694
3177
  return tiedTicks.length === 0 ? this.rhythmProps.ticks : Math.max(...tiedTicks);
2695
3178
  }
@@ -2728,7 +3211,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2728
3211
  if (isTopNote && stemDir === "up" /* Up */) stemTipStaff = noteStaff;
2729
3212
  if (isBottomNote && stemDir === "down" /* Down */) stemTipStaff = noteStaff;
2730
3213
  if (isTopNote && stemDir === "down" /* Down */) stemBaseStaff = noteStaff;
2731
- let noteHeadRect = obj.noteHeadRects[noteIndex] = AnchoredRect9.createCentered(noteX, noteY, noteHeadWidth, noteHeadHeight);
3214
+ let noteHeadRect = obj.noteHeadRects[noteIndex] = AnchoredRect.createCentered(noteX, noteY, noteHeadWidth, noteHeadHeight);
2732
3215
  noteStaff.addObject(noteHeadRect);
2733
3216
  if (accState.needAccidental(note)) {
2734
3217
  let acc = obj.accidentals[noteIndex] = new ObjAccidental(this, note.diatonicId, note.accidental, this.color);
@@ -2744,7 +3227,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2744
3227
  for (let i = 0; i < dotCount; i++) {
2745
3228
  let dotX = noteHeadRect.right + DocumentSettings.NoteDotSpace * unitSize + dotWidth / 2 + i * dotWidth * 1.5;
2746
3229
  let dotY = noteY + this.getDotVerticalDisplacement(staff, note.diatonicId, stemDir) * unitSize;
2747
- let r = AnchoredRect9.createCentered(dotX, dotY, dotWidth, dotWidth);
3230
+ let r = AnchoredRect.createCentered(dotX, dotY, dotWidth, dotWidth);
2748
3231
  obj.dotRects.push(r);
2749
3232
  noteStaff.addObject(r);
2750
3233
  }
@@ -2752,13 +3235,13 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2752
3235
  if (stemDir === "up" /* Up */ && isBottomNote) {
2753
3236
  let dotX = noteX;
2754
3237
  let dotY = noteY + unitSize * (isNoteOnLine ? 3 : 2);
2755
- let r = AnchoredRect9.createCentered(dotX, dotY, dotWidth, dotWidth);
3238
+ let r = AnchoredRect.createCentered(dotX, dotY, dotWidth, dotWidth);
2756
3239
  obj.dotRects.push(r);
2757
3240
  stemBaseStaff.addObject(r);
2758
3241
  } else if (stemDir === "down" /* Down */ && isTopNote) {
2759
3242
  let dotX = noteX;
2760
3243
  let dotY = noteY - unitSize * (isNoteOnLine ? 3 : 2);
2761
- let r = AnchoredRect9.createCentered(dotX, dotY, dotWidth, dotWidth);
3244
+ let r = AnchoredRect.createCentered(dotX, dotY, dotWidth, dotWidth);
2762
3245
  obj.dotRects.push(r);
2763
3246
  stemBaseStaff.addObject(r);
2764
3247
  }
@@ -2771,8 +3254,8 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2771
3254
  let stemTipY = stemDir === "up" /* Up */ ? topNoteY - stemHeight : bottomNoteY + stemHeight;
2772
3255
  let stemBaseY = stemDir === "up" /* Up */ ? bottomNoteY : topNoteY;
2773
3256
  if (hasStem) {
2774
- obj.stemTip = new AnchoredRect9(stemX, stemX, stemTipY, stemTipY);
2775
- obj.stemBase = new AnchoredRect9(stemX, stemX, stemBaseY, stemBaseY);
3257
+ obj.stemTip = new AnchoredRect(stemX, stemX, stemTipY, stemTipY);
3258
+ obj.stemBase = new AnchoredRect(stemX, stemX, stemBaseY, stemBaseY);
2776
3259
  stemTipStaff.addObject(obj.stemTip);
2777
3260
  stemBaseStaff.addObject(obj.stemBase);
2778
3261
  }
@@ -2781,7 +3264,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2781
3264
  let flagHeight = flagCount === 0 ? 0 : DocumentSettings.FlagHeight * unitSize;
2782
3265
  for (let i = 0; i < flagCount; i++) {
2783
3266
  let flagAddY = i * unitSize * DocumentSettings.FlagSeparation;
2784
- let r = obj.flagRects[i] = stemDir === "up" /* Up */ ? new AnchoredRect9(stemX, stemX + flagWidth, stemTipY + flagAddY, stemTipY + flagHeight + flagAddY) : new AnchoredRect9(stemX, stemX + flagWidth, stemTipY - flagHeight - flagAddY, stemTipY - flagAddY);
3267
+ let r = obj.flagRects[i] = stemDir === "up" /* Up */ ? new AnchoredRect(stemX, stemX + flagWidth, stemTipY + flagAddY, stemTipY + flagHeight + flagAddY) : new AnchoredRect(stemX, stemX + flagWidth, stemTipY - flagHeight - flagAddY, stemTipY - flagAddY);
2785
3268
  stemTipStaff.addObject(r);
2786
3269
  }
2787
3270
  }
@@ -2794,12 +3277,13 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2794
3277
  return;
2795
3278
  }
2796
3279
  let obj = new ObjTabNoteGroup(tab, this);
3280
+ const bgcolor = DocumentColor.Background;
3281
+ const color = DocumentColor.Tab_Note;
2797
3282
  this.notes.forEach((note, noteIndex) => {
2798
3283
  let stringNumber = this.runningStringNumbers[noteIndex];
2799
- if (Guard2.isIntegerBetween(stringNumber, 1, 6)) {
3284
+ if (guard_exports.isIntegerBetween(stringNumber, 1, 6)) {
2800
3285
  let fretId = note.chromaticId - tab.getTuningStrings()[stringNumber - 1].chromaticId;
2801
- let color = fretId < 0 ? "red" : "black";
2802
- let fretNumber = new ObjText(this, { text: String(fretId), color, bgcolor: "white" }, 0.5, 0.5);
3286
+ let fretNumber = new ObjText(this, { text: String(fretId), color, bgcolor }, 0.5, 0.5);
2803
3287
  fretNumber.layout(ctx);
2804
3288
  fretNumber.setAnchor(this.col.getRect().anchorX, tab.getStringY(stringNumber - 1));
2805
3289
  obj.fretNumbers.push(fretNumber);
@@ -2818,7 +3302,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2818
3302
  } else if (this.tabObjects.length > 0 && this.tabObjects[0].fretNumbers.length > 0) {
2819
3303
  this.rect = this.tabObjects[0].fretNumbers[0].getRect().clone();
2820
3304
  } else {
2821
- this.rect = new AnchoredRect9();
3305
+ this.rect = new AnchoredRect();
2822
3306
  return;
2823
3307
  }
2824
3308
  this.staffObjects.forEach((obj) => this.rect.expandInPlace(obj.getRect()));
@@ -2915,8 +3399,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2915
3399
  };
2916
3400
 
2917
3401
  // src/score/engine/obj-rhythm-column.ts
2918
- import { MusicError as MusicError7, MusicErrorType as MusicErrorType7 } from "@tspro/web-music-score/core";
2919
- import { IndexArray, UniMap as UniMap2, TriMap, AnchoredRect as AnchoredRect10 } from "@tspro/ts-utils-lib";
3402
+ import { MusicError as MusicError6, MusicErrorType as MusicErrorType6 } from "@tspro/web-music-score/core";
2920
3403
  var ObjRhythmColumn = class extends MusicObject {
2921
3404
  constructor(measure, positionTicks) {
2922
3405
  super(measure);
@@ -2926,8 +3409,8 @@ var ObjRhythmColumn = class extends MusicObject {
2926
3409
  __publicField(this, "lyricsObject", new TriMap());
2927
3410
  __publicField(this, "minDiatonicId");
2928
3411
  __publicField(this, "maxDiatonicId");
2929
- __publicField(this, "staffMinDiatonicId", new UniMap2());
2930
- __publicField(this, "staffMaxDiatonicId", new UniMap2());
3412
+ __publicField(this, "staffMinDiatonicId", new UniMap());
3413
+ __publicField(this, "staffMaxDiatonicId", new UniMap());
2931
3414
  __publicField(this, "arpeggioDir");
2932
3415
  __publicField(this, "arpeggios", []);
2933
3416
  __publicField(this, "playerProps");
@@ -2952,7 +3435,7 @@ var ObjRhythmColumn = class extends MusicObject {
2952
3435
  if (colId >= 0 && colId < this.measure.getColumnCount()) {
2953
3436
  return this.measure.getColumn(colId + 1);
2954
3437
  } else {
2955
- throw new MusicError7(MusicErrorType7.Score, "Cannot get next column in measure because current column's id in mesure is invalid.");
3438
+ throw new MusicError6(MusicErrorType6.Score, "Cannot get next column in measure because current column's id in mesure is invalid.");
2956
3439
  }
2957
3440
  }
2958
3441
  /**
@@ -3142,7 +3625,7 @@ var ObjRhythmColumn = class extends MusicObject {
3142
3625
  return;
3143
3626
  }
3144
3627
  let { row } = this;
3145
- this.rect = new AnchoredRect10();
3628
+ this.rect = new AnchoredRect();
3146
3629
  this.requestRectUpdate();
3147
3630
  let leftw = 0;
3148
3631
  let rightw = 0;
@@ -3259,6 +3742,7 @@ var ObjRhythmColumn = class extends MusicObject {
3259
3742
  this.rect.offsetInPlace(dx, dy);
3260
3743
  }
3261
3744
  draw(ctx) {
3745
+ ctx.color(DocumentColor.Staff_Frame);
3262
3746
  this.row.getStaves().forEach((staff) => {
3263
3747
  let minDiatonicId = this.staffMinDiatonicId.get(staff);
3264
3748
  let maxDiatonicId = this.staffMaxDiatonicId.get(staff);
@@ -3274,35 +3758,29 @@ var ObjRhythmColumn = class extends MusicObject {
3274
3758
  }
3275
3759
  };
3276
3760
 
3277
- // src/score/engine/extension.ts
3278
- import { MusicError as MusicError8, MusicErrorType as MusicErrorType8 } from "@tspro/web-music-score/core";
3279
-
3280
- // src/score/engine/element-data.ts
3281
- import { Guard as Guard3, Utils as Utils4 } from "@tspro/ts-utils-lib";
3282
-
3283
3761
  // src/score/engine/obj-special-text.ts
3284
- import { AnchoredRect as AnchoredRect11 } from "@tspro/ts-utils-lib";
3285
3762
  var _ObjSpecialText = class _ObjSpecialText extends MusicObject {
3286
- constructor(parent, text) {
3763
+ constructor(parent, text, color = "black") {
3287
3764
  super(parent);
3288
3765
  this.text = text;
3766
+ this.color = color;
3289
3767
  __publicField(this, "components", []);
3290
3768
  __publicField(this, "mi");
3291
3769
  switch (this.text) {
3292
3770
  case _ObjSpecialText.Coda:
3293
3771
  this.components = [
3294
- new ObjText(this, { text: "\u{1D10C}", scale: 1.7 }, 0.5, 0.3),
3295
- new ObjText(this, " Coda", 0, 1)
3772
+ new ObjText(this, { text: "\u{1D10C}", scale: 1.7, color }, 0.5, 0.3),
3773
+ new ObjText(this, { text: " Coda", color }, 0, 1)
3296
3774
  ];
3297
3775
  break;
3298
3776
  case _ObjSpecialText.toCoda:
3299
3777
  this.components = [
3300
- new ObjText(this, "toCoda ", 1, 1),
3301
- new ObjText(this, { text: "\u{1D10C}", scale: 1.7 }, 0.5, 0.3)
3778
+ new ObjText(this, { text: "toCoda ", color }, 1, 1),
3779
+ new ObjText(this, { text: "\u{1D10C}", scale: 1.7, color }, 0.5, 0.3)
3302
3780
  ];
3303
3781
  break;
3304
3782
  case _ObjSpecialText.Segno:
3305
- this.components = [new ObjText(this, { text: "\u{1D10B}", scale: 1.1 }, 0.5, 1)];
3783
+ this.components = [new ObjText(this, { text: "\u{1D10B}", scale: 1.1, color }, 0.5, 1)];
3306
3784
  break;
3307
3785
  default:
3308
3786
  this.components = [];
@@ -3328,7 +3806,7 @@ var _ObjSpecialText = class _ObjSpecialText extends MusicObject {
3328
3806
  codaText.layout(ctx);
3329
3807
  codaSym.setAnchorY(codaText.getRect().centerY);
3330
3808
  codaText.setLeft(codaSym.getRect().right);
3331
- this.rect = new AnchoredRect11(
3809
+ this.rect = new AnchoredRect(
3332
3810
  codaSym.getRect().left,
3333
3811
  codaSym.getRect().anchorX,
3334
3812
  codaText.getRect().right,
@@ -3345,7 +3823,7 @@ var _ObjSpecialText = class _ObjSpecialText extends MusicObject {
3345
3823
  codaSym.layout(ctx);
3346
3824
  codaSym.setAnchorY(toCodaText.getRect().centerY);
3347
3825
  toCodaText.setRight(codaSym.getRect().left);
3348
- this.rect = new AnchoredRect11(
3826
+ this.rect = new AnchoredRect(
3349
3827
  toCodaText.getRect().left,
3350
3828
  codaSym.getRect().anchorX,
3351
3829
  codaSym.getRect().right,
@@ -3377,6 +3855,84 @@ __publicField(_ObjSpecialText, "Coda", "Coda \u{1D10C}");
3377
3855
  __publicField(_ObjSpecialText, "Segno", "\u{1D10B}");
3378
3856
  var ObjSpecialText = _ObjSpecialText;
3379
3857
 
3858
+ // src/score/engine/extension.ts
3859
+ function getTextContent(obj) {
3860
+ if (obj instanceof ObjText || obj instanceof ObjSpecialText)
3861
+ return obj.getText();
3862
+ if (obj instanceof ObjMeasure)
3863
+ return "[measure]";
3864
+ return "";
3865
+ }
3866
+ var ExtensionRange = class {
3867
+ constructor(startColumn) {
3868
+ this.startColumn = startColumn;
3869
+ __publicField(this, "columnRange");
3870
+ __publicField(this, "stopObject");
3871
+ this.columnRange = [startColumn];
3872
+ }
3873
+ get endColumn() {
3874
+ return this.columnRange[this.columnRange.length - 1];
3875
+ }
3876
+ addColumn(col) {
3877
+ if (this.endColumn !== col) this.columnRange.push(col);
3878
+ }
3879
+ setStopObject(obj) {
3880
+ this.stopObject = obj;
3881
+ }
3882
+ };
3883
+ var _Extension = class _Extension extends MusicObjectLink {
3884
+ constructor(headObj, startColumn, length, visible, lineStyle, linePos) {
3885
+ super(headObj.musicObj);
3886
+ this.headObj = headObj;
3887
+ __publicField(this, "length");
3888
+ __publicField(this, "visible");
3889
+ __publicField(this, "lineStyle");
3890
+ __publicField(this, "linePos");
3891
+ __publicField(this, "startColumn");
3892
+ this.length = length + 1;
3893
+ this.visible = visible;
3894
+ this.lineStyle = lineStyle;
3895
+ this.linePos = linePos;
3896
+ this.startColumn = startColumn;
3897
+ }
3898
+ isVisible() {
3899
+ return this.visible;
3900
+ }
3901
+ getLineStyle() {
3902
+ return this.lineStyle;
3903
+ }
3904
+ getLinePos() {
3905
+ return this.linePos;
3906
+ }
3907
+ whatStopped(col) {
3908
+ const m = col.measure;
3909
+ const cols = m.getColumns();
3910
+ const stoppingCol = col.getAnchoredLayoutObjects().filter((obj) => obj !== this.headObj && obj.layoutGroupId === this.headObj.layoutGroupId).map((obj) => obj.musicObj).filter((obj) => obj instanceof ObjText || obj instanceof ObjSpecialText)[0];
3911
+ return stoppingCol ? stoppingCol : col === cols[cols.length - 1] && m.hasEndSection() || m.hasEndSong() || _Extension.StopNavigations.some((nav) => m.hasNavigation(nav)) ? m.getBarLineRight() : void 0;
3912
+ }
3913
+ getRange() {
3914
+ let { startColumn, length } = this;
3915
+ let curColumn = startColumn;
3916
+ let range = new ExtensionRange(curColumn);
3917
+ let ticksLeft = length;
3918
+ while (true) {
3919
+ if (ticksLeft <= 0) return range;
3920
+ const stopObject = this.whatStopped(curColumn);
3921
+ if (stopObject !== void 0) {
3922
+ range.setStopObject(stopObject);
3923
+ return range;
3924
+ }
3925
+ ticksLeft -= curColumn.getTicksToNextColumn();
3926
+ curColumn = curColumn.getNextColumn();
3927
+ if (!curColumn) return range;
3928
+ if (ticksLeft > 0)
3929
+ range.addColumn(curColumn);
3930
+ }
3931
+ }
3932
+ };
3933
+ __publicField(_Extension, "StopNavigations", ["endRepeat" /* EndRepeat */, "ending" /* Ending */]);
3934
+ var Extension = _Extension;
3935
+
3380
3936
  // src/score/engine/element-data.ts
3381
3937
  function getNavigationString(navigation) {
3382
3938
  switch (navigation) {
@@ -3400,140 +3956,24 @@ function getNavigationString(navigation) {
3400
3956
  return navigation[0].toUpperCase() + navigation.substring(1);
3401
3957
  }
3402
3958
  }
3403
- function isDynamicsText(text) {
3404
- return Guard3.isEnumValue(text, DynamicsAnnotation);
3405
- }
3406
3959
  function getDynamicsVolume(text) {
3407
3960
  if (/^(p+|f+|m|mp|mf)$/.test(text)) {
3408
- let volume = 0.5 - Utils4.Str.charCount(text, "p") * 0.1 + Utils4.Str.charCount(text, "f") * 0.1;
3409
- return Utils4.Math.clamp(volume, 0, 1);
3961
+ let volume = 0.5 - utils_exports.Str.charCount(text, "p") * 0.1 + utils_exports.Str.charCount(text, "f") * 0.1;
3962
+ return utils_exports.Math.clamp(volume, 0, 1);
3410
3963
  } else {
3411
3964
  return void 0;
3412
3965
  }
3413
3966
  }
3414
- function isTempoText(text) {
3415
- return Guard3.isEnumValue(text, TempoAnnotation);
3416
- }
3417
3967
  function getAnnotation(text) {
3418
- if (Guard3.isEnumValue(text, DynamicsAnnotation)) {
3968
+ if (guard_exports.isEnumValue(text, DynamicsAnnotation)) {
3419
3969
  return "dynamics" /* Dynamics */;
3420
- } else if (Guard3.isEnumValue(text, TempoAnnotation)) {
3970
+ } else if (guard_exports.isEnumValue(text, TempoAnnotation)) {
3421
3971
  return "tempo" /* Tempo */;
3422
3972
  } else {
3423
3973
  return void 0;
3424
3974
  }
3425
3975
  }
3426
3976
 
3427
- // src/score/engine/extension.ts
3428
- function getTextAnchorY(linePos) {
3429
- switch (linePos) {
3430
- case "bottom":
3431
- return 0.8;
3432
- case "middle":
3433
- return 0.5;
3434
- }
3435
- }
3436
- function getContext(elementText) {
3437
- if (isDynamicsText(elementText)) {
3438
- return 2 /* Volume */;
3439
- } else if (isTempoText(elementText)) {
3440
- return 1 /* Tempo */;
3441
- } else {
3442
- return 0 /* Undefined */;
3443
- }
3444
- }
3445
- var Extension = class extends MusicObjectLink {
3446
- constructor(head, startColumn, length, visible, lineStyle, linePos) {
3447
- super(head);
3448
- __publicField(this, "length");
3449
- __publicField(this, "visible");
3450
- __publicField(this, "lineStyle");
3451
- __publicField(this, "linePos");
3452
- __publicField(this, "startColumn");
3453
- __publicField(this, "context");
3454
- this.length = length;
3455
- this.visible = visible;
3456
- this.lineStyle = lineStyle;
3457
- this.linePos = linePos;
3458
- this.startColumn = startColumn;
3459
- this.context = head instanceof ObjText ? getContext(head.getText()) : 0 /* Undefined */;
3460
- if (head instanceof ObjText) {
3461
- head.updateAnchorY(getTextAnchorY(linePos));
3462
- } else {
3463
- throw new MusicError8(MusicErrorType8.Score, "Update anchor's y-coordinate is only implemented for text objects.");
3464
- }
3465
- }
3466
- isVisible() {
3467
- return this.visible;
3468
- }
3469
- getLineStyle() {
3470
- return this.lineStyle;
3471
- }
3472
- getLinePos() {
3473
- return this.linePos;
3474
- }
3475
- getSpanBreakText(col, context) {
3476
- if (col === col.measure.getColumn(0)) {
3477
- let prevMeasure = col.measure.getPrevMeasure();
3478
- if (prevMeasure) {
3479
- if (prevMeasure.hasEndSection() || prevMeasure.hasEndSong()) {
3480
- return "section-break";
3481
- }
3482
- let elemArr = ["endRepeat" /* EndRepeat */, "ending" /* Ending */];
3483
- for (let i = 0; i < elemArr.length; i++) {
3484
- if (prevMeasure.hasNavigation(elemArr[i])) {
3485
- return "section-break";
3486
- }
3487
- }
3488
- }
3489
- }
3490
- if (context === 1 /* Tempo */) {
3491
- let objArr = col.getAnchoredLayoutObjects();
3492
- for (let i = 0; i < objArr.length; i++) {
3493
- let text = objArr[i].getTextContent();
3494
- if (text && isTempoText(text)) {
3495
- return text;
3496
- }
3497
- }
3498
- } else if (context === 2 /* Volume */) {
3499
- let objArr = col.getAnchoredLayoutObjects();
3500
- for (let i = 0; i < objArr.length; i++) {
3501
- let text = objArr[i].getTextContent();
3502
- if (text && isDynamicsText(text)) {
3503
- return text;
3504
- }
3505
- }
3506
- }
3507
- return void 0;
3508
- }
3509
- getExtensionRangeInfo() {
3510
- let { startColumn, length: extensionLength, context } = this;
3511
- let columnRange = [startColumn];
3512
- if (extensionLength <= 0) {
3513
- return { startColumn, endColumn: startColumn, columnRange, extensionBreakText: void 0 };
3514
- }
3515
- let ticksLeft = extensionLength;
3516
- let endColumn = startColumn;
3517
- while (true) {
3518
- let nextColumn = endColumn.getNextColumn();
3519
- if (!nextColumn) {
3520
- return { startColumn, endColumn, columnRange, extensionBreakText: void 0 };
3521
- }
3522
- let extensionBreakText = this.getSpanBreakText(nextColumn, context);
3523
- if (extensionBreakText !== void 0) {
3524
- return { startColumn, endColumn, columnRange, extensionBreakText };
3525
- }
3526
- ticksLeft -= endColumn.getTicksToNextColumn();
3527
- if (ticksLeft <= 0) {
3528
- return { startColumn, endColumn, columnRange, extensionBreakText: void 0 };
3529
- } else {
3530
- endColumn = nextColumn;
3531
- columnRange.push(endColumn);
3532
- }
3533
- }
3534
- }
3535
- };
3536
-
3537
3977
  // src/score/engine/player.ts
3538
3978
  var AccelerandoSpeedMul = 2;
3539
3979
  var RitardandoSpeedDiv = 2;
@@ -3573,7 +4013,7 @@ var PlayerColumnProps = class {
3573
4013
  return this.speed;
3574
4014
  }
3575
4015
  getTempo() {
3576
- let speed = Utils5.Math.clamp(this.getSpeed(), 0.1, 10);
4016
+ let speed = utils_exports.Math.clamp(this.getSpeed(), 0.1, 10);
3577
4017
  return alterTempoSpeed(this.measure.getTempo(), speed);
3578
4018
  }
3579
4019
  setVolume(volume) {
@@ -3598,7 +4038,7 @@ var PlayerColumnProps = class {
3598
4038
  if (symbolsTicks.length === 0) {
3599
4039
  return 0;
3600
4040
  } else {
3601
- return Utils5.Math.sum(symbolsTicks) / symbolsTicks.length;
4041
+ return utils_exports.Math.sum(symbolsTicks) / symbolsTicks.length;
3602
4042
  }
3603
4043
  }
3604
4044
  }
@@ -3721,8 +4161,8 @@ var Player = class _Player {
3721
4161
  }
3722
4162
  let curSpeed = 1;
3723
4163
  let curVolume = getDefaultVolume();
3724
- let speedMap = new UniMap3();
3725
- let volumeMap = new UniMap3();
4164
+ let speedMap = new UniMap();
4165
+ let volumeMap = new UniMap();
3726
4166
  const pushSpeed = (col, speed) => speedMap.getOrCreate(col, []).push(speed);
3727
4167
  const pushVolume = (col, volume) => volumeMap.getOrCreate(col, []).push(volume);
3728
4168
  this.playerColumnSequence.forEach((col) => {
@@ -3730,8 +4170,7 @@ var Player = class _Player {
3730
4170
  return;
3731
4171
  }
3732
4172
  col.getAnchoredLayoutObjects().forEach((layoutObj) => {
3733
- var _a;
3734
- let text = (_a = layoutObj.getTextContent()) != null ? _a : "";
4173
+ const text = getTextContent(layoutObj.musicObj);
3735
4174
  let vol;
3736
4175
  if (text === "a tempo" /* a_tempo */) {
3737
4176
  curSpeed = 1;
@@ -3739,14 +4178,15 @@ var Player = class _Player {
3739
4178
  curVolume = vol;
3740
4179
  } else if (layoutObj.musicObj.getLink() instanceof Extension) {
3741
4180
  let extension = layoutObj.musicObj.getLink();
3742
- let { columnRange, extensionBreakText } = extension.getExtensionRangeInfo();
3743
- let totalTicks = Utils5.Math.sum(columnRange.map((c) => c.getTicksToNextColumn()));
4181
+ const range = extension.getRange();
4182
+ const stopText = range.stopObject ? getTextContent(range.stopObject) : "";
4183
+ let totalTicks = utils_exports.Math.sum(range.columnRange.map((c) => c.getTicksToNextColumn()));
3744
4184
  switch (text) {
3745
4185
  case "accel." /* accel */: {
3746
4186
  let startSpeed = curSpeed;
3747
4187
  let endSpeed = startSpeed * AccelerandoSpeedMul;
3748
4188
  let accuTicks = 0;
3749
- columnRange.forEach((c) => {
4189
+ range.columnRange.forEach((c) => {
3750
4190
  accuTicks += c.getTicksToNextColumn();
3751
4191
  pushSpeed(c, startSpeed + (endSpeed - startSpeed) * accuTicks / totalTicks);
3752
4192
  });
@@ -3756,7 +4196,7 @@ var Player = class _Player {
3756
4196
  let startSpeed = curSpeed;
3757
4197
  let endSpeed = startSpeed / RitardandoSpeedDiv;
3758
4198
  let accuTicks = 0;
3759
- columnRange.forEach((c) => {
4199
+ range.columnRange.forEach((c) => {
3760
4200
  accuTicks += c.getTicksToNextColumn();
3761
4201
  pushSpeed(c, startSpeed + (endSpeed - startSpeed) * accuTicks / totalTicks);
3762
4202
  });
@@ -3765,11 +4205,11 @@ var Player = class _Player {
3765
4205
  case "cresc." /* cresc */: {
3766
4206
  let startVol = curVolume;
3767
4207
  let endVol = startVol + CrescendoVolumeAdd;
3768
- if (extensionBreakText && (vol = getDynamicsVolume(extensionBreakText)) !== void 0 && vol > startVol) {
4208
+ if (range.stopObject && (vol = getDynamicsVolume(stopText)) !== void 0 && vol > startVol) {
3769
4209
  endVol = vol;
3770
4210
  }
3771
4211
  let accuTicks = 0;
3772
- columnRange.forEach((c) => {
4212
+ range.columnRange.forEach((c) => {
3773
4213
  accuTicks += c.getTicksToNextColumn();
3774
4214
  pushVolume(c, startVol + (endVol - startVol) * accuTicks / totalTicks);
3775
4215
  });
@@ -3779,11 +4219,11 @@ var Player = class _Player {
3779
4219
  case "dim." /* dim */: {
3780
4220
  let startVol = curVolume;
3781
4221
  let endVol = startVol - DiminuendoVolumeSub;
3782
- if (extensionBreakText && (vol = getDynamicsVolume(extensionBreakText)) !== void 0 && vol < startVol) {
4222
+ if (range.stopObject && (vol = getDynamicsVolume(stopText)) !== void 0 && vol < startVol) {
3783
4223
  endVol = vol;
3784
4224
  }
3785
4225
  let accuTicks = 0;
3786
- columnRange.forEach((c) => {
4226
+ range.columnRange.forEach((c) => {
3787
4227
  accuTicks += c.getTicksToNextColumn();
3788
4228
  pushVolume(c, startVol + (endVol - startVol) * accuTicks / totalTicks);
3789
4229
  });
@@ -3794,11 +4234,11 @@ var Player = class _Player {
3794
4234
  });
3795
4235
  let speedArr = speedMap.getOrDefault(col, []);
3796
4236
  if (speedArr.length > 0) {
3797
- curSpeed = Utils5.Math.sum(speedArr) / speedArr.length;
4237
+ curSpeed = utils_exports.Math.sum(speedArr) / speedArr.length;
3798
4238
  }
3799
4239
  let volumeArr = volumeMap.getOrDefault(col, []);
3800
4240
  if (volumeArr.length > 0) {
3801
- curVolume = Utils5.Math.sum(volumeArr) / volumeArr.length;
4241
+ curVolume = utils_exports.Math.sum(volumeArr) / volumeArr.length;
3802
4242
  }
3803
4243
  col.getPlayerProps().setSpeed(curSpeed);
3804
4244
  col.getPlayerProps().setVolume(curVolume);
@@ -3918,17 +4358,17 @@ var Player = class _Player {
3918
4358
  let measure = col.measure;
3919
4359
  let x = col.getRect().anchorX;
3920
4360
  let { top, height } = measure.row.getRect();
3921
- return new Rect2(x, top, 0, height);
4361
+ return new Rect(x, top, 0, height);
3922
4362
  }
3923
4363
  };
3924
4364
 
3925
4365
  // src/score/engine/obj-bar-line.ts
3926
- import { AnchoredRect as AnchoredRect13, UniMap as UniMap4 } from "@tspro/ts-utils-lib";
3927
4366
  var ObjStaffBarLine = class extends MusicObject {
3928
- constructor(barLine, line) {
4367
+ constructor(barLine, line, rowGroup) {
3929
4368
  super(line);
3930
4369
  this.barLine = barLine;
3931
4370
  this.line = line;
4371
+ this.rowGroup = rowGroup;
3932
4372
  __publicField(this, "vlines", []);
3933
4373
  __publicField(this, "dots", []);
3934
4374
  __publicField(this, "mi");
@@ -3942,12 +4382,12 @@ var ObjStaffBarLine = class extends MusicObject {
3942
4382
  return this.getRect().contains(x, y) ? [this] : [];
3943
4383
  }
3944
4384
  updateRect() {
3945
- this.rect = new AnchoredRect13(0, 0, this.line.getTopLineY(), this.line.getBottomLineY());
4385
+ this.rect = new AnchoredRect(0, 0, this.line.getTopLineY(), this.line.getBottomLineY());
3946
4386
  this.vlines.forEach(
3947
- (l) => this.rect.expandInPlace(new AnchoredRect13(l.left, l.left + l.width, this.rect.top, this.rect.bottom))
4387
+ (l) => this.rect.expandInPlace(new AnchoredRect(l.left, l.left + l.width, this.rect.top, this.rect.bottom))
3948
4388
  );
3949
4389
  this.dots.forEach(
3950
- (d) => this.rect.expandInPlace(new AnchoredRect13(d.x - d.r, d.x + d.r, d.y - d.r, d.y + d.r))
4390
+ (d) => this.rect.expandInPlace(new AnchoredRect(d.x - d.r, d.x + d.r, d.y - d.r, d.y + d.r))
3951
4391
  );
3952
4392
  }
3953
4393
  offset(dx, dy) {
@@ -3964,9 +4404,15 @@ var ObjBarLine = class extends MusicObject {
3964
4404
  super(measure);
3965
4405
  this.measure = measure;
3966
4406
  __publicField(this, "notationLineObjects", []);
3967
- __publicField(this, "notationLineObjectsByGrp", new UniMap4());
4407
+ __publicField(this, "notationLineObjectsByGrp", new UniMap());
3968
4408
  __publicField(this, "barLineType", 0 /* None */);
3969
4409
  }
4410
+ get doc() {
4411
+ return this.measure.doc;
4412
+ }
4413
+ get row() {
4414
+ return this.measure.row;
4415
+ }
3970
4416
  pick(x, y) {
3971
4417
  if (!this.getRect().contains(x, y)) {
3972
4418
  return [];
@@ -3994,7 +4440,7 @@ var ObjBarLine = class extends MusicObject {
3994
4440
  this.notationLineObjectsByGrp.clear();
3995
4441
  row.getRowGroups().forEach((grp) => {
3996
4442
  grp.lines.forEach((line) => {
3997
- let obj = new ObjStaffBarLine(this, line);
4443
+ let obj = new ObjStaffBarLine(this, line, grp);
3998
4444
  this.notationLineObjects.push(obj);
3999
4445
  this.notationLineObjectsByGrp.getOrCreate(grp, []).push(obj);
4000
4446
  let lineCenterY;
@@ -4058,7 +4504,7 @@ var ObjBarLine = class extends MusicObject {
4058
4504
  this.rect.expandInPlace(this.notationLineObjects[i].getRect());
4059
4505
  }
4060
4506
  } else {
4061
- this.rect = new AnchoredRect13();
4507
+ this.rect = new AnchoredRect();
4062
4508
  }
4063
4509
  }
4064
4510
  offset(dx, dy) {
@@ -4069,16 +4515,10 @@ var ObjBarLine = class extends MusicObject {
4069
4515
  if (this.barLineType === 0 /* None */)
4070
4516
  return;
4071
4517
  ctx.drawDebugRect(this.getRect());
4072
- ctx.color("black");
4073
- for (const [grp, objects] of this.notationLineObjectsByGrp) {
4074
- objects.forEach((obj, i) => {
4075
- obj.dots.forEach((d) => ctx.fillCircle(d.x, d.y, d.r));
4076
- if (i === 0) {
4077
- let { top, height } = obj.barLine.getRect();
4078
- obj.vlines.forEach((l) => ctx.fillRect(l.left, top, l.width, height));
4079
- }
4080
- });
4081
- }
4518
+ this.notationLineObjects.forEach((o) => {
4519
+ o.vlines.forEach((l) => o.line.drawVerticalLine(ctx, l.left, l.width));
4520
+ o.dots.forEach((d) => ctx.fillCircle(d.x, d.y, d.r));
4521
+ });
4082
4522
  }
4083
4523
  };
4084
4524
  var ObjBarLineLeft = class extends ObjBarLine {
@@ -4143,25 +4583,25 @@ var ObjBarLineRight = class extends ObjBarLine {
4143
4583
  };
4144
4584
 
4145
4585
  // src/score/engine/obj-ending.ts
4146
- import { AnchoredRect as AnchoredRect14, Guard as Guard4 } from "@tspro/ts-utils-lib";
4147
- import { MusicError as MusicError9, MusicErrorType as MusicErrorType9 } from "@tspro/web-music-score/core";
4586
+ import { MusicError as MusicError7, MusicErrorType as MusicErrorType7 } from "@tspro/web-music-score/core";
4148
4587
  var ObjEnding = class extends MusicObject {
4149
- constructor(measure, passages) {
4588
+ constructor(measure, color, passages) {
4150
4589
  super(measure);
4151
4590
  this.measure = measure;
4591
+ this.color = color;
4152
4592
  this.passages = passages;
4153
4593
  __publicField(this, "endingText");
4154
4594
  __publicField(this, "shapeRects", []);
4155
4595
  __publicField(this, "mi");
4156
4596
  this.mi = new MEnding(this);
4157
- if (!Guard4.isIntegerGte(passages.length, 1)) {
4158
- throw new MusicError9(MusicErrorType9.Score, "Passages is empty.");
4159
- } else if (!this.passages.every((p) => Guard4.isIntegerGte(p, 1))) {
4160
- throw new MusicError9(MusicErrorType9.Score, "Invalid passages: " + this.passages);
4597
+ if (!guard_exports.isIntegerGte(passages.length, 1)) {
4598
+ throw new MusicError7(MusicErrorType7.Score, "Passages is empty.");
4599
+ } else if (!this.passages.every((p) => guard_exports.isIntegerGte(p, 1))) {
4600
+ throw new MusicError7(MusicErrorType7.Score, "Invalid passages: " + this.passages);
4161
4601
  }
4162
4602
  this.passages.sort((a, b) => a - b);
4163
- let text = this.passages.map((p) => p + ".").join("");
4164
- this.endingText = new ObjText(this, text, 0, 1);
4603
+ const text = this.passages.map((p) => p + ".").join("");
4604
+ this.endingText = new ObjText(this, { text, color }, 0, 1);
4165
4605
  }
4166
4606
  getMusicInterface() {
4167
4607
  return this.mi;
@@ -4184,7 +4624,7 @@ var ObjEnding = class extends MusicObject {
4184
4624
  return this.rect.contains(x, y) ? [this] : [];
4185
4625
  }
4186
4626
  layout(ctx) {
4187
- this.rect = new AnchoredRect14();
4627
+ this.rect = new AnchoredRect();
4188
4628
  this.shapeRects = [this.rect.clone()];
4189
4629
  }
4190
4630
  layoutFitToMeasure(ctx) {
@@ -4194,13 +4634,13 @@ var ObjEnding = class extends MusicObject {
4194
4634
  let textRect = this.endingText.getRect();
4195
4635
  let measureContent = measure.getColumnsContentRect();
4196
4636
  let endingHeight = textRect.height;
4197
- this.rect = new AnchoredRect14(measureContent.left + unitSize, measureContent.right - unitSize, -endingHeight, 0);
4637
+ this.rect = new AnchoredRect(measureContent.left + unitSize, measureContent.right - unitSize, -endingHeight, 0);
4198
4638
  this.endingText.setLeft(this.rect.left + unitSize / 2);
4199
4639
  this.endingText.setBottom(this.rect.bottom);
4200
4640
  this.shapeRects = [
4201
- new AnchoredRect14(this.rect.left, this.rect.left + 1, this.rect.top, this.rect.bottom),
4202
- new AnchoredRect14(this.rect.left, this.rect.right, this.rect.top, this.rect.top + 1),
4203
- new AnchoredRect14(this.rect.right - 1, this.rect.right, this.rect.top, this.rect.bottom),
4641
+ new AnchoredRect(this.rect.left, this.rect.left + 1, this.rect.top, this.rect.bottom),
4642
+ new AnchoredRect(this.rect.left, this.rect.right, this.rect.top, this.rect.top + 1),
4643
+ new AnchoredRect(this.rect.right - 1, this.rect.right, this.rect.top, this.rect.bottom),
4204
4644
  this.endingText.getRect().clone()
4205
4645
  ];
4206
4646
  }
@@ -4212,7 +4652,7 @@ var ObjEnding = class extends MusicObject {
4212
4652
  draw(ctx) {
4213
4653
  let { rect } = this;
4214
4654
  ctx.drawDebugRect(this.rect);
4215
- ctx.color("black").lineWidth(1);
4655
+ ctx.color(this.color).lineWidth(1);
4216
4656
  ctx.beginPath();
4217
4657
  ctx.moveTo(rect.left, rect.bottom);
4218
4658
  ctx.lineTo(rect.left, rect.top);
@@ -4226,9 +4666,8 @@ var ObjEnding = class extends MusicObject {
4226
4666
  };
4227
4667
 
4228
4668
  // src/score/engine/obj-beam-group.ts
4229
- import { AnchoredRect as AnchoredRect15, Utils as Utils6 } from "@tspro/ts-utils-lib";
4230
4669
  import { NoteLength as NoteLength5, Tuplet as Tuplet3, NoteLengthProps as NoteLengthProps4 } from "@tspro/web-music-score/theory";
4231
- import { MusicError as MusicError10, MusicErrorType as MusicErrorType10 } from "@tspro/web-music-score/core";
4670
+ import { MusicError as MusicError8, MusicErrorType as MusicErrorType8 } from "@tspro/web-music-score/core";
4232
4671
  var adjustBeamAngle = (dx, dy) => {
4233
4672
  let T = DocumentSettings.BeamAngleFactor;
4234
4673
  if (!Number.isFinite(T) || T === 0) {
@@ -4256,7 +4695,7 @@ var BeamPoint = class {
4256
4695
  this.beamGroup.requestRectUpdate();
4257
4696
  }
4258
4697
  getRect() {
4259
- return new AnchoredRect15(this.x, this.x, this.x, this.y - this.topBeamsHeight, this.y, this.y + this.bottomBeamsHeight);
4698
+ return new AnchoredRect(this.x, this.x, this.x, this.y - this.topBeamsHeight, this.y, this.y + this.bottomBeamsHeight);
4260
4699
  }
4261
4700
  };
4262
4701
  var ObjStaffBeamGroup = class extends MusicObject {
@@ -4313,9 +4752,9 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4313
4752
  this.mi = new MBeamGroup(this);
4314
4753
  let beamGroupName = tupletRatio ? "Tuplet" : "BeamGroup";
4315
4754
  if (!symbols.every((s) => s.measure === symbols[0].measure)) {
4316
- throw new MusicError10(MusicErrorType10.Score, `All ${beamGroupName} symbols are not in same measure.`);
4755
+ throw new MusicError8(MusicErrorType8.Score, `All ${beamGroupName} symbols are not in same measure.`);
4317
4756
  } else if (symbols.length < 2) {
4318
- throw new MusicError10(MusicErrorType10.Score, `${beamGroupName} needs minimum 2 symbols, but ${symbols.length} given.`);
4757
+ throw new MusicError8(MusicErrorType8.Score, `${beamGroupName} needs minimum 2 symbols, but ${symbols.length} given.`);
4319
4758
  }
4320
4759
  if (tupletRatio !== void 0) {
4321
4760
  let isGroup = symbols.length < 3 || symbols.some((s) => !(s instanceof ObjNoteGroup)) || symbols.some((s) => s.rhythmProps.flagCount !== symbols[0].rhythmProps.flagCount);
@@ -4335,7 +4774,7 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4335
4774
  symbols.forEach((s) => s.setBeamGroup(this));
4336
4775
  symbols[0].measure.addBeamGroup(this);
4337
4776
  } else {
4338
- throw new MusicError10(MusicErrorType10.Score, `Cannot add ${beamGroupName} because some symbol already has one.`);
4777
+ throw new MusicError8(MusicErrorType8.Score, `Cannot add ${beamGroupName} because some symbol already has one.`);
4339
4778
  }
4340
4779
  if (this.type === 0 /* RegularBeam */) {
4341
4780
  this.symbols.filter((sym) => sym instanceof ObjNoteGroup).some((sym, i) => {
@@ -4350,7 +4789,7 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4350
4789
  if (this.type === 0 /* RegularBeam */) {
4351
4790
  throw new InvalidBeamGroup(this, "Beam symbols have different voiceId.");
4352
4791
  } else {
4353
- throw new MusicError10(MusicErrorType10.Score, `Tuplet symbols have different voiceId.`);
4792
+ throw new MusicError8(MusicErrorType8.Score, `Tuplet symbols have different voiceId.`);
4354
4793
  }
4355
4794
  }
4356
4795
  symbols[0].row.getStaves().forEach((staff) => {
@@ -4534,7 +4973,7 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4534
4973
  symbolY.forEach((symY, i) => {
4535
4974
  let symX = symbolX[i];
4536
4975
  if (symX !== void 0 && symY !== void 0) {
4537
- let beamY = Utils6.Math.interpolateY(leftX, leftY, rightX, rightY, symX);
4976
+ let beamY = utils_exports.Math.interpolateY(leftX, leftY, rightX, rightY, symX);
4538
4977
  let raiseY = symY - beamY;
4539
4978
  if (stemDir === "up" /* Up */ && raiseY < 0) {
4540
4979
  raiseBeamY = Math.min(raiseBeamY, raiseY);
@@ -4549,8 +4988,8 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4549
4988
  let obj = new ObjStaffBeamGroup(mainStaff, this);
4550
4989
  if (type === 2 /* TupletGroup */) {
4551
4990
  let ef = unitSize / (rightX - leftX);
4552
- let l = Utils6.Math.interpolateCoord(leftX, leftY + groupLineDy, rightX, rightY + groupLineDy, -ef);
4553
- let r = Utils6.Math.interpolateCoord(leftX, leftY + groupLineDy, rightX, rightY + groupLineDy, 1 + ef);
4991
+ let l = utils_exports.Math.interpolateCoord(leftX, leftY + groupLineDy, rightX, rightY + groupLineDy, -ef);
4992
+ let r = utils_exports.Math.interpolateCoord(leftX, leftY + groupLineDy, rightX, rightY + groupLineDy, 1 + ef);
4554
4993
  obj.points.push(new BeamPoint(leftStaff, this, leftSymbol, l.x, l.y));
4555
4994
  obj.points.push(new BeamPoint(rightStaff, this, rightSymbol, r.x, r.y));
4556
4995
  obj.tupletNumberOffsetY = 0;
@@ -4599,7 +5038,7 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4599
5038
  }
4600
5039
  updateRect() {
4601
5040
  if (this.staffObjects.length === 0) {
4602
- this.rect = new AnchoredRect15();
5041
+ this.rect = new AnchoredRect();
4603
5042
  } else {
4604
5043
  this.staffObjects.forEach((obj) => obj.updateRect());
4605
5044
  this.rect = this.staffObjects[0].getRect().clone();
@@ -4616,7 +5055,7 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4616
5055
  obj.points.forEach((pt) => {
4617
5056
  if (pt.symbol instanceof ObjNoteGroup) {
4618
5057
  if (pt !== left && pt !== right) {
4619
- pt.y = Utils6.Math.interpolateY(left.x, left.y, right.x, right.y, pt.x);
5058
+ pt.y = utils_exports.Math.interpolateY(left.x, left.y, right.x, right.y, pt.x);
4620
5059
  }
4621
5060
  pt.symbol.setStemTipY(pt.staff, pt.y);
4622
5061
  }
@@ -4642,8 +5081,8 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4642
5081
  let { x: rx, y: ry } = obj.points[obj.points.length - 1];
4643
5082
  if (obj.tupletNumber) {
4644
5083
  let tf = obj.tupletNumber.getRect().width / (rx - lx) * 1.2;
4645
- let lc = Utils6.Math.interpolateCoord(lx, ly, rx, ry, 0.5 - tf / 2);
4646
- let rc = Utils6.Math.interpolateCoord(lx, ly, rx, ry, 0.5 + tf / 2);
5084
+ let lc = utils_exports.Math.interpolateCoord(lx, ly, rx, ry, 0.5 - tf / 2);
5085
+ let rc = utils_exports.Math.interpolateCoord(lx, ly, rx, ry, 0.5 + tf / 2);
4647
5086
  ctx.strokeLine(lx, ly, lc.x, lc.y);
4648
5087
  ctx.strokeLine(rc.x, rc.y, rx, ry);
4649
5088
  } else {
@@ -4757,12 +5196,11 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4757
5196
  };
4758
5197
 
4759
5198
  // src/score/engine/obj-fermata.ts
4760
- import { AnchoredRect as AnchoredRect16 } from "@tspro/ts-utils-lib";
4761
5199
  var ObjFermata = class extends MusicObject {
4762
- constructor(parent, pos) {
5200
+ constructor(parent, pos, color) {
4763
5201
  super(parent);
4764
5202
  this.pos = pos;
4765
- __publicField(this, "color", "black");
5203
+ this.color = color;
4766
5204
  __publicField(this, "mi");
4767
5205
  this.mi = new MFermata(this);
4768
5206
  }
@@ -4785,7 +5223,7 @@ var ObjFermata = class extends MusicObject {
4785
5223
  let { unitSize } = ctx;
4786
5224
  let width = unitSize * 4;
4787
5225
  let height = unitSize * 3;
4788
- this.rect = new AnchoredRect16(-width / 2, width / 2, -height, 0);
5226
+ this.rect = new AnchoredRect(-width / 2, width / 2, -height, 0);
4789
5227
  }
4790
5228
  offset(dx, dy) {
4791
5229
  this.rect.offsetInPlace(dx, dy);
@@ -4800,7 +5238,7 @@ var ObjFermata = class extends MusicObject {
4800
5238
  let bottom = (upsideDown ? this.rect.top : this.rect.bottom) + dy;
4801
5239
  let height = bottom - top;
4802
5240
  ctx.drawDebugRect(this.rect);
4803
- ctx.color("black").lineWidth(1);
5241
+ ctx.color(this.color).lineWidth(1);
4804
5242
  ctx.beginPath();
4805
5243
  ctx.moveTo(left, bottom);
4806
5244
  ctx.bezierCurveTo(left, top, right, top, right, bottom);
@@ -4813,15 +5251,19 @@ var ObjFermata = class extends MusicObject {
4813
5251
  };
4814
5252
 
4815
5253
  // src/score/engine/obj-extension-line.ts
4816
- import { AnchoredRect as AnchoredRect17 } from "@tspro/ts-utils-lib";
5254
+ function isExtensionStartObject(obj) {
5255
+ return obj instanceof ObjText || obj instanceof ObjSpecialText;
5256
+ }
5257
+ function isExtensionStopObject(obj) {
5258
+ return obj instanceof ObjBarLineRight || obj instanceof ObjText || obj instanceof ObjSpecialText;
5259
+ }
4817
5260
  var ObjExtensionLine = class extends MusicObject {
4818
- constructor(measure, line, extension, leftObj, rightObj) {
5261
+ constructor(measure, line, extension, cols) {
4819
5262
  super(measure);
4820
5263
  this.measure = measure;
4821
5264
  this.line = line;
4822
5265
  this.extension = extension;
4823
- this.leftObj = leftObj;
4824
- this.rightObj = rightObj;
5266
+ this.cols = cols;
4825
5267
  __publicField(this, "mi");
4826
5268
  extension.addTail(this);
4827
5269
  this.mi = new MExtensionLine(this);
@@ -4832,52 +5274,61 @@ var ObjExtensionLine = class extends MusicObject {
4832
5274
  getMusicInterface() {
4833
5275
  return this.mi;
4834
5276
  }
4835
- getLineLeft() {
4836
- if (this.leftObj instanceof ObjBarLineLeft) {
4837
- return this.leftObj.getRect().anchorX;
4838
- } else {
4839
- return this.leftObj.getRect().right;
4840
- }
4841
- }
4842
- getLineRight() {
4843
- if (this.rightObj instanceof ObjRhythmColumn) {
4844
- let col = this.rightObj;
4845
- let nextCol = col.getNextColumn();
4846
- if (nextCol && nextCol.measure === col.measure) {
4847
- return (col.getRect().right + nextCol.getRect().left) / 2;
4848
- } else {
4849
- return (col.getRect().right + col.measure.getBarLineRight().getRect().left) / 2;
4850
- }
4851
- } else {
4852
- return this.rightObj.getRect().anchorX;
4853
- }
5277
+ getLineLeft(ctx) {
5278
+ let obj = this.cols[0];
5279
+ if (isExtensionStartObject(obj))
5280
+ return obj.getRect().right + ctx.unitSize;
5281
+ if (obj instanceof ObjBarLineLeft)
5282
+ return obj.getRect().anchorX;
5283
+ if (obj instanceof ObjRhythmColumn) {
5284
+ const mcols = obj.measure.getColumns();
5285
+ if (obj === mcols[0])
5286
+ return obj.measure.getRect().left;
5287
+ }
5288
+ return obj.getRect().right;
5289
+ }
5290
+ getLineRight(ctx) {
5291
+ let obj = this.cols[this.cols.length - 1];
5292
+ if (isExtensionStopObject(obj))
5293
+ return obj.getRect().left - ctx.unitSize;
5294
+ if (obj instanceof ObjRhythmColumn) {
5295
+ const mcols = obj.measure.getColumns();
5296
+ if (obj === mcols[mcols.length - 1])
5297
+ return obj.measure.getRect().right;
5298
+ let next = obj.getNextColumn();
5299
+ if (next && next.measure === obj.measure)
5300
+ return (obj.getRect().right + next.getRect().left) / 2;
5301
+ }
5302
+ return obj.getRect().anchorX;
4854
5303
  }
4855
5304
  layoutFitToMeasure(ctx) {
4856
- let { unitSize } = ctx;
4857
- let lineLeft = this.getLineLeft();
4858
- let lineRight = this.getLineRight();
4859
- let lineRectH = unitSize;
4860
- this.rect = new AnchoredRect17(lineLeft, lineRight, -lineRectH / 2, lineRectH / 2);
5305
+ let recth = ctx.unitSize;
5306
+ let lineLeft = this.getLineLeft(ctx);
5307
+ let lineRight = this.getLineRight(ctx);
5308
+ [lineLeft, lineRight] = [Math.min(lineLeft, lineRight), Math.max(lineLeft, lineRight)];
5309
+ this.rect = new AnchoredRect(lineLeft, lineRight, -recth / 2, recth / 2);
4861
5310
  }
4862
5311
  pick(x, y) {
4863
5312
  return this.rect.contains(x, y) ? [this] : [];
4864
5313
  }
4865
5314
  layout(ctx) {
4866
- this.rect = new AnchoredRect17();
5315
+ this.rect = new AnchoredRect();
4867
5316
  }
4868
5317
  offset(dx, dy) {
4869
5318
  this.rect.offsetInPlace(dx, dy);
4870
5319
  }
4871
5320
  draw(ctx) {
4872
5321
  let { rect } = this;
4873
- if (this.extension.getLineStyle() === "dashed") {
5322
+ const head = this.extension.headObj.musicObj;
5323
+ const color = String(head.userData["extension-color"]);
5324
+ if (this.extension.getLineStyle() === "dashed")
4874
5325
  ctx.setLineDash([7, 3]);
4875
- }
4876
- ctx.color("black").lineWidth(1);
5326
+ ctx.color(color).lineWidth(1);
4877
5327
  ctx.strokeLine(rect.left, rect.anchorY, rect.right, rect.anchorY);
4878
5328
  ctx.setLineDash([]);
4879
5329
  let tails = this.extension.getTails();
4880
- if (tails.length > 0 && this === tails[tails.length - 1]) {
5330
+ let last = tails[tails.length - 1];
5331
+ if (this === last && !isExtensionStopObject(this.cols[this.cols.length - 1])) {
4881
5332
  let tipH = rect.anchorY > this.line.getRect().anchorY ? -ctx.unitSize : ctx.unitSize;
4882
5333
  ctx.strokeLine(rect.right, rect.anchorY, rect.right, rect.anchorY + tipH);
4883
5334
  }
@@ -4885,14 +5336,13 @@ var ObjExtensionLine = class extends MusicObject {
4885
5336
  };
4886
5337
 
4887
5338
  // src/score/engine/obj-measure.ts
4888
- import { MusicError as MusicError13, MusicErrorType as MusicErrorType13 } from "@tspro/web-music-score/core";
5339
+ import { MusicError as MusicError11, MusicErrorType as MusicErrorType11 } from "@tspro/web-music-score/core";
4889
5340
 
4890
5341
  // src/score/engine/connective-props.ts
4891
5342
  import { Note as Note6 } from "@tspro/web-music-score/theory";
4892
5343
 
4893
5344
  // src/score/engine/obj-connective.ts
4894
- import { AnchoredRect as AnchoredRect18, Guard as Guard5, Utils as Utils7 } from "@tspro/ts-utils-lib";
4895
- import { MusicError as MusicError11, MusicErrorType as MusicErrorType11 } from "@tspro/web-music-score/core";
5345
+ import { MusicError as MusicError9, MusicErrorType as MusicErrorType9 } from "@tspro/web-music-score/core";
4896
5346
  var ObjConnective = class extends MusicObject {
4897
5347
  constructor(connectiveProps, line, measure, leftNoteGroup, leftNoteId, ...args) {
4898
5348
  var _a;
@@ -4922,7 +5372,7 @@ var ObjConnective = class extends MusicObject {
4922
5372
  this.rightNoteGroup = args[0];
4923
5373
  this.rightNoteId = args[1];
4924
5374
  this.tieType = void 0;
4925
- } else if (Guard5.isEnumValue(args[0], TieType)) {
5375
+ } else if (guard_exports.isEnumValue(args[0], TieType)) {
4926
5376
  this.rightNoteGroup = void 0;
4927
5377
  this.rightNoteId = void 0;
4928
5378
  this.tieType = args[0];
@@ -4933,6 +5383,9 @@ var ObjConnective = class extends MusicObject {
4933
5383
  getMusicInterface() {
4934
5384
  return this.mi;
4935
5385
  }
5386
+ get doc() {
5387
+ return this.measure.doc;
5388
+ }
4936
5389
  isInsideMeasure() {
4937
5390
  return this.rightNoteGroup === void 0 || this.leftNoteGroup.measure === this.rightNoteGroup.measure;
4938
5391
  }
@@ -4983,7 +5436,7 @@ var ObjConnective = class extends MusicObject {
4983
5436
  rx = contentRect.right;
4984
5437
  ry = leftPos.y + (rightPos.y - leftPos.y) * tLeft / (tLeft + tRight);
4985
5438
  } else {
4986
- throw new MusicError11(MusicErrorType11.Score, "Cannot layout connective object because no valid left and right note groups.");
5439
+ throw new MusicError9(MusicErrorType9.Score, "Cannot layout connective object because no valid left and right note groups.");
4987
5440
  }
4988
5441
  let spanDy = arcDir === "up" ? -1 : 1;
4989
5442
  let arcHeight = spanDy * unitSize * Math.log2(rx - lx) / 3;
@@ -4992,12 +5445,12 @@ var ObjConnective = class extends MusicObject {
4992
5445
  this.rx = rx;
4993
5446
  this.ry = ry;
4994
5447
  this.arcHeight = this.connectiveProps.connective === "slide" /* Slide */ ? 0 : arcHeight;
4995
- let { nx, ny } = Utils7.Math.calcNormal(lx, ly, rx, ry);
5448
+ let { nx, ny } = utils_exports.Math.calcNormal(lx, ly, rx, ry);
4996
5449
  this.cp1x = lx * 0.7 + rx * 0.3 + nx * this.arcHeight;
4997
5450
  this.cp1y = ly * 0.7 + ry * 0.3 + ny * this.arcHeight;
4998
5451
  this.cp2x = lx * 0.3 + rx * 0.7 + nx * this.arcHeight;
4999
5452
  this.cp2y = ly * 0.3 + ry * 0.7 + ny * this.arcHeight;
5000
- this.rect = new AnchoredRect18(
5453
+ this.rect = new AnchoredRect(
5001
5454
  Math.min(this.lx, this.cp1x, this.cp2x, this.rx),
5002
5455
  Math.max(this.lx, this.cp1x, this.cp2x, this.rx),
5003
5456
  Math.min(this.ly, this.cp1y, this.cp2y, this.ry),
@@ -5029,7 +5482,10 @@ var ObjConnective = class extends MusicObject {
5029
5482
  ctx.drawDebugRect(rect);
5030
5483
  let t = _lineWidth * 1.5;
5031
5484
  let s = _lineWidth * 0.25;
5032
- ctx.color("black").lineWidth(1);
5485
+ ctx.lineWidth(1);
5486
+ ctx.color(
5487
+ this.line instanceof ObjTab ? DocumentColor.Tab_Connective : DocumentColor.Staff_Connective
5488
+ );
5033
5489
  if (this.arcHeight === 0) {
5034
5490
  ctx.beginPath();
5035
5491
  ctx.moveTo(this.lx, this.ly);
@@ -5047,8 +5503,7 @@ var ObjConnective = class extends MusicObject {
5047
5503
  };
5048
5504
 
5049
5505
  // src/score/engine/connective-props.ts
5050
- import { MusicError as MusicError12, MusicErrorType as MusicErrorType12 } from "@tspro/web-music-score/core";
5051
- import { Guard as Guard6 } from "@tspro/ts-utils-lib";
5506
+ import { MusicError as MusicError10, MusicErrorType as MusicErrorType10 } from "@tspro/web-music-score/core";
5052
5507
  var ConnectiveProps = class {
5053
5508
  constructor(connective, span, noteAnchor, startNoteGroup) {
5054
5509
  this.connective = connective;
@@ -5121,7 +5576,7 @@ var ConnectiveProps = class {
5121
5576
  this.noteGroups[0].row.getNotationLines().forEach((line) => {
5122
5577
  this.computeParams(line);
5123
5578
  if (connective === "tie" /* Tie */) {
5124
- if (Guard6.isEnumValue(span, TieType)) {
5579
+ if (guard_exports.isEnumValue(span, TieType)) {
5125
5580
  let leftNoteGroup = this.noteGroups[0];
5126
5581
  for (let noteId = 0; noteId < leftNoteGroup.notes.length; noteId++) {
5127
5582
  this.createObjConnectiveWithTieType(line, leftNoteGroup, noteId, span);
@@ -5187,13 +5642,12 @@ var ConnectiveProps = class {
5187
5642
  addConnective(leftNoteGroup.measure, leftNoteGroup, leftNoteId, rightNoteGroup, rightNoteId);
5188
5643
  addConnective(rightNoteGroup.measure, leftNoteGroup, leftNoteId, rightNoteGroup, rightNoteId);
5189
5644
  } else {
5190
- throw new MusicError12(MusicErrorType12.Score, "Cannot create connective because it is jumping measures.");
5645
+ throw new MusicError10(MusicErrorType10.Score, "Cannot create connective because it is jumping measures.");
5191
5646
  }
5192
5647
  }
5193
5648
  };
5194
5649
 
5195
5650
  // src/score/engine/obj-lyrics.ts
5196
- import { Guard as Guard7 } from "@tspro/ts-utils-lib";
5197
5651
  var ObjLyrics = class extends MusicObject {
5198
5652
  constructor(col, verse, line, vpos, lyricsLength, lyricsText, lyricsOptions) {
5199
5653
  super(col);
@@ -5209,7 +5663,7 @@ var ObjLyrics = class extends MusicObject {
5209
5663
  __publicField(this, "mi");
5210
5664
  this.rhythmProps = RhythmProps.get(lyricsLength);
5211
5665
  let halign = (lyricsOptions == null ? void 0 : lyricsOptions.align) === "left" /* Left */ ? 0 : (lyricsOptions == null ? void 0 : lyricsOptions.align) === "right" /* Right */ ? 1 : 0.5;
5212
- this.hyphen = Guard7.isEnumValue(lyricsOptions == null ? void 0 : lyricsOptions.hyphen, LyricsHyphen) ? lyricsOptions == null ? void 0 : lyricsOptions.hyphen : void 0;
5666
+ this.hyphen = guard_exports.isEnumValue(lyricsOptions == null ? void 0 : lyricsOptions.hyphen, LyricsHyphen) ? lyricsOptions == null ? void 0 : lyricsOptions.hyphen : void 0;
5213
5667
  this.text = new ObjText(this, { text: lyricsText, color: this.color, scale: 0.8 }, halign, 0);
5214
5668
  this.rect = this.text.getRect().clone();
5215
5669
  this.mi = new MLyrics(this);
@@ -5259,7 +5713,6 @@ var ObjLyrics = class extends MusicObject {
5259
5713
  };
5260
5714
 
5261
5715
  // src/score/engine/obj-tab-rhythm.ts
5262
- import { AnchoredRect as AnchoredRect19, UniMap as UniMap5, Utils as Utils8 } from "@tspro/ts-utils-lib";
5263
5716
  var ObjTabRhythm = class extends MusicObject {
5264
5717
  constructor(measure, tab) {
5265
5718
  super(measure);
@@ -5268,22 +5721,25 @@ var ObjTabRhythm = class extends MusicObject {
5268
5721
  __publicField(this, "voiceId");
5269
5722
  __publicField(this, "mi");
5270
5723
  // Keep non-static
5271
- __publicField(this, "tupletPartsTextObjMap", new UniMap5());
5724
+ __publicField(this, "tupletPartsTextObjMap", new UniMap());
5272
5725
  this.voiceId = getVoiceIds().filter((voiceId) => tab.containsVoiceId(voiceId));
5273
- this.rect = new AnchoredRect19();
5726
+ this.rect = new AnchoredRect();
5274
5727
  this.mi = new MTabRhythm(this);
5275
5728
  }
5276
5729
  getMusicInterface() {
5277
5730
  return this.mi;
5278
5731
  }
5732
+ get doc() {
5733
+ return this.measure.doc;
5734
+ }
5279
5735
  pick(x, y) {
5280
5736
  return this.rect.contains(x, y) ? [this] : [];
5281
5737
  }
5282
5738
  layout(ctx) {
5283
5739
  let columns = this.measure.getColumns();
5284
- let numColsInVoiceId = getVoiceIds().map((voiceId) => Utils8.Math.sum(columns.map((col) => col.getVoiceSymbol(voiceId) ? 1 : 0)));
5285
- this.voiceId.sort((a, b) => Utils8.Math.cmp(numColsInVoiceId[a], numColsInVoiceId[b]));
5286
- this.rect = new AnchoredRect19();
5740
+ let numColsInVoiceId = getVoiceIds().map((voiceId) => utils_exports.Math.sum(columns.map((col) => col.getVoiceSymbol(voiceId) ? 1 : 0)));
5741
+ this.voiceId.sort((a, b) => utils_exports.Math.cmp(numColsInVoiceId[a], numColsInVoiceId[b]));
5742
+ this.rect = new AnchoredRect();
5287
5743
  }
5288
5744
  hasTuplets() {
5289
5745
  return this.measure.getBeamGroups().some((beamGroup) => beamGroup.isTuplet());
@@ -5305,7 +5761,7 @@ var ObjTabRhythm = class extends MusicObject {
5305
5761
  }
5306
5762
  draw(ctx) {
5307
5763
  ctx.drawDebugRect(this.rect);
5308
- ctx.color("black").lineWidth(1);
5764
+ ctx.lineWidth(1);
5309
5765
  let { unitSize, fontSize } = ctx;
5310
5766
  let flagSize = unitSize;
5311
5767
  let dotSpace = unitSize;
@@ -5327,20 +5783,23 @@ var ObjTabRhythm = class extends MusicObject {
5327
5783
  let nextSym = symbols[j + 1];
5328
5784
  let colX = sym.col.getRect().anchorX;
5329
5785
  if (sym instanceof ObjNoteGroup) {
5786
+ ctx.lineWidth(1);
5787
+ ctx.color(DocumentColor.Tab_Note);
5330
5788
  if (sym.rhythmProps.noteSize >= 2) {
5331
5789
  ctx.lineWidth(sym.rhythmProps.noteSize === 4 ? 2 : 1);
5332
5790
  ctx.strokeLine(colX, stemBottom, colX, stemTop);
5333
5791
  }
5334
- ctx.lineWidth(1);
5335
5792
  if (symbols.length === 1) {
5336
5793
  for (let i = 0; i < sym.rhythmProps.flagCount; i++) {
5337
- ctx.drawFlag(new AnchoredRect19(colX, colX + flagSize, stemTop + i * flagSize, stemTop + (i + 2) * flagSize), "up");
5794
+ ctx.drawFlag(new AnchoredRect(colX, colX + flagSize, stemTop + i * flagSize, stemTop + (i + 2) * flagSize), "up");
5338
5795
  }
5339
5796
  }
5340
5797
  for (let i = 0; i < sym.rhythmProps.dotCount; i++) {
5341
5798
  ctx.fillCircle(colX + dotSpace * (i + 1), stemBottom - dotWidth, dotWidth);
5342
5799
  }
5343
5800
  } else if (sym instanceof ObjRest) {
5801
+ ctx.lineWidth(1);
5802
+ ctx.color(DocumentColor.Tab_Rest);
5344
5803
  let cx = colX;
5345
5804
  let cy = (stemTop + stemBottom) / 2;
5346
5805
  let scale = 0.65;
@@ -5361,6 +5820,7 @@ var ObjTabRhythm = class extends MusicObject {
5361
5820
  let leftBeamCount = left.hasTuplet() ? 1 : left instanceof ObjNoteGroup ? left.getRightBeamCount() : 1;
5362
5821
  let rightBeamCount = right.hasTuplet() ? 1 : right instanceof ObjNoteGroup ? right.getLeftBeamCount() : 1;
5363
5822
  let maxBeamCount = Math.max(leftBeamCount, rightBeamCount);
5823
+ ctx.color(DocumentColor.Tab_Note);
5364
5824
  ctx.lineWidth(2);
5365
5825
  for (let i = 0; i < maxBeamCount; i++) {
5366
5826
  let leftT = rightBeamCount > leftBeamCount && i >= leftBeamCount ? 0.75 : 0;
@@ -5376,6 +5836,7 @@ var ObjTabRhythm = class extends MusicObject {
5376
5836
  }
5377
5837
  }
5378
5838
  if (beamGroup && beamGroup.isTuplet()) {
5839
+ ctx.color(DocumentColor.Tab_Note);
5379
5840
  let cx = (symbols[0].col.getRect().anchorX + symbols[symbols.length - 1].col.getRect().anchorX) / 2;
5380
5841
  let text = beamGroup.getTupletRatioText();
5381
5842
  let textObj = this.tupletPartsTextObjMap.get(text);
@@ -5398,11 +5859,19 @@ var ObjTabRhythm = class extends MusicObject {
5398
5859
  };
5399
5860
 
5400
5861
  // src/score/engine/obj-measure.ts
5862
+ function getExtensionAnchorY(linePos) {
5863
+ switch (linePos) {
5864
+ case "bottom":
5865
+ return 0.8;
5866
+ case "middle":
5867
+ return 0.5;
5868
+ }
5869
+ }
5401
5870
  function getExtensionTicks(extensionLength) {
5402
5871
  if (typeof extensionLength === "string") {
5403
5872
  extensionLength = [extensionLength];
5404
5873
  }
5405
- if (Guard8.isArray(extensionLength)) {
5874
+ if (guard_exports.isArray(extensionLength)) {
5406
5875
  let totalTicks = 0;
5407
5876
  for (let i = 0; i < extensionLength.length; ) {
5408
5877
  let str = extensionLength[i];
@@ -5433,7 +5902,7 @@ function getVerseLayoutGroupId(verse) {
5433
5902
  case 3:
5434
5903
  return 10 /* LyricsVerse3 */;
5435
5904
  default:
5436
- throw new MusicError13(MusicErrorType13.Unknown, "VerseNumber is not 1, 2 or 3.");
5905
+ throw new MusicError11(MusicErrorType11.Unknown, "VerseNumber is not 1, 2 or 3.");
5437
5906
  }
5438
5907
  }
5439
5908
  var MeasureRegions = class {
@@ -5479,10 +5948,10 @@ var ObjMeasure = class extends MusicObject {
5479
5948
  __publicField(this, "measureId");
5480
5949
  __publicField(this, "regions", new MeasureRegions());
5481
5950
  __publicField(this, "needLayout", true);
5482
- __publicField(this, "voiceSymbols", asMulti(new IndexArray2()));
5951
+ __publicField(this, "voiceSymbols", asMulti(new IndexArray()));
5483
5952
  __publicField(this, "lastAddedRhythmColumn");
5484
5953
  __publicField(this, "lastAddedRhythmSymbol");
5485
- __publicField(this, "addExtensionToMusicObjects", []);
5954
+ __publicField(this, "addExtensionTo", []);
5486
5955
  __publicField(this, "layoutObjects", []);
5487
5956
  __publicField(this, "postMeasureBreakWidth", 0);
5488
5957
  __publicField(this, "passCount", 0);
@@ -5494,8 +5963,8 @@ var ObjMeasure = class extends MusicObject {
5494
5963
  __publicField(this, "endRepeatPlayCount", 2);
5495
5964
  // play twice.
5496
5965
  __publicField(this, "endRepeatPlayCountText");
5497
- __publicField(this, "staticObjectsCache", new UniMap6());
5498
- __publicField(this, "lyricsObjectsCache", new TriMap2());
5966
+ __publicField(this, "staticObjectsCache", new UniMap());
5967
+ __publicField(this, "lyricsObjectsCache", new TriMap());
5499
5968
  __publicField(this, "mi");
5500
5969
  this.mi = new MMeasure(this);
5501
5970
  this.prevMeasure = row.doc.getLastMeasure();
@@ -5536,7 +6005,7 @@ var ObjMeasure = class extends MusicObject {
5536
6005
  updateRunningArguments(runningArgs) {
5537
6006
  var _a;
5538
6007
  runningArgs != null ? runningArgs : runningArgs = [];
5539
- let numVoices = Utils9.Math.sum(getVoiceIds().map((voiceId) => this.getVoiceSymbols(voiceId).length > 0 ? 1 : 0));
6008
+ let numVoices = utils_exports.Math.sum(getVoiceIds().map((voiceId) => this.getVoiceSymbols(voiceId).length > 0 ? 1 : 0));
5540
6009
  getVoiceIds().forEach((voiceId) => {
5541
6010
  var _a2;
5542
6011
  const getDefaultDiatonicId = () => {
@@ -5674,6 +6143,12 @@ var ObjMeasure = class extends MusicObject {
5674
6143
  isLastMeasure() {
5675
6144
  return this.nextMeasure === void 0;
5676
6145
  }
6146
+ isFirstMeasureInRow() {
6147
+ return this === this.row.getFirstMeasure();
6148
+ }
6149
+ isLastMeasureInRow() {
6150
+ return this === this.row.getLastMeasure();
6151
+ }
5677
6152
  getNextMeasure() {
5678
6153
  return this.nextMeasure;
5679
6154
  }
@@ -5695,7 +6170,7 @@ var ObjMeasure = class extends MusicObject {
5695
6170
  this.alterKeySignature = args[0];
5696
6171
  } else if (args[0] instanceof Scale) {
5697
6172
  this.alterKeySignature = args[0];
5698
- } else if (Guard8.isNonEmptyString(args[0])) {
6173
+ } else if (guard_exports.isNonEmptyString(args[0])) {
5699
6174
  if (args.length === 1) {
5700
6175
  this.alterKeySignature = getScale(args[0]);
5701
6176
  } else if (args.length === 2) {
@@ -5704,7 +6179,7 @@ var ObjMeasure = class extends MusicObject {
5704
6179
  let scaleType = validateScaleType("" + args[1]);
5705
6180
  this.alterKeySignature = getScale(tonic, scaleType);
5706
6181
  } catch (e) {
5707
- throw new MusicError13(MusicErrorType13.Score, "Cannot set key signature because invalid args: " + args);
6182
+ throw new MusicError11(MusicErrorType11.Score, "Cannot set key signature because invalid args: " + args);
5708
6183
  }
5709
6184
  }
5710
6185
  }
@@ -5788,9 +6263,11 @@ var ObjMeasure = class extends MusicObject {
5788
6263
  return this.postMeasureBreakWidth;
5789
6264
  }
5790
6265
  addLayoutObject(musicObj, line, layoutGroupId, verticalPos) {
5791
- this.layoutObjects.push(new LayoutObjectWrapper(musicObj, line, layoutGroupId, verticalPos));
6266
+ const layoutObj = new LayoutObjectWrapper(musicObj, line, layoutGroupId, verticalPos);
6267
+ this.layoutObjects.push(layoutObj);
5792
6268
  this.requestLayout();
5793
6269
  this.requestRectUpdate();
6270
+ return layoutObj;
5794
6271
  }
5795
6272
  forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, addFn) {
5796
6273
  const lines = this.row.getNotationLines();
@@ -5806,7 +6283,7 @@ var ObjMeasure = class extends MusicObject {
5806
6283
  let grp = this.doc.getStaffGroup(staffTabOrGroup);
5807
6284
  if (grp && !prevGroups.includes(staffTabOrGroup)) {
5808
6285
  let curGroups = [...prevGroups, staffTabOrGroup];
5809
- (Guard8.isArray(grp.staffsTabsAndGroups) ? grp.staffsTabsAndGroups : [grp.staffsTabsAndGroups]).forEach((staffTabOrGroup2) => {
6286
+ (guard_exports.isArray(grp.staffsTabsAndGroups) ? grp.staffsTabsAndGroups : [grp.staffsTabsAndGroups]).forEach((staffTabOrGroup2) => {
5810
6287
  switch (grp.verticalPosition) {
5811
6288
  case "above" /* Above */:
5812
6289
  addToStaffTabOrGroup(staffTabOrGroup2, 0 /* Above */, curGroups);
@@ -5833,7 +6310,7 @@ var ObjMeasure = class extends MusicObject {
5833
6310
  } else {
5834
6311
  addToStaffTabOrGroup(0, defaultVerticalPos);
5835
6312
  }
5836
- } else if (Guard8.isArray(staffTabOrGroups)) {
6313
+ } else if (guard_exports.isArray(staffTabOrGroups)) {
5837
6314
  staffTabOrGroups.forEach((staffTabOrGroup) => addToStaffTabOrGroup(staffTabOrGroup, defaultVerticalPos));
5838
6315
  } else {
5839
6316
  addToStaffTabOrGroup(staffTabOrGroups, defaultVerticalPos);
@@ -5842,10 +6319,11 @@ var ObjMeasure = class extends MusicObject {
5842
6319
  addFermata(staffTabOrGroups, fermata) {
5843
6320
  let anchor = fermata === "atMeasureEnd" /* AtMeasureEnd */ ? this.barLineRight : this.lastAddedRhythmColumn;
5844
6321
  if (!anchor) {
5845
- throw new MusicError13(MusicErrorType13.Score, "Cannot add Fermata because anchor is undefined.");
6322
+ throw new MusicError11(MusicErrorType11.Score, "Cannot add Fermata because anchor is undefined.");
5846
6323
  }
5847
6324
  this.forEachStaffGroup(staffTabOrGroups, 0 /* Above */, (line, vpos) => {
5848
- this.addLayoutObject(new ObjFermata(anchor, vpos), line, 1 /* Fermata */, vpos);
6325
+ const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Fermata : DocumentColor.Tab_Element_Fermata;
6326
+ this.addLayoutObject(new ObjFermata(anchor, vpos, color), line, 1 /* Fermata */, vpos);
5849
6327
  });
5850
6328
  this.disableExtension();
5851
6329
  this.requestLayout();
@@ -5858,12 +6336,15 @@ var ObjMeasure = class extends MusicObject {
5858
6336
  switch (navigation) {
5859
6337
  case "ending" /* Ending */:
5860
6338
  if (this.navigationSet.has(navigation)) {
5861
- throw new MusicError13(MusicErrorType13.Score, "Cannot add ending beasure measure already has one.");
6339
+ throw new MusicError11(MusicErrorType11.Score, "Cannot add ending beasure measure already has one.");
5862
6340
  }
5863
6341
  let anchor = this;
5864
6342
  let passages = args;
5865
6343
  addLayoutObjectProps = {
5866
- createObj: () => new ObjEnding(anchor, passages),
6344
+ createObj: (line) => {
6345
+ const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Navigation : DocumentColor.Tab_Element_Navigation;
6346
+ return new ObjEnding(anchor, color, passages);
6347
+ },
5867
6348
  layoutGroupId: 4 /* Ending */,
5868
6349
  defaultVerticalPos: 0 /* Above */
5869
6350
  };
@@ -5875,7 +6356,10 @@ var ObjMeasure = class extends MusicObject {
5875
6356
  let anchor2 = this.barLineRight;
5876
6357
  let text = getNavigationString(navigation);
5877
6358
  addLayoutObjectProps = {
5878
- createObj: () => new ObjText(anchor2, text, 1, 1),
6359
+ createObj: (line) => {
6360
+ const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Navigation : DocumentColor.Tab_Element_Navigation;
6361
+ return new ObjText(anchor2, { text, color }, 1, 1);
6362
+ },
5879
6363
  layoutGroupId: 3 /* Navigation */,
5880
6364
  defaultVerticalPos: 0 /* Above */
5881
6365
  };
@@ -5887,7 +6371,10 @@ var ObjMeasure = class extends MusicObject {
5887
6371
  let anchor2 = this.barLineRight;
5888
6372
  let text = getNavigationString(navigation);
5889
6373
  addLayoutObjectProps = {
5890
- createObj: () => new ObjText(anchor2, text, 1, 1),
6374
+ createObj: (line) => {
6375
+ const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Navigation : DocumentColor.Tab_Element_Navigation;
6376
+ return new ObjText(anchor2, { text, color }, 1, 1);
6377
+ },
5891
6378
  layoutGroupId: 3 /* Navigation */,
5892
6379
  defaultVerticalPos: 0 /* Above */
5893
6380
  };
@@ -5898,7 +6385,10 @@ var ObjMeasure = class extends MusicObject {
5898
6385
  let anchor2 = this.barLineLeft;
5899
6386
  let text = getNavigationString(navigation);
5900
6387
  addLayoutObjectProps = {
5901
- createObj: () => new ObjSpecialText(anchor2, text),
6388
+ createObj: (line) => {
6389
+ const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Navigation : DocumentColor.Tab_Element_Navigation;
6390
+ return new ObjSpecialText(anchor2, text, color);
6391
+ },
5902
6392
  layoutGroupId: 3 /* Navigation */,
5903
6393
  defaultVerticalPos: 0 /* Above */
5904
6394
  };
@@ -5908,7 +6398,10 @@ var ObjMeasure = class extends MusicObject {
5908
6398
  let anchor2 = this.barLineRight;
5909
6399
  let text = getNavigationString(navigation);
5910
6400
  addLayoutObjectProps = {
5911
- createObj: () => new ObjSpecialText(anchor2, text),
6401
+ createObj: (line) => {
6402
+ const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Navigation : DocumentColor.Tab_Element_Navigation;
6403
+ return new ObjSpecialText(anchor2, text, color);
6404
+ },
5912
6405
  layoutGroupId: 3 /* Navigation */,
5913
6406
  defaultVerticalPos: 0 /* Above */
5914
6407
  };
@@ -5917,15 +6410,17 @@ var ObjMeasure = class extends MusicObject {
5917
6410
  case "endRepeat" /* EndRepeat */:
5918
6411
  if (args.length === 0) {
5919
6412
  this.endRepeatPlayCount = 2;
5920
- } else if (Guard8.isIntegerGte(args[0], 2)) {
6413
+ } else if (guard_exports.isIntegerGte(args[0], 2)) {
5921
6414
  this.endRepeatPlayCount = args[0];
5922
6415
  } else {
5923
- throw new MusicError13(MusicErrorType13.Score, "Invalid end repeat play count (should be 2 or greater integer): " + args[0]);
6416
+ throw new MusicError11(MusicErrorType11.Score, "Invalid end repeat play count (should be 2 or greater integer): " + args[0]);
5924
6417
  }
5925
6418
  if (this.endRepeatPlayCount !== 2) {
5926
- let textProps = {
5927
- text: "" + this.endRepeatPlayCount + "x",
5928
- scale: 0.8
6419
+ const text = `${this.endRepeatPlayCount}x`;
6420
+ const textProps = {
6421
+ text,
6422
+ scale: 0.8,
6423
+ color: DocumentColor.Staff_Frame
5929
6424
  };
5930
6425
  this.endRepeatPlayCountText = new ObjText(this, textProps, 0.5, 1);
5931
6426
  }
@@ -5933,7 +6428,7 @@ var ObjMeasure = class extends MusicObject {
5933
6428
  }
5934
6429
  if (addLayoutObjectProps) {
5935
6430
  this.forEachStaffGroup(staffTabOrGroups, addLayoutObjectProps.defaultVerticalPos, (line, vpos) => {
5936
- this.addLayoutObject(addLayoutObjectProps.createObj(), line, addLayoutObjectProps.layoutGroupId, vpos);
6431
+ this.addLayoutObject(addLayoutObjectProps.createObj(line), line, addLayoutObjectProps.layoutGroupId, vpos);
5937
6432
  });
5938
6433
  }
5939
6434
  this.navigationSet.add(navigation);
@@ -5945,38 +6440,45 @@ var ObjMeasure = class extends MusicObject {
5945
6440
  addAnnotation(staffTabOrGroups, annotation, text) {
5946
6441
  let anchor = this.lastAddedRhythmColumn;
5947
6442
  if (!anchor) {
5948
- throw new MusicError13(MusicErrorType13.Score, "Cannot add annotation because anchor is undefined.");
6443
+ throw new MusicError11(MusicErrorType11.Score, "Cannot add annotation because anchor is undefined.");
5949
6444
  } else if (text.length === 0) {
5950
- throw new MusicError13(MusicErrorType13.Score, "Cannot add annotation because annotation text is empty.");
6445
+ throw new MusicError11(MusicErrorType11.Score, "Cannot add annotation because annotation text is empty.");
5951
6446
  }
5952
6447
  let textProps = { text };
5953
6448
  let layoutGroupId;
5954
6449
  let defaultVerticalPos;
6450
+ let linePos;
5955
6451
  switch (annotation) {
5956
6452
  case "dynamics" /* Dynamics */:
5957
6453
  layoutGroupId = 6 /* DynamicsAnnotation */;
5958
6454
  defaultVerticalPos = 0 /* Above */;
5959
6455
  textProps.italic = true;
6456
+ linePos = "bottom";
5960
6457
  break;
5961
6458
  case "tempo" /* Tempo */:
5962
6459
  layoutGroupId = 5 /* TempoAnnotation */;
5963
6460
  defaultVerticalPos = 0 /* Above */;
5964
6461
  textProps.italic = true;
6462
+ linePos = "bottom";
5965
6463
  break;
5966
6464
  }
6465
+ const anchorX = 0.5;
6466
+ const anchorY = getExtensionAnchorY(linePos);
5967
6467
  this.disableExtension();
5968
6468
  this.forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, (line, vpos) => {
5969
- let textObj = new ObjText(anchor, textProps, 0.5, 1);
5970
- this.addLayoutObject(textObj, line, layoutGroupId, vpos);
5971
- this.enableExtension(textObj);
6469
+ const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Annotation : DocumentColor.Tab_Element_Annotation;
6470
+ textProps.color = color;
6471
+ let textObj = new ObjText(anchor, textProps, anchorX, anchorY);
6472
+ const layoutObj = this.addLayoutObject(textObj, line, layoutGroupId, vpos);
6473
+ this.enableExtension(layoutObj, color);
5972
6474
  });
5973
6475
  }
5974
6476
  addLabel(staffTabOrGroups, label, text) {
5975
6477
  let anchor = this.lastAddedRhythmColumn;
5976
6478
  if (!anchor) {
5977
- throw new MusicError13(MusicErrorType13.Score, "Cannot add label because anchor is undefined.");
6479
+ throw new MusicError11(MusicErrorType11.Score, "Cannot add label because anchor is undefined.");
5978
6480
  } else if (text.length === 0) {
5979
- throw new MusicError13(MusicErrorType13.Score, "Cannot add label because label text is empty.");
6481
+ throw new MusicError11(MusicErrorType11.Score, "Cannot add label because label text is empty.");
5980
6482
  }
5981
6483
  let textProps = { text };
5982
6484
  let layoutGroupId;
@@ -5993,52 +6495,57 @@ var ObjMeasure = class extends MusicObject {
5993
6495
  }
5994
6496
  this.disableExtension();
5995
6497
  this.forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, (line, vpos) => {
6498
+ const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Label : DocumentColor.Tab_Element_Label;
6499
+ textProps.color = color;
5996
6500
  let textObj = new ObjText(anchor, textProps, 0.5, 1);
5997
- this.addLayoutObject(textObj, line, layoutGroupId, vpos);
5998
- this.enableExtension(textObj);
6501
+ const layoutObj = this.addLayoutObject(textObj, line, layoutGroupId, vpos);
6502
+ this.enableExtension(layoutObj, color);
5999
6503
  });
6000
6504
  }
6001
6505
  addConnective(connective, ...args) {
6002
6506
  let anchor = this.lastAddedRhythmSymbol;
6003
6507
  if (!(anchor instanceof ObjNoteGroup)) {
6004
- throw new MusicError13(MusicErrorType13.Score, "Connective can be added to note group only.");
6508
+ throw new MusicError11(MusicErrorType11.Score, "Connective can be added to note group only.");
6005
6509
  }
6006
6510
  if (connective === "tie" /* Tie */) {
6007
- let tieSpan = Guard8.isInteger(args[0]) || Guard8.isEnumValue(args[0], TieType) ? args[0] : 2;
6008
- let noteAnchor = Guard8.isEnumValue(args[1], NoteAnchor) ? args[1] : "auto" /* Auto */;
6511
+ let tieSpan = guard_exports.isInteger(args[0]) || guard_exports.isEnumValue(args[0], TieType) ? args[0] : 2;
6512
+ let noteAnchor = guard_exports.isEnumValue(args[1], NoteAnchor) ? args[1] : "auto" /* Auto */;
6009
6513
  anchor.startConnective(new ConnectiveProps("tie" /* Tie */, tieSpan, noteAnchor, anchor));
6010
6514
  } else if (connective === "slur" /* Slur */) {
6011
- let slurSpan = Guard8.isInteger(args[0]) ? args[0] : 2;
6012
- let noteAnchor = Guard8.isEnumValue(args[1], NoteAnchor) ? args[1] : "auto" /* Auto */;
6515
+ let slurSpan = guard_exports.isInteger(args[0]) ? args[0] : 2;
6516
+ let noteAnchor = guard_exports.isEnumValue(args[1], NoteAnchor) ? args[1] : "auto" /* Auto */;
6013
6517
  anchor.startConnective(new ConnectiveProps("slur" /* Slur */, slurSpan, noteAnchor, anchor));
6014
6518
  } else if (connective === "slide" /* Slide */) {
6015
- let noteAnchor = Guard8.isEnumValue(args[0], NoteAnchor) ? args[0] : "auto" /* Auto */;
6519
+ let noteAnchor = guard_exports.isEnumValue(args[0], NoteAnchor) ? args[0] : "auto" /* Auto */;
6016
6520
  anchor.startConnective(new ConnectiveProps("slide" /* Slide */, 2, noteAnchor, anchor));
6017
6521
  }
6018
6522
  }
6019
6523
  addExtension(extensionLength, extensionVisible) {
6020
- this.addExtensionToMusicObjects.forEach((musicObj) => {
6021
- let anchor = musicObj.getParent();
6524
+ this.addExtensionTo.forEach((data) => {
6525
+ const { layoutObj, color } = data;
6526
+ const { musicObj } = layoutObj;
6527
+ musicObj.userData["extension-color"] = color;
6528
+ const anchor = musicObj.getParent();
6022
6529
  if (musicObj instanceof ObjText && anchor instanceof ObjRhythmColumn) {
6023
6530
  let lineStyle = "dashed";
6024
6531
  let linePos = "bottom";
6025
- let extension = new Extension(musicObj, anchor, getExtensionTicks(extensionLength), extensionVisible, lineStyle, linePos);
6532
+ let extension = new Extension(layoutObj, anchor, getExtensionTicks(extensionLength), extensionVisible, lineStyle, linePos);
6026
6533
  musicObj.setLink(extension);
6027
6534
  } else {
6028
- throw new MusicError13(MusicErrorType13.Score, "Cannot add extension becaue no compatible music object to attach it to.");
6535
+ throw new MusicError11(MusicErrorType11.Score, "Cannot add extension becaue no compatible music object to attach it to.");
6029
6536
  }
6030
6537
  });
6031
- if (this.addExtensionToMusicObjects.length === 0) {
6032
- throw new MusicError13(MusicErrorType13.Score, "Cannot add extension because music object to attach it to is undefined.");
6538
+ if (this.addExtensionTo.length === 0) {
6539
+ throw new MusicError11(MusicErrorType11.Score, "Cannot add extension because music object to attach it to is undefined.");
6033
6540
  }
6034
6541
  this.disableExtension();
6035
6542
  this.requestLayout();
6036
6543
  }
6037
- enableExtension(musicObject) {
6038
- this.addExtensionToMusicObjects.push(musicObject);
6544
+ enableExtension(layoutObj, color) {
6545
+ this.addExtensionTo.push({ layoutObj, color });
6039
6546
  }
6040
6547
  disableExtension() {
6041
- this.addExtensionToMusicObjects = [];
6548
+ this.addExtensionTo = [];
6042
6549
  }
6043
6550
  getEnding() {
6044
6551
  return this.layoutObjects.map((layoutObj) => layoutObj.musicObj).find((musicObj) => musicObj instanceof ObjEnding);
@@ -6098,7 +6605,7 @@ var ObjMeasure = class extends MusicObject {
6098
6605
  col.addLyricsObject(lyricsObj);
6099
6606
  let lyricsArr = this.lyricsObjectsCache.getOrCreate(line, vpos, verse, []);
6100
6607
  lyricsArr.push(lyricsObj);
6101
- lyricsArr.sort((a, b) => Utils9.Math.cmp(a.col.positionTicks, b.col.positionTicks));
6608
+ lyricsArr.sort((a, b) => utils_exports.Math.cmp(a.col.positionTicks, b.col.positionTicks));
6102
6609
  (_a = lyricsObj.measure.getPrevLyricsObject(lyricsObj)) == null ? void 0 : _a.setNextLyricsObject(lyricsObj);
6103
6610
  this.addLayoutObject(lyricsObj, line, getVerseLayoutGroupId(verse), vpos);
6104
6611
  this.lastAddedRhythmColumn = col;
@@ -6128,7 +6635,7 @@ var ObjMeasure = class extends MusicObject {
6128
6635
  return col2;
6129
6636
  }
6130
6637
  }
6131
- throw new MusicError13(MusicErrorType13.Score, "Error in rhythm column. Should never get here.");
6638
+ throw new MusicError11(MusicErrorType11.Score, "Error in rhythm column. Should never get here.");
6132
6639
  }
6133
6640
  getMeasureTicks() {
6134
6641
  return this.getTimeSignature().measureTicks;
@@ -6147,7 +6654,7 @@ var ObjMeasure = class extends MusicObject {
6147
6654
  }
6148
6655
  // Get content rect excluding signature
6149
6656
  getColumnsContentRect() {
6150
- return new AnchoredRect20(
6657
+ return new AnchoredRect(
6151
6658
  this.barLineLeft.getRect().anchorX,
6152
6659
  this.barLineRight.getRect().anchorX,
6153
6660
  this.getRect().top,
@@ -6230,24 +6737,35 @@ var ObjMeasure = class extends MusicObject {
6230
6737
  }
6231
6738
  createExtensions() {
6232
6739
  this.layoutObjects.forEach((layoutObj) => {
6233
- var _a;
6234
6740
  let { musicObj, measure, layoutGroupId, verticalPos, line } = layoutObj;
6235
6741
  if (musicObj.getLink() instanceof Extension) {
6236
6742
  let extension = musicObj.getLink();
6237
- if (extension.getHead() === musicObj) {
6238
- extension.getTails().forEach((musicObj2) => measure.removeLayoutObjects(musicObj2));
6239
- let { startColumn, endColumn } = extension.getExtensionRangeInfo();
6240
- if (extension.isVisible() && startColumn !== endColumn) {
6241
- for (let m = startColumn.measure; m !== void 0; m = m === endColumn.measure ? void 0 : m.getNextMeasure()) {
6242
- let leftObj = m === startColumn.measure ? extension.getHead() : m.getBarLineLeft();
6243
- let rightObj = m === endColumn.measure ? endColumn : m.getBarLineRight();
6244
- const lines = m.row.getNotationLines();
6245
- let line2 = (_a = lines.find((l) => l.name !== "" && l.name === line.name)) != null ? _a : lines[line.id];
6246
- if (line2) {
6247
- m.addLayoutObject(new ObjExtensionLine(m, line2, extension, leftObj, rightObj), line2, layoutGroupId, verticalPos);
6248
- }
6249
- }
6250
- }
6743
+ if (extension.getHead() !== musicObj)
6744
+ return;
6745
+ extension.getTails().forEach((musicObj2) => measure.removeLayoutObjects(musicObj2));
6746
+ if (!extension.isVisible())
6747
+ return;
6748
+ const range = extension.getRange();
6749
+ const rcols = range.columnRange.slice();
6750
+ for (let isFirst = true; rcols.length > 1; isFirst = false) {
6751
+ const { measure: measure2 } = rcols[0];
6752
+ const i = rcols.findIndex((col) => col.measure !== measure2);
6753
+ const mcols = rcols.splice(0, i > 0 ? i : rcols.length);
6754
+ if (mcols.length < 2) continue;
6755
+ const lineMatch = measure2.row.findMatchingLine(line);
6756
+ if (!lineMatch) continue;
6757
+ const isLast = rcols.length === 0;
6758
+ const extCols = [
6759
+ ...isFirst ? [musicObj] : [],
6760
+ ...mcols,
6761
+ ...isLast && range.stopObject ? [range.stopObject] : []
6762
+ ];
6763
+ measure2.addLayoutObject(
6764
+ new ObjExtensionLine(measure2, lineMatch, extension, extCols),
6765
+ lineMatch,
6766
+ layoutGroupId,
6767
+ verticalPos
6768
+ );
6251
6769
  }
6252
6770
  }
6253
6771
  });
@@ -6301,7 +6819,7 @@ var ObjMeasure = class extends MusicObject {
6301
6819
  let beamGroupSize = ts.beamGroupSizes[groupId];
6302
6820
  let beamGroupSizeList = [beamGroupSize];
6303
6821
  if (beamGroupSize.length > 1) {
6304
- beamGroupSizeList.unshift([Utils9.Math.sum(beamGroupSize)]);
6822
+ beamGroupSizeList.unshift([utils_exports.Math.sum(beamGroupSize)]);
6305
6823
  }
6306
6824
  let beamCreated = false;
6307
6825
  let groupStartTicksSave = groupStartTicks;
@@ -6316,7 +6834,7 @@ var ObjMeasure = class extends MusicObject {
6316
6834
  let symbolEndTicks = symbolStartTicks + symbol.rhythmProps.ticks;
6317
6835
  return symbolStartTicks >= groupStartTicks && symbolEndTicks <= groupEndTicks;
6318
6836
  });
6319
- let groupSymbolsTicks = Utils9.Math.sum(groupSymbols.map((sym) => sym.rhythmProps.ticks));
6837
+ let groupSymbolsTicks = utils_exports.Math.sum(groupSymbols.map((sym) => sym.rhythmProps.ticks));
6320
6838
  if (groupSymbolsTicks === beamGroupTicks && groupSymbols.every((n) => n instanceof ObjNoteGroup) && (groupSymbols.every((n) => n.rhythmProps.flagCount === 1) || beamGroupSizeList.length === 0)) {
6321
6839
  if (ObjBeamGroup.createBeam(groupSymbols)) {
6322
6840
  beamCreated = true;
@@ -6347,7 +6865,7 @@ var ObjMeasure = class extends MusicObject {
6347
6865
  this.completeRests(getVoiceIds().filter((id) => this.getConsumedTicks(id) > 0));
6348
6866
  }
6349
6867
  return;
6350
- } else if (Guard8.isArray(voiceId)) {
6868
+ } else if (guard_exports.isArray(voiceId)) {
6351
6869
  voiceId.forEach((id) => this.completeRests(id));
6352
6870
  return;
6353
6871
  } else {
@@ -6386,7 +6904,7 @@ var ObjMeasure = class extends MusicObject {
6386
6904
  this.requestRectUpdate();
6387
6905
  let { unitSize } = ctx;
6388
6906
  this.postMeasureBreakWidth = this.hasPostMeasureBreak() ? DocumentSettings.PostMeasureBreakWidth * unitSize : 0;
6389
- let isFirstMeasureInRow = this === this.row.getFirstMeasure();
6907
+ let isFirstMeasureInRow = this.isFirstMeasureInRow();
6390
6908
  let isAfterMeasureBreak = ((_a = this.getPrevMeasure()) == null ? void 0 : _a.hasPostMeasureBreak()) === true;
6391
6909
  this.regions.tabTuning_0 = isFirstMeasureInRow && this.row.hasTab ? unitSize * 4 : 0;
6392
6910
  let showClef = isFirstMeasureInRow || isAfterMeasureBreak;
@@ -6419,11 +6937,12 @@ var ObjMeasure = class extends MusicObject {
6419
6937
  }
6420
6938
  });
6421
6939
  this.tabStringNotes.length = 0;
6422
- if (this === this.row.getFirstMeasure()) {
6940
+ if (this.isFirstMeasureInRow()) {
6423
6941
  this.row.getTabs().forEach((tab) => {
6424
6942
  for (let stringId = 0; stringId < 6; stringId++) {
6425
6943
  let note = tab.getTuningStrings()[stringId].format(PitchNotation.Helmholtz, SymbolSet.Unicode);
6426
- let obj = new ObjText(this, { text: note, scale: 0.8 }, 1, 0.5);
6944
+ let color = DocumentColor.Tab_Tuning;
6945
+ let obj = new ObjText(this, { text: note, scale: 0.8, color }, 1, 0.5);
6427
6946
  obj.layout(ctx);
6428
6947
  obj.setRight(this.regions.tabTuning_0 * 0.8);
6429
6948
  obj.setCenterY(tab.getStringY(stringId));
@@ -6456,7 +6975,7 @@ var ObjMeasure = class extends MusicObject {
6456
6975
  return;
6457
6976
  }
6458
6977
  width = Math.max(width, this.getMinWidth());
6459
- this.rect = new AnchoredRect20();
6978
+ this.rect = new AnchoredRect();
6460
6979
  this.rect.anchorX = this.rect.left + width / 2;
6461
6980
  this.rect.right = this.rect.left + width;
6462
6981
  this.signatures.forEach((signature) => {
@@ -6541,7 +7060,7 @@ var ObjMeasure = class extends MusicObject {
6541
7060
  ...this.beamGroups.filter((b) => !b.isEmpty()).map((b) => b.getRect().bottom),
6542
7061
  ...this.layoutObjects.filter((o) => o.isPositionResolved()).map((o) => o.musicObj.getRect().bottom)
6543
7062
  );
6544
- if (this === this.row.getLastMeasure()) {
7063
+ if (this.isLastMeasureInRow()) {
6545
7064
  this.rect.right = Math.max(
6546
7065
  this.rect.right,
6547
7066
  ...this.layoutObjects.filter((o) => o.isPositionResolved() && o.musicObj instanceof ObjFermata).map((o) => o.musicObj.getRect().right)
@@ -6569,21 +7088,31 @@ var ObjMeasure = class extends MusicObject {
6569
7088
  }
6570
7089
  draw(ctx) {
6571
7090
  ctx.drawDebugRect(this.getRect());
7091
+ ctx.lineWidth(1);
6572
7092
  let left = this.getStaffLineLeft();
6573
7093
  let right = this.getStaffLineRight();
6574
- ctx.color("black").lineWidth(1);
6575
- const drawLine = (y) => ctx.strokeLine(left, y, right, y);
7094
+ const drawLine = (y, color) => ctx.color(color).strokeLine(left, y, right, y);
6576
7095
  this.row.getNotationLines().forEach((line) => {
6577
7096
  if (line instanceof ObjStaff) {
6578
7097
  for (let p = line.bottomLineDiatonicId; p <= line.topLineDiatonicId; p += 2) {
6579
- drawLine(line.getDiatonicIdY(p));
7098
+ drawLine(line.getDiatonicIdY(p), DocumentColor.Staff_Frame);
6580
7099
  }
6581
7100
  } else if (line instanceof ObjTab) {
6582
7101
  for (let stringId = 0; stringId < 6; stringId++) {
6583
- drawLine(line.getStringY(stringId));
7102
+ drawLine(line.getStringY(stringId), DocumentColor.Tab_Frame);
6584
7103
  }
6585
7104
  }
6586
7105
  });
7106
+ if (this.isFirstMeasureInRow() && this.row.getNotationLines().length === 1) {
7107
+ this.row.getTabs().forEach((tab) => {
7108
+ const grp = tab.getRowGroup();
7109
+ if (grp.hasBrace) return;
7110
+ const left2 = this.getStaffLineLeft();
7111
+ const top = tab.getTopLineY();
7112
+ const bottom = tab.getBottomLineY();
7113
+ ctx.color(DocumentColor.Tab_Frame).lineWidth(1).strokeLine(left2, top, left2, bottom);
7114
+ });
7115
+ }
6587
7116
  this.signatures.forEach((signature) => signature.draw(ctx));
6588
7117
  this.tabStringNotes.forEach((obj) => obj.draw(ctx));
6589
7118
  this.barLineLeft.draw(ctx);
@@ -6599,8 +7128,7 @@ var ObjMeasure = class extends MusicObject {
6599
7128
  };
6600
7129
 
6601
7130
  // src/score/engine/layout-object.ts
6602
- import { MusicError as MusicError14, MusicErrorType as MusicErrorType14 } from "@tspro/web-music-score/core";
6603
- import { AnchoredRect as AnchoredRect21, asMulti as asMulti2, IndexArray as IndexArray3, UniMap as UniMap7 } from "@tspro/ts-utils-lib";
7131
+ import { MusicError as MusicError12, MusicErrorType as MusicErrorType12 } from "@tspro/web-music-score/core";
6604
7132
  var LayoutGroupId = /* @__PURE__ */ ((LayoutGroupId2) => {
6605
7133
  LayoutGroupId2[LayoutGroupId2["TabRhythm"] = 0] = "TabRhythm";
6606
7134
  LayoutGroupId2[LayoutGroupId2["Fermata"] = 1] = "Fermata";
@@ -6615,7 +7143,7 @@ var LayoutGroupId = /* @__PURE__ */ ((LayoutGroupId2) => {
6615
7143
  LayoutGroupId2[LayoutGroupId2["LyricsVerse3"] = 10] = "LyricsVerse3";
6616
7144
  return LayoutGroupId2;
6617
7145
  })(LayoutGroupId || {});
6618
- var LayoutGroupIdAttrs = new UniMap7([
7146
+ var LayoutGroupIdAttrs = new UniMap([
6619
7147
  [0 /* TabRhythm */, { rowAlign: true }],
6620
7148
  [1 /* Fermata */, { reserveSpace: true }],
6621
7149
  [2 /* NoteLabel */, { reserveSpace: true }],
@@ -6635,7 +7163,7 @@ function requireParentMeasure(p) {
6635
7163
  }
6636
7164
  p = p.getParent();
6637
7165
  }
6638
- throw new MusicError14(MusicErrorType14.Score, "Parent measure is required but not found!");
7166
+ throw new MusicError12(MusicErrorType12.Score, "Parent measure is required but not found!");
6639
7167
  }
6640
7168
  var StaffGroup = class {
6641
7169
  constructor(groupName, staffsTabsAndGroups, verticalPosition) {
@@ -6659,7 +7187,7 @@ var LayoutObjectWrapper = class {
6659
7187
  this.row = this.measure.row;
6660
7188
  let anchor = this.musicObj.getParent();
6661
7189
  if (!anchor) {
6662
- throw new MusicError14(MusicErrorType14.Score, "Parent music object is required as an anchor.");
7190
+ throw new MusicError12(MusicErrorType12.Score, "Parent music object is required as an anchor.");
6663
7191
  }
6664
7192
  this.anchor = anchor;
6665
7193
  this.anchor.addAnchoredLayoutObject(this);
@@ -6687,7 +7215,7 @@ var LayoutObjectWrapper = class {
6687
7215
  let staticShapeRects = staticObj.getShapeRects();
6688
7216
  objShapeRects.forEach((objR) => {
6689
7217
  staticShapeRects.forEach((staticR) => {
6690
- if (AnchoredRect21.overlapX(objR, staticR)) {
7218
+ if (AnchoredRect.overlapX(objR, staticR)) {
6691
7219
  y = verticalPos === 1 /* Below */ ? Math.max(y, staticR.bottom + objR.toph + objR.anchorY) : Math.min(y, staticR.top - objR.bottomh - objR.anchorY);
6692
7220
  }
6693
7221
  });
@@ -6695,13 +7223,6 @@ var LayoutObjectWrapper = class {
6695
7223
  });
6696
7224
  return y;
6697
7225
  }
6698
- getTextContent() {
6699
- if (this.musicObj instanceof ObjText || this.musicObj instanceof ObjSpecialText) {
6700
- return this.musicObj.getText();
6701
- } else {
6702
- return void 0;
6703
- }
6704
- }
6705
7226
  layout(ctx) {
6706
7227
  this.line.addObject(this);
6707
7228
  }
@@ -6719,7 +7240,7 @@ var LayoutGroup = class {
6719
7240
  constructor(layoutGroupId) {
6720
7241
  this.layoutGroupId = layoutGroupId;
6721
7242
  // key = VerticalPos
6722
- __publicField(this, "layoutObject", asMulti2(new IndexArray3()));
7243
+ __publicField(this, "layoutObject", asMulti(new IndexArray()));
6723
7244
  __publicField(this, "rowAlign");
6724
7245
  __publicField(this, "reserveSpace");
6725
7246
  __publicField(this, "padding");
@@ -6749,12 +7270,15 @@ var LayoutGroup = class {
6749
7270
  };
6750
7271
 
6751
7272
  // src/score/engine/obj-staff-and-tab.ts
6752
- var ObjNotationLine5 = class extends MusicObject {
7273
+ var ObjNotationLine6 = class extends MusicObject {
6753
7274
  constructor(row) {
6754
7275
  super(row);
6755
7276
  this.row = row;
6756
7277
  __publicField(this, "objects", []);
6757
- __publicField(this, "layoutGroups", new UniMap8());
7278
+ __publicField(this, "layoutGroups", new UniMap());
7279
+ }
7280
+ getRowGroup() {
7281
+ return this.row.getRowGroupByLineId(this.id);
6758
7282
  }
6759
7283
  addObject(o) {
6760
7284
  this.objects.push(o);
@@ -6769,7 +7293,7 @@ var ObjNotationLine5 = class extends MusicObject {
6769
7293
  this.layoutGroups.forEach((layoutGroup) => layoutGroup.layout(ctx));
6770
7294
  }
6771
7295
  layoutLayoutGroups(ctx) {
6772
- for (const groupId of Utils10.Enum.getEnumValues(LayoutGroupId)) {
7296
+ for (const groupId of utils_exports.Enum.getEnumValues(LayoutGroupId)) {
6773
7297
  const layoutGroup = this.getLayoutGroup(groupId);
6774
7298
  if (layoutGroup) {
6775
7299
  this.layoutLayoutGroup(ctx, layoutGroup, 0 /* Above */);
@@ -6820,11 +7344,20 @@ var ObjNotationLine5 = class extends MusicObject {
6820
7344
  });
6821
7345
  }
6822
7346
  }
7347
+ drawVerticalLine(ctx, left, width, isSystemBarLine = false) {
7348
+ ctx.color(this.getConfig().type === "tab" ? DocumentColor.Tab_Frame : DocumentColor.Staff_Frame);
7349
+ const i = this.row.getNotationLines().indexOf(this);
7350
+ const nextLine = i >= 0 ? this.row.getNotationLines()[i + 1] : void 0;
7351
+ const isGroupLine = this.getRowGroup().lines.length > 1;
7352
+ const isGrandTreble = this instanceof ObjStaff && this.isGrandTreble();
7353
+ const top = this.getTopLineY();
7354
+ const bottom = nextLine && (isSystemBarLine || isGroupLine || isGrandTreble) ? nextLine.getTopLineY() : this.getBottomLineY();
7355
+ ctx.fillRect(left, top, width, bottom - top);
7356
+ }
6823
7357
  };
6824
- var ObjStaff = class extends ObjNotationLine5 {
7358
+ var ObjStaff = class extends ObjNotationLine6 {
6825
7359
  constructor(row, staffConfig, id) {
6826
7360
  super(row);
6827
- this.row = row;
6828
7361
  this.staffConfig = staffConfig;
6829
7362
  this.id = id;
6830
7363
  __publicField(this, "clefImageAsset");
@@ -6848,7 +7381,7 @@ var ObjStaff = class extends ObjNotationLine5 {
6848
7381
  this.clefLineDiatonicId = getDiatonicId("F3", staffConfig.isOctaveDown === true);
6849
7382
  this.middleLineDiatonicId = this.clefLineDiatonicId - 2;
6850
7383
  } else {
6851
- throw new MusicError15(MusicErrorType15.Score, `Invalid staffConfig.clef ${staffConfig.clef}.`);
7384
+ throw new MusicError13(MusicErrorType13.Score, `Invalid staffConfig.clef ${staffConfig.clef}.`);
6852
7385
  }
6853
7386
  this.topLineDiatonicId = this.middleLineDiatonicId + 4;
6854
7387
  this.bottomLineDiatonicId = this.middleLineDiatonicId - 4;
@@ -6879,9 +7412,14 @@ var ObjStaff = class extends ObjNotationLine5 {
6879
7412
  return this.bottomLineY;
6880
7413
  }
6881
7414
  joinGrandStaff(staff) {
6882
- if (staff !== this) {
7415
+ if (staff !== this)
6883
7416
  this.joinedGrandStaff = staff;
6884
- }
7417
+ }
7418
+ isGrandTreble() {
7419
+ return this.joinedGrandStaff !== void 0 && this.staffConfig.clef === "G" /* G */;
7420
+ }
7421
+ isGrandBass() {
7422
+ return this.joinedGrandStaff !== void 0 && this.staffConfig.clef === "F" /* F */;
6885
7423
  }
6886
7424
  getLineSpacing() {
6887
7425
  return (this.bottomLineY - this.topLineY) / 4;
@@ -6899,7 +7437,7 @@ var ObjStaff = class extends ObjNotationLine5 {
6899
7437
  } else if (this.joinedGrandStaff && this.joinedGrandStaff.containsDiatonicId(diatonicId)) {
6900
7438
  return this.joinedGrandStaff.getDiatonicIdY(diatonicId);
6901
7439
  } else {
6902
- throw new MusicError15(MusicErrorType15.Score, "Staff does not contain diatonicId " + diatonicId);
7440
+ throw new MusicError13(MusicErrorType13.Score, "Staff does not contain diatonicId " + diatonicId);
6903
7441
  }
6904
7442
  }
6905
7443
  getActualStaff(diatonicId) {
@@ -6908,7 +7446,7 @@ var ObjStaff = class extends ObjNotationLine5 {
6908
7446
  } else if (this.joinedGrandStaff && this.joinedGrandStaff.containsDiatonicId(diatonicId)) {
6909
7447
  return this.joinedGrandStaff;
6910
7448
  } else {
6911
- throw new MusicError15(MusicErrorType15.Score, "Staff does not contain diatonicId " + diatonicId);
7449
+ throw new MusicError13(MusicErrorType13.Score, "Staff does not contain diatonicId " + diatonicId);
6912
7450
  }
6913
7451
  }
6914
7452
  getDiatonicIdAt(y) {
@@ -6922,7 +7460,7 @@ var ObjStaff = class extends ObjNotationLine5 {
6922
7460
  return diatonicId % 2 !== this.middleLineDiatonicId % 2;
6923
7461
  }
6924
7462
  containsVoiceId(voiceId) {
6925
- return Guard9.isUndefined(this.staffConfig.voiceId) || Utils10.Arr.toArray(this.staffConfig.voiceId).includes(voiceId);
7463
+ return guard_exports.isUndefined(this.staffConfig.voiceId) || utils_exports.Arr.toArray(this.staffConfig.voiceId).includes(voiceId);
6926
7464
  }
6927
7465
  calcTop() {
6928
7466
  let top = this.topLineY;
@@ -6952,7 +7490,7 @@ var ObjStaff = class extends ObjNotationLine5 {
6952
7490
  let h = unitSize * DocumentSettings.StaffHeight;
6953
7491
  this.topLineY = -h / 2;
6954
7492
  this.bottomLineY = h / 2;
6955
- this.rect = new AnchoredRect22(0, 0, this.topLineY, this.bottomLineY);
7493
+ this.rect = new AnchoredRect(0, 0, this.topLineY, this.bottomLineY);
6956
7494
  }
6957
7495
  layoutWidth(ctx) {
6958
7496
  this.rect.left = this.row.getRect().left;
@@ -6973,10 +7511,9 @@ var ObjStaff = class extends ObjNotationLine5 {
6973
7511
  draw(ctx) {
6974
7512
  }
6975
7513
  };
6976
- var ObjTab = class extends ObjNotationLine5 {
7514
+ var ObjTab = class extends ObjNotationLine6 {
6977
7515
  constructor(row, tabConfig, id) {
6978
7516
  super(row);
6979
- this.row = row;
6980
7517
  this.tabConfig = tabConfig;
6981
7518
  this.id = id;
6982
7519
  __publicField(this, "top", 0);
@@ -6984,7 +7521,7 @@ var ObjTab = class extends ObjNotationLine5 {
6984
7521
  __publicField(this, "tuningName");
6985
7522
  __publicField(this, "tuningStrings");
6986
7523
  __publicField(this, "mi");
6987
- if (Guard9.isArray(tabConfig.tuning)) {
7524
+ if (guard_exports.isArray(tabConfig.tuning)) {
6988
7525
  this.tuningName = void 0;
6989
7526
  this.tuningStrings = tabConfig.tuning.map((noteName) => Note8.getNote(noteName)).reverse();
6990
7527
  } else if (typeof tabConfig.tuning === "string") {
@@ -7035,7 +7572,7 @@ var ObjTab = class extends ObjNotationLine5 {
7035
7572
  return this.bottom;
7036
7573
  }
7037
7574
  containsVoiceId(voiceId) {
7038
- return Guard9.isUndefined(this.tabConfig.voiceId) || Utils10.Arr.toArray(this.tabConfig.voiceId).includes(voiceId);
7575
+ return guard_exports.isUndefined(this.tabConfig.voiceId) || utils_exports.Arr.toArray(this.tabConfig.voiceId).includes(voiceId);
7039
7576
  }
7040
7577
  containsDiatonicId(diatonicId) {
7041
7578
  return true;
@@ -7058,7 +7595,7 @@ var ObjTab = class extends ObjNotationLine5 {
7058
7595
  let h = unitSize * DocumentSettings.TabHeight;
7059
7596
  this.top = -h / 2;
7060
7597
  this.bottom = h / 2;
7061
- this.rect = new AnchoredRect22(0, 0, this.top, this.bottom);
7598
+ this.rect = new AnchoredRect(0, 0, this.top, this.bottom);
7062
7599
  }
7063
7600
  layoutWidth(ctx) {
7064
7601
  this.rect.left = this.row.getRect().left;
@@ -7081,11 +7618,15 @@ var ObjTab = class extends ObjNotationLine5 {
7081
7618
  };
7082
7619
 
7083
7620
  // src/score/engine/obj-score-row.ts
7084
- import { MusicError as MusicError16, MusicErrorType as MusicErrorType16 } from "@tspro/web-music-score/core";
7085
- import { AnchoredRect as AnchoredRect24, Guard as Guard10, Utils as Utils11 } from "@tspro/ts-utils-lib";
7621
+ import { MusicError as MusicError14, MusicErrorType as MusicErrorType14 } from "@tspro/web-music-score/core";
7086
7622
 
7087
7623
  // src/score/engine/obj-score-row-group.ts
7088
- import { AnchoredRect as AnchoredRect23 } from "@tspro/ts-utils-lib";
7624
+ function parseInstr(instr) {
7625
+ const instrName = (instr.startsWith("!{") ? instr.substring(2) : instr.startsWith("!") ? instr.substring(1) : instr).trim();
7626
+ const hideInstr = instr.startsWith("!");
7627
+ const hideBrace = instr.startsWith("!{");
7628
+ return { instrName, hideInstr, hideBrace };
7629
+ }
7089
7630
  var ObjScoreRowGroup = class extends MusicObject {
7090
7631
  constructor(lines) {
7091
7632
  var _a;
@@ -7093,11 +7634,16 @@ var ObjScoreRowGroup = class extends MusicObject {
7093
7634
  this.lines = lines;
7094
7635
  __publicField(this, "space", 0);
7095
7636
  __publicField(this, "instrument");
7637
+ __publicField(this, "hasBrace");
7096
7638
  __publicField(this, "instrText");
7097
- __publicField(this, "braceRect", new AnchoredRect23());
7639
+ __publicField(this, "braceRect", new AnchoredRect());
7098
7640
  __publicField(this, "mi");
7099
- this.instrument = (_a = lines[0].getConfig().instrument) != null ? _a : "";
7100
- this.instrText = new ObjText(this, { text: this.instrument, color: "black", scale: 1 }, 1, 0.5);
7641
+ const color = DocumentColor.RowGroup_Instrument;
7642
+ const instr = parseInstr((_a = lines[0].getConfig().instrument) != null ? _a : "");
7643
+ this.instrument = instr.instrName;
7644
+ this.hasBrace = instr.hideBrace ? false : this.hasInstrument && lines.length >= 2;
7645
+ const text = instr.hideInstr ? "" : this.instrument;
7646
+ this.instrText = new ObjText(this, { text, color, scale: 1 }, 1, 0.5);
7101
7647
  this.mi = new MScoreRowGroup(this);
7102
7648
  }
7103
7649
  getMusicInterface() {
@@ -7106,12 +7652,12 @@ var ObjScoreRowGroup = class extends MusicObject {
7106
7652
  get row() {
7107
7653
  return this.lines[0].row;
7108
7654
  }
7109
- get hasBrace() {
7110
- return this.hasInstrument && this.lines.length > 1;
7111
- }
7112
7655
  get hasInstrument() {
7113
7656
  return this.instrument.length > 0;
7114
7657
  }
7658
+ hasNotationLine(line) {
7659
+ return this.lines.includes(line);
7660
+ }
7115
7661
  pick(x, y) {
7116
7662
  if (!this.getRect().contains(x, y))
7117
7663
  return [];
@@ -7129,7 +7675,7 @@ var ObjScoreRowGroup = class extends MusicObject {
7129
7675
  layout(ctx) {
7130
7676
  this.space = ctx.unitSize;
7131
7677
  this.instrText.layout(ctx);
7132
- this.braceRect = new AnchoredRect23(-(this.hasBrace ? ctx.unitSize * 5 : 0), 0, 0, 0);
7678
+ this.braceRect = new AnchoredRect(-(this.hasBrace ? ctx.unitSize * 5 : 0), 0, 0, 0);
7133
7679
  this.forceRectUpdate();
7134
7680
  }
7135
7681
  layoutToNotationLines() {
@@ -7146,7 +7692,8 @@ var ObjScoreRowGroup = class extends MusicObject {
7146
7692
  draw(ctx) {
7147
7693
  this.instrText.draw(ctx);
7148
7694
  if (this.hasBrace) {
7149
- ctx.color("brack").lineWidth(1).drawBracket(this.braceRect, "{");
7695
+ const r = this.braceRect;
7696
+ ctx.color(DocumentColor.RowGroup_Frame).lineWidth(1).drawBracket(r, "{");
7150
7697
  }
7151
7698
  }
7152
7699
  };
@@ -7200,6 +7747,7 @@ var ObjScoreRow = class extends MusicObject {
7200
7747
  __publicField(this, "staves");
7201
7748
  __publicField(this, "tabs");
7202
7749
  __publicField(this, "measures", []);
7750
+ __publicField(this, "rowGroupByLine");
7203
7751
  __publicField(this, "needLayout", true);
7204
7752
  __publicField(this, "mi");
7205
7753
  this.notationLines = this.createNotationLines();
@@ -7216,6 +7764,7 @@ var ObjScoreRow = class extends MusicObject {
7216
7764
  }
7217
7765
  }
7218
7766
  this.rowGroups = lineGroups.filter((lines) => lines.length > 0).map((lines) => new ObjScoreRowGroup(lines));
7767
+ this.rowGroupByLine = this.notationLines.map((line) => this.rowGroups.find((grp) => grp.lines.includes(line)));
7219
7768
  if (this.prevRow) {
7220
7769
  this.prevRow.nextRow = this;
7221
7770
  }
@@ -7242,9 +7791,12 @@ var ObjScoreRow = class extends MusicObject {
7242
7791
  getRowGroups() {
7243
7792
  return this.rowGroups;
7244
7793
  }
7794
+ getRowGroupByLineId(id) {
7795
+ return this.rowGroupByLine[id];
7796
+ }
7245
7797
  findMatchingLine(line) {
7246
7798
  return line.row === this ? line : this.notationLines.find(
7247
- (curLine) => Utils11.Obj.deepEqual(line.row.scoreConfig, curLine.row.scoreConfig) && line.id === curLine.id || Guard10.isNonEmptyString(line.getConfig().name) && line.getConfig().name === curLine.getConfig().name && line.getConfig().type === curLine.getConfig().type
7799
+ (curLine) => utils_exports.Obj.deepEqual(line.row.scoreConfig, curLine.row.scoreConfig) && line.id === curLine.id || guard_exports.isNonEmptyString(line.getConfig().name) && line.getConfig().name === curLine.getConfig().name && line.getConfig().type === curLine.getConfig().type
7248
7800
  );
7249
7801
  }
7250
7802
  get regions() {
@@ -7267,7 +7819,7 @@ var ObjScoreRow = class extends MusicObject {
7267
7819
  if (topStaff) {
7268
7820
  return topStaff;
7269
7821
  } else {
7270
- throw new MusicError16(MusicErrorType16.Score, "Top staff is required!");
7822
+ throw new MusicError14(MusicErrorType14.Score, "Top staff is required!");
7271
7823
  }
7272
7824
  }
7273
7825
  getBottomStaff() {
@@ -7275,7 +7827,7 @@ var ObjScoreRow = class extends MusicObject {
7275
7827
  if (bottomStaff) {
7276
7828
  return bottomStaff;
7277
7829
  } else {
7278
- throw new MusicError16(MusicErrorType16.Score, "Bottom staff is required!");
7830
+ throw new MusicError14(MusicErrorType14.Score, "Bottom staff is required!");
7279
7831
  }
7280
7832
  }
7281
7833
  getStaff(diatonicId) {
@@ -7322,7 +7874,7 @@ var ObjScoreRow = class extends MusicObject {
7322
7874
  let r = this.getRect();
7323
7875
  let firstMeasure = this.getFirstMeasure();
7324
7876
  let left = firstMeasure ? firstMeasure.getColumnsContentRect().left : r.left;
7325
- return new AnchoredRect24(left, (left + r.right) / 2, r.right, r.top, r.anchorY, r.bottom);
7877
+ return new AnchoredRect(left, (left + r.right) / 2, r.right, r.top, r.anchorY, r.bottom);
7326
7878
  }
7327
7879
  getDiatonicIdAt(y) {
7328
7880
  for (let i = 0; i < this.notationLines.length; i++) {
@@ -7369,7 +7921,7 @@ var ObjScoreRow = class extends MusicObject {
7369
7921
  return "up" /* Up */;
7370
7922
  }
7371
7923
  let diatonicIds = noteGroupDiatonicIds.length > 0 ? noteGroupDiatonicIds : restDiatonicIds;
7372
- let avgDiatonicId = Math.floor(Utils11.Math.avg(...diatonicIds));
7924
+ let avgDiatonicId = Math.floor(utils_exports.Math.avg(...diatonicIds));
7373
7925
  let staves = this.getStaves().filter((staff) => staff.containsVoiceId(voiceId) && staff.containsDiatonicId(avgDiatonicId));
7374
7926
  return staves.length > 0 ? avgDiatonicId >= staves[0].middleLineDiatonicId ? "down" /* Down */ : "up" /* Up */ : "up" /* Up */;
7375
7927
  }
@@ -7401,7 +7953,7 @@ var ObjScoreRow = class extends MusicObject {
7401
7953
  if (!this.needLayout) {
7402
7954
  return;
7403
7955
  }
7404
- this.rect = new AnchoredRect24(this.regions.left, this.regions.right, 0, 0);
7956
+ this.rect = new AnchoredRect(this.regions.left, this.regions.right, 0, 0);
7405
7957
  this.notationLines.forEach((line) => line.layoutWidth(ctx));
7406
7958
  this.rowGroups.forEach((grp) => grp.setRight(this.regions.instrRight));
7407
7959
  let targetColumnsAreaWidth = this.regions.staffWidth;
@@ -7440,7 +7992,7 @@ var ObjScoreRow = class extends MusicObject {
7440
7992
  top = Math.min(...this.measures.map((m) => m.getRect().top));
7441
7993
  bottom = Math.max(...this.measures.map((m) => m.getRect().bottom));
7442
7994
  }
7443
- this.rect = new AnchoredRect24(left, right, top, bottom);
7995
+ this.rect = new AnchoredRect(left, right, top, bottom);
7444
7996
  }
7445
7997
  alignStemsToBeams() {
7446
7998
  this.measures.forEach((m) => m.alignStemsToBeams());
@@ -7484,6 +8036,10 @@ var ObjScoreRow = class extends MusicObject {
7484
8036
  this.notationLines.forEach((l) => l.offset(dx, dy));
7485
8037
  this.rowGroups.forEach((grp) => grp.offset(dx, dy));
7486
8038
  }
8039
+ getStaffLineLeft() {
8040
+ var _a;
8041
+ return (_a = this.getFirstMeasure()) == null ? void 0 : _a.getStaffLineLeft();
8042
+ }
7487
8043
  draw(ctx) {
7488
8044
  ctx.drawDebugRect(this.getRect());
7489
8045
  const { left, top, width, height } = this.getRect();
@@ -7491,21 +8047,18 @@ var ObjScoreRow = class extends MusicObject {
7491
8047
  ctx.save();
7492
8048
  ctx.rect(left - p, top, width + 2 * p, height);
7493
8049
  ctx.clip();
7494
- if (this.getFirstMeasure() && (this.notationLines.length > 1 || this.notationLines[0] instanceof ObjTab)) {
7495
- let left2 = this.getFirstMeasure().getStaffLineLeft();
7496
- let top2 = Math.min(...this.notationLines.map((line) => line.getTopLineY()));
7497
- let bottom = Math.max(...this.notationLines.map((line) => line.getBottomLineY()));
7498
- ctx.color("black").lineWidth(1).strokeLine(left2, top2, left2, bottom);
7499
- }
7500
8050
  this.measures.forEach((m) => m.draw(ctx));
7501
8051
  this.notationLines.forEach((m) => m.draw(ctx));
8052
+ const staffLeft = this.getStaffLineLeft();
8053
+ if (staffLeft !== void 0 && this.notationLines.length > 1) {
8054
+ this.notationLines.forEach((line) => line.drawVerticalLine(ctx, staffLeft, ctx._lineWidth, true));
8055
+ }
7502
8056
  this.rowGroups.forEach((grp) => grp.draw(ctx));
7503
8057
  ctx.restore();
7504
8058
  }
7505
8059
  };
7506
8060
 
7507
8061
  // src/score/engine/obj-header.ts
7508
- import { AnchoredRect as AnchoredRect25 } from "@tspro/ts-utils-lib";
7509
8062
  var ObjHeader = class extends MusicObject {
7510
8063
  constructor(doc, title, composer, arranger) {
7511
8064
  super(doc);
@@ -7518,9 +8071,12 @@ var ObjHeader = class extends MusicObject {
7518
8071
  __publicField(this, "arrangerText");
7519
8072
  __publicField(this, "mi");
7520
8073
  this.mi = new MHeader(this);
7521
- this.titleText = this.title ? new ObjText(this, { text: this.title, scale: 2 }, 0.5, 0) : void 0;
7522
- this.composerText = this.composer ? new ObjText(this, this.composer, 1, 0) : void 0;
7523
- this.arrangerText = this.arranger ? new ObjText(this, "Arr.: " + this.arranger, 1, 0) : void 0;
8074
+ const titleColor = DocumentColor.Header_Title;
8075
+ const compColor = DocumentColor.Header_Composer;
8076
+ const arrColor = DocumentColor.Header_Arranger;
8077
+ this.titleText = this.title ? new ObjText(this, { text: this.title, color: titleColor, scale: 2 }, 0.5, 0) : void 0;
8078
+ this.composerText = this.composer ? new ObjText(this, { text: this.composer, color: compColor }, 1, 0) : void 0;
8079
+ this.arrangerText = this.arranger ? new ObjText(this, { text: "Arr.: " + this.arranger, color: arrColor }, 1, 0) : void 0;
7524
8080
  }
7525
8081
  getMusicInterface() {
7526
8082
  return this.mi;
@@ -7553,7 +8109,7 @@ var ObjHeader = class extends MusicObject {
7553
8109
  let top = 0;
7554
8110
  const left = this.doc.regions.staffLeft;
7555
8111
  const right = this.doc.regions.staffRight;
7556
- this.rect = new AnchoredRect25(left, right, 0, 0);
8112
+ this.rect = new AnchoredRect(left, right, 0, 0);
7557
8113
  if (this.titleText) {
7558
8114
  this.titleText.layout(ctx);
7559
8115
  this.titleText.setCenterX((left + right) / 2);
@@ -7602,8 +8158,7 @@ var ObjHeader = class extends MusicObject {
7602
8158
  };
7603
8159
 
7604
8160
  // src/score/engine/obj-document.ts
7605
- import { AnchoredRect as AnchoredRect26, Guard as Guard11, UniMap as UniMap9 } from "@tspro/ts-utils-lib";
7606
- import { MusicError as MusicError17, MusicErrorType as MusicErrorType17 } from "@tspro/web-music-score/core";
8161
+ import { MusicError as MusicError15, MusicErrorType as MusicErrorType15 } from "@tspro/web-music-score/core";
7607
8162
  var ObjDocument = class extends MusicObject {
7608
8163
  constructor() {
7609
8164
  super(void 0);
@@ -7617,7 +8172,7 @@ var ObjDocument = class extends MusicObject {
7617
8172
  __publicField(this, "header");
7618
8173
  __publicField(this, "newRowRequested", false);
7619
8174
  __publicField(this, "allConnectiveProps", []);
7620
- __publicField(this, "staffGroups", new UniMap9());
8175
+ __publicField(this, "staffGroups", new UniMap());
7621
8176
  __publicField(this, "mi");
7622
8177
  this.mi = new MDocument2(this);
7623
8178
  }
@@ -7625,7 +8180,7 @@ var ObjDocument = class extends MusicObject {
7625
8180
  return this.mi;
7626
8181
  }
7627
8182
  setScoreConfiguration(config) {
7628
- if (Guard11.isEnumValue(config, StaffPreset)) {
8183
+ if (guard_exports.isEnumValue(config, StaffPreset)) {
7629
8184
  switch (config) {
7630
8185
  default:
7631
8186
  case "treble" /* Treble */:
@@ -7653,7 +8208,7 @@ var ObjDocument = class extends MusicObject {
7653
8208
  ];
7654
8209
  break;
7655
8210
  }
7656
- } else if (Guard11.isArray(config)) {
8211
+ } else if (guard_exports.isArray(config)) {
7657
8212
  this.curScoreConfig = config;
7658
8213
  } else {
7659
8214
  this.curScoreConfig = [config];
@@ -7666,10 +8221,10 @@ var ObjDocument = class extends MusicObject {
7666
8221
  }
7667
8222
  if (treble && treble.type === "staff" && treble.isGrand) {
7668
8223
  if (treble.grandId !== void 0) {
7669
- throw new MusicError17(MusicErrorType17.Score, `Grand staff error: mixing isGrand and grandId!`);
8224
+ throw new MusicError15(MusicErrorType15.Score, `Grand staff error: mixing isGrand and grandId!`);
7670
8225
  } else if (bass && bass.type === "staff" && bass.isGrand) {
7671
8226
  if (bass.grandId !== void 0) {
7672
- throw new MusicError17(MusicErrorType17.Score, `Grand staff error: mixing isGrand and grandId!`);
8227
+ throw new MusicError15(MusicErrorType15.Score, `Grand staff error: mixing isGrand and grandId!`);
7673
8228
  } else {
7674
8229
  treble.grandId = grandId;
7675
8230
  bass.grandId = grandId;
@@ -7677,7 +8232,7 @@ var ObjDocument = class extends MusicObject {
7677
8232
  cfgId += 2;
7678
8233
  }
7679
8234
  } else {
7680
- throw new MusicError17(MusicErrorType17.Score, `Grand staff error: invalid use of isGrand!`);
8235
+ throw new MusicError15(MusicErrorType15.Score, `Grand staff error: invalid use of isGrand!`);
7681
8236
  }
7682
8237
  } else {
7683
8238
  cfgId++;
@@ -7688,20 +8243,20 @@ var ObjDocument = class extends MusicObject {
7688
8243
  let bass = this.curScoreConfig[cfgId + 1];
7689
8244
  if (treble && bass && treble.type === "staff" && bass.type === "staff" && treble.grandId !== void 0 && treble.grandId === bass.grandId) {
7690
8245
  if (usedGrandIdes.includes(treble.grandId)) {
7691
- throw new MusicError17(MusicErrorType17.Score, `Grand staff error: grandId "${treble.grandId}" already used!`);
8246
+ throw new MusicError15(MusicErrorType15.Score, `Grand staff error: grandId "${treble.grandId}" already used!`);
7692
8247
  } else if (treble.clef !== "G" /* G */) {
7693
- throw new MusicError17(MusicErrorType17.Score, `Grand staff error: Invalid treble clef "${treble.clef}"!`);
8248
+ throw new MusicError15(MusicErrorType15.Score, `Grand staff error: Invalid treble clef "${treble.clef}"!`);
7694
8249
  } else if (bass.clef !== "F" /* F */) {
7695
- throw new MusicError17(MusicErrorType17.Score, `Grand staff error: Invalid treble clef "${treble.clef}"!`);
8250
+ throw new MusicError15(MusicErrorType15.Score, `Grand staff error: Invalid treble clef "${treble.clef}"!`);
7696
8251
  } else if (treble.isOctaveDown || bass.isOctaveDown) {
7697
- throw new MusicError17(MusicErrorType17.Score, `Grand staff error: cannot use isOctaveDown option!`);
8252
+ throw new MusicError15(MusicErrorType15.Score, `Grand staff error: cannot use isOctaveDown option!`);
7698
8253
  }
7699
8254
  usedGrandIdes.push(treble.grandId);
7700
8255
  treble.minNote = "C4";
7701
8256
  bass.maxNote = "B3";
7702
8257
  cfgId += 2;
7703
8258
  } else if (treble && treble.type === "staff" && treble.grandId !== void 0) {
7704
- throw new MusicError17(MusicErrorType17.Score, `Grand staff error: invalid use of grandId "${treble.grandId}"!`);
8259
+ throw new MusicError15(MusicErrorType15.Score, `Grand staff error: invalid use of grandId "${treble.grandId}"!`);
7705
8260
  } else {
7706
8261
  cfgId++;
7707
8262
  }
@@ -7847,7 +8402,7 @@ var ObjDocument = class extends MusicObject {
7847
8402
  this.rows.forEach((row) => row.layoutStretch(ctx));
7848
8403
  this.rows.forEach((row) => row.layoutLayoutGroups(ctx));
7849
8404
  this.rows.forEach((row) => row.layoutSetNotationLines(ctx));
7850
- this.rect = new AnchoredRect26();
8405
+ this.rect = new AnchoredRect();
7851
8406
  if (this.header) {
7852
8407
  this.header.layout(ctx);
7853
8408
  this.rect.expandInPlace(this.header.getRect());
@@ -7864,13 +8419,10 @@ var ObjDocument = class extends MusicObject {
7864
8419
  }
7865
8420
  drawContent() {
7866
8421
  const { ctx } = this;
7867
- if (!ctx) {
7868
- return;
7869
- }
8422
+ if (!ctx) return;
7870
8423
  this.rows.forEach((row) => row.draw(ctx));
7871
- if (this.header) {
8424
+ if (this.header)
7872
8425
  this.header.draw(ctx);
7873
- }
7874
8426
  }
7875
8427
  pickStaffPosAt(x, y) {
7876
8428
  if (!this.rect.contains(x, y)) {
@@ -7913,7 +8465,7 @@ var ObjDocument = class extends MusicObject {
7913
8465
 
7914
8466
  // src/score/pub/document-builder.ts
7915
8467
  import { BeamGrouping, isNoteLength, isTupletRatio, KeySignature as KeySignature3, Note as Note10, NoteLength as NoteLength8, RhythmProps as RhythmProps6, Scale as Scale2, ScaleType, SymbolSet as SymbolSet2, TimeSignature as TimeSignature2, TimeSignatures, TuningNameList } from "@tspro/web-music-score/theory";
7916
- import { MusicError as MusicError18, MusicErrorType as MusicErrorType18 } from "@tspro/web-music-score/core";
8468
+ import { MusicError as MusicError16, MusicErrorType as MusicErrorType16 } from "@tspro/web-music-score/core";
7917
8469
  var assertingFunction = "";
7918
8470
  function setAssertFunction(fnName, ...fnArgs) {
7919
8471
  let argsStr = fnArgs.map((arg) => JSON.stringify(arg)).join(", ");
@@ -7921,95 +8473,95 @@ function setAssertFunction(fnName, ...fnArgs) {
7921
8473
  }
7922
8474
  function assertArg(...conditions) {
7923
8475
  conditions.forEach((condition) => {
7924
- if (!condition) throw new MusicError18(MusicErrorType18.Score, assertingFunction);
8476
+ if (!condition) throw new MusicError16(MusicErrorType16.Score, assertingFunction);
7925
8477
  });
7926
8478
  }
7927
8479
  function assertArgMsg(condition, msg) {
7928
- if (!condition) throw new MusicError18(MusicErrorType18.Score, msg);
8480
+ if (!condition) throw new MusicError16(MusicErrorType16.Score, msg);
7929
8481
  }
7930
8482
  function assertBaseConfig(baseConfig) {
7931
8483
  var _a;
7932
8484
  assertArg(
7933
- Guard12.isObject(baseConfig),
7934
- Guard12.isStringOrUndefined(baseConfig.name),
7935
- Guard12.isUndefined(baseConfig.voiceId) || isVoiceId(baseConfig.voiceId) || Guard12.isArray(baseConfig.voiceId) && baseConfig.voiceId.every((voiceId) => isVoiceId(voiceId))
8485
+ guard_exports.isObject(baseConfig),
8486
+ guard_exports.isStringOrUndefined(baseConfig.name),
8487
+ guard_exports.isUndefined(baseConfig.voiceId) || isVoiceId(baseConfig.voiceId) || guard_exports.isArray(baseConfig.voiceId) && baseConfig.voiceId.every((voiceId) => isVoiceId(voiceId))
7936
8488
  );
7937
- if (!Guard12.isUndefined(baseConfig.voiceIds)) {
7938
- assertArg(isVoiceId(baseConfig.voiceIds) || Guard12.isArray(baseConfig.voiceIds) && baseConfig.voiceIds.every((voiceId) => isVoiceId(voiceId)));
8489
+ if (!guard_exports.isUndefined(baseConfig.voiceIds)) {
8490
+ assertArg(isVoiceId(baseConfig.voiceIds) || guard_exports.isArray(baseConfig.voiceIds) && baseConfig.voiceIds.every((voiceId) => isVoiceId(voiceId)));
7939
8491
  console.warn(`Staff/tab config property 'voiceIds' is deprecated, use 'voiceId' instead.`);
7940
- let arr = Utils12.Arr.toArray((_a = baseConfig.voiceId) != null ? _a : []);
7941
- Utils12.Arr.toArray(baseConfig.voiceIds).forEach((voiceId) => arr.push(voiceId));
8492
+ let arr = utils_exports.Arr.toArray((_a = baseConfig.voiceId) != null ? _a : []);
8493
+ utils_exports.Arr.toArray(baseConfig.voiceIds).forEach((voiceId) => arr.push(voiceId));
7942
8494
  baseConfig.voiceId = arr;
7943
8495
  }
7944
- if (Guard12.isArray(baseConfig.voiceId)) {
7945
- baseConfig.voiceId = Utils12.Arr.removeDuplicates(baseConfig.voiceId);
8496
+ if (guard_exports.isArray(baseConfig.voiceId)) {
8497
+ baseConfig.voiceId = utils_exports.Arr.removeDuplicates(baseConfig.voiceId);
7946
8498
  }
7947
- assertArg(Guard12.isStringOrUndefined(baseConfig.instrument));
8499
+ assertArg(guard_exports.isStringOrUndefined(baseConfig.instrument));
7948
8500
  }
7949
8501
  function assertStaffConfig(staffConfig) {
7950
8502
  assertBaseConfig(staffConfig);
7951
8503
  assertArg(
7952
- Guard12.isObject(staffConfig),
7953
- Guard12.isStrictEqual(staffConfig.type, "staff"),
7954
- Guard12.isEnumValue(staffConfig.clef, Clef),
7955
- Guard12.isBooleanOrUndefined(staffConfig.isOctaveDown),
7956
- Guard12.isUndefined(staffConfig.minNote) || Note10.isNote(staffConfig.minNote),
7957
- Guard12.isUndefined(staffConfig.maxNote) || Note10.isNote(staffConfig.maxNote),
7958
- Guard12.isStringOrUndefined(staffConfig.grandId),
7959
- Guard12.isBooleanOrUndefined(staffConfig.isGrand)
8504
+ guard_exports.isObject(staffConfig),
8505
+ guard_exports.isStrictEqual(staffConfig.type, "staff"),
8506
+ guard_exports.isEnumValue(staffConfig.clef, Clef),
8507
+ guard_exports.isBooleanOrUndefined(staffConfig.isOctaveDown),
8508
+ guard_exports.isUndefined(staffConfig.minNote) || Note10.isNote(staffConfig.minNote),
8509
+ guard_exports.isUndefined(staffConfig.maxNote) || Note10.isNote(staffConfig.maxNote),
8510
+ guard_exports.isStringOrUndefined(staffConfig.grandId),
8511
+ guard_exports.isBooleanOrUndefined(staffConfig.isGrand)
7960
8512
  );
7961
- if (!Guard12.isUndefined(staffConfig.isGrand))
8513
+ if (!guard_exports.isUndefined(staffConfig.isGrand))
7962
8514
  console.warn(`Staff config property 'isGrand' is deprecated, use 'grandId' instead.`);
7963
8515
  }
7964
8516
  function assertTabConfig(tabConfig) {
7965
8517
  assertBaseConfig(tabConfig);
7966
8518
  assertArg(
7967
- Guard12.isObject(tabConfig),
7968
- Guard12.isStrictEqual(tabConfig.type, "tab"),
7969
- Guard12.isUndefined(tabConfig.tuning) || Guard12.isString(tabConfig.tuning) && Guard12.isIncluded(tabConfig.tuning, TuningNameList) || Guard12.isArray(tabConfig.tuning) && Guard12.isStrictEqual(tabConfig.tuning.length, getStringNumbers().length && tabConfig.tuning.every((s) => Note10.isNote(s)))
8519
+ guard_exports.isObject(tabConfig),
8520
+ guard_exports.isStrictEqual(tabConfig.type, "tab"),
8521
+ guard_exports.isUndefined(tabConfig.tuning) || guard_exports.isString(tabConfig.tuning) && guard_exports.isIncluded(tabConfig.tuning, TuningNameList) || guard_exports.isArray(tabConfig.tuning) && guard_exports.isStrictEqual(tabConfig.tuning.length, getStringNumbers().length && tabConfig.tuning.every((s) => Note10.isNote(s)))
7970
8522
  );
7971
8523
  }
7972
8524
  function assertNoteOptions(noteOptions) {
7973
8525
  assertArg(
7974
- Guard12.isObject(noteOptions),
7975
- Guard12.isBooleanOrUndefined(noteOptions.dotted) || Guard12.isIntegerGte(noteOptions.dotted, 0),
7976
- Guard12.isEnumValueOrUndefined(noteOptions.stem, Stem),
7977
- Guard12.isStringOrUndefined(noteOptions.color),
7978
- Guard12.isBooleanOrUndefined(noteOptions.arpeggio) || Guard12.isEnumValue(noteOptions.arpeggio, Arpeggio),
7979
- Guard12.isBooleanOrUndefined(noteOptions.staccato),
7980
- Guard12.isBooleanOrUndefined(noteOptions.diamond),
7981
- Guard12.isBooleanOrUndefined(noteOptions.triplet),
7982
- Guard12.isUndefined(noteOptions.string) || isStringNumber(noteOptions.string) || Guard12.isEmptyArray(noteOptions.string) || Guard12.isNonEmptyArray(noteOptions.string) && noteOptions.string.every((string) => isStringNumber(string))
8526
+ guard_exports.isObject(noteOptions),
8527
+ guard_exports.isBooleanOrUndefined(noteOptions.dotted) || guard_exports.isIntegerGte(noteOptions.dotted, 0),
8528
+ guard_exports.isEnumValueOrUndefined(noteOptions.stem, Stem),
8529
+ guard_exports.isStringOrUndefined(noteOptions.color),
8530
+ guard_exports.isBooleanOrUndefined(noteOptions.arpeggio) || guard_exports.isEnumValue(noteOptions.arpeggio, Arpeggio),
8531
+ guard_exports.isBooleanOrUndefined(noteOptions.staccato),
8532
+ guard_exports.isBooleanOrUndefined(noteOptions.diamond),
8533
+ guard_exports.isBooleanOrUndefined(noteOptions.triplet),
8534
+ guard_exports.isUndefined(noteOptions.string) || isStringNumber(noteOptions.string) || guard_exports.isEmptyArray(noteOptions.string) || guard_exports.isNonEmptyArray(noteOptions.string) && noteOptions.string.every((string) => isStringNumber(string))
7983
8535
  );
7984
- assertArgMsg(Guard12.isUndefined(noteOptions.tieSpan), `NoteOptions.tieSpan was removed. Use addConnective("tie", tieSpan)`);
7985
- assertArgMsg(Guard12.isUndefined(noteOptions.slurSpan), `NoteOptions.slurSpan was removed. Use addConnective("slur", slurSpan)`);
8536
+ assertArgMsg(guard_exports.isUndefined(noteOptions.tieSpan), `NoteOptions.tieSpan was removed. Use addConnective("tie", tieSpan)`);
8537
+ assertArgMsg(guard_exports.isUndefined(noteOptions.slurSpan), `NoteOptions.slurSpan was removed. Use addConnective("slur", slurSpan)`);
7986
8538
  }
7987
8539
  function assertRestOptions(restOptions) {
7988
8540
  assertArg(
7989
- Guard12.isObject(restOptions),
7990
- Guard12.isBooleanOrUndefined(restOptions.dotted) || Guard12.isIntegerGte(restOptions.dotted, 0),
7991
- Guard12.isStringOrUndefined(restOptions.staffPos) || Guard12.isInteger(restOptions.staffPos) || restOptions.staffPos instanceof Note10,
7992
- Guard12.isStringOrUndefined(restOptions.color),
7993
- Guard12.isBooleanOrUndefined(restOptions.hide),
7994
- Guard12.isBooleanOrUndefined(restOptions.triplet)
8541
+ guard_exports.isObject(restOptions),
8542
+ guard_exports.isBooleanOrUndefined(restOptions.dotted) || guard_exports.isIntegerGte(restOptions.dotted, 0),
8543
+ guard_exports.isStringOrUndefined(restOptions.staffPos) || guard_exports.isInteger(restOptions.staffPos) || restOptions.staffPos instanceof Note10,
8544
+ guard_exports.isStringOrUndefined(restOptions.color),
8545
+ guard_exports.isBooleanOrUndefined(restOptions.hide),
8546
+ guard_exports.isBooleanOrUndefined(restOptions.triplet)
7995
8547
  );
7996
8548
  }
7997
8549
  function assertLyricsOptions(lyricsOptions) {
7998
8550
  assertArg(
7999
- Guard12.isObject(lyricsOptions),
8000
- Guard12.isEnumValueOrUndefined(lyricsOptions.align, LyricsAlign),
8001
- Guard12.isEnumValueOrUndefined(lyricsOptions.hyphen, LyricsHyphen)
8551
+ guard_exports.isObject(lyricsOptions),
8552
+ guard_exports.isEnumValueOrUndefined(lyricsOptions.align, LyricsAlign),
8553
+ guard_exports.isEnumValueOrUndefined(lyricsOptions.hyphen, LyricsHyphen)
8002
8554
  );
8003
8555
  }
8004
8556
  function assertMeasureOptions(measureOptions) {
8005
8557
  assertArg(
8006
- Guard12.isObject(measureOptions),
8007
- Guard12.isBooleanOrUndefined(measureOptions.showNumber)
8558
+ guard_exports.isObject(measureOptions),
8559
+ guard_exports.isBooleanOrUndefined(measureOptions.showNumber)
8008
8560
  );
8009
8561
  }
8010
8562
  function assertStaffTabOrGRoups(staffTabOrGroups) {
8011
8563
  assertArg(
8012
- Guard12.isStringOrUndefined(staffTabOrGroups) || Guard12.isIntegerGte(staffTabOrGroups, 0) || Guard12.isNonEmptyArray(staffTabOrGroups) && staffTabOrGroups.every((staffTabOrGroup) => Guard12.isString(staffTabOrGroup) || Guard12.isIntegerGte(staffTabOrGroup, 0))
8564
+ guard_exports.isStringOrUndefined(staffTabOrGroups) || guard_exports.isIntegerGte(staffTabOrGroups, 0) || guard_exports.isNonEmptyArray(staffTabOrGroups) && staffTabOrGroups.every((staffTabOrGroup) => guard_exports.isString(staffTabOrGroup) || guard_exports.isIntegerGte(staffTabOrGroup, 0))
8013
8565
  );
8014
8566
  }
8015
8567
  var _DocumentBuilder = class _DocumentBuilder {
@@ -8023,19 +8575,19 @@ var _DocumentBuilder = class _DocumentBuilder {
8023
8575
  }
8024
8576
  setScoreConfiguration(config) {
8025
8577
  setAssertFunction("setScoreConfiguration", config);
8026
- if (Guard12.isEnumValue(config, StaffPreset)) {
8578
+ if (guard_exports.isEnumValue(config, StaffPreset)) {
8027
8579
  this.doc.setScoreConfiguration(config);
8028
- } else if (Guard12.isObject(config) && config.type === "staff") {
8580
+ } else if (guard_exports.isObject(config) && config.type === "staff") {
8029
8581
  assertStaffConfig(config);
8030
8582
  this.doc.setScoreConfiguration(config);
8031
- } else if (Guard12.isObject(config) && config.type === "tab") {
8583
+ } else if (guard_exports.isObject(config) && config.type === "tab") {
8032
8584
  assertTabConfig(config);
8033
8585
  this.doc.setScoreConfiguration(config);
8034
- } else if (Guard12.isNonEmptyArray(config)) {
8586
+ } else if (guard_exports.isNonEmptyArray(config)) {
8035
8587
  config.forEach((c) => {
8036
- if (Guard12.isObject(c) && c.type === "staff") {
8588
+ if (guard_exports.isObject(c) && c.type === "staff") {
8037
8589
  assertStaffConfig(c);
8038
- } else if (Guard12.isObject(c) && c.type === "tab") {
8590
+ } else if (guard_exports.isObject(c) && c.type === "tab") {
8039
8591
  assertTabConfig(c);
8040
8592
  } else {
8041
8593
  assertArg(false);
@@ -8068,9 +8620,9 @@ var _DocumentBuilder = class _DocumentBuilder {
8068
8620
  setHeader(title, composer, arranger) {
8069
8621
  setAssertFunction("setHeader", title, composer, arranger);
8070
8622
  assertArg(
8071
- Guard12.isStringOrUndefined(title),
8072
- Guard12.isStringOrUndefined(composer),
8073
- Guard12.isStringOrUndefined(arranger)
8623
+ guard_exports.isStringOrUndefined(title),
8624
+ guard_exports.isStringOrUndefined(composer),
8625
+ guard_exports.isStringOrUndefined(arranger)
8074
8626
  );
8075
8627
  this.doc.setHeader(title, composer, arranger);
8076
8628
  return this;
@@ -8082,7 +8634,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8082
8634
  */
8083
8635
  setMeasuresPerRow(measuresPerRow) {
8084
8636
  setAssertFunction("setMeasuresPerRow", measuresPerRow);
8085
- assertArg(Guard12.isIntegerGte(measuresPerRow, 1) || Guard12.isPosInfinity(measuresPerRow));
8637
+ assertArg(guard_exports.isIntegerGte(measuresPerRow, 1) || guard_exports.isPosInfinity(measuresPerRow));
8086
8638
  this.doc.setMeasuresPerRow(measuresPerRow);
8087
8639
  return this;
8088
8640
  }
@@ -8100,7 +8652,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8100
8652
  }
8101
8653
  setKeySignature(...args) {
8102
8654
  setAssertFunction("setKeySignature", ...args);
8103
- assertArg(args[0] instanceof Scale2 || args[0] instanceof KeySignature3 || Guard12.isNonEmptyString(args[0]) && Guard12.isEnumValueOrUndefined(args[1], ScaleType));
8655
+ assertArg(args[0] instanceof Scale2 || args[0] instanceof KeySignature3 || guard_exports.isNonEmptyString(args[0]) && guard_exports.isEnumValueOrUndefined(args[1], ScaleType));
8104
8656
  this.getMeasure().setKeySignature(...args);
8105
8657
  return this;
8106
8658
  }
@@ -8108,9 +8660,9 @@ var _DocumentBuilder = class _DocumentBuilder {
8108
8660
  setAssertFunction("setTimeSignature", ...args);
8109
8661
  if (args[0] instanceof TimeSignature2) {
8110
8662
  this.getMeasure().setTimeSignature(args[0]);
8111
- } else if (Guard12.isEnumValue(args[0], TimeSignatures) && Guard12.isEnumValueOrUndefined(args[1], BeamGrouping)) {
8663
+ } else if (guard_exports.isEnumValue(args[0], TimeSignatures) && guard_exports.isEnumValueOrUndefined(args[1], BeamGrouping)) {
8112
8664
  this.getMeasure().setTimeSignature(new TimeSignature2(args[0], args[1]));
8113
- } else if (Guard12.isIntegerGte(args[0], 1) && Guard12.isIntegerGte(args[1], 1) && Guard12.isEnumValueOrUndefined(args[2], BeamGrouping)) {
8665
+ } else if (guard_exports.isIntegerGte(args[0], 1) && guard_exports.isIntegerGte(args[1], 1) && guard_exports.isEnumValueOrUndefined(args[2], BeamGrouping)) {
8114
8666
  this.getMeasure().setTimeSignature(new TimeSignature2(args[0], args[1], args[2]));
8115
8667
  } else {
8116
8668
  assertArg(false);
@@ -8120,8 +8672,8 @@ var _DocumentBuilder = class _DocumentBuilder {
8120
8672
  setTempo(beatsPerMinute, beatLength, dotted) {
8121
8673
  setAssertFunction("setTempo", beatsPerMinute, beatLength, dotted);
8122
8674
  assertArg(
8123
- Guard12.isIntegerGte(beatsPerMinute, 1),
8124
- Guard12.isUndefined(beatLength) && Guard12.isUndefined(dotted) || isNoteLength(beatLength) && (Guard12.isBooleanOrUndefined(dotted) || Guard12.isIntegerGte(dotted, 0))
8675
+ guard_exports.isIntegerGte(beatsPerMinute, 1),
8676
+ guard_exports.isUndefined(beatLength) && guard_exports.isUndefined(dotted) || isNoteLength(beatLength) && (guard_exports.isBooleanOrUndefined(dotted) || guard_exports.isIntegerGte(dotted, 0))
8125
8677
  );
8126
8678
  this.getMeasure().setTempo(beatsPerMinute, beatLength, dotted);
8127
8679
  return this;
@@ -8138,15 +8690,15 @@ var _DocumentBuilder = class _DocumentBuilder {
8138
8690
  setAssertFunction("addNote", voiceId, note, noteLength, noteOptions);
8139
8691
  assertArg(
8140
8692
  isVoiceId(voiceId),
8141
- note instanceof Note10 || Guard12.isNonEmptyString(note) || Guard12.isArray(note) && note.every((note2) => note2 instanceof Note10 || Guard12.isNonEmptyString(note2)),
8693
+ note instanceof Note10 || guard_exports.isNonEmptyString(note) || guard_exports.isArray(note) && note.every((note2) => note2 instanceof Note10 || guard_exports.isNonEmptyString(note2)),
8142
8694
  isNoteLength(noteLength)
8143
8695
  );
8144
8696
  noteOptions != null ? noteOptions : noteOptions = {};
8145
8697
  assertNoteOptions(noteOptions);
8146
- if (Guard12.isArray(note)) {
8698
+ if (guard_exports.isArray(note)) {
8147
8699
  let string = noteOptions.string;
8148
8700
  note.forEach((note2, noteId) => {
8149
- noteOptions.string = Guard12.isArray(string) ? string[noteId] : string;
8701
+ noteOptions.string = guard_exports.isArray(string) ? string[noteId] : string;
8150
8702
  this.getMeasure().addNoteGroup(voiceId, [note2], noteLength, noteOptions);
8151
8703
  });
8152
8704
  } else {
@@ -8166,7 +8718,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8166
8718
  setAssertFunction("addChord", voiceId, notes, noteLength, noteOptions);
8167
8719
  assertArg(
8168
8720
  isVoiceId(voiceId),
8169
- Guard12.isNonEmptyArray(notes) && notes.every((note) => note instanceof Note10 || Guard12.isNonEmptyString(note)),
8721
+ guard_exports.isNonEmptyArray(notes) && notes.every((note) => note instanceof Note10 || guard_exports.isNonEmptyString(note)),
8170
8722
  isNoteLength(noteLength)
8171
8723
  );
8172
8724
  noteOptions != null ? noteOptions : noteOptions = {};
@@ -8211,24 +8763,24 @@ var _DocumentBuilder = class _DocumentBuilder {
8211
8763
  setAssertFunction("addTuplet", voiceId, tupletRatio);
8212
8764
  assertArg(
8213
8765
  isVoiceId(voiceId),
8214
- Guard12.isFunction(tupletBuilder),
8215
- isTupletRatio(tupletRatio) && Guard12.isBooleanOrUndefined(tupletRatio.showRatio)
8766
+ guard_exports.isFunction(tupletBuilder),
8767
+ isTupletRatio(tupletRatio) && guard_exports.isBooleanOrUndefined(tupletRatio.showRatio)
8216
8768
  );
8217
8769
  let tupletSymbols = [];
8218
8770
  const helper = {
8219
8771
  addNote: (note, noteLength, noteOptions) => {
8220
8772
  setAssertFunction("addTuplet => addNote", note, noteLength, noteOptions);
8221
8773
  assertArg(
8222
- note instanceof Note10 || Guard12.isNonEmptyString(note) || Guard12.isArray(note) && note.every((note2) => note2 instanceof Note10 || Guard12.isNonEmptyString(note2)),
8774
+ note instanceof Note10 || guard_exports.isNonEmptyString(note) || guard_exports.isArray(note) && note.every((note2) => note2 instanceof Note10 || guard_exports.isNonEmptyString(note2)),
8223
8775
  isNoteLength(noteLength)
8224
8776
  );
8225
8777
  noteOptions != null ? noteOptions : noteOptions = {};
8226
8778
  delete noteOptions.triplet;
8227
8779
  assertNoteOptions(noteOptions);
8228
- if (Guard12.isArray(note)) {
8780
+ if (guard_exports.isArray(note)) {
8229
8781
  let string = noteOptions.string;
8230
8782
  note.forEach((note2, noteId) => {
8231
- noteOptions.string = Guard12.isArray(string) ? string[noteId] : string;
8783
+ noteOptions.string = guard_exports.isArray(string) ? string[noteId] : string;
8232
8784
  let s = this.getMeasure().addNoteGroup(voiceId, [note2], noteLength, noteOptions, tupletRatio);
8233
8785
  tupletSymbols.push(s);
8234
8786
  });
@@ -8241,7 +8793,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8241
8793
  addChord: (notes, noteLength, noteOptions) => {
8242
8794
  setAssertFunction("addTuplet => addChord", notes, noteLength, noteOptions);
8243
8795
  assertArg(
8244
- Guard12.isNonEmptyArray(notes) && notes.every((note) => note instanceof Note10 || Guard12.isNonEmptyString(note)),
8796
+ guard_exports.isNonEmptyArray(notes) && notes.every((note) => note instanceof Note10 || guard_exports.isNonEmptyString(note)),
8245
8797
  isNoteLength(noteLength)
8246
8798
  );
8247
8799
  noteOptions != null ? noteOptions : noteOptions = {};
@@ -8271,8 +8823,8 @@ var _DocumentBuilder = class _DocumentBuilder {
8271
8823
  assertStaffTabOrGRoups(staffTabOrGroups);
8272
8824
  assertArg(
8273
8825
  isVerseNumber(verse),
8274
- Guard12.isEnumValue(lyricsLength, NoteLength8),
8275
- Guard12.isString(lyricsText) || Guard12.isArray(lyricsText) && lyricsText.every((text) => Guard12.isString(text))
8826
+ guard_exports.isEnumValue(lyricsLength, NoteLength8),
8827
+ guard_exports.isString(lyricsText) || guard_exports.isArray(lyricsText) && lyricsText.every((text) => guard_exports.isString(text))
8276
8828
  );
8277
8829
  lyricsOptions != null ? lyricsOptions : lyricsOptions = {};
8278
8830
  assertLyricsOptions(lyricsOptions);
@@ -8281,7 +8833,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8281
8833
  } else {
8282
8834
  (_a = lyricsOptions.align) != null ? _a : lyricsOptions.align = this.currentLyricsAlign;
8283
8835
  }
8284
- if (Guard12.isArray(lyricsText)) {
8836
+ if (guard_exports.isArray(lyricsText)) {
8285
8837
  lyricsText.forEach((text) => this.getMeasure().addLyrics(staffTabOrGroups, verse, lyricsLength, text, lyricsOptions));
8286
8838
  } else {
8287
8839
  this.getMeasure().addLyrics(staffTabOrGroups, verse, lyricsLength, lyricsText, lyricsOptions);
@@ -8315,7 +8867,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8315
8867
  }
8316
8868
  addFermataInternal(staffTabOrGroups, fermata) {
8317
8869
  assertStaffTabOrGRoups(staffTabOrGroups);
8318
- assertArg(Guard12.isEnumValue(fermata, Fermata));
8870
+ assertArg(guard_exports.isEnumValue(fermata, Fermata));
8319
8871
  this.getMeasure().addFermata(staffTabOrGroups, fermata);
8320
8872
  return this;
8321
8873
  }
@@ -8341,7 +8893,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8341
8893
  addNavigationInternal(staffTabOrGroups, navigation, ...args) {
8342
8894
  assertStaffTabOrGRoups(staffTabOrGroups);
8343
8895
  assertArg(
8344
- Guard12.isStrictEqual(navigation, "endRepeat" /* EndRepeat */) && Guard12.isStrictEqual(args.length, 1) || Guard12.isStrictEqual(navigation, "ending" /* Ending */) && Guard12.isIntegerGte(args.length, 1) && args.every((passage) => Guard12.isIntegerGte(passage, 1)) || Guard12.isEnumValue(navigation, Navigation) && Guard12.isEmptyArray(args)
8896
+ guard_exports.isStrictEqual(navigation, "endRepeat" /* EndRepeat */) && guard_exports.isStrictEqual(args.length, 1) || guard_exports.isStrictEqual(navigation, "ending" /* Ending */) && guard_exports.isIntegerGte(args.length, 1) && args.every((passage) => guard_exports.isIntegerGte(passage, 1)) || guard_exports.isEnumValue(navigation, Navigation) && guard_exports.isEmptyArray(args)
8345
8897
  );
8346
8898
  this.getMeasure().addNavigation(staffTabOrGroups, navigation, ...args);
8347
8899
  return this;
@@ -8357,12 +8909,12 @@ var _DocumentBuilder = class _DocumentBuilder {
8357
8909
  addAnnotationInternal(staffTabOrGroups, annotation, text) {
8358
8910
  annotation != null ? annotation : annotation = getAnnotation(text);
8359
8911
  if (annotation === void 0) {
8360
- throw new MusicError18(MusicErrorType18.Score, `Annotation text "${text}" is not known annotation.`);
8912
+ throw new MusicError16(MusicErrorType16.Score, `Annotation text "${text}" is not known annotation.`);
8361
8913
  }
8362
8914
  assertStaffTabOrGRoups(staffTabOrGroups);
8363
8915
  assertArg(
8364
- Guard12.isEnumValue(annotation, Annotation),
8365
- Guard12.isNonEmptyString(text)
8916
+ guard_exports.isEnumValue(annotation, Annotation),
8917
+ guard_exports.isNonEmptyString(text)
8366
8918
  );
8367
8919
  this.getMeasure().addAnnotation(staffTabOrGroups, annotation, text);
8368
8920
  return this;
@@ -8386,8 +8938,8 @@ var _DocumentBuilder = class _DocumentBuilder {
8386
8938
  addLabelInternal(staffTabOrGroups, label, text) {
8387
8939
  assertStaffTabOrGRoups(staffTabOrGroups);
8388
8940
  assertArg(
8389
- Guard12.isEnumValue(label, Label),
8390
- Guard12.isNonEmptyString(text)
8941
+ guard_exports.isEnumValue(label, Label),
8942
+ guard_exports.isNonEmptyString(text)
8391
8943
  );
8392
8944
  this.getMeasure().addLabel(staffTabOrGroups, label, text);
8393
8945
  return this;
@@ -8415,21 +8967,21 @@ var _DocumentBuilder = class _DocumentBuilder {
8415
8967
  }
8416
8968
  addConnective(connective, ...args) {
8417
8969
  setAssertFunction("addConnective", connective, ...args);
8418
- assertArg(Guard12.isEnumValue(connective, Connective));
8970
+ assertArg(guard_exports.isEnumValue(connective, Connective));
8419
8971
  if (connective === "tie" /* Tie */) {
8420
- assertArg(Guard12.isIntegerOrUndefined(args[0]) || Guard12.isEnumValue(args[0], TieType));
8421
- assertArg(Guard12.isEnumValueOrUndefined(args[1], NoteAnchor));
8972
+ assertArg(guard_exports.isIntegerOrUndefined(args[0]) || guard_exports.isEnumValue(args[0], TieType));
8973
+ assertArg(guard_exports.isEnumValueOrUndefined(args[1], NoteAnchor));
8422
8974
  let tieSpan = args[0];
8423
8975
  let noteAnchor = args[1];
8424
8976
  this.getMeasure().addConnective(connective, tieSpan, noteAnchor);
8425
8977
  } else if (connective === "slur" /* Slur */) {
8426
- assertArg(Guard12.isIntegerOrUndefined(args[0]));
8427
- assertArg(Guard12.isEnumValueOrUndefined(args[1], NoteAnchor));
8978
+ assertArg(guard_exports.isIntegerOrUndefined(args[0]));
8979
+ assertArg(guard_exports.isEnumValueOrUndefined(args[1], NoteAnchor));
8428
8980
  let slurSpan = args[0];
8429
8981
  let noteAnchor = args[1];
8430
8982
  this.getMeasure().addConnective(connective, slurSpan, noteAnchor);
8431
8983
  } else if (connective === "slide" /* Slide */) {
8432
- assertArg(Guard12.isEnumValueOrUndefined(args[0], NoteAnchor));
8984
+ assertArg(guard_exports.isEnumValueOrUndefined(args[0], NoteAnchor));
8433
8985
  let noteAnchor = args[0];
8434
8986
  this.getMeasure().addConnective(connective, noteAnchor);
8435
8987
  }
@@ -8449,20 +9001,20 @@ var _DocumentBuilder = class _DocumentBuilder {
8449
9001
  */
8450
9002
  addExtension(extensionBuilder) {
8451
9003
  setAssertFunction("addExtension");
8452
- assertArgMsg(Guard12.isFunctionOrUndefined(extensionBuilder), "addExtension() has new usage, e.g. addExtension(ext => ext.measures(2)).");
9004
+ assertArgMsg(guard_exports.isFunctionOrUndefined(extensionBuilder), "addExtension() has new usage, e.g. addExtension(ext => ext.measures(2)).");
8453
9005
  let ticks = 0;
8454
9006
  let visible = true;
8455
9007
  const helper = {
8456
9008
  notes: (noteLength, noteCount) => {
8457
9009
  setAssertFunction("addExtension.notes", noteLength, noteCount);
8458
9010
  assertArg(isNoteLength(noteLength));
8459
- assertArg(Guard12.isUndefined(noteCount) || Guard12.isNumber(noteCount) && noteCount >= 0);
9011
+ assertArg(guard_exports.isUndefined(noteCount) || guard_exports.isNumber(noteCount) && noteCount >= 0);
8460
9012
  ticks += RhythmProps6.get(noteLength).ticks * (noteCount != null ? noteCount : 1);
8461
9013
  return helper;
8462
9014
  },
8463
9015
  measures: (measureCount) => {
8464
9016
  setAssertFunction("addExtension.measures", measureCount);
8465
- assertArg(Guard12.isNumber(measureCount) && measureCount >= 1);
9017
+ assertArg(guard_exports.isNumber(measureCount) && measureCount >= 1);
8466
9018
  ticks += this.getMeasure().getMeasureTicks() * measureCount;
8467
9019
  return helper;
8468
9020
  },
@@ -8495,9 +9047,9 @@ var _DocumentBuilder = class _DocumentBuilder {
8495
9047
  addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition = "auto" /* Auto */) {
8496
9048
  setAssertFunction("addStaffGroup", groupName, staffsTabsAndGroups, verticalPosition);
8497
9049
  assertArg(
8498
- Guard12.isNonEmptyString(groupName),
8499
- Guard12.isNonEmptyString(staffsTabsAndGroups) || Guard12.isIntegerGte(staffsTabsAndGroups, 0) || Guard12.isNonEmptyArray(staffsTabsAndGroups) && staffsTabsAndGroups.every((line) => Guard12.isNonEmptyString(line) || Guard12.isIntegerGte(line, 0)),
8500
- Guard12.isEnumValue(verticalPosition, VerticalPosition)
9050
+ guard_exports.isNonEmptyString(groupName),
9051
+ guard_exports.isNonEmptyString(staffsTabsAndGroups) || guard_exports.isIntegerGte(staffsTabsAndGroups, 0) || guard_exports.isNonEmptyArray(staffsTabsAndGroups) && staffsTabsAndGroups.every((line) => guard_exports.isNonEmptyString(line) || guard_exports.isIntegerGte(line, 0)),
9052
+ guard_exports.isEnumValue(verticalPosition, VerticalPosition)
8501
9053
  );
8502
9054
  this.doc.addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition);
8503
9055
  return this;
@@ -8537,7 +9089,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8537
9089
  */
8538
9090
  completeRests(voiceId) {
8539
9091
  setAssertFunction("completeRests", voiceId);
8540
- assertArg(Guard12.isUndefined(voiceId) || isVoiceId(voiceId) || Guard12.isArray(voiceId) && voiceId.every((id) => isVoiceId(id)));
9092
+ assertArg(guard_exports.isUndefined(voiceId) || isVoiceId(voiceId) || guard_exports.isArray(voiceId) && voiceId.every((id) => isVoiceId(id)));
8541
9093
  this.getMeasure().completeRests(voiceId);
8542
9094
  return this;
8543
9095
  }
@@ -8551,8 +9103,8 @@ var _DocumentBuilder = class _DocumentBuilder {
8551
9103
  addScaleArpeggio(scale, bottomNote, numOctaves) {
8552
9104
  setAssertFunction("addScaleArpeggio", scale, bottomNote, numOctaves);
8553
9105
  assertArg(
8554
- Guard12.isNonEmptyString(bottomNote),
8555
- Guard12.isIntegerGte(numOctaves, 1)
9106
+ guard_exports.isNonEmptyString(bottomNote),
9107
+ guard_exports.isIntegerGte(numOctaves, 1)
8556
9108
  );
8557
9109
  let ts = this.getMeasure().getTimeSignature();
8558
9110
  let notes = scale.getScaleNotes(bottomNote, numOctaves);
@@ -8571,7 +9123,7 @@ __publicField(_DocumentBuilder, "DefaultMeasureOptions", {});
8571
9123
  var DocumentBuilder = _DocumentBuilder;
8572
9124
 
8573
9125
  // src/score/pub/event.ts
8574
- import { MusicError as MusicError19, MusicErrorType as MusicErrorType19 } from "@tspro/web-music-score/core";
9126
+ import { MusicError as MusicError17, MusicErrorType as MusicErrorType17 } from "@tspro/web-music-score/core";
8575
9127
  var ScoreEvent = class {
8576
9128
  /**
8577
9129
  * Create new score event instance.
@@ -8614,7 +9166,7 @@ var ScoreObjectEvent = class extends ScoreEvent {
8614
9166
  this.renderContext = renderContext;
8615
9167
  this.objects = objects;
8616
9168
  if (arguments.length === 0) {
8617
- throw new MusicError19(MusicErrorType19.Score, "Empty array in score object event!");
9169
+ throw new MusicError17(MusicErrorType17.Score, "Empty array in score object event!");
8618
9170
  }
8619
9171
  }
8620
9172
  /**
@@ -8639,21 +9191,19 @@ var ScoreObjectEvent = class extends ScoreEvent {
8639
9191
 
8640
9192
  // src/score/pub/music-interface.ts
8641
9193
  import * as Audio2 from "@tspro/web-music-score/audio";
8642
- import { Guard as Guard14, UniMap as UniMap10, ValueSet as ValueSet2, Utils as Utils13 } from "@tspro/ts-utils-lib";
8643
9194
 
8644
9195
  // src/score/pub/music-objects.ts
8645
- import { Guard as Guard13 } from "@tspro/ts-utils-lib";
8646
- import { MusicError as MusicError20, MusicErrorType as MusicErrorType20 } from "@tspro/web-music-score/core";
9196
+ import { MusicError as MusicError18, MusicErrorType as MusicErrorType18 } from "@tspro/web-music-score/core";
8647
9197
  function assertArg2(condition, argName, argValue) {
8648
9198
  if (!condition) {
8649
- throw new MusicError20(MusicErrorType20.Score, `Invalid arg: ${argName} = ${argValue}`);
9199
+ throw new MusicError18(MusicErrorType18.Score, `Invalid arg: ${argName} = ${argValue}`);
8650
9200
  }
8651
9201
  }
8652
9202
  function getNotationLine(line) {
8653
9203
  if (line instanceof ObjStaff || line instanceof ObjTab) {
8654
9204
  return line.getMusicInterface();
8655
9205
  } else {
8656
- throw new MusicError20(MusicErrorType20.Score, `Notation line not staff nor tab.`);
9206
+ throw new MusicError18(MusicErrorType18.Score, `Notation line not staff nor tab.`);
8657
9207
  }
8658
9208
  }
8659
9209
  var MusicInterface5 = class {
@@ -8823,7 +9373,7 @@ var _MDocument = class _MDocument extends MusicInterface5 {
8823
9373
  * @returns - Player instance.
8824
9374
  */
8825
9375
  play(playStateChangeListener) {
8826
- assertArg2(Guard13.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
9376
+ assertArg2(guard_exports.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
8827
9377
  return new MPlayer(this, playStateChangeListener).play();
8828
9378
  }
8829
9379
  };
@@ -8853,7 +9403,7 @@ var _MEnding = class _MEnding extends MusicInterface5 {
8853
9403
  * @returns - Boolean whether this ending has asked passage number.
8854
9404
  */
8855
9405
  hasPassage(passage) {
8856
- assertArg2(Guard13.isIntegerGte(passage, 1), "passage", passage);
9406
+ assertArg2(guard_exports.isIntegerGte(passage, 1), "passage", passage);
8857
9407
  return this.obj.hasPassage(passage);
8858
9408
  }
8859
9409
  };
@@ -9005,7 +9555,7 @@ var _MStaffBarLine = class _MStaffBarLine extends MusicInterface5 {
9005
9555
  if (barLine instanceof ObjBarLineLeft || barLine instanceof ObjBarLineRight) {
9006
9556
  return barLine.getMusicInterface();
9007
9557
  } else {
9008
- throw new MusicError20(MusicErrorType20.Score, `Bar line not left nor right.`);
9558
+ throw new MusicError18(MusicErrorType18.Score, `Bar line not left nor right.`);
9009
9559
  }
9010
9560
  }
9011
9561
  /**
@@ -9539,10 +10089,10 @@ __publicField(_MExtensionLine, "Name", "ExtensionLine");
9539
10089
  var MExtensionLine = _MExtensionLine;
9540
10090
 
9541
10091
  // src/score/pub/music-interface.ts
9542
- import { MusicError as MusicError21, MusicErrorType as MusicErrorType21 } from "@tspro/web-music-score/core";
10092
+ import { MusicError as MusicError19, MusicErrorType as MusicErrorType19 } from "@tspro/web-music-score/core";
9543
10093
  function assertArg3(condition, argName, argValue) {
9544
10094
  if (!condition) {
9545
- throw new MusicError21(MusicErrorType21.Score, `Invalid arg: ${argName} = ${argValue}`);
10095
+ throw new MusicError19(MusicErrorType19.Score, `Invalid arg: ${argName} = ${argValue}`);
9546
10096
  }
9547
10097
  }
9548
10098
  function require_t(t, message) {
@@ -9561,7 +10111,7 @@ var _MPlayer = class _MPlayer {
9561
10111
  constructor(doc, playStateChangeListener) {
9562
10112
  __publicField(this, "player");
9563
10113
  assertArg3(doc instanceof MDocument2, "doc", doc);
9564
- assertArg3(Guard14.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
10114
+ assertArg3(guard_exports.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
9565
10115
  this.player = new Player();
9566
10116
  this.player.setDocument(doc.getMusicObject());
9567
10117
  this.player.setCursorPositionChangeListener((cursorRect) => {
@@ -9605,7 +10155,7 @@ var _MPlayer = class _MPlayer {
9605
10155
  return this;
9606
10156
  }
9607
10157
  };
9608
- __publicField(_MPlayer, "currentlyPlaying", new ValueSet2());
10158
+ __publicField(_MPlayer, "currentlyPlaying", new ValueSet());
9609
10159
  var MPlayer = _MPlayer;
9610
10160
  var MRenderContext2 = class {
9611
10161
  /**
@@ -9621,7 +10171,7 @@ var MRenderContext2 = class {
9621
10171
  * @returns - This render context instance.
9622
10172
  */
9623
10173
  setDocument(doc) {
9624
- assertArg3(Guard14.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
10174
+ assertArg3(guard_exports.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
9625
10175
  this.ctx.setDocument(doc);
9626
10176
  return this;
9627
10177
  }
@@ -9631,7 +10181,7 @@ var MRenderContext2 = class {
9631
10181
  * @returns - This render context instance.
9632
10182
  */
9633
10183
  setCanvas(canvas) {
9634
- canvas = require_t(Utils13.Dom.getCanvas(canvas), typeof canvas === "string" ? "Cannot set render canvas because invalid canvas id: " + canvas : "Cannot set render canvas because given canvas is undefined.");
10184
+ canvas = require_t(utils_exports.Dom.getCanvas(canvas), typeof canvas === "string" ? "Cannot set render canvas because invalid canvas id: " + canvas : "Cannot set render canvas because given canvas is undefined.");
9635
10185
  this.ctx.setCanvas(canvas);
9636
10186
  return this;
9637
10187
  }
@@ -9640,7 +10190,7 @@ var MRenderContext2 = class {
9640
10190
  * @param scoreEventListener - Score event listener.
9641
10191
  */
9642
10192
  setScoreEventListener(scoreEventListener) {
9643
- assertArg3(Guard14.isFunctionOrUndefined(scoreEventListener), "scoreEventListener", scoreEventListener);
10193
+ assertArg3(guard_exports.isFunctionOrUndefined(scoreEventListener), "scoreEventListener", scoreEventListener);
9644
10194
  this.ctx.setScoreEventListener(scoreEventListener);
9645
10195
  }
9646
10196
  /**
@@ -9715,7 +10265,7 @@ var _MPlaybackButtons = class _MPlaybackButtons {
9715
10265
  * @returns
9716
10266
  */
9717
10267
  setDocument(doc) {
9718
- assertArg3(Guard14.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
10268
+ assertArg3(guard_exports.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
9719
10269
  this.onStop();
9720
10270
  if (doc) {
9721
10271
  this.player = new MPlayer(doc, (playState) => {
@@ -9759,9 +10309,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
9759
10309
  * @returns - This playback buttons class instance.
9760
10310
  */
9761
10311
  setPlayButton(btn, btnLabel) {
9762
- assertArg3(Guard14.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
10312
+ assertArg3(guard_exports.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
9763
10313
  _MPlaybackButtons.removeOnClickListeners(this.playButton, this.onPlay);
9764
- this.playButton = require_t(Utils13.Dom.getButton(btn), "Play button required!");
10314
+ this.playButton = require_t(utils_exports.Dom.getButton(btn), "Play button required!");
9765
10315
  this.playLabel = btnLabel != null ? btnLabel : "Play";
9766
10316
  _MPlaybackButtons.removeOnClickListeners(this.playButton, "all");
9767
10317
  _MPlaybackButtons.addOnClickListener(this.playButton, this.onPlay);
@@ -9775,9 +10325,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
9775
10325
  * @returns - This playback buttons class instance.
9776
10326
  */
9777
10327
  setStopButton(btn, btnLabel) {
9778
- assertArg3(Guard14.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
10328
+ assertArg3(guard_exports.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
9779
10329
  _MPlaybackButtons.removeOnClickListeners(this.stopButton, this.onStop);
9780
- this.stopButton = require_t(Utils13.Dom.getButton(btn), "Stop button required!");
10330
+ this.stopButton = require_t(utils_exports.Dom.getButton(btn), "Stop button required!");
9781
10331
  this.stopLabel = btnLabel != null ? btnLabel : "Stop";
9782
10332
  _MPlaybackButtons.removeOnClickListeners(this.stopButton, "all");
9783
10333
  _MPlaybackButtons.addOnClickListener(this.stopButton, this.onStop);
@@ -9792,10 +10342,10 @@ var _MPlaybackButtons = class _MPlaybackButtons {
9792
10342
  * @returns - This playback buttons class instance.
9793
10343
  */
9794
10344
  setPlayStopButton(btn, playLabel, stopLabel) {
9795
- assertArg3(Guard14.isStringOrUndefined(playLabel), "playLabel", playLabel);
9796
- assertArg3(Guard14.isStringOrUndefined(stopLabel), "stopLabel", stopLabel);
10345
+ assertArg3(guard_exports.isStringOrUndefined(playLabel), "playLabel", playLabel);
10346
+ assertArg3(guard_exports.isStringOrUndefined(stopLabel), "stopLabel", stopLabel);
9797
10347
  _MPlaybackButtons.removeOnClickListeners(this.playStopButton, this.onPlayStop);
9798
- this.playStopButton = require_t(Utils13.Dom.getButton(btn), "Play/stop button required!");
10348
+ this.playStopButton = require_t(utils_exports.Dom.getButton(btn), "Play/stop button required!");
9799
10349
  this.playLabel = playLabel != null ? playLabel : "Play";
9800
10350
  this.stopLabel = stopLabel != null ? stopLabel : "Stop";
9801
10351
  _MPlaybackButtons.removeOnClickListeners(this.playStopButton, "all");
@@ -9810,9 +10360,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
9810
10360
  * @returns - This playback buttons class instance.
9811
10361
  */
9812
10362
  setPauseButton(btn, btnLabel) {
9813
- assertArg3(Guard14.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
10363
+ assertArg3(guard_exports.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
9814
10364
  _MPlaybackButtons.removeOnClickListeners(this.pauseButton, this.onPause);
9815
- this.pauseButton = require_t(Utils13.Dom.getButton(btn), "Pause button required!");
10365
+ this.pauseButton = require_t(utils_exports.Dom.getButton(btn), "Pause button required!");
9816
10366
  this.pauseLabel = btnLabel != null ? btnLabel : "Pause";
9817
10367
  _MPlaybackButtons.removeOnClickListeners(this.pauseButton, "all");
9818
10368
  _MPlaybackButtons.addOnClickListener(this.pauseButton, this.onPause);
@@ -9833,12 +10383,12 @@ var _MPlaybackButtons = class _MPlaybackButtons {
9833
10383
  this.savedOnClickListeners.set(btn, curListeners);
9834
10384
  }
9835
10385
  static addOnClickListener(btn, onClickListener) {
9836
- assertArg3(Guard14.isFunction(onClickListener), "onClick", onClickListener);
10386
+ assertArg3(guard_exports.isFunction(onClickListener), "onClick", onClickListener);
9837
10387
  btn.addEventListener("click", onClickListener);
9838
10388
  this.savedOnClickListeners.getOrCreate(btn, []).push(onClickListener);
9839
10389
  }
9840
10390
  };
9841
- __publicField(_MPlaybackButtons, "savedOnClickListeners", new UniMap10());
10391
+ __publicField(_MPlaybackButtons, "savedOnClickListeners", new UniMap());
9842
10392
  var MPlaybackButtons = _MPlaybackButtons;
9843
10393
 
9844
10394
  // src/score/index.ts
@@ -9909,6 +10459,7 @@ export {
9909
10459
  isStringNumber,
9910
10460
  isVerseNumber,
9911
10461
  isVoiceId,
10462
+ setColor,
9912
10463
  validateStringNumber,
9913
10464
  validateVerseNumber,
9914
10465
  validateVoiceId