UNPKG

aibandtab

Version:

aibandTab is a music notation and guitar tablature rendering library

1 lines 775 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).aibandTab={})}(this,(function(e){"use strict";var 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,E,C,F,L,M,D,I,A,R,O,H,V,G,W,z,U;e.LayoutMode=void 0,(t=e.LayoutMode||(e.LayoutMode={}))[t.Page=0]="Page",t[t.Horizontal=1]="Horizontal",e.StaveProfile=void 0,(i=e.StaveProfile||(e.StaveProfile={}))[i.Default=0]="Default",i[i.ScoreTab=1]="ScoreTab",i[i.Score=2]="Score",i[i.Tab=3]="Tab",i[i.TabMixed=4]="TabMixed";class X{static getValue(e){return X._values||(X._values=new Map),e=e.toLowerCase().replaceAll(" ",""),X._values.has(e)?X._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}}X._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 Y{init(e,t){this.data=e,this.settings=t}}e.AibandTabErrorType=void 0,(s=e.AibandTabErrorType||(e.AibandTabErrorType={}))[s.General=0]="General",s[s.Format=1]="Format",s[s.AibandTex=2]="AibandTex";class q extends Error{constructor(e,t="",i){super(t??"",{cause:i}),this.type=e,Object.setPrototypeOf(this,q.prototype)}}class J extends q{constructor(t=null,i){super(e.AibandTabErrorType.Format,t??"Unsupported format",i),Object.setPrototypeOf(this,J.prototype)}}!function(e){e[e.None=0]="None",e[e.Normal=1]="Normal",e[e.Heavy=2]="Heavy",e[e.Tenuto=3]="Tenuto"}(a||(a={})),function(e){e[e.Tempo=0]="Tempo",e[e.Volume=1]="Volume",e[e.Instrument=2]="Instrument",e[e.Balance=3]="Balance"}(r||(r={}));class j{constructor(){this.isLinear=!1,this.type=r.Tempo,this.value=0,this.ratioPosition=0,this.text=""}static buildTempoAutomation(e,t,i,s){(s<1||s>5)&&(s=2);let a=new Float32Array([1,.5,1,1.5,2,3]),n=new j;return n.type=r.Tempo,n.isLinear=e,n.ratioPosition=t,n.value=i*a[s],n}static buildInstrumentAutomation(e,t,i){let s=new j;return s.type=r.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"}(n||(n={})),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"}(o||(o={})),function(e){e[e.None=0]="None",e[e.Simple=1]="Simple",e[e.FirstOfDouble=2]="FirstOfDouble",e[e.SecondOfDouble=3]="SecondOfDouble"}(h||(h={})),function(e){e[e.Down=0]="Down",e[e.Hold=1]="Hold",e[e.Up=2]="Up"}(l||(l={}));class Q{constructor(){this.ratioPosition=0,this.pedalType=l.Down,this.nextPedalMarker=null,this.previousPedalMarker=null}}class K{constructor(){this.id=K._globalBarId++,this.index=0,this.nextBar=null,this.previousBar=null,this.clef=n.G2,this.clefOttava=o.Regular,this.voices=[],this.simileMark=h.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!==l.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!==l.Up){const t=new Q;t.ratioPosition=0,t.bar=this,t.pedalType=l.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}}K._globalBarId=0;class ${static ticksToMillis(e,t){return e*(6e4/(t*$.QuarterTime))|0}static millisToTicks(e,t){return e/(6e4/(t*$.QuarterTime))|0}static toTicks(e){return $.valueToTicks(e)}static valueToTicks(e){let t=e;return t<0&&(t=1/-t),$.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 $.MinVelocity+e*$.VelocityIncrement}}$.QuarterTime=960,$.MinVelocity=15,$.VelocityIncrement=16;class Z{constructor(e=0,t=0){this.offset=e,this.value=t}}Z.MaxPosition=60,Z.MaxValue=12,function(e){e[e.Default=0]="Default",e[e.Gradual=1]="Gradual",e[e.Fast=2]="Fast"}(d||(d={})),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"}(c||(c={})),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"}(u||(u={})),function(e){e[e.None=0]="None",e[e.Crescendo=1]="Crescendo",e[e.Decrescendo=2]="Decrescendo"}(p||(p={})),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"}(g||(g={})),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"}(f||(f={})),function(e){e[e.None=0]="None",e[e.OnBeat=1]="OnBeat",e[e.BeforeBeat=2]="BeforeBeat",e[e.BendGrace=3]="BendGrace"}(m||(m={})),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"}(y||(y={})),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"}(b||(b={})),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"}(S||(S={})),function(e){e[e.None=0]="None",e[e.IntoFromBelow=1]="IntoFromBelow",e[e.IntoFromAbove=2]="IntoFromAbove"}(w||(w={})),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"}(_||(_={})),function(e){e[e.None=0]="None",e[e.Slight=1]="Slight",e[e.Wide=2]="Wide"}(B||(B={})),e.TabRhythmMode=void 0,(T=e.TabRhythmMode||(e.TabRhythmMode={}))[T.Hidden=0]="Hidden",T[T.ShowWithBeams=1]="ShowWithBeams",T[T.ShowWithBars=2]="ShowWithBars",T[T.Automatic=3]="Automatic",e.FingeringMode=void 0,(k=e.FingeringMode||(e.FingeringMode={}))[k.ScoreDefault=0]="ScoreDefault",k[k.ScoreForcePiano=1]="ScoreForcePiano",k[k.SingleNoteEffectBand=2]="SingleNoteEffectBand",k[k.SingleNoteEffectBandForcePiano=3]="SingleNoteEffectBandForcePiano",e.NotationMode=void 0,(N=e.NotationMode||(e.NotationMode={}))[N.GuitarPro=0]="GuitarPro",N[N.SongBook=1]="SongBook",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"}(x||(x={}));class ee{constructor(){this.notationMode=e.NotationMode.GuitarPro,this.fingeringMode=e.FingeringMode.ScoreDefault,this.elements=new Map,this.rhythmMode=e.TabRhythmMode.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):!ee.defaultElements.has(e)||ee.defaultElements.get(e)}}ee.defaultElements=new Map([[x.ZerosOnDiveWhammys,!1]]);class te{constructor(e){this._value=void 0,this._factory=e}get value(){return void 0===this._value&&(this._value=this._factory()),this._value}}e.LogLevel=void 0,(v=e.LogLevel||(e.LogLevel={}))[v.None=0]="None",v[v.Debug=1]="Debug",v[v.Info=2]="Info",v[v.Warning=3]="Warning",v[v.Error=4]="Error";class ie{static format(e,t){return`[AibandTab][${e}] ${t}`}debug(e,t,...i){console.debug(ie.format(e,t),...i)}warning(e,t,...i){console.warn(ie.format(e,t),...i)}info(e,t,...i){console.info(ie.format(e,t),...i)}error(e,t,...i){console.error(ie.format(e,t),...i)}}ie.logLevel=e.LogLevel.Info;class se{static shouldLog(t){return se.logLevel!==e.LogLevel.None&&t>=se.logLevel}static debug(t,i,...s){se.shouldLog(e.LogLevel.Debug)&&se.log.debug(t,i,...s)}static warning(t,i,...s){se.shouldLog(e.LogLevel.Warning)&&se.log.warning(t,i,...s)}static info(t,i,...s){se.shouldLog(e.LogLevel.Info)&&se.log.info(t,i,...s)}static error(t,i,...s){se.shouldLog(e.LogLevel.Error)&&se.log.error(t,i,...s)}}se.logLevel=e.LogLevel.Info,se.log=new ie;class ae{constructor(){this.note=null,this.tone=new re,this.octave=0}get realValue(){return 12*this.octave+this.tone.noteValue}}class re{constructor(e=0,t=S.Default){this.noteValue=e,this.accidentalMode=t}}class ne{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(t,i,s,a){if(t.notation.fingeringMode===e.FingeringMode.ScoreForcePiano||t.notation.fingeringMode===e.FingeringMode.SingleNoteEffectBandForcePiano||X.isPiano(i.voice.bar.staff.track.playbackInfo.program))switch(s){case y.Unknown:case y.NoOrDead:return null;case y.Thumb:return"1";case y.IndexFinger:return"2";case y.MiddleFinger:return"3";case y.AnnularFinger:return"4";case y.LittleFinger:return"5";default:return null}if(a)switch(s){case y.Unknown:return null;case y.NoOrDead:return"0";case y.Thumb:return"t";case y.IndexFinger:return"1";case y.MiddleFinger:return"2";case y.AnnularFinger:return"3";case y.LittleFinger:return"4";default:return null}switch(s){case y.Unknown:case y.NoOrDead:return null;case y.Thumb:return"p";case y.IndexFinger:return"i";case y.MiddleFinger:return"m";case y.AnnularFinger:return"a";case y.LittleFinger:return"c";default:return null}}static isTuning(e){return!!ne.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 ae;return s.octave=parseInt(i)+1,s.note=t.toLowerCase(),s.tone=ne.getToneForText(s.note),s.tone.noteValue<0&&(s.octave--,s.tone.noteValue+=12),s}static getTuningForText(e){let t=ne.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=ne.parseAccidentalMode(i),a){case S.Default:case S.ForceNone:case S.ForceNatural:break;case S.ForceSharp:s++;break;case S.ForceDoubleSharp:s+=2;break;case S.ForceFlat:s--;break;case S.ForceDoubleFlat:s-=2}return new re(s,a)}static parseAccidentalMode(e){const t=e.toLowerCase();return ne.accidentalModeMapping.has(t)?ne.accidentalModeMapping.get(t):S.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}}ne.accidentalModeMapping=new Map([["default",S.Default],["d",S.Default],["forcenone",S.ForceNone],["-",S.ForceNone],["forcenatural",S.ForceNatural],["n",S.ForceNatural],["forcesharp",S.ForceSharp],["#",S.ForceSharp],["forcedoublesharp",S.ForceDoubleSharp],["##",S.ForceDoubleSharp],["x",S.ForceDoubleSharp],["forceflat",S.ForceFlat],["b",S.ForceFlat],["forcedoubleflat",S.ForceDoubleFlat],["bb",S.ForceDoubleFlat]]),function(e){e[e.None=0]="None",e[e.Up=1]="Up",e[e.Down=2]="Down"}(P||(P={})),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"}(E||(E={})),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"}(F||(F={}));class oe{constructor(e,t){this.width=e,this.height=t}}class he{constructor(e="",t=0,i=0,s=E.None,a=E.None,r=E.None,n=E.None,o=F.Middle){this.elementType=e,this.outputMidiNumber=i,this.staffLine=t,this.noteHeadDefault=s,this.noteHeadHalf=a!==E.None?a:s,this.noteHeadWhole=r!==E.None?r:s,this.techniqueSymbol=n,this.techniqueSymbolPlacement=o}getSymbol(e){switch(e){case g.Whole:return this.noteHeadWhole;case g.Half:return this.noteHeadHalf;default:return this.noteHeadDefault}}}class le{static articulationFromElementVariation(e,t){return e<le.gp6ElementAndVariationToArticulation.length?(t>=le.gp6ElementAndVariationToArticulation.length&&(t=0),le.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]:le.getArticulationByValue(t)}static getElementAndVariation(e){const t=le.getArticulation(e);if(!t)return[-1,-1];for(let e=0;e<le.gp6ElementAndVariationToArticulation.length;e++){const i=le.gp6ElementAndVariationToArticulation[e];for(let s=0;s<i.length;s++){const a=le.getArticulationByValue(i[s]);if(a?.outputMidiNumber===t.outputMidiNumber)return[e,s]}}return[-1,-1]}static getArticulationByValue(e){return le.instrumentArticulations.has(e)?le.instrumentArticulations.get(e):null}}le.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]],le.instrumentArticulations=new Map([[38,new he("snare",3,38,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[37,new he("snare",3,37,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[91,new he("snare",3,38,E.NoteheadDiamondWhite,E.NoteheadDiamondWhite,E.NoteheadDiamondWhite)],[42,new he("hiHat",-1,42,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[92,new he("hiHat",-1,46,E.NoteheadCircleSlash,E.NoteheadCircleSlash,E.NoteheadCircleSlash)],[46,new he("hiHat",-1,46,E.NoteheadCircleX,E.NoteheadCircleX,E.NoteheadCircleX)],[44,new he("hiHat",9,44,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[35,new he("kickDrum",8,35,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[36,new he("kickDrum",7,36,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[50,new he("tom",1,50,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[48,new he("tom",2,48,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[47,new he("tom",4,47,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[45,new he("tom",5,45,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[43,new he("tom",6,43,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[93,new he("ride",0,51,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack,E.PictEdgeOfCymbal,F.Bottom)],[51,new he("ride",0,51,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[53,new he("ride",0,53,E.NoteheadDiamondWhite,E.NoteheadDiamondWhite,E.NoteheadDiamondWhite)],[94,new he("ride",0,51,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack,E.ArticStaccatoAbove,F.Top)],[55,new he("splash",-2,55,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[95,new he("splash",-2,55,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack,E.ArticStaccatoAbove,F.Bottom)],[52,new he("china",-3,52,E.NoteheadHeavyXHat,E.NoteheadHeavyXHat,E.NoteheadHeavyXHat)],[96,new he("china",-3,52,E.NoteheadHeavyXHat,E.NoteheadHeavyXHat,E.NoteheadHeavyXHat)],[49,new he("crash",-2,49,E.NoteheadHeavyX,E.NoteheadHeavyX,E.NoteheadHeavyX)],[97,new he("crash",-2,49,E.NoteheadHeavyX,E.NoteheadHeavyX,E.NoteheadHeavyX,E.ArticStaccatoAbove,F.Bottom)],[57,new he("crash",-1,57,E.NoteheadHeavyX,E.NoteheadHeavyX,E.NoteheadHeavyX)],[98,new he("crash",-1,57,E.NoteheadHeavyX,E.NoteheadHeavyX,E.NoteheadHeavyX,E.ArticStaccatoAbove,F.Bottom)],[99,new he("cowbell",1,56,E.NoteheadTriangleUpBlack,E.NoteheadTriangleUpHalf,E.NoteheadTriangleUpWhole)],[100,new he("cowbell",1,56,E.NoteheadXBlack,E.NoteheadXHalf,E.NoteheadXWhole)],[56,new he("cowbell",0,56,E.NoteheadTriangleUpBlack,E.NoteheadTriangleUpHalf,E.NoteheadTriangleUpWhole)],[101,new he("cowbell",0,56,E.NoteheadXBlack,E.NoteheadXHalf,E.NoteheadXWhole)],[102,new he("cowbell",-1,56,E.NoteheadTriangleUpBlack,E.NoteheadTriangleUpHalf,E.NoteheadTriangleUpWhole)],[103,new he("cowbell",-1,56,E.NoteheadXBlack,E.NoteheadXHalf,E.NoteheadXWhole)],[77,new he("woodblock",-9,77,E.NoteheadTriangleUpBlack,E.NoteheadTriangleUpBlack,E.NoteheadTriangleUpBlack)],[76,new he("woodblock",-10,76,E.NoteheadTriangleUpBlack,E.NoteheadTriangleUpBlack,E.NoteheadTriangleUpBlack)],[60,new he("bongo",-4,60,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[104,new he("bongo",-5,60,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole,E.NoteheadParenthesis,F.Middle)],[105,new he("bongo",-6,60,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[61,new he("bongo",-7,61,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[106,new he("bongo",-8,61,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole,E.NoteheadParenthesis,F.Middle)],[107,new he("bongo",-16,61,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[66,new he("timbale",10,66,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[65,new he("timbale",9,65,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[68,new he("agogo",12,68,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[67,new he("agogo",11,67,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[64,new he("conga",17,64,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[108,new he("conga",16,64,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[109,new he("conga",15,64,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole,E.NoteheadParenthesis,F.Middle)],[63,new he("conga",14,63,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[110,new he("conga",13,63,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[62,new he("conga",19,62,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole,E.NoteheadParenthesis,F.Middle)],[72,new he("whistle",-11,72,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[71,new he("whistle",-17,71,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[73,new he("guiro",38,73,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[74,new he("guiro",37,74,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[86,new he("surdo",36,86,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[87,new he("surdo",35,87,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadParenthesis,F.Middle)],[54,new he("tambourine",3,54,E.NoteheadTriangleUpBlack,E.NoteheadTriangleUpBlack,E.NoteheadTriangleUpBlack)],[111,new he("tambourine",2,54,E.NoteheadTriangleUpBlack,E.NoteheadTriangleUpBlack,E.NoteheadTriangleUpBlack,E.StringsUpBow,F.Bottom)],[112,new he("tambourine",1,54,E.NoteheadTriangleUpBlack,E.NoteheadTriangleUpBlack,E.NoteheadTriangleUpBlack,E.StringsDownBow,F.Bottom)],[113,new he("tambourine",-7,54,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[79,new he("cuica",30,79,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[78,new he("cuica",29,78,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[58,new he("vibraslap",28,58,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[81,new he("triangle",27,81,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[80,new he("triangle",26,80,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadParenthesis,F.Middle)],[114,new he("grancassa",25,43,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[115,new he("piatti",18,49,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[116,new he("piatti",24,49,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[69,new he("cabasa",23,69,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[117,new he("cabasa",22,69,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole,E.StringsUpBow,F.Bottom)],[85,new he("castanets",21,85,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[75,new he("claves",20,75,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[70,new he("maraca",-12,70,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[118,new he("maraca",-13,70,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole,E.StringsUpBow,F.Bottom)],[119,new he("maraca",-14,70,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[120,new he("maraca",-15,70,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole,E.StringsUpBow,F.Bottom)],[82,new he("shaker",-23,54,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[122,new he("shaker",-24,54,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole,E.StringsUpBow,F.Bottom)],[84,new he("bellTree",-18,53,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[123,new he("bellTree",-19,53,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole,E.StringsUpBow,F.Bottom)],[83,new he("jingleBell",-20,53,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[124,new he("unpitched",-21,62,E.NoteheadNull,E.NoteheadNull,E.NoteheadNull,E.GuitarGolpe,F.Top)],[125,new he("unpitched",-22,62,E.NoteheadNull,E.NoteheadNull,E.NoteheadNull,E.GuitarGolpe,F.Bottom)],[39,new he("handClap",3,39,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[40,new he("snare",3,40,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[31,new he("snare",3,40,E.NoteheadSlashedBlack2,E.NoteheadSlashedBlack2,E.NoteheadSlashedBlack2)],[41,new he("tom",5,41,E.NoteheadBlack,E.NoteheadHalf,E.NoteheadWhole)],[59,new he("ride",2,59,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack,E.PictEdgeOfCymbal,F.Bottom)],[126,new he("ride",2,59,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[127,new he("ride",2,59,E.NoteheadDiamondWhite,E.NoteheadDiamondWhite,E.NoteheadDiamondWhite)],[29,new he("ride",2,59,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack,E.ArticStaccatoAbove,F.Top)],[30,new he("crash",-3,49,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[33,new he("snare",3,37,E.NoteheadXBlack,E.NoteheadXBlack,E.NoteheadXBlack)],[34,new he("snare",3,38,E.NoteheadBlack,E.NoteheadBlack,E.NoteheadBlack)]]),le.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"}(L||(L={}));class de{constructor(){this.tieDestinationNoteId=-1,this.tieOriginNoteId=-1,this.slurDestinationNoteId=-1,this.slurOriginNoteId=-1,this.hammerPullDestinationNoteId=-1,this.hammerPullOriginNoteId=-1}}class ce{constructor(){this.id=ce.GlobalNoteId++,this.index=0,this.accentuated=a.None,this.bendType=c.None,this.bendStyle=d.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=b.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=w.None,this.slideOutType=_.None,this.slideTarget=null,this.slideOrigin=null,this.vibrato=B.None,this.tieOrigin=null,this.tieDestination=null,this.isTieDestination=!1,this.leftHandFinger=y.Unknown,this.rightHandFinger=y.Unknown,this.isFingering=!1,this.trillValue=-1,this.trillSpeed=g.ThirtySecond,this.durationPercent=1,this.accidentalMode=S.Default,this.dynamics=f.F,this.isEffectSlurOrigin=!1,this.hasEffectSlur=!1,this.effectSlurOrigin=null,this.effectSlurDestination=null,this.ornament=L.None,this._noteIdBag=null}get hasBend(){return null!==this.bendPoints&&this.bendType!==c.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?le.getElementAndVariation(this)[0]:-1}get variation(){return this.isPercussion?le.getElementAndVariation(this)[1]:-1}get isHammerPullDestination(){return!!this.hammerPullOrigin}get isSlurOrigin(){return!!this.slurDestination}get isHarmonic(){return this.harmonicType!==b.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+ce.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===b.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===b.None||!this.isStringed)return 0;let e=this.harmonicValue;return ne.isAlmostEqualTo(e,2.4)?36:ne.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!==b.Natural&&this.harmonicType!==b.None&&(e-=this.harmonicPitch),this.beat.ottava){case o._15ma:e-=24;break;case o._8va:e-=12;break;case o.Regular:break;case o._8vb:e+=12;break;case o._15mb:e+=24}switch(this.beat.voice.bar.clefOttava){case o._15ma:e-=24;break;case o._8va:e-=12;break;case o.Regular:break;case o._8vb:e+=12;break;case o._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===c.None&&(this.bendType=c.Custom)}finish(t,i=null){let s=new te((()=>ce.nextNoteOnSameLine(this))),a=t&&t.notation.notationMode===e.NotationMode.SongBook;if(this.isTieDestination&&(this.chain(i),a&&this.tieOrigin&&this.tieOrigin.isLetRing&&(this.isLetRing=!0)),this.isLetRing&&(s.value&&s.value.isLetRing?this.letRingDestination=s.value:this.letRingDestination=this,a&&this.isTieDestination&&!this.tieOrigin.hasBend&&(this.isVisible=!1)),this.isPalmMute&&(s.value&&s.value.isPalmMute?this.palmMuteDestination=s.value:this.palmMuteDestination=this),this.isHammerPullOrigin){let e=ce.findHammerPullDestination(this);e?(this.hammerPullDestination=e,e.hammerPullOrigin=this):this.isHammerPullOrigin=!1}switch(this.slideOutType){case _.Shift:case _.Legato:this.slideTarget=s.value,this.slideTarget?this.slideTarget.slideOrigin=this:this.slideOutType=_.None}let r=null;this.isHammerPullOrigin&&this.hammerPullDestination?r=this.hammerPullDestination:this.slideOutType===_.Legato&&this.slideTarget&&(r=this.slideTarget),r&&(this.hasEffectSlur=!0,this.effectSlurOrigin&&this.beat.pickStroke===P.None?(this.effectSlurOrigin.effectSlurDestination=r,this.effectSlurOrigin.effectSlurDestination.effectSlurOrigin=this.effectSlurOrigin,this.effectSlurOrigin=null):(this.isEffectSlurOrigin=!0,this.effectSlurDestination=r,this.effectSlurDestination.effectSlurOrigin=this));const n=this.bendPoints;if(null!=n&&n.length>0&&this.bendType===c.Custom){let e=this.isTieDestination&&this.tieOrigin.hasBend;if(this.isContinuedBend=e,4===n.length){let t=n[0],i=n[1],s=n[2],a=n[3];i.value===s.value?a.value>t.value?i.value>a.value?this.bendType=c.BendRelease:!e&&t.value>0?(this.bendType=c.PrebendBend,n.splice(2,1),n.splice(1,1)):(this.bendType=c.Bend,n.splice(2,1),n.splice(1,1)):a.value<t.value?e?(this.bendType=c.Release,n.splice(2,1),n.splice(1,1)):(this.bendType=c.PrebendRelease,n.splice(2,1),n.splice(1,1)):i.value>t.value?this.bendType=c.BendRelease:t.value>0&&!e?(this.bendType=c.Prebend,n.splice(2,1),n.splice(1,1)):(this.bendType=c.Hold,n.splice(2,1),n.splice(1,1)):se.warning("Model","Unsupported bend type detected, fallback to custom",null)}else if(2===n.length){let t=n[0],i=n[1];i.value>t.value?!e&&t.value>0?this.bendType=c.PrebendBend:this.bendType=c.Bend:i.value<t.value?this.bendType=e?c.Release:c.PrebendRelease:t.value>0&&!e?this.bendType=c.Prebend:this.bendType=c.Hold}}else null!==n&&0!==n.length||(this.bendType=c.None);this.initialBendValue>0&&(this.accidentalMode=S.Default)}static nextNoteOnSameLine(e){let t=e.beat.nextBeat;for(;t&&t.voice.bar.index<=e.beat.voice.bar.index+ce.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+ce.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-ce.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(ce.NoteIdLookupKey)?t=e.get(ce.NoteIdLookupKey):(t=new Map,e.set(ce.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??ce.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 de),this._noteIdBag.tieDestinationNoteId=t,!0;case"tieoriginnoteid":return null==this._noteIdBag&&(this._noteIdBag=new de),this._noteIdBag.tieOriginNoteId=t,!0;case"slurdestinationnoteid":return null==this._noteIdBag&&(this._noteIdBag=new de),this._noteIdBag.slurDestinationNoteId=t,!0;case"sluroriginnoteid":return null==this._noteIdBag&&(this._noteIdBag=new de),this._noteIdBag.slurOriginNoteId=t,!0;case"hammerpulloriginnoteid":return null==this._noteIdBag&&(this._noteIdBag=new de),this._noteIdBag.hammerPullOriginNoteId=t,!0;case"hammerpulldestinationnoteid":return null==this._noteIdBag&&(this._noteIdBag=new de),this._noteIdBag.hammerPullDestinationNoteId=t,!0}return!1}}ce.GlobalNoteId=0,ce.MaxOffsetForSameLineSearch=3,ce.NoteIdLookupKey="NoteIdLookup";class ue{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!==m.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 ue.AllTicks)if(this.totalDuration===t*e){this.isFull=!0;break}}return!0}}ue.HalfTicks=1920,ue.QuarterTicks=960,ue.EighthTicks=480,ue.SixteenthTicks=240,ue.ThirtySecondTicks=120,ue.SixtyFourthTicks=60,ue.OneHundredTwentyEighthTicks=30,ue.TwoHundredFiftySixthTicks=15,ue.AllTicks=[ue.HalfTicks,ue.QuarterTicks,ue.EighthTicks,ue.SixteenthTicks,ue.ThirtySecondTicks,ue.SixtyFourthTicks,ue.OneHundredTwentyEighthTicks,ue.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"}(M||(M={}));class pe{static clone(e){const t=new Z;return t.offset=e.offset,t.value=e.value,t}}class ge{static clone(e){const t=new ce;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(pe.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 fe{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 me{static clone(e){const t=new be;t.index=e.index,t.notes=[];for(const i of e.notes)t.addNote(ge.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.auto