UNPKG

aibandtab

Version:

aibandTab is a music notation and guitar tablature rendering library

1 lines 772 kB
var e,t,i,s,a,r,n,o,h,l,d,c,u,p,g,f,m,y,b,S,w,_,B,T,k,N,x,v,P,C,E,F,L,M,D,I,A,R,O,H,V,G,W,z;!function(e){e[e.Page=0]="Page",e[e.Horizontal=1]="Horizontal"}(e||(e={})),function(e){e[e.Default=0]="Default",e[e.ScoreTab=1]="ScoreTab",e[e.Score=2]="Score",e[e.Tab=3]="Tab",e[e.TabMixed=4]="TabMixed"}(t||(t={}));class U{static getValue(e){return U._values||(U._values=new Map),e=e.toLowerCase().replaceAll(" ",""),U._values.has(e)?U._values.get(e):0}static isPiano(e){return e<=7||e>=16&&e<=23}static isGuitar(e){return e>=24&&e<=39||105===e||43===e}}U._values=new Map([["acousticgrandpiano",0],["brightacousticpiano",1],["electricgrandpiano",2],["honkytonkpiano",3],["electricpiano1",4],["electricpiano2",5],["harpsichord",6],["clavinet",7],["celesta",8],["glockenspiel",9],["musicbox",10],["vibraphone",11],["marimba",12],["xylophone",13],["tubularbells",14],["dulcimer",15],["drawbarorgan",16],["percussiveorgan",17],["rockorgan",18],["churchorgan",19],["reedorgan",20],["accordion",21],["harmonica",22],["tangoaccordion",23],["acousticguitarnylon",24],["acousticguitarsteel",25],["electricguitarjazz",26],["electricguitarclean",27],["electricguitarmuted",28],["overdrivenguitar",29],["distortionguitar",30],["guitarharmonics",31],["acousticbass",32],["electricbassfinger",33],["electricbasspick",34],["fretlessbass",35],["slapbass1",36],["slapbass2",37],["synthbass1",38],["synthbass2",39],["violin",40],["viola",41],["cello",42],["contrabass",43],["tremolostrings",44],["pizzicatostrings",45],["orchestralharp",46],["timpani",47],["stringensemble1",48],["stringensemble2",49],["synthstrings1",50],["synthstrings2",51],["choiraahs",52],["voiceoohs",53],["synthvoice",54],["orchestrahit",55],["trumpet",56],["trombone",57],["tuba",58],["mutedtrumpet",59],["frenchhorn",60],["brasssection",61],["synthbrass1",62],["synthbrass2",63],["sopranosax",64],["altosax",65],["tenorsax",66],["baritonesax",67],["oboe",68],["englishhorn",69],["bassoon",70],["clarinet",71],["piccolo",72],["flute",73],["recorder",74],["panflute",75],["blownbottle",76],["shakuhachi",77],["whistle",78],["ocarina",79],["lead1square",80],["lead2sawtooth",81],["lead3calliope",82],["lead4chiff",83],["lead5charang",84],["lead6voice",85],["lead7fifths",86],["lead8bassandlead",87],["pad1newage",88],["pad2warm",89],["pad3polysynth",90],["pad4choir",91],["pad5bowed",92],["pad6metallic",93],["pad7halo",94],["pad8sweep",95],["fx1rain",96],["fx2soundtrack",97],["fx3crystal",98],["fx4atmosphere",99],["fx5brightness",100],["fx6goblins",101],["fx7echoes",102],["fx8scifi",103],["sitar",104],["banjo",105],["shamisen",106],["koto",107],["kalimba",108],["bagpipe",109],["fiddle",110],["shanai",111],["tinklebell",112],["agogo",113],["steeldrums",114],["woodblock",115],["taikodrum",116],["melodictom",117],["synthdrum",118],["reversecymbal",119],["guitarfretnoise",120],["breathnoise",121],["seashore",122],["birdtweet",123],["telephonering",124],["helicopter",125],["applause",126],["gunshot",127]]);class X{init(e,t){this.data=e,this.settings=t}}!function(e){e[e.General=0]="General",e[e.Format=1]="Format",e[e.AibandTex=2]="AibandTex"}(i||(i={}));class Y extends Error{constructor(e,t="",i){super(t??"",{cause:i}),this.type=e,Object.setPrototypeOf(this,Y.prototype)}}class q extends Y{constructor(e=null,t){super(i.Format,e??"Unsupported format",t),Object.setPrototypeOf(this,q.prototype)}}!function(e){e[e.None=0]="None",e[e.Normal=1]="Normal",e[e.Heavy=2]="Heavy",e[e.Tenuto=3]="Tenuto"}(s||(s={})),function(e){e[e.Tempo=0]="Tempo",e[e.Volume=1]="Volume",e[e.Instrument=2]="Instrument",e[e.Balance=3]="Balance"}(a||(a={}));class J{constructor(){this.isLinear=!1,this.type=a.Tempo,this.value=0,this.ratioPosition=0,this.text=""}static buildTempoAutomation(e,t,i,s){(s<1||s>5)&&(s=2);let r=new Float32Array([1,.5,1,1.5,2,3]),n=new J;return n.type=a.Tempo,n.isLinear=e,n.ratioPosition=t,n.value=i*r[s],n}static buildInstrumentAutomation(e,t,i){let s=new J;return s.type=a.Instrument,s.isLinear=e,s.ratioPosition=t,s.value=i,s}}!function(e){e[e.Neutral=0]="Neutral",e[e.C3=1]="C3",e[e.C4=2]="C4",e[e.F4=3]="F4",e[e.G2=4]="G2"}(r||(r={})),function(e){e[e._15ma=0]="_15ma",e[e._8va=1]="_8va",e[e.Regular=2]="Regular",e[e._8vb=3]="_8vb",e[e._15mb=4]="_15mb"}(n||(n={})),function(e){e[e.None=0]="None",e[e.Simple=1]="Simple",e[e.FirstOfDouble=2]="FirstOfDouble",e[e.SecondOfDouble=3]="SecondOfDouble"}(o||(o={})),function(e){e[e.Down=0]="Down",e[e.Hold=1]="Hold",e[e.Up=2]="Up"}(h||(h={}));class j{constructor(){this.ratioPosition=0,this.pedalType=h.Down,this.nextPedalMarker=null,this.previousPedalMarker=null}}class Q{constructor(){this.id=Q._globalBarId++,this.index=0,this.nextBar=null,this.previousBar=null,this.clef=r.G2,this.clefOttava=n.Regular,this.voices=[],this.simileMark=o.None,this.isMultiVoice=!1,this.displayScale=1,this.displayWidth=-1,this.sustainPedals=[]}get masterBar(){return this.staff.track.score.masterBars[this.index]}get isEmpty(){for(let e=0,t=this.voices.length;e<t;e++)if(!this.voices[e].isEmpty)return!1;return!0}addVoice(e){e.bar=this,e.index=this.voices.length,this.voices.push(e)}finish(e,t=null){this.isMultiVoice=!1;for(let i=0,s=this.voices.length;i<s;i++){let s=this.voices[i];s.finish(e,t),i>0&&!s.isEmpty&&(this.isMultiVoice=!0)}if(this.sustainPedals.length>0){let e=null;this.previousBar&&this.previousBar.sustainPedals.length>0&&(e=this.previousBar.sustainPedals[this.previousBar.sustainPedals.length-1]);for(const t of this.sustainPedals)e&&e.pedalType!==h.Up&&(e.nextPedalMarker=t,t.previousPedalMarker=e),t.bar=this,e=t}else if(this.previousBar&&this.previousBar.sustainPedals.length>0){const e=this.previousBar.sustainPedals[this.previousBar.sustainPedals.length-1];if(e.pedalType!==h.Up){const t=new j;t.ratioPosition=0,t.bar=this,t.pedalType=h.Hold,this.sustainPedals.push(t),e.nextPedalMarker=t,t.previousPedalMarker=e}}}calculateDuration(){let e=0;for(let t of this.voices){let i=t.calculateDuration();i>e&&(e=i)}return e}}Q._globalBarId=0;class K{static ticksToMillis(e,t){return e*(6e4/(t*K.QuarterTime))|0}static millisToTicks(e,t){return e/(6e4/(t*K.QuarterTime))|0}static toTicks(e){return K.valueToTicks(e)}static valueToTicks(e){let t=e;return t<0&&(t=1/-t),K.QuarterTime*(4/t)|0}static applyDot(e,t){return t?e+3*(e/4|0):e+(e/2|0)}static applyTuplet(e,t,i){return e*i/t|0}static removeTuplet(e,t,i){return e*t/i|0}static dynamicToVelocity(e){return K.MinVelocity+e*K.VelocityIncrement}}K.QuarterTime=960,K.MinVelocity=15,K.VelocityIncrement=16;class ${constructor(e=0,t=0){this.offset=e,this.value=t}}$.MaxPosition=60,$.MaxValue=12,function(e){e[e.Default=0]="Default",e[e.Gradual=1]="Gradual",e[e.Fast=2]="Fast"}(l||(l={})),function(e){e[e.None=0]="None",e[e.Custom=1]="Custom",e[e.Bend=2]="Bend",e[e.Release=3]="Release",e[e.BendRelease=4]="BendRelease",e[e.Hold=5]="Hold",e[e.Prebend=6]="Prebend",e[e.PrebendBend=7]="PrebendBend",e[e.PrebendRelease=8]="PrebendRelease"}(d||(d={})),function(e){e[e.None=0]="None",e[e.BrushUp=1]="BrushUp",e[e.BrushDown=2]="BrushDown",e[e.ArpeggioUp=3]="ArpeggioUp",e[e.ArpeggioDown=4]="ArpeggioDown"}(c||(c={})),function(e){e[e.None=0]="None",e[e.Crescendo=1]="Crescendo",e[e.Decrescendo=2]="Decrescendo"}(u||(u={})),function(e){e[e.QuadrupleWhole=-4]="QuadrupleWhole",e[e.DoubleWhole=-2]="DoubleWhole",e[e.Whole=1]="Whole",e[e.Half=2]="Half",e[e.Quarter=4]="Quarter",e[e.Eighth=8]="Eighth",e[e.Sixteenth=16]="Sixteenth",e[e.ThirtySecond=32]="ThirtySecond",e[e.SixtyFourth=64]="SixtyFourth",e[e.OneHundredTwentyEighth=128]="OneHundredTwentyEighth",e[e.TwoHundredFiftySixth=256]="TwoHundredFiftySixth"}(p||(p={})),function(e){e[e.PPP=0]="PPP",e[e.PP=1]="PP",e[e.P=2]="P",e[e.MP=3]="MP",e[e.MF=4]="MF",e[e.F=5]="F",e[e.FF=6]="FF",e[e.FFF=7]="FFF"}(g||(g={})),function(e){e[e.None=0]="None",e[e.OnBeat=1]="OnBeat",e[e.BeforeBeat=2]="BeforeBeat",e[e.BendGrace=3]="BendGrace"}(f||(f={})),function(e){e[e.Unknown=-2]="Unknown",e[e.NoOrDead=-1]="NoOrDead",e[e.Thumb=0]="Thumb",e[e.IndexFinger=1]="IndexFinger",e[e.MiddleFinger=2]="MiddleFinger",e[e.AnnularFinger=3]="AnnularFinger",e[e.LittleFinger=4]="LittleFinger"}(m||(m={})),function(e){e[e.None=0]="None",e[e.Natural=1]="Natural",e[e.Artificial=2]="Artificial",e[e.Pinch=3]="Pinch",e[e.Tap=4]="Tap",e[e.Semi=5]="Semi",e[e.Feedback=6]="Feedback"}(y||(y={})),function(e){e[e.Default=0]="Default",e[e.ForceNone=1]="ForceNone",e[e.ForceNatural=2]="ForceNatural",e[e.ForceSharp=3]="ForceSharp",e[e.ForceDoubleSharp=4]="ForceDoubleSharp",e[e.ForceFlat=5]="ForceFlat",e[e.ForceDoubleFlat=6]="ForceDoubleFlat"}(b||(b={})),function(e){e[e.None=0]="None",e[e.IntoFromBelow=1]="IntoFromBelow",e[e.IntoFromAbove=2]="IntoFromAbove"}(S||(S={})),function(e){e[e.None=0]="None",e[e.Shift=1]="Shift",e[e.Legato=2]="Legato",e[e.OutUp=3]="OutUp",e[e.OutDown=4]="OutDown",e[e.PickSlideDown=5]="PickSlideDown",e[e.PickSlideUp=6]="PickSlideUp"}(w||(w={})),function(e){e[e.None=0]="None",e[e.Slight=1]="Slight",e[e.Wide=2]="Wide"}(_||(_={})),function(e){e[e.Hidden=0]="Hidden",e[e.ShowWithBeams=1]="ShowWithBeams",e[e.ShowWithBars=2]="ShowWithBars",e[e.Automatic=3]="Automatic"}(B||(B={})),function(e){e[e.ScoreDefault=0]="ScoreDefault",e[e.ScoreForcePiano=1]="ScoreForcePiano",e[e.SingleNoteEffectBand=2]="SingleNoteEffectBand",e[e.SingleNoteEffectBandForcePiano=3]="SingleNoteEffectBandForcePiano"}(T||(T={})),function(e){e[e.GuitarPro=0]="GuitarPro",e[e.SongBook=1]="SongBook"}(k||(k={})),function(e){e[e.ScoreTitle=0]="ScoreTitle",e[e.ScoreSubTitle=1]="ScoreSubTitle",e[e.ScoreArtist=2]="ScoreArtist",e[e.ScoreAlbum=3]="ScoreAlbum",e[e.ScoreWords=4]="ScoreWords",e[e.ScoreMusic=5]="ScoreMusic",e[e.ScoreWordsAndMusic=6]="ScoreWordsAndMusic",e[e.ScoreCopyright=7]="ScoreCopyright",e[e.GuitarTuning=8]="GuitarTuning",e[e.TrackNames=9]="TrackNames",e[e.ChordDiagrams=10]="ChordDiagrams",e[e.ParenthesisOnTiedBends=11]="ParenthesisOnTiedBends",e[e.TabNotesOnTiedBends=12]="TabNotesOnTiedBends",e[e.ZerosOnDiveWhammys=13]="ZerosOnDiveWhammys",e[e.EffectAlternateEndings=14]="EffectAlternateEndings",e[e.EffectCapo=15]="EffectCapo",e[e.EffectChordNames=16]="EffectChordNames",e[e.EffectCrescendo=17]="EffectCrescendo",e[e.EffectDynamics=18]="EffectDynamics",e[e.EffectFadeIn=19]="EffectFadeIn",e[e.EffectFermata=20]="EffectFermata",e[e.EffectFingering=21]="EffectFingering",e[e.EffectHarmonics=22]="EffectHarmonics",e[e.EffectLetRing=23]="EffectLetRing",e[e.EffectLyrics=24]="EffectLyrics",e[e.EffectMarker=25]="EffectMarker",e[e.EffectOttavia=26]="EffectOttavia",e[e.EffectPalmMute=27]="EffectPalmMute",e[e.EffectPickSlide=28]="EffectPickSlide",e[e.EffectPickStroke=29]="EffectPickStroke",e[e.EffectSlightBeatVibrato=30]="EffectSlightBeatVibrato",e[e.EffectSlightNoteVibrato=31]="EffectSlightNoteVibrato",e[e.EffectTap=32]="EffectTap",e[e.EffectTempo=33]="EffectTempo",e[e.EffectText=34]="EffectText",e[e.EffectTrill=35]="EffectTrill",e[e.EffectTripletFeel=36]="EffectTripletFeel",e[e.EffectWhammyBar=37]="EffectWhammyBar",e[e.EffectWideBeatVibrato=38]="EffectWideBeatVibrato",e[e.EffectWideNoteVibrato=39]="EffectWideNoteVibrato",e[e.EffectLeftHandTap=40]="EffectLeftHandTap",e[e.EffectFreeTime=41]="EffectFreeTime",e[e.EffectSustainPedal=42]="EffectSustainPedal",e[e.EffectGolpe=43]="EffectGolpe",e[e.EffectWahPedal=44]="EffectWahPedal",e[e.EffectBeatBarre=45]="EffectBeatBarre",e[e.EffectNoteOrnament=46]="EffectNoteOrnament",e[e.EffectRasgueado=47]="EffectRasgueado"}(N||(N={}));class Z{constructor(){this.notationMode=k.GuitarPro,this.fingeringMode=T.ScoreDefault,this.elements=new Map,this.rhythmMode=B.Automatic,this.rhythmHeight=15,this.transpositionPitches=[],this.displayTranspositionPitches=[],this.smallGraceTabNotes=!0,this.extendBendArrowsOnTiedNotes=!0,this.extendLineEffectsToBeatEnd=!1,this.slurHeight=5}isNotationElementVisible(e){return this.elements.has(e)?this.elements.get(e):!Z.defaultElements.has(e)||Z.defaultElements.get(e)}}Z.defaultElements=new Map([[N.ZerosOnDiveWhammys,!1]]);class ee{constructor(e){this._value=void 0,this._factory=e}get value(){return void 0===this._value&&(this._value=this._factory()),this._value}}!function(e){e[e.None=0]="None",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warning=3]="Warning",e[e.Error=4]="Error"}(x||(x={}));class te{static format(e,t){return`[AibandTab][${e}] ${t}`}debug(e,t,...i){console.debug(te.format(e,t),...i)}warning(e,t,...i){console.warn(te.format(e,t),...i)}info(e,t,...i){console.info(te.format(e,t),...i)}error(e,t,...i){console.error(te.format(e,t),...i)}}te.logLevel=x.Info;class ie{static shouldLog(e){return ie.logLevel!==x.None&&e>=ie.logLevel}static debug(e,t,...i){ie.shouldLog(x.Debug)&&ie.log.debug(e,t,...i)}static warning(e,t,...i){ie.shouldLog(x.Warning)&&ie.log.warning(e,t,...i)}static info(e,t,...i){ie.shouldLog(x.Info)&&ie.log.info(e,t,...i)}static error(e,t,...i){ie.shouldLog(x.Error)&&ie.log.error(e,t,...i)}}ie.logLevel=x.Info,ie.log=new te;class se{constructor(){this.note=null,this.tone=new ae,this.octave=0}get realValue(){return 12*this.octave+this.tone.noteValue}}class ae{constructor(e=0,t=b.Default){this.noteValue=e,this.accidentalMode=t}}class re{static getIndex(e){return e<0?0:0|Math.log2(e)}static keySignatureIsFlat(e){return e<0}static keySignatureIsNatural(e){return 0===e}static keySignatureIsSharp(e){return e>0}static applyPitchOffsets(e,t){for(let i=0;i<t.tracks.length;i++){if(i<e.notation.displayTranspositionPitches.length)for(let s of t.tracks[i].staves)s.displayTranspositionPitch=-e.notation.displayTranspositionPitches[i];if(i<e.notation.transpositionPitches.length)for(let s of t.tracks[i].staves)s.transpositionPitch=-e.notation.transpositionPitches[i]}}static fingerToString(e,t,i,s){if(e.notation.fingeringMode===T.ScoreForcePiano||e.notation.fingeringMode===T.SingleNoteEffectBandForcePiano||U.isPiano(t.voice.bar.staff.track.playbackInfo.program))switch(i){case m.Unknown:case m.NoOrDead:return null;case m.Thumb:return"1";case m.IndexFinger:return"2";case m.MiddleFinger:return"3";case m.AnnularFinger:return"4";case m.LittleFinger:return"5";default:return null}if(s)switch(i){case m.Unknown:return null;case m.NoOrDead:return"0";case m.Thumb:return"t";case m.IndexFinger:return"1";case m.MiddleFinger:return"2";case m.AnnularFinger:return"3";case m.LittleFinger:return"4";default:return null}switch(i){case m.Unknown:case m.NoOrDead:return null;case m.Thumb:return"p";case m.IndexFinger:return"i";case m.MiddleFinger:return"m";case m.AnnularFinger:return"a";case m.LittleFinger:return"c";default:return null}}static isTuning(e){return!!re.parseTuning(e)}static parseTuning(e){let t="",i="";for(let s=0;s<e.length;s++){let a=e.charCodeAt(s);if(a>=48&&a<=57){if(!t)return null;i+=String.fromCharCode(a)}else{if(!(a>=65&&a<=90||a>=97&&a<=122||35===a))return null;t+=String.fromCharCode(a)}}if(!i||!t)return null;let s=new se;return s.octave=parseInt(i)+1,s.note=t.toLowerCase(),s.tone=re.getToneForText(s.note),s.tone.noteValue<0&&(s.octave--,s.tone.noteValue+=12),s}static getTuningForText(e){let t=re.parseTuning(e);return t?t.realValue:-1}static getToneForText(e){const t=e.substring(0,1),i=e.substring(1);let s,a;switch(t.toLowerCase()){case"c":default:s=0;break;case"d":s=2;break;case"e":s=4;break;case"f":s=5;break;case"g":s=7;break;case"a":s=9;break;case"b":s=11}switch(a=re.parseAccidentalMode(i),a){case b.Default:case b.ForceNone:case b.ForceNatural:break;case b.ForceSharp:s++;break;case b.ForceDoubleSharp:s+=2;break;case b.ForceFlat:s--;break;case b.ForceDoubleFlat:s-=2}return new ae(s,a)}static parseAccidentalMode(e){const t=e.toLowerCase();return re.accidentalModeMapping.has(t)?re.accidentalModeMapping.get(t):b.Default}static newGuid(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)+Math.floor(65536*(1+Math.random())).toString(16).substring(1)+"-"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)+"-"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)+"-"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)+"-"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)+Math.floor(65536*(1+Math.random())).toString(16).substring(1)+Math.floor(65536*(1+Math.random())).toString(16).substring(1)}static isAlmostEqualTo(e,t){return Math.abs(e-t)<1e-5}static toHexString(e,t=0){let i="";do{i=String.fromCharCode("0123456789ABCDEF".charCodeAt(15&e))+i,e>>=4}while(e>0);for(;i.length<t;)i="0"+i;return i}}re.accidentalModeMapping=new Map([["default",b.Default],["d",b.Default],["forcenone",b.ForceNone],["-",b.ForceNone],["forcenatural",b.ForceNatural],["n",b.ForceNatural],["forcesharp",b.ForceSharp],["#",b.ForceSharp],["forcedoublesharp",b.ForceDoubleSharp],["##",b.ForceDoubleSharp],["x",b.ForceDoubleSharp],["forceflat",b.ForceFlat],["b",b.ForceFlat],["forcedoubleflat",b.ForceDoubleFlat],["bb",b.ForceDoubleFlat]]),function(e){e[e.None=0]="None",e[e.Up=1]="Up",e[e.Down=2]="Down"}(v||(v={})),function(e){e[e.None=-1]="None",e[e.Brace=57344]="Brace",e[e.BracketTop=57347]="BracketTop",e[e.BracketBottom=57348]="BracketBottom",e[e.SystemDivider=57351]="SystemDivider",e[e.GClef=57424]="GClef",e[e.CClef=57436]="CClef",e[e.FClef=57442]="FClef",e[e.UnpitchedPercussionClef1=57449]="UnpitchedPercussionClef1",e[e.SixStringTabClef=57453]="SixStringTabClef",e[e.FourStringTabClef=57454]="FourStringTabClef",e[e.TimeSig0=57472]="TimeSig0",e[e.TimeSig1=57473]="TimeSig1",e[e.TimeSig2=57474]="TimeSig2",e[e.TimeSig3=57475]="TimeSig3",e[e.TimeSig4=57476]="TimeSig4",e[e.TimeSig5=57477]="TimeSig5",e[e.TimeSig6=57478]="TimeSig6",e[e.TimeSig7=57479]="TimeSig7",e[e.TimeSig8=57480]="TimeSig8",e[e.TimeSig9=57481]="TimeSig9",e[e.TimeSigCommon=57482]="TimeSigCommon",e[e.TimeSigCutCommon=57483]="TimeSigCutCommon",e[e.NoteheadDoubleWholeSquare=57505]="NoteheadDoubleWholeSquare",e[e.NoteheadDoubleWhole=57504]="NoteheadDoubleWhole",e[e.NoteheadWhole=57506]="NoteheadWhole",e[e.NoteheadHalf=57507]="NoteheadHalf",e[e.NoteheadBlack=57508]="NoteheadBlack",e[e.NoteheadNull=57509]="NoteheadNull",e[e.NoteheadXOrnate=57514]="NoteheadXOrnate",e[e.NoteheadTriangleUpWhole=57531]="NoteheadTriangleUpWhole",e[e.NoteheadTriangleUpHalf=57532]="NoteheadTriangleUpHalf",e[e.NoteheadTriangleUpBlack=57534]="NoteheadTriangleUpBlack",e[e.NoteheadDiamondBlackWide=57564]="NoteheadDiamondBlackWide",e[e.NoteheadDiamondWhite=57565]="NoteheadDiamondWhite",e[e.NoteheadDiamondWhiteWide=57566]="NoteheadDiamondWhiteWide",e[e.NoteheadCircleX=57523]="NoteheadCircleX",e[e.NoteheadXWhole=57511]="NoteheadXWhole",e[e.NoteheadXHalf=57512]="NoteheadXHalf",e[e.NoteheadXBlack=57513]="NoteheadXBlack",e[e.NoteheadParenthesis=57550]="NoteheadParenthesis",e[e.NoteheadSlashedBlack2=57552]="NoteheadSlashedBlack2",e[e.NoteheadCircleSlash=57591]="NoteheadCircleSlash",e[e.NoteheadHeavyX=57592]="NoteheadHeavyX",e[e.NoteheadHeavyXHat=57593]="NoteheadHeavyXHat",e[e.NoteheadSlashVerticalEnds=57600]="NoteheadSlashVerticalEnds",e[e.NoteheadSlashWhiteWhole=57602]="NoteheadSlashWhiteWhole",e[e.NoteheadSlashWhiteHalf=57603]="NoteheadSlashWhiteHalf",e[e.NoteQuarterUp=57813]="NoteQuarterUp",e[e.NoteEighthUp=57815]="NoteEighthUp",e[e.Tremolo3=57890]="Tremolo3",e[e.Tremolo2=57889]="Tremolo2",e[e.Tremolo1=57888]="Tremolo1",e[e.FlagEighthUp=57920]="FlagEighthUp",e[e.FlagEighthDown=57921]="FlagEighthDown",e[e.FlagSixteenthUp=57922]="FlagSixteenthUp",e[e.FlagSixteenthDown=57923]="FlagSixteenthDown",e[e.FlagThirtySecondUp=57924]="FlagThirtySecondUp",e[e.FlagThirtySecondDown=57925]="FlagThirtySecondDown",e[e.FlagSixtyFourthUp=57926]="FlagSixtyFourthUp",e[e.FlagSixtyFourthDown=57927]="FlagSixtyFourthDown",e[e.FlagOneHundredTwentyEighthUp=57928]="FlagOneHundredTwentyEighthUp",e[e.FlagOneHundredTwentyEighthDown=57929]="FlagOneHundredTwentyEighthDown",e[e.FlagTwoHundredFiftySixthUp=57930]="FlagTwoHundredFiftySixthUp",e[e.FlagTwoHundredFiftySixthDown=57931]="FlagTwoHundredFiftySixthDown",e[e.AccidentalFlat=57952]="AccidentalFlat",e[e.AccidentalNatural=57953]="AccidentalNatural",e[e.AccidentalSharp=57954]="AccidentalSharp",e[e.AccidentalDoubleSharp=57955]="AccidentalDoubleSharp",e[e.AccidentalDoubleFlat=57956]="AccidentalDoubleFlat",e[e.AccidentalQuarterToneFlatArrowUp=57968]="AccidentalQuarterToneFlatArrowUp",e[e.AccidentalQuarterToneSharpArrowUp=57972]="AccidentalQuarterToneSharpArrowUp",e[e.AccidentalQuarterToneNaturalArrowUp=57970]="AccidentalQuarterToneNaturalArrowUp",e[e.ArticAccentAbove=58528]="ArticAccentAbove",e[e.ArticAccentBelow=58529]="ArticAccentBelow",e[e.ArticStaccatoAbove=58530]="ArticStaccatoAbove",e[e.ArticStaccatoBelow=58531]="ArticStaccatoBelow",e[e.ArticTenutoAbove=58532]="ArticTenutoAbove",e[e.ArticTenutoBelow=58533]="ArticTenutoBelow",e[e.ArticMarcatoAbove=58540]="ArticMarcatoAbove",e[e.ArticMarcatoBelow=58541]="ArticMarcatoBelow",e[e.FermataAbove=58560]="FermataAbove",e[e.FermataShortAbove=58564]="FermataShortAbove",e[e.FermataLongAbove=58566]="FermataLongAbove",e[e.RestLonga=58593]="RestLonga",e[e.RestDoubleWhole=58594]="RestDoubleWhole",e[e.RestWhole=58595]="RestWhole",e[e.RestHalf=58596]="RestHalf",e[e.RestQuarter=58597]="RestQuarter",e[e.RestEighth=58598]="RestEighth",e[e.RestSixteenth=58599]="RestSixteenth",e[e.RestThirtySecond=58600]="RestThirtySecond",e[e.RestSixtyFourth=58601]="RestSixtyFourth",e[e.RestOneHundredTwentyEighth=58602]="RestOneHundredTwentyEighth",e[e.RestTwoHundredFiftySixth=58603]="RestTwoHundredFiftySixth",e[e.Repeat1Bar=58624]="Repeat1Bar",e[e.Repeat2Bars=58625]="Repeat2Bars",e[e.Ottava=58640]="Ottava",e[e.OttavaAlta=58641]="OttavaAlta",e[e.OttavaBassaVb=58652]="OttavaBassaVb",e[e.Quindicesima=58644]="Quindicesima",e[e.QuindicesimaAlta=58645]="QuindicesimaAlta",e[e.DynamicPPP=58666]="DynamicPPP",e[e.DynamicPP=58667]="DynamicPP",e[e.DynamicPiano=58656]="DynamicPiano",e[e.DynamicMP=58668]="DynamicMP",e[e.DynamicMF=58669]="DynamicMF",e[e.DynamicForte=58658]="DynamicForte",e[e.DynamicFF=58671]="DynamicFF",e[e.DynamicFFF=58672]="DynamicFFF",e[e.OrnamentTrill=58726]="OrnamentTrill",e[e.OrnamentTurn=58727]="OrnamentTurn",e[e.OrnamentTurnInverted=58728]="OrnamentTurnInverted",e[e.OrnamentShortTrill=58732]="OrnamentShortTrill",e[e.OrnamentMordent=58733]="OrnamentMordent",e[e.StringsDownBow=58896]="StringsDownBow",e[e.StringsUpBow=58898]="StringsUpBow",e[e.KeyboardPedalPed=58960]="KeyboardPedalPed",e[e.KeyboardPedalUp=58965]="KeyboardPedalUp",e[e.PictEdgeOfCymbal=59177]="PictEdgeOfCymbal",e[e.GuitarString0=59443]="GuitarString0",e[e.GuitarString1=59444]="GuitarString1",e[e.GuitarString2=59445]="GuitarString2",e[e.GuitarString3=59446]="GuitarString3",e[e.GuitarString4=59447]="GuitarString4",e[e.GuitarString5=59448]="GuitarString5",e[e.GuitarString6=59449]="GuitarString6",e[e.GuitarString7=59450]="GuitarString7",e[e.GuitarString8=59451]="GuitarString8",e[e.GuitarString9=59452]="GuitarString9",e[e.GuitarOpenPedal=59453]="GuitarOpenPedal",e[e.GuitarClosePedal=59455]="GuitarClosePedal",e[e.GuitarGolpe=59458]="GuitarGolpe",e[e.GuitarFadeIn=59459]="GuitarFadeIn",e[e.GuitarFadeOut=59460]="GuitarFadeOut",e[e.GuitarVolumeSwell=59461]="GuitarVolumeSwell",e[e.FretboardX=59481]="FretboardX",e[e.FretboardO=59482]="FretboardO",e[e.WiggleTrill=60068]="WiggleTrill",e[e.WiggleVibratoMediumFast=60126]="WiggleVibratoMediumFast",e[e.OctaveBaselineM=60565]="OctaveBaselineM",e[e.OctaveBaselineB=60563]="OctaveBaselineB"}(P||(P={})),function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"}(C||(C={})),function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle",e[e.Bottom=2]="Bottom"}(E||(E={}));class ne{constructor(e,t){this.width=e,this.height=t}}class oe{constructor(e="",t=0,i=0,s=P.None,a=P.None,r=P.None,n=P.None,o=E.Middle){this.elementType=e,this.outputMidiNumber=i,this.staffLine=t,this.noteHeadDefault=s,this.noteHeadHalf=a!==P.None?a:s,this.noteHeadWhole=r!==P.None?r:s,this.techniqueSymbol=n,this.techniqueSymbolPlacement=o}getSymbol(e){switch(e){case p.Whole:return this.noteHeadWhole;case p.Half:return this.noteHeadHalf;default:return this.noteHeadDefault}}}class he{static articulationFromElementVariation(e,t){return e<he.gp6ElementAndVariationToArticulation.length?(t>=he.gp6ElementAndVariationToArticulation.length&&(t=0),he.gp6ElementAndVariationToArticulation[e][t]):38}static getArticulation(e){const t=e.percussionArticulation,i=e.beat.voice.bar.staff.track.percussionArticulations;return t<i.length?i[t]:he.getArticulationByValue(t)}static getElementAndVariation(e){const t=he.getArticulation(e);if(!t)return[-1,-1];for(let e=0;e<he.gp6ElementAndVariationToArticulation.length;e++){const i=he.gp6ElementAndVariationToArticulation[e];for(let s=0;s<i.length;s++){const a=he.getArticulationByValue(i[s]);if(a?.outputMidiNumber===t.outputMidiNumber)return[e,s]}}return[-1,-1]}static getArticulationByValue(e){return he.instrumentArticulations.has(e)?he.instrumentArticulations.get(e):null}}he.gp6ElementAndVariationToArticulation=[[35,35,35],[38,91,37],[99,100,99],[56,100,56],[102,103,102],[43,43,43],[45,45,45],[47,47,47],[48,48,48],[50,50,50],[42,92,46],[44,44,44],[57,98,57],[49,97,49],[55,95,55],[51,93,127],[52,96,52]],he.instrumentArticulations=new Map([[38,new oe("snare",3,38,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[37,new oe("snare",3,37,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[91,new oe("snare",3,38,P.NoteheadDiamondWhite,P.NoteheadDiamondWhite,P.NoteheadDiamondWhite)],[42,new oe("hiHat",-1,42,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[92,new oe("hiHat",-1,46,P.NoteheadCircleSlash,P.NoteheadCircleSlash,P.NoteheadCircleSlash)],[46,new oe("hiHat",-1,46,P.NoteheadCircleX,P.NoteheadCircleX,P.NoteheadCircleX)],[44,new oe("hiHat",9,44,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[35,new oe("kickDrum",8,35,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[36,new oe("kickDrum",7,36,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[50,new oe("tom",1,50,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[48,new oe("tom",2,48,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[47,new oe("tom",4,47,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[45,new oe("tom",5,45,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[43,new oe("tom",6,43,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[93,new oe("ride",0,51,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack,P.PictEdgeOfCymbal,E.Bottom)],[51,new oe("ride",0,51,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[53,new oe("ride",0,53,P.NoteheadDiamondWhite,P.NoteheadDiamondWhite,P.NoteheadDiamondWhite)],[94,new oe("ride",0,51,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack,P.ArticStaccatoAbove,E.Top)],[55,new oe("splash",-2,55,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[95,new oe("splash",-2,55,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack,P.ArticStaccatoAbove,E.Bottom)],[52,new oe("china",-3,52,P.NoteheadHeavyXHat,P.NoteheadHeavyXHat,P.NoteheadHeavyXHat)],[96,new oe("china",-3,52,P.NoteheadHeavyXHat,P.NoteheadHeavyXHat,P.NoteheadHeavyXHat)],[49,new oe("crash",-2,49,P.NoteheadHeavyX,P.NoteheadHeavyX,P.NoteheadHeavyX)],[97,new oe("crash",-2,49,P.NoteheadHeavyX,P.NoteheadHeavyX,P.NoteheadHeavyX,P.ArticStaccatoAbove,E.Bottom)],[57,new oe("crash",-1,57,P.NoteheadHeavyX,P.NoteheadHeavyX,P.NoteheadHeavyX)],[98,new oe("crash",-1,57,P.NoteheadHeavyX,P.NoteheadHeavyX,P.NoteheadHeavyX,P.ArticStaccatoAbove,E.Bottom)],[99,new oe("cowbell",1,56,P.NoteheadTriangleUpBlack,P.NoteheadTriangleUpHalf,P.NoteheadTriangleUpWhole)],[100,new oe("cowbell",1,56,P.NoteheadXBlack,P.NoteheadXHalf,P.NoteheadXWhole)],[56,new oe("cowbell",0,56,P.NoteheadTriangleUpBlack,P.NoteheadTriangleUpHalf,P.NoteheadTriangleUpWhole)],[101,new oe("cowbell",0,56,P.NoteheadXBlack,P.NoteheadXHalf,P.NoteheadXWhole)],[102,new oe("cowbell",-1,56,P.NoteheadTriangleUpBlack,P.NoteheadTriangleUpHalf,P.NoteheadTriangleUpWhole)],[103,new oe("cowbell",-1,56,P.NoteheadXBlack,P.NoteheadXHalf,P.NoteheadXWhole)],[77,new oe("woodblock",-9,77,P.NoteheadTriangleUpBlack,P.NoteheadTriangleUpBlack,P.NoteheadTriangleUpBlack)],[76,new oe("woodblock",-10,76,P.NoteheadTriangleUpBlack,P.NoteheadTriangleUpBlack,P.NoteheadTriangleUpBlack)],[60,new oe("bongo",-4,60,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[104,new oe("bongo",-5,60,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole,P.NoteheadParenthesis,E.Middle)],[105,new oe("bongo",-6,60,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[61,new oe("bongo",-7,61,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[106,new oe("bongo",-8,61,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole,P.NoteheadParenthesis,E.Middle)],[107,new oe("bongo",-16,61,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[66,new oe("timbale",10,66,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[65,new oe("timbale",9,65,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[68,new oe("agogo",12,68,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[67,new oe("agogo",11,67,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[64,new oe("conga",17,64,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[108,new oe("conga",16,64,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[109,new oe("conga",15,64,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole,P.NoteheadParenthesis,E.Middle)],[63,new oe("conga",14,63,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[110,new oe("conga",13,63,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[62,new oe("conga",19,62,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole,P.NoteheadParenthesis,E.Middle)],[72,new oe("whistle",-11,72,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[71,new oe("whistle",-17,71,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[73,new oe("guiro",38,73,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[74,new oe("guiro",37,74,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[86,new oe("surdo",36,86,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[87,new oe("surdo",35,87,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadParenthesis,E.Middle)],[54,new oe("tambourine",3,54,P.NoteheadTriangleUpBlack,P.NoteheadTriangleUpBlack,P.NoteheadTriangleUpBlack)],[111,new oe("tambourine",2,54,P.NoteheadTriangleUpBlack,P.NoteheadTriangleUpBlack,P.NoteheadTriangleUpBlack,P.StringsUpBow,E.Bottom)],[112,new oe("tambourine",1,54,P.NoteheadTriangleUpBlack,P.NoteheadTriangleUpBlack,P.NoteheadTriangleUpBlack,P.StringsDownBow,E.Bottom)],[113,new oe("tambourine",-7,54,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[79,new oe("cuica",30,79,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[78,new oe("cuica",29,78,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[58,new oe("vibraslap",28,58,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[81,new oe("triangle",27,81,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[80,new oe("triangle",26,80,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadParenthesis,E.Middle)],[114,new oe("grancassa",25,43,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[115,new oe("piatti",18,49,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[116,new oe("piatti",24,49,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[69,new oe("cabasa",23,69,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[117,new oe("cabasa",22,69,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole,P.StringsUpBow,E.Bottom)],[85,new oe("castanets",21,85,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[75,new oe("claves",20,75,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[70,new oe("maraca",-12,70,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[118,new oe("maraca",-13,70,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole,P.StringsUpBow,E.Bottom)],[119,new oe("maraca",-14,70,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[120,new oe("maraca",-15,70,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole,P.StringsUpBow,E.Bottom)],[82,new oe("shaker",-23,54,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[122,new oe("shaker",-24,54,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole,P.StringsUpBow,E.Bottom)],[84,new oe("bellTree",-18,53,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[123,new oe("bellTree",-19,53,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole,P.StringsUpBow,E.Bottom)],[83,new oe("jingleBell",-20,53,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[124,new oe("unpitched",-21,62,P.NoteheadNull,P.NoteheadNull,P.NoteheadNull,P.GuitarGolpe,E.Top)],[125,new oe("unpitched",-22,62,P.NoteheadNull,P.NoteheadNull,P.NoteheadNull,P.GuitarGolpe,E.Bottom)],[39,new oe("handClap",3,39,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[40,new oe("snare",3,40,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[31,new oe("snare",3,40,P.NoteheadSlashedBlack2,P.NoteheadSlashedBlack2,P.NoteheadSlashedBlack2)],[41,new oe("tom",5,41,P.NoteheadBlack,P.NoteheadHalf,P.NoteheadWhole)],[59,new oe("ride",2,59,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack,P.PictEdgeOfCymbal,E.Bottom)],[126,new oe("ride",2,59,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[127,new oe("ride",2,59,P.NoteheadDiamondWhite,P.NoteheadDiamondWhite,P.NoteheadDiamondWhite)],[29,new oe("ride",2,59,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack,P.ArticStaccatoAbove,E.Top)],[30,new oe("crash",-3,49,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[33,new oe("snare",3,37,P.NoteheadXBlack,P.NoteheadXBlack,P.NoteheadXBlack)],[34,new oe("snare",3,38,P.NoteheadBlack,P.NoteheadBlack,P.NoteheadBlack)]]),he.instrumentArticulationNames=new Map([["Ride (choke)",29],["Cymbal (hit)",30],["Snare (side stick)",31],["Snare (side stick) 2",33],["Snare (hit)",34],["Kick (hit)",35],["Kick (hit) 2",36],["Snare (side stick) 3",37],["Snare (hit) 2",38],["Hand Clap (hit)",39],["Snare (hit) 3",40],["Low Floor Tom (hit)",41],["Hi-Hat (closed)",42],["Very Low Tom (hit)",43],["Pedal Hi-Hat (hit)",44],["Low Tom (hit)",45],["Hi-Hat (open)",46],["Mid Tom (hit)",47],["High Tom (hit)",48],["Crash high (hit)",49],["High Floor Tom (hit)",50],["Ride (middle)",51],["China (hit)",52],["Ride (bell)",53],["Tambourine (hit)",54],["Splash (hit)",55],["Cowbell medium (hit)",56],["Crash medium (hit)",57],["Vibraslap (hit)",58],["Ride (edge)",59],["Hand (hit)",60],["Hand (hit)",61],["Conga high (mute)",62],["Conga high (hit)",63],["Conga low (hit)",64],["Timbale high (hit)",65],["Timbale low (hit)",66],["Agogo high (hit)",67],["Agogo tow (hit)",68],["Cabasa (hit)",69],["Left Maraca (hit)",70],["Whistle high (hit)",71],["Whistle low (hit)",72],["Guiro (hit)",73],["Guiro (scrap-return)",74],["Claves (hit)",75],["Woodblock high (hit)",76],["Woodblock low (hit)",77],["Cuica (mute)",78],["Cuica (open)",79],["Triangle (rnute)",80],["Triangle (hit)",81],["Shaker (hit)",82],["Tinkle Bell (hat)",83],["Jingle Bell (hit)",83],["Bell Tree (hit)",84],["Castanets (hit)",85],["Surdo (hit)",86],["Surdo (mute)",87],["Snare (rim shot)",91],["Hi-Hat (half)",92],["Ride (edge) 2",93],["Ride (choke) 2",94],["Splash (choke)",95],["China (choke)",96],["Crash high (choke)",97],["Crash medium (choke)",98],["Cowbell low (hit)",99],["Cowbell low (tip)",100],["Cowbell medium (tip)",101],["Cowbell high (hit)",102],["Cowbell high (tip)",103],["Hand (mute)",104],["Hand (slap)",105],["Hand (mute) 2",106],["Hand (slap) 2",107],["Conga low (slap)",108],["Conga low (mute)",109],["Conga high (slap)",110],["Tambourine (return)",111],["Tambourine (roll)",112],["Tambourine (hand)",113],["Grancassa (hit)",114],["Piatti (hat)",115],["Piatti (hand)",116],["Cabasa (return)",117],["Left Maraca (return)",118],["Right Maraca (hit)",119],["Right Maraca (return)",120],["Shaker (return)",122],["Bell Tee (return)",123],["Golpe (thumb)",124],["Golpe (finger)",125],["Ride (middle) 2",126],["Ride (bell) 2",127]]),function(e){e[e.None=0]="None",e[e.InvertedTurn=1]="InvertedTurn",e[e.Turn=2]="Turn",e[e.UpperMordent=3]="UpperMordent",e[e.LowerMordent=4]="LowerMordent"}(F||(F={}));class le{constructor(){this.tieDestinationNoteId=-1,this.tieOriginNoteId=-1,this.slurDestinationNoteId=-1,this.slurOriginNoteId=-1,this.hammerPullDestinationNoteId=-1,this.hammerPullOriginNoteId=-1}}class de{constructor(){this.id=de.GlobalNoteId++,this.index=0,this.accentuated=s.None,this.bendType=d.None,this.bendStyle=l.Default,this.bendOrigin=null,this.isContinuedBend=!1,this.bendPoints=null,this.maxBendPoint=null,this.fret=-1,this.string=-1,this.showStringNumber=!1,this.octave=-1,this.tone=-1,this.percussionArticulation=-1,this.isVisible=!0,this.isLeftHandTapped=!1,this.isHammerPullOrigin=!1,this.hammerPullOrigin=null,this.hammerPullDestination=null,this.isSlurDestination=!1,this.slurOrigin=null,this.slurDestination=null,this.harmonicType=y.None,this.harmonicValue=0,this.isGhost=!1,this.isLetRing=!1,this.letRingDestination=null,this.isPalmMute=!1,this.palmMuteDestination=null,this.isDead=!1,this.isStaccato=!1,this.slideInType=S.None,this.slideOutType=w.None,this.slideTarget=null,this.slideOrigin=null,this.vibrato=_.None,this.tieOrigin=null,this.tieDestination=null,this.isTieDestination=!1,this.leftHandFinger=m.Unknown,this.rightHandFinger=m.Unknown,this.isFingering=!1,this.trillValue=-1,this.trillSpeed=p.ThirtySecond,this.durationPercent=1,this.accidentalMode=b.Default,this.dynamics=g.F,this.isEffectSlurOrigin=!1,this.hasEffectSlur=!1,this.effectSlurOrigin=null,this.effectSlurDestination=null,this.ornament=F.None,this._noteIdBag=null}get hasBend(){return null!==this.bendPoints&&this.bendType!==d.None}get isStringed(){return this.string>=0}get isPiano(){return!this.isStringed&&this.octave>=0&&this.tone>=0}get isPercussion(){return!this.isStringed&&this.percussionArticulation>=0}get element(){return this.isPercussion?he.getElementAndVariation(this)[0]:-1}get variation(){return this.isPercussion?he.getElementAndVariation(this)[1]:-1}get isHammerPullDestination(){return!!this.hammerPullOrigin}get isSlurOrigin(){return!!this.slurDestination}get isHarmonic(){return this.harmonicType!==y.None}get isTieOrigin(){return null!==this.tieDestination}get trillFret(){return this.trillValue-this.stringTuning}get isTrill(){return this.trillValue>=0}get isEffectSlurDestination(){return!!this.effectSlurOrigin}get stringTuning(){return this.beat.voice.bar.staff.capo+de.getStringTuning(this.beat.voice.bar.staff,this.string)}static getStringTuning(e,t){return e.tuning.length>0?e.tuning[e.tuning.length-(t-1)-1]:0}get realValue(){return this.calculateRealValue(!0,!0)}get realValueWithoutHarmonic(){return this.calculateRealValue(!0,!1)}calculateRealValue(e,t){const i=e?this.beat.voice.bar.staff.transpositionPitch:0;if(t){let t=this.calculateRealValue(e,!1);return this.isStringed&&(this.harmonicType===y.Natural?t=this.harmonicPitch+this.stringTuning-i:t+=this.harmonicPitch),t}return this.isPercussion?this.percussionArticulation:this.isStringed?this.fret+this.stringTuning-i:this.isPiano?12*this.octave+this.tone-i:0}get harmonicPitch(){if(this.harmonicType===y.None||!this.isStringed)return 0;let e=this.harmonicValue;return re.isAlmostEqualTo(e,2.4)?36:re.isAlmostEqualTo(e,2.7)?34:e<3?0:e<=3.5?31:e<=4?28:e<=5?24:e<=6?34:e<=7?19:e<=8.5?36:e<=9?28:e<=10?34:e<=11?0:e<=12?12:e<14?0:e<=15?34:e<=16?28:e<=17?36:e<=18?0:e<=19?19:e<=21?0:e<=22?36:e<=24?24:0}get initialBendValue(){return this.hasBend?Math.floor(this.bendPoints[0].value/2):this.bendOrigin?Math.floor(this.bendOrigin.bendPoints[this.bendOrigin.bendPoints.length-1].value/2):this.isTieDestination&&this.tieOrigin.bendOrigin?Math.floor(this.tieOrigin.bendOrigin.bendPoints[this.tieOrigin.bendOrigin.bendPoints.length-1].value/2):this.beat.hasWhammyBar?Math.floor(this.beat.whammyBarPoints[0].value/2):this.beat.isContinuedWhammy?Math.floor(this.beat.previousBeat.whammyBarPoints[this.beat.previousBeat.whammyBarPoints.length-1].value/2):0}get displayValue(){return this.displayValueWithoutBend+this.initialBendValue}get displayValueWithoutBend(){let e=this.realValue;switch(this.harmonicType!==y.Natural&&this.harmonicType!==y.None&&(e-=this.harmonicPitch),this.beat.ottava){case n._15ma:e-=24;break;case n._8va:e-=12;break;case n.Regular:break;case n._8vb:e+=12;break;case n._15mb:e+=24}switch(this.beat.voice.bar.clefOttava){case n._15ma:e-=24;break;case n._8va:e-=12;break;case n.Regular:break;case n._8vb:e+=12;break;case n._15mb:e+=24}return e-this.beat.voice.bar.staff.displayTranspositionPitch}get hasQuarterToneOffset(){return this.hasBend?this.bendPoints[0].value%2!=0:this.bendOrigin?this.bendOrigin.bendPoints[this.bendOrigin.bendPoints.length-1].value%2!=0:this.beat.hasWhammyBar?this.beat.whammyBarPoints[0].value%2!=0:!!this.beat.isContinuedWhammy&&this.beat.previousBeat.whammyBarPoints[this.beat.previousBeat.whammyBarPoints.length-1].value%2!=0}addBendPoint(e){let t=this.bendPoints;null===t&&(t=[],this.bendPoints=t),t.push(e),(!this.maxBendPoint||e.value>this.maxBendPoint.value)&&(this.maxBendPoint=e),this.bendType===d.None&&(this.bendType=d.Custom)}finish(e,t=null){let i=new ee((()=>de.nextNoteOnSameLine(this))),s=e&&e.notation.notationMode===k.SongBook;if(this.isTieDestination&&(this.chain(t),s&&this.tieOrigin&&this.tieOrigin.isLetRing&&(this.isLetRing=!0)),this.isLetRing&&(i.value&&i.value.isLetRing?this.letRingDestination=i.value:this.letRingDestination=this,s&&this.isTieDestination&&!this.tieOrigin.hasBend&&(this.isVisible=!1)),this.isPalmMute&&(i.value&&i.value.isPalmMute?this.palmMuteDestination=i.value:this.palmMuteDestination=this),this.isHammerPullOrigin){let e=de.findHammerPullDestination(this);e?(this.hammerPullDestination=e,e.hammerPullOrigin=this):this.isHammerPullOrigin=!1}switch(this.slideOutType){case w.Shift:case w.Legato:this.slideTarget=i.value,this.slideTarget?this.slideTarget.slideOrigin=this:this.slideOutType=w.None}let a=null;this.isHammerPullOrigin&&this.hammerPullDestination?a=this.hammerPullDestination:this.slideOutType===w.Legato&&this.slideTarget&&(a=this.slideTarget),a&&(this.hasEffectSlur=!0,this.effectSlurOrigin&&this.beat.pickStroke===v.None?(this.effectSlurOrigin.effectSlurDestination=a,this.effectSlurOrigin.effectSlurDestination.effectSlurOrigin=this.effectSlurOrigin,this.effectSlurOrigin=null):(this.isEffectSlurOrigin=!0,this.effectSlurDestination=a,this.effectSlurDestination.effectSlurOrigin=this));const r=this.bendPoints;if(null!=r&&r.length>0&&this.bendType===d.Custom){let e=this.isTieDestination&&this.tieOrigin.hasBend;if(this.isContinuedBend=e,4===r.length){let t=r[0],i=r[1],s=r[2],a=r[3];i.value===s.value?a.value>t.value?i.value>a.value?this.bendType=d.BendRelease:!e&&t.value>0?(this.bendType=d.PrebendBend,r.splice(2,1),r.splice(1,1)):(this.bendType=d.Bend,r.splice(2,1),r.splice(1,1)):a.value<t.value?e?(this.bendType=d.Release,r.splice(2,1),r.splice(1,1)):(this.bendType=d.PrebendRelease,r.splice(2,1),r.splice(1,1)):i.value>t.value?this.bendType=d.BendRelease:t.value>0&&!e?(this.bendType=d.Prebend,r.splice(2,1),r.splice(1,1)):(this.bendType=d.Hold,r.splice(2,1),r.splice(1,1)):ie.warning("Model","Unsupported bend type detected, fallback to custom",null)}else if(2===r.length){let t=r[0],i=r[1];i.value>t.value?!e&&t.value>0?this.bendType=d.PrebendBend:this.bendType=d.Bend:i.value<t.value?this.bendType=e?d.Release:d.PrebendRelease:t.value>0&&!e?this.bendType=d.Prebend:this.bendType=d.Hold}}else null!==r&&0!==r.length||(this.bendType=d.None);this.initialBendValue>0&&(this.accidentalMode=b.Default)}static nextNoteOnSameLine(e){let t=e.beat.nextBeat;for(;t&&t.voice.bar.index<=e.beat.voice.bar.index+de.MaxOffsetForSameLineSearch;){let i=t.getNoteOnString(e.string);if(i)return i;t=t.nextBeat}return null}static findHammerPullDestination(e){let t=e.beat.nextBeat;for(;t&&t.voice.bar.index<=e.beat.voice.bar.index+de.MaxOffsetForSameLineSearch;){let i=t.getNoteOnString(e.string);if(i)return i;for(let s=e.string;s>0;s--)if(i=t.getNoteOnString(s),i){if(i.isLeftHandTapped)return i;break}for(let s=e.string;s<=e.beat.voice.bar.staff.tuning.length;s++)if(i=t.getNoteOnString(s),i){if(i.isLeftHandTapped)return i;break}t=t.nextBeat}return null}static findTieOrigin(e){let t=e.beat.previousBeat;for(;t&&t.voice.bar.index>=e.beat.voice.bar.index-de.MaxOffsetForSameLineSearch;){if(e.isStringed){let i=t.getNoteOnString(e.string);if(i)return i}else if(-1===e.octave&&-1===e.tone){if(e.index<t.notes.length)return t.notes[e.index]}else{let i=t.getNoteWithRealValue(e.realValue);if(i)return i}t=t.previousBeat}return null}chain(e=null){if(null!==e)if(null!==this._noteIdBag){let t;e.has(de.NoteIdLookupKey)?t=e.get(de.NoteIdLookupKey):(t=new Map,e.set(de.NoteIdLookupKey,t)),-1===this._noteIdBag.hammerPullDestinationNoteId&&-1===this._noteIdBag.tieDestinationNoteId&&-1===this._noteIdBag.slurDestinationNoteId||t.set(this.id,this),-1!==this._noteIdBag.hammerPullOriginNoteId&&(this.hammerPullOrigin=t.get(this._noteIdBag.hammerPullOriginNoteId),this.hammerPullOrigin.hammerPullDestination=this),-1!==this._noteIdBag.tieOriginNoteId&&(this.tieOrigin=t.get(this._noteIdBag.tieOriginNoteId),this.tieOrigin.tieDestination=this),-1!==this._noteIdBag.slurOriginNoteId&&(this.slurOrigin=t.get(this._noteIdBag.slurOriginNoteId),this.slurOrigin.slurDestination=this),this._noteIdBag=null}else{if(!this.isTieDestination&&null===this.tieOrigin)return;let e=this.tieOrigin??de.findTieOrigin(this);e?(e.tieDestination=this,this.tieOrigin=e,this.fret=e.fret,this.octave=e.octave,this.tone=e.tone,e.hasBend&&(this.bendOrigin=this.tieOrigin)):this.isTieDestination=!1}}toJson(e){null!==this.tieDestination&&e.set("tiedestinationnoteid",this.tieDestination.id),null!==this.tieOrigin&&e.set("tieoriginnoteid",this.tieOrigin.id),null!==this.slurDestination&&e.set("slurdestinationnoteid",this.slurDestination.id),null!==this.slurOrigin&&e.set("sluroriginnoteid",this.slurOrigin.id),null!==this.hammerPullOrigin&&e.set("hammerpulloriginnoteid",this.hammerPullOrigin.id),null!==this.hammerPullDestination&&e.set("hammerpulldestinationnoteid",this.hammerPullDestination.id)}setProperty(e,t){switch(e){case"tiedestinationnoteid":return null==this._noteIdBag&&(this._noteIdBag=new le),this._noteIdBag.tieDestinationNoteId=t,!0;case"tieoriginnoteid":return null==this._noteIdBag&&(this._noteIdBag=new le),this._noteIdBag.tieOriginNoteId=t,!0;case"slurdestinationnoteid":return null==this._noteIdBag&&(this._noteIdBag=new le),this._noteIdBag.slurDestinationNoteId=t,!0;case"sluroriginnoteid":return null==this._noteIdBag&&(this._noteIdBag=new le),this._noteIdBag.slurOriginNoteId=t,!0;case"hammerpulloriginnoteid":return null==this._noteIdBag&&(this._noteIdBag=new le),this._noteIdBag.hammerPullOriginNoteId=t,!0;case"hammerpulldestinationnoteid":return null==this._noteIdBag&&(this._noteIdBag=new le),this._noteIdBag.hammerPullDestinationNoteId=t,!0}return!1}}de.GlobalNoteId=0,de.MaxOffsetForSameLineSearch=3,de.NoteIdLookupKey="NoteIdLookup";class ce{constructor(e){this._isEqualLengthTuplet=!0,this.totalDuration=0,this.beats=[],this.isFull=!1,this.voice=e}check(e){if(0===this.beats.length)return this.beats.push(e),this.totalDuration+=e.playbackDuration,!0;if(e.graceType!==f.None)return!0;if(e.voice!==this.voice||this.isFull||e.tupletNumerator!==this.beats[0].tupletNumerator||e.tupletDenominator!==this.beats[0].tupletDenominator)return!1;if(e.playbackDuration!==this.beats[0].playbackDuration&&(this._isEqualLengthTuplet=!1),this.beats.push(e),this.totalDuration+=e.playbackDuration,this._isEqualLengthTuplet)this.beats.length===this.beats[0].tupletNumerator&&(this.isFull=!0);else{let e=this.beats[0].tupletNumerator/this.beats[0].tupletDenominator|0;for(let t of ce.AllTicks)if(this.totalDuration===t*e){this.isFull=!0;break}}return!0}}ce.HalfTicks=1920,ce.QuarterTicks=960,ce.EighthTicks=480,ce.SixteenthTicks=240,ce.ThirtySecondTicks=120,ce.SixtyFourthTicks=60,ce.OneHundredTwentyEighthTicks=30,ce.TwoHundredFiftySixthTicks=15,ce.AllTicks=[ce.HalfTicks,ce.QuarterTicks,ce.EighthTicks,ce.SixteenthTicks,ce.ThirtySecondTicks,ce.SixtyFourthTicks,ce.OneHundredTwentyEighthTicks,ce.TwoHundredFiftySixthTicks],function(e){e[e.None=0]="None",e[e.Custom=1]="Custom",e[e.Dive=2]="Dive",e[e.Dip=3]="Dip",e[e.Hold=4]="Hold",e[e.Predive=5]="Predive",e[e.PrediveDive=6]="PrediveDive"}(L||(L={}));class ue{static clone(e){const t=new $;return t.offset=e.offset,t.value=e.value,t}}class pe{static clone(e){const t=new de;if(t.index=e.index,t.accentuated=e.accentuated,t.bendType=e.bendType,t.bendStyle=e.bendStyle,t.isContinuedBend=e.isContinuedBend,e.bendPoints){t.bendPoints=[];for(const i of e.bendPoints)t.addBendPoint(ue.clone(i))}return t.fret=e.fret,t.string=e.string,t.showStringNumber=e.showStringNumber,t.octave=e.octave,t.tone=e.tone,t.percussionArticulation=e.percussionArticulation,t.isVisible=e.isVisible,t.isLeftHandTapped=e.isLeftHandTapped,t.isHammerPullOrigin=e.isHammerPullOrigin,t.isSlurDestination=e.isSlurDestination,t.harmonicType=e.harmonicType,t.harmonicValue=e.harmonicValue,t.isGhost=e.isGhost,t.isLetRing=e.isLetRing,t.isPalmMute=e.isPalmMute,t.isDead=e.isDead,t.isStaccato=e.isStaccato,t.slideInType=e.slideInType,t.slideOutType=e.slideOutType,t.vibrato=e.vibrato,t.isTieDestination=e.isTieDestination,t.leftHandFinger=e.leftHandFinger,t.rightHandFinger=e.rightHandFinger,t.isFingering=e.isFingering,t.trillValue=e.trillValue,t.trillSpeed=e.trillSpeed,t.durationPercent=e.durationPercent,t.accidentalMode=e.accidentalMode,t.dynamics=e.dynamics,t.ornament=e.ornament,t}}class ge{static clone(e){const t=new J;return t.isLinear=e.isLinear,t.type=e.type,t.value=e.value,t.ratioPosition=e.ratioPosition,t.text=e.text,t}}class fe{static clone(e){const t=new ye;t.index=e.index,t.notes=[];for(const i of e.notes)t.addNote(pe.clone(i));t.isEmpty=e.isEmpty,t.whammyStyle=e.whammyStyle,t.ottava=e.ottava,t.isLegatoOrigin=e.isLegatoOrigin,t.duration=e.duration,t.isLetRing=e.isLetRing,t.isPalmMute=e.isPalmMute,t.automations=[];for(const i of e.automations)t.automations.push(ge.clone(i));if(t.dots=e.dots,t.fade=e.fade,t.lyrics=e.lyrics?e.lyrics.slice():null,t.pop=e.pop,t.slap=e.slap,t.tap=e.tap,t.text=e.text,t.slashed=e.slashed,t.deadSlapped=e.deadSlapped,t.brushType=e.brushType,t.brushDuration=e.brushDuration,t.tupletDenominator=e.tupletDenominator,t.tupletNumerator=e.tupletNumerator,t.isContinuedWhammy=e.isContinuedWhammy,t.whammyBarType=e.whammyBarType,e.whammyBarPoints){t.whammyBarPoints=[];for(const i of e.whammyBarPoints)t.addWhammyBarPoint(ue.clone(i))}return t.vibrato=e.vibrato,t.chordId=e.chordId,t.graceType=e.graceType,t.pickStroke=e.pickStroke,t.tremoloSpeed=e.tremoloSpeed,t.crescendo=e.crescendo,t.disp