deciphony-renderer 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/assets/assets/msSymbols/1.svg +7 -0
  2. package/dist/assets/assets/msSymbols/2.svg +7 -0
  3. package/dist/assets/assets/msSymbols/3.svg +7 -0
  4. package/dist/assets/assets/msSymbols/4.svg +7 -0
  5. package/dist/assets/assets/msSymbols/5.svg +7 -0
  6. package/dist/assets/assets/msSymbols/6.svg +7 -0
  7. package/dist/assets/assets/msSymbols/7.svg +7 -0
  8. package/dist/assets/assets/msSymbols/altoClef.svg +20 -0
  9. package/dist/assets/assets/msSymbols/bar-numberNotation.svg +5 -0
  10. package/dist/assets/assets/msSymbols/bar-standardStaff.svg +7 -0
  11. package/dist/assets/assets/msSymbols/barlineEndRepeatSign.svg +12 -0
  12. package/dist/assets/assets/msSymbols/barlineFinal.svg +10 -0
  13. package/dist/assets/assets/msSymbols/barlineReverseFinal.svg +10 -0
  14. package/dist/assets/assets/msSymbols/barlineSingle.svg +3 -0
  15. package/dist/assets/assets/msSymbols/barlineStartRepeatSign.svg +10 -0
  16. package/dist/assets/assets/msSymbols/bassClef.svg +46 -0
  17. package/dist/assets/assets/msSymbols/chronaxieIncreasingLine.svg +3 -0
  18. package/dist/assets/assets/msSymbols/chronaxieReducingLine1.svg +3 -0
  19. package/dist/assets/assets/msSymbols/chronaxieReducingLine2.svg +4 -0
  20. package/dist/assets/assets/msSymbols/chronaxieReducingLine3.svg +5 -0
  21. package/dist/assets/assets/msSymbols/chronaxieReducingLine4.svg +6 -0
  22. package/dist/assets/assets/msSymbols/defaultSymbol.svg +0 -0
  23. package/dist/assets/assets/msSymbols/flat.svg +11 -0
  24. package/dist/assets/assets/msSymbols/nature.svg +10 -0
  25. package/dist/assets/assets/msSymbols/noteDot1.svg +3 -0
  26. package/dist/assets/assets/msSymbols/noteDot2.svg +4 -0
  27. package/dist/assets/assets/msSymbols/noteDot3.svg +5 -0
  28. package/dist/assets/assets/msSymbols/noteDot4.svg +6 -0
  29. package/dist/assets/assets/msSymbols/noteHeadHalf.svg +14 -0
  30. package/dist/assets/assets/msSymbols/noteHeadQuarter.svg +14 -0
  31. package/dist/assets/assets/msSymbols/noteHeadWhole.svg +12 -0
  32. package/dist/assets/assets/msSymbols/noteStem.svg +5 -0
  33. package/dist/assets/assets/msSymbols/noteTailOneDown.svg +13 -0
  34. package/dist/assets/assets/msSymbols/noteTailOneUp.svg +10 -0
  35. package/dist/assets/assets/msSymbols/noteTailTwoDown.svg +14 -0
  36. package/dist/assets/assets/msSymbols/noteTailTwoUp.svg +14 -0
  37. package/dist/assets/assets/msSymbols/readne.md +5 -0
  38. package/dist/assets/assets/msSymbols/restEighth.svg +40 -0
  39. package/dist/assets/assets/msSymbols/restHalf.svg +36 -0
  40. package/dist/assets/assets/msSymbols/restQuarter.svg +38 -0
  41. package/dist/assets/assets/msSymbols/restSixteenth.svg +46 -0
  42. package/dist/assets/assets/msSymbols/restSixtyFourth.svg +45 -0
  43. package/dist/assets/assets/msSymbols/restThirtySecond.svg +45 -0
  44. package/dist/assets/assets/msSymbols/restWhole.svg +8 -0
  45. package/dist/assets/assets/msSymbols/sharp.svg +10 -0
  46. package/dist/assets/assets/msSymbols/trebleClef.svg +21 -0
  47. package/dist/common.d.ts +1 -0
  48. package/dist/components/clef.d.ts +22 -0
  49. package/dist/components/keySignature.d.ts +42 -0
  50. package/dist/components/measure.d.ts +91 -0
  51. package/dist/components/measureContainer.d.ts +74 -0
  52. package/dist/components/msSymbol.d.ts +152 -0
  53. package/dist/components/msSymbolContainer.d.ts +100 -0
  54. package/dist/components/msSymbolSlot.d.ts +293 -0
  55. package/dist/components/noteTail.d.ts +100 -0
  56. package/dist/components/rectDragShell.d.ts +29 -0
  57. package/dist/components/slur.d.ts +14 -0
  58. package/dist/components/spanSymbol.d.ts +48 -0
  59. package/dist/components/timeSignature.d.ts +24 -0
  60. package/dist/components/virtualSymbolContainer.d.ts +96 -0
  61. package/dist/components/volta.d.ts +14 -0
  62. package/dist/constant.d.ts +4 -0
  63. package/dist/deciphony-renderer.css +1 -0
  64. package/dist/index.cjs.js +6 -0
  65. package/dist/index.d.ts +12 -0
  66. package/dist/index.es.js +3927 -0
  67. package/dist/musicScore.d.ts +76 -0
  68. package/dist/types.d.ts +80 -0
  69. package/dist/utils/bottomUtil.d.ts +11 -0
  70. package/dist/utils/eventUtil.d.ts +33 -0
  71. package/dist/utils/geometryUtil.d.ts +10 -0
  72. package/dist/utils/heightUtil.d.ts +3 -0
  73. package/dist/utils/leftUtil.d.ts +7 -0
  74. package/dist/utils/widthConstantUtil.d.ts +5 -0
  75. package/dist/utils/widthUtil.d.ts +9 -0
  76. package/package.json +43 -0
