smoosic 2.0.3 → 2.0.5

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 (260) hide show
  1. package/build/smoosic.js +408 -69
  2. package/changes.md +95 -0
  3. package/package.json +19 -1
  4. package/release/smoosic.js +408 -69
  5. package/specs/032-split-multimeasure-rests/checklists/requirements.md +40 -0
  6. package/specs/032-split-multimeasure-rests/contracts/grouping-contract.md +53 -0
  7. package/specs/032-split-multimeasure-rests/data-model.md +70 -0
  8. package/specs/032-split-multimeasure-rests/plan.md +81 -0
  9. package/specs/032-split-multimeasure-rests/quickstart.md +46 -0
  10. package/specs/032-split-multimeasure-rests/research.md +63 -0
  11. package/specs/032-split-multimeasure-rests/spec.md +127 -0
  12. package/specs/032-split-multimeasure-rests/tasks.md +174 -0
  13. package/specs/033-key-distance-transposition/checklists/requirements.md +35 -0
  14. package/specs/033-key-distance-transposition/contracts/spelling-api.md +36 -0
  15. package/specs/033-key-distance-transposition/data-model.md +49 -0
  16. package/specs/033-key-distance-transposition/plan.md +87 -0
  17. package/specs/033-key-distance-transposition/quickstart.md +40 -0
  18. package/specs/033-key-distance-transposition/research.md +82 -0
  19. package/specs/033-key-distance-transposition/spec.md +132 -0
  20. package/specs/033-key-distance-transposition/tasks.md +139 -0
  21. package/specs/034-smz-compressed-scores/checklists/requirements.md +35 -0
  22. package/specs/034-smz-compressed-scores/contracts/archive-api.md +30 -0
  23. package/specs/034-smz-compressed-scores/data-model.md +48 -0
  24. package/specs/034-smz-compressed-scores/plan.md +89 -0
  25. package/specs/034-smz-compressed-scores/quickstart.md +44 -0
  26. package/specs/034-smz-compressed-scores/research.md +86 -0
  27. package/specs/034-smz-compressed-scores/spec.md +137 -0
  28. package/specs/034-smz-compressed-scores/tasks.md +148 -0
  29. package/specs/035-paste-special/checklists/requirements.md +35 -0
  30. package/specs/035-paste-special/contracts/paste-special-api.md +50 -0
  31. package/specs/035-paste-special/data-model.md +47 -0
  32. package/specs/035-paste-special/plan.md +83 -0
  33. package/specs/035-paste-special/quickstart.md +51 -0
  34. package/specs/035-paste-special/research.md +97 -0
  35. package/specs/035-paste-special/spec.md +170 -0
  36. package/specs/035-paste-special/tasks.md +149 -0
  37. package/specs/036-autosave-recovery/checklists/requirements.md +36 -0
  38. package/specs/036-autosave-recovery/contracts/autosave-api.md +111 -0
  39. package/specs/036-autosave-recovery/data-model.md +70 -0
  40. package/specs/036-autosave-recovery/plan.md +87 -0
  41. package/specs/036-autosave-recovery/quickstart.md +65 -0
  42. package/specs/036-autosave-recovery/research.md +105 -0
  43. package/specs/036-autosave-recovery/spec.md +143 -0
  44. package/specs/036-autosave-recovery/tasks.md +165 -0
  45. package/specs/037-fix-new-part-dialog/checklists/requirements.md +38 -0
  46. package/specs/037-fix-new-part-dialog/contracts/create-part-api.md +84 -0
  47. package/specs/037-fix-new-part-dialog/data-model.md +68 -0
  48. package/specs/037-fix-new-part-dialog/plan.md +83 -0
  49. package/specs/037-fix-new-part-dialog/quickstart.md +58 -0
  50. package/specs/037-fix-new-part-dialog/research.md +86 -0
  51. package/specs/037-fix-new-part-dialog/spec.md +144 -0
  52. package/specs/037-fix-new-part-dialog/tasks.md +174 -0
  53. package/specs/038-per-measure-beam-groups/checklists/requirements.md +36 -0
  54. package/specs/038-per-measure-beam-groups/contracts/beam-groups-api.md +74 -0
  55. package/specs/038-per-measure-beam-groups/data-model.md +75 -0
  56. package/specs/038-per-measure-beam-groups/plan.md +84 -0
  57. package/specs/038-per-measure-beam-groups/quickstart.md +53 -0
  58. package/specs/038-per-measure-beam-groups/research.md +72 -0
  59. package/specs/038-per-measure-beam-groups/spec.md +146 -0
  60. package/specs/038-per-measure-beam-groups/tasks.md +132 -0
  61. package/specs/039-measure-fill-submenu/checklists/requirements.md +35 -0
  62. package/specs/039-measure-fill-submenu/contracts/measure-fill-api.md +56 -0
  63. package/specs/039-measure-fill-submenu/data-model.md +79 -0
  64. package/specs/039-measure-fill-submenu/plan.md +81 -0
  65. package/specs/039-measure-fill-submenu/quickstart.md +62 -0
  66. package/specs/039-measure-fill-submenu/research.md +68 -0
  67. package/specs/039-measure-fill-submenu/spec.md +153 -0
  68. package/specs/039-measure-fill-submenu/tasks.md +121 -0
  69. package/specs/040-dynamics-dialog-cleanup/checklists/requirements.md +36 -0
  70. package/specs/040-dynamics-dialog-cleanup/contracts/dynamics-dialog.md +52 -0
  71. package/specs/040-dynamics-dialog-cleanup/data-model.md +48 -0
  72. package/specs/040-dynamics-dialog-cleanup/plan.md +89 -0
  73. package/specs/040-dynamics-dialog-cleanup/quickstart.md +69 -0
  74. package/specs/040-dynamics-dialog-cleanup/research.md +80 -0
  75. package/specs/040-dynamics-dialog-cleanup/spec.md +120 -0
  76. package/specs/040-dynamics-dialog-cleanup/tasks.md +114 -0
  77. package/specs/041-delete-special/checklists/requirements.md +35 -0
  78. package/specs/041-delete-special/contracts/delete-special-api.md +41 -0
  79. package/specs/041-delete-special/data-model.md +40 -0
  80. package/specs/041-delete-special/plan.md +93 -0
  81. package/specs/041-delete-special/quickstart.md +41 -0
  82. package/specs/041-delete-special/research.md +75 -0
  83. package/specs/041-delete-special/spec.md +136 -0
  84. package/specs/041-delete-special/tasks.md +106 -0
  85. package/specs/042-preserve-music-time-signature/checklists/requirements.md +35 -0
  86. package/specs/042-preserve-music-time-signature/contracts/rebar-api.md +66 -0
  87. package/specs/042-preserve-music-time-signature/data-model.md +73 -0
  88. package/specs/042-preserve-music-time-signature/plan.md +93 -0
  89. package/specs/042-preserve-music-time-signature/quickstart.md +37 -0
  90. package/specs/042-preserve-music-time-signature/research.md +102 -0
  91. package/specs/042-preserve-music-time-signature/spec.md +153 -0
  92. package/specs/042-preserve-music-time-signature/tasks.md +104 -0
  93. package/src/application/application.ts +13 -2
  94. package/src/application/exports.ts +402 -395
  95. package/src/application/generateVexTests.ts +2 -2
  96. package/src/render/sui/NoteEntryCaret.ts +117 -16
  97. package/src/render/sui/autosave.ts +265 -0
  98. package/src/render/sui/formatter.ts +12 -2
  99. package/src/render/sui/renderState.ts +4 -4
  100. package/src/render/sui/scoreChangeState.ts +8 -3
  101. package/src/render/sui/scoreView.ts +47 -2
  102. package/src/render/sui/scoreViewOperations.ts +2761 -2555
  103. package/src/render/sui/staffLineGeometry.ts +82 -0
  104. package/src/render/sui/tracker.ts +18 -23
  105. package/src/render/vex/vxMeasure.ts +22 -8
  106. package/src/render/vex/vxNote.ts +2 -4
  107. package/src/smo/data/measure.ts +58 -1
  108. package/src/smo/data/measureModifiers.ts +81 -1
  109. package/src/smo/data/music.ts +169 -359
  110. package/src/smo/data/note.ts +1 -1
  111. package/src/smo/data/noteModifiers.ts +12 -0
  112. package/src/smo/data/score.ts +179 -7
  113. package/src/smo/data/scoreModifiers.ts +46 -1
  114. package/src/smo/data/systemStaff.ts +43 -0
  115. package/src/smo/xform/beamers.ts +80 -6
  116. package/src/smo/xform/copypaste.ts +207 -47
  117. package/src/smo/xform/measureFill.ts +89 -0
  118. package/src/smo/xform/operations.ts +452 -61
  119. package/src/smo/xform/rebar.ts +490 -0
  120. package/src/smo/xform/selections.ts +73 -0
  121. package/src/ui/components/dialogs/beamGroups.vue +106 -0
  122. package/src/ui/components/dialogs/deleteSpecial.vue +38 -0
  123. package/src/ui/components/dialogs/dynamics.vue +16 -3
  124. package/src/ui/components/dialogs/fileUpload.vue +2 -2
  125. package/src/ui/components/dialogs/hairpin.vue +3 -3
  126. package/src/ui/components/dialogs/newPart.vue +148 -184
  127. package/src/ui/components/dialogs/pasteSpecial.vue +49 -0
  128. package/src/ui/components/dialogs/recovery.vue +66 -0
  129. package/src/ui/components/dialogs/save.vue +11 -4
  130. package/src/ui/components/dialogs/scorePreferences.vue +23 -1
  131. package/src/ui/components/dialogs/slur.vue +6 -6
  132. package/src/ui/components/dialogs/tempo.vue +11 -3
  133. package/src/ui/components/dialogs/timeSignature.vue +18 -3
  134. package/src/ui/components/dialogs/volta.vue +3 -3
  135. package/src/ui/dialogs/annotationVue.ts +1 -1
  136. package/src/ui/dialogs/beamGroupsVue.ts +69 -0
  137. package/src/ui/dialogs/createPartHelpers.ts +68 -0
  138. package/src/ui/dialogs/deleteSpecial.ts +57 -0
  139. package/src/ui/dialogs/dynamicsVue.ts +87 -60
  140. package/src/ui/dialogs/factory.ts +0 -2
  141. package/src/ui/dialogs/fileDialogs.ts +63 -22
  142. package/src/ui/dialogs/instrument.ts +37 -30
  143. package/src/ui/dialogs/pasteSpecial.ts +59 -0
  144. package/src/ui/dialogs/preferences.ts +41 -40
  145. package/src/ui/dialogs/recovery.ts +49 -0
  146. package/src/ui/dialogs/timeSignature.ts +27 -39
  147. package/src/ui/fileio/fileInput.ts +12 -3
  148. package/src/ui/fileio/scoreArchive.ts +151 -0
  149. package/src/ui/fileio/xhrLoader.ts +26 -0
  150. package/src/ui/i18n/language.ts +1 -1
  151. package/src/ui/menus/beams.ts +181 -112
  152. package/src/ui/menus/edit.ts +44 -6
  153. package/src/ui/menus/file.ts +21 -1
  154. package/src/ui/menus/measure.ts +40 -1
  155. package/tests/autosave.ts +332 -0
  156. package/tests/beamDotted.ts +56 -0
  157. package/tests/beamGroups.ts +338 -0
  158. package/tests/createPart.ts +292 -0
  159. package/tests/deleteSpecial.ts +350 -0
  160. package/tests/dynamicsFontSize.ts +132 -0
  161. package/tests/keyDistanceTransposition.ts +351 -0
  162. package/tests/measureFill.ts +295 -0
  163. package/tests/movePart.ts +94 -0
  164. package/tests/multimeasureRest.ts +338 -0
  165. package/tests/pasteIntoMeasure.ts +103 -0
  166. package/tests/pasteSpecial.ts +541 -0
  167. package/tests/quickBeam.ts +126 -0
  168. package/tests/rebarMeasures.ts +492 -0
  169. package/tests/scoreArchive.ts +218 -0
  170. package/tests/scoreChangeState.ts +2 -0
  171. package/tests/staffLineGeometry.ts +179 -0
  172. package/tests/timeRangeSelect.ts +111 -0
  173. package/tests/timeSignatureDisplay.ts +58 -0
  174. package/tools/smoosic-schema.json +37 -0
  175. package/typedoc.ts +2 -1
  176. package/types/src/application/exports.d.ts +454 -447
  177. package/types/src/common/promiseHelpers.d.ts +30 -30
  178. package/types/src/common/vex.d.ts +224 -224
  179. package/types/src/render/sui/NoteEntryCaret.d.ts +107 -107
  180. package/types/src/render/sui/autosave.d.ts +99 -0
  181. package/types/src/render/sui/scoreView.d.ts +23 -0
  182. package/types/src/render/sui/scoreViewOperations.d.ts +776 -639
  183. package/types/src/render/sui/svgHelpers.d.ts +88 -88
  184. package/types/src/render/sui/svgPageMap.d.ts +344 -344
  185. package/types/src/render/sui/textEdit.d.ts +96 -96
  186. package/types/src/render/sui/textRender.d.ts +199 -199
  187. package/types/src/render/vex/smoAdapter.d.ts +47 -47
  188. package/types/src/render/vex/vxMeasure.d.ts +97 -97
  189. package/types/src/render/vex/vxNote.d.ts +56 -56
  190. package/types/src/render/vex/vxSystem.d.ts +71 -71
  191. package/types/src/smo/data/measure.d.ts +30 -0
  192. package/types/src/smo/data/measureModifiers.d.ts +568 -513
  193. package/types/src/smo/data/music.d.ts +74 -32
  194. package/types/src/smo/data/note.d.ts +498 -498
  195. package/types/src/smo/data/noteModifiers.d.ts +615 -606
  196. package/types/src/smo/data/score.d.ts +479 -421
  197. package/types/src/smo/data/scoreModifiers.d.ts +30 -0
  198. package/types/src/smo/data/scoreText.d.ts +334 -334
  199. package/types/src/smo/data/systemStaff.d.ts +14 -0
  200. package/types/src/smo/xform/beamers.d.ts +23 -1
  201. package/types/src/smo/xform/copypaste.d.ts +138 -2
  202. package/types/src/smo/xform/measureFill.d.ts +21 -0
  203. package/types/src/smo/xform/operations.d.ts +269 -129
  204. package/types/src/smo/xform/rebar.d.ts +53 -0
  205. package/types/src/smo/xform/selections.d.ts +168 -154
  206. package/types/src/smo/xform/undo.d.ts +142 -142
  207. package/types/src/ui/buttons/button.d.ts +100 -100
  208. package/types/src/ui/buttons/ribbon.d.ts +70 -70
  209. package/types/src/ui/common.d.ts +76 -76
  210. package/types/src/ui/components/dialogs/chordText.d.ts +28 -28
  211. package/types/src/ui/components/dialogs/textBlockAtomNode.d.ts +20 -20
  212. package/types/src/ui/components/dialogs/textGroupHtml.d.ts +29 -29
  213. package/types/src/ui/composable/draggable.d.ts +15 -15
  214. package/types/src/ui/dialogs/adapter.d.ts +120 -120
  215. package/types/src/ui/dialogs/annotationVue.d.ts +9 -9
  216. package/types/src/ui/dialogs/audioSettings.d.ts +32 -32
  217. package/types/src/ui/dialogs/beamGroupsVue.d.ts +20 -0
  218. package/types/src/ui/dialogs/chordChangeVue.d.ts +8 -8
  219. package/types/src/ui/dialogs/createPartHelpers.d.ts +29 -0
  220. package/types/src/ui/dialogs/customTupletsVue.d.ts +9 -9
  221. package/types/src/ui/dialogs/deleteSpecial.d.ts +8 -0
  222. package/types/src/ui/dialogs/dialog.d.ts +203 -203
  223. package/types/src/ui/dialogs/dynamicsVue.d.ts +10 -10
  224. package/types/src/ui/dialogs/factory.d.ts +15 -15
  225. package/types/src/ui/dialogs/fileDialogs.d.ts +4 -4
  226. package/types/src/ui/dialogs/hairpin.d.ts +35 -35
  227. package/types/src/ui/dialogs/hairpinVue.d.ts +7 -7
  228. package/types/src/ui/dialogs/instrument.d.ts +3 -3
  229. package/types/src/ui/dialogs/keySignatureVue.d.ts +7 -7
  230. package/types/src/ui/dialogs/libraryVue.d.ts +15 -15
  231. package/types/src/ui/dialogs/lyricVue.d.ts +8 -8
  232. package/types/src/ui/dialogs/pasteSpecial.d.ts +8 -0
  233. package/types/src/ui/dialogs/pedalMarkingVue.d.ts +7 -7
  234. package/types/src/ui/dialogs/recovery.d.ts +8 -0
  235. package/types/src/ui/dialogs/rehearsalMark.d.ts +25 -25
  236. package/types/src/ui/dialogs/rehearsalMarkVue.d.ts +7 -7
  237. package/types/src/ui/dialogs/slur.d.ts +57 -57
  238. package/types/src/ui/dialogs/slurVue.d.ts +7 -7
  239. package/types/src/ui/dialogs/tempo.d.ts +50 -50
  240. package/types/src/ui/dialogs/tempoVue.d.ts +10 -10
  241. package/types/src/ui/dialogs/textBlockVue.d.ts +8 -8
  242. package/types/src/ui/dialogs/textBracket.d.ts +35 -35
  243. package/types/src/ui/dialogs/textBracketVue.d.ts +7 -7
  244. package/types/src/ui/dialogs/tie.d.ts +41 -41
  245. package/types/src/ui/dialogs/volta.d.ts +40 -40
  246. package/types/src/ui/dialogs/voltaVue.d.ts +7 -7
  247. package/types/src/ui/fileio/fileInput.d.ts +7 -1
  248. package/types/src/ui/fileio/library.d.ts +40 -40
  249. package/types/src/ui/fileio/scoreArchive.d.ts +55 -0
  250. package/types/src/ui/fileio/xhrLoader.d.ts +7 -0
  251. package/types/src/ui/menus/file.d.ts +8 -8
  252. package/types/src/ui/menus/language.d.ts +7 -7
  253. package/types/src/ui/menus/manager.d.ts +58 -58
  254. package/types/src/ui/menus/menu.d.ts +159 -159
  255. package/types/src/ui/menus/partSelection.d.ts +14 -14
  256. package/types/src/ui/menus/score.d.ts +8 -8
  257. package/types/src/ui/menus/staffModifier.d.ts +17 -17
  258. package/types/typedoc.d.ts +148 -147
  259. package/src/ui/dialogs/dynamics.ts +0 -141
  260. package/types/src/ui/dialogs/dynamics.d.ts +0 -37
