UNPKG

@coderline/alphatab

Version:

alphaTab is a music notation and guitar tablature rendering library

51 lines 1.06 MB
/*! * alphaTab v1.7.1 (, build 24) * * 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(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).alphaTab={})}(this,function(t){"use strict";class e{t;i=new Set;constructor(t){this.t=t,window.addEventListener("resize",this.o.bind(this),!1)}observe(t){this.i.add(t)}unobserve(t){this.i.delete(t)}disconnect(){this.i.clear()}o(){const t=[];for(const e of this.i)t.push({target:e,contentRect:void 0,borderBoxSize:void 0,contentBoxSize:[],devicePixelContentBoxSize:[]});this.t(t,this)}}class s{t;l=[];u=null;constructor(t){this.t=t,window.addEventListener("resize",()=>this.p,!0),document.addEventListener("scroll",()=>this.p,!0)}p(){this.u||(this.u=setTimeout(()=>{this.m(),this.u=null},100))}observe(t){this.l.indexOf(t)>=0||(this.l.push(t),this.p())}unobserve(t){this.l=this.l.filter(e=>e!==t)}m(){const t=[];for(const e of this.l){const s=e.getBoundingClientRect();s.top+s.height>=0&&s.top<=window.innerHeight&&s.left+s.width>=0&&s.left<=window.innerWidth&&t.push({target:e,isIntersecting:!0})}t.length&&this.t(t,this)}}var i,n,r,a,h,o,c,l,u,d,f,p,b,m,g,w,y,k,S,B,_,x,T,M,v,N,P,E,C,F,A,D,L,W;void 0===Symbol.dispose&&(Symbol.dispose=Symbol("Symbol.dispose")),"undefined"!=typeof window&&("ResizeObserver"in globalThis||(globalThis.ResizeObserver=e),"IntersectionObserver"in globalThis||(globalThis.IntersectionObserver=s),"replaceChildren"in Element.prototype||(Element.prototype.replaceChildren=function(...t){this.innerHTML="",this.append(...t)},Document.prototype.replaceChildren=Element.prototype.replaceChildren,DocumentFragment.prototype.replaceChildren=Element.prototype.replaceChildren)),"replaceAll"in String.prototype||(String.prototype.replaceAll=function(t,e){return this.replace(new RegExp(t,"g"),e)}),t.AlphaTabErrorType=void 0,(i=t.AlphaTabErrorType||(t.AlphaTabErrorType={}))[i.General=0]="General",i[i.Format=1]="Format",i[i.AlphaTex=2]="AlphaTex";class R extends Error{type;constructor(t,e="",s){super(e??"",{cause:s}),this.type=t}}class O{static version="1.7.1";static date="2025-12-02T16:54:46.381Z";static commit="e487b958158892679a115693547661dc49a78e16";static print(t){t(`alphaTab ${O.version}`),t(`commit: ${O.commit}`),t(`build date: ${O.date}`)}}!function(t){t[t.PPP=0]="PPP",t[t.PP=1]="PP",t[t.P=2]="P",t[t.MP=3]="MP",t[t.MF=4]="MF",t[t.F=5]="F",t[t.FF=6]="FF",t[t.FFF=7]="FFF",t[t.PPPP=8]="PPPP",t[t.PPPPP=9]="PPPPP",t[t.PPPPPP=10]="PPPPPP",t[t.FFFF=11]="FFFF",t[t.FFFFF=12]="FFFFF",t[t.FFFFFF=13]="FFFFFF",t[t.SF=14]="SF",t[t.SFP=15]="SFP",t[t.SFPP=16]="SFPP",t[t.FP=17]="FP",t[t.RF=18]="RF",t[t.RFZ=19]="RFZ",t[t.SFZ=20]="SFZ",t[t.SFFZ=21]="SFFZ",t[t.FZ=22]="FZ",t[t.N=23]="N",t[t.PF=24]="PF",t[t.SFZP=25]="SFZP"}(n||(n={}));class I{static QuarterTime=960;static k=15;static VelocityIncrement=16;static ticksToMillis(t,e){return t*(6e4/(e*I.QuarterTime))|0}static millisToTicks(t,e){return t/(6e4/(e*I.QuarterTime))|0}static toTicks(t){return I.valueToTicks(t)}static valueToTicks(t){let e=t;return e<0&&(e=1/-e),I.QuarterTime*(4/e)|0}static applyDot(t,e){return e?t+3*(t/4|0):t+(t/2|0)}static applyTuplet(t,e,s){return t*s/e|0}static removeTuplet(t,e,s){return t*e/s|0}static dynamicToVelocity(t,e=0){let s=1;switch(t){case n.PPP:s=I.k+0*I.VelocityIncrement;break;case n.PP:s=I.k+1*I.VelocityIncrement;break;case n.P:s=I.k+2*I.VelocityIncrement;break;case n.MP:s=I.k+3*I.VelocityIncrement;break;case n.MF:s=I.k+4*I.VelocityIncrement;break;case n.F:s=I.k+5*I.VelocityIncrement;break;case n.FF:s=I.k+6*I.VelocityIncrement;break;case n.FFF:s=I.k+7*I.VelocityIncrement;break;case n.PPPP:s=10;break;case n.PPPPP:s=5;break;case n.PPPPPP:s=3;break;case n.FFFF:s=I.k+8*I.VelocityIncrement;break;case n.FFFFF:s=I.k+9*I.VelocityIncrement;break;case n.FFFFFF:s=I.k+10*I.VelocityIncrement;break;case n.SF:case n.SFP:case n.SFZP:case n.SFPP:case n.SFZ:case n.FZ:s=I.k+6*I.VelocityIncrement;break;case n.FP:case n.RF:case n.RFZ:case n.SFFZ:s=I.k+5*I.VelocityIncrement;break;case n.N:s=1;break;case n.PF:s=I.k+(4.5*I.VelocityIncrement|0)}return s+=e*I.VelocityIncrement,Math.min(Math.max(s,1),127)}}!function(t){t[t.Tempo=0]="Tempo",t[t.Volume=1]="Volume",t[t.Instrument=2]="Instrument",t[t.Balance=3]="Balance",t[t.SyncPoint=4]="SyncPoint",t[t.Bank=4]="Bank"}(r||(r={}));class G{barOccurence=0;millisecondOffset=0}class ${isLinear=!1;type=r.Tempo;value=0;syncPointValue;ratioPosition=0;text="";isVisible=!0;static buildTempoAutomation(t,e,s,i,n=!0){(i<1||i>5)&&(i=2);const a=new Float32Array([1,.5,1,1.5,2,3]),h=new $;return h.type=r.Tempo,h.isLinear=t,h.ratioPosition=e,h.value=s*a[i],h.isVisible=n,h}static buildInstrumentAutomation(t,e,s){const i=new $;return i.type=r.Instrument,i.isLinear=t,i.ratioPosition=e,i.value=s,i}}class V{static MaxPosition=60;static MaxValue=12;offset;value;constructor(t=0,e=0){this.offset=t,this.value=e}}!function(t){t[t.Default=0]="Default",t[t.Gradual=1]="Gradual",t[t.Fast=2]="Fast"}(a||(a={})),function(t){t[t.None=0]="None",t[t.Custom=1]="Custom",t[t.Bend=2]="Bend",t[t.Release=3]="Release",t[t.BendRelease=4]="BendRelease",t[t.Hold=5]="Hold",t[t.Prebend=6]="Prebend",t[t.PrebendBend=7]="PrebendBend",t[t.PrebendRelease=8]="PrebendRelease"}(h||(h={})),function(t){t[t.None=0]="None",t[t.BrushUp=1]="BrushUp",t[t.BrushDown=2]="BrushDown",t[t.ArpeggioUp=3]="ArpeggioUp",t[t.ArpeggioDown=4]="ArpeggioDown"}(o||(o={})),function(t){t[t.None=0]="None",t[t.Crescendo=1]="Crescendo",t[t.Decrescendo=2]="Decrescendo"}(c||(c={})),function(t){t[t.QuadrupleWhole=-4]="QuadrupleWhole",t[t.DoubleWhole=-2]="DoubleWhole",t[t.Whole=1]="Whole",t[t.Half=2]="Half",t[t.Quarter=4]="Quarter",t[t.Eighth=8]="Eighth",t[t.Sixteenth=16]="Sixteenth",t[t.ThirtySecond=32]="ThirtySecond",t[t.SixtyFourth=64]="SixtyFourth",t[t.OneHundredTwentyEighth=128]="OneHundredTwentyEighth",t[t.TwoHundredFiftySixth=256]="TwoHundredFiftySixth"}(l||(l={})),function(t){t[t.None=0]="None",t[t.OnBeat=1]="OnBeat",t[t.BeforeBeat=2]="BeforeBeat",t[t.BendGrace=3]="BendGrace"}(u||(u={})),function(t){t[t.None=0]="None",t[t.Normal=1]="Normal",t[t.Heavy=2]="Heavy",t[t.Tenuto=3]="Tenuto"}(d||(d={})),function(t){t[t.Unknown=-2]="Unknown",t[t.NoOrDead=-1]="NoOrDead",t[t.Thumb=0]="Thumb",t[t.IndexFinger=1]="IndexFinger",t[t.MiddleFinger=2]="MiddleFinger",t[t.AnnularFinger=3]="AnnularFinger",t[t.LittleFinger=4]="LittleFinger"}(f||(f={})),function(t){t[t.None=0]="None",t[t.Natural=1]="Natural",t[t.Artificial=2]="Artificial",t[t.Pinch=3]="Pinch",t[t.Tap=4]="Tap",t[t.Semi=5]="Semi",t[t.Feedback=6]="Feedback"}(p||(p={})),function(t){t[t.Default=0]="Default",t[t.ForceNone=1]="ForceNone",t[t.ForceNatural=2]="ForceNatural",t[t.ForceSharp=3]="ForceSharp",t[t.ForceDoubleSharp=4]="ForceDoubleSharp",t[t.ForceFlat=5]="ForceFlat",t[t.ForceDoubleFlat=6]="ForceDoubleFlat"}(b||(b={})),function(t){t[t.S=0]="_15ma",t[t._=1]="_8va",t[t.Regular=2]="Regular",t[t.T=3]="_8vb",t[t.M=4]="_15mb"}(m||(m={})),function(t){t[t.None=0]="None",t[t.IntoFromBelow=1]="IntoFromBelow",t[t.IntoFromAbove=2]="IntoFromAbove"}(g||(g={})),function(t){t[t.None=0]="None",t[t.Shift=1]="Shift",t[t.Legato=2]="Legato",t[t.OutUp=3]="OutUp",t[t.OutDown=4]="OutDown",t[t.PickSlideDown=5]="PickSlideDown",t[t.PickSlideUp=6]="PickSlideUp"}(w||(w={})),function(t){t[t.None=0]="None",t[t.Slight=1]="Slight",t[t.Wide=2]="Wide"}(y||(y={})),t.TabRhythmMode=void 0,(k=t.TabRhythmMode||(t.TabRhythmMode={}))[k.Hidden=0]="Hidden",k[k.ShowWithBeams=1]="ShowWithBeams",k[k.ShowWithBars=2]="ShowWithBars",k[k.Automatic=3]="Automatic",t.FingeringMode=void 0,(S=t.FingeringMode||(t.FingeringMode={}))[S.ScoreDefault=0]="ScoreDefault",S[S.ScoreForcePiano=1]="ScoreForcePiano",S[S.SingleNoteEffectBand=2]="SingleNoteEffectBand",S[S.SingleNoteEffectBandForcePiano=3]="SingleNoteEffectBandForcePiano",t.NotationMode=void 0,(B=t.NotationMode||(t.NotationMode={}))[B.GuitarPro=0]="GuitarPro",B[B.SongBook=1]="SongBook",t.NotationElement=void 0,(_=t.NotationElement||(t.NotationElement={}))[_.ScoreTitle=0]="ScoreTitle",_[_.ScoreSubTitle=1]="ScoreSubTitle",_[_.ScoreArtist=2]="ScoreArtist",_[_.ScoreAlbum=3]="ScoreAlbum",_[_.ScoreWords=4]="ScoreWords",_[_.ScoreMusic=5]="ScoreMusic",_[_.ScoreWordsAndMusic=6]="ScoreWordsAndMusic",_[_.ScoreCopyright=7]="ScoreCopyright",_[_.GuitarTuning=8]="GuitarTuning",_[_.TrackNames=9]="TrackNames",_[_.ChordDiagrams=10]="ChordDiagrams",_[_.ParenthesisOnTiedBends=11]="ParenthesisOnTiedBends",_[_.TabNotesOnTiedBends=12]="TabNotesOnTiedBends",_[_.ZerosOnDiveWhammys=13]="ZerosOnDiveWhammys",_[_.EffectAlternateEndings=14]="EffectAlternateEndings",_[_.EffectCapo=15]="EffectCapo",_[_.EffectChordNames=16]="EffectChordNames",_[_.EffectCrescendo=17]="EffectCrescendo",_[_.EffectDynamics=18]="EffectDynamics",_[_.EffectFadeIn=19]="EffectFadeIn",_[_.EffectFermata=20]="EffectFermata",_[_.EffectFingering=21]="EffectFingering",_[_.EffectHarmonics=22]="EffectHarmonics",_[_.EffectLetRing=23]="EffectLetRing",_[_.EffectLyrics=24]="EffectLyrics",_[_.EffectMarker=25]="EffectMarker",_[_.EffectOttavia=26]="EffectOttavia",_[_.EffectPalmMute=27]="EffectPalmMute",_[_.EffectPickSlide=28]="EffectPickSlide",_[_.EffectPickStroke=29]="EffectPickStroke",_[_.EffectSlightBeatVibrato=30]="EffectSlightBeatVibrato",_[_.EffectSlightNoteVibrato=31]="EffectSlightNoteVibrato",_[_.EffectTap=32]="EffectTap",_[_.EffectTempo=33]="EffectTempo",_[_.EffectText=34]="EffectText",_[_.EffectTrill=35]="EffectTrill",_[_.EffectTripletFeel=36]="EffectTripletFeel",_[_.EffectWhammyBar=37]="EffectWhammyBar",_[_.EffectWideBeatVibrato=38]="EffectWideBeatVibrato",_[_.EffectWideNoteVibrato=39]="EffectWideNoteVibrato",_[_.EffectLeftHandTap=40]="EffectLeftHandTap",_[_.EffectFreeTime=41]="EffectFreeTime",_[_.EffectSustainPedal=42]="EffectSustainPedal",_[_.EffectGolpe=43]="EffectGolpe",_[_.EffectWahPedal=44]="EffectWahPedal",_[_.EffectBeatBarre=45]="EffectBeatBarre",_[_.EffectNoteOrnament=46]="EffectNoteOrnament",_[_.EffectRasgueado=47]="EffectRasgueado",_[_.EffectDirections=48]="EffectDirections",_[_.EffectBeatTimer=49]="EffectBeatTimer";class H{notationMode=t.NotationMode.GuitarPro;fingeringMode=t.FingeringMode.ScoreDefault;elements=new Map;static defaultElements=new Map([[t.NotationElement.ZerosOnDiveWhammys,!1]]);rhythmMode=t.TabRhythmMode.Automatic;rhythmHeight=15;transpositionPitches=[];displayTranspositionPitches=[];smallGraceTabNotes=!0;extendBendArrowsOnTiedNotes=!0;extendLineEffectsToBeatEnd=!1;slurHeight=5;isNotationElementVisible(t){return this.elements.has(t)?this.elements.get(t):!H.defaultElements.has(t)||H.defaultElements.get(t)}}class U{v;L=void 0;get hasValue(){return void 0!==this.L}constructor(t){this.v=t}get value(){return void 0===this.L&&(this.L=this.v()),this.L}reset(){this.L=void 0}}t.LogLevel=void 0,(x=t.LogLevel||(t.LogLevel={}))[x.None=0]="None",x[x.Debug=1]="Debug",x[x.Info=2]="Info",x[x.Warning=3]="Warning",x[x.Error=4]="Error";class z{static logLevel=t.LogLevel.Info;static W(t,e){return`[AlphaTab][${t}] ${e}`}debug(t,e,...s){console.debug(z.W(t,e),...s)}warning(t,e,...s){console.warn(z.W(t,e),...s)}info(t,e,...s){console.info(z.W(t,e),...s)}error(t,e,...s){console.error(z.W(t,e),...s)}}class j{static logLevel=t.LogLevel.Info;static log=new z;static R(e){return j.logLevel!==t.LogLevel.None&&e>=j.logLevel}static debug(e,s,...i){j.R(t.LogLevel.Debug)&&j.log.debug(e,s,...i)}static warning(e,s,...i){j.R(t.LogLevel.Warning)&&j.log.warning(e,s,...i)}static info(e,s,...i){j.R(t.LogLevel.Info)&&j.log.info(e,s,...i)}static error(e,s,...i){j.R(t.LogLevel.Error)&&j.log.error(e,s,...i)}}!function(t){t[t.NoBrackets=0]="NoBrackets",t[t.GroupStaves=1]="GroupStaves",t[t.GroupSimilarInstruments=2]="GroupSimilarInstruments"}(T||(T={})),function(t){t[t.Hidden=0]="Hidden",t[t.FirstSystem=1]="FirstSystem",t[t.AllSystems=2]="AllSystems"}(M||(M={})),function(t){t[t.FullName=0]="FullName",t[t.ShortName=1]="ShortName"}(v||(v={})),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(N||(N={}));class X{hideDynamics=!1;bracketExtendMode=T.GroupStaves;useSystemSignSeparator=!1;globalDisplayTuning=!0;perTrackDisplayTuning=null;globalDisplayChordDiagramsOnTop=!0;perTrackChordDiagramsOnTop=null;singleTrackTrackNamePolicy=M.FirstSystem;multiTrackTrackNamePolicy=M.FirstSystem;firstSystemTrackNameMode=v.ShortName;otherSystemsTrackNameMode=v.ShortName;firstSystemTrackNameOrientation=N.Vertical;otherSystemsTrackNameOrientation=N.Vertical;multiTrackMultiBarRest=!1;perTrackMultiBarRest=null}class J{masterBars=[];opening=null;get openings(){const t=this.opening;return t?[t]:[]}closings=[];get isOpened(){return!0===this.opening?.isRepeatStart}isClosed=!1;addMasterBar(t){null===this.opening&&(this.opening=t),this.masterBars.push(t),t.repeatGroup=this,t.isRepeatEnd&&(this.closings.push(t),this.isClosed=!0)}}class q{colors=new Map}!function(t){t[t.Neutral=0]="Neutral",t[t.C3=1]="C3",t[t.C4=2]="C4",t[t.F4=3]="F4",t[t.G2=4]="G2"}(P||(P={})),function(t){t[t.None=0]="None",t[t.Simple=1]="Simple",t[t.FirstOfDouble=2]="FirstOfDouble",t[t.SecondOfDouble=3]="SecondOfDouble"}(E||(E={})),function(t){t[t.Cb=-7]="Cb",t[t.Gb=-6]="Gb",t[t.Db=-5]="Db",t[t.Ab=-4]="Ab",t[t.Eb=-3]="Eb",t[t.Bb=-2]="Bb",t[t.F=-1]="F",t[t.C=0]="C",t[t.G=1]="G",t[t.D=2]="D",t[t.A=3]="A",t[t.E=4]="E",t[t.B=5]="B",t[t.FSharp=6]="FSharp",t[t.CSharp=7]="CSharp"}(C||(C={})),function(t){t[t.Major=0]="Major",t[t.Minor=1]="Minor"}(F||(F={})),function(t){t[t.Down=0]="Down",t[t.Hold=1]="Hold",t[t.Up=2]="Up"}(A||(A={}));class Y{ratioPosition=0;pedalType=A.Down;bar;nextPedalMarker=null;previousPedalMarker=null}!function(t){t[t.StandardNotationRepeats=0]="StandardNotationRepeats",t[t.GuitarTabsRepeats=1]="GuitarTabsRepeats",t[t.SlashRepeats=2]="SlashRepeats",t[t.NumberedRepeats=3]="NumberedRepeats",t[t.StandardNotationBarNumber=4]="StandardNotationBarNumber",t[t.GuitarTabsBarNumber=5]="GuitarTabsBarNumber",t[t.SlashBarNumber=6]="SlashBarNumber",t[t.NumberedBarNumber=7]="NumberedBarNumber",t[t.StandardNotationBarLines=8]="StandardNotationBarLines",t[t.GuitarTabsBarLines=9]="GuitarTabsBarLines",t[t.SlashBarLines=10]="SlashBarLines",t[t.NumberedBarLines=11]="NumberedBarLines",t[t.StandardNotationClef=12]="StandardNotationClef",t[t.GuitarTabsClef=13]="GuitarTabsClef",t[t.StandardNotationKeySignature=14]="StandardNotationKeySignature",t[t.NumberedKeySignature=15]="NumberedKeySignature",t[t.StandardNotationTimeSignature=16]="StandardNotationTimeSignature",t[t.GuitarTabsTimeSignature=17]="GuitarTabsTimeSignature",t[t.SlashTimeSignature=18]="SlashTimeSignature",t[t.NumberedTimeSignature=19]="NumberedTimeSignature",t[t.StandardNotationStaffLine=20]="StandardNotationStaffLine",t[t.GuitarTabsStaffLine=21]="GuitarTabsStaffLine",t[t.SlashStaffLine=22]="SlashStaffLine",t[t.NumberedStaffLine=23]="NumberedStaffLine"}(D||(D={}));class K extends q{}!function(t){t[t.Automatic=0]="Automatic",t[t.Dashed=1]="Dashed",t[t.Dotted=2]="Dotted",t[t.Heavy=3]="Heavy",t[t.HeavyHeavy=4]="HeavyHeavy",t[t.HeavyLight=5]="HeavyLight",t[t.LightHeavy=6]="LightHeavy",t[t.LightLight=7]="LightLight",t[t.None=8]="None",t[t.Regular=9]="Regular",t[t.Short=10]="Short",t[t.Tick=11]="Tick"}(L||(L={}));class Q{static O=0;static resetIds(){Q.O=0}id=Q.O++;index=0;nextBar=null;previousBar=null;clef=P.G2;clefOttava=m.Regular;staff;voices=[];simileMark=E.None;I=new Set([0]);get isMultiVoice(){return this.I.size>1}get filledVoices(){return this.I}displayScale=1;displayWidth=-1;sustainPedals=[];get masterBar(){return this.staff.track.score.masterBars[this.index]}$=!0;V=!0;get isEmpty(){return this.$}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!==E.None||this.sustainPedals.length>0||this.barLineLeft!==L.Automatic||this.barLineRight!==L.Automatic)}get isRestOnly(){return this.V}barLineLeft=L.Automatic;barLineRight=L.Automatic;keySignature=C.C;keySignatureType=F.Major;getActualBarLineLeft(t){return Q.H(this,!1,t)}getActualBarLineRight(){return Q.H(this,!0,!1)}static U(t,e,s){let i;return i=e?t.isRepeatEnd?L.LightHeavy:t.nextMasterBar?t.isFreeTime?L.Dashed:t.isDoubleBar?L.LightLight:L.Regular:L.LightHeavy:t.isRepeatStart?L.HeavyLight:s?L.Regular:L.None,i}static H(t,e,s){const i=t.masterBar,n=e?t.barLineRight:t.barLineLeft;let r;return r=n===L.Automatic?Q.U(i,e,s):n,r}style;addVoice(t){t.bar=this,t.index=this.voices.length,this.voices.push(t)}finish(t,e=null){this.I.clear(),this.I.add(0),this.$=!0,this.V=!0;for(let s=0,i=this.voices.length;s<i;s++){const i=this.voices[s];i.finish(t,e),i.isEmpty||(this.$=!1,this.I.add(s)),i.isRestOnly||(this.V=!1)}const s=this.sustainPedals;if(s.length>0){let t=null;this.sustainPedals=[],this.previousBar&&this.previousBar.sustainPedals.length>0&&(t=this.previousBar.sustainPedals[this.previousBar.sustainPedals.length-1],t.pedalType===A.Up&&(t=null));const e=null!==t&&t.pedalType!==A.Up;for(const i of s){if(t&&t.pedalType!==A.Up){if(t.bar===this&&i.ratioPosition<=t.ratioPosition)continue;t.nextPedalMarker=i,i.previousPedalMarker=t}e&&i.pedalType===A.Down&&(i.pedalType=A.Hold),i.bar=this,this.sustainPedals.push(i),t=i}}else if(this.previousBar&&this.previousBar.sustainPedals.length>0){const t=this.previousBar.sustainPedals[this.previousBar.sustainPedals.length-1];if(t.pedalType!==A.Up){const e=new Y;e.ratioPosition=0,e.bar=this,e.pedalType=A.Hold,this.sustainPedals.push(e),t.nextPedalMarker=e,e.previousPedalMarker=t}}}calculateDuration(){let t=0;for(const e of this.voices){const s=e.calculateDuration();s>t&&(t=s)}return t}}class Z{beats=[];id="empty";isComplete=!1;addBeat(t){t.graceIndex=this.beats.length,t.graceGroup=this,this.beats.push(t)}finish(){this.beats.length>0&&(this.id=`${this.beats[0].absoluteDisplayStart}_${this.beats[0].voice.index}`)}}!function(t){t[t.Glyphs=0]="Glyphs"}(W||(W={}));class tt extends q{}let et=class t{j;$=!0;V=!0;static X=0;static resetIds(){t.X=0}id=t.X++;index=0;bar;beats=[];get isEmpty(){return this.$}style;forceNonEmpty(){this.$=!1}get isRestOnly(){return this.V}insertBeat(t,e){e.nextBeat=t.nextBeat,e.nextBeat&&(e.nextBeat.previousBeat=e),e.previousBeat=t,e.voice=this,t.nextBeat=e,this.beats.splice(t.index+1,0,e)}addBeat(t){t.voice=this,t.index=this.beats.length,this.beats.push(t),t.isEmpty||(this.$=!1),t.isRest||(this.V=!1)}J(t,e=null){if(this.bar){if(t.index<this.beats.length-1)t.nextBeat=this.beats[t.index+1],t.nextBeat.previousBeat=t;else if(t.isLastOfVoice&&t.voice.bar.nextBar){const e=this.bar.nextBar.voices[this.index];e.beats.length>0?(t.nextBeat=e.beats[0],t.nextBeat.previousBeat=t):t.nextBeat.previousBeat=t}t.chain(e)}}addGraceBeat(t){if(0===this.beats.length)return void this.addBeat(t);const e=this.beats[this.beats.length-1];this.beats.splice(this.beats.length-1,1),this.addBeat(t),this.addBeat(e),this.$=!1,this.V=!1}getBeatAtPlaybackStart(t){return this.j.has(t)?this.j.get(t):null}finish(t,e=null){this.$=!0,this.V=!0,this.j=new Map;let s=null;for(let t=0;t<this.beats.length;t++){const i=this.beats[t];i.index=t,this.J(i,e),i.graceType===u.None?(i.graceGroup=s,s&&(s.isComplete=!0),s=null):(s||(s=new Z),s.addBeat(i)),i.isEmpty||(this.$=!1),i.isRest||(this.V=!1)}let i=0,n=0;for(let s=0;s<this.beats.length;s++){const r=this.beats[s];if(r.index=s,r.finish(t,e),r.graceType===u.None){if(r.graceGroup){const t=r.graceGroup.beats[0],e=r.graceGroup.beats[r.graceGroup.beats.length-1];if(t.graceType!==u.BendGrace){const s=e.playbackStart+e.playbackDuration-t.playbackStart;switch(t.graceType){case u.BeforeBeat:t.previousBeat?(t.previousBeat.playbackDuration-=s,n=t.previousBeat.voice===this?t.previousBeat.playbackStart+t.previousBeat.playbackDuration:-s):n=-s;for(const t of r.graceGroup.beats)this.j.delete(t.playbackStart),t.playbackStart=n,this.j.set(t.playbackStart,r),n+=t.playbackDuration;break;case u.OnBeat:r.playbackDuration-=s,n=e.voice===this?e.playbackStart+e.playbackDuration:-s}}}r.displayStart=i,r.playbackStart=n,this.j.set(r.playbackStart,r)}else r.displayStart=i,r.playbackStart=n;r.fermata?this.bar.masterBar.addFermata(r.playbackStart,r.fermata):r.fermata=this.bar.masterBar.getFermata(r),r.finishTuplet(),r.graceGroup&&r.graceGroup.finish(),i+=r.displayDuration,n+=r.playbackDuration}}calculateDuration(){if(this.isEmpty||0===this.beats.length)return 0;const t=this.beats[this.beats.length-1],e=this.beats[0];return t.playbackStart+t.playbackDuration-e.playbackStart}};var st,it,nt,rt,at,ht,ot,ct,lt,ut,dt,ft,pt,bt,mt,gt,wt,yt,kt,St,Bt,_t,xt,Tt,Mt,vt,Nt,Pt,Et,Ct,Ft,At;!function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right"}(st||(st={})),function(t){t[t.Top=0]="Top",t[t.Middle=1]="Middle",t[t.Bottom=2]="Bottom",t[t.Alphabetic=3]="Alphabetic"}(it||(it={}));class Dt{width;height;constructor(t,e){this.width=t,this.height=e}}class Lt{static fillMusicFontSymbolSafe(t,e,s,i,n,r){t.settings.display.resources.engravingSettings.hasSymbol(n)&&t.fillMusicFontSymbol(e,s,i,n,r)}static fillMusicFontSymbolsSafe(t,e,s,i,n,r){const a=n.filter(e=>t.settings.display.resources.engravingSettings.hasSymbol(e));0!==a.length&&t.fillMusicFontSymbols(e,s,i,a,r)}}!function(t){t[t.Title=0]="Title",t[t.SubTitle=1]="SubTitle",t[t.Artist=2]="Artist",t[t.Album=3]="Album",t[t.Words=4]="Words",t[t.Music=5]="Music",t[t.WordsAndMusic=6]="WordsAndMusic",t[t.Transcriber=7]="Transcriber",t[t.Copyright=8]="Copyright",t[t.CopyrightSecondLine=9]="CopyrightSecondLine",t[t.ChordDiagramList=10]="ChordDiagramList"}(nt||(nt={}));class Wt{template;isVisible;textAlign;constructor(t="",e=void 0,s=st.Left){this.template=t,this.isVisible=e,this.textAlign=s}static equals(t,e){return(void 0===t.isVisible||t.isVisible)===(void 0===e.isVisible||e.isVisible)&&(t.template===e.template&&t.textAlign===e.textAlign)}buildText(t){let e=!1,s=!1;const i=this.template.replace(Wt.q,(i,n)=>{s=!0;let r="";switch(n){case"TITLE":r=t.title;break;case"SUBTITLE":r=t.subTitle;break;case"ARTIST":r=t.artist;break;case"ALBUM":r=t.album;break;case"WORDS":case"WORDSMUSIC":r=t.words;break;case"MUSIC":r=t.music;break;case"TABBER":r=t.tab;break;case"COPYRIGHT":r=t.copyright;break;default:r=""}return r&&(e=!0),r});return s&&!e?"":i}static q=/%([^%]+)%/g}class Rt extends q{headerAndFooter=new Map;static defaultHeaderAndFooter=new Map([[nt.Title,new Wt("%TITLE%",void 0,st.Center)],[nt.SubTitle,new Wt("%SUBTITLE%",void 0,st.Center)],[nt.Artist,new Wt("%ARTIST%",void 0,st.Center)],[nt.Album,new Wt("%ALBUM%",void 0,st.Center)],[nt.Words,new Wt("Words by %WORDS%",void 0,st.Left)],[nt.Music,new Wt("Music by %MUSIC%",void 0,st.Right)],[nt.WordsAndMusic,new Wt("Words & Music by %MUSIC%",void 0,st.Right)],[nt.Transcriber,new Wt("Tabbed by %TABBER%",!1,st.Right)],[nt.Copyright,new Wt("%COPYRIGHT%",void 0,st.Center)],[nt.CopyrightSecondLine,new Wt("All Rights Reserved - International Copyright Secured",!0,st.Center)]])}class Ot{Y=null;K=[];Z=0;static resetIds(){Q.resetIds(),Kt.resetIds(),et.resetIds(),Jt.resetIds()}album="";artist="";copyright="";instructions="";music="";notices="";subTitle="";title="";words="";tab="";get tempo(){return this.masterBars.length&&this.masterBars[0].tempoAutomations.length>0?this.masterBars[0].tempoAutomations[0].value:120}get tempoLabel(){return this.masterBars.length&&this.masterBars[0].tempoAutomations.length>0?this.masterBars[0].tempoAutomations[0].text:""}masterBars=[];tracks=[];defaultSystemsLayout=3;systemsLayout=[];stylesheet=new X;backingTrack;style;rebuildRepeatGroups(){this.Y=null,this.K=[],this.Z=0;for(const t of this.masterBars)this.tt(t)}addMasterBar(t){t.score=this,t.index=this.masterBars.length,0!==this.masterBars.length&&(t.previousMasterBar=this.masterBars[this.masterBars.length-1],t.previousMasterBar.nextMasterBar=t,t.start=t.previousMasterBar.start+(t.previousMasterBar.isAnacrusis?0:t.previousMasterBar.calculateDuration())),this.tt(t),this.masterBars.push(t)}tt(t){t.isRepeatStart?(this.Y?.isClosed&&(this.K.pop(),this.Z--),this.Y=new J,this.K.push(this.Y),this.Z++):this.Y||(this.Y=new J,this.K.push(this.Y)),this.Y.addMasterBar(t),t.isRepeatEnd&&this.Z>1&&(this.K.pop(),this.Z--,this.Y=this.K.length>0?this.K[this.K.length-1]:null)}addTrack(t){t.score=this,t.index=this.tracks.length,this.tracks.push(t)}finish(t){const e=new Map;for(let s=0,i=this.tracks.length;s<i;s++)this.tracks[s].finish(t,e)}applyFlatSyncPoints(t){for(const t of this.masterBars)t.syncPoints=void 0;for(const e of t){const t=new $;t.ratioPosition=Math.min(1,Math.max(0,e.barPosition)),t.type=r.SyncPoint,t.syncPointValue=new G,t.syncPointValue.millisecondOffset=e.millisecondOffset,t.syncPointValue.barOccurence=e.barOccurence,e.barIndex<this.masterBars.length&&this.masterBars[e.barIndex].addSyncPoint(t)}for(const t of this.masterBars)t.syncPoints&&t.syncPoints.sort((t,e)=>{const s=t.syncPointValue.barOccurence-e.syncPointValue.barOccurence;return 0!==s?s:t.ratioPosition-e.ratioPosition})}exportFlatSyncPoints(){const t=[];for(const e of this.masterBars){const s=e.syncPoints;if(s)for(const i of s)t.push({barIndex:e.index,barOccurence:i.syncPointValue.barOccurence,barPosition:i.ratioPosition,millisecondOffset:i.syncPointValue.millisecondOffset})}return t}}!function(t){t[t.NoTripletFeel=0]="NoTripletFeel",t[t.Triplet16th=1]="Triplet16th",t[t.Triplet8th=2]="Triplet8th",t[t.Dotted16th=3]="Dotted16th",t[t.Dotted8th=4]="Dotted8th",t[t.Scottish16th=5]="Scottish16th",t[t.Scottish8th=6]="Scottish8th"}(rt||(rt={}));class It{static MaxAlternateEndings=8;alternateEndings=0;nextMasterBar=null;previousMasterBar=null;index=0;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(t){this.score.tracks[0].staves[0].bars[this.index].keySignature=t}get keySignatureType(){return this.score.tracks[0].staves[0].bars[this.index].keySignatureType}set keySignatureType(t){this.score.tracks[0].staves[0].bars[this.index].keySignatureType=t}isDoubleBar=!1;isRepeatStart=!1;get isRepeatEnd(){return this.repeatCount>0}repeatCount=0;repeatGroup;timeSignatureNumerator=4;timeSignatureDenominator=4;timeSignatureCommon=!1;isFreeTime=!1;tripletFeel=rt.NoTripletFeel;section=null;get isSectionStart(){return!!this.section}get tempoAutomation(){return this.tempoAutomations.length>0?this.tempoAutomations[0]:null}tempoAutomations=[];syncPoints;score;fermata=null;start=0;isAnacrusis=!1;displayScale=1;displayWidth=-1;directions=null;calculateDuration(t=!0){if(this.isAnacrusis&&t){let t=0;for(const e of this.score.tracks)for(const s of e.staves){const e=this.index<s.bars.length?s.bars[this.index].calculateDuration():0;e>t&&(t=e)}return t}return this.timeSignatureNumerator*I.valueToTicks(this.timeSignatureDenominator)}addFermata(t,e){let s=this.fermata;null===s&&(s=new Map,this.fermata=s),s.set(t,e)}addDirection(t){null==this.directions&&(this.directions=new Set),this.directions.add(t)}getFermata(t){const e=this.fermata;return null===e?null:e.has(t.playbackStart)?e.get(t.playbackStart):0===t.index&&e.has(0)?e.get(0):null}addSyncPoint(t){this.syncPoints||(this.syncPoints=[]),this.syncPoints.push(t)}}class Gt{static DefaultChannelCount=17;static MetronomeChannel=Gt.DefaultChannelCount-1;static MetronomeKey=33;static AudioChannels=2;static MinVolume=0;static MinProgram=0;static MaxProgram=127;static MinPlaybackSpeed=.125;static MaxPlaybackSpeed=8;static PercussionChannel=9;static PercussionBank=128;static MaxPitchWheel=16384;static MaxPitchWheel20=4294967296;static DefaultPitchWheel=Gt.MaxPitchWheel/2;static MicroBufferCount=32;static MicroBufferSize=64}!function(t){t[t.None=-1]="None",t[t.Space=32]="Space",t[t.Brace=57344]="Brace",t[t.BracketTop=57347]="BracketTop",t[t.BracketBottom=57348]="BracketBottom",t[t.SystemDivider=57351]="SystemDivider",t[t.GClef=57424]="GClef",t[t.GClef15mb=57425]="GClef15mb",t[t.GClef8vb=57426]="GClef8vb",t[t.GClef8va=57427]="GClef8va",t[t.GClef15ma=57428]="GClef15ma",t[t.CClef=57436]="CClef",t[t.CClef8vb=57437]="CClef8vb",t[t.FClef=57442]="FClef",t[t.FClef15mb=57443]="FClef15mb",t[t.FClef8vb=57444]="FClef8vb",t[t.FClef8va=57445]="FClef8va",t[t.FClef15ma=57446]="FClef15ma",t[t.UnpitchedPercussionClef1=57449]="UnpitchedPercussionClef1",t[t.SixStringTabClef=57453]="SixStringTabClef",t[t.FourStringTabClef=57454]="FourStringTabClef",t[t.Clef8=57469]="Clef8",t[t.Clef15=57470]="Clef15",t[t.TimeSig0=57472]="TimeSig0",t[t.TimeSig1=57473]="TimeSig1",t[t.TimeSig2=57474]="TimeSig2",t[t.TimeSig3=57475]="TimeSig3",t[t.TimeSig4=57476]="TimeSig4",t[t.TimeSig5=57477]="TimeSig5",t[t.TimeSig6=57478]="TimeSig6",t[t.TimeSig7=57479]="TimeSig7",t[t.TimeSig8=57480]="TimeSig8",t[t.TimeSig9=57481]="TimeSig9",t[t.TimeSigCommon=57482]="TimeSigCommon",t[t.TimeSigCutCommon=57483]="TimeSigCutCommon",t[t.NoteheadDoubleWholeSquare=57505]="NoteheadDoubleWholeSquare",t[t.NoteheadDoubleWhole=57504]="NoteheadDoubleWhole",t[t.NoteheadWhole=57506]="NoteheadWhole",t[t.NoteheadHalf=57507]="NoteheadHalf",t[t.NoteheadBlack=57508]="NoteheadBlack",t[t.NoteheadNull=57509]="NoteheadNull",t[t.NoteheadXOrnate=57514]="NoteheadXOrnate",t[t.NoteheadPlusDoubleWhole=57516]="NoteheadPlusDoubleWhole",t[t.NoteheadPlusWhole=57517]="NoteheadPlusWhole",t[t.NoteheadPlusHalf=57518]="NoteheadPlusHalf",t[t.NoteheadPlusBlack=57519]="NoteheadPlusBlack",t[t.NoteheadSquareWhite=57528]="NoteheadSquareWhite",t[t.NoteheadSquareBlack=57529]="NoteheadSquareBlack",t[t.NoteheadTriangleUpDoubleWhole=57530]="NoteheadTriangleUpDoubleWhole",t[t.NoteheadTriangleUpWhole=57531]="NoteheadTriangleUpWhole",t[t.NoteheadTriangleUpHalf=57532]="NoteheadTriangleUpHalf",t[t.NoteheadTriangleUpBlack=57534]="NoteheadTriangleUpBlack",t[t.NoteheadTriangleRightWhite=57537]="NoteheadTriangleRightWhite",t[t.NoteheadTriangleRightBlack=57538]="NoteheadTriangleRightBlack",t[t.NoteheadTriangleDownDoubleWhole=57548]="NoteheadTriangleDownDoubleWhole",t[t.NoteheadTriangleDownWhole=57540]="NoteheadTriangleDownWhole",t[t.NoteheadTriangleDownHalf=57541]="NoteheadTriangleDownHalf",t[t.NoteheadTriangleDownBlack=57543]="NoteheadTriangleDownBlack",t[t.NoteheadDiamondDoubleWhole=57559]="NoteheadDiamondDoubleWhole",t[t.NoteheadDiamondWhole=57560]="NoteheadDiamondWhole",t[t.NoteheadDiamondHalf=57561]="NoteheadDiamondHalf",t[t.NoteheadDiamondBlack=57563]="NoteheadDiamondBlack",t[t.NoteheadDiamondBlackWide=57564]="NoteheadDiamondBlackWide",t[t.NoteheadDiamondWhite=57565]="NoteheadDiamondWhite",t[t.NoteheadDiamondWhiteWide=57566]="NoteheadDiamondWhiteWide",t[t.NoteheadCircleXDoubleWhole=57520]="NoteheadCircleXDoubleWhole",t[t.NoteheadCircleXWhole=57521]="NoteheadCircleXWhole",t[t.NoteheadCircleXHalf=57522]="NoteheadCircleXHalf",t[t.NoteheadCircleX=57523]="NoteheadCircleX",t[t.NoteheadXDoubleWhole=57510]="NoteheadXDoubleWhole",t[t.NoteheadXWhole=57511]="NoteheadXWhole",t[t.NoteheadXHalf=57512]="NoteheadXHalf",t[t.NoteheadXBlack=57513]="NoteheadXBlack",t[t.NoteheadParenthesis=57550]="NoteheadParenthesis",t[t.NoteheadSlashedBlack1=57551]="NoteheadSlashedBlack1",t[t.NoteheadSlashedBlack2=57552]="NoteheadSlashedBlack2",t[t.NoteheadSlashedHalf1=57553]="NoteheadSlashedHalf1",t[t.NoteheadSlashedHalf2=57554]="NoteheadSlashedHalf2",t[t.NoteheadSlashedWhole1=57555]="NoteheadSlashedWhole1",t[t.NoteheadSlashedWhole2=57556]="NoteheadSlashedWhole2",t[t.NoteheadSlashedDoubleWhole1=57557]="NoteheadSlashedDoubleWhole1",t[t.NoteheadSlashedDoubleWhole2=57558]="NoteheadSlashedDoubleWhole2",t[t.NoteheadCircledBlack=57572]="NoteheadCircledBlack",t[t.NoteheadCircledHalf=57573]="NoteheadCircledHalf",t[t.NoteheadCircledWhole=57574]="NoteheadCircledWhole",t[t.NoteheadCircledDoubleWhole=57575]="NoteheadCircledDoubleWhole",t[t.NoteheadCircleSlash=57591]="NoteheadCircleSlash",t[t.NoteheadHeavyX=57592]="NoteheadHeavyX",t[t.NoteheadHeavyXHat=57593]="NoteheadHeavyXHat",t[t.NoteheadSlashHorizontalEnds=57601]="NoteheadSlashHorizontalEnds",t[t.NoteheadSlashWhiteWhole=57602]="NoteheadSlashWhiteWhole",t[t.NoteheadSlashWhiteHalf=57603]="NoteheadSlashWhiteHalf",t[t.NoteheadRoundWhiteWithDot=57621]="NoteheadRoundWhiteWithDot",t[t.NoteheadSquareBlackLarge=57626]="NoteheadSquareBlackLarge",t[t.NoteheadSquareBlackWhite=57627]="NoteheadSquareBlackWhite",t[t.NoteheadClusterDoubleWhole3rd=57640]="NoteheadClusterDoubleWhole3rd",t[t.NoteheadClusterWhole3rd=57641]="NoteheadClusterWhole3rd",t[t.NoteheadClusterHalf3rd=57642]="NoteheadClusterHalf3rd",t[t.NoteheadClusterQuarter3rd=57643]="NoteheadClusterQuarter3rd",t[t.NoteShapeRoundWhite=57776]="NoteShapeRoundWhite",t[t.NoteShapeRoundBlack=57777]="NoteShapeRoundBlack",t[t.NoteShapeSquareWhite=57778]="NoteShapeSquareWhite",t[t.NoteShapeSquareBlack=57779]="NoteShapeSquareBlack",t[t.NoteShapeTriangleRightWhite=57780]="NoteShapeTriangleRightWhite",t[t.NoteShapeTriangleRightBlack=57781]="NoteShapeTriangleRightBlack",t[t.NoteShapeTriangleLeftWhite=57782]="NoteShapeTriangleLeftWhite",t[t.NoteShapeTriangleLeftBlack=57783]="NoteShapeTriangleLeftBlack",t[t.NoteShapeDiamondWhite=57784]="NoteShapeDiamondWhite",t[t.NoteShapeDiamondBlack=57785]="NoteShapeDiamondBlack",t[t.NoteShapeTriangleUpWhite=57786]="NoteShapeTriangleUpWhite",t[t.NoteShapeTriangleUpBlack=57787]="NoteShapeTriangleUpBlack",t[t.NoteShapeMoonWhite=57788]="NoteShapeMoonWhite",t[t.NoteShapeMoonBlack=57789]="NoteShapeMoonBlack",t[t.NoteShapeTriangleRoundWhite=57790]="NoteShapeTriangleRoundWhite",t[t.NoteShapeTriangleRoundBlack=57791]="NoteShapeTriangleRoundBlack",t[t.NoteQuarterUp=57813]="NoteQuarterUp",t[t.Note8thUp=57815]="Note8thUp",t[t.MetNoteQuarterUp=60581]="MetNoteQuarterUp",t[t.MetNote8thUp=60583]="MetNote8thUp",t[t.MetAugmentationDot=60599]="MetAugmentationDot",t[t.ArrowheadBlackUp=60280]="ArrowheadBlackUp",t[t.ArrowheadBlackDown=60284]="ArrowheadBlackDown",t[t.AugmentationDot=57831]="AugmentationDot",t[t.TextBlackNoteLongStem=57841]="TextBlackNoteLongStem",t[t.TextBlackNoteFrac8thLongStem=57843]="TextBlackNoteFrac8thLongStem",t[t.TextBlackNoteFrac16thLongStem=57845]="TextBlackNoteFrac16thLongStem",t[t.TextBlackNoteFrac32ndLongStem=57846]="TextBlackNoteFrac32ndLongStem",t[t.TextCont8thBeamLongStem=57848]="TextCont8thBeamLongStem",t[t.TextCont16thBeamLongStem=57850]="TextCont16thBeamLongStem",t[t.TextCont32ndBeamLongStem=57851]="TextCont32ndBeamLongStem",t[t.TextAugmentationDot=57852]="TextAugmentationDot",t[t.TextTupletBracketStartLongStem=57857]="TextTupletBracketStartLongStem",t[t.TextTuplet3LongStem=57858]="TextTuplet3LongStem",t[t.TextTupletBracketEndLongStem=57859]="TextTupletBracketEndLongStem",t[t.Tremolo3=57890]="Tremolo3",t[t.Tremolo2=57889]="Tremolo2",t[t.Tremolo1=57888]="Tremolo1",t[t.Flag8thUp=57920]="Flag8thUp",t[t.Flag8thDown=57921]="Flag8thDown",t[t.Flag16thUp=57922]="Flag16thUp",t[t.Flag16thDown=57923]="Flag16thDown",t[t.Flag32ndUp=57924]="Flag32ndUp",t[t.Flag32ndDown=57925]="Flag32ndDown",t[t.Flag64thUp=57926]="Flag64thUp",t[t.Flag64thDown=57927]="Flag64thDown",t[t.Flag128thUp=57928]="Flag128thUp",t[t.Flag128thDown=57929]="Flag128thDown",t[t.Flag256thUp=57930]="Flag256thUp",t[t.Flag256thDown=57931]="Flag256thDown",t[t.AccidentalFlat=57952]="AccidentalFlat",t[t.AccidentalNatural=57953]="AccidentalNatural",t[t.AccidentalSharp=57954]="AccidentalSharp",t[t.AccidentalDoubleSharp=57955]="AccidentalDoubleSharp",t[t.AccidentalDoubleFlat=57956]="AccidentalDoubleFlat",t[t.AccidentalQuarterToneFlatArrowUp=57968]="AccidentalQuarterToneFlatArrowUp",t[t.AccidentalQuarterToneSharpNaturalArrowUp=57970]="AccidentalQuarterToneSharpNaturalArrowUp",t[t.AccidentalThreeQuarterTonesSharpArrowUp=57972]="AccidentalThreeQuarterTonesSharpArrowUp",t[t.RepeatDot=57412]="RepeatDot",t[t.Segno=57415]="Segno",t[t.Coda=57416]="Coda",t[t.ArticAccentAbove=58528]="ArticAccentAbove",t[t.ArticAccentBelow=58529]="ArticAccentBelow",t[t.ArticStaccatoAbove=58530]="ArticStaccatoAbove",t[t.ArticStaccatoBelow=58531]="ArticStaccatoBelow",t[t.ArticTenutoAbove=58532]="ArticTenutoAbove",t[t.ArticTenutoBelow=58533]="ArticTenutoBelow",t[t.ArticMarcatoAbove=58540]="ArticMarcatoAbove",t[t.ArticMarcatoBelow=58541]="ArticMarcatoBelow",t[t.FermataAbove=58560]="FermataAbove",t[t.FermataShortAbove=58564]="FermataShortAbove",t[t.FermataLongAbove=58566]="FermataLongAbove",t[t.RestLonga=58593]="RestLonga",t[t.RestDoubleWhole=58594]="RestDoubleWhole",t[t.RestWhole=58595]="RestWhole",t[t.RestHalf=58596]="RestHalf",t[t.RestQuarter=58597]="RestQuarter",t[t.Rest8th=58598]="Rest8th",t[t.Rest16th=58599]="Rest16th",t[t.Rest32nd=58600]="Rest32nd",t[t.Rest64th=58601]="Rest64th",t[t.Rest128th=58602]="Rest128th",t[t.Rest256th=58603]="Rest256th",t[t.RestHBarLeft=58607]="RestHBarLeft",t[t.RestHBarMiddle=58608]="RestHBarMiddle",t[t.RestHBarRight=58609]="RestHBarRight",t[t.Repeat1Bar=58624]="Repeat1Bar",t[t.Repeat2Bars=58625]="Repeat2Bars",t[t.Ottava=58640]="Ottava",t[t.OttavaAlta=58641]="OttavaAlta",t[t.OttavaBassaVb=58652]="OttavaBassaVb",t[t.Quindicesima=58644]="Quindicesima",t[t.QuindicesimaAlta=58645]="QuindicesimaAlta",t[t.DynamicPPPPPP=58663]="DynamicPPPPPP",t[t.DynamicPPPPP=58664]="DynamicPPPPP",t[t.DynamicPPPP=58665]="DynamicPPPP",t[t.DynamicPPP=58666]="DynamicPPP",t[t.DynamicPP=58667]="DynamicPP",t[t.DynamicPiano=58656]="DynamicPiano",t[t.DynamicMP=58668]="DynamicMP",t[t.DynamicMF=58669]="DynamicMF",t[t.DynamicPF=58670]="DynamicPF",t[t.DynamicForte=58658]="DynamicForte",t[t.DynamicFF=58671]="DynamicFF",t[t.DynamicFFF=58672]="DynamicFFF",t[t.DynamicFFFF=58673]="DynamicFFFF",t[t.DynamicFFFFF=58674]="DynamicFFFFF",t[t.DynamicFFFFFF=58675]="DynamicFFFFFF",t[t.DynamicFortePiano=58676]="DynamicFortePiano",t[t.DynamicNiente=58662]="DynamicNiente",t[t.DynamicSforzando1=58678]="DynamicSforzando1",t[t.DynamicSforzandoPiano=58679]="DynamicSforzandoPiano",t[t.DynamicSforzandoPianissimo=58680]="DynamicSforzandoPianissimo",t[t.DynamicSforzato=58681]="DynamicSforzato",t[t.DynamicSforzatoPiano=58682]="DynamicSforzatoPiano",t[t.DynamicSforzatoFF=58683]="DynamicSforzatoFF",t[t.DynamicRinforzando1=58684]="DynamicRinforzando1",t[t.DynamicRinforzando2=58685]="DynamicRinforzando2",t[t.DynamicForzando=58677]="DynamicForzando",t[t.DynamicCrescendoHairpin=58686]="DynamicCrescendoHairpin",t[t.GraceNoteSlashStemUp=58724]="GraceNoteSlashStemUp",t[t.GraceNoteSlashStemDown=58725]="GraceNoteSlashStemDown",t[t.OrnamentTrill=58726]="OrnamentTrill",t[t.OrnamentTurn=58727]="OrnamentTurn",t[t.OrnamentTurnInverted=58728]="OrnamentTurnInverted",t[t.OrnamentShortTrill=58732]="OrnamentShortTrill",t[t.OrnamentMordent=58733]="OrnamentMordent",t[t.StringsDownBow=58896]="StringsDownBow",t[t.StringsUpBow=58898]="StringsUpBow",t[t.KeyboardPedalPed=58960]="KeyboardPedalPed",t[t.KeyboardPedalUp=58965]="KeyboardPedalUp",t[t.PictEdgeOfCymbal=59177]="PictEdgeOfCymbal",t[t.GuitarString0=59443]="GuitarString0",t[t.GuitarString1=59444]="GuitarString1",t[t.GuitarString2=59445]="GuitarString2",t[t.GuitarString3=59446]="GuitarString3",t[t.GuitarString4=59447]="GuitarString4",t[t.GuitarString5=59448]="GuitarString5",t[t.GuitarString6=59449]="GuitarString6",t[t.GuitarString7=59450]="GuitarString7",t[t.GuitarString8=59451]="GuitarString8",t[t.GuitarString9=59452]="GuitarString9",t[t.GuitarOpenPedal=59453]="GuitarOpenPedal",t[t.GuitarClosePedal=59455]="GuitarClosePedal",t[t.GuitarGolpe=59458]="GuitarGolpe",t[t.GuitarFadeIn=59459]="GuitarFadeIn",t[t.GuitarFadeOut=59460]="GuitarFadeOut",t[t.GuitarVolumeSwell=59461]="GuitarVolumeSwell",t[t.FretboardFilledCircle=59480]="FretboardFilledCircle",t[t.FretboardX=59481]="FretboardX",t[t.FretboardO=59482]="FretboardO",t[t.Tuplet0=59520]="Tuplet0",t[t.Tuplet1=59521]="Tuplet1",t[t.Tuplet2=59522]="Tuplet2",t[t.Tuplet3=59523]="Tuplet3",t[t.Tuplet4=59524]="Tuplet4",t[t.Tuplet5=59525]="Tuplet5",t[t.Tuplet6=59526]="Tuplet6",t[t.Tuplet7=59527]="Tuplet7",t[t.Tuplet8=59528]="Tuplet8",t[t.Tuplet9=59529]="Tuplet9",t[t.TupletColon=59530]="TupletColon",t[t.WiggleTrill=60068]="WiggleTrill",t[t.GuitarVibratoStroke=60082]="GuitarVibratoStroke",t[t.GuitarWideVibratoStroke=60083]="GuitarWideVibratoStroke",t[t.WiggleVibratoMediumFast=60126]="WiggleVibratoMediumFast",t[t.WiggleSawtoothNarrow=60090]="WiggleSawtoothNarrow",t[t.WiggleSawtooth=60091]="WiggleSawtooth",t[t.OctaveBaselineM=60565]="OctaveBaselineM",t[t.OctaveBaselineB=60563]="OctaveBaselineB",t[t.GuitarLeftHandTapping=59456]="GuitarLeftHandTapping",t[t.Fingering0=60688]="Fingering0",t[t.Fingering1=60689]="Fingering1",t[t.Fingering2=60690]="Fingering2",t[t.Fingering3=60691]="Fingering3",t[t.Fingering4=60692]="Fingering4",t[t.Fingering5=60693]="Fingering5",t[t.FingeringPLower=60695]="FingeringPLower",t[t.FingeringTLower=60696]="FingeringTLower",t[t.FingeringILower=60697]="FingeringILower",t[t.FingeringMLower=60698]="FingeringMLower",t[t.FingeringALower=60699]="FingeringALower",t[t.FingeringCLower=60700]="FingeringCLower"}(at||(at={})),function(t){t[t.None=0]="None",t[t.Natural=1]="Natural",t[t.Sharp=2]="Sharp",t[t.Flat=3]="Flat",t[t.NaturalQuarterNoteUp=4]="NaturalQuarterNoteUp",t[t.SharpQuarterNoteUp=5]="SharpQuarterNoteUp",t[t.FlatQuarterNoteUp=6]="FlatQuarterNoteUp",t[t.DoubleSharp=7]="DoubleSharp",t[t.DoubleFlat=8]="DoubleFlat"}(ht||(ht={}));class $t{note=null;tone=new Vt;octave=0;get realValue(){return 12*this.octave+this.tone.noteValue}}class Vt{noteValue;accidentalMode;constructor(t=0,e=b.Default){this.noteValue=t,this.accidentalMode=e}}class Ht{static getIndex(t){return t<0?0:0|Math.log2(t)}static keySignatureIsFlat(t){return t<0}static keySignatureIsNatural(t){return 0===t}static keySignatureIsSharp(t){return t>0}static applyPitchOffsets(t,e){for(let s=0;s<e.tracks.length;s++){if(s<t.notation.displayTranspositionPitches.length)for(const i of e.tracks[s].staves)i.displayTranspositionPitch=-t.notation.displayTranspositionPitches[s];if(s<t.notation.transpositionPitches.length)for(const i of e.tracks[s].staves)i.transpositionPitch=-t.notation.transpositionPitches[s]}}static isTuning(t){return!!Ht.parseTuning(t)}static tuningLetters=new Set([67,68,69,70,71,65,66,99,100,101,102,103,97,98,35]);static parseTuning(t){let e="",s="";for(let i=0;i<t.length;i++){const n=t.charCodeAt(i);if(n>=48&&n<=57){if(!e)return null;s+=String.fromCharCode(n)}else if(0===e.length){if(!Ht.tuningLetters.has(n))return null;e+=String.fromCharCode(n)}else e+=String.fromCharCode(n)}if(!s||!e)return null;const i=new $t;i.octave=Number.parseInt(s,10)+1,i.note=e.toLowerCase();const n=Ht.getToneForText(i.note);return null===n?null:(i.tone=n,i.tone.noteValue<0&&(i.octave--,i.tone.noteValue+=12),i)}static getTuningForText(t){const e=Ht.parseTuning(t);return e?e.realValue:-1}static getToneForText(t){const e=t.substring(0,1),s=t.substring(1);let i,n;switch(e.toLowerCase()){case"c":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;break;default:return null}if(!Ht.accidentalModeMapping.has(s))return null;switch(n=Ht.parseAccidentalMode(s),n){case b.Default:case b.ForceNone:case b.ForceNatural:break;case b.ForceSharp:i++;break;case b.ForceDoubleSharp:i+=2;break;case b.ForceFlat:i--;break;case b.ForceDoubleFlat:i-=2}return new Vt(i,n)}static reverseAccidentalModeMapping=new Map([[b.Default,"d"],[b.ForceNone,"forcenone"],[b.ForceNatural,"forcenatural"],[b.ForceSharp,"#"],[b.ForceDoubleSharp,"x"],[b.ForceFlat,"b"],[b.ForceDoubleFlat,"bb"]]);static accidentalModeMapping=new Map([["default",b.Default],["d",b.Default],["",b.Default],["forcenone",b.ForceNone],["-",b.ForceNone],["forcenatural",b.ForceNatural],["n",b.ForceNatural],["forcesharp",b.ForceSharp],["#",b.ForceSharp],["forcedoublesharp",b.ForceDoubleSharp],["##",b.ForceDoubleSharp],["x",b.ForceDoubleSharp],["forceflat",b.ForceFlat],["b",b.ForceFlat],["forcedoubleflat",b.ForceDoubleFlat],["bb",b.ForceDoubleFlat]]);static parseAccidentalMode(t){const e=t.toLowerCase();return Ht.accidentalModeMapping.has(e)?Ht.accidentalModeMapping.get(e):b.Default}static newGuid(){return`${Math.floor(65536*(1+Math.random())).toString(16).substring(1)+Math.floor(65536*(1+Math.random())).toString(16).substring(1)}-${Math.floor(65536*(1+Math.random())).toString(16).substring(1)}-${Math.floor(65536*(1+Math.random())).toString(16).substring(1)}-${Math.floor(65536*(1+Math.random())).toString(16).substring(1)}-${Math.floor(65536*(1+Math.random())).toString(16).substring(1)}${Math.floor(65536*(1+Math.random())).toString(16).substring(1)}${Math.floor(65536*(1+Math.random())).toString(16).substring(1)}`}static isAlmostEqualTo(t,e){return Math.abs(t-e)<1e-5}static toHexString(t,e=0){let s="";do{s=String.fromCharCode("0123456789ABCDEF".charCodeAt(15&t))+s,t>>=4}while(t>0);for(;s.length<e;)s=`0${s}`;return s}static getAlternateEndingsList(t){const e=[];for(let s=0;s<It.MaxAlternateEndings;s++)t&1<<s&&e.push(s);return e}static deltaFretToHarmonicValue(t){switch(t){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 t;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(t,e,s){return t<=e?e:t>=s?s:t}static buildMultiBarRestInfo(t,e,s){if(!t)return null;const i=t[0].score.stylesheet;if(!(t.length>1?i.multiTrackMultiBarRest:!0===i.perTrackMultiBarRest?.has(t[0].index)))return null;const n=new Map,r=t[0].score;let a=e,h=r.tempo;for(;a<=s;){const i=a;let o=null;for(;a<=s;){const s=r.masterBars[a];let n=!1;for(const t of s.tempoAutomations)t.value!==h&&(n=!0),h=t.value;if(s.alternateEndings||s.isRepeatStart&&s.index!==i||s.isFreeTime||s.isAnacrusis||null!==s.section||s.index!==i&&n||null!==s.fermata&&s.fermata.size>0||null!==s.directions&&s.directions.size>0)break;if(i>e&&s.previousMasterBar&&(s.timeSignatureCommon!==s.previousMasterBar.timeSignatureCommon||s.timeSignatureNumerator!==s.previousMasterBar.timeSignatureNumerator||s.timeSignatureDenominator!==s.previousMasterBar.timeSignatureDenominator||s.tripletFeel!==s.previousMasterBar.tripletFeel))break;let c=!0;for(const e of t){for(const t of e.staves){const e=t.bars[s.index];if(!e.isRestOnly){c=!1;break}if(e.index>0&&(e.keySignature!==e.previousBar.keySignature||e.keySignatureType!==e.previousBar.keySignatureType)){c=!1;break}}if(!c)break}if(!c)break;if(a++,s.index>i&&(null===o?o=[s.index]:o.push(s.index)),s.isRepeatEnd)break}o?n.set(i,o):a++}return n}static computeFirstDisplayedBarIndex(t,e){let s=e.display.startBar;return s--,s=Math.min(t.masterBars.length-1,Math.max(0,s)),s}static computeLastDisplayedBarIndex(t,e,s){let i=e.display.barCount;return i<0&&(i=t.masterBars.length),i=s+i-1,i=Math.min(t.masterBars.length-1,Math.max(0,i)),i}static getOrCreateHeaderFooterStyle(t,e){let s,i=t.style;if(t.style||(i=new Rt,t.style=i),i.headerAndFooter.has(e))s=i.headerAndFooter.get(e);else{if(s=new Wt,Rt.defaultHeaderAndFooter.has(e)){const t=Rt.defaultHeaderAndFooter.get(e);s.template=t.template,s.textAlign=t.textAlign}i.headerAndFooter.set(e,s)}return s}static consolidate(t){if(0===t.masterBars.length){const e=new It;t.addMasterBar(e);const s=new $;s.isLinear=!1,s.type=r.Tempo,s.value=t.tempo,e.tempoAutomations.push(s);const i=new Q;t.tracks[0].staves[0].addBar(i);const n=new et;i.addVoice(n);const a=new Kt;return a.isEmpty=!0,void n.addBeat(a)}const e=new Set([Gt.PercussionChannel]);for(const s of t.tracks){if(1===s.staves.length&&s.staves[0].isPercussion)s.playbackInfo.primaryChannel=Gt.PercussionChannel,s.playbackInfo.secondaryChannel=Gt.PercussionChannel;else{if(s.playbackInfo.primaryChannel!==Gt.PercussionChannel)for(;e.has(s.playbackInfo.primaryChannel);)s.playbackInfo.primaryChannel++;if(e.add(s.playbackInfo.primaryChannel),s.playbackInfo.secondaryChannel!==Gt.PercussionChannel)for(;e.has(s.playbackInfo.secondaryChannel);)s.playbackInfo.secondaryChannel++;e.add(s.playbackInfo.secondaryChannel)}for(const e of s.staves){for(const t of e.bars)for(const e of t.voices)if(e.isEmpty&&0===e.beats.length){const t=new Kt;t.isEmpty=!0,e.addBeat(t)}const s=0===e.bars.length?1:e.bars[0].voices.length;for(;e.bars.length<t.masterBars.length;){const t=new Q;e.addBar(t);const i=t.previousBar;i&&(t.clef=i.clef,t.clefOttava=i.clefOttava,t.keySignature=t.previousBar.keySignature,t.keySi