UNPKG

osmd-extended

Version:

Private / sponsor exclusive OSMD mirror/audio player.

2 lines 1.49 MB
/*! For license information please see opensheetmusicdisplay.min.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.opensheetmusicdisplay=e():t.opensheetmusicdisplay=e()}(this,()=>(()=>{var t={30:(t,e,i)=>{"use strict";var s=i(6157),n=function(t){return function(t){return null!==t&&t!==[]&&t>=0&&t<129}(t)?+t:s.midi(t)};t.exports=function(t){if(t.buffers){var e=t.opts.map,i="function"==typeof e?e:n,s=function(t){return t?i(t)||t:null};t.buffers=function(t,e){return Object.keys(t).reduce(function(i,s){return i[e(s)]=t[s],i},{})}(t.buffers,s);var r=t.start;t.start=function(t,e,i){var n=s(t),o=n%1;return o&&(n=Math.floor(n),i=Object.assign(i||{},{cents:Math.floor(100*o)})),r(n,e,i)}}return t}},67:(t,e)=>{"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),e.SystemLinePosition=void 0,function(t){t[t.MeasureBegin=0]="MeasureBegin",t[t.MeasureEnd=1]="MeasureEnd"}(i||(e.SystemLinePosition=i={}))},98:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalGlissando=void 0;const s=i(9409),n=i(6438),r=i(6452);e.GraphicalGlissando=class{constructor(t){this.Glissando=t,this.staffEntries=[]}calculateLine(t){const e=this.staffEntries[0],i=this.staffEntries[this.staffEntries.length-1],o=e.findGraphicalNoteFromNote(this.Glissando.StartNote),a=i.findGraphicalNoteFromNote(this.Glissando.EndNote);if(!o&&!a)return;const l=e.parentMeasure.ParentStaffLine;let h,u,c,d;if(o&&e.parentMeasure.ParentStaffLine===this.StaffLine)h=o.PositionAndShape.RelativePosition.x+o.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+o.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x+t.GlissandoNoteOffset,c=o.PositionAndShape.AbsolutePosition.y;else{h=i.parentMeasure.beginInstructionsWidth-.4;const e=this.Glissando.Direction===n.ColDirEnum.Down?-1:1;c=a.PositionAndShape.AbsolutePosition.y+e*t.GlissandoStafflineStartYDistanceToNote}if(a&&i.parentMeasure.ParentStaffLine===this.StaffLine)u=a.PositionAndShape.RelativePosition.x+a.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+a.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x-.5-t.GlissandoNoteOffset,h>u&&(h=u-t.GlissandoStafflineStartMinimumWidth),d=a.PositionAndShape.AbsolutePosition.y;else{if(l.Measures.last().parentSourceMeasure.HasEndLine)return;u=l.PositionAndShape.Size.width,u-h>t.GlissandoStafflineEndOffset&&(h=u-t.GlissandoStafflineEndOffset);const e=this.Glissando.Direction===n.ColDirEnum.Down?1:-1;d=o.PositionAndShape.AbsolutePosition.y+e*t.GlissandoStafflineStartYDistanceToNote}const p=new s.PointF2D(h,c),f=new s.PointF2D(u,d);void 0===this.Width&&(this.Width=t.GlissandoDefaultWidth),this.Line=new r.GraphicalLine(p,f,this.Width)}}},164:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MidiInstrument=e.ClefEnum=e.ClefInstruction=void 0;const s=i(8233),n=i(5364),r=i(8233),o=i(8233),a=i(7307);class l extends n.AbstractNotationInstruction{constructor(t=h.G,e=0,i=2){super(void 0),this.clefType=h.G,this.line=2,this.octaveOffset=0,this.line=i,this.clefType=t,this.octaveOffset=e,this.calcParameters()}static getDefaultClefFromMidiInstrument(t){switch(t){case u.Acoustic_Grand_Piano:case u.Electric_Bass_finger:case u.Electric_Bass_pick:case u.Fretless_Bass:case u.Slap_Bass_1:case u.Slap_Bass_2:case u.Synth_Bass_1:case u.Synth_Bass_2:case u.Contrabass:return new l(h.F,0,4);default:return new l(h.G,0,2)}}static getAllPossibleClefs(){const t=[];for(let e=0;e<=2;e++){const i=new l(h.G,e,2);t.push(i)}for(let e=-2;e<=0;e++){const i=new l(h.F,e,4);t.push(i)}return t}static isSupportedClef(t){switch(t){case h.G:case h.F:case h.C:case h.percussion:case h.TAB:return!0;default:return!1}}get ClefType(){return this.clefType}set ClefType(t){this.clefType=t}get Line(){return this.line}set Line(t){this.line=t}get OctaveOffset(){return this.octaveOffset}set OctaveOffset(t){this.octaveOffset=t}get ClefPitch(){return this.clefPitch}set ClefPitch(t){this.clefPitch=t}get ReferenceCyPosition(){return this.referenceCyPosition}set ReferenceCyPosition(t){this.referenceCyPosition=t}Equals(t){return this===t||!(!this||!t)&&this.clefPitch===t.clefPitch&&this.Line===t.Line}NotEqual(t){return!this.Equals(t)}ToString(){return"ClefType: "+this.clefType}calcParameters(){switch(this.clefType){case h.G:this.clefPitch=new s.Pitch(r.NoteEnum.G,1+this.octaveOffset,o.AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+2;break;case h.F:this.clefPitch=new s.Pitch(r.NoteEnum.F,0+this.octaveOffset,o.AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+1.5;break;case h.C:this.clefPitch=new s.Pitch(r.NoteEnum.C,1+this.octaveOffset,o.AccidentalEnum.NONE),this.referenceCyPosition=5-this.line;break;case h.percussion:this.clefPitch=new s.Pitch(r.NoteEnum.C,2,o.AccidentalEnum.NONE),this.referenceCyPosition=2;break;case h.TAB:this.clefPitch=new s.Pitch(r.NoteEnum.G,0,o.AccidentalEnum.NONE),this.referenceCyPosition=0;break;default:throw new a.ArgumentOutOfRangeException("clefType")}}}var h,u;e.ClefInstruction=l,function(t){t[t.G=0]="G",t[t.F=1]="F",t[t.C=2]="C",t[t.percussion=3]="percussion",t[t.TAB=4]="TAB"}(h||(e.ClefEnum=h={})),function(t){t[t.None=-1]="None",t[t.Acoustic_Grand_Piano=0]="Acoustic_Grand_Piano",t[t.Bright_Acoustic_Piano=1]="Bright_Acoustic_Piano",t[t.Electric_Grand_Piano=2]="Electric_Grand_Piano",t[t.Honky_tonk_Piano=3]="Honky_tonk_Piano",t[t.Electric_Piano_1=4]="Electric_Piano_1",t[t.Electric_Piano_2=5]="Electric_Piano_2",t[t.Harpsichord=6]="Harpsichord",t[t.Clavinet=7]="Clavinet",t[t.Celesta=8]="Celesta",t[t.Glockenspiel=9]="Glockenspiel",t[t.Music_Box=10]="Music_Box",t[t.Vibraphone=11]="Vibraphone",t[t.Marimba=12]="Marimba",t[t.Xylophone=13]="Xylophone",t[t.Tubular_Bells=14]="Tubular_Bells",t[t.Dulcimer=15]="Dulcimer",t[t.Drawbar_Organ=16]="Drawbar_Organ",t[t.Percussive_Organ=17]="Percussive_Organ",t[t.Rock_Organ=18]="Rock_Organ",t[t.Church_Organ=19]="Church_Organ",t[t.Reed_Organ=20]="Reed_Organ",t[t.Accordion=21]="Accordion",t[t.Harmonica=22]="Harmonica",t[t.Tango_Accordion=23]="Tango_Accordion",t[t.Acoustic_Guitar_nylon=24]="Acoustic_Guitar_nylon",t[t.Acoustic_Guitar_steel=25]="Acoustic_Guitar_steel",t[t.Electric_Guitar_jazz=26]="Electric_Guitar_jazz",t[t.Electric_Guitar_clean=27]="Electric_Guitar_clean",t[t.Electric_Guitar_muted=28]="Electric_Guitar_muted",t[t.Overdriven_Guitar=29]="Overdriven_Guitar",t[t.Distortion_Guitar=30]="Distortion_Guitar",t[t.Guitar_harmonics=31]="Guitar_harmonics",t[t.Acoustic_Bass=32]="Acoustic_Bass",t[t.Electric_Bass_finger=33]="Electric_Bass_finger",t[t.Electric_Bass_pick=34]="Electric_Bass_pick",t[t.Fretless_Bass=35]="Fretless_Bass",t[t.Slap_Bass_1=36]="Slap_Bass_1",t[t.Slap_Bass_2=37]="Slap_Bass_2",t[t.Synth_Bass_1=38]="Synth_Bass_1",t[t.Synth_Bass_2=39]="Synth_Bass_2",t[t.Violin=40]="Violin",t[t.Viola=41]="Viola",t[t.Cello=42]="Cello",t[t.Contrabass=43]="Contrabass",t[t.Tremolo_Strings=44]="Tremolo_Strings",t[t.Pizzicato_Strings=45]="Pizzicato_Strings",t[t.Orchestral_Harp=46]="Orchestral_Harp",t[t.Timpani=47]="Timpani",t[t.String_Ensemble_1=48]="String_Ensemble_1",t[t.String_Ensemble_2=49]="String_Ensemble_2",t[t.Synth_Strings_1=50]="Synth_Strings_1",t[t.Synth_Strings_2=51]="Synth_Strings_2",t[t.Choir_Aahs=52]="Choir_Aahs",t[t.Voice_Oohs=53]="Voice_Oohs",t[t.Synth_Voice=54]="Synth_Voice",t[t.Orchestra_Hit=55]="Orchestra_Hit",t[t.Trumpet=56]="Trumpet",t[t.Trombone=57]="Trombone",t[t.Tuba=58]="Tuba",t[t.Muted_Trumpet=59]="Muted_Trumpet",t[t.French_Horn=60]="French_Horn",t[t.Brass_Section=61]="Brass_Section",t[t.Synth_Brass_1=62]="Synth_Brass_1",t[t.Synth_Brass_2=63]="Synth_Brass_2",t[t.Soprano_Sax=64]="Soprano_Sax",t[t.Alto_Sax=65]="Alto_Sax",t[t.Tenor_Sax=66]="Tenor_Sax",t[t.Baritone_Sax=67]="Baritone_Sax",t[t.Oboe=68]="Oboe",t[t.English_Horn=69]="English_Horn",t[t.Bassoon=70]="Bassoon",t[t.Clarinet=71]="Clarinet",t[t.Piccolo=72]="Piccolo",t[t.Flute=73]="Flute",t[t.Recorder=74]="Recorder",t[t.Pan_Flute=75]="Pan_Flute",t[t.Blown_Bottle=76]="Blown_Bottle",t[t.Shakuhachi=77]="Shakuhachi",t[t.Whistle=78]="Whistle",t[t.Ocarina=79]="Ocarina",t[t.Lead_1_square=80]="Lead_1_square",t[t.Lead_2_sawtooth=81]="Lead_2_sawtooth",t[t.Lead_3_calliope=82]="Lead_3_calliope",t[t.Lead_4_chiff=83]="Lead_4_chiff",t[t.Lead_5_charang=84]="Lead_5_charang",t[t.Lead_6_voice=85]="Lead_6_voice",t[t.Lead_7_fifths=86]="Lead_7_fifths",t[t.Lead_8_bass_lead=87]="Lead_8_bass_lead",t[t.Pad_1_new_age=88]="Pad_1_new_age",t[t.Pad_2_warm=89]="Pad_2_warm",t[t.Pad_3_polysynth=90]="Pad_3_polysynth",t[t.Pad_4_choir=91]="Pad_4_choir",t[t.Pad_5_bowed=92]="Pad_5_bowed",t[t.Pad_6_metallic=93]="Pad_6_metallic",t[t.Pad_7_halo=94]="Pad_7_halo",t[t.Pad_8_sweep=95]="Pad_8_sweep",t[t.FX_1_rain=96]="FX_1_rain",t[t.FX_2_soundtrack=97]="FX_2_soundtrack",t[t.FX_3_crystal=98]="FX_3_crystal",t[t.FX_4_atmosphere=99]="FX_4_atmosphere",t[t.FX_5_brightness=100]="FX_5_brightness",t[t.FX_6_goblins=101]="FX_6_goblins",t[t.FX_7_echoes=102]="FX_7_echoes",t[t.FX_8_scifi=103]="FX_8_scifi",t[t.Sitar=104]="Sitar",t[t.Banjo=105]="Banjo",t[t.Shamisen=106]="Shamisen",t[t.Koto=107]="Koto",t[t.Kalimba=108]="Kalimba",t[t.Bag_pipe=109]="Bag_pipe",t[t.Fiddle=110]="Fiddle",t[t.Shanai=111]="Shanai",t[t.Tinkle_Bell=112]="Tinkle_Bell",t[t.Agogo=113]="Agogo",t[t.Steel_Drums=114]="Steel_Drums",t[t.Woodblock=115]="Woodblock",t[t.Taiko_Drum=116]="Taiko_Drum",t[t.Melodic_Tom=117]="Melodic_Tom",t[t.Synth_Drum=118]="Synth_Drum",t[t.Reverse_Cymbal=119]="Reverse_Cymbal",t[t.Guitar_Fret_Noise=120]="Guitar_Fret_Noise",t[t.Breath_Noise=121]="Breath_Noise",t[t.Seashore=122]="Seashore",t[t.Bird_Tweet=123]="Bird_Tweet",t[t.Telephone_Ring=124]="Telephone_Ring",t[t.Helicopter=125]="Helicopter",t[t.Applause=126]="Applause",t[t.Gunshot=127]="Gunshot",t[t.Percussion=128]="Percussion"}(u||(e.MidiInstrument=u={}))},200:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RectangleF2D=void 0;const s=i(6864),n=i(9409);class r{constructor(t,e,i,s){this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=i,this.height=s}static createFromLocationAndSize(t,e){return new r(t.x,t.y,e.width,e.height)}get Location(){return new n.PointF2D(this.x,this.y)}get Size(){return new s.SizeF2D(this.width,this.height)}}e.RectangleF2D=r},214:t=>{t.exports=function t(e,i,s){function n(o,a){if(!i[o]){if(!e[o]){if(r)return r(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var h=i[o]={exports:{}};e[o][0].call(h.exports,function(t){return n(e[o][1][t]||t)},h,h.exports,t,e,i,s)}return i[o].exports}for(var r=void 0,o=0;o<s.length;o++)n(s[o]);return n}({1:[function(t,e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(t){return new function(t){if(this._event=t,this._data=t.data,this.receivedTime=t.receivedTime,this._data&&this._data.length<2)console.warn("Illegal MIDI message of length",this._data.length);else switch(this._messageCode=240&t.data[0],this.channel=15&t.data[0],this._messageCode){case 128:this.messageType="noteoff",this.key=127&t.data[1],this.velocity=127&t.data[2];break;case 144:this.messageType="noteon",this.key=127&t.data[1],this.velocity=127&t.data[2];break;case 160:this.messageType="keypressure",this.key=127&t.data[1],this.pressure=127&t.data[2];break;case 176:this.messageType="controlchange",this.controllerNumber=127&t.data[1],this.controllerValue=127&t.data[2],120===this.controllerNumber&&0===this.controllerValue?this.channelModeMessage="allsoundoff":121===this.controllerNumber?this.channelModeMessage="resetallcontrollers":122===this.controllerNumber?0===this.controllerValue?this.channelModeMessage="localcontroloff":this.channelModeMessage="localcontrolon":123===this.controllerNumber&&0===this.controllerValue?this.channelModeMessage="allnotesoff":124===this.controllerNumber&&0===this.controllerValue?this.channelModeMessage="omnimodeoff":125===this.controllerNumber&&0===this.controllerValue?this.channelModeMessage="omnimodeon":126===this.controllerNumber?this.channelModeMessage="monomodeon":127===this.controllerNumber&&(this.channelModeMessage="polymodeon");break;case 192:this.messageType="programchange",this.program=t.data[1];break;case 208:this.messageType="channelpressure",this.pressure=127&t.data[1];break;case 224:this.messageType="pitchbendchange";var e=127&t.data[2],i=127&t.data[1];this.pitchBend=(e<<8)+i}}(t)},e.exports=i.default},{}]},{},[1])(1)},242:(t,e)=>{"use strict";var i,s,n;Object.defineProperty(e,"__esModule",{value:!0}),e.PhonicScoreModes=e.MusicSymbolDrawingStyle=e.DrawingMode=void 0,function(t){t[t.All=0]="All",t[t.NoOverlays=1]="NoOverlays",t[t.Leadsheet=2]="Leadsheet"}(i||(e.DrawingMode=i={})),function(t){t[t.Normal=0]="Normal",t[t.Disabled=1]="Disabled",t[t.Selected=2]="Selected",t[t.Clickable=3]="Clickable",t[t.PlaybackSymbols=4]="PlaybackSymbols",t[t.FollowSymbols=5]="FollowSymbols",t[t.QFeedbackNotFound=6]="QFeedbackNotFound",t[t.QFeedbackOk=7]="QFeedbackOk",t[t.QFeedbackPerfect=8]="QFeedbackPerfect",t[t.Debug1=9]="Debug1",t[t.Debug2=10]="Debug2",t[t.Debug3=11]="Debug3"}(s||(e.MusicSymbolDrawingStyle=s={})),function(t){t[t.Following=0]="Following",t[t.Midi=1]="Midi",t[t.Manual=2]="Manual"}(n||(e.PhonicScoreModes=n={}))},283:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PlaybackSettings=void 0;const s=i(2561);class n{constructor(t=new s.Fraction,e=100){this.rhythm=t,this.beatsPerMinute=e,this.beatLengthInMilliseconds=6e4/e,this.beatRealValue=1/4}static createFrom(t){return new n(t.Rhythm,t.BeatsPerMinute)}get BeatsPerMinute(){return this.beatsPerMinute}set BeatsPerMinute(t){this.beatsPerMinute=t,this.beatLengthInMilliseconds=6e4/this.beatsPerMinute}get Rhythm(){return this.rhythm}set Rhythm(t){this.rhythm=t}get BeatRealValue(){return this.beatRealValue}get BeatLengthInMilliseconds(){return this.beatLengthInMilliseconds}getDurationInMilliseconds(t){return("number"==typeof t?t:t.RealValue)*this.BeatLengthInMilliseconds/this.beatRealValue}getDurationAsNoteDuration(t,e=1024){const i=t/this.BeatLengthInMilliseconds;let n=Math.floor(i);const r=new s.Fraction(n,4),o=i-n;return n=Math.round(o/(1/e)/4),0!==o&&0===n&&t>0&&(n=1),r.Add(new s.Fraction(n,e)),r}}e.PlaybackSettings=n},298:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StaffLineActivitySymbol=void 0;const s=i(7741),n=i(6438);class r extends s.GraphicalObject{constructor(t){super(),this.parentStaffLine=t;const e=t.PositionAndShape;this.boundingBox=new n.BoundingBox(this,e),this.boundingBox.BorderRight=6,this.boundingBox.BorderBottom=4.5,this.boundingBox.BorderLeft=-1.5,this.boundingBox.BorderTop=-1.5}}e.StaffLineActivitySymbol=r},302:function(t,e,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(t,e,i,s){void 0===s&&(s=i);var n=Object.getOwnPropertyDescriptor(e,i);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,s,n)}:function(t,e,i,s){void 0===s&&(s=i),t[s]=e[i]}),n=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||s(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),n(i(4127),e),n(i(9536),e),n(i(3235),e),n(i(5984),e),n(i(6030),e),n(i(6302),e),n(i(7631),e),n(i(3186),e)},348:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalStaffEntry=void 0;const s=i(6438),n=i(2561),r=i(7741),o=i(813),a=i(7921);class l extends r.GraphicalObject{constructor(t,e=void 0,i=void 0){super(),this.graphicalChordContainers=[],this.tabStaffEntry=void 0,this.MaxAccidentals=0,this.graphicalInstructions=[],this.ties=[],this.graphicalTies=[],this.lyricsEntries=[],this.parentMeasure=t,this.graphicalVoiceEntries=[],this.sourceStaffEntry=e,i?(this.staffEntryParent=i,this.parentVerticalContainer=i.parentVerticalContainer,this.PositionAndShape=new s.BoundingBox(this,i.PositionAndShape)):this.PositionAndShape=new s.BoundingBox(this,t.PositionAndShape),e&&(this.relInMeasureTimestamp=e.Timestamp),this.FingeringEntries=[]}get GraphicalInstructions(){return this.graphicalInstructions}get GraphicalTies(){return this.graphicalTies}get LyricsEntries(){return this.lyricsEntries}set LyricsEntries(t){this.lyricsEntries=t}getAbsoluteTimestamp(){const t=this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.clone();return this.relInMeasureTimestamp&&t.Add(this.relInMeasureTimestamp),t}findTieGraphicalNoteFromNote(t){for(const e of this.graphicalVoiceEntries)for(const i of e.notes){const e=i.sourceNote;if(!e.isRest()&&e.Pitch.FundamentalNote===t.Pitch.FundamentalNote&&e.Pitch.Octave===t.Pitch.Octave&&e.getAbsoluteTimestamp().Equals(t.getAbsoluteTimestamp()))return i}}findEndTieGraphicalNoteFromNoteWithStartingSlur(t,e){if(t)for(const i of this.graphicalVoiceEntries)if(i.parentVoiceEntry===t.ParentVoiceEntry)for(const t of i.notes){const i=t.sourceNote;if(i.NoteTie&&-1!==i.NoteSlurs.indexOf(e))return t}}findGraphicalNoteFromGraceNote(t){if(t)for(const e of this.graphicalVoiceEntries)if(e.parentVoiceEntry===t.ParentVoiceEntry)for(const i of e.notes)if(i.sourceNote===t)return i}findGraphicalNoteFromNote(t){if(t)for(const e of this.graphicalVoiceEntries)if(e.parentVoiceEntry===t.ParentVoiceEntry)for(const i of e.notes)if(i.sourceNote===t&&this.getAbsoluteTimestamp().Equals(t.getAbsoluteTimestamp()))return i}getGraphicalNoteDurationFromVoice(t){for(const e of this.graphicalVoiceEntries)if(e.parentVoiceEntry.ParentVoice===t)return e.notes[0].graphicalNoteLength;return new n.Fraction(0,1)}findVoiceEntryGraphicalNotes(t){for(const e of this.graphicalVoiceEntries)if(e.parentVoiceEntry===t)return e.notes}isVoiceEntryPartOfLinkedVoiceEntry(t){if(this.sourceStaffEntry.Link)for(let e=0,i=this.sourceStaffEntry.Link.LinkStaffEntries.length;e<i;++e){const i=this.sourceStaffEntry.Link.LinkStaffEntries[e];if(-1!==i.VoiceEntries.indexOf(t)&&i!==this.sourceStaffEntry)return!0}return!1}findStaffEntryMinNoteLength(){let t=new n.Fraction(Number.MAX_VALUE,1);for(const e of this.graphicalVoiceEntries)for(const i of e.notes){const e=i.graphicalNoteLength;e.lt(t)&&e.GetExpandedNumerator()>0&&(t=e)}return t}findStaffEntryMaxNoteLength(){let t=new n.Fraction(0,1);for(const e of this.graphicalVoiceEntries)for(const i of e.notes){const e=i.graphicalNoteLength;t.lt(e)&&e.GetExpandedNumerator()>0&&(t=e)}return t}findOrCreateGraphicalVoiceEntry(t){for(const e of this.graphicalVoiceEntries)if(e.parentVoiceEntry===t)return e;const e=a.MusicSheetCalculator.symbolFactory.createVoiceEntry(t,this);return this.graphicalVoiceEntries.push(e),e}findOrCreateGraphicalVoiceEntryFromGraphicalNote(t){for(const e of this.graphicalVoiceEntries)if(e===t.parentVoiceEntry)return e;const e=a.MusicSheetCalculator.symbolFactory.createVoiceEntry(t.sourceNote.ParentVoiceEntry,this);return this.graphicalVoiceEntries.push(e),e}addGraphicalNoteToListAtCorrectYPosition(t,e){const i=t.notes;if(0===i.length||e.PositionAndShape.RelativePosition.y<o.CollectionUtil.last(i).PositionAndShape.RelativePosition.y)i.push(e);else for(let t=i.length-1;t>=0;t--){if(i[t].PositionAndShape.RelativePosition.y>e.PositionAndShape.RelativePosition.y){i.splice(t+1,0,e);break}if(0===t){i.splice(0,0,e);break}}}hasOnlyRests(){return this.sourceStaffEntry.hasOnlyRests}getSkylineMin(){const t=this.parentMeasure?.ParentStaffLine.SkyBottomLineCalculator;if(!t)return;const[e,i]=this.getAbsoluteStartAndEnd();return t.getSkyLineMinInRange(e,i)}getHighestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getSkylineMin()}getLowestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getBottomlineMax()}getBottomlineMax(){const t=this.parentMeasure?.ParentStaffLine.SkyBottomLineCalculator;if(!t)return;const[e,i]=this.getAbsoluteStartAndEnd();return t.getBottomLineMaxInRange(e,i)}getAbsoluteStartAndEnd(){let t=this.PositionAndShape.AbsolutePosition.x;return t-=this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.x,[t,t+this.PositionAndShape.Size.width]}}e.GraphicalStaffEntry=l},361:(t,e,i)=>{"use strict";i.d(e,{O:()=>r});var s=i(5215),n=i(6009),r=function(){function t(t,e){for(var i=[],n=2;n<arguments.length;n++)i[n-2]=arguments[n];this.root=t,this.initialize.apply(this,(0,s.gz)(i)),this.foundation=void 0===e?this.getDefaultFoundation():e,this.foundation.init(),this.initialSyncWithDOM()}return t.attachTo=function(e){return new t(e,new n.I({}))},t.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},t.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},t.prototype.initialSyncWithDOM=function(){},t.prototype.destroy=function(){this.foundation.destroy()},t.prototype.listen=function(t,e,i){this.root.addEventListener(t,e,i)},t.prototype.unlisten=function(t,e,i){this.root.removeEventListener(t,e,i)},t.prototype.emit=function(t,e,i){var s;void 0===i&&(i=!1),"function"==typeof CustomEvent?s=new CustomEvent(t,{bubbles:i,detail:e}):(s=document.createEvent("CustomEvent")).initCustomEvent(t,i,!1,e),this.root.dispatchEvent(s)},t}()},363:function(t,e,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(t,e,i,s){void 0===s&&(s=i);var n=Object.getOwnPropertyDescriptor(e,i);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,s,n)}:function(t,e,i,s){void 0===s&&(s=i),t[s]=e[i]}),n=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||s(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),n(i(8659),e)},427:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MusicSheet=void 0;const n=i(2561),r=i(9024),o=i(6001),a=i(7435),l=i(5534),h=i(8786),u=i(9713),c=i(2683),d=s(i(3065)),p=i(7533),f=i(3263),m=i(283);class g{constructor(){this.idString="uninitialized",this.sourceMeasures=[],this.repetitions=[],this.dynListStaves=[],this.timestampSortedDynamicExpressionsList=[],this.timestampSortedTempoExpressionsList=[],this.instrumentalGroups=[],this.instruments=[],this.musicPartManager=void 0,this.musicSheetErrors=new h.MusicSheetErrors,this.staves=[],this.playbackDataDict=new f.Dictionary,this.transpose=0,this.defaultStartTempoInBpm=0,this.drawErroneousMeasures=!1,this.hasBeenOpenedForTheFirstTime=!1,this.currentEnrolledPosition=new n.Fraction(0,1),this.MeasureWidthFactor=1,this.userStartTempoInBPM=100,this.playbackSettings=new m.PlaybackSettings(new n.Fraction(4,4,0,!1),this.userStartTempoInBPM),this.pageWidth=120,this.MusicPartManager=new r.MusicPartManager(this),this.hasBPMInfo=!1}static getIndexFromStaff(t){return t.idInMusicSheet}get SourceMeasures(){return this.sourceMeasures}set SourceMeasures(t){this.sourceMeasures=t}get Repetitions(){return this.repetitions}set Repetitions(t){this.repetitions=t}get DynListStaves(){return this.dynListStaves}get TimestampSortedTempoExpressionsList(){return this.timestampSortedTempoExpressionsList}set TimestampSortedTempoExpressionsList(t){this.timestampSortedTempoExpressionsList=t}get TimestampSortedDynamicExpressionsList(){return this.timestampSortedDynamicExpressionsList}get InstrumentalGroups(){return this.instrumentalGroups}get Parts(){return this.instruments}get Instruments(){return this.instruments}get SheetPlaybackSetting(){return this.playbackSettings}set SheetPlaybackSetting(t){this.playbackSettings=t}get DrawErroneousMeasures(){return this.drawErroneousMeasures}set DrawErroneousMeasures(t){this.drawErroneousMeasures=t}get HasBeenOpenedForTheFirstTime(){return this.hasBeenOpenedForTheFirstTime}set HasBeenOpenedForTheFirstTime(t){this.hasBeenOpenedForTheFirstTime=t}InitializeStartTempoInBPM(t){this.playbackSettings.BeatsPerMinute=t,this.userStartTempoInBPM=t}get DefaultStartTempoInBpm(){return this.defaultStartTempoInBpm}set DefaultStartTempoInBpm(t){this.defaultStartTempoInBpm=t,this.InitializeStartTempoInBPM(t)}get Path(){return this.path}set Path(t){this.path=t}get Staves(){return this.staves}get TitleString(){return this.title?this.title.text:""}set TitleString(t){this.Title=new a.Label(t)}get SubtitleString(){return this.subtitle?this.subtitle.text:""}set SubtitleString(t){this.Subtitle=new a.Label(t)}get ComposerString(){return this.composer?this.composer.text:""}set ComposerString(t){this.Composer=new a.Label(t)}get LyricistString(){return this.lyricist?this.lyricist.text:""}set LyricistString(t){this.Lyricist=new a.Label(t)}get CopyrightString(){return this.copyright?this.copyright.text:""}set CopyrightString(t){this.Copyright=new a.Label(t,p.TextAlignmentEnum.CenterBottom,void 0,!0)}get Title(){return this.title}set Title(t){this.title=t}get Subtitle(){return this.subtitle}set Subtitle(t){this.subtitle=t}get Composer(){return this.composer}set Composer(t){this.composer=t}get Lyricist(){return this.lyricist}set Lyricist(t){this.lyricist=t}get Copyright(){return this.copyright}set Copyright(t){this.copyright=t}get Rules(){return this.rules||(d.default.debug("warning: sheet.Rules was undefined. Creating new EngravingRules."),this.rules=new u.EngravingRules),this.rules}set Rules(t){this.rules=t}get SheetErrors(){return this.musicSheetErrors}get PlaybackDataDict(){return this.playbackDataDict}get SelectionStart(){return this.selectionStart}set SelectionStart(t){this.selectionStart=t.clone(),this.currentEnrolledPosition=t.clone()}get SelectionEnd(){return this.selectionEnd}set SelectionEnd(t){this.selectionEnd=t}set HasBPMInfo(t){this.hasBPMInfo=t}get HasBPMInfo(){return this.hasBPMInfo}addMeasure(t){this.sourceMeasures.push(t),t.measureListIndex=this.sourceMeasures.length-1}checkForInstrumentWithNoVoice(){for(let t=0,e=this.instruments.length;t<e;++t){const e=this.instruments[t];if(0===e.Voices.length){const t=new l.Voice(e,1);e.Voices.push(t)}}}getStaffFromIndex(t){return this.staves[t]}fillStaffList(){let t=0;for(let e=0,i=this.instruments.length;e<i;++e){const i=this.instruments[e];for(let e=0,s=i.Staves.length;e<s;++e){const s=i.Staves[e];s.idInMusicSheet=t,this.staves.push(s),t++}}}get MusicPartManager(){return this.musicPartManager}set MusicPartManager(t){this.musicPartManager=t}getCompleteNumberOfStaves(){let t=0;for(let e=0,i=this.instruments.length;e<i;++e)t+=this.instruments[e].Staves.length;return t}getListOfMeasuresFromIndeces(t,e){const i=[];for(let s=t;s<=e;s++)i.push(this.sourceMeasures[s]);return i}getMeasureFromIndex(t){return this.sourceMeasures[t]}getNextSourceMeasure(t){const e=this.sourceMeasures.indexOf(t);return e===this.sourceMeasures.length-1?t:this.sourceMeasures[e+1]}getFirstSourceMeasure(){return this.sourceMeasures[0]}getLastSourceMeasure(){return this.sourceMeasures[this.sourceMeasures.length-1]}resetAllNoteStates(){const t=this.MusicPartManager.getIterator();for(;!t.EndReached&&t.CurrentVoiceEntries;){for(let e=0,i=t.CurrentVoiceEntries.length;e<i;++e){const i=t.CurrentVoiceEntries[e];for(let t=0,e=i.Notes.length;t<e;++t)i.Notes[t].state=c.NoteState.Normal}t.moveToNext()}}getMusicSheetInstrumentIndex(t){return this.Instruments.indexOf(t)}getGlobalStaffIndexOfFirstStaff(t){const e=this.getMusicSheetInstrumentIndex(t);let i=0;for(let t=0;t<e;t++)i+=this.Instruments[t].Staves.length;return i}setRepetitionNewUserNumberOfRepetitions(t,e){let i=0;for(let s=0;s<this.repetitions.length;s++)if(this.repetitions[s]instanceof o.Repetition){if(t===i){this.repetitions[s].UserNumberOfRepetitions=e;break}i++}}getRepetitionByIndex(t){let e=0;for(let i=0;i<this.repetitions.length;i++)if(this.repetitions[i]instanceof o.Repetition){if(t===e)return this.repetitions[i];e++}}CompareTo(t){return this.Title.text.localeCompare(t.Title.text)}getExpressionsStartTempoInBPM(){if(this.TimestampSortedTempoExpressionsList.length>0){const t=this.TimestampSortedTempoExpressionsList[0];if(t.InstantaneousTempo)return t.InstantaneousTempo.TempoInBpm;if(t.ContinuousTempo)return t.ContinuousTempo.StartTempo}return this.userStartTempoInBPM}get Errors(){return this.musicSheetErrors.measureErrors}get FirstMeasureNumber(){try{return this.getFirstSourceMeasure().MeasureNumber}catch(t){return d.default.info("MusicSheet.FirstMeasureNumber: ",t),0}}get LastMeasureNumber(){try{return this.getLastSourceMeasure().MeasureNumber}catch(t){return d.default.info("MusicSheet.LastMeasureNumber: ",t),0}}get CurrentEnrolledPosition(){return this.currentEnrolledPosition.clone()}set CurrentEnrolledPosition(t){this.currentEnrolledPosition=t.clone()}get Transpose(){return this.transpose}set Transpose(t){this.transpose=t}get FullNameString(){return this.ComposerString+" "+this.TitleString}get IdString(){return this.idString}set IdString(t){this.idString=t}getEnrolledSelectionStartTimeStampWorkaround(){const t=this.MusicPartManager.getIterator(this.SelectionStart);return n.Fraction.createFromFraction(t.CurrentEnrolledTimestamp)}get SheetEndTimestamp(){const t=this.getLastSourceMeasure();return n.Fraction.plus(t.AbsoluteTimestamp,t.Duration)}getSourceMeasureFromTimeStamp(t){for(let e=0,i=this.sourceMeasures.length;e<i;++e){const i=this.sourceMeasures[e];for(let e=0,s=i.VerticalSourceStaffEntryContainers.length;e<s;++e){const s=i.VerticalSourceStaffEntryContainers[e];if(t.Equals(s.getAbsoluteTimestamp()))return i}}return this.findSourceMeasureFromTimeStamp(t)}findSourceMeasureFromTimeStamp(t){for(const e of this.sourceMeasures)if(e.AbsoluteTimestamp.lte(t)&&t.lt(n.Fraction.plus(e.AbsoluteTimestamp,e.Duration)))return e}getVisibleInstruments(){const t=[];for(let e=0,i=this.Instruments.length;e<i;++e){const i=this.Instruments[e];i.Voices.length>0&&i.Voices[0].Visible&&t.push(i)}return t}}e.MusicSheet=g,g.defaultTitle="defaultTitle"},437:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OctaveEnum=e.OctaveShift=void 0;const s=i(8233);var n;e.OctaveShift=class{constructor(t,e){this.numberXml=1,this.setOctaveShiftValue(t,e)}get Type(){return this.octaveValue}set Type(t){this.octaveValue=t}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t}get ParentStartMultiExpression(){return this.startMultiExpression}set ParentStartMultiExpression(t){this.startMultiExpression=t}get ParentEndMultiExpression(){return this.endMultiExpression}set ParentEndMultiExpression(t){this.endMultiExpression=t}setOctaveShiftValue(t,e){this.octaveValue=1===e&&"down"===t?n.VA8:1===e&&"up"===t?n.VB8:2===e&&"down"===t?n.MA15:2===e&&"up"===t?n.MB15:n.NONE}static getPitchFromOctaveShift(t,e){if(!t)return;if(t.OctaveShiftApplied)return t;let i=t.Octave;switch(e){case n.VA8:i-=1;break;case n.VB8:i+=1;break;case n.MA15:i-=2;break;case n.MB15:i+=2;break;case n.NONE:default:i+=0}const r=new s.Pitch(t.FundamentalNote,i,t.Accidental);return r.OctaveShiftApplied=!0,r}},function(t){t[t.VA8=0]="VA8",t[t.VB8=1]="VB8",t[t.MA15=2]="MA15",t[t.MB15=3]="MB15",t[t.NONE=4]="NONE"}(n||(e.OctaveEnum=n={}))},448:function(t,e){var i,s;void 0===(s="function"==typeof(i=function(){"use strict";return function(t){for(var e={command:/\s*([achlmqstvz])/gi,number:/\s*([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/gi,comma:/\s*(?:(,)|\s)/g,flag:/\s*([01])/g},i={number:function(t){return+u("number",t)},"coordinate pair":function(t){var e=u("number",t);return null!==e||t?(u("comma"),{x:+e,y:+u("number",!0)}):null},"arc definition":function(t){var e=i["coordinate pair"](t);if(!e&&!t)return null;u("comma");var s=+u("number",!0);u("comma",!0);var n=!!+u("flag",!0);u("comma");var r=!!+u("flag",!0);return u("comma"),{radii:e,rotation:s,large:n,clockwise:r,end:i["coordinate pair"](!0)}}},s=0,n=[];s<t.length;){var r,o=u("command"),a=o.toUpperCase(),l=o!==a;switch(a){case"M":r=c("coordinate pair").map(function(t,e){return 1===e&&(o=l?"l":"L"),h({end:t})});break;case"L":case"T":r=c("coordinate pair").map(function(t){return h({end:t})});break;case"C":if((r=c("coordinate pair")).length%3)throw Error("Expected coordinate pair triplet at position "+s);r=r.reduce(function(t,e,i){var s=i%3;return s?t[t.length-1][1===s?"cp2":"end"]=e:t.push(h({cp1:e})),t},[]);break;case"Q":case"S":if(1&(r=c("coordinate pair")).length)throw Error("Expected coordinate pair couple at position "+s);r=r.reduce(function(t,e,i){return 1&i?t[t.length-1].end=e:t.push(h({cp:e})),t},[]);break;case"H":case"V":r=c("number").map(function(t){return h({value:t})});break;case"A":r=c("arc definition").map(h);break;case"Z":r=[{code:"Z"}]}n.push.apply(n,r)}return n;function h(t){return t.code=o,t.relative=l,t}function u(i,n){e[i].lastIndex=s;var r=e[i].exec(t);if(!r||r.index!==s){if(!n)return null;throw Error("Expected "+i+" at position "+s)}return s=e[i].lastIndex,r[1]}function c(t){for(var e,s=[],n=!0;e=i[t](n);)s.push(e),n=!!u("comma");return s}}})?i.apply(e,[]):i)||(t.exports=s)},469:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VoiceGenerator=void 0;const n=i(4249),r=i(5534),o=i(1336),a=i(1850),l=i(2369),h=i(8365),u=i(5274),c=i(2257),d=i(4268),p=i(2561),f=i(2148),m=i(6030),g=i(7307),b=i(8233),S=i(8233),y=i(6644),v=s(i(3065)),E=i(8233),_=i(813),x=i(4127),M=i(4064),P=i(4236),T=i(5282),w=i(9647),I=i(6362);e.VoiceGenerator=class{constructor(t,e,i,s,o=void 0){this.openBeams=[],this.beamNumberOffset=0,this.currentOctaveShift=0,this.tupletDict={},this.openTupletNumber=0,this.currMeasureVoiceEntries=[],this.graceVoiceEntriesTempList=[],this.staff=e,this.instrument=e.ParentInstrument,this.musicSheet=this.instrument.GetMusicSheet,this.slurReader=s,this.pluginManager=t,this.voice=o?new n.LinkedVoice(this.instrument,i,o):new r.Voice(this.instrument,i),this.instrument.Voices.push(this.voice),this.staff.Voices.push(this.voice),this.lyricsReader=new m.LyricsReader(this.musicSheet),this.articulationReader=new x.ArticulationReader(this.musicSheet.Rules)}get openTieDict(){return this.staff.openTieDict}get GetVoice(){return this.voice}get OctaveShift(){return this.currentOctaveShift}set OctaveShift(t){this.currentOctaveShift=t}createVoiceEntry(t,e,i,s,n=!1,r=!1,a=!1){this.activeKey=i,this.activeRhythm=s,this.currentVoiceEntry=new o.VoiceEntry(p.Fraction.createFromFraction(t),this.voice,e,!0,n,r,a),n?this.graceVoiceEntriesTempList.push(this.currentVoiceEntry):(this.currentNormalVoiceEntry=this.currentVoiceEntry,this.currMeasureVoiceEntries.push(this.currentNormalVoiceEntry),this.graceVoiceEntriesTempList.length>0&&(this.currentVoiceEntry.GraceVoiceEntriesBefore=this.graceVoiceEntriesTempList,this.graceVoiceEntriesTempList=[]))}finalizeReadingMeasure(){this.graceVoiceEntriesTempList.length>0&&void 0!==this.currentNormalVoiceEntry&&this.currentNormalVoiceEntry.GraceVoiceEntriesAfter.concat(this.graceVoiceEntriesTempList),this.graceVoiceEntriesTempList=[],this.pluginManager.processVoiceMeasureReadPlugins(this.currMeasureVoiceEntries,this.activeKey,this.activeRhythm),this.currMeasureVoiceEntries.length=0,this.openBeams.length>1&&this.handleOpenBeam()}read(t,e,i,s,n,r,o,a,l,h,u,d,p,m,g,b,S,y,E,_){this.currentStaffEntry=o,this.currentMeasure=a;try{this.currentNote=r?this.addRestNote(t.element("rest"),e,s,i,n,p,m,E):this.addSingleNote(t,e,s,i,n,u,d,p,m,g,b,S,y,E),this.currentNote.DotsXml=_;const o=t.elements("lyric");void 0!==this.lyricsReader&&o&&(this.lyricsReader.addLyricEntry(o,this.currentVoiceEntry),this.voice.Parent.HasLyrics=!0);let a=!1;const f=t.element("notations");if(f){this.articulationReader&&this.readArticulations(f,this.currentVoiceEntry,this.currentNote);const e=f.elements("slur"),i=f.elements("slide"),s=f.elements("glissando");void 0!==this.slurReader&&(e.length>0||i.length>0)&&!this.currentNote.ParentVoiceEntry.IsGrace&&(this.slurReader.addSlur(e,this.currentNote),i.length>0&&this.slurReader.addSlur(i,this.currentNote),s.length>0&&this.slurReader.addSlur(s,this.currentNote));const n=f.elements("tuplet");n.length>0&&(this.openTupletNumber=this.addTuplet(t,n),a=!0);const r=f.element("arpeggiate");if(void 0!==r){let t;if(this.currentVoiceEntry.Arpeggio)t=this.currentVoiceEntry.Arpeggio;else{let e=!1;for(const i of this.currentStaffEntry.VoiceEntries)if(i.Arpeggio){e=!0,t=i.Arpeggio;break}if(!e){let e=P.ArpeggioType.ARPEGGIO_DIRECTIONLESS;const i=r.attribute("direction");if(i)switch(i.value){case"up":e=P.ArpeggioType.ROLL_UP;break;case"down":e=P.ArpeggioType.ROLL_DOWN;break;default:e=P.ArpeggioType.ARPEGGIO_DIRECTIONLESS}t=new P.Arpeggio(this.currentVoiceEntry,e),this.currentVoiceEntry.Arpeggio=t}}t.addNote(this.currentNote)}const o=f.elements("tied");o.length>0&&this.addTie(o,l,h,c.TieTypes.SIMPLE);const u=f.element("technical");if(u){const t=u.elements("hammer-on");t.length>0&&this.addTie(t,l,h,c.TieTypes.HAMMERON);const e=u.elements("pull-off");e.length>0&&this.addTie(e,l,h,c.TieTypes.PULLOFF)}}void 0===t.element("time-modification")||a||this.handleTimeModificationNode(t)}catch(t){v.default.warn(t);const e=f.ITextTranslation.translateText("ReaderErrorMessages/NoteError","Ignored erroneous Note.");this.musicSheet.SheetErrors.pushMeasureError(e),this.musicSheet.SheetErrors.pushMeasureError(t)}return this.currentNote}checkForStaffEntryLink(t,e,i,s){const n=new y.StaffEntryLink(this.currentVoiceEntry);n.LinkStaffEntries.push(i),i.Link=n;const r=this.currentVoiceEntry.Timestamp.clone(),o=s.getVerticalContainerByTimestamp(r);return(i=o.StaffEntries[t])||(i=new l.SourceStaffEntry(o,e),o.StaffEntries[t]=i),i.VoiceEntries.push(this.currentVoiceEntry),n.LinkStaffEntries.push(i),i.Link=n,i}checkForOpenBeam(){this.openBeams.length>0&&this.currentNote&&this.handleOpenBeam()}checkOpenTies(){const t=this.openTieDict;for(const e in t)if(t.hasOwnProperty(e)){const i=t[e];p.Fraction.plus(i.StartNote.ParentStaffEntry.Timestamp,i.Duration).lt(i.StartNote.SourceMeasure.Duration)&&delete t[e]}}hasVoiceEntry(){return void 0!==this.currentVoiceEntry}readArticulations(t,e,i){const s=t.element("articulations");s&&this.articulationReader.addArticulationExpression(s,e);const n=t.element("fermata");n&&this.articulationReader.addFermata(n,e);const r=t.element("technical");r&&this.articulationReader.addTechnicalArticulations(r,e,i);const o=t.element("ornaments");o&&this.articulationReader.addOrnament(o,e)}addSingleNote(t,e,i,s,n,r,l,h,u,c,d,m,y,_){let x,P,T,I,L=0,C=b.AccidentalEnum.NONE,A=S.NoteEnum.C,R=S.NoteEnum.C,N=0,k=0;const B=t.elements();for(let t=0,e=B.length;t<e;++t){const e=B[t];try{if("pitch"===e.name){const t=e.elements();for(let e=0,i=t.length;e<i;++e){const i=t[e];T=void 0,I=void 0;try{if("step"===i.name){if(A=S.NoteEnum[i.value],void 0===A){const t=f.ITextTranslation.translateText("ReaderErrorMessages/NotePitchError","Invalid pitch while reading note.");throw this.musicSheet.SheetErrors.pushMeasureError(t),new g.MusicSheetReadingException(t,void 0)}}else if("alter"===i.name){if(L=parseFloat(i.value),isNaN(L)){const t=f.ITextTranslation.translateText("ReaderErrorMessages/NoteAlterationError","Invalid alteration while reading note.");throw this.musicSheet.SheetErrors.pushMeasureError(t),new g.MusicSheetReadingException(t,void 0)}C=E.Pitch.AccidentalFromHalfTones(L)}else if("octave"===i.name&&(N=parseInt(i.value,10),isNaN(N))){const t=f.ITextTranslation.translateText("ReaderErrorMessages/NoteOctaveError","Invalid octave value while reading note.");throw this.musicSheet.SheetErrors.pushMeasureError(t),new g.MusicSheetReadingException(t,void 0)}}catch(t){v.default.info("VoiceGenerator.addSingleNote read Step: ",t.message)}}}else if("accidental"===e.name)x=e.value,"natural"===x?C=b.AccidentalEnum.NATURAL:"slash-flat"===x?C=b.AccidentalEnum.SLASHFLAT:"slash-quarter-sharp"===x?C=b.AccidentalEnum.SLASHQUARTERSHARP:"slash-sharp"===x?C=b.AccidentalEnum.SLASHSHARP:"double-slash-flat"===x?C=b.AccidentalEnum.DOUBLESLASHFLAT:"sori"===x?C=b.AccidentalEnum.SORI:"koron"===x&&(C=b.AccidentalEnum.KORON);else if("unpitched"===e.name){const t=e.element("display-step"),i=e.element("display-octave");if(i&&(N=parseInt(i.value,10),k=N-3,l&&(N+=1),1===this.instrument.Staves[0].StafflineCount&&(k+=1)),t){A=S.NoteEnum[t.value.toUpperCase()];let e=0,i=this.musicSheet.Rules.PercussionXMLDisplayStepNoteValueShift;1===this.instrument.Staves[0].StafflineCount&&(i-=3),[R,e]=E.Pitch.lineShiftFromNoteEnum(A,i),k+=e}}else"instrument"===e.name?e.firstAttribute&&(P=e.firstAttribute.value):"notehead"===e.name&&(T=e.value,e.attribute("filled")&&(I="yes"===e.attribute("filled").value))}catch(t){v.default.info("VoiceGenerator.addSingleNote: ",t)}}N-=E.Pitch.OctaveXmlDifference;const D=new E.Pitch(A,N,C,x),O=p.Fraction.createFromFraction(e);let F,V=-1,G=-1;const W=[],U=t.element("notations");if(U){const t=U.element("technical");if(t){const e=t.element("string");e&&(V=parseInt(e.value,10));const i=t.element("fret");i&&(G=parseInt(i.value,10)),t.elements("bend").forEach(function(t){const e=t.element("bend-alter");void 0!==t.element("release")?W.push({bendalter:parseInt(e.value,10),direction:"down"}):W.push({bendalter:parseInt(e.value,10),direction:"up"})})}}return F=V<0||G<0?new a.Note(this.currentVoiceEntry,this.currentStaffEntry,O,D,this.currentMeasure):new w.TabNote(this.currentVoiceEntry,this.currentStaffEntry,O,D,this.currentMeasure,V,G,W),this.addNoteInfo(F,i,h,u,n,R,k,_,_),F.TypeLength=s,F.IsGraceNote=c,F.StemDirectionXml=d,F.TremoloInfo=m,F.PlaybackInstrumentId=P,(void 0!==T&&"normal"!==T||void 0!==I)&&(F.Notehead=new M.Notehead(F,T,I)),F.NoteheadColorXml=_,F.NoteheadColor=_,F.PlaybackInstrumentId=P,this.currentVoiceEntry.addNote(F),d===o.StemDirectionType.None&&(y="#00000000"),this.currentVoiceEntry.StemDirectionXml=d,y&&(this.currentVoiceEntry.StemColorXml=y,this.currentVoiceEntry.StemColor=y,F.StemColorXml=y),t.elements("beam")&&!r&&this.createBeam(t,F),F}addRestNote(t,e,i,s,n,r,o,l){const h=p.Fraction.createFromFraction(e),u=t.element("display-step"),c=t.element("display-octave");let d,f,m;u&&c&&(d=S.NoteEnum[u.value.toUpperCase()],f=parseInt(c.value,10),m=new E.Pitch(d,f,b.AccidentalEnum.NONE,void 0,!0));const g=new a.Note(this.currentVoiceEntry,this.currentStaffEntry,h,m,this.currentMeasure,!0);return this.addNoteInfo(g,i,r,o,n,d,f,l,l),g.TypeLength=s,this.currentVoiceEntry.Notes.push(g),this.openBeams.length>0&&this.openBeams.last().ExtendedNoteList.push(g),g}addNoteInfo(t,e,i,s,n,r,o,a,l){t.NoteTypeXml=e,t.PrintObject=i,t.IsCueNote=s,t.NormalNotes=n,t.displayStepUnpitched=r,t.displayOctaveUnpitched=o,t.NoteheadColorXml=a,t.NoteheadColor=a}createBeam(t,e){try{const i=t.element("beam");let s;if(void 0!==i&&i.hasAttributes&&(s=i.attribute("number")),s){let i=parseInt(s.value,10);const n=t.elements("beam"),r=n[0].value;n&&("begin"===r?(i===this.openBeams.last()?.BeamNumber?(this.beamNumberOffset++,i+=this.beamNumberOffset):this.openBeams.last()&&this.handleOpenBeam(),this.openBeams.push(new h.Beam(i,this.beamNumberOffset))):i+=this.beamNumberOffset);let o=!1;if(!(i>0&&i<=this.openBeams.length&&this.openBeams[i-1]))return void v.default.debug("[OSMD] invalid beamnumber");for(let t=0,e=this.openBeams[i-1].Notes.length;t<e;++t){const e=this.openBeams[i-1].Notes[t];this.currentVoiceEntry===e.ParentVoiceEntry&&(o=!0)}o||(this.openBeams[i-1].addNoteToBeam(e),"end"===r&&this.endBeam())}}catch(t){const e=f.ITextTranslation.translateText("ReaderErrorMessages/BeamError","Error while reading beam.");throw this.musicSheet.SheetErrors.pushMeasureError(e),new g.MusicSheetReadingException("",t)}}endBeam(){this.openBeams.pop(),this.beamNumberOffset=Math.max(0,this.beamNumberOffset-1)}handleOpenBeam(){const t=this.openBeams.last();if(0!==t.Notes.length){if(1===t.Notes.length)return t.Notes[0].NoteBeam=void 0,void this.endBeam();if(this.currentNote===_.CollectionUtil.last(t.Notes))this.endBeam();else{const e=_.CollectionUtil.last(t.Notes).ParentStaffEntry,i=this.currentMeasure.getVerticalContainerIndexByTimestamp(e.Timestamp),s=e.VerticalContainerParent.StaffEntries.indexOf(e);if(i<this.currentMeasure.VerticalSourceStaffEntryContainers.length-1){const t=this.currentMeasure.VerticalSourceStaffEntryContainers[i+1].StaffEntries[s];if(t)for(let e=0,i=t.VoiceEntries.length;e<i;++e){const i=t.VoiceEntries[e];if(i.ParentVoice===this.voice){const t=i.Notes[0];t.Length.lte(new p.Fraction(1,8))?(this.openBeams.last().addNoteToBeam(t),this.endBeam()):this.endBeam()}}}else this.endBeam()}}else this.endBeam()}addTuplet(t,e){let i,s=!1;if(void 0!==e&&e.length>1){let n=t.element("time-modification");n&&(n=n.element("actual-notes"));const r=e;for(let e=0,a=r.length;e<a;++e){const a=r[e];if(void 0!==a&&a.attributes()){const e=a.attribute("bracket");e&&"yes"===e.value?(s=!0,i=!0):e&&"no"===e.value&&(i=!1);const r=this.readShowNumberNoneGiven(a),l=a.attribute("type");if(l&&"start"===l.value){let e=1;a.attribute("number")&&(e=parseInt(a.attribute("number").value,10));let o=0;if(n&&(o=parseInt(n.value,10),isNaN(o))){const t=f.ITextTranslation.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(t),new g.MusicSheetReadingException(t,void 0)}const l=new d.Tuplet(o,s);l.BracketedXmlValue=i,l.ShowNumberNoneGivenInXml=r,l.tupletLabelNumberPlacement=I.PlacementEnum.Above;const h=a.attribute("placement");h&&("below"===h.value&&(l.tupletLabelNumberPlacement=I.PlacementEnum.Below),l.PlacementFromXml=!0),this.tupletDict[e]&&(delete this.tupletDict[e],0===Object.keys(this.tupletDict).length?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--),this.tupletDict[e]=l;const u=[];u.push(this.currentNote),l.Notes.push(u),l.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=l,this.openTupletNumber=e}else if("stop"===l.value){let e=1;a.attribute("number")&&(e=parseInt(a.attribute("number").value,10));const i=this.tupletDict[e];if(i){const s=a.attribute("placement");s&&("below"===s.value?i.tupletLabelNumberPlacement=I.PlacementEnum.Below:i.tupletLabelNumberPlacement=I.PlacementEnum.Above,i.PlacementFromXml=!0);const n=[];if(n.push(this.currentNote),i.Notes.push(n),!i.PlacementFromXml){let t=!1;for(const e of i.Notes){for(const s of e)if(!s.isRest()){s.StemDirectionXml===o.StemDirectionType.Down?i.tupletLabelNumberPlacement=I.PlacementEnum.Below:i.tupletLabelNumberPlacement=I.PlacementEnum.Above,t=!0;break}if(t)break}}i.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=i,delete this.tupletDict[e],0===Object.keys(this.tupletDict).length?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--}}}}}else if(e[0]){const n=e[0];if(n.hasAttributes){const e=n.attribute("type").value;let r=1;n.attribute("number")&&(r=parseInt(n.attribute("number").value,10));const a=isNaN(r),l=this.readShowNumberNoneGiven(n),h=n.attribute("bracket");if(h&&"yes"===h.value?(s=!0,i=!0):h&&"no"===h.value&&(i=!1),"start"===e){let e=0,o=t.element("time-modification");if(o&&(o=o.element("actual-notes")),o&&(e=parseInt(o.value,10),isNaN(e))){const t=f.ITextTranslation.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(t),new g.MusicSheetReadingException(t)}a&&(this.openTupletNumber++,r=this.openTupletNumber);let h=this.tupletDict[r];h||(h=this.tupletDict[r]=new d.Tuplet(e,s),h.BracketedXmlValue=i,h.ShowNumberNoneGivenInXml=l,h.tupletLabelNumberPlacement=I.PlacementEnum.Above);const u=n.attribute("placement");u&&("below"===u.value?h.tupletLabelNumberPlacement=I.PlacementEnum.Below:h.tupletLabelNumberPlacement=I.PlacementEnum.Above,h.PlacementFromXml=!0);const c=[];c.push(this.currentNote),h.Notes.push(c),h.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=h,this.openTupletNumber=r}else if("stop"===e){a&&(r=this.openTupletNumber);const e=this.tupletDict[this.openTupletNumber];if(e){const i=n.attribute("placement");i&&("below"===i.value?e.tupletLabelNumberPlacement=I.PlacementEnum.Below:e.tupletLabelNumberPlacement=I.PlacementEnum.Above,e.PlacementFromXml=!0);const s=[];if(s.push(this.currentNote),e.Notes.push(s),!e.PlacementFromXml){let t=!1;for(const i of e.Notes){for(const s of i)if(!s.isRest()){s.StemDirectionXml===o.StemDirectionType.Down?e.tupletLabelNumberPlacement=I.PlacementEnum.Below:e.tupletLabelNumberPlacement=I.PlacementEnum.Above,t=!0;break}if(t)break}}e.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=e,0===Object.keys(this.tupletDict).length?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--,delete this.tupletDict[r]}}}}return this.openTupletNumber}readShowNumberNoneGiven(t){const e=t.attribute("show-number");return!(!e?.value||"none"!==e.value)}handleTimeModificationNode(t){if(this.tupletDict[this.openTupletNumber])try{const e=this.tupletDict[this.openTupletNumber],i=_.CollectionUtil.last(e.Notes);let s;i[0].ParentVoiceEntry.Timestamp.Equals(this.currentVoiceEntry.Timestamp)?s=i:(s=[],e.Notes.push(s),e.Fractions.push(this.getTupletNoteDurationFromType(t))),s.push(this.currentNote),this.currentNote.NoteTuplet=e}catch(t){const e=f.ITextTranslation.translateText("ReaderErrorMessages/TupletNumberError","Invalid tuplet number.");throw this.musicSheet.SheetErrors.pushMeasureError(e),t}else if(this.currentVoiceEntry.Notes.length>0){const t=this.currentVoiceEntry.Notes[0];if(t.NoteTuplet){const e=t.NoteTuplet;_.CollectionUtil.last(e.Notes).push(this.currentNote),this.currentNote.NoteTuplet=e}}}addTie(t,e,i,s){if(t)if(1===t.length){const e=t[0];if(void 0!==e&&e.attributes()){const t=this.getTieDirection(e),i=e.attribute("type").value;try{if("start"===i){const e=this.findCurrentNoteInTieDict(this.currentNote);e<0&&delete this.openTieDict[e];const i=this.getNextAvailableNumberForTie(),n=new u.Tie(this.currentNote,s);this.openTieDict[i]=n,n.TieNumber=i,n.TieDirection=t}else if("stop"===i){const t=this.findCurrentNoteInTieDict(this.currentNote),e=t