@coderline/alphatab
Version:
alphaTab is a music notation and guitar tablature rendering library
51 lines • 1 MB
JavaScript
/*!
* alphaTab v1.6.3 (, build 22)
*
* Copyright © 2025, 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/.
*
* Integrated Libraries:
*
* Library: TinySoundFont
* License: MIT
* Copyright: Copyright (C) 2017, 2018 Bernhard Schelling
* URL: https://github.com/schellingb/TinySoundFont
* Purpose: SoundFont loading and Audio Synthesis
*
* Library: SFZero
* License: MIT
* Copyright: Copyright (C) 2012 Steve Folta ()
* URL: https://github.com/stevefolta/SFZero
* Purpose: TinySoundFont is based on SFZEro
*
* Library: Haxe Standard Library
* License: MIT
* Copyright: Copyright (C)2005-2025 Haxe Foundation
* URL: https://github.com/HaxeFoundation/haxe/tree/development/std
* Purpose: XML Parser & Zip Inflate Algorithm
*
* Library: SharpZipLib
* License: MIT
* Copyright: Copyright © 2000-2018 SharpZipLib Contributors
* URL: https://github.com/icsharpcode/SharpZipLib
* Purpose: Zip Deflate Algorithm for writing compressed Zips
*
* Library: NVorbis
* License: MIT
* Copyright: Copyright (c) 2020 Andrew Ward
* URL: https://github.com/NVorbis/NVorbis
* Purpose: Vorbis Stream Decoding
*
* Library: libvorbis
* License: BSD-3-Clause
* Copyright: Copyright (c) 2002-2020 Xiph.org Foundation
* URL: https://github.com/xiph/vorbis
* Purpose: NVorbis adopted some code from libvorbis.
*
* @preserve
* @license
*/
!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).alphaTab={})}(this,(function(e){"use strict";class t{constructor(e){this._targets=new Set,this._callback=e,window.addEventListener("resize",this.onWindowResize.bind(this),!1)}observe(e){this._targets.add(e)}unobserve(e){this._targets.delete(e)}disconnect(){this._targets.clear()}onWindowResize(){const e=[];for(const t of this._targets)e.push({target:t,contentRect:void 0,borderBoxSize:void 0,contentBoxSize:[],devicePixelContentBoxSize:[]});this._callback(e,this)}}class s{constructor(e){this._elements=[];let t=null;const s=this.check.bind(this);this.check=()=>{t||(t=setTimeout((()=>{s(),t=null}),100))},this._callback=e,window.addEventListener("resize",this.check,!0),document.addEventListener("scroll",this.check,!0)}observe(e){this._elements.indexOf(e)>=0||(this._elements.push(e),this.check())}unobserve(e){this._elements=this._elements.filter((t=>t!==e))}check(){const e=[];for(const t of this._elements){const s=t.getBoundingClientRect();s.top+s.height>=0&&s.top<=window.innerHeight&&s.left+s.width>=0&&s.left<=window.innerWidth&&e.push({target:t,isIntersecting:!0})}e.length&&this._callback(e,this)}}var i,a,n,r,o,h,l,c,d,u,p,m,g,f,y,b,S,_,w,T,k,B,N,x,P,v,F,C,E,D,M,L,A,I,R,O;void 0===Symbol.dispose&&(Symbol.dispose=Symbol("Symbol.dispose")),"undefined"!=typeof window&&("ResizeObserver"in globalThis||(globalThis.ResizeObserver=t),"IntersectionObserver"in globalThis||(globalThis.IntersectionObserver=s),"replaceChildren"in Element.prototype||(Element.prototype.replaceChildren=function(...e){this.innerHTML="",this.append(...e)},Document.prototype.replaceChildren=Element.prototype.replaceChildren,DocumentFragment.prototype.replaceChildren=Element.prototype.replaceChildren)),"replaceAll"in String.prototype||(String.prototype.replaceAll=function(e,t){return this.replace(new RegExp(e,"g"),t)}),e.LayoutMode=void 0,(i=e.LayoutMode||(e.LayoutMode={}))[i.Page=0]="Page",i[i.Horizontal=1]="Horizontal",e.StaveProfile=void 0,(a=e.StaveProfile||(e.StaveProfile={}))[a.Default=0]="Default",a[a.ScoreTab=1]="ScoreTab",a[a.Score=2]="Score",a[a.Tab=3]="Tab",a[a.TabMixed=4]="TabMixed";class H{static getValue(e){return H._values||(H._values=new Map),e=e.toLowerCase().replaceAll(" ",""),H._values.has(e)?H._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}}H._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]]),function(e){e[e.NoBrackets=0]="NoBrackets",e[e.GroupStaves=1]="GroupStaves",e[e.GroupSimilarInstruments=2]="GroupSimilarInstruments"}(n||(n={})),function(e){e[e.Hidden=0]="Hidden",e[e.FirstSystem=1]="FirstSystem",e[e.AllSystems=2]="AllSystems"}(r||(r={})),function(e){e[e.FullName=0]="FullName",e[e.ShortName=1]="ShortName"}(o||(o={})),function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical"}(h||(h={}));class W{constructor(){this.hideDynamics=!1,this.bracketExtendMode=n.GroupStaves,this.useSystemSignSeparator=!1,this.globalDisplayTuning=!0,this.perTrackDisplayTuning=null,this.globalDisplayChordDiagramsOnTop=!0,this.perTrackChordDiagramsOnTop=null,this.singleTrackTrackNamePolicy=r.FirstSystem,this.multiTrackTrackNamePolicy=r.FirstSystem,this.firstSystemTrackNameMode=o.ShortName,this.otherSystemsTrackNameMode=o.ShortName,this.firstSystemTrackNameOrientation=h.Vertical,this.otherSystemsTrackNameOrientation=h.Vertical,this.multiTrackMultiBarRest=!1,this.perTrackMultiBarRest=null}}class V{constructor(){this.masterBars=[],this.opening=null,this.closings=[],this.isClosed=!1}get openings(){const e=this.opening;return e?[e]:[]}get isOpened(){return!0===this.opening?.isRepeatStart}addMasterBar(e){null===this.opening&&(this.opening=e),this.masterBars.push(e),e.repeatGroup=this,e.isRepeatEnd&&(this.closings.push(e),this.isClosed=!0)}}class G{constructor(){this.colors=new Map}}!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"}(l||(l={})),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"}(c||(c={})),function(e){e[e.None=0]="None",e[e.Simple=1]="Simple",e[e.FirstOfDouble=2]="FirstOfDouble",e[e.SecondOfDouble=3]="SecondOfDouble"}(d||(d={})),function(e){e[e.Cb=-7]="Cb",e[e.Gb=-6]="Gb",e[e.Db=-5]="Db",e[e.Ab=-4]="Ab",e[e.Eb=-3]="Eb",e[e.Bb=-2]="Bb",e[e.F=-1]="F",e[e.C=0]="C",e[e.G=1]="G",e[e.D=2]="D",e[e.A=3]="A",e[e.E=4]="E",e[e.B=5]="B",e[e.FSharp=6]="FSharp",e[e.CSharp=7]="CSharp"}(u||(u={})),function(e){e[e.Major=0]="Major",e[e.Minor=1]="Minor"}(p||(p={})),function(e){e[e.Down=0]="Down",e[e.Hold=1]="Hold",e[e.Up=2]="Up"}(m||(m={}));class z{constructor(){this.ratioPosition=0,this.pedalType=m.Down,this.nextPedalMarker=null,this.previousPedalMarker=null}}!function(e){e[e.StandardNotationRepeats=0]="StandardNotationRepeats",e[e.GuitarTabsRepeats=1]="GuitarTabsRepeats",e[e.SlashRepeats=2]="SlashRepeats",e[e.NumberedRepeats=3]="NumberedRepeats",e[e.StandardNotationBarNumber=4]="StandardNotationBarNumber",e[e.GuitarTabsBarNumber=5]="GuitarTabsBarNumber",e[e.SlashBarNumber=6]="SlashBarNumber",e[e.NumberedBarNumber=7]="NumberedBarNumber",e[e.StandardNotationBarLines=8]="StandardNotationBarLines",e[e.GuitarTabsBarLines=9]="GuitarTabsBarLines",e[e.SlashBarLines=10]="SlashBarLines",e[e.NumberedBarLines=11]="NumberedBarLines",e[e.StandardNotationClef=12]="StandardNotationClef",e[e.GuitarTabsClef=13]="GuitarTabsClef",e[e.StandardNotationKeySignature=14]="StandardNotationKeySignature",e[e.NumberedKeySignature=15]="NumberedKeySignature",e[e.StandardNotationTimeSignature=16]="StandardNotationTimeSignature",e[e.GuitarTabsTimeSignature=17]="GuitarTabsTimeSignature",e[e.SlashTimeSignature=18]="SlashTimeSignature",e[e.NumberedTimeSignature=19]="NumberedTimeSignature",e[e.StandardNotationStaffLine=20]="StandardNotationStaffLine",e[e.GuitarTabsStaffLine=21]="GuitarTabsStaffLine",e[e.SlashStaffLine=22]="SlashStaffLine",e[e.NumberedStaffLine=23]="NumberedStaffLine"}(g||(g={}));class U extends G{}!function(e){e[e.Automatic=0]="Automatic",e[e.Dashed=1]="Dashed",e[e.Dotted=2]="Dotted",e[e.Heavy=3]="Heavy",e[e.HeavyHeavy=4]="HeavyHeavy",e[e.HeavyLight=5]="HeavyLight",e[e.LightHeavy=6]="LightHeavy",e[e.LightLight=7]="LightLight",e[e.None=8]="None",e[e.Regular=9]="Regular",e[e.Short=10]="Short",e[e.Tick=11]="Tick"}(f||(f={}));class X{constructor(){this.id=X._globalBarId++,this.index=0,this.nextBar=null,this.previousBar=null,this.clef=l.G2,this.clefOttava=c.Regular,this.voices=[],this.simileMark=d.None,this.isMultiVoice=!1,this.displayScale=1,this.displayWidth=-1,this.sustainPedals=[],this._isEmpty=!0,this._isRestOnly=!0,this.barLineLeft=f.Automatic,this.barLineRight=f.Automatic,this.keySignature=u.C,this.keySignatureType=p.Major}static resetIds(){X._globalBarId=0}get masterBar(){return this.staff.track.score.masterBars[this.index]}get isEmpty(){return this._isEmpty}get hasChanges(){if(0===this.index)return!0;return!(this.keySignature===this.previousBar.keySignature&&this.keySignatureType===this.previousBar.keySignatureType&&this.clef===this.previousBar.clef&&this.clefOttava===this.previousBar.clefOttava)||(this.simileMark!==d.None||this.sustainPedals.length>0||this.barLineLeft!==f.Automatic||this.barLineRight!==f.Automatic)}get isRestOnly(){return this._isRestOnly}getActualBarLineLeft(e){return X.actualBarLine(this,!1,e)}getActualBarLineRight(){return X.actualBarLine(this,!0,!1)}static automaticToActualType(e,t,s){let i;return i=t?e.isRepeatEnd?f.LightHeavy:e.nextMasterBar?e.isFreeTime?f.Dashed:e.isDoubleBar?f.LightLight:f.Regular:f.LightHeavy:e.isRepeatStart?f.HeavyLight:s?f.Regular:f.None,i}static actualBarLine(e,t,s){const i=e.masterBar,a=t?e.barLineRight:e.barLineLeft;let n;return n=a===f.Automatic?X.automaticToActualType(i,t,s):a,n}addVoice(e){e.bar=this,e.index=this.voices.length,this.voices.push(e)}finish(e,t=null){this.isMultiVoice=!1,this._isEmpty=!0,this._isRestOnly=!0;for(let s=0,i=this.voices.length;s<i;s++){const i=this.voices[s];i.finish(e,t),s>0&&!i.isEmpty&&(this.isMultiVoice=!0),i.isEmpty||(this._isEmpty=!1),i.isRestOnly||(this._isRestOnly=!1)}const s=this.sustainPedals;if(s.length>0){let e=null;this.sustainPedals=[],this.previousBar&&this.previousBar.sustainPedals.length>0&&(e=this.previousBar.sustainPedals[this.previousBar.sustainPedals.length-1]);const t=null!==e&&e.pedalType!==m.Up;for(const i of s){if(e&&e.pedalType!==m.Up){if(e.bar===this&&i.ratioPosition<=e.ratioPosition)continue;e.nextPedalMarker=i,i.previousPedalMarker=e}t&&i.pedalType===m.Down&&(i.pedalType=m.Hold),i.bar=this,this.sustainPedals.push(i),e=i}}else if(this.previousBar&&this.previousBar.sustainPedals.length>0){const e=this.previousBar.sustainPedals[this.previousBar.sustainPedals.length-1];if(e.pedalType!==m.Up){const t=new z;t.ratioPosition=0,t.bar=this,t.pedalType=m.Hold,this.sustainPedals.push(t),e.nextPedalMarker=t,t.previousPedalMarker=e}}}calculateDuration(){let e=0;for(const t of this.voices){const s=t.calculateDuration();s>e&&(e=s)}return e}}X._globalBarId=0,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",e[e.PPPP=8]="PPPP",e[e.PPPPP=9]="PPPPP",e[e.PPPPPP=10]="PPPPPP",e[e.FFFF=11]="FFFF",e[e.FFFFF=12]="FFFFF",e[e.FFFFFF=13]="FFFFFF",e[e.SF=14]="SF",e[e.SFP=15]="SFP",e[e.SFPP=16]="SFPP",e[e.FP=17]="FP",e[e.RF=18]="RF",e[e.RFZ=19]="RFZ",e[e.SFZ=20]="SFZ",e[e.SFFZ=21]="SFFZ",e[e.FZ=22]="FZ",e[e.N=23]="N",e[e.PF=24]="PF",e[e.SFZP=25]="SFZP"}(y||(y={}));class J{static ticksToMillis(e,t){return e*(6e4/(t*J.QuarterTime))|0}static millisToTicks(e,t){return e/(6e4/(t*J.QuarterTime))|0}static toTicks(e){return J.valueToTicks(e)}static valueToTicks(e){let t=e;return t<0&&(t=1/-t),J.QuarterTime*(4/t)|0}static applyDot(e,t){return t?e+3*(e/4|0):e+(e/2|0)}static applyTuplet(e,t,s){return e*s/t|0}static removeTuplet(e,t,s){return e*t/s|0}static dynamicToVelocity(e,t=0){let s=1;switch(e){case y.PPP:s=J.MinVelocity+0*J.VelocityIncrement;break;case y.PP:s=J.MinVelocity+1*J.VelocityIncrement;break;case y.P:s=J.MinVelocity+2*J.VelocityIncrement;break;case y.MP:s=J.MinVelocity+3*J.VelocityIncrement;break;case y.MF:s=J.MinVelocity+4*J.VelocityIncrement;break;case y.F:s=J.MinVelocity+5*J.VelocityIncrement;break;case y.FF:s=J.MinVelocity+6*J.VelocityIncrement;break;case y.FFF:s=J.MinVelocity+7*J.VelocityIncrement;break;case y.PPPP:s=10;break;case y.PPPPP:s=5;break;case y.PPPPPP:s=3;break;case y.FFFF:s=J.MinVelocity+8*J.VelocityIncrement;break;case y.FFFFF:s=J.MinVelocity+9*J.VelocityIncrement;break;case y.FFFFFF:s=J.MinVelocity+10*J.VelocityIncrement;break;case y.SF:case y.SFP:case y.SFZP:case y.SFPP:case y.SFZ:case y.FZ:s=J.MinVelocity+6*J.VelocityIncrement;break;case y.FP:case y.RF:case y.RFZ:case y.SFFZ:s=J.MinVelocity+5*J.VelocityIncrement;break;case y.N:s=1;break;case y.PF:s=J.MinVelocity+(4.5*J.VelocityIncrement|0)}return s+=t*J.VelocityIncrement,Math.min(Math.max(s,1),127)}}J.QuarterTime=960,J.MinVelocity=15,J.VelocityIncrement=16,function(e){e[e.Tempo=0]="Tempo",e[e.Volume=1]="Volume",e[e.Instrument=2]="Instrument",e[e.Balance=3]="Balance",e[e.SyncPoint=4]="SyncPoint"}(b||(b={}));class Y{constructor(){this.barOccurence=0,this.millisecondOffset=0}}class q{constructor(){this.isLinear=!1,this.type=b.Tempo,this.value=0,this.ratioPosition=0,this.text=""}static buildTempoAutomation(e,t,s,i){(i<1||i>5)&&(i=2);const a=new Float32Array([1,.5,1,1.5,2,3]),n=new q;return n.type=b.Tempo,n.isLinear=e,n.ratioPosition=t,n.value=s*a[i],n}static buildInstrumentAutomation(e,t,s){const i=new q;return i.type=b.Instrument,i.isLinear=e,i.ratioPosition=t,i.value=s,i}}class ${constructor(e=0,t=0){this.offset=e,this.value=t}}$.MaxPosition=60,$.MaxValue=12,function(e){e[e.Default=0]="Default",e[e.Gradual=1]="Gradual",e[e.Fast=2]="Fast"}(S||(S={})),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"}(_||(_={})),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"}(w||(w={})),function(e){e[e.None=0]="None",e[e.Crescendo=1]="Crescendo",e[e.Decrescendo=2]="Decrescendo"}(T||(T={})),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"}(k||(k={})),function(e){e[e.None=0]="None",e[e.OnBeat=1]="OnBeat",e[e.BeforeBeat=2]="BeforeBeat",e[e.BendGrace=3]="BendGrace"}(B||(B={})),function(e){e[e.None=0]="None",e[e.Normal=1]="Normal",e[e.Heavy=2]="Heavy",e[e.Tenuto=3]="Tenuto"}(N||(N={})),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"}(x||(x={})),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"}(P||(P={})),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"}(v||(v={})),function(e){e[e.None=0]="None",e[e.IntoFromBelow=1]="IntoFromBelow",e[e.IntoFromAbove=2]="IntoFromAbove"}(F||(F={})),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"}(C||(C={})),function(e){e[e.None=0]="None",e[e.Slight=1]="Slight",e[e.Wide=2]="Wide"}(E||(E={})),e.TabRhythmMode=void 0,(D=e.TabRhythmMode||(e.TabRhythmMode={}))[D.Hidden=0]="Hidden",D[D.ShowWithBeams=1]="ShowWithBeams",D[D.ShowWithBars=2]="ShowWithBars",D[D.Automatic=3]="Automatic",e.FingeringMode=void 0,(M=e.FingeringMode||(e.FingeringMode={}))[M.ScoreDefault=0]="ScoreDefault",M[M.ScoreForcePiano=1]="ScoreForcePiano",M[M.SingleNoteEffectBand=2]="SingleNoteEffectBand",M[M.SingleNoteEffectBandForcePiano=3]="SingleNoteEffectBandForcePiano",e.NotationMode=void 0,(L=e.NotationMode||(e.NotationMode={}))[L.GuitarPro=0]="GuitarPro",L[L.SongBook=1]="SongBook",e.NotationElement=void 0,(A=e.NotationElement||(e.NotationElement={}))[A.ScoreTitle=0]="ScoreTitle",A[A.ScoreSubTitle=1]="ScoreSubTitle",A[A.ScoreArtist=2]="ScoreArtist",A[A.ScoreAlbum=3]="ScoreAlbum",A[A.ScoreWords=4]="ScoreWords",A[A.ScoreMusic=5]="ScoreMusic",A[A.ScoreWordsAndMusic=6]="ScoreWordsAndMusic",A[A.ScoreCopyright=7]="ScoreCopyright",A[A.GuitarTuning=8]="GuitarTuning",A[A.TrackNames=9]="TrackNames",A[A.ChordDiagrams=10]="ChordDiagrams",A[A.ParenthesisOnTiedBends=11]="ParenthesisOnTiedBends",A[A.TabNotesOnTiedBends=12]="TabNotesOnTiedBends",A[A.ZerosOnDiveWhammys=13]="ZerosOnDiveWhammys",A[A.EffectAlternateEndings=14]="EffectAlternateEndings",A[A.EffectCapo=15]="EffectCapo",A[A.EffectChordNames=16]="EffectChordNames",A[A.EffectCrescendo=17]="EffectCrescendo",A[A.EffectDynamics=18]="EffectDynamics",A[A.EffectFadeIn=19]="EffectFadeIn",A[A.EffectFermata=20]="EffectFermata",A[A.EffectFingering=21]="EffectFingering",A[A.EffectHarmonics=22]="EffectHarmonics",A[A.EffectLetRing=23]="EffectLetRing",A[A.EffectLyrics=24]="EffectLyrics",A[A.EffectMarker=25]="EffectMarker",A[A.EffectOttavia=26]="EffectOttavia",A[A.EffectPalmMute=27]="EffectPalmMute",A[A.EffectPickSlide=28]="EffectPickSlide",A[A.EffectPickStroke=29]="EffectPickStroke",A[A.EffectSlightBeatVibrato=30]="EffectSlightBeatVibrato",A[A.EffectSlightNoteVibrato=31]="EffectSlightNoteVibrato",A[A.EffectTap=32]="EffectTap",A[A.EffectTempo=33]="EffectTempo",A[A.EffectText=34]="EffectText",A[A.EffectTrill=35]="EffectTrill",A[A.EffectTripletFeel=36]="EffectTripletFeel",A[A.EffectWhammyBar=37]="EffectWhammyBar",A[A.EffectWideBeatVibrato=38]="EffectWideBeatVibrato",A[A.EffectWideNoteVibrato=39]="EffectWideNoteVibrato",A[A.EffectLeftHandTap=40]="EffectLeftHandTap",A[A.EffectFreeTime=41]="EffectFreeTime",A[A.EffectSustainPedal=42]="EffectSustainPedal",A[A.EffectGolpe=43]="EffectGolpe",A[A.EffectWahPedal=44]="EffectWahPedal",A[A.EffectBeatBarre=45]="EffectBeatBarre",A[A.EffectNoteOrnament=46]="EffectNoteOrnament",A[A.EffectRasgueado=47]="EffectRasgueado",A[A.EffectDirections=48]="EffectDirections",A[A.EffectBeatTimer=49]="EffectBeatTimer";class j{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):!j.defaultElements.has(e)||j.defaultElements.get(e)}}j.defaultElements=new Map([[e.NotationElement.ZerosOnDiveWhammys,!1]]);class K{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,(I=e.LogLevel||(e.LogLevel={}))[I.None=0]="None",I[I.Debug=1]="Debug",I[I.Info=2]="Info",I[I.Warning=3]="Warning",I[I.Error=4]="Error";class Q{static format(e,t){return`[AlphaTab][${e}] ${t}`}debug(e,t,...s){console.debug(Q.format(e,t),...s)}warning(e,t,...s){console.warn(Q.format(e,t),...s)}info(e,t,...s){console.info(Q.format(e,t),...s)}error(e,t,...s){console.error(Q.format(e,t),...s)}}Q.logLevel=e.LogLevel.Info;class Z{static shouldLog(t){return Z.logLevel!==e.LogLevel.None&&t>=Z.logLevel}static debug(t,s,...i){Z.shouldLog(e.LogLevel.Debug)&&Z.log.debug(t,s,...i)}static warning(t,s,...i){Z.shouldLog(e.LogLevel.Warning)&&Z.log.warning(t,s,...i)}static info(t,s,...i){Z.shouldLog(e.LogLevel.Info)&&Z.log.info(t,s,...i)}static error(t,s,...i){Z.shouldLog(e.LogLevel.Error)&&Z.log.error(t,s,...i)}}Z.logLevel=e.LogLevel.Info,Z.log=new Q,function(e){e[e.NoTripletFeel=0]="NoTripletFeel",e[e.Triplet16th=1]="Triplet16th",e[e.Triplet8th=2]="Triplet8th",e[e.Dotted16th=3]="Dotted16th",e[e.Dotted8th=4]="Dotted8th",e[e.Scottish16th=5]="Scottish16th",e[e.Scottish8th=6]="Scottish8th"}(R||(R={}));class ee{constructor(){this.alternateEndings=0,this.nextMasterBar=null,this.previousMasterBar=null,this.index=0,this.isDoubleBar=!1,this.isRepeatStart=!1,this.repeatCount=0,this.timeSignatureNumerator=4,this.timeSignatureDenominator=4,this.timeSignatureCommon=!1,this.isFreeTime=!1,this.tripletFeel=R.NoTripletFeel,this.section=null,this.tempoAutomations=[],this.fermata=null,this.start=0,this.isAnacrusis=!1,this.displayScale=1,this.displayWidth=-1,this.directions=null}get hasChanges(){if(0===this.index)return!1;return!(this.timeSignatureCommon===this.previousMasterBar.timeSignatureCommon&&this.timeSignatureNumerator===this.previousMasterBar.timeSignatureNumerator&&this.timeSignatureDenominator===this.previousMasterBar.timeSignatureDenominator&&this.tripletFeel===this.previousMasterBar.tripletFeel)||(0!==this.alternateEndings||this.isRepeatStart||this.isRepeatEnd||this.isFreeTime||this.isSectionStart||this.tempoAutomations.length>0||this.syncPoints&&this.syncPoints.length>0||null!==this.fermata&&this.fermata.size>0||null!==this.directions&&this.directions.size>0||this.isAnacrusis)}get keySignature(){return this.score.tracks[0].staves[0].bars[this.index].keySignature}set keySignature(e){this.score.tracks[0].staves[0].bars[this.index].keySignature=e}get keySignatureType(){return this.score.tracks[0].staves[0].bars[this.index].keySignatureType}set keySignatureType(e){this.score.tracks[0].staves[0].bars[this.index].keySignatureType=e}get isRepeatEnd(){return this.repeatCount>0}get isSectionStart(){return!!this.section}get tempoAutomation(){return this.tempoAutomations.length>0?this.tempoAutomations[0]:null}calculateDuration(e=!0){if(this.isAnacrusis&&e){let e=0;for(const t of this.score.tracks)for(const s of t.staves){const t=this.index<s.bars.length?s.bars[this.index].calculateDuration():0;t>e&&(e=t)}return e}return this.timeSignatureNumerator*J.valueToTicks(this.timeSignatureDenominator)}addFermata(e,t){let s=this.fermata;null===s&&(s=new Map,this.fermata=s),s.set(e,t)}addDirection(e){null==this.directions&&(this.directions=new Set),this.directions.add(e)}getFermata(e){const t=this.fermata;return null===t?null:t.has(e.playbackStart)?t.get(e.playbackStart):null}addSyncPoint(e){this.syncPoints||(this.syncPoints=[]),this.syncPoints.push(e)}}ee.MaxAlternateEndings=8;class te{}te.DefaultChannelCount=17,te.MetronomeChannel=te.DefaultChannelCount-1,te.MetronomeKey=33,te.AudioChannels=2,te.MinVolume=0,te.MinProgram=0,te.MaxProgram=127,te.MinPlaybackSpeed=.125,te.MaxPlaybackSpeed=8,te.PercussionChannel=9,te.PercussionBank=128,te.MaxPitchWheel=16384,te.MaxPitchWheel20=4294967296,te.DefaultPitchWheel=te.MaxPitchWheel/2,te.MicroBufferCount=32,te.MicroBufferSize=64;class se{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.Glyphs=0]="Glyphs"}(O||(O={}));class ie extends G{}let ae=class e{constructor(){this._isEmpty=!0,this._isRestOnly=!0,this.id=e._globalVoiceId++,this.index=0,this.beats=[]}static resetIds(){e._globalVoiceId=0}get isEmpty(){return this._isEmpty}forceNonEmpty(){this._isEmpty=!1}get isRestOnly(){return this._isRestOnly}insertBeat(e,t){t.nextBeat=e.nextBeat,t.nextBeat&&(t.nextBeat.previousBeat=t),t.previousBeat=e,t.voice=this,e.nextBeat=t,this.beats.splice(e.index+1,0,t)}addBeat(e){e.voice=this,e.index=this.beats.length,this.beats.push(e),e.isEmpty||(this._isEmpty=!1),e.isRest||(this._isRestOnly=!1)}chain(e,t=null){if(this.bar){if(e.index<this.beats.length-1)e.nextBeat=this.beats[e.index+1],e.nextBeat.previousBeat=e;else if(e.isLastOfVoice&&e.voice.bar.nextBar){const t=this.bar.nextBar.voices[this.index];t.beats.length>0?(e.nextBeat=t.beats[0],e.nextBeat.previousBeat=e):e.nextBeat.previousBeat=e}e.chain(t)}}addGraceBeat(e){if(0===this.beats.length)return void this.addBeat(e);const t=this.beats[this.beats.length-1];this.beats.splice(this.beats.length-1,1),this.addBeat(e),this.addBeat(t),this._isEmpty=!1,this._isRestOnly=!1}getBeatAtPlaybackStart(e){return this._beatLookup.has(e)?this._beatLookup.get(e):null}finish(e,t=null){this._isEmpty=!0,this._isRestOnly=!0,this._beatLookup=new Map;let s=null;for(let e=0;e<this.beats.length;e++){const i=this.beats[e];i.index=e,this.chain(i,t),i.graceType===B.None?(i.graceGroup=s,s&&(s.isComplete=!0),s=null):(s||(s=new se),s.addBeat(i)),i.isEmpty||(this._isEmpty=!1),i.isRest||(this._isRestOnly=!1)}let i=0,a=0;for(let s=0;s<this.beats.length;s++){const n=this.beats[s];if(n.index=s,n.finish(e,t),n.graceType===B.None){if(n.graceGroup){const e=n.graceGroup.beats[0],t=n.graceGroup.beats[n.graceGroup.beats.length-1];if(e.graceType!==B.BendGrace){const s=t.playbackStart+t.playbackDuration-e.playbackStart;switch(e.graceType){case B.BeforeBeat:e.previousBeat?(e.previousBeat.playbackDuration-=s,a=e.previousBeat.voice===this?e.previousBeat.playbackStart+e.previousBeat.playbackDuration:-s):a=-s;for(const e of n.graceGroup.beats)this._beatLookup.delete(e.playbackStart),e.playbackStart=a,this._beatLookup.set(e.playbackStart,n),a+=e.playbackDuration;break;case B.OnBeat:n.playbackDuration-=s,a=t.voice===this?t.playbackStart+t.playbackDuration:-s}}}n.displayStart=i,n.playbackStart=a,n.fermata?this.bar.masterBar.addFermata(n.playbackStart,n.fermata):n.fermata=this.bar.masterBar.getFermata(n),this._beatLookup.set(n.playbackStart,n)}else n.displayStart=i,n.playbackStart=a;n.finishTuplet(),n.graceGroup&&n.graceGroup.finish(),i+=n.displayDuration,a+=n.playbackDuration}}calculateDuration(){if(this.isEmpty||0===this.beats.length)return 0;const e=this.beats[this.beats.length-1],t=this.beats[0];return e.playbackStart+e.playbackDuration-t.playbackStart}};ae._globalVoiceId=0;class ne{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=v.Default){this.noteValue=e,this.accidentalMode=t}}class oe{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 s=0;s<t.tracks.length;s++){if(s<e.notation.displayTranspositionPitches.length)for(const i of t.tracks[s].staves)i.displayTranspositionPitch=-e.notation.displayTranspositionPitches[s];if(s<e.notation.transpositionPitches.length)for(const i of t.tracks[s].staves)i.transpositionPitch=-e.notation.transpositionPitches[s]}}static fingerToString(t,s,i,a){if(t.notation.fingeringMode===e.FingeringMode.ScoreForcePiano||t.notation.fingeringMode===e.FingeringMode.SingleNoteEffectBandForcePiano||H.isPiano(s.voice.bar.staff.track.playbackInfo.program))switch(i){case x.Unknown:case x.NoOrDead:return null;case x.Thumb:return"1";case x.IndexFinger:return"2";case x.MiddleFinger:return"3";case x.AnnularFinger:return"4";case x.LittleFinger:return"5";default:return null}if(a)switch(i){case x.Unknown:return null;case x.NoOrDead:return"0";case x.Thumb:return"t";case x.IndexFinger:return"1";case x.MiddleFinger:return"2";case x.AnnularFinger:return"3";case x.LittleFinger:return"4";default:return null}switch(i){case x.Unknown:case x.NoOrDead:return null;case x.Thumb:return"p";case x.IndexFinger:return"i";case x.MiddleFinger:return"m";case x.AnnularFinger:return"a";case x.LittleFinger:return"c";default:return null}}static isTuning(e){return!!oe.parseTuning(e)}static parseTuning(e){let t="",s="";for(let i=0;i<e.length;i++){const a=e.charCodeAt(i);if(a>=48&&a<=57){if(!t)return null;s+=String.fromCharCode(a)}else{if(!oe.TuningLetters.has(a))return null;t+=String.fromCharCode(a)}}if(!s||!t)return null;const i=new ne;return i.octave=Number.parseInt(s)+1,i.note=t.toLowerCase(),i.tone=oe.getToneForText(i.note),i.tone.noteValue<0&&(i.octave--,i.tone.noteValue+=12),i}static getTuningForText(e){const t=oe.parseTuning(e);return t?t.realValue:-1}static getToneForText(e){const t=e.substring(0,1),s=e.substring(1);let i,a;switch(t.toLowerCase()){case"c":default:i=0;break;case"d":i=2;break;case"e":i=4;break;case"f":i=5;break;case"g":i=7;break;case"a":i=9;break;case"b":i=11}switch(a=oe.parseAccidentalMode(s),a){case v.Default:case v.ForceNone:case v.ForceNatural:break;case v.ForceSharp:i++;break;case v.ForceDoubleSharp:i+=2;break;case v.ForceFlat:i--;break;case v.ForceDoubleFlat:i-=2}return new re(i,a)}static parseAccidentalMode(e){const t=e.toLowerCase();return oe.accidentalModeMapping.has(t)?oe.accidentalModeMapping.get(t):v.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 s="";do{s=String.fromCharCode("0123456789ABCDEF".charCodeAt(15&e))+s,e>>=4}while(e>0);for(;s.length<t;)s=`0${s}`;return s}static getAlternateEndingsList(e){const t=[];for(let s=0;s<ee.MaxAlternateEndings;s++)e&1<<s&&t.push(s);return t}static deltaFretToHarmonicValue(e){switch(e){case 2:return 2.4;case 3:return 3.2;case 4:case 5:case 7:case 9:case 12:case 16:case 17:case 19:case 24:return e;case 8:return 8.2;case 10:return 9.6;case 14:case 15:return 14.7;case 21:case 22:return 21.7;default:return 12}}static clamp(e,t,s){return e<=t?t:e>=s?s:e}static buildMultiBarRestInfo(e,t,s){if(!e)return null;const i=e[0].score.stylesheet;if(!(e.length>1?i.multiTrackMultiBarRest:!0===i.perTrackMultiBarRest?.has(e[0].index)))return null;const a=new Map,n=e[0].score;let r=t,o=n.tempo;for(;r<=s;){const i=r;let h=null;for(;r<=s;){const s=n.masterBars[r];let a=!1;for(const e of s.tempoAutomations)e.value!==o&&(a=!0),o=e.value;if(s.alternateEndings||s.isRepeatStart&&s.index!==i||s.isFreeTime||s.isAnacrusis||null!==s.section||s.index!==i&&a||null!==s.fermata&&s.fermata.size>0||null!==s.directions&&s.directions.size>0)break;if(i>t&&s.previousMasterBar&&(s.timeSignatureCommon!==s.previousMasterBar.timeSignatureCommon||s.timeSignatureNumerator!==s.previousMasterBar.timeSignatureNumerator||s.timeSignatureDenominator!==s.previousMasterBar.timeSignatureDenominator||s.tripletFeel!==s.previousMasterBar.tripletFeel))break;let l=!0;for(const t of e){for(const e of t.staves){const t=e.bars[s.index];if(!t.isRestOnly){l=!1;break}if(t.index>0&&(t.keySignature!==t.previousBar.keySignature||t.keySignatureType!==t.previousBar.keySignatureType)){l=!1;break}}if(!l)break}if(!l)break;if(r++,s.index>i&&(null===h?h=[s.index]:h.push(s.index)),s.isRepeatEnd)break}h?a.set(i,h):r++}return a}static computeFirstDisplayedBarIndex(e,t){let s=t.display.startBar;return s--,s=Math.min(e.masterBars.length-1,Math.max(0,s)),s}static computeLastDisplayedBarIndex(e,t,s){let i=t.display.barCount;return i<0&&(i=e.masterBars.length),i=s+i-1,i=Math.min(e.masterBars.length-1,Math.max(0,i)),i}static getOrCreateHeaderFooterStyle(e,t){let s,i=e.style;if(e.style||(i=new je,e.style=i),i.headerAndFooter.has(t))s=i.headerAndFooter.get(t);else{if(s=new $e,je.defaultHeaderAndFooter.has(t)){const e=je.defaultHeaderAndFooter.get(t);s.template=e.template,s.textAlign=e.textAlign}i.headerAndFooter.set(t,s)}return s}static consolidate(e){if(0===e.masterBars.length){const t=new ee;e.addMasterBar(t);const s=new q;s.isLinear=!1,s.type=b.Tempo,s.value=e.tempo,t.tempoAutomations.push(s);const i=new X;e.tracks[0].staves[0].addBar(i);const a=new ae;i.addVoice(a);const n=new qe;return n.isEmpty=!0,void a.addBeat(n)}const t=new Set([te.PercussionChannel]);for(const s of e.tracks){if(1===s.staves.length&&s.staves[0].isPercussion)s.playbackInfo.primaryChannel=te.PercussionChannel,s.playbackInfo.secondaryChannel=te.PercussionChannel;else{if(s.playbackInfo.primaryChannel!==te.PercussionChannel)for(;t.has(s.playbackInfo.primaryChannel);)s.playbackInfo.primaryChannel++;if(t.add(s.playbackInfo.primaryChannel),s.playbackInfo.secondaryChannel!==te.PercussionChannel)for(;t.has(s.playbackInfo.secondaryChannel);)s.playbackInfo.secondaryChannel++;t.add(s.playbackInfo.secondaryChannel)}for(const t of s.staves){for(const e of t.bars)for(const t of e.voices)if(t.isEmpty&&0===t.beats.length){const e=new qe;e.isEmpty=!0,t.addBeat(e)}const s=0===t.bars.length?1:t.bars[0].voices.length;for(;t.bars.length<e.masterBars.length;){const e=new X;t.addBar(e);const i=e.previousBar;i&&(e.clef=i.clef,e.clefOttava=i.clefOttava,e.keySignature=e.previousBar.keySignature,e.keySignatureType=e.previousBar.keySignatureType);for(let t=0;t<s;t++){const t=new ae;e.addVoice(t);const s=new qe;s.isEmpty=!0,t.addBeat(s)}}}}}static trimEmptyBarsAtEnd(e){for(;e.masterBars.length>1;){const t=e.masterBars.length-1,s=e.masterBars[t];if(s.hasChanges)return;for(const s of e.tracks)for(const e of s.staves)if(t<e.bars.length){const s=e.bars[t];if(!s.isEmpty||s.hasChanges)return}for(const s of e.tracks)for(const e of s.staves)if(t<e.bars.length){const s=e.bars[t];e.bars.pop(),s.previousBar.nextBar=null}e.masterBars.pop(),s.previousMasterBar.nextMasterBar=null}}}var he,le,ce,de,ue,pe,me,ge,fe,ye,be,Se,_e,we,Te,ke,Be,Ne,xe,Pe,ve,Fe,Ce,Ee,De,Me,Le;oe.TuningLetters=new Set([67,68,69,70,71,65,66,99,100,101,102,103,97,98,35]),oe.accidentalModeMapping=new Map([["default",v.Default],["d",v.Default],["forcenone",v.ForceNone],["-",v.ForceNone],["forcenatural",v.ForceNatural],["n",v.ForceNatural],["forcesharp",v.ForceSharp],["#",v.ForceSharp],["forcedoublesharp",v.ForceDoubleSharp],["##",v.ForceDoubleSharp],["x",v.ForceDoubleSharp],["forceflat",v.ForceFlat],["b",v.ForceFlat],["forcedoubleflat",v.ForceDoubleFlat],["bb",v.ForceDoubleFlat]]),function(e){e[e.None=0]="None",e[e.Up=1]="Up",e[e.Down=2]="Down"}(he||(he={})),function(e){e[e.None=-1]="None",e[e.Space=32]="Space",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.NoteheadPlusDoubleWhole=57516]="NoteheadPlusDoubleWhole",e[e.NoteheadPlusWhole=57517]="NoteheadPlusWhole",e[e.NoteheadPlusHalf=57518]="NoteheadPlusHalf",e[e.NoteheadPlusBlack=57519]="NoteheadPlusBlack",e[e.NoteheadSquareWhite=57528]="NoteheadSquareWhite",e[e.NoteheadSquareBlack=57529]="NoteheadSquareBlack",e[e.NoteheadTriangleUpDoubleWhole=57530]="NoteheadTriangleUpDoubleWhole",e[e.NoteheadTriangleUpWhole=57531]="NoteheadTriangleUpWhole",e[e.NoteheadTriangleUpHalf=57532]="NoteheadTriangleUpHalf",e[e.NoteheadTriangleUpBlack=57534]="NoteheadTriangleUpBlack",e[e.NoteheadTriangleRightWhite=57537]="NoteheadTriangleRightWhite",e[e.NoteheadTriangleRightBlack=57538]="NoteheadTriangleRightBlack",e[e.NoteheadTriangleDownDoubleWhole=57548]="NoteheadTriangleDownDoubleWhole",e[e.NoteheadTriangleDownWhole=57540]="NoteheadTriangleDownWhole",e[e.NoteheadTriangleDownHalf=57541]="NoteheadTriangleDownHalf",e[e.NoteheadTriangleDownBlack=57543]="NoteheadTriangleDownBlack",e[e.NoteheadDiamondDoubleWhole=57559]="NoteheadDiamondDoubleWhole",e[e.NoteheadDiamondWhole=57560]="NoteheadDiamondWhole",e[e.NoteheadDiamondHalf=57561]="NoteheadDiamondHalf",e[e.NoteheadDiamondBlack=57563]="NoteheadDiamondBlack",e[e.NoteheadDiamondBlackWide=57564]="NoteheadDiamondBlackWide",e[e.NoteheadDiamondWhite=57565]="NoteheadDiamondWhite",e[e.NoteheadDiamondWhiteWide=57566]="NoteheadDiamondWhiteWide",e[e.NoteheadCircleXDoubleWhole=57520]="NoteheadCircleXDoubleWhole",e[e.NoteheadCircleXWhole=57521]="NoteheadCircleXWhole",e[e.NoteheadCircleXHalf=57522]="NoteheadCircleXHalf",e[e.NoteheadCircleX=57523]="NoteheadCircleX",e[e.NoteheadXDoubleWhole=57510]="NoteheadXDoubleWhole",e[e.NoteheadXWhole=57511]="NoteheadXWhole",e[e.NoteheadXHalf=57512]="NoteheadXHalf",e[e.NoteheadXBlack=57513]="NoteheadXBlack",e[e.NoteheadParenthesis=57550]="NoteheadParenthesis",e[e.NoteheadSlashedBlack1=57551]="NoteheadSlashedBlack1",e[e.NoteheadSlashedBlack2=57552]="NoteheadSlashedBlack2",e[e.NoteheadSlashedHalf1=57553]="NoteheadSlashedHalf1",e[e.NoteheadSlashedHalf2=57554]="NoteheadSlashedHalf2",e[e.NoteheadSlashedWhole1=57555]="NoteheadSlashedWhole1",e[e.NoteheadSlashedWhole2=57556]="NoteheadSlashedWhole2",e[e.NoteheadSlashedDoubleWhole1=57557]="NoteheadSlashedDoubleWhole1",e[e.NoteheadSlashedDoubleWhole2=57558]="NoteheadSlashedDoubleWhole2",e[e.NoteheadCircledBlack=57572]="NoteheadCircledBlack",e[e.NoteheadCircledHalf=57573]="NoteheadCircledHalf",e[e.NoteheadCircledWhole=57574]="NoteheadCircledWhole",e[e.NoteheadCircledDoubleWhole=57575]="NoteheadCircledDoubleWhole",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.NoteheadRoundWhiteWithDot=57621]="NoteheadRoundWhiteWithDot",e[e.NoteheadSquareBlackLarge=57626]="NoteheadSquareBlackLarge",e[e.NoteheadSquareBlackWhite=57627]="NoteheadSquareBlackWhite",e[e.NoteheadClusterDoubleWhole3rd=57640]="NoteheadClusterDoubleWhole3rd",e[e.NoteheadClusterWhole3rd=57641]="NoteheadClusterWhole3rd",e[e.NoteheadClusterHalf3rd=57642]="NoteheadClusterHalf3rd",e[e.NoteheadClusterQuarter3rd=57643]="NoteheadClusterQuarter3rd",e[e.NoteShapeRoundWhite=57776]="NoteShapeRoundWhite",e[e.NoteShapeRoundBlack=57777]="NoteShapeRoundBlack",e[e.NoteShapeSquareWhite=57778]="NoteShapeSquareWhite",e[e.NoteShapeSquareBlack=57779]="NoteShapeSquareBlack",e[e.NoteShapeTriangleRightWhite=57780]="NoteShapeTriangleRightWhite",e[e.NoteShapeTriangleRightBlack=57781]="NoteShapeTriangleRightBlack",e[e.NoteShapeTriangleLeftWhite=57782]="NoteShapeTriangleLeftWhite",e[e.NoteShapeTriangleLeftBlack=57783]="NoteShapeTriangleLeftBlack",e[e.NoteShapeDiamondWhite=57784]="NoteShapeDiamondWhite",e[e.NoteShapeDiamondBlack=57785]="NoteShapeDiamondBlack",e[e.NoteShapeTriangleUpWhite=57786]="NoteShapeTriangleUpWhite",e[e.NoteShapeTriangleUpBlack=57787]="NoteShapeTriangleUpBlack",e[e.NoteShapeMoonWhite=57788]="NoteShapeMoonWhite",e[e.NoteShapeMoonBlack=57789]="NoteShapeMoonBlack",e[e.NoteShapeTriangleRoundWhite=57790]="NoteShapeTriangleRoundWhite",e[e.NoteShapeTriangleRoundBlack=57791]="NoteShapeTriangleRoundBlack",e[e.NoteQuarterUp=57813]="NoteQuarterUp",e[e.NoteEighthUp=57815]="NoteEighthUp",e[e.TextBlackNoteLongStem=57841]="TextBlackNoteLongStem",e[e.TextBlackNoteFrac8thLongStem=57843]="TextBlackNoteFrac8thLongStem",e[e.TextBlackNoteFrac16thLongStem=57845]="TextBlackNoteFrac16thLongStem",e[e.TextBlackNoteFrac32ndLongStem=57846]="TextBlackNoteFrac32ndLongStem",e[e.TextCont8thBeamLongStem=57848]="TextCont8thBeamLongStem",e[e.TextCont16thBeamLongStem=57850]="TextCont16thBeamLongStem",e[e.TextCont32ndBeamLongStem=57851]="TextCont32ndBeamLongStem",e[e.TextAugmentationDot=57852]="TextAugmentationDot",e[e.TextTupletBracketStartLongStem=57857]="TextTupletBracketStartLongStem",e[e.TextTuplet3LongStem=57858]="TextTuplet3LongStem",e[e.TextTupletBracketEndLongStem=57859]="TextTupletBracketEndLongStem",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.Segno=57415]="Segno",e[e.Coda=57416]="Coda",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.RestHBarLeft=58607]="RestHBarLeft",e[e.RestHBarMiddle=58608]="RestHBarMiddle",e[e.RestHBarRight=58609]="RestHBarRight",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.DynamicPPPPPP=58663]="DynamicPPPPPP",e[e.DynamicPPPPP=58664]="DynamicPPPPP",e[e.DynamicPPPP=58665]="DynamicPPPP",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.DynamicPF=58670]="DynamicPF",e[e.DynamicForte=58658]="DynamicForte",e[e.DynamicFF=58671]="DynamicFF",e[e.DynamicFFF=58672]="DynamicFFF",e[e.DynamicFFFF=58673]="DynamicFFFF",e[e.DynamicFFFFF=58674]="DynamicFFFFF",e[e.DynamicFFFFFF=58675]="DynamicFFFFFF",e[e.DynamicFortePiano=58676]="DynamicFortePiano",e[e.DynamicNiente=58662]="DynamicNiente",e[e.DynamicSforzando1=58678]="DynamicSforzando1",e[e.DynamicSforzandoPiano=58679]="DynamicSforzandoPiano",e[e.DynamicSforzandoPianissimo=58680]="DynamicSforzandoPianissimo",e[e.DynamicSforzato=58681]="DynamicSforzato",e[e.DynamicSforzatoPiano=58682]="DynamicSforzatoPiano",e[e.DynamicSforzatoFF=58683]="DynamicSforzatoFF",e[e.DynamicRinforzando1=58684]="DynamicRinforzando1",e[e.DynamicRinforzando2=58685]="DynamicRinforzando2",e[e.DynamicForzando=58677]="DynamicForzando",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"}(le||(le={})),function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"}(ce||(ce={})),function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle",e[e.Bottom=2]="Bottom"}(de||(de={}));class Ae{constructor(e,t){this.width=e,this.height=t}}class Ie{constructor(e="",t=0,s=0,i=le.None,a=le.None,n=le.None,r=le.None,o=de.Middle){this.elementType=e,this.outputMidiNumber=s,this.staffLine=t,this.noteHeadDefault=i,this.noteHeadHalf=a!==le.None?a:i,this.noteHeadWhole=n!==le.None?n:i,this.techniqueSymbol=r,this.techniqueSymbolPlacement=o}getSymbol(e){switch(e){case k.Whole:return this.noteHeadWhole;case k.Half:return this.noteHeadHalf;default:return this.noteHeadDefault}}}class Re{static articulationFromElementVariation(e,t){return e<Re.gp6ElementAndVariationToArticulation.length?(t>=Re.gp6ElementAndVariationToArticulation.length&&(t=0),Re.gp6ElementAndVariationToArticulation[e][t]):38}static getArticulation(e){const t=e.percussionArticulation;if(t<0)return null;const s=e.beat.voice.bar.staff.track.percussionArticulations;return t<s.length?s[t]:Re.getArticulationByInputMidiNumber(t)}static getElementAndVariation(e){const t=Re.getArticulation(e);if(!t)return[-1,-1];for(let e=0;e<Re.gp6ElementAndVariationToArticulation.length;e++){const s=Re.gp6ElementAndVariationToArticulation[e];for(let i=0;i<s.length;i++){const a=Re.getArticulationByInputMidiNumber(s[i]);if(a?.outputMidiNumber===t.outputMidiNumber)return[e,i]}}return[-1,-1]}static getArticulationByInputMidiNumber(e){return Re.instrumentArticulations.has(e)?Re.instrumentArticulations.get(e):null}}Re.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]],Re.instrumentArticulations=new Map([[38,new Ie("snare",3,38,le.NoteheadBlack,le.NoteheadHalf,le.NoteheadWhole)],[37,new Ie("snare",3,37,le.N