UNPKG

@coderline/alphatab

Version:

alphaTab is a music notation and guitar tablature rendering library

51 lines 1.05 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 */ class t{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 e{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 s,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,F,C,A,D,L;void 0===Symbol.dispose&&(Symbol.dispose=Symbol("Symbol.dispose")),"undefined"!=typeof window&&("ResizeObserver"in globalThis||(globalThis.ResizeObserver=t),"IntersectionObserver"in globalThis||(globalThis.IntersectionObserver=e),"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)}),function(t){t[t.General=0]="General",t[t.Format=1]="Format",t[t.AlphaTex=2]="AlphaTex"}(s||(s={}));class W 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"}(i||(i={}));class R{static QuarterTime=960;static k=15;static VelocityIncrement=16;static ticksToMillis(t,e){return t*(6e4/(e*R.QuarterTime))|0}static millisToTicks(t,e){return t/(6e4/(e*R.QuarterTime))|0}static toTicks(t){return R.valueToTicks(t)}static valueToTicks(t){let e=t;return e<0&&(e=1/-e),R.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 i.PPP:s=R.k+0*R.VelocityIncrement;break;case i.PP:s=R.k+1*R.VelocityIncrement;break;case i.P:s=R.k+2*R.VelocityIncrement;break;case i.MP:s=R.k+3*R.VelocityIncrement;break;case i.MF:s=R.k+4*R.VelocityIncrement;break;case i.F:s=R.k+5*R.VelocityIncrement;break;case i.FF:s=R.k+6*R.VelocityIncrement;break;case i.FFF:s=R.k+7*R.VelocityIncrement;break;case i.PPPP:s=10;break;case i.PPPPP:s=5;break;case i.PPPPPP:s=3;break;case i.FFFF:s=R.k+8*R.VelocityIncrement;break;case i.FFFFF:s=R.k+9*R.VelocityIncrement;break;case i.FFFFFF:s=R.k+10*R.VelocityIncrement;break;case i.SF:case i.SFP:case i.SFZP:case i.SFPP:case i.SFZ:case i.FZ:s=R.k+6*R.VelocityIncrement;break;case i.FP:case i.RF:case i.RFZ:case i.SFFZ:s=R.k+5*R.VelocityIncrement;break;case i.N:s=1;break;case i.PF:s=R.k+(4.5*R.VelocityIncrement|0)}return s+=e*R.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"}(n||(n={}));class I{barOccurence=0;millisecondOffset=0}class G{isLinear=!1;type=n.Tempo;value=0;syncPointValue;ratioPosition=0;text="";isVisible=!0;static buildTempoAutomation(t,e,s,i,r=!0){(i<1||i>5)&&(i=2);const a=new Float32Array([1,.5,1,1.5,2,3]),h=new G;return h.type=n.Tempo,h.isLinear=t,h.ratioPosition=e,h.value=s*a[i],h.isVisible=r,h}static buildInstrumentAutomation(t,e,s){const i=new G;return i.type=n.Instrument,i.isLinear=t,i.ratioPosition=e,i.value=s,i}}class ${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"}(r||(r={})),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"}(a||(a={})),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"}(h||(h={})),function(t){t[t.None=0]="None",t[t.Crescendo=1]="Crescendo",t[t.Decrescendo=2]="Decrescendo"}(o||(o={})),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"}(c||(c={})),function(t){t[t.None=0]="None",t[t.OnBeat=1]="OnBeat",t[t.BeforeBeat=2]="BeforeBeat",t[t.BendGrace=3]="BendGrace"}(l||(l={})),function(t){t[t.None=0]="None",t[t.Normal=1]="Normal",t[t.Heavy=2]="Heavy",t[t.Tenuto=3]="Tenuto"}(u||(u={})),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"}(d||(d={})),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"}(f||(f={})),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"}(p||(p={})),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"}(b||(b={})),function(t){t[t.None=0]="None",t[t.IntoFromBelow=1]="IntoFromBelow",t[t.IntoFromAbove=2]="IntoFromAbove"}(m||(m={})),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"}(g||(g={})),function(t){t[t.None=0]="None",t[t.Slight=1]="Slight",t[t.Wide=2]="Wide"}(w||(w={})),function(t){t[t.Hidden=0]="Hidden",t[t.ShowWithBeams=1]="ShowWithBeams",t[t.ShowWithBars=2]="ShowWithBars",t[t.Automatic=3]="Automatic"}(y||(y={})),function(t){t[t.ScoreDefault=0]="ScoreDefault",t[t.ScoreForcePiano=1]="ScoreForcePiano",t[t.SingleNoteEffectBand=2]="SingleNoteEffectBand",t[t.SingleNoteEffectBandForcePiano=3]="SingleNoteEffectBandForcePiano"}(k||(k={})),function(t){t[t.GuitarPro=0]="GuitarPro",t[t.SongBook=1]="SongBook"}(S||(S={})),function(t){t[t.ScoreTitle=0]="ScoreTitle",t[t.ScoreSubTitle=1]="ScoreSubTitle",t[t.ScoreArtist=2]="ScoreArtist",t[t.ScoreAlbum=3]="ScoreAlbum",t[t.ScoreWords=4]="ScoreWords",t[t.ScoreMusic=5]="ScoreMusic",t[t.ScoreWordsAndMusic=6]="ScoreWordsAndMusic",t[t.ScoreCopyright=7]="ScoreCopyright",t[t.GuitarTuning=8]="GuitarTuning",t[t.TrackNames=9]="TrackNames",t[t.ChordDiagrams=10]="ChordDiagrams",t[t.ParenthesisOnTiedBends=11]="ParenthesisOnTiedBends",t[t.TabNotesOnTiedBends=12]="TabNotesOnTiedBends",t[t.ZerosOnDiveWhammys=13]="ZerosOnDiveWhammys",t[t.EffectAlternateEndings=14]="EffectAlternateEndings",t[t.EffectCapo=15]="EffectCapo",t[t.EffectChordNames=16]="EffectChordNames",t[t.EffectCrescendo=17]="EffectCrescendo",t[t.EffectDynamics=18]="EffectDynamics",t[t.EffectFadeIn=19]="EffectFadeIn",t[t.EffectFermata=20]="EffectFermata",t[t.EffectFingering=21]="EffectFingering",t[t.EffectHarmonics=22]="EffectHarmonics",t[t.EffectLetRing=23]="EffectLetRing",t[t.EffectLyrics=24]="EffectLyrics",t[t.EffectMarker=25]="EffectMarker",t[t.EffectOttavia=26]="EffectOttavia",t[t.EffectPalmMute=27]="EffectPalmMute",t[t.EffectPickSlide=28]="EffectPickSlide",t[t.EffectPickStroke=29]="EffectPickStroke",t[t.EffectSlightBeatVibrato=30]="EffectSlightBeatVibrato",t[t.EffectSlightNoteVibrato=31]="EffectSlightNoteVibrato",t[t.EffectTap=32]="EffectTap",t[t.EffectTempo=33]="EffectTempo",t[t.EffectText=34]="EffectText",t[t.EffectTrill=35]="EffectTrill",t[t.EffectTripletFeel=36]="EffectTripletFeel",t[t.EffectWhammyBar=37]="EffectWhammyBar",t[t.EffectWideBeatVibrato=38]="EffectWideBeatVibrato",t[t.EffectWideNoteVibrato=39]="EffectWideNoteVibrato",t[t.EffectLeftHandTap=40]="EffectLeftHandTap",t[t.EffectFreeTime=41]="EffectFreeTime",t[t.EffectSustainPedal=42]="EffectSustainPedal",t[t.EffectGolpe=43]="EffectGolpe",t[t.EffectWahPedal=44]="EffectWahPedal",t[t.EffectBeatBarre=45]="EffectBeatBarre",t[t.EffectNoteOrnament=46]="EffectNoteOrnament",t[t.EffectRasgueado=47]="EffectRasgueado",t[t.EffectDirections=48]="EffectDirections",t[t.EffectBeatTimer=49]="EffectBeatTimer"}(B||(B={}));class V{notationMode=S.GuitarPro;fingeringMode=k.ScoreDefault;elements=new Map;static defaultElements=new Map([[B.ZerosOnDiveWhammys,!1]]);rhythmMode=y.Automatic;rhythmHeight=15;transpositionPitches=[];displayTranspositionPitches=[];smallGraceTabNotes=!0;extendBendArrowsOnTiedNotes=!0;extendLineEffectsToBeatEnd=!1;slurHeight=5;isNotationElementVisible(t){return this.elements.has(t)?this.elements.get(t):!V.defaultElements.has(t)||V.defaultElements.get(t)}}class H{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}}!function(t){t[t.None=0]="None",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warning=3]="Warning",t[t.Error=4]="Error"}(_||(_={}));class U{static logLevel=_.Info;static W(t,e){return`[AlphaTab][${t}] ${e}`}debug(t,e,...s){console.debug(U.W(t,e),...s)}warning(t,e,...s){console.warn(U.W(t,e),...s)}info(t,e,...s){console.info(U.W(t,e),...s)}error(t,e,...s){console.error(U.W(t,e),...s)}}class z{static logLevel=_.Info;static log=new U;static O(t){return z.logLevel!==_.None&&t>=z.logLevel}static debug(t,e,...s){z.O(_.Debug)&&z.log.debug(t,e,...s)}static warning(t,e,...s){z.O(_.Warning)&&z.log.warning(t,e,...s)}static info(t,e,...s){z.O(_.Info)&&z.log.info(t,e,...s)}static error(t,e,...s){z.O(_.Error)&&z.log.error(t,e,...s)}}!function(t){t[t.NoBrackets=0]="NoBrackets",t[t.GroupStaves=1]="GroupStaves",t[t.GroupSimilarInstruments=2]="GroupSimilarInstruments"}(x||(x={})),function(t){t[t.Hidden=0]="Hidden",t[t.FirstSystem=1]="FirstSystem",t[t.AllSystems=2]="AllSystems"}(T||(T={})),function(t){t[t.FullName=0]="FullName",t[t.ShortName=1]="ShortName"}(M||(M={})),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(v||(v={}));class j{hideDynamics=!1;bracketExtendMode=x.GroupStaves;useSystemSignSeparator=!1;globalDisplayTuning=!0;perTrackDisplayTuning=null;globalDisplayChordDiagramsOnTop=!0;perTrackChordDiagramsOnTop=null;singleTrackTrackNamePolicy=T.FirstSystem;multiTrackTrackNamePolicy=T.FirstSystem;firstSystemTrackNameMode=M.ShortName;otherSystemsTrackNameMode=M.ShortName;firstSystemTrackNameOrientation=v.Vertical;otherSystemsTrackNameOrientation=v.Vertical;multiTrackMultiBarRest=!1;perTrackMultiBarRest=null}class X{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 J{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"}(N||(N={})),function(t){t[t.None=0]="None",t[t.Simple=1]="Simple",t[t.FirstOfDouble=2]="FirstOfDouble",t[t.SecondOfDouble=3]="SecondOfDouble"}(P||(P={})),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"}(E||(E={})),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"}(C||(C={}));class q{ratioPosition=0;pedalType=C.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"}(A||(A={}));class Y extends J{}!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"}(D||(D={}));class K{static R=0;static resetIds(){K.R=0}id=K.R++;index=0;nextBar=null;previousBar=null;clef=N.G2;clefOttava=b.Regular;staff;voices=[];simileMark=P.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!==P.None||this.sustainPedals.length>0||this.barLineLeft!==D.Automatic||this.barLineRight!==D.Automatic)}get isRestOnly(){return this.V}barLineLeft=D.Automatic;barLineRight=D.Automatic;keySignature=E.C;keySignatureType=F.Major;getActualBarLineLeft(t){return K.H(this,!1,t)}getActualBarLineRight(){return K.H(this,!0,!1)}static U(t,e,s){let i;return i=e?t.isRepeatEnd?D.LightHeavy:t.nextMasterBar?t.isFreeTime?D.Dashed:t.isDoubleBar?D.LightLight:D.Regular:D.LightHeavy:t.isRepeatStart?D.HeavyLight:s?D.Regular:D.None,i}static H(t,e,s){const i=t.masterBar,n=e?t.barLineRight:t.barLineLeft;let r;return r=n===D.Automatic?K.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===C.Up&&(t=null));const e=null!==t&&t.pedalType!==C.Up;for(const i of s){if(t&&t.pedalType!==C.Up){if(t.bar===this&&i.ratioPosition<=t.ratioPosition)continue;t.nextPedalMarker=i,i.previousPedalMarker=t}e&&i.pedalType===C.Down&&(i.pedalType=C.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!==C.Up){const e=new q;e.ratioPosition=0,e.bar=this,e.pedalType=C.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 Q{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"}(L||(L={}));class Z extends J{}let tt=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===l.None?(i.graceGroup=s,s&&(s.isComplete=!0),s=null):(s||(s=new Q),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===l.None){if(r.graceGroup){const t=r.graceGroup.beats[0],e=r.graceGroup.beats[r.graceGroup.beats.length-1];if(t.graceType!==l.BendGrace){const s=e.playbackStart+e.playbackDuration-t.playbackStart;switch(t.graceType){case l.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 l.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 et,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,Ft,Ct;!function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right"}(et||(et={})),function(t){t[t.Top=0]="Top",t[t.Middle=1]="Middle",t[t.Bottom=2]="Bottom",t[t.Alphabetic=3]="Alphabetic"}(st||(st={}));class At{width;height;constructor(t,e){this.width=t,this.height=e}}class Dt{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"}(it||(it={}));class Lt{template;isVisible;textAlign;constructor(t="",e=void 0,s=et.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(Lt.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 Wt extends J{headerAndFooter=new Map;static defaultHeaderAndFooter=new Map([[it.Title,new Lt("%TITLE%",void 0,et.Center)],[it.SubTitle,new Lt("%SUBTITLE%",void 0,et.Center)],[it.Artist,new Lt("%ARTIST%",void 0,et.Center)],[it.Album,new Lt("%ALBUM%",void 0,et.Center)],[it.Words,new Lt("Words by %WORDS%",void 0,et.Left)],[it.Music,new Lt("Music by %MUSIC%",void 0,et.Right)],[it.WordsAndMusic,new Lt("Words & Music by %MUSIC%",void 0,et.Right)],[it.Transcriber,new Lt("Tabbed by %TABBER%",!1,et.Right)],[it.Copyright,new Lt("%COPYRIGHT%",void 0,et.Center)],[it.CopyrightSecondLine,new Lt("All Rights Reserved - International Copyright Secured",!0,et.Center)]])}class Ot{Y=null;K=[];Z=0;static resetIds(){K.resetIds(),Yt.resetIds(),tt.resetIds(),Xt.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 j;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 X,this.K.push(this.Y),this.Z++):this.Y||(this.Y=new X,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 G;t.ratioPosition=Math.min(1,Math.max(0,e.barPosition)),t.type=n.SyncPoint,t.syncPointValue=new I,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"}(nt||(nt={}));class Rt{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=nt.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*R.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 It{static DefaultChannelCount=17;static MetronomeChannel=It.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=It.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"}(rt||(rt={})),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"}(at||(at={}));class Gt{note=null;tone=new $t;octave=0;get realValue(){return 12*this.octave+this.tone.noteValue}}class $t{noteValue;accidentalMode;constructor(t=0,e=p.Default){this.noteValue=t,this.accidentalMode=e}}class Vt{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!!Vt.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(!Vt.tuningLetters.has(n))return null;e+=String.fromCharCode(n)}else e+=String.fromCharCode(n)}if(!s||!e)return null;const i=new Gt;i.octave=Number.parseInt(s,10)+1,i.note=e.toLowerCase();const n=Vt.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=Vt.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(!Vt.accidentalModeMapping.has(s))return null;switch(n=Vt.parseAccidentalMode(s),n){case p.Default:case p.ForceNone:case p.ForceNatural:break;case p.ForceSharp:i++;break;case p.ForceDoubleSharp:i+=2;break;case p.ForceFlat:i--;break;case p.ForceDoubleFlat:i-=2}return new $t(i,n)}static reverseAccidentalModeMapping=new Map([[p.Default,"d"],[p.ForceNone,"forcenone"],[p.ForceNatural,"forcenatural"],[p.ForceSharp,"#"],[p.ForceDoubleSharp,"x"],[p.ForceFlat,"b"],[p.ForceDoubleFlat,"bb"]]);static accidentalModeMapping=new Map([["default",p.Default],["d",p.Default],["",p.Default],["forcenone",p.ForceNone],["-",p.ForceNone],["forcenatural",p.ForceNatural],["n",p.ForceNatural],["forcesharp",p.ForceSharp],["#",p.ForceSharp],["forcedoublesharp",p.ForceDoubleSharp],["##",p.ForceDoubleSharp],["x",p.ForceDoubleSharp],["forceflat",p.ForceFlat],["b",p.ForceFlat],["forcedoubleflat",p.ForceDoubleFlat],["bb",p.ForceDoubleFlat]]);static parseAccidentalMode(t){const e=t.toLowerCase();return Vt.accidentalModeMapping.has(e)?Vt.accidentalModeMapping.get(e):p.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<Rt.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 Wt,t.style=i),i.headerAndFooter.has(e))s=i.headerAndFooter.get(e);else{if(s=new Lt,Wt.defaultHeaderAndFooter.has(e)){const t=Wt.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 Rt;t.addMasterBar(e);const s=new G;s.isLinear=!1,s.type=n.Tempo,s.value=t.tempo,e.tempoAutomations.push(s);const i=new K;t.tracks[0].staves[0].addBar(i);const r=new tt;i.addVoice(r);const a=new Yt;return a.isEmpty=!0,void r.addBeat(a)}const e=new Set([It.PercussionChannel]);for(const s of t.tracks){if(1===s.staves.length&&s.staves[0].isPercussion)s.playbackInfo.primaryChannel=It.PercussionChannel,s.playbackInfo.secondaryChannel=It.PercussionChannel;else{if(s.playbackInfo.primaryChannel!==It.PercussionChannel)for(;e.has(s.playbackInfo.primaryChannel);)s.playbackInfo.primaryChannel++;if(e.add(s.playbackInfo.primaryChannel),s.playbackInfo.secondaryChannel!==It.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 Yt;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 K;e.addBar(t);const i=t.previousBar;i&&(t.clef=i.clef,t.clefOttava=i.clefOttava,t.keySignature=t.previousBar.keySignature,t.keySignatureType=t.previousBar.keySignatureType);for(let e=0;e<s;e++){const e=new tt;t.addVoice(e);const s=new Yt;s.isEmpty=!0,e.addBeat(s)}}}}if(t.masterBars.length>0){if(!t.masterBars[0].tempoAutomations.find(t=>t.type===n.Tempo&&0===t.ratioPosition)){const e=new G;e.isLinear=!1,e.type=n.Tempo,e.value=t.tempo,e.text=t.tempoLabel,e.isVisible=!1,t.masterBars[0].tempoAutomations.push(e)}}}static trimEmptyBarsAtEnd(t){for(;t.masterBars.length>1;){const e=t.masterBars.length-1,s=t.masterBars[e];if(s.hasChanges)return;for(const s of t.tracks)for(const t of s.staves)if(e<t.bars.length){const s=t.