@@ -7,7 +7,7 @@ import { SmoScore } from '../data/score';
7
7
  import { SmoMeasureParams, SmoMeasure, SmoVoice } from '../data/measure';
8
8
  import { SmoSystemStaff, SmoSystemStaffParams } from '../data/systemStaff';
9
9
  import { SmoArticulation, SmoGraceNote, SmoLyric, SmoMicrotone, SmoOrnament,
10
- SmoDynamicText,
10
+ SmoDynamicText, SmoNoteModifierBase,
11
11
  SmoTabNote} from '../data/noteModifiers';
12
12
  import {
13
13
  SmoRehearsalMark, SmoMeasureText, SmoVolta, SmoMeasureFormat, SmoTempo, SmoBarline,
@@ -17,10 +17,13 @@ import { SmoStaffHairpin, SmoSlur, SmoTie, StaffModifierBase, SmoTieParams, SmoI
17
17
  SmoSlurParams, SmoInstrumentMeasure, SmoStaffTextBracket, SmoStaffTextBracketParams,
18
18
  SmoTabStave } from '../data/staffModifiers';
19
19
  import { SmoSystemGroup } from '../data/scoreModifiers';
20
+ import { SmoPartInfo } from '../data/partInfo';
20
21
  import { SmoTextGroup } from '../data/scoreText';
21
22
  import { SmoSelection, SmoSelector, ModifierTab } from './selections';
22
23
  import { SmoContractNoteActor, SmoStretchNoteActor, SmoMakeTupletActor, SmoUnmakeTupletActor, SmoStretchNoteParams, SmoContractNoteParams, SmoMakeTupletParams} from './tickDuration';
23
24
  import { SmoBeamer } from './beamers';
25
+ import { fillRestDurations, MeasureFillType } from './measureFill';
26
+ import { rebarMeasures, RebarResult } from './rebar';
24
27
  import { SmoTupletTree } from '../data/tuplet';
25
28
  /**
26
29
  * supported operations for {@link SmoOperation.batchSelectionOperation} to change a note's duration
@@ -41,7 +44,120 @@ export type createStaffModifierType<T> = (fromSelection: SmoSelection, toSelecti
41
44
  * take the score, a selection or selection array, and the parameters of the operation.
42
45
  * @category SmoTransform
43
46
  */
47
+ /**
48
+ * What is needed to create a part: where it goes, its instrument, and what it is called.
49
+ * @category SmoOperation
50
+ */
51
+ export interface AddPartParams {
52
+ /** where the new part goes, counting from 1; N + 1 is after the last of N staves */
53
+ location: number;
54
+ /** the sound, clef, staff lines and transposition of the (first) staff */
55
+ instrument: SmoInstrument;
56
+ /** add a second staff to the part, with the opposite clef */
57
+ twoStaves: boolean;
58
+ /** the name as typed. If it is blank, instrumentLabel is the name */
59
+ name: string;
60
+ /** the display name of the instrument, e.g. 'Bb Trumpet' */
61
+ instrumentLabel: string;
62
+ /** the abbreviation as typed; blank for none */
63
+ abbreviation: string;
64
+ }
65
+
66
+ /**
67
+ * The kinds of marking attached to notes that Delete Special can remove on their own
68
+ * @category SmoTransform
69
+ */
70
+ export type DeleteAttributeKind = 'dynamics' | 'lyrics' | 'annotations' | 'chords' | 'articulations'
71
+ | 'ornaments' | 'graceNotes' | 'arpeggios' | 'microtones';
72
+ /** How the markings of one kind are counted on a note and cleared from it */
73
+ interface DeleteAttributeHandler {
74
+ count: (note: SmoNote) => number,
75
+ clear: (note: SmoNote) => void
76
+ }
77
+ const isLyricOfParser = (mod: SmoNoteModifierBase, parser: number) =>
78
+ mod.attrs.type === 'SmoLyric' && (mod as SmoLyric).parser === parser;
79
+ /** Lyrics, annotations and chords are all SmoLyric, told apart only by parser */
80
+ const lyricHandler = (parser: number): DeleteAttributeHandler => ({
81
+ count: (note) => note.textModifiers.filter((mod) => isLyricOfParser(mod, parser)).length,
82
+ clear: (note) => {
83
+ note.textModifiers = note.textModifiers.filter((mod) => !isLyricOfParser(mod, parser));
84
+ }
85
+ });
86
+ const deleteAttributeHandlers: Record<DeleteAttributeKind, DeleteAttributeHandler> = {
87
+ dynamics: {
88
+ count: (note) => note.textModifiers.filter((mod) => mod.attrs.type === 'SmoDynamicText').length,
89
+ clear: (note) => {
90
+ note.textModifiers = note.textModifiers.filter((mod) => mod.attrs.type !== 'SmoDynamicText');
91
+ }
92
+ },
93
+ lyrics: lyricHandler(SmoLyric.parsers.lyric),
94
+ annotations: lyricHandler(SmoLyric.parsers.annotation),
95
+ chords: lyricHandler(SmoLyric.parsers.chord),
96
+ articulations: {
97
+ count: (note) => note.articulations.length,
98
+ clear: (note) => { note.articulations = []; }
99
+ },
100
+ ornaments: {
101
+ count: (note) => note.ornaments.length,
102
+ clear: (note) => { note.ornaments = []; }
103
+ },
104
+ graceNotes: {
105
+ count: (note) => note.graceNotes.length,
106
+ clear: (note) => { note.graceNotes = []; }
107
+ },
108
+ arpeggios: {
109
+ count: (note) => note.arpeggio ? 1 : 0,
110
+ clear: (note) => { note.arpeggio = undefined; }
111
+ },
112
+ microtones: {
113
+ count: (note) => note.tones.length,
114
+ clear: (note) => { note.tones = []; }
115
+ }
116
+ };
117
+
44
118
  export class SmoOperation {
119
+ /** All the kinds Delete Special can remove, in the order of its dialog */
120
+ static readonly deleteAttributeKinds: DeleteAttributeKind[] = ['dynamics', 'lyrics', 'annotations', 'chords',
121
+ 'articulations', 'ornaments', 'graceNotes', 'arpeggios', 'microtones'];
122
+ /**
123
+ * How many markings of the given kinds are on the notes of the selections. Reads only. Selections with
124
+ * no note are skipped, and kinds that are not known are ignored.
125
+ * @param selections the selected notes
126
+ * @param kinds the kinds of marking to count
127
+ */
128
+ static countNoteAttributes(selections: SmoSelection[], kinds: DeleteAttributeKind[]): number {
129
+ const handlers = SmoOperation.deleteHandlersFor(kinds);
130
+ let count = 0;
131
+ selections.forEach((selection) => {
132
+ const note = selection.note;
133
+ if (note) {
134
+ handlers.forEach((handler) => {
135
+ count += handler.count(note);
136
+ });
137
+ }
138
+ });
139
+ return count;
140
+ }
141
+ /**
142
+ * Remove every marking of the given kinds from the notes of the selections. Pitches, durations, ties and
143
+ * the kinds not listed are not changed. Kinds that are not known are ignored.
144
+ * @param selections the selected notes
145
+ * @param kinds the kinds of marking to remove
146
+ */
147
+ static deleteNoteAttributes(selections: SmoSelection[], kinds: DeleteAttributeKind[]) {
148
+ const handlers = SmoOperation.deleteHandlersFor(kinds);
149
+ selections.forEach((selection) => {
150
+ const note = selection.note;
151
+ if (note) {
152
+ handlers.forEach((handler) => handler.clear(note));
153
+ }
154
+ });
155
+ }
156
+ private static deleteHandlersFor(kinds: DeleteAttributeKind[]): DeleteAttributeHandler[] {
157
+ return kinds.filter((kind) => Object.prototype.hasOwnProperty.call(deleteAttributeHandlers, kind))
158
+ .map((kind) => deleteAttributeHandlers[kind]);
159
+ }
160
+
45
161
  static setMeasureFormat(score: SmoScore, selection: SmoSelection, value: SmoMeasureFormat) {
46
162
  if (!score.formattingManager) {
47
163
  return;
@@ -82,24 +198,70 @@ export class SmoOperation {
82
198
  });
83
199
  }
84
200
  /**
85
- * Move a single stave up or down one. If last down, move to first.
86
- * If first up, move to last
87
- * @param score
88
- * @param selection
89
- * @param index
201
+ * The staves that make up the part containing the given staff. A multi-staff part is
202
+ * kept together.
203
+ * @returns the index of the first staff of the part, and the number of staves in it
204
+ */
205
+ static getPartBlock(score: SmoScore, staffIndex: number): { start: number, length: number } {
206
+ const count = score.staves.length;
207
+ const info = score.staves[staffIndex].partInfo;
208
+ const start = Math.max(0, staffIndex - info.stavesBefore);
209
+ const end = Math.min(count - 1, staffIndex + info.stavesAfter);
210
+ return { start, length: end - start + 1 };
211
+ }
212
+ /**
213
+ * Swap the part starting at `start` with the part just before it, keeping the staves
214
+ * of each part together and in order.
215
+ */
216
+ private static swapPartWithPrevious(score: SmoScore, start: number) {
217
+ const prev = SmoOperation.getPartBlock(score, start - 1);
218
+ const cur = SmoOperation.getPartBlock(score, start);
219
+ for (let k = 0; k < cur.length; ++k) {
220
+ // bubble each staff of the current part up past the previous part
221
+ for (let j = 0; j < prev.length; ++j) {
222
+ score.swapStaves(start + k - j, start + k - j - 1);
223
+ }
224
+ }
225
+ }
226
+ /**
227
+ * Move a part up or down one. A part with 2 staves moves as a unit, so a single-staff part
228
+ * that it passes moves by 2. If last down, move to first. If first up, move to last
229
+ * @param score
230
+ * @param selection
231
+ * @param index direction to move, -1 for up and 1 for down
90
232
  */
91
233
  static moveStaffUpDown(score: SmoScore, selection: SmoSelection, index: number) {
92
- const index1 = selection.selector.staff;
93
- const index2 = selection.selector.staff + index;
94
- if (index2 < score.staves.length && index2 >= 0) {
95
- score.swapStaves(index1, index2);
96
- } else if (index2 === score.staves.length) {
97
- for (let i = 0; i < (score.staves.length - 1); ++i) {
98
- score.swapStaves((score.staves.length - 1) - i, (score.staves.length - 1) - (i + 1));
234
+ const count = score.staves.length;
235
+ if (count < 2 || selection.selector.staff >= count) {
236
+ return;
237
+ }
238
+ const block = SmoOperation.getPartBlock(score, selection.selector.staff);
239
+ if (block.length >= count) {
240
+ return;
241
+ }
242
+ let start = block.start;
243
+ if (index < 0) {
244
+ if (start > 0) {
245
+ SmoOperation.swapPartWithPrevious(score, start);
246
+ } else {
247
+ // first part up: it becomes the last, by moving each part after it up past it
248
+ while (start + block.length < count) {
249
+ const next = SmoOperation.getPartBlock(score, start + block.length);
250
+ SmoOperation.swapPartWithPrevious(score, next.start);
251
+ start += next.length;
252
+ }
99
253
  }
100
- } else if (index2 < 0) {
101
- for (let i = 0; i < (score.staves.length - 1); ++i) {
102
- score.swapStaves(i, i + 1);
254
+ } else if (index > 0) {
255
+ if (start + block.length < count) {
256
+ // moving down is the next part moving up
257
+ SmoOperation.swapPartWithPrevious(score, start + block.length);
258
+ } else {
259
+ // last part down: it becomes the first
260
+ while (start > 0) {
261
+ const prev = SmoOperation.getPartBlock(score, start - 1);
262
+ SmoOperation.swapPartWithPrevious(score, start);
263
+ start = prev.start;
264
+ }
103
265
  }
104
266
  }
105
267
  }
@@ -139,6 +301,54 @@ export class SmoOperation {
139
301
  score.staves[tabStaves[0].startSelector.staff].removeTabStaves(tabStaves);
140
302
  }
141
303
  }
304
+ /**
305
+ * Re-bar the music of measures firstMeasure to lastMeasure (all staves) into a new time signature, adding
306
+ * measures if the new one holds less time. See {@link rebarMeasures}. Unlike {@link setTimeSignature}, no
307
+ * music is lost.
308
+ * @param score the score to change
309
+ * @param firstMeasure the first measure of the range
310
+ * @param lastMeasure the last measure of the range
311
+ * @param timeSignature the new time signature
312
+ */
313
+ static rebarMeasures(score: SmoScore, firstMeasure: number, lastMeasure: number, timeSignature: SmoTimeSignature): RebarResult {
314
+ return rebarMeasures(score, firstMeasure, lastMeasure, timeSignature);
315
+ }
316
+ /**
317
+ * Would setting this time signature on measures firstMeasure to lastMeasure change anything? True if any
318
+ * of those measures, in any staff, has a time signature that is not equal to this one, display options included.
319
+ * Reads only.
320
+ */
321
+ static timeSignatureChanges(score: SmoScore, firstMeasure: number, lastMeasure: number, timeSignature: SmoTimeSignature): boolean {
322
+ return SmoOperation.rangeMeasures(score, firstMeasure, lastMeasure).some((measure) =>
323
+ !SmoTimeSignature.equalIncludeAttributes(measure.timeSignature, timeSignature));
324
+ }
325
+ /**
326
+ * Is every measure in the range, in every staff, already as long as the new time signature would make it?
327
+ * (2/2 for 4/4, or only a display option changed). If so the music does not need to move. The measure
328
+ * k places after the first has part k of a time signature that has several parts. Reads only.
329
+ */
330
+ static timeSignatureKeepsLength(score: SmoScore, firstMeasure: number, lastMeasure: number, timeSignature: SmoTimeSignature): boolean {
331
+ const measures = SmoOperation.rangeMeasures(score, firstMeasure, lastMeasure);
332
+ if (measures.length < 1) {
333
+ return true;
334
+ }
335
+ const perStaff = lastMeasure - firstMeasure + 1;
336
+ return measures.every((measure, ix) => {
337
+ const k = ix % perStaff;
338
+ const part = timeSignature.times[k % timeSignature.times.length];
339
+ const oldTicks = SmoMusic.timeSignatureToTicks(measure.timeSignature.actualBeats, measure.timeSignature.beatDuration);
340
+ return oldTicks === SmoMusic.timeSignatureToTicks(part.actualBeats, part.beatDuration);
341
+ });
342
+ }
343
+ private static rangeMeasures(score: SmoScore, firstMeasure: number, lastMeasure: number): SmoMeasure[] {
344
+ const rv: SmoMeasure[] = [];
345
+ score.staves.forEach((staff) => {
346
+ for (let m = Math.max(firstMeasure, 0); m <= lastMeasure && m < staff.measures.length; ++m) {
347
+ rv.push(staff.measures[m]);
348
+ }
349
+ });
350
+ return rv;
351
+ }
142
352
  static setTimeSignature(score: SmoScore, selections: SmoSelection[], timeSignature: SmoTimeSignature) {
143
353
  const selectors: SmoSelector[] = [];
144
354
  let i = 0;
@@ -413,18 +623,34 @@ export class SmoOperation {
413
623
  });
414
624
  }
415
625
 
626
+ /**
627
+ * Transpose the whole score by a number of half steps. The destination key of each measure is
628
+ * computed from its current key, and each pitch is spelled so that its distance from the new key
629
+ * matches its distance from the old key (e.g. e natural in Eb becomes g# in G).
630
+ * @param score
631
+ * @param offset half steps, may be negative
632
+ */
416
633
  static transposeScore(score: SmoScore, offset: number) {
417
- score.staves.forEach((staff, staffIx) => {
418
- staff.measures.forEach((measure, measureIx) => {
419
- measure.voices.forEach((voice, voiceIx) => {
420
- voice.notes.forEach((note, tickIx) => {
421
- const selection = SmoSelection.noteSelection(
422
- score,staffIx, measureIx, voiceIx, tickIx);
423
- if (selection) {
424
- this.transpose(selection, offset);
425
- }
634
+ if (offset === 0) {
635
+ return;
636
+ }
637
+ score.staves.forEach((staff) => {
638
+ staff.measures.forEach((measure) => {
639
+ const originalKey = measure.keySignature;
640
+ const destinationKey = SmoMusic.keyForOffset(originalKey, offset);
641
+ measure.voices.forEach((voice) => {
642
+ voice.notes.forEach((note) => {
643
+ SmoNote.transpose(note, [], offset, originalKey, destinationKey);
644
+ note.getGraceNotes().forEach((graceNote) => {
645
+ SmoNote.transpose(graceNote, [], offset, originalKey, destinationKey);
646
+ });
426
647
  });
427
648
  });
649
+ measure.setKeySignature(destinationKey);
650
+ });
651
+ Object.keys(staff.keySignatureMap).forEach((measureIndex) => {
652
+ const ix = parseInt(measureIndex, 10);
653
+ staff.keySignatureMap[ix] = SmoMusic.keyForOffset(staff.keySignatureMap[ix], offset);
428
654
  });
429
655
  });
430
656
  }
@@ -628,6 +854,14 @@ export class SmoOperation {
628
854
  note.beamState = SmoNote.beamStates.auto;
629
855
  }
630
856
  });
857
+ // In a measure with its own beam grouping, every note of a hand beam except the last is marked
858
+ // 'continue' so that a group boundary does not break the beam after it. Otherwise the beam
859
+ // is as it always was.
860
+ if (selections[0].measure.getBeamGroups().length > 0) {
861
+ for (let i = 0; i < beamGroup.length - 1; ++i) {
862
+ beamGroup[i].beamState = SmoNote.beamStates.continue;
863
+ }
864
+ }
631
865
  const sn = beamGroup[beamGroup.length - 1];
632
866
  sn.beamState = SmoNote.beamStates.end;
633
867
  // Make sure the last note of the previous beam is the end of this beam group.
@@ -641,6 +875,59 @@ export class SmoOperation {
641
875
  }
642
876
  }
643
877
  }
878
+ /**
879
+ * Set the beam grouping of the measures in the selections, or clear it with an empty list.
880
+ * Only the staves and measures in the selections change.
881
+ * @param score the score the selections belong to
882
+ * @param selections the notes or measures to change; every measure they touch is changed
883
+ * @param groups the longest beam group for each group in turn, whole numbers from 1 to 4
884
+ */
885
+ static setBeamGroups(score: SmoScore, selections: SmoSelection[], groups: number[]) {
886
+ selections.forEach((selection) => {
887
+ selection.measure.setBeamGroups(groups);
888
+ });
889
+ }
890
+ /**
891
+ * Set the beam grouping of every measure in every staff of the score, or clear it with
892
+ * an empty list.
893
+ */
894
+ static setAllBeamGroups(score: SmoScore, groups: number[]) {
895
+ score.staves.forEach((staff) => {
896
+ staff.measures.forEach((measure) => {
897
+ measure.setBeamGroups(groups);
898
+ });
899
+ });
900
+ }
901
+ /**
902
+ * Fill the measures in the selections with rests, removing all the notes and voices in them. See
903
+ * {@link fillRestDurations} for which rests. Everything attached to the removed notes goes with them:
904
+ * staff modifiers that start or end in the measure (slurs, ties, hairpins) and text attached to its notes.
905
+ * Only the staves and measures in the selections change.
906
+ * @param score the score the selections belong to
907
+ * @param selections the notes or measures; every measure they touch is filled
908
+ * @param fill which rests
909
+ */
910
+ static fillMeasures(score: SmoScore, selections: SmoSelection[], fill: MeasureFillType) {
911
+ const done: Record<string, boolean> = {};
912
+ selections.forEach((selection) => {
913
+ const staffIndex = selection.selector.staff;
914
+ const measure = selection.measure;
915
+ const measureIndex = measure.measureNumber.measureIndex;
916
+ const key = `${staffIndex}-${measureIndex}`;
917
+ if (done[key]) {
918
+ return;
919
+ }
920
+ done[key] = true;
921
+ // A pickup measure is filled to the length it has
922
+ const total = measure.isPickup() ? measure.getTicksFromVoice(0) : undefined;
923
+ const durations = fillRestDurations(measure.timeSignature, fill, total);
924
+ const triple = measure.timeSignature.actualBeats % 3 === 0;
925
+ const beamBeats = triple ? score.preferences.defaultTripleDuration : score.preferences.defaultDupleDuration;
926
+ selection.staff.removeModifiersInMeasure(measureIndex);
927
+ score.removeTextAttachedToMeasure(staffIndex, measureIndex);
928
+ measure.fillWithRests(durations, beamBeats);
929
+ });
930
+ }
644
931
  static clearAllBeamGroups(score: SmoScore) {
645
932
  score.staves.forEach((ss) => {
646
933
  ss.measures.forEach((mm) => {
@@ -665,6 +952,34 @@ export class SmoOperation {
665
952
  });
666
953
  }
667
954
 
955
+ /**
956
+ * Put the selected notes back to automatic beaming: no hand-placed beam break or join, and the
957
+ * beam length for the meter from the score preferences. In a measure with its own beam grouping,
958
+ * that grouping applies.
959
+ */
960
+ static autoBeamSelections(score: SmoScore, selections: SmoSelection[]) {
961
+ selections.forEach((selection) => {
962
+ const note = selection.note;
963
+ if (note) {
964
+ const triple = selection.measure.timeSignature.actualBeats % 3 === 0;
965
+ note.beamBeats = triple ? score.preferences.defaultTripleDuration : score.preferences.defaultDupleDuration;
966
+ note.beamState = SmoNote.beamStates.auto;
967
+ note.endBeam = false;
968
+ }
969
+ });
970
+ }
971
+ /**
972
+ * Set the stem direction of the selected notes
973
+ * @param flagState one of {@link SmoNote.flagStates}: auto, up or down
974
+ */
975
+ static setStemDirection(selections: SmoSelection[], flagState: number) {
976
+ selections.forEach((selection) => {
977
+ if (selection.note) {
978
+ selection.note.flagState = flagState;
979
+ }
980
+ });
981
+ }
982
+
668
983
  static toggleBeamDirection(selections: SmoSelection[]) {
669
984
  const note0 = selections[0].note as SmoNote;
670
985
  note0.toggleFlagState();
@@ -974,6 +1289,68 @@ export class SmoOperation {
974
1289
  static addStaff(score: SmoScore, parameters: SmoSystemStaffParams): SmoSystemStaff {
975
1290
  return score.addStaff(parameters);
976
1291
  }
1292
+ /**
1293
+ * Create a part with one or two staves. The part goes at the requested location, but never
1294
+ * inside an existing part with more than one staff. Staves below it move down, and anything
1295
+ * that refers to them moves too. The new part keeps its text groups (preserveTextGroups), which
1296
+ * is not the default for a part.
1297
+ * @param score the full score
1298
+ * @param params where to put the part and what it is called
1299
+ * @returns the index of the first new staff
1300
+ */
1301
+ static addPart(score: SmoScore, params: AddPartParams): number {
1302
+ const index = score.resolveNewPartIndex(params.location);
1303
+ const lastMeasure = score.staves[0].measures.length - 1;
1304
+ const typedName = (params.name ?? '').trim();
1305
+ const partName = typedName.length > 0 ? typedName : params.instrumentLabel;
1306
+ const abbreviation = (params.abbreviation ?? '').trim();
1307
+ const stavesInPart = params.twoStaves ? 2 : 1;
1308
+ const newStaves: SmoSystemStaff[] = [];
1309
+ for (let ix = 0; ix < stavesInPart; ++ix) {
1310
+ const instrument = new SmoInstrument(params.instrument);
1311
+ if (ix === 1) {
1312
+ instrument.clef = params.instrument.clef === 'treble' ? 'bass' : 'treble';
1313
+ }
1314
+ // the selectors are shared with the instrument we copied, and with the other new staff
1315
+ instrument.startSelector = JSON.parse(JSON.stringify(params.instrument.startSelector));
1316
+ instrument.endSelector = JSON.parse(JSON.stringify(params.instrument.endSelector));
1317
+ instrument.startSelector.measure = 0;
1318
+ instrument.endSelector.measure = lastMeasure;
1319
+ const partInfo = new SmoPartInfo(SmoPartInfo.defaults);
1320
+ partInfo.partName = partName;
1321
+ partInfo.partAbbreviation = abbreviation;
1322
+ partInfo.preserveTextGroups = true;
1323
+ partInfo.stavesBefore = ix;
1324
+ partInfo.stavesAfter = stavesInPart - ix - 1;
1325
+ const staffParams: SmoSystemStaffParams = SmoSystemStaff.defaults;
1326
+ staffParams.staffId = index + ix;
1327
+ staffParams.measureInstrumentMap[0] = instrument;
1328
+ staffParams.partInfo = partInfo;
1329
+ newStaves.push(score.addStaff(staffParams));
1330
+ }
1331
+ newStaves.forEach((staff) => {
1332
+ staff.updateInstrumentOffsets();
1333
+ });
1334
+ score.setNoteInstrumentProperties();
1335
+ // As for any added staff, group the new staves with the staff above them, so they are justified
1336
+ // and bracketed together. A group that already spans the new staff has grown to hold it.
1337
+ for (let ix = 0; ix < stavesInPart; ++ix) {
1338
+ const staffId = index + ix;
1339
+ if (staffId > 0) {
1340
+ const selection = SmoSelection.measureSelection(score, staffId - 1, 0);
1341
+ const grp = selection ? score.getSystemGroupForStaff(selection) : undefined;
1342
+ if (grp) {
1343
+ grp.endSelector.staff = Math.max(grp.endSelector.staff, staffId);
1344
+ } else {
1345
+ const newGroup = new SmoSystemGroup(SmoSystemGroup.defaults);
1346
+ newGroup.startSelector.staff = staffId - 1;
1347
+ newGroup.endSelector.staff = staffId;
1348
+ score.systemGroups.push(newGroup);
1349
+ }
1350
+ }
1351
+ }
1352
+ return index;
1353
+ }
977
1354
  static removeStaff(score: SmoScore, index: number) {
978
1355
  score.removeStaff(index);
979
1356
  }
@@ -1057,52 +1434,66 @@ export class SmoOperation {
1057
1434
  }
1058
1435
  score.setNoteInstrumentProperties();
1059
1436
  }
1437
+ /**
1438
+ * Group runs of empty measures into multimeasure rests, for parts that show them. A landmark splits a run:
1439
+ * a start landmark (rehearsal mark, key, time or tempo change, Segno, Coda, instrument change, repeat
1440
+ * or double barline at the start of the measure) ends the rest before its measure and that measure
1441
+ * starts the next rest; an end landmark (D.S., D.C., To Coda, Fine, repeat or double barline at the end of
1442
+ * the measure) ends the rest after its measure. Measures under a volta ending are never grouped.
1443
+ * The result is recorded in each measure's svg record: the first measure of a rest has its length, end
1444
+ * barline and end symbol, the others are hidden; every other measure is reset.
1445
+ * @param score the score being displayed
1446
+ */
1060
1447
  static computeMultipartRest(score: SmoScore) {
1061
- let i = 0;
1062
- let j = 0;
1063
- const measureRanges: Record<number, number> = {};
1064
1448
  const measureCount = score.staves[0].measures.length;
1065
1449
  if (score.staves[0].partInfo.expandMultimeasureRests === true) {
1066
1450
  return;
1067
1451
  }
1452
+ const isRestMeasure = (m: number) => {
1453
+ return score.staves[0].measures[m].format.forceRest || score.staves.every((staff) => staff.isRest(m));
1454
+ };
1455
+ const reset = (m: number, hide: boolean) => {
1456
+ score.staves.forEach((staff) => {
1457
+ const svg = staff.measures[m].svg;
1458
+ svg.multimeasureLength = 0;
1459
+ svg.multimeasureEndBarline = SmoBarline.barlines.singleBar;
1460
+ svg.multimeasureEndSymbol = null;
1461
+ svg.hideMultimeasure = hide;
1462
+ });
1463
+ };
1464
+ let i = 0;
1068
1465
  while (i < measureCount) {
1069
- let forceRest = score.staves[0].measures[i].format.forceRest;
1070
- if (score.isMultimeasureRest(i, true, forceRest)) {
1071
- for (j = i + 1; j < measureCount; ++j) {
1072
- const restBreak = score.staves[0].measures[j].format.restBreak;
1073
- forceRest = score.staves[0].measures[j].format.forceRest;
1074
- if (!score.isMultimeasureRest(j, false, forceRest) || restBreak) {
1075
- break;
1076
- }
1077
- }
1078
- if (j - i >= 2) {
1079
- measureRanges[i] = j;
1080
- }
1081
- i = j;
1082
- } else {
1083
- const startMeasure = i;
1466
+ if (score.isMultimeasureBlocked(i) || !isRestMeasure(i)) {
1467
+ reset(i, false);
1468
+ i += 1;
1469
+ continue;
1470
+ }
1471
+ // measure i starts a block; it may carry start landmarks. An end landmark closes the block.
1472
+ let j = i + 1;
1473
+ let closed = score.isMultimeasureEndLandmark(i);
1474
+ while (!closed && j < measureCount && isRestMeasure(j) && !score.isMultimeasureBlocked(j)
1475
+ && !score.staves[0].measures[j].format.restBreak && !score.isMultimeasureStartLandmark(j)) {
1476
+ closed = score.isMultimeasureEndLandmark(j);
1477
+ j += 1;
1478
+ }
1479
+ if (j - i >= 2) {
1480
+ const last = j - 1;
1481
+ reset(i, false);
1084
1482
  score.staves.forEach((staff) => {
1085
- staff.measures[startMeasure].svg.hideMultimeasure = false;
1483
+ const svg = staff.measures[i].svg;
1484
+ svg.multimeasureLength = j - i;
1485
+ svg.multimeasureEndBarline = staff.measures[last].getEndBarline().barline;
1486
+ const symbol = staff.measures[last].getRepeatSymbol();
1487
+ svg.multimeasureEndSymbol = (symbol && SmoScore.isEndRepeatSymbol(symbol.symbol)) ? symbol : null;
1086
1488
  });
1087
- i += 1;
1489
+ for (let k = i + 1; k < j; ++k) {
1490
+ reset(k, true);
1491
+ }
1492
+ } else {
1493
+ reset(i, false);
1088
1494
  }
1495
+ i = j;
1089
1496
  }
1090
- const multiKeys = Object.keys(measureRanges).map((x) => parseInt(x, 10));
1091
- multiKeys.forEach((key) => {
1092
- const endMeasure = measureRanges[key];
1093
- score.staves.forEach((staff) => {
1094
- const mmLength = endMeasure - key;
1095
- const svg = staff.measures[key].svg;
1096
- svg.multimeasureLength = mmLength;
1097
- if (svg.multimeasureLength > 1) {
1098
- svg.multimeasureEndBarline = staff.measures[endMeasure - 1].getEndBarline().barline;
1099
- }
1100
- staff.measures[key].svg.hideMultimeasure = false;
1101
- for (i = key + 1; i < endMeasure; ++i) {
1102
- staff.measures[i].svg.hideMultimeasure = true;
1103
- }
1104
- });
1105
- });
1106
1497
  }
1107
1498
  }
1108
1499