@@ -0,0 +1,3927 @@
1
+ import { defineComponent as X, computed as S, createElementBlock as D, openBlock as x, withModifiers as $, normalizeStyle as F, createElementVNode as ue, Fragment as E, renderList as se, renderSlot as _e, createCommentVNode as Ce, unref as Z, toDisplayString as Rt, watch as An, ref as ie, onMounted as St, withDirectives as De, createBlock as J, vShow as Ne, inject as en, onBeforeMount as tn, withCtx as qe, createVNode as Re, mergeProps as jt, onUnmounted as kn, provide as Ln } from "vue";
2
+ const Dn = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='500'%20height='80'%3e%3cline%20x1='0'%20y1='0'%20x2='500'%20y2='000'%20stroke='black'%20stroke-width='1'%3e%3c/line%3e%3cline%20x1='0'%20y1='20'%20x2='500'%20y2='20'%20stroke='black'%20stroke-width='1'%3e%3c/line%3e%3cline%20x1='0'%20y1='40'%20x2='500'%20y2='40'%20stroke='black'%20stroke-width='1'%3e%3c/line%3e%3cline%20x1='0'%20y1='60'%20x2='500'%20y2='60'%20stroke='black'%20stroke-width='1'%3e%3c/line%3e%3cline%20x1='0'%20y1='80'%20x2='500'%20y2='80'%20stroke='black'%20stroke-width='1'%3e%3c/line%3e%3c/svg%3e", Nn = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='500'%20height='80'%3e%3cline%20x1='0'%20y1='0'%20x2='500'%20y2='000'%20stroke='white'%20stroke-width='1'%3e%3c/line%3e%3cline%20x1='0'%20y1='80'%20x2='500'%20y2='80'%20stroke='white'%20stroke-width='1'%3e%3c/line%3e%3c/svg%3e";
3
+ var ge = /* @__PURE__ */ ((e) => (e[e.MultipStaves = 1] = "MultipStaves", e[e.SingleStaff = 2] = "SingleStaff", e[e.Measure = 3] = "Measure", e[e.SpanSymbol = 4] = "SpanSymbol", e[e.MsSymbolContainer = 5] = "MsSymbolContainer", e[e.MsSymbol = 6] = "MsSymbol", e))(ge || {}), nn = /* @__PURE__ */ ((e) => (e.Line = "line", e.Space = "space", e))(nn || {}), rn = /* @__PURE__ */ ((e) => (e.Lower = "lower", e.Main = "main", e.Upper = "upper", e))(rn || {}), Y = /* @__PURE__ */ ((e) => (e[e.Treble = 1] = "Treble", e[e.MezzoSoprano = 2] = "MezzoSoprano", e[e.Alto = 3] = "Alto", e[e.Tenor = 4] = "Tenor", e[e.BaritoneF = 5] = "BaritoneF", e[e.BaritoneC = 6] = "BaritoneC", e[e.Bass = 7] = "Bass", e[e.Subbass = 8] = "Subbass", e))(Y || {}), on = /* @__PURE__ */ ((e) => (e.Cb = "Cb", e.Gb = "Gb", e.Db = "Db", e.Ab = "Ab", e.Eb = "Eb", e.Bb = "Bb", e.F = "F", e.C = "C", e.G = "G", e.D = "D", e.A = "A", e.E = "E", e.B = "B", e["F#"] = "F#", e["C#"] = "C#", e))(on || {}), Se = /* @__PURE__ */ ((e) => (e[e.DO = 1] = "DO", e[e.RE = 2] = "RE", e[e.MI = 3] = "MI", e[e.FA = 4] = "FA", e[e.SOL = 5] = "SOL", e[e.LA = 6] = "LA", e[e.TI = 7] = "TI", e))(Se || {}), He = /* @__PURE__ */ ((e) => (e.None = "", e.Natural = "&", e.Sharp = "#", e.Flat = "b", e.DoubleSharp = "##", e.DoubleFlat = "bb", e))(He || {}), R = /* @__PURE__ */ ((e) => (e[e.whole = 1] = "whole", e[e.half = 2] = "half", e[e.quarter = 4] = "quarter", e[e.eighth = 8] = "eighth", e[e.sixteenth = 16] = "sixteenth", e[e.thirtySecond = 32] = "thirtySecond", e[e.sixtyFourth = 64] = "sixtyFourth", e))(R || {}), b = /* @__PURE__ */ ((e) => (e.NoteHead = "noteHead", e.NoteStem = "noteStem", e.NoteTail = "noteTail", e.NoteNumber = "noteNumber", e.ChronaxieReducingLine = "chronaxieReducingLine", e.ChronaxieIncreasingLine = "chronaxieIncreasingLine", e.NoteDot = "noteDot", e.Rest = "rest", e.Slur = "slur", e.Tie = "tie", e.DurationDot = "durationDot", e.Accidental = "accidental", e.Tuplet = "tuplet", e.Clef = "clef", e.Clef_f = "clef_f", e.KeySignature = "keySignature", e.TimeSignature = "timeSignature", e.BarLine = "barLine", e.BarLine_f = "barLine_f", e))(b || {}), ce = /* @__PURE__ */ ((e) => (e[e.standardStaff = 1] = "standardStaff", e[e.numberNotation = 2] = "numberNotation", e[e.rhythmNotation = 3] = "rhythmNotation", e[e.percussion = 4] = "percussion", e))(ce || {}), Pe = /* @__PURE__ */ ((e) => (e[e.volta = 1] = "volta", e[e.slur = 2] = "slur", e[e.tie = 3] = "tie", e))(Pe || {}), Ee = /* @__PURE__ */ ((e) => (e[e.frontFixed = 1] = "frontFixed", e[e.rearFixed = 2] = "rearFixed", e[e.variable = 3] = "variable", e[e.span = 4] = "span", e))(Ee || {}), oe = /* @__PURE__ */ ((e) => (e[e.single = 1] = "single", e[e.final = 2] = "final", e[e.reverseFinal = 3] = "reverseFinal", e[e.startRepeatSign = 4] = "startRepeatSign", e[e.endRepeatSign = 5] = "endRepeatSign", e))(oe || {}), he = /* @__PURE__ */ ((e) => (e[e.normal = 1] = "normal", e[e.edit = 2] = "edit", e))(he || {}), xe = /* @__PURE__ */ ((e) => (e[e.note = 1] = "note", e[e.rest = 2] = "rest", e))(xe || {});
4
+ const Hn = /* @__PURE__ */ X({
5
+ __name: "measure",
6
+ props: {
7
+ measure: {
8
+ type: Object,
9
+ required: !0
10
+ },
11
+ x: {
12
+ type: Number,
13
+ default: 0
14
+ },
15
+ y: {
16
+ type: Number,
17
+ default: 0
18
+ },
19
+ width: {
20
+ type: Number,
21
+ default: 400
22
+ },
23
+ height: {
24
+ type: Number,
25
+ default: 80
26
+ },
27
+ componentWidth: {
28
+ type: Number,
29
+ default: 1e3
30
+ },
31
+ componentHeight: {
32
+ type: Number,
33
+ default: 800
34
+ },
35
+ strokeWidth: {
36
+ type: Number,
37
+ default: 1
38
+ },
39
+ musicScore: {
40
+ type: Object,
41
+ default: {}
42
+ }
43
+ },
44
+ emits: ["measureMouseDown"],
45
+ setup(e, { emit: t }) {
46
+ const n = e, r = S(() => ({
47
+ width: "100%",
48
+ display: "grid",
49
+ "grid-template-rows": "1fr",
50
+ "grid-template-columns": "1fr"
51
+ })), o = S(() => {
52
+ const u = {
53
+ width: n.width + "px",
54
+ height: n.height + "px",
55
+ "background-color": "black",
56
+ // mask:`url("${barLine}") no-repeat center`,
57
+ // 'mask-size': '100% 100%',
58
+ background: n.measure.options.highlight ? n.measure.options.highlightColor : n.measure.options.color,
59
+ pointerEvents: "none"
60
+ };
61
+ switch (n.musicScore.showMode) {
62
+ case ce.standardStaff: {
63
+ u.mask = `url("${Dn}") no-repeat center`, u["mask-size"] = "100% 100%";
64
+ break;
65
+ }
66
+ case ce.numberNotation: {
67
+ u.mask = `url("${Nn}") no-repeat center`, u["mask-size"] = "100% 100%";
68
+ break;
69
+ }
70
+ }
71
+ return u;
72
+ }), i = t;
73
+ function s(u) {
74
+ i("measureMouseDown", u, n.measure);
75
+ }
76
+ return (u, c) => (x(), D("div", {
77
+ class: "measure",
78
+ style: F(r.value),
79
+ onMousedown: $(s, ["self"])
80
+ }, [
81
+ ue("div", {
82
+ style: F(o.value)
83
+ }, null, 4)
84
+ ], 36));
85
+ }
86
+ }), ne = (e, t) => {
87
+ const n = e.__vccOpts || e;
88
+ for (const [r, o] of t)
89
+ n[r] = o;
90
+ return n;
91
+ }, Rn = /* @__PURE__ */ ne(Hn, [["__scopeId", "data-v-45ed8482"]]);
92
+ var we;
93
+ (function(e) {
94
+ e[e.MultipStaves = 1] = "MultipStaves", e[e.SingleStaff = 2] = "SingleStaff", e[e.Measure = 3] = "Measure", e[e.SpanSymbol = 4] = "SpanSymbol", e[e.MsSymbolContainer = 5] = "MsSymbolContainer", e[e.MsSymbol = 6] = "MsSymbol";
95
+ })(we || (we = {}));
96
+ var G;
97
+ (function(e) {
98
+ e.Line = "line", e.Space = "space";
99
+ })(G || (G = {}));
100
+ var C;
101
+ (function(e) {
102
+ e.Lower = "lower", e.Main = "main", e.Upper = "upper";
103
+ })(C || (C = {}));
104
+ var H;
105
+ (function(e) {
106
+ e[e.Treble = 1] = "Treble", e[e.MezzoSoprano = 2] = "MezzoSoprano", e[e.Alto = 3] = "Alto", e[e.Tenor = 4] = "Tenor", e[e.BaritoneF = 5] = "BaritoneF", e[e.BaritoneC = 6] = "BaritoneC", e[e.Bass = 7] = "Bass", e[e.Subbass = 8] = "Subbass";
107
+ })(H || (H = {}));
108
+ var p;
109
+ (function(e) {
110
+ e.Cb = "Cb", e.Gb = "Gb", e.Db = "Db", e.Ab = "Ab", e.Eb = "Eb", e.Bb = "Bb", e.F = "F", e.C = "C", e.G = "G", e.D = "D", e.A = "A", e.E = "E", e.B = "B", e["F#"] = "F#", e["C#"] = "C#";
111
+ })(p || (p = {}));
112
+ var L;
113
+ (function(e) {
114
+ e[e.DO = 1] = "DO", e[e.RE = 2] = "RE", e[e.MI = 3] = "MI", e[e.FA = 4] = "FA", e[e.SOL = 5] = "SOL", e[e.LA = 6] = "LA", e[e.TI = 7] = "TI";
115
+ })(L || (L = {}));
116
+ var z;
117
+ (function(e) {
118
+ e.C = "C", e.D = "D", e.E = "E", e.F = "F", e.G = "G", e.A = "A", e.B = "B";
119
+ })(z || (z = {}));
120
+ var m;
121
+ (function(e) {
122
+ e.None = "", e.Natural = "&", e.Sharp = "#", e.Flat = "b", e.DoubleSharp = "##", e.DoubleFlat = "bb";
123
+ })(m || (m = {}));
124
+ var Bt;
125
+ (function(e) {
126
+ e.None = "", e.Single = ".", e.Double = "..", e.Triple = "...";
127
+ })(Bt || (Bt = {}));
128
+ var w;
129
+ (function(e) {
130
+ e[e.whole = 1] = "whole", e[e.half = 2] = "half", e[e.quarter = 4] = "quarter", e[e.eighth = 8] = "eighth", e[e.sixteenth = 16] = "sixteenth", e[e.thirtySecond = 32] = "thirtySecond", e[e.sixtyFourth = 64] = "sixtyFourth";
131
+ })(w || (w = {}));
132
+ var f;
133
+ (function(e) {
134
+ e.NoteHead = "noteHead", e.NoteStem = "noteStem", e.NoteTail = "noteTail", e.NoteNumber = "noteNumber", e.ChronaxieReducingLine = "chronaxieReducingLine", e.ChronaxieIncreasingLine = "chronaxieIncreasingLine", e.NoteDot = "noteDot", e.Rest = "rest", e.Slur = "slur", e.Tie = "tie", e.DurationDot = "durationDot", e.Accidental = "accidental", e.Tuplet = "tuplet", e.Clef = "clef", e.Clef_f = "clef_f", e.KeySignature = "keySignature", e.TimeSignature = "timeSignature", e.BarLine = "barLine", e.BarLine_f = "barLine_f";
135
+ })(f || (f = {}));
136
+ var Ve;
137
+ (function(e) {
138
+ e[e.standardStaff = 1] = "standardStaff", e[e.numberNotation = 2] = "numberNotation", e[e.rhythmNotation = 3] = "rhythmNotation", e[e.percussion = 4] = "percussion";
139
+ })(Ve || (Ve = {}));
140
+ var P;
141
+ (function(e) {
142
+ e[e.singleMeasure = 1] = "singleMeasure", e[e.multipleMeasure = 2] = "multipleMeasure";
143
+ })(P || (P = {}));
144
+ var Wt;
145
+ (function(e) {
146
+ e[e.volta = 1] = "volta", e[e.slur = 2] = "slur", e[e.tie = 3] = "tie";
147
+ })(Wt || (Wt = {}));
148
+ var Ft;
149
+ (function(e) {
150
+ e[e.msSymbol = 1] = "msSymbol", e[e.measure = 2] = "measure", e[e.singleStaff = 3] = "singleStaff", e[e.multipleStaves = 4] = "multipleStaves";
151
+ })(Ft || (Ft = {}));
152
+ var q;
153
+ (function(e) {
154
+ e[e.frontFixed = 1] = "frontFixed", e[e.rearFixed = 2] = "rearFixed", e[e.variable = 3] = "variable", e[e.span = 4] = "span";
155
+ })(q || (q = {}));
156
+ var U;
157
+ (function(e) {
158
+ e[e.single = 1] = "single", e[e.final = 2] = "final", e[e.reverseFinal = 3] = "reverseFinal", e[e.startRepeatSign = 4] = "startRepeatSign", e[e.endRepeatSign = 5] = "endRepeatSign";
159
+ })(U || (U = {}));
160
+ var Tt;
161
+ (function(e) {
162
+ e[e.highlight = 1] = "highlight";
163
+ })(Tt || (Tt = {}));
164
+ var Ot;
165
+ (function(e) {
166
+ e[e.normal = 1] = "normal", e[e.edit = 2] = "edit";
167
+ })(Ot || (Ot = {}));
168
+ var Gt;
169
+ (function(e) {
170
+ e[e.note = 1] = "note", e[e.rest = 2] = "rest";
171
+ })(Gt || (Gt = {}));
172
+ var ut;
173
+ (function(e) {
174
+ e[e.left = 1] = "left";
175
+ })(ut || (ut = {}));
176
+ function jn(e) {
177
+ return e >= w.eighth;
178
+ }
179
+ function Bn(e) {
180
+ return e !== w.whole;
181
+ }
182
+ function an(e, t) {
183
+ let n = m.None;
184
+ if (!e.msSymbolArray)
185
+ return {
186
+ accidental: n,
187
+ measureAccidental: m.None
188
+ };
189
+ const r = O(e.index, t), o = r.msSymbolContainer, i = r.measure, s = r.singleStaff, u = i == null ? void 0 : i.index.measureIndex, c = o == null ? void 0 : o.index.msSymbolContainerIndex;
190
+ if (!o || !i || !s || c == null || u == null)
191
+ return console.error("索引数据查找出错,获取符号的谱号失败"), {
192
+ accidental: n,
193
+ measureAccidental: m.None
194
+ };
195
+ let l = m.None;
196
+ for (let a = u; a >= 0; a--) {
197
+ const g = s.measureArray[a];
198
+ if (a === u)
199
+ for (let d = c; d >= 0; d--) {
200
+ const y = g.msSymbolContainerArray[d].msSymbolArray[0];
201
+ if (f.Accidental === y.type) {
202
+ l = y.accidental;
203
+ break;
204
+ }
205
+ }
206
+ else
207
+ for (let d = g.msSymbolContainerArray.length - 1; d >= 0; d--) {
208
+ const y = g.msSymbolContainerArray[d].msSymbolArray[0];
209
+ if (f.Accidental === y.type) {
210
+ l = y.accidental;
211
+ break;
212
+ }
213
+ }
214
+ }
215
+ for (let a of e.msSymbolArray)
216
+ if (a.type === f.Accidental)
217
+ return n = a.accidental, { accidental: n, measureAccidental: l };
218
+ return { accidental: n, measureAccidental: l };
219
+ }
220
+ function sn(e, t) {
221
+ const n = O(e.index, t), r = n.msSymbolContainer, o = n.measure, i = n.singleStaff, s = o == null ? void 0 : o.index.measureIndex, u = r == null ? void 0 : r.index.msSymbolContainerIndex;
222
+ if (!r || !o || !i || u == null || s == null)
223
+ return console.error("索引数据查找出错,获取符号的谱号失败"), p.C;
224
+ for (let c = s; c >= 0; c--) {
225
+ const l = i.measureArray[c];
226
+ if (c === s)
227
+ for (let a = u; a >= 0; a--) {
228
+ const d = l.msSymbolContainerArray[a].msSymbolArray[0];
229
+ if (f.KeySignature === d.type)
230
+ return d.keySignature;
231
+ }
232
+ else
233
+ for (let a = l.msSymbolContainerArray.length - 1; a >= 0; a--) {
234
+ const d = l.msSymbolContainerArray[a].msSymbolArray[0];
235
+ if (f.KeySignature === d.type)
236
+ return d.keySignature;
237
+ }
238
+ }
239
+ return p.C;
240
+ }
241
+ function vt(e, t) {
242
+ const n = O(e.index, t), r = n.msSymbolContainer, o = n.measure, i = n.singleStaff, s = o == null ? void 0 : o.index.measureIndex, u = r == null ? void 0 : r.index.msSymbolContainerIndex;
243
+ if (!r || !o || !i || u == null || s == null)
244
+ return console.error("索引数据查找出错,获取符号的谱号失败"), H.Treble;
245
+ for (let c = s; c >= 0; c--) {
246
+ const l = i.measureArray[c];
247
+ if (c === s)
248
+ for (let a = u; a >= 0; a--) {
249
+ const d = l.msSymbolContainerArray[a].msSymbolArray[0];
250
+ if (f.Clef === d.type || f.Clef_f === d.type)
251
+ return d.clef;
252
+ }
253
+ else
254
+ for (let a = l.msSymbolContainerArray.length - 1; a >= 0; a--) {
255
+ const d = l.msSymbolContainerArray[a].msSymbolArray[0];
256
+ if (f.Clef === d.type || f.Clef_f === d.type)
257
+ return d.clef;
258
+ }
259
+ }
260
+ return H.Treble;
261
+ }
262
+ function Wn(e, { level: t = "symbol", order: n = "asc", callback: r }) {
263
+ const o = (s) => n === "asc" ? [...Array(s).keys()] : [...Array(s).keys()].reverse(), i = e.multipleStavesArray;
264
+ for (const s of o(i.length)) {
265
+ const u = i[s];
266
+ if (t === "multipleStaves") {
267
+ if (r({
268
+ multipleStavesIndex: s,
269
+ singleStaffIndex: -1,
270
+ measureIndex: -1,
271
+ multipleStaves: u
272
+ }))
273
+ return;
274
+ continue;
275
+ }
276
+ for (const c of o(u.singleStaffArray.length)) {
277
+ const l = u.singleStaffArray[c];
278
+ if (t === "singleStaff") {
279
+ if (r({
280
+ multipleStavesIndex: s,
281
+ singleStaffIndex: c,
282
+ measureIndex: -1,
283
+ multipleStaves: u,
284
+ singleStaff: l
285
+ }))
286
+ return;
287
+ continue;
288
+ }
289
+ for (const a of o(l.measureArray.length)) {
290
+ const g = l.measureArray[a];
291
+ if (t === "measure") {
292
+ if (r({
293
+ multipleStavesIndex: s,
294
+ singleStaffIndex: c,
295
+ measureIndex: a,
296
+ multipleStaves: u,
297
+ singleStaff: l,
298
+ measure: g
299
+ }))
300
+ return;
301
+ continue;
302
+ }
303
+ for (const d of o(g.msSymbolContainerArray.length)) {
304
+ const h = g.msSymbolContainerArray[d];
305
+ if (t === "container") {
306
+ if (r({
307
+ multipleStavesIndex: s,
308
+ singleStaffIndex: c,
309
+ measureIndex: a,
310
+ msSymbolContainerIndex: d,
311
+ multipleStaves: u,
312
+ singleStaff: l,
313
+ measure: g,
314
+ msSymbolContainer: h
315
+ }))
316
+ return;
317
+ continue;
318
+ }
319
+ for (const y of o(h.msSymbolArray.length)) {
320
+ const v = h.msSymbolArray[y];
321
+ if (r({
322
+ multipleStavesIndex: s,
323
+ singleStaffIndex: c,
324
+ measureIndex: a,
325
+ msSymbolContainerIndex: d,
326
+ msSymbolIndex: y,
327
+ multipleStaves: u,
328
+ singleStaff: l,
329
+ measure: g,
330
+ msSymbolContainer: h,
331
+ msSymbol: v
332
+ }))
333
+ return;
334
+ }
335
+ }
336
+ }
337
+ }
338
+ }
339
+ }
340
+ function Fn(e, t, n, r) {
341
+ if (t.multipleStavesIndex == null || e.multipleStavesIndex == null || e.measureIndex == null || t.measureIndex == null || e.singleStaffIndex == null)
342
+ return console.error("索引元素有误,无法正确执行traverseMeasure");
343
+ const o = e.singleStaffIndex, i = O(e, n), s = O(t, n), u = i.singleStaff;
344
+ s.singleStaff;
345
+ const c = i.multipleStaves, l = s.multipleStaves;
346
+ if (c === l) {
347
+ if (u == null || c == null)
348
+ return console.error("索引元素有误,无法正确执行traverseMeasure");
349
+ for (let a = e.measureIndex; a <= t.measureIndex; a++) {
350
+ const g = u.measureArray[a];
351
+ r(g, u, c);
352
+ }
353
+ } else
354
+ for (let a = e.multipleStavesIndex; a <= t.multipleStavesIndex; a++) {
355
+ const g = n.multipleStavesArray[a], d = g.singleStaffArray[o];
356
+ if (c === g)
357
+ for (let h = e.measureIndex; h < d.measureArray.length; h++) {
358
+ const y = d.measureArray[h];
359
+ r(y, d, g);
360
+ }
361
+ else if (c !== g && l !== g)
362
+ for (let h = 0; h < d.measureArray.length; h++) {
363
+ const y = d.measureArray[h];
364
+ r(y, d, g);
365
+ }
366
+ else if (l === g && c !== l)
367
+ for (let h = 0; h < t.measureIndex; h++) {
368
+ const y = d.measureArray[h];
369
+ r(y, d, g);
370
+ }
371
+ }
372
+ }
373
+ function Tn(e) {
374
+ e.multipleStavesArray.forEach((t, n) => {
375
+ t.index = {
376
+ multipleStavesIndex: n,
377
+ singleStaffIndex: -1,
378
+ measureIndex: -1,
379
+ msSymbolContainerIndex: -1,
380
+ msSymbolIndex: -1
381
+ }, On(t);
382
+ });
383
+ }
384
+ function On(e) {
385
+ const t = e.index.multipleStavesIndex;
386
+ if (t == null)
387
+ return console.error("数据有误,复谱表索引生成失败");
388
+ e.singleStaffArray.forEach((n, r) => {
389
+ n.index = {
390
+ multipleStavesIndex: t,
391
+ singleStaffIndex: r,
392
+ measureIndex: -1,
393
+ msSymbolContainerIndex: -1,
394
+ msSymbolIndex: -1
395
+ }, ln(n);
396
+ });
397
+ }
398
+ function ln(e) {
399
+ const t = e.index.singleStaffIndex, n = e.index.multipleStavesIndex;
400
+ if (n == null || t == null)
401
+ return console.error("数据有误,单谱表索引生成失败");
402
+ e.measureArray.forEach((r, o) => {
403
+ r.index = {
404
+ multipleStavesIndex: n,
405
+ singleStaffIndex: t,
406
+ measureIndex: o,
407
+ msSymbolContainerIndex: -1,
408
+ msSymbolIndex: -1
409
+ }, et(r);
410
+ });
411
+ }
412
+ function et(e) {
413
+ const t = e.index.singleStaffIndex, n = e.index.multipleStavesIndex, r = e.index.measureIndex;
414
+ if (n == null || t == null || r == null)
415
+ return console.error("数据有误,符号容器索引生成失败");
416
+ e.msSymbolContainerArray.forEach((o, i) => {
417
+ o.index = {
418
+ multipleStavesIndex: n,
419
+ singleStaffIndex: t,
420
+ measureIndex: r,
421
+ msSymbolContainerIndex: i,
422
+ msSymbolIndex: -1
423
+ }, gt(o);
424
+ });
425
+ }
426
+ function gt(e) {
427
+ const t = e.index.singleStaffIndex, n = e.index.multipleStavesIndex, r = e.index.measureIndex, o = e.index.msSymbolContainerIndex;
428
+ if (n == null || t == null || r == null || o == null)
429
+ return console.error("数据有误,符号索引生成失败");
430
+ e.msSymbolArray.forEach((i, s) => {
431
+ const u = {
432
+ multipleStavesIndex: n,
433
+ singleStaffIndex: t,
434
+ measureIndex: r,
435
+ msSymbolContainerIndex: o,
436
+ msSymbolIndex: s
437
+ };
438
+ i.index = u, xt(i);
439
+ });
440
+ }
441
+ function xt(e, t) {
442
+ let n = null;
443
+ n = e, n.msSymbolArray.forEach((r, o) => {
444
+ r.index = n.index, r.msSymbolArray.length > 0 && xt(r);
445
+ });
446
+ }
447
+ function Gn(e) {
448
+ const t = e.map;
449
+ for (let n = 0; n < e.multipleStavesArray.length; n++) {
450
+ const r = e.multipleStavesArray[n];
451
+ t[r.id] = r;
452
+ for (let o = 0; o < r.singleStaffArray.length; o++) {
453
+ const i = r.singleStaffArray[o];
454
+ t[i.id] = i;
455
+ for (let s = 0; s < i.measureArray.length; s++) {
456
+ const u = i.measureArray[s];
457
+ t[u.id] = u;
458
+ for (let c = 0; c < u.msSymbolContainerArray.length; c++) {
459
+ const l = u.msSymbolContainerArray[c];
460
+ t[l.id] = l;
461
+ for (let a = 0; a < l.msSymbolArray.length; a++) {
462
+ const g = l.msSymbolArray[a];
463
+ t[g.id] = g;
464
+ }
465
+ }
466
+ }
467
+ }
468
+ }
469
+ }
470
+ function K(e) {
471
+ if (e.region === C.Main)
472
+ return (e.index - 1) * 2 + (e.type === G.Space ? 1 : 0);
473
+ if (e.region === C.Lower)
474
+ return -(e.index * 2) + (e.type === G.Space ? 1 : 0);
475
+ if (e.region === C.Upper)
476
+ return 8 + e.index * 2 + (e.type === G.Space ? 1 : 0);
477
+ throw new Error("Invalid StaffRegion");
478
+ }
479
+ function dt(e) {
480
+ if (e >= 0 && e <= 9) {
481
+ const t = e % 2 === 0 ? G.Line : G.Space, n = Math.floor(e / 2) + 1, r = Math.floor(e / 2) + 1;
482
+ return {
483
+ region: C.Main,
484
+ type: t,
485
+ index: t === G.Line ? n : r
486
+ };
487
+ }
488
+ if (e < 0) {
489
+ const t = Math.abs(e), n = t % 2 === 0 ? G.Line : G.Space, r = Math.floor((t + 1) / 2);
490
+ return {
491
+ region: C.Lower,
492
+ type: n,
493
+ index: r
494
+ };
495
+ }
496
+ if (e >= 10) {
497
+ const t = e - 10, n = t % 2 === 0 ? G.Line : G.Space, r = Math.floor(t / 2) + 1;
498
+ return {
499
+ region: C.Upper,
500
+ type: n,
501
+ index: r
502
+ };
503
+ }
504
+ throw new Error("Invalid index for StaffRegion");
505
+ }
506
+ function Pt(e) {
507
+ return typeof e == "number" ? e <= 3 ? "up" : "down" : K(e) <= 3 ? "up" : "down";
508
+ }
509
+ function Je(e, t) {
510
+ const n = t[e];
511
+ if (n)
512
+ return n;
513
+ console.warn("此id元素不存在");
514
+ }
515
+ function O(e, t) {
516
+ const n = {
517
+ multipleStaves: null,
518
+ singleStaff: null,
519
+ measure: null,
520
+ msSymbolContainer: null,
521
+ msSymbol: null
522
+ };
523
+ if (e.multipleStavesIndex !== -1) {
524
+ const r = t.multipleStavesArray[e.multipleStavesIndex];
525
+ if (n.multipleStaves = r, e.singleStaffIndex !== -1) {
526
+ const o = r.singleStaffArray[e.singleStaffIndex];
527
+ if (n.singleStaff = o, e.measureIndex !== -1) {
528
+ const i = o.measureArray[e.measureIndex];
529
+ if (n.measure = i, e.msSymbolContainerIndex !== -1) {
530
+ const s = i.msSymbolContainerArray[e.msSymbolContainerIndex];
531
+ n.msSymbolContainer = s, e.msSymbolIndex !== -1 && (n.msSymbol = s.msSymbolArray[e.msSymbolIndex]);
532
+ }
533
+ }
534
+ }
535
+ }
536
+ return n;
537
+ }
538
+ function Pn(e, t) {
539
+ const n = /* @__PURE__ */ new Set();
540
+ return e.bindingEndId.forEach((r) => {
541
+ n.add(r);
542
+ }), e.bindingStartId.forEach((r) => {
543
+ n.add(r);
544
+ }), e.msSymbolContainerArray.forEach((r, o) => {
545
+ r.msSymbolArray.forEach((i, s) => {
546
+ i.bindingEndId.forEach((u) => {
547
+ n.add(u);
548
+ }), i.bindingStartId.forEach((u) => {
549
+ n.add(u);
550
+ });
551
+ });
552
+ }), n;
553
+ }
554
+ function wt(e, t) {
555
+ let n = /* @__PURE__ */ new Set();
556
+ return e.measureArray.forEach((r) => {
557
+ const o = Pn(r);
558
+ n = /* @__PURE__ */ new Set([...n, ...o]);
559
+ }), n;
560
+ }
561
+ function It(e, t) {
562
+ t.spanSymbolArray.forEach((n) => {
563
+ e.has(n.id) && (n.vueKey = Date.now());
564
+ });
565
+ }
566
+ function Ze(e, t) {
567
+ const n = O(e.index, t).msSymbol;
568
+ return n || (console.error("获取主符号失败"), e);
569
+ }
570
+ function Qe(e, t) {
571
+ const n = [];
572
+ return e === -1 ? [] : (t.msSymbolContainerArray.forEach((r) => {
573
+ r.msSymbolArray.forEach((o) => {
574
+ if (o.type === f.NoteHead && o.beamId === e) {
575
+ const i = {
576
+ beamId: o.beamId,
577
+ note: o,
578
+ region: o.region,
579
+ chronaxie: o.chronaxie
580
+ };
581
+ n.push(i);
582
+ }
583
+ });
584
+ }), n);
585
+ }
586
+ function cn(e, t) {
587
+ e.id = t.id, e.bindingEndId = t.bindingEndId, e.bindingStartId = t.bindingStartId;
588
+ }
589
+ function V(e = {}) {
590
+ const t = {
591
+ id: Math.random() * Date.now() + 1,
592
+ msTypeName: we.MsSymbol,
593
+ index: {
594
+ multipleStavesIndex: -1,
595
+ singleStaffIndex: -1,
596
+ measureIndex: -1,
597
+ msSymbolContainerIndex: -1,
598
+ msSymbolIndex: -1
599
+ },
600
+ options: {
601
+ highlight: !1,
602
+ highlightColor: "red",
603
+ color: "black"
604
+ },
605
+ bindingStartId: [],
606
+ bindingEndId: [],
607
+ msSymbolArray: [],
608
+ vueKey: Math.random() * Date.now()
609
+ };
610
+ switch (e.type) {
611
+ case f.NoteHead: {
612
+ const n = e.region || {
613
+ region: C.Main,
614
+ type: G.Line,
615
+ index: 1
616
+ };
617
+ if (!e.chronaxie || ![w.whole].includes(e.chronaxie)) {
618
+ const r = V({
619
+ type: f.NoteStem,
620
+ direction: Pt(K(n))
621
+ });
622
+ t.msSymbolArray.push(r);
623
+ }
624
+ if (e.chronaxie && ![w.whole, w.half, w.quarter].includes(e.chronaxie)) {
625
+ const r = V({
626
+ type: f.NoteTail,
627
+ chronaxie: e.chronaxie || w.quarter,
628
+ direction: Pt(n)
629
+ });
630
+ t.msSymbolArray.push(r);
631
+ }
632
+ return {
633
+ ...t,
634
+ beamId: -1,
635
+ type: f.NoteHead,
636
+ region: n,
637
+ chronaxie: e.chronaxie || w.quarter
638
+ };
639
+ }
640
+ case f.NoteDot:
641
+ return {
642
+ ...t,
643
+ type: f.NoteDot,
644
+ octave: e.octave ?? 4
645
+ };
646
+ case f.NoteNumber: {
647
+ e.chronaxie && [w.whole, w.half].includes(e.chronaxie) && (console.error("noteNumber的时值最大为四分音符"), e.chronaxie = w.quarter);
648
+ const n = {
649
+ ...t,
650
+ type: f.NoteNumber,
651
+ solmization: e.solmization || L.DO,
652
+ chronaxie: e.chronaxie || w.quarter,
653
+ octave: e.octave ?? 4,
654
+ beamId: -1
655
+ };
656
+ if (e.chronaxie && ![w.quarter].includes(e.chronaxie)) {
657
+ const r = V({
658
+ type: f.ChronaxieReducingLine,
659
+ chronaxie: e.chronaxie
660
+ });
661
+ t.msSymbolArray.push(r);
662
+ }
663
+ return n;
664
+ }
665
+ case f.ChronaxieIncreasingLine:
666
+ return {
667
+ ...t,
668
+ type: f.ChronaxieIncreasingLine
669
+ };
670
+ case f.ChronaxieReducingLine:
671
+ return {
672
+ ...t,
673
+ type: f.ChronaxieReducingLine,
674
+ chronaxie: e.chronaxie ?? w.eighth
675
+ };
676
+ case f.Rest:
677
+ return {
678
+ ...t,
679
+ type: f.Rest,
680
+ chronaxie: e.chronaxie || w.quarter
681
+ };
682
+ case f.BarLine: {
683
+ const n = e.barLineType ?? U.single;
684
+ return U.endRepeatSign === n || U.startRepeatSign === n ? {
685
+ ...t,
686
+ type: f.BarLine,
687
+ barLineType: n,
688
+ loopCount: 2
689
+ } : {
690
+ ...t,
691
+ type: f.BarLine,
692
+ barLineType: n
693
+ };
694
+ }
695
+ case f.BarLine_f: {
696
+ const n = e.barLineType ?? U.single;
697
+ return U.endRepeatSign === n || U.startRepeatSign === n ? {
698
+ ...t,
699
+ type: f.BarLine_f,
700
+ barLineType: n,
701
+ loopCount: 2
702
+ } : {
703
+ ...t,
704
+ type: f.BarLine_f,
705
+ barLineType: n
706
+ };
707
+ }
708
+ case f.NoteStem:
709
+ return {
710
+ ...t,
711
+ direction: e.direction || "up",
712
+ type: f.NoteStem
713
+ };
714
+ case f.NoteTail:
715
+ return {
716
+ ...t,
717
+ type: f.NoteTail,
718
+ chronaxie: e.chronaxie || w.quarter,
719
+ beamType: ut.left,
720
+ direction: e.direction || "up"
721
+ };
722
+ case f.Clef_f:
723
+ return {
724
+ ...t,
725
+ type: f.Clef_f,
726
+ clef: e.clef || H.Treble
727
+ };
728
+ case f.Clef:
729
+ return {
730
+ ...t,
731
+ type: f.Clef,
732
+ clef: e.clef || H.Treble
733
+ };
734
+ case f.KeySignature:
735
+ return {
736
+ ...t,
737
+ type: f.KeySignature,
738
+ keySignature: e.keySignature || p.C
739
+ };
740
+ case f.TimeSignature:
741
+ return {
742
+ ...t,
743
+ type: f.TimeSignature,
744
+ timeSignature: e.timeSignature || {
745
+ beat: 1,
746
+ chronaxie: 4
747
+ }
748
+ };
749
+ case f.Accidental:
750
+ return {
751
+ ...t,
752
+ type: f.Accidental,
753
+ accidental: e.accidental || m.Sharp
754
+ };
755
+ default:
756
+ return console.error("type不被识别,符号模版返回noteHead"), {
757
+ ...t,
758
+ type: f.NoteHead,
759
+ region: e.region || {
760
+ region: C.Main,
761
+ type: G.Line,
762
+ index: 1
763
+ },
764
+ chronaxie: e.chronaxie || w.quarter,
765
+ beamId: -1
766
+ };
767
+ }
768
+ }
769
+ function tt(e = {}) {
770
+ return {
771
+ id: Math.random() * Date.now() + 2,
772
+ msSymbolArray: [],
773
+ type: e.type || q.variable,
774
+ index: {
775
+ multipleStavesIndex: -1,
776
+ singleStaffIndex: -1,
777
+ measureIndex: -1,
778
+ msSymbolContainerIndex: -1,
779
+ msSymbolIndex: -1
780
+ },
781
+ bindingStartId: [],
782
+ bindingEndId: [],
783
+ options: {
784
+ highlight: !1,
785
+ highlightColor: "red",
786
+ color: "black"
787
+ },
788
+ vueKey: Math.random() * Date.now(),
789
+ msTypeName: we.MsSymbolContainer
790
+ };
791
+ }
792
+ function Mt(e, t) {
793
+ t.map[e.id] = e;
794
+ }
795
+ function Ct(e, t) {
796
+ t.map[e] && delete t.map[e];
797
+ }
798
+ function je(e, t, n) {
799
+ t.msSymbolArray.push(e), xt(t), Mt(e, n);
800
+ }
801
+ function Be(e, t, n, r = "after") {
802
+ if (t.msTypeName === we.MsSymbol) {
803
+ if (typeof r == "number") {
804
+ console.error("以符号为定位元素添加符号时,position只可以传after或before");
805
+ return;
806
+ }
807
+ const s = O(t.index, n).msSymbolContainer, u = O(t.index, n).msSymbol;
808
+ if (!s)
809
+ return console.error("符号容器不存在,符号添加失败");
810
+ if (!u)
811
+ return console.error("符号不存在,符号添加失败");
812
+ const c = s.msSymbolArray, l = c.findIndex((a) => a === u);
813
+ r === "before" ? c.splice(l, 0, e) : c.splice(l + 1, 0, e), gt(s);
814
+ } else if (t.msTypeName === we.MsSymbolContainer) {
815
+ const s = t;
816
+ if (!s)
817
+ return console.error("小节不存在,符号容器添加失败");
818
+ const u = s.msSymbolArray;
819
+ if (r === -1 || typeof r == "string")
820
+ u.push(e);
821
+ else if (r >= 0 && r <= u.length)
822
+ u.splice(r, 0, e);
823
+ else {
824
+ console.error("索引有误,符号添加失败");
825
+ return;
826
+ }
827
+ gt(s);
828
+ }
829
+ if (Mt(e, n), !("index" in t))
830
+ return console.error("当前选中对象缺少index,符号添加失败");
831
+ const o = O(t.index, n).singleStaff;
832
+ if (!o)
833
+ return console.error("单谱表查找出错,符号添加失败");
834
+ ln(o);
835
+ const i = wt(o);
836
+ It(i, n);
837
+ }
838
+ function ve(e, t, n, r = "after") {
839
+ if (t.msTypeName === we.MsSymbolContainer) {
840
+ if (typeof r == "number") {
841
+ console.error("以符号容器为定位元素添加符号容器时,position只可以传after或before");
842
+ return;
843
+ }
844
+ const o = O(t.index, n).measure, i = O(t.index, n).msSymbolContainer;
845
+ if (!o)
846
+ return console.error("小节不存在,符号容器添加失败");
847
+ if (!i)
848
+ return console.error("符号容器不存在,符号容器添加失败");
849
+ const s = o.msSymbolContainerArray, u = s.findIndex((c) => c === i);
850
+ r === "before" ? s.splice(u, 0, e) : s.splice(u + 1, 0, e), et(o);
851
+ } else if (t.msTypeName === we.Measure) {
852
+ const o = t;
853
+ if (!o)
854
+ return console.error("小节不存在,符号容器添加失败");
855
+ const i = o.msSymbolContainerArray;
856
+ if (r === -1 || typeof r == "string")
857
+ i.push(e);
858
+ else if (r >= 0 && r <= i.length)
859
+ i.splice(r, 0, e);
860
+ else {
861
+ console.error("索引有误,符号容器添加失败");
862
+ return;
863
+ }
864
+ et(o);
865
+ }
866
+ Mt(e, n);
867
+ }
868
+ function zn(e, t) {
869
+ const n = O(e.index, t), r = n.measure, o = n.singleStaff;
870
+ if (!r || !o)
871
+ return console.error("索引数据出错,符号容器移除失败");
872
+ const i = r.msSymbolContainerArray, s = i.findIndex((c) => c === e);
873
+ if (s === -1)
874
+ return console.error("找不到目标符号容器");
875
+ i.splice(s, 1), Ct(e.id, t), et(r), Un(e, t);
876
+ const u = wt(o);
877
+ It(u, t);
878
+ }
879
+ function qn(e, t) {
880
+ for (let n = t.spanSymbolArray.length - 1; n >= 0; n--) {
881
+ const r = t.spanSymbolArray[n];
882
+ (e.bindingStartId.includes(r.id) || e.bindingEndId.includes(r.id)) && (un(r, t), Ct(r.id, t));
883
+ }
884
+ }
885
+ function Un(e, t) {
886
+ e.msSymbolArray.forEach((n) => {
887
+ qn(n, t);
888
+ });
889
+ for (let n = t.spanSymbolArray.length - 1; n >= 0; n--) {
890
+ const r = t.spanSymbolArray[n];
891
+ (e.bindingStartId.includes(r.id) || e.bindingEndId.includes(r.id)) && (un(r, t), Ct(r.id, t));
892
+ }
893
+ }
894
+ function un(e, t) {
895
+ const n = t.spanSymbolArray.indexOf(e), r = e.startTargetId, o = e.endTargetId;
896
+ t.spanSymbolArray.splice(n, 1);
897
+ const i = e.id, s = t.map[r];
898
+ s && "bindingStartId" in s && s.bindingStartId.indexOf(i) !== -1 && s.bindingStartId.splice(n, 1);
899
+ const u = t.map[o];
900
+ u && "bindingEndId" in u && u.bindingEndId.indexOf(i) !== -1 && u.bindingEndId.splice(n, 1);
901
+ }
902
+ function mt(e, t) {
903
+ t.direction = e, t.vueKey = Math.random() * Date.now();
904
+ }
905
+ function ft(e, t) {
906
+ t.direction = e, t.vueKey = Math.random() * Date.now();
907
+ }
908
+ function Vn(e, t, n) {
909
+ const r = [];
910
+ let o = "up", i = 4, s = !1;
911
+ for (const u in t.msSymbolContainerArray) {
912
+ const c = t.msSymbolContainerArray[u];
913
+ for (const l in c.msSymbolArray) {
914
+ const a = c.msSymbolArray[l];
915
+ if (a.type === f.NoteHead && ![w.whole, w.half, w.quarter].includes(a.chronaxie)) {
916
+ const g = Math.abs(K(a.region) - 4), d = Math.abs(i - 4);
917
+ g > d && (i = K(a.region));
918
+ const h = a.msSymbolArray.find((v) => v.type === f.NoteStem), y = a.msSymbolArray.find((v) => v.type === f.NoteTail);
919
+ y && h && a.beamId === e && (r.push({ noteStem: h, noteTail: y }), s = !0);
920
+ } else if (s)
921
+ break;
922
+ }
923
+ }
924
+ o = i >= 3 ? "down" : "up";
925
+ for (const u in r) {
926
+ const c = r[u].noteStem, l = r[u].noteTail;
927
+ mt(o, c), ft(o, l);
928
+ }
929
+ }
930
+ z.C, m.None, z.C, m.Sharp, z.D, m.None, z.D, m.Sharp, z.E, m.None, z.F, m.None, z.F, m.Sharp, z.G, m.None, z.G, m.Sharp, z.A, m.None, z.A, m.Sharp, z.B, m.None;
931
+ const $n = {
932
+ [p.Cb]: 59,
933
+ // Cb = B (比 C 小一半音)
934
+ [p.Gb]: 66,
935
+ // Gb = F#
936
+ [p.Db]: 61,
937
+ // Db = C#
938
+ [p.Ab]: 68,
939
+ // Ab = G#
940
+ [p.Eb]: 63,
941
+ // Eb = D#
942
+ [p.Bb]: 70,
943
+ // Bb = A#
944
+ [p.F]: 65,
945
+ // F
946
+ [p.C]: 60,
947
+ // C
948
+ [p.G]: 67,
949
+ // G
950
+ [p.D]: 62,
951
+ // D
952
+ [p.A]: 69,
953
+ // A
954
+ [p.E]: 64,
955
+ // E
956
+ [p.B]: 71,
957
+ // B
958
+ "F#": 66,
959
+ // F#
960
+ "C#": 61
961
+ // C#
962
+ };
963
+ function Zn(e, t, n, r) {
964
+ const o = $n[n];
965
+ let s = {
966
+ [L.DO]: 0,
967
+ [L.RE]: 2,
968
+ [L.MI]: 4,
969
+ [L.FA]: 5,
970
+ [L.SOL]: 7,
971
+ [L.LA]: 9,
972
+ [L.TI]: 11
973
+ }[e];
974
+ switch (t) {
975
+ case m.Sharp:
976
+ s += 1;
977
+ break;
978
+ case m.Flat:
979
+ s -= 1;
980
+ break;
981
+ case m.DoubleSharp:
982
+ s += 2;
983
+ break;
984
+ case m.DoubleFlat:
985
+ s -= 2;
986
+ break;
987
+ case m.None:
988
+ break;
989
+ }
990
+ return o + (r - 4) * 12 + s;
991
+ }
992
+ m.Natural, m.Sharp, m.Flat;
993
+ m.Natural, m.Flat, m.Sharp;
994
+ function Qn(e, t, n = m.Sharp) {
995
+ const r = ["C", "D", "E", "F", "G", "A", "B"], o = {
996
+ 0: ["C", m.None],
997
+ 1: ["C", m.Sharp],
998
+ 2: ["D", m.None],
999
+ 3: ["D", m.Sharp],
1000
+ 4: ["E", m.None],
1001
+ 5: ["F", m.None],
1002
+ 6: ["F", m.Sharp],
1003
+ 7: ["G", m.None],
1004
+ 8: ["G", m.Sharp],
1005
+ 9: ["A", m.None],
1006
+ 10: ["A", m.Sharp],
1007
+ 11: ["B", m.None]
1008
+ }, i = {
1009
+ 0: ["C", m.None],
1010
+ 1: ["D", m.Flat],
1011
+ // Db
1012
+ 2: ["D", m.None],
1013
+ 3: ["E", m.Flat],
1014
+ // Eb
1015
+ 4: ["E", m.None],
1016
+ 5: ["F", m.None],
1017
+ 6: ["G", m.Flat],
1018
+ // Gb
1019
+ 7: ["G", m.None],
1020
+ 8: ["A", m.Flat],
1021
+ // Ab
1022
+ 9: ["A", m.None],
1023
+ 10: ["B", m.Flat],
1024
+ // Bb
1025
+ 11: ["B", m.None]
1026
+ }, s = n === m.Sharp ? o : i, u = (e % 12 + 12) % 12, [c, l] = s[u], a = Math.floor(e / 12) - 1, g = r.indexOf(c), d = a * 7 + g;
1027
+ function h(B, te) {
1028
+ const ye = r.indexOf(B);
1029
+ return te * 7 + ye;
1030
+ }
1031
+ const y = {
1032
+ [H.Treble]: { diatonic: h("G", 4), staffStep: 2 },
1033
+ // G4 -> main_line2
1034
+ [H.MezzoSoprano]: { diatonic: h("C", 4), staffStep: 2 },
1035
+ // C4 -> main_line2
1036
+ [H.Alto]: { diatonic: h("C", 4), staffStep: 4 },
1037
+ // C4 -> main_line3
1038
+ [H.Tenor]: { diatonic: h("C", 4), staffStep: 6 },
1039
+ // C4 -> main_line4
1040
+ [H.BaritoneF]: { diatonic: h("F", 3), staffStep: 4 },
1041
+ // 取 F3 -> main_line3(可调整)
1042
+ [H.BaritoneC]: { diatonic: h("C", 4), staffStep: 8 },
1043
+ // C4 -> main_line5
1044
+ [H.Bass]: { diatonic: h("F", 3), staffStep: 6 },
1045
+ // F3 -> main_line4
1046
+ [H.Subbass]: { diatonic: h("F", 2), staffStep: 6 }
1047
+ // F2 -> main_line4(可调整)
1048
+ }, v = y[t] ?? y[H.Treble], k = d - v.diatonic + v.staffStep;
1049
+ let I, N, A;
1050
+ if (k >= 0 && k <= 8)
1051
+ I = C.Main, k % 2 === 0 ? (N = G.Line, A = Math.floor(k / 2) + 1) : (N = G.Space, A = Math.floor((k + 1) / 2));
1052
+ else if (k < 0) {
1053
+ I = C.Lower;
1054
+ const B = -k;
1055
+ B % 2 === 1 ? (N = G.Space, A = Math.floor((B + 1) / 2)) : (N = G.Line, A = B / 2);
1056
+ } else {
1057
+ I = C.Upper;
1058
+ const B = k - 8;
1059
+ B % 2 === 1 ? (N = G.Space, A = Math.floor((B + 1) / 2)) : (N = G.Line, A = B / 2);
1060
+ }
1061
+ return { staffRegion: {
1062
+ region: I,
1063
+ type: N,
1064
+ index: A
1065
+ }, accidental: l };
1066
+ }
1067
+ const Xn = {
1068
+ // 高音谱号(G 谱号,G4 在第 2 线)
1069
+ [H.Treble]: {
1070
+ [C.Main]: 64,
1071
+ // main_line_1 = E4
1072
+ [C.Upper]: 79,
1073
+ // upper_space_1 = G5
1074
+ [C.Lower]: 62
1075
+ // lower_space_1 = D4
1076
+ },
1077
+ // 次女高音谱号(Mezzo-soprano C 谱号,C4 在第 2 线)
1078
+ [H.MezzoSoprano]: {
1079
+ [C.Main]: 57,
1080
+ // main_line_1 = A3
1081
+ [C.Upper]: 72,
1082
+ // upper_space_1 = C5
1083
+ [C.Lower]: 55
1084
+ // lower_space_1 = G3
1085
+ },
1086
+ // 中音谱号(Alto C 谱号,C4 在第 3 线)
1087
+ [H.Alto]: {
1088
+ [C.Main]: 53,
1089
+ // main_line_1 = F3
1090
+ [C.Upper]: 69,
1091
+ // upper_space_1 = A4
1092
+ [C.Lower]: 52
1093
+ // lower_space_1 = E3
1094
+ },
1095
+ // 次男高音谱号(Tenor C 谱号,C4 在第 4 线)
1096
+ [H.Tenor]: {
1097
+ [C.Main]: 50,
1098
+ // main_line_1 = D3
1099
+ [C.Upper]: 65,
1100
+ // upper_space_1 = F4
1101
+ [C.Lower]: 48
1102
+ // lower_space_1 = C3
1103
+ },
1104
+ // 男中音 F 谱号(Baritone F,常把 F 放第 3 线)
1105
+ [H.BaritoneF]: {
1106
+ [C.Main]: 47,
1107
+ // main_line_1 = B2
1108
+ [C.Upper]: 62,
1109
+ // upper_space_1 = D4
1110
+ [C.Lower]: 45
1111
+ // lower_space_1 = A2
1112
+ },
1113
+ // 男中音 C 谱号(Baritone C,C4 在第 5 线)
1114
+ [H.BaritoneC]: {
1115
+ [C.Main]: 53,
1116
+ // main_line_1 = F3
1117
+ [C.Upper]: 62,
1118
+ // upper_space_1 = D4 (C4 在 line5, 所以上方第一个间是 D4)
1119
+ [C.Lower]: 52
1120
+ // lower_space_1 = E3
1121
+ },
1122
+ // 低音谱号(Bass, F 谱号,F3 在第 4 线)
1123
+ [H.Bass]: {
1124
+ [C.Main]: 43,
1125
+ // main_line_1 = G2
1126
+ [C.Upper]: 60,
1127
+ // upper_space_1 = C4
1128
+ [C.Lower]: 41
1129
+ // lower_space_1 = F2
1130
+ },
1131
+ // 次低音谱号(Subbass)——这里采用常见约定:F 在第 5 线 (F2)
1132
+ [H.Subbass]: {
1133
+ [C.Main]: 28,
1134
+ // main_line_1 = E1 (五线最下面一线非常低)
1135
+ [C.Upper]: 43,
1136
+ // upper_space_1 = G2
1137
+ [C.Lower]: 26
1138
+ // lower_space_1 = D1
1139
+ }
1140
+ }, Kn = [2, 2, 1, 2, 2, 2, 1], Jn = {
1141
+ 0: 0,
1142
+ // C
1143
+ 2: 1,
1144
+ // D
1145
+ 4: 2,
1146
+ // E
1147
+ 5: 3,
1148
+ // F
1149
+ 7: 4,
1150
+ // G
1151
+ 9: 5,
1152
+ // A
1153
+ 11: 6
1154
+ // B
1155
+ };
1156
+ function _n(e, t) {
1157
+ return t = (t % e.length + e.length) % e.length, e.slice(t).concat(e.slice(0, t));
1158
+ }
1159
+ function Yn(e, t, n) {
1160
+ const r = Xn[n];
1161
+ if (!r || typeof r[C.Main] != "number")
1162
+ throw new Error(`No clef mapping for clef ${n}. please add clefMidiMap entry.`);
1163
+ const o = r[C.Main], { region: i, type: s, index: u } = e;
1164
+ if (u < 1)
1165
+ throw new Error("StaffRegion.index should be >= 1");
1166
+ let c;
1167
+ if (i === C.Main)
1168
+ c = (u - 1) * 2 + (s === G.Space ? 1 : 0);
1169
+ else if (i === C.Upper)
1170
+ c = 8 + (u - 1) * 2 + (s === G.Space ? 1 : 2);
1171
+ else if (i === C.Lower)
1172
+ c = -((u - 1) * 2 + (s === G.Space ? 1 : 2));
1173
+ else
1174
+ throw new Error("Unknown StaffRegionEnum: " + i);
1175
+ const l = (o % 12 + 12) % 12;
1176
+ let a = Jn[l];
1177
+ a === void 0 && (a = 0);
1178
+ const g = _n(Kn, a);
1179
+ let d = 0;
1180
+ if (c > 0)
1181
+ for (let y = 0; y < c; y++)
1182
+ d += g[y % g.length];
1183
+ else if (c < 0) {
1184
+ const y = Math.abs(c);
1185
+ for (let v = 0; v < y; v++)
1186
+ (g.length - 1 - v) % g.length, d -= g[(g.length - 1 - v % 7) % g.length];
1187
+ }
1188
+ let h = 0;
1189
+ switch (t) {
1190
+ case m.Sharp:
1191
+ h = 1;
1192
+ break;
1193
+ case m.Flat:
1194
+ h = -1;
1195
+ break;
1196
+ case m.DoubleSharp:
1197
+ h = 2;
1198
+ break;
1199
+ case m.DoubleFlat:
1200
+ h = -2;
1201
+ break;
1202
+ default:
1203
+ h = 0;
1204
+ }
1205
+ return o + d + h;
1206
+ }
1207
+ m.Natural, m.Sharp, m.Flat;
1208
+ m.Natural, m.Flat, m.Sharp;
1209
+ const En = {
1210
+ [p.Cb]: 59,
1211
+ // Cb = B (比 C 小一半音)
1212
+ [p.Gb]: 66,
1213
+ // Gb = F#
1214
+ [p.Db]: 61,
1215
+ // Db = C#
1216
+ [p.Ab]: 68,
1217
+ // Ab = G#
1218
+ [p.Eb]: 63,
1219
+ // Eb = D#
1220
+ [p.Bb]: 70,
1221
+ // Bb = A#
1222
+ [p.F]: 65,
1223
+ // F
1224
+ [p.C]: 60,
1225
+ // C
1226
+ [p.G]: 67,
1227
+ // G
1228
+ [p.D]: 62,
1229
+ // D
1230
+ [p.A]: 69,
1231
+ // A
1232
+ [p.E]: 64,
1233
+ // E
1234
+ [p.B]: 71,
1235
+ // B
1236
+ "F#": 66,
1237
+ // F#
1238
+ "C#": 61
1239
+ // C#
1240
+ }, er = {
1241
+ 0: {
1242
+ sharp: { solmization: L.DO, accidental: m.None },
1243
+ flat: { solmization: L.DO, accidental: m.None }
1244
+ },
1245
+ 1: {
1246
+ sharp: { solmization: L.DO, accidental: m.Sharp },
1247
+ flat: { solmization: L.RE, accidental: m.Flat }
1248
+ },
1249
+ 2: {
1250
+ sharp: { solmization: L.RE, accidental: m.None },
1251
+ flat: { solmization: L.RE, accidental: m.None }
1252
+ },
1253
+ 3: {
1254
+ sharp: { solmization: L.RE, accidental: m.Sharp },
1255
+ flat: { solmization: L.MI, accidental: m.Flat }
1256
+ },
1257
+ 4: {
1258
+ sharp: { solmization: L.MI, accidental: m.None },
1259
+ flat: { solmization: L.MI, accidental: m.None }
1260
+ },
1261
+ 5: {
1262
+ sharp: { solmization: L.FA, accidental: m.None },
1263
+ flat: { solmization: L.FA, accidental: m.None }
1264
+ },
1265
+ 6: {
1266
+ sharp: { solmization: L.FA, accidental: m.Sharp },
1267
+ flat: { solmization: L.SOL, accidental: m.Flat }
1268
+ },
1269
+ 7: {
1270
+ sharp: { solmization: L.SOL, accidental: m.None },
1271
+ flat: { solmization: L.SOL, accidental: m.None }
1272
+ },
1273
+ 8: {
1274
+ sharp: { solmization: L.SOL, accidental: m.Sharp },
1275
+ flat: { solmization: L.LA, accidental: m.Flat }
1276
+ },
1277
+ 9: {
1278
+ sharp: { solmization: L.LA, accidental: m.None },
1279
+ flat: { solmization: L.LA, accidental: m.None }
1280
+ },
1281
+ 10: {
1282
+ sharp: { solmization: L.LA, accidental: m.Sharp },
1283
+ flat: { solmization: L.TI, accidental: m.Flat }
1284
+ },
1285
+ 11: {
1286
+ sharp: { solmization: L.TI, accidental: m.None },
1287
+ flat: { solmization: L.TI, accidental: m.None }
1288
+ }
1289
+ };
1290
+ function tr(e, t, n = m.Sharp) {
1291
+ const r = En[t], o = e - r, i = (o % 12 + 12) % 12, s = Math.floor(o / 12) + 4, u = er[i], c = n === m.Sharp ? u.sharp : u.flat;
1292
+ return {
1293
+ solmization: c.solmization,
1294
+ accidental: c.accidental,
1295
+ octave: s
1296
+ };
1297
+ }
1298
+ function nr(e) {
1299
+ e.showMode = Ve.numberNotation;
1300
+ for (let t = 0; t < e.multipleStavesArray.length; t++) {
1301
+ const n = e.multipleStavesArray[t];
1302
+ for (let r = 0; r < n.singleStaffArray.length; r++) {
1303
+ const o = n.singleStaffArray[r];
1304
+ for (let i = 0; i < o.measureArray.length; i++) {
1305
+ const s = o.measureArray[i];
1306
+ for (let u = 0; u < s.msSymbolContainerArray.length; u++) {
1307
+ const c = s.msSymbolContainerArray[u];
1308
+ for (let l = 0; l < c.msSymbolArray.length; l++) {
1309
+ const a = c.msSymbolArray[l];
1310
+ if (a.type === f.NoteHead) {
1311
+ const g = V({ type: f.NoteNumber, chronaxie: w.quarter });
1312
+ cn(g, a);
1313
+ const { accidental: d, measureAccidental: h } = an(a, e);
1314
+ let y = d;
1315
+ h && y === m.Natural && (y = h);
1316
+ const v = vt(a, e), k = sn(a, e), I = Yn(a.region, y, v), N = tr(I, k);
1317
+ if (g.solmization = N.solmization, g.octave = N.octave, g.msSymbolArray = [], [w.whole, w.half, w.quarter].includes(a.chronaxie) || (g.chronaxie = a.chronaxie), c.msSymbolArray.splice(l, 1), Be(g, c, e, l), N.octave !== 4) {
1318
+ const A = V({ type: f.NoteDot, octave: N.octave });
1319
+ je(A, g, e);
1320
+ }
1321
+ if (![w.whole, w.half, w.quarter].includes(g.chronaxie)) {
1322
+ const A = V({ type: f.ChronaxieReducingLine, chronaxie: g.chronaxie });
1323
+ je(A, g, e);
1324
+ }
1325
+ if (N.accidental) {
1326
+ const A = V({
1327
+ type: f.Accidental,
1328
+ accidental: N.accidental
1329
+ });
1330
+ je(A, g, e);
1331
+ }
1332
+ }
1333
+ if (a.type === f.NoteHead) {
1334
+ if (a.chronaxie === w.whole) {
1335
+ for (let g = 0; g < 3; g++) {
1336
+ const d = V({ type: f.ChronaxieIncreasingLine }), h = tt({ type: q.variable });
1337
+ ve(h, c, e, "after"), Be(d, h, e, "after");
1338
+ }
1339
+ u += 3;
1340
+ } else if (a.chronaxie === w.half) {
1341
+ const g = V({ type: f.ChronaxieIncreasingLine }), d = tt({ type: q.variable });
1342
+ ve(d, c, e, "after"), Be(g, d, e, "after"), u += 1;
1343
+ }
1344
+ }
1345
+ }
1346
+ }
1347
+ }
1348
+ }
1349
+ }
1350
+ }
1351
+ function rr(e) {
1352
+ var t;
1353
+ for (let n = 0; n < e.multipleStavesArray.length; n++) {
1354
+ const r = e.multipleStavesArray[n];
1355
+ for (let o = 0; o < r.singleStaffArray.length; o++) {
1356
+ const i = r.singleStaffArray[o];
1357
+ for (let s = 0; s < i.measureArray.length; s++) {
1358
+ const u = i.measureArray[s];
1359
+ for (let c = 0; c < u.msSymbolContainerArray.length; c++) {
1360
+ const l = u.msSymbolContainerArray[c];
1361
+ for (let a = 0; a < l.msSymbolArray.length; a++) {
1362
+ const g = l.msSymbolArray[a];
1363
+ if (g.type === f.ChronaxieIncreasingLine) {
1364
+ zn(l, e), c--;
1365
+ continue;
1366
+ }
1367
+ if (g.type === f.NoteNumber) {
1368
+ const d = V({ type: f.NoteHead });
1369
+ cn(d, g);
1370
+ const { accidental: h, measureAccidental: y } = an(g, e);
1371
+ let v = h;
1372
+ y && v === m.Natural && (v = y);
1373
+ const k = vt(g, e), I = sn(g, e), N = Zn(g.solmization, v, I, g.octave), A = Qn(N, k);
1374
+ if (d.region = A.staffRegion, d.vueKey = Date.now(), d.msSymbolArray = [], g.chronaxie === w.quarter) {
1375
+ let j = 0;
1376
+ for (let B = c + 1; B < u.msSymbolContainerArray.length && ((t = u.msSymbolContainerArray[B]) == null ? void 0 : t.msSymbolArray[0]).type === f.ChronaxieIncreasingLine; B++)
1377
+ j++;
1378
+ j === 0 ? d.chronaxie = w.quarter : j === 1 ? d.chronaxie = w.half : j === 3 && (d.chronaxie = w.whole);
1379
+ } else
1380
+ d.chronaxie = g.chronaxie;
1381
+ if (l.msSymbolArray.splice(a, 1), Be(d, l, e, a), A.accidental) {
1382
+ const j = V({
1383
+ type: f.Accidental,
1384
+ accidental: A.accidental
1385
+ });
1386
+ je(j, d, e);
1387
+ }
1388
+ if (Bn(d.chronaxie)) {
1389
+ const j = V({ type: f.NoteStem });
1390
+ j.index = d.index, je(j, d, e);
1391
+ }
1392
+ if (jn(d.chronaxie)) {
1393
+ const j = V({
1394
+ type: f.NoteTail,
1395
+ chronaxie: d.chronaxie
1396
+ });
1397
+ je(j, d, e);
1398
+ }
1399
+ }
1400
+ }
1401
+ }
1402
+ }
1403
+ }
1404
+ }
1405
+ e.showMode = Ve.standardStaff;
1406
+ }
1407
+ H.Treble + "", H.MezzoSoprano + "", H.Alto + "", H.Tenor + "", H.BaritoneF + "", H.BaritoneC + "", H.Bass + "", H.Subbass + "";
1408
+ m.Natural, m.Sharp, m.Flat;
1409
+ m.Natural, m.Flat, m.Sharp;
1410
+ z.C + "", z.D + "", z.E + "", z.F + "", z.G + "", z.A + "", z.B + "";
1411
+ m.None + "", m.Sharp + "", m.Flat + "", m.DoubleFlat + "", m.DoubleSharp + "";
1412
+ const co = {
1413
+ [p.Cb]: 11,
1414
+ // B
1415
+ [p.Gb]: 6,
1416
+ // Gb
1417
+ [p.Db]: 1,
1418
+ // Db
1419
+ [p.Ab]: 8,
1420
+ // Ab
1421
+ [p.Eb]: 3,
1422
+ // Eb
1423
+ [p.Bb]: 10,
1424
+ // Bb
1425
+ [p.F]: 5,
1426
+ // F
1427
+ [p.C]: 0,
1428
+ // C
1429
+ [p.G]: 7,
1430
+ // G
1431
+ [p.D]: 2,
1432
+ // D
1433
+ [p.A]: 9,
1434
+ // A
1435
+ [p.E]: 4,
1436
+ // E
1437
+ [p.B]: 11,
1438
+ // B
1439
+ [p["F#"]]: 6,
1440
+ // F#
1441
+ [p["C#"]]: 1
1442
+ // C#
1443
+ }, Q = {
1444
+ [f.NoteHead]: {
1445
+ containerType: q.variable,
1446
+ aspectRatio: 1,
1447
+ widthRatioConstant: 1,
1448
+ category: P.singleMeasure,
1449
+ heightMultiplier: 0.25,
1450
+ space: {
1451
+ top: 0,
1452
+ bottom: 0,
1453
+ left: 0,
1454
+ right: 0
1455
+ }
1456
+ },
1457
+ [f.NoteNumber]: {
1458
+ containerType: q.variable,
1459
+ aspectRatio: 1,
1460
+ widthRatioConstant: 1,
1461
+ category: P.singleMeasure,
1462
+ heightMultiplier: 1,
1463
+ space: {
1464
+ top: 0,
1465
+ bottom: 0,
1466
+ left: 0,
1467
+ right: 0
1468
+ }
1469
+ },
1470
+ [f.NoteDot]: {
1471
+ aspectRatio: {
1472
+ // heightMultiplier除以1,保证宽度不变
1473
+ 0: 1 / 0.7,
1474
+ 1: 1 / 0.5,
1475
+ 2: 1 / 0.3,
1476
+ 3: 1 / 0.1,
1477
+ 5: 1 / 0.1,
1478
+ 6: 1 / 0.3,
1479
+ 7: 1 / 0.5,
1480
+ 8: 1 / 0.7
1481
+ },
1482
+ category: P.singleMeasure,
1483
+ widthRatioConstant: 0,
1484
+ heightMultiplier: {
1485
+ 0: 0.7,
1486
+ 1: 0.5,
1487
+ 2: 0.3,
1488
+ 3: 0.1,
1489
+ 5: 0.1,
1490
+ 6: 0.3,
1491
+ 7: 0.5,
1492
+ 8: 0.7
1493
+ },
1494
+ space: {
1495
+ top: 0.1,
1496
+ bottom: 0.1,
1497
+ left: 0,
1498
+ right: 0
1499
+ }
1500
+ },
1501
+ [f.ChronaxieIncreasingLine]: {
1502
+ containerType: q.variable,
1503
+ aspectRatio: 5,
1504
+ widthRatioConstant: 1,
1505
+ category: P.singleMeasure,
1506
+ heightMultiplier: 0.1,
1507
+ space: {
1508
+ top: 0,
1509
+ bottom: 0,
1510
+ left: 0,
1511
+ right: 0
1512
+ }
1513
+ },
1514
+ [f.ChronaxieReducingLine]: {
1515
+ aspectRatio: {
1516
+ // 1 除以heightMultiplier,保持宽度不变
1517
+ [w.eighth]: 1 / 0.1,
1518
+ // 7 flats
1519
+ [w.sixteenth]: 1 / 0.15,
1520
+ // 7 flats
1521
+ [w.thirtySecond]: 1 / 0.2,
1522
+ // 6 flats
1523
+ [w.sixtyFourth]: 1 / 0.25
1524
+ // 6 flats
1525
+ },
1526
+ category: P.singleMeasure,
1527
+ widthRatioConstant: 0,
1528
+ heightMultiplier: {
1529
+ [w.eighth]: 0.1,
1530
+ // 7 flats
1531
+ [w.sixteenth]: 0.15,
1532
+ // 7 flats
1533
+ [w.thirtySecond]: 0.2,
1534
+ // 6 flats
1535
+ [w.sixtyFourth]: 0.25
1536
+ // 6 flats
1537
+ },
1538
+ space: {
1539
+ top: 0,
1540
+ bottom: 0.1,
1541
+ left: 0,
1542
+ right: 0
1543
+ }
1544
+ },
1545
+ [f.NoteStem]: {
1546
+ // 有些纯粹的符号跟随类型是没有符号容器类型的
1547
+ aspectRatio: 0.05,
1548
+ category: P.singleMeasure,
1549
+ widthRatioConstant: 0,
1550
+ heightMultiplier: 0.75,
1551
+ // 符杠的height是动态的,这里只是最小高度
1552
+ space: {
1553
+ top: 0,
1554
+ bottom: 0,
1555
+ left: 0,
1556
+ right: 0
1557
+ }
1558
+ },
1559
+ [f.NoteTail]: {
1560
+ aspectRatio: {
1561
+ [w.eighth]: 0.5,
1562
+ // 7 flats
1563
+ [w.sixteenth]: 0.5
1564
+ // 6 flats
1565
+ },
1566
+ category: P.singleMeasure,
1567
+ widthRatioConstant: 0,
1568
+ heightMultiplier: 0.5,
1569
+ space: {
1570
+ top: 0,
1571
+ bottom: 0,
1572
+ left: 0,
1573
+ right: 0
1574
+ }
1575
+ },
1576
+ [f.Rest]: {
1577
+ // 休止符: 占位比例等于音符头
1578
+ containerType: q.variable,
1579
+ aspectRatio: 0.25,
1580
+ widthRatioConstant: 1,
1581
+ category: P.singleMeasure,
1582
+ heightMultiplier: 1,
1583
+ space: {
1584
+ top: 0,
1585
+ bottom: 0,
1586
+ left: 0,
1587
+ right: 0
1588
+ }
1589
+ },
1590
+ [f.Slur]: {
1591
+ // 圆滑线:跨音符装饰线,不占宽度
1592
+ category: P.multipleMeasure,
1593
+ space: {
1594
+ top: 0,
1595
+ bottom: 0,
1596
+ left: 0,
1597
+ right: 0
1598
+ }
1599
+ },
1600
+ [f.Tie]: {
1601
+ // 延音线:连接两个音符,不影响宽度
1602
+ category: P.multipleMeasure,
1603
+ space: {
1604
+ top: 0,
1605
+ bottom: 0,
1606
+ left: 0,
1607
+ right: 0
1608
+ }
1609
+ },
1610
+ [f.DurationDot]: {
1611
+ // 附点:相对于音符有一点影响
1612
+ aspectRatio: 1,
1613
+ category: P.singleMeasure,
1614
+ widthRatioConstant: 0.5,
1615
+ heightMultiplier: 0.1,
1616
+ space: {
1617
+ top: 0,
1618
+ bottom: 0,
1619
+ left: 0,
1620
+ right: 0
1621
+ }
1622
+ },
1623
+ [f.Accidental]: {
1624
+ aspectRatio: 1,
1625
+ category: P.singleMeasure,
1626
+ widthRatioConstant: 0.5,
1627
+ heightMultiplier: 0.4,
1628
+ space: {
1629
+ top: 0,
1630
+ bottom: 0,
1631
+ left: 0,
1632
+ right: 0
1633
+ }
1634
+ },
1635
+ [f.Tuplet]: {
1636
+ // 连音记号
1637
+ category: P.multipleMeasure,
1638
+ space: {
1639
+ top: 0,
1640
+ bottom: 0,
1641
+ left: 0,
1642
+ right: 0
1643
+ }
1644
+ },
1645
+ [f.Clef]: {
1646
+ // 谱号
1647
+ containerType: q.rearFixed,
1648
+ aspectRatio: 0.6,
1649
+ category: P.singleMeasure,
1650
+ heightMultiplier: 1,
1651
+ space: {
1652
+ top: 0,
1653
+ bottom: 0,
1654
+ left: 0,
1655
+ right: 0
1656
+ }
1657
+ },
1658
+ [f.Clef_f]: {
1659
+ // 前置谱号
1660
+ containerType: q.frontFixed,
1661
+ aspectRatio: 0.6,
1662
+ category: P.singleMeasure,
1663
+ heightMultiplier: 1,
1664
+ space: {
1665
+ top: 0,
1666
+ bottom: 0,
1667
+ left: 0,
1668
+ right: 0
1669
+ }
1670
+ },
1671
+ [f.TimeSignature]: {
1672
+ containerType: q.frontFixed,
1673
+ aspectRatio: 0.6,
1674
+ category: P.singleMeasure,
1675
+ heightMultiplier: 1,
1676
+ space: {
1677
+ top: 0,
1678
+ bottom: 0,
1679
+ left: 0,
1680
+ right: 0
1681
+ }
1682
+ },
1683
+ [f.KeySignature]: {
1684
+ containerType: q.frontFixed,
1685
+ aspectRatio: {
1686
+ [p.Cb]: 0.4 * 7,
1687
+ // 7 flats
1688
+ [p.Gb]: 0.4 * 6,
1689
+ // 6 flats
1690
+ [p.Db]: 0.4 * 5,
1691
+ // 5 flats
1692
+ [p.Ab]: 0.4 * 4,
1693
+ // 4 flats
1694
+ [p.Eb]: 0.4 * 3,
1695
+ // 3 flats
1696
+ [p.Bb]: 0.4 * 2,
1697
+ // 2 flats
1698
+ [p.F]: 0.4,
1699
+ // 1 flat
1700
+ [p.C]: 0,
1701
+ // 0
1702
+ [p.G]: 0.4,
1703
+ // 1 sharp
1704
+ [p.D]: 0.4 * 2,
1705
+ // 2 sharps
1706
+ [p.A]: 0.4 * 3,
1707
+ // 3 sharps
1708
+ [p.E]: 0.4 * 4,
1709
+ // 4 sharps
1710
+ [p.B]: 0.4 * 5,
1711
+ // 5 sharps
1712
+ [p["F#"]]: 0.4 * 6,
1713
+ // 6 sharps
1714
+ [p["C#"]]: 0.4 * 7
1715
+ // 7 sharps
1716
+ },
1717
+ category: P.singleMeasure,
1718
+ heightMultiplier: 1,
1719
+ space: {
1720
+ top: 0,
1721
+ bottom: 0,
1722
+ left: 0,
1723
+ right: 0
1724
+ }
1725
+ },
1726
+ [f.BarLine]: {
1727
+ containerType: q.rearFixed,
1728
+ aspectRatio: {
1729
+ [U.single]: 1 / 50,
1730
+ // 7 flats
1731
+ [U.final]: 2 / 5,
1732
+ // 7 flats
1733
+ [U.reverseFinal]: 2 / 5,
1734
+ // 7 flats
1735
+ [U.startRepeatSign]: 3 / 5,
1736
+ // 7 flats
1737
+ [U.endRepeatSign]: 3 / 5
1738
+ // 7 flats
1739
+ },
1740
+ category: P.singleMeasure,
1741
+ heightMultiplier: 1,
1742
+ space: {
1743
+ top: 0,
1744
+ bottom: 0,
1745
+ left: 0,
1746
+ right: 0
1747
+ }
1748
+ },
1749
+ [f.BarLine_f]: {
1750
+ containerType: q.frontFixed,
1751
+ aspectRatio: {
1752
+ [U.single]: 1 / 400,
1753
+ // 7 flats
1754
+ [U.final]: 2 / 5,
1755
+ // 7 flats
1756
+ [U.reverseFinal]: 2 / 5,
1757
+ // 7 flats
1758
+ [U.startRepeatSign]: 3 / 5,
1759
+ // 7 flats
1760
+ [U.endRepeatSign]: 3 / 5
1761
+ // 7 flats
1762
+ },
1763
+ category: P.singleMeasure,
1764
+ heightMultiplier: 1,
1765
+ space: {
1766
+ top: 0,
1767
+ bottom: 0,
1768
+ left: 0,
1769
+ right: 0
1770
+ }
1771
+ }
1772
+ };
1773
+ function gn(e) {
1774
+ let t = 0;
1775
+ const n = Q[e.type];
1776
+ if ("widthRatioConstant" in n && (t += n.widthRatioConstant), e.msSymbolArray)
1777
+ for (let r = 0; r < e.msSymbolArray.length; r++) {
1778
+ const o = e.msSymbolArray[r], i = Q[o.type];
1779
+ "widthRatioConstant" in i && (t += i.widthRatioConstant);
1780
+ }
1781
+ return t;
1782
+ }
1783
+ function At(e) {
1784
+ let t = 0;
1785
+ if (e.msSymbolArray)
1786
+ for (let n = 0; n < e.msSymbolArray.length; n++) {
1787
+ const r = e.msSymbolArray[n], o = gn(r);
1788
+ t < o && (t = o);
1789
+ }
1790
+ return t;
1791
+ }
1792
+ function Ie(e, t) {
1793
+ let n = 0;
1794
+ for (let r = 0; r < e.msSymbolContainerArray.length; r++) {
1795
+ const o = e.msSymbolContainerArray[r];
1796
+ if (t && o === t)
1797
+ return n;
1798
+ n += At(o);
1799
+ }
1800
+ return n === 0 ? 1 : n;
1801
+ }
1802
+ function dn(e, t, n) {
1803
+ let r = 0;
1804
+ for (let o = 0; o < e.measureArray.length; o++) {
1805
+ const i = e.measureArray[o];
1806
+ r += Ie(i, n);
1807
+ }
1808
+ return r;
1809
+ }
1810
+ const uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1811
+ __proto__: null,
1812
+ getWidthConstantInMeasure: Ie,
1813
+ getWidthConstantInMsSymbol: gn,
1814
+ getWidthConstantInMsSymbolContainer: At,
1815
+ getWidthConstantInSingleStaff: dn
1816
+ }, Symbol.toStringTag, { value: "Module" }));
1817
+ function or(e) {
1818
+ const t = Q[e.type];
1819
+ if ("aspectRatio" in t && typeof t.aspectRatio == "object") {
1820
+ if (e.type === b.KeySignature)
1821
+ return t.aspectRatio[e.keySignature];
1822
+ if (e.type === b.BarLine || e.type === b.BarLine_f)
1823
+ return t.aspectRatio[e.barLineType];
1824
+ if (e.type === b.NoteTail)
1825
+ return t.aspectRatio[e.chronaxie];
1826
+ if (e.type === b.NoteDot)
1827
+ return t.aspectRatio[e.octave];
1828
+ if (e.type === b.ChronaxieReducingLine)
1829
+ return t.aspectRatio[e.chronaxie];
1830
+ }
1831
+ return console.error("符号有误或符号不是复合aspectRatio类型"), 0;
1832
+ }
1833
+ function Ae(e) {
1834
+ if (!(e != null && e.type))
1835
+ return console.error("缺少符号传参,宽高比获取失败"), 1;
1836
+ const t = Q[e.type];
1837
+ return "aspectRatio" in t && typeof t.aspectRatio == "number" ? t.aspectRatio : "aspectRatio" in t && typeof t.aspectRatio == "object" ? or(e) : (console.error("未找到符号对应宽高比"), 1);
1838
+ }
1839
+ function ir(e) {
1840
+ const t = Q[e.type];
1841
+ if ("heightMultiplier" in t && typeof t.heightMultiplier == "object") {
1842
+ if (e.type === b.ChronaxieReducingLine)
1843
+ return t.heightMultiplier[e.chronaxie];
1844
+ if (e.type === b.NoteDot)
1845
+ return t.heightMultiplier[e.octave];
1846
+ }
1847
+ return console.error("符号有误或符号不是复合heightMultiplier类型"), 0;
1848
+ }
1849
+ function ot(e) {
1850
+ if (!(e != null && e.type))
1851
+ return console.error("缺少符号传参,高度乘数获取失败"), 1;
1852
+ const t = Q[e.type];
1853
+ return "heightMultiplier" in t && typeof t.heightMultiplier == "number" ? t.heightMultiplier : "heightMultiplier" in t && typeof t.heightMultiplier == "object" ? ir(e) : 1;
1854
+ }
1855
+ function ze(e, t) {
1856
+ const n = Q[e.type], r = t.measureHeight;
1857
+ return {
1858
+ top: n.space.top * r,
1859
+ bottom: n.space.bottom * r,
1860
+ left: n.space.left * r,
1861
+ right: n.space.right * r
1862
+ };
1863
+ }
1864
+ const go = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1865
+ __proto__: null,
1866
+ getHeightMultiplier: ot,
1867
+ getMsSymbolAspectRatio: Ae,
1868
+ getSpace: ze
1869
+ }, Symbol.toStringTag, { value: "Module" }));
1870
+ function kt(e, t) {
1871
+ return t * ((K(e) - 1) * 2) / 16;
1872
+ }
1873
+ function Lt(e, t) {
1874
+ const n = O(e.index, t).msSymbol, r = t.measureHeight;
1875
+ switch (e == null ? void 0 : e.type) {
1876
+ case f.NoteStem:
1877
+ return e.direction === "up" ? r / 8 : -ee(e, t) + r / 8;
1878
+ case f.NoteTail: {
1879
+ de(e, t);
1880
+ const o = n == null ? void 0 : n.msSymbolArray.find((c) => c.type === f.NoteStem);
1881
+ if (!o)
1882
+ return console.error("找不到符杠,符尾bottom计算失败"), 0;
1883
+ const i = r * 1 / 8, s = ee(e, t), u = ee(o, t);
1884
+ return e.direction === "up" ? u - s + i : -u + i;
1885
+ }
1886
+ case f.NoteDot: {
1887
+ Q[f.NoteDot];
1888
+ const o = ze(e, t).bottom, i = ze(e, t).top, s = Ze(e, t);
1889
+ let u = 0;
1890
+ const c = s.msSymbolArray.find((a) => a.type === f.ChronaxieReducingLine);
1891
+ let l = 0;
1892
+ return c && (l = ze(c, t).bottom, u = ee(c, t)), [0, 1, 2, 3].includes(e.octave) ? -ee(e, t) - o - u - l : [5, 6, 7, 8].includes(e.octave) ? r + i : 0;
1893
+ }
1894
+ case f.ChronaxieIncreasingLine: {
1895
+ const s = Q[f.ChronaxieIncreasingLine].heightMultiplier * r;
1896
+ return r / 2 - s / 2;
1897
+ }
1898
+ case f.ChronaxieReducingLine: {
1899
+ Q[f.ChronaxieReducingLine];
1900
+ const o = ot(e), i = ze(e, t).bottom;
1901
+ return -(o * r) - i;
1902
+ }
1903
+ default:
1904
+ return 0;
1905
+ }
1906
+ }
1907
+ function de(e, t) {
1908
+ var o;
1909
+ if (!e) return 0;
1910
+ const n = t.measureHeight, r = (o = O(e.index, t)) == null ? void 0 : o.msSymbol;
1911
+ switch (r.type) {
1912
+ case f.NoteHead: {
1913
+ if (!r || t.showMode === Ve.numberNotation) return 0;
1914
+ const i = r.region;
1915
+ return kt(i, n);
1916
+ }
1917
+ default:
1918
+ return 0;
1919
+ }
1920
+ }
1921
+ function mn(e, t, n = !0) {
1922
+ let r = 0;
1923
+ t.measureHeight;
1924
+ for (let o of e.msSymbolArray) {
1925
+ const i = de(o, t), s = ee(o, t), u = i + s;
1926
+ n ? r = Math.max(u, r) : r = Math.max(i, r);
1927
+ }
1928
+ return r;
1929
+ }
1930
+ function fn(e, t) {
1931
+ let n = 1e4;
1932
+ for (let r of e.msSymbolArray) {
1933
+ const o = de(r, t);
1934
+ n = Math.min(o, n);
1935
+ }
1936
+ return n;
1937
+ }
1938
+ function nt(e, t, n = !0) {
1939
+ let r = 0;
1940
+ for (let o of e.msSymbolContainerArray) {
1941
+ const i = mn(o, t, n);
1942
+ r = Math.max(i, r);
1943
+ }
1944
+ return r;
1945
+ }
1946
+ function hn(e, t) {
1947
+ let n = 1e4;
1948
+ for (let r of e.msSymbolContainerArray) {
1949
+ const o = fn(r, t);
1950
+ n = Math.min(o, n);
1951
+ }
1952
+ return n;
1953
+ }
1954
+ function ar(e, t, n = !0) {
1955
+ let r = 0;
1956
+ for (let o of e.measureArray) {
1957
+ const i = nt(o, t, n);
1958
+ r = Math.max(i, r);
1959
+ }
1960
+ return r;
1961
+ }
1962
+ function sr(e, t) {
1963
+ let n = 1e4;
1964
+ for (let r of e.measureArray) {
1965
+ const o = hn(r, t);
1966
+ n = Math.min(o, n);
1967
+ }
1968
+ return n;
1969
+ }
1970
+ function ht(e, t, n) {
1971
+ let r = 0;
1972
+ return Wn(t, {
1973
+ level: "multipleStaves",
1974
+ order: "asc",
1975
+ callback: ({ multipleStaves: o }) => {
1976
+ if (!o) return !0;
1977
+ r += o.multipleStavesPaddingTop;
1978
+ for (let i of o.singleStaffArray) {
1979
+ r += i.singleStaffPaddingTop + t.measureHeight;
1980
+ for (let s of i.measureArray)
1981
+ if (s === e)
1982
+ return !0;
1983
+ r += i.singleStaffPaddingBottom + i.singleStaffMarginBottom;
1984
+ }
1985
+ return r += o.multipleStavesPaddingBottom + o.multipleStavesMarginBottom, !1;
1986
+ }
1987
+ }), n - r;
1988
+ }
1989
+ const mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1990
+ __proto__: null,
1991
+ getMaxMsSymbolBottomInMeasure: nt,
1992
+ getMaxMsSymbolBottomInMsSymbolContainer: mn,
1993
+ getMaxMsSymbolBottomInSingleStaff: ar,
1994
+ getMeasureBottomToMusicScore: ht,
1995
+ getMinMsSymbolBottomInMeasure: hn,
1996
+ getMinMsSymbolBottomInMsSymbolContainer: fn,
1997
+ getMinMsSymbolBottomInSingleStaff: sr,
1998
+ getMsSymbolBottomToSlot: Lt,
1999
+ getSlotBottomToMeasure: de,
2000
+ staffRegionToBottom: kt
2001
+ }, Symbol.toStringTag, { value: "Module" }));
2002
+ function yn(e, t) {
2003
+ const n = O(e.index, t).msSymbol, r = Q[e == null ? void 0 : e.type], o = t.measureHeight;
2004
+ let i = 0;
2005
+ if ("heightMultiplier" in r) {
2006
+ const l = r.heightMultiplier;
2007
+ i = o * l;
2008
+ }
2009
+ const s = o * 1 / 8, u = O(n.index, t).measure;
2010
+ if (!u)
2011
+ return console.error("索引找不到measure,符杠height计算失败"), 0;
2012
+ const c = Qe(n.beamId, u);
2013
+ if (n.beamId === -1 || !c || c.length === 0) {
2014
+ const l = de(e, t);
2015
+ return e.direction === "up" ? Math.max(i, Math.abs(l) + i - s) : Math.max(i, Math.abs(l) - o + i + s);
2016
+ } else {
2017
+ const l = de(e, t);
2018
+ if (e.direction === "up") {
2019
+ const a = c.reduce((d, h) => {
2020
+ const y = d, v = h.note;
2021
+ return K(y.region) < K(v.region) ? h.note : d;
2022
+ }, c[0].note), g = de(a, t);
2023
+ return K(a.region) > 0 ? a === n ? i : -l + g + i : -l - s + i;
2024
+ } else {
2025
+ const a = c.reduce((d, h) => {
2026
+ const y = d, v = h.note;
2027
+ return K(y.region) > K(v.region) ? v : d;
2028
+ }, c[0].note), g = de(a, t);
2029
+ return K(a.region) < 8 ? a === n ? i : l - g + i : l - o + s + i;
2030
+ }
2031
+ }
2032
+ }
2033
+ function ee(e, t) {
2034
+ Q[e == null ? void 0 : e.type];
2035
+ const n = t.measureHeight, r = ot(e);
2036
+ switch (e.type) {
2037
+ case b.NoteStem:
2038
+ return yn(e, t);
2039
+ default:
2040
+ return n * r;
2041
+ }
2042
+ }
2043
+ const fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2044
+ __proto__: null,
2045
+ getMsSymbolHeight: ee,
2046
+ getNoteStemHeight: yn
2047
+ }, Symbol.toStringTag, { value: "Module" }));
2048
+ function Ue(e, t) {
2049
+ let n = 0;
2050
+ for (let r = 0; r < e.msSymbolArray.length; r++) {
2051
+ const o = e.msSymbolArray[r], i = Q[o.type];
2052
+ let s = 0;
2053
+ "aspectRatio" in i && typeof i.aspectRatio == "number" ? s += i.aspectRatio * t : "aspectRatio" in i && typeof i.aspectRatio == "object" ? o.type === f.KeySignature ? s += i.aspectRatio[o.keySignature] * t : (o.type === f.BarLine || o.type === f.BarLine_f) && (s += i.aspectRatio[o.barLineType] * t) : console.error("符号的svg宽高比不存在"), n < s && (n = s);
2054
+ }
2055
+ return n;
2056
+ }
2057
+ function me(e, t, n, r, o) {
2058
+ const i = r.measureHeight;
2059
+ if (!e || !t)
2060
+ return console.error("缺少必要的参数,坐标计算出错"), 0;
2061
+ let s = 0;
2062
+ const u = e.type;
2063
+ if ([q.frontFixed, q.rearFixed].includes(u))
2064
+ s = Ue(e, i);
2065
+ else {
2066
+ const c = ae(t, i), l = Ie(t), a = At(e);
2067
+ s = (Me(t, n, r, o) - c) / l * a;
2068
+ }
2069
+ return s;
2070
+ }
2071
+ function Me(e, t, n, r) {
2072
+ const o = dn(t, n.showMode), i = Ie(e), s = pn(t, n.measureHeight, n.showMode), u = ae(e, n.measureHeight), c = t.measureArray.length, l = r - s, a = l / o * n.widthDynamicRatio, g = l * (1 - n.widthDynamicRatio) / c;
2073
+ return a * i + u + g;
2074
+ }
2075
+ function ae(e, t, n = "all", r) {
2076
+ let o = 0;
2077
+ for (let i = 0; i < e.msSymbolContainerArray.length; i++) {
2078
+ const s = e.msSymbolContainerArray[i];
2079
+ if (r && r === s)
2080
+ return o;
2081
+ const u = s.type;
2082
+ (n === "all" && [q.frontFixed, q.rearFixed].includes(u) || n === "front" && [q.frontFixed].includes(u) || n === "rear" && [q.rearFixed].includes(u)) && (o += Ue(s, t));
2083
+ }
2084
+ return o;
2085
+ }
2086
+ function pn(e, t, n, r = "all", o) {
2087
+ let i = 0;
2088
+ return e.measureArray.forEach((s) => {
2089
+ i += ae(s, t, r, o);
2090
+ }), i;
2091
+ }
2092
+ function Dt(e, t, n, r, o, i, s) {
2093
+ const u = Ae(e), c = ee(e, i), l = Qe(t.beamId, r);
2094
+ return l.length > 1 ? t.id === l[0].note.id || t.id === l[l.length - 1].note.id ? me(n, r, o, i, s) / 2 : me(n, r, o, i, s) : c * u;
2095
+ }
2096
+ function We(e, t, n, r, o, i) {
2097
+ const s = o.measureHeight, u = Ae(e), c = ot(e), l = ee(e, o);
2098
+ switch (e == null ? void 0 : e.type) {
2099
+ case f.NoteStem:
2100
+ return s * c * u;
2101
+ case f.NoteTail: {
2102
+ const a = O(e.index, o).msSymbol;
2103
+ return a ? Dt(e, a, t, n, r, o, i) : (console.error("音符头索引失败,符尾宽度计算失败"), l * u);
2104
+ }
2105
+ default:
2106
+ return l * u;
2107
+ }
2108
+ }
2109
+ function $e(e, t, n = !1) {
2110
+ const r = n ? e : Ze(e, t), o = Ae(r);
2111
+ return ee(r, t) * o;
2112
+ }
2113
+ const ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2114
+ __proto__: null,
2115
+ getMeasureWidth: Me,
2116
+ getMsSymbolContainerWidth: me,
2117
+ getMsSymbolSlotWidth: $e,
2118
+ getMsSymbolWidth: We,
2119
+ getNoteTailWidth: Dt,
2120
+ getWidthFixedContainerWidth: Ue,
2121
+ getWidthFixedContainerWidthSumInMeasure: ae,
2122
+ getWidthFixedContainerWidthSumInSingleStaff: pn
2123
+ }, Symbol.toStringTag, { value: "Module" })), lr = ["onMousedown"], cr = ["onMousedown"], ur = /* @__PURE__ */ X({
2124
+ __name: "measureContainer",
2125
+ props: {
2126
+ musicScore: {
2127
+ type: Object,
2128
+ default: {}
2129
+ },
2130
+ disabled: {
2131
+ type: Boolean,
2132
+ default: !0
2133
+ },
2134
+ width: {
2135
+ type: Number,
2136
+ default: 1e3
2137
+ },
2138
+ height: {
2139
+ type: Number,
2140
+ default: 800
2141
+ }
2142
+ },
2143
+ emits: ["singleStaffMouseDown", "multipleStavesMouseDown"],
2144
+ setup(e, { emit: t }) {
2145
+ const n = e, r = t, o = S(() => (c) => ({
2146
+ "grid-template-rows": `repeat(${c.singleStaffArray.length},1fr)`,
2147
+ "padding-top": c.multipleStavesPaddingTop + "px",
2148
+ "padding-bottom": c.multipleStavesPaddingBottom + "px",
2149
+ "margin-bottom": c.multipleStavesMarginBottom + "px",
2150
+ "pointer-events": n.disabled ? "none" : "auto",
2151
+ outline: "1px solid " + (c.options.highlight ? c.options.highlightColor : c.options.color)
2152
+ })), i = S(() => (c, l) => ({
2153
+ "grid-template-columns": `repeat(${c.measureArray.length},1fr)`,
2154
+ "padding-top": c.singleStaffPaddingTop + "px",
2155
+ "padding-bottom": c.singleStaffPaddingBottom + "px",
2156
+ "margin-bottom": c.singleStaffMarginBottom + "px",
2157
+ "pointer-events": n.disabled ? "none" : "auto",
2158
+ outline: "1px solid " + (c.options.highlight ? c.options.highlightColor : c.options.color)
2159
+ })), s = S(() => (c, l, a) => Me(c, l, n.musicScore, n.width)), u = S(() => (c, l, a) => {
2160
+ let g = {};
2161
+ return g.height = n.musicScore.measureHeight + "px", g.width = s.value(c, l, a) + "px", g.pointerEvents = n.disabled ? "none" : "auto", g;
2162
+ });
2163
+ return (c, l) => (x(), D("div", null, [
2164
+ (x(!0), D(E, null, se(e.musicScore.multipleStavesArray, (a, g) => (x(), D("div", {
2165
+ key: "multipleStaves" + g,
2166
+ style: F(o.value(a)),
2167
+ onMousedown: $((d) => r("multipleStavesMouseDown", d, a), ["self"]),
2168
+ class: "multipleStaves"
2169
+ }, [
2170
+ _e(c.$slots, "multipleStaves", {}, void 0, !0),
2171
+ (x(!0), D(E, null, se(a.singleStaffArray, (d, h) => (x(), D("div", {
2172
+ key: "singleStaff" + h,
2173
+ style: F(i.value(d, a)),
2174
+ onMousedown: $((y) => r("singleStaffMouseDown", y, d), ["self"]),
2175
+ class: "singleStaff"
2176
+ }, [
2177
+ _e(c.$slots, "singleStaff", {}, void 0, !0),
2178
+ (x(!0), D(E, null, se(d.measureArray, (y, v) => (x(), D("div", {
2179
+ style: F(u.value(y, d, a)),
2180
+ class: "measureSlot",
2181
+ key: "measure" + v
2182
+ }, [
2183
+ _e(c.$slots, "default", {
2184
+ measure: y,
2185
+ measureIndex: v,
2186
+ singleStaff: d,
2187
+ singleStaffIndex: h,
2188
+ multipleStaves: a,
2189
+ multipleStavesIndex: g,
2190
+ measureWidth: s.value(y, d, a)
2191
+ }, void 0, !0)
2192
+ ], 4))), 128))
2193
+ ], 44, cr))), 128))
2194
+ ], 44, lr))), 128))
2195
+ ]));
2196
+ }
2197
+ }), st = /* @__PURE__ */ ne(ur, [["__scopeId", "data-v-98818cac"]]), bn = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20width='100'%20height='100'%3e%3cdefs%3e%3cmask%20id='hollowEllipseMask'%3e%3c!--%20背景为黑色(不可见),要保留的区域为白色(可见)%20--%3e%3crect%20width='100%25'%20height='100%25'%20fill='black'/%3e%3cellipse%20cx='50'%20cy='50'%20rx='50'%20ry='37.36'%20fill='white'/%3e%3cellipse%20cx='50'%20cy='50'%20rx='40'%20ry='27.36'%20fill='black'/%3e%3c/mask%3e%3c/defs%3e%3crect%20width='100%25'%20height='100%25'%20fill='black'%20mask='url(%23hollowEllipseMask)'/%3e%3c/svg%3e", gr = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20width='100'%20height='100'%3e%3cdefs%3e%3cmask%20id='hollowSlantedEllipseMask'%3e%3crect%20width='100%25'%20height='100%25'%20fill='black'/%3e%3c!--%20外椭圆,稍微倾斜%20--%3e%3cellipse%20cx='50'%20cy='50'%20rx='45'%20ry='32'%20fill='white'%20transform='rotate(-15%2050%2050)'/%3e%3c!--%20内椭圆,用于挖空%20--%3e%3cellipse%20cx='50'%20cy='50'%20rx='35'%20ry='22'%20fill='black'%20transform='rotate(-15%2050%2050)'/%3e%3c/mask%3e%3c/defs%3e%3c!--%20使用蒙版绘制一个斜切空心音符头%20--%3e%3crect%20width='100%25'%20height='100%25'%20fill='black'%20mask='url(%23hollowSlantedEllipseMask)'/%3e%3c/svg%3e", zt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20width='100'%20height='100'%3e%3cdefs%3e%3cmask%20id='hollowSlantedEllipseMask'%3e%3crect%20width='100%25'%20height='100%25'%20fill='black'/%3e%3c!--%20外椭圆,稍微倾斜%20--%3e%3cellipse%20cx='50'%20cy='50'%20rx='45'%20ry='32'%20fill='white'%20transform='rotate(-15%2050%2050)'/%3e%3c!--%20内椭圆,用于挖空%20--%3e%3c!--%20%3cellipse%20cx='50'%20cy='50'%20rx='35'%20ry='22'%20fill='black'%20transform='rotate(-15%2050%2050)'/%3e--%3e%3c/mask%3e%3c/defs%3e%3c!--%20使用蒙版绘制一个斜切空心音符头%20--%3e%3crect%20width='100%25'%20height='100%25'%20fill='black'%20mask='url(%23hollowSlantedEllipseMask)'/%3e%3c/svg%3e", qt = "data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiDQogICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyINCiAgICAgd2lkdGg9IjMwIiBoZWlnaHQ9IjUwIg0KICAgICB2aWV3Qm94PSIwIDAgMzAgNTAiPg0KICAgIDwhLS0geSDorr7kuLogMjDvvIzorqnmloflrZfokL3lnKjlj6/op4HojIPlm7QgLS0+DQogICAgPHRleHQgeD0iLTIiIHk9IjQ4IiBmb250LXNpemU9IjcwIiBmaWxsPSJibGFjayI+MTwvdGV4dD4NCjwvc3ZnPg0K", dr = "data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiDQogICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyINCiAgICAgd2lkdGg9IjMwIiBoZWlnaHQ9IjUwIg0KICAgICB2aWV3Qm94PSIwIDAgMzAgNTAiPg0KICAgIDwhLS0geSDorr7kuLogMjDvvIzorqnmloflrZfokL3lnKjlj6/op4HojIPlm7QgLS0+DQogICAgPHRleHQgeD0iLTIiIHk9IjQ4IiBmb250LXNpemU9IjcwIiBmaWxsPSJibGFjayI+MjwvdGV4dD4NCjwvc3ZnPg0K", mr = "data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiDQogICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyINCiAgICAgd2lkdGg9IjMwIiBoZWlnaHQ9IjUwIg0KICAgICB2aWV3Qm94PSIwIDAgMzAgNTAiPg0KICAgIDwhLS0geSDorr7kuLogMjDvvIzorqnmloflrZfokL3lnKjlj6/op4HojIPlm7QgLS0+DQogICAgPHRleHQgeD0iLTIiIHk9IjQ4IiBmb250LXNpemU9IjcwIiBmaWxsPSJibGFjayI+MzwvdGV4dD4NCjwvc3ZnPg0K", fr = "data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiDQogICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyINCiAgICAgd2lkdGg9IjMwIiBoZWlnaHQ9IjUwIg0KICAgICB2aWV3Qm94PSIwIDAgMzAgNTAiPg0KICAgIDwhLS0geSDorr7kuLogMjDvvIzorqnmloflrZfokL3lnKjlj6/op4HojIPlm7QgLS0+DQogICAgPHRleHQgeD0iLTIiIHk9IjQ4IiBmb250LXNpemU9IjcwIiBmaWxsPSJibGFjayI+NDwvdGV4dD4NCjwvc3ZnPg0K", hr = "data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiDQogICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyINCiAgICAgd2lkdGg9IjMwIiBoZWlnaHQ9IjUwIg0KICAgICB2aWV3Qm94PSIwIDAgMzAgNTAiPg0KICAgIDwhLS0geSDorr7kuLogMjDvvIzorqnmloflrZfokL3lnKjlj6/op4HojIPlm7QgLS0+DQogICAgPHRleHQgeD0iLTIiIHk9IjQ4IiBmb250LXNpemU9IjcwIiBmaWxsPSJibGFjayI+NTwvdGV4dD4NCjwvc3ZnPg0K", yr = "data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiDQogICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyINCiAgICAgd2lkdGg9IjMwIiBoZWlnaHQ9IjUwIg0KICAgICB2aWV3Qm94PSIwIDAgMzAgNTAiPg0KICAgIDwhLS0geSDorr7kuLogMjDvvIzorqnmloflrZfokL3lnKjlj6/op4HojIPlm7QgLS0+DQogICAgPHRleHQgeD0iLTIiIHk9IjQ4IiBmb250LXNpemU9IjcwIiBmaWxsPSJibGFjayI+NjwvdGV4dD4NCjwvc3ZnPg0K", pr = "data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiDQogICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyINCiAgICAgd2lkdGg9IjMwIiBoZWlnaHQ9IjUwIg0KICAgICB2aWV3Qm94PSIwIDAgMzAgNTAiPg0KICAgIDwhLS0geSDorr7kuLogMjDvvIzorqnmloflrZfokL3lnKjlj6/op4HojIPlm7QgLS0+DQogICAgPHRleHQgeD0iLTIiIHk9IjQ4IiBmb250LXNpemU9IjcwIiBmaWxsPSJibGFjayI+NzwvdGV4dD4NCjwvc3ZnPg0K", Ut = "data:image/svg+xml,%3csvg%20viewBox='0%200%20100%20100'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='50'%20cy='50'%20r='50'%20/%3e%3c/svg%3e", Vt = "data:image/svg+xml,%3csvg%20viewBox='0%200%20100%20300'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='50'%20cy='50'%20r='50'%20/%3e%3ccircle%20cx='50'%20cy='250'%20r='50'%20/%3e%3c/svg%3e", br = "data:image/svg+xml,%3csvg%20viewBox='0%200%20100%20500'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='50'%20cy='50'%20r='50'%20/%3e%3ccircle%20cx='50'%20cy='250'%20r='50'%20/%3e%3ccircle%20cx='50'%20cy='450'%20r='50'%20/%3e%3c/svg%3e", $t = "data:image/svg+xml,%3csvg%20viewBox='0%200%20100%20700'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='50'%20cy='50'%20r='50'%20/%3e%3ccircle%20cx='50'%20cy='250'%20r='50'%20/%3e%3ccircle%20cx='50'%20cy='450'%20r='50'%20/%3e%3ccircle%20cx='50'%20cy='650'%20r='50'%20/%3e%3c/svg%3e", lt = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2019.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20viewBox='0%200%20210%20210'%20style='enable-background:new%200%200%20210%20210;'%20xml:space='preserve'%3e%3cpolygon%20id='XMLID_830_'%20points='210,60%200,60%200,90%2030,90%2030,150%20180,150%20180,90%20210,90%20'/%3e%3c/svg%3e", Sr = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2019.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20viewBox='0%200%20210%20210'%20style='enable-background:new%200%200%20210%20210;'%20xml:space='preserve'%3e%3cpolygon%20id='XMLID_819_'%20points='180,120%20180,60%2030,60%2030,120%200,120%200,150%20210,150%20210,120%20'/%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3c/svg%3e", Zt = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2019.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20viewBox='0%200%20275.734%20275.734'%20style='enable-background:new%200%200%20275.734%20275.734;'%20xml:space='preserve'%3e%3cpath%20id='XMLID_831_'%20d='M149.83,130.355l42.148-41.852L103.474,0L82.261,21.213l42.143,42.143l-42.143,41.857l52.543,52.543%20c-25.63,6.826-44.571,30.229-44.571,57.979c0,33.084,26.916,60,60,60v-30c-16.542,0-30-13.457-30-30c0-16.541,13.458-30,30-30%20c7.948,0,15.438,3.078,21.089,8.664l0.063-0.063l0.877,0.877L193.474,174L149.83,130.355z'/%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3c/svg%3e", vr = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2019.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20viewBox='0%200%20180%20180'%20style='enable-background:new%200%200%20180%20180;'%20xml:space='preserve'%3e%3cg%20id='XMLID_19_'%3e%3cpath%20id='XMLID_833_'%20d='M119.771,30l-7.279,16.325C107.142,54.543,97.898,60,87.381,60c-5.458,0-10.575-1.472-14.988-4.029%20C81.351,50.781,87.381,41.099,87.381,30c0-16.569-13.43-30-30-30c-16.569,0-30,13.431-30,30c0,0.519,0.013,1.034,0.039,1.546%20C28.246,63.917,54.815,90,87.381,90c1.945,0,3.866-0.102,5.764-0.284L52.888,180h32.847l66.884-150H119.771z'/%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3c/svg%3e", xr = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2019.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20viewBox='0%200%20360%20360'%20style='enable-background:new%200%200%20360%20360;'%20xml:space='preserve'%3e%3cg%20id='XMLID_18_'%3e%3cpath%20id='XMLID_835_'%20d='M249.901,30l-6.545,14.678C238.211,53.806,228.456,60,217.251,60c-5.457,0-10.574-1.472-14.988-4.029%20c8.958-5.189,14.988-14.872,14.988-25.971c0-16.569-13.43-30-30-30c-16.569,0-30,13.431-30,30c0,0.519,0.014,1.034,0.039,1.546%20C158.116,63.917,184.686,90,217.251,90c2.038,0,4.05-0.112,6.036-0.312l-20.467,45.9c-5.27,8.626-14.741,14.411-25.569,14.411%20c-5.457,0-10.574-1.472-14.988-4.029c8.958-5.189,14.988-14.872,14.988-25.971c0-16.569-13.43-30-30-30c-16.569,0-30,13.431-30,30%20c0,0.519,0.014,1.034,0.039,1.546c0.826,32.37,27.395,58.454,59.961,58.454c1.989,0,3.956-0.099,5.896-0.29l-20.787,46.617%20C157.01,234.544,147.768,240,137.251,240c-5.457,0-10.574-1.472-14.988-4.029c8.958-5.189,14.988-14.872,14.988-25.971%20c0-16.569-13.43-30-30-30c-16.569,0-30,13.431-30,30c0,0.519,0.014,1.034,0.039,1.546C78.116,243.917,104.686,270,137.251,270%20c1.943,0,3.865-0.098,5.762-0.28L102.758,360h32.848L282.749,30H249.901z'/%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3c/svg%3e", wr = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='10'%20height='100'%3e%3c!--%20音符杆%20--%3e%3cline%20x1='5'%20y1='0'%20x2='5'%20y2='100'%20stroke='black'%20stroke-width='10'%3e%3c/line%3e%3c/svg%3e", yt = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2019.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20viewBox='0%200%20395%20395'%20style='enable-background:new%200%200%20395%20395;'%20xml:space='preserve'%3e%3cpath%20id='XMLID_905_'%20d='M272.833,80h30l-45-80l-45,80h30v47.358l-90,22.714V90h-30v67.645l-30.666,7.739v60l30.666-7.739v52.478%20l-30.666,7.739v60l30.666-7.739V395h30v-72.449l90-22.714V365h30v-72.734l29.334-7.403v-60l-29.334,7.403v-52.479l29.334-7.403v-60%20l-29.334,7.403V80z%20M242.833,239.837l-90,22.714v-52.479l90-22.714V239.837z'/%3e%3c/svg%3e", pt = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2019.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20viewBox='0%200%20270%20270'%20style='enable-background:new%200%200%20270%20270;'%20xml:space='preserve'%3e%3cpath%20id='XMLID_920_'%20d='M174.642,156.642c-10.662-17.767-29.276-25.48-48.578-20.137c-2.379,0.659-4.681,1.507-6.901,2.507V0h-30%20v270h30c5.88-4.736,21.586-18.098,35.412-34.425C172.578,214.313,190.674,183.359,174.642,156.642z%20M131.944,215.875%20c-4.175,4.955-8.586,9.608-12.782,13.75V185c0-10.037,7.682-17.581,14.91-19.584c6.258-1.733,11.115,0.446,14.846,6.661%20C151.41,176.231,154.746,188.814,131.944,215.875z'/%3e%3c/svg%3e", Ir = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2019.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20viewBox='0%200%20270%20270'%20style='enable-background:new%200%200%20270%20270;'%20xml:space='preserve'%3e%3cg%20id='XMLID_14_'%3e%3cpath%20id='XMLID_906_'%20d='M90,60V0H60v240l120-30v60h30V30L90,60z%20M180,150l-90,22.5V120l90-22.5V150z'/%3e%3c/g%3e%3c/svg%3e", Qt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='100'%20height='800'%3e%3crect%20width='100'%20height='800'/%3e%3c/svg%3e", Xt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='200'%20height='500'%3e%3cstyle%3e%3c/style%3e%3cg%3e%3cline%20x1='50'%20x2='50'%20y1='0'%20y2='500'%20stroke-width='50'%20class='line'%20stroke='black'/%3e%3cline%20x1='150'%20x2='150'%20y1='0'%20y2='500'%20stroke-width='100'%20class='line'%20stroke='black'/%3e%3c/g%3e%3c/svg%3e", Kt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='200'%20height='500'%3e%3cstyle%3e%3c/style%3e%3cg%3e%3cline%20x1='150'%20x2='150'%20y1='0'%20y2='500'%20stroke-width='50'%20class='line'%20stroke='black'/%3e%3cline%20x1='50'%20x2='50'%20y1='0'%20y2='500'%20stroke-width='100'%20class='line'%20stroke='black'/%3e%3c/g%3e%3c/svg%3e", Jt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='300'%20height='500'%3e%3cg%3e%3ccircle%20cx='240'%20cy='180'%20r='30'%20fill='black'/%3e%3ccircle%20cx='240'%20cy='320'%20r='30'%20fill='black'/%3e%3cline%20x1='150'%20x2='150'%20y1='0'%20y2='500'%20stroke-width='50'%20class='line'%20stroke='black'/%3e%3cline%20x1='50'%20x2='50'%20y1='0'%20y2='500'%20stroke-width='100'%20class='line'%20stroke='black'/%3e%3c/g%3e%3c/svg%3e", _t = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='300'%20height='500'%3e%3cstyle%3e%3c/style%3e%3cg%3e%3ccircle%20cx='60'%20cy='180'%20r='30'%20fill='black'/%3e%3ccircle%20cx='60'%20cy='320'%20r='30'%20fill='black'/%3e%3cline%20x1='150'%20x2='150'%20y1='0'%20y2='500'%20stroke-width='50'%20class='line'%20stroke='black'/%3e%3cline%20x1='250'%20x2='250'%20y1='0'%20y2='500'%20stroke-width='100'%20class='line'%20stroke='black'/%3e%3c/g%3e%3c/svg%3e", Mr = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2018.1.1,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20width='30'%20height='50'%20viewBox='0%200%2025.8%2025.8'%20style='enable-background:new%200%200%2025.8%2025.8;'%20xml:space='preserve'%3e%3cg%20transform='translate(12.9,%2012.9)%20scale(1.67)%20translate(-12.9,%20-12.9)'%3e%3cpath%20style='fill:%23030104;'%20d='M16.681,13.4c-0.7-0.8-1.7-1.3-2.9-1.2c-0.1-0.2-0.5-2.2-0.5-2.2s1.4-2.1,1.7-2.5%20c1.5-2.4,1.6-4.3,0.7-6.2c-0.3-0.7-1.1-1.3-1.9-1.3c-0.6,0-1.1,0.5-1.4,1.1c-1,1.7-1,4.9-0.5,7.1c0,0-0.5,0.5-1,1.1%20c-1,1.1-2.1,2.3-2.5,3.9c-0.5,1.8-0.1,3.5,1,4.8c1.2,1.5,3,2.2,5.2,2c0.4,1.9,0.7,3.1,0.1,4.2c-0.2,0.4-0.6,0.8-1.3,0.8%20c-0.2,0-0.3,0-0.5-0.1c0.6-0.3,1.1-0.9,1.1-1.6c0-1-0.8-1.8-1.8-1.8c-1.7,0.1-1.8,1.8-1.8,1.8c0,0.6,0.2,1.2,0.6,1.6%20c0.5,0.5,1.3,0.9,2.2,0.9c1.1,0,2.2-0.4,2.6-2c0.4-1.3-0.3-3.4-0.4-4.1c1.1-0.5,2.1-2,2.2-3C17.781,15.6,17.381,14.3,16.681,13.4z%20M13.481,2.3c0.1-0.2,0.3-0.3,0.5-0.3c0.1,0,0.3,0.1,0.4,0.2c0.4,0.2,0.5,0.6,0.5,1.2c-0.1,1.5-1.4,3.3-2.1,3.9%20C12.481,5.9,12.681,3.3,13.481,2.3z%20M10.581,18c-0.7-0.7-1-1.7-0.9-2.7c0.2-1.6,1.3-2.9,2.2-3.9c0.2-0.2,0.4-0.4,0.5-0.6%20c0.1,0.5,0.4,1.3,0.5,1.7c-1.2,0.5-1.9,2.1-1.8,3.4c0,0.6,0.2,1,0.5,1.4c0.1,0.1,0.2,0.2,0.3,0.2s0.3-0.1,0.3-0.2l0,0%20c0.1-0.1,0.1-0.3,0-0.4s-0.1-0.2-0.1-0.4c-0.1-0.9,0.5-1.6,1.2-1.9c0.1,0.6,0.8,3.7,0.9,4.4C12.881,19.4,11.481,19,10.581,18z%20M15.081,18.6c-0.2-0.7-0.3-1.5-0.5-2.4c-0.1-0.6-0.2-1.3-0.4-1.9c1.3,0,1.7,1.1,1.8,1.5C16.281,16.9,15.981,18,15.081,18.6z'/%3e%3c/g%3e%3c/svg%3e", Cr = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2019.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20width='30'%20height='50'%20viewBox='0%200%20285%20285'%20xml:space='preserve'%3e%3cg%20id='XMLID_516_'%20transform='translate(0,%20142.5)%20scale(1,1.8)%20translate(0,%20-142.5)%20'%3e%3crect%20id='XMLID_517_'%20y='7.5'%20width='60'%20height='270'/%3e%3crect%20id='XMLID_518_'%20x='90'%20y='7.5'%20width='30'%20height='270'/%3e%3cpath%20id='XMLID_519_'%20d='M225,157.428v-29.855c33.084,0,60-26.916,60-60c0-33.084-26.916-60-60-60%20c-31.424,0-57.18,23.901-59.779,54.892c-0.02,0.158-0.173,1.825-0.173,2.515c0,0.031,0.005,0.06,0.005,0.091%20c-0.001,0.024-0.004,0.047-0.005,0.071l0.009,0.001c0.088,10.97,9,19.837,19.991,19.837c11.046,0,20-8.954,20-20%20c0-5.252-2.041-10.017-5.353-13.586c5.326-8.344,14.666-13.821,25.305-13.821c16.542,0,30,13.458,30,30c0,16.542-13.458,30-30,30%20V82.5l-75,60l75,60v-15.072c16.542,0,30,13.458,30,29.999c0,16.542-13.458,30.001-30,30.001c-10.639,0-19.979-5.477-25.305-13.821%20c3.312-3.569,5.353-8.333,5.353-13.586c0-11.046-8.954-20-20-20c-10.991,0-19.903,8.868-19.991,19.837l-0.009,0.001%20c0.001,0.024,0.004,0.047,0.005,0.071c0,0.031-0.005,0.06-0.005,0.091c0,0.69,0.153,2.357,0.173,2.515%20c2.6,30.991,28.355,54.892,59.779,54.892c33.084,0,60-26.916,60-60.001C285,184.343,258.084,157.428,225,157.428z'/%3e%3c/g%3e%3c/svg%3e", Ar = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3c!--%20Generator:%20Adobe%20Illustrator%2019.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%206.00%20Build%200)%20--%3e%3csvg%20version='1.1'%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20width='30'%20height='50'%20viewBox='0%200%20270%20270'%20style='enable-background:new%200%200%20270%20270;'%20xml:space='preserve'%3e%3cg%20id='XMLID_520_'%20transform='translate(135,%20135)%20scale(1.2,1.7)%20translate(-135,%20-135)'%3e%3cpath%20id='XMLID_521_'%20d='M95,0C46.286,0,20,35.035,20,68c0,16.393,5.134,30.499,14.848,40.794C44.851,119.396,58.736,125,75,125%20c16.569,0,30-13.431,30-30S91.569,65,75,65c-9.828,0-18.551,4.726-24.023,12.028C50.234,73.834,50,70.676,50,68%20c0-18.884,15.457-38,45-38c37.664,0,65,35.748,65,85c0,47.058-20.573,76.48-37.831,92.875C100.995,227.991,72.146,240,45,240v30%20c35.164,0,70.822-14.716,97.831-40.375C173.248,200.729,190,160.02,190,115c0-31.97-9.544-61.113-26.874-82.062%20C145.554,11.698,121.36,0,95,0z'/%3e%3ccircle%20id='XMLID_522_'%20cx='235'%20cy='60'%20r='15'/%3e%3ccircle%20id='XMLID_523_'%20cx='235'%20cy='120'%20r='15'/%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3cg%3e%3c/g%3e%3c/svg%3e", kr = /* @__PURE__ */ X({
2198
+ __name: "clef",
2199
+ props: {
2200
+ clef: {
2201
+ type: Object,
2202
+ required: !0
2203
+ },
2204
+ musicScore: {
2205
+ required: !0,
2206
+ type: Object
2207
+ }
2208
+ },
2209
+ setup(e) {
2210
+ const t = e, n = S(() => {
2211
+ let r = "";
2212
+ return t.clef.clef === Y.Treble ? r = Mr : t.clef.clef === Y.Alto ? r = Cr : t.clef.clef === Y.Bass && (r = Ar), {
2213
+ mask: `url("${r}") center center / 100% 100% no-repeat`
2214
+ };
2215
+ });
2216
+ return (r, o) => (x(), D("div", {
2217
+ style: F(n.value)
2218
+ }, null, 4));
2219
+ }
2220
+ }), Lr = { class: "keySignature" }, Dr = /* @__PURE__ */ X({
2221
+ __name: "keySignature",
2222
+ props: {
2223
+ keySignature: {
2224
+ type: Object,
2225
+ required: !0
2226
+ },
2227
+ slotWidth: {
2228
+ type: Number,
2229
+ default: 50
2230
+ },
2231
+ measureHeight: {
2232
+ type: Number,
2233
+ default: 60
2234
+ },
2235
+ musicScore: {
2236
+ type: Object,
2237
+ default: {}
2238
+ }
2239
+ },
2240
+ setup(e) {
2241
+ const t = e, n = S(() => t.keySignature ? vt(t.keySignature, t.musicScore) : Y.Treble), r = S(() => {
2242
+ const a = {
2243
+ Cb: { type: "flat", count: 7 },
2244
+ Gb: { type: "flat", count: 6 },
2245
+ Db: { type: "flat", count: 5 },
2246
+ Ab: { type: "flat", count: 4 },
2247
+ Eb: { type: "flat", count: 3 },
2248
+ Bb: { type: "flat", count: 2 },
2249
+ F: { type: "flat", count: 1 },
2250
+ C: { type: "none", count: 0 },
2251
+ G: { type: "sharp", count: 1 },
2252
+ D: { type: "sharp", count: 2 },
2253
+ A: { type: "sharp", count: 3 },
2254
+ E: { type: "sharp", count: 4 },
2255
+ B: { type: "sharp", count: 5 },
2256
+ "F#": { type: "sharp", count: 6 },
2257
+ "C#": { type: "sharp", count: 7 }
2258
+ };
2259
+ return t.keySignature.type === b.KeySignature ? a[t.keySignature.keySignature] : (console.error("keySignature出错,没有keySignature属性", t.keySignature), a[on.C]);
2260
+ }), o = S(
2261
+ () => r.value.type === "sharp" ? yt : pt
2262
+ ), i = S(() => t.measureHeight / 8), s = {
2263
+ [Y.Treble]: [6, 3.5, 5, 2.5, 4, 2, 3],
2264
+ [Y.Bass]: [3, 0.5, 2, -0.5, 1, -1, 0],
2265
+ // 低音谱号升号位置,模拟五线谱线和间的对应
2266
+ [Y.Alto]: [4.5, 2, 3.5, 1, 2.5, 0, 1.5]
2267
+ // 中音谱号
2268
+ }, u = {
2269
+ [Y.Treble]: [5, 8, 4, 7, 3, 6, 2],
2270
+ [Y.Bass]: [6, 3.5, 5, 2.5, 4, 2, 3],
2271
+ [Y.Alto]: [2, 4.5, 1, 3.5, 0, 2.5, -0.5]
2272
+ }, c = S(() => r.value.type === "sharp" ? (s[n.value] || s[Y.Treble]).slice(0, r.value.count).map((g) => g * i.value) : r.value.type === "flat" ? (u[n.value] || u[Y.Treble]).slice(0, r.value.count).map((g) => g * i.value) : []), l = S(() => {
2273
+ const a = t.measureHeight * 0.5, g = t.measureHeight * 0.4;
2274
+ return (d, h) => ({
2275
+ width: a + "px",
2276
+ height: a + "px",
2277
+ position: "absolute",
2278
+ pointerEvents: "none",
2279
+ left: `${d * g}px`,
2280
+ top: `${t.measureHeight - h - a / 2}px`,
2281
+ backgroundColor: t.keySignature.options.highlight ? t.keySignature.options.highlightColor : t.keySignature.options.color,
2282
+ maskImage: `url("${o.value}")`,
2283
+ WebkitMaskImage: `url("${o.value}")`,
2284
+ maskRepeat: "no-repeat",
2285
+ WebkitMaskRepeat: "no-repeat",
2286
+ maskSize: "contain",
2287
+ WebkitMaskSize: "contain",
2288
+ maskPosition: "center",
2289
+ WebkitMaskPosition: "center"
2290
+ });
2291
+ });
2292
+ return (a, g) => (x(), D("div", Lr, [
2293
+ (x(!0), D(E, null, se(c.value, (d, h) => (x(), D("div", {
2294
+ key: h,
2295
+ class: "symbol",
2296
+ style: F(l.value(h, d))
2297
+ }, null, 4))), 128))
2298
+ ]));
2299
+ }
2300
+ }), Nr = /* @__PURE__ */ ne(Dr, [["__scopeId", "data-v-2bd67863"]]), Hr = /* @__PURE__ */ X({
2301
+ __name: "timeSignature",
2302
+ props: {
2303
+ timeSignature: {
2304
+ type: Object,
2305
+ required: !0
2306
+ },
2307
+ //小节高度, 此属性会控制音符,休止符,谱号,拍号等符号大小
2308
+ measureHeight: {
2309
+ type: Number,
2310
+ default: 60
2311
+ }
2312
+ },
2313
+ setup(e) {
2314
+ const t = e, n = S(() => ({
2315
+ fontSize: t.measureHeight / 3 + "px",
2316
+ userSelect: "none",
2317
+ color: t.timeSignature.options.highlight ? t.timeSignature.options.highlightColor : t.timeSignature.options.color
2318
+ }));
2319
+ return (r, o) => e.timeSignature && e.timeSignature.type === Z(b).TimeSignature ? (x(), D("div", {
2320
+ key: 0,
2321
+ class: "timeSignature",
2322
+ style: F(n.value)
2323
+ }, [
2324
+ ue("div", null, Rt(e.timeSignature.timeSignature.beat), 1),
2325
+ ue("div", null, Rt(e.timeSignature.timeSignature.chronaxie), 1)
2326
+ ], 4)) : Ce("", !0);
2327
+ }
2328
+ }), Rr = /* @__PURE__ */ ne(Hr, [["__scopeId", "data-v-08c2b53d"]]);
2329
+ function Ye(e, t, n) {
2330
+ const r = O(e.index, t);
2331
+ if (r.singleStaff == null)
2332
+ return console.error("没有单谱表信息,无法计算小节left"), 0;
2333
+ let o = 0;
2334
+ for (let i of r.singleStaff.measureArray) {
2335
+ if (i === e)
2336
+ return o;
2337
+ o += Me(i, r.singleStaff, t, n);
2338
+ }
2339
+ return o;
2340
+ }
2341
+ function Sn(e, t, n, r, o, i, s, u, c) {
2342
+ const l = i.measureHeight;
2343
+ if (!n || !r || !o)
2344
+ return console.error("数据索引有误,符尾left计算出错"), 0;
2345
+ const a = We(
2346
+ e,
2347
+ n,
2348
+ r,
2349
+ o,
2350
+ i,
2351
+ c
2352
+ ), g = Qe(t.beamId, r), d = Q[b.NoteStem];
2353
+ if (!("aspectRatio" in d) || typeof d.aspectRatio != "number")
2354
+ return console.error("符杠aspectRatio获取失败,符尾left计算出错"), 0;
2355
+ if (g.length > 1)
2356
+ return t.id === g[0].note.id ? e.direction === "up" ? s : 0 : t.id === g[g.length - 1].note.id ? e.direction === "up" ? -a + s : -a : -it(
2357
+ t,
2358
+ n,
2359
+ r,
2360
+ o,
2361
+ i,
2362
+ s,
2363
+ c
2364
+ );
2365
+ if (e.direction === "up")
2366
+ return s;
2367
+ {
2368
+ const h = Q[b.NoteStem];
2369
+ if (!("aspectRatio" in h) || typeof h.aspectRatio != "number")
2370
+ return console.error("符杠aspectRatio获取失败,符杠left计算出错"), 0;
2371
+ const y = h.heightMultiplier;
2372
+ return l * y * h.aspectRatio;
2373
+ }
2374
+ }
2375
+ function Nt(e, t, n, r, o, i, s, u, c = !1) {
2376
+ const l = c ? e : Ze(e, o), a = $e(e, o), g = We(
2377
+ e,
2378
+ t,
2379
+ n,
2380
+ r,
2381
+ o,
2382
+ u
2383
+ );
2384
+ switch (e == null ? void 0 : e.type) {
2385
+ case b.NoteHead:
2386
+ return 0;
2387
+ case b.NoteStem:
2388
+ return e.direction === "up" ? a - g : 0;
2389
+ case b.NoteTail:
2390
+ return l.type !== b.NoteHead ? (console.error("找不到音符头,符尾left计算出错"), 0) : Sn(
2391
+ e,
2392
+ l,
2393
+ t,
2394
+ n,
2395
+ r,
2396
+ o,
2397
+ a,
2398
+ s,
2399
+ u
2400
+ );
2401
+ case b.Accidental:
2402
+ return -g;
2403
+ case b.NoteDot: {
2404
+ const d = We(e, t, n, r, o, u);
2405
+ return a / 2 - d / 2;
2406
+ }
2407
+ }
2408
+ return 0;
2409
+ }
2410
+ function it(e, t, n, r, o, i, s, u = !1) {
2411
+ const c = u ? e : Ze(e, o), l = me(t, n, r, o, s);
2412
+ switch (o.measureHeight, c == null ? void 0 : c.type) {
2413
+ case b.NoteHead:
2414
+ return l / 2 - i / 2;
2415
+ case b.NoteNumber:
2416
+ return l / 2 - i / 2;
2417
+ case b.Rest:
2418
+ return l / 2 - i / 2;
2419
+ case b.ChronaxieIncreasingLine:
2420
+ return l / 2 - i / 2;
2421
+ }
2422
+ return 0;
2423
+ }
2424
+ function Ht(e, t, n, r, o) {
2425
+ const i = r.measureHeight;
2426
+ if (!e || !t || !n)
2427
+ return console.error("缺少必要的参数,坐标计算出错"), 0;
2428
+ let s = 0;
2429
+ const u = e.type;
2430
+ if ([Ee.frontFixed].includes(u))
2431
+ s = ae(t, i, "front", e);
2432
+ else if ([Ee.rearFixed].includes(u))
2433
+ s = o - ae(t, i) + ae(t, i, "all", e);
2434
+ else {
2435
+ const c = ae(t, i), l = Ie(t), a = Ie(t, e), g = ae(t, i, "front");
2436
+ s = (o - c) / l * a + g;
2437
+ }
2438
+ return s;
2439
+ }
2440
+ function bt(e, t, n, r, o, i, s, u, c = !1) {
2441
+ const l = c ? e : Ze(e, o), a = it(
2442
+ l,
2443
+ t,
2444
+ n,
2445
+ r,
2446
+ o,
2447
+ i,
2448
+ u
2449
+ ), g = Ht(
2450
+ t,
2451
+ n,
2452
+ r,
2453
+ o,
2454
+ s
2455
+ );
2456
+ return a + g;
2457
+ }
2458
+ const yo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2459
+ __proto__: null,
2460
+ getContainerLeftToMeasure: Ht,
2461
+ getMeasureLeftToMusicScore: Ye,
2462
+ getMsSymbolLeftToSlot: Nt,
2463
+ getNoteTailLeftToSlot: Sn,
2464
+ getSlotLeftToContainer: it,
2465
+ getSlotLeftToMeasure: bt
2466
+ }, Symbol.toStringTag, { value: "Module" })), jr = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='100'%20height='200'%3e%3c!--%20音符尾%20--%3e%3cpath%20d='%20M%200%200%20L%200%2040%20L%20100%20200%20L%20100%20180%20Z%20'%20fill='black'/%3e%3c/svg%3e", Br = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='100'%20height='200'%3e%3c!--%20音符尾%20--%3e%3cpath%20d='%20M%200%200%20L%200%2040%20L%20100%20120%20L%20100%20100%20M%200%2080%20L%200%20120%20L%20100%20200%20L%20100%20180%20Z%20'%20fill='black'/%3e%3c/svg%3e", Wr = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='100'%20height='200'%3e%3c!--%20音符尾%20--%3e%3cg%3e%3cpath%20d='%20M%200%20200%20L%200%20160%20L%20100%200%20L%20100%200%20Z%20'%20fill='black'/%3e%3c/g%3e%3c/svg%3e", Fr = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='100'%20height='200'%3e%3c!--%20音符尾%20--%3e%3cpath%20d='%20M%200%20200%20L%200%20160%20L%20100%2080%20L%20100%20100%20M%200%20120%20L%200%2080%20L%20100%200%20L%20100%2020%20Z%20'%20fill='black'/%3e%3c/svg%3e", Tr = /* @__PURE__ */ X({
2467
+ __name: "noteTail",
2468
+ props: {
2469
+ noteTail: {
2470
+ type: Object,
2471
+ required: !0
2472
+ },
2473
+ // 不知道这里是否有问题,外部使用了as进行了强转,定性了符杠的父符号只能是符头
2474
+ noteHead: {
2475
+ type: Object,
2476
+ required: !0
2477
+ },
2478
+ preContainer: {
2479
+ type: Object,
2480
+ required: !0
2481
+ },
2482
+ nextContainer: {
2483
+ type: Object,
2484
+ required: !0
2485
+ },
2486
+ msSymbolContainer: {
2487
+ type: Object,
2488
+ required: !0
2489
+ },
2490
+ measure: {
2491
+ type: Object,
2492
+ required: !0
2493
+ },
2494
+ singleStaff: {
2495
+ type: Object,
2496
+ required: !0
2497
+ },
2498
+ musicScore: {
2499
+ type: Object,
2500
+ required: !0
2501
+ },
2502
+ parentMsSymbol: {
2503
+ type: Object
2504
+ },
2505
+ slotLeft: {
2506
+ type: Number,
2507
+ required: !0
2508
+ },
2509
+ measureWidth: {
2510
+ type: Number,
2511
+ required: !0
2512
+ },
2513
+ componentWidth: {
2514
+ type: Number,
2515
+ required: !0
2516
+ }
2517
+ },
2518
+ setup(e) {
2519
+ const t = e, n = S(() => Qe(t.noteHead.beamId, t.measure));
2520
+ S(() => Ae(t.noteTail));
2521
+ const r = S(() => {
2522
+ var a;
2523
+ switch ((a = t.noteTail) == null ? void 0 : a.chronaxie) {
2524
+ case R.eighth:
2525
+ return 1;
2526
+ case R.sixteenth:
2527
+ return 2;
2528
+ }
2529
+ return 0;
2530
+ }), o = S(() => ee(t.noteTail, t.musicScore)), i = S(() => t.noteTail.type === b.NoteTail && t.nextContainer ? Dt(
2531
+ t.noteTail,
2532
+ t.noteHead,
2533
+ t.msSymbolContainer,
2534
+ t.measure,
2535
+ t.singleStaff,
2536
+ t.musicScore,
2537
+ t.componentWidth
2538
+ ) : We(
2539
+ t.noteTail,
2540
+ t.msSymbolContainer,
2541
+ t.measure,
2542
+ t.singleStaff,
2543
+ t.musicScore,
2544
+ t.componentWidth
2545
+ )), s = S(() => {
2546
+ var g;
2547
+ const a = {
2548
+ width: `${i.value}px`,
2549
+ height: `${o.value}px`,
2550
+ display: "flex",
2551
+ flexDirection: ((g = t.noteTail) == null ? void 0 : g.direction) === "up" ? "column" : "column-reverse",
2552
+ position: "absolute",
2553
+ left: u.value + "px",
2554
+ bottom: c.value + "px",
2555
+ background: t.noteTail.options.highlight ? t.noteTail.options.highlightColor : t.noteTail.options.color
2556
+ };
2557
+ return l.value && n.value.length < 2 ? a.mask = `url("${l.value}") center center / cover no-repeat` : a.background = "transparent", a;
2558
+ }), u = S(() => Nt(
2559
+ t.noteTail,
2560
+ t.msSymbolContainer,
2561
+ t.measure,
2562
+ t.singleStaff,
2563
+ t.musicScore,
2564
+ t.slotLeft,
2565
+ t.measureWidth,
2566
+ t.componentWidth
2567
+ )), c = S(() => Lt(t.noteTail, t.musicScore)), l = S(() => {
2568
+ const a = O(t.noteTail.index, t.musicScore).msSymbol;
2569
+ if (a && "chronaxie" in a && K(a.region) <= 3)
2570
+ switch (t.noteTail.chronaxie) {
2571
+ case R.eighth:
2572
+ return jr;
2573
+ case R.sixteenth:
2574
+ return Br;
2575
+ default:
2576
+ return "";
2577
+ }
2578
+ else
2579
+ switch (t.noteTail.chronaxie) {
2580
+ case R.eighth:
2581
+ return Wr;
2582
+ case R.sixteenth:
2583
+ return Fr;
2584
+ default:
2585
+ return "";
2586
+ }
2587
+ });
2588
+ return (a, g) => (x(), D("div", {
2589
+ style: F(s.value)
2590
+ }, [
2591
+ n.value.length > 1 ? (x(!0), D(E, { key: 0 }, se(r.value * 2 - 1, (d, h) => (x(), D("div", {
2592
+ style: F({ backgroundColor: h % 2 === 0 ? "black" : "transparent", height: o.value / 5 + "px", width: "100%" })
2593
+ }, null, 4))), 256)) : Ce("", !0)
2594
+ ], 4));
2595
+ }
2596
+ }), Or = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='100'%20height='10'%3e%3cline%20x1='0'%20y1='5'%20x2='100'%20y2='5'%20stroke='black'%20stroke-width='10'%3e%3c/line%3e%3c/svg%3e", Gr = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='100'%20height='10'%3e%3cline%20x1='0'%20y1='5'%20x2='100'%20y2='5'%20stroke='black'%20stroke-width='10'%3e%3c/line%3e%3c/svg%3e", Pr = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='100'%20height='30'%3e%3cline%20x1='0'%20y1='5'%20x2='100'%20y2='5'%20stroke='black'%20stroke-width='10'%3e%3c/line%3e%3cline%20x1='0'%20y1='25'%20x2='100'%20y2='25'%20stroke='black'%20stroke-width='10'%3e%3c/line%3e%3c/svg%3e", zr = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='100'%20height='50'%3e%3cline%20x1='0'%20y1='5'%20x2='100'%20y2='5'%20stroke='black'%20stroke-width='10'%3e%3c/line%3e%3cline%20x1='0'%20y1='25'%20x2='100'%20y2='25'%20stroke='black'%20stroke-width='10'%3e%3c/line%3e%3cline%20x1='0'%20y1='45'%20x2='100'%20y2='45'%20stroke='black'%20stroke-width='10'%3e%3c/line%3e%3c/svg%3e", qr = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='100'%20height='70'%3e%3cline%20x1='0'%20y1='5'%20x2='100'%20y2='5'%20stroke='black'%20stroke-width='10'%3e%3c/line%3e%3cline%20x1='0'%20y1='25'%20x2='100'%20y2='25'%20stroke='black'%20stroke-width='10'%3e%3c/line%3e%3cline%20x1='0'%20y1='45'%20x2='100'%20y2='45'%20stroke='black'%20stroke-width='10'%3e%3c/line%3e%3cline%20x1='0'%20y1='65'%20x2='100'%20y2='65'%20stroke='black'%20stroke-width='10'%3e%3c/line%3e%3c/svg%3e", Ur = /* @__PURE__ */ X({
2597
+ __name: "msSymbol",
2598
+ props: {
2599
+ msSymbol: {
2600
+ type: Object,
2601
+ required: !0
2602
+ },
2603
+ msSymbolContainer: {
2604
+ type: Object,
2605
+ required: !0
2606
+ },
2607
+ preContainer: {
2608
+ type: Object,
2609
+ required: !0
2610
+ },
2611
+ nextContainer: {
2612
+ type: Object,
2613
+ required: !0
2614
+ },
2615
+ measure: {
2616
+ type: Object,
2617
+ required: !0
2618
+ },
2619
+ measureWidth: {
2620
+ type: Number,
2621
+ required: !0
2622
+ },
2623
+ singleStaff: {
2624
+ type: Object,
2625
+ required: !0
2626
+ },
2627
+ musicScore: {
2628
+ type: Object,
2629
+ required: !0
2630
+ },
2631
+ containerWidth: {
2632
+ type: Number,
2633
+ required: !0
2634
+ },
2635
+ isMain: {
2636
+ type: Boolean,
2637
+ default: !1
2638
+ },
2639
+ //小节高度, 此属性会控制音符,休止符,谱号,拍号等符号大小
2640
+ measureHeight: {
2641
+ type: Number,
2642
+ required: !0
2643
+ },
2644
+ parentMsSymbol: {
2645
+ type: Object
2646
+ },
2647
+ // 符号槽位宽度(父级符号宽度)
2648
+ slotWidth: {
2649
+ type: Number,
2650
+ required: !0
2651
+ },
2652
+ slotBottom: {
2653
+ type: Number,
2654
+ required: !0
2655
+ },
2656
+ slotLeft: {
2657
+ type: Number,
2658
+ required: !0
2659
+ },
2660
+ componentWidth: {
2661
+ type: Number,
2662
+ required: !0
2663
+ },
2664
+ componentHeight: {
2665
+ type: Number,
2666
+ required: !0
2667
+ }
2668
+ },
2669
+ emits: ["msSymbolMouseDown", "msSymbolMouseUp"],
2670
+ setup(e, { expose: t, emit: n }) {
2671
+ const r = e;
2672
+ An(() => {
2673
+ var k;
2674
+ return (k = r.msSymbol) == null ? void 0 : k.vueKey;
2675
+ }, () => {
2676
+ o();
2677
+ });
2678
+ function o() {
2679
+ var k, I, N, A, j, B, te;
2680
+ switch ((k = r.msSymbol) == null ? void 0 : k.type) {
2681
+ case b.NoteHead:
2682
+ switch ((I = r.msSymbol) == null ? void 0 : I.chronaxie) {
2683
+ case R.whole:
2684
+ return bn;
2685
+ case R.half:
2686
+ return gr;
2687
+ case R.quarter:
2688
+ return zt;
2689
+ default:
2690
+ return zt;
2691
+ }
2692
+ case b.Rest:
2693
+ switch ((N = r.msSymbol) == null ? void 0 : N.chronaxie) {
2694
+ case R.whole:
2695
+ return lt;
2696
+ case R.half:
2697
+ return Sr;
2698
+ case R.quarter:
2699
+ return Zt;
2700
+ case R.eighth:
2701
+ return vr;
2702
+ case R.sixteenth:
2703
+ return xr;
2704
+ case R.thirtySecond:
2705
+ return lt;
2706
+ case R.sixtyFourth:
2707
+ return lt;
2708
+ default:
2709
+ return Zt;
2710
+ }
2711
+ case b.NoteStem:
2712
+ return wr;
2713
+ case b.NoteTail:
2714
+ return "";
2715
+ case b.Clef:
2716
+ return "";
2717
+ case b.Clef_f:
2718
+ return "";
2719
+ case b.BarLine: {
2720
+ switch ((A = r.msSymbol) == null ? void 0 : A.barLineType) {
2721
+ case oe.single:
2722
+ return Qt;
2723
+ case oe.final:
2724
+ return Xt;
2725
+ case oe.reverseFinal:
2726
+ return Kt;
2727
+ case oe.startRepeatSign:
2728
+ return Jt;
2729
+ case oe.endRepeatSign:
2730
+ return _t;
2731
+ }
2732
+ return "";
2733
+ }
2734
+ case b.BarLine_f: {
2735
+ switch ((j = r.msSymbol) == null ? void 0 : j.barLineType) {
2736
+ case oe.single:
2737
+ return Qt;
2738
+ case oe.final:
2739
+ return Xt;
2740
+ case oe.reverseFinal:
2741
+ return Kt;
2742
+ case oe.startRepeatSign:
2743
+ return Jt;
2744
+ case oe.endRepeatSign:
2745
+ return _t;
2746
+ }
2747
+ return console.error("未知的小节线类型", r.msSymbol), "";
2748
+ }
2749
+ case b.KeySignature:
2750
+ return "";
2751
+ case b.TimeSignature:
2752
+ return "";
2753
+ case b.Accidental: {
2754
+ switch ((B = r.msSymbol) == null ? void 0 : B.accidental) {
2755
+ case He.Sharp:
2756
+ return yt;
2757
+ case He.Flat:
2758
+ return pt;
2759
+ case He.Natural:
2760
+ return Ir;
2761
+ case He.DoubleSharp:
2762
+ return yt;
2763
+ case He.DoubleFlat:
2764
+ return pt;
2765
+ }
2766
+ return console.error("未知的变音符号", r.msSymbol), "";
2767
+ }
2768
+ case b.NoteNumber:
2769
+ switch ((te = r.msSymbol) == null ? void 0 : te.solmization) {
2770
+ case Se.DO:
2771
+ return qt;
2772
+ case Se.RE:
2773
+ return dr;
2774
+ case Se.MI:
2775
+ return mr;
2776
+ case Se.FA:
2777
+ return fr;
2778
+ case Se.SOL:
2779
+ return hr;
2780
+ case Se.LA:
2781
+ return yr;
2782
+ case Se.TI:
2783
+ return pr;
2784
+ default:
2785
+ return qt;
2786
+ }
2787
+ case b.NoteDot:
2788
+ switch (r.msSymbol.octave) {
2789
+ case 1:
2790
+ return $t;
2791
+ case 2:
2792
+ return Vt;
2793
+ case 3:
2794
+ return Ut;
2795
+ case 5:
2796
+ return Ut;
2797
+ case 6:
2798
+ return Vt;
2799
+ case 7:
2800
+ return br;
2801
+ case 8:
2802
+ return $t;
2803
+ default:
2804
+ return "";
2805
+ }
2806
+ case b.ChronaxieReducingLine:
2807
+ switch (r.msSymbol.chronaxie) {
2808
+ case R.eighth:
2809
+ return Gr;
2810
+ case R.sixteenth:
2811
+ return Pr;
2812
+ case R.thirtySecond:
2813
+ return zr;
2814
+ case R.sixtyFourth:
2815
+ return qr;
2816
+ default:
2817
+ return "";
2818
+ }
2819
+ case b.ChronaxieIncreasingLine:
2820
+ return Or;
2821
+ default:
2822
+ return console.error("未知的符号类别", r.msSymbol), "";
2823
+ }
2824
+ }
2825
+ const i = S(() => o()), s = ie(null), u = S(() => Ae(r.msSymbol)), c = S(() => ee(r.msSymbol, r.musicScore)), l = S(() => We(
2826
+ r.msSymbol,
2827
+ r.msSymbolContainer,
2828
+ r.measure,
2829
+ r.singleStaff,
2830
+ r.musicScore,
2831
+ r.componentWidth
2832
+ )), a = S(() => Nt(r.msSymbol, r.msSymbolContainer, r.measure, r.singleStaff, r.musicScore, r.slotLeft, r.measureWidth, r.componentWidth)), g = S(() => Lt(r.msSymbol, r.musicScore)), d = S(() => {
2833
+ var I;
2834
+ const k = {
2835
+ width: `${l.value}px`,
2836
+ height: `${c.value}px`,
2837
+ position: "absolute",
2838
+ pointerEvents: "auto",
2839
+ left: a.value + "px",
2840
+ bottom: g.value + "px",
2841
+ background: r.msSymbol.options.highlight ? r.msSymbol.options.highlightColor : r.msSymbol.options.color
2842
+ };
2843
+ return (I = r.msSymbol) != null && I.type && [
2844
+ b.KeySignature,
2845
+ b.TimeSignature,
2846
+ b.NoteTail
2847
+ ].includes(r.msSymbol.type) && (k.background = "unset"), i.value && (k.mask = `url("${i.value}") no-repeat center`, k["mask-size"] = "100% 100%"), k;
2848
+ }), h = n;
2849
+ function y(k) {
2850
+ h("msSymbolMouseDown", k, r.msSymbol);
2851
+ }
2852
+ function v(k) {
2853
+ h("msSymbolMouseUp", k, r.msSymbol);
2854
+ }
2855
+ return St(() => {
2856
+ }), t({ aspectRatio: u }), (k, I) => {
2857
+ var N, A, j, B, te, ye;
2858
+ return ((N = e.msSymbol) == null ? void 0 : N.type) === Z(b).Clef || ((A = e.msSymbol) == null ? void 0 : A.type) === Z(b).Clef_f && "clef" in e.msSymbol ? De((x(), J(kr, {
2859
+ key: 0,
2860
+ clef: e.msSymbol,
2861
+ onMouseup: $(v, ["self"]),
2862
+ onMousedown: $(y, ["self"]),
2863
+ musicScore: e.musicScore,
2864
+ style: F(d.value)
2865
+ }, null, 8, ["clef", "musicScore", "style"])), [
2866
+ [Ne, e.musicScore.showMode === Z(ce).standardStaff]
2867
+ ]) : ((j = e.msSymbol) == null ? void 0 : j.type) === Z(b).KeySignature ? De((x(), J(Nr, {
2868
+ key: 1,
2869
+ "measure-height": e.measureHeight,
2870
+ slotWidth: e.slotWidth,
2871
+ onMouseup: $(v, ["self"]),
2872
+ onMousedown: $(y, ["self"]),
2873
+ musicScore: e.musicScore,
2874
+ style: F(d.value),
2875
+ keySignature: e.msSymbol
2876
+ }, null, 8, ["measure-height", "slotWidth", "musicScore", "style", "keySignature"])), [
2877
+ [Ne, e.musicScore.showMode === Z(ce).standardStaff]
2878
+ ]) : ((B = e.msSymbol) == null ? void 0 : B.type) === Z(b).TimeSignature ? De((x(), J(Rr, {
2879
+ key: 2,
2880
+ style: F(d.value),
2881
+ onMouseup: $(v, ["self"]),
2882
+ onMousedown: $(y, ["self"]),
2883
+ "time-signature": e.msSymbol,
2884
+ "measure-height": e.measureHeight
2885
+ }, null, 8, ["style", "time-signature", "measure-height"])), [
2886
+ [Ne, e.musicScore.showMode === Z(ce).standardStaff]
2887
+ ]) : ((te = e.msSymbol) == null ? void 0 : te.type) === Z(b).NoteTail ? De((x(), J(Tr, {
2888
+ key: 3,
2889
+ "ms-symbol-container": e.msSymbolContainer,
2890
+ "pre-container": e.preContainer,
2891
+ "next-container": e.nextContainer,
2892
+ "measure-width": e.measureWidth,
2893
+ "single-staff": e.singleStaff,
2894
+ "slot-left": e.slotLeft,
2895
+ "component-width": e.componentWidth,
2896
+ noteTail: e.msSymbol,
2897
+ noteHead: e.parentMsSymbol,
2898
+ measure: e.measure,
2899
+ musicScore: e.musicScore
2900
+ }, null, 8, ["ms-symbol-container", "pre-container", "next-container", "measure-width", "single-staff", "slot-left", "component-width", "noteTail", "noteHead", "measure", "musicScore"])), [
2901
+ [Ne, e.musicScore.showMode === Z(ce).standardStaff]
2902
+ ]) : ((ye = e.msSymbol) == null ? void 0 : ye.type) === Z(b).NoteStem ? De((x(), D("div", {
2903
+ key: 4,
2904
+ ref_key: "msSymbolRef",
2905
+ ref: s,
2906
+ class: "msSymbol",
2907
+ style: F(d.value),
2908
+ onMouseup: $(v, ["self"]),
2909
+ onMousedown: $(y, ["self"])
2910
+ }, null, 36)), [
2911
+ [Ne, e.musicScore.showMode === Z(ce).standardStaff]
2912
+ ]) : (x(), D("div", {
2913
+ key: 5,
2914
+ ref_key: "msSymbolRef",
2915
+ ref: s,
2916
+ class: "msSymbol",
2917
+ style: F(d.value),
2918
+ onMouseup: $(v, ["self"]),
2919
+ onMousedown: $(y, ["self"])
2920
+ }, null, 36));
2921
+ };
2922
+ }
2923
+ }), Yt = /* @__PURE__ */ ne(Ur, [["__scopeId", "data-v-5b6eb544"]]), Vr = /* @__PURE__ */ X({
2924
+ __name: "msSymbolSlot",
2925
+ props: {
2926
+ msSymbol: {
2927
+ type: Object,
2928
+ required: !0
2929
+ },
2930
+ msSymbolContainer: {
2931
+ type: Object,
2932
+ required: !0
2933
+ },
2934
+ preContainer: {
2935
+ type: Object,
2936
+ required: !0
2937
+ },
2938
+ nextContainer: {
2939
+ type: Object,
2940
+ required: !0
2941
+ },
2942
+ containerWidth: {
2943
+ type: Number,
2944
+ default: 60,
2945
+ required: !0
2946
+ },
2947
+ //小节高度, 此属性会控制音符,休止符,谱号,拍号等符号大小
2948
+ measureHeight: {
2949
+ type: Number,
2950
+ default: 60,
2951
+ required: !0
2952
+ },
2953
+ measure: {
2954
+ type: Object,
2955
+ required: !0
2956
+ },
2957
+ measureWidth: {
2958
+ type: Number,
2959
+ default: 200,
2960
+ required: !0
2961
+ },
2962
+ componentWidth: {
2963
+ type: Number,
2964
+ default: 1e3
2965
+ },
2966
+ componentHeight: {
2967
+ type: Number,
2968
+ default: 800
2969
+ },
2970
+ singleStaff: {
2971
+ type: Object,
2972
+ required: !0
2973
+ },
2974
+ multipleStaves: {
2975
+ type: Object,
2976
+ required: !0
2977
+ },
2978
+ musicScore: {
2979
+ type: Object,
2980
+ default: {}
2981
+ }
2982
+ },
2983
+ emits: ["msSymbolMouseDown", "msSymbolMouseUp"],
2984
+ setup(e, { emit: t }) {
2985
+ const n = e, r = S(() => !n.msSymbol || !n.measure || !n.singleStaff ? (console.error("缺少必要的参数,坐标计算出错"), {}) : {
2986
+ left: i.value + "px",
2987
+ height: n.measureHeight + "px",
2988
+ width: o.value + "px",
2989
+ bottom: s.value + "px",
2990
+ pointEvents: " none"
2991
+ });
2992
+ S(() => Ae(n.msSymbol)), S(() => ee(n.msSymbol, n.musicScore));
2993
+ const o = S(() => $e(n.msSymbol, n.musicScore)), i = S(() => it(
2994
+ n.msSymbol,
2995
+ n.msSymbolContainer,
2996
+ n.measure,
2997
+ n.singleStaff,
2998
+ n.musicScore,
2999
+ o.value,
3000
+ n.componentWidth
3001
+ )), s = S(() => de(n.msSymbol, n.musicScore)), u = t;
3002
+ return (c, l) => {
3003
+ var a;
3004
+ return x(), D("div", {
3005
+ class: "msSymbolSlot p-stackItem",
3006
+ style: F(r.value)
3007
+ }, [
3008
+ e.msSymbol ? (x(), J(Yt, {
3009
+ key: 0,
3010
+ ref: "mainMsSymbolRef",
3011
+ measureHeight: e.measureHeight,
3012
+ msSymbolContainer: n.msSymbolContainer,
3013
+ preContainer: n.preContainer,
3014
+ nextContainer: n.nextContainer,
3015
+ "slot-width": o.value,
3016
+ slotBottom: s.value,
3017
+ "slot-left": i.value,
3018
+ containerWidth: e.containerWidth,
3019
+ "measure-width": e.measureWidth,
3020
+ isMain: !0,
3021
+ componentWidth: e.componentWidth,
3022
+ componentHeight: e.componentHeight,
3023
+ measure: e.measure,
3024
+ "single-staff": e.singleStaff,
3025
+ musicScore: n.musicScore,
3026
+ onMsSymbolMouseDown: l[0] || (l[0] = (g, d) => u("msSymbolMouseDown", g, d)),
3027
+ onMsSymbolMouseUp: l[1] || (l[1] = (g, d) => u("msSymbolMouseUp", g, d)),
3028
+ "ms-symbol": e.msSymbol
3029
+ }, null, 8, ["measureHeight", "msSymbolContainer", "preContainer", "nextContainer", "slot-width", "slotBottom", "slot-left", "containerWidth", "measure-width", "componentWidth", "componentHeight", "measure", "single-staff", "musicScore", "ms-symbol"])) : Ce("", !0),
3030
+ (a = e.msSymbol) != null && a.msSymbolArray ? (x(!0), D(E, { key: 1 }, se(e.msSymbol.msSymbolArray, (g) => (x(), J(Yt, {
3031
+ measureHeight: e.measureHeight,
3032
+ msSymbolContainer: n.msSymbolContainer,
3033
+ preContainer: n.preContainer,
3034
+ nextContainer: n.nextContainer,
3035
+ containerWidth: e.containerWidth,
3036
+ "measure-width": e.measureWidth,
3037
+ isMain: !1,
3038
+ slotBottom: s.value,
3039
+ measure: e.measure,
3040
+ "single-staff": e.singleStaff,
3041
+ "slot-width": o.value,
3042
+ "slot-left": i.value,
3043
+ "parent-ms-symbol": e.msSymbol,
3044
+ componentWidth: e.componentWidth,
3045
+ onMsSymbolMouseDown: l[2] || (l[2] = (d, h) => u("msSymbolMouseDown", d, h)),
3046
+ onMsSymbolMouseUp: l[3] || (l[3] = (d, h) => u("msSymbolMouseUp", d, h)),
3047
+ componentHeight: e.componentHeight,
3048
+ musicScore: n.musicScore,
3049
+ "ms-symbol": g
3050
+ }, null, 8, ["measureHeight", "msSymbolContainer", "preContainer", "nextContainer", "containerWidth", "measure-width", "slotBottom", "measure", "single-staff", "slot-width", "slot-left", "parent-ms-symbol", "componentWidth", "componentHeight", "musicScore", "ms-symbol"]))), 256)) : Ce("", !0)
3051
+ ], 4);
3052
+ };
3053
+ }
3054
+ }), $r = /* @__PURE__ */ ne(Vr, [["__scopeId", "data-v-501cb6ae"]]), Zr = /* @__PURE__ */ X({
3055
+ __name: "msSymbolContainer",
3056
+ props: {
3057
+ msSymbolContainer: {
3058
+ type: Object,
3059
+ required: !0
3060
+ },
3061
+ preContainer: {
3062
+ type: Object,
3063
+ required: !0
3064
+ },
3065
+ nextContainer: {
3066
+ type: Object,
3067
+ required: !0
3068
+ },
3069
+ measureHeight: {
3070
+ type: Number,
3071
+ required: !0
3072
+ },
3073
+ measure: {
3074
+ type: Object,
3075
+ required: !0
3076
+ },
3077
+ measureWidth: {
3078
+ type: Number,
3079
+ required: !0
3080
+ },
3081
+ componentWidth: {
3082
+ type: Number,
3083
+ required: !0
3084
+ },
3085
+ componentHeight: {
3086
+ type: Number,
3087
+ required: !0
3088
+ },
3089
+ singleStaff: {
3090
+ type: Object,
3091
+ required: !0
3092
+ },
3093
+ multipleStaves: {
3094
+ type: Object,
3095
+ required: !0
3096
+ },
3097
+ musicScore: {
3098
+ type: Object,
3099
+ required: !0
3100
+ // 改为必须传入,移除 default: {}
3101
+ }
3102
+ },
3103
+ emits: ["msSymbolMouseDown", "msSymbolMouseUp"],
3104
+ setup(e, { emit: t }) {
3105
+ const n = e, r = S(() => !n.msSymbolContainer || !n.measure || !n.singleStaff ? (console.error("缺少必要的参数,坐标计算出错"), {}) : {
3106
+ left: i.value + "px",
3107
+ height: n.measureHeight + "px",
3108
+ width: o.value + "px",
3109
+ bottom: "0px",
3110
+ pointerEvents: "none"
3111
+ }), o = S(() => me(n.msSymbolContainer, n.measure, n.singleStaff, n.musicScore, n.componentWidth)), i = S(() => Ht(n.msSymbolContainer, n.measure, n.singleStaff, n.musicScore, n.measureWidth)), s = t;
3112
+ return (u, c) => {
3113
+ var l;
3114
+ return x(), D("div", {
3115
+ class: "msSymbolContainer",
3116
+ style: F(r.value)
3117
+ }, [
3118
+ (x(!0), D(E, null, se((l = e.msSymbolContainer) == null ? void 0 : l.msSymbolArray, (a) => (x(), J($r, {
3119
+ msSymbol: a,
3120
+ msSymbolContainer: n.msSymbolContainer,
3121
+ preContainer: n.preContainer,
3122
+ nextContainer: n.nextContainer,
3123
+ measure: n.measure,
3124
+ measureWidth: n.measureWidth,
3125
+ singleStaff: n.singleStaff,
3126
+ containerWidth: o.value,
3127
+ componentWidth: e.componentWidth,
3128
+ componentHeight: e.componentHeight,
3129
+ onMsSymbolMouseDown: (g, d) => s("msSymbolMouseDown", g, d),
3130
+ onMsSymbolMouseUp: (g, d) => s("msSymbolMouseUp", g, d),
3131
+ multipleStaves: n.multipleStaves,
3132
+ musicScore: n.musicScore,
3133
+ measureHeight: n.measureHeight
3134
+ }, null, 8, ["msSymbol", "msSymbolContainer", "preContainer", "nextContainer", "measure", "measureWidth", "singleStaff", "containerWidth", "componentWidth", "componentHeight", "onMsSymbolMouseDown", "onMsSymbolMouseUp", "multipleStaves", "musicScore", "measureHeight"]))), 256))
3135
+ ], 4);
3136
+ };
3137
+ }
3138
+ }), Qr = /* @__PURE__ */ ne(Zr, [["__scopeId", "data-v-a10cc562"]]), Xr = /* @__PURE__ */ X({
3139
+ __name: "rectDragShell",
3140
+ props: {
3141
+ rect: {
3142
+ required: !0,
3143
+ type: Object
3144
+ }
3145
+ },
3146
+ setup(e) {
3147
+ const t = e, n = ie({
3148
+ left: t.rect.left,
3149
+ top: t.rect.top,
3150
+ width: t.rect.width,
3151
+ height: t.rect.height
3152
+ }), r = ie(!1), o = ie(null);
3153
+ function i(c, l) {
3154
+ l.stopPropagation(), l.preventDefault(), r.value = !0, o.value = c, window.addEventListener("mousemove", s), window.addEventListener("mouseup", u);
3155
+ }
3156
+ function s(c) {
3157
+ if (!r.value || !o.value) return;
3158
+ const { clientX: l, clientY: a } = c;
3159
+ switch (o.value) {
3160
+ case "tl":
3161
+ n.value.width += n.value.left - l, n.value.height += n.value.top - a, n.value.left = l, n.value.top = a;
3162
+ break;
3163
+ case "tr":
3164
+ n.value.width = l - n.value.left, n.value.height += n.value.top - a, n.value.top = a;
3165
+ break;
3166
+ case "bl":
3167
+ n.value.width += n.value.left - l, n.value.left = l, n.value.height = a - n.value.top;
3168
+ break;
3169
+ case "br":
3170
+ n.value.width = l - n.value.left, n.value.height = a - n.value.top;
3171
+ break;
3172
+ }
3173
+ }
3174
+ function u() {
3175
+ r.value = !1, o.value = null, window.removeEventListener("mousemove", s), window.removeEventListener("mouseup", u);
3176
+ }
3177
+ return (c, l) => (x(), D("div", {
3178
+ class: "resizable-box",
3179
+ style: F({
3180
+ position: "absolute",
3181
+ left: n.value.left + "px",
3182
+ top: n.value.top + "px",
3183
+ width: n.value.width + "px",
3184
+ height: n.value.height + "px"
3185
+ })
3186
+ }, [
3187
+ _e(c.$slots, "default", {}, void 0, !0),
3188
+ ue("div", {
3189
+ class: "drag-point top-left",
3190
+ onMousedown: l[0] || (l[0] = (a) => i("tl", a))
3191
+ }, null, 32),
3192
+ ue("div", {
3193
+ class: "drag-point top-right",
3194
+ onMousedown: l[1] || (l[1] = (a) => i("tr", a))
3195
+ }, null, 32),
3196
+ ue("div", {
3197
+ class: "drag-point bottom-left",
3198
+ onMousedown: l[2] || (l[2] = (a) => i("bl", a))
3199
+ }, null, 32),
3200
+ ue("div", {
3201
+ class: "drag-point bottom-right",
3202
+ onMousedown: l[3] || (l[3] = (a) => i("br", a))
3203
+ }, null, 32)
3204
+ ], 4));
3205
+ }
3206
+ }), Et = /* @__PURE__ */ ne(Xr, [["__scopeId", "data-v-5a499cb9"]]), Kr = /* @__PURE__ */ X({
3207
+ __name: "volta",
3208
+ props: {
3209
+ volta: {
3210
+ type: Object,
3211
+ required: !0
3212
+ }
3213
+ },
3214
+ setup(e) {
3215
+ const t = S(() => ({
3216
+ width: "100%",
3217
+ height: "100%"
3218
+ }));
3219
+ return (n, r) => (x(), D("div", {
3220
+ class: "volta",
3221
+ style: F(t.value)
3222
+ }, r[0] || (r[0] = [
3223
+ ue("div", null, "1,2,3", -1)
3224
+ ]), 4));
3225
+ }
3226
+ }), Jr = /* @__PURE__ */ ne(Kr, [["__scopeId", "data-v-71eea7f6"]]), _r = { class: "slur" }, Yr = {
3227
+ class: "slur-svg",
3228
+ viewBox: "0 0 100 100",
3229
+ preserveAspectRatio: "none"
3230
+ }, Er = ["d"], eo = /* @__PURE__ */ X({
3231
+ __name: "slur",
3232
+ props: {
3233
+ slur: {
3234
+ type: Object,
3235
+ required: !0
3236
+ }
3237
+ },
3238
+ setup(e) {
3239
+ const t = S(() => `
3240
+ M 0,50
3241
+ Q 50,-30 100,50
3242
+ Q 50,0 0,50
3243
+ Z
3244
+ `.trim());
3245
+ return (n, r) => (x(), D("div", _r, [
3246
+ (x(), D("svg", Yr, [
3247
+ ue("path", {
3248
+ class: "slur-path",
3249
+ d: t.value
3250
+ }, null, 8, Er)
3251
+ ]))
3252
+ ]));
3253
+ }
3254
+ }), to = /* @__PURE__ */ ne(eo, [["__scopeId", "data-v-45a54060"]]), no = /* @__PURE__ */ X({
3255
+ __name: "spanSymbol",
3256
+ props: {
3257
+ spanSymbol: {
3258
+ type: Object,
3259
+ required: !0
3260
+ },
3261
+ musicScore: {
3262
+ type: Object,
3263
+ default: {}
3264
+ },
3265
+ componentWidth: {
3266
+ type: Number,
3267
+ default: 1e3
3268
+ },
3269
+ componentHeight: {
3270
+ type: Number,
3271
+ default: 800
3272
+ }
3273
+ },
3274
+ emits: ["spanSymbolMouseDown", "spanSymbolMouseUp"],
3275
+ setup(e, { emit: t }) {
3276
+ const n = e;
3277
+ en("msState");
3278
+ function r(l, a, g, d) {
3279
+ const h = {
3280
+ width: 0,
3281
+ left: 0,
3282
+ top: 0,
3283
+ height: 0
3284
+ }, y = Je(l.startTargetId, a.map), v = Je(l.endTargetId, a.map);
3285
+ if (!y || !v) return console.error("获取不到绑定元素", y, v);
3286
+ if (y.msTypeName !== ge.Measure || v.msTypeName !== ge.Measure) return console.error("volta绑定元素错误");
3287
+ if (y.index.multipleStavesIndex !== v.index.multipleStavesIndex) {
3288
+ console.error("反复符号绑定小节有误");
3289
+ return;
3290
+ }
3291
+ h.left = Ye(y, a, g), Fn(y.index, v.index, a, (k, I, N) => {
3292
+ h.width += Me(k, I, a, g);
3293
+ const A = ht(k, a, d), j = nt(k, a), B = a.measureHeight;
3294
+ h.top = d - Math.max(a.measureHeight + A, j + A + B);
3295
+ }), h.height = n.musicScore.measureHeight, l.rect = h;
3296
+ }
3297
+ function o(l, a, g, d) {
3298
+ const h = {
3299
+ width: 0,
3300
+ left: 0,
3301
+ top: 0,
3302
+ height: 0
3303
+ }, y = Je(l.startTargetId, a.map), v = Je(l.endTargetId, a.map);
3304
+ if (!y || !v) return console.error("获取不到绑定元素", y, v);
3305
+ if (y.msTypeName !== ge.MsSymbol || v.msTypeName !== ge.MsSymbol) return console.error("volta绑定元素错误");
3306
+ if (y.index.multipleStavesIndex !== v.index.multipleStavesIndex) {
3307
+ console.error("反复符号绑定小节有误");
3308
+ return;
3309
+ }
3310
+ const k = a.measureHeight, I = O(y.index, a), N = I.msSymbolContainer, A = I.measure, j = I.singleStaff;
3311
+ if (!N || !A || !j) {
3312
+ console.error("索引数据出错,连音线rect计算失败");
3313
+ return;
3314
+ }
3315
+ const B = $e(y, a, !0), te = Me(A, j, a, g), ye = bt(
3316
+ y,
3317
+ N,
3318
+ A,
3319
+ j,
3320
+ a,
3321
+ B,
3322
+ te,
3323
+ g
3324
+ ), Xe = Ye(A, a, g), ke = ht(A, a, d), at = nt(A, a), Te = O(v.index, a), Ke = Te.msSymbolContainer, Le = Te.measure, Oe = Te.singleStaff;
3325
+ if (!Ke || !Le || !Oe) {
3326
+ console.error("索引数据出错,连音线rect计算失败");
3327
+ return;
3328
+ }
3329
+ const M = $e(v, a, !0), W = Me(Le, Oe, a, g), T = bt(
3330
+ v,
3331
+ Ke,
3332
+ Le,
3333
+ Oe,
3334
+ a,
3335
+ M,
3336
+ W,
3337
+ g
3338
+ ), le = Ye(Le, a, g), _ = Xe + ye + B / 2, pe = le + T + M / 2;
3339
+ h.left = _, h.top = d - Math.max(a.measureHeight + ke, at + ke + k), h.width = pe - _, h.height = n.musicScore.measureHeight, l.rect = h;
3340
+ }
3341
+ function i(l, a, g, d) {
3342
+ switch (l.type) {
3343
+ case Pe.volta: {
3344
+ r(l, a, g, d);
3345
+ break;
3346
+ }
3347
+ case Pe.slur: {
3348
+ o(l, a, g, d);
3349
+ break;
3350
+ }
3351
+ }
3352
+ }
3353
+ const s = t;
3354
+ function u(l) {
3355
+ s("spanSymbolMouseDown", l, n.spanSymbol);
3356
+ }
3357
+ function c(l) {
3358
+ s("spanSymbolMouseUp", l, n.spanSymbol);
3359
+ }
3360
+ return tn(() => {
3361
+ i(n.spanSymbol, n.musicScore, n.componentWidth, n.componentHeight);
3362
+ }), (l, a) => (x(), D(E, null, [
3363
+ e.spanSymbol && e.spanSymbol.type === Z(Pe).volta ? (x(), J(Et, {
3364
+ key: 0,
3365
+ rect: e.spanSymbol.rect
3366
+ }, {
3367
+ default: qe(() => [
3368
+ Re(Jr, jt({ volta: e.spanSymbol }, u, c), null, 16, ["volta"])
3369
+ ]),
3370
+ _: 1
3371
+ }, 8, ["rect"])) : Ce("", !0),
3372
+ e.spanSymbol && e.spanSymbol.type === Z(Pe).slur ? (x(), J(Et, {
3373
+ key: 1,
3374
+ slur: e.spanSymbol,
3375
+ rect: e.spanSymbol.rect
3376
+ }, {
3377
+ default: qe(() => [
3378
+ Re(to, jt({ slur: e.spanSymbol }, u, c), null, 16, ["slur"])
3379
+ ]),
3380
+ _: 1
3381
+ }, 8, ["slur", "rect"])) : Ce("", !0)
3382
+ ], 64));
3383
+ }
3384
+ });
3385
+ function Fe(e, t) {
3386
+ t.value && (t.value.options.highlight = !1), e.options.highlight = !0, t.value = e;
3387
+ }
3388
+ const fe = {
3389
+ startX: 0,
3390
+ //鼠标按下时相对视口坐标
3391
+ startY: 0,
3392
+ originRegion: {
3393
+ region: rn.Main,
3394
+ type: nn.Space,
3395
+ index: 1
3396
+ }
3397
+ // 音符按下专用,记录初始region
3398
+ };
3399
+ function vn(e, t, n, r) {
3400
+ if (n.value)
3401
+ switch (n.value.msTypeName) {
3402
+ case ge.MsSymbol: {
3403
+ const o = n.value;
3404
+ if (o.type === b.NoteHead) {
3405
+ e.clientX - fe.startX;
3406
+ const i = e.clientY - fe.startY;
3407
+ if (Math.abs(i) > t / 8 && o) {
3408
+ const s = Math.floor(i / t * 8), u = K(fe.originRegion) - s;
3409
+ o.region, o.region = dt(u);
3410
+ const c = o.msSymbolArray.find((y) => y.type === b.NoteStem), l = o.msSymbolArray.find((y) => y.type === b.NoteTail), a = O(o.index, r).measure;
3411
+ if (!a) {
3412
+ console.error("measure不存在,音符移动事件出错");
3413
+ return;
3414
+ }
3415
+ const g = Qe(o.beamId, a);
3416
+ if ([R.whole, R.half, R.quarter].includes(o.chronaxie) || g.length < 2) {
3417
+ const y = K(o.region);
3418
+ c && y >= 4 && c.direction !== "down" ? mt("down", c) : c && y < 4 && c.direction !== "up" && mt("up", c), l && y >= 4 && l.direction !== "down" ? ft("down", l) : l && y < 4 && l.direction !== "up" && ft("up", l);
3419
+ } else {
3420
+ const y = O(o.index, r).measure;
3421
+ y && Vn(o.beamId, y);
3422
+ }
3423
+ const d = O(n.value.index, r).singleStaff;
3424
+ if (!d) return console.error("找不到单谱表,跨小节符号更新失败");
3425
+ const h = wt(d);
3426
+ It(h, r);
3427
+ }
3428
+ }
3429
+ break;
3430
+ }
3431
+ }
3432
+ }
3433
+ function ro(e, t, n) {
3434
+ if (t.value)
3435
+ switch (t.value.msTypeName) {
3436
+ case ge.MsSymbol: {
3437
+ t.value.options.highlight = !1, t.value = null;
3438
+ break;
3439
+ }
3440
+ case ge.Measure:
3441
+ }
3442
+ }
3443
+ function xn(e, t) {
3444
+ if (!t.msState.currentSelected.value || t.msState.mode.value !== he.edit || t.msState.currentSelected.value.msTypeName !== ge.Measure) return;
3445
+ const n = t.msState.currentResevedType.value;
3446
+ if (n === xe.note) {
3447
+ let r = null;
3448
+ const o = t.msState.reserveMsSymbolMap.value.get(xe.note);
3449
+ o && "chronaxie" in o && (r = o.chronaxie);
3450
+ const i = V({
3451
+ type: b.NoteHead,
3452
+ region: t.msSymbolInformation.region,
3453
+ chronaxie: r || R.quarter
3454
+ }), s = tt({});
3455
+ if (["front"].includes(t.virtualSymbolContainerType))
3456
+ s.msSymbolArray.push(i), t.msData.msSymbolContainer ? ve(
3457
+ s,
3458
+ t.msData.msSymbolContainer,
3459
+ t.msData.musicScore,
3460
+ "before"
3461
+ ) : ve(
3462
+ s,
3463
+ t.msData.measure,
3464
+ t.msData.musicScore,
3465
+ "before"
3466
+ );
3467
+ else if (["end", "middle"].includes(t.virtualSymbolContainerType)) {
3468
+ if (s.msSymbolArray.push(i), !t.msData.msSymbolContainer) return console.error("没有作为对照的符号容器,符号容器添加失败");
3469
+ ve(
3470
+ s,
3471
+ t.msData.msSymbolContainer,
3472
+ t.msData.musicScore,
3473
+ "after"
3474
+ );
3475
+ } else if (["self"].includes(t.virtualSymbolContainerType)) {
3476
+ if (!t.msData.msSymbolContainer) return console.error("没有作为对照的符号容器,符号添加失败");
3477
+ const u = t.msData.msSymbolContainer.msSymbolArray.find((c) => c.type === b.NoteHead && c.region === i.region);
3478
+ u ? rt(e, t.msState.mode, t.msState.currentSelected, u) : Be(
3479
+ i,
3480
+ t.msData.msSymbolContainer,
3481
+ t.msData.musicScore,
3482
+ "after"
3483
+ );
3484
+ }
3485
+ } else if (n === xe.rest) {
3486
+ let r = null;
3487
+ const o = t.msState.reserveMsSymbolMap.value.get(xe.rest);
3488
+ o && "chronaxie" in o && (r = o.chronaxie);
3489
+ const i = V({
3490
+ type: b.Rest,
3491
+ chronaxie: r || R.quarter
3492
+ }), s = tt({});
3493
+ if (["front"].includes(t.virtualSymbolContainerType))
3494
+ s.msSymbolArray.push(i), t.msData.msSymbolContainer ? ve(
3495
+ s,
3496
+ t.msData.msSymbolContainer,
3497
+ t.msData.musicScore,
3498
+ "before"
3499
+ ) : ve(
3500
+ s,
3501
+ t.msData.measure,
3502
+ t.msData.musicScore,
3503
+ "before"
3504
+ );
3505
+ else if (["end", "middle"].includes(t.virtualSymbolContainerType)) {
3506
+ if (s.msSymbolArray.push(i), !t.msData.msSymbolContainer) return console.error("没有作为对照的符号容器,符号容器添加失败");
3507
+ ve(
3508
+ s,
3509
+ t.msData.msSymbolContainer,
3510
+ t.msData.musicScore,
3511
+ "after"
3512
+ );
3513
+ } else if (["self"].includes(t.virtualSymbolContainerType)) {
3514
+ if (!t.msData.msSymbolContainer) return console.error("没有作为对照的符号容器,符号添加失败");
3515
+ const u = t.msData.msSymbolContainer.msSymbolArray.find((c) => c.type === b.Rest);
3516
+ u ? rt(e, t.msState.mode, t.msState.currentSelected, u) : Be(
3517
+ i,
3518
+ t.msData.msSymbolContainer,
3519
+ t.msData.musicScore,
3520
+ "after"
3521
+ );
3522
+ }
3523
+ }
3524
+ }
3525
+ function wn(e, t, n, r) {
3526
+ t.value === he.edit && Fe(r, n);
3527
+ }
3528
+ function oo(e, t, n, r) {
3529
+ }
3530
+ function rt(e, t, n, r) {
3531
+ r.type === b.NoteHead && (fe.originRegion = r.region), t.value === he.edit && Fe(r, n);
3532
+ }
3533
+ function io(e, t, n, r) {
3534
+ }
3535
+ function In(e, t, n, r) {
3536
+ t.value === he.edit && Fe(r, n);
3537
+ }
3538
+ function Mn(e, t, n, r) {
3539
+ t.value === he.edit && Fe(r, n);
3540
+ }
3541
+ function Cn(e, t, n, r) {
3542
+ t.value === he.edit && Fe(r, n);
3543
+ }
3544
+ const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3545
+ __proto__: null,
3546
+ eventConstant: fe,
3547
+ handleMouseMoveSelected: vn,
3548
+ handleMouseUpSelected: ro,
3549
+ measureMouseDown: In,
3550
+ msSymbolMouseDown: rt,
3551
+ msSymbolMouseUp: io,
3552
+ multipleStavesMouseDown: Cn,
3553
+ select: Fe,
3554
+ singleStaffMouseDown: Mn,
3555
+ spanSymbolMouseDown: wn,
3556
+ spanSymbolMouseUp: oo,
3557
+ virtualSymbolMouseDown: xn
3558
+ }, Symbol.toStringTag, { value: "Module" })), ao = /* @__PURE__ */ X({
3559
+ __name: "virtualSymbolContainer",
3560
+ props: {
3561
+ ind: {},
3562
+ msSymbolContainer: {
3563
+ type: Object
3564
+ },
3565
+ //小节高度, 此属性会控制音符,休止符,谱号,拍号等符号大小
3566
+ measureHeight: {
3567
+ type: Number,
3568
+ default: 60,
3569
+ required: !0
3570
+ },
3571
+ type: {
3572
+ type: String,
3573
+ required: !0
3574
+ },
3575
+ measure: {
3576
+ type: Object,
3577
+ required: !0
3578
+ },
3579
+ measureWidth: {
3580
+ type: Number,
3581
+ default: 200
3582
+ },
3583
+ componentWidth: {
3584
+ type: Number,
3585
+ default: 1e3
3586
+ },
3587
+ componentHeight: {
3588
+ type: Number,
3589
+ default: 800
3590
+ },
3591
+ singleStaff: {
3592
+ type: Object,
3593
+ required: !0
3594
+ },
3595
+ multipleStaves: {
3596
+ type: Object,
3597
+ required: !0
3598
+ },
3599
+ musicScore: {
3600
+ type: Object,
3601
+ default: {}
3602
+ }
3603
+ },
3604
+ setup(e) {
3605
+ const t = e, n = S(() => bn), r = S(() => ({
3606
+ left: i.value + "px",
3607
+ height: t.measureHeight * 3 + "px",
3608
+ width: o.value + "px",
3609
+ bottom: -t.measureHeight + "px"
3610
+ }));
3611
+ S(() => 0);
3612
+ const o = S(() => t.measureHeight * 0.25), i = S(() => {
3613
+ let I = 0;
3614
+ if (t.msSymbolContainer) {
3615
+ t.msSymbolContainer.type;
3616
+ const N = ae(t.measure, t.measureHeight), A = Ie(t.measure), j = Ie(t.measure, t.msSymbolContainer), B = ae(t.measure, t.measureHeight, "front");
3617
+ I = (t.measureWidth - N) / A * j + B - o.value / 2, ["middle"].includes(t.type) ? I += me(t.msSymbolContainer, t.measure, t.singleStaff, t.musicScore, t.componentWidth) : ["end"].includes(t.type) ? I += me(t.msSymbolContainer, t.measure, t.singleStaff, t.musicScore, t.componentWidth) * 3 / 4 : ["front"].includes(t.type) ? I += me(t.msSymbolContainer, t.measure, t.singleStaff, t.musicScore, t.componentWidth) / 4 : ["self"].includes(t.type) && (I += me(t.msSymbolContainer, t.measure, t.singleStaff, t.musicScore, t.componentWidth) * 2 / 4);
3618
+ } else
3619
+ I = t.measureWidth / 2 - o.value / 2;
3620
+ return I;
3621
+ }), s = ie(t.measureHeight);
3622
+ function u(I) {
3623
+ const A = I.currentTarget.getBoundingClientRect();
3624
+ s.value = A.height - I.clientY + A.top;
3625
+ }
3626
+ const c = en("msState");
3627
+ function l(I) {
3628
+ xn(I, {
3629
+ msState: c,
3630
+ virtualSymbolContainerType: t.type,
3631
+ msData: {
3632
+ musicScore: t.musicScore,
3633
+ msSymbolContainer: t.msSymbolContainer || null,
3634
+ measure: t.measure,
3635
+ singleStaff: t.singleStaff,
3636
+ multipleStaves: t.multipleStaves
3637
+ },
3638
+ msSymbolInformation: {
3639
+ region: dt(y.value)
3640
+ }
3641
+ });
3642
+ }
3643
+ const a = S(() => 1), g = S(() => t.measureHeight * 0.25), d = S(() => g.value * a.value), h = S(() => 0), y = S(() => +((s.value - t.measureHeight) / (t.measureHeight / 8)).toFixed(0) + 1), v = S(() => kt(dt(y.value), t.measureHeight) + t.measureHeight), k = S(() => {
3644
+ const I = {
3645
+ width: `${d.value}px`,
3646
+ height: `${g.value}px`,
3647
+ position: "absolute",
3648
+ left: h.value + "px",
3649
+ bottom: v.value + "px",
3650
+ background: "blue"
3651
+ };
3652
+ return n.value && (I.mask = `url("${n.value}") center center / cover no-repeat`), I;
3653
+ });
3654
+ return St(() => {
3655
+ }), (I, N) => (x(), D("div", {
3656
+ class: "vitrualSymbolContainer",
3657
+ onMousemove: u,
3658
+ onMousedown: l,
3659
+ style: F(r.value)
3660
+ }, [
3661
+ ue("div", {
3662
+ ref: "vitrualSymbolRef",
3663
+ class: "vitrualSymbol",
3664
+ style: F(k.value)
3665
+ }, null, 4)
3666
+ ], 36));
3667
+ }
3668
+ }), ct = /* @__PURE__ */ ne(ao, [["__scopeId", "data-v-04b21654"]]), so = /* @__PURE__ */ X({
3669
+ __name: "musicScore",
3670
+ props: {
3671
+ musicScore: {
3672
+ type: Object,
3673
+ required: !0
3674
+ },
3675
+ width: {
3676
+ type: Number,
3677
+ default: 1e3
3678
+ },
3679
+ height: {
3680
+ type: Number,
3681
+ default: 800
3682
+ },
3683
+ //小节的线条宽度
3684
+ strokeWidth: {
3685
+ type: Number,
3686
+ default: 1
3687
+ }
3688
+ },
3689
+ emits: ["spanSymbolMouseDown", "spanSymbolMouseUp", "msSymbolMouseDown", "measureMouseDown", "singleStaffMouseDown", "multipleStavesMouseDown", "update:mode", "msSymbolMouseUp"],
3690
+ setup(e, { expose: t, emit: n }) {
3691
+ const r = e;
3692
+ S(() => (M) => {
3693
+ const W = [];
3694
+ return M.msSymbolContainerArray.forEach((T) => {
3695
+ let le = !1;
3696
+ for (const _ of T.msSymbolArray)
3697
+ if (_.type === b.NoteHead && (_.chronaxie === R.eighth || _.chronaxie === R.sixteenth)) {
3698
+ le = !0;
3699
+ break;
3700
+ }
3701
+ W.push(le);
3702
+ }), W;
3703
+ });
3704
+ const o = ie(he.edit), i = ie(/* @__PURE__ */ new Map()), s = ie(null);
3705
+ function u() {
3706
+ const M = V({ type: b.NoteHead, chronaxie: R.quarter }), W = V({ type: b.Rest, chronaxie: R.quarter });
3707
+ i.value.set(xe.note, M), i.value.set(xe.rest, W);
3708
+ }
3709
+ function c(M, W) {
3710
+ i.value.set(M, W);
3711
+ }
3712
+ function l(M) {
3713
+ return i.value.has(M) ? i.value.get(M) : null;
3714
+ }
3715
+ const a = ie(xe.note);
3716
+ function g(M) {
3717
+ a.value = M;
3718
+ }
3719
+ const d = S(() => (M) => M.msSymbolContainerArray.filter((W) => W.type === Ee.variable)), h = n;
3720
+ function y(M, W) {
3721
+ wn(M, o, s, W), h("spanSymbolMouseDown");
3722
+ }
3723
+ function v(M, W) {
3724
+ h("spanSymbolMouseUp");
3725
+ }
3726
+ function k(M, W) {
3727
+ rt(M, o, s, W), h("msSymbolMouseDown");
3728
+ }
3729
+ function I(M, W) {
3730
+ h("msSymbolMouseUp");
3731
+ }
3732
+ function N(M, W) {
3733
+ In(M, o, s, W), h("measureMouseDown");
3734
+ }
3735
+ function A(M, W) {
3736
+ Mn(M, o, s, W), h("singleStaffMouseDown");
3737
+ }
3738
+ function j(M, W) {
3739
+ Cn(M, o, s, W), h("multipleStavesMouseDown");
3740
+ }
3741
+ function B(M) {
3742
+ o.value = M;
3743
+ }
3744
+ const te = S(() => ({
3745
+ width: r.width + "px",
3746
+ height: r.height + "px",
3747
+ overflow: "visible"
3748
+ }));
3749
+ function ye() {
3750
+ r.musicScore && (Tn(r.musicScore), u(), Gn(r.musicScore));
3751
+ }
3752
+ tn(ye);
3753
+ const Xe = ie(null), ke = ie(!1);
3754
+ function at(M) {
3755
+ M.preventDefault(), fe.startX = M.clientX, fe.startY = M.clientY, ke.value = !0;
3756
+ }
3757
+ function Te(M) {
3758
+ fe.startX = 0, fe.startY = 0, ke.value = !1;
3759
+ }
3760
+ function Ke(M) {
3761
+ var W;
3762
+ ke.value && vn(M, (W = r.musicScore) == null ? void 0 : W.measureHeight, s, r.musicScore);
3763
+ }
3764
+ function Le() {
3765
+ s.value && (s.value.options.highlight = !1), s.value = null;
3766
+ }
3767
+ function Oe(M) {
3768
+ M.showMode === ce.standardStaff ? nr(M) : M.showMode === ce.numberNotation && rr(M);
3769
+ }
3770
+ return St(() => {
3771
+ }), kn(() => {
3772
+ }), Ln("msState", {
3773
+ mode: o,
3774
+ currentSelected: s,
3775
+ reserveMsSymbolMap: i,
3776
+ currentResevedType: a
3777
+ }), t({
3778
+ changeMode: B,
3779
+ root: Xe,
3780
+ mode: o,
3781
+ currentSelected: s,
3782
+ currentResevedType: a,
3783
+ setReserveMsSymbol: c,
3784
+ getReserveMsSymbol: l,
3785
+ reserveMsSymbolMap: i,
3786
+ setCurrentResevedType: g,
3787
+ cancelSelect: Le,
3788
+ switchShowMode: Oe
3789
+ }), (M, W) => (x(), D("div", {
3790
+ class: "musicScore stack",
3791
+ style: F(te.value),
3792
+ ref_key: "musicScoreRef",
3793
+ ref: Xe,
3794
+ onMousedown: $(at, ["stop"]),
3795
+ onMousemove: $(Ke, ["stop"]),
3796
+ onMouseup: $(Te, ["stop"])
3797
+ }, [
3798
+ Re(st, {
3799
+ disabled: !1,
3800
+ musicScore: e.musicScore,
3801
+ class: "stackItem lineLayer",
3802
+ style: F({ width: e.width + "px", height: e.height + "px" }),
3803
+ onMultipleStavesMouseDown: j,
3804
+ onSingleStaffMouseDown: A,
3805
+ comment: "谱线层1"
3806
+ }, {
3807
+ default: qe(({ measure: T, measureIndex: le, singleStaff: _, multipleStaves: pe, measureWidth: be }) => [
3808
+ (x(), J(Rn, {
3809
+ key: "measure" + le,
3810
+ strokeWidth: e.strokeWidth,
3811
+ x: le * be,
3812
+ width: be,
3813
+ height: e.musicScore.measureHeight,
3814
+ musicScore: e.musicScore,
3815
+ componentWidth: e.width,
3816
+ onMeasureMouseDown: N,
3817
+ componentHeight: e.height,
3818
+ measure: T
3819
+ }, null, 8, ["strokeWidth", "x", "width", "height", "musicScore", "componentWidth", "componentHeight", "measure"]))
3820
+ ]),
3821
+ _: 1
3822
+ }, 8, ["musicScore", "style"]),
3823
+ (x(!0), D(E, null, se(e.musicScore.spanSymbolArray, (T, le) => (x(), J(no, {
3824
+ key: T.vueKey,
3825
+ musicScore: e.musicScore,
3826
+ componentWidth: e.width,
3827
+ componentHeight: e.height,
3828
+ onSpanSymbolMouseDown: y,
3829
+ onSpanSymbolMouseUp: v,
3830
+ spanSymbol: T
3831
+ }, null, 8, ["musicScore", "componentWidth", "componentHeight", "spanSymbol"]))), 128)),
3832
+ Re(st, {
3833
+ musicScore: e.musicScore,
3834
+ class: "stackItem symbolLayer",
3835
+ style: F({ width: e.width + "px", height: e.height + "px", pointerEvents: "none" }),
3836
+ comment: "符号层2"
3837
+ }, {
3838
+ default: qe(({ measure: T, measureIndex: le, singleStaff: _, multipleStaves: pe, measureWidth: be }) => [
3839
+ (x(!0), D(E, null, se(T.msSymbolContainerArray, (Ge, re) => (x(), J(Qr, {
3840
+ msSymbolContainer: Ge,
3841
+ nextContainer: T.msSymbolContainerArray.length !== re + 1 ? T.msSymbolContainerArray[re + 1] : void 0,
3842
+ preContainer: T.msSymbolContainerArray.length !== 0 ? T.msSymbolContainerArray[re - 1] : void 0,
3843
+ measure: T,
3844
+ musicScore: e.musicScore,
3845
+ measureWidth: be,
3846
+ singleStaff: _,
3847
+ multipleStaves: pe,
3848
+ measureHeight: e.musicScore.measureHeight,
3849
+ onMsSymbolMouseDown: k,
3850
+ onMsSymbolMousUp: I,
3851
+ key: "note-symbol" + re,
3852
+ componentWidth: e.width,
3853
+ componentHeight: e.height
3854
+ }, null, 8, ["msSymbolContainer", "nextContainer", "preContainer", "measure", "musicScore", "measureWidth", "singleStaff", "multipleStaves", "measureHeight", "componentWidth", "componentHeight"]))), 128))
3855
+ ]),
3856
+ _: 1
3857
+ }, 8, ["musicScore", "style"]),
3858
+ De(Re(st, {
3859
+ musicScore: e.musicScore,
3860
+ class: "stackItem symbolLayer",
3861
+ style: F({ width: e.width + "px", height: e.height + "px", pointerEvents: "none" }),
3862
+ comment: "编辑模式虚拟音符层"
3863
+ }, {
3864
+ default: qe(({ measure: T, measureIndex: le, singleStaff: _, multipleStaves: pe, measureWidth: be }) => [
3865
+ s.value === T ? (x(), D(E, { key: 0 }, [
3866
+ Re(ct, {
3867
+ comment: "第一个变宽容器",
3868
+ msSymbolContainer: d.value(T)[0],
3869
+ measure: T,
3870
+ type: "front",
3871
+ musicScore: e.musicScore,
3872
+ measureWidth: be,
3873
+ singleStaff: _,
3874
+ multipleStaves: pe,
3875
+ measureHeight: e.musicScore.measureHeight,
3876
+ componentWidth: e.width,
3877
+ componentHeight: e.height
3878
+ }, null, 8, ["msSymbolContainer", "measure", "musicScore", "measureWidth", "singleStaff", "multipleStaves", "measureHeight", "componentWidth", "componentHeight"]),
3879
+ (x(!0), D(E, null, se(d.value(T), (Ge, re) => (x(), J(ct, {
3880
+ msSymbolContainer: Ge,
3881
+ measure: T,
3882
+ type: "self",
3883
+ musicScore: e.musicScore,
3884
+ measureWidth: be,
3885
+ ind: re,
3886
+ singleStaff: _,
3887
+ multipleStaves: pe,
3888
+ measureHeight: e.musicScore.measureHeight,
3889
+ key: "virtual-symbol" + re,
3890
+ componentWidth: e.width,
3891
+ componentHeight: e.height
3892
+ }, null, 8, ["msSymbolContainer", "measure", "musicScore", "measureWidth", "ind", "singleStaff", "multipleStaves", "measureHeight", "componentWidth", "componentHeight"]))), 128)),
3893
+ (x(!0), D(E, null, se(d.value(T), (Ge, re) => (x(), J(ct, {
3894
+ msSymbolContainer: Ge,
3895
+ measure: T,
3896
+ type: re === d.value(T).length - 1 ? "end" : "middle",
3897
+ musicScore: e.musicScore,
3898
+ measureWidth: be,
3899
+ ind: re,
3900
+ singleStaff: _,
3901
+ multipleStaves: pe,
3902
+ measureHeight: e.musicScore.measureHeight,
3903
+ key: "virtual-symbol" + re,
3904
+ componentWidth: e.width,
3905
+ componentHeight: e.height
3906
+ }, null, 8, ["msSymbolContainer", "measure", "type", "musicScore", "measureWidth", "ind", "singleStaff", "multipleStaves", "measureHeight", "componentWidth", "componentHeight"]))), 128))
3907
+ ], 64)) : Ce("", !0)
3908
+ ]),
3909
+ _: 1
3910
+ }, 8, ["musicScore", "style"]), [
3911
+ [Ne, o.value === Z(he).edit]
3912
+ ])
3913
+ ], 36));
3914
+ }
3915
+ }), bo = /* @__PURE__ */ ne(so, [["__scopeId", "data-v-54269214"]]);
3916
+ export {
3917
+ co as KeySignatureTonicSemitones,
3918
+ Q as MsSymbolInformationMap,
3919
+ mo as bottomUtil,
3920
+ bo as default,
3921
+ po as eventUtil,
3922
+ go as geometryUtil,
3923
+ fo as heightUtil,
3924
+ yo as leftUtil,
3925
+ uo as widthConstantUtil,
3926
+ ho as widthUtil
3927
+ };