alphatab-pd
Version:
alphaTab is a music notation and guitar tablature rendering library
17 lines (16 loc) • 697 kB
JavaScript
/**
* alphaTab v1.0.21 (develop, build 0)
*
* Copyright © 2024, Daniel Kuschny and Contributors, All rights reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* SoundFont loading and Audio Synthesis based on TinySoundFont (licensed under MIT)
* Copyright (C) 2017, 2018 Bernhard Schelling (https://github.com/schellingb/TinySoundFont)
*
* TinySoundFont is based on SFZero (licensed under MIT)
* Copyright (C) 2012 Steve Folta (https://github.com/stevefolta/SFZero)
*/
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,v,x,N,P,E,C,F,L,M,D,I,R,A,O,G,V,H,W,z,U,X,Y,q,J,j,Q,$,K,Z,ee,te,ie,se,ae,re,ne,oe,he,le,de,ce,ue;!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 pe{static getValue(e){return pe._values||(pe._values=new Map),e=e.toLowerCase().replaceAll(" ",""),pe._values.has(e)?pe._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}}pe._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 ge{init(e,t){this.data=e,this.settings=t}}!function(e){e[e.General=0]="General",e[e.Format=1]="Format",e[e.AlphaTex=2]="AlphaTex"}(i||(i={}));class fe extends Error{constructor(e,t="",i){super(null!=t?t:""),this.type=e,this.inner=null!=i?i:null,Object.setPrototypeOf(this,fe.prototype)}}class me extends fe{constructor(e=null,t=null){super(i.Format,null!=e?e:"Unsupported format"),this.inner=t,Object.setPrototypeOf(this,me.prototype)}}!function(e){e[e.None=0]="None",e[e.Normal=1]="Normal",e[e.Heavy=2]="Heavy"}(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 ye{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 ye;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 ye;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={}));class be{constructor(){this.id=be._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}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)}}calculateDuration(){let e=0;for(let t of this.voices){let i=t.calculateDuration();i>e&&(e=i)}return e}}be._globalBarId=0;class Se{static ticksToMillis(e,t){return e*(6e4/(t*Se.QuarterTime))|0}static millisToTicks(e,t){return e/(6e4/(t*Se.QuarterTime))|0}static toTicks(e){return Se.valueToTicks(e)}static valueToTicks(e){let t=e;return t<0&&(t=1/-t),Se.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 Se.MinVelocity+e*Se.VelocityIncrement}}Se.QuarterTime=960,Se.MinVelocity=15,Se.VelocityIncrement=16;class _e{constructor(e=0,t=0){this.offset=e,this.value=t}}_e.MaxPosition=60,_e.MaxValue=12,function(e){e[e.Default=0]="Default",e[e.Gradual=1]="Gradual",e[e.Fast=2]="Fast"}(h||(h={})),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"}(l||(l={})),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"}(d||(d={})),function(e){e[e.None=0]="None",e[e.Crescendo=1]="Crescendo",e[e.Decrescendo=2]="Decrescendo"}(c||(c={})),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"}(u||(u={})),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"}(p||(p={})),function(e){e[e.None=0]="None",e[e.OnBeat=1]="OnBeat",e[e.BeforeBeat=2]="BeforeBeat",e[e.BendGrace=3]="BendGrace"}(g||(g={})),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"}(f||(f={})),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"}(m||(m={})),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"}(y||(y={})),function(e){e[e.None=0]="None",e[e.IntoFromBelow=1]="IntoFromBelow",e[e.IntoFromAbove=2]="IntoFromAbove"}(b||(b={})),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"}(S||(S={})),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"}(w||(w={})),function(e){e[e.ScoreDefault=0]="ScoreDefault",e[e.ScoreForcePiano=1]="ScoreForcePiano",e[e.SingleNoteEffectBand=2]="SingleNoteEffectBand",e[e.SingleNoteEffectBandForcePiano=3]="SingleNoteEffectBandForcePiano"}(B||(B={})),function(e){e[e.GuitarPro=0]="GuitarPro",e[e.SongBook=1]="SongBook"}(T||(T={})),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"}(k||(k={}));class we{constructor(){this.notationMode=T.GuitarPro,this.fingeringMode=B.ScoreDefault,this.elements=new Map,this.rhythmMode=w.Hidden,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):!we.defaultElements.has(e)||we.defaultElements.get(e)}}we.defaultElements=new Map([[k.ZerosOnDiveWhammys,!1]]);class Be{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"}(v||(v={}));class Te{static format(e,t){return`[AlphaTab][${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=v.Info;class ke{static shouldLog(e){return ke.logLevel!==v.None&&e>=ke.logLevel}static debug(e,t,...i){ke.shouldLog(v.Debug)&&ke.log.debug(e,t,...i)}static warning(e,t,...i){ke.shouldLog(v.Warning)&&ke.log.warning(e,t,...i)}static info(e,t,...i){ke.shouldLog(v.Info)&&ke.log.info(e,t,...i)}static error(e,t,...i){ke.shouldLog(v.Error)&&ke.log.error(e,t,...i)}}ke.logLevel=v.Info,ke.log=new Te;class ve{constructor(){this.note=null,this.noteValue=0,this.octave=0}get realValue(){return 12*this.octave+this.noteValue}}class xe{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===B.ScoreForcePiano||e.notation.fingeringMode===B.SingleNoteEffectBandForcePiano||pe.isPiano(t.voice.bar.staff.track.playbackInfo.program))switch(i){case f.Unknown:case f.NoOrDead:return null;case f.Thumb:return"1";case f.IndexFinger:return"2";case f.MiddleFinger:return"3";case f.AnnularFinger:return"4";case f.LittleFinger:return"5";default:return null}if(s)switch(i){case f.Unknown:case f.NoOrDead:return"0";case f.Thumb:return"T";case f.IndexFinger:return"1";case f.MiddleFinger:return"2";case f.AnnularFinger:return"3";case f.LittleFinger:return"4";default:return null}switch(i){case f.Unknown:case f.NoOrDead:return null;case f.Thumb:return"p";case f.IndexFinger:return"i";case f.MiddleFinger:return"m";case f.AnnularFinger:return"a";case f.LittleFinger:return"c";default:return null}}static isTuning(e){return!!xe.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 ve;return s.octave=parseInt(i)+1,s.note=t.toLowerCase(),s.noteValue=xe.getToneForText(s.note),s}static getTuningForText(e){let t=xe.parseTuning(e);return t?t.realValue:-1}static getToneForText(e){switch(e.toLowerCase()){case"c":default:return 0;case"c#":case"db":return 1;case"d":return 2;case"d#":case"eb":return 3;case"e":return 4;case"f":return 5;case"f#":case"gb":return 6;case"g":return 7;case"g#":case"ab":return 8;case"a":return 9;case"a#":case"bb":return 10;case"b":return 11}}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}}!function(e){e[e.None=0]="None",e[e.Up=1]="Up",e[e.Down=2]="Down"}(x||(x={})),function(e){e[e.None=-1]="None",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.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.ArticStaccatoAbove=58530]="ArticStaccatoAbove",e[e.ArticMarcatoAbove=58540]="ArticMarcatoAbove",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.StringsDownBow=58896]="StringsDownBow",e[e.StringsUpBow=58898]="StringsUpBow",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.GuitarGolpe=59458]="GuitarGolpe",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"}(N||(N={})),function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"}(P||(P={})),function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle",e[e.Bottom=2]="Bottom"}(E||(E={}));class Ne{constructor(e="",t=0,i=0,s=N.None,a=N.None,r=N.None,n=N.None,o=E.Middle){this.elementType=e,this.outputMidiNumber=i,this.staffLine=t,this.noteHeadDefault=s,this.noteHeadHalf=a!==N.None?a:s,this.noteHeadWhole=r!==N.None?r:s,this.techniqueSymbol=n,this.techniqueSymbolPlacement=o}getSymbol(e){switch(e){case u.Whole:return this.noteHeadWhole;case u.Half:return this.noteHeadHalf;default:return this.noteHeadDefault}}}class Pe{static articulationFromElementVariation(e,t){return e<Pe.gp6ElementAndVariationToArticulation.length?(t>=Pe.gp6ElementAndVariationToArticulation.length&&(t=0),Pe.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]:Pe.getArticulationByValue(t)}static getElementAndVariation(e){const t=Pe.getArticulation(e);if(!t)return[-1,-1];for(let e=0;e<Pe.gp6ElementAndVariationToArticulation.length;e++){const i=Pe.gp6ElementAndVariationToArticulation[e];for(let s=0;s<i.length;s++){const a=Pe.getArticulationByValue(i[s]);if((null==a?void 0:a.outputMidiNumber)===t.outputMidiNumber)return[e,s]}}return[-1,-1]}static getArticulationByValue(e){return Pe.instrumentArticulations.has(e)?Pe.instrumentArticulations.get(e):null}}Pe.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]],Pe.instrumentArticulations=new Map([[38,new Ne("snare",3,38,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[37,new Ne("snare",3,37,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[91,new Ne("snare",3,38,N.NoteheadDiamondWhite,N.NoteheadDiamondWhite,N.NoteheadDiamondWhite)],[42,new Ne("hiHat",-1,42,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[92,new Ne("hiHat",-1,46,N.NoteheadCircleSlash,N.NoteheadCircleSlash,N.NoteheadCircleSlash)],[46,new Ne("hiHat",-1,46,N.NoteheadCircleX,N.NoteheadCircleX,N.NoteheadCircleX)],[44,new Ne("hiHat",9,44,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[35,new Ne("kickDrum",8,35,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[36,new Ne("kickDrum",7,36,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[50,new Ne("tom",1,50,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[48,new Ne("tom",2,48,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[47,new Ne("tom",4,47,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[45,new Ne("tom",5,45,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[43,new Ne("tom",6,43,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[93,new Ne("ride",0,51,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack,N.PictEdgeOfCymbal,E.Bottom)],[51,new Ne("ride",0,51,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[53,new Ne("ride",0,53,N.NoteheadDiamondWhite,N.NoteheadDiamondWhite,N.NoteheadDiamondWhite)],[94,new Ne("ride",0,51,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack,N.ArticStaccatoAbove,E.Top)],[55,new Ne("splash",-2,55,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[95,new Ne("splash",-2,55,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack,N.ArticStaccatoAbove,E.Bottom)],[52,new Ne("china",-3,52,N.NoteheadHeavyXHat,N.NoteheadHeavyXHat,N.NoteheadHeavyXHat)],[96,new Ne("china",-3,52,N.NoteheadHeavyXHat,N.NoteheadHeavyXHat,N.NoteheadHeavyXHat)],[49,new Ne("crash",-2,49,N.NoteheadHeavyX,N.NoteheadHeavyX,N.NoteheadHeavyX)],[97,new Ne("crash",-2,49,N.NoteheadHeavyX,N.NoteheadHeavyX,N.NoteheadHeavyX,N.ArticStaccatoAbove,E.Bottom)],[57,new Ne("crash",-1,57,N.NoteheadHeavyX,N.NoteheadHeavyX,N.NoteheadHeavyX)],[98,new Ne("crash",-1,57,N.NoteheadHeavyX,N.NoteheadHeavyX,N.NoteheadHeavyX,N.ArticStaccatoAbove,E.Bottom)],[99,new Ne("cowbell",1,56,N.NoteheadTriangleUpBlack,N.NoteheadTriangleUpHalf,N.NoteheadTriangleUpWhole)],[100,new Ne("cowbell",1,56,N.NoteheadXBlack,N.NoteheadXHalf,N.NoteheadXWhole)],[56,new Ne("cowbell",0,56,N.NoteheadTriangleUpBlack,N.NoteheadTriangleUpHalf,N.NoteheadTriangleUpWhole)],[101,new Ne("cowbell",0,56,N.NoteheadXBlack,N.NoteheadXHalf,N.NoteheadXWhole)],[102,new Ne("cowbell",-1,56,N.NoteheadTriangleUpBlack,N.NoteheadTriangleUpHalf,N.NoteheadTriangleUpWhole)],[103,new Ne("cowbell",-1,56,N.NoteheadXBlack,N.NoteheadXHalf,N.NoteheadXWhole)],[77,new Ne("woodblock",-9,77,N.NoteheadTriangleUpBlack,N.NoteheadTriangleUpBlack,N.NoteheadTriangleUpBlack)],[76,new Ne("woodblock",-10,76,N.NoteheadTriangleUpBlack,N.NoteheadTriangleUpBlack,N.NoteheadTriangleUpBlack)],[60,new Ne("bongo",-4,60,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[104,new Ne("bongo",-5,60,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole,N.NoteheadParenthesis,E.Middle)],[105,new Ne("bongo",-6,60,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[61,new Ne("bongo",-7,61,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[106,new Ne("bongo",-8,61,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole,N.NoteheadParenthesis,E.Middle)],[107,new Ne("bongo",-16,61,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[66,new Ne("timbale",10,66,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[65,new Ne("timbale",9,65,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[68,new Ne("agogo",12,68,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[67,new Ne("agogo",11,67,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[64,new Ne("conga",17,64,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[108,new Ne("conga",16,64,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[109,new Ne("conga",15,64,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole,N.NoteheadParenthesis,E.Middle)],[63,new Ne("conga",14,63,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[110,new Ne("conga",13,63,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[62,new Ne("conga",19,62,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole,N.NoteheadParenthesis,E.Middle)],[72,new Ne("whistle",-11,72,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[71,new Ne("whistle",-17,71,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[73,new Ne("guiro",38,73,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[74,new Ne("guiro",37,74,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[86,new Ne("surdo",36,86,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[87,new Ne("surdo",35,87,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadParenthesis,E.Middle)],[54,new Ne("tambourine",3,54,N.NoteheadTriangleUpBlack,N.NoteheadTriangleUpBlack,N.NoteheadTriangleUpBlack)],[111,new Ne("tambourine",2,54,N.NoteheadTriangleUpBlack,N.NoteheadTriangleUpBlack,N.NoteheadTriangleUpBlack,N.StringsUpBow,E.Bottom)],[112,new Ne("tambourine",1,54,N.NoteheadTriangleUpBlack,N.NoteheadTriangleUpBlack,N.NoteheadTriangleUpBlack,N.StringsDownBow,E.Bottom)],[113,new Ne("tambourine",-7,54,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[79,new Ne("cuica",30,79,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[78,new Ne("cuica",29,78,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[58,new Ne("vibraslap",28,58,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[81,new Ne("triangle",27,81,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[80,new Ne("triangle",26,80,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadParenthesis,E.Middle)],[114,new Ne("grancassa",25,43,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[115,new Ne("piatti",18,49,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[116,new Ne("piatti",24,49,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[69,new Ne("cabasa",23,69,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[117,new Ne("cabasa",22,69,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole,N.StringsUpBow,E.Bottom)],[85,new Ne("castanets",21,85,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[75,new Ne("claves",20,75,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[70,new Ne("maraca",-12,70,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[118,new Ne("maraca",-13,70,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole,N.StringsUpBow,E.Bottom)],[119,new Ne("maraca",-14,70,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[120,new Ne("maraca",-15,70,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole,N.StringsUpBow,E.Bottom)],[82,new Ne("shaker",-23,54,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[122,new Ne("shaker",-24,54,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole,N.StringsUpBow,E.Bottom)],[84,new Ne("bellTree",-18,53,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[123,new Ne("bellTree",-19,53,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole,N.StringsUpBow,E.Bottom)],[83,new Ne("jingleBell",-20,53,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[124,new Ne("unpitched",-21,62,N.NoteheadNull,N.NoteheadNull,N.NoteheadNull,N.GuitarGolpe,E.Top)],[125,new Ne("unpitched",-22,62,N.NoteheadNull,N.NoteheadNull,N.NoteheadNull,N.GuitarGolpe,E.Bottom)],[39,new Ne("handClap",3,39,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[40,new Ne("snare",3,40,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[31,new Ne("snare",3,40,N.NoteheadSlashedBlack2,N.NoteheadSlashedBlack2,N.NoteheadSlashedBlack2)],[41,new Ne("tom",5,41,N.NoteheadBlack,N.NoteheadHalf,N.NoteheadWhole)],[59,new Ne("ride",2,59,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack,N.PictEdgeOfCymbal,E.Bottom)],[126,new Ne("ride",2,59,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[127,new Ne("ride",2,59,N.NoteheadDiamondWhite,N.NoteheadDiamondWhite,N.NoteheadDiamondWhite)],[29,new Ne("ride",2,59,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack,N.ArticStaccatoAbove,E.Top)],[30,new Ne("crash",-3,49,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[33,new Ne("snare",3,37,N.NoteheadXBlack,N.NoteheadXBlack,N.NoteheadXBlack)],[34,new Ne("snare",3,38,N.NoteheadBlack,N.NoteheadBlack,N.NoteheadBlack)]]);class Ee{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=s.None,this.bendType=l.None,this.bendStyle=h.Default,this.bendOrigin=null,this.isContinuedBend=!1,this.bendPoints=null,this.maxBendPoint=null,this.fret=-1,this.string=-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=m.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=b.None,this.slideOutType=S.None,this.slideTarget=null,this.slideOrigin=null,this.vibrato=_.None,this.tieOrigin=null,this.tieDestination=null,this.isTieDestination=!1,this.leftHandFinger=f.Unknown,this.rightHandFinger=f.Unknown,this.isFingering=!1,this.trillValue=-1,this.trillSpeed=u.ThirtySecond,this.durationPercent=1,this.accidentalMode=y.Default,this.dynamics=p.F,this.isEffectSlurOrigin=!1,this.hasEffectSlur=!1,this.effectSlurOrigin=null,this.effectSlurDestination=null,this._noteIdBag=null}get hasBend(){return null!==this.bendPoints&&this.bendType!==l.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?Pe.getElementAndVariation(this)[0]:-1}get variation(){return this.isPercussion?Pe.getElementAndVariation(this)[1]:-1}get isHammerPullDestination(){return!!this.hammerPullOrigin}get isSlurOrigin(){return!!this.slurDestination}get isHarmonic(){return this.harmonicType!==m.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(){let e=this.realValueWithoutHarmonic;return this.isStringed&&(this.harmonicType===m.Natural?e=this.harmonicPitch+this.stringTuning-this.beat.voice.bar.staff.transpositionPitch:e+=this.harmonicPitch),e}get realValueWithoutHarmonic(){return this.isPercussion?this.percussionArticulation:this.isStringed?this.fret+this.stringTuning-this.beat.voice.bar.staff.transpositionPitch:this.isPiano?12*this.octave+this.tone-this.beat.voice.bar.staff.transpositionPitch:0}get harmonicPitch(){if(this.harmonicType===m.None||!this.isStringed)return 0;let e=this.harmonicValue;return xe.isAlmostEqualTo(e,2.4)?36:xe.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!==m.Natural&&this.harmonicType!==m.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===l.None&&(this.bendType=l.Custom)}finish(e,t=null){let i=new Be((()=>Ce.nextNoteOnSameLine(this))),s=e&&e.notation.notationMode===T.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=Ce.findHammerPullDestination(this);e?(this.hammerPullDestination=e,e.hammerPullOrigin=this):this.isHammerPullOrigin=!1}switch(this.slideOutType){case S.Shift:case S.Legato:this.slideTarget=i.value,this.slideTarget?this.slideTarget.slideOrigin=this:this.slideOutType=S.None}let a=null;this.isHammerPullOrigin&&this.hammerPullDestination?a=this.hammerPullDestination:this.slideOutType===S.Legato&&this.slideTarget&&(a=this.slideTarget),a&&(this.hasEffectSlur=!0,this.effectSlurOrigin&&this.beat.pickStroke===x.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===l.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=l.BendRelease:!e&&t.value>0?(this.bendType=l.PrebendBend,r.splice(2,1),r.splice(1,1)):(this.bendType=l.Bend,r.splice(2,1),r.splice(1,1)):a.value<t.value?e?(this.bendType=l.Release,r.splice(2,1),r.splice(1,1)):(this.bendType=l.PrebendRelease,r.splice(2,1),r.splice(1,1)):i.value>t.value?this.bendType=l.BendRelease:t.value>0&&!e?(this.bendType=l.Prebend,r.splice(2,1),r.splice(1,1)):(this.bendType=l.Hold,r.splice(2,1),r.splice(1,1)):ke.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=l.PrebendBend:this.bendType=l.Bend:i.value<t.value?this.bendType=e?l.Release:l.PrebendRelease:this.bendType=l.Hold}}else null!==r&&0!==r.length||(this.bendType=l.None);this.initialBendValue>0&&(this.accidentalMode=y.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=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 Ee),this._noteIdBag.tieDestinationNoteId=t,!0;case"tieoriginnoteid":return null==this._noteIdBag&&(this._noteIdBag=new Ee),this._noteIdBag.tieOriginNoteId=t,!0;case"slurdestinationnoteid":return null==this._noteIdBag&&(this._noteIdBag=new Ee),this._noteIdBag.slurDestinationNoteId=t,!0;case"sluroriginnoteid":return null==this._noteIdBag&&(this._noteIdBag=new Ee),this._noteIdBag.slurOriginNoteId=t,!0;case"hammerpulloriginnoteid":return null==this._noteIdBag&&(this._noteIdBag=new Ee),this._noteIdBag.hammerPullOriginNoteId=t,!0;case"hammerpulldestinationnoteid":return null==this._noteIdBag&&(this._noteIdBag=new Ee),this._noteIdBag.hammerPullDestinationNoteId=t,!0}return!1}}Ce.GlobalNoteId=0,Ce.MaxOffsetForSameLineSearch=3,Ce.NoteIdLookupKey="NoteIdLookup";class Fe{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!==g.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 Fe.AllTicks)if(this.totalDuration===t*e){this.isFull=!0;break}}return!0}}Fe.HalfTicks=1920,Fe.QuarterTicks=960,Fe.EighthTicks=480,Fe.SixteenthTicks=240,Fe.ThirtySecondTicks=120,Fe.SixtyFourthTicks=60,Fe.OneHundredTwentyEighthTicks=30,Fe.TwoHundredFiftySixthTicks=15,Fe.AllTicks=[Fe.HalfTicks,Fe.QuarterTicks,Fe.EighthTicks,Fe.SixteenthTicks,Fe.ThirtySecondTicks,Fe.SixtyFourthTicks,Fe.OneHundredTwentyEighthTicks,Fe.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"}(C||(C={}));class Le{static clone(e){const t=new _e;return t.offset=e.offset,t.value=e.value,t}}class Me{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(Le.clone(i))}return t.fret=e.fret,t.string=e.string,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}}class De{static clone(e){const t=new ye;return t.isLinear=e.isLinear,t.type=e.type,t.value=e.value,t.ratioPosition=e.ratioPosition,t.text=e.text,t}}class Ie{static clone(e){const t=new Ae;t.index=e.index,t.notes=[];for(const i of e.notes)t.addNote(Me.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(De.clone(i));if(t.dots=e.dots,t.fadeIn=e.fadeIn,t.lyrics=e.lyrics?e.lyrics.slice():null,t.hasRasgueado=e.hasRasgueado,t.pop=e.pop,t.slap=e.slap,t.tap=e.tap,t.text=e.text,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(Le.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.displayStart=e.displayStart,t.playbackStart=e.playbackStart,t.displayDuration=e.displayDuration,t.playbackDuration=e.playbackDuration,t.dynamics=e.dynamics,t.invertBeamDirection=e.invertBeamDirection,t.preferredBeamDirection=e.preferredBeamDirection,t.isEffectSlurOrigin=e.isEffectSlurOrigin,t.beamingMode=e.beamingMode,t}}class Re{constructor(){this.beats=[],this.id="empty",this.isComplete=!1}addBeat(e){e.graceIndex=this.beats.length,e.graceGroup=this,this.beats.push(e)}finish(){this.beats.length>0&&(this.id=this.beats[0].absoluteDisplayStart+"_"+this.beats[0].voice.index)}}!function(e){e[e.Auto=0]="Auto",e[e.ForceSplitToNext=1]="ForceSplitToNext",e[e.ForceMergeWithNext=2]="ForceMergeWithNext"}(F||(F={}));class Ae{constructor(){this.id=Ae._globalBeatId++,this.index=0,this.previousBeat=null,this.nextBeat=null,this.notes=[],this.noteStringLookup=new Map,this.noteValueLookup=new Map,this.isEmpty=!1,this.whammyStyle=h.Default,this.ottava=n.Regular,this.fermata=null,this.isLegatoOrigin=!1,this.minNote=null,this.maxNote=null,this.maxStringNote=null,this.minStringNote=null,this.duration=u.Quarter,this.isLetRing=!1,this.isPalmMute=!1,this.automations=[],this.dots=0,this.fadeIn=!1,this.lyrics=null,this.hasRasgueado=!1,this.pop=!1,this.slap=!1,this.tap=!1,this.text=null,this.brushType=d.None,this.brushDuration=0,this.tupletDenominator=-1,this.tupletNumerator=-1,this.tupletGroup=null,this.isContinuedWhammy=!1,this.whammyBarType=C.None,this.whammyBarPoints=null,this.maxWhammyPoint=null,this.minWhammyPoint=null,this.vibrato=_.None,this.chordId=null,this.graceType=g.None,this.graceGroup=null,this.graceIndex=-1,this.pickStroke=x.None,this.tremoloSpeed=null,this.crescendo=c.None,this.displayStart=0,this.playbackStart=0,this.displayDuration=0,this.playbackDuration=0,this.dynamics=p.F,this.invertBeamDirection=!1,this.preferredBeamDirection=null,this.isEffectSlurOrigin=!1,this.effectSlurOrigin=null,this.effectSlurDestination=null,this.beamingMode=F.Auto}get isLastOfVoice(){return this.index===this.voice.beats.length-1}get isLegatoDestination(){return!!this.previousBeat&&this.previousBeat.isLegatoOrigin}get isRest(){return this.isEmpty||0===this.notes.length}get isFullBarRest(){return this.isRest&&1===this.voice.beats.length&&this.duration===u.Whole}get hasTuplet(){return!(-1===this.tupletDenominator&&-1===this.tupletNumerator||1===this.tupletDenominator&&1===this.tupletNumerator)}get hasWhammyBar(){return null!==this.whammyBarPoints&&this.whammyBarType!==C.None}get hasChord(){return!!this.chordId}get chord(){return this.chordId?this.voice.bar.staff.getChord(this.chordId):null}get isTremolo(){return!!this.tremoloSpeed}get absoluteDisplayStart(){return this.voice.bar.masterBar.start+this.displayStart}get absolutePlaybackStart(){return this.voice.bar.masterBar.start+this.playbackStart}get isEffectSlurDestination(){return!!this.effectSlurOrigin}addWhammyBarPoint(e){let t=this.whammyBarPoints;null===t&&(t=[],this.whammyBarPoints=t),t.push(e),(!this.maxWhammyPoint||e.value>this.maxWhammyPoint.value)&&(this.maxWhammyPoint=e),(!this.minWhammyPoint||e.value<this.minWhammyPoint.value)&&(this.minWhammyPoint=e),this.whammyBarType===C.None&&(this.whammyBarType=C.Custom)}removeWhammyBarPoint(e){const t=this.whammyBarPoints;if(null===t||e<0||e>=t.length)return;t.splice(e,1);let i=t[e];if(i===this.maxWhammyPoint){this.maxWhammyPoint=null;for(let e of t)(!this.maxWhammyPoint||e.value>this.maxWhammyPoint.value)&&(this.maxWhammyPoint=e)}if(i===this.minWhammyPoint){this.minWhammyPoint=null;for(let e of t)(!this.minWhammyPoint||e.value<this.minWhammyPoint.value)&&(this.minWhammyPoint=e)}}addNote(e){e.beat=this,e.index=this.notes.length,this.notes.push(e),e.isStringed&&this.noteStringLookup.set(e.string,e)}removeNote(e){let t=this.notes.indexOf(e);t>=0&&(this.notes.splice(t,1),e.isStringed&&this.noteStringLookup.delete(e.string))}getAutomation(e){for(let t=0,i=this.automations.length;t<i;t++){let i=this.automations[t];if(i.type===e)return i}return null}getNoteOnString(e){return this.noteStringLookup.has(e)?this.noteStringLookup.get(e):null}calculateDuration(){if(this.isFullBarRest)return this.voice.bar.masterBar.calculateDuration();let e=Se.toTicks(this.duration);return 2===this.dots?e=Se.applyDot(e,!0):1===this.dots&&(e=Se.applyDot(e,!1)),this.tupletDenominator>0&&this.tupletNumerator>=0&&(e=Se.applyTuplet(e,this.tupletNumerator,this.tupletDenominator)),e}updateDurations(){let e=this.calculateDuration();switch(this.playbackDuration=e,this.graceType){case g.BeforeBeat:case g.OnBeat:switch(this.duration){case u.Sixteenth:this.playbackDuration=Se.toTicks(u.SixtyFourth);break;case u.ThirtySecond:this.playbackDuration=Se.toTicks(u.OneHundredTwentyEighth);break;default:this.playbackDuration=Se.toTicks(u.ThirtySecond)}this.displayDuration=0;break;case g.BendGrace:this.playbackDuration/=2,this.displayDuration=0;break;default:this.displayDuration=e;let t=this.previousBeat;t&&t.graceType===g.BendGrace&&(this.playbackDuration=t.playbackDur