PageSourceSearch

https://clefline.pages.dev/assets/osmd-DSRaEtby.js

js clefline.pages.dev collected 2026-10-03 06:38:52 UTC 1,132,978 bytes, 79 lines download raw bytes

1import{i as Vi,r as Ql}from"./rolldown-runtime-BPhFYGVA.js";var sc=Ql({AClassHierarchyTrackable:()=>no,AJAX:()=>qa,AbstractGraphicalExpression:()=>Cs,AbstractGraphicalInstruction:()=>ju,AbstractNotationInstruction:()=>br,AccidentalCalculator:()=>yo,AccidentalEnum:()=>q,AlignRestOption:()=>ms,AlignmentManager:()=>rl,AlignmentType:()=>Pt,Appearance:()=>Sh,ArgumentOutOfRangeException:()=>gi,Arpeggio:()=>ml,ArpeggioType:()=>Ge,ArticulationEnum:()=>Et,ArticulationReader:()=>Nl,AutoColorSet:()=>Yr,BackendType:()=>ni,Beam:()=>fr,BeamEnum:()=>Mu,BoundingBox:()=>Yt,CanvasVexFlowBackend:()=>Pr,ChordDegreeText:()=>gs,ChordSymbolContainer:()=>rr,ChordSymbolEnum:()=>Gt,ChordSymbolReader:()=>Il,ClefEnum:()=>yt,ClefInstruction:()=>Zt,Clickable:()=>go,ColDirEnum:()=>re,CollectionUtil:()=>Le,ColoringModes:()=>bi,Cursor:()=>Ja,CursorType:()=>ri,CurvePositionEnum:()=>mn,CustomChord:()=>Kr,Degree:()=>oo,DrawingMode:()=>xu,DrawingParameters:()=>mr,DrawingParametersEnum:()=>Ve,EngravingRules:()=>Li,ExpressionReader:()=>kl,FillEmptyMeasuresWithWholeRests:()=>An,FontStyles:()=>Qt,Fonts:()=>jr,Fraction:()=>N,Glissando:()=>Fl,GraphicalChordSymbolContainer:()=>da,GraphicalComment:()=>Ku,GraphicalContinuousDynamicExpression:()=>Es,GraphicalCurve:()=>fa,GraphicalGlissando:()=>nl,GraphicalInstantaneousDynamicExpression:()=>aa,GraphicalInstantaneousTempoExpression:()=>Yi,GraphicalLabel:()=>pe,GraphicalLayers:()=>$t,GraphicalLine:()=>Ae,GraphicalLyricEntry:()=>Mi,GraphicalLyricWord:()=>vl,GraphicalMarkedArea:()=>qu,GraphicalMeasure:()=>Ni,GraphicalMusicPage:()=>sr,GraphicalMusicSheet:()=>nr,GraphicalNote:()=>In,GraphicalObject:()=>ue,GraphicalOctaveShift:()=>ll,GraphicalRectangle:()=>Ju,GraphicalSlur:()=>Ss,GraphicalStaffEntry:()=>Nn,GraphicalStaffEntryLink:()=>$u,GraphicalTie:()=>El,GraphicalVoiceEntry:()=>Bn,ITextTranslation:()=>Tt,IXmlElement:()=>Rn,Instrument:()=>cr,InstrumentReader:()=>Ol,InstrumentalGroup:()=>ia,InvalidEnumArgumentException:()=>io,KeyEnum:()=>ai,KeyInstruction:()=>ye,Label:()=>Nt,LinkedVoice:()=>ki,LyricsReader:()=>Rl,MXLFile:()=>Xl,MXLHelper:()=>ga,MappingSourceMusicPart:()=>Yu,Matrix2D:()=>Sn,MeasureBuildParameters:()=>Mh,MidiInstrument:()=>lt,MusicPartManager:()=>Tl,MusicPartManagerIterator:()=>xn,MusicSheet:()=>ma,MusicSheetCalculator:()=>Xt,MusicSheetDrawer:()=>fl,MusicSheetErrors:()=>Pl,MusicSheetReader:()=>zl,MusicSheetReadingException:()=>Se,MusicSymbol:()=>Ce,MusicSymbolDrawingStyle:()=>$s,MusicSymbolModuleFactory:()=>Pn,MusicSystem:()=>sl,MusicSystemBuilder:()=>Jr,Note:()=>Di,NoteEnum:()=>ut,NoteEnumToHalfToneLink:()=>gh,NoteHeadShape:()=>Vt,NoteState:()=>eo,NoteType:()=>_r,NoteTypeHandler:()=>Zi,Notehead:()=>xo,OSMDColor:()=>ec,OSMDOptions:()=>Xr,OUTLINE_AND_FILL_STYLE_DICT:()=>Bt,OctaveShiftParams:()=>So,OpenSheetMusicDisplay:()=>jl,OrnamentContainer:()=>fo,OrnamentEnum:()=>he,OutlineAndFillStyleEnum:()=>At,PSMath:()=>tc,PageFormat:()=>Te,PagePlacementEnum:()=>ao,PartListEntry:()=>pa,PhonicScoreModes:()=>Zs,Pitch:()=>Ct,PointF2D:()=>k,ReaderPluginManager:()=>Ul,RectangleF2D:()=>Ze,Repetition:()=>Ls,RepetitionBuildingContainer:()=>Wl,RepetitionCalculator:()=>Gl,RepetitionEndingPart:()=>Mn,RepetitionInstruction:()=>Lt,RepetitionInstructionComparer:()=>ar,RepetitionInstructionEnum:()=>J,RepetitionInstructionReader:()=>Vl,RhythmInstruction:()=>Re,RhythmSymbolEnum:()=>Ke,SelectionEndSymbol:()=>Zu,SelectionStartSymbol:()=>Qu,SizeF2D:()=>Xi,SkyBottomLineBatchCalculatorBackendType:()=>ir,SkyBottomLineCalculator:()=>ul,SlurReader:()=>Dl,SourceMeasure:()=>_l,SourceMusicPart:()=>vn,SourceStaffEntry:()=>be,Staff:()=>il,StaffEntryLink:()=>Cl,StaffLine:()=>cl,StaffLineActivitySymbol:()=>ha,StavePositionEnum:()=>Qs,StemDirectionType:()=>Rt,StyleSets:()=>mh,SubInstrument:()=>gr,SvgVexFlowBackend:()=>dr,SystemBuildParameters:()=>zs,SystemImageProperties:()=>bh,SystemLine:()=>sa,SystemLinePosition:()=>wi,SystemLinesEnum:()=>ft,SystemLinesEnumHelper:()=>mo,TechnicalInstruction:()=>bo,TechnicalInstructionType:()=>xs,TempoSorter:()=>_n,TemposCalculator:()=>Yl,TextAlignment:()=>Gs,TextAlignmentEnum:()=>mt,Tie:()=>Al,TieTypes:()=>Ws,TimestampTransform:()=>En,TransposeCalculator:()=>ql,Tuplet:()=>wn,VerticalGraphicalStaffEntryContainer:()=>hs,VerticalSourceStaffEntryContainer:()=>
1bs,VexFlowBackend:()=>ra,VexFlowBackends:()=>vu,VexFlowContinuousDynamicExpression:()=>Tr,VexFlowConverter:()=>Ht,VexFlowGlissando:()=>dn,VexFlowGraphicalNote:()=>ts,VexFlowGraphicalSymbolFactory:()=>yl,VexFlowInstantaneousDynamicExpression:()=>ol,VexFlowInstrumentBrace:()=>fn,VexFlowInstrumentBracket:()=>oa,VexFlowMeasure:()=>Qi,VexFlowMultiRestMeasure:()=>na,VexFlowMusicSheetCalculator:()=>ys,VexFlowMusicSheetDrawer:()=>pl,VexFlowMusicSystem:()=>gl,VexFlowOctaveShift:()=>pn,VexFlowSlur:()=>_u,VexFlowStaffEntry:()=>la,VexFlowStaffLine:()=>ua,VexFlowTabMeasure:()=>dl,VexFlowTextMeasurer:()=>ca,VexFlowVoiceEntry:()=>Lr,VexflowStafflineNoteCalculator:()=>gn,Voice:()=>Rs,VoiceEntry:()=>As,VoiceGenerator:()=>Tn,unitInPixels:()=>10}),th=Object.create,er=Object.defineProperty,eh=Object.getOwnPropertyDescriptor,ih=Object.getOwnPropertyNames,sh=Object.getPrototypeOf,rh=Object.prototype.hasOwnProperty,nh=(e,t)=>()=>(e&&(t=e(e=0)),t),xe=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),ah=(e,t)=>{let i={};for(var s in e)er(i,s,{get:e[s],enumerable:!0});return t||er(i,Symbol.toStringTag,{value:"Module"}),i},oh=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(var r=ih(t),n=0,a=r.length,o;n<a;n++)o=r[n],!rh.call(e,o)&&o!==i&&er(e,o,{get:(l=>t[l]).bind(null,o),enumerable:!(s=eh(t,o))||s.enumerable});return e},Ka=(e,t,i)=>(i=e==null?{}:th(sh(e)),oh(t||!e||!e.__esModule?er(i,"default",{value:e,enumerable:!0}):i,e)),ks=(e=>typeof Vi<"u"?Vi:typeof Proxy<"u"?new Proxy(e,{get:(t,i)=>(typeof Vi<"u"?Vi:t)[i]}):e)(function(e){if(typeof Vi<"u")return Vi.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")}),qa=class{static ajax(e,t=9e3){let i,s=e.indexOf(".mxl")>-1?"text/plain; charset=x-user-defined":"application/xml";if(XMLHttpRequest)i=new XMLHttpRequest;else if(ActiveXObject)i=new ActiveXObject("Microsoft.XMLHTTP");else return Promise.reject(Error("XMLHttp not supported."));return i.timeout=t,new Promise((r,n)=>{i.onreadystatechange=()=>{i.readyState===XMLHttpRequest.DONE&&(i.status===200||i.status===0&&i.responseText?r(i.responseText):n(Error("Could not retrieve requested URL "+i.status)))},i.ontimeout=a=>{n(Error("Server request Timeout"))},i.overrideMimeType(s),i.open("GET",e,!0),i.send()})}},Rr,N=class De{static max(t,i){return t.RealValue>i.RealValue?t:i}static Equal(t,i){return t.wholeValue===i.wholeValue&&t.Denominator===i.Denominator&&t.Numerator===i.Numerator}static createFromFraction(t){return new De(t.numerator,t.denominator,t.wholeValue,!1)}static plus(t,i){let s=t.clone();return s.Add(i),s}static minus(t,i){let s=t.clone();return s.Sub(i),s}static multiply(t,i){return new De((t.wholeValue*t.denominator+t.numerator)*(i.wholeValue*i.denominator+i.numerator),t.denominator*i.denominator)}static greatestCommonDenominator(t,i){if(t===0)return i;if(i===1)return 1;for(;Math.abs(i)>=1&&Math.abs(t)>=1;)t>i?t-=i:i-=t;return Math.max(Math.round(t),1)}constructor(t=0,i=1,s=0,r=!0){this.numerator=0,this.denominator=1,this.wholeValue=0,this.numerator=t,this.denominator=i,this.wholeValue=s,r&&this.simplify(),this.setRealValue()}toString(){let t=this.numerator+"/"+this.denominator;return this.wholeValue!==0&&(t=this.wholeValue+" "+t),t}clone(){return new De(this.numerator,this.denominator,this.wholeValue,!1)}get Numerator(){return this.numerator}set Numerator(t){this.numerator!==t&&(this.numerator=t,this.simplify(),this.setRealValue())}get Denominator(){return this.denominator}set Denominator(t){this.denominator!==t&&(this.denominator=t,this.numerator!==0&&this.simplify(),this.setRealValue())}get WholeValue(){return this.wholeValue}set WholeValue(t){this.wholeValue!==t&&(this.wholeValue=t,this.setRealValue())}GetExpandedNumerator(){return this.wholeValue*this.denominator+this.numerator}calculateNumberOfNeededDots(){let t=1,i=2,s=this.GetExpandedNumerator();for(;i<s;)t++,i=2**t;return Math.min(3,t-1)}IsNegative(){return this.realValue<0}get RealValue(){return this.realValue}expand(t){this.numerator*=t,this.denominator*=t,this.wholeValue!==0&&(this.numerator+=this.wholeValue*this.denominator,this.wholeValue=0)}Add(t){return this.numerator=(this.wholeValue*this.denominator+this.numerator)*t.denominator+(t.wholeValue*t.denominator+t.numerator)*this.denominator,this.denominator*=t.de
1nominator,this.wholeValue=0,this.simplify(),this.setRealValue(),this}Sub(t){return this.numerator=(this.wholeValue*this.denominator+this.numerator)*t.denominator-(t.wholeValue*t.denominator+t.numerator)*this.denominator,this.denominator*=t.denominator,this.wholeValue=0,this.simplify(),this.setRealValue(),this}Quantize(t){if(this.denominator<=t)return this;let i=new De(this.numerator+1,this.denominator,this.wholeValue);for(;i.Denominator>t;)i.Numerator++;if(this.numerator>this.denominator){let s=new De(this.numerator-1,this.denominator,this.wholeValue);for(;s.Denominator>t;)s.Numerator--;if(s.Denominator<i.Denominator)return s}return i}Equals(t){return this.realValue===t?.realValue}CompareTo(t){let i=this.realValue-t.realValue;return i?i<0?-1:1:0}lt(t){return this.realValue<t.realValue}lte(t){return this.realValue<=t.realValue}gt(t){return!this.lte(t)}gte(t){return!this.lt(t)}setRealValue(){this.realValue=this.wholeValue+this.numerator/this.denominator}simplify(){if(this.numerator===0){this.denominator=1;return}let t=De.greatestCommonDenominator(Math.abs(this.numerator),Math.abs(this.denominator));this.numerator/=t,this.denominator/=t;let i=Math.floor(this.numerator/this.denominator);if(i!==0&&(this.wholeValue+=i,this.numerator-=i*this.denominator,this.numerator===0&&(this.denominator=1)),this.denominator>De.maximumAllowedNumber){let s=this.denominator/De.maximumAllowedNumber;this.numerator=Math.round(this.numerator/s),this.denominator=Math.round(this.denominator/s)}if(this.numerator>De.maximumAllowedNumber){let s=this.numerator/De.maximumAllowedNumber;this.numerator=Math.round(this.numerator/s),this.denominator=Math.round(this.denominator/s)}}isOnBeat(t){let i=this.distanceFromBeat(t);return Math.abs(i)<De.FloatInaccuracyTolerance}distanceFromBeat(t){let i=new De(1,t.Denominator);return this.RealValue%i.RealValue}};Rr=N,Rr.maximumAllowedNumber=46340,Rr.FloatInaccuracyTolerance=1e-4;var Ve=(function(e){return e.allon="allon",e.compact="compact",e.compacttight="compacttight",e.default="default",e.leadsheet="leadsheet",e.preview="preview",e.thumbnail="thumbnail",e})({}),ri=(function(e){return e[e.Standard=0]="Standard",e[e.ThinLeft=1]="ThinLeft",e[e.ShortThinTopLeft=2]="ShortThinTopLeft",e[e.CurrentArea=3]="CurrentArea",e[e.CurrentAreaLeft=4]="CurrentAreaLeft",e})({}),ms=(function(e){return e[e.Never=0]="Never",e[e.Always=1]="Always",e[e.Auto=2]="Auto",e})({}),An=(function(e){return e[e.No=0]="No",e[e.YesVisible=1]="YesVisible",e[e.YesInvisible=2]="YesInvisible",e})({}),ni=(function(e){return e[e.SVG=0]="SVG",e[e.Canvas=1]="Canvas",e})({}),ir=(function(e){return e[e.Plain=0]="Plain",e[e.WebGL=1]="WebGL",e})({}),Xr=class{static OSMDOptionsStandard(){return{autoResize:!0,backend:"svg",drawingParameters:Ve.default}}static BackendTypeFromString(e){return e&&e.toLowerCase()==="canvas"?ni.Canvas:ni.SVG}},Ja=class{constructor(e,t,i){this.hidden=!0,this.currentPageNumber=1,this.skipInvisibleNotes=!0,this.container=e,this.openSheetMusicDisplay=t,this.rules=this.openSheetMusicDisplay.EngravingRules,this.cursorOptions=i;let s=0;for(this.cursorElementId="cursorImg-0";document.getElementById(this.cursorElementId);)s++,this.cursorElementId=`cursorImg-${s}`;let r=document.createElement("img");r.id=this.cursorElementId,r.style.position="absolute",this.cursorOptions.follow===!0?(this.wantedZIndex="-1",r.style.zIndex=this.wantedZIndex):(this.wantedZIndex="-2",r.style.zIndex=this.wantedZIndex),this.cursorElement=r,this.container.appendChild(r)}adjustToBackgroundColor(){let e;e=this.rules.PageBackgroundColor?"1":this.wantedZIndex,this.cursorElement.style.zIndex=e}init(e,t){this.manager=e,this.graphic=t,this.reset(),this.hidden=!0,this.hide()}show(){this.hidden=!1,this.update(),this.adjustToBackgroundColor()}resetIterator(){if(!this.openSheetMusicDisplay.Sheet||!this.openSheetMusicDisplay.Sheet.SourceMeasures){console.log("OSMD.Cursor.resetIterator(): sheet or measures were null/undefined.");return}let e=this.openSheetMusicDisplay.Sheet.SourceMeasures.length-1,t=this.rules.MinMeasureToDrawIndex;t=Math.min(t,e);let i=this.rules.MaxMeasureToDrawIndex;if(i=Math.min(i,e),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>t&&(this.openSheetMusicDisplay.Sheet.SelectionStart=this.openSheetMusicDisplay.Sheet.SourceMeasures[t].AbsoluteTimestamp),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>i){let s=this.openSheetMusicDisplay.Sheet.SourceMeasures[i];this.openSheetMusicDisplay.Sheet.SelectionEnd=N.plus(s.AbsoluteTimestamp,s.Duration)}this.iterator=this.manager.getIterator(),this.iterator.SkipInvisibleNotes=this.skipInvisibleNotes}getStaffEntryFromVoiceEntry(e){let t=e.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.measureListIndex,i=e.ParentSourceStaffEntry.ParentStaff.idInMusicSheet;return this.graphic.findGraphicalStaffEntryFromMeasureList(i,t,e.ParentSourceStaffEntry)}update(){if(this.hidden||this.hidden===void 0||this.hidden===null)return;this.updateCurrentPage();let e=this.iterator,t=e.CurrentVisibleVoiceEntries(),i=e.CurrentMeasureIndex,s=0,r=0,n=0,a;if(t.length===0&&!e.FrontReached&&!e.EndReached&&(e.moveToPrevious(),t=e.CurrentVisibleVoiceEntries(),e.moveToNext()),e.FrontReached&&t.length===0){e.moveToNext(),t=e.CurrentVisibleVoiceEntries();let c=this.findVisibleGraphicalMeasure(e.CurrentMeasureIndex);s=c.PositionAndShape.AbsolutePosition.x,a=c.ParentMusicSystem,e.moveToPrevious()}else if(e.EndReached||!e.CurrentVoiceEntries||t.length===0){e.moveToPrevious(),t=e.CurrentVisibleVoiceEntries(),i=e.CurrentMeasureIndex;let c=this.findVisibleGraphicalMeasure(e.CurrentMeasureIndex);s=c.PositionAndShape.AbsolutePosition.x+c.PositionAndShape.Size.width,a=c.ParentMusicSystem,e.moveToNext()}else if(e.CurrentMeasure.isReducedToMultiRest){let c=this.findVisibleGraphicalMeasure(e.CurrentMeasureIndex),d=c.parentSourceMeasure.multipleRestMeasures,f=e.CurrentMeasure.multipleRestMeasureNumber/(d+1),p=c.PositionAndShape.Size.width-c.beginInstructionsWidth;s=c.PositionAndShape.AbsolutePosition.x+c.beginInstructionsWidth+f*p,a=c.ParentMusicSystem}else{let c=t.map(d=>this.getStaffEntryFromVoiceEntry(d)).sort((d,f)=>d?.PositionAndShape?.AbsolutePosition?.x<=f?.PositionAndShape?.AbsolutePosition?.x?-1:1)[0];c&&(s=c.PositionAndShape.AbsolutePosition.x,a=c.parentMeasure.ParentMusicSystem)}if(!a?.StaffLines[0])return;r=a.PositionAndShape.AbsolutePosition.y+a.StaffLines[0].PositionAndShape.RelativePosition.y;let o=a.PositionAndShape.AbsolutePosition.y,l=a.StaffLines[a.StaffLines.length-1];l&&(o+=l.PositionAndShape.RelativePosition.y+l.StaffHeight),n=o-r;let h=this.findVisibleGraphicalMeasure(i);if(!h)return;let u=h.PositionAndShape;if(this.updateWidthAndStyle(u,s,r,n),this.openSheetMusicDisplay.FollowCursor&&this.cursorOptions.follow)if(this.openSheetMusicDisplay.EngravingRules.RenderSingleHorizontalStaffline)this.cursorElement.scrollIntoView({behavior:"smooth",inline:"center"});else{let c=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:c<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}findVisibleGraphicalMeasure(e){for(let t=0;t<this.graphic.NumberOfStaves;t++){let i=this.graphic.findGraphicalMeasure(this.iterator.CurrentMeasureIndex,t);if(i?.ParentStaff.isVisible())return i}}updateWidthAndStyle(e,t,i,s){let r=this.cursorElement,n=0;switch(this.cursorOptions.type){case ri.ThinLeft:r.style.top=i*10*this.openSheetMusicDisplay.zoom+"px",r.style.left=(t-1.5)*10*this.openSheetMusicDisplay.zoom+"px",r.height=s*10*this.openSheetMusicDisplay.zoom,n=5*this.openSheetMusicDisplay.zoom;break;case ri.ShortThinTopLeft:r.style.top=(i-2.5)*10*this.openSheetMusicDisplay.zoom+"px",r.style.left=t*10*this.openSheetMusicDisplay.zoom+"px",r.height=1.5*10*this.openSheetMusicDisplay.zoom,n=5*this.openSheetMusicDisplay.zoom;break;case ri.CurrentArea:r.style.top=e.AbsolutePosition.y*10*this.openSheetMusicDisplay.zoom+"px",r.style.left=e.AbsolutePosition.x*10*this.openSheetMusicDisplay.zoom+"px",r.height=s*10*this.openSheetMusicDisplay.zoom,n=e.Size.width*10*this.openSheetMusicDisplay.zoom;break;case ri.CurrentAreaLeft:r.style.top=e.AbsolutePosition.y*10*this.openSheetMusicDisplay.zoom+"px",r.style.left=e.AbsolutePosition.x*10*this.openSheetMusicDisplay.zoom+"px",r.height=s*10*this.openSheetMusicDisplay.zoom,n=(t-e.AbsolutePosition.x)*10*this.openSheetMusicDisplay.zoom;break;default:r.style.top=i*10*this.openSheetMusicDisplay.zoom+"px",r.style.left=(t-1.5)*10*this.openSheetMusicDisplay.zoom+"px",r.height=s*10*this.openSheetMusicDisplay.zoom,n=30*this.openSheetMusicDisplay.zoom;break}r.width=n,this.cursorOptionsRendered!==this.cursorOptions&&this.updateStyle(n,this.cursorOptions)}hide(){this.cursorElement.style.display="none",this.hidden=!0}
1previous(){this.iterator.moveToPreviousVisibleVoiceEntry(!1),this.update()}next(){this.iterator.moveToNextVisibleVoiceEntry(!1),this.update()}reset(){this.resetIterator(),this.update()}updateStyle(e,t=void 0){t!==void 0&&(this.cursorOptions=t);let i=document.createElement("canvas");i.width=this.cursorElement.width,i.height=1;let s=i.getContext("2d");s.globalAlpha=this.cursorOptions.alpha;let r=s.createLinearGradient(0,0,this.cursorElement.width,0);switch(this.cursorOptions.type){case ri.ThinLeft:case ri.ShortThinTopLeft:case ri.CurrentArea:case ri.CurrentAreaLeft:r.addColorStop(1,this.cursorOptions.color);break;default:r.addColorStop(0,"white"),r.addColorStop(.2,this.cursorOptions.color),r.addColorStop(.8,this.cursorOptions.color),r.addColorStop(1,"white");break}s.fillStyle=r,s.fillRect(0,0,e,1),this.cursorOptionsRendered={...this.cursorOptions},this.cursorElement.src=i.toDataURL("image/png")}get Iterator(){return this.iterator}get Hidden(){return this.hidden}VoicesUnderCursor(e){return this.iterator.CurrentVisibleVoiceEntries(e)}NotesUnderCursor(e){let t=this.VoicesUnderCursor(e),i=[];return t.forEach(s=>{i.push.apply(i,s.Notes)}),i}GNotesUnderCursor(e){let t=this.VoicesUnderCursor(e),i=[];return t.forEach(s=>{i.push(...s.Notes.map(r=>this.rules.GNote(r)))}),i}updateCurrentPage(){let e=this.iterator.currentTimeStamp;e.RealValue<0&&(e=new N(0,0));for(let t of this.graphic.MusicPages)if(t.MusicSystems.last().GetSystemsLastTimeStamp().gt(e)){let i=t.PageNumber;return i!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById("osmdCanvasPage"+i),this.container.appendChild(this.cursorElement)),this.currentPageNumber=i}return 1}get SkipInvisibleNotes(){return this.skipInvisibleNotes}set SkipInvisibleNotes(e){this.skipInvisibleNotes=e,this.iterator.SkipInvisibleNotes=e}get CursorOptions(){return this.cursorOptions}set CursorOptions(e){this.cursorOptions=e}Dispose(){this.hide(),this.container.removeChild(this.cursorElement),this.rules=void 0,this.openSheetMusicDisplay=void 0,this.cursorOptions=void 0}nextMeasure(){let e=this.Iterator.CurrentMeasure,t=this.Iterator.currentTimeStamp.RealValue;this.next();let i=0;for(;this.Iterator.CurrentMeasure===e&&this.Iterator.currentTimeStamp.RealValue!==t&&i<999;)t=this.Iterator.currentTimeStamp.RealValue,this.next(),i++}previousMeasure(){let e=this.Iterator.CurrentMeasure,t=this.Iterator.currentTimeStamp.RealValue;this.previous();let i=0;for(;this.Iterator.CurrentMeasure===e&&this.Iterator.currentTimeStamp.RealValue!==t&&i<999;)t=this.Iterator.currentTimeStamp.RealValue,this.previous(),i++;for(i=0;this.Iterator.CurrentRelativeInMeasureTimestamp.RealValue!==0&&i<999;)this.previous(),i++}},Rn=class Vs{constructor(t){if(this.hasAttributes=!1,!t)throw Error("IXmlElement: expected Element, got undefined");this.elem=t,this.name=t.nodeName.toLowerCase(),t.hasAttributes()&&(this.hasAttributes=!0,this.firstAttribute=t.attributes[0]),this.hasElements=t.hasChildNodes(),t.childNodes.length===1&&t.childNodes[0].nodeType===Node.TEXT_NODE?this.value=t.childNodes[0].nodeValue:this.value=""}attribute(t){return this.elem.attributes.getNamedItem(t)}attributes(){if(!this.attrs){let t=this.elem.attributes,i=[];for(let s=0;s<t.length;s+=1)i.push(t[s]);this.attrs=i}return this.attrs}element(t){let i=this.elem.childNodes;for(let s=0,r=i.length;s<r;s+=1){let n=i[s];if(n.nodeType===Node.ELEMENT_NODE&&n.nodeName.toLowerCase()===t)return new Vs(n)}}elements(t){let i=this.elem.childNodes,s=[],r=!t;r||(t=t.toLowerCase());for(let n=0;n<i.length;n+=1){let a=i[n];a.nodeType===Node.ELEMENT_NODE&&(r||a.nodeName.toLowerCase()===t)&&s.push(new Vs(a))}return s}combinedElement(t){let i=this.elem.childNodes;if(i.length>0){let s;for(let r=0,n=i.length;r<n;r+=1){let a=i[r];if(a.nodeType===Node.ELEMENT_NODE&&a.nodeName.toLowerCase()===t)if(s){let o=a.childNodes;for(let l=0,h=o.length;l<h;l+=1){let u=o[l];s.appendChild(u.cloneNode(!0))}}else s=a}if(s)return new Vs(s)}}},hs=class{constructor(e,t){this.staffEntries=[],this.absoluteTimestamp=t,this.staffEntries=Array(e)}get Index(){return this.index}set Index(e){this.index=e}get AbsoluteTimestamp(){return this.absoluteTimestamp}get StaffEntries(){return this.staffEntries}set StaffEntries(e){this.staffEntries=e}static compareByTimestamp(e,t){let i=e.absoluteTimestamp.RealValue,s=t.absoluteTimestamp.RealValue;return i<s?-1:+(i>s)}getFirstNonNullStaffEntry(){for(let e=0,t=this.staffEntries.length;e<t;++e){let i=this.staffEntries[e];if(i)return i}}},qe=xe((e=>
1{Object.defineProperty(e,"__esModule",{value:!0});var t=Object.prototype.hasOwnProperty;e.has=function(c,d){return t.call(c,d)};function i(c,d){return c<d?-1:c===d?0:1}e.defaultCompare=i;function s(c,d){return c===d}e.defaultEquals=s;function r(c){return c===null?"COLLECTION_NULL":o(c)?"COLLECTION_UNDEFINED":l(c)?"$s"+c:"$o"+c.toString()}e.defaultToString=r;function n(c,d){if(d===void 0&&(d=","),c===null)return"COLLECTION_NULL";if(o(c))return"COLLECTION_UNDEFINED";if(l(c))return c.toString();var f="{",p=!0;for(var m in c)e.has(c,m)&&(p?p=!1:f+=d,f=f+m+":"+c[m]);return f+"}"}e.makeString=n;function a(c){return typeof c=="function"}e.isFunction=a;function o(c){return c===void 0}e.isUndefined=o;function l(c){return Object.prototype.toString.call(c)==="[object String]"}e.isString=l;function h(c){return o(c)||!a(c)?function(d,f){return d<f?1:d===f?0:-1}:function(d,f){return c(d,f)*-1}}e.reverseCompareFunction=h;function u(c){return function(d,f){return c(d,f)===0}}e.compareToEquals=u})),_s=xe((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=qe();function i(d,f,p){for(var m=p||t.defaultEquals,g=d.length,b=0;b<g;b++)if(m(d[b],f))return b;return-1}e.indexOf=i;function s(d,f,p){for(var m=p||t.defaultEquals,g=d.length-1;g>=0;g--)if(m(d[g],f))return g;return-1}e.lastIndexOf=s;function r(d,f,p){return i(d,f,p)>=0}e.contains=r;function n(d,f,p){var m=i(d,f,p);return m<0?!1:(d.splice(m,1),!0)}e.remove=n;function a(d,f,p){for(var m=p||t.defaultEquals,g=d.length,b=0,S=0;S<g;S++)m(d[S],f)&&b++;return b}e.frequency=a;function o(d,f,p){var m=p||t.defaultEquals;if(d.length!==f.length)return!1;for(var g=d.length,b=0;b<g;b++)if(!m(d[b],f[b]))return!1;return!0}e.equals=o;function l(d){return d.concat()}e.copy=l;function h(d,f,p){if(f<0||f>=d.length||p<0||p>=d.length)return!1;var m=d[f];return d[f]=d[p],d[p]=m,!0}e.swap=h;function u(d){return"["+d.toString()+"]"}e.toString=u;function c(d,f){for(var p=0,m=d;p<m.length;p++){var g=m[p];if(f(g)===!1)return}}e.forEach=c})),es=xe((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=qe();e.default=(function(){function i(s){this.table={},this.nElements=0,this.toStr=s||t.defaultToString}return i.prototype.getValue=function(s){var r=this.table["$"+this.toStr(s)];if(!t.isUndefined(r))return r.value},i.prototype.setValue=function(s,r){if(!(t.isUndefined(s)||t.isUndefined(r))){var n,a="$"+this.toStr(s),o=this.table[a];return t.isUndefined(o)?(this.nElements++,n=void 0):n=o.value,this.table[a]={key:s,value:r},n}},i.prototype.remove=function(s){var r="$"+this.toStr(s),n=this.table[r];if(!t.isUndefined(n))return delete this.table[r],this.nElements--,n.value},i.prototype.keys=function(){var s=[];for(var r in this.table)if(t.has(this.table,r)){var n=this.table[r];s.push(n.key)}return s},i.prototype.values=function(){var s=[];for(var r in this.table)if(t.has(this.table,r)){var n=this.table[r];s.push(n.value)}return s},i.prototype.forEach=function(s){for(var r in this.table)if(t.has(this.table,r)){var n=this.table[r];if(s(n.key,n.value)===!1)return}},i.prototype.containsKey=function(s){return!t.isUndefined(this.getValue(s))},i.prototype.clear=function(){this.table={},this.nElements=0},i.prototype.size=function(){return this.nElements},i.prototype.isEmpty=function(){return this.nElements<=0},i.prototype.toString=function(){var s="{";
1return this.forEach(function(r,n){s+=`
2	`+r+" : "+n}),s+`
3}`},i})()})),$a=xe((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=qe(),i=_s(),s=es();e.default=(function(){function r(n){this.dictionary=new s.default(n)}return r.prototype.contains=function(n){return this.dictionary.containsKey(n)},r.prototype.add=function(n){return this.contains(n)||t.isUndefined(n)?!1:(this.dictionary.setValue(n,n),!0)},r.prototype.intersection=function(n){var a=this;this.forEach(function(o){return n.contains(o)||a.remove(o),!0})},r.prototype.union=function(n){var a=this;n.forEach(function(o){return a.add(o),!0})},r.prototype.difference=function(n){var a=this;n.forEach(function(o){return a.remove(o),!0})},r.prototype.isSubsetOf=function(n){if(this.size()>n.size())return!1;var a=!0;return this.forEach(function(o){return n.contains(o)?!0:(a=!1,!1)}),a},r.prototype.remove=function(n){return this.contains(n)?(this.dictionary.remove(n),!0):!1},r.prototype.forEach=function(n){this.dictionary.forEach(function(a,o){return n(o)})},r.prototype.toArray=function(){return this.dictionary.values()},r.prototype.isEmpty=function(){return this.dictionary.isEmpty()},r.prototype.size=function(){return this.dictionary.size()},r.prototype.clear=function(){this.dictionary.clear()},r.prototype.toString=function(){return i.toString(this.toArray())},r})()})),lh=xe((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=qe(),i=es(),s=$a();e.default=(function(){function r(n){this.toStrF=n||t.defaultToString,this.dictionary=new i.default(this.toStrF),this.nElements=0}return r.prototype.add=function(n,a){if(a===void 0&&(a=1),t.isUndefined(n)||a<=0)return!1;if(this.contains(n))this.dictionary.getValue(n).copies+=a;else{var o={value:n,copies:a};this.dictionary.setValue(n,o)}return this.nElements+=a,!0},r.prototype.count=function(n){return this.contains(n)?this.dictionary.getValue(n).copies:0},r.prototype.contains=function(n){return this.dictionary.containsKey(n)},r.prototype.remove=function(n,a){if(a===void 0&&(a=1),t.isUndefined(n)||a<=0)return!1;if(this.contains(n)){var o=this.dictionary.getValue(n);return a>o.copies?this.nElements-=o.copies:this.nElements-=a,o.copies-=a,o.copies<=0&&this.dictionary.remove(n),!0}else return!1},r.prototype.toArray=function(){for(var n=[],a=this.dictionary.values(),o=0,l=a;o<l.length;o++)for(var h=l[o],u=h.value,c=h.copies,d=0;d<c;d++)n.push(u);return n},r.prototype.toSet=function(){for(var n=new s.default(this.toStrF),a=this.dictionary.values(),o=0,l=a;o<l.length;o++){var h=l[o].value;n.add(h)}return n},r.prototype.forEach=function(n){this.dictionary.forEach(function(a,o){for(var l=o.value,h=o.copies,u=0;u<h;u++)if(n(l)===!1)return!1;return!0})},r.prototype.size=function(){return this.nElements},r.prototype.isEmpty=function(){return this.nElements===0},r.prototype.clear=function(){this.nElements=0,this.dictionary.clear()},r})()})),Cn=xe((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=qe(),i=_s();e.default=(function(){function s(){this.firstNode=null,this.lastNode=null,this.nElements=0}return s.prototype.add=function(r,n){if(t.isUndefined(n)&&(n=this.nElements),n<0||n>this.nElements||t.isUndefined(r))return!1;var a=this.createNode(r);if(this.nElements===0||this.lastNode===null)this.firstNode=a,this.lastNode=a;else if(n===this.nElements)this.lastNode.next=a,this.lastNode=a;else if(n===0)a.next=this.firstNode,this.firstNode=a;else{var o=this.nodeAtIndex(n-1);if(o===null)return!1;a.next=o.next,o.next=a}return this.nElements++,!0},s.prototype.first=function(){if(this.firstNode!==null)return this.firstNode.element},s.prototype.last=function(){if(this.lastNode!==null)return this.lastNode.element},s.prototype.elementAtIndex=function(r){var n=this.nodeAtIndex(r);if(n!==null)return n.element},s.prototype.indexOf=function(r,n){var a=n||t.defaultEquals;if(t.isUndefined(r))return-1;for(var o=this.firstNode,l=0;o!==null;){if(a(o.element,r))return l;l++,o=o.next}return-1},s.prototype.contains=function(r,n){return this.indexOf(r,n)>=0},s.prototype.remove=function(r,n){var a=n||t.defaultEquals;if(this.nElements<1||t.isUndefined(r))return!1;for(var o=null,l=this.firstNode;l!==null;){if(a(l.element,r))return o===null?(this.firstNode=l.next,l===this.lastNode&&(this.lastNode=null)):l===this.lastNode?(this.lastNode=o,o.next=l.next,l.next=null):(o.next=l.next,l.next=null),this.nElements--,!0;o=l,l=l.next}return!1},s.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},s.prototype.equals=function(r,n){var a=n||t.defaultEquals;
3return!(r instanceof s)||this.size()!==r.size()?!1:this.equalsAux(this.firstNode,r.firstNode,a)},s.prototype.equalsAux=function(r,n,a){for(;r!==null&&n!==null;){if(!a(r.element,n.element))return!1;r=r.next,n=n.next}return!0},s.prototype.removeElementAtIndex=function(r){if(!(r<0||r>=this.nElements||this.firstNode===null||this.lastNode===null)){var n;if(this.nElements===1)n=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var a=this.nodeAtIndex(r-1);a===null?(n=this.firstNode.element,this.firstNode=this.firstNode.next):a.next===this.lastNode&&(n=this.lastNode.element,this.lastNode=a),a!==null&&a.next!==null&&(n=a.next.element,a.next=a.next.next)}return this.nElements--,n}},s.prototype.forEach=function(r){for(var n=this.firstNode;n!==null&&r(n.element)!==!1;)n=n.next},s.prototype.reverse=function(){for(var r=null,n=this.firstNode,a=null;n!==null;)a=n.next,n.next=r,r=n,n=a;a=this.firstNode,this.firstNode=this.lastNode,this.lastNode=a},s.prototype.toArray=function(){for(var r=[],n=this.firstNode;n!==null;)r.push(n.element),n=n.next;return r},s.prototype.size=function(){return this.nElements},s.prototype.isEmpty=function(){return this.nElements<=0},s.prototype.toString=function(){return i.toString(this.toArray())},s.prototype.nodeAtIndex=function(r){if(r<0||r>=this.nElements)return null;if(r===this.nElements-1)return this.lastNode;for(var n=this.firstNode,a=0;a<r&&n!==null;a++)n=n.next;return n},s.prototype.createNode=function(r){return{element:r,next:null}},s})()})),Za=xe((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Cn();e.default=(function(){function i(){this.list=new t.default}return i.prototype.enqueue=function(s){return this.list.add(s)},i.prototype.add=function(s){return this.list.add(s)},i.prototype.dequeue=function(){if(this.list.size()!==0){var s=this.list.first();return this.list.removeElementAtIndex(0),s}},i.prototype.peek=function(){if(this.list.size()!==0)return this.list.first()},i.prototype.size=function(){return this.list.size()},i.prototype.contains=function(s,r){return this.list.contains(s,r)},i.prototype.isEmpty=function(){return this.list.size()<=0},i.prototype.clear=function(){this.list.clear()},i.prototype.forEach=function(s){this.list.forEach(s)},i})()})),Qa=xe((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=qe(),i=Za();e.default=(function(){function s(r){this.root=null,this.compare=r||t.defaultCompare,this.nElements=0}return s.prototype.add=function(r){return t.isUndefined(r)||this.insertNode(this.createNode(r))===null?!1:(this.nElements++,!0)},s.prototype.clear=function(){this.root=null,this.nElements=0},s.prototype.isEmpty=function(){return this.nElements===0},s.prototype.size=function(){return this.nElements},s.prototype.contains=function(r){return t.isUndefined(r)?!1:this.searchNode(this.root,r)!==null},s.prototype.search=function(r){var n=this.searchNode(this.root,r);if(n!==null)return n.element},s.prototype.remove=function(r){var n=this.searchNode(this.root,r);return n===null?!1:(this.removeNode(n),this.nElements--,!0)},s.prototype.inorderTraversal=function(r){this.inorderTraversalAux(this.root,r,{stop:!1})},s.prototype.preorderTraversal=function(r){this.preorderTraversalAux(this.root,r,{stop:!1})},s.prototype.postorderTraversal=function(r){this.postorderTraversalAux(this.root,r,{stop:!1})},s.prototype.levelTraversal=function(r){this.levelTraversalAux(this.root,r)},s.prototype.minimum=function(){if(!(this.isEmpty()||this.root===null))return this.minimumAux(this.root).element},s.prototype.maximum=function(){if(!(this.isEmpty()||this.root===null))return this.maximumAux(this.root).element},s.prototype.forEach=function(r){this.inorderTraversal(r)},s.prototype.toArray=function(){var r=[];return this.inorderTraversal(function(n){return r.push(n),!0}),r},s.prototype.height=function(){return this.heightAux(this.root)},s.prototype.searchNode=function(r,n){for(var a=1;r!==null&&a!==0;)a=this.compare(n,r.element),a<0?r=r.leftCh:a>0&&(r=r.rightCh);return r},s.prototype.transplant=function(r,n){r.parent===null?this.root=n:r===r.parent.leftCh?r.parent.leftCh=n:r.parent.rightCh=n,n!==null&&(n.parent=r.parent)},s.prototype.removeNode=function(r){if(r.leftCh===null)this.transplant(r,r.rightCh);else if(r.rightCh===null)this.transplant(r,r.leftCh);else{var n=this.minimumAux(r.rightCh);n.parent!==r&&(this.transplant(n,n.rightCh),n.rightCh=r.rightCh,n.rightCh.parent=n),this.transplant(r,n),n.leftCh=r.leftCh,n.leftCh.parent=n}},s.prototype.inorderTraversalAux=function(r,n,a){r===null||a.stop||(this.inorderTraversalAux(r.leftCh,n,a),!a.stop&&(a.stop=n(r.element)===!1,!a.stop&&this.inorderTraversalAux(r.rightCh,n,a)))},s.prototype.levelTraversalAux=function(r,n){var a=new i.default;for(r!==null&&a.enqueue(r),r=a.dequeue()||null;r!=null;){if(n(r.element)===!1)return;r.leftCh!==null&&a.enqueue(r.leftCh),r.rightCh!==null&&a.enqueue(r.rightCh),r=a.dequeue()||null}},s.prototype.preorderTraversalAux=function(r,n,a){r===null||a.stop||(a.stop=n(r.element)===!1,!a.stop&&(this.preorderTraversalAux(r.leftCh,n,a),!a.stop&&this.preorderTraversalAux(r.rightCh,n,a)))},s.prototype.postorderTraversalAux=function(r,n,a){r===null||a.stop||(this.postorderTraversalAux(r.leftCh,n,a),!a.stop&&(this.postorderTraversalAux(r.rightCh,n,a),!a.stop&&(a.stop=n(r.element)===!1)))},s.prototype.minimumAux=function(r){for(;r!=null&&r.leftCh!==null;)r=r.leftCh;return r},s.prototype.maximumAux=function(r){for(;r!=null&&r.rightCh!==null;)r=r.rightCh;return r},s.prototype.heightAux=function(r){return r===null?-1:Math.max(this.heightAux(r.leftCh),this.heightAux(r.rightCh))+1}
3,s.prototype.insertNode=function(r){for(var n=null,a=this.root;a!==null;){var o=this.compare(r.element,a.element);if(o===0)return null;o<0?(n=a,a=a.leftCh):(n=a,a=a.rightCh)}return r.parent=n,n===null?this.root=r:this.compare(r.element,n.element)<0?n.leftCh=r:n.rightCh=r,r},s.prototype.createNode=function(r){return{element:r,leftCh:null,rightCh:null,parent:null}},s})()})),hh=xe((e=>{var t=e&&e.__extends||(function(){var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var n in r)r.hasOwnProperty(n)&&(s[n]=r[n])};return function(s,r){i(s,r);function n(){this.constructor=s}s.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.default=(function(i){t(s,i);function s(){return i!==null&&i.apply(this,arguments)||this}return s})(Qa().default)})),to=xe((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=qe(),i=_s();e.default=(function(){function s(r){this.data=[],this.compare=r||t.defaultCompare}return s.prototype.leftChildIndex=function(r){return 2*r+1},s.prototype.rightChildIndex=function(r){return 2*r+2},s.prototype.parentIndex=function(r){return Math.floor((r-1)/2)},s.prototype.minIndex=function(r,n){return n>=this.data.length?r>=this.data.length?-1:r:this.compare(this.data[r],this.data[n])<=0?r:n},s.prototype.siftUp=function(r){for(var n=this.parentIndex(r);r>0&&this.compare(this.data[n],this.data[r])>0;)i.swap(this.data,n,r),r=n,n=this.parentIndex(r)},s.prototype.siftDown=function(r){for(var n=this.minIndex(this.leftChildIndex(r),this.rightChildIndex(r));n>=0&&this.compare(this.data[r],this.data[n])>0;)i.swap(this.data,n,r),r=n,n=this.minIndex(this.leftChildIndex(r),this.rightChildIndex(r))},s.prototype.peek=function(){if(this.data.length>0)return this.data[0]},s.prototype.add=function(r){return t.isUndefined(r)?!1:(this.data.push(r),this.siftUp(this.data.length-1),!0)},s.prototype.removeRoot=function(){if(this.data.length>0){var r=this.data[0];return this.data[0]=this.data[this.data.length-1],this.data.splice(this.data.length-1,1),this.data.length>0&&this.siftDown(0),r}},s.prototype.contains=function(r){var n=t.compareToEquals(this.compare);return i.contains(this.data,r,n)},s.prototype.size=function(){return this.data.length},s.prototype.isEmpty=function(){return this.data.length<=0},s.prototype.clear=function(){this.data.length=0},s.prototype.forEach=function(r){i.forEach(this.data,r)},s})()})),uh=xe((e=>{var t=e&&e.__extends||(function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,h){l.__proto__=h}||function(l,h){for(var u in h)h.hasOwnProperty(u)&&(l[u]=h[u])};return function(l,h){o(l,h);function u(){this.constructor=l}l.prototype=h===null?Object.create(h):(u.prototype=h.prototype,new u)}})();Object.defineProperty(e,"__esModule",{value:!0});var i=es(),s=qe(),r=(function(){function o(l,h){this.key=l,this.value=h}return o.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},o})(),n=(function(){function o(){this.key=null,this.value=null}return o.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},o})();function a(o){return!o.next}e.default=(function(o){t(l,o);function l(h){var u=o.call(this,h)||this;return u.head=new n,u.tail=new n,u.head.next=u.tail,u.tail.prev=u.head,u}return l.prototype.appendToTail=function(h){var u=this.tail.prev;u.next=h,h.prev=u,h.next=this.tail,this.tail.prev=h},l.prototype.getLinkedDictionaryPair=function(h){if(!s.isUndefined(h)){var u="$"+this.toStr(h);return this.table[u]}},l.prototype.getValue=function(h){var u=this.getLinkedDictionaryPair(h);if(!s.isUndefined(u))return u.value},l.prototype.remove=function(h){var u=this.getLinkedDictionaryPair(h);if(!s.isUndefined(u))return o.prototype.remove.call(this,h),u.unlink(),u.value},l.prototype.clear=function(){o.prototype.clear.call(this),this.head.next=this.tail,this.tail.prev=this.head},l.prototype.replace=function(h,u){var c="$"+this.toStr(u.key);u.next=h.next,u.prev=h.prev,this.remove(h.key),u.prev.next=u,u.next.prev=u,this.table[c]=u,++this.nElements},l.prototype.setValue=function(h,u){if(!(s.isUndefined(h)||s.isUndefined(u))){var c=this.getLinkedDictionaryPair(h),d=new r(h,u),f="$"+this.toStr(h);if(s.isUndefined(c)){this.appendToTail(d),this.table[f]=d,++this.nElements;return}else return this.replace(c,d),c.value}},l.prototype.keys=function(){var h=[];return this.forEach(function(u,c){h.push(u)}),h},l.prototype.values=function(){var h=[];return this.forEach(function(u,c){h.push(c)}),h},l.prototype.forEach=function(h){for(var u=this.head.next;!a(u);){if(h(u.key,u.value)===!1)return;u=u.next}},l})(i.default)})),ch=xe((e=>
3{Object.defineProperty(e,"__esModule",{value:!0});var t=qe(),i=es(),s=_s();e.default=(function(){function r(n,a,o){o===void 0&&(o=!1),this.dict=new i.default(n),this.equalsF=a||t.defaultEquals,this.allowDuplicate=o}return r.prototype.getValue=function(n){var a=this.dict.getValue(n);return t.isUndefined(a)?[]:s.copy(a)},r.prototype.setValue=function(n,a){if(t.isUndefined(n)||t.isUndefined(a))return!1;var o=this.dict.getValue(n);return t.isUndefined(o)?(this.dict.setValue(n,[a]),!0):!this.allowDuplicate&&s.contains(o,a,this.equalsF)?!1:(o.push(a),!0)},r.prototype.remove=function(n,a){if(t.isUndefined(a)){var o=this.dict.remove(n);return!t.isUndefined(o)}var l=this.dict.getValue(n);return!t.isUndefined(l)&&s.remove(l,a,this.equalsF)?(l.length===0&&this.dict.remove(n),!0):!1},r.prototype.keys=function(){return this.dict.keys()},r.prototype.values=function(){for(var n=this.dict.values(),a=[],o=0,l=n;o<l.length;o++)for(var h=l[o],u=0,c=h;u<c.length;u++){var d=c[u];a.push(d)}return a},r.prototype.containsKey=function(n){return this.dict.containsKey(n)},r.prototype.clear=function(){this.dict.clear()},r.prototype.size=function(){return this.dict.size()},r.prototype.isEmpty=function(){return this.dict.isEmpty()},r})()})),ya=xe((e=>{var t=e&&e.__extends||(function(){var r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var o in a)a.hasOwnProperty(o)&&(n[o]=a[o])};return function(n,a){r(n,a);function o(){this.constructor=n}n.prototype=a===null?Object.create(a):(o.prototype=a.prototype,new o)}})();Object.defineProperty(e,"__esModule",{value:!0});var i=es(),s=qe();e.default=(function(r){t(n,r);function n(a,o){var l=r.call(this,o)||this;return l.defaultFactoryFunction=a,l}return n.prototype.setDefault=function(a,o){var l=r.prototype.getValue.call(this,a);return s.isUndefined(l)?(this.setValue(a,o),o):l},n.prototype.getValue=function(a){return this.setDefault(a,this.defaultFactoryFunction())},n})(i.default)})),dh=xe((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=qe(),i=to();e.default=(function(){function s(r){this.heap=new i.default(t.reverseCompareFunction(r))}return s.prototype.enqueue=function(r){return this.heap.add(r)},s.prototype.add=function(r){return this.heap.add(r)},s.prototype.dequeue=function(){if(this.heap.size()!==0){var r=this.heap.peek();return this.heap.removeRoot(),r}},s.prototype.peek=function(){return this.heap.peek()},s.prototype.contains=function(r){return this.heap.contains(r)},s.prototype.isEmpty=function(){return this.heap.isEmpty()},s.prototype.size=function(){return this.heap.size()},s.prototype.clear=function(){this.heap.clear()},s.prototype.forEach=function(r){this.heap.forEach(r)},s})()})),fh=xe((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Cn();e.default=(function(){function i(){this.list=new t.default}return i.prototype.push=function(s){return this.list.add(s,0)},i.prototype.add=function(s){return this.list.add(s,0)},i.prototype.pop=function(){return this.list.removeElementAtIndex(0)},i.prototype.peek=function(){return this.list.first()},i.prototype.size=function(){return this.list.size()},i.prototype.contains=function(s,r){return this.list.contains(s,r)},i.prototype.isEmpty=function(){return this.list.isEmpty()},i.prototype.clear=function(){this.list.clear()},i.prototype.forEach=function(s){this.list.forEach(s)},i})()})),ph=xe((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t;(function(i){i[i.BEFORE=0]="BEFORE",i[i.AFTER=1]="AFTER",i[i.INSIDE_AT_END=2]="INSIDE_AT_END",i[i.INSIDE_AT_START=3]="INSIDE_AT_START"})(t||(t={})),e.default=(function(){function i(s,r){s===void 0&&(s=[]),r===void 0&&(r={}),this.rootIds=s,this.nodes=r,this.initRootIds(),this.initNodes()}return i.prototype.initRootIds=function(){for(var s=0,r=this.rootIds;s<r.length;s++){var n=r[s];this.createEmptyNodeIfNotExist(n)}},i.prototype.initNodes=function(){for(var s in this.nodes)if(this.nodes.hasOwnProperty(s))for(var r=0,n=this.nodes[s];r<n.length;r++){var a=n[r];this.createEmptyNodeIfNotExist(a)}},i.prototype.createEmptyNodeIfNotExist=function(s){this.nodes[s]||(this.nodes[s]=[])},i.prototype.getRootIds=function(){return this.rootIds.slice()},i.prototype.getNodes=function(){var s={};for(var r in this.nodes)this.nodes.hasOwnProperty(r)&&(s[r]=this.nodes[r].slice());return s},i.prototype.getObject=function(){return{rootIds:this.getRootIds(),nodes:this.getNodes()}},i.prototype.toObject=function(){return this.getObject()},i.prototype.flatten=function(){for(var s=this,r=[],n=0;n<this.rootIds.length;n++){var a=this.rootIds[n];r.push({id:a,level:0,hasParent:!1,childrenCount:0}),c(a,this.nodes,r,0)}for(var o=0,l=r;o<l.length;o++){var h=l[o];h.childrenCount=u(h.id)}return r;function u(d){return s.nodes[d]?s.nodes[d].length:0}function c(d,f,p,m){if(m===void 0&&(m=0),!(!d||!f||!p||!f[d])){m++;for(var g=f[d],b=0;b<g.length;b++){var S=g[b];p.push({id:S,level:m,hasParent:!0}),c(S,f,p,m)}m--}}},i.prototype.moveIdBeforeId=function(s,r){return this.moveId(s,r,t.BEFORE)},i.prototype.moveIdAfterId=function(s,r){return this.moveId(s,r,t.AFTER)},i.prototype.moveIdIntoId=function(s,r,n){return n===void 0&&(n=!0),n?this.moveId(s,r,t.INSIDE_AT_START):this.moveId(s,r,t.INSIDE_AT_END)},i.prototype.swapRootIdWithRootId=function(s,r){var n=this.findRootId(s),a=this.findRootId(r);this.swapRootPositionWithRootPosition(n,a)},i.prototype.swapRootPositionWithRootPosition=function(s,r){var n=this.rootIds[r];this.rootIds[r]=this.rootIds[s],this.rootIds[s]=n},i.prototype.deleteId=function(s){this.rootDeleteId(s),this.nodeAndSubNodesDelete(s),this.nodeRefrencesDelete(s)},i.prototype.insertIdBeforeId=function(s,r){var n=this.findRootId(s);for(var a in n>-1&&this.insertIdIntoRoot(r,n),this.nodes)if(this.nodes.hasOwnProperty(a)){var o=this.findNodeId(a,s);o>-1&&this.insertIdIntoNode(a,r,o)}},i.prototype.insertIdAfterId=function(s,r){var n=this.findRootId(s);for(var a in n>-1&&this.insertIdIntoRoot(r,n+1),this.nodes)if(this.nodes.hasOwnProperty(a)){var o=this.findNodeId(a,s);o>-1&&this.insertIdIntoNode(a,r,o+1)}},i.prototype.insertIdIntoId=function(s,r){this.nodeInsertAtEnd(s,r),this.nodes[r]=[]},i.prototype.insertIdIntoRoot=function(s,r){if(r===void 0)this.rootInsertAtEnd(s);else if(r<0){var n=this.rootIds.length;this.rootIds.splice(r+n+1,0,s)}else this.rootIds.splice(r,0,s);this.nodes[s]=this.nodes[s]||[]},i.prototype.insertIdIntoNode=function(s,r,n){if(this.nodes[s]=this.nodes[s]||[],this.nodes[r]=this.nodes[r]||[],n===void 0)this.nodeInsertAtEnd(s,r);else if(n<0){var a=this.nodes[s].length;this.nodes[s].splice(n+a+1,0,r)}else this.nodes[s].splice(n,0,r)},i.prototype.moveId=function(s,r,n){var a=s,o=this.findRootId(a);for(var l in this.nodes[r],this.nodes)if(this.nodes.hasOwnProperty(l)){this.findNodeId(l,r);break}var h=r,u=this.findRootId(h);for(var l in this.nodes[r],this.nodes)if(this.nodes.hasOwnProperty(l)){this.findNodeId(l,r);break}if(o>-1){if(u>-1)switch(this.rootDelete(o),u>o&&u--,n){case t.BEFORE:this.insertIdIntoRoot(a,u);break;case t.AFTER:this.insertIdIntoRoot(a,u+1);break;case t.INSIDE_AT_START:this.nodeInsertAtStart(h,a);break;case t.INSIDE_AT_END:this.nodeInsertAtEnd(h,a);break}else for(var l in this.rootDelete(o),this.nodes)if(this.nodes.hasOwnProperty(l)){var c=this.findNodeId(l,h);if(c>-1){switch(n){case t.BEFORE:this.insertIdIntoNode(l,a,c);break;case t.AFTER:this.insertIdIntoNode(l,a,c+1);break;case t.INSIDE_AT_START:this.nodeInsertAtStart(h,a);break;case t.INSIDE_AT_END:this.nodeInsertAtEnd(h,a);break}break}}}else if(u>-1){for(var l in this.nodes)if(this.nodes.hasOwnProperty(l)){var c=this.findNodeId(l,a);if(c>-1){this.nodeDeleteAtIndex(l,c);break}}switch(n){case t.BEFORE:this.insertIdIntoRoot(a,u);break;case t.AFTER:this.insertIdIntoRoot(a,u+1);break;case t.INSIDE_AT_START:this.nodeInsertAtStart(h,a);break;case t.INSIDE_AT_END:this.nodeInsertAtEnd(h,a);break}}else{for(var l in this.nodes)if(this.nodes.hasOwnProperty(l)){var c=this.findNodeId(l,a);if(c>-1){this.nodeDeleteAtIndex(l,c);break}}for(var l in this.nodes)if(this.nodes.hasOwnProperty(l)){var c=this.findNodeId(l,h);if(c>-1){switch(n){case t.BEFORE:this.insertIdIntoNode(l,a,c);break;case t.AFTER:this.insertIdIntoNode(l,a,c+1);break;case t.INSIDE_AT_START:this.nodeInsertAtStart(h,a);break;case t.INSIDE_AT_END:this.nodeInsertAtEnd(h,a);break}break}}}},i.prototype.swapArrayElements=function(s,r,n){var a=s[r];return s[r]=s[n],s[n]=a,s},i.prototype.rootDeleteId=function(s){var r=this.findRootId(s);r>-1&&this.rootDelete(r)},i.prototype.nodeAndSubNodesDelete=function(s){for(var r=[],n=0;n<this.nodes[s].length;n++){var a=this.nodes[s][n];this.nodeAndSubNodesDelete(a),r.push(s)}this.nodeDelete(s);for(var n=0;n<r.length;n++)this.nodeDelete(r[n])},i.prototype.nodeRefrencesDelete=function(s){for(var r in this.nodes)if(this.nodes.hasOwnProperty(r))for(var n=0;n<this.nodes[r].length;n++)this.nodes[r][n]===s&&this.nodeDeleteAtIndex(r,n)},i.prototype.nodeDelete=function(s){delete this.nodes[s]},i.prototype.findRootId=function(s){return this.rootIds.indexOf(s)},i.prototype.findNodeId=function(s,r){return this.nodes[s].indexOf(r)},i.prototype.findNode=function(s){return this.nodes[s]},i.prototype.nodeInsertAtStart=function(s,r){this.nodes[s].unshift(r)},i.prototype.nodeInsertAtEnd=function(s,r){this.nodes[s].push(r)},i.prototype.rootDelete=function(s){this.rootIds.splice(s,1)},i.prototype.nodeDeleteAtIndex=function(s,r){this.nodes[s].splice(r,1)},i.prototype.rootInsertAtStart=function(s){this.rootIds.unshift(s)},i.prototype.rootInsertAtEnd=function(s){this.rootIds.push(s)},i})()})),We=xe((e=>
3{Object.defineProperty(e,"__esModule",{value:!0}),_s(),e.Bag=lh().default,e.BSTree=hh().default,e.BSTreeKV=Qa().default,e.Dictionary=es().default,e.Heap=to().default,e.LinkedDictionary=uh().default,e.LinkedList=Cn().default,e.MultiDictionary=ch().default,e.FactoryDictionary=ya().default,e.DefaultDictionary=ya().default,e.Queue=Za().default,e.PriorityQueue=dh().default,e.Set=$a().default,e.Stack=fh().default,e.MultiRootTree=ph().default,qe()}))(),At=(function(e){return e[e.BaseWritingColor=0]="BaseWritingColor",e[e.FollowingCursor=1]="FollowingCursor",e[e.AlternativeFollowingCursor=2]="AlternativeFollowingCursor",e[e.PlaybackCursor=3]="PlaybackCursor",e[e.Highlighted=4]="Highlighted",e[e.ErrorUnderlay=5]="ErrorUnderlay",e[e.Selected=6]="Selected",e[e.SelectionSymbol=7]="SelectionSymbol",e[e.DebugColor1=8]="DebugColor1",e[e.DebugColor2=9]="DebugColor2",e[e.DebugColor3=10]="DebugColor3",e[e.SplitScreenDivision=11]="SplitScreenDivision",e[e.GreyTransparentOverlay=12]="GreyTransparentOverlay",e[e.MarkedArea1=13]="MarkedArea1",e[e.MarkedArea2=14]="MarkedArea2",e[e.MarkedArea3=15]="MarkedArea3",e[e.MarkedArea4=16]="MarkedArea4",e[e.MarkedArea5=17]="MarkedArea5",e[e.MarkedArea6=18]="MarkedArea6",e[e.MarkedArea7=19]="MarkedArea7",e[e.MarkedArea8=20]="MarkedArea8",e[e.MarkedArea9=21]="MarkedArea9",e[e.MarkedArea10=22]="MarkedArea10",e[e.Comment1=23]="Comment1",e[e.Comment2=24]="Comment2",e[e.Comment3=25]="Comment3",e[e.Comment4=26]="Comment4",e[e.Comment5=27]="Comment5",e[e.Comment6=28]="Comment6",e[e.Comment7=29]="Comment7",e[e.Comment8=30]="Comment8",e[e.Comment9=31]="Comment9",e[e.Comment10=32]="Comment10",e})({}),Bt=new We.Dictionary;Bt.setValue(At.BaseWritingColor,"Thistle"),Bt.setValue(At.FollowingCursor,"Aqua"),Bt.setValue(At.AlternativeFollowingCursor,"Azure"),Bt.setValue(At.PlaybackCursor,"Bisque"),Bt.setValue(At.Highlighted,"CadetBlue"),Bt.setValue(At.ErrorUnderlay,"DarkBlue"),Bt.setValue(At.Selected,"DarkGoldenRod"),Bt.setValue(At.SelectionSymbol,"BlanchedAlmond"),Bt.setValue(At.DebugColor1,"Chartreuse"),Bt.setValue(At.DebugColor2,"DarkGreen"),Bt.setValue(At.DebugColor3,"DarkOrange"),Bt.setValue(At.SplitScreenDivision,"FireBrick"),Bt.setValue(At.GreyTransparentOverlay,"DarkSalmon"),Bt.setValue(At.MarkedArea1,"DarkSeaGreen"),Bt.setValue(At.MarkedArea2,"DarkOrchid"),Bt.setValue(At.MarkedArea3,"Aquamarine"),Bt.setValue(At.MarkedArea4,"DarkKhaki"),Bt.setValue(At.MarkedArea5,"ForestGreen"),Bt.setValue(At.MarkedArea6,"AliceBlue"),Bt.setValue(At.MarkedArea7,"DeepPink"),Bt.setValue(At.MarkedArea8,"Coral"),Bt.setValue(At.MarkedArea9,"DarkOliveGreen"),Bt.setValue(At.MarkedArea10,"Chocolate"),Bt.setValue(At.Comment1,"DodgerBlue"),Bt.setValue(At.Comment2,"Blue"),Bt.setValue(At.Comment3,"Beige"),Bt.setValue(At.Comment4,"Crimson"),Bt.setValue(At.Comment5,"Fuchsia"),Bt.setValue(At.Comment6,"Brown"),Bt.setValue(At.Comment7,"BlanchedAlmond"),Bt.setValue(At.Comment8,"CornflowerBlue"),Bt.setValue(At.Comment9,"Cornsilk"),Bt.setValue(At.Comment10,"DarkGrey");var mh=(function(e){return e[e.MarkedArea=0]="MarkedArea",e[e.Comment=1]="Comment",e})({}
3),$t=(function(e){return e[e.Background=0]="Background",e[e.Highlight=1]="Highlight",e[e.MeasureError=2]="MeasureError",e[e.SelectionSymbol=3]="SelectionSymbol",e[e.Cursor=4]="Cursor",e[e.PSI_Debug=5]="PSI_Debug",e[e.Notes=6]="Notes",e[e.Comment=7]="Comment",e[e.Debug_above=8]="Debug_above",e})({}),eo=(function(e){return e[e.Normal=0]="Normal",e[e.Selected=1]="Selected",e[e.Follow_Confirmed=2]="Follow_Confirmed",e[e.QFeedback_NotFound=3]="QFeedback_NotFound",e[e.QFeedback_OK=4]="QFeedback_OK",e[e.QFeedback_Perfect=5]="QFeedback_Perfect",e[e.Debug1=6]="Debug1",e[e.Debug2=7]="Debug2",e[e.Debug3=8]="Debug3",e})({}),Yr=(function(e){return e.C="#d82c6b",e.D="#F89D15",e.E="#FFE21A",e.F="#4dbd5c",e.G="#009D96",e.A="#43469d",e.B="#76429c",e.Rest="#000000",e})({}),Ae=class{constructor(e,t,i=0,s=At.BaseWritingColor,r=void 0){this.start=e,this.end=t,this.width=i,this.styleId=s,this.colorHex=r}get Start(){return this.start}set Start(e){this.start=e}get End(){return this.end}set End(e){this.end=e}get Width(){return this.width}set Width(e){this.width=e}},W=Ka(xe(((e,t)=>{(function(i,s){typeof define=="function"&&define.amd?define(s):typeof t=="object"&&t.exports?t.exports=s():i.log=s()})(e,function(){var i=function(){},s="undefined",r=typeof window!==s&&typeof window.navigator!==s&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"],a={},o=null;function l(g,b){var S=g[b];if(typeof S.bind=="function")return S.bind(g);try{return Function.prototype.bind.call(S,g)}catch{return function(){return Function.prototype.apply.apply(S,[g,arguments])}}}function h(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function u(g){return g==="debug"&&(g="log"),typeof console===s?!1:g==="trace"&&r?h:console[g]===void 0?console.log===void 0?i:l(console,"log"):l(console,g)}function c(){for(var g=this.getLevel(),b=0;b<n.length;b++){var S=n[b];this[S]=b<g?i:this.methodFactory(S,g,this.name)}if(this.log=this.debug,typeof console===s&&g<this.levels.SILENT)return"No console available for logging"}function d(g){return function(){typeof console!==s&&(c.call(this),this[g].apply(this,arguments))}}function f(g,b,S){return u(g)||d.apply(this,arguments)}function p(g,b){var S=this,E,y,M,P="loglevel";typeof g=="string"?P+=":"+g:typeof g=="symbol"&&(P=void 0);function L(T){var I=(n[T]||"silent").toUpperCase();if(!(typeof window===s||!P)){try{window.localStorage[P]=I;return}catch{}try{window.document.cookie=encodeURIComponent(P)+"="+I+";"}catch{}}}function B(){var T;if(!(typeof window===s||!P)){try{T=window.localStorage[P]}catch{}if(typeof T===s)try{var I=window.document.cookie,v=encodeURIComponent(P),U=I.indexOf(v+"=");U!==-1&&(T=/^([^;]+)/.exec(I.slice(U+v.length+1))[1])}catch{}return S.levels[T]===void 0&&(T=void 0),T}}function A(){if(!(typeof window===s||!P)){try{window.localStorage.removeItem(P)}catch{}try{window.document.cookie=encodeURIComponent(P)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function G(T){var I=T;if(typeof I=="string"&&S.levels[I.toUpperCase()]!==void 0&&(I=S.levels[I.toUpperCase()]),typeof I=="number"&&I>=0&&I<=S.levels.SILENT)return I;throw TypeError("log.setLevel() called with invalid level: "+T)}S.name=g,S.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},S.methodFactory=b||f,S.getLevel=function(){return M??y??E},S.setLevel=function(T,I){return M=G(T),I!==!1&&L(M),c.call(S)},S.setDefaultLevel=function(T){y=G(T),B()||S.setLevel(T,!1)},S.resetLevel=function(){M=null,A(),c.call(S)},S.enableAll=function(T){S.setLevel(S.levels.TRACE,T)},S.disableAll=function(T){S.setLevel(S.levels.SILENT,T)},S.rebuild=function(){if(o!==S&&(E=G(o.getLevel())),c.call(S),o===S)for(var T in a)a[T].rebuild()},E=G(o?o.getLevel():"WARN");var H=B();H!=null&&(M=G(H)),c.call(S)}o=new p,o.getLogger=function(g){if(typeof g!="symbol"&&typeof g!="string"||g==="")throw TypeError("You must supply a name when creating a logger.");var b=a[g];return b||(b=a[g]=new p(g,o.methodFactory)),b};var m=typeof window===s?void 0:window.log;return o.noConflict=function(){return typeof window!==s&&window.log===o&&(window.log=m),o},o.getLoggers=function(){return a},o.default=o,o})}
3))()),Se=class{constructor(e,t){this.message=e,t&&(this.message+=" "+t.toString())}},gi=class{constructor(e){this.message=e}},io=class{constructor(e){this.message=e}},k=class so{constructor(t=0,i=0){this.x=0,this.y=0,this.x=t,this.y=i}static get Empty(){return new so}static pointsAreEqual(t,i){return t.x===i.x&&t.y===i.y}ToString(){return"["+this.x+", "+this.y+"]"}},Xi=class{constructor(e=0,t=0){this.width=e,this.height=t}},Ze=class ro{constructor(t,i,s,r){this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=i,this.width=s,this.height=r}static createFromLocationAndSize(t,i){return new ro(t.x,t.y,i.width,i.height)}get Location(){return new k(this.x,this.y)}get Size(){return new Xi(this.width,this.height)}},no=class{isInstanceOfClass(e){let t=this.constructor.prototype;for(;t;){if(e===t.constructor.name)return!0;t=t.__proto__}return!1}},ue=class extends no{get PositionAndShape(){return this.boundingBox}set PositionAndShape(e){this.boundingBox=e}},Yt=class{constructor(e=void 0,t=void 0,i=!1){this.isSymbol=!1,this.relativePositionHasBeenSet=!1,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,this.absolutePosition=new k,this.relativePosition=new k,this.size=new Xi,this.marginSize=new Xi,this.upperLeftCorner=new k,this.upperLeftMarginCorner=new k,this.borderLeft=0,this.borderRight=0,this.borderTop=0,this.borderBottom=0,this.borderMarginLeft=0,this.borderMarginRight=0,this.borderMarginTop=0,this.borderMarginBottom=0,this.childElements=[],this.parent=t,this.dataObject=e,this.isSymbol=i,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,t&&(this.Parent=t)}get RelativePositionHasBeenSet(){return this.relativePositionHasBeenSet}get XBordersHaveBeenSet(){return this.xBordersHaveBeenSet}set XBordersHaveBeenSet(e){this.xBordersHaveBeenSet=e}get YBordersHaveBeenSet(){return this.yBordersHaveBeenSet}set YBordersHaveBeenSet(e){this.yBordersHaveBeenSet=e}get AbsolutePosition(){return this.absolutePosition}set AbsolutePosition(e){this.absolutePosition=e}get RelativePosition(){return this.relativePosition}set RelativePosition(e){this.relativePosition=e,this.relativePositionHasBeenSet=!0}get Size(){return this.size}set Size(e){this.size=e}get MarginSize(){return this.marginSize}
3get UpperLeftCorner(){return this.upperLeftCorner}get UpperLeftMarginCorner(){return this.upperLeftMarginCorner}get BorderLeft(){return this.borderLeft}set BorderLeft(e){this.borderLeft=e,this.calculateRectangle()}get BorderRight(){return this.borderRight}set BorderRight(e){this.borderRight=e,this.calculateRectangle()}get BorderTop(){return this.borderTop}set BorderTop(e){this.borderTop=e,this.calculateRectangle()}get BorderBottom(){return this.borderBottom}set BorderBottom(e){this.borderBottom=e,this.calculateRectangle()}get BorderMarginLeft(){return this.borderMarginLeft>this.borderLeft?this.borderLeft:this.borderMarginLeft}set BorderMarginLeft(e){this.borderMarginLeft=e,this.calculateMarginRectangle()}get BorderMarginRight(){return this.borderMarginRight<this.borderRight?this.borderRight:this.borderMarginRight}set BorderMarginRight(e){this.borderMarginRight=e,this.calculateMarginRectangle()}get BorderMarginTop(){return this.borderMarginTop>this.borderTop?this.borderTop:this.borderMarginTop}set BorderMarginTop(e){this.borderMarginTop=e,this.calculateMarginRectangle()}get BorderMarginBottom(){return this.borderMarginBottom<this.borderBottom?this.borderBottom:this.borderMarginBottom}set BorderMarginBottom(e){this.borderMarginBottom=e,this.calculateMarginRectangle()}get BoundingRectangle(){return this.boundingRectangle}get BoundingMarginRectangle(){return this.boundingMarginRectangle}get ChildElements(){return this.childElements}set ChildElements(e){this.childElements=e}get Parent(){return this.parent}set Parent(e){if(this.parent){let t=this.parent.ChildElements.indexOf(this,0);t>-1&&this.parent.ChildElements.splice(t,1)}this.parent=e,this.parent.ChildElements.indexOf(this)>-1?W.default.error("BoundingBox of "+this.dataObject.constructor.name+" already in children list of "+this.parent.dataObject.constructor.name+"'s BoundingBox"):this.parent.ChildElements.push(this)}get DataObject(){return this.dataObject}get Center(){return new k(this.RelativePosition.x+(this.BorderMarginRight+this.BorderMarginLeft),this.RelativePosition.y+(this.BorderMarginBottom+this.BorderMarginTop))}setAbsolutePositionFromParent(){this.parent?(this.absolutePosition.x=this.parent.AbsolutePosition.x+this.relativePosition.x,this.absolutePosition.y=this.parent.AbsolutePosition.y+this.relativePosition.y):this.absolutePosition=this.relativePosition}calculateAbsolutePosition(){this.absolutePosition.x=this.relativePosition.x,this.absolutePosition.y=this.relativePosition.y;let e=this.parent;for(;e;)this.absolutePosition.x+=e.relativePosition.x,this.absolutePosition.y+=e.relativePosition.y,e=e.parent}calculateAbsolutePositionsRecursiveWithoutTopelement(){this.absolutePosition.x=0,this.absolutePosition.y=0;for(let e=0,t=this.ChildElements.length;e<t;++e)this.ChildElements[e].calculateAbsolutePositionsRecursive(this.absolutePosition.x,this.absolutePosition.y)}calculateAbsolutePositionsRecursive(e,t){this.absolutePosition.x=this.relativePosition.x+e,this.absolutePosition.y=this.relativePosition.y+t;for(let i=0,s=this.ChildElements.length;i<s;++i)this.ChildElements[i].calculateAbsolutePositionsRecursive(this.absolutePosition.x,this.absolutePosition.y)}calculateAbsolutePositionsOfChildren(){for(let e=0,t=this.ChildElements.length;e<t;++e)this.ChildElements[e].calculateAbsolutePositionsRecursive(this.absolutePosition.x,this.absolutePosition.y)}calculateBoundingBox(e=[]){if(this.childElements.length===0)return;for(let h=0,u=this.ChildElements.length;h<u;++h){let c=this.ChildElements[h],d=!0;for(let f of e){let p=c.DataObject;if(p.isInstanceOfClass&&p.isInstanceOfClass(f)){d=!1;break}}d&&c.calculateBoundingBox(e)}let t=Number.MAX_VALUE,i=Number.MIN_VALUE,s=Number.MAX_VALUE,r=Number.MIN_VALUE,n=Number.MAX_VALUE,a=Number.MIN_VALUE,o=Number.MAX_VALUE,l=Number.MIN_VALUE;this.isSymbol&&(t=this.borderLeft,i=this.borderRight,s=this.borderTop,r=this.borderBottom,n=this.borderMarginLeft,a=this.borderMarginRight,o=this.borderMarginTop,l=this.borderMarginBottom);for(let h=0,u=this.ChildElements.length;h<u;++h){let c=this.ChildElements[h];t=Math.min(t,c.relativePosition.x+c.borderLeft),i=Math.max(i,c.relativePosition.x+c.borderRight),s=Math.min(s,c.relativePosition.y+c.borderTop),r=Math.max(r,c.relativePosition.y+c.borderBottom),n=Math.min(n,c.relativePosition.x+c.borderMarginLeft),a=Math.max(a,c.relativePosition.x+c.borderMarginRight),o=Math.min(o,c.relativePosition.y+c.borderMarginTop),l=Math.max(l,c.relativePosition.y+c.borderMarginBottom)}this.borderLeft=t,this.borderRight=i,this.borderTop=s,this.borderBottom=r,this.borderMarginLeft=n,this.borderMarginRight=a,this.borderMarginTop=o,this.borderMarginBottom=l,this.calculateRectangle(),this.calculateMarginRectangle(),this.xBordersHaveBeenSet=!0,this.yBordersHaveBeenSet=!0}calculateTopBottomBorders(){if(this.childElements.length===0)return;for(let r=0,n=this.ChildElements.length;r<n;++r)this.ChildElements[r].calculateTopBottomBorders();let e=Number.MAX_VALUE,t=Number.MIN_VALUE,i=Number.MAX_VALUE,s=Number.MIN_VALUE;this.yBordersHaveBeenSet&&(e=this.borderTop,t=this.borderBottom,i=this.borderMarginTop,s=this.borderMarginBottom);for(let r=0,n=this.ChildElements.length;r<n;++r){let a=this.ChildElements[r];e=Math.min(e,a.relativePosition.y+a.borderTop),t=Math.max(t,a.relativePosition.y+a.borderBottom),i=Math.min(i,a.relativePosition.y+a.borderMarginTop),s=Math.max(s,a.relativePosition.y+a.borderMarginBottom)}this.borderTop=e,this.borderBottom=t,this.borderMarginTop=i,this.borderMarginBottom=s,this.calculateRectangle(),this.calculateMarginRectangle()}computeNonOverlappingPositionWithMargin(e,t,i){this.RelativePosition=new k(i.x,i.y),this.setAbsolutePositionFromParent();let s=0,r=!1;do switch(t){case re.Left:case re.Right:s=this.relativePosition.x,e.calculateMarginPositionAlongDirection(this,t),r=Math.abs(s-this.relativePosition.x)>.001;break;case re.Up:case re.Down:s=this.relativePosition.y,e.calculateMarginPositionAlongDirection(this,t),r=Math.abs(s-this.relativePosition.y)>.001;break;default:throw new gi("direction")}while(r)}collisionDetection(e){let t=Math.min(this.AbsolutePosition.x+this.borderRight,e.absolutePosition.x+e.borderRight)-Math.max(this.AbsolutePosition.x+this.borderLeft,e.absolutePosition.x+e.borderLeft),i=Math.min(this.AbsolutePosition.y+this.borderBottom,e.absolutePosition.y+e.borderBottom)-Math.max(this.AbsolutePosition.y+this.borderTop,e.absolutePosition.y+e.borderTop);return t>=0&&i>=0}liesInsideBorders(e){let t=this.AbsolutePosition.x+this.borderLeft<=e.absolutePosition.x+e.borderLeft&&e.absolutePosition.x+e.borderLeft<=this.AbsolutePosition.x+this.borderRight,i=this.AbsolutePosition.x+this.borderLeft<=e.absolutePosition.x+e.borderRight&&e.absolutePosition.x+e.borderRight<=this.AbsolutePosition.x+this.borderRight;if(t&&i){let s=this.AbsolutePosition.y+this.borderTop<=e.absolutePosition.y+e.borderTop&&e.absolutePosition.y+e.borderTop<=this.AbsolutePosition.y+this.borderBottom,r=this.AbsolutePosition.y+this.borderTop<=e.absolutePosition.y+e.borderBottom&&e.absolutePosition.y+e.borderBottom<=this.AbsolutePosition.y+this.borderBottom;if(s&&r)return!0}return!1}pointLiesInsideBorders(e){return this.AbsolutePosition.x+this.borderLeft<=e.x&&e.x<=this.AbsolutePosition.x+this.borderRight&&this.AbsolutePosition.y+this.borderTop<=e.y&&e.y<=this.AbsolutePosition.y+this.borderBottom}marginCollisionDetection(e){let t=Math.min(this.AbsolutePosition.x+this.borderMarginRight,e.absolutePosition.x+e.borderMarginRight)-Math.max(this.AbsolutePosition.x+this.borderMarginLeft,e.absolutePosition.x+e.borderMarginLeft),i=Math.min(this.AbsolutePosition.y+this.borderMarginBottom,e.absolutePosition.y+e.borderMarginBottom)-Math.max(this.AbsolutePosition.y+this.borderMarginTop,e.absolutePosition.y+e.borderMarginTop);return t>0&&i>0}liesInsideMargins(e){let t=this.AbsolutePosition.x+this.borderMarginLeft<=e.absolutePosition.x+e.borderMarginLeft&&e.absolutePosition.x+e.borderMarginLeft<=this.AbsolutePosition.x+this.borderMarginRight,i=this.AbsolutePosition.x+this.borderMarginLeft<=e.absolutePosition.x+e.borderMarginRight&&e.absolutePosition.x+e.borderMarginRight<=this.AbsolutePosition.x+this.borderMarginRight;if(t&&i){let s=this.AbsolutePosition.y+this.borderMarginTop<=e.absolutePosition.y+e.borderMarginTop&&e.absolutePosition.y+e.borderMarginTop<=this.AbsolutePosition.y+this.borderMarginBottom,r=this.AbsolutePosition.y+this.borderMarginTop<=e.absolutePosition.y+e.borderMarginBottom&&e.absolutePosition.y+e.borderMarginBottom<=this.AbsolutePosition.y+this.borderMarginBottom;if(s&&r)return!0}return!1}pointLiesInsideMargins(e){return this.AbsolutePosition.x+this.borderMarginLeft<=e.x&&e.x<=this.AbsolutePosition.x+this.borderMarginRight&&this.AbsolutePosition.y+this.borderMarginTop<=e.y&&e.y<=this.AbsolutePosition.y+this.borderMarginBottom}computeNonOverlappingPosition(e,t,i){this.RelativePosition=new k(i.x,i.y),this.setAbsolutePositionFromParent();let s=0,r=!1;do switch(t){case re.Left:case re.Right:s=this.relativePosition.x,e.calculatePositionAlongDirection(this,t),r=Math.abs(s-this.relativePosition.x)>1e-4;break;case re.Up:case re.Down:s=this.relativePosition.y,e.calculatePositionAlongDirection(this,t),r=Math.abs(s-this.relativePosition.y)>1e-4;break;default:throw new gi("direction")}while(r)}getClickedObjectOfType(e){let t=this.dataObject;if(this.pointLiesInsideBorders(e)&&t)return t;for(let i=0,s=this.childElements.length;i<s;++i){let r=this.childElements[i].getClickedObjectOfType(e);if(r)return r}}getObjectsInRegion(e,t=!0,i=ue.name){let s=[];for(let r of this.childElements)s=s.concat(r.getObjectsInRegion(e,t,i));return this.dataObject&&this.dataObject.isInstanceOfClass(i)&&(t?e.liesInsideBorders(this)&&s.push(this.dataObject):e.collisionDetection(this)&&s.push(this.dataObject)),s}
3calculateRectangle(){this.upperLeftCorner=new k(this.BorderLeft,this.BorderTop),this.size=new Xi(this.BorderRight-this.BorderLeft,this.BorderBottom-this.BorderTop),this.boundingRectangle=Ze.createFromLocationAndSize(this.upperLeftCorner,this.size)}calculateMarginRectangle(){this.upperLeftMarginCorner=new k(this.BorderMarginLeft,this.BorderMarginTop),this.marginSize=new Xi(this.BorderMarginRight-this.BorderMarginLeft,this.BorderMarginBottom-this.BorderMarginTop),this.boundingMarginRectangle=Ze.createFromLocationAndSize(this.upperLeftMarginCorner,this.marginSize)}calculateMarginPositionAlongDirection(e,t){if(this!==e){if(this.isSymbol&&this.marginCollisionDetection(e)){let i=0;switch(t){case re.Left:i=this.absolutePosition.x+this.borderMarginLeft-(e.absolutePosition.x+e.borderMarginRight),e.relativePosition.x+=i,e.absolutePosition.x+=i;return;case re.Right:i=this.absolutePosition.x+this.borderMarginRight-(e.absolutePosition.x+e.borderMarginLeft),e.relativePosition.x+=i,e.absolutePosition.x+=i;return;case re.Up:i=this.absolutePosition.y+this.borderMarginTop-(e.absolutePosition.y+e.borderMarginBottom),e.relativePosition.y+=i,e.absolutePosition.y+=i;return;case re.Down:i=this.absolutePosition.y+this.borderMarginBottom-(e.absolutePosition.y+e.borderMarginTop),e.relativePosition.y+=i,e.absolutePosition.y+=i;return;default:throw new gi("direction")}}for(let i=0,s=this.ChildElements.length;i<s;++i)this.ChildElements[i].calculateMarginPositionAlongDirection(e,t)}}calculatePositionAlongDirection(e,t){if(this!==e){if(this.isSymbol&&this.collisionDetection(e)){let i;switch(t){case re.Left:i=this.absolutePosition.x+this.borderLeft-(e.absolutePosition.x+e.borderRight),e.relativePosition.x+=i,e.absolutePosition.x+=i;return;case re.Right:i=this.absolutePosition.x+this.borderRight-(e.absolutePosition.x+e.borderLeft),e.relativePosition.x+=i,e.absolutePosition.x+=i;return;case re.Up:i=this.absolutePosition.y+this.borderTop-(e.absolutePosition.y+e.borderBottom),e.relativePosition.y+=i,e.absolutePosition.y+=i;return;case re.Down:i=this.absolutePosition.y+this.borderBottom-(e.absolutePosition.y+e.borderTop),e.relativePosition.y+=i,e.absolutePosition.y+=i;return;default:throw new gi("direction")}}for(let i=0,s=this.ChildElements.length;i<s;++i)this.ChildElements[i].calculatePositionAlongDirection(e,t)}}},re=(function(e){return e[e.Left=0]="Left",e[e.Right=1]="Right",e[e.Up=2]="Up",e[e.Down=3]="Down",e[e.NotYetDefined=4]="NotYetDefined",e})({});Array.prototype.last||Object.defineProperty(Array.prototype,"last",{enumerable:!1,writable:!0,value:function(){return this[this.length-1]}}),Array.prototype.clear||Object.defineProperty(Array.prototype,"clear",{enumerable:!1,writable:!0,value:function(){this.length=0}}),Array.prototype.contains||Object.defineProperty(Array.prototype,"contains",{enumerable:!1,writable:!0,value:function(e){return this.indexOf(e)!==-1}});var Le=class{static contains2(e,t){for(let i=0;i<e.length;i++)if(e[i]===t)return!0;return!1}static last(e){return e[e.length-1]}static flat(e){return[].concat(...e)}static removeDictElementIfTrue(e,t,i){let s=[];t.forEach(function(r,n){i(e,r,n)&&s.push(r)});for(let r=0;r<s.length;r++)t.remove(s[r])}static getLastElement(e){return e[e.length-1]}static binarySearch(e,t,i,s=0,r=e.length-1){let n=1,a=-1;for(;s<=r&&(n=Math.floor((s+r)/2),n!==a);){let o=i(e[n],t);if(o===0)return n;o<0&&(s=n+1),0<o&&(r=n),a=n}return-n}},Nn=class extends ue{constructor(e,t=void 0,i=void 0){super(),this.graphicalChordContainers=[],this.tabStaffEntry=void 0,this.MaxAccidentals=0,this.graphicalInstructions=[],this.ties=[],this.graphicalTies=[],this.lyricsEntries=[],this.parentMeasure=e,this.graphicalVoiceEntries=[],this.sourceStaffEntry=t,i?(this.staffEntryParent=i,this.parentVerticalContainer=i.parentVerticalContainer,this.PositionAndShape=new Yt(this,i.PositionAndShape)):this.PositionAndShape=new Yt(this,e.PositionAndShape),t&&(this.relInMeasureTimestamp=t.Timestamp),this.FingeringEntries=[]}get GraphicalInstructions(){return this.graphicalInstructions}get GraphicalTies(){return this.graphicalTies}get LyricsEntries(){return this.lyricsEntries}set LyricsEntries(e){this.lyricsEntries=e}getAbsoluteTimestamp(){let e=this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.clone();return this.relInMeasureTimestamp&&e.Add(this.relInMeasureTimestamp),e}findTieGraphicalNoteFromNote(e){for(let t of this.graphicalVoiceEntries)for(let i of t.notes){let s=i.sourceNote;if(!s.isRest()&&s.Pitch.FundamentalNote===e.Pitch.FundamentalNote&&s.Pitch.Octave===e.Pitch.Octave&&s.getAbsoluteTimestamp().Equals(e.getAbsoluteTimestamp()))return i}}findEndTieGraphicalNoteFromNoteWithStartingSlur(e,t){if(e){for(let i of this.graphicalVoiceEntries)if(i.parentVoiceEntry===e.ParentVoiceEntry)for(let s of i.notes){let r=s.sourceNote;if(r.NoteTie&&r.NoteSlurs.indexOf(t)!==-1)return s}}}findGraphicalNoteFromGraceNote(e){if(e){for(let t of this.graphicalVoiceEntries)if(t.parentVoiceEntry===e.ParentVoiceEntry){for(let i of t.notes)if(i.sourceNote===e)return i}}}findGraphicalNoteFromNote(e){if(e){for(let t of this.graphicalVoiceEntries)if(t.parentVoiceEntry===e.ParentVoiceEntry){for(let i of t.notes)if(i.sourceNote===e&&this.getAbsoluteTimestamp().Equals(e.getAbsoluteTimestamp()))return i}}}getGraphicalNoteDurationFromVoice(e){for(let t of this.graphicalVoiceEntries)if(t.parentVoiceEntry.ParentVoice===e)return t.notes[0].graphicalNoteLength;return new N(0,1)}findVoiceEntryGraphicalNotes(e){for(let t of this.graphicalVoiceEntries)if(t.parentVoiceEntry===e)return t.notes}isVoiceEntryPartOfLinkedVoiceEntry(e){if(this.sourceStaffEntry.Link)for(let t=0,i=this.sourceStaffEntry.Link.LinkStaffEntries.length;t<i;++t){let s=this.sourceStaffEntry.Link.LinkStaffEntries[t];
3if(s.VoiceEntries.indexOf(e)!==-1&&s!==this.sourceStaffEntry)return!0}return!1}findStaffEntryMinNoteLength(){let e=new N(Number.MAX_VALUE,1);for(let t of this.graphicalVoiceEntries)for(let i of t.notes){let s=i.graphicalNoteLength;s.lt(e)&&s.GetExpandedNumerator()>0&&(e=s)}return e}findStaffEntryMaxNoteLength(){let e=new N(0,1);for(let t of this.graphicalVoiceEntries)for(let i of t.notes){let s=i.graphicalNoteLength;e.lt(s)&&s.GetExpandedNumerator()>0&&(e=s)}return e}findOrCreateGraphicalVoiceEntry(e){for(let i of this.graphicalVoiceEntries)if(i.parentVoiceEntry===e)return i;let t=Xt.symbolFactory.createVoiceEntry(e,this);return this.graphicalVoiceEntries.push(t),t}findOrCreateGraphicalVoiceEntryFromGraphicalNote(e){for(let i of this.graphicalVoiceEntries)if(i===e.parentVoiceEntry)return i;let t=Xt.symbolFactory.createVoiceEntry(e.sourceNote.ParentVoiceEntry,this);return this.graphicalVoiceEntries.push(t),t}addGraphicalNoteToListAtCorrectYPosition(e,t){let i=e.notes;if(i.length===0||t.PositionAndShape.RelativePosition.y<Le.last(i).PositionAndShape.RelativePosition.y)i.push(t);else for(let s=i.length-1;s>=0;s--){if(i[s].PositionAndShape.RelativePosition.y>t.PositionAndShape.RelativePosition.y){i.splice(s+1,0,t);break}if(s===0){i.splice(0,0,t);break}}}hasOnlyRests(){return this.sourceStaffEntry.hasOnlyRests}getSkylineMin(){let e=this.parentMeasure?.ParentStaffLine.SkyBottomLineCalculator;if(!e)return;let[t,i]=this.getAbsoluteStartAndEnd();return e.getSkyLineMinInRange(t,i)}getHighestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getSkylineMin()}getLowestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getBottomlineMax()}getBottomlineMax(){let e=this.parentMeasure?.ParentStaffLine.SkyBottomLineCalculator;if(!e)return;let[t,i]=this.getAbsoluteStartAndEnd();return e.getBottomLineMaxInRange(t,i)}getAbsoluteStartAndEnd(){let e=this.PositionAndShape.AbsolutePosition.x;e-=this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.x;let t=e+this.PositionAndShape.Size.width;return[e,t]}},Fs,ut=(function(e){return e[e.C=0]="C",e[e.D=2]="D",e[e.E=4]="E",e[e.F=5]="F",e[e.G=7]="G",e[e.A=9]="A",e[e.B=11]="B",e})({}),q=(function(e){return e[e.SHARP=0]="SHARP",e[e.FLAT=1]="FLAT",e[e.NONE=2]="NONE",e[e.NATURAL=3]="NATURAL",e[e.DOUBLESHARP=4]="DOUBLESHARP",e[e.DOUBLEFLAT=5]="DOUBLEFLAT",e[e.TRIPLESHARP=6]="TRIPLESHARP",e[e.TRIPLEFLAT=7]="TRIPLEFLAT",e[e.QUARTERTONESHARP=8]="QUARTERTONESHARP",e[e.QUARTERTONEFLAT=9]="QUARTERTONEFLAT",e[e.SLASHFLAT=10]="SLASHFLAT",e[e.THREEQUARTERSSHARP=11]="THREEQUARTERSSHARP",e[e.THREEQUARTERSFLAT=12]="THREEQUARTERSFLAT",e[e.SLASHQUARTERSHARP=13]="SLASHQUARTERSHARP",e[e.SLASHSHARP=14]="SLASHSHARP",e[e.DOUBLESLASHFLAT=15]="DOUBLESLASHFLAT",e[e.SORI=16]="SORI",e[e.KORON=17]="KORON",e})({}),Ct=class _t{static getNoteEnumString(t){switch(t){case ut.C:return"C";case ut.D:return"D";case ut.E:return"E";case ut.F:return"F";case ut.G:return"G";case ut.A:return"A";case ut.B:return"B";default:return""}}static lineShiftFromNoteEnum(t,i){if(i===0)return[t,0];let s=_t.pitchEnumValues,r=s.indexOf(t),n=0,a=(r+i)%s.length;return r+i>s.length-1&&(n=1),a<0&&(a=s.length+a,n=-1),[s[a],n]}static CalculateTransposedHalfTone(t,i){let s=t.fundamentalNote+t.AccidentalHalfTones+i;return _t.WrapAroundCheck(s,12)}static WrapAroundCheck(t,i){let s=0;for(;t<0;)t+=i,s--;for(;t>=i;)t-=i,s++;return{overflow:s,halftone:t}}static calcFrequency(t){let i=0,s;if(t instanceof _t){let r=t;i=r.octave-1,s=r.fundamentalNote-ut.A+r.AccidentalHalfTones}else typeof t=="number"&&(s=t-57);return 440*2**i*2**(s/12)}static calcFractionalKey(t){return Math.log(t/440)/Math.LN10*_t.halftoneFactor+57}static fromFrequency(t){let i=_t.calcFractionalKey(t)+.5,s=Math.floor(i/12)-_t.octXmlDiff,r=Math.floor(i)%12,n=r,a=q.NONE;return this.pitchEnumValues.indexOf(n)===-1&&(n=r-1,a=q.SHARP),new _t(n,s,a)}static fromHalftone(t){let i=Math.floor(t/12)-_t.octXmlDiff,s=t%12,r=s,n=q.NONE;return this.pitchEnumValues.indexOf(r)===-1&&(r=s-1,n=q.SHARP),new _t(r,i,n)}static ceiling(t){t%=12;let i=t;return this.pitchEnumValues.indexOf(i)===-1&&(i=t+1),i}static floor(t){t%=12;let i=t;return this.pitchEnumValues.indexOf(i)===-1&&(i=t-1),i}constructor(t,i,s,r=void 0,n=!1,a=void 0){this.accidental=q.NONE,this.fund
3amentalNote=t,this.octave=i,this.accidental=s,this.accidentalXml=r,this.halfTone=t+(i+_t.octXmlDiff)*12+_t.HalfTonesFromAccidental(s),n||(this.frequency=_t.calcFrequency(this)),this.OctaveShiftApplied=a}static HalfTonesFromAccidental(t){switch(t){case q.NONE:return 0;case q.SHARP:return 1;case q.FLAT:return-1;case q.NATURAL:return 0;case q.DOUBLESHARP:return 2;case q.DOUBLEFLAT:return-2;case q.TRIPLESHARP:return 3;case q.TRIPLEFLAT:return-3;case q.QUARTERTONESHARP:return .5;case q.QUARTERTONEFLAT:return-.5;case q.SLASHFLAT:return-.51;case q.THREEQUARTERSSHARP:return 1.5;case q.THREEQUARTERSFLAT:return-1.5;case q.SLASHQUARTERSHARP:return .0013;case q.SLASHSHARP:return .0014;case q.DOUBLESLASHFLAT:return-.0015;case q.SORI:return .0016;case q.KORON:return .0017;default:throw Error("Unhandled AccidentalEnum value")}}static AccidentalFromHalfTones(t){switch(t){case 0:return q.NONE;case 1:return q.SHARP;case-1:return q.FLAT;case 2:return q.DOUBLESHARP;case-2:return q.DOUBLEFLAT;case 3:return q.TRIPLESHARP;case-3:return q.TRIPLEFLAT;case .5:return q.QUARTERTONESHARP;case-.5:return q.QUARTERTONEFLAT;case 1.5:return q.THREEQUARTERSSHARP;case-1.5:return q.THREEQUARTERSFLAT;default:return t>0&&t<1?q.QUARTERTONESHARP:t<0&&t>-1?q.QUARTERTONEFLAT:q.QUARTERTONESHARP}}static accidentalVexflow(t){let i;switch(t){case q.NATURAL:i="n";break;case q.FLAT:i="b";break;case q.SHARP:i="#";break;case q.DOUBLESHARP:i="##";break;case q.TRIPLESHARP:i="###";break;case q.DOUBLEFLAT:i="bb";break;case q.TRIPLEFLAT:i="bbs";break;case q.QUARTERTONESHARP:i="+";break;case q.QUARTERTONEFLAT:i="d";break;case q.SLASHFLAT:i="bs";break;case q.THREEQUARTERSSHARP:i="++";break;case q.THREEQUARTERSFLAT:i="db";break;case q.SLASHQUARTERSHARP:i="+-";break;case q.SLASHSHARP:i="++-";break;case q.DOUBLESLASHFLAT:i="bss";break;case q.SORI:i="o";break;case q.KORON:i="k";break;default:}return i}get AccidentalHalfTones(){return _t.HalfTonesFromAccidental(this.accidental)}get Octave(){return this.octave}get FundamentalNote(){return this.fundamentalNote}get Accidental(){return this.accidental}get AccidentalXml(){return this.accidentalXml}get Frequency(){return this.frequency}static get OctaveXmlDifference(){return _t.octXmlDiff}getHalfTone(){return this.halfTone}getTransposedPitch(t){if(t>12)throw Error("rewrite this method to handle bigger octave changes or don't use is with bigger octave changes!");return t>0?this.getHigherPitchByTransposeFactor(t):t<0?this.getLowerPitchByTransposeFactor(-t):this}DoEnharmonicChange(){switch(this.accidental){case q.FLAT:case q.DOUBLEFLAT:this.fundamentalNote=this.getPreviousFundamentalNote(this.fundamentalNote),this.accidental=_t.AccidentalFromHalfTones(this.halfTone-(this.fund
3amentalNote+(this.octave+_t.octXmlDiff)*12));break;case q.SHARP:case q.DOUBLESHARP:this.fundamentalNote=this.getNextFundamentalNote(this.fundamentalNote),this.accidental=_t.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+(this.octave+_t.octXmlDiff)*12));break;default:return}}ToString(){let t=_t.accidentalVexflow(this.accidental);return t||(t=""),"Key: "+_t.getNoteEnumString(this.fundamentalNote)+t+", Note: "+this.fundamentalNote+", octave: "+this.octave.toString()}ToStringShort(t=0){let i=_t.accidentalVexflow(this.accidental);i||(i="");let s=this.octave+t;return _t.getNoteEnumString(this.fundamentalNote)+i+s}get ToStringShortGet(){return this.ToStringShort(0)}OperatorEquals(t){let i=this;return!i||!t?!1:i.FundamentalNote===t.FundamentalNote&&i.Octave===t.Octave&&i.Accidental===t.Accidental}OperatorNotEqual(t){return this!==t}OperatorFundamentalGreaterThan(t){let i=this;return i.Octave===t.Octave?i.FundamentalNote>t.FundamentalNote:i.Octave>t.Octave}OperatorFundamentalLessThan(t){let i=this;return i.Octave===t.Octave?i.FundamentalNote<t.FundamentalNote:i.Octave<t.Octave}getHigherPitchByTransposeFactor(t){let i=_t.pitchEnumValues.indexOf(this.fundamentalNote),s=this.octave,r;return i+t>_t.pitchEnumValues.length-1?(r=_t.pitchEnumValues[i+t-_t.pitchEnumValues.length],s++):r=_t.pitchEnumValues[i+t],new _t(r,s,q.NONE)}getLowerPitchByTransposeFactor(t){let i=_t.pitchEnumValues.indexOf(this.fundamentalNote),s=this.octave,r;return i-t<0?(r=_t.pitchEnumValues[_t.pitchEnumValues.length+i-t],s--):r=_t.pitchEnumValues[i-t],new _t(r,s,q.NONE)}getNextFundamentalNote(t){let i=_t.pitchEnumValues.indexOf(t);return i=(i+1)%_t.pitchEnumValues.length,_t.pitchEnumValues[i]}getPreviousFundamentalNote(t){let i=_t.pitchEnumValues.indexOf(t);return i>0?_t.pitchEnumValues[i-1]:_t.pitchEnumValues[_t.pitchEnumValues.length-1]}};Fs=Ct,Fs.pitchEnumValues=[ut.C,ut.D,ut.E,ut.F,ut.G,ut.A,ut.B],Fs.halftoneFactor=12/(Math.LN2/Math.LN10),Fs.octXmlDiff=3;var br=class{constructor(e){this.printObject=!0,this.parent=e}get Parent(){return this.parent}set Parent(e){this.parent=e}get PrintObject(){return this.printObject}set PrintObject(e){this.printObject=e}},Zt=class Oe extends br{constructor(t=yt.G,i=0,s=2){super(void 0),this.clefType=yt.G,this.line=2,this.octaveOffset=0,this.line=s,this.clefType=t,this.octaveOffset=i,this.calcParameters()}static getDefaultClefFromMidiInstrument(t){switch(t){case lt.Acoustic_Grand_Piano:return new Oe(yt.F,0,4);case lt.Electric_Bass_finger:return new Oe(yt.F,0,4);case lt.Electric_Bass_pick:return new Oe(yt.F,0,4);case lt.Fretless_Bass:return new Oe(yt.F,0,4);case lt.Slap_Bass_1:return new Oe(yt.F,0,4);case lt.Slap_Bass_2:return new Oe(yt.F,0,4);case lt.Synth_Bass_1:return new Oe(yt.F,0,4);case lt.Synth_Bass_2:return new Oe(yt.F,0,4);case lt.Contrabass:return new Oe(yt.F,0,4);default:return new Oe(yt.G,0,2)}}static getAllPossibleClefs(){let t=[];for(let i=0;i<=2;i++){let s=new Oe(yt.G,i,2);t.push(s)}for(let i=-2;i<=0;i++){let s=new Oe(yt.F,i,4);t.push(s)}return t}static isSupportedClef(t){switch(t){case yt.G:case yt.F:case yt.C:case yt.percussion:case yt.TAB:return!0;default:return!1}}get ClefType(){return this.clefType}set ClefType(t){this.clefType=t}get Line(){return this.line}set Line(t){this.line=t}get OctaveOffset(){return this.octaveOffset}set OctaveOffset(t){this.octaveOffset=t}get ClefPitch(){return this.clefPitch}set ClefPitch(t){this.clefPitch=t}get ReferenceCyPosition(){return this.referenceCyPosition}set ReferenceCyPosition(t){this.referenceCyPosition=t}Equals(t){return this===t?!0:!this||!t?!1:this.clefPitch===t.clefPitch&&this.Line===t.Line}NotEqual(t){return!this.Equals(t)}ToString(){return"ClefType: "+this.clefType}calcParameters(){switch(this.clefType){case yt.G:this.clefPitch=new Ct(ut.G,1+this.octaveOffset,q.NONE),this.referenceCyPosition=5-this.line+2;break;case yt.F:this.clefPitch=new Ct(ut.F,0+this.octaveOffset,q.NONE),this.referenceCyPosition=5-this.line+1.5;break;case yt.C:this.clefPitch=new Ct(ut.C,1+this.octaveOffset,q.NONE),this.referenceCyPosition=5-this.line;break;case yt.percussion:this.clefPitch=new Ct(ut.C,2,q.NONE),this.referenceCyPosition=2;break;case yt.TAB:this.clefPitch=new Ct(ut.G,0,q.NONE),this.referenceCyPosition=0;break;default:throw new gi("clefType")}}},yt=(function(e){return e[e.G=0]="G",e[e.F=1]="F",e[e.C=2]="C",e[e.percussion=3]="percussion",e[e.TAB=4]="TAB",e})({}),lt=(function(e){return e[e.None=-1]="None",e[e.Acoustic_Grand_Piano=1+e.None]="Acoustic_Grand_Piano",e[e.Bright_Acoustic_Piano=1+e.Acoustic_Grand_Piano]="Bright_Acoustic_Piano",e[e.Electric_Grand_Piano=1+e.Bright_Acoustic_Piano]="Electric_Grand_Piano",e[e.Honky_tonk_Piano=1+e.Electric_Grand_Piano]="Honky_tonk_Piano",e[e.Electric_Piano_1=1+e.Honky_tonk_Piano]="Electric_Piano_1",e[e.Electric_Piano_2=1+e.Electric_Piano_1]="Electric_Piano_2",e[e.Harpsichord=1+e.Electric_Piano_2]="Harpsichord",e[e.Clavinet=1+e.Harpsichord]="Clavinet",e[e.Celesta=1+e.Clavinet]="Celesta",e[e.Glockenspiel=1+e.Celesta]="Glockenspiel",e[e.Music_Box=1+e.Glockenspiel]="Music_Box",e[e.Vibraphone=1+e.Music_Box]="Vibraphone",e[e.Marimba=1+e.Vibraphone]="Marimba",e[e.Xylophone=1+e.Marimba]="Xylo
3phone",e[e.Tubular_Bells=1+e.Xylophone]="Tubular_Bells",e[e.Dulcimer=1+e.Tubular_Bells]="Dulcimer",e[e.Drawbar_Organ=1+e.Dulcimer]="Drawbar_Organ",e[e.Percussive_Organ=1+e.Drawbar_Organ]="Percussive_Organ",e[e.Rock_Organ=1+e.Percussive_Organ]="Rock_Organ",e[e.Church_Organ=1+e.Rock_Organ]="Church_Organ",e[e.Reed_Organ=1+e.Church_Organ]="Reed_Organ",e[e.Accordion=1+e.Reed_Organ]="Accordion",e[e.Harmonica=1+e.Accordion]="Harmonica",e[e.Tango_Accordion=1+e.Harmonica]="Tango_Accordion",e[e.Acoustic_Guitar_nylon=1+e.Tango_Accordion]="Acoustic_Guitar_nylon",e[e.Acoustic_Guitar_steel=1+e.Acoustic_Guitar_nylon]="Acoustic_Guitar_steel",e[e.Electric_Guitar_jazz=1+e.Acoustic_Guitar_steel]="Electric_Guitar_jazz",e[e.Electric_Guitar_clean=1+e.Electric_Guitar_jazz]="Electric_Guitar_clean",e[e.Electric_Guitar_muted=1+e.Electric_Guitar_clean]="Electric_Guitar_muted",e[e.Overdriven_Guitar=1+e.Electric_Guitar_muted]="Overdriven_Guitar",e[e.Distortion_Guitar=1+e.Overdriven_Guitar]="Distortion_Guitar",e[e.Guitar_harmonics=1+e.Distortion_Guitar]="Guitar_harmonics",e[e.Acoustic_Bass=1+e.Guitar_harmonics]="Acoustic_Bass",e[e.Electric_Bass_finger=1+e.Acoustic_Bass]="Electric_Bass_finger",e[e.Electric_Bass_pick=1+e.Electric_Bass_finger]="Electric_Bass_pick",e[e.Fretless_Bass=1+e.Electric_Bass_pick]="Fretless_Bass",e[e.Slap_Bass_1=1+e.Fretless_Bass]="Slap_Bass_1",e[e.Slap_Bass_2=1+e.Slap_Bass_1]="Slap_Bass_2",e[e.Synth_Bass_1=1+e.Slap_Bass_2]="Synth_Bass_1",e[e.Synth_Bass_2=1+e.Synth_Bass_1]="Synth_Bass_2",e[e.Violin=1+e.Synth_Bass_2]="Violin",e[e.Viola=1+e.Violin]="Viola",e[e.Cello=1+e.Viola]="Cello",e[e.Contrabass=1+e.Cello]="Contrabass",e[e.Tremolo_Strings=1+e.Contrabass]="Tremolo_Strings",e[e.Pizzicato_Strings=1+e.Tremolo_Strings]="Pizzicato_Strings",e[e.Orchestral_Harp=1+e.Pizzicato_Strings]="Orchestral_Harp",e[e.Timpani=1+e.Orchestral_Harp]="Timpani",e[e.String_Ensemble_1=1+e.Timpani]="String_Ensemble_1",e[e.String_Ensemble_2=1+e.String_Ensemble_1]="String_Ensemble_2",e[e.Synth_Strings_1=1+e.String_Ensemble_2]="Synth_Strings_1",e[e.Synth_Strings_2=1+e.Synth_Strings_1]="Synth_Strings_2",e[e.Choir_Aahs=1+e.Synth_Strings_2]="Choir_Aahs",e[e.Voice_Oohs=1+e.Choir_Aahs]="Voice_Oohs",e[e.Synth_Voice=1+e.Voice_Oohs]="Synth_Voice",e[e.Orchestra_Hit=1+e.Synth_Voice]="Orchestra_Hit",e[e.Trumpet=1+e.Orchestra_Hit]="Trumpet",e[e.Trombone=1+e.Trumpet]="Trombone",e[e.Tuba=1+e.Trombone]="Tuba",e[e.Muted_Trumpet=1+e.Tuba]="Muted_Trumpet",e[e.French_Horn=1+e.Muted_Trumpet]="French_Horn",e[e.Brass_Section=1+e.French_Horn]="Brass_Section",e[e.Synth_Brass_1=1+e.Brass_Section]="Synth_Brass_1",e[e.Synth_Brass_2=1+e.Synth_Brass_1]="Synth_Brass_2",e[e.Soprano_Sax=1+e.Synth_Brass_2]="Soprano_Sax",e[e.Alto_Sax=1+e.Soprano_Sax]="Alto_Sax",e[e.Tenor_Sax=1+e.Alto_Sax]="Tenor_Sax",e[e.Baritone_Sax=1+e.Tenor_Sax]="Baritone_Sax",e[e.Oboe=1+e.Baritone_Sax]="Oboe",e[e.English_Horn=1+e.Oboe]="English_Horn",e[e.Bassoon=1+e.English_Horn]="Bassoon",e[e.Clarinet=1+e.Bassoon]="Clarinet",e[e.P
3iccolo=1+e.Clarinet]="Piccolo",e[e.Flute=1+e.Piccolo]="Flute",e[e.Recorder=1+e.Flute]="Recorder",e[e.Pan_Flute=1+e.Recorder]="Pan_Flute",e[e.Blown_Bottle=1+e.Pan_Flute]="Blown_Bottle",e[e.Shakuhachi=1+e.Blown_Bottle]="Shakuhachi",e[e.Whistle=1+e.Shakuhachi]="Whistle",e[e.Ocarina=1+e.Whistle]="Ocarina",e[e.Lead_1_square=1+e.Ocarina]="Lead_1_square",e[e.Lead_2_sawtooth=1+e.Lead_1_square]="Lead_2_sawtooth",e[e.Lead_3_calliope=1+e.Lead_2_sawtooth]="Lead_3_calliope",e[e.Lead_4_chiff=1+e.Lead_3_calliope]="Lead_4_chiff",e[e.Lead_5_charang=1+e.Lead_4_chiff]="Lead_5_charang",e[e.Lead_6_voice=1+e.Lead_5_charang]="Lead_6_voice",e[e.Lead_7_fifths=1+e.Lead_6_voice]="Lead_7_fifths",e[e.Lead_8_bass_lead=1+e.Lead_7_fifths]="Lead_8_bass_lead",e[e.Pad_1_new_age=1+e.Lead_8_bass_lead]="Pad_1_new_age",e[e.Pad_2_warm=1+e.Pad_1_new_age]="Pad_2_warm",e[e.Pad_3_polysynth=1+e.Pad_2_warm]="Pad_3_polysynth",e[e.Pad_4_choir=1+e.Pad_3_polysynth]="Pad_4_choir",e[e.Pad_5_bowed=1+e.Pad_4_choir]="Pad_5_bowed",e[e.Pad_6_metallic=1+e.Pad_5_bowed]="Pad_6_metallic",e[e.Pad_7_halo=1+e.Pad_6_metallic]="Pad_7_halo",e[e.Pad_8_sweep=1+e.Pad_7_halo]="Pad_8_sweep",e[e.FX_1_rain=1+e.Pad_8_sweep]="FX_1_rain",e[e.FX_2_soundtrack=1+e.FX_1_rain]="FX_2_soundtrack",e[e.FX_3_crystal=1+e.FX_2_soundtrack]="FX_3_crystal",e[e.FX_4_atmosphere=1+e.FX_3_crystal]="FX_4_atmosphere",e[e.FX_5_brightness=1+e.FX_4_atmosphere]="FX_5_brightness",e[e.FX_6_goblins=1+e.FX_5_brightness]="FX_6_goblins",e[e.FX_7_echoes=1+e.FX_6_goblins
3]="FX_7_echoes",e[e.FX_8_scifi=1+e.FX_7_echoes]="FX_8_scifi",e[e.Sitar=1+e.FX_8_scifi]="Sitar",e[e.Banjo=1+e.Sitar]="Banjo",e[e.Shamisen=1+e.Banjo]="Shamisen",e[e.Koto=1+e.Shamisen]="Koto",e[e.Kalimba=1+e.Koto]="Kalimba",e[e.Bag_pipe=1+e.Kalimba]="Bag_pipe",e[e.Fiddle=1+e.Bag_pipe]="Fiddle",e[e.Shanai=1+e.Fiddle]="Shanai",e[e.Tinkle_Bell=1+e.Shanai]="Tinkle_Bell",e[e.Agogo=1+e.Tinkle_Bell]="Agogo",e[e.Steel_Drums=1+e.Agogo]="Steel_Drums",e[e.Woodblock=1+e.Steel_Drums]="Woodblock",e[e.Taiko_Drum=1+e.Woodblock]="Taiko_Drum",e[e.Melodic_Tom=1+e.Taiko_Drum]="Melodic_Tom",e[e.Synth_Drum=1+e.Melodic_Tom]="Synth_Drum",e[e.Reverse_Cymbal=1+e.Synth_Drum]="Reverse_Cymbal",e[e.Guitar_Fret_Noise=1+e.Reverse_Cymbal]="Guitar_Fret_Noise",e[e.Breath_Noise=1+e.Guitar_Fret_Noise]="Breath_Noise",e[e.Seashore=1+e.Breath_Noise]="Seashore",e[e.Bird_Tweet=1+e.Seashore]="Bird_Tweet",e[e.Telephone_Ring=1+e.Bird_Tweet]="Telephone_Ring",e[e.Helicopter=1+e.Telephone_Ring]="Helicopter",e[e.Applause=1+e.Helicopter]="Applause",e[e.Gunshot=1+e.Applause]="Gunshot",e[e.Percussion=128]="Percussion",e})({}),Cr,ye=class us extends br{constructor(t=void 0,i=0,s=ai.major){super(t),this.isTransposedBy=0,this.Key=i,this.keyTypeOriginal=i,this.mode=s,this.alteratedNotes=this.calcAlteratedNotes()}static copy(t){let i=new us(t.parent,t.Key,t.Mode);return i.keyTypeOriginal=t.keyTypeOriginal,i}static getAllPossibleMajorKeyInstructions(){let t=[];for(let i=-7;i<7;i++){let s=new us(void 0,i,ai.major);t.push(s)}return t}get Key(){return this.keyType}set Key(t){this.keyType=t,this.alteratedNotes=this.calcAlteratedNotes()}get Mode(){return this.mode}set Mode(t){this.mode=t}get AlteratedNotes(){return this.alteratedNotes}calcAlteratedNotes(){let t=[];if(this.keyType>0)for(let i=0;i<this.keyType;i++)t.push(us.sharpPositionList[i]);else if(this.keyType<0)for(let i=0;i<-this.keyType;i++)t.push(us.flatPositionList[i]);return t}willAlterateNote(t){return this.alteratedNotes.indexOf(t)>=0}getAlterationForPitch(t){return this.keyType>0&&this.alteratedNotes.indexOf(t.FundamentalNote)<=this.keyType?q.SHARP:this.keyType<0&&this.alteratedNotes.indexOf(t.FundamentalNote)<=Math.abs(this.keyType)?q.FLAT:q.NONE}ToString(){return"Key: "+this.keyType+this.mode}OperatorEquals(t){let i=this;return i===t?!0:!i||!t?!1:i.Key===t.Key&&i.Mode===t.Mode}OperatorNotEqual(t){return!this.OperatorEquals(t)}};Cr=ye,Cr.sharpPositionList=[ut.F,ut.C,ut.G,ut.D,ut.A,ut.E,ut.B],Cr.flatPositionList=[ut.B,ut.E,ut.A,ut.D,ut.G,ut.C,ut.F];var gh=class{constructor(e,t){this.note=e,this.halfTone=t}},ai=(function(e){return e[e.major=0]="major",e[e.minor=1]="minor",e[e.none=2]="none",e[e.dorian=3]="dorian",e[e.phrygian=4]="phrygian",e[e.lydian=5]="lydian",e[e.mixolydian=6]="mixolydian",e[e.aeolian=7]="aeolian",e[e.ionian=8]="ionian",e[e.locrian=9]="locrian",e})({}),sr=class extends ue{constructor(e){super(),this.musicSystems=[],this.labels=[],this.parent=e,this.boundingBox=new Yt(this,void 0)}get MusicSystems(){return this.musicSystems}set MusicSystems(e){this.musicSystems=e}get Labels(){return this.labels}set Labels(e){this.labels=e}get Parent(){return this.parent}set Parent(e){this.parent=e}get PageNumber(){return this.pageNumber}set PageNumber(e){this.pageNumber=e}setMusicPageAbsolutePosition(e,t){return new k(0,0)}},ao=(function(e){return e[e.Down=0]="Down",e[e.Right=1]="Right",e[e.RightDown=2]="RightDown",e})({}),mt=(function(e){return e[e.LeftTop=0]="LeftTop",e[e.LeftCenter=1]="LeftCenter",e[e.LeftBottom=2]="LeftBottom",e[e.CenterTop=3]="CenterTop",e[e.CenterCenter=4]="CenterCenter",e[e.CenterBottom=5]="CenterBottom",e[e.RightTop=6]="RightTop",e[e.RightCenter=7]="RightCenter",e[e.RightBottom=8]="RightBottom",e})({}),Gs=class{static IsLeft(e){return e===mt.LeftTop||e===mt.LeftCenter||e===mt.LeftBottom}static IsCenterAligned(e){return e===mt.CenterTop||e===mt.CenterCenter||e===mt.CenterBottom}static IsRight(e){return e===mt.RightTop||e===mt.RightCenter||e===mt.RightBottom}},Pi=class{constructor(e){this.placement=e}static isStringInStringList(e,t){for(let i=0,s=e.length;i<s;++i){let r=e[i];if(t.toLowerCase()===r.toLowerCase().trim())return!0}return!1}get Placement(){return this.placement}static PlacementEnumFromString(e){switch(e.toLowerCase()){case"above":return C.Above;case"below":return C.Below;case"aboveorbelow":case"abovebelow":return C.AboveOrBelow;case"left":return C.Left;case"right":return C.Right;default:return C.NotYetDefined}}},C=(function(e){return e[e.Above=0]="Above",e[e.Below=1]="Below",e[e.Left=2]="Left",e[e.Right=3]="Right",e[e.NotYetDefined=4]="NotYetDefined",e[e.AboveOrBelow=5]="AboveOrBelow",e})({}),bi=(function(e){return e[e.XML=0]="XML",e[e.AutoColoring=1]="AutoColoring",e[e.CustomColorSet=2]="CustomColorSet",e})({}),Qt=(function(e){return e[e.Regular=0]="Regular",e[e.Bold=1]="Bold",e[e.Italic=2]="Italic",e[e.BoldItalic=3]="BoldItalic",e[e.Underlined=4]="Underlined",e})({}),jr=(function(e){return e[e.TimesNewRoman=0]="TimesNewRoman",e[e.K
3okila=1]="Kokila",e})({}),Ws=(function(e){return e.SIMPLE="",e.HAMMERON="H",e.PULLOFF="P",e.SLIDE="S",e.TAPPING="T",e})({}),rr=class{constructor(e,t,i,s,r,n=C.Above){this.rootPitch=e,this.chordKind=t,this.bassPitch=i,this.degrees=s,this.rules=r,this.Placement=n}get RootPitch(){return this.rootPitch}get ChordKind(){return this.chordKind}get BassPitch(){return this.bassPitch}get ChordDegrees(){return this.degrees}static calculateChordText(e,t,i){if(e.NumeralText!==void 0)return e.NumeralText;let s=e.RootPitch;if(Xt.transposeCalculator&&(s=Xt.transposeCalculator.transposePitch(e.RootPitch,i,t)),e.ChordKind===Gt.none)return e.getTextFromChordKindEnum(e.ChordKind);let r=Ct.getNoteEnumString(s.FundamentalNote);s.Accidental!==q.NONE&&(r+=e.getTextForAccidental(s.Accidental));let n={adds:[],alts:[],subs:[]};for(let h of e.ChordDegrees)if(h){let u="";switch(h.alteration!==q.NONE&&(u+=e.getTextForAccidental(h.alteration)),u+=h.value,h.text){case gs.add:n.adds.push(u);break;case gs.alter:n.alts.push(u);break;case gs.subtract:n.subs.push(u);break;default:}}let a=e.getTextFromChordKindEnum(e.ChordKind),o=["adds","alts","subs"],l=e.rules.CustomChords;for(let h of l){if(h.chordKind!==e.chordKind)continue;let u=!0;for(let c of o){for(let d of h.degrees[c]||[])if(n[c].indexOf(d)<0){u=!1;break}if(!u)break}if(u){for(let c of o)for(let d of h.degrees[c]||[])n[c].splice(n[c].indexOf(d),1);a=h.alternateName}}if(r+=a,n.adds.length>0&&(r+="("+n.adds.join(",")+")"),n.alts.length>0&&(r+="(alt "+n.alts.join(",")+")"),n.subs.length>0&&(r+="(omit "+n.subs.join(",")+")"),e.BassPitch){let h=e.BassPitch;Xt.transposeCalculator&&(h=Xt.transposeCalculator.transposePitch(e.BassPitch,i,t)),r+="/",r+=Ct.getNoteEnumString(h.FundamentalNote),r+=e.getTextForAccidental(h.Accidental)}return r}getTextForAccidental(e){let t=this.rules.ChordAccidentalTexts.getValue(e);return t===void 0?"":t}getTextFromChordKindEnum(e){return this.rules.ChordSymbolLabelTexts.getValue(e)??""}},oo=class{constructor(e,t,i){this.value=e,this.alteration=t,this.text=i}},Kr=class lo{constructor(t,i,s){this.alternateName=t,this.chordKind=i,this.degrees=s}static createCustomChord(t,i,s){return new lo(t,i,s)}static renameCustomChord(t,i,s){for(let r of s)r.alternateName===t&&(r.alternateName=i)}},gs=(function(e){return e[e.add=0]="add",e[e.alter=1]="alter",e[e.subtract=2]="subtract",e})({}),Gt=(function(e){return e[e.major=0]="major",e[e.minor=1]="minor",e[e.augmented=2]="augmented",e[e.diminished=3]="diminished",e[e.dominant=4]="dominant",e[e.majorseventh=5]="majorseventh",e[e.minorseventh=6]="minorseventh",e[e.dim
3inishedseventh=7]="diminishedseventh",e[e.augmentedseventh=8]="augmentedseventh",e[e.halfdiminished=9]="halfdiminished",e[e.majorminor=10]="majorminor",e[e.majorsixth=11]="majorsixth",e[e.minorsixth=12]="minorsixth",e[e.dominantninth=13]="dominantninth",e[e.majorninth=14]="majorninth",e[e.minorninth=15]="minorninth",e[e.dominant11th=16]="dominant11th",e[e.major11th=17]="major11th",e[e.minor11th=18]="minor11th",e[e.dominant13th=19]="dominant13th",e[e.major13th=20]="major13th",e[e.minor13th=21]="minor13th",e[e.suspendedsecond=22]="suspendedsecond",e[e.suspendedfourth=23]="suspendedfourth",e[e.Neapolitan=24]="Neapolitan",e[e.Italian=25]="Italian",e[e.French=26]="French",e[e.German=27]="German",e[e.pedal=28]="pedal",e[e.power=29]="power",e[e.Tristan=30]="Tristan",e[e.none=31]="none",e})({}),In=class extends ue{constructor(e,t,i,s=void 0){super(),this.DrawnAccidental=q.NONE,this.lineShift=0,this.sourceNote=e,this.parentVoiceEntry=t,this.PositionAndShape=new Yt(this,t.PositionAndShape),s?this.graphicalNoteLength=s:this.graphicalNoteLength=e.Length,this.numberOfDots=this.calculateNumberOfNeededDots(this.graphicalNoteLength),this.rules=i,this.rules.addGraphicalNoteToNoteMap(e,this)}Transpose(e,t,i,s){let r=this.sourceNote.Pitch;return Xt.transposeCalculator&&(r=Xt.transposeCalculator.transposePitch(this.sourceNote.Pitch,e,i)),r}calculateNumberOfNeededDots(e){return!this.sourceNote||!this.sourceNote.NoteTuplet?e.calculateNumberOfNeededDots():0}get ParentMusicPage(){return this.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentMusicSystem?.Parent}static FromNote(e,t){return t.NoteToGraphicalNoteMap.getValue(e.NoteToGraphicalNoteObjectId)}ToStringShort(e=0){return this.sourceNote?.ToStringShort(e)}get ToStringShortGet(){return this.ToStringShort(0)}getLyricsSVGs(){let e=[];for(let t of this.parentVoiceEntry?.parentStaffEntry.LyricsEntries)e.push(t.GraphicalLabel?.SVGNode);return e}setColor(e,t){}setVisible(e,t={}){}},xa,Li=class $e{constructor(){this.NoteDistances=[1,1,1.3,1.6,2,2.5,3,4],this.NoteDistancesScalingFactors=[1,2,4,8,16,32,64,128],this.DurationDistanceDict={},this.DurationScalingDistanceDict={},this.NoteToGraphicalNoteMapObjectCount=0,this.RenderCount=0,this.loadDefaultValues()}loadDefaultValues(){this.SamplingUnit=$e.unit*3,this.SheetTitleHeight=4,this.SheetSubtitleHeight=2,this.SheetMinimumDistanceBetweenTitleAndSubtitle=1,this.SheetComposerHeight=2,this.SheetAuthorHeight=2,this.SheetCopyrightHeight=1.5,this.SheetCopyrightMargin=2,this.SheetComposerSubtitleUseLegacyParsing=!1,this.CompactMode=!1,this.PagePlacementEnum=ao.Down,this.PageHeight=100001,this.PageTopMargin=5,this.PageTopMarginNarrow=0,this.PageBottomMargin=5,this.PageLeftMargin=5,this.PageRightMargin=5,this.TitleTopDistance=5,this.TitleBottomDistance=1,this.StaffDistance=7,this.BetweenStaffDistance=5,this.MinimumStaffLineDistance=4,this.MinSkyBottomDistBetweenStaves=1,this.StaffHeight=4,this.TabStaffInterlineHeight=1.1111,this.TabStaffInterlineHeightForBboxes=1.3,this.BetweenStaffLinesDistance=$e.unit,this.SystemLeftMargin=0,this.SystemRightMargin=0,this.SystemLabelsRightMargin=2,this.SystemComposerDistance=2,this.SystemLyricistDistance=2,this.InstrumentLabelTextHeight=2,this.MinimumDistanceBetweenSystems=7,this.MinSkyBottomDistBetweenSystems=5,this.LastSystemMaxScalingFactor=1.4,this.AutoBeamNotes=!1,this.AutoBeamOptions={beam_middle_rests_only:!1,beam_rests:!1,maintain_stem_directions:!1},this.AutoBeamTabs=!1,this.BeamWidth=$e.unit/2,this.BeamSpaceWidth=$e.unit/3,this.BeamForwardLength=1.25*$e.unit,this.FlatBeams=!1,this.FlatBeamOffset=20,this.FlatBeamOffsetPerBeam=10,this.ClefLeftMargin=.5,this.ClefRightMargin=.75,this.PercussionOneLineCutoff=3,this.PercussionForceVoicesOneLineCutoff=1,this.PercussionUseXMLDisplayStep=!0,this.PercussionXMLDisplayStepNoteValueShift=0,this.PercussionOneLineXMLDisplayStepOctaveOffset=0,this.PercussionUseCajon2NoteSystem=!1,this.BetweenKeySymbolsDistance=.2,this.KeyRightMargin=.75,this.RhythmRightMargin=1.25,this.ShowRhythmAgainAfterPartEndOrFinalBarline=!0,this.NewPartAndSystemAfterFinalBarline=!1,this.InStaffClefScalingFactor=.8,this.DistanceBetweenNaturalAndSymbolWhenCancelling=.4,this.NoteHelperLinesOffset=.25,this.MeasureLeftMargin=.7,this.MeasureRightMargin=0,this.DistanceBetweenLastInstructionAndRepetitionBarline=1,this.ArpeggioDistance=.6,this.StaccatoShorteningFactor=2,this.IdealStemLength=3,this.StemNoteHeadBorderYOffset=.2,this.StemMargin=.2,this.StemMinLength=2.5,this.StemMaxLength=4.5,this.BeamSlopeMaxAngle=10,this.StemMinAllowedDistanceBetweenNoteHeadAndBeamLine=1,this.SetWantedStemDirectionByXml=!0,this.GraceNoteScalingFactor=.6,this.GraceNoteXOffset=.2,this.GraceNoteGroupXMargin=0,this.WedgeOpeningLength=1.2,this.WedgeMeasureEndOpeningLength=.75,this.WedgeMeasureBeginOpeningLength=.75,this.WedgePlacementAboveY=-1.5,this.WedgePlacementBelowY=1.5,this.WedgeHorizontalMargin=.6,this.WedgeVerticalMargin=.5,this.DistanceOffsetBetweenTwoHorizontallyCrossedWedges=.3,this.WedgeMinLength=2,this.WedgeEndDistanceBetweenTimestampsFactor=1.75,this.ArticulationAboveNoteForStemUp=!1,this.SoftAccentWedgePadding=.4,this.SoftAccentSizeFactor=.6,this.DistanceBetweenAdjacentDynamics=.75,this.TempoChangeMeasureValidity=4,this.TempoContinousFactor=.7,this.StaccatoScalingFactor=.8,this.BetweenDotsDistance=.8,this.OrnamentAccidentalScalingFactor=.65,this.ChordSymbolTextHeight=2,this.ChordSymbolTextAlignmentTop=mt.LeftBottom,this.ChordSymbolTextAlignmentBottom=mt.LeftTop,this.ChordSymbolBottomMargin=.6,this.ChordSymbolRelativeXOffset=-1,this.ChordSymbolExtraXS
3hiftForShortChordSymbols=.3,this.ChordSymbolExtraXShiftWidthThreshold=2,this.ChordSymbolXSpacing=1,this.ChordOverlapAllowedIntoNextMeasure=0,this.ChordSymbolYOffset=.1,this.ChordSymbolYPadding=0,this.ChordSymbolYAlignment=!0,this.ChordSymbolYAlignmentScope="staffline",this.ChordSymbolWholeMeasureRestXOffset=0,this.ChordSymbolWholeMeasureRestXOffsetMeasure1=-2,this.ChordAccidentalTexts=new We.Dictionary,this.resetChordAccidentalTexts(this.ChordAccidentalTexts,!1),this.ChordSymbolLabelTexts=new We.Dictionary,this.resetChordSymbolLabelTexts(this.ChordSymbolLabelTexts),this.CustomChords=[],this.resetChordNames(),this.RepetitionSymbolsYOffset=0,this.RepetitionEndInstructionXShiftAsPercentOfStaveWidth=.4,this.RehearsalMarkXOffsetDefault=10,this.RehearsalMarkXOffset=0,this.RehearsalMarkXOffsetSystemStartMeasure=-20,this.RehearsalMarkYOffsetDefault=-15,this.RehearsalMarkYOffsetAddedForRehearsalMarks=-12,this.RehearsalMarkYOffset=0,this.RehearsalMarkFontSize=10,this.MeasureNumberLabelHeight=1.5*$e.unit,this.MeasureNumberLabelOffset=2,this.MeasureNumberLabelXOffset=-.5,this.TupletsRatioed=!1,this.TupletsRatioedUseXMLValue=!0,this.TupletsBracketed=!1,this.TripletsBracketed=!1,this.TupletsBracketedUseXMLValue=!0,this.TupletNumberLabelHeight=1.5*$e.unit,this.TupletNumberYOffset=.5,this.TupletNumberLimitConsecutiveRepetitions=!0,this.TupletNumberMaxConsecutiveRepetitions=2,this.TupletNumberAlwaysDisableAfterFirstMax=!0,this.TupletNumberUseShowNoneXMLValue=!0,this.LabelMarginBorderFactor=.1,this.TupletVerticalLineLength=.5,this.TupletNumbersInTabs=!0,this.TabTupletYOffsetBottom=1,this.TabTupletYOffsetTop=-3.5,this.TabTupletYOffsetEffects=1.5,this.TabTupletsBracketed=!0,this.TabBeamsRendered=!0,this.TabKeySignatureRendered=!1,this.TabKeySignatureSpacingAdded=!0,this.TabTimeSignatureRendered=!1,this.TabTimeSignatureSpacingAdded=!0,this.TabFingeringsRendered=!1,this.TabUseXNoteheadShapeForTabNote=!0,this.TabUseXNoteheadAlternativeGlyph=!0,this.TabXNoteheadScale=.9,this.SlurPlacementFromXML=!0,this.SlurPlacementAtStems=!1,this.SlurPlacementUseSkyBottomLine=!1,this.BezierCurveStepSize=1e3,this.calculateCurveParametersArrays(),this.TieGhostObjectWidth=.75,this.TieYPositionOffsetFactor=.3,this.MinimumNeededXspaceForTieGhostObject=1,this.TieHeightMinimum=.28,this.TieHeightMaximum=1.2,this.TieHeightInterpolationK=.0288,this.TieHeightInterpolationD=.136,this.SlurNoteHeadYOffset=.5,this.SlurEndArticulationYOffset=.8,this.SlurStartArticulationYOffsetOfArticulation=.5,this.SlurStemXOffset=.3,this.SlurSlopeMaxAngle=15,this.SlurTangentMinAngle=30,this.SlurTangentMaxAngle=80,this.SlurHeightFactor=1,this.SlurHeightFlattenLongSlursFactorByWidth=.24,this.SlurHeightFlattenLongSlursFactorByAngle=.36,this.SlurHeightFlattenLongSlursCutoffAngle=47,this.SlurHeightFlattenLongSlursCutoffWidth=16,this.SlursStartingAtSameStaffEntryYOffset=.8,this.SlurMaximumYControlPointDistance=void 0,this.GlissandoNoteOffset=.5,this.GlissandoStafflineStartMinimumWidth=1,this.GlissandoStafflineStartYDistanceToNote=.8,this.GlissandoStafflineEndOffset=1,this.GlissandoDefaultWidth=.12,this.GlissandoWaveAmplitude=.3,this.GlissandoWaveLength=.5,this.RepetitionAllowFirstMeasureBeginningRepeatBarline=!0,this.RepetitionEndingLabelHeight=2,this.RepetitionEndingLabelXOffset=.5,this.RepetitionEndingLabelYOffset=.3,this.RepetitionEndingLineYLowerOffset=.5,this.RepetitionEndingLineYUpperOffset=.3,this.CursorIgnoreRepetitions=!1,this.VoltaOffset=2.5,this.LabelXOffsetForStafflineLeftOverflowCheck=-1.2,this.TempoExpressionTextAlignment=mt.CenterBottom,this.UnknownExpressionTextAlignment=mt.CenterBottom,this.LyricsAlignmentStandard=mt.LeftBottom,this.LyricsHeight=2,this.LyricsYOffsetToStaffHeight=0,this.LyricsYMarginToBottomLine=.2,this.LyricsExtraXShiftForShortLyrics=.5,this.LyricsExtraXShiftForShortLyricsWidthThreshold=1.4,this.LyricsUseXPaddingForLongLyrics=!0,this.LyricsXPaddingFactorForLongLyrics=1,this.LyricsXPaddingWidthThreshold=1.7,this.LyricsXPaddingReductionForLongNotes=.7,this.LyricsXPaddingReductionForLastNoteInMeasure=1.2,this.LyricsXPaddingForLastNoteInMeasure=!0,this.VerticalBetweenLyricsDistance=.5,this.HorizontalBetweenLyricsDistance=.2,this.BetweenSyllableMaximumDistance=10,this.BetweenSyllableMinimumDistance=.5,this.LyricOverlapAllowedIntoNextMeasure=3.4,this.MinimumDistanceBetweenDashes=10,this.MaximumLyricsElongationFactor=2.5,this.TempoYSpacing=.5,this.InstantaneousTempoTextHeight=2.3,this.ContinuousDynamicTextHeight=2.3,this.UseEndOffsetForExpressions=!0,this.MoodTextHeight=2.3,this.UnknownTextHeight=2,this.ContinuousTempoTextHeight=2.3,this.DynamicExpressionMaxDistance=2,this.DynamicExpressionSpacer=.5,this.IgnoreRepeatedDynamics=!1,this.ExpressionsUseXMLColor=!0,this.VexFlowDefaultNotationFontScale=39,this.VexFlowDefaultTabFontScale=39,this.TremoloStrokeScale=1,this.TremoloYSpacingScale=1,this.TremoloBuzzRollThickness=.25,this.StemWidth=.15,this.StaffLineWidth=.1,this.StaffLineColor=void 0,this.LedgerLineWidth=1,this.LedgerLineStrokeStyle=void 0,this.LedgerLineColorDefault="#000000",this.WedgeLineWidth=.12,this.TupletLineWidth=.12,this.LyricUnderscoreLineWidth=.12,this.SystemThinLineWi
3dth=.12,this.SystemBoldLineWidth=$e.unit/2,this.SystemRepetitionEndingLineWidth=.12,this.SystemDotWidth=$e.unit/2,this.DistanceBetweenVerticalSystemLines=.35,this.DistanceBetweenDotAndLine=.7,this.RepeatEndStartPadding=2,this.OctaveShiftLineWidth=.12,this.OctaveShiftVerticalLineLength=$e.unit,this.OctaveShiftOnWholeMeasureNoteUntilEndOfMeasure=!1,this.GraceLineWidth=this.StaffLineWidth*this.GraceNoteScalingFactor,this.MultipleRestMeasureDefaultWidth=4,this.MultipleRestMeasureAddKeySignature=!0,this.FixedMeasureWidth=!1,this.FixedMeasureWidthFixedValue=void 0,this.FixedMeasureWidthUseForPickupMeasures=!1,this.MinimumMeasureWidth=0,this.MinimumCrossedBeamDifferenceMargin=1e-4,this.SheetMaximumWidth=32767,this.VoiceSpacingMultiplierVexflow=.85,this.VoiceSpacingAddendVexflow=3,this.PickupMeasureWidthMultiplier=1,this.PickupMeasureRepetitionSpacing=.8,this.PickupMeasureSpacingSingleNoteAddend=1.6,this.DisplacedNoteMargin=.1,this.MinNoteDistance=2,this.SubMeasureXSpacingThreshold=35,this.MeasureDynamicsMaxScalingFactor=2.5,this.WholeRestXShiftVexflow=-1.5,this.MetronomeMarksDrawn=!0,this.MetronomeMarkXShift=-6,this.MetronomeMarkYShift=-1,this.SoftmaxFactorVexFlow=15,this.StaggerSameWholeNotes=!0,this.AlignRests=ms.Never,this.RestCollisionYPadding=0,this.FillEmptyMeasuresWithWholeRest=An.No,this.ArpeggiosGoAcrossVoices=!1,this.RenderArpeggios=!0,this.RenderSlurs=!0,this.RenderGlissandi=!0,this.ColoringMode=bi.XML,this.ColoringEnabled=!0,this.ColorStemsLikeNoteheads=!1,this.ColorBeams=!0,this.ColorFlags=!0,this.applyDefaultColorMusic("#000000"),this.DefaultColorCursor="#33e02f",this.DefaultFontFamily="Times New Roman",this.DefaultFontStyle=Qt.Regular,this.DefaultVexFlowNoteFont="gonville",this.MaxMeasureToDrawIndex=Number.MAX_VALUE,this.MaxMeasureToDrawNumber=Number.MAX_VALUE,this.MinMeasureToDrawIndex=0,this.MinMeasureToDrawNumber=0,this.MaxSystemToDrawNumber=Number.MAX_VALUE,this.MaxPageToDrawNumber=Number.MAX_VALUE,this.RenderComposer=!0,this.RenderTitle=!0,this.RenderSubtitle=!0,this.RenderLyricist=!0,this.RenderCopyright=!1,this.RenderPartNames=!0,this.RenderPartAbbreviations=!0,this.RenderSystemLabelsAfterFirstPage=!0,this.RenderFingerings=!0,this.RenderMeasureNumbers=!0,this.RenderMeasureNumbersOnlyAtSystemStart=!1,this.UseXMLMeasureNumbers=!0,this.RenderLyrics=!0,this.RenderChordSymbols=!0,this.RenderMultipleRestMeasures=!0,this.AutoGenerateMultipleRestMeasuresFromRestMeasures=!0,this.RenderRehearsalMarks=!0,this.RenderClefsAtBeginningOfStaffline=!0,this.RenderKeySignatures=!0,this.RenderTimeSignatures=!0,this.RenderFirstTempoExpression=!0,this.RenderPedals=!0,this.ArticulationPlacementFromXML=!0,this.BreathMarkDistance=.8,this.FingeringPosition=C.AboveOrBelow,this.FingeringPositionFromXML=!0,this.FingeringPositionGrace=C.Left,this.FingeringInsideStafflines=!1,this.FingeringLabelFontHeight=1.7,this.FingeringOffsetX=0,this.FingeringOffsetY=0,this.FingeringPaddingY=-.2,this.FingeringTextSize=1.5,this.RenderStringNumbersClassical=!0,this.StringNumberOffsetY=0,this.NewSystemAtXMLNewSystemAttribute=!1,this.NewPageAtXMLNewPageAttribute=!1,this.NewSystemAtXMLNewPageAttribute=!1,this.RenderXMeasuresPerLineAkaSystem=0,this.RestoreCursorAfterRerender=!0,this.StretchLastSystemLine=!1,this.IgnoreBracketsWords=!0,this.PlaceWordsInsideStafflineFromXml=!1,this.PlaceWordsInsideStafflineYOffset=.9,this.PageFormat=Te.UndefinedPageFormat,this.PageBackgroundColor=void 0,this.DarkModeEnabled=!1,this.UsePageBackgroundColorForTabNotes=!0,this.RenderSingleHorizontalStaffline=!1,this.SpacingBetweenTextLines=0,this.NoteToGraphicalNoteMap=new We.Dictionary,this.NoteToGraphicalNoteMapObjectCount=0,this.SkyBottomLineBatchMinMeasures=5,this.SkyBottomLineWebGLMinMeasures=80,this.AlwaysSetPreferredSkyBottomLineBackendAutomatically=!0,this.DisableWebGLInFirefox=!0,this.DisableWebGLInSafariAndIOS=!0,this.setPreferredSkyBottomLineBackendAutomatically(),this.UseInterpolatedTempoForAccelerandoEtc=!1;try{this.MaxInstructionsConstValue=this.ClefLeftMargin+this.ClefRightMargin+this.KeyRightMargin+this.RhythmRightMargin+11}catch(t){W.default.info("EngravingRules()",t)}}setPreferredSkyBottomLineBackendAutomatically(t=-1){let i="",s="";typeof globalThis=="object"&&(i=globalThis.navigator?.vendor??"",s=globalThis.navigator?.userAgent??"");let r=!1;(this.DisableWebGLInSafariAndIOS&&/apple/i.test(i)||this.DisableWebGLInFirefox&&s.includes("Firefox"))&&(r=!0),this.PreferredSkyBottomLineBatchCalculatorBackend=ir.Plain,r||t>=this.SkyBottomLineWebGLMinMeasures&&(this.PreferredSkyBottomLineBatchCalculatorBackend=ir.WebGL)}applyDefaultColorMusic(t){this.DefaultColorMusic=t,this.DefaultColorNotehead=t,this.DefaultColorRest=t,this.DefaultColorStem=t,this.DefaultColorLabel=t,this.DefaultColorLyrics=t,this.DefaultColorTitle=t,this.LedgerLineColorDefault=t}addGraphicalNoteToNoteMap(t,i){t.NoteToGraphicalNoteObjectId=this.NoteToGraphicalNoteMapObjectC
3ount,this.NoteToGraphicalNoteMap.setValue(t.NoteToGraphicalNoteObjectId,i),this.NoteToGraphicalNoteMapObjectCount++}GNote(t){return In.FromNote(t,this)}clearMusicSheetObjects(){this.NoteToGraphicalNoteMap=new We.Dictionary,this.NoteToGraphicalNoteMapObjectCount=0}resetChordAccidentalTexts(t,i){t.setValue(q.SHARP,i?"♯":"#"),t.setValue(q.FLAT,i?"♭":"b"),t.setValue(q.DOUBLEFLAT,i?"𝄫":"bb"),t.setValue(q.DOUBLESHARP,i?"𝄪":"x")}setChordSymbolLabelText(t,i){this.ChordSymbolLabelTexts.setValue(t,i)}resetChordSymbolLabelTexts(t){return t.setValue(Gt.minor,"m"),t.setValue(Gt.augmented,"aug"),t.setValue(Gt.diminished,"dim"),t.setValue(Gt.dominant,"7"),t.setValue(Gt.majorseventh,"maj7"),t.setValue(Gt.minorseventh,"m7"),t.setValue(Gt.diminishedseventh,"dim7"),t.setValue(Gt.augmentedseventh,"aug7"),t.setValue(Gt.halfdiminished,`m7${this.ChordAccidentalTexts.getValue(q.FLAT)}5`),t.setValue(Gt.majorminor,"m(maj7)"),t.setValue(Gt.majorsixth,"maj6"),t.setValue(Gt.minorsixth,"m6"),t.setValue(Gt.dominantninth,"9"),t.setValue(Gt.majorninth,"maj9"),t.setValue(Gt.minorninth,"m9"),t.setValue(Gt.dominant11th,"11"),t.setValue(Gt.major11th,"maj11"),t.setValue(Gt.minor11th,"m11"),t.setValue(Gt.dominant13th,"13"),t.setValue(Gt.major13th,"maj13"),t.setValue(Gt.minor13th,"m13"),t.setValue(Gt.suspendedsecond,"sus2"),t.setValue(Gt.suspendedfourth,"sus4"),t.setValue(Gt.power,"5"),t.setValue(Gt.none,"N.C."),t}addChordName(t,i,s,r,n){if(Gt[i]!==void 0){let a={adds:s,alts:r,subs:n};this.CustomChords.push(Kr.createCustomChord(t,Gt[i],a))}}renameChord(t,i){Kr.renameCustomChord(t,i,this.CustomChords)}resetChordNames(){let t=this.ChordAccidentalTexts.getValue(q.SHARP),i=this.ChordAccidentalTexts.getValue(q.FLAT);this.addChordName("alt","major",[`${t}5`,`${i}9`,`${t}9`],[`${i}5`],[]),this.addChordName("7alt","dominant",[`${t}5`,`${i}9`,`${t}9`],[`${i}5`],[]),this.addChordName("7sus4","dominant",["4"],[],["3"]),this.addChordName("7sus4","suspendedfourth",["7"],[],[]),this.addChordName("9sus4","dominantninth",["4"],[],["3"]),this.addChordName("9sus4","suspendedfourth",["9"],[],[]),this.addChordName("11sus4","dominant11th",["4"],[],["3"]),this.addChordName("11sus4","suspendedfourth",["11"],[],[]),this.addChordName("13sus4","dominant13th",["4"],[],["3"]),this.addChordName("13sus4","suspendedfourth",["13"],[],[]),this.addChordName("7sus2","dominant",["2"],[],["3"]),this.addChordName("7sus2","suspendedsecond",["7"],[],[]),this.addChordName(`m7${i}5`,"minorseventh",[],[`${i}5`],[]),this.addChordName("9sus2","dominantninth",["2"],[],["3"]),this.addChordName("9sus2","suspendedsecond",["9"],[],[]),this.addChordName("11sus2","dominant11th",["2"],[],["3"]),this.addChordName("11sus2","suspendedsecond",["11"],[],[]),this.addChordName("13sus2","dominant13th",["2"],[],["3"]),this.addChordName("13sus2","suspendedsecond",["13"],[],[]),this.addChordName("m(maj9)","majorminor",["9"],[],[]),this.addChordName("m(maj11)","majorminor",["11"],[],[]),this.addChordName("m(maj13)","majorminor",["13"],[],[]),this.addChordName("69","majorsixth",["9"],[],[]),this.addChordName("mi69","minorsixth",["9"],[],[])}calculateCurveParametersArrays(){this.TPower3=Array(this.BezierCurveStepSize),this.OneMinusTPower3=Array(this.BezierCurveStepSize),this.FactorOne=Array(this.BezierCurveStepSize),this.FactorTwo=Array(this.BezierCurveStepSize);for(let t=0;t<this.BezierCurveStepSize;t++){let i=t/this.BezierCurveStepSize;this.TPower3[t]=i**3,this.OneMinusTPower3[t]=(1-i)**3,this.FactorOne[t]=3*(1-i)**2*i,this.FactorTwo[t]=3*(1-i)*i**2}}};xa=Li,xa.unit=1;var Te=class ho{constructor(t,i,s="noIdStringGiven"){this.width=t,this.height=i,this.idString=s}get aspectRatio(){return this.IsUndefined?0:this.width/this.height}get IsUndefined(){return this.width===void 0||this.height===void 0||this.height===0||this.width===0}static get UndefinedPageFormat(){return new ho(0,0)}Equals(t){return t?t.width===this.width&&t.height===this.height:!1}},Bn=class extends ue{constructor(e,t,i){super(),this.parentVoiceEntry=e,this.parentStaffEntry=t,this.PositionAndShape=new Yt(this,t?t.PositionAndShape:void 0,!0),this.notes=[],i?this.rules=i:this.rules=t?t.parentMeasure.parentSourceMeasure.Rules:new Li}
3sort(){return this.notes.sort((e,t)=>(t.sourceNote.Pitch?.getHalfTone()??0)-(e.sourceNote.Pitch?.getHalfTone()??0)),this.notes}sortForVexflow(){return this.notes.sort((e,t)=>(e.sourceNote.Pitch?.getHalfTone()??0)-(t.sourceNote.Pitch.getHalfTone()??0)),this.notes}applyCustomNoteheads(){}color(){}},qi=ah({YieldGuard:()=>co,yieldToMain:()=>uo});function uo(){return new Promise(e=>{!(typeof document<"u"&&document.hidden)&&typeof requestAnimationFrame<"u"?requestAnimationFrame(()=>setTimeout(e,0)):setTimeout(e,0)})}var Ea,co,Ji=nh((()=>{Ea=8,co=class{constructor(e=Ea){this.intervalMs=e,this.lastYield=performance.now()}shouldYield(){return performance.now()-this.lastYield>=this.intervalMs}async yield(){await uo(),this.lastYield=performance.now()}async maybeYield(){this.shouldYield()&&await this.yield()}}})),nr=class{constructor(e,t){this.musicPages=[],this.measureList=[],this.verticalGraphicalStaffEntryContainers=[],this.cursors=[],this.leadSheet=!1,this.musicSheet=e,this.numberOfStaves=this.musicSheet.Staves.length,this.calculator=t,this.calculator.initialize(this)}get ParentMusicSheet(){return this.musicSheet}get GetCalculator(){return this.calculator}get MusicPages(){return this.musicPages}set MusicPages(e){this.musicPages=e}get MeasureList(){return this.measureList}set MeasureList(e){this.measureList=e}get VerticalGraphicalStaffEntryContainers(){return this.verticalGraphicalStaffEntryContainers}set VerticalGraphicalStaffEntryContainers(e){this.verticalGraphicalStaffEntryContainers=e}get Title(){return this.title}set Title(e){this.title=e}get Subtitle(){return this.subtitle}set Subtitle(e){this.subtitle=e}get Composer(){return this.composer}set Composer(e){this.composer=e}get Lyricist(){return this.lyricist}set Lyricist(e){this.lyricist=e}get Copyright(){return this.copyright}set Copyright(e){this.copyright=e}get Cursors(){return this.cursors}get SelectionStartSymbol(){return this.selectionStartSymbol}get SelectionEndSymbol(){return this.selectionEndSymbol}get MinAllowedSystemWidth(){return this.minAllowedSystemWidth}set MinAllowedSystemWidth(e){this.minAllowedSystemWidth=e}get NumberOfStaves(){return this.numberOfStaves}get LeadSheet(){return this.leadSheet}set LeadSheet(e){this.leadSheet=e}static transformRelativeToAbsolutePosition(e){for(let t=0;t<e.MusicPages.length;t++){let i=e.MusicPages[t].setMusicPageAbsolutePosition(t,e.ParentMusicSheet.Rules);e.MusicPages[t].PositionAndShape.calculateAbsolutePositionsRecursive(i.x,i.y)}}static async transformRelativeToAbsolutePositionAsync(e){let{YieldGuard:t}=await Promise.resolve().then(()=>(Ji(),qi)),i=new t;for(let s of e.MusicPages){let r=s.setMusicPageAbsolutePosition(e.MusicPages.indexOf(s),e.ParentMusicSheet.Rules),n=[{box:s.PositionAndShape,x:r.x,y:r.y}],a=0;for(;n.length>0;){let{box:o,x:l,y:h}=n.pop();o.AbsolutePosition.x=o.RelativePosition.x+l,o.AbsolutePosition.y=o.RelativePosition.y+h;for(let u=o.ChildElements.length-1;u>=0;u--)n.push({box:o.ChildElements[u],x:o.AbsolutePosition.x,y:o.AbsolutePosition.y});!(++a&255)&&i.shouldYield()&&await i.yield()}}}Initialize(){this.verticalGraphicalStaffEntryContainers=[],this.musicPages=[],this.measureList=[]}reCalculate(){this.calculator.calculate()}async reCalculateAsync(e){await this.calculator.calculateAsync(e)}EnforceRedrawOfMusicSystems(){for(let e=0,t=this.musicPages.length;e<t;++e){let i=this.musicPages[e];for(let s=0,r=i.MusicSystems.length;s<r;++s){let n=i.MusicSystems[s];n.needsToBeRedrawn=!0}}}getClickedObject(e){for(let t=0,i=this.MusicPages.length;t<i;++t)return this.MusicPages[t].PositionAndShape.getClickedObjectOfType(e)}findGraphicalMeasure(e,t){for(let i=e;i>=0;i--){let s=this.measureList[i]?.[t];if(s)return s}}findGraphicalMeasureByMeasureNumber(e,t){for(let i=e;i>=0;i--)if(this.MeasureList[i]){let s=this.MeasureList[i][t];if(s?.MeasureNumber===e)return s}}findGraphicalStaffEntryFromMeasureList(e,t,i){for(let s=t;s<this.measureList.length;s++){let r=this.measureList[s][e];if(r)for(let n=0,a=r.staffEntries.length;n<a;++n){let o=r.staffEntries[n];if(o.sourceStaffEntry===i)return o}}}findNextGraphicalStaffEntry(e,t,i){let s=i.parentMeasure,r=s.staffEntries.indexOf(i);if(r<s.staffEntries.length-1)return s.staffEntries[r+1];if(t<this.measureList.length-1){let n=this.measureList[t+1][e];if(n.staffEntries.length>0)return n.staffEntries[0]}}getFirstVisibleMeasuresListFromIndices(e,t){let i=[],s=this.measureList[0].length;for(let r=e;r<=t;r++)for(let n=0;n<s;n++)if(this.measureList[r][n].isVisible()){i.push(this.measureList[r][n]);break}return i}orderMeasuresByStaffLine(e){let t=[],i=[];t.push(i);for(let s=0;s<e.length;s++)s===0?i.push(e[0]):(e[s].ParentStaffLine===e[s-1].ParentStaffLine||(t.indexOf(i)===-1&&t.push(i),i=[],t.push(i)),i.push(e[s]));return t}initializeActiveClefs(){let e=[],t=this.musicSheet.getFirstSourceMeasure();if(t)for(let i=0;i<t.CompleteNumberOfStaves;i++){let s=new Zt;if(t.FirstInstructionsStaffEntries[i])for(let r=0,n=t.FirstInstructionsStaffEntries[i].Instructions.length;r<n;++r){let a=t.FirstInstructionsStaffEntries[i].Instructions[r];a instanceof Zt&&(s=a)}e.push(s)}return e}GetMainKey(){let e=this.musicSheet.getFirstSourceMeasure();if(e)for(let t=0;t<e.CompleteNumberOfStaves;t++)for(let i=0,s=e.FirstInstructionsStaffEntries[t].Instructions.length;i<s;++i){let r=e.FirstInstructionsStaffEntries[t].Instructions[i];if(r instanceof ye)return r}}getOrCreateVerticalContainer(e){if(this.verticalGraphicalStaffEntryContainers.length===0||Le.getLastElement(this.verticalGraphicalStaffEntryContainers
3).AbsoluteTimestamp.lt(e)){let t=new hs(this.numberOfStaves,e);return this.verticalGraphicalStaffEntryContainers.push(t),t}for(let t=this.verticalGraphicalStaffEntryContainers.length-1;t>=0;t--){if(this.verticalGraphicalStaffEntryContainers[t].AbsoluteTimestamp.lt(e)){let i=new hs(this.numberOfStaves,e);return this.verticalGraphicalStaffEntryContainers.splice(t+1,0,i),i}if(this.verticalGraphicalStaffEntryContainers[t].AbsoluteTimestamp.Equals(e))return this.verticalGraphicalStaffEntryContainers[t]}}GetVerticalContainerFromTimestamp(e,t=0){let i=Le.binarySearch(this.verticalGraphicalStaffEntryContainers,new hs(0,e),hs.compareByTimestamp,t);if(i>=0)return this.verticalGraphicalStaffEntryContainers[i]}GetInterpolatedIndexInVerticalContainers(e){let t=this.verticalGraphicalStaffEntryContainers;if(t.length===1)return 0;let i=0,s=t.length-1,r,n;if(e.lte(t[t.length-1].AbsoluteTimestamp)){for(;s-i>1;){let h=Math.floor((s+i)/2);if(t[i].AbsoluteTimestamp.Equals(e)){s=i;break}else if(t[s].AbsoluteTimestamp.Equals(e)){i=s;break}else{if(t[h].AbsoluteTimestamp.Equals(e))return this.verticalGraphicalStaffEntryContainers.indexOf(t[h]);e.lt(t[h].AbsoluteTimestamp)?s=h:i=h}}if(i===s)return this.verticalGraphicalStaffEntryContainers.indexOf(t[i]);r=t[i].AbsoluteTimestamp,n=t[s].AbsoluteTimestamp}else r=t[t.length-1].AbsoluteTimestamp,n=N.plus(this.getLongestStaffEntryDuration(t.length-1),r),s=t.length;let a=n.RealValue-r.RealValue,o=n.RealValue-e.RealValue,l=s-o/a;return Math.min(l,this.verticalGraphicalStaffEntryContainers.length-1)}getVisibleStavesIndicesFromSourceMeasure(e){let t=[],i=[];for(let s=0,r=e.length;s<r;++s){let n=e[s].ParentStaff.ParentInstrument;t.indexOf(n)===-1&&t.push(n)}for(let s=0,r=t.length;s<r;++s){let n=t[s],a=this.musicSheet.getGlobalStaffIndexOfFirstStaff(n);for(let o=0;o<n.Staves.length;o++)i.push(a+o)}return i}getGraphicalMeasureFromSourceMeasureAndIndex(e,t){for(let i=0;i<this.measureList.length;i++)if(this.measureList[i][0]?.parentSourceMeasure===e)return this.measureList[i][t]}getLastGraphicalMeasureFromIndex(e,t=!0){let i=this.measureList.length-1;t&&(i=Math.min(i,this.musicSheet.Rules.MaxMeasureToDrawIndex));let s=this.measureList[i][e];for(;!s&&i>=0;)s=this.measureList[--i][e];return this.measureList[i][e]}getMeasureIndex(e,t,i){for(t=0,i=0;t<this.measureList.length;t++)for(let s=0,r=this.measureList[t].length;s<r;++s)if(this.measureList[t][s]===e)return!0;return!1}GetNearestGraphicalObject(e,t=ue.name,i=5,s=20,r=5,n=void 0){let a=[];for(;a.length===0&&i<=s;){let l=new Yt(void 0);l.BorderLeft=e.x-i,l.BorderTop=e.y-i,l.BorderRight=e.x+i,l.BorderBottom=e.y+i,l.AbsolutePosition=new k(e.x,e.y),l.calculateAbsolutePosition();for(let h=0,u=this.MusicPages.length;h<u;++h){let c=this.MusicPages[h].PositionAndShape.getObjectsInRegion(l,!1,t);if(!(!c||c.length===0))for(let d=0,f=c.length;d<f;++d)n?n(c[d])&&a.push(c[d]):a.push(c[d])}i+=r}let o;for(let l=0,h=a.length;l<h;++l){let u=a[l];(o===void 0||this.CalculateDistance(u.PositionAndShape.AbsolutePosition,e)<this.CalculateDistance(o.PositionAndShape.AbsolutePosition,e))&&(o=u)}if(o)return o}GetNearestVoiceEntry(e){return this.GetNearestGraphicalObject(e,Bn.name,5,20,5,t=>t.parentStaffEntry?.relInMeasureTimestamp!==void 0)}GetNearestNote(e,t){let i=this.GetNearestVoiceEntry(e);if(!i)return;let s,r=2**53-1;for(let n of i.notes){let a=n.PositionAndShape.AbsolutePosition.y,o=Math.abs(n.PositionAndShape.AbsolutePosition.x-e.x),l=Math.abs(a-e.y);o+l<r&&(s=n,r=o+l)}return s}domToSvg(e){return this.domToSvgTransform(e,!0)}svgToDom(e){return this.domToSvgTransform(e,!1)}svgToOsmd(e){let t=new k(e.x,e.y);return t.x/=10,t.y/=10,t}domToSvgTransform(e,t){let i=this.drawer.Backends[0].getSvgElement(),s=i.createSVGPoint();s.x=e.x,s.y=e.y;let r=i.getScreenCTM();t&&(r=r.inverse());let n=s.matrixTransform(r);return new k(n.x,n.y)}GetClickableLabel(e){let t=new Yt;t.BorderLeft=e.x-4,t.BorderTop=e.y-4,t.BorderRight=e.x+4,t.BorderBottom=e.y+4,t.AbsolutePosition=new k(0,0);for(let i=0,s=this.MusicPages.length;i<s;++i){let r=this.MusicPages[i].PositionAndShape.getObjectsInRegion(t);if(r.length===1)for(let n=0,a=r.length;n<a;++n)return r[n]}}GetNearestStaffEntry(e){let t=[],i=new Yt(void 0);i.BorderLeft=e.x-10,i.BorderTop=e.y-10,i.BorderRight=e.x+10,i.BorderBottom=e.y+10,i.AbsolutePosition=new k(0,0);for(let r=0,n=this.MusicPages.length;r<n;++r){let a=this.MusicPages[r].PositionAndShape.getObjectsInRegion(i,!1,Nn.name);if(!(!a||a.length===0))for(let o=0,l=a.length;o<l;++o){let h=a[o];t.push(h)}}let s;for(let r=0,n=t.length;r<n;++r){let a=t[r];if(s===void 0)s=a;else{if(!a.relInMeasureTimestamp)continue;this.CalculateDistance(a.PositionAndShape.AbsolutePosition,e)<this.CalculateDistance(s.PositionAndShape.AbsolutePosition,e)&&(s=a)}}if(s)return s}GetNearestObject(e,t){let i=[],s=new Yt(void 0);s.BorderLeft=e.x-10,s.BorderTop=e.y-10,s.BorderRight=e.x+10,s.BorderBottom=e.y+10,s.AbsolutePosition=new k(0,0);for(let n=0,a=this.MusicPages.length;n<a;++n){let o=this.MusicPages[n].PositionAndShape.getObjectsInRegion(s,!1,t);if(!(!o||o.length===0))for(let l=0,h=o.length;l<h;++l){let u=o[l];i.push(u)}}let r;for(let n=0,a=i.length;n<a;++n){let o=i[n];(r===void 0||this.CalculateDistance(o.PositionAndShape.AbsolutePosition,e)<this.CalculateDistance(r.PositionAndShape.AbsolutePosition,e))&&(r=o)}if(r)return r}GetPossibleCommentAnchor(e){let t=this.GetNearestStaffEntry(e);if(t)return t.sourceStaffEntry}getClickedObjectOfType(e){for(let t=0,i=this.musicPages.length;t<i;++t){let s=this.musicPages[t].PositionAndShape.getClickedObjectOfType(e);if(s)return s}}tryGetTimestampFromPosition(e){let t=this.getClickedObjectOfType(e);if(t)return t.getAbsoluteTimestamp()}tryGetClickableLabel(e){try{return this.GetClickableLabel(e)}catch(t){W.default.info("GraphicalMusicSheet.tryGetClickableObject","positionOnMusicSheet: "+e,t)}}tryGetTimeStampFromPosition(e){try{let t=this.GetNearestStaffEntry(e);return t?t.getAbsoluteTimestamp():void 0}catch(t){W.default.info("GraphicalMusicSheet.tryGetTimeStampFromPosition","positionOnMusicSheet: "+e,t)}}getStaffEntry(e){let t=this.VerticalGraphicalStaffEntryContainers[e],i;try{for(let s=0,r=t.StaffEntries.length;s<r;++s){let n=t.StaffEntries[s];!n||!n.sourceStaffEntry.ParentStaff.isVisible()||(i?n.PositionAndShape&&i.PositionAndShape&&i.PositionAndShape.RelativePosition.x>n.PositionAndShape.RelativePosition.x&&(i=n):i=n)}}catch(s){W.default.info("GraphicalMusicSheet.getStaffEntry",s)}return i}GetPreviousVisibleContainerIndex(e){for(let t=e-1;t>=0;t--){let i=this.verticalGraphicalStaffEntryContainers[t].StaffEntries;for(let s=0,r=i.length;s<r;++s){let n=i[s];if(n&&n.sourceStaffEntry.ParentStaff.isVisible())return t}}return-1}GetNextVisibleContainerIndex(e){for(let t=e+1;t<this.verticalGraphicalStaffEntryContainers.length;++t){let i=this.verticalGraphicalStaffEntryContainers[t].StaffEntries;for(let s=0,r=i.length;s<r;++s){let n=i[s];if(n&&n.sourceStaffEntry.ParentStaff.isVisible())return t}}return-1}findClosestLeftStaffEntry(e,t){let i,s=Math.floor(e);s=Math.min(this.VerticalGraphicalStaffEntryContainers.length-1,s);for(let r=s;r>=0;r--)if(i=this.getStaffEntry(r),i)if(t){if(i.sourceStaffEntry.ParentStaff.isVisible())return i}else return i}findClosestRightStaffEntry(e,t){let i,s=Math.max(0,Math.ceil(e));for(let r=s;r<this.VerticalGraphicalStaffEntryContainers.length;r++)if(i=this.getStaffEntry(r),i)if(t){if(i.sourceStaffEntry.ParentStaff.isVisible())return i}else return i}calculateCursorLineAtTimestamp(e,t){let i=this.calculateXPositionFromTimestamp(e),s=i[0],r=i[1];if(!r||r.StaffLines.length===0)return;let n=r.PositionAndShape.AbsolutePosition.y,a=Le.last(r.StaffLines).PositionAndShape.RelativePosition.y+4;return new Ae(new k(s,n),new k(s,n+a),3,t)}calculateXPositionFromTimestamp(e){let t,i=this.GetInterpolatedIndexInVerticalContainers(e),s=this.findClosestLeftStaffEntry(i,!0),r=this.findClosestRightStaffEntry(i,!0),n=e.RealValue;if(!s&&!r)return[0,void 0];let a;a=s?s.parentMeasure.ParentStaffLine?.ParentMusicSystem:r.parentMeasure.ParentStaffLine?.ParentMusicSystem;let o;if(o=r?r.parentMeasure.ParentStaffLine?.ParentMusicSystem:s.parentMeasure.ParentStaffLine?.ParentMusicSystem,a===o){t=a;let l,h,u;if(!s)h=u=r.PositionAndShape.AbsolutePosition.x,l=0;else if(r)h=s.PositionAndShape.AbsolutePosition.x,u=r.PositionAndShape.AbsolutePosition.x,l=s===r?0:(n-s.getAbsoluteTimestamp().RealValue)/(r.getAbsoluteTimestamp().RealValue-s.getAbsoluteTimestamp().RealValue);else{h=s.PositionAndShape.AbsolutePosition.x,u=t.GetRightBorderAbsoluteXPosition();let c=s.parentMeasure.parentSourceMeasure;l=(n-s.getAbsoluteTimestamp().RealValue)/(N.plus(c.AbsoluteTimestamp,c.Duration).RealValue-s.getAbsoluteTimestamp().RealValue)}return l=Math.min(1,Math.max(0,l)),[h+l*(u-h),t]}else{let l=r.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.RealValue,h,u;if(n<l&&a.StaffLines[0]){t=a;let c=s.PositionAndShape.AbsolutePosition.x,d=t.GetRightBorderAbsoluteXPosition();h=(n-s.getAbsoluteTimestamp().RealValue)/(l-s.getAbsoluteTimestamp().RealValue),h=Math.min(1,Math.max(0,h)),u=c+h*(d-c)}else{t=o;let c=r.PositionAndShape.AbsolutePosition.x,d=t.GetLeftBorderAbsoluteXPosition();h=(n-l)/(r.getAbsoluteTimestamp().RealValue-l),h=Math.min(1,Math.max(0,h)),u=d+h*(c-d)}return[u,t]}}
3GetNumberOfVisibleInstruments(){let e=0;for(let t=0,i=this.musicSheet.Instruments.length;t<i;++t)this.musicSheet.Instruments[t].isVisible()&&e++;return e}GetNumberOfFollowedInstruments(){let e=0;for(let t=0,i=this.musicSheet.Instruments.length;t<i;++t)this.musicSheet.Instruments[t].Following===!0&&e++;return e}GetGraphicalFromSourceStaffEntry(e){if(e.VerticalContainerParent.ParentMeasure?.VerticalMeasureList)return e.VerticalContainerParent.ParentMeasure.VerticalMeasureList[e.ParentStaff.idInMusicSheet]?.findGraphicalStaffEntryFromTimestamp(e.Timestamp)}CalculateDistance(e,t){let i=e.x-t.x,s=e.y-t.y;return i*i+s*s}getLongestStaffEntryDuration(e){let t=new N(0,1);for(let i of this.verticalGraphicalStaffEntryContainers[e].StaffEntries){if(!i)continue;let s=i.findStaffEntryMaxNoteLength();t.lt(s)&&(t=s)}return t}},bh=class{},Di=class{constructor(e,t,i,s,r,n){this.slurs=[],this.playbackInstrumentId=void 0,this.notehead=void 0,this.printObject=!0,this.voiceEntry=e,this.parentStaffEntry=t,this.length=i,this.pitch=s,this.sourceMeasure=r,this.isRestFlag=n??!1,s?this.halfTone=s.getHalfTone():this.halfTone=0}get NoteAsString(){return this.pitch.toString()}ToStringShort(e=0){return!this.Pitch||this.isRest()?"rest":this.Pitch?.ToStringShort(e)}get ToStringShortGet(){return this.ToStringShort(0)}get ParentVoiceEntry(){return this.voiceEntry}set ParentVoiceEntry(e){this.voiceEntry=e}get ParentStaffEntry(){return this.parentStaffEntry}get ParentStaff(){return this.parentStaffEntry.ParentStaff}get Length(){return this.length}set Length(e){this.length=e}get SourceMeasure(){return this.sourceMeasure}get TypeLength(){return this.typeLength}set TypeLength(e){this.typeLength=e}get NoteTypeXml(){return this.noteTypeXml}set NoteTypeXml(e){this.noteTypeXml=e}get NormalNotes(){return this.normalNotes}set NormalNotes(e){this.normalNotes=e}get Pitch(){return this.pitch}get NoteBeam(){return this.beam}set NoteBeam(e){this.beam=e}set Notehead(e){this.notehead=e}get Notehead(){return this.notehead}get NoteTuplet(){return this.tuplet}set NoteTuplet(e){this.tuplet=e}get NoteGlissando(){return this.glissando}set NoteGlissando(e){this.glissando=e}get NoteTie(){return this.tie}set NoteTie(e){this.tie=e}get NoteSlurs(){return this.slurs}set NoteSlurs(e){this.slurs=e}get PlaybackInstrumentId(){return this.playbackInstrumentId}set PlaybackInstrumentId(e){this.playbackInstrumentId=e}get PrintObject(){return this.printObject}set PrintObject(e){this.printObject=e}get Arpeggio(){return this.arpeggio}set Arpeggio(e){this.arpeggio=e}get IsCueNote(){return this.isCueNote}set IsCueNote(e){this.isCueNote=e}get StemDirectionXml(){return this.stemDirectionXml}set StemDirectionXml(e){this.stemDirectionXml=e}get TremoloStrokes(){return this.TremoloInfo?.tremoloStrokes}get StemColorXml(){return this.stemColorXml}set StemColorXml(e){this.stemColorXml=e}get NoteheadColorXml(){return this.noteheadColorXml}set NoteheadColorXml(e){this.noteheadColorXml=e}get NoteheadColor(){return this.noteheadColor}set NoteheadColor(e){this.noteheadColor=e}get NoteheadColorCurrentlyRendered(){return this.noteheadColorCurrentlyRendered}set NoteheadColorCurrentlyRendered(e){this.noteheadColorCurrentlyRendered=e}isRest(){return this.isRestFlag}isWholeRest(){return this.isRest()&&this.Length.RealValue===this.sourceMeasure.ActiveTimeSignature.RealValue}isWholeMeasureNote(){return this.Length.RealValue===this.sourceMeasure.ActiveTimeSignature.RealValue}ToString(){return this.pitch?this.Pitch.ToString()+", length: "+this.length.toString():"rest note, length: "+this.length.toString()}getAbsoluteTimestamp(){return N.plus(this.voiceEntry.Timestamp,this.sourceMeasure.AbsoluteTimestamp)}isDuplicateSlur(e){for(let t=0,i=this.slurs.length;t<i;++t){let s=this.slurs[t];if(s.StartNote!==void 0&&s.EndNote!==void 0&&e.StartNote!==void 0&&e.StartNote===s.StartNote&&s.EndNote===this&&e.PlacementXml===s.PlacementXml)return!0}return!1}hasTabEffects(){return!1}},Sh=(function(e){return e[e.Normal=0]="Normal",e[e.Grace=1]="Grace",e[e.Cue=2]="Cue",e})({}),Ni=class extends ue{constructor(e=void 0,t=void 0,i=void 0){super(),this.hasOnlyRests=!1,this.measureNumber=-1,this.ShowTimeSignature=!0,this.ShowKeySignature=!0,this.isTabMeasure=!1,this.parentStaff=e,this.parentSourceMeasure=t,this.parentStaffLine=i,i?(this.parentStaff=i.ParentStaff,this.PositionAndShape=new Yt(this,i.PositionAndShape)):this.PositionAndShape=new Yt(this),this.PositionAndShape.BorderBottom=4,this.parentSourceMeasure&&(this.measureNumber=this.parentSourceMeasure.MeasureNumber),this.staffEntries=[]}get ParentStaff(){return this.parentStaff}
3get ParentMusicSystem(){return this.parentMusicSystem}set ParentMusicSystem(e){this.parentMusicSystem=e}get MeasureNumber(){return this.measureNumber}get FirstInstructionStaffEntry(){return this.firstInstructionStaffEntry}set FirstInstructionStaffEntry(e){this.firstInstructionStaffEntry=e}get LastInstructionStaffEntry(){return this.lastInstructionStaffEntry}set LastInstructionStaffEntry(e){this.lastInstructionStaffEntry=e}get ParentStaffLine(){return this.parentStaffLine}set ParentStaffLine(e){this.parentStaffLine=e,this.parentStaffLine&&(this.PositionAndShape.Parent=this.parentStaffLine.PositionAndShape)}resetLayout(){throw Error("not implemented")}getLineWidth(e){throw Error("not implemented")}addClefAtBegin(e){throw Error("not implemented")}addKeyAtBegin(e,t,i){throw Error("not implemented")}addRhythmAtBegin(e){throw Error("not implemented")}addClefAtEnd(e,t=!0){throw Error("not implemented")}setPositionInStaffline(e){this.PositionAndShape.RelativePosition=new k(e,0)}setWidth(e){this.PositionAndShape.BorderRight=e}layoutSymbols(){throw Error("not implemented")}findGraphicalStaffEntryFromTimestamp(e){for(let t=0,i=this.staffEntries.length;t<i;++t){let s=this.staffEntries[t];if(s.relInMeasureTimestamp?.Equals(e))return s}}findGraphicalStaffEntryFromVerticalContainerTimestamp(e){for(let t=0,i=this.staffEntries.length;t<i;++t){let s=this.staffEntries[t];if(s.sourceStaffEntry.VerticalContainerParent.getAbsoluteTimestamp().Equals(e))return s}}hasSameDurationWithSourceMeasureParent(){let e=new N(0,1);for(let t=0,i=this.staffEntries.length;t<i;++t){let s=this.staffEntries[t];e.Add(s.findStaffEntryMinNoteLength())}return e.Equals(this.parentSourceMeasure.Duration)}hasMultipleVoices(){if(this.staffEntries.length===0)return!1;let e=[];for(let t=0,i=this.staffEntries.length;t<i;++t){let s=this.staffEntries[t];for(let r=0,n=s.sourceStaffEntry.VoiceEntries.length;r<n;++r){let a=s.sourceStaffEntry.VoiceEntries[r];e.indexOf(a.ParentVoice)<0&&e.push(a.ParentVoice)}}return e.length>1}isVisible(){return this.ParentStaff.isVisible()}isMultiRestMeasure(){return this.multiRestElement!==void 0}getGraphicalMeasureDurationFromStaffEntries(){let e=new N(0,1),t=[];for(let i=0,s=this.staffEntries.length;i<s;++i){let r=this.staffEntries[i];for(let n=0,a=r.sourceStaffEntry.VoiceEntries.length;n<a;++n){let o=r.sourceStaffEntry.VoiceEntries[n];t.indexOf(o.ParentVoice)<0&&t.push(o.ParentVoice)}}for(let i=0,s=t.length;i<s;++i){let r=t[i],n=new N(0,1);for(let a of this.staffEntries)for(let o of a.graphicalVoiceEntries)o.parentVoiceEntry.ParentVoice===r&&o.notes.length>0&&n.Add(o.notes[0].graphicalNoteLength);e.lt(n)&&(e=N.createFromFraction(n))}return e}addGraphicalStaffEntry(e){this.staffEntries.push(e)}addGraphicalStaffEntryAtTimestamp(e){if(e)if(this.staffEntries.length===0||this.staffEntries[this.staffEntries.length-1].relInMeasureTimestamp.lt(e.relInMeasureTimestamp))this.staffEntries.push(e);else for(let t=this.staffEntries.length-1;t>=0;t--){if(this.staffEntries[t].relInMeasureTimestamp.lt(e.relInMeasureTimestamp)){this.staffEntries.splice(t+1,0,e);break}t===0&&this.staffEntries.splice(t,0,e)}}isPianoRightHand(){return this.isUpperStaffOfInstrument()}isPianoLeftHand(){return this.isLowerStaffOfInstrument()}isUpperStaffOfInstrument(){return this.parentStaff.ParentInstrument.Staves.length===1?!0:this.ParentStaff===this.parentStaff.ParentInstrument.Staves[0]}isLowerStaffOfInstrument(){return this.parentStaff.ParentInstrument.Staves.length===1?!1:this.ParentStaff===this.ParentStaff.ParentInstrument.Staves.last(
3)}beginsWithLineRepetition(){let e=this.parentSourceMeasure;return e?e.beginsWithLineRepetition():!1}endsWithLineRepetition(){let e=this.parentSourceMeasure;return e?e.endsWithLineRepetition():!1}beginsWithWordRepetition(){let e=this.parentSourceMeasure;return e?e.beginsWithWordRepetition():!1}endsWithWordRepetition(){let e=this.parentSourceMeasure;return e?e.endsWithWordRepetition():!1}getTransposedHalftones(){return this.parentStaff.ParentInstrument.GetMusicSheet.Transpose+this.parentStaff.ParentInstrument.Transpose}},Us=class{constructor(e,t){this.numberXml=1,this.setOctaveShiftValue(e,t)}get Type(){return this.octaveValue}set Type(e){this.octaveValue=e}get StaffNumber(){return this.staffNumber}set StaffNumber(e){this.staffNumber=e}get ParentStartMultiExpression(){return this.startMultiExpression}set ParentStartMultiExpression(e){this.startMultiExpression=e}get ParentEndMultiExpression(){return this.endMultiExpression}set ParentEndMultiExpression(e){this.endMultiExpression=e}setOctaveShiftValue(e,t){t===1&&e==="down"?this.octaveValue=se.VA8:t===1&&e==="up"?this.octaveValue=se.VB8:t===2&&e==="down"?this.octaveValue=se.MA15:t===2&&e==="up"?this.octaveValue=se.MB15:this.octaveValue=se.NONE}static getPitchFromOctaveShift(e,t){if(!e)return;if(e.OctaveShiftApplied)return e;let i=e.Octave;switch(t){case se.VA8:--i;break;case se.VB8:i+=1;break;case se.MA15:i-=2;break;case se.MB15:i+=2;break;case se.NONE:default:i+=0}let s=new Ct(e.FundamentalNote,i,e.Accidental);return s.OctaveShiftApplied=!0,s}},se=(function(e){return e[e.VA8=0]="VA8",e[e.VB8=1]="VB8",e[e.MA15=2]="MA15",e[e.MB15=3]="MB15",e[e.NONE=4]="NONE",e})({}),fo=class{constructor(e){this.placement=C.Above,this.accidentalAbove=q.NONE,this.accidentalBelow=q.NONE,this.ornament=e}get GetOrnament(){return this.ornament}get AccidentalAbove(){return this.accidentalAbove}set AccidentalAbove(e){this.accidentalAbove=e}get AccidentalBelow(){return this.accidentalBelow}set AccidentalBelow(e){this.accidentalBelow=e}},he=(function(e){return e[e.Trill=0]="Trill",e[e.Turn=1]="Turn",e[e.InvertedTurn=2]="InvertedTurn",e[e.DelayedTurn=3]="DelayedTurn",e[e.DelayedInvertedTurn=4]="DelayedInvertedTurn",e[e.Mordent=5]="Mordent",e[e.InvertedMordent=6]="InvertedMordent",e})({}),As=class qr{constructor(t,i,s,r=!1,n=!1,a=!1){if(this.notes=[],this.articulations=[],this.technicalInstructions=[],this.lyricsEntries=new We.Dictionary,this.wantedStemDirection=Rt.Undefined,this.stemDirectionXml=Rt.Undefined,this.stemDirection=Rt.Undefined,this.timestamp=t,this.parentVoice=i,this.parentSourceStaffEntry=s,this.isGrace=r,this.graceAfterMainNote=!1,this.graceNoteSlash=n,this.graceSlur=a,s!==void 0){let o=s.VoiceEntries;o.indexOf(this)===-1&&o.push(this)}}get ParentSourceStaffEntry(){return this.parentSourceStaffEntry}get ParentVoice(){return this.parentVoice}get Timestamp(){return this.timestamp}set Timestamp(t){this.timestamp=t}get Notes(){return this.notes}get IsGrace(){return this.isGrace}set IsGrace(t){this.isGrace=t}get GraceAfterMainNote(){return this.graceAfterMainNote}set GraceAfterMainNote(t){this.graceAfterMainNote=t}get GraceNoteSlash(){return this.graceNoteSlash}set GraceNoteSlash(t){this.graceNoteSlash=t}get GraceSlur(){return this.graceSlur}set GraceSlur(t){this.graceSlur=t}get Articulations(){return this.articulations}set Articulations(t){this.articulations=t}get TechnicalInstructions(){return this.technicalInstructions}get LyricsEntries(){return this.lyricsEntries}get Arpeggio(){return this.arpeggio}set Arpeggio(t){this.arpeggio=t}get OrnamentContainer(){return this.ornamentContainer}set OrnamentContainer(t){this.ornamentContainer=t}set WantedStemDirection(t){this.wantedStemDirection=t}get WantedStemDirection(){return this.wantedStemDirection}set StemDirectionXml(t){this.stemDirectionXml=t}get StemDirectionXml(){return this.stemDirectionXml}set StemDirection(t){this.stemDirection=t}get StemDirection(){return this.stemDirection}get StemColorXml(){return this.stemColorXml}set StemColorXml(t){this.stemColorXml=t}get StemColor(){return this.stemColor}set StemColor(t){this.stemColor=t}hasArticulation(t){for(let i of this.articulations)if(i.Equals(t))return!0;return!1}static isSupportedArticulation(t){switch(t){case Et.accent:case Et.strongaccent:case Et.softaccent:case Et.invertedstrongaccent:case Et.staccato:case Et.staccatissimo:case Et.spiccato:case Et.tenuto:case Et.fermata:case Et.invertedfermata:case Et.breathmark:case Et.caesura:case Et.lefthandpizzicato:case Et.naturalharmonic:case Et.snappizzicato:case Et.upbow:case Et.downbow:case Et.bend:return!0;default:return!1}}hasTie(){for(let t=0,i=this.Notes.length;t<i;++t)if(this.Notes[t].NoteTie)return!0;return!1}hasSlur(){for(let t=0,i=this.Notes.length;t<i;++t)if(this.Notes[t].NoteSlurs.length>0)return!0;return!1}isStaccato(){for(let t of this.Articulations)if(t.articulationEnum===Et.staccato)return!0;return!1}isAccent(){for(let t of this.Articulations)if(t.articulationEnum===Et.accent||t.articulationEnum===Et.strongaccent)return!0;return!1}getVerseNumberForLyricEntry(t){let i="1";
3return this.lyricsEntries.forEach((s,r)=>{t===r&&(i=s)}),i}createVoiceEntriesForOrnament(t,i){t||(t=this);let s=[];if(!t.ornamentContainer)return;let r=this.notes[0],n=r.Length,a=t.ParentVoice,o=t.Timestamp,l=N.createFromFraction(o);switch(t.ornamentContainer.GetOrnament){case he.Trill:{let h=new N(n.Numerator,n.Denominator*8),u=r.Pitch.getTransposedPitch(1),c=i.getAlterationForPitch(u);t.OrnamentContainer.AccidentalAbove!==q.NONE&&(c=t.ornamentContainer.AccidentalAbove);for(let d=0;d<8;d++)l=N.plus(o,new N(d*h.Numerator,h.Denominator)),d%2==0?this.createBaseVoiceEntry(l,h,a,r,s):this.createAlteratedVoiceEntry(l,h,a,r.SourceMeasure,u,c,s);break}case he.Turn:{let h=new N(n.Numerator,n.Denominator*4),u=r.Pitch.getTransposedPitch(-1),c=i.getAlterationForPitch(u),d=r.Pitch.getTransposedPitch(1),f=i.getAlterationForPitch(d);this.createAlteratedVoiceEntry(l,h,a,r.SourceMeasure,d,f,s),l.Add(h),this.createBaseVoiceEntry(l,h,a,r,s),l.Add(h),this.createAlteratedVoiceEntry(l,h,a,r.SourceMeasure,u,c,s),l.Add(h),this.createBaseVoiceEntry(l,h,a,r,s);break}case he.InvertedTurn:{let h=new N(n.Numerator,n.Denominator*4),u=r.Pitch.getTransposedPitch(-1),c=i.getAlterationForPitch(u),d=r.Pitch.getTransposedPitch(1),f=i.getAlterationForPitch(d);this.createAlteratedVoiceEntry(l,h,a,r.SourceMeasure,u,c,s),l.Add(h),this.createBaseVoiceEntry(l,h,a,r,s),l.Add(h),this.createAlteratedVoiceEntry(l,h,a,r.SourceMeasure,d,f,s),l.Add(h),this.createBaseVoiceEntry(l,h,a,r,s);break}case he.DelayedTurn:{let h=new N(n.Numerator,n.Denominator*2),u=r.Pitch.getTransposedPitch(-1),c=i.getAlterationForPitch(u),d=r.Pitch.getTransposedPitch(1),f=i.getAlterationForPitch(d);this.createBaseVoiceEntry(l,h,a,r,s),l=N.plus(o,h),h.Denominator=n.Denominator*8,this.createAlteratedVoiceEntry(l,h,a,r.SourceMeasure,d,f,s),l.Add(h),this.createBaseVoiceEntry(l,h,a,r,s),l.Add(h),this.createAlteratedVoiceEntry(l,h,a,r.SourceMeasure,u,c,s),l.Add(h),this.createBaseVoiceEntry(l,h,a,r,s);break}case he.DelayedInvertedTurn:{let h=new N(n.Numerator,n.Denominator*2),u=r.Pitch.getTransposedPitch(-1),c=i.getAlterationForPitch(u),d=r.Pitch.getTransposedPitch(1),f=i.getAlterationForPitch(d);this.createBaseVoiceEntry(l,h,a,r,s),l=N.plus(o,h),h.Denominator=n.Denominator*8,this.createAlteratedVoiceEntry(l,h,a,r.SourceMeasure,u,c,s),l.Add(h),this.createBaseVoiceEntry(l,h,a,r,s),l.Add(h),this.createAlteratedVoiceEntry(l,h,a,r.SourceMeasure,d,f,s),l.Add(h),this.createBaseVoiceEntry(l,h,a,r,s);break}case he.Mordent:{let h=new N(n.Numerator,n.Denominator*4),u=r.Pitch.getTransposedPitch(1),c=i.getAlterationForPitch(u);this.createBaseVoiceEntry(l,h,a,r,s),l.Add(h),this.createAlteratedVoiceEntry(l,h,a,r.SourceMeasure,u,c,s),h.Denominator=n.Denominator*2,l=N.plus(o,h),this.createBaseVoiceEntry(l,h,a,r,s);break}case he.InvertedMordent:{let h=new N(n.Numerator,n.Denominator*4),u=r.Pitch.getTransposedPitch(-1),c=i.getAlterationForPitch(u);this.createBaseVoiceEntry(l,h,a,r,s),l.Add(h),this.createAlteratedVoiceEntry(l,h,a,r.SourceMeasure,u,c,s),h.Denominator=n.Denominator*2,l=N.plus(o,h),this.createBaseVoiceEntry(l,h,a,r,s);break}default:throw RangeError()}return s}createBaseVoiceEntry(t,i,s,r,n){let a=new qr(t,s,r.ParentStaffEntry),o=new Di(a,void 0,i,new Ct(r.Pitch.FundamentalNote,r.Pitch.Octave,r.Pit
3ch.Accidental),r.SourceMeasure);a.Notes.push(o),n.push(a)}createAlteratedVoiceEntry(t,i,s,r,n,a,o){let l=new qr(t,s,void 0),h=new Di(l,void 0,i,new Ct(n.FundamentalNote,n.Octave,a),r);l.Notes.push(h),o.push(l)}},Et=(function(e){return e[e.accent=0]="accent",e[e.strongaccent=1]="strongaccent",e[e.softaccent=2]="softaccent",e[e.marcatoup=3]="marcatoup",e[e.marcatodown=4]="marcatodown",e[e.invertedstrongaccent=5]="invertedstrongaccent",e[e.staccato=6]="staccato",e[e.staccatissimo=7]="staccatissimo",e[e.spiccato=8]="spiccato",e[e.tenuto=9]="tenuto",e[e.fermata=10]="fermata",e[e.invertedfermata=11]="invertedfermata",e[e.breathmark=12]="breathmark",e[e.caesura=13]="caesura",e[e.lefthandpizzicato=14]="lefthandpizzicato",e[e.naturalharmonic=15]="naturalharmonic",e[e.snappizzicato=16]="snappizzicato",e[e.upbow=17]="upbow",e[e.downbow=18]="downbow",e[e.scoop=19]="scoop",e[e.plop=20]="plop",e[e.doit=21]="doit",e[e.falloff=22]="falloff",e[e.stress=23]="stress",e[e.unstress=24]="unstress",e[e.detachedlegato=25]="detachedlegato",e[e.otherarticulation=26]="otherarticulation",e[e.bend=27]="bend",e})({}),Rt=(function(e){return e[e.Undefined=-1]="Undefined",e[e.Up=0]="Up",e[e.Down=1]="Down",e[e.None=2]="None",e[e.Double=3]="Double",e})({}),ar=class{static Compare(e,t){if(e.parentRepetition!==void 0&&t.parentRepetition){if(e.alignment===Pt.End&&t.alignment===Pt.End){if(e.parentRepetition.StartIndex<t.parentRepetition.StartIndex)return 1;if(e.parentRepetition.StartIndex>t.parentRepetition.StartIndex)return-1}if(e.alignment===Pt.Begin&&t.alignment===Pt.Begin){if(e.parentRepetition.EndIndex<t.parentRepetition.EndIndex)return 1;if(e.parentRepetition.EndIndex>t.parentRepetition.EndIndex)return-1}}return 0}},Lt=class{constructor(e,t,i=Pt.End,s=void 0,r=void 0){this.endingIndices=void 0,this.measureIndex=e,r&&(this.endingIndices=r.slice()),this.type=t,this.alignment=i,this.parentRepetition=s}CompareTo(e){let t=e;if(this.measureIndex>t.measureIndex)return 1;if(this.measureIndex<t.measureIndex)return-1;if(this.alignment===Pt.Begin){if(t.alignment===Pt.End)return-1;switch(this.type){case J.Ending:return 1;case J.StartLine:return t.type===J.Ending?-1:1;case J.Coda:case J.Segno:return t.type===J.Coda?1:-1;default:}}else{if(t.alignment===Pt.Begin)return 1;switch(this.type){case J.Ending:return-1;case J.Fine:case J.ToCoda:return t.type===J.Ending?1:-1;case J.ForwardJump:switch(t.type){case J.Ending:case J.Fine:case J.ToCoda:return 1;default:}return-1;case J.DalSegnoAlFine:case J.DaCapoAlFine:case J.DalSegnoAlCoda:case J.DaCapoAlCoda:case J.DaCapo:case J.DalSegno:case J.BackJumpLine:return 1;default:}}return 0}equals(e){if(this.measureIndex!==e.measureIndex||this.type!==e.type||this.alignment!==e.alignment)return!1;if(this.endingIndices===e.endingIndices)return!0;if(!this.endingIndices||!e.endingIndices||this.endingIndices.length!==e.endingIndices.length)return!1;for(let t=0;t<this.endingIndices.length;t++)if(this.endingIndices[t]!==e.endingIndices[t])return!1;return!0}},J=(function(e){return e[e.StartLine=0]="StartLine",e[e.ForwardJump=1]="ForwardJump",e[e.BackJumpLine=2]="BackJumpLine",e[e.Ending=3]="Ending",e[e.DaCapo=4]="DaCapo",e[e.DalSegno=5]="DalSegno",e[e.Fine=6]="Fine",e[e.ToCoda=7]="ToCoda",e[e.DalSegnoAlFine=8]="DalSegnoAlFine",e[e.DaCapoAlFine=9]="DaCapoAlFine",e[e.DalSegnoAlCoda=10]="DalSegnoAlCoda",e[e.DaCapoAlCoda=11]="DaCapoAlCoda",e[e.Coda=12]="Coda",e[e.Segno=13]="Segno",e[e.None=14]="None",e})({}),Pt=(function(e){return e[e.Begin=0]="Begin",e[e.End=1]="End",e[e.Mid=2]="Mid",e[e.Discontinue=3]="Discontinue",e})({}),Re=class po extends br{constructor(t,i){super(void 0),this.rhythm=t,this.numerator=t.Numerator,this.denominator=t.Denominator,this.symbolEnum=i}get Rhythm(){return this.rhythm}set Rhythm(t){this.rhythm=t}get SymbolEnum(){return this.symbolEnum}set SymbolEnum(t){this.symbolEnum=t}clone(){return new po(this.rhythm.clone(),this.symbolEnum)}OperatorEquals(t){let i=this;return i===t?!0:!i||!t?!1:i.numerator===t.numerator&&i.denominator===t.denominator}OperatorNotEqual(t){return this!==t}ToString(){return"Rhythm: "+this.rhythm.toString()}},Ke=(function(e){return e[e.NONE=0]="NONE",e[e.COMMON=1]="COMMON",e[e.CUT=2]="CUT",e})({}),ft=(function(e){return e[e.SingleThin=0]="SingleThin",e[e.DoubleThin=1]="DoubleThin",e[e.ThinBold=2]="ThinBold",e[e.BoldThinDots=3]="BoldThinDots",e[e.DotsThinBold=4]="DotsThinBold",e[e.DotsBoldBoldDots=5]="DotsBoldBoldDots",e[e.None=6]="None",e[e.Dotted=7]="Dotted",e[e.Dashed=8]="Dashed",e[e.Bold=9]="Bold",e[e.BoldThin=10]="BoldThin",e[e.DoubleBold=11]="DoubleBold",e[e.Tick=12]="Tick",e[e.Short=13]="Short",e})({}),mo=class{static xmlBarlineStyleToSystemLinesEnum(e){return e==="regular"?ft.SingleThin:e==="dotted"?ft.Dotted:e==="dashed"?ft.Dashed:e==="heavy"?ft.Bold:e==="light-light"?ft.DoubleThin:e==="light-heavy"?ft.ThinBold:e==="heavy-light"?ft.BoldThin:e==="heavy-heavy"?ft.DoubleBold:e==="tick"?ft.Tick:e==="short"?ft.Short:e==="none"?ft.None:ft.SingleThin}},wi=(function(e){return e[e.MeasureBegin=0]="MeasureBegin",e[e.MeasureEnd=1]="MeasureEnd",e})({}),yh=5,xh=4,Eh="barlines",vh="timesignatures",Jr=class{constructor(){this.musicSystems=[],this.globalSystemIndex=0,this.leadSheet=!1}initialize(e,t,i){this.leadSheet=e.LeadSheet,this.graphicalMusicSheet=e,this.rules=this.graphicalMusicSheet.ParentMusicSheet.Rules,this.measureList=t,this.numberOfVisibleStaffLines=i,this.activeRhythm=Array(this.numberOfVisibleStaffLines),this.activeKeys=Array(this.numberOfVisibleStaffLines),this.activeClefs=Array(this.numberOfVisibleStaffLines),this.initializeActiveInstructions(this.measureList[0])}buildMusicSystems(){let e=this.getFullPageSystemWidth(),t=!1;for(this.measureListIndex=0,this.currentSystemParams=new zs,this.currentSystemParams.currentSystem=this.initMusicSystem(
3),this.currentSystemParams.maxLabelLength=this.currentSystemParams.currentSystem.MaxLabelLength;this.measureListIndex<this.measureList.length;){let i=this.measureList[this.measureListIndex];if(!i||!i[0]){this.measureListIndex++;continue}for(let M=0,P=i.length;M<P;++M)i[M].resetLayout();let s=i[0].parentSourceMeasure,r=s.HasEndLine,n=r&&this.rules.NewPartAndSystemAfterFinalBarline,a=this.currentSystemParams.IsSystemStartMeasure();s.IsSystemStartMeasure=a;let o=s===this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure(),l=this.rules.MeasureLeftMargin,h=0,u=this.getMeasureStartLine();if(l+=this.getLineWidth(i[0],u,a),!this.leadSheet){let M=!1;t&&this.rules.ShowRhythmAgainAfterPartEndOrFinalBarline&&(M=!0),l+=this.addBeginInstructions(i,a,o||M),h+=this.addEndInstructions(i)}let c=0;for(let M=0;M<this.numberOfVisibleStaffLines;M++)c=Math.max(c,i[M].minimumStaffEntriesWidth);let d=this.getMeasureEndLine();h+=this.getLineWidth(i[0],d,a);let f=this.rules.MeasureLeftMargin,p;if(this.measureListIndex+1<this.measureList.length){let M=this.measureList[this.measureListIndex+1];p=M[0]?.parentSourceMeasure,p?.hasBeginInstructions()&&(f+=this.addBeginInstructions(M,!1,!1))}let m=l+h+c;if(i[0]?.parentSourceMeasure?.multipleRestMeasures){c=this.rules.MultipleRestMeasureDefaultWidth,m=l+h+c;for(let M=0;M<this.numberOfVisibleStaffLines;M++)i[M]&&(i[M].minimumStaffEntriesWidth=c)}let g=this.currentSystemParams.systemMeasures.length,b=this.currentSystemParams.maxLabelLength>0?this.currentSystemParams.maxLabelLength+this.rules.SystemLabelsRightMargin:0,S=this.currentSystemParams.currentWidth+m+f+b<e,E=this.rules.NewPageAtXMLNewPageAttribute&&s.printNewPageXml,y=E||this.rules.NewSystemAtXMLNewPageAttribute&&s.printNewPageXml||this.rules.NewSystemAtXMLNewSystemAttribute&&s.printNewSystemXml||g===this.rules.RenderXMeasuresPerLineAkaSystem&&g>0;if(a||S&&!y){if(this.addMeasureToSystem(i,u,d,m,l,c,h),this.updateActiveClefs(s,i),this.measureListIndex++,n){if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(i,!this.rules.StretchLastSystemLine,!1),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(i,!this.rules.StretchLastSystemLine,!1)}t=r}else{if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(i,!1,!0,E),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(i,!1,!0,E)}}if(this.currentSystemParams.systemMeasures.length>0){if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1)}return this.musicSystems}async buildMusicSystemsAsync(e){let{YieldGuard:t}=await Promise.resolve().then(()=>(Ji(),qi)),i=new t,s=this.getFullPageSystemWidth(),r=!1;this.measureListIndex=0,this.currentSystemParams=new zs,this.currentSystemParams.currentSystem=this.initMusicSystem(),this.currentSystemParams.maxLabelLength=this.currentSystemParams.currentSystem.MaxLabelLength;let n=this.measureList.length,a=0;for(;this.measureListIndex<this.measureList.length;){let o=this.measureList[this.measureListIndex];if(!o||!o[0]){this.measureListIndex++;continue}for(let G=0,H=o.length;G<H;++G)o[G].resetLayout();let l=o[0].parentSourceMeasure,h=l.HasEndLine,u=h&&this.rules.NewPartAndSystemAfterFinalBarline,c=this.currentSystemParams.IsSystemStartMeasure();l.IsSystemStartMeasure=c;let d=l===this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure(),f=this.rules.MeasureLeftMargin,p=0,m=this.getMeasureStartLine();if(f+=this.getLineWidth(o[0],m,c),!this.leadSheet){let G=!1;r&&this.rules.ShowRhythmAgainAfterPartEndOrFinalBarline&&(G=!0),f+=this.addBeginInstructions(o,c,d||G),p+=this.addEndInstructions(o)}let g=0;for(let G=0;G<this.numberOfVisibleStaffLines;G++)g=Math.max(g,o[G].minimumStaffEntriesWidth);let b=this.getMeasureEndLine();p+=this.getLineWidth(o[0],b,c);let S=this.rules.MeasureLeftMargin,E;if(this.measureListIndex+1<this.measureList.length){let G=this.measureList[this.measureListIndex+1];
3E=G[0]?.parentSourceMeasure,E?.hasBeginInstructions()&&(S+=this.addBeginInstructions(G,!1,!1))}let y=f+p+g;if(o[0]?.parentSourceMeasure?.multipleRestMeasures){g=this.rules.MultipleRestMeasureDefaultWidth,y=f+p+g;for(let G=0;G<this.numberOfVisibleStaffLines;G++)o[G]&&(o[G].minimumStaffEntriesWidth=g)}let M=this.currentSystemParams.systemMeasures.length,P=this.currentSystemParams.maxLabelLength>0?this.currentSystemParams.maxLabelLength+this.rules.SystemLabelsRightMargin:0,L=this.currentSystemParams.currentWidth+y+S+P<s,B=this.rules.NewPageAtXMLNewPageAttribute&&l.printNewPageXml,A=B||this.rules.NewSystemAtXMLNewPageAttribute&&l.printNewPageXml||this.rules.NewSystemAtXMLNewSystemAttribute&&l.printNewSystemXml||M===this.rules.RenderXMeasuresPerLineAkaSystem&&M>0;if(c||L&&!A){if(this.addMeasureToSystem(o,m,b,y,f,g,p),this.updateActiveClefs(l,o),this.measureListIndex++,u){if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(o,!this.rules.StretchLastSystemLine,!1),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(o,!this.rules.StretchLastSystemLine,!1)}r=h}else{if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(o,!1,!0,B),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(o,!1,!0,B)}a++,a%8==0&&(e?.(a,n),await i.maybeYield())}if(this.currentSystemParams.systemMeasures.length>0){if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1)}return e?.(n,n),this.musicSystems}calculateSystemYLayout(){for(let e of this.musicSystems)this.optimizeDistanceBetweenStaffLines(e);this.calculateMusicSystemsRelativePositions()}setMeasureWidth(e,t,i,s){for(let r=0,n=e.length;r<n;++r){let a=e[r];a.setWidth(t),i>0&&(a.beginInstructionsWidth=i),s>0&&(a.endInstructionsWidth=s)}}finalizeCurrentAndCreateNewSystem(e,t=!1,i=!0,s=!1){this.finalizeCurrentSystem(e,t,i,s),this.currentSystemParams=new zs,e!==void 0&&this.measureListIndex<this.measureList.length&&(this.currentSystemParams.currentSystem=this.initMusicSystem(),this.currentSystemParams.maxLabelLength=this.currentSystemParams.currentSystem.MaxLabelLength)}finalizeCurrentSystem(e,t=!1,i=!0,s=!1){this.currentSystemParams.currentSystem.breaksPage=s,this.adaptRepetitionLineWithIfNeeded(),e!==void 0&&i&&this.checkAndCreateExtraInstructionMeasure(e),this.stretchMusicSystem(t)}adaptRepetitionLineWithIfNeeded(){let e=this.currentSystemParams.systemMeasures;if(e.length>=1){let t=this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length-1],i=0,s=e[e.length-1];s.endLine===ft.DotsBoldBoldDots&&(s.endLine=ft.DotsThinBold,i=t[0].getLineWidth(ft.DotsBoldBoldDots)/2-t[0].getLineWidth(ft.DotsThinBold)),this.currentSystemParams.currentSystemFixWidth-=i;for(let r=0,n=t.length;r<n;++r){let a=t[r];a.endInstructionsWidth-=i}}}addMeasureToSystem(e,t,i,s,r,n,a){this.currentSystemParams.systemMeasures.push({beginLine:t,endLine:i}),this.setMeasureWidth(e,s,r,a),this.addStaveMeasuresToSystem(e),this.currentSystemParams.currentWidth+=s,this.currentSystemParams.currentSystemFixWidth+=r+a,this.currentSystemParams.currentSystemVarWidth+=n,this.currentSystemParams.systemMeasureIndex++}initMusicSystem(){let e=Xt.symbolFactory.createMusicSystem(this.globalSystemIndex++,this.rules);return this.musicSystems.push(e),this.layoutSystemStaves(e),e.createMusicSystemLabel(this.rules.InstrumentLabelTextHeight,this.rules.SystemLabelsRightMargin,this.rules.LabelMarginBorderFactor,this.musicSystems.length===1),e}getFullPageSystemWidth(){return this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageLeftMargin-this.rules.PageRightMargin-this.rules.SystemLeftMargin-this.rules.SystemRightMargin}layoutSystemStaves(e){let t=this.getFullPageSystemWidth(),i=e.PositionAndShape;i.BorderLeft=0,i.BorderRight=t,i.BorderTop=0;let s=[],r=this.graphicalMusicSheet.ParentMusicSheet.Instruments;for(let o=0,l=r.length;o<l;++o){let h=r[o];if(!(!h.isVisible()||h.Voices.length===0))for(let u=0,c=h.Staves.length;u<c;++u){let d=h.Staves[u];d?.Visible&&s.push(d)}}let n=!1;if(this.leadSheet){for(let o=0,l=s.length;o<l;++o)if(s[o].ParentInstrument.LyricVersesNumbers.length>1){n=!0;break}}let a=0;for(let o=0;o<s.length;o++)if(this.addStaffLineToMusicSystem(e,a,s[o]),a+=this.rules.StaffHeight,o+1<s.length){let l=0;l=this.leadSheet&&!n?2.5:s[o].ParentInstrument===s[o+1].ParentInstrument?this.rules.BetweenStaffDistance:this.rules.StaffDistance,a+=l}i.BorderBottom=a}addStaffLineToMusicSystem(e,t,i){if(e){let s=Xt.symbolFactory.createStaffLine(e,i);e.StaffLines.push(s);let r=s.PositionAndShape,n=new k;n.x=0,r.BorderRight=e.PositionAndShape.Size.width,n.y=t,r.RelativePosition=n,r.BorderLeft=0,r.BorderTop=0,r.BorderBottom=this.rules.StaffHeight;for(let a=0;a<5;a++){let o=new k;o.x=0,o.y=a*this.rules.StaffHeight/4;let l=new k;l.x=s.PositionAndShape.Size.width,l.y=a*this.rules.StaffHeight/4,this.leadSheet&&(o.y=l.y=0),s.StaffLines[a]=new Ae(o,l,this.rules.StaffLineWidth)}}}initializeActiveInstructions(e){let t=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(t){this.visibleStaffIndices=this.graphicalMusicSheet.getVisibleStavesIndicesFromSourceMeasure(e);for(let s=0,r=this.visibleStaffIndices.length;s<r;s++){let n=this.visibleStaffIndices[s],a=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(t,n);this.activeClefs[s]=t.FirstInstructionsStaffEntries[n].Instructions[0],a.InitiallyActiveClef=this.activeClefs[s];let o=t.FirstInstructionsStaffEntries[n].Instructions[1];if(o){let h=ye.copy(o);h=this.transposeKeyInstruction(h,a),this.activeKeys[s]=h}let l=t.FirstInstructionsStaffEntries[n].Instructions[2];this.activeRhythm[s]=l}let i=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures;for(let s=0;s<this.rules.MinMeasureToDrawIndex;s++){let r=i[s];if(r)for(let n=0,a=this.visibleStaffIndices.length;n<a;n++){let o=this.visibleStaffIndices[n],l=r.FirstInstructionsStaffEntries[o];if(l)for(let c=0,d=l.Instructions.length;c<d;++c){let f=l.Instructions[c];f instanceof Zt?this.activeClefs[n]=f:f instanceof ye?this.activeKeys[n]=f:f instanceof Re&&(this.activeRhythm[n]=f)}let h=r.getEntriesPerStaff(o);for(let c=0,d=h.length;c<d;++c){let f=h[c];
3if(f.Instructions)for(let p=0,m=f.Instructions.length;p<m;++p){let g=f.Instructions[p];g instanceof Zt&&(this.activeClefs[n]=g)}}let u=r.LastInstructionsStaffEntries[o];if(u)for(let c=0,d=u.Instructions.length;c<d;++c){let f=u.Instructions[c];f instanceof Zt&&(this.activeClefs[n]=f)}}}}}transposeKeyInstruction(e,t){let i=t.getTransposedHalftones();return i!==e.isTransposedBy&&t.ParentStaff.ParentInstrument.MidiInstrumentId!==lt.Percussion&&Xt.transposeCalculator!==void 0&&Xt.transposeCalculator.transposeKey(e,i),e}addBeginInstructions(e,t,i){let s=e.length;if(s===0)return 0;let r=0,n=e[0].parentSourceMeasure,a=[];for(let o=0;o<s;++o){let l=e[o];l&&a.push(l.getVFStave());let h=this.visibleStaffIndices[o],u=n.FirstInstructionsStaffEntries[h],c=this.AddInstructionsAtMeasureBegin(u,l,o,i,t);r=Math.max(r,c)}return this.formatBeginModifiers(a),r}formatBeginModifiers(e){if(e.length===0)return;let t=e[0];if(typeof t.formatBegModifiers=="function"){t.formatBegModifiers(e);return}this.alignNoteStartXs(e),this.alignBeginModifierXs(e,Eh,xh),this.alignBeginModifierXs(e,vh)}alignNoteStartXs(e){let t=0;for(let i of e){let s=i.getNoteStartX?.()??0;s>t&&(t=s)}for(let i of e)i.setNoteStartX?.(t)}alignBeginModifierXs(e,t,i){let s=0,r=[];for(let n of e){let a=n.getModifiers?.(yh,t)?.filter(o=>i===void 0||o.getType?.()===i)??[];r.push(a);for(let o of a){let l=o.getX?.()??0;l>s&&(s=l)}}for(let n of r)for(let a of n)a.setX?.(s)}addEndInstructions(e){let t=e.length;if(t===0)return 0;let i=.5,s=e[0].parentSourceMeasure;for(let r=0;r<t;r++){let n=e[r],a=this.visibleStaffIndices[r],o=s.LastInstructionsStaffEntries[a],l=this.addInstructionsAtMeasureEnd(o,n,e);i=Math.max(i,l)}return i}AddInstructionsAtMeasureBegin(e,t,i,s,r){let n=0,a,o,l;if(e)for(let d=0,f=e.Instructions.length;d<f;++d){let p=e.Instructions[d];p instanceof Zt?a=p:p instanceof ye?o=p:p instanceof Re&&(l=p)}t.InitiallyActiveClef=a??this.activeClefs[i],r&&(a||(a=this.activeClefs[i]),o||(o=ye.copy(this.activeKeys[i])),s&&!l&&(l=this.activeRhythm[i]));let h=!1,u=!1,c=!1;if(a?(t.addClefAtBegin(a),h=!0):a=this.activeClefs[i],o){o=this.transposeKeyInstruction(o,t);let d=r?void 0:this.activeKeys[i];t.addKeyAtBegin(o,d,a),u=!0}if(l!==void 0&&l.PrintObject&&this.rules.RenderTimeSignatures){let d=!0,f=t.MeasureNumber-1-this.rules.MinMeasureToDrawIndex;if(t.MeasureNumber-1>=0&&this.measureList[f]){let p=this.measureList[f][0]?.parentSourceMeasure;p?.ImplicitMeasure&&p?.RhythmPrinted&&(d=!1)}d&&(t.addRhythmAtBegin(l),t.parentSourceMeasure.RhythmPrinted=l,c=!0)}return(h||u||c)&&(n+=t.beginInstructionsWidth,c&&(n+=this.rules.RhythmRightMargin)),n}addInstructionsAtMeasureEnd(e,t,i){if(!e||!e.Instructions||e.Instructions.length===0)return 0;for(let s=0,r=e.Instructions.length;s<r;++s){let n=e.Instructions[s];if(n instanceof Zt){let a=n;t.addClefAtEnd(a);for(let o of i)o!==t&&o.addClefAtEnd(a,!1)}}return this.rules.MeasureRightMargin+t.endInstructionsWidth}updateActiveClefs(e,t){for(let i=0,s=t.length;i<s;i++){let r=this.visibleStaffIndices[i],n=e.FirstInstructionsStaffEntries[r];if(n)for(let l=0,h=n.Instructions.length;l<h;++l){let u=n.Instructions[l];u instanceof Zt?this.activeClefs[i]=u:u instanceof ye?this.activeKeys[i]=u:u instanceof Re&&(this.activeRhythm[i]=u)}let a=e.getEntriesPerStaff(r);for(let l=0,h=a.length;l<h;++l){let u=a[l];if(u.Instructions)for(let c=0,d=u.Instructions.length;c<d;++c){let f=u.Instructions[c];f instanceof Zt&&(this.activeClefs[i]=f)}}let o=e.LastInstructionsStaffEntries[r];if(o){let l=o.Instructions;for(let h=0,u=l.length;h<u;++h){let c=l[h];c instanceof Zt&&(this.activeClefs[i]=c)}}}}
3checkAndCreateExtraInstructionMeasure(e){let t=e[0].parentSourceMeasure.FirstInstructionsStaffEntries,i=[];for(let r=0,n=e.length;r<n;++r){let a=e[r];i.push(t[a.ParentStaff.idInMusicSheet])}let s=0;for(let r=0,n=i.length;r<n;++r){let a=i[r];if(!a)continue;let o=a.Instructions,l,h;for(let u=0,c=o.length;u<c;++u){let d=o[u];d instanceof ye&&d.Key!==this.activeKeys[r].Key&&(l=d),d instanceof Re&&d!==this.activeRhythm[r]&&(h=d)}if(l!==void 0||h){let u=this.addExtraInstructionMeasure(r,l,h);s=Math.max(s,u)}}s>0&&(this.currentSystemParams.systemMeasures.push({beginLine:ft.None,endLine:ft.None}),this.currentSystemParams.currentWidth+=s,this.currentSystemParams.currentSystemFixWidth+=s)}addExtraInstructionMeasure(e,t,i){let s=this.currentSystemParams.currentSystem,r=[],n=Xt.symbolFactory.createExtraGraphicalMeasure(s.StaffLines[e]);r.push(n),t&&n.addKeyAtBegin(t,this.activeKeys[e],this.activeClefs[e]),i!==void 0&&i.PrintObject&&n.addRhythmAtBegin(i),n.PositionAndShape.BorderLeft=0,n.PositionAndShape.BorderTop=0,n.PositionAndShape.BorderBottom=this.rules.StaffHeight;let a=this.rules.MeasureLeftMargin+n.beginInstructionsWidth+this.rules.MeasureRightMargin;return n.PositionAndShape.BorderRight=a,s.StaffLines[e].Measures.push(n),a}addStaveMeasuresToSystem(e){if(e[0]){let t=[];for(let s=0;s<e.length;s++)t.push(e[s]);let i=this.currentSystemParams.currentSystem;for(let s=0;s<this.numberOfVisibleStaffLines;s++){let r=t[s];i.StaffLines[s].Measures.push(r),r.ParentStaffLine=i.StaffLines[s]}i.AddGraphicalMeasures(t)}}getMeasureStartLine(){if(this.thisMeasureBeginsLineRepetition()){let e=this.measureListIndex===0;if(e&&this.rules.RepetitionAllowFirstMeasureBeginningRepeatBarline)return ft.BoldThinDots;let t=this.currentSystemParams.IsSystemStartMeasure();if(this.previousMeasureEndsLineRepetition()&&!t)return ft.DotsBoldBoldDots;if(!e)return ft.BoldThinDots}return ft.None}getMeasureEndLine(){let e;if(e=this.measureList[this.measureListIndex][0].parentSourceMeasure,this.rules.RenderMultipleRestMeasures&&e.multipleRestMeasures>1){let t=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,e.measureListIndex+e.multipleRestMeasures-1);e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[t]}return this.nextMeasureBeginsLineRepetition()&&this.thisMeasureEndsLineRepetition()?ft.DotsBoldBoldDots:this.thisMeasureEndsLineRepetition()?ft.DotsThinBold:this.nextMeasureHasKeyInstructionChange()?ft.DoubleThin:e?e.endingBarStyleEnum===void 0?ft.SingleThin:e.endingBarStyleEnum:ft.SingleThin}getLineWidth(e,t,i){let s=e.getLineWidth(t);return t===ft.DotsBoldBoldDots&&(s/=2),i&&t===ft.BoldThinDots&&(s+=this.rules.DistanceBetweenLastInstructionAndRepetitionBarline),s}previousMeasureEndsLineRepetition(){if(this.measureListIndex===0)return!1;for(let e=0,t=this.measureList[this.measureListIndex-1].length;e<t;++e)if(this.measureList[this.measureListIndex-1][e].endsWithLineRepetition())return!0;return!1}thisMeasureBeginsLineRepetition(){for(let e=0,t=this.measureList[this.measureListIndex].length;e<t;++e)if(this.measureList[this.measureListIndex][e].beginsWithLineRepetition())return!0;return!1}nextMeasureBeginsLineRepetition(){let e=this.measureListIndex+1;if(e>=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||!this.measureList[e])return!1;for(let t=0,i=this.measureList[e].length;t<i;++t)if(this.measureList[e][t].beginsWithLineRepetition())return!0;return!1}thisMeasureEndsLineRepetition(){for(let e=0,t=this.measureList[this.measureListIndex].length;e<t;++e){let i=this.measureList[this.measureListIndex][e];if(i.endsWithLineRepetition())return!0;if(i.parentSourceMeasure?.isReducedToMultiRest){let s=this.graphicalMusicSheet.ParentMusicSheet,r=i.parentSourceMeasure,n=s.SourceMeasures.indexOf(r),a=r.multipleRestMeasureNumber;for(let o=n+1;o<s.SourceMeasures.length;o++){let l=s.SourceMeasures[o];if(l.multipleRestMeasureNumber>=a)r=l,a=l.multipleRestMeasureNumber;else break}return r.endsWithLineRepetition()}}return!1}nextMeasureBeginsWordRepetition(){let e=this.measureListIndex+1;if(e>=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||e>this.measureList.length-1)return!1;for(let t=0,i=this.measureList[e].length;t<i;++t)if(this.measureList[e][t].beginsWithWordRepetition())return!0;return!1}thisMeasureEndsWordRepetition(){for(let e=0,t=this.measureList[this.measureListIndex].length;e<t;++e)if(this.measureList[this.measureListIndex][e].endsWithWordRepetition())return!0;return!1}nextMeasureHasKeyInstructionChange(){return this.getNextMeasureKeyInstruction()!==void 0}getNextMeasureKeyInstruction(){if(this.measureListIndex<this.measureList.length-1)for(let e=0;e<this.measureList[this.measureListIndex].length;e++){let t=this.measureList[this.measureListIndex+1][e]?.parentSourceMeasure;return t?t.getKeyInstruction(this.visibleStaffIndices[e]):void 0}}calculateXScalingFactor(e,t){return Math.abs(t-0)<1e-5||Math.abs(e-0)<1e-5?1:(this.currentSystemParams.currentSystem.StaffLines[0].PositionAndShape.Size.width-e)/t}stretchMusicSystem(e){let t=this.calculateXScalingFactor(this.currentSystemParams.currentSystemFixWidth,this.currentSystemParams.currentSystemVarWidth);e&&(t=Math.min(t,this.rules.LastSystemMaxScalingFactor));let i=this.currentSystemParams.currentSystem;for(let s=0,r=i.StaffLines.length;s<r;++s){let n=i.StaffLines[s],a=0;for(let o=0;o<n.Measures.length;o++){let l=n.Measures[o];l.setPositionInStaffline(a);let h=l.beginInstructionsWidth;
3if(l.setWidth(h+l.minimumStaffEntriesWidth*t+l.endInstructionsWidth),o<this.currentSystemParams.systemMeasures.length){let u=this.currentSystemParams.systemMeasures[o].beginLine,c=l.getLineWidth(ft.BoldThinDots);if(u===ft.BoldThinDots){let d=a;o===0&&(d=a+l.beginInstructionsWidth-c),i.createVerticalLineForMeasure(d,c,u,wi.MeasureBegin,o,l)}}if(l.staffEntriesScaleFactor=t,l.layoutSymbols(),!(o+1<this.currentSystemParams.systemMeasures.length&&this.currentSystemParams.systemMeasures[o+1].beginLine===ft.BoldThinDots)){let u=ft.SingleThin;o<this.currentSystemParams.systemMeasures.length&&(u=this.currentSystemParams.systemMeasures[o].endLine);let c=l.getLineWidth(u),d=l.PositionAndShape.RelativePosition.x+l.PositionAndShape.BorderRight-c;u===ft.DotsBoldBoldDots&&(d-=c/2),i.createVerticalLineForMeasure(d,c,u,wi.MeasureEnd,o,l)}a=l.PositionAndShape.RelativePosition.x+l.PositionAndShape.BorderRight}}e&&this.decreaseMusicSystemBorders()}decreaseMusicSystemBorders(){let e=this.currentSystemParams.currentSystem,t=Le.last(e.StaffLines[0].Measures).PositionAndShape,i=t.RelativePosition.x+t.Size.width;for(let s=0,r=e.StaffLines.length;s<r;++s){let n=e.StaffLines[s];n.PositionAndShape.BorderRight=i;for(let a=0,o=n.StaffLines.length;a<o;++a){let l=n.StaffLines[a];l.End=new k(i,l.End.y)}}e.PositionAndShape.BorderRight=i+this.currentSystemParams.maxLabelLength+this.rules.SystemLabelsRightMargin}updateStaffLinesRelativePosition(e,t,i){for(let s=t;s<e.StaffLines.length;s++)e.StaffLines[s].PositionAndShape.RelativePosition.y=i;e.PositionAndShape.BorderBottom+=i}createMusicPage(){let e=new sr(this.graphicalMusicSheet);return this.graphicalMusicSheet.MusicPages.push(e),e.PageNumber=this.graphicalMusicSheet.MusicPages.length,e.PositionAndShape.BorderLeft=0,e.PositionAndShape.BorderRight=this.graphicalMusicSheet.ParentMusicSheet.pageWidth,e.PositionAndShape.BorderTop=0,e.PositionAndShape.BorderBottom=this.rules.PageHeight,e.PositionAndShape.RelativePosition=new k(0,0),e}addSystemToPage(e,t){e.MusicSystems.push(t),t.Parent=e}optimizeDistanceBetweenStaffLines(e){if(!e.checkStaffEntriesForStaffEntryLink())for(let s=0;s<e.StaffLines.length-1;s++){let r=e.StaffLines[s].BottomLine,n=e.StaffLines[s+1].SkyLine,a=0;for(let l=0;l<r.length;l++){let h=r[l],u=Math.max(0,l-6),c=Math.min(n.length-1,l+6),d=0;for(let p=u;p<=c;p++)d=Math.min(d,n[p]);let f=h-d;a=Math.max(f,a)}a+=this.rules.MinSkyBottomDistBetweenStaves,a=Math.max(a,this.rules.StaffHeight+this.rules.MinimumStaffLineDistance);let o=a+e.StaffLines[s].PositionAndShape.RelativePosition.y;this.updateStaffLinesRelativePosition(e,s+1,o)}let t=e.StaffLines[0];e.PositionAndShape.BorderTop=t.PositionAndShape.RelativePosition.y+t.PositionAndShape.BorderTop;let i=e.StaffLines[e.StaffLines.length-1];e.PositionAndShape.BorderBottom=i.PositionAndShape.RelativePosition.y+i.PositionAndShape.BorderBottom}calculateMusicSystemsRelativePositions(){let e=this.createMusicPage(),t=0,i=this.musicSystems[0],s=0;for(let r=0;r<this.musicSystems.length;r++)if(i=this.musicSystems[r],e.MusicSystems.length===0){this.addSystemToPage(e,i),t=this.rules.CompactMode?this.rules.PageTopMarginNarrow:this.rules.PageTopMargin,this.graphicalMusicSheet.MusicPages.length===1&&this.rules.RenderTitle&&(t+=this.rules.TitleTopDistance+this.rules.SheetTitleHeight+this.rules.TitleBottomDistance);let n=new k(this.rules.PageLeftMargin+this.rules.SystemLeftMargin,t);i.PositionAndShape.RelativePosition=n,t+i.PositionAndShape.BorderBottom>this.rules.PageHeight-this.rules.PageBottomMargin&&(s++,s<=4&&console.log(`warning: could not fit a single system on page ${e.PageNumber} and measure number ${i.GraphicalMeasures[0][0].MeasureNumber}.
4                            The PageFormat may be too small for this sheet."
5                            Will not give further warnings for all pages, only total.`))}else{let n=this.musicSystems[r-1],a=n.StaffLines[n.StaffLines.length-1],o=a.PositionAndShape,l=this.findRequiredDistanceWithSkyBottomLine(n,i);l+=this.rules.MinSkyBottomDistBetweenSystems,l=Math.max(l,this.rules.MinimumDistanceBetweenSystems+a.StaffHeight);let h=t+o.RelativePosition.y+l,u=h+i.PositionAndShape.BorderMarginBottom;if(!(this.rules.NewPageAtXMLNewPageAttribute&&n.breaksPage)&&u<this.rules.PageHeight-this.rules.PageBottomMargin){this.addSystemToPage(e,i),t=h;let c=new k(this.rules.PageLeftMargin+this.rules.SystemLeftMargin,t);i.PositionAndShape.RelativePosition=c}else{e=this.createMusicPage(),--r;continue}}s>0&&console.log(`total amount of pages that couldn't fit a single music system: ${s} of ${e.PageNumber}`)}findRequiredDistanceWithSkyBottomLine(e,t){let i=e.StaffLines[e.StaffLines.length-1],s=t.StaffLines[0],r=i.BottomLine,n=s.SkyLine,a=i.PositionAndShape,o=s.PositionAndShape,l=1/this.rules.SamplingUnit,h=0;for(let u=0;u<r.length;u++){let c=r[u],d=u+Math.round((a.RelativePosition.x-o.RelativePosition.x)*l);
5if(d<0)continue;if(d>=n.length)break;let f=Math.max(0,d-6),p=Math.min(n.length-1,d+6),m=0;for(let b=f;b<=p;b++)m=Math.min(m,n[b]);let g=c-m;h=Math.max(g,h)}return h===0&&(h=a.BorderBottom-o.BorderTop),h}},zs=class{constructor(){this.systemMeasures=[],this.systemMeasureIndex=0,this.currentWidth=0,this.currentSystemFixWidth=0,this.currentSystemVarWidth=0,this.maxLabelLength=0}IsSystemStartMeasure(){return this.systemMeasureIndex===0}},Mh=class{},be=class{constructor(e,t){this.voiceEntries=[],this.instructions=[],this.chordSymbolContainers=[],this.verticalContainerParent=e,this.parentStaff=t}get ParentStaff(){return this.parentStaff}get VerticalContainerParent(){return this.verticalContainerParent}get Timestamp(){if(this.VerticalContainerParent)return this.VerticalContainerParent.Timestamp}get AbsoluteTimestamp(){if(this.VerticalContainerParent)return N.plus(this.VerticalContainerParent.ParentMeasure.AbsoluteTimestamp,this.VerticalContainerParent.Timestamp)}get VoiceEntries(){return this.voiceEntries}set VoiceEntries(e){this.voiceEntries=e}get Link(){return this.staffEntryLink}set Link(e){this.staffEntryLink=e}get Instructions(){return this.instructions}set Instructions(e){this.instructions=e}get ChordContainers(){return this.chordSymbolContainers}set ChordContainers(e){this.chordSymbolContainers=e}removeAllInstructionsOfTypeClefInstruction(){let e=0,t=0;for(;e<this.instructions.length;)this.instructions[e]instanceof Zt?(this.instructions.splice(e,1),t++):e++;return t}removeFirstInstructionOfTypeClefInstruction(){for(let e=0;e<this.instructions.length;e++)if(this.instructions[e]instanceof Zt)return this.instructions.splice(e,1),!0;return!1}removeAllInstructionsOfTypeKeyInstruction(){let e=0,t=0;for(;e<this.instructions.length;)this.instructions[e]instanceof ye?(this.instructions.splice(e,1),t++):e++;return t}removeFirstInstructionOfTypeKeyInstruction(){for(let e=0;e<this.instructions.length;e++)if(this.instructions[e]instanceof ye)return this.instructions.splice(e,1),!0;return!1}removeAllInstructionsOfTypeRhythmInstruction(){let e=0,t=0;for(;e<this.instructions.length;)this.instructions[e]instanceof Re?(this.instructions.splice(e,1),t++):e++;return t}removeFirstInstructionOfTypeRhythmInstruction(){for(let e=0;e<this.instructions.length;e++)if(this.instructions[e]instanceof Re)return this.instructions.splice(e,1),!0;return!1}calculateMinNoteLength(){let e=new N(Number.MAX_VALUE,1);for(let t=0,i=this.VoiceEntries.length;t<i;++t){let s=this.VoiceEntries[t];for(let r=0,n=s.Notes.length;r<n;++r){let a=s.Notes[r];a.Length.lt(e)&&(e=a.Length)}}return e}calculateMaxNoteLength(e=!0){let t=new N(0,1);for(let i=0,s=this.VoiceEntries.length;i<s;++i){let r=this.VoiceEntries[i];for(let n=0,a=r.Notes.length;n<a;++n){let o=r.Notes[n];if(e&&o.NoteTie){let l=N.createFromFraction(o.Length),h=!1;for(let u of o.NoteTie.Notes){if(u===o){h=!0;continue}h&&l.Add(u.Length)}t.lt(l)&&(t=l)}else t.lt(o.Length)&&(t=o.Length)}}return t}hasNotes(){for(let e=0,t=this.VoiceEntries.length;e<t;++e)if(this.VoiceEntries[e].Notes.length>0)return!0;return!1}hasTie(){for(let e=0,t=this.VoiceEntries.length;e<t;++e)if(this.VoiceEntries[e].hasTie())return!0;return!1}findLinkedNotes(e){for(let t=0,i=this.voiceEntries.length;t<i;++t){let s=this.voiceEntries[t];for(let r=0,n=s.Notes.length;r<n;++r){let a=s.Notes[r];a.ParentStaffEntry===this&&e.push(a)}}}get hasOnlyRests(){for(let e of this.voiceEntries)for(let t of e.Notes)if(!t.isRest())return!1;return!0}},go=class extends ue{},pe=class extends go{constructor(e,t,i,s,r=void 0){super(),this.CenteringXShift=0,this.label=e,this.boundingBox=new Yt(this,r),this.label.fontHeight=t,this.label.textAlignment=i,this.rules=s}get Label(){return this.label}toString(){return`${this.label.text} (${this.boundingBox.RelativePosition.x},${this.boundingBox.RelativePosition.y})`}setLabelPositionAndShapeBorders(){if(this.Label.text.trim()==="")return;this.TextLines=[];let e=this.rules?.LabelMarginBorderFactor??.1,t=this.Label.text.split(/[\n\r]+/g),i=t.length,s=0;for(let a=0;a<i;a++){let o=t[a].trim(),l=Xt.TextMeasurer.computeTextWidthToHeightRatio(o,this.Label.font,this.Label.fontStyle,this.label.fontFamily),h=this.Label.fontHeight*l;s=Math.max(s,h),this.TextLines.push({text:o,xOffset:0,width:h})}for(let a of this.TextLines){let o=0;switch(this.Label.textAlignment){case mt.RightBottom:case mt.RightCenter:case mt.RightTop:o=s-a.width;break;case mt.CenterBottom:case mt.CenterCenter:case mt.CenterTop:o=(s-a.width)/2;break;default:break}a.xOffset=o}let r=this.Label.fontHeight*i;this.rules.SpacingBetweenTextLines>0&&this.TextLines.length>1&&(r+=this.rules.SpacingBetweenTextLines*i/10);let n=this.PositionAndShape;switch(this.Label.textAlignment){case mt.CenterBottom:n.BorderTop=-r,n.BorderLeft=-s/2,n.BorderBottom=0,n.BorderRight=s/2;break;case mt.CenterCenter:n.BorderTop=-r/2,n.BorderLeft=-s/2,n.BorderBottom=r/2,n.BorderRight=s/2;break;case mt.CenterTop:n.BorderTop=0,n.BorderLeft=-s/2,n.BorderBottom=r,n.BorderRight=s/2;break;case mt.LeftBottom:n.BorderTop=-r,n.BorderLeft=0,n.BorderBottom=0,n.BorderRight=s;break;case mt.LeftCenter:n.BorderTop=-r/2,n.BorderLeft=0,n.BorderBottom=r/2,n.BorderRight=s;break;case mt.LeftTop:n.BorderTop=0,n.BorderLeft=0,n.BorderBottom=r,n.BorderRight=s;break;case mt.RightBottom:n.BorderTop=-r,n.BorderLeft=-s,n.BorderBottom=0,n.BorderRight=0;break;case mt.RightCenter:n.BorderTop=-r/2,n.BorderLeft=-s,n.BorderBottom=r/2,n.BorderRight=0;break;case mt.RightTop:n.BorderTop=0,n.BorderLeft=-s,n.BorderBottom=r,n.BorderRight=0;break;default:}n.BorderMarginTop=n.BorderTop-r*e,n.BorderMarginLeft=n.BorderLeft-r*e,n.BorderMarginBottom=n.BorderBottom+r*e,n.BorderMarginRight=n.BorderRight+r*e}},xs=(function(e){return e[e.Fingering=0]="Fingering",e[e.String=1]="String",e})({}),bo=class{},Rs=class{constructor(e,t){this.voiceEntries=[],this.volume=1,this.parent=e,this.visible=!0,this.audible=!0,this.following=!0,this.voiceId=t}get VoiceEntries(){return this.voiceEntries}get Parent(){return this.parent}get Visible(){return this.visible}set Visible(e){this.visible=e}get Audible(){return this.audible}set Audible(e){this.audible=e}get Following(){return this.following}set Following(e){this.following=e}get VoiceId(){return this.voiceId}get Volume(){return this.volume}set Volume(e){this.volume=e}},ki=class extends Rs{constructor(e,t,i){super(e,t),this.master=i}get Master(){return this.master}},So=class{constructor(e,t,i){this.getOpenOctaveShift=e,this.getAbsoluteStartTimestamp=t,this.getAbsoluteEndTimestamp=i}},yo=class{constructor(){this.keySignatureNoteAlterationsDict=new We.Dictionary,this.currentAlterationsComparedToKeyInstructionList=[],this.currentInMeasureNoteAlterationsDict=new We.Dictionary}get ActiveKeyInstruction(){return this.activeKeyInstruction}set ActiveKeyInstruction(e){this.activeKeyInstruction=e,this.reactOnKeyInstructionChange()}doCalculationsAtEndOfMeasure(){this.currentInMeasureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.clear();for(let e of this.keySignatureNoteAlterationsDict.keys())this.currentInMeasureNoteAlterationsDict.setValue(e,this.keySignatureNoteAlterationsDict.getValue(e))}checkAccidental(e,t){if(!t)return;let i=t.FundamentalNote+t.Octave*12,s=e.sourceNote.NoteTie;if(s&&e.sourceNote!==s.StartNote)return;let r=this.currentAlterationsComparedToKeyInstructionList.indexOf(i)>=0;if(this.currentInMeasureNoteAlterationsDict.containsKey(i))if(r&&this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(i),1),this.currentInMeasureNoteAlterationsDict.getValue(i)!==t.AccidentalHalfTones){this.keySignatureNoteAlterationsDict.containsKey(i)&&this.keySignatureNoteAlterationsDict.getValue(i)!==t.AccidentalHalfTones?(this.currentAlterationsComparedToKeyInstructionList.push(i),this.currentInMeasureNoteAlterationsDict.setValue(i,t.AccidentalHalfTones)):t.Accidental===q.NONE?this.currentInMeasureNoteAlterationsDict.setValue(i,t.AccidentalHalfTones):this.keySignatureNoteAlterationsDict.containsKey(i)?this.currentInMeasureNoteAlterationsDict.setValue(i,this.keySignatureNoteAlterationsDict.getValue(i)):this.currentInMeasureNoteAlterationsDict.remove(i);let n=this.currentInMeasureNoteAlterationsDict.getValue(i);if(t.Accidental===q.NONE&&(t=Math.abs(n)===.5?new Ct(t.FundamentalNote,t.Octave,q.NONE,void 0,!1,t.OctaveShiftApplied):new Ct(t.FundamentalNote,t.Octave,q.NATURAL,void 0,!1,t.OctaveShiftApplied)),this.isAlterAmbiguousAccidental(t.Accidental)&&!t.AccidentalXml)return;
5Xt.symbolFactory.addGraphicalAccidental(e,t)}else t.AccidentalXml&&this.Transpose===0&&!r&&Xt.symbolFactory.addGraphicalAccidental(e,t);else if(t.Accidental!==q.NONE){if(r||this.currentAlterationsComparedToKeyInstructionList.push(i),this.currentInMeasureNoteAlterationsDict.setValue(i,t.AccidentalHalfTones),this.isAlterAmbiguousAccidental(t.Accidental)&&!t.AccidentalXml)return;Xt.symbolFactory.addGraphicalAccidental(e,t)}else r&&(t=new Ct(t.FundamentalNote,t.Octave,q.NATURAL,void 0,!1,t.OctaveShiftApplied),this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(i),1),Xt.symbolFactory.addGraphicalAccidental(e,t))}isAlterAmbiguousAccidental(e){return e===q.SLASHFLAT||e===q.QUARTERTONEFLAT}reactOnKeyInstructionChange(){let e=this.activeKeyInstruction.AlteratedNotes,t;t=this.activeKeyInstruction.Key>0?q.SHARP:q.FLAT,this.keySignatureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.length=0;for(let i=-9;i<9;i++)for(let s=0;s<e.length;s++)this.keySignatureNoteAlterationsDict.setValue(e[s]+i*12,Ct.HalfTonesFromAccidental(t));this.doCalculationsAtEndOfMeasure()}},xo=class Eo{constructor(t,i,s=void 0){this.sourceNote=t,this.setShapeFromXml(i,s)}setShapeFromXml(t,i=void 0){this.shape=Eo.ShapeTypeXmlToShape(t);let s=i;s===void 0&&(this.sourceNote?s=this.sourceNote.Length.Denominator>2:(W.default.warn("notehead: sourceNote and filledXmlAttribute undefined."),s=!0)),this.filled=s}get SourceNote(){return this.sourceNote}get Shape(){return this.shape}get Filled(){return this.filled}static ShapeTypeXmlToShape(t){switch(t.toLowerCase()){case"normal":return Vt.NORMAL;case"none":return Vt.NONE;case"x":return Vt.X;case"slash":return Vt.SLASH;case"diamond":return Vt.DIAMOND;case"square":return Vt.SQUARE;case"la":return Vt.SQUARE;case"do":case"triangle":return Vt.TRIANGLE;case"inverted triangle":return Vt.TRIANGLE_INVERTED;case"rectangle":return Vt.RECTANGLE;case"circle-x":return Vt.CIRCLEX;default:return W.default.info("unsupported/unhandled xml notehead '"+t+"'. Using normal notehead."),Vt.NORMAL}}},Vt=(function(e){return e[e.CIRCLEX=0]="CIRCLEX",e[e.DIAMOND=1]="DIAMOND",e[e.NORMAL=2]="NORMAL",e[e.NONE=3]="NONE",e[e.RECTANGLE=4]="RECTANGLE",e[e.SLASH=5]="SLASH",e[e.SQUARE=6]="SQUARE",e[e.TRIANGLE=7]="TRIANGLE",e[e.TRIANGLE_INVERTED=8]="TRIANGLE_INVERTED",e[e.X=9]="X",e})({}),Nt=class{constructor(e="",t=mt.CenterBottom,i=void 0,s=!0){this.IsCreditLabel=!1,this.text=e,this.print=s,this.textAlignment=t,this.font=i,this.fontFamily=void 0}ToString(){return this.text}},bs=class{constructor(e,t,i){this.staffEntries=[],this.comments=[],this.timestamp=t,this.staffEntries=Array(i),this.parentMeasure=e}$get$(e){return this.staffEntries[e]}$set$(e,t){this.staffEntries[e]=t}get Timestamp(){return this.timestamp}set Timestamp(e){this.timestamp=e}get StaffEntries(){return this.staffEntries}set StaffEntries(e){this.staffEntries=e}get Comments(){return this.comments}set Comments(e){this.comments=e}get ParentMeasure(){return this.parentMeasure}set ParentMeasure(e){this.parentMeasure=e}getAbsoluteTimestamp(){return N.plus(this.timestamp,this.parentMeasure.AbsoluteTimestamp)}},Cs=class extends ue{constructor(e,t,i){super(),this.expression=t,this.parentMeasure=i,this.boundingBox=new Yt(this,e.PositionAndShape),this.parentStaffLine=e,this.parentStaffLine.AbstractExpressions.push(this),this.rules=e.ParentMusicSystem.rules}get Label(){return this.label}get ParentStaffLine(){return this.parentStaffLine}get SourceExpression(){return this.expression}get Placement(){return this.expression.Placement}},Yi=class extends Cs{constructor(e,t){super(t.PositionAndShape.Parent.DataObject,e,e.parentMeasure),this.label=t}get GraphicalLabel(){return this.label}updateSkyBottomLine(){}},vo=class Mo extends Pi{constructor(t,i,s,r){super(i),this.label=t,this.staffNumber=s,this.parentMultiTempoExpression=r}get Label(){return this.label}set Label(t){this.label=t}get Placement(){return this.placement}set Placement(t){this.placement=t}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t}get ParentMultiTempoExpression(){return this.parentMultiTempoExpression}
5static isStringInStringList(t,i){for(let s of t)if(Mo.stringContainsSeparatedWord(i.toLowerCase().trim(),s.toLowerCase().trim()))return!0;return!1}static stringContainsSeparatedWord(t,i){return t===i||t.indexOf(" "+i)!==-1||t.indexOf(i+" ")!==-1}},ae,Fe=class tt extends vo{constructor(t,i,s,r,n,a=!1){super(t,i,s,n),this.parentMeasure=n.SourceMeasureParent,this.isMetronomeMark=a,this.setTempoAndTempoType(r)}static getDefaultValueForInstTempo(t){switch(t){case bt.larghissimo:return 20;case bt.grave:return 30;case bt.lento:return 48;case bt.largo:return 52;case bt.larghetto:return 63;case bt.adagio:return 70;case bt.adagietto:return 75;case bt.andanteModerato:return 88;case bt.andante:return 92;case bt.andantino:return 96;case bt.moderato:return 106;case bt.allegretto:return 112;case bt.allegroModerato:return 118;case bt.allegro:return 130;case bt.vivace:return 140;case bt.vivacissimo:return 155;case bt.allegrissimo:return 170;case bt.presto:return 184;case bt.prestissimo:return 200;default:return 60}}static isInputStringInstantaneousTempo(t){return t?tt.isStringInStringList(tt.listInstantaneousTempoLarghissimo,t)||tt.isStringInStringList(tt.listInstantaneousTempoGrave,t)||tt.isStringInStringList(tt.listInstantaneousTempoLento,t)||tt.isStringInStringList(tt.listInstantaneousTempoLargo,t)||tt.isStringInStringList(tt.listInstantaneousTempoLarghetto,t)||tt.isStringInStringList(tt.listInstantaneousTempoAdagio,t)||tt.isStringInStringList(tt.listInstantaneousTempoAdagietto,t)||tt.isStringInStringList(tt.listInstantaneousTempoAndanteModerato,t)||tt.isStringInStringList(tt.listInstantaneousTempoAndante,t)||tt.isStringInStringList(tt.listInstantaneousTempoAndantino,t)||tt.isStringInStringList(tt.listInstantaneousTempoModerato,t)||tt.isStringInStringList(tt.listInstantaneousTempoAllegretto,t)||tt.isStringInStringList(tt.listInstantaneousTempoAllegroModerato,t)||tt.isStringInStringList(tt.listInstantaneousTempoAllegro,t)||tt.isStringInStringList(tt.listInstantaneousTempoVivace,t)||tt.isStringInStringList(tt.listInstantaneousTempoVivacissimo,t)||tt.isStringInStringList(tt.listInstantaneousTempoAllegrissimo,t)||tt.isStringInStringList(tt.listInstantaneousTempoPresto,t)||tt.isStringInStringList(tt.listInstantaneousTempoPrestissimo,t)||tt.isStringInStringList(tt.listInstantaneousTempoChangesGeneral,t):!1}get Label(){return this.label}set Label(t){this.label=t}get Placement(){return this.placement}set Placement(t){this.placement=t}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t}get TempoInBpm(){return this.tempoInBpm}set TempoInBpm(t){this.tempoInBpm=t}get ParentMultiTempoExpression(){return this.parentMultiTempoExpression}getAbsoluteTimestamp(){return N.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp)}getAbsoluteFloatTimestamp(){return N.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp).RealValue}setTempoAndTempoType(t){if(!this.label){this.tempoInBpm=t,this.TempoType=Wt.metronomeMark;return}tt.isStringInStringList(tt.listInstantaneousTempoLarghissimo,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.larghissimo)),this.tempoInBpm=t,this.InstTempo=bt.larghissimo,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoGrave,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.grave)),this.tempoInBpm=t,this.InstTempo=bt.grave,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoLento,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.lento)),this.tempoInBpm=t,this.InstTempo=bt.lento,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoLargo,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.largo)),this.tempoInBpm=t,this.InstTempo=bt.largo,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoLarghetto,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.larghetto)),this.tempoInBpm=t,this.InstTempo=bt.larghetto,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoAdagio,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.adagio)),this.tempoInBpm=t,this.InstTempo=bt.adagio,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoAdagietto,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.adagietto)),this.tempoInBpm=t,this.InstTempo=bt.adagietto,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoAndanteModerato,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.andanteModerato)),this.tempoInBpm=t,this.InstTempo=bt.andanteModerato,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoAndante,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.andante)),this.tempoInBpm=t,this.InstTempo=bt.andante,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoAndantino,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.andantino)),this.tempoInBpm=t,this.InstTempo=bt.andantino,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoModerato,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.moderato)),this.tempoInBpm=t,this.InstTempo=bt.moderato,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoAllegretto,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.allegretto)),this.tempoInBpm=t,this.InstTempo=bt.allegretto,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoAllegroModerato,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.allegroModerato)),this.tempoInBpm=t,this.InstTempo=bt.allegroModerato,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoAllegro,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.allegro)),this.tempoInBpm=t,this.InstTempo=bt.allegro,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoVivace,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.vivace)),this.tempoInBpm=t,this.InstTempo=bt.vivace,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoVivacissimo,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.vivacissimo)),this.tempoInBpm=t,this.InstTempo=bt.vivacissimo,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoAllegrissimo,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.allegrissimo)),this.tempoInBpm=t,this.InstTempo=bt.allegrissimo,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoPresto,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.presto)),this.tempoInBpm=t,this.InstTempo=bt.presto,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoPrestissimo,this.label)?(t===0&&(t=tt.getDefaultValueForInstTempo(bt.prestissimo)),this.tempoInBpm=t,this.InstTempo=bt.prestissimo,this.TempoType=Wt.inst):tt.isStringInStringList(tt.listInstantaneousTempoAddons,this.label)?(this.tempoInBpm=0,this.TempoType=Wt.addon):tt.isStringInStringList(tt.listInstantaneousTempoChangesGeneral,this.label)&&(this.tempoInBpm=0,this.TempoType=Wt.change)}};ae=Fe,ae.listInstantaneousTempoLarghissimo=["Larghissimo","Sehr breit","very, very slow"],ae.listInstantaneousTempoGrave=["Grave","Schwer","slow and solemn"],ae.listInstantaneousTempoLento=["Lento","Lent","Langsam","slowly"],ae.listInstantaneousTempoLargo=["Largo","Breit","broadly"],ae.listInstantaneousTempoLarghetto=["Larghetto","Etwas breit","rather broadly"],ae.listInstantaneousTempoAdagio=["Adagio","Langsam","Ruhig","slow and stately"],ae.listInstantaneousTempoAdagietto=["Adagietto","Ziemlich ruhig","Ziemlich langsam","rather slow"],ae.listInstantaneousTempoAndanteModerato=["Andante moderato"],ae.listInstantaneousTempoAndante=["Andante","Gehend","Schreitend","at a walking pace"],ae.listInstantaneousTempoAndantino=["Andantino","Maestoso"],ae.listInstantaneousTempoModerato=["Moderato","Mäßig","Modéré","moderately"],ae.listInstantaneousTempoAllegretto=["Allegretto","Animato","fast"],ae.listInstantaneousTempoAllegroModerato=["Allegro moderato"],ae.listInstantaneousTempoAllegro=["Allegro","Rapide","Vite","Rasch","Schnell","Fröhlich"],ae.listInstantaneousTempoVivace=["Vivace","Allegro Assai","Lebhaft","Lebendig","lively and fast"],ae.listInstantaneousTempoVivacissimo=["Vivacissimo","Sehr lebhaft","Sehr lebendig"],ae.listInstantaneousTempoAllegrissimo=["Allegrissimo","very fast"],ae.listInstantaneousTempoPresto=["Presto","Sehr schnell","Geschwind"],ae.listInstantaneousTempoPrestissimo=["Prestissimo","äußerst schnell"],ae.listInstantaneousTempoChangesGeneral=["tempo primo","a tempo","tempo i","rubato","doppio movimento","rallentando","ritardando","ritard.","rit.","ritard","rall...","accelerando","accel"],ae.listInstantaneousTempoAddons="assai.amoroso.cantabile.con brio.con dolore.con espressione.con fuoco.con moto.con spirito.spiritoso.espressivo.giocoso.giusto.grazioso.lesto.lugubre.maestoso.ma non troppo.marcato.molto.morend
5o.mosso.non tanto.piu.un poco.poco.quasi.risoluto.scherzando.sostenuto.teneramente.tempo giusto.tranquillo.sehr.lieblich.liebevoll.mit Leidenschaft.mit Liebe.amourös.gesanglich.mit Schwung.mit Feuer.mit Schmerz.mit Ausdruck.mit Bewegung.geistvoll.ausdrucksvoll.freudig.verspielt.angemessen.graziös.mit Grazie.flink.behände.traurig.klagend.majestätisch.aber nicht zu sehr.markant.gemäßigt.viel.sehr.ersterbend.bewegt.nicht zu sehr.mehr.ein wenig.gleichsam.entschlossen.zupackend.heiter.nachdrücklich.getragen.gewichtig.zart.zärtlich.im angemessenen Zeitmaß.ruhig.ein wenig.alla marcia.ad libitum.alla breve".split(".");var Wt=(function(e){return e[e.none=0]="none",e[e.metronomeMark=1+e.none]="metronomeMark",e[e.inst=1+e.metronomeMark]="inst",e[e.change=1+e.inst]="change",e[e.addon=1+e.change]="addon",e})({}),bt=(function(e){return e[e.larghissimo=0]="larghissimo",e[e.grave=1]="grave",e[e.lento=2]="lento",e[e.largo=3]="largo",e[e.larghetto=4]="larghetto",e[e.adagio=5]="adagio",e[e.adagietto=6]="adagietto",e[e.andanteModerato=7]="andanteModerato",e[e.andante=8]="andante",e[e.andantino=9]="andantino",e[e.moderato=10]="moderato",e[e.allegretto=11]="allegretto",e[e.allegroModerato=12]="allegroModerato",e[e.allegro=13]="allegro",e[e.vivace=14]="vivace",e[e.vivacissimo=15]="vivacissimo",e[e.allegrissimo=16]="allegrissimo",e[e.presto=17]="presto",e[e.prestissimo=18]="prestissimo",e[e.lastRealTempo=19]="lastRealTempo",e})({}),ji=(function(e){return e[e.none=0]="none",e[e.atempo=1+e.none]="atempo",e[e.doppioMovimento=1+e.atempo]="doppioMovimento",e[e.tempoprimo=1+e.doppioMovimento]="tempoprimo",e})({}),Nr,Fi=class li extends vo{constructor(t,i,s,r){super(t,i,s,r),this.setTempoType()}static isInputStringContinuousTempo(t){return t?(t.endsWith(".")&&(t=t.substring(0,t.length-1)),li.isStringInStringList(li.listContinuousTempoFaster,t)||li.isStringInStringList(li.listContinuousTempoSlower,t)):!1}static isIncreasingTempo(t){return t<=ns.piuMosso}static isDecreasingTempo(t){return t>=ns.allargando&&t<=ns.ritenuto}get TempoType(){return this.tempoType}set TempoType(t){this.tempoType=t}get StartTempo(){return this.startTempo}set StartTempo(t){this.startTempo=t}get EndTempo(){return this.endTempo}set EndTempo(t){this.endTempo=t}get AbsoluteStartTimestamp(){return N.plus(this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.parentMultiTempoExpression.Timestamp)}get AbsoluteEndTimestamp(){return this.absoluteEndTimestamp}set AbsoluteEndTimestamp(t){this.absoluteEndTimestamp=t,this.AbsoluteTimeSpan=N.minus(this.AbsoluteEndTimestamp,this.AbsoluteStartTimestamp).RealValue}get AbsoluteTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp}getAbsoluteFloatTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp.RealValue}getInterpolatedTempo(t){let i=N.plus(this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.parentMultiTempoExpression.Timestamp);if(t.lt(i))return-1;if(this.absoluteEndTimestamp.lt(t))return-2;let s=N.minus(t,i).RealValue/N.minus(this.absoluteEndTimestamp,i).RealValue;return Math.max(0,Math.min(250,this.startTempo+(this.endTempo-this.startTempo)*s))}setTempoType(){li.isStringInStringList(li.listContinuousTempoFaster,this.label)?this.tempoType=ns.accelerando:li.isStringInStringList(li.listContinuousTempoSlower,this.label)&&(this.tempoType=ns.ritardando)}getTempoFactor(t=this.Label){return 1}};Nr=Fi,Nr.listContinuousTempoFaster=["accelerando","accel","piu mosso","poco piu","stretto"],Nr.listContinuousTempoSlower=["poco meno","meno mosso","piu lento","calando","allargando","rallentando","ritardando","ritenuto","ritard.","ritard","rit.","rit","riten.","riten"];var ns=(function(e){return e[e.accelerando=0]="accelerando",e[e.stretto=1]="stretto",e[e.stringendo=2]="stringendo",e[e.mosso=3]="mosso",e[e.piuMosso=4]="piuMosso",e[e.allargando=5]="allargando",e[e.calando=6]="calando",e[e.menoMosso=7]="menoMosso",e[e.rallentando=8]="rallentando",e[e.ritardando=9]="ritardando",e[e.ritard=10]="ritard",e[e.rit=11]="rit",e[e.ritenuto=12]="ritenuto",e[e.rubato=13]="rubato",e[e.precipitando=14]="precipitando",e})({}),Ir,Ue=class hi extends Pi{constructor(t,i,s,r,n,a=""){super(i),this.parentMeasure=r,this.NumberXml=n,this.dynamicType=t,this.label=a,this.staffNumber=s,this.startVolume=-1,this.endVolume=-1,a!==""&&this.setType()}get DynamicType(){return this.dynamicType}set DynamicType(t){this.dynamicType=t}get StartMultiExpression(){return this.startMultiExpression}set StartMultiExpression(t){this.startMultiExpression=t}get EndMultiExpression(){return this.endMultiExpression}set EndMultiExpression(t){this.endMultiExpression=t}get Placement(){return this.placement}set Placement(t){this.placement=t}get StartVolume(){return this.startVolume}set StartVolume(t){this.startVolume=t}get EndVolume(){return this.endVolume}set EndVolume(t){this.endVolume=t}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t}get Label(){return this.label}set Label(t){this.label=t,this.setType()}static isInputStringContinuousDynamic(t){return t?hi.isStringInStringList(hi.listContinuousDynamicIncreasing,t)||hi.isStringInStringList(hi.listContinuousDynamicDecreasing,t):!1}getInterpolatedDynamic(t){let i=this.StartMultiExpression.AbsoluteTimestamp,s;if(s=this.EndMultiExpression?this.EndMultiExpression.AbsoluteTimestamp:N.plus(this.startMultiExpression.SourceMeasureParent.AbsoluteTimestamp,this.startMultiExpression.SourceMeasureParent.Duration),t.lt(i))return-1;if(s.lt(t))return-2;let r=N.minus(t,i).RealValue/N.minus(s,i).RealValue;return Math.max(0,Math.min(99.9,this.startVolume+(this.endVolume-this.startVolume)*r))}isWedge(){return!this.label}setType(){hi.isStringInStringList(hi.listContinuousDynamicIncreasing,this.label)?this.dynamicType=ne.crescendo:hi.isStringInStringList(hi.listContinuousDynamicDecreasing,this.label)&&(this.dynamicType=ne.diminuendo)}};Ir=Ue,Ir.listContinuousDynamicIncreasing=["crescendo","cresc","cresc.","cres."],Ir.listContinuousDynamicDecreasing=["decrescendo","decresc","decr.","diminuendo","dim.","dim"];
5var ne=(function(e){return e[e.crescendo=0]="crescendo",e[e.diminuendo=1]="diminuendo",e})({}),Es=class extends Cs{constructor(e,t,i){super(t,e,i),this.lines=[],this.isSplittedPart=!1,this.notToBeRemoved=!1}get StartMeasure(){return this.startMeasure}set StartMeasure(e){this.startMeasure=e}get EndMeasure(){return this.endMeasure}set EndMeasure(e){this.endMeasure=e}get EndStaffLine(){return this.endMeasure?this.endMeasure.ParentStaffLine:void 0}get IsSplittedPart(){return this.isSplittedPart}set IsSplittedPart(e){this.isSplittedPart=e}get IsVerbal(){return this.ContinuousDynamic.Label&&this.ContinuousDynamic.Label.length>0}get NotToBeRemoved(){return this.notToBeRemoved}set NotToBeRemoved(e){this.notToBeRemoved=e}get Lines(){return this.lines}get ContinuousDynamic(){return this.SourceExpression}updateSkyBottomLine(){let e=this.parentStaffLine.SkyBottomLineCalculator,t=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft:0,i=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight:0;switch(!this.IsSoftAccent&&!this.IsVerbal&&this.lines.length<2&&W.default.warn("Not enough lines for SkyBottomLine calculation"),this.IsVerbal||this.ContinuousDynamic.DynamicType!==ne.crescendo&&this.ContinuousDynamic.DynamicType!==ne.diminuendo&&W.default.warn("GraphicalContinuousDynamicExpression.updateSkyBottomLine(): unhandled continuous dynamic type. start measure: "+this.startMeasure?.MeasureNumber),this.Placement){case C.Above:if(this.IsSoftAccent)e.updateSkyLineWithWedge(this.lines[0].Start,this.lines[0].End),e.updateSkyLineWithWedge(this.lines[2].End,this.lines[2].Start),e.updateSkyLineWithLine(this.lines[0].End,this.lines[2].End,this.lines[0].End.y);else if(!this.IsVerbal)this.ContinuousDynamic.DynamicType===ne.crescendo?e.updateSkyLineWithWedge(this.lines[0].Start,this.lines[0].End):this.ContinuousDynamic.DynamicType===ne.diminuendo&&e.updateSkyLineWithWedge(this.lines[0].End,this.lines[0].Start);else{let s=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;e.updateSkyLineInRange(t,i,s)}break;case C.Below:if(!this.IsVerbal)this.ContinuousDynamic.DynamicType===ne.crescendo?e.updateBottomLineWithWedge(this.lines[1].Start,this.lines[1].End):this.ContinuousDynamic.DynamicType===ne.diminuendo&&e.updateBottomLineWithWedge(this.lines[1].End,this.lines[1].Start);else{let s=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;e.updateBottomLineInRange(t,i,s)}break;default:W.default.error("Placement for GraphicalContinuousDynamicExpression is unknown")}}createCrescendoLines(e,t,i,s=this.rules.WedgeOpeningLength,r=this.rules.WedgeLineWidth){let n=new k(e,i),a=new k(t,i-s/2),o=new k(t,i+s/2);this.addWedgeLines(n,a,o,r)}createFirstHalfCrescendoLines(e,t,i,s=this.rules.WedgeMeasureEndOpeningLength,r=this.rules.WedgeLineWidth){let n=new k(e,i),a=new k(t,i-s/2),o=new k(t,i+s/2);this.addWedgeLines(n,a,o,r)}createSecondHalfCrescendoLines(e,t,i,s=this.rules.WedgeMeasureBeginOpeningLength,r=this.rules.WedgeOpeningLength,n=this.rules.WedgeLineWidth){let a=new k(e,i-s/2),o=new k(e,i+s/2),l=new k(t,i-r/2),h=new k(t,i+r/2);this.addDoubleLines(a,l,o,h,n)}recalculateCrescendoLines(e,t,i){let s=Math.abs(this.lines[0].Start.y-this.lines[1].Start.y)>1e-4;this.lines.clear(),s?this.createSecondHalfCrescendoLines(e,t,i):this.isSplittedPart?this.createFirstHalfCrescendoLines(e,t,i):this.createCrescendoLines(e,t,i)}createDiminuendoLines(e,t,i,s=this.rules.WedgeOpeningLength,r=this.rules.WedgeLineWidth){let n=new k(e,i-s/2),a=new k(e,i+s/2),o=new k(t,i);this.addWedgeLines(o,n,a,r)}createFirstHalfDiminuendoLines(e,t,i,s=this.rules.WedgeOpeningLength,r=this.rules.WedgeMeasureEndOpeningLength,n=this.rules.WedgeLineWidth){let a=new k(e,i-s/2),o=new k(e,i+s/2),l=new k(t,i-r/2),h=new k(t,i+r/2);this.addDoubleLines(a,l,o,h,n)}createSecondHalfDiminuendoLines(e,t,i,s=this.rules.WedgeMeasureBeginOpeningLength,r=this.rules.WedgeLineWidth){let n=new k(e,i-s/2),a=new k(e,i+s/2),o=new k(t,i);this.addWedgeLines(o,n,a,r)}recalculateDiminuendoLines(e,t,i){let s=Math.abs(this.lines[0].End.y-this.lines[1].End.y)>1e-4;this.lines.clear(),s?this.createFirstHalfDiminuendoLines(e,t,i):this.isSplittedPart?this.createSecondHalfDiminuendoLines(e,t,i):this.createDiminuendoLines(e,t,i)}createFirstHalfLines(e,t,i,s=this.rules.WedgeOpeningLength,r=this.rules.WedgeMeasureEndOpeningLength,n=this.rules.WedgeLineWidth){this.ContinuousDynamic.DynamicType===ne.crescendo?this.createFirstHalfCrescendoLines(e,t,i,r,n):this.ContinuousDynamic.DynamicType===ne.diminuendo&&this.createFirstHalfDiminuendoLines(e,t,i,s,r,n)}createSecondHalfLines(e,t,i,s=this.rules.WedgeMeasureBeginOpeningLength,r=this.rules.WedgeOpeningLength,n=this.rules.WedgeLineWidth){this.ContinuousDynamic.DynamicType===ne.crescendo?this.createSecondHalfCrescendoLines(e,t,i,s,r,n):this.ContinuousDynamic.DynamicType===ne.diminuendo&&this.createSecondHalfDiminuendoLines(e,t,i,s,n)}createLines(e,t,i,s=this.rules.WedgeOpeningLength,r=this.rules.WedgeLineWidth){this.ContinuousDynamic.DynamicType===ne.crescendo?this.createCrescendoLines(e,t,i,s,r):this.ContinuousDynamic.DynamicType===ne.diminuendo&&this.createDiminuendoLines(e,t,i,s,r)}calcPsi(){if(this.IsVerbal){this.PositionAndShape.calculateBoundingBox();return}this.PositionAndShape.RelativePosition=this.lines[0].Start,this.PositionAndShape.BorderMarginTop=this.lines[0].End.y-this.lines[0].Start.y,this.PositionAndShape.BorderMarginBottom=this.lines[1].End.y-this.lines[1].Start.y,this.PositionAndShape.Center.y=(this.PositionAndShape.BorderMarginTop+this.PositionAndShape.BorderMarginBottom)/2,this.IsSoftAccent?(this.PositionAndShape.BorderMarginLeft=0,this.PositionAndShape.BorderMarginRight=this.lines[3].Start.x-this.lines[0].Start.x):this.ContinuousDynamic.DynamicType===ne.crescendo?(this.PositionAndShape.BorderMarginLeft=0,this.PositionAndShape.BorderMarginRight=this.lines[0].End.x-this.lines[0].Start.x):(this.PositionAndShape.BorderMarginLeft=this.lines[0].End.x-this.lines[0].Start.x,this.PositionAndShape.BorderMarginRight=0)}cleanUp(){this.lines.clear()}shiftYPosition(e){this.IsVerbal?(this.PositionAndShape.RelativePosition.y+=e,this.PositionAndShape.calculateBoundingBox()):(this.lines[0].Start.y+=e,this.lines[0].End.y+=e,this.lines[1].End.y+=e)}squeeze(e){this.IsVerbal||Math.abs(this.lines[0].End.x-this.lines[0].Start.x)<Math.abs(e)||(this.ContinuousDynamic.DynamicType===ne.crescendo?e>0?this.lines[0].Start.x+=e:(this.lines[0].End.x+=e,this.lines[1].End.x+=e):e<0?this.lines[0].Start.x+=e:(this.lines[0].End.x+=e,this.lines[1].End.x+=e),this.calcPsi())}
5addWedgeLines(e,t,i,s){let r=new Ae(e,t,s),n=new Ae(e,i,s);this.rules.DefaultColorMusic&&(r.colorHex=this.rules.DefaultColorMusic,n.colorHex=this.rules.DefaultColorMusic),this.lines.push(r),this.lines.push(n)}addDoubleLines(e,t,i,s,r){let n=new Ae(e,t,r),a=new Ae(i,s,r);this.rules.DefaultColorMusic&&(n.colorHex=this.rules.DefaultColorMusic,a.colorHex=this.rules.DefaultColorMusic),this.lines.push(n),this.lines.push(a)}},wo=class extends Cs{constructor(e,t,i,s,r=void 0){super(e,new Pi(i),s),this.label=t,this.sourceMultiExpression=r}updateSkyBottomLine(){let e=this.parentStaffLine.SkyBottomLineCalculator,t=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft,i=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight;switch(this.Placement){case C.Above:let s=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;e.updateSkyLineInRange(t,i,s);break;case C.Below:let r=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;e.updateBottomLineInRange(t,i,r);break;default:W.default.error("Placement for GraphicalUnknownExpression is unknown")}}},kn=class extends Di{constructor(e,t,i,s,r,n,a,o,l){super(e,t,i,s,r),this.stringNumberTab=n,this.fretNumber=a,this.bendArray=o,this.vibratoStroke=l}get StringNumberTab(){return this.stringNumberTab}get FretNumber(){return this.fretNumber}get BendArray(){return this.bendArray}get VibratoStroke(){return this.vibratoStroke}hasTabEffects(){return this.bendArray?.length>0||this.vibratoStroke}},Xt=class te{constructor(){this.staffEntriesWithGraphicalTies=[],this.staffEntriesWithOrnaments=[],this.staffEntriesWithChordSymbols=[],this.staffLinesWithLyricWords=[],this.graphicalLyricWords=[],this.abstractNotImplementedErrorMessage="abstract, not implemented",this.dynamicExpressionMap=new Map}static get TextMeasurer(){return te.textMeasurer}static set TextMeasurer(t){te.textMeasurer=t}get leadSheet(){return this.graphicalMusicSheet.LeadSheet}static setMeasuresMinStaffEntriesWidth(t,i){for(let s=0,r=t.length;s<r;++s){let n=t[s];n&&(n.minimumStaffEntriesWidth=i)}}initialize(t){this.graphicalMusicSheet=t,this.rules=t.ParentMusicSheet.Rules,this.rules.clearMusicSheetObjects(),this.prepareGraphicalMusicSheet()}prepareGraphicalMusicSheet(){let t=this.graphicalMusicSheet.ParentMusicSheet;this.staffEntriesWithGraphicalTies=[],this.staffEntriesWithOrnaments=[],this.staffEntriesWithChordSymbols=[],this.staffLinesWithLyricWords=[],this.graphicalMusicSheet.Initialize();let i=this.graphicalMusicSheet.MeasureList,s=this.createAccidentalCalculators(),r=this.graphicalMusicSheet.initializeActiveClefs(),n=[],a=t.getCompleteNumberOfStaves(),o=[];for(let h=0;h<a;h++)o.push(void 0);for(let h=0,u=t.SourceMeasures.length;h<u;++h){let c=t.SourceMeasures[h],d=this.createGraphicalMeasuresForSourceMeasure(c,s,n,o,r);if(i.push(d),c.multipleRestMeasures>0&&this.rules.RenderMultipleRestMeasures){c.isReducedToMultiRest=!0,c.multipleRestMeasureNumber=1;let f=c.multipleRestMeasures-1;h+=f;
5for(let p=1;p<=f;p++){let m=t.SourceMeasures.indexOf(c)+p;if(m>=t.SourceMeasures.length)break;let g=t.SourceMeasures[m];g.multipleRestMeasureNumber=p+1,g.isReducedToMultiRest=!0,i.push([void 0])}}}if(this.rules.AutoGenerateMultipleRestMeasuresFromRestMeasures&&this.rules.RenderMultipleRestMeasures){let h,u=0;for(let c=0,d=t.SourceMeasures.length;c<d;++c){let f=t.SourceMeasures[c];if(!f.isReducedToMultiRest&&f.canBeReducedToMultiRest())if(u>0){h.isReducedToMultiRest=!0,h.multipleRestMeasureNumber=1,u++,f.multipleRestMeasureNumber=u,f.isReducedToMultiRest=!0;for(let p=0;p<i[c].length;p++)i[c][p]=void 0}else h=f,u=1;else if(u>1){h.multipleRestMeasures=u;let p=this.createGraphicalMeasuresForSourceMeasure(h,s,n,o,r);i[h.measureListIndex]=p,u=0,h=void 0}else u=0,h=void 0}if(u>1){h.multipleRestMeasures=u,h.isReducedToMultiRest=!0;let c=this.createGraphicalMeasuresForSourceMeasure(h,s,n,o,r);i[h.measureListIndex]=c,u=0,h=void 0}}let l=r.map(h=>h.ClefType===yt.percussion);this.handleStaffEntries(l),this.calculateVerticalContainersList(),this.setIndicesToVerticalGraphicalContainers()}calculate(){this.musicSystems=[],this.clearSystemsAndMeasures(),this.clearRecreatedObjects(),this.createGraphicalTies(),this.calculateSheetLabelBoundingBoxes(),this.calculateXLayout(this.graphicalMusicSheet,this.maxInstrNameLabelLength()),this.graphicalMusicSheet.MusicPages.length=0,this.calculateMusicSystems(),nr.transformRelativeToAbsolutePosition(this.graphicalMusicSheet)}async calculateAsync(t){let{yieldToMain:i}=await Promise.resolve().then(()=>(Ji(),qi));this.musicSystems=[],this.clearSystemsAndMeasures(),this.clearRecreatedObjects(),this.createGraphicalTies(),t?.("Preparing",0,100),await i(),this.calculateSheetLabelBoundingBoxes(),this.calculateXLayout(this.graphicalMusicSheet,this.maxInstrNameLabelLength()),await i(),this.graphicalMusicSheet.MusicPages.length=0,await this.calculateMusicSystemsAsync(t),t?.("Finalizing",95,100),await i(),await nr.transformRelativeToAbsolutePositionAsync(this.graphicalMusicSheet),t?.("Complete",100,100)}calculateXLayout(t,i){if(this.graphicalMusicSheet.MeasureList.length>0){let s=0,r,n=1;for(let a=0;a<this.graphicalMusicSheet.MeasureList.length;a++){r=this.graphicalMusicSheet.MeasureList[a];let o=this.calculateMeasureXLayout(r);o=this.calculateMeasureWidthFromStaffEntries(r,o),o>s&&(s=o);let l=this.graphicalMusicSheet.ParentMusicSheet.MeasureWidthFactor;for(let h of r)if(h?.parentSourceMeasure.WidthFactor){n=h.parentSourceMeasure.WidthFactor;break}o*=l*n,this.rules.MinimumMeasureWidth>0&&(o=Math.max(o,this.rules.MinimumMeasureWidth)),te.setMeasuresMinStaffEntriesWidth(r,o)}if(this.rules.FixedMeasureWidth){let a=s;this.rules.FixedMeasureWidthFixedValue&&(a=this.rules.FixedMeasureWidthFixedValue);for(let o=0;o<this.graphicalMusicSheet.MeasureList.length;o++)r=this.graphicalMusicSheet.MeasureList[o],!(!this.rules.FixedMeasureWidthUseForPickupMeasures&&r[0]?.parentSourceMeasure.ImplicitMeasure)&&te.setMeasuresMinStaffEntriesWidth(r,a)}}}calculateMeasureWidthFromStaffEntries(t,i){throw Error(this.abstractNotImplementedErrorMessage)}formatMeasures(){throw Error(this.abstractNotImplementedErrorMessage)}calculateMeasureXLayout(t){throw Error(this.abstractNotImplementedErrorMessage)}initGraphicalMeasuresCreation(){throw Error(this.abstractNotImplementedErrorMessage)}handleBeam(t,i,s){throw Error(this.abstractNotImplementedErrorMessage)}handleTiedGraphicalNote(t,i,s,r,n,a,o,l){throw Error(this.abstractNotImplementedErrorMessage)}handleVoiceEntryLyrics(t,i,s){throw Error(this.abstractNotImplementedErrorMessage)}handleVoiceEntryOrnaments(t,i,s){throw Error(this.abstractNotImplementedErrorMessage)}handleVoiceEntryArticulations(t,i,s){throw Error(this.abstractNotImplementedErrorMessage)}handleVoiceEntryTechnicalInstructions(t,i,s){throw Error(this.abstractNotImplementedErrorMessage)}handleTuplet(t,i,s){throw Error(this.abstractNotImplementedErrorMessage)}layoutVoiceEntry(t,i,s,r){throw Error(this.abstractNotImplementedErrorMessage)}layoutStaffEntry(t){throw Error(this.abstractNotImplementedErrorMessage)}createGraphicalTie(t,i,s,r,n){throw Error(this.abstractNotImplementedErrorMessage)}updateStaffLineBorders(t){throw Error(this.abstractNotImplementedErrorMessage)}calculateMeasureNumberPlacement(t){let i=t.StaffLines[0];if(!i||!i.Measures[0]){W.default.warn("calculateMeasureNumberPlacement: measure undefined for system.Id "+t.Id);return}let s=i.Measures[0].MeasureNumber,r=0;for(let n=0;n<i.Measures.length;n++){let a=i.Measures[n],o=this.rules.RenderMeasureNumbersOnlyAtSystemStart&&n>1;if(n===1&&i.Measures[0].parentSourceMeasure.ImplicitMeasure&&(o=!1),o)return;(a.MeasureNumber===0||a.MeasureNumber===1)&&(s=a.MeasureNumber),r=a!==i.Measures[0]&&this.rules.MeasureNumberLabelXOffset?this.rules.MeasureNumberLabelXOffset:0;let l=this.rules.UseXMLMeasureNumbers&&a.MeasureNumber===1&&a.parentSourceMeasure.getPrintedMeasureNumber()!==1;((a.MeasureNumber===s||a.MeasureNumber>=s+this.rules.MeasureNumberLabelOffset)&&!a.parentSourceMeasure.ImplicitMeasure||l)&&((a.MeasureNumber!==1||a.MeasureNumber===1&&a!==i.Measures[0]||l)&&this.calculateSingleMeasureNumberPlacement(a,i,t,r),s=a.MeasureNumber)}}calculateSingleMeasureNumberPlacement(t,i,s,r=0){let n=new pe(new Nt(t.parentSourceMeasure.getPrintedMeasureNumber().toString()),this.rules.MeasureNumberLabelHeight,mt.LeftBottom,this.rules),a=i.SkyBottomLineCalculator;n.setLabelPositionAndShapeBorders(),n.PositionAndShape.Parent=s.PositionAndShape;let o=i.PositionAndShape.RelativePosition.x+t.PositionAndShape.RelativePosition.x-n.PositionAndShape.BorderMarginLeft+r,l,h=o,u=o-n.PositionAndShape.BorderLeft+n.PositionAndShape.BorderRight;h-=i.PositionAndShape.RelativePosition.x,u-=i.PositionAndShape.RelativePosition.x;let c=h+.5,d=u-.5,f=a.getSkyLineMinInRange(c,d);if(t===i.Measures[0]){let p=0;if(s.GroupBrackets.length>0)for(let m of s.GroupBrackets)p=Math.min(p,m.PositionAndShape.BorderTop);else t.ParentStaff.ParentInstrument.Parent&&(p=-1);l=Math.min(f,p)}else l=f;l=Math.min(0,l),n.PositionAndShape.RelativePosition=new k(o,l),s.MeasureNumberLabels.push(n)}calculateMeasureNumberSkyline(t){let i=t.StaffLines[0];for(let s of t.MeasureNumberLabels){let r=s.PositionAndShape.RelativePosition.x,n=r-s.PositionAndShape.BorderLeft+s.PositionAndShape.BorderRight;r-=i.PositionAndShape.RelativePosition.x,n-=i.PositionAndShape.RelativePosition.x,i.SkyBottomLineCalculator.updateSkyLineInRange(r,n,s.PositionAndShape.RelativePosition.y+s.PositionAndShape.BorderMarginTop)}}layoutGraphicalTie(t,i,s){throw Error(this.abstractNotImplementedErrorMessage)}calculateSingleStaffLineLyricsPosition(t,i){let s=0,r=this.rules.StaffHeight,n=new Map,a=[],o=t.SkyBottomLineCalculator,l=t.Measures.length;for(let u=0;u<l;++u){let c=t.Measures[u],d=c.PositionAndShape.RelativePosition,f=c.staffEntries.length;for(let p=0;p<f;++p){let m=c.staffEntries[p],g=m.LyricsEntries.length;for(let b=0;b<g;++b){let S=m.LyricsEntries[b].LyricsEntry;n[S.VerseNumber]=S.IsChorus}if(g>0){a.push(m),s=Math.max(s,m.LyricsEntries.length);let b=m.PositionAndShape.RelativePosition.x+d.x,S=Number.MAX_VALUE,E=Number.MIN_VALUE;for(let M=0;M<m.LyricsEntries.length;M++){let P=m.LyricsEntries[M].GraphicalLabel;S=Math.min(S,b+P.PositionAndShape.BorderMarginLeft),E=Math.max(E,b+P.PositionAndShape.BorderMarginRight)}let y=o.getBottomLineMaxInRange(S,E);r=Math.max(r,y+this.rules.LyricsYMarginToBottomLine)}}}let h=0;l=a.length;for(let u of a){let c=[],d=!0;for(let f=0;f<u.LyricsEntries.length;f++)d&&(d=u.LyricsEntries[f].LyricsEntry.IsChorus);for(let f of i)n[f]===d&&c.push(f);for(let f=0;f<u.LyricsEntries.length;f++){let p=u.LyricsEntries[f],m=p.GraphicalLabel,g=p.LyricsEntry.VerseNumber,b=c.indexOf(g),S=r+this.rules.LyricsHeight+this.rules.VerticalBetweenLyricsDistance+this.rules.LyricsYOffsetToStaffHeight+(this.rules.VerticalBetweenLyricsDistance+this.rules.LyricsHeight)*b,E=m.PositionAndShape.RelativePosition.x;m.PositionAndShape.RelativePosition=new k(E,S),m.Label.fontStyle=p.LyricsEntry.FontStyle,h=Math.max(h,S)}}
5if(a.length>0){let u=t.PositionAndShape.Size.width,c=a[0].PositionAndShape.RelativePosition.x+a[0].PositionAndShape.BorderMarginLeft+a[0].parentMeasure.PositionAndShape.RelativePosition.x;c=c>u?u:c,o.updateBottomLineInRange(c,u,h)}return a}calculateLyricsExtendsAndDashes(t){for(let i=0,s=t.length;i<s;++i){let r=t[i];for(let n=0;n<r.LyricsEntries.length;n++){let a=r.LyricsEntries[n];a.ParentLyricWord&&a.ParentLyricWord.GraphicalLyricsEntries[a.ParentLyricWord.GraphicalLyricsEntries.length-1]!==a&&this.calculateSingleLyricWord(a),a.LyricsEntry.extend&&this.calculateLyricExtend(a)}}}calculateSingleOctaveShift(t,i,s,r){throw Error(this.abstractNotImplementedErrorMessage)}calculateWordRepetitionInstruction(t,i){throw Error(this.abstractNotImplementedErrorMessage)}calculateMoodAndUnknownExpression(t,i,s){let r=t.AbsoluteTimestamp,n=this.graphicalMusicSheet.MeasureList[i],a=new k,o=t.UnknownList[0]?.defaultYXml;if(t.MoodList.length>0||t.UnknownList.length>0){let l="";for(let m=0,g=t.EntriesList.length;m<g;++m){let b=t.EntriesList[m];b.prefix!==""&&(l===""?l+=b.prefix:l+=" "+b.prefix),l===""?l+=b.label:l+=" "+b.label}let h=n[s].ParentStaffLine;if(!h){W.default.debug("MusicSheetCalculator.calculateMoodAndUnknownExpression: staffLine undefined. Returning.");return}a=this.getRelativePositionInStaffLineFromTimestamp(r,s,h,h?.isPartOfMultiStaffInstrument()),Math.abs(a.x-0)<1e-4&&(a.x=n[s].beginInstructionsWidth+this.rules.RhythmRightMargin);let u=this.rules.UnknownTextHeight,c=t.getPlacementOfFirstEntry(),d=this.calculateLabel(h,a,l,t.getFontstyleOfFirstEntry(),c,u),f=t.getColorXMLOfFirstEntry();if(this.rules.ExpressionsUseXMLColor&&f&&(d.ColorXML=f),this.rules.PlaceWordsInsideStafflineFromXml&&o<0&&o>-50){let m=o/10;m+=this.rules.PlaceWordsInsideStafflineYOffset,d.PositionAndShape.RelativePosition.y=m}let p=new wo(h,d,c,n[s]?.parentSourceMeasure,t);h.AbstractExpressions.push(p)}}clearRecreatedObjects(){for(let t=0,i=this.staffEntriesWithGraphicalTies.length;t<i;++t){let s=this.staffEntriesWithGraphicalTies[t];s.GraphicalTies.length=0}this.staffEntriesWithGraphicalTies.length=0}handleStaffEntryLink(t,i){W.default.debug("handleStaffEntryLink not implemented")}calculateMusicSystems(){if(!this.graphicalMusicSheet.MeasureList)return;let t=this.graphicalMusicSheet.MeasureList;if(!t)return;this.rules.MinMeasureToDrawIndex>t.length-1&&(W.default.debug("minimum measure to draw index out of range. resetting min measure index to limit."),this.rules.MinMeasureToDrawIndex=t.length-1);let i=[];for(let n=this.rules.MinMeasureToDrawIndex,a=t.length;n<a&&n<=this.rules.MaxMeasureToDrawIndex;++n){let o=t[n],l=[];for(let h=0,u=o.length;h<u;++h){let c=t[n][h];if(c?.isVisible()&&(l.push(c),this.rules.ColoringEnabled))for(let d of c.staffEntries)for(let f of d.graphicalVoiceEntries)f.applyCustomNoteheads(),f.color()}i.push(l)}let s=0;for(let n=0,a=i.length;n<a;++n){let o=i[n];s=Math.max(o.length,s);break}if(s===0)return;let r=new Jr;if(r.initialize(this.graphicalMusicSheet,i,s),this.musicSystems=r.buildMusicSystems(),this.formatMeasures(),this.leadSheet||(this.optimizeRestPlacement(),this.calculateStaffEntryArticulationMarks(),this.rules.RenderSlurs&&this.calculateTieCurves()),this.calculateSkyBottomLines(),this.calculateTupletNumbers(),this.rules.RenderMeasureNumbers)for(let n=0,a=this.musicSystems.length;n<a;++n){let o=this.musicSystems[n];this.calculateMeasureNumberPlacement(o)}if(this.rules.RenderFingerings&&this.calculateFingerings(),!this.leadSheet&&this.rules.RenderSlurs&&this.calculateSlurs(),this.calculateGlissandi(),this.rules.RenderMeasureNumbers)for(let n=0,a=this.musicSystems.length;n<a;++n){let o=this.musicSystems[n];this.calculateMeasureNumberSkyline(o)}this.leadSheet||this.calculateOrnaments(),this.calculateChordSymbols(),this.leadSheet||(this.calculateDynamicExpressions(),this.calculateMoodAndUnknownExpressions(),this.calculateExpressionAlignements(),this.calculateOctaveShifts(),this.rules.RenderPedals&&this.calculatePedals(),this.calculateWordRepetitionInstructions()),this.calculateRepetitionEndings(),this.leadSheet||this.calculateTempoExpressions(),this.calculateRehearsalMarks(),this.calculateLyricsPosition();for(let n=0,a=this.musicSystems.length;n<a;++n){let o=this.musicSystems[n];for(let l=0,h=o.StaffLines.length;l<h;++l){let u=o.StaffLines[l];this.updateStaffLineBorders(u)}}r.calculateSystemYLayout(),this.calculateComments(),this.calculateMarkedAreas();for(let n=0,a=this.graphicalMusicSheet.MusicPages.length;n<a;++n){let o=this.graphicalMusicSheet.MusicPages[n];for(let h=0,u=o.MusicSystems.length;h<u;++h){let c=n===0&&h===0,d=o.MusicSystems[h];d.setMusicSystemLabelsYPosition(),this.leadSheet?d===d.Parent.MusicSystems[0]&&d.createSystemLeftLine(this.rules.SystemThinLineWi
5dth,this.rules.SystemLabelsRightMargin,c):(d.setYPositionsToVerticalLineObjectsAndCreateLines(this.rules),d.createSystemLeftLine(this.rules.SystemThinLineWidth,this.rules.SystemLabelsRightMargin,c),d.createInstrumentBrackets(this.graphicalMusicSheet.ParentMusicSheet.Instruments,this.rules.StaffHeight),d.createGroupBrackets(this.graphicalMusicSheet.ParentMusicSheet.InstrumentalGroups,this.rules.StaffHeight,0),d.alignBeginInstructions()),d.calculateBorders(this.rules)}let l=o.MusicSystems[0].PositionAndShape.BorderTop;for(let h=0,u=o.MusicSystems.length;h<u;++h){let c=o.MusicSystems[h];c.PositionAndShape.RelativePosition=new k(c.PositionAndShape.RelativePosition.x,c.PositionAndShape.RelativePosition.y-l)}o.PositionAndShape.calculateTopBottomBorders(),o===this.graphicalMusicSheet.MusicPages[0]&&this.calculatePageLabels(o),o.PositionAndShape.calculateTopBottomBorders()}}async calculateMusicSystemsAsync(t){let{yieldToMain:i}=await Promise.resolve().then(()=>(Ji(),qi));if(!this.graphicalMusicSheet.MeasureList)return;let s=this.graphicalMusicSheet.MeasureList;if(!s)return;this.rules.MinMeasureToDrawIndex>s.length-1&&(W.default.debug("minimum measure to draw index out of range. resetting min measure index to limit."),this.rules.MinMeasureToDrawIndex=s.length-1);let r=[];for(let o=this.rules.MinMeasureToDrawIndex,l=s.length;o<l&&o<=this.rules.MaxMeasureToDrawIndex;++o){let h=s[o],u=[];for(let c=0,d=h.length;c<d;++c){let f=s[o][c];if(f?.isVisible()&&(u.push(f),this.rules.ColoringEnabled))for(let p of f.staffEntries)for(let m of p.graphicalVoiceEntries)m.applyCustomNoteheads(),m.color()}r.push(u)}let n=0;for(let o=0,l=r.length;o<l;++o){let h=r[o];n=Math.max(h.length,n);break}if(n===0)return;let a=new Jr;if(a.initialize(this.graphicalMusicSheet,r,n),this.musicSystems=await a.buildMusicSystemsAsync((o,l)=>{let h=Math.round(o/l*40);t?.("Building systems",h,100)}),t?.("Formatting",45,100),await i(),this.formatMeasures(),this.leadSheet||(this.optimizeRestPlacement(),this.calculateStaffEntryArticulationMarks(),this.rules.RenderSlurs&&this.calculateTieCurves()),t?.("Calculating layout",55,100),await i(),await this.calculateSkyBottomLinesAsync(()=>i()),this.calculateTupletNumbers(),this.rules.RenderMeasureNumbers)for(let o of this.musicSystems)this.calculateMeasureNumberPlacement(o);if(this.rules.RenderFingerings&&this.calculateFingerings(),!this.leadSheet&&this.rules.RenderSlurs&&this.calculateSlurs(),this.calculateGlissandi(),t?.("Calculating layout",70,100),await i(),this.rules.RenderMeasureNumbers)for(let o of this.musicSystems)this.calculateMeasureNumberSkyline(o);this.leadSheet||this.calculateOrnaments(),this.calculateChordSymbols(),this.leadSheet||(this.calculateDynamicExpressions(),this.calculateMoodAndUnknownExpressions(),this.calculateExpressionAlignements(),this.calculateOctaveShifts(),this.rules.RenderPedals&&this.calculatePedals(),this.calculateWordRepetitionInstructions()),this.calculateRepetitionEndings(),this.leadSheet||this.calculateTempoExpressions(),this.calculateRehearsalMarks(),this.calculateLyricsPosition(),t?.("Calculating layout",80,100),await i();for(let o of this.musicSystems)for(let l of o.StaffLines)this.updateStaffLineBorders(l);a.calculateSystemYLayout(),this.calculateComments(),this.calculateMarkedAreas(),t?.("Calculating layout",90,100),await i();for(let o=0;o<this.graphicalMusicSheet.MusicPages.length;o++){let l=this.graphicalMusicSheet.MusicPages[o];for(let u=0;u<l.MusicSystems.length;u++){let c=o===0&&u===0,d=l.MusicSystems[u];d.setMusicSystemLabelsYPosition(),this.leadSheet?d===d.Parent.MusicSystems[0]&&d.createSystemLeftLine(this.rules.SystemThinLineWidth,this.rules.SystemLabelsRightMargin,c):(d.setYPositionsToVerticalLineObjectsAndCreateLines(this.rules),d.createSystemLeftLine(this.rules.SystemThinLineWidth,this.rules.SystemLabelsRightMargin,c),d.createInstrumentBrackets(this.graphicalMusicSheet.ParentMusicSheet.Instruments,this.rules.StaffHeight),d.createGroupBrackets(this.graphicalMusicSheet.ParentMusicSheet.InstrumentalGroups,this.rules.StaffHeight,0),d.alignBeginInstructions()),d.calculateBorders(this.rules)}let h=l.MusicSystems[0].PositionAndShape.BorderTop;for(let u of l.MusicSystems)u.PositionAndShape.RelativePosition=new k(u.PositionAndShape.RelativePosition.x,u.PositionAndShape.RelativePosition.y-h);l.PositionAndShape.calculateTopBottomBorders(),l===this.graphicalMusicSheet.MusicPages[0]&&this.calculatePageLabels(l),l.PositionAndShape.calculateTopBottomBorders()}}calculateMarkedAreas(){}calculateComments(){}calculateChordSymbols(){for(let t of this.musicSystems)for(let i of t.StaffLines){let s=i.SkyBottomLineCalculator,r=2**53-1,n=-(2**53-1);if(this.rules.ChordSymbolYAlignment&&this.rules.ChordSymbolYAlignmentScope==="staffline"){let a=[];for(let h of i.Measures)a.push(...h.staffEntries);let{minOffset:o,maxOffset:l}=this.calculateAlignedChordSymbolsOffset(a,s);r=o,n=l}for(let a=0;a<i.Measures.length;a++){let o=i.Measures[a];if(this.rules.ChordSymbolYAlignment&&this.rules.ChordSymbolYAlignmentScope==="measure"){let{minOffset:h,maxOffset:u}=this.calculateAlignedChordSymbolsOffset(o.staffEntries,s);r=h,n=u}let l;for(let h of o.staffEntries)if(!(!h.graphicalChordContainers||h.graphicalChordContainers.length===0))for(let u=0;u<h.graphicalChordContainers.length;u++){let c=h.graphicalChordContainers[u];if(h.graphicalVoiceEntries.length===0&&h.relInMeasureTimestamp.RealValue>0){let E=0;o.staffEntries[0].relInMeasureTimestamp.RealValue===0&&(E=o.staffEntries[0].PositionAndShape.RelativePosition.x,o.MeasureNumber===1&&(E+=this.rules.ChordSymbolWholeMeasureRestXOffsetMeasure1));let y=o.PositionAndShape.Size.width-o.endInstructionsWidth,M=h.relInMeasureTimestamp.RealValue/o.parentSourceMeasure.Duration.RealValue,P=E+(y-E)*M+c.PositionAndShape.BorderMarginLeft;l&&(P=Math.max(P,l.PositionAndShape.RelativePosition.x+l.GraphicalLabel.PositionAndShape.Size.width+this.rules.ChordSymbolXSpacing)),c.PositionAndShape.RelativePosition.x=P,c.PositionAndShape.Parent=o.staffEntries[0].PositionAndShape.Parent}let d=c.PositionAndShape,f=d.Parent;if(f.DataObject instanceof Ni&&h.relInMeasureTimestamp.RealValue===0&&(d.RelativePosition.x=Math.max(o.beginInstructionsWidth,d.RelativePosition.x),o.MeasureNumber===1&&d.RelativePosition.x>3&&(d.RelativePosition.x+=this.rules.ChordSymbolWholeMeasureRestXOffsetMeasure1)),h.PositionAndShape.RelativePosition.x===0){let E=t.GraphicalMeasures[a];for(let y of E){let M=!1;for(let P of y.staffEntries)if(P.relInMeasureTimestamp===h.relInMeasureTimestamp&&P.PositionAndShape.RelativePosition.x!==0){d.RelativePosition.x=P.PositionAndShape.RelativePosition.x,M=!0;break}if(M)break}}let p=d.BorderMarginLeft+f.AbsolutePosition.x+d.RelativePosition.x,m=d.BorderMarginRight+f.AbsolutePosition.x+d.RelativePosition.x,g=c.GetChordSymbolContainer.Placement;g===C.Below?(!this.rules.ChordSymbolYAlignment||n<0)&&(n=s.getBottomLineMaxInRange(p,m)):g===C.Above&&(!this.rules.ChordSymbolYAlignment||r>0)&&(r=s.getSkyLineMinInRange(p,m));let b=0;u===0?(b+=this.rules.ChordSymbolYOffset,b+=.1):b+=this.rules.ChordSymbolYPadding,g!==C.Below&&(b*=-1);let S=c.GraphicalLabel;g===C.Below?(S.PositionAndShape.RelativePosition.y=n+b,S.setLabelPositionAndShapeBorders(),S.PositionAndShape.calculateBoundingBox(),s.updateBottomLineInRange(p,m,n+S.PositionAndShape.BorderMarginBottom+this.rules.ChordSymbolBottomMargin)):(S.PositionAndShape.RelativePosition.y=r+b,S.set
5LabelPositionAndShapeBorders(),S.PositionAndShape.calculateBoundingBox(),s.updateSkyLineInRange(p,m,r+S.PositionAndShape.BorderMarginTop)),l=c}}}}calculateAlignedChordSymbolsOffset(t,i){let s=9007199254740991,r=-(2**53-1);for(let n of t)for(let a of n.graphicalChordContainers){let o=a.PositionAndShape,l=o.Parent,h=o.BorderMarginLeft+l.AbsolutePosition.x,u=o.BorderMarginRight+l.AbsolutePosition.x;l.DataObject instanceof Ni&&(h+=l.DataObject.beginInstructionsWidth,u+=l.DataObject.beginInstructionsWidth);let c=a.GetChordSymbolContainer.Placement;c===C.Above?s=Math.min(s,i.getSkyLineMinInRange(h,u)):c===C.Below&&(r=Math.max(r,i.getBottomLineMaxInRange(h,u)))}return{minOffset:s,maxOffset:r}}layoutMeasureWithWholeRest(t,i,s){}layoutBeams(t){}layoutArticulationMarks(t,i,s){}layoutOrnament(t,i,s){}calculateRestNotePlacementWithinGraphicalBeam(t,i,s,r,n){}calculateTupletNumbers(){if(!this.rules.TupletNumberLimitConsecutiveRepetitions)return;let t=-1,i,s=0,r,n,a={};for(let o of this.graphicalMusicSheet.ParentMusicSheet.Instruments)for(let l of o.Voices){s=0,a[l.VoiceId]={};for(let h of l.VoiceEntries)if(h.Notes.length>0){let u=h.Notes[0];if(!u.NoteTuplet||u.NoteTuplet.shouldBeBracketed(this.rules.TupletsBracketedUseXMLValue,this.rules.TupletsBracketed,this.rules.TripletsBracketed)){t=-1,s=0,r=void 0,i=void 0;continue}if(u.NoteTuplet===n)continue;let c=u.TypeLength;if(c||(W.default.warn("note missing TypeLength"),c=u.NoteTuplet.Fractions[0]),u.NoteTuplet!==r&&a[l.VoiceId][u.NoteTuplet.TupletLabelNumber]&&a[l.VoiceId][u.NoteTuplet.TupletLabelNumber][c.RealValue]){u.NoteTuplet.RenderTupletNumber=!1,n=u.NoteTuplet;continue}(u.NoteTuplet.TupletLabelNumber!==t||!c.Equals(i)||u.NoteTuplet.Bracket)&&(t=u.NoteTuplet.TupletLabelNumber,i=c,s=0),r=u.NoteTuplet,s++,s<=this.rules.TupletNumberMaxConsecutiveRepetitions&&(u.NoteTuplet.RenderTupletNumber=!0),s>this.rules.TupletNumberMaxConsecutiveRepetitions&&(u.NoteTuplet.RenderTupletNumber=!1,this.rules.TupletNumberAlwaysDisableAfterFirstMax&&(a[l.VoiceId][t]||(a[l.VoiceId][t]={}),a[l.VoiceId][t][c.RealValue]=!0)),n=r}}}calculateSlurs(){}calculateGlissandi(){}calculateDynamicExpressionsForMultiExpression(t,i,s){}calculateGraphicalVerbalContinuousDynamic(t,i){let s=t.Label,r=i.x+s.PositionAndShape.BorderMarginLeft,n=i.x+s.PositionAndShape.BorderMarginRight,a=t.ContinuousDynamic.Placement,o=t.ParentStaffLine.SkyBottomLineCalculator,l;a===C.Below?(l=o.getBottomLineMaxInRange(r,n),s.PositionAndShape.RelativePosition=new k(i.x,l-s.PositionAndShape.BorderMarginTop)):(l=o.getSkyLineMinInRange(r,n),s.PositionAndShape.RelativePosition=new k(i.x,l-s.PositionAndShape.BorderMarginBottom))}calculateGraphicalContinuousDynamic(t,i){let s=t.IsSoftAccent,r=t.ParentStaffLine.ParentStaff.idInMusicSheet,n=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(t.ContinuousDynamic.EndMultiExpression.SourceMeasureParent,r);if(!n){W.default.warn("MusicSheetCalculator.calculateGraphicalContinuousDynamic: No endMeasure found");return}t.EndMeasure=n;let a=t.ParentStaffLine,o=n.ParentStaffLine,l=o&&a===o,h=!1;o?h=o?.isPartOfMultiStaffInstrument():a&&(h=a?.isPartOfMultiStaffInstrument());let u=N.createFromFraction(t.ContinuousDynamic.EndMultiExpression.AbsoluteTimestamp),c=this.graphicalMusicSheet.GetVerticalContainerFromTimestamp(u),d=c.getFirstNonNullStaffEntry().parentMeasure,f=d.PositionAndShape.AbsolutePosition.x+d.PositionAndShape.BorderRight,p=new N(0,0,0);for(let X of c.StaffEntries){if(X?.sourceStaffEntry.ParentStaff!==a.ParentStaff)continue;let Z=X?.sourceStaffEntry?.calculateMaxNoteLength(!1);Z?.gt(p)&&(p=Z)}let m=!s&&t.ContinuousDynamic.DynamicType===ne.diminuendo,g=this.getRelativePositionInStaffLineFromTimestamp(u,r,o,h,0,m),b=N.plus(u,p).clone();t.ContinuousDynamic.EndMultiExpression.EndOffsetFraction&&this.rules.UseEndOffsetForExpressions&&b.Add(t.ContinuousDynamic.EndMultiExpression.EndOffsetFraction);let S=this.getRelativePositionInStaffLineFromTimestamp(b,r,o,h,0,t.ContinuousDynamic.DynamicType===ne.diminuendo),E=this.rules.SoftAccentWedgePadding,y=c.getFirstNonNullStaffEntry().PositionAndShape.Size.width,M=this.rules.SoftAccentSizeFactor;s?(i.x-=y/2*M+E,g.x=i.x+y/2*M):S.x>g.x&&S.x<f?g.x+=(S.x-g.x)/this.rules.WedgeEndDistanceBetweenTimestampsFactor:g.x=f-this.rules.WedgeHorizontalMargin;let P=this.dynamicExpressionMap.get(t.ContinuousDynamic.StartMultiExpression.AbsoluteTimestamp.RealValue);P&&P.DataObject.ParentStaffLine===a&&(i.x=P.RelativePosition.x+this.rules.WedgeHorizontalMargin,i.x+=P.BorderMarginRight);let L=a.ParentMusicSystem,B=L.StaffLines.indexOf(a),A=a.SkyBottomLineCalculator,G=t.ContinuousDynamic.Placement,H;l&&g.x-i.x<this.rules.WedgeMinLength&&!s&&(g.x=i.x+this.rules.WedgeMinLength);let T=i.x,I=o.Measures[0].beginInstructionsWidth-this.rules.WedgeHorizontalMargin-2,v=0,U=0,dt=[];
5if(l)v=g.x;else{v=a.PositionAndShape.Size.width,U=g.x;let X=[a,o],Z=t.StartMeasure,O=Z,V=0,ht=Z.parentSourceMeasure.measureListIndex;for(;O!==n&&V<1e3;){let nt=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[ht],it=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(nt,r);if(it){O=it;let Ut=O.ParentStaffLine;if(!X.includes(Ut)){X.push(Ut);let jt=new Es(t.ContinuousDynamic,Ut,Ut.Measures[0].parentSourceMeasure);jt.IsSplittedPart=!0,dt.push(jt)}}ht++,V++}H=new Es(t.ContinuousDynamic,o,n.parentSourceMeasure),H.IsSplittedPart=!0,t.IsSplittedPart=!0}s&&(I=g.x+E,U=I+y/2*M);let Y=0,at=0;if(G===C.Below){let X=0;if(B<L.StaffLines.length-1&&(X=B+1),X>B){let O=L.StaffLines[X].PositionAndShape.RelativePosition.y-a.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;Y=this.rules.StaffHeight+O/2}else Y=this.rules.WedgePlacementBelowY;Y-=this.rules.WedgeOpeningLength/2,l||(at=Y);let Z=A.getBottomLineMaxInRange(T,v);if(Z>Y&&(Y=Z),B<L.StaffLines.length-1){let O=a.findClosestStaffEntry(v),V=a.findClosestStaffEntry(T);V&&O&&V.parentVerticalContainer}l||(Z=o.SkyBottomLineCalculator.getBottomLineMaxInRange(I,U),Z>at&&(at=Z),at+=this.rules.WedgeOpeningLength/2,at+=this.rules.WedgeVerticalMargin),Y+=this.rules.WedgeOpeningLength/2,Y+=this.rules.WedgeVerticalMargin}else if(G===C.Above){if(a.ParentStaff.ParentInstrument.Staves.length===1)Y=this.rules.WedgePlacementAboveY;else{let Z=0;B>0&&(Z=B-1);let O=L.StaffLines[Z];Y=-(a.PositionAndShape.RelativePosition.y-O.PositionAndShape.RelativePosition.y-this.rules.StaffHeight)/2}Y+=this.rules.WedgeOpeningLength/2,l||(at=Y);let X=A.getSkyLineMinInRange(T,v);if(X<Y&&(Y=X),a.ParentStaff.ParentInstrument.Staves.length>1&&B>0){let Z=a.findClosestStaffEntry(T),O=a.findClosestStaffEntry(v);Z&&O&&(Z.parentVerticalContainer,B-1)}l||(X=o.SkyBottomLineCalculator.getSkyLineMinInRange(I,U),X<at&&(at=X),at-=this.rules.WedgeOpeningLength/2),Y-=this.rules.WedgeOpeningLength/2,Y-=this.rules.WedgeVerticalMargin,l||(at-=this.rules.WedgeVerticalMargin)}if(t.Lines.clear(),s)t.createFirstHalfCrescendoLines(T,v,Y),t.createSecondHalfDiminuendoLines(I,U,Y),t.calcPsi();else if(l&&!s)t.createLines(T,v,Y),t.calcPsi();else{t.createFirstHalfLines(T,v,Y),t.calcPsi();for(let X=0;X<dt.length;X++){let Z=dt[X],O=Z.ParentStaffLine,V=at;if(G===C.Below){let ht=o.SkyBottomLineCalculator.getBottomLineMaxInRange(I,v);ht>V&&(V=ht),V+=this.rules.WedgeOpeningLength/2,V+=this.rules.WedgeVerticalMargin}else if(G===C.Above){let ht=O.SkyBottomLineCalculator.getSkyLineMinInRange(I,U);ht<at&&(V=ht),V-=this.rules.WedgeOpeningLength/2}t.ContinuousDynamic.DynamicType===ne.crescendo?Z.createSecondHalfCrescendoLines(0,O.PositionAndShape.Size.width,V):Z.createFirstHalfDiminuendoLines(0,O.PositionAndShape.Size.width,V),Z.calcPsi()}H.createSecondHalfLines(I,U,at),H.calcPsi()}this.dynamicExpressionMap.set(u.RealValue,t.PositionAndShape)}calculateGraphicalInstantaneousDynamicExpression(t,i,s){let r=t.ParentStaffLine;if(!r)return;let n=i.x+t.PositionAndShape.BorderMarginLeft,a=i.x+t.PositionAndShape.BorderMarginRight,o=r.SkyBottomLineCalculator,l=0;if(t.Placement===C.Above){let h=o.getSkyLineMinInRange(n,a);if(r.isPartOfMultiStaffInstrument()&&r.ParentStaff!==r.ParentStaff.ParentInstrument.Staves[0]){let u=r.ParentMusicSystem.StaffLines[r.ParentMusicSystem.StaffLines.indexOf(r)-1];if(u){let c=r?.PositionAndShape.RelativePosition.y-u.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;l=h>-c/2?-c/2:h-t.PositionAndShape.BorderMarginBottom}}else l=h-t.PositionAndShape.BorderMarginBottom;t.PositionAndShape.RelativePosition=new k(i.x,l)}else if(t.Placement===C.Below){let h=o.getBottomLineMaxInRange(n,a),u=r.ParentStaff.ParentInstrument.Staves[r.ParentStaff.ParentInstrument.Staves.length-1];if(r.isPartOfMultiStaffInstrument()&&r.ParentStaff!==u){let c=r.ParentMusicSystem.StaffLines[r.ParentMusicSystem.StaffLines.indexOf(r)+1];if(c){let d=c.PositionAndShape.RelativePosition.y-r.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;l=h+t.PositionAndShape.BorderMarginBottom<this.rules.StaffHeight+d/2?this.rules.StaffHeight+d/2:h-t.PositionAndShape.BorderMarginTop}}else l=h-t.PositionAndShape.BorderMarginTop;t.PositionAndShape.RelativePosition=new k(i.x,l)}t.updateSkyBottomLine()}calcGraphicalRepetitionEndingsRecursively(t){}layoutSingleRepetitionEnding(t,i,s,r,n,a){}calculateLabel(t,i,s,r,n,a,o=mt.CenterBottom,l=0){let h=new Nt(s,o);h.fontStyle=r,h.fontHeight=a;let u=new pe(h,a,h.textAlignment,this.rules,t.PositionAndShape),c=1.1;n===C.Below&&(u.Label.textAlignment=mt.LeftTop),u.setLabelPositionAndShapeBorders(),u.PositionAndShape.BorderMarginBottom*=c,u.PositionAndShape.BorderMarginTop*=c,u.PositionAndShape.BorderMarginLeft*=c,u.PositionAndShape.BorderMarginRight*=c;let d=i.x+u.PositionAndShape.BorderMarginLeft,f=i.x+u.PositionAndShape.BorderMarginRight;if(f>t.PositionAndShape.Size.width&&(f=t.PositionAndShape.Size.width-this.rules.MeasureRightMargin,d=f-u.PositionAndShape.MarginSize.width,i.x=d-u.PositionAndShape.BorderMarginLeft),d<t.PositionAndShape.BorderMarginLeft){let g=t.PositionAndShape.BorderMarginLeft-d+this.rules.LabelXOffsetForStafflineLeftOverflowCheck;d+=g,f+=g,i.x+=g}let p,m=t.SkyBottomLineCalculator;return p=n===C.Below?m.getBottomLineMaxInRange(d,f)+l:m.getSkyLineMinInRange(d,f)-l,u.PositionAndShape.RelativePosition=new k(i.x,p),n===C.Below?m.updateBottomLineInRange(d,f,u.PositionAndShape.BorderMarginBottom+p):m.updateSkyLineInRange(d,f,u.PositionAndShape.BorderMarginTop+p),u}calculateTempoExpressionsForMultiTempoExpression(t,i,s){let r=N.plus(t.AbsoluteTimestamp,i.Timestamp),n=this.graphicalMusicSheet.MeasureList[s],a=new k;if(i.ContinuousTempo||i.InstantaneousTempo){if(this.rules.MinMeasureToDrawIndex>0||!n[0])return;let o=n[0].ParentStaffLine,l=n[0].PositionAndShape.RelativePosition.x,h=0;for(let u=0;u<n.length;u++)if(!(!n[u].ParentStaffLine||n[u].ParentStaffLine.Measures.length===0)&&n[u].ParentStaffLine.Measures.length>0){o=n[u].ParentStaffLine,l=n[u].PositionAndShape.RelativePosition.x,h=u;break}if(a=this.getRelativePositionInStaffLineFromTimestamp(r,h,o,o.isPartOfMultiStaffInstrument(),l),i.EntriesList.length>0&&i.EntriesList[0].Expression instanceof Fe){let u=i.EntriesList[0].Expression;if(u.Placement=C.Above,o.Measures[0].staffEntries.length>0&&Math.abs(a.x-o.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x)===0&&o.ParentMusicSystem===this.musicSystems[0]){let c=o.Measures[0].FirstInstructionStaffEntry;if(c){let d=c.GraphicalInstructions.last();a.x=d.PositionAndShape.RelativePosition.x}this.rules.CompactMode&&(a.x=o.PositionAndShape.RelativePosition.x+o.Measures[0].PositionAndShape.RelativePosition.x)}}for(let u of i.EntriesList){let c=this.rules.TempoExpressionTextAlignment;this.rules.CompactMode&&(c=mt.LeftBottom);let d=this.calculateLabel(o,a,u.label,i.getFontstyleOfFirstEntry(),u.Expression.Placement,this.rules.UnknownTextHeight,c,this.rules.TempoYSpacing);if(u.Expression.ColorXML&&this.rules.ExpressionsUseXMLColor&&(d.ColorXML=u.Expression.ColorXML),u.Expression instanceof Fe){for(let f of o.AbstractExpressions)f instanceof Yi&&(f.SourceExpression.Label,u.Expression.Label);if(new Yi(u.Expression,d).ParentStaffLine||W.default.warn("Adding staffline didn't work"),this.rules.MetronomeMarksDrawn&&u.Expression.TempoType===Wt.metronomeMark){this.createMetronomeMark(u.Expression);continue}}else if(u.Expression instanceof Fi){for(let f of o.AbstractExpressions)f instanceof Yi&&(f.SourceExpression.Label,u.Expression.Label);o.AbstractExpressions.push(new Yi(u.Expression,d))}}}}createMetronomeMark(t){throw Error(this.abstractNotImplementedErrorMessage)}graphicalMeasureCreatedCalculations(t){}clearSystemsAndMeasures(){for(let t=0,i=this.graphicalMusicSheet.MusicPages.length;t<i;++t){let s=this.graphicalMusicSheet.MusicPages[t];for(let r=0,n=s.MusicSystems.length;r<n;++r){let a=s.MusicSystems[r];for(let o=0,l=a.StaffLines.length;o<l;++o){let h=a.StaffLines[o];h.ParentStaff.Visible||h.Measures.clear();for(let u=0,c=h.Measures.length;u<c;++u){let d=h.Measures[u];if(d.FirstInstructionStaffEntry){let f=d.PositionAndShape.ChildElements.indexOf(d.FirstInstructionStaffEntry.PositionAndShape);f>-1&&d.PositionAndShape.ChildElements.splice(f,1),d.FirstInstructionStaffEntry=void 0,d.beginInstructionsWidth=0}if(d.LastInstructionStaffEntry){let f=d.PositionAndShape.ChildElements.indexOf(d.LastInstructionStaffEntry.PositionAndShape);f>-1&&d.PositionAndShape.ChildElements.splice(f,1),d.LastInstructionStaffEntry=void 0,d.endInstructionsWidth=0}}h.Measures=[],h.PositionAndShape.ChildElements=[]}a.StaffLines.length=0,a.PositionAndShape.ChildElements=[]}s.MusicSystems=[],s.PositionAndShape.ChildElements=[]}this.graphicalMusicSheet.MusicPages=[]}handleVoiceEntry(t,i,s,r,n,a,o,l,h,u=void 0,c=void 0){t.StemDirectionXml!==Rt.Undefined&&this.rules.SetWantedStemDirectionByXml&&t.StemDirectionXml!==void 0?t.WantedStemDirection=t.StemDirectionXml:this.calculateStemDirectionFromVoices(t);let d=i.findOrCreateGraphicalVoiceEntry(t);d.octaveShiftValue=l;let f=i.tabStaffEntry,p;f&&(p=f.findOrCreateGraphicalVoiceEntry(t));for(let m=0,g=t.Notes.length;m<g;++m){let b=t.Notes[m];if(!b||c!==void 0&&c.Link!==void 0&&u!==void 0&&u.indexOf(b)>-1)continue;let S;if(t.IsGrace?S=te.symbolFactory.createGraceNote(b,d,n,this.rules,l):(S=te.symbolFactory.createNote(b,d,n,l,this.rules,void 0),te.stafflineNoteCalculator.trackNote(S)),b.Pitch&&this.checkNoteForAccidental(S,s,n,l),this.resetYPositionForLeadSheet(S.PositionAndShape),i.addGraphicalNoteToListAtCorrectYPosition(d,S),S.PositionAndShape.calculateBoundingBox(),this.leadSheet||(b.NoteBeam!==void 0&&b.PrintObject&&(!(b instanceof kn)||this.rules.TabBeamsRendered)&&this.handleBeam(S,b.NoteBeam,o),b.NoteTuplet!==void 0&&b.PrintObject&&this.handleTuplet(S,b.NoteTuplet,a)),p){let E=te.symbolFactory.createNote(b,p,n,l,this.rules,void 0);f.addGraphicalNoteToListAtCorrectYPosition(p,E),E.PositionAndShape.calculateBoundingBox(),this.leadSheet||b.
5NoteTuplet&&this.handleTuplet(E,b.NoteTuplet,a)}}return t.Articulations.length>0&&this.handleVoiceEntryArticulations(t.Articulations,t,i),t.TechnicalInstructions.length>0&&this.handleVoiceEntryTechnicalInstructions(t.TechnicalInstructions,t,i),t.LyricsEntries.size()>0&&this.handleVoiceEntryLyrics(t,i,r),t.OrnamentContainer&&this.handleVoiceEntryOrnaments(t.OrnamentContainer,t,i),l}resetYPositionForLeadSheet(t){this.leadSheet&&(t.RelativePosition=new k(t.RelativePosition.x,0))}layoutVoiceEntries(t,i){if(t.PositionAndShape.RelativePosition=new k(0,0),!this.leadSheet)for(let s of t.graphicalVoiceEntries){let r=s.notes;if(r.length===0)continue;let n=r[0].sourceNote.ParentVoiceEntry,a=r[0].sourceNote.Pitch!==void 0;this.layoutVoiceEntry(n,r,t,a)}}maxInstrNameLabelLength(){let t=0;for(let i of this.graphicalMusicSheet.ParentMusicSheet.Instruments)if(i.NameLabel?.print&&i.Voices.length>0&&i.Voices[0].Visible){let s=i.NameLabel;this.rules.RenderPartNames||(s=new Nt("",s.textAlignment,s.font));let r=new pe(s,this.rules.InstrumentLabelTextHeight,mt.LeftCenter,this.rules);r.setLabelPositionAndShapeBorders(),t=Math.max(t,r.PositionAndShape.MarginSize.width)}return this.rules.RenderPartNames?t:0}calculateSheetLabelBoundingBoxes(){let t=this.graphicalMusicSheet.ParentMusicSheet,i=this.rules.DefaultColorTitle;if(t.Title!==void 0&&this.rules.RenderTitle){let s=new pe(t.Title,this.rules.SheetTitleHeight,mt.CenterBottom,this.rules);s.Label.IsCreditLabel=!0,s.Label.colorDefault=i,this.graphicalMusicSheet.Title=s,s.setLabelPositionAndShapeBorders()}else this.rules.RenderTitle||(this.graphicalMusicSheet.Title=void 0);if(t.Subtitle!==void 0&&this.rules.RenderSubtitle){let s=new pe(t.Subtitle,this.rules.SheetSubtitleHeight,mt.CenterCenter,this.rules);s.Label.IsCreditLabel=!0,s.Label.colorDefault=i,this.graphicalMusicSheet.Subtitle=s,s.setLabelPositionAndShapeBorders()}else this.rules.RenderSubtitle||(this.graphicalMusicSheet.Subtitle=void 0);if(t.Composer!==void 0&&this.rules.RenderComposer){let s=new pe(t.Composer,this.rules.SheetComposerHeight,mt.RightCenter,this.rules);s.Label.IsCreditLabel=!0,s.Label.colorDefault=i,this.graphicalMusicSheet.Composer=s,s.setLabelPositionAndShapeBorders()}else this.rules.RenderComposer||(this.graphicalMusicSheet.Composer=void 0);if(t.Lyricist!==void 0&&this.rules.RenderLyricist){let s=new pe(t.Lyricist,this.rules.SheetAuthorHeight,mt.LeftCenter,this.rules);s.Label.IsCreditLabel=!0,s.Label.colorDefault=i,this.graphicalMusicSheet.Lyricist=s,s.setLabelPositionAndShapeBorders()}else this.rules.RenderLyricist||(this.graphicalMusicSheet.Lyricist=void 0);if(t.Copyright!==void 0&&this.rules.RenderCopyright){let s=new pe(t.Copyright,this.rules.SheetCopyrightHeight,mt.CenterBottom,this.rules);s.Label.IsCreditLabel=!0,s.Label.colorDefault=i,this.graphicalMusicSheet.Copyright=s,s.setLabelPositionAndShapeBorders()}else this.rules.RenderCopyright||(this.graphicalMusicSheet.Copyright=void 0)}checkMeasuresForWholeRestNotes(){for(let t=0,i=this.musicSystems.length;t<i;++t){let s=this.musicSystems[t];for(let r=0,n=s.StaffLines.length;r<n;++r){let a=s.StaffLines[r];for(let o=0,l=a.Measures.length;o<l;++o){let h=a.Measures[o];if(h.staffEntries.length===1){let u=h.staffEntries[0];if(u.graphicalVoiceEntries.length>0&&u.graphicalVoiceEntries[0].notes.length===1){let c=u.graphicalVoiceEntries[0].notes[0];!c.sourceNote.Pitch&&new N(1,2).lt(c.sourceNote.Length)&&this.layoutMeasureWithWholeRest(c,u,h)}}}}}}optimizeRestNotePlacement(t,i){if(t.graphicalVoiceEntries.length===0)return;let s=t.graphicalVoiceEntries[0].notes;if(s.length===0)return;let r=s[0],n=r.sourceNote.isRest();if(t.graphicalVoiceEntries.length===2){let a=!1,o=t.graphicalVoiceEntries[1].notes;o.length>0&&(a=o[0].sourceNote.isRest()),n&&a?this.calculateTwoRestNotesPlacementWithCollisionDetection(t):(n||a)&&this.calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(t)}else if(n&&t!==i.staffEntries[0]&&t!==i.staffEntries[i.staffEntries.length-1]){let a=i.staffEntries.indexOf(t),o=i.staffEntries[a-1],l=i.staffEntries[a+1];if(o.graphicalVoiceEntries.length===1){let h=o.graphicalVoiceEntries[0].notes[0];if(h.sourceNote.NoteBeam!==void 0&&l.graphicalVoiceEntries.length===1){let u=l.graphicalVoiceEntries[0].notes[0];u.sourceNote.NoteBeam!==void 0&&h.sourceNote.NoteBeam===u.sourceNote.NoteBeam&&(this.calculateRestNotePlacementWithinGraphicalBeam(t,r,h,l,u),t.PositionAndShape.calculateBoundingBox())}}}}getRelativePositionInStaffLineFromTimestamp(t,i,s,r,n=0,a=!1){let o=new k,l,h,u=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,c=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(t),d=Math.min(Math.floor(c),u-1),f=Math.min(Math.ceil(c),u-1);if(d<0||i<0)return o;if(l=this.getFirstLeftNotNullStaffEntryFromContainer(d,i,r),h=this.getFirstRightNotNullStaffEntryFromContainer(f,i,r),l&&h){let p=l.parentMeasure.PositionAndShape.RelativePosition.x;n>0&&(p=n);let m=l.PositionAndShape.RelativePosition.x+p,g=h.PositionAndShape.RelativePosition.x+h.parentMeasure.PositionAndShape.RelativePosition.x,b=t.RealValue>h.getAbsoluteTimestamp().RealValue;n>0?g=h.PositionAndShape.RelativePosition.x+p:a&&(l.getAbsoluteTimestamp().RealValue===t.RealValue||b)&&(m=l.PositionAndShape.RelativePosition.x+l.PositionAndShape.BorderLeft+p,g=m);let S=0;if(l!==h){let E=l.getAbsoluteTimestamp(),y=h.getAbsoluteTimestamp();S=N.minus(t,E).RealValue/N.minus(y,E).RealValue}l.parentMeasure.ParentStaffLine!==h.parentMeasure.ParentStaffLine&&(l.parentMeasure.ParentStaffLine===s?g=s.PositionAndShape.Size.width:m=s.PositionAndShape.RelativePosition.x),o=new k(m+(g-m)*S,0)}return o}getRelativeXPositionFromTimestamp(t){let i=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,s=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(t),r=Math.max(0,Math.min(Math.round(s),i-1)),n=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[r].getFirstNonNullStaffEntry();return n.PositionAndShape.RelativePosition.x+n.parentMeasure.PositionAndShape.RelativePosition.x}calculatePageLabels(t){this.rules.RenderSingleHorizontalStaffline&&(t.PositionAndShape.calculateBoundingBox([Ni.name]),this.graphicalMusicSheet.ParentMusicSheet.pageWidth=t.PositionAndShape.Size.width);let i=10,s=-1;if(t.MusicSystems.length>0){let h=t.MusicSystems[0];i=h.PositionAndShape.RelativePosition.y+h.PositionAndShape.BorderTop;let u=t.MusicSystems[t.MusicSystems.length-1];s=u.PositionAndShape.RelativePosition.y+u.PositionAndShape.BorderBottom}let r=this.graphicalMusicSheet.Title;if(r&&this.rules.RenderTitle){r.PositionAndShape.Parent=t.PositionAndShape;let h=new k;h.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,this.rules.RenderSingleHorizontalStaffline&&(h.x=Math.max(h.x,r.PositionAndShape.Size.width)),h.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight,r.PositionAndShape.RelativePosition=h,t.Labels.push(r)}if(this.graphicalMusicSheet.Subtitle&&this.rules.RenderTitle&&this.rules.RenderSubtitle){let h=this.graphicalMusicSheet.Subtitle;h.PositionAndShape.Parent=t.PositionAndShape;let u=new k;u.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,this.rules.RenderSingleHorizontalStaffline&&(u.x=r.PositionAndShape.RelativePosition.x),u.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight+this.rules.SheetMinimumDistanceBetweenTitleAndSubtitle;let c=h.TextLines?.length;c>1&&(u.y+=h.PositionAndShape.BorderBottom*(c-1)/c),h.PositionAndShape.RelativePosition=u,t.Labels.push(h)}let n=this.graphicalMusicSheet.Composer,a;if(n&&this.rules.RenderComposer){n.PositionAndShape.Parent=t.PositionAndShape,n.set
5LabelPositionAndShapeBorders();let h=new k;h.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageRightMargin,h.y=i,h.y-=this.rules.SystemComposerDistance;let u=n.TextLines?.length;u>1&&(h.y-=n.PositionAndShape.BorderBottom*(u-1)/u),a=h.y,n.PositionAndShape.RelativePosition=h,t.Labels.push(n)}let o=this.graphicalMusicSheet.Lyricist;if(o&&this.rules.RenderLyricist){o.PositionAndShape.Parent=t.PositionAndShape,o.setLabelPositionAndShapeBorders();let h=new k;h.x=this.rules.PageLeftMargin,h.y=i,h.y-=this.rules.SystemLyricistDistance,h.y+=o.PositionAndShape.BorderBottom,h.y=Math.min(h.y,a??2**53-1),o.PositionAndShape.RelativePosition=h,t.Labels.push(o)}let l=this.graphicalMusicSheet.Copyright;if(l&&this.rules.RenderCopyright){l.PositionAndShape.Parent=t.PositionAndShape,l.setLabelPositionAndShapeBorders();let h=new k;h.x=t.PositionAndShape.Size.width/2,h.y=s+this.rules.SheetCopyrightMargin,h.y-=l.PositionAndShape.BorderTop,l.PositionAndShape.RelativePosition=h,t.Labels.push(l)}this.rules.RenderSingleHorizontalStaffline&&(t.PositionAndShape.calculateBoundingBox([Ni.name]),this.graphicalMusicSheet.ParentMusicSheet.pageWidth=t.PositionAndShape.Size.width)}createGraphicalTies(){for(let t=0;t<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;t++){let i=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[t];for(let s=0;s<i.CompleteNumberOfStaves;s++)for(let r=0;r<i.VerticalSourceStaffEntryContainers.length;r++){let n=i.VerticalSourceStaffEntryContainers[r].StaffEntries[s];if(n){let a=this.graphicalMusicSheet.findGraphicalStaffEntryFromMeasureList(s,t,n);a&&(a.GraphicalTies.clear(),a.ties.clear());for(let o=0,l=n.VoiceEntries.length;o<l;++o){let h=n.VoiceEntries[o];for(let u=0,c=h.Notes.length;u<c;++u){let d=h.Notes[u];if(d.NoteTie){let f=d.NoteTie;if(d===d.NoteTie.Notes.last())continue;if(a)for(let p of a.GraphicalTies)p.Tie;this.handleTie(f,a,s,t)}}}this.setTieDirections(a)}}}}handleTie(t,i,s,r){if(!i)return;i.ties.push(t);let n=i,a,o,l;for(let h=1;h<t.Notes.length;h++)if(a=n.findTieGraphicalNoteFromNote(t.Notes[h-1]),o=this.graphicalMusicSheet.GetGraphicalFromSourceStaffEntry(t.Notes[h].ParentStaffEntry),o){if(l=o.findTieGraphicalNoteFromNote(t.Notes[h]),a!==void 0&&l!==void 0&&o){if(!a.sourceNote.PrintObject||!l.sourceNote.PrintObject)continue;let u=this.createGraphicalTie(t,n,o,a,l);n.GraphicalTies.push(u),this.staffEntriesWithGraphicalTies.indexOf(n)>=0&&this.staffEntriesWithGraphicalTies.push(n)}n=o}}setTieDirections(t){if(!t)return;let i=t.ties;if(i.length===1){let s=i[0];if(s.TieDirection===C.NotYetDefined){let r=s.Notes[0].ParentVoiceEntry.ParentVoice.VoiceId;(r===2||r===6)&&(s.TieDirection=C.Below)}}if(i.length>1){let s;for(let r of i){let n=r.Notes[0];(!s||n.Pitch.getHalfTone()>s.Pitch.getHalfTone())&&(s=n)}for(let r of i)r.TieDirection===C.NotYetDefined&&(r.Notes[0]===s?r.TieDirection=C.Above:r.TieDirection=C.Below)}}createAccidentalCalculators(){let t=[],i=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(i){let s=this.graphicalMusicSheet.ParentMusicSheet.Transpose;for(let r=0;r<i.CompleteNumberOfStaves;r++){let n=new yo;if(t.push(n),n.Transpose=s,i.FirstInstructionsStaffEntries[r])for(let a=0,o=i.FirstInstructionsStaffEntries[r].Instructions.length;a<o;++a){let l=i.FirstInstructionsStaffEntries[r].Instructions[a];if(l instanceof ye){let h=l,u=new ye(h.Parent,h.keyTypeOriginal,h.Mode),c=this.graphicalMusicSheet.ParentMusicSheet.Staves[r];s!==0&&c?.ParentInstrument?.MidiInstrumentId!==lt.Percussion&&te.transposeCalculator&&te.transposeCalculator.transposeKey(u,s),n.ActiveKeyInstruction=u}}}}return t}calculateVerticalContainersList(){let t=this.graphicalMusicSheet.MeasureList[0].length;for(let i=0;i<this.graphicalMusicSheet.MeasureList.length;i++)for(let s=0;s<t;s++){let r=this.graphicalMusicSheet.MeasureList[i][s];if(r)for(let n=0,a=r.staffEntries.length;n<a;++n){let o=r.staffEntries[n],l=this.graphicalMusicSheet.getOrCreateVerticalContainer(o.getAbsoluteTimestamp());l&&(l.StaffEntries[s]=o,o.parentVerticalContainer=l)}}}setIndicesToVerticalGraphicalContainers(){for(let t=0;t<this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length;t++)this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t].Index=t}createGraphicalMeasuresForSourceMeasure(t,i,s,r,n){this.initGraphicalMeasuresCreation();let a=[],o=[],l=[],h=[],u=!0;for(let c=0;c<t.CompleteNumberOfStaves;c++){let d=this.createGraphicalMeasure(t,l,o,i[c],n,r,s,c,h);u=u&&d.hasOnlyRests,a.push(d)}return t.allRests=u,t.VerticalMeasureList=a,a}createGraphicalMeasure(t,i,s,r,n,a,o,l,h){let u=this.graphicalMusicSheet.ParentMusicSheet.getStaffFromIndex(l),c;if(n[l].ClefType===yt.TAB||u.isTab)u.isTab=!0,c=te.symbolFactory.createTabStaffMeasure(t,u);else if(t.multipleRestMeasures&&this.rules.RenderMultipleRestMeasures)c=te.symbolFactory.createMultiRestMeasure(t,u);else{if(t.multipleRestMeasureNumber>1)return;c=te.symbolFactory.createGraphicalMeasure(t,u)}if(c.hasError=t.getErrorInMeasure(l),t.FirstInstructionsStaffEntries[l])for(let f=0,p=t.FirstInstructionsStaffEntries[l].Instructions.length;f<p;++f){let m=t.FirstInstructionsStaffEntries[l].Instructions[f];if(m instanceof ye){let g=new ye(m.Parent,m.keyTypeOriginal,m.Mode),b=c.getTransposedHalftones();b!==0&&te.transposeCalculator===void 0&&W.default.info("[OSMD] transpose requested, but Trans
5poseCalculator undefined. Use osmd.TransposeCalculator = new TransposeCalculator()"),b!==0&&c.ParentStaff.ParentInstrument.MidiInstrumentId!==lt.Percussion&&te.transposeCalculator&&te.transposeCalculator.transposeKey(g,b),r.ActiveKeyInstruction=g}}let d=[];for(let f=0,p=t.StaffLinkedExpressions[l].length;f<p;++f){let m=t.StaffLinkedExpressions[l][f],g;if(m.OctaveShiftStart?g=m.OctaveShiftStart:m.OctaveShiftEnd&&(g=m.OctaveShiftEnd),g){d.push(m);let b=g,S=b?.ParentEndMultiExpression?.AbsoluteTimestamp;b?.ParentEndMultiExpression||(S=N.plus(t.AbsoluteTimestamp,t.Duration)),a[l]=new So(b,b.ParentStartMultiExpression.AbsoluteTimestamp,S)}}for(let f=0;f<t.VerticalSourceStaffEntryContainers.length;f++){let p=t.VerticalSourceStaffEntryContainers[f].StaffEntries[l];if(p){for(let S=0,E=p.Instructions.length;S<E;++S){let y=p.Instructions[S];y instanceof Zt&&n[l]?.ClefType!==yt.TAB&&(n[l]=y)}let m=te.symbolFactory.createStaffEntry(p,c);f<c.staffEntries.length?c.addGraphicalStaffEntryAtTimestamp(m):c.addGraphicalStaffEntry(m);let g=[];p.Link&&(p.findLinkedNotes(g),this.handleStaffEntryLink(m,h));let b=se.NONE;if(a[l]&&a[l].getAbsoluteStartTimestamp.lte(p.AbsoluteTimestamp)&&p.AbsoluteTimestamp.lte(a[l].getAbsoluteEndTimestamp)&&(b=a[l].getOpenOctaveShift.Type),b===se.NONE)for(let S of d){let E;if(S.OctaveShiftStart?E=S.OctaveShiftStart:S.OctaveShiftEnd&&(E=S.OctaveShiftEnd),E?.ParentStartMultiExpression?.AbsoluteTimestamp.lte(p.AbsoluteTimestamp)&&!E.ParentEndMultiExpression?.AbsoluteTimestamp.lt(p.AbsoluteTimestamp)){b=E.Type;break}}for(let S=0,E=p.VoiceEntries.length;S<E;++S){let y=p.VoiceEntries[S];b=this.handleVoiceEntry(y,m,r,o,n[l],i,s,b,l,g,p)}for(let S of p.Instructions)if(S instanceof Zt){te.symbolFactory.createInStaffClef(m,S);break}this.rules.RenderChordSymbols&&p.ChordContainers?.length>0&&(p.ParentStaff.ParentInstrument.HasChordSymbols=!0,te.symbolFactory.createChordSymbols(p,m,r.ActiveKeyInstruction,this.graphicalMusicSheet.ParentMusicSheet.Transpose))}}if(r.doCalculationsAtEndOfMeasure(),t.LastInstructionsStaffEntries[l]){let f=t.LastInstructionsStaffEntries[l];for(let p=0,m=f.Instructions.length;p<m;++p){let g=f.Instructions[p];g instanceof Zt&&n[l]?.ClefType!==yt.TAB&&(n[l]=g)}}for(let f=0,p=t.StaffLinkedExpressions[l].length;f<p;++f){let m=t.StaffLinkedExpressions[l][f];m.OctaveShiftEnd!==void 0&&a[l]!==void 0&&m.OctaveShiftEnd===a[l].getOpenOctaveShift&&(a[l]=void 0)}for(let f of c.staffEntries)for(let p of f.graphicalVoiceEntries)this.setBeamNotesWantedStemDirections(p.parentVoiceEntry);if(this.rules.FillEmptyMeasuresWithWholeRest>=1&&c.staffEntries.length===0){let f=new be(new bs(c.parentSourceMeasure,c.parentSourceMeasure.AbsoluteTimestamp,c.parentSourceMeasure.CompleteNumberOfStaves),u);if(u.Voices.length===0){let y=new Rs(c.ParentStaff.ParentInstrument,-1);u.Voices.push(y)}let p=new As(new N(0,1),u.Voices[0],f),m=t.Duration;m.RealValue===0&&(m=t.ActiveTimeSignature.clone());let g=new Di(p,f,m,void 0,t,!0);g.IsWholeMeasureRest=!0,g.PrintObject=this.rules.FillEmptyMeasuresWithWholeRest===An.YesVisible,p.Notes.push(g);let b=te.symbolFactory.createStaffEntry(f,c);c.addGraphicalStaffEntry(b),b.relInMeasureTimestamp=p.Timestamp;let S=te.symbolFactory.createVoiceEntry(p,b);b.graphicalVoiceEntries.push(S);let E=te.symbolFactory.createNote(g,S,new Zt,se.NONE,this.rules);te.stafflineNoteCalculator.trackNote(E),S.notes.push(E)}c.hasOnlyRests=!0;for(let f of c.staffEntries)if(c.hasOnlyRests=f.hasOnlyRests(),!c.hasOnlyRests)break;return c}checkNoteForAccidental(t,i,s,r){let n=t.sourceNote.Pitch,a=t.parentVoiceEntry.parentStaffEntry.parentMeasure.getTransposedHalftones();a!==0&&t.sourceNote.ParentStaffEntry.ParentStaff.ParentInstrument.MidiInstrumentId!==lt.Percussion?(n=t.Transpose(i.ActiveKeyInstruction,s,a,r),t.sourceNote.TransposedPitch=n):t.sourceNote.TransposedPitch=void 0,t.sourceNote.halfTone=n.getHalfTone(),i.checkAccidental(t,n)}handleStaffEntries(t){for(let i=0,s=this.graphicalMusicSheet.MeasureList.length;i<s;++i){let r=this.graphicalMusicSheet.MeasureList[i];for(let n=0,a=r.length;n<a;++n){let o=r[n];if(o){this.rules.PercussionOneLineCutoff>0&&!this.rules.PercussionUseCajon2NoteSystem&&t[n]&&(this.rules.PercussionOneLineCutoff===-1||te.stafflineNoteCalculator.getStafflineUniquePositionCount(n)<this.rules.PercussionOneLineCutoff)&&(o.ParentStaff.StafflineCount=1);for(let l of o.staffEntries)l.parentMeasure!==void 0&&l.graphicalVoiceEntries.length>0&&l.graphicalVoiceEntries[0].notes.length>0&&(this.layoutVoiceEntries(l,n),this.layoutStaffEntry(l));this.graphicalMeasureCreatedCalculations(o)}}}}async calculateSkyBottomLinesAsync(t){this.calculateSkyBottomLines(),await t()}calculateSkyBottomLines(){}calculateExpressionAlignements(){}calculateStaffEntryArticulationMarks(){for(let t=0,i=this.musicSystems.length;t<i;++t){let s=this.musicSystems[t];for(let r=0,n=s.StaffLines.length;r<n;++r){let a=s.StaffLines[r];for(let o=0,l=a.Measures.length;o<l;++o){let h=a.Measures[o];for(let u=0,c=h.staffEntries.length;u<c;++u){let d=h.staffEntries[u];for(let f=0,p=d.sourceStaffEntry.VoiceEntries.length;f<p;++f){let m=d.sourceStaffEntry.VoiceEntries[f];m.Articulations.length>0&&this.layoutArticulationMarks(m.Articulations,m,d)}}}}}}calculateOrnaments(){for(let t=0,i=this.musicSystems.length;t<i;++t){let s=this.musicSystems[t];for(let r=0,n=s.StaffLines.length;r<n;++r){let a=s.StaffLines[r];for(let o=0,l=a.Measures.length;o<l;++o){let h=a.Measures[o];for(let u=0,c=h.staffEntries.length;u<c;++u){let d=h.staffEntries[u];for(let f=0,p=d.sourceStaffEntry.VoiceEntries.length;f<p;++f){let m=d.sourceStaffEntry.VoiceEntries[f];if(m.OrnamentContainer){if(m.hasTie()&&!d.relInMeasureTimestamp.Equals(m.Timestamp))continue;this.layoutOrnament(m.OrnamentContainer,m,d),this.staffEntriesWithOrnaments.indexOf(d)===-1&&this.staffEntriesWithOrnaments.push(d)}}}}}}}getFingeringPlacement(t){let i=this.rules.FingeringPosition;return(i===C.NotYetDefined||i===C.AboveOrBelow)&&(i=t.isUpperStaffOfInstrument()?C.Above:C.Below),i}calculateFingerings(){if(!(this.rules.FingeringPosition===C.Left||this.rules.FingeringPosition===C.Right))for(let t of this.musicSystems)for(let i of t.StaffLines)for(let s of i.Measures){if
5(s.isTabMeasure&&!this.rules.TabFingeringsRendered)continue;let r=this.getFingeringPlacement(s);for(let n of s.staffEntries){n.FingeringEntries=[];let a=i.SkyBottomLineCalculator,o=n.PositionAndShape.RelativePosition.x+s.PositionAndShape.RelativePosition.x,l=[];for(let h of n.graphicalVoiceEntries)if(!h.parentVoiceEntry.IsGrace)for(let u of h.parentVoiceEntry.TechnicalInstructions)u.type===xs.Fingering&&l.push(u);if(l.length>0){r===C.Below&&l.reverse();let h;for(let u of n.graphicalVoiceEntries)for(let c of u.notes)(!h||c.sourceNote.Pitch?.getHalfTone()>h.Pitch?.getHalfTone())&&(h=c.sourceNote);l[0].sourceNote===h&&r===C.Above&&l.reverse()}for(let h=0;h<l.length;h++){let u=l[h],c=r===C.Above?mt.CenterBottom:mt.CenterTop,d=new Nt(u.value,c),f=new pe(d,this.rules.FingeringTextSize,d.textAlignment,this.rules,i.PositionAndShape);u.fontFamily&&(d.fontFamily=u.fontFamily);let p=o+f.PositionAndShape.BorderMarginLeft,m=o+f.PositionAndShape.BorderMarginRight,g;g=r===C.Above?a.getSkyLineMinInRange(p,m):a.getBottomLineMaxInRange(p,m);let b=0;h===0?(b+=this.rules.FingeringOffsetY,r===C.Above&&(b+=.1)):b+=this.rules.FingeringPaddingY,r===C.Above&&(b*=-1),f.PositionAndShape.RelativePosition.y+=g+b,f.PositionAndShape.RelativePosition.x=o,f.setLabelPositionAndShapeBorders(),f.PositionAndShape.calculateBoundingBox(),n.FingeringEntries.push(f);let S=f.PositionAndShape.RelativePosition.x+f.PositionAndShape.BorderLeft,E=S-f.PositionAndShape.BorderLeft+f.PositionAndShape.BorderRight;r===C.Above?a.updateSkyLineInRange(S,E,f.PositionAndShape.RelativePosition.y+f.PositionAndShape.BorderTop):r===C.Below&&a.updateBottomLineInRange(S,E,f.PositionAndShape.RelativePosition.y+f.PositionAndShape.BorderBottom)}}}}optimizeRestPlacement(){for(let t=0,i=this.musicSystems.length;t<i;++t){let s=this.musicSystems[t];for(let r=0,n=s.StaffLines.length;r<n;++r){let a=s.StaffLines[r];for(let o=0,l=a.Measures.length;o<l;++o){let h=a.Measures[o];for(let u=0,c=h.staffEntries.length;u<c;++u){let d=h.staffEntries[u];this.optimizeRestNotePlacement(d,h)}}}}}calculateTwoRestNotesPlacementWithCollisionDetection(t){let i=t.graphicalVoiceEntries[0].notes[0],s=t.graphicalVoiceEntries[1].notes[0];s.PositionAndShape.RelativePosition=new k(0,2.5),t.PositionAndShape.calculateAbsolutePositionsRecursiveWithoutTopelement(),i.PositionAndShape.computeNonOverlappingPositionWithMargin(t.PositionAndShape,re.Up,new k(0,s.PositionAndShape.RelativePosition.y));let r=i.PositionAndShape.RelativePosition;--r.y,i.PositionAndShape.RelativePosition=r,t.PositionAndShape.calculateBoundingBox()}calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(t){let i,s;t.graphicalVoiceEntries[0].notes[0].sourceNote.isRest()?(i=t.graphicalVoiceEntries[0].notes[0],s=t.graphicalVoiceEntries[1].notes):(s=t.graphicalVoiceEntries[0].notes,i=t.graphicalVoiceEntries[1].notes[0]);let r=!1;t.PositionAndShape.calculateAbsolutePositionsRecursiveWithoutTopelement();for(let n=0,a=s.length;n<a;++n){let o=s[n];if(i.PositionAndShape.marginCollisionDetection(o.PositionAndShape)){r=!0;break}}if(r)if(i.sourceNote.ParentVoiceEntry.ParentVoice instanceof ki){let n=s[0].PositionAndShape.BorderMarginBottom+s[0].PositionAndShape.RelativePosition.y;i.PositionAndShape.RelativePosition=new k(0,n-i.PositionAndShape.BorderMarginTop+.5)}else{let n=s[s.length-1],a=n.PositionAndShape.BorderMarginTop+n.PositionAndShape.RelativePosition.y;if(s[0].sourceNote.ParentVoiceEntry.ParentVoice instanceof ki)i.PositionAndShape.RelativePosition=new k(0,a-i.PositionAndShape.BorderMarginBottom-.5);else{let o=s[0].PositionAndShape.BorderMarginBottom+s[0].PositionAndShape.RelativePosition.y;o<2?i.PositionAndShape.RelativePosition=new k(0,o-i.PositionAndShape.BorderMarginTop+.5):i.PositionAndShape.RelativePosition=new k(0,a-i.PositionAndShape.BorderMarginBottom-0)}}t.PositionAndShape.calculateBoundingBox()}calculateTieCurves(){for(let t of this.musicSystems)for(let i of t.StaffLines)for(let s of i.Measures)for(let r of s.staffEntries)for(let n of r.GraphicalTies)if(n.StartNote!==void 0&&n.StartNote.parentVoiceEntry.parentStaffEntry===r){let a=n.StartNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine!==n.EndNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine;this.layoutGraphicalTie(n,a,s.ParentStaff.isTab)}}calculateLyricsPosition(){let t=new We.Dictionary;for(let i=0,s=this.graphicalMusicSheet.ParentMusicSheet.Instruments.length;i<s;++i){let r=this.graphicalMusicSheet.ParentMusicSheet.Instruments[i];r.HasLyrics&&r.LyricVersesNumbers.length>0&&r.LyricVersesNumbers.sort()}for(let i=0,s=this.musicSystems.length;i<s;++i){let r=this.musicSystems[i];for(let n=0,a=r.StaffLines.length;n<a;++n){let o=r.StaffLines[n],l=this.calculateSingleStaffLineLyricsPosition(o,o.ParentStaff.ParentInstrument.LyricVersesNumbers);t.setValue(o,l),this.calculateLyricsExtendsAndDashes(t.getValue(o))}}for(let i=0,s=this.musicSystems.length;i<s;++i){let r=this.musicSystems[i];for(let n=0,a=r.StaffLines.length;n<a;++n){let o=r.StaffLines[n];this.calculateLyricsExtendsAndDashes(t.getValue(o))}}}calculateSingleLyricWord(t){let i=t.ParentLyricWord,s=i.GraphicalLyricsEntries.indexOf(t),r;if(s>=0&&(r=i.GraphicalLyricsEntries[s+1]),!r)return;let n=t.StaffEntryParent.parentMeasure.ParentStaffLine,a=r.StaffEntryParent.parentMeasure.ParentStaffLine,o=t.StaffEntryParent,l=r.StaffEntryParent;if(t.StaffEntryParent.parentMeasure.ParentStaffLine===r.StaffEntryParent.parentMeasure.ParentStaffLine){let h=o.parentMeasure.PositionAndShape.RelativePosition.x+o.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight-t.GraphicalLabel.CenteringXShift,u=l.parentMeasure.PositionAndShape.RelativePosition.x+l.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.RelativePosition.x+r.GraphicalLabel.PositionAndShape.BorderMarginLeft,c=t.GraphicalLabel.PositionAndShape.RelativePosition.y,d=1;u-h>this.rules.MinimumDistanceBetweenDashes*3&&(d=Math.floor((u-h)/this.rules.MinimumDistanceBetweenDashes)-1),d===1?this.calculateSingleDashForLyricWord(n,h,u,c):this.calculateDashes(n,h,u,c)}else{let h=o.parentMeasure.PositionAndShape.RelativePosition.x+o.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,u=n.Measures[n.Measures.length-1],c=u.PositionAndShape.RelativePosition.x+u.PositionAndShape.Size.width,d=t.GraphicalLabel.PositionAndShape.RelativePosition.y;if(this.calculateDashes(n,h,c,d),a&&a.Measures[0]&&l.parentMeasure.ParentStaffLine&&!(l===l.parentMeasure.staffEntries[0]&&l.parentMeasure===l.parentMeasure.ParentStaffLine.Measures[0])){let f=a.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,p=l.parentMeasure.PositionAndShape.RelativePosition.x+l.PositionAndShape.RelativePosition.x+r.GraphicalLabel.PositionAndShape.BorderMarginLeft;d=r.GraphicalLabel.PositionAndShape.RelativePosition.y,this.calculateDashes(a,f,p,d)}}}calculateDashes(t,i,s,r){let n=s-i;if(n<this.rules.MinimumDistanceBetweenDashes*3)this.calculateSingleDashForLyricWord(t,i,s,r);else{let a=Math.floor(n/this.rules.MinimumDistanceBetweenDashes)-1,o=n/(a+1),l=0;for(i+=o,s-=o;l<=Math.floor(a/2)&&s>i;)n=this.calculateRightAndLeftDashesForLyricWord(t,i,s,r),i+=o,s-=o,l++;n>o*2&&this.calculateSingleDashForLyricWord(t,i,s,r)}}calculateSingleDashForLyricWord(t,i,s,r){let n=new Nt("-");n.colorDefault=this.rules.DefaultColorLyrics;let a=this.rules.LyricsHeight;s-i<.8&&(a*=.8,r-=.1*a);let o=new pe(n,a,mt.CenterBottom,this.rules);o.setLabelPositionAndShapeBorders(),t.LyricsDashes.push(o),this.staffLinesWithLyricWords.indexOf(t)===-1&&this.staffLinesWithLyricWords.push(t),o.PositionAndShape.Parent=t.PositionAndShape;let l=new k(i+(s-i)/2,r);o.PositionAndShape.RelativePosition=l}calculateLyricExtend(t){let i=t.GraphicalLabel.PositionAndShape.RelativePosition.y,s=t.StaffEntryParent,r=s.parentMeasure.ParentStaffLine,n,a,o=s.parentMeasure.ParentStaff.idInMusicSheet;for(let l=s.parentVerticalContainer.Index+1;l<this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length;++l){let h=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[l].StaffEntries[o];if(h){if(h.hasOnlyRests()||h.LyricsEntries.length>0)break;n=h,a=n.parentMeasure.ParentStaffLine,a||(a=s.parentMeasure.ParentStaffLine)}}if(!(!n||!a))if(r===a&&n.parentMeasure.ParentStaffLine){let l=s.parentMeasure.PositionAndShape.RelativePosition.x+s.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,h=n.parentMeasure.PositionAndShape.RelativePosition.x+n.PositionAndShape.RelativePosition.x+n.PositionAndShape.BorderMarginRight;i-=t.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(r,l,h,i)}else{let l=r.Measures[r.Measures.length-1].PositionAndShape,h=s.parentMeasure.PositionAndShape.RelativePosition.x+s.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,u=l.RelativePosition.x+l.Size.width;if(i-=t.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(r,h,u,i),!n)return;if(n.parentMeasure.ParentStaffLine&&n.parentMeasure.staffEntries&&!(n===n.parentMeasure.staffEntries[0]&&n.parentMeasure===n.parentMeasure.ParentStaffLine.Measures[0])){let c=a.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,d=n.parentMeasure.PositionAndShape.RelativePosition.x+n.PositionAndShape.RelativePosition.x+n.PositionAndShape.BorderMarginRight;this.calculateSingleLyricWordWithUnderscore(a,c,d,i)}}}calculateSingleLyricWordWithUnderscore(t,i,s,r){let n=new Ae(new k(i,r),new k(s,r),this.rules.LyricUnderscoreLineWidth);n.colorHex=this.rules.DefaultColorLyrics,t.LyricLines.push(n),this.staffLinesWithLyricWords.indexOf(t)===-1&&this.staffLinesWithLyricWords.push(t)}calculateRightAndLeftDashesForLyricWord(t,i,s,r){let n=new Nt("-");n.colorDefault=this.rules.DefaultColorLyrics;let a=new pe(n,this.rules.LyricsHeight,mt.CenterBottom,this.rules);a.setLabelPositionAndShapeBorders(),t.LyricsDashes.push(a),this.staffLinesWithLyricWords.indexOf(t)===-1&&this.staffLinesWithLyricWords.push(t),a.PositionAndShape.Parent=t.PositionAndShape;let o=new k(i,r);a.PositionAndShape.RelativePosition=o;let l=new pe(new Nt("-"),this.rules.LyricsHeight,mt.CenterBottom,this.rules);l.setLabelPositionAndShapeBorders(),t.LyricsDashes.push(l),l.PositionAndShape.Parent=t.PositionAndShape;let h=new k(s,r);return l.PositionAndShape.RelativePosition=h,l.PositionAndShape.RelativePosition.x-a.PositionAndShape.RelativePosition.x}calculateDynamicExpressions(){let t=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex),i=Math.min(this.rules.MinMeasureToDrawIndex,this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length);for(let s=i;s<=t;s++){let r=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[s];this.dynamicExpressionMap.clear();for(let n=0;n<r.StaffLinkedExpressions.length;n++)if(!(!this.graphicalMusicSheet.MeasureList[s]||!this.graphicalMusicSheet.MeasureList[s][n])&&this.graphicalMusicSheet.MeasureList[s][n].ParentStaff.isVisible())for(let a=0;a<r.StaffLinkedExpressions[n].length;a++)(r.StaffLinkedExpressions[n][a].InstantaneousDynamic!==void 0||r.StaffLinkedExpressions[n][a].StartingContinuousDynamic!==void 0&&r.StaffLinkedExpressions[n][a].StartingContinuousDynamic.StartMultiExpression===r.StaffLinkedExpressions[n][a]&&r.StaffLinkedExpressions[n][a].UnknownList.length===0)&&this.calculateDynamicExpressionsForMultiExpression(r.StaffLinkedExpressions[n][a],s,n)}this.dynamicExpressionMap.clear()}calculateOctaveShifts(){for(let t=0;t<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;t++){let i=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[t];for(let s=0;s<i.StaffLinkedExpressions.length;s++)if(!(!this.graphicalMusicSheet.MeasureList[t]||!this.graphicalMusicSheet.MeasureList[t][s])&&this.graphicalMusicSheet.MeasureList[t][s].ParentStaff.isVisible())for(let r=0;r<i.StaffLinkedExpressions[s].length;r++)i.StaffLinkedExpressions[s][r].OctaveShiftStart&&this.calculateSingleOctaveShift(i,i.StaffLinkedExpressions[s][r],t,s)}}calculatePedals(){for(let t=0;t<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;t++){let i=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[t];for(let s=0;s<i.StaffLinkedExpressions.length;s++)if(!(!this.graphicalMusicSheet.MeasureList[t]||!this.graphicalMusicSheet.MeasureList[t][s])&&this.graphicalMusicSheet.MeasureList[t][s].ParentStaff.isVisible())for(let r=0;r<i.StaffLinkedExpressions[s].length;r++)i.StaffLinkedExpressions[s][r].PedalStart&&this.calculateSinglePedal(i,i.StaffLinkedExpressions[s][r],t,s)}}getFirstLeftNotNullStaffEntryFromContainer(t,i,s){if(this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t].StaffEntries[i])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t].StaffEntries[i];for(let r=t-1;r>=0;r--)if(this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[r].StaffEntries[i])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[r].StaffEntries[i]}getFirstRightNotNullStaffEntryFromContainer(t,i,s){if(this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t].StaffEntries[i])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t].StaffEntries[i];for(let r=t+1;r<this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length;r++)if(this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[r].StaffEntries[i])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[r].StaffEntries[i]}calculateWordRepetitionInstructions(){let t=[];for(let i=0;i<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;i++){let s=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[i],r=!1,n=!1,a;for(let o of s.FirstRepetitionInstructions)o.type===J.Ending&&o.alignment===Pt.Begin&&(r=!0,a=o.endingIndices);for(let o of s.LastRepetitionInstructions)o.type===J.Ending&&(o.alignment===Pt.End||o.alignment===Pt.Discontinue)&&(n=!0);r&&t.push({startMeasure:i,endingIndices:a});for(let o=0,l=s.FirstRepetitionInstructions.length;o<l;++o){let h=s.FirstRepetitionInstructions[o];this.calculateWordRepetitionInstruction(h,i)}for(let o=0,l=s.LastRepetitionInstructions.length;o<l;++o){let h=s.LastRepetitionInstructions[o];this.calculateWordRepetitionInstruction(h,i)}if(!r&&!n&&t.length>0){let o=t[t.length-1];if(i>o.startMeasure){let l=new Lt(i,J.Ending,Pt.Mid,void 0,o.endingIndices);this.calculateWordRepetitionInstruction(l,i)}}n&&t.length>0&&t.pop()}}calculateRepetitionEndings(){let t=this.graphicalMusicSheet.ParentMusicSheet;for(let i=0,s=t.Repetitions.length;i<s;++i){let r=t.Repetitions[i];this.calcGraphicalRepetitionEndingsRecursively(r)}}calculateTempoExpressions(){let t=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex),i=this.rules.MinMeasureToDrawIndex;for(let s=i;s<=t;s++){let r=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[s];for(let n=0;n<r.TempoExpressions.length;n++)this.calculateTempoExpressionsForMultiTempoExpression(r,r.TempoExpressions[n],s)}}calculateRehearsalMarks(){if(this.rules.RenderRehearsalMarks)for(let t of this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures)this.calculateRehearsalMark(t)}calculateRehearsalMark(t){throw Error(this.abstractNotImplementedErrorMessage)}calculateMoodAndUnknownExpressions(){for(let t=0;t<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;t++){let i=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[t];for(let s=0;s<i.StaffLinkedExpressions.length;s++){if(!this.graphicalMusicSheet.MeasureList[t]||!this.graphicalMusicSheet.MeasureList[t][s])continue;let r=s;if(!this.graphicalMusicSheet.MeasureList[t][s].ParentStaff.isVisible())if(s===0){let n=!1;for(let a=0;a<this.graphicalMusicSheet.MeasureList[t].length;a++)if(this.graphicalMusicSheet.MeasureList[t][a]?.ParentStaff.isVisible()){r=a,n=!0;break}if(!n)continue}else continue;for(let n=0;n<i.StaffLinkedExpressions[s].length;n++)(i.StaffLinkedExpressions[s][n].MoodList.length>0||i.StaffLinkedExpressions[s][n].UnknownList.length>0)&&this.calculateMoodAndUnknownExpression(i.StaffLinkedExpressions[s][n],t,r)}}}calculateStemDirectionFromVoices(t){if(t.ParentSourceStaffEntry.Link!==void 0)if(t===t.ParentSourceStaffEntry.VoiceEntries[0]){t.WantedStemDirection=Rt
5.Up;return}else{t.WantedStemDirection=Rt.Down;return}else t.ParentVoice instanceof ki?t.WantedStemDirection=Rt.Down:t.ParentSourceStaffEntry.VoiceEntries.length>1&&(t.WantedStemDirection=Rt.Up)}setBeamNotesWantedStemDirections(t){if(!(t.Notes.length>0))return;let i=t.Notes[0].NoteBeam;if(i){for(let s of i.Notes)if(s.Notehead?.Shape!==Vt.NONE&&s.ParentVoiceEntry.WantedStemDirection!==Rt.Undefined&&s.ParentVoiceEntry.ParentSourceStaffEntry.ParentStaff.Id===t.ParentSourceStaffEntry.ParentStaff.Id){t.WantedStemDirection=s.ParentVoiceEntry.WantedStemDirection;break}}}},w=()=>{};w.L=(e,t)=>{if(!t)return;let i=Array.prototype.slice.call(t).join(" ");window.console.log(e+": "+i)},w.MakeException=e=>class extends Error{constructor(t,i){super(t),this.name=e,this.message=t,this.data=i}},w.RuntimeError=class{constructor(e,t){this.code=e,this.message=t}toString(){return"[RuntimeError] "+this.code+":"+this.message}},w.RERR=w.RuntimeError,w.Merge=(e,t)=>{for(let i in t)e[i]=t[i];return e},w.Min=Math.min,w.Max=Math.max,w.forEach=(e,t)=>{for(let i=0;i<e.length;i++)t(e[i],i)},w.RoundN=(e,t)=>e%t>=t/2?parseInt(e/t,10)*t+t:parseInt(e/t,10)*t,w.MidLine=(e,t)=>{let i=t+(e-t)/2;return i%2>0&&(i=w.RoundN(i*10,5)/10),i},w.SortAndUnique=(e,t,i)=>{if(e.length>1){let s=[],r;e.sort(t);for(let n=0;n<e.length;++n)(n===0||!i(e[n],r))&&s.push(e[n]),r=e[n];return s}else return e},w.Contains=(e,t)=>{let i=e.length;for(;i--;)if(e[i]===t)return!0;return!1},w.getCanvasContext=e=>{if(!e)throw new w.RERR("BadArgument","Invalid canvas selector: "+e);let t=document.getElementById(e);if(!(t&&t.getContext))throw new w.RERR("UnsupportedBrowserError","This browser does not support HTML5 Canvas");return t.getContext("2d")},w.drawDot=(e,t,i,s="#55")=>{e.save(),e.setFillStyle(s),e.beginPath(),e.arc(t,i,3,0,Math.PI*2,!0),e.closePath(),e.fill(),e.restore()},w.BM=(e,t)=>{let i=new Date().getTime();t();let s=new Date().getTime()-i;w.L(e+s+"ms")},w.StackTrace=()=>Error().stack,w.W=(...e)=>{let t=e.join(" ");window.console.log("Warning: ",t,w.StackTrace())},w.Prefix=e=>w.Prefix.prefix+e,w.Prefix.prefix="vf-";var ie=class ge{static GCD(t,i){if(typeof t!="number"||typeof i!="number")throw new w.RERR("BadArgument",`Invalid numbers: ${t}, ${i}`);let s;for(;i!==0;)s=i,i=t%i,t=s;return t}static LCM(t,i){return t*i/ge.GCD(t,i)}static LCMM(t){if(t.length===0)return 0;if(t.length===1)return t[0];if(t.length===2)return ge.LCM(t[0],t[1]);{let i=t[0];return t.shift(),ge.LCM(i,ge.LCMM(t))}}constructor(t,i){this.set(t,i)}set(t,i){return this.numerator=t===void 0?1:t,this.denominator=i===void 0?1:i,this}value(){return this.numerator/this.denominator}simplify(){let t=this.numerator,i=this.denominator,s=ge.GCD(t,i);return t/=s,i/=s,i<0&&(i=-i,t=-t),this.set(t,i)}add(t,i){let s,r;t instanceof ge?(s=t.numerator,r=t.denominator):(s=t===void 0?0:t,r=i===void 0?1:i);let n=ge.LCM(this.denominator,r),a=n/this.denominator,o=n/r,l=this.numerator*a+s*o;return this.set(l,n)}subtract(t,i){let s,r;t instanceof ge?(s=t.numerator,r=t.denominator):(s=t===void 0?0:t,r=i===void 0?1:i);let n=ge.LCM(this.denominator,r),a=n/this.denominator,o=n/r,l=this.numerator*a-s*o;return this.set(l,n)}multiply(t,i){let s,r;return t instanceof ge?(s=t.numerator,r=t.denominator):(s=t===void 0?1:t,r=i===void 0?1:i),this.set(this.numerator*s,this.denominator*r)}divide(t,i){let s,r;return t instanceof ge?(s=t.numerator,r=t.denominator):(s=t===void 0?1:t,r=i===void 0?1:i),this.set(this.numerator*r,this.denominator*s)}equals(t){let i=ge.__compareA.copy(t).simplify(),s=ge.__compareB.copy(this).simplify();return i.numerator===s.numerator&&i.denominator===s.denominator}greaterThan(t){let i=ge.__compareB.copy(this);return i.subtract(t),i.numerator>0}greaterThanEquals(t){let i=ge.__compareB.copy(this);return i.subtract(t),i.numerator>=0}lessThan(t){return!this.greaterThanEquals(t)}lessThanEquals(t){return!this.greaterThan(t)}clone(){return new ge(this.numerator,this.denominator)}copy(t){return typeof t=="number"?this.set(t||0,1):this.set(t.numerator,t.denominator)}quotient(){return Math.floor(this.numerator/this.denominator)}fraction(){return this.numerator%this.denominator}abs(){return this.denominator=Math.abs(this.denominator),this.numerator=Math.abs(this.numerator),this}toString(){return this.numerator+"/"+this.denominator}
5toSimplifiedString(){return ge.__tmp.copy(this).simplify().toString()}toMixedString(){let t="",i=this.quotient(),s=ge.__tmp.copy(this);return i<0?s.abs().fraction():s.fraction(),i===0?t=s.numerator===0?"0":s.toSimplifiedString():(t+=i,s.numerator!==0&&(t+=" "+s.toSimplifiedString())),t}parse(t){let i=t.split("/"),s=parseInt(i[0],10),r=i[1]?parseInt(i[1],10):1;return this.set(s,r)}};ie.__compareA=new ie,ie.__compareB=new ie,ie.__tmp=new ie;var wh=w.MakeException("RegistryError");function va(e,t,i,s,r){e[t][i]||(e[t][i]={}),e[t][i][s]=r}var or=class Ui{static get INDEXES(){return["type"]}constructor(){this.clear()}static enableDefaultRegistry(t){Ui.defaultRegistry=t}static getDefaultRegistry(){return Ui.defaultRegistry}static disableDefaultRegistry(){Ui.defaultRegistry=null}clear(){return this.index={id:{},type:{},class:{}},this}updateIndex({id:t,name:i,value:s,oldValue:r}){let n=this.getElementById(t);r!==null&&this.index[i][r]&&delete this.index[i][r][t],s!==null&&va(this.index,i,s,n.getAttribute("id"),n)}register(t,i){if(i=i||t.getAttribute("id"),!i)throw new wh("Can't add element without `id` attribute to registry",t);return t.setAttribute("id",i),va(this.index,"id",i,i,t),Ui.INDEXES.forEach(s=>{this.updateIndex({id:i,name:s,value:t.getAttribute(s),oldValue:null})}),t.onRegister(this),this}getElementById(t){return this.index.id[t]?this.index.id[t][t]:null}getElementsByAttribute(t,i){let s=this.index[t];return s&&s[i]?Object.keys(s[i]).map(r=>s[i][r]):[]}getElementsByType(t){return this.getElementsByAttribute("type",t)}getElementsByClass(t){return this.getElementsByAttribute("class",t)}onUpdate({id:t,name:i,value:s,oldValue:r}){function n(a,o){return a.filter(l=>l===o).length>0}return n(Ui.INDEXES.concat(["id","class"]),i)&&this.updateIndex({id:t,name:i,value:s,oldValue:r}),this}};or.defaultRegistry=null;var fe=class $r{static newID(){return"auto"+$r.ID++}constructor({type:t}={}){this.attrs={id:$r.newID(),el:null,type:t||"Base",classes:{}},this.boundingBox=null,this.context=null,this.rendered=!1,or.getDefaultRegistry()&&or.getDefaultRegistry().register(this)}setStyle(t){return this.style=t,this}getStyle(){return this.style}applyStyle(t=this.context,i=this.getStyle()){return i?(t.save(),i.shadowColor&&t.setShadowColor(i.shadowColor),i.shadowBlur&&t.setShadowBlur(i.shadowBlur),i.fillStyle&&t.setFillStyle(i.fillStyle),i.strokeStyle&&t.setStrokeStyle(i.strokeStyle),i.lineWidth&&t.setLineWidth(i.lineWidth),this):this}restoreStyle(t=this.context,i=this.getStyle()){return i&&t.restore(),this}drawWithStyle(){this.checkContext(),this.applyStyle(),this.draw(),this.restoreStyle()}hasClass(t){return this.attrs.classes[t]===!0}addClass(t){return this.attrs.classes[t]=!0,this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:t,oldValue:null}),this}removeClass(t){return delete this.attrs.classes[t],this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:null,oldValue:t}),this}onRegister(t){return this.registry=t,this}isRendered(){return this.rendered}setRendered(t=!0){return this.rendered=t,this}getAttributes(){return this.attrs}getAttribute(t){return this.attrs[t]}setAttribute(t,i){let s=this.attrs.id,r=this.attrs[t];return this.attrs[t]=i,this.registry&&this.registry.onUpdate({id:s,name:t,value:i,oldValue:r}),this}getContext(){return this.context}setContext(t){return this.context=t,this}getBoundingBox(){return this.boundingBox}checkContext(){if(!this.context)throw new w.RERR("NoContext","No rendering context attached to instance");return this.context}};fe.ID=1e3;var Th=class{constructor(e,t,i,s){this.x1=NaN,this.y1=NaN,this.x2=NaN,this.y2=NaN,this.addPoint(e,t),this.addPoint(i,s)}width(){return this.x2-this.x1}height(){return this.y2-this.y1}addPoint(e,t){e!=null&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),e<this.x1&&(this.x1=e),e>this.x2&&(this.x2=e)),t!=null&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),t<this.y1&&(this.y1=t),t>this.y2&&(this.y2=t))}addX(e){this.addPoint(e,null)}addY(e){this.addPoint(null,e)}addQuadraticCurve(e,t,i,s,r,n){let a=e+.6666666666666666*(i-e),o=t+2/3*(s-t),l=a+1/3*(r-e),h=o+1/3*(n-t);this.addBezierCurve(e,t,a,o,l,h,r,n)}addBezierCurve(e,t,i,s,r,n,a,o){let l=[e,t],h=[i,s],u=[r,n],c=[a,o],d;this.addPoint(l[0],l[1]),this.addPoint(c[0],c[1]);let f=(p,m)=>(1-p)**3*l[m]+3*(1-p)**2*p*h[m]+3*(1-p)*p**2*u[m]+p**3*c[m];for(d=0;d<=1;d++){let p=6*l[d]-12*h[d]+6*u[d],m=-3*l[d]+9*h[d]-9*u[d]+3*c[d],g=3*h[d]-3*l[d];if(m===0){if(p===0)continue;let y=-g/p;0<y&&y<1&&(d===0&&this.addX(f(y,d)),d===1&&this.addY(f(y,d)));continue}let b=p**2-4*g*m;if(b<0)continue;let S=(-p+Math.sqrt(b))/(2*m);0<S&&S<1&&(d===0&&this.addX(f(S,d)),d===1&&this.addY(f(S,d)));let E=(-p-Math.sqrt(b))/(2*m);0<E&&E<1&&(d===0&&this.addX(f(E,d)),d===1&&this.addY(f(E,d)))}}},Sr=class Zr{static copy(t){return new Zr(t.x,t.y,t.w,t.h)}constructor(t,i,s,r){this.x=t,this.y=i,this.w=s,this.h=r}getX(){return this.x}getY(){return this.y}getW(){return this.w}getH(){return this.h}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setW(t){return this.w=t,this}setH(t){return this.h=t,this}move(t,i){this.x+=t,this.y+=i}clone(){return Zr.copy(this)}mergeWith(t,i){let s=t,r=this.x<s.x?this.x:s.x,n=this.y<s.y?this.y:s.y,a=Math.max(this.x+this.w,s.x+s.w)-r,o=Math.max(this.y+this.h,s.y+s.h)-n;return this.x=r,this.y=n,this.w=a,this.h=o,i&&this.draw(i),this}draw(t,i,s){i||(i=0),s||(s=0),t.rect(this.x+i,this.y+s,this.w,this.h),t.stroke()}},Hs
vendor: 128,642 bytes, line 5
5={glyphs:{v0:{x_min:0,x_max:514.5,ha:525,o:"m 236 648 b 246 648 238 648 242 648 b 288 646 261 648 283 648 b 472 513 364 634 428 587 b 514 347 502 464 514 413 b 462 163 514 272 499 217 b 257 44 409 83 333 44 b 50 163 181 44 103 83 b 0 347 14 217 0 272 b 40 513 0 413 12 464 b 236 648 87 591 155 638 m 277 614 b 253 616 273 616 261 616 b 242 616 247 616 243 616 b 170 499 193 609 181 589 b 159 348 163 446 159 398 b 166 222 159 308 161 266 b 201 91 174 138 183 106 b 257 76 215 81 235 76 b 311 91 277 76 299 81 b 347 222 330 106 338 138 b 353 348 352 266 353 308 b 344 499 353 398 351 446 b 277 614 333 587 322 606 m 257 -1 l 258 -1 l 255 -1 l 257 -1 m 257 673 l 258 673 l 255 673 l 257 673 "},v1:{x_min:-1.359375,x_max:344.359375,ha:351,o:"m 126 637 l 129 638 l 198 638 l 266 638 l 269 635 b 274 631 272 634 273 632 l 277 627 l 277 395 b 279 156 277 230 277 161 b 329 88 281 123 295 106 b 344 69 341 81 344 79 b 337 55 344 62 343 59 l 333 54 l 197 54 l 61 54 l 58 55 b 50 69 53 59 50 62 b 65 88 50 79 53 81 b 80 97 72 91 74 93 b 117 156 103 113 112 129 b 117 345 117 161 117 222 l 117 528 l 100 503 l 38 406 b 14 383 24 384 23 383 b -1 398 5 383 -1 390 b 4 415 -1 403 1 409 b 16 437 5 416 10 426 l 72 539 l 100 596 b 121 632 119 631 119 631 b 126 637 122 634 125 635 m 171 -1 l 172 -1 l 170 -1 l 171 -1 m 171 673 l 172 673 l 170 673 l 171 673 "},v2:{x_min:-1.359375,x_max:458.6875,ha:468,o:"m 197 648 b 216 648 201 648 208 648 b 258 646 232 648 253 648 b 419 546 333 637 393 599 b 432 489 428 528 432 509 b 356 342 432 440 405 384 b 235 278 322 313 288 295 b 69 170 166 256 107 217 b 69 169 69 170 69 169 b 69 169 69 169 69 169 b 74 173 69 169 72 170 b 209 222 112 204 163 222 b 310 195 247 222 274 215 b 371 179 332 184 352 179 b 396 181 379 179 387 179 b 428 202 409 184 423 194 b 442 212 431 209 436 212 b 458 197 450 212 458 206 b 441 148 458 190 449 165 b 299 44 409 84 353 44 b 288 45 295 44 292 44 b 250 61 274 45 268 49 b 122 99 212 86 164 99 b 73 91 104 99 88 97 b 28 63 53 84 34 72 b 14 54 25 56 20 54 b 1 62 9 54 4 56 l -1 65 l -1 79 b 0 99 -1 91 0 95 b 2 113 1 102 2 108 b 164 309 20 197 81 272 b 285 470 232 341 277 398 b 287 487 287 476 287 481 b 171 595 287 551 239 595 b 155 595 166 595 160 595 b 142 592 145 594 142 594 b 145 589 142 592 142 591 b 179 527 168 576 179 551 b 132 455 179 496 163 467 b 104 451 122 452 112 451 b 27 530 62 451 27 487 b 29 555 27 538 27 546 b 197 648 44 601 115 639 m 228 -1 l 230 -1 l 227 -1 l 228 -1 m 228 673 l 230 673 l 227 673 l 228 673 "},v3:{x_min:-1.359375,x_max:409.6875,ha:418,o:"m 174 648 b 191 648 176 648 183 648 b 225 648 204 648 220 648 b 402 523 317 638 389 588 b 404 503 404 517 404 510 b 402 484 404 495 404 488 b 264 373 389 437 334 394 b 257 370 259 371 257 371 b 257 370 257 370 257 370 b 264 369 258 370 261 369 b 409 202 359 334 409 267 b 318 72 409 152 381 104 b 200 43 281 52 240 43 b 23 113 134 43 69 68 b 0 169 6 129 0 149 b 77 249 0 210 29 249 l 77 249 b 152 174 125 249 152 212 b 103 102 152 145 137 116 b 103 102 103 102 103 102 b 147 94 103 101 132 95 b 153 94 149 94 151 94 b 265 206 219 94 265 141 b 264 226 265 213 265 219 b 147 355 253 299 204 353 b 126 371 133 356 126 362 b 147 388 126 383 132 388 b 254 474 196 391 238 424 b 259 502 258 484 259 494 b 182 592 259 544 228 582 b 156 595 175 595 166 595 b 115 592 142 595 129 594 l 111 591 l 115 588 b 152 524 141 574 152 549 b 92 449 152 491 130 458 b 76 448 87 448 81 448 b -1 530 32 448 -1 488 b 20 581 -1 548 5 566 b 174 648 55 619 108 641 m 204 -1 l 205 -1 l 202 -1 l 204 -1 m 204 673 l 205 673 l 202 673 l 204 673 "},v4:{x_min:0,x_max:468.21875,ha:478,o:"m 174 637 b 232 638 175 638 189 638 b 277 638 245 638 259 638 l 378 638 l 381 635 b 389 623 386 632 389 627 b 382 609 389 617 386 613 b 366 589 381 606 372 598 l 313 528 l 245 451 l 209 410 l 155 348 l 84 267 b 59 240 72 252 59 240 b 59 240 59 240 59 240 b 151 238 59 238 68 238 l 242 238 l 242 303 b 243 371 242 369 242 370 b 289 426 245 374 254 385 l 303 441 l 317 456 l 338 483 l 360 506 l 371 520 b 386 527 375 526 381 527 b 400 519 392 527 397 524 b 401 440 401 516 401 514 b 401 377 401 423 401 402 l 401 238 l 426 238 b 453 237 449 238 450 238 b 465 217 461 234 465 226 b 460 202 465 212 464 206 b 426 197 454 197 453 197 l 401 197 l 401 180 b 451 88 402 129 412 109 b 468 69 465 81 468 79 b 461 55 468 62 466 59 l 458 54 l 321 54 l 185 54 l 182 55 b 175 69 176 59 175 62 b 191 88 175 79 176 81 b 240 180 230 109 240 129 l 240 197 l 125 197 b 73 195 104 195 87 195 b 8 197 10 195 9 197 b 0 212 2 199 0 205 b 0 212 0 212 0 212 b 20 242 0 219 0 219 b 163 610 104 344 163 492 b 174 637 163 628 166 634 m 234 -1 l 235 -1 l 232 -1 l 234 -1 m 234 673 l 235 673 l 232 673 l 234 673 "},v5:{x_min:0,x_max:409.6875,ha:418,o:"m 47 637 b 53 638 49 638 50 638 b 69 634 55 638 61 637 b 210 610 114 619 161 610 b 363 634 259 610 311 619 b 382 638 372 637 378 638 b 392 634 386 638 389 637 b 397 623 396 630 397 627 b 393 610 397 620 396 616 b 298 505 368 552 338 520 b 212 494 277 498 246 494 b 65 517 163 494 106 502 b 61 517 62 517 61 517 b 61 517 61 517 61 517 b 51 408 61 517 51 412 b 51 408 51 408 51 408 b 51 408 51 408 51 408 b 61 412 53 408 55 409 b 125 434 80 421 103 430 b 185 441 145 440 166 441 b 409 244 310 441 409 353 b 401 191 409 227 406 209 b 197 43 375 105 287 43 b 159 47 183 43 171 44 b 23 123 112 56 61 86 b 0 180 6 140 0 159 b 76 260 0 220 31 260 b 92 259 81 260 87 259 b 152 183 132 251 152 216 b 100 112 152 152 134 122 b 95 111 98 112 95 111 b 95 111 95 111 95 111 b 129 98 95 109 119 101 b 148 97 136 97 141 97 b 264 235 206 97 261 158 b 265 248 265 240 265 244 b 210 398 265 312 243 373 b 179 408 201 406 194 408 b 174 408 178 408 176 408 b 53 369 130 408 88 394 b 34 359 39 359 38 359 b 17 374 24 359 17 365 b 39 628 17 384 38 625 b 47 637 40 631 43 635 m 204 -1 l 205 -1 l 202 -1 l 204 -1 m 204 673 l 205 673 l 202 673 l 204 673 "},v6:{x_min:0,x_max:475.03125,ha:485,o:"m 255 648 b 274 648 259 648 266 648 b 314 646 288 648 307 648 b 450 555 374 637 438 594 b 454 530 453 546 454 538 b 375 451 454 485 416 451 b 328 467 359 451 343 455 b 300 526 310 483 300 503 b 352 598 300 557 319 589 b 356 599 355 598 356 599 b 352 602 356 599 355 601 b 288 616 330 612 308 616 b 210 584 257 616 230 605 b 164 433 189 559 174 508 b 160 374 163 415 160 381 b 160 374 160 374 160 374 b 160 374 160 374 160 374 b 168 377 160 374 164 376 b 258 395 200 390 228 395 b 366 367 294 395 328 387 b 475 223 436 333 475 283 b 472 197 475 215 473 206 b 349 65 462 141 419 95 b 259 43 317 51 288 43 b 167 69 230 43 200 52 b 4 290 80 113 20 195 b 0 349 1 309 0 328 b 20 467 0 391 6 433 b 255 648 58 563 155 637 m 269 363 b 257 363 265 363 261 363 b 210 345 236 363 220 356 b 186 226 196 324 186 272 b 187 198 186 216 186 206 b 213 95 191 151 202 112 b 257 76 221 83 238 76 b 270 77 261 76 266 76 b 321 156 299 81 310 99 b 329 229 326 183 329 206 b 321 301 329 252 326 274 b 269 363 311 342 298 359 m 236 -1 l 238 -1 l 235 -1 l 236 -1 m 236 673 l 238 673 l 235 673 l 236 673 "},v7:{x_min:0,x_max:442.359375,ha:451,o:"m 147 648 b 166 649 153 649 160 649 b 313 598 217 649 273 630 b 340 587 323 588 328 587 l 341 587 b 412 628 367 587 390 601 b 427 638 416 635 421 638 b 439 632 431 638 435 637 b 442 623 441 630 442 628 b 430 569 442 616 439 603 b 352 369 408 492 377 410 b 300 259 325 324 313 298 b 273 84 283 205 273 140 b 265 55 273 65 272 59 l 261 54 l 181 54 l 99 54 l 96 55 b 91 61 95 56 92 59 l 89 63 l 89 77 b 147 263 89 133 111 202 b 261 401 176 313 212 355 b 378 541 315 449 349 489 l 382 548 l 375 544 b 240 495 333 512 285 495 b 129 535 198 495 160 509 b 84 560 108 552 95 560 b 76 559 81 560 78 560 b 31 487 59 555 43 530 b 14 470 27 473 24 470 b 1 477 8 470 4 471 l 0 480 l 0 553 l 0 627 l 1 630 b 16 638 4 635 9 638 b 23 635 17 638 20 637 b 49 626 36 626 39 626 b 96 638 59 626 80 630 b 104 639 99 638 102 639 b 117 644 107 641 112 642 b 147 648 125 645 137 648 m 220 -1 l 221 -1 l 219 -1 l 220 -1 m 220 673 l 221 673 l 219 673 l 220 673 "},v8:{x_min:0,x_max:488.640625,ha:499,o:"m 217 648 b 245 649 225 648 235 649 b 453 516 343 649 430 595 b 458 478 455 503 458 491 b 412 370 458 440 441 398 b 411 369 412 369 411 369 b 415 365 411 367 412 367 b 488 231 462 331 488 281 b 472 165 488 208 483 186 b 243 43 434 86 338 43 b 63 104 178 43 112 62 b 0 233 20 140 0 186 b 73 365 0 283 24 331 l 77 369 l 72 374 b 29 476 42 406 29 441 b 217 648 29 557 103 635 m 258 605 b 242 606 253 605 247 606 b 157 552 198 606 157 580 b 160 541 157 548 159 544 b 319 413 176 503 242 452 l 337 403 l 338 406 b 359 476 352 428 359 452 b 258 605 359 537 318 595 m 138 326 b 130 330 134 328 130 330 b 130 330 130 330 130 330 b 107 305 127 330 112 313 b 84 231 91 281 84 256 b 243 86 84 156 151 86 b 249 87 245 86 246 87 b 347 156 303 88 347 120 b 344 172 347 162 345 167 b 156 319 325 227 257 281 b 138 326 151 322 144 324 m 243 -1 l 245 -1 l 242 -1 l 243 -1 m 243 673 l 245 673 l 242 673 l 243 673 "},v9:{x_min:0,x_max:475.03125,ha:485,o:"m 191 646 b 212 649 198 648 205 649 b 255 644 227 649 243 646 b 458 448 348 616 428 539 b 475 342 469 415 475 378 b 460 244 475 308 469 274 b 193 44 421 124 303 44 b 91 69 157 44 122 51 b 19 161 43 97 19 126 b 21 181 19 167 20 174 b 98 241 32 220 65 241 b 170 186 129 241 160 223 b 172 166 171 179 172 173 b 121 94 172 134 152 102 b 117 93 118 94 117 93 b 121 90 117 93 118 91 b 185 76 142 80 164 76 b 270 119 220 76 251 91 b 308 259 287 145 300 194 b 313 317 310 277 313 310 b 313 317 313 317 313 317 b 313 317 313 317 313 317 b 304 315 313 317 308 316 b 216 295 273 302 245 295 b 145 308 193 295 170 299 b 19 398 88 327 42 360 b 0 469 5 420 0 444 b 24 551 0 496 8 526 b 191 646 54 596 125 637 m 227 614 b 215 616 224 616 220 616 b 202 614 210 616 206 616 b 152 535 174 610 163 592 b 144 463 147 509 144 485 b 152 391 144 440 147 417 b 216 328 163 344 179 328 b 280 391 253 328 269 344 b 288 463 285 417 288 440 b 280 535 288 485 285 509 b 227 614 269 594 258 610 m 236 -1 l 238 -1 l 235 -1 l 236 -1 m 236 673 l 238 673 l 235 673 l 236 673 "},va:{x_min:-149.71875,x_max:148.359375,ha:151,o:"m -8 -1 b -1 0 -5 -1 -4 0 b 16 -11 5 0 13 -4 b 83 -186 17 -12 47 -90 l 148 -358 l 148 -363 b 127 -385 148 -376 138 -385 b 112 -378 122 -385 118 -383 b 54 -226 110 -374 114 -385 b 0 -81 24 -147 0 -81 b -55 -226 -1 -81 -25 -147 b -114 -378 -115 -385 -111 -374 b -129 -385 -119 -383 -123 -385 b -149 -363 -140 -385 -149 -376 l -149 -358 l -84 -186 b -19 -11 -49 -90 -19 -12 b -8 -1 -17 -8 -12 -4 "},vb:{x_min:0,x_max:428.75,ha:438,o:"m 262 186 b 273 186 266 186 272 186 b 274 186 273 186 274 186 b 285 186 274 186 280 186 b 428 48 375 181 428 122 b 386 -68 428 12 416 -29 b 155 -187 329 -145 236 -187 b 12 -111 92 -187 38 -162 b 0 -51 4 -91 0 -72 b 262 186 0 58 122 179 "},vc:{x_min:0,x_max:447.8125,ha:457,o:"m 0 86 l 0 173 l 223 173 l 447 173 l 447 86 l 447 0 l 223 0 l 0 0 l 0 86 "},vf:{x_min:0,x_max:370.21875,ha:378,o:"m 0 0 l 0 277 l 61 277 l 122 277 l 122 0 l 122 -278 l 61 -278 l 0 -278 l 0 0 m 246 -1 l 246 277 l 308 277 l 370 277 l 370 -1 l 370 -278 l 308 -278 l 246 -278 l 246 -1 "},v10:{x_min:0,x_max:559.421875,ha:571,o:"m 5 127 b 14 127 6 127 9 127 b 51 126 25 127 43 127 b 175 98 93 122 138 112 l 186 94 b 279 51 210 86 255 65 b 285 47 280 51 283 48 b 319 27 291 44 311 31 l 326 22 b 359 0 332 19 352 4 l 367 -6 b 371 -9 368 -6 370 -8 l 379 -15 b 387 -22 383 -18 386 -20 l 398 -30 l 411 -40 l 417 -47 l 427 -55 l 434 -61 b 441 -66 436 -62 439 -65 l 446 -72 l 453 -77 l 462 -87 b 558 -188 490 -113 549 -176 b 559 -195 559 -191 559 -194 b 548 -205 559 -201 555 -205 b 541 -204 547 -205 544 -205 b 534 -198 539 -201 536 -199 l 525 -191 b 481 -162 518 -187 490 -167 b 472 -155 477 -159 472 -156 b 468 -152 470 -155 469 -154 b 461 -149 466 -152 464 -151 b 428 -130 454 -145 441 -137 b 371 -99 413 -122 372 -99 b 363 -95 371 -99 367 -98 b 353 -91 357 -94 353 -91 b 348 -90 353 -91 352 -91 b 332 -81 343 -87 341 -86 b 27 -12 230 -37 127 -13 b 0 -5 4 -11 2 -11 b 0 58 0 -2 0 27 b 0 122 0 88 0 120 b 5 127 1 124 4 126 "},v11:{x_min:-155.171875,x_max:153.8125,ha:157,o:"m -137 353 b -130 353 -136 353 -133 353 b -112 349 -125 353 -119 352 b -100 342 -110 347 -104 344 b 0 317 -69 326 -35 317 b 111 349 38 317 76 328 b 129 353 117 352 123 353 b 153 327 142 353 153 344 b 144 302 153 320 153 317 b 27 6 93 226 50 113 b 21 -13 24 -11 24 -11 b 0 -26 17 -22 8 -26 b -24 -12 -9 -26 -19 -22 b -28 5 -24 -9 -27 -2 b -145 302 -53 117 -95 224 b -155 327 -155 317 -155 320 b -137 353 -155 340 -148 349 "},v18:{x_min:0,x_max:323.9375,ha:331,o:"m 217 535 b 225 537 220 537 221 537 b 245 524 235 537 242 533 l 246 521 l 247 390 l 247 258 l 273 265 b 306 270 288 269 299 270 b 322 259 315 270 319 267 b 323 208 323 256 323 233 b 322 158 323 184 323 159 b 288 140 318 148 315 147 b 247 130 254 131 247 130 b 247 65 247 130 247 104 b 247 20 247 51 247 36 l 247 -88 l 273 -81 b 306 -76 289 -77 299 -76 b 318 -81 311 -76 315 -77 b 323 -123 323 -87 323 -86 l 323 -138 l 323 -154 b 318 -195 323 -191 323 -190 b 269 -210 314 -199 315 -199 b 249 -216 259 -213 250 -216 l 247 -216 l 247 -349 l 246 -483 l 245 -487 b 225 -499 242 -495 234 -499 b 206 -487 219 -499 210 -495 l 205 -483 l 205 -355 l 205 -227 l 204 -227 l 181 -233 l 138 -244 b 117 -249 127 -247 117 -249 b 115 -385 115 -249 115 -256 l 115 -523 l 114 -526 b 95 -538 110 -534 102 -538 b 74 -526 87 -538 78 -534 l 73 -523 l 73 -391 b 72 -260 73 -269 73 -260 b 72 -260 72 -260 72 -260 b 19 -273 61 -263 23 -273 b 0 -260 10 -273 4 -267 b 0 -209 0 -256 0 -256 l 0 -162 l 1 -158 b 61 -134 5 -148 5 -148 l 73 -131 l 73 -22 b 72 86 73 79 73 86 b 72 86 72 86 72 86 b 19 74 61 83 23 74 b 0 86 10 74 4 79 b 0 137 0 90 0 90 l 0 184 l 1 188 b 61 212 5 198 5 198 l 73 215 l 73 348 l 73 481 l 74 485 b 95 498 78 492 87 498 b 103 495 98 498 100 496 b 114 485 107 494 111 489 l 115 481 l 115 353 l 115 226 l 121 226 b 159 235 123 227 141 231 l 198 247 l 205 248 l 205 384 l 205 521 l 206 524 b 217 535 209 528 212 533 m 205 9 b 205 119 205 70 205 119 l 205 119 b 182 113 204 119 194 116 l 138 102 b 117 97 127 99 117 97 b 115 -12 115 97 115 91 l 115 -122 l 121 -120 b 159 -111 123 -119 141 -115 l 198 -101 l 205 -98 l 205 9 "},v1b:{x_min:0,x_max:559.421875,ha:571,o:"m 544 204 b 548 204 545 204 547 204 b 559 194 555 204 559 199 b 559 190 559 192 559 191 b 530 156 559 188 556 184 b 462 86 510 134 481 104 b 453 76 458 81 454 77 l 446 70 l 441 65 b 434 59 439 63 436 61 l 427 54 b 409 37 426 51 416 44 b 392 23 398 29 394 26 b 387 19 389 22 387 20 b 379 13 386 19 383 16 l 371 8 l 367 5 l 359 -1 l 337 -16 b 285 -48 319 -29 298 -41 l 279 -52 b 186 -95 255 -66 210 -87 l 175 -99 b 23 -129 127 -117 68 -129 b 17 -129 20 -129 19 -129 b 1 -123 2 -129 2 -129 b 0 -49 0 -122 0 -83 b 0 4 0 -22 0 1 b 27 11 2 9 4 9 b 185 31 78 12 145 20 b 198 34 186 31 193 33 b 314 73 234 44 277 58 b 349 88 328 79 340 84 b 353 90 352 90 353 90 b 363 94 353 90 357 93 b 371 98 367 97 371 98 b 428 129 372 98 413 120 b 461 148 441 136 454 144 b 468 151 464 149 466 151 b 472 154 469 152 470 154 b 481 161 473 155 477 158 b 525 190 490 166 518 186 l 534 197 b 540 201 536 198 539 199 b 544 204 541 202 544 204 "},v1d:{x_min:0,x_max:619.3125,ha:632,o:"m 274 184 b 307 186 285 186 296 186 b 616 22 465 186 597 116 b 619 -1 617 13 619 5 b 308 -187 619 -104 483 -187 b 0 -1 133 -187 0 -102 b 5 36 0 11 1 23 b 274 184 29 115 141 176 m 289 161 b 272 162 284 162 277 162 b 171 41 209 162 171 108 b 205 -73 171 5 182 -34 b 345 -163 243 -133 298 -163 b 436 -98 385 -163 420 -142 b 446 -43 443 -80 446 -62 b 289 161 446 47 377 147 "},v1e:{x_min:-402.890625,x_max:401.53125,ha:410,o:"m -219 173 b -213 174 -217 174 -215 174 b -202 173 -209 174 -205 173 b -114 86 -200 172 -179 151 b -28 0 -66 37 -28 0 b 40 84 -28 0 2 37 b 117 174 111 173 110 172 b 122 174 118 174 119 174 b 132 173 125 174 129 173 b 295 11 134 172 171 134 l 307 -1 l 336 34 b 374 76 366 72 368 74 b 381 77 375 77 378 77 b 401 56 392 77 401 68 b 400 48 401 54 401 51 b 223 -172 397 41 230 -166 b 210 -176 220 -174 215 -176 b 201 -174 206 -176 204 -176 b 112 -87 198 -173 178 -152 b 27 0 65 -38 27 0 b -42 -86 27 0 -4 -38 b -118 -174 -112 -174 -111 -173 b -123 -176 -119 -176 -121 -176 b -133 -174 -126 -176 -130 -174 b -296 -12 -136 -173 -172 -137 l -308 0 l -337 -34 b -375 -77 -367 -73 -370 -76 b -382 -79 -377 -79 -379 -79 b -402 -58 -393 -79 -402 -69 b -401 -49 -402 -55 -402 -52 b -224 172 -398 -43 -228 167 b -219 173 -223 172 -220 173 "},v1f:{x_min:-340.28125,x_max:338.921875,ha:346,o:"m -32 520 b -29 521 -31 520 -31 521 b -23 519 -27 521 -24 520 b -20 513 -21 517 -20 516 b -21 506 -20 512 -20 509 b -31 474 -23 502 -27 488 l -53 402 l -66 352 l -68 349 l -57 349 b -32 351 -51 349 -40 351 b 123 370 19 352 74 359 b 137 371 127 370 133 371 b 170 356 152 371 164 366 b 171 355 170 355 170 355 b 216 366 174 355 183 358 b 280 378 268 377 266 377 b 287 378 283 378 284 378 b 332 349 307 378 322 369 b 338 319 336 341 338 330 b 332 301 338 310 336 302 b 242 280 329 299 246 280 b 242 280 242 280 242 280 b 235 288 236 280 235 283 b 235 292 235 290 235 291 b 236 302 236 297 236 299 b 220 337 236 316 230 330 l 216 340 l 210 335 b 159 276 189 322 172 301 b 118 149 152 265 156 274 b 81 34 84 36 85 36 b -8 13 78 33 -4 13 b -8 13 -8 13 -8 13 b -14 20 -12 15 -14 15 b -8 44 -14 24 -12 31 b -2 66 -5 55 -2 65 b -2 66 -2 66 -2 66 l -2 66 b -43 41 -2 66 -21 55 b -114 4 -98 8 -98 8 b -144 0 -123 0 -134 0 b -242 99 -197 0 -242 43 b -242 109 -242 102 -242 105 b -212 219 -240 122 -242 116 b -185 312 -197 270 -185 312 l -185 312 b -189 312 -185 312 -186 312 b -259 312 -200 312 -227 312 b -321 310 -291 312 -310 310 b -334 312 -330 310 -334 312 b -340 319 -338 313 -340 316 b -336 326 -340 322 -338 324 b -291 337 -334 326 -314 331 l -247 347 l -210 348 b -172 348 -190 348 -172 348 b -168 363 -172 348 -171 355 b -145 442 -151 424 -145 441 b -133 452 -144 444 -140 446 l -77 489 b -32 520 -53 506 -32 520 m 57 334 b 53 335 55 335 54 335 b 44 334 50 335 49 335 b -70 316 8 326 -28 320 b -78 309 -78 316 -78 316 b -108 202 -80 305 -88 274 b -141 81 -136 112 -141 93 b -140 74 -141 79 -141 77 b -117 49 -137 59 -127 49 b -107 52 -114 49 -110 51 b 16 127 -106 54 14 126 b 42 217 16 127 42 215 b 49 241 42 222 44 229 b 73 320 53 251 73 317 b 57 334 73 327 65 333 "},v20:{x_min:-571.671875,x_max:570.3125,ha:582,o:"m -559 351 b -551 352 -556 352 -553 352 b -530 338 -543 352 -533 348 b -529 169 -530 337 -529 291 l -529 1 l -507 27 l -441 112 b -382 174 -394 169 -390 174 b -378 174 -381 174 -379 174 b -281 86 -370 174 -375 179 b -196 0 -234 37 -196 0 b -126 84 -196 0 -164 37 b -50 174 -55 173 -57 172 b -44 174 -49 174 -47 174 b -35 173 -42 174 -38 173 b 53 86 -32 172 -12 151 b 138 0 100 37 138 0 b 208 84 140 0 170 37 b 284 174 279 173 279 172 b 289 174 285 174 288 174 b 300 173 294 174 298 173 b 462 11 303 172 340 134 l 475 -1 l 503 34 b 541 76 534 72 536 74 b 548 77 544 77 545 77 b 570 56 560 77 570 68 b 567 48 570 54 568 51 b 392 -172 564 41 397 -166 b 378 -176 387 -174 382 -176 b 368 -174 375 -176 371 -176 b 280 -87 367 -173 347 -152 b 194 0 234 -38 194 0 b 126 -86 194 0 163 -38 b 49 -174 54 -174 55 -173 b 44 -176 47 -176 46 -176 b 34 -174 40 -176 36 -174 b -54 -87 31 -173 10 -152 b -140 0 -102 -38 -140 0 b -209 -86 -140 0 -171 -38 b -285 -174 -280 -174 -279 -173 b -291 -176 -287 -176 -288 -176 b -300 -174 -294 -176 -298 -174 b -464 -11 -303 -173 -374 -102 l -476 0 l -506 -37 b -539 -76 -528 -65 -537 -74 b -551 -80 -543 -79 -547 -80 b -570 -68 -558 -80 -566 -76 l -571 -65 l -571 136 b -570 340 -571 331 -571 337 b -559 351 -568 344 -564 348 "},v22:{x_min:0,x_max:432.828125,ha:442,o:"m 209 186 b 213 187 210 187 212 187 b 216 187 215 187 216 187 b 224 174 216 186 220 180 b 420 -1 269 105 338 43 b 432 -12 431 -8 432 -9 b 421 -23 432 -15 432 -16 b 228 -180 345 -70 264 -137 b 219 -188 221 -188 221 -188 l 219 -188 b 208 -177 215 -188 215 -188 b 10 1 163 -106 93 -44 b 0 11 0 6 0 8 b 10 22 0 13 0 15 b 202 179 87 69 167 136 b 209 186 206 183 209 186 "},v23:{x_min:0,x_max:133.390625,ha:136,o:"m 54 66 b 65 68 58 68 61 68 b 122 37 88 68 110 56 b 133 -1 130 26 133 12 b 104 -58 133 -23 123 -44 b 66 -69 92 -65 78 -69 b 10 -38 44 -69 23 -58 b 0 -1 2 -27 0 -13 b 54 66 0 30 20 61 "},v25:{x_min:0,x_max:318.5,ha:325,o:"m 20 376 b 167 377 23 377 96 377 b 296 376 231 377 294 377 b 318 347 311 371 318 359 b 296 316 318 333 311 320 b 159 315 294 315 227 315 b 21 316 91 315 24 315 b 0 345 6 320 0 333 b 20 376 0 359 6 371 "},v26:{x_min:-21.78125,x_max:483.1875,ha:493,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 383 20 616 20 616 l 20 148 l 21 151 b 140 199 59 183 102 199 b 206 179 164 199 187 192 l 210 176 l 210 396 l 210 617 l 212 621 b 231 632 216 628 223 632 b 250 620 239 632 247 628 b 251 383 251 616 251 616 l 251 148 l 254 151 b 370 199 291 183 332 199 b 415 191 385 199 400 197 b 483 84 458 176 483 134 b 461 0 483 58 476 29 b 332 -142 439 -40 411 -72 l 255 -215 b 231 -229 240 -229 239 -229 b 216 -223 224 -229 220 -227 b 210 -158 210 -217 210 -223 b 210 -120 210 -148 210 -136 l 210 -29 l 205 -34 b 100 -142 182 -65 159 -88 l 23 -215 b -1 -229 9 -229 6 -229 b -20 -216 -9 -229 -17 -224 l -21 -212 l -21 201 l -21 616 l -20 620 b -8 631 -17 624 -13 630 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 m 341 131 b 328 133 337 133 332 133 b 322 133 326 133 323 133 b 257 87 296 129 273 113 l 251 80 l 251 -37 l 251 -156 l 255 -152 b 375 81 328 -72 375 20 l 375 83 b 341 131 375 113 367 126 "},v27:{x_min:0,x_max:432.828125,ha:442,o:"m 208 184 b 213 187 209 186 212 187 b 224 176 217 187 221 183 b 245 147 225 172 235 159 b 419 -1 288 90 347 38 b 431 -8 424 -4 431 -8 b 432 -12 432 -9 432 -11 b 430 -18 432 -13 432 -16 b 364 -61 424 -20 383 -47 b 225 -183 307 -102 250 -152 b 223 -187 224 -184 223 -187 b 220 -188 221 -188 220 -188 b 208 -176 216 -188 210 -184 b 187 -148 205 -173 197 -159 b 12 0 144 -90 84 -38 b 0 11 4 5 0 8 b 16 24 0 13 4 18 b 183 158 83 69 141 115 b 208 184 194 169 198 173 m 183 105 b 176 113 181 109 176 113 b 172 109 176 113 175 112 b 92 45 149 90 117 62 l 88 41 l 102 31 b 247 -105 160 -6 210 -55 l 254 -115 l 257 -112 l 269 -102 b 340 -45 287 -87 319 -61 l 344 -43 l 330 -33 b 183 105 272 6 221 54 "},v28:{x_min:-73.5,x_max:72.140625,ha:74,o:"m -72 252 l -73 254 l 0 254 l 72 254 l 70 252 b 0 -1 70 248 0 -1 b -72 252 -1 -1 -72 248 "},v29:{x_min:-590.71875,x_max:589.359375,ha:601,o:"m 175 273 b 182 274 178 273 181 274 b 202 262 190 274 198 269 b 204 158 204 259 204 259 l 204 56 l 250 112 b 303 174 296 172 298 172 b 308 174 304 174 307 174 b 318 173 313 174 317 173 b 481 11 322 172 357 134 l 494 -1 l 522 34 b 560 76 553 72 555 74 b 567 77 563 77 564 77 b 589 56 579 77 589 68 b 586 48 589 54 588 51 b 411 -172 583 41 416 -166 b 397 -176 406 -174 401 -176 b 387 -174 393 -176 390 -176 b 299 -87 386 -173 366 -152 b 213 0 253 -38 213 0 b 208 -6 213 0 210 -2 l 204 -12 l 204 -147 b 204 -210 204 -173 204 -194 b 198 -292 204 -297 204 -287 b 183 -299 194 -297 189 -299 b 164 -287 175 -299 167 -295 b 163 -174 163 -284 163 -284 l 161 -63 l 119 -117 b 65 -176 76 -170 73 -176 b 61 -176 63 -176 62 -176 b -35 -87 51 -174 57 -180 b -121 0 -83 -38 -121 0 b -190 -86 -122 0 -152 -38 b -266 -174 -261 -174 -259 -173 b -272 -176 -268 -176 -270 -176 b -281 -174 -276 -176 -280 -174 b -371 -86 -284 -173 -304 -152 b -457 0 -417 -38 -457 0 l -457 0 b -477 -26 -457 0 -470 -16 b -548 -227 -524 -88 -548 -161 b -536 -303 -548 -254 -544 -280 b -533 -317 -534 -309 -533 -313 b -553 -338 -533 -330 -541 -338 b -577 -315 -566 -338 -571 -333 b -590 -227 -586 -287 -590 -258 b -518 -9 -590 -154 -564 -77 b -465 56 -509 2 -504 8 l -402 134 b -363 174 -374 170 -371 174 b -359 174 -362 174 -360 174 b -262 86 -351 174 -356 179 b -176 0 -216 37 -176 0 b -107 84 -176 0 -145 37 b -31 174 -36 173 -38 172 b -25 174 -29 174 -28 174 b -16 173 -23 174 -19 173 b 147 11 -13 172 35 123 l 157 -1 l 160 1 l 163 4 l 163 130 b 164 260 163 256 163 258 b 175 273 166 266 170 270 "},v2a:{x_min:-21.78125,x_max:366.140625,ha:374,o:"m 276 1378 b 284 1379 279 1379 281 1379 b 306 1360 292 1379 298 1374 b 352 1247 326 1326 343 1286 b 366 1139 362 1213 366 1175 b 347 1009 366 1093 359 1049 l 344 1002 l 347 992 b 352 971 348 986 351 977 b 366 863 362 936 366 899 b 347 732 366 818 359 773 l 344 725 l 347 716 b 352 695 348 710 351 700 b 366 588 362 659 366 623 b 223 262 366 464 314 345 b 189 233 212 252 212 252 b 35 76 126 183 73 129 b -1 16 20 56 2 27 b -19 4 -4 9 -12 4 l -21 4 l -21 137 l -21 270 l -17 270 b 186 344 59 281 134 308 b 319 606 270 399 319 499 b 317 650 319 620 319 635 l 315 659 l 314 655 b 223 537 288 607 258 570 b 189 509 212 528 212 528 b 35 352 126 459 73 405 b -1 292 20 333 2 303 b -19 280 -4 285 -12 280 l -21 280 l -21 413 l -21 546 l -17 546 b 186 620 59 557 134 584 b 319 882 270 675 319 775 b 317 925 319 896 319 911 l 315 935 l 314 931 b 223 813 288 884 258 846 b 189 785 212 805 212 805 b 35 628 126 735 73 681 b -1 569 20 609 2 580 b -19 556 -4 562 -12 556 l -21 556 l -21 689 l -21 823 l -17 823 b 202 907 68 835 152 867 b 319 1157 280 968 319 1061 b 270 1338 319 1218 303 1281 b 262 1358 264 1349 262 1353 b 262 1364 262 1360 262 1363 b 276 1378 265 1371 269 1376 "},v2c:{x_min:-597.53125,x_max:596.171875,ha:608,o:"m -413 173 b -408 174 -412 174 -409 174 b -397 173 -404 174 -400 173 b -308 86 -394 172 -374 151 b -223 0 -261 37 -223 0 b -153 84 -223 0 -191 37 b -77 174 -83 173 -84 172 b -72 174 -76 174 -74 174 b -62 173 -68 174 -63 173 b 25 86 -59 172 -39 151 b 112 0 73 37 111 0 b 181 84 112 0 144 37 b 257 174 251 173 251 172 b 262 174 258 174 261 174 b 273 173 266 174 270 173 b 436 9 276 172 347 101 l 447 -1 l 477 36 b 522 79 511 79 513 79 l 522 79 b 552 51 533 79 539 73 b 596 -112 582 6 596 -51 b 567 -262 596 -161 586 -213 b 539 -322 558 -287 544 -316 b 524 -327 534 -326 529 -327 b 504 -315 515 -327 507 -323 b 503 -308 503 -312 503 -309 b 511 -285 503 -302 504 -297 b 555 -113 540 -227 555 -169 b 544 -34 555 -86 551 -59 b 522 19 540 -16 530 8 l 521 22 l 481 -26 l 405 -122 b 353 -176 366 -172 362 -176 b 349 -176 352 -176 351 -176 b 253 -87 341 -176 347 -180 b 167 0 206 -38 167 0 b 99 -86 167 0 136 -38 b 21 -174 27 -174 28 -173 b 17 -176 20 -176 19 -176 b 6 -174 13 -176 9 -174 b -81 -87 4 -173 -14 -152 b -167 0 -129 -38 -167 0 b -236 -86 -167 0 -198 -38 b -313 -174 -307 -174 -306 -173 b -318 -176 -314 -176 -315 -176 b -328 -174 -321 -176 -325 -174 b -491 -12 -330 -173 -367 -137 l -503 0 l -530 -34 b -570 -77 -562 -73 -564 -76 b -577 -79 -571 -79 -574 -79 b -597 -58 -588 -79 -597 -69 b -596 -49 -597 -55 -597 -52 b -417 172 -593 -43 -423 167 b -413 173 -417 172 -415 173 "},v2d:{x_min:0,x_max:438.28125,ha:447,o:"m 212 190 b 219 191 213 191 216 191 b 236 176 225 191 228 190 b 419 18 277 105 341 49 b 436 5 431 13 434 11 b 438 -1 438 4 438 1 b 424 -16 438 -8 432 -13 b 356 -49 409 -20 379 -36 b 234 -180 306 -83 258 -133 b 219 -192 230 -188 224 -192 b 200 -176 213 -192 206 -187 b 9 -15 157 -102 89 -45 b 0 0 2 -12 0 -6 b 16 18 0 9 2 12 b 200 176 93 48 159 104 b 212 190 205 186 208 188 m 239 113 b 236 117 238 116 238 117 b 230 108 235 117 234 115 b 92 -15 196 58 140 8 b 88 -18 91 -16 88 -18 b 92 -20 88 -18 91 -19 b 198 -116 130 -43 166 -74 b 200 -117 200 -117 200 -117 b 201 -117 200 -117 201 -117 b 264 -43 212 -98 242 -62 b 345 15 288 -19 321 4 b 348 18 347 16 348 16 b 344 20 348 18 347 19 b 239 113 307 41 266 79 "},v2f:{x_min:-1.359375,x_max:680.5625,ha:694,o:"m 597 1042 b 604 1042 600 1042 602 1042 b 642 1002 627 1042 642 1022 b 619 966 642 988 635 974 b 439 927 574 942 503 927 l 426 927 l 426 921 b 430 838 428 893 430 866 b 345 480 430 696 398 560 b 179 391 307 423 249 391 b 156 392 171 391 164 392 b 138 394 149 394 142 394 b 103 434 115 396 103 416 b 129 471 103 451 111 466 b 141 474 133 473 137 474 b 172 459 153 474 164 469 b 181 455 175 456 176 455 b 187 456 182 455 185 455 b 253 520 212 460 234 483 b 315 836 294 605 315 714 b 311 928 315 867 314 898 b 302 945 310 943 311 942 b 245 953 283 950 262 953 b 130 891 193 953 149 931 b 84 860 119 870 102 860 b 36 905 61 860 39 877 b 36 910 36 907 36 909 b 80 970 36 931 50 949 b 249 1017 125 1000 187 1017 b 322 1009 273 1017 299 1014 l 341 1003 b 436 991 372 995 406 991 b 577 1031 495 991 545 1004 b 597 1042 583 1038 590 1041 m 416 360 b 424 360 419 360 421 360 b 481 309 454 360 479 338 b 503 145 484 280 495 199 b 585 -185 525 16 555 -106 b 630 -245 596 -213 613 -237 l 634 -247 l 638 -245 b 647 -244 641 -245 645 -244 b 680 -278 666 -244 680 -262 b 664 -308 680 -290 675 -301 b 638 -312 658 -310 650 -312 b 613 -309 631 -312 623 -310 b 477 -201 555 -303 502 -260 b 417 -2 460 -159 434 -72 b 416 5 417 1 416 5 b 416 5 416 5 416 5 b 411 -5 415 5 413 0 b 359 -97 397 -33 377 -70 b 353 -106 355 -102 353 -105 b 359 -112 353 -108 355 -109 b 409 -130 375 -123 390 -129 b 426 -134 420 -130 421 -131 b 431 -147 428 -137 431 -141 b 420 -162 431 -152 427 -159 b 382 -169 409 -166 396 -169 b 323 -155 363 -169 341 -165 l 317 -152 l 314 -155 b 62 -303 240 -240 148 -295 b 36 -305 55 -305 44 -305 b 23 -303 29 -305 24 -305 b -1 -273 6 -299 -1 -287 b 31 -240 -1 -256 10 -240 b 36 -240 32 -240 34 -240 b 42 -241 38 -241 39 -241 b 134 -204 63 -241 99 -226 b 367 288 265 -115 357 81 b 375 330 368 313 370 320 b 416 360 383 347 400 358 m 360 -359 b 379 -359 363 -359 371 -359 b 424 -360 396 -359 416 -359 b 646 -502 536 -373 624 -430 b 649 -527 649 -510 649 -519 b 530 -673 649 -578 604 -635 l 521 -677 l 529 -681 b 653 -811 592 -714 637 -762 b 660 -853 658 -827 660 -839 b 645 -911 660 -873 656 -892 b 426 -1021 608 -981 519 -1021 b 283 -989 377 -1021 328 -1011 b 235 -949 249 -972 239 -964 b 234 -936 234 -946 234 -941 b 234 -928 234 -934 234 -931 l 235 -925 l 234 -927 l 225 -934 b 87 -982 186 -966 138 -982 b 80 -982 85 -982 83 -982 b 55 -981 70 -981 58 -981 b 17 -943 32 -981 17 -964 b 54 -904 17 -921 35 -904 b 78 -914 62 -904 72 -909 l 83 -918 l 88 -918 b 190 -831 122 -918 166 -881 b 269 -506 242 -727 269 -612 b 268 -462 269 -492 269 -477 b 266 -449 266 -458 266 -452 b 265 -444 266 -445 266 -444 b 257 -446 264 -444 261 -445 b 132 -545 196 -470 152 -505 b 88 -573 122 -563 104 -573 b 39 -523 63 -573 39 -553 b 63 -476 39 -505 44 -494 b 360 -359 136 -408 235 -369 m 419 -424 b 393 -423 411 -423 406 -423 l 375 -423 l 377 -426 b 379 -439 377 -427 378 -434 b 383 -510 382 -463 383 -487 b 314 -811 383 -609 360 -710 b 266 -893 296 -850 285 -870 b 264 -898 265 -896 264 -898 l 264 -898 b 264 -898 264 -898 264 -898 b 268 -898 264 -898 266 -898 b 273 -898 270 -898 272 -898 b 300 -909 283 -898 291 -900 b 426 -957 340 -941 385 -957 b 476 -949 443 -957 460 -954 b 547 -853 522 -931 547 -893 b 485 -745 547 -816 526 -775 b 397 -707 460 -727 432 -714 b 366 -675 375 -703 366 -692 b 396 -642 366 -657 377 -645 b 530 -557 455 -637 511 -601 b 536 -527 534 -548 536 -537 b 419 -424 536 -480 490 -437 "},v30:{x_min:-21.78125,x_max:367.5,ha:375,o:"m 276 1900 b 284 1901 279 1900 281 1901 b 306 1883 291 1901 298 1896 b 367 1686 347 1825 367 1757 b 343 1558 367 1643 359 1600 l 338 1549 l 343 1537 b 367 1411 359 1497 367 1454 b 343 1282 367 1367 359 1324 l 338 1272 l 343 1261 b 367 1135 359 1221 367 1178 b 343 1007 367 1090 359 1047 l 338 996 l 343 985 b 367 859 359 945 367 902 b 343 731 367 814 359 771 l 338 720 l 343 709 b 367 582 359 667 367 626 b 289 362 367 503 340 426 b 239 312 276 345 259 330 b 29 77 152 237 76 152 b -1 18 14 54 2 30 b -19 4 -4 11 -12 4 l -21 4 l -21 133 l -20 260 l -13 262 b 98 299 17 269 62 284 b 111 305 103 302 110 305 b 167 334 123 310 156 327 b 319 595 264 391 319 491 b 313 659 319 616 318 638 b 310 667 311 664 311 667 b 307 663 310 667 308 666 b 240 588 289 637 269 614 b 16 331 141 505 62 413 b -1 294 8 316 1 302 b -19 280 -4 287 -12 280 l -21 280 l -21 408 l -20 537 l -13 538 b 98 576 17 545 62 560 b 111 581 103 578 110 581 b 167 610 123 587 156 603 b 319 871 264 667 319 767 b 313 935 319 892 318 913 b 310 942 311 941 311 942 b 307 939 310 942 308 941 b 240 864 289 913 269 889 b 16 607 141 781 62 689 b -1 570 8 592 1 578 b -19 556 -4 563 -12 556 l -21 556 l -21 684 l -20 813 l -13 814 b 98 852 17 821 62 836 b 111 857 103 855 110 857 b 167 886 123 863 156 880 b 319 1147 264 943 319 1043 b 313 1211 319 1168 318 1189 b 310 1218 311 1217 311 1218 b 307 1215 310 1218 308 1217 b 240 1140 289 1188 269 1165 b 16 884 141 1057 62 966 b -1 846 8 868 1 855 b -19 832 -4 839 -12 832 l -21 832 l -21 960 l -20 1089 l -13 1090 b 98 1128 17 1097 62 1111 b 111 1134 103 1131 110 1134 b 167 1163 123 1139 156 1156 b 319 1424 264 1220 319 1320 b 313 1486 319 1444 318 1465 b 310 1494 311 1493 311 1494 b 307 1492 310 1494 308 1493 b 240 1417 289 1464 269 1442 b 16 1160 141 1333 62 1242 b -1 1121 8 1145 1 1131 b -19 1109 -4 1115 -12 1109 l -21 1109 l -21 1236 l -20 1365 l -13 1367 b 98 1404 17 1374 62 1388 b 111 1410 103 1407 110 1410 b 250 1508 172 1437 215 1467 b 319 1701 296 1564 319 1633 b 270 1859 319 1757 303 1814 b 262 1882 265 1868 262 1875 b 276 1900 262 1890 266 1896 "},v31:{x_min:0,x_max:386.5625,ha:394,o:"m 0 173 l 0 347 l 193 347 l 386 347 l 386 173 l 386 0 l 193 0 l 0 0 l 0 173 "},v33:{x_min:-423.3125,x_max:421.9375,ha:431,o:"m -10 276 b -2 277 -8 277 -5 277 b 17 265 5 277 13 273 b 19 163 19 260 19 260 l 19 68 l 39 45 b 277 -95 122 -34 200 -81 b 289 -97 281 -97 285 -97 b 378 0 332 -97 371 -54 b 378 11 378 4 378 6 b 302 83 378 55 345 83 b 242 66 283 83 262 77 b 208 56 231 59 219 56 b 148 120 175 56 148 81 b 200 186 148 151 164 172 b 261 198 220 194 240 198 b 420 45 341 198 411 137 b 421 22 421 37 421 29 b 257 -198 421 -86 347 -188 b 242 -198 251 -198 247 -198 b 20 -105 181 -198 95 -163 l 19 -104 l 19 -183 b 19 -216 19 -195 19 -206 b 12 -273 19 -272 17 -267 b -2 -278 8 -277 2 -278 b -21 -266 -10 -278 -19 -274 b -23 -165 -23 -263 -23 -262 l -23 -69 l -44 -47 b -250 86 -117 23 -183 66 b -295 94 -270 93 -284 94 b -315 91 -302 94 -308 94 b -381 5 -356 81 -381 43 b -355 -56 -381 -16 -372 -40 b -299 -81 -338 -73 -319 -81 b -246 -68 -283 -81 -265 -77 b -212 -58 -234 -61 -223 -58 b -168 -77 -196 -58 -179 -65 b -151 -122 -156 -90 -151 -105 b -179 -174 -151 -141 -160 -162 b -239 -195 -194 -184 -217 -192 b -257 -197 -245 -195 -250 -197 b -423 -5 -349 -197 -423 -113 b -423 0 -423 -4 -423 -1 b -277 194 -420 97 -362 173 b -247 197 -268 197 -258 197 b -24 104 -185 197 -100 162 l -23 102 l -23 181 b -21 265 -23 260 -23 260 b -10 276 -20 269 -14 274 "},v34:{x_min:0,x_max:622.03125,ha:635,o:"m 398 417 b 406 419 401 419 404 419 b 427 398 417 419 427 409 b 427 391 427 395 427 392 b 34 -274 424 385 38 -272 b 20 -280 29 -278 25 -280 b 0 -259 9 -280 0 -270 b 0 -252 0 -256 0 -254 b 393 413 2 -247 389 410 b 398 417 394 415 397 416 m 592 417 b 600 419 594 419 597 419 b 622 398 611 419 622 409 b 620 391 622 395 620 392 b 227 -274 617 385 231 -272 b 213 -280 223 -278 219 -280 b 193 -259 202 -280 193 -270 b 194 -252 193 -256 193 -254 b 586 413 196 -247 582 410 b 592 417 588 415 590 416 "},v36:{x_min:-1.359375,x_max:1064.390625,ha:1086,o:"m 296 692 b 314 694 302 694 307 694 b 386 685 337 694 366 689 b 548 498 480 660 548 580 b 548 481 548 492 548 487 b 455 395 541 426 499 395 b 370 462 420 395 383 417 b 362 496 364 477 362 488 b 377 514 362 509 367 514 b 393 501 386 514 390 510 b 432 474 397 484 413 474 b 470 487 445 474 458 478 b 491 530 484 496 491 510 b 490 544 491 534 491 539 b 333 660 479 606 411 657 l 323 662 l 315 646 b 269 524 285 591 269 556 b 321 431 269 492 287 466 b 349 395 338 413 343 408 b 363 342 359 378 363 362 b 359 312 363 333 362 322 b 285 158 348 266 318 206 b 281 152 283 155 281 152 b 281 152 281 152 281 152 b 287 154 283 152 284 152 b 318 155 298 154 308 155 b 461 98 371 155 419 136 l 464 97 l 483 112 b 503 129 494 120 503 127 b 504 130 503 129 504 129 b 503 138 504 131 503 134 b 500 180 500 152 500 166 b 553 326 500 238 518 288 b 604 366 560 331 592 358 b 649 381 617 376 632 381 b 696 362 665 381 681 374 b 724 302 714 347 724 324 b 695 238 724 278 714 255 b 660 210 691 234 662 212 b 579 148 658 209 582 151 b 579 148 579 148 579 148 b 596 106 579 144 589 119 b 622 77 604 88 609 83 b 657 69 632 72 645 69 b 748 112 688 69 721 84 b 755 123 754 117 755 120 b 755 127 755 124 755 126 b 751 165 752 137 751 151 b 758 219 751 183 754 202 b 894 387 774 290 820 347 b 896 390 896 388 896 388 b 891 398 896 391 895 392 b 622 560 827 477 730 535 b 600 580 605 564 600 569 b 617 596 600 591 607 596 b 628 595 622 596 624 596 b 1057 248 846 552 1020 412 b 1064 191 1061 229 1064 209 b 922 0 1064 94 1005 9 b 902 -1 916 -1 909 -1 b 774 76 847 -1 800 26 b 769 83 770 81 770 83 b 769 81 769 83 769 83 b 627 -1 733 29 677 -1 b 548 27 597 -1 570 8 b 515 88 537 37 525 61 l 513 95 l 510 93 l 453 45 b 390 0 396 0 396 0 b 390 0 390 0 390 0 b 374 15 381 0 377 4 b 268 105 359 69 314 105 b 250 104 262 105 257 105 l 243 102 l 234 90 b 155 1 201 49 159 2 b 147 -1 152 0 149 -1 b 130 15 138 -1 130 6 b 132 20 130 18 132 19 b 136 31 133 22 134 27 b 220 131 149 74 178 109 b 231 137 225 134 230 136 b 302 278 280 202 302 244 b 265 335 302 299 295 309 b 209 442 234 363 213 402 b 209 455 209 446 209 451 b 279 648 209 502 232 564 l 285 659 l 283 659 b 176 627 238 653 210 645 b 57 477 111 594 66 538 b 55 459 55 471 55 464 b 72 409 55 437 61 415 b 93 403 78 405 87 403 b 152 467 123 403 151 431 b 168 488 153 483 157 488 b 185 462 181 488 185 483 l 185 460 b 137 344 183 409 168 369 b 78 322 119 328 98 322 b 13 360 50 322 25 335 b -1 426 4 380 -1 402 b 89 610 -1 488 32 559 b 296 692 147 659 210 685 m 926 348 b 921 353 924 351 922 353 b 914 348 920 353 918 351 b 823 167 857 306 823 237 b 828 124 823 154 826 138 b 890 31 837 79 862 40 b 896 31 892 31 894 31 b 956 104 916 31 940 59 b 970 191 965 129 970 159 b 966 241 970 208 969 224 b 926 348 959 277 945 313 m 627 326 b 619 326 624 326 622 326 b 598 316 611 326 604 323 b 568 215 579 288 568 255 b 568 208 568 213 568 210 b 571 183 570 195 570 184 l 571 183 b 594 201 571 183 582 191 l 634 231 b 660 259 653 247 656 248 b 664 278 662 266 664 272 b 627 326 664 299 649 320 "},v38:{x_min:-1.359375,x_max:651.96875,ha:665,o:"m 389 644 b 405 645 394 645 400 645 b 504 566 450 645 492 613 b 507 541 506 557 507 549 b 480 471 507 514 498 489 l 477 467 l 483 470 b 609 591 539 485 586 531 b 613 601 611 595 613 599 b 631 609 619 607 624 609 b 651 588 641 609 651 602 b 200 -946 651 584 204 -941 b 182 -957 197 -953 190 -957 b 163 -945 174 -957 166 -953 b 161 -939 161 -942 161 -942 b 217 -743 161 -931 170 -904 b 272 -555 247 -639 272 -555 b 272 -555 272 -555 272 -555 b 264 -560 272 -555 268 -557 b 140 -603 227 -589 182 -603 b 36 -567 102 -603 65 -592 b -1 -487 12 -548 -1 -517 b 17 -427 -1 -466 5 -445 b 103 -380 38 -395 70 -380 b 191 -433 137 -380 172 -398 b 205 -484 201 -448 205 -466 b 178 -553 205 -509 196 -535 l 175 -557 l 182 -555 b 307 -435 236 -539 284 -494 b 372 -213 308 -430 372 -215 b 372 -213 372 -213 372 -213 b 364 -219 372 -213 368 -216 b 240 -262 328 -247 283 -262 b 137 -226 202 -262 166 -249 b 99 -145 112 -206 99 -176 b 118 -84 99 -124 106 -104 b 204 -38 138 -54 171 -38 b 292 -91 238 -38 273 -56 b 306 -141 302 -106 306 -124 b 279 -212 306 -167 296 -194 l 276 -215 l 281 -213 b 408 -93 336 -198 385 -151 b 473 129 409 -88 473 127 b 473 129 473 129 473 129 b 465 122 473 129 469 126 b 341 80 428 94 383 80 b 236 115 303 80 266 91 b 200 195 213 136 200 165 b 217 256 200 217 206 238 b 304 303 239 287 272 303 b 393 249 338 303 374 285 b 406 199 402 234 406 217 b 379 129 406 173 397 148 l 377 126 l 382 127 b 509 248 436 142 485 190 b 574 470 510 254 574 469 b 574 470 574 470 574 470 b 566 464 574 470 570 467 b 442 421 529 435 484 421 b 337 458 404 421 367 433 b 300 537 313 478 300 508 b 389 644 300 585 334 635 "},v39:{x_min:-171.5,x_max:251.8125,ha:257,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 553 20 616 20 614 b 20 491 20 503 20 491 l 20 491 b 153 535 47 501 149 535 b 174 514 167 535 174 524 b 164 496 174 508 171 501 b 92 470 164 495 132 484 l 20 445 l 20 390 b 20 363 20 378 20 370 b 20 333 20 340 20 333 l 20 333 b 153 377 47 344 149 377 b 174 356 167 377 174 367 b 164 338 174 349 171 342 b 92 312 164 338 132 326 l 20 288 l 20 219 l 20 148 l 21 151 b 137 199 59 183 99 199 b 182 191 152 199 167 197 b 251 84 227 176 251 134 b 228 0 251 58 243 29 b 100 -142 206 -40 178 -72 l 23 -215 b -1 -229 9 -229 6 -229 b -20 -216 -9 -229 -17 -224 b -21 30 -21 -212 -21 -212 b -21 273 -21 163 -21 273 b -84 252 -21 273 -50 263 b -152 230 -133 234 -145 230 b -157 231 -155 230 -156 231 b -171 252 -166 234 -171 244 b -160 270 -171 259 -167 266 b -27 316 -159 270 -93 294 l -21 319 l -21 374 b -21 431 -21 406 -21 431 b -84 409 -21 431 -50 421 b -152 388 -133 392 -145 388 b -157 390 -155 388 -156 388 b -171 409 -166 392 -171 401 b -160 428 -171 417 -167 424 b -27 474 -159 428 -93 451 l -21 476 l -21 546 b -20 620 -21 614 -21 616 b -8 631 -17 624 -13 630 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 "},v3b:{x_min:0,x_max:484.5625,ha:494,o:"m 228 245 b 239 247 234 247 239 247 b 243 247 240 247 242 247 b 303 238 257 247 287 242 b 484 -2 417 208 484 104 b 412 -177 484 -65 461 -127 b 243 -248 363 -226 303 -248 b 6 -63 138 -248 36 -180 b 0 -1 1 -41 0 -20 b 228 245 0 127 98 240 m 255 181 b 240 183 247 183 245 183 b 232 181 238 183 235 183 b 142 152 200 180 168 170 l 138 149 l 190 97 l 242 44 l 294 97 l 345 149 l 340 152 b 255 181 315 169 284 180 m 147 -54 l 197 -1 l 147 51 l 95 104 l 91 99 b 62 -1 72 70 62 34 b 66 -43 62 -15 63 -29 b 91 -101 72 -63 80 -84 l 95 -106 l 147 -54 m 393 99 b 389 104 390 102 389 104 b 337 51 389 104 366 80 l 285 -1 l 337 -54 l 389 -106 l 393 -101 b 421 -1 412 -72 421 -36 b 393 99 421 34 412 69 m 294 -98 b 242 -45 265 -69 242 -45 b 190 -98 242 -45 219 -69 l 138 -151 l 142 -154 b 242 -184 172 -174 206 -184 b 340 -154 276 -184 311 -174 l 345 -151 l 294 -98 "},v3c:{x_min:0,x_max:450.53125,ha:460,o:"m 189 302 b 204 303 193 302 198 303 b 303 224 250 303 292 270 b 306 199 304 216 306 208 b 279 129 306 173 296 147 l 276 126 l 281 127 b 408 249 337 142 385 190 b 412 259 409 254 412 258 b 430 267 417 265 423 267 b 450 247 441 267 450 259 b 200 -605 450 242 204 -599 b 182 -616 197 -612 190 -616 b 163 -602 174 -616 166 -610 b 161 -598 161 -601 161 -601 b 217 -402 161 -589 170 -562 b 272 -213 247 -298 272 -213 b 272 -213 272 -213 272 -213 b 264 -219 272 -213 268 -216 b 140 -262 227 -247 182 -262 b 36 -226 102 -262 65 -249 b 0 -145 12 -206 0 -176 b 17 -84 0 -124 5 -104 b 103 -38 38 -54 70 -38 b 191 -91 137 -38 172 -56 b 205 -141 201 -106 205 -124 b 178 -212 205 -167 196 -194 l 175 -215 l 182 -213 b 307 -93 236 -198 284 -151 b 372 129 308 -88 372 127 b 372 129 372 129 372 129 b 364 122 372 129 368 126 b 240 80 328 94 283 80 b 137 115 202 80 166 91 b 99 194 111 136 99 165 b 189 302 99 244 133 292 "},v3e:{x_min:0,x_max:406.96875,ha:415,o:"m 21 183 b 28 183 24 183 25 183 b 42 181 34 183 39 183 b 127 108 47 179 47 179 b 202 41 168 72 202 41 b 279 108 204 41 238 72 b 357 177 321 145 356 176 b 375 183 363 181 370 183 b 406 151 392 183 406 169 b 404 137 406 147 405 141 b 322 62 401 131 398 129 b 251 0 284 27 251 0 b 322 -63 251 -1 284 -29 b 404 -138 398 -130 401 -133 b 406 -152 405 -142 406 -148 b 375 -184 406 -170 392 -184 b 357 -179 370 -184 363 -183 b 279 -109 356 -177 321 -147 b 202 -43 238 -73 204 -43 b 127 -109 202 -43 168 -73 b 49 -179 85 -147 50 -177 b 31 -184 43 -183 36 -184 b 0 -152 13 -184 0 -170 b 2 -138 0 -148 0 -142 b 83 -63 5 -133 8 -130 b 155 0 122 -29 155 -1 b 83 62 155 0 122 27 b 8 129 43 97 10 127 b 0 151 2 136 0 144 b 21 183 0 165 8 177 "},v3f:{x_min:-24.5,x_max:317.140625,ha:324,o:"m -24 -147 l -24 -5 l -20 -5 b -1 -19 -12 -5 -4 -11 b 58 -123 6 -43 31 -86 b 196 -278 93 -173 134 -219 b 317 -570 274 -356 317 -460 b 294 -713 317 -617 308 -666 l 289 -724 l 294 -735 b 317 -873 308 -780 317 -827 b 235 -1132 317 -963 288 -1054 b 209 -1165 228 -1140 224 -1146 b 189 -1177 204 -1172 196 -1177 b 171 -1164 182 -1177 175 -1172 b 168 -1154 170 -1161 168 -1159 b 181 -1132 168 -1149 172 -1142 b 269 -891 238 -1064 269 -975 b 269 -881 269 -886 269 -884 b 262 -814 269 -857 265 -827 b 258 -800 261 -811 259 -806 b 142 -628 240 -731 198 -667 b -8 -589 112 -606 47 -589 b -20 -589 -13 -589 -19 -589 l -24 -589 l -24 -449 l -24 -308 l -20 -308 b -1 -322 -12 -308 -4 -313 b 58 -424 6 -345 31 -388 b 194 -580 93 -476 136 -523 b 259 -660 221 -606 245 -635 b 261 -663 259 -662 261 -663 b 264 -656 262 -663 262 -660 b 269 -587 268 -632 269 -610 b 264 -521 269 -566 268 -544 b 262 -512 264 -517 262 -513 b 258 -498 261 -509 259 -503 b 142 -326 240 -428 198 -365 b -8 -287 112 -303 47 -288 b -20 -287 -13 -287 -19 -287 l -24 -287 l -24 -147 "},v40:{x_min:-1.359375,x_max:436.921875,ha:446,o:"m 213 205 b 217 205 215 205 216 205 b 234 194 224 205 234 199 b 236 187 234 194 235 190 l 245 167 l 261 129 l 270 106 b 355 -61 294 54 329 -13 b 420 -163 381 -105 402 -138 b 436 -188 435 -184 436 -184 b 436 -191 436 -190 436 -190 b 421 -206 436 -201 431 -206 l 421 -206 l 416 -206 l 405 -201 b 217 -158 347 -172 283 -158 b 31 -201 153 -158 88 -172 l 20 -206 l 14 -206 l 14 -206 b 0 -191 5 -206 0 -201 b -1 -188 0 -190 -1 -190 b 14 -163 -1 -186 0 -184 b 95 -34 36 -136 72 -77 b 166 106 119 8 148 68 l 175 129 l 183 148 l 200 188 b 213 205 205 199 208 202 "},v41:{x_min:-1.359375,x_max:556.6875,ha:568,o:"m 294 322 b 318 323 299 322 308 323 b 360 320 334 323 352 322 b 526 217 430 310 490 273 b 543 166 537 202 543 184 b 447 70 543 117 503 70 b 445 70 447 70 446 70 b 359 159 394 72 359 113 b 368 201 359 173 362 187 b 442 245 382 229 412 245 b 455 244 446 245 451 245 b 460 244 458 244 460 244 b 460 244 460 244 460 244 b 454 248 460 244 458 245 b 325 291 417 276 372 291 b 285 287 313 291 299 290 b 144 -2 183 269 144 190 b 281 -290 144 -208 179 -280 b 304 -291 289 -291 298 -291 b 524 -105 412 -291 506 -212 b 541 -84 526 -88 530 -84 b 556 -101 551 -84 556 -90 b 549 -138 556 -111 553 -122 b 334 -322 521 -237 435 -310 b 302 -324 323 -323 313 -324 b 13 -101 172 -324 54 -234 b -1 -1 4 -68 -1 -34 b 294 322 -1 161 121 303 "},v42:{x_min:-348.4375,x_max:24.5,ha:25,o:"m -330 155 b -322 156 -329 156 -326 156 b -315 156 -319 156 -317 156 b -298 147 -311 155 -308 154 b -19 30 -224 98 -122 55 l 2 26 b 24 -1 17 22 24 13 b 2 -27 24 -15 17 -23 l -19 -31 b -298 -148 -122 -56 -224 -99 b -322 -158 -313 -158 -315 -158 b -348 -131 -338 -158 -348 -145 b -344 -117 -348 -127 -347 -122 b -328 -104 -341 -112 -338 -111 b -127 -8 -269 -65 -202 -33 b -106 0 -115 -4 -106 -1 b -127 6 -106 0 -115 2 b -328 102 -202 31 -269 63 b -344 116 -338 109 -341 111 b -348 130 -347 120 -348 124 b -330 155 -348 141 -341 152 "},v43:{x_min:-442.359375,x_max:441,ha:450,o:"m -31 487 b -1 488 -21 488 -10 488 b 434 104 216 488 397 330 b 441 27 438 79 441 47 b 439 12 441 20 439 15 b 419 0 435 4 427 0 b 404 5 413 0 408 1 b 398 30 400 11 398 13 b 0 351 390 213 213 351 b -59 348 -20 351 -39 349 b -400 30 -251 324 -393 191 b -405 5 -400 13 -401 11 b -420 0 -409 1 -415 0 b -441 12 -428 0 -436 4 b -442 27 -441 15 -442 20 b -435 104 -442 47 -439 79 b -31 487 -401 316 -235 474 m -13 131 b -1 133 -9 133 -5 133 b 51 105 19 133 39 123 b 61 70 58 95 61 83 b 51 34 61 58 58 45 b -1 6 39 16 19 6 b -46 27 -17 6 -34 13 b -62 69 -57 38 -62 54 b -13 131 -62 98 -44 124 "},v44:{x_min:-21.78125,x_max:251.8125,ha:257,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 383 20 616 20 616 l 20 148 l 21 151 b 137 199 59 183 99 199 b 182 191 152 199 167 197 b 251 84 227 176 251 134 b 228 0 251 58 243 29 b 100 -142 206 -40 178 -72 l 23 -215 b 0 -229 9 -229 6 -229 b -20 -216 -9 -229 -17 -224 l -21 -212 l -21 201 l -21 616 l -20 620 b -8 631 -17 624 -13 630 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 "},v45:{x_min:-402.890625,x_max:401.53125,ha:410,o:"m -10 273 b -4 274 -9 273 -6 274 b 16 262 4 274 12 269 b 17 158 17 259 17 259 l 17 56 l 62 112 b 117 174 110 172 110 172 b 122 174 118 174 119 174 b 132 173 125 174 129 173 b 295 11 134 172 171 134 l 307 -1 l 336 34 b 374 76 366 72 368 74 b 381 77 375 77 378 77 b 401 56 392 77 401 68 b 400 48 401 54 401 51 b 223 -172 397 41 230 -166 b 210 -176 220 -174 215 -176 b 201 -174 206 -176 204 -176 b 112 -87 198 -173 178 -152 b 27 0 65 -38 27 0 b 21 -6 27 0 24 -2 l 17 -12 l 17 -147 b 17 -210 17 -173 17 -194 b 10 -292 17 -297 16 -287 b -2 -299 6 -297 2 -299 b -21 -287 -10 -299 -19 -295 b -24 -174 -23 -284 -23 -284 l -24 -63 l -66 -117 b -121 -176 -110 -170 -114 -176 b -125 -176 -122 -176 -123 -176 b -296 -12 -134 -174 -125 -184 l -308 0 l -337 -34 b -375 -77 -367 -73 -370 -76 b -382 -79 -377 -79 -379 -79 b -402 -58 -393 -79 -402 -69 b -401 -49 -402 -55 -402 -52 b -224 170 -398 -43 -231 165 b -212 174 -221 173 -216 174 b -202 173 -208 174 -205 174 b -39 11 -200 172 -151 122 l -28 -1 l -25 1 l -24 4 l -24 130 b -23 260 -24 256 -24 258 b -10 273 -20 266 -16 270 "},v46:{x_min:0,x_max:627.46875,ha:640,o:"m 306 190 b 314 191 308 191 311 191 b 326 184 318 191 322 190 l 336 173 b 510 52 377 127 442 80 b 515 49 513 51 515 49 b 611 16 537 40 579 24 b 627 0 624 13 627 9 b 607 -18 627 -11 624 -13 b 330 -181 490 -49 389 -109 b 314 -192 323 -190 319 -192 b 306 -191 311 -192 308 -192 b 294 -177 302 -188 302 -188 b 257 -140 287 -170 265 -148 b 19 -18 193 -84 114 -44 b 0 0 2 -13 0 -11 b 16 16 0 9 2 13 b 110 49 47 24 89 40 b 117 52 111 49 114 51 b 145 65 126 56 130 58 b 281 163 200 93 245 124 b 300 186 288 170 291 174 b 306 190 300 187 303 188 m 317 137 b 313 142 315 141 314 142 b 308 137 313 142 311 141 b 161 4 276 84 220 33 b 155 0 159 1 155 0 b 163 -4 155 0 159 -2 b 308 -138 220 -34 276 -84 b 313 -142 311 -141 313 -142 b 317 -138 314 -142 315 -141 b 464 -4 351 -84 406 -34 b 470 0 468 -2 470 0 b 464 4 470 0 468 1 b 317 137 406 33 351 84 "},v47:{x_min:-24.5,x_max:315.78125,ha:322,o:"m -24 -145 l -24 -5 l -20 -5 b 1 -26 -10 -5 -6 -9 b 175 -241 31 -86 96 -166 b 314 -548 259 -323 304 -420 b 315 -589 315 -555 315 -571 b 314 -630 315 -606 315 -623 b 298 -730 311 -664 306 -699 l 295 -742 l 296 -748 b 314 -850 304 -778 311 -813 b 315 -892 315 -857 315 -874 b 314 -932 315 -909 315 -925 b 298 -1032 311 -967 306 -1002 l 295 -1045 l 296 -1050 b 314 -1153 304 -1081 311 -1115 b 315 -1193 315 -1160 315 -1177 b 314 -1235 315 -1211 315 -1228 b 217 -1526 306 -1338 270 -1444 b 201 -1533 213 -1532 208 -1533 b 182 -1522 193 -1533 185 -1529 b 179 -1514 181 -1518 179 -1517 b 189 -1489 179 -1508 182 -1501 b 266 -1217 240 -1403 266 -1308 b 262 -1156 266 -1196 265 -1177 b 110 -907 247 -1043 190 -950 b 0 -889 87 -895 50 -889 l -1 -889 l -24 -889 l -24 -749 l -24 -610 l -20 -610 b 1 -631 -10 -610 -6 -614 b 175 -846 31 -691 96 -771 b 259 -956 213 -884 236 -914 b 265 -966 262 -961 264 -966 b 265 -966 265 -966 265 -966 b 265 -953 265 -964 265 -959 b 266 -920 266 -943 266 -932 b 262 -853 266 -898 265 -873 b 110 -605 247 -741 190 -648 b 0 -587 87 -592 50 -587 l -1 -587 l -24 -587 l -24 -448 l -24 -308 l -20 -308 b 1 -328 -10 -308 -6 -312 b 175 -544 31 -388 96 -469 b 259 -655 213 -581 236 -612 b 265 -663 262 -659 264 -663 b 265 -663 265 -663 265 -663 b 265 -650 265 -663 265 -657 b 266 -617 266 -641 266 -630 b 262 -551 266 -595 265 -570 b 110 -303 247 -438 190 -345 b 0 -284 87 -290 50 -284 l -1 -284 l -24 -284 l -24 -145 "},v49:{x_min:0,x_max:630.203125,ha:643,o:"m 308 204 b 314 205 310 205 313 205 b 326 201 319 205 323 204 b 355 154 328 199 338 180 b 401 83 362 142 392 95 l 409 72 b 431 41 412 66 424 49 b 619 -174 498 -51 570 -134 b 630 -192 626 -180 630 -186 b 626 -202 630 -195 628 -199 b 616 -206 623 -205 620 -206 b 552 -188 608 -206 592 -202 b 310 -155 488 -169 392 -155 b 268 -156 295 -155 281 -155 b 77 -188 197 -161 126 -173 b 13 -206 35 -202 20 -206 b 9 -206 12 -206 10 -206 b 0 -191 2 -202 0 -197 b 8 -176 0 -186 2 -180 b 204 49 58 -136 138 -43 l 220 72 l 227 83 b 295 188 245 108 281 166 b 308 204 299 197 304 202 m 315 147 b 314 147 315 147 314 147 b 314 147 314 147 314 147 b 306 129 314 145 310 138 l 296 105 b 281 72 292 97 284 77 l 274 56 b 181 -123 247 -4 212 -72 l 174 -134 l 176 -133 b 314 -123 215 -127 272 -123 b 451 -133 356 -123 413 -127 l 454 -134 l 449 -123 b 353 56 417 -72 381 -4 l 347 72 b 332 105 344 77 336 97 l 322 129 b 315 147 318 138 315 145 "},v4a:{x_min:70.78125,x_max:378.390625,ha:315,o:"m 246 373 b 254 373 249 373 251 373 b 372 324 303 373 360 351 b 378 302 377 317 378 309 b 338 251 378 278 362 255 b 328 249 334 249 332 249 b 283 294 303 249 283 270 b 288 315 283 301 284 308 b 289 319 289 317 289 319 b 289 319 289 319 289 319 b 283 320 289 320 287 320 b 270 322 279 322 274 322 b 206 288 242 322 215 308 b 206 283 206 287 206 285 b 257 223 206 267 230 238 b 284 206 272 213 277 210 b 351 90 328 173 351 130 b 340 47 351 74 348 59 b 205 -30 314 -2 264 -30 b 182 -29 198 -30 190 -30 b 84 15 147 -24 103 -5 b 70 48 74 24 70 36 b 108 99 70 70 85 94 b 121 102 112 101 117 102 b 167 56 147 102 167 80 b 159 31 167 48 164 40 l 156 26 l 157 26 b 190 20 167 22 178 20 b 220 26 201 20 212 22 b 258 65 243 34 258 51 b 257 70 258 66 258 69 b 204 126 249 94 234 109 b 114 258 148 158 114 209 b 125 302 114 273 118 288 b 246 373 147 342 193 370 "},v4b:{x_min:0,x_max:503.609375,ha:514,o:"m 274 430 b 277 430 276 430 277 430 b 310 394 296 430 310 415 b 308 383 310 391 308 387 b 306 367 307 381 307 374 b 236 120 298 305 272 210 b 40 -273 189 -5 125 -134 b 20 -287 35 -283 27 -287 b 5 -281 14 -287 9 -285 b 0 -267 1 -277 0 -273 b 9 -242 0 -262 2 -255 b 246 395 137 -12 232 242 b 274 430 249 416 257 427 m 468 430 b 472 430 469 430 470 430 b 503 394 490 430 503 415 b 502 383 503 391 503 387 b 499 367 502 381 500 374 b 431 120 491 305 465 210 b 234 -273 382 -5 318 -134 b 213 -287 228 -283 220 -287 b 198 -281 208 -287 202 -285 b 193 -267 194 -277 193 -273 b 202 -242 193 -262 196 -255 b 439 395 330 -12 426 242 b 468 430 442 416 451 427 "},v4d:{x_min:-311.6875,x_max:310.328125,ha:317,o:"m -9 388 b -2 390 -8 390 -5 390 b 5 388 1 390 4 390 b 19 378 10 387 16 383 b 23 333 23 371 23 371 b 24 298 23 299 24 298 b 81 276 34 298 65 285 b 213 91 145 240 190 177 b 224 24 217 76 224 36 b 257 24 224 24 235 24 b 299 19 292 24 292 24 b 310 -1 306 15 310 6 b 299 -23 310 -11 306 -19 b 257 -27 292 -27 292 -27 b 224 -29 235 -27 224 -29 b 213 -95 224 -40 217 -80 b 81 -280 190 -181 145 -244 b 24 -301 65 -290 34 -301 b 23 -335 24 -301 23 -303 l 23 -340 b 17 -381 23 -374 23 -374 b -1 -391 13 -388 5 -391 b -21 -381 -9 -391 -17 -388 b -27 -340 -27 -374 -27 -374 l -27 -335 b -28 -301 -27 -303 -27 -301 b -85 -280 -38 -301 -69 -290 b -217 -95 -149 -244 -194 -181 b -228 -29 -221 -80 -228 -40 b -259 -27 -228 -29 -238 -27 b -300 -23 -294 -27 -294 -27 b -311 -2 -307 -19 -311 -11 b -294 23 -311 8 -304 19 b -259 24 -291 23 -284 24 b -228 24 -239 24 -228 24 b -217 91 -228 36 -221 76 b -85 276 -194 177 -149 240 b -28 298 -69 285 -38 298 b -27 333 -27 298 -27 299 b -27 371 -27 362 -27 369 b -9 388 -24 378 -17 385 m -27 136 b -28 247 -27 197 -28 247 b -61 216 -31 247 -53 226 b -123 33 -95 172 -121 98 l -125 24 l -76 24 l -27 24 l -27 136 m 29 242 b 24 247 27 245 24 247 b 23 136 24 247 23 197 l 23 24 l 72 24 l 121 24 l 119 33 b 29 242 115 116 77 206 m -27 -140 l -27 -27 l -76 -27 l -125 -27 l -123 -36 b -61 -220 -121 -102 -95 -176 b -28 -251 -53 -230 -31 -251 b -27 -140 -28 -251 -27 -201 m 119 -36 l 121 -27 l 72 -27 l 23 -27 l 23 -140 b 24 -251 23 -201 24 -251 b 57 -220 27 -251 49 -230 b 119 -36 91 -176 117 -102 "},v4e:{x_min:0,x_max:239.5625,ha:244,o:"m 10 460 b 20 462 13 462 14 462 b 39 449 28 462 35 458 l 40 446 l 40 326 b 40 205 40 259 40 205 b 127 227 40 205 80 215 b 220 249 196 244 213 249 b 227 247 224 249 225 248 b 238 237 231 245 235 241 l 239 233 l 239 -106 l 239 -448 l 238 -451 b 219 -463 234 -459 225 -463 b 198 -451 210 -463 202 -459 l 197 -448 l 197 -324 b 197 -201 197 -248 197 -201 b 110 -223 196 -201 157 -210 b 17 -245 42 -240 24 -245 b 10 -242 13 -245 13 -244 b 0 -233 6 -241 2 -237 l 0 -230 l 0 108 l 0 446 l 0 449 b 10 460 2 453 6 458 m 197 22 b 197 70 197 41 197 58 b 196 116 197 113 197 116 l 196 116 b 118 97 196 116 160 106 l 40 77 l 40 -18 b 40 -112 40 -69 40 -112 l 119 -93 l 197 -73 l 197 22 "},v51:{x_min:-1.359375,x_max:455.96875,ha:465,o:"m 352 541 b 357 542 353 542 355 542 b 377 530 364 542 372 537 l 378 526 l 378 394 l 379 262 l 404 266 b 436 270 420 269 430 270 b 450 265 443 270 446 269 b 455 220 455 259 455 260 l 455 208 l 455 161 l 454 156 b 411 140 449 147 447 147 b 378 133 393 137 379 134 b 378 68 378 133 378 106 b 378 22 378 54 378 38 l 379 -87 l 404 -83 b 436 -79 420 -80 430 -79 b 450 -84 443 -79 446 -80 b 455 -129 455 -90 455 -88 l 455 -141 l 455 -188 l 454 -192 b 413 -209 449 -202 447 -202 b 382 -215 398 -212 383 -215 l 378 -215 l 378 -345 l 378 -380 b 375 -485 378 -484 378 -480 b 357 -494 371 -491 364 -494 b 340 -485 351 -494 344 -491 b 336 -383 337 -480 336 -484 l 336 -349 l 336 -223 l 334 -223 b 291 -231 334 -223 314 -227 l 247 -240 l 247 -371 l 246 -503 l 245 -506 b 225 -519 242 -514 234 -519 b 206 -506 219 -519 210 -514 l 205 -503 l 205 -376 l 205 -248 l 160 -256 l 115 -265 l 115 -396 l 115 -527 l 114 -531 b 95 -544 110 -539 102 -544 b 76 -531 87 -544 78 -539 l 73 -527 l 73 -399 b 73 -273 73 -330 73 -273 b 49 -277 73 -273 61 -274 b 17 -281 32 -280 24 -281 b 4 -276 10 -281 8 -280 b -1 -234 0 -269 -1 -272 b 0 -219 -1 -229 0 -224 l 0 -170 l 1 -167 b 10 -158 2 -163 6 -159 b 49 -149 13 -156 16 -155 l 73 -145 l 73 -34 b 73 76 73 26 73 76 b 49 72 73 76 61 74 b 17 68 32 69 24 68 b 4 73 10 68 8 69 b -1 115 0 80 -1 77 b 0 130 -1 120 0 124 l 0 179 l 1 181 b 10 191 2 186 6 190 b 49 199 13 192 16 194 l 73 204 l 73 338 b 73 374 73 352 73 365 b 77 483 73 484 73 477 b 95 492 81 489 88 492 b 111 483 100 492 107 489 b 115 378 115 477 115 483 l 115 342 b 117 212 115 223 115 212 b 204 229 117 212 200 227 l 205 229 l 205 365 l 205 502 l 206 505 b 225 517 210 513 219 517 b 245 505 234 517 242 513 l 246 502 l 247 369 l 247 237 l 249 237 b 336 254 253 238 336 254 b 337 390 336 254 337 302 l 337 526 l 338 530 b 352 541 341 535 347 539 m 336 15 b 336 126 336 102 336 126 l 336 126 b 291 117 336 126 315 122 l 247 109 l 247 -1 l 247 -112 l 249 -112 b 336 -95 253 -111 336 -95 b 336 15 336 -95 336 -56 m 205 -120 b 205 -55 205 -120 205 -93 b 205 -9 205 -41 205 -24 l 205 101 l 160 93 l 115 84 l 115 -26 b 115 -83 115 -49 115 -69 b 117 -137 115 -133 115 -137 b 205 -120 118 -137 204 -120 "},v52:{x_min:-10.890625,x_max:298.078125,ha:294,o:"m 138 473 b 142 474 140 473 141 474 b 164 459 148 474 153 470 b 191 402 183 442 191 423 b 181 353 191 388 187 371 b 178 349 179 352 178 349 b 179 348 178 348 179 348 b 185 349 181 348 182 348 b 255 376 210 355 234 363 b 272 381 264 381 266 381 b 298 355 287 381 298 370 b 288 330 298 348 298 345 b 171 34 238 254 194 141 b 166 13 168 16 168 16 b 144 1 161 5 152 1 b 121 15 134 1 125 5 b 115 33 119 18 117 24 b 0 330 91 145 49 252 b -10 355 -9 345 -10 348 b 13 381 -10 371 0 381 b 31 376 19 381 25 380 b 132 345 61 358 103 345 l 136 345 l 137 355 b 145 378 138 359 142 370 b 152 415 149 394 152 405 b 137 452 152 427 148 438 b 133 464 134 458 133 460 b 138 473 133 467 134 470 "},v53:{x_min:0,x_max:902.421875,ha:921,o:"m 17 240 b 24 241 19 241 21 241 b 32 240 28 241 31 241 b 46 229 38 238 43 234 b 50 88 50 223 50 237 b 50 -1 50 63 50 34 b 50 -90 50 -36 50 -65 b 46 -231 50 -238 50 -224 b 25 -242 42 -238 34 -242 b 0 -224 14 -242 4 -235 b 0 2 0 -222 0 -108 b 0 223 0 112 0 220 b 17 240 2 230 9 237 m 110 240 b 118 241 111 241 114 241 b 126 240 121 241 123 241 b 142 223 133 237 140 230 b 144 123 144 220 144 205 b 144 29 144 45 144 29 b 144 29 144 29 144 29 b 393 183 166 106 264 167 b 450 186 412 184 431 186 b 756 29 600 186 732 120 b 756 29 756 29 756 29 b 758 123 758 29 758 45 b 760 227 758 226 758 223 b 784 241 766 237 774 241 b 804 229 792 241 800 237 b 809 88 808 223 809 237 l 809 -1 l 809 -90 b 804 -231 809 -238 808 -224 b 784 -242 800 -238 792 -242 b 762 -231 775 -242 766 -238 b 758 -124 756 -224 758 -231 b 756 -30 758 -47 758 -30 b 756 -30 756 -30 756 -30 b 509 -184 736 -108 637 -169 b 450 -187 488 -187 469 -187 b 144 -30 300 -187 168 -122 b 144 -30 144 -30 144 -30 b 144 -124 144 -30 144 -47 b 140 -231 144 -231 144 -224 b 118 -242 134 -238 126 -242 b 92 -224 107 -242 96 -235 b 92 2 92 -222 92 -108 b 92 223 92 112 92 220 b 110 240 95 230 102 237 m 432 161 b 413 162 426 162 420 162 b 313 41 351 162 313 109 b 347 -73 313 5 323 -34 b 487 -163 385 -133 439 -163 b 578 -97 526 -163 562 -142 b 588 -43 585 -80 588 -62 b 432 161 588 47 518 147 m 868 240 b 876 241 869 241 872 241 b 884 240 879 241 882 241 b 898 229 890 238 894 234 b 902 88 902 223 902 237 l 902 -1 l 902 -90 b 898 -231 902 -238 902 -224 b 876 -242 892 -238 884 -242 b 852 -224 865 -242 854 -235 b 850 2 850 -222 850 -108 b 852 223 850 112 850 220 b 868 240 853 230 860 237 "},v54:{x_min:-24.5,x_max:317.140625,ha:324,o:"m -24 -161 l -24 -5 l -20 -5 b 0 -24 -9 -5 -2 -12 b 171 -315 21 -124 84 -233 b 317 -660 268 -406 317 -531 b 187 -1014 317 -782 274 -909 b 161 -1034 172 -1034 171 -1034 b 141 -1013 149 -1034 141 -1025 b 152 -991 141 -1004 142 -1002 b 266 -682 228 -899 266 -788 b 174 -430 266 -588 236 -498 b -23 -317 136 -388 66 -348 b -24 -161 -23 -316 -24 -285 "},v55:{x_min:0,x_max:551.25,ha:563,o:"m 289 644 b 304 645 294 645 299 645 b 404 566 349 645 392 613 b 406 541 405 557 406 549 b 379 471 406 514 397 489 l 377 467 l 382 470 b 509 591 438 485 485 531 b 513 601 510 595 513 599 b 530 609 518 607 524 609 b 551 588 540 609 551 602 b 200 -605 551 584 204 -599 b 182 -616 197 -612 190 -616 b 163 -602 174 -616 166 -610 b 161 -598 161 -601 161 -601 b 217 -402 161 -589 170 -562 b 272 -213 247 -298 272 -213 b 272 -213 272 -213 272 -213 b 264 -219 272 -213 268 -216 b 140 -262 227 -247 182 -262 b 36 -226 102 -262 65 -249 b 0 -145 12 -206 0 -176 b 17 -84 0 -124 5 -104 b 103 -38 38 -54 70 -38 b 191 -91 137 -38 172 -56 b 205 -141 201 -106 205 -124 b 178 -212 205 -167 196 -194 l 175 -215 l 182 -213 b 307 -93 236 -198 284 -151 b 372 129 308 -88 372 127 b 372 129 372 129 372 129 b 364 122 372 129 368 126 b 240 80 328 94 283 80 b 137 115 202 80 166 91 b 99 195 112 136 99 165 b 118 256 99 217 106 238 b 204 303 138 287 171 303 b 292 249 238 303 273 285 b 306 199 302 234 306 217 b 279 129 306 173 296 148 l 276 126 l 281 127 b 408 248 336 142 385 190 b 473 470 409 254 473 469 b 473 470 473 470 473 470 b 465 464 473 470 469 467 b 341 421 428 435 383 421 b 236 458 303 421 266 433 b 200 537 212 478 200 508 b 289 644 200 585 234 635 "},v58:{x_min:-21.78125,x_max:367.5,ha:375,o:"m 259 1553 b 265 1553 261 1553 264 1553 b 288 1540 272 1553 277 1550 b 367 1351 340 1493 367 1424 b 336 1221 367 1308 357 1263 l 332 1211 l 333 1208 b 367 1077 356 1170 367 1124 b 336 945 367 1032 357 986 l 332 935 l 333 932 b 367 800 356 893 367 848 b 336 669 367 756 357 710 l 332 659 l 333 656 b 367 523 356 617 367 571 b 345 412 367 485 360 446 b 231 273 322 356 284 310 b -1 19 121 195 27 93 b -17 4 -4 11 -10 5 l -21 4 l -21 134 l -21 265 l -17 265 b 133 291 20 265 96 278 b 318 537 245 328 318 433 b 307 603 318 559 315 582 b 303 614 304 612 304 614 b 298 609 302 614 300 613 b 231 549 281 589 258 567 b -1 295 121 471 27 369 b -17 280 -4 287 -10 281 l -21 280 l -21 410 l -21 541 l -17 541 b 133 567 20 541 96 555 b 318 813 245 605 318 709 b 307 880 318 835 315 859 b 303 891 304 888 304 891 b 298 885 302 891 300 888 b 231 825 281 866 258 843 b -1 571 121 748 27 645 b -17 556 -4 563 -10 557 l -21 556 l -21 687 l -21 817 l -17 817 b 133 843 20 817 96 830 b 318 1089 245 881 318 985 b 307 1156 318 1111 315 1134 b 303 1167 304 1164 304 1167 b 298 1161 302 1167 300 1164 b 231 1102 281 1140 258 1120 b -1 848 121 1024 27 921 b -17 832 -4 839 -10 834 l -21 832 l -21 963 l -21 1093 l -17 1093 b 114 1113 12 1093 78 1103 b 313 1314 215 1142 289 1218 b 318 1364 317 1331 318 1347 b 255 1511 318 1422 295 1478 b 243 1532 247 1519 243 1525 b 259 1553 243 1540 250 1550 "},v59:{x_min:0,x_max:464.140625,ha:474,o:"m 0 0 l 0 347 l 76 347 l 153 347 l 153 0 l 153 -348 l 76 -348 l 0 -348 l 0 0 m 308 -1 l 308 347 l 386 347 l 464 347 l 464 -1 l 464 -348 l 386 -348 l 308 -348 l 308 -1 "},v5a:{x_min:-171.5,x_max:170.140625,ha:174,o:"m -6 566 b 0 567 -5 567 -2 567 b 14 556 6 567 12 563 b 92 285 14 555 50 433 b 170 13 166 33 170 19 b 168 13 170 13 170 13 b 161 1 168 8 167 4 l 159 0 l 122 0 l 84 0 l 81 1 b 21 195 76 5 78 -5 b -32 381 -8 297 -32 381 b -87 197 -32 381 -57 298 b -141 8 -115 94 -140 9 b -155 0 -142 2 -149 0 b -171 15 -163 0 -171 5 b -14 556 -171 18 -24 528 b -6 566 -14 560 -10 564 "},v5b:{x_min:-441,x_max:439.640625,ha:449,o:"m -428 -2 b -421 0 -427 -1 -424 0 b -406 -6 -416 0 -409 -2 b -400 -31 -401 -12 -400 -15 b -1 -352 -392 -215 -215 -352 b 58 -349 19 -352 38 -351 b 398 -31 250 -326 392 -192 b 404 -6 398 -15 400 -12 b 419 -1 408 -2 413 -1 b 439 -13 427 -1 435 -5 b 439 -29 439 -16 439 -22 b 434 -105 439 -48 438 -80 b 0 -489 397 -333 213 -489 b -68 -484 -23 -489 -44 -488 b -441 -36 -280 -452 -436 -263 b -441 -30 -441 -34 -441 -31 b -428 -2 -441 -11 -439 -5 m -13 -9 b -1 -8 -9 -8 -5 -8 b 50 -36 19 -8 39 -19 b 61 -72 57 -47 61 -59 b 50 -106 61 -84 57 -97 b -1 -134 39 -124 19 -134 b -46 -115 -17 -134 -34 -129 b -62 -72 -57 -102 -62 -87 b -13 -9 -62 -44 -44 -16 "},v5c:{x_min:0,x_max:447.8125,ha:457,o:"m 0 -87 l 0 0 l 223 0 l 447 0 l 447 -87 l 447 -174 l 223 -174 l 0 -174 l 0 -87 "},v5d:{x_min:-1.359375,x_max:592.078125,ha:604,o:"m 280 692 b 295 694 283 692 289 694 b 310 692 300 694 307 692 b 357 630 340 684 357 657 b 336 580 357 612 351 594 b 311 538 321 566 311 549 b 352 492 311 512 330 492 b 366 495 357 492 362 492 b 397 553 390 503 397 517 b 415 603 397 576 402 591 b 460 623 427 617 443 623 b 509 599 479 623 498 614 b 522 559 518 587 522 573 b 494 506 522 538 513 519 b 451 495 481 498 473 496 b 415 488 432 495 426 494 b 394 449 404 483 394 464 b 394 448 394 448 394 448 l 394 440 l 397 433 b 428 409 404 420 413 413 b 438 408 431 408 435 408 b 479 431 450 408 462 415 b 528 455 495 448 510 455 b 548 452 534 455 541 453 b 592 391 577 442 592 416 b 549 331 592 365 577 340 b 528 327 541 328 534 327 b 479 351 510 327 495 335 b 438 374 464 367 450 374 b 417 369 431 374 424 373 b 394 333 402 360 394 348 b 400 312 394 326 396 319 b 451 287 408 294 420 288 b 513 258 484 285 499 278 b 522 223 519 247 522 234 b 461 159 522 190 496 159 b 449 161 457 159 453 159 b 397 229 416 167 397 191 b 366 288 397 265 390 278 b 352 290 362 290 357 290 b 315 262 336 290 321 280 b 311 245 313 256 311 251 b 334 204 311 233 318 220 b 355 170 348 190 351 184 b 357 152 356 166 357 159 b 355 136 357 147 356 140 b 295 88 345 104 321 88 b 232 152 264 88 232 112 b 255 204 232 174 238 186 b 279 244 273 222 279 231 l 279 245 b 238 290 279 270 259 290 b 224 288 234 290 228 290 b 193 229 200 278 193 265 b 141 161 193 191 174 167 b 129 159 137 159 133 159 b 68 223 93 159 68 190 b 77 258 68 234 70 247 b 138 287 91 278 106 285 b 185 302 166 287 175 291 b 196 333 193 312 196 323 b 174 369 196 347 187 360 b 152 374 166 373 159 374 b 111 351 140 374 126 367 b 62 327 95 335 80 327 b 51 328 58 327 54 327 b -1 391 16 334 -1 363 b 53 455 -1 420 17 449 b 62 455 57 455 59 455 b 111 431 80 455 95 448 b 152 408 127 415 140 408 b 161 409 155 408 159 408 b 193 433 176 413 186 420 l 196 440 l 196 448 b 196 451 196 449 196 449 b 190 471 196 459 194 463 b 137 495 182 489 167 495 l 134 495 l 134 495 b 68 560 95 495 68 521 b 129 623 68 596 95 623 b 144 621 134 623 138 623 b 193 553 175 614 193 589 b 224 495 193 517 200 503 b 238 492 228 492 234 492 b 279 538 259 492 279 512 b 254 580 279 549 269 566 b 232 630 239 594 232 612 b 280 692 232 657 250 684 m 307 456 b 295 458 303 458 299 458 b 230 391 258 458 230 426 b 236 360 230 381 231 371 b 295 324 249 337 272 324 b 353 360 318 324 341 337 b 360 391 357 370 360 381 b 307 456 360 421 340 451 "},v60:{x_min:-590.71875,x_max:589.359375,ha:601,o:"m -367 173 b -362 174 -366 174 -364 174 b -351 173 -357 174 -353 173 b -262 86 -348 172 -328 151 b -176 0 -216 37 -176 0 b -107 84 -176 0 -145 37 b -31 174 -36 173 -38 172 b -25 174 -29 174 -28 174 b -16 173 -23 174 -19 173 b 72 86 -13 172 6 151 b 157 0 119 37 157 0 b 227 84 159 0 189 37 b 303 174 298 173 296 172 b 308 174 304 174 307 174 b 318 173 313 174 317 173 b 481 11 322 172 357 134 l 494 -1 l 522 34 b 560 76 553 72 555 74 b 567 77 563 77 564 77 b 589 56 579 77 589 68 b 586 48 589 54 588 51 b 411 -172 583 41 416 -166 b 397 -176 406 -174 401 -176 b 387 -174 393 -176 390 -176 b 299 -87 386 -173 366 -152 b 213 0 253 -38 213 0 b 144 -86 213 0 182 -38 b 68 -174 73 -174 74 -173 b 62 -176 66 -176 65 -176 b 53 -174 59 -176 55 -174 b -35 -87 50 -173 29 -152 b -121 0 -83 -38 -121 0 b -190 -86 -122 0 -152 -38 b -266 -174 -261 -174 -259 -173 b -272 -176 -268 -176 -270 -176 b -281 -174 -276 -176 -280 -174 b -371 -86 -284 -173 -304 -152 b -457 0 -417 -38 -457 0 l -457 0 b -477 -26 -457 0 -470 -16 b -548 -227 -524 -88 -548 -161 b -536 -303 -548 -254 -544 -280 b -533 -317 -534 -309 -533 -313 b -553 -338 -533 -330 -541 -338 b -577 -315 -566 -338 -571 -333 b -590 -227 -586 -287 -590 -258 b -518 -9 -590 -154 -564 -77 b -465 56 -509 2 -504 8 l -402 134 b -367 173 -375 169 -372 172 "},v62:{x_min:46.28125,x_max:669.671875,ha:563,o:"m 183 376 b 189 376 185 376 187 376 b 212 374 197 376 208 376 b 265 337 234 369 253 355 b 274 317 268 331 273 320 b 274 316 274 317 274 316 b 280 323 276 316 276 319 b 311 358 288 337 299 348 b 319 366 315 360 318 365 b 356 376 326 373 340 376 b 382 371 364 376 374 374 b 428 337 400 366 417 352 b 436 317 431 331 436 320 b 438 316 436 317 436 316 b 442 323 438 316 439 319 b 475 358 451 337 462 348 b 483 366 477 360 481 365 b 518 376 488 373 503 376 b 544 373 528 376 536 376 b 604 285 579 360 604 326 b 597 249 604 273 601 258 b 543 63 596 247 544 70 b 541 54 543 61 541 55 b 540 44 540 51 540 47 b 552 23 540 33 545 23 b 552 23 552 23 552 23 b 647 126 586 29 627 72 b 658 138 651 136 653 138 b 660 138 660 138 660 138 b 669 129 666 137 669 136 b 654 88 669 122 665 109 b 562 -12 631 43 602 9 l 549 -19 b 521 -27 540 -24 530 -27 b 447 30 490 -27 458 -4 b 443 58 445 38 443 48 b 450 93 443 72 446 84 b 504 278 453 97 504 272 b 507 288 506 283 506 287 b 509 298 507 292 509 295 b 491 326 509 310 502 320 b 487 327 490 327 488 327 b 479 324 484 327 483 326 b 441 270 462 316 443 288 b 435 249 441 265 436 254 b 398 127 434 248 419 195 b 362 4 379 61 362 5 b 328 -1 359 -1 362 -1 b 314 -1 323 -1 319 -1 b 302 -1 310 -1 306 -1 b 266 4 266 -1 269 -1 b 265 6 265 5 265 5 b 303 144 265 13 272 34 b 343 278 325 216 343 276 b 344 288 343 281 344 285 b 345 298 345 291 345 295 b 330 326 345 310 340 320 b 323 327 328 327 325 327 b 317 324 322 327 321 326 b 279 270 300 316 281 288 b 273 249 279 265 274 254 b 236 127 272 248 255 195 b 200 4 216 61 200 5 b 164 -1 197 -1 198 -1 b 151 -1 161 -1 156 -1 b 140 -1 147 -1 142 -1 b 103 4 104 -1 106 -1 b 103 6 103 5 103 5 b 141 144 103 13 108 34 b 181 278 161 216 179 276 b 182 288 181 281 181 285 b 183 298 182 291 183 295 b 168 324 183 310 178 320 b 160 327 166 326 163 327 b 141 320 156 327 151 324 b 69 230 112 305 85 272 b 57 215 65 217 62 215 b 55 215 57 215 55 215 b 46 224 49 215 46 217 b 59 260 46 231 50 242 b 151 363 81 306 112 341 b 161 369 155 365 160 367 b 183 376 166 371 174 374 "},v68:{x_min:-597.53125,x_max:596.171875,ha:608,o:"m -533 324 b -525 327 -530 326 -528 327 b -504 305 -514 327 -504 317 b -504 305 -504 305 -504 305 b -513 284 -504 299 -504 299 b -556 112 -541 226 -556 167 b -545 33 -556 84 -552 58 b -524 -20 -541 15 -532 -9 l -522 -23 l -491 15 l -413 111 b -355 174 -367 169 -363 174 b -351 174 -353 174 -352 174 b -254 86 -343 174 -348 179 b -168 -1 -208 37 -168 -1 b -100 84 -168 -1 -137 37 b -23 173 -28 173 -29 172 b -19 174 -21 174 -20 174 b -8 173 -14 174 -10 173 b 155 11 -5 172 43 123 l 166 -1 l 168 1 l 170 4 l 170 130 b 171 260 170 256 170 258 b 191 274 175 269 183 274 b 205 267 196 274 201 272 b 212 158 212 262 210 273 l 212 56 l 257 112 b 311 173 304 172 304 172 b 317 174 313 174 314 174 b 326 173 319 174 323 173 b 490 11 329 172 366 134 l 502 -1 l 530 34 b 568 76 560 72 563 74 b 575 77 570 77 573 77 b 596 56 586 77 596 68 b 594 48 596 54 596 51 b 417 -172 592 41 424 -166 b 405 -176 415 -174 409 -176 b 396 -174 401 -176 398 -176 b 307 -87 393 -173 372 -152 b 221 -1 259 -38 221 -1 b 216 -6 221 -1 219 -2 l 212 -12 l 212 -147 b 212 -210 212 -173 212 -194 b 205 -292 212 -297 210 -287 b 191 -299 201 -297 196 -299 b 172 -287 183 -299 175 -295 b 170 -174 171 -284 171 -284 l 170 -63 l 127 -117 b 73 -176 84 -170 80 -176 b 68 -176 72 -176 70 -176 b -27 -87 59 -174 65 -180 b -114 0 -74 -38 -112 0 b -182 -86 -114 0 -145 -38 b -258 -174 -253 -174 -253 -173 b -264 -176 -259 -176 -262 -176 b -274 -174 -268 -176 -272 -174 b -438 -11 -277 -173 -348 -102 l -449 0 l -479 -37 b -524 -80 -513 -80 -514 -80 l -524 -80 b -553 -52 -534 -80 -540 -74 b -597 109 -583 -8 -597 48 b -560 280 -597 165 -585 224 b -533 324 -548 310 -540 322 "},v6c:{x_min:-1.359375,x_max:193.28125,ha:197,o:"m 78 233 b 87 233 81 233 84 233 b 187 140 132 233 174 195 b 193 102 190 127 193 115 b 43 -113 193 22 136 -62 b 27 -119 36 -116 31 -119 b 19 -108 21 -119 19 -115 b 29 -97 19 -102 20 -101 b 102 13 73 -72 102 -27 b 92 51 102 26 98 40 l 91 54 l 84 54 b 8 104 53 54 21 74 b -1 142 1 116 -1 130 b 78 233 -1 187 31 227 "},v6d:{x_min:-590.71875,x_max:589.359375,ha:601,o:"m 544 335 b 553 337 548 337 551 337 b 575 313 563 337 570 330 b 589 226 583 285 589 256 b 517 8 589 152 563 76 b 464 -58 507 -4 503 -9 l 401 -136 b 362 -176 372 -172 370 -176 b 357 -176 360 -176 359 -176 b 261 -87 349 -174 355 -180 b 175 0 215 -38 175 0 b 106 -86 175 0 144 -38 b 29 -174 35 -174 36 -173 b 24 -176 28 -176 27 -176 b 14 -174 21 -176 17 -174 b -73 -87 12 -173 -8 -152 b -159 0 -121 -38 -159 0 b -228 -86 -160 0 -190 -38 b -304 -174 -299 -174 -298 -173 b -310 -176 -306 -176 -308 -176 b -319 -174 -314 -176 -318 -174 b -483 -12 -323 -173 -359 -137 l -495 0 l -524 -34 b -562 -77 -553 -73 -556 -76 b -568 -79 -564 -79 -566 -79 b -590 -58 -581 -79 -590 -69 b -588 -49 -590 -55 -589 -52 b -412 170 -585 -43 -417 165 b -398 174 -408 173 -402 174 b -389 173 -394 174 -392 174 b -300 86 -387 172 -366 151 b -215 -1 -254 37 -215 -1 b -145 84 -215 -1 -183 37 b -69 173 -74 173 -76 172 b -63 174 -68 174 -66 174 b -54 173 -61 174 -57 173 b 34 86 -51 172 -31 151 b 119 -1 81 37 119 -1 b 189 84 121 -1 151 37 b 265 173 259 173 258 172 b 270 174 266 174 269 174 b 280 173 274 174 279 173 b 370 84 283 172 303 151 b 455 -1 416 37 455 -1 l 455 -1 b 476 24 455 -1 469 15 b 547 226 522 87 547 159 b 534 302 547 252 543 278 b 532 317 533 308 532 313 b 544 335 532 326 536 333 "},v6f:{x_min:-80.3125,x_max:78.9375,ha:81,o:"m 63 191 b 69 192 65 192 66 192 b 77 188 72 192 76 191 b 78 183 78 187 78 186 b 74 158 78 179 77 172 l 66 115 b 9 -161 49 30 10 -158 b -10 -187 6 -172 -1 -181 b -34 -194 -17 -191 -25 -194 b -80 -147 -58 -194 -80 -174 b -80 -141 -80 -144 -80 -142 b 9 70 -80 -134 -73 -117 l 49 163 b 63 191 59 188 61 190 "},v70:{x_min:0,x_max:436.921875,ha:446,o:"m 213 190 b 217 191 215 191 216 191 b 231 184 223 191 228 188 b 249 154 240 167 246 159 b 419 18 292 91 348 45 b 436 -1 435 11 436 8 b 424 -16 436 -9 434 -13 b 308 -87 394 -26 340 -59 b 231 -186 276 -117 257 -142 b 219 -192 228 -191 225 -192 b 198 -174 209 -192 208 -191 b 47 -33 161 -113 110 -63 b 10 -16 34 -26 17 -19 b 0 -1 2 -13 0 -9 b 17 18 0 8 1 11 b 198 173 95 48 156 101 b 213 190 206 187 208 188 "},v72:{x_min:-423.3125,x_max:421.9375,ha:431,o:"m -262 197 b -247 197 -257 197 -253 197 b -118 162 -210 197 -163 184 b 40 45 -61 134 -13 98 b 277 -95 119 -33 200 -81 b 289 -97 281 -97 285 -97 b 378 0 332 -97 371 -55 b 378 11 378 4 378 6 b 302 83 378 55 345 83 b 242 66 283 83 262 77 b 208 56 231 59 219 56 b 148 120 175 56 148 81 b 201 186 148 151 164 172 b 261 198 220 194 240 198 b 420 45 341 198 411 136 b 421 22 421 37 421 29 b 245 -199 421 -93 338 -199 b 238 -198 243 -199 240 -199 b -44 -47 148 -194 50 -141 b -250 86 -114 22 -183 66 b -295 94 -270 91 -283 94 b -315 91 -302 94 -307 94 b -381 4 -356 81 -381 43 b -355 -56 -381 -18 -372 -40 b -298 -81 -338 -73 -319 -81 b -246 -68 -283 -81 -265 -77 b -212 -58 -234 -61 -223 -58 b -178 -69 -200 -58 -189 -62 b -151 -122 -160 -81 -151 -101 b -171 -167 -151 -138 -157 -155 b -239 -195 -185 -181 -213 -192 b -257 -197 -245 -197 -250 -197 b -423 -5 -352 -197 -423 -109 b -412 65 -423 16 -419 40 b -262 197 -389 137 -329 188 "},v74:{x_min:-206.890625,x_max:428.75,ha:438,o:"m 389 -351 b 394 -351 390 -351 393 -351 b 428 -385 413 -351 428 -367 b 428 -394 428 -388 428 -391 b 394 -428 426 -406 421 -410 l 332 -473 l 269 -516 l 205 -560 l 141 -603 l 77 -648 l 13 -692 l -50 -737 l -114 -780 l -145 -802 b -171 -813 -157 -810 -163 -813 b -175 -813 -172 -813 -174 -813 b -206 -777 -194 -811 -206 -795 b -202 -760 -206 -771 -205 -766 b -87 -675 -197 -752 -206 -757 l -34 -639 l 83 -557 l 145 -514 l 209 -470 l 272 -427 b 389 -351 375 -356 381 -352 "},v75:{x_min:-149.71875,x_max:148.359375,ha:151,o:"m -137 381 b -130 383 -134 383 -133 383 b -111 371 -122 383 -114 378 b -55 224 -110 370 -85 305 b 0 80 -25 145 -1 80 b 54 224 0 80 24 145 b 112 377 114 384 110 373 b 127 384 118 381 122 384 b 148 362 138 384 148 374 l 148 356 l 83 183 b 16 9 47 88 17 11 b -1 0 12 2 5 0 b -14 5 -5 0 -10 1 b -84 183 -19 9 -13 -6 l -149 356 l -149 362 b -137 381 -149 371 -145 378 "},v78:{x_min:0,x_max:193.28125,ha:197,o:"m 85 514 b 95 517 88 517 89 517 b 114 505 103 517 110 513 l 115 502 l 115 376 b 115 249 115 306 115 249 b 141 258 117 249 127 252 l 167 266 l 172 266 b 190 254 181 265 187 262 l 193 251 l 193 202 l 193 188 b 187 147 193 149 191 152 b 147 130 183 142 182 141 l 115 119 l 115 9 b 115 -99 115 -51 115 -99 b 141 -91 115 -99 127 -95 b 171 -81 166 -81 167 -81 l 171 -81 b 191 -94 181 -81 189 -87 b 193 -142 191 -97 193 -120 b 191 -195 193 -167 191 -194 b 125 -227 187 -205 187 -204 l 115 -230 l 115 -366 l 115 -503 l 114 -506 b 95 -519 110 -514 102 -519 b 74 -506 87 -519 78 -514 l 73 -503 l 73 -374 b 73 -245 73 -260 73 -245 b 73 -245 73 -245 73 -245 b 55 -252 72 -245 63 -249 l 32 -260 b 19 -263 27 -262 23 -263 b 4 -256 13 -263 8 -260 b 0 -215 0 -251 0 -254 b 0 -199 0 -210 0 -206 l 0 -152 l 1 -149 b 8 -140 2 -145 5 -141 b 42 -127 9 -140 24 -133 l 73 -116 l 73 -5 b 73 23 73 4 73 15 b 73 105 73 70 73 105 b 49 97 73 105 61 101 b 17 88 32 91 23 88 b 4 95 10 88 8 91 b 0 137 0 101 0 98 b 0 151 0 141 0 145 l 0 199 l 1 202 b 43 224 5 212 5 212 l 73 234 l 73 367 l 73 502 l 74 505 b 85 514 77 509 81 513 "},v79:{x_min:-1.359375,x_max:899.703125,ha:918,o:"m 307 349 b 332 351 315 351 323 351 b 443 340 367 351 408 347 b 741 47 607 306 720 195 b 744 0 743 31 744 16 b 660 -303 744 -90 713 -206 b 28 -755 534 -531 304 -695 b 14 -756 23 -755 19 -756 b -1 -741 4 -756 -1 -750 b 21 -720 -1 -731 1 -728 b 567 -56 337 -601 548 -344 b 568 -11 568 -41 568 -24 b 442 285 568 129 525 233 b 325 319 406 308 367 319 b 93 177 232 319 137 266 b 84 154 91 170 84 155 b 84 154 84 154 84 154 b 88 156 84 154 85 155 b 159 177 110 170 134 177 b 257 134 194 177 231 162 b 294 41 281 108 294 73 b 171 -97 294 -24 246 -90 b 156 -98 166 -97 161 -98 b 6 74 73 -98 6 -22 b 6 80 6 76 6 79 b 307 349 10 223 141 340 m 839 215 b 845 216 841 216 842 216 b 862 213 852 216 860 215 b 899 163 887 206 899 184 b 872 117 899 145 890 127 b 847 111 865 112 856 111 b 808 130 833 111 818 117 b 796 162 800 140 796 151 b 839 215 796 187 812 212 m 839 -112 b 845 -112 841 -112 842 -112 b 862 -115 852 -112 860 -113 b 899 -165 887 -122 899 -144 b 872 -210 899 -183 890 -201 b 847 -217 865 -215 856 -217 b 808 -198 833 -217 818 -210 b 796 -165 800 -188 796 -177 b 839 -112 796 -140 812 -116 "},v7a:{x_min:-1.359375,x_max:386.5625,ha:394,o:"m 249 535 b 257 537 251 537 253 537 b 276 524 266 537 273 533 l 277 521 l 279 419 l 279 316 l 304 323 b 337 328 319 326 330 328 b 353 316 347 328 349 324 b 355 266 355 315 355 290 b 353 215 355 241 355 217 b 319 198 349 206 347 205 b 279 187 284 190 279 188 b 279 156 279 187 279 174 b 279 136 279 151 279 144 l 279 84 l 289 87 l 330 98 b 367 105 352 102 362 105 b 378 101 372 105 375 104 b 386 61 385 95 386 94 b 386 40 386 55 386 48 l 386 -5 l 385 -8 b 374 -19 383 -12 378 -18 b 291 -40 372 -19 347 -26 b 279 -43 284 -41 279 -43 b 279 -83 279 -43 279 -59 b 279 -95 279 -87 279 -91 l 279 -145 l 304 -140 b 337 -133 321 -136 330 -133 b 349 -140 343 -133 347 -136 b 355 -181 355 -145 355 -142 l 355 -197 l 355 -210 b 349 -252 355 -249 355 -247 b 300 -269 345 -258 347 -258 b 280 -274 291 -272 281 -273 l 279 -274 l 277 -378 l 277 -483 l 276 -487 b 257 -499 273 -495 265 -499 b 238 -487 249 -499 242 -495 l 236 -483 l 236 -384 l 236 -285 l 235 -285 l 212 -291 l 170 -301 b 148 -308 159 -305 148 -306 b 147 -415 147 -308 147 -313 l 147 -523 l 145 -526 b 126 -538 141 -534 133 -538 b 106 -526 118 -538 110 -534 l 104 -523 l 104 -420 b 103 -317 104 -326 104 -317 b 103 -317 103 -317 103 -317 b 50 -330 92 -322 54 -330 b 31 -317 42 -330 35 -326 b 29 -267 29 -315 29 -315 l 29 -219 l 32 -216 b 92 -192 36 -206 36 -206 l 104 -190 l 104 -138 b 103 -87 104 -91 104 -87 b 103 -87 103 -87 103 -87 b 88 -91 103 -87 96 -88 l 49 -101 b 17 -106 32 -105 23 -106 b 6 -102 13 -106 10 -105 b -1 -62 0 -97 -1 -95 b 0 -41 -1 -56 0 -49 l 0 4 l 1 6 b 10 16 2 11 6 15 b 91 37 12 18 38 24 l 104 41 l 104 93 b 103 144 104 140 104 144 b 103 144 103 144 103 144 b 50 131 92 141 54 131 b 31 144 42 131 35 137 b 29 195 29 147 29 148 l 29 242 l 32 245 b 92 269 36 255 36 255 l 104 273 l 104 377 l 104 481 l 106 485 b 126 498 110 492 118 498 b 134 495 129 498 132 496 b 145 485 138 494 142 489 l 147 481 l 147 383 l 147 283 l 152 284 b 190 294 155 285 171 290 l 230 303 l 236 305 l 236 413 l 236 521 l 238 524 b 249 535 240 528 243 533 m 236 126 b 235 177 236 154 236 177 l 235 177 b 213 172 235 177 225 174 l 170 161 b 147 155 157 158 147 155 b 147 124 147 155 147 142 b 147 102 147 117 147 111 l 147 52 l 153 54 l 228 72 l 236 74 l 236 126 m 236 -105 b 235 -54 236 -65 236 -54 l 235 -54 b 231 -55 235 -54 234 -54 b 172 -69 227 -55 204 -62 l 149 -76 l 147 -76 l 147 -127 l 147 -179 l 152 -177 b 190 -167 155 -177 171 -173 l 230 -158 l 236 -156 l 236 -105 "},v7c:{x_min:0,x_max:300.8125,ha:307,o:"m 49 505 b 53 506 50 505 51 506 b 70 496 58 506 62 503 b 81 485 73 492 78 488 l 96 473 l 111 459 l 122 449 l 134 438 l 182 396 l 255 330 b 292 291 292 298 292 298 l 292 290 l 292 284 l 283 270 b 209 36 234 197 209 113 b 288 -170 209 -44 235 -119 b 299 -184 295 -179 299 -181 b 300 -191 300 -187 300 -188 b 285 -206 300 -199 294 -206 b 280 -206 283 -206 281 -206 b 247 -201 270 -202 259 -201 b 176 -222 223 -201 197 -208 b 114 -340 136 -249 114 -292 b 172 -471 114 -384 134 -433 b 185 -492 182 -481 185 -487 b 181 -502 185 -496 183 -499 b 171 -508 176 -505 174 -508 b 152 -498 166 -508 160 -503 b 0 -284 65 -428 12 -352 b 0 -260 0 -278 0 -270 b 1 -238 0 -252 0 -242 b 148 -140 16 -177 73 -140 b 209 -148 167 -140 189 -142 b 215 -149 212 -148 215 -149 b 215 -149 215 -149 215 -149 l 215 -149 b 201 -136 215 -148 209 -142 l 157 -97 l 96 -41 b 17 34 21 24 17 29 b 17 37 17 36 17 36 b 17 38 17 37 17 38 b 25 56 17 44 17 44 b 110 298 81 131 110 219 b 46 474 110 367 88 431 b 38 491 40 480 38 487 b 49 505 38 498 42 502 "},v7d:{x_min:-1.359375,x_max:436.921875,ha:446,o:"m 213 205 b 217 205 215 205 216 205 b 234 194 224 205 234 199 b 236 187 234 194 235 190 l 245 167 l 261 129 l 270 106 b 355 -61 294 54 329 -13 b 420 -163 381 -105 402 -138 b 436 -188 435 -184 436 -184 b 436 -191 436 -190 436 -190 b 421 -206 436 -201 431 -206 l 421 -206 l 416 -206 l 405 -201 b 217 -158 347 -172 283 -158 b 31 -201 153 -158 88 -172 l 20 -206 l 14 -206 l 14 -206 b 0 -191 5 -206 0 -201 b -1 -188 0 -190 -1 -190 b 14 -163 -1 -186 0 -184 b 95 -34 36 -136 72 -77 b 166 106 119 8 148 68 l 175 129 l 183 148 l 200 188 b 213 205 205 199 208 202 "},v7f:{x_min:0,x_max:367.5,ha:375,o:"m 0 124 l 0 187 l 61 187 l 122 187 l 122 138 l 122 91 l 153 61 l 183 30 l 213 61 l 243 91 l 243 138 l 243 187 l 306 187 l 367 187 l 367 124 l 367 61 l 321 61 l 274 61 l 243 30 l 213 0 l 243 -31 l 274 -62 l 321 -62 l 367 -62 l 367 -124 l 367 -188 l 306 -188 l 243 -188 l 243 -140 l 243 -93 l 213 -62 l 183 -31 l 153 -62 l 122 -93 l 122 -140 l 122 -188 l 61 -188 l 0 -188 l 0 -124 l 0 -62 l 46 -62 l 92 -62 l 123 -31 l 153 0 l 123 30 l 92 61 l 46 61 l 0 61 l 0 124 "},v80:{x_min:29.9375,x_max:420.578125,ha:371,o:"m 115 345 b 221 347 117 345 166 347 b 411 345 306 347 409 345 b 420 330 416 342 420 335 b 415 319 420 326 419 321 b 178 118 397 303 179 118 b 178 117 178 118 178 117 b 181 117 178 117 178 117 b 189 117 182 117 185 117 b 193 117 190 117 191 117 b 247 98 215 117 232 111 b 296 75 266 83 280 76 b 302 75 299 75 300 75 b 322 91 311 75 315 79 b 322 91 322 91 322 91 b 322 91 322 91 322 91 b 319 91 322 91 321 91 b 313 90 318 90 315 90 b 283 107 300 90 288 97 b 277 126 279 114 277 121 b 319 167 277 149 295 167 b 319 167 319 167 319 167 b 362 118 347 167 362 147 b 355 82 362 108 359 96 b 311 33 349 65 340 55 b 224 1 284 12 253 1 b 194 5 213 1 204 2 b 168 18 183 8 178 11 b 110 36 151 30 130 36 b 57 15 88 36 68 29 b 47 11 54 12 51 11 b 31 20 40 11 34 13 b 29 26 31 22 29 25 b 68 66 29 36 39 45 b 285 250 73 71 281 248 b 285 250 285 250 285 250 b 231 252 285 252 261 252 b 137 250 190 252 141 250 b 93 227 122 248 110 241 b 78 220 88 222 83 220 b 66 227 74 220 70 222 b 63 234 65 229 63 231 b 85 291 63 241 69 252 b 115 345 108 342 108 344 "},v81:{x_min:0,x_max:428.75,ha:438,o:"m 262 186 b 273 186 266 186 272 186 b 274 186 273 186 274 186 b 285 186 274 186 280 186 b 428 48 375 181 428 122 b 386 -68 428 12 416 -29 b 155 -187 329 -145 236 -187 b 12 -111 92 -187 38 -162 b 0 -51 4 -91 0 -72 b 262 186 0 58 122 179 m 366 131 b 352 134 362 133 357 134 b 219 81 321 134 269 115 b 47 -111 126 23 50 -62 b 47 -112 47 -111 47 -112 b 77 -136 47 -129 58 -136 b 264 -45 118 -136 194 -101 b 382 109 336 12 382 76 b 366 131 382 120 377 129 "},v83:{x_min:-1.359375,x_max:847.96875,ha:865,o:"m 488 1499 b 495 1500 490 1500 492 1500 b 541 1465 507 1500 521 1490 b 679 1078 622 1372 679 1210 b 677 1050 679 1068 677 1060 b 477 642 668 893 604 764 l 443 609 l 431 596 l 431 592 l 438 562 l 449 508 l 460 458 b 481 355 475 390 481 355 b 481 355 481 355 481 355 b 490 356 481 355 485 355 b 528 358 495 356 511 358 b 558 356 540 358 552 356 b 839 95 699 338 808 237 b 847 22 845 72 847 47 b 631 -303 847 -113 766 -242 b 620 -309 623 -308 620 -309 l 620 -310 b 631 -359 620 -310 626 -333 l 646 -435 l 660 -496 b 672 -588 668 -535 672 -563 b 664 -653 672 -610 669 -630 b 383 -875 630 -792 509 -875 b 201 -810 321 -875 257 -855 b 129 -680 151 -768 129 -730 b 274 -530 129 -592 200 -530 b 351 -553 300 -530 326 -538 b 412 -669 393 -582 412 -626 b 287 -805 412 -735 366 -800 l 279 -805 l 285 -809 b 383 -830 318 -823 351 -830 b 586 -718 464 -830 540 -789 b 626 -584 612 -678 626 -631 b 619 -528 626 -566 623 -548 b 612 -495 619 -526 616 -510 b 577 -324 590 -387 577 -324 b 577 -324 577 -324 577 -324 b 568 -326 575 -324 571 -324 b 528 -334 558 -328 537 -333 b 465 -338 506 -337 485 -338 b 24 -11 269 -338 87 -206 b -1 145 8 41 -1 93 b 96 442 -1 249 32 351 b 322 714 166 541 236 626 l 352 745 l 345 782 l 332 843 l 315 921 b 303 984 310 950 304 978 b 295 1082 298 1017 295 1049 b 413 1426 295 1208 336 1329 b 488 1499 436 1456 477 1496 m 549 1301 b 541 1301 547 1301 544 1301 b 411 1207 500 1301 447 1263 b 355 1004 374 1152 355 1079 b 359 942 355 984 356 963 b 371 881 362 927 363 917 l 385 818 b 392 782 389 799 392 784 l 392 782 b 434 828 393 782 424 816 b 607 1165 534 941 594 1060 b 608 1193 608 1175 608 1183 b 597 1270 608 1224 604 1254 b 549 1301 589 1286 571 1299 m 398 528 b 393 555 396 542 393 553 b 392 555 393 555 393 555 b 317 470 390 555 347 505 b 190 298 266 408 212 334 b 127 70 148 227 127 148 b 155 -77 127 19 137 -30 b 468 -303 209 -216 333 -303 b 519 -299 484 -303 502 -302 b 568 -284 541 -295 568 -287 l 568 -284 b 563 -263 568 -284 566 -274 l 534 -120 l 511 -13 l 496 61 l 480 133 b 469 187 472 176 469 187 b 468 188 469 187 469 188 b 416 162 462 188 430 172 b 337 13 364 126 337 69 b 413 -124 337 -40 363 -93 b 428 -144 424 -131 428 -137 b 428 -149 428 -145 428 -148 b 409 -166 426 -161 419 -166 b 394 -162 405 -166 400 -165 b 240 77 302 -122 240 -27 l 240 77 b 430 342 240 197 315 301 l 436 344 l 426 394 l 398 528 m 548 194 b 526 195 540 195 532 195 b 519 195 524 195 521 195 l 514 195 l 518 177 l 539 79 l 552 15 l 566 -48 l 594 -187 l 605 -240 b 612 -266 609 -254 611 -266 b 612 -266 612 -266 612 -266 b 641 -248 613 -266 630 -256 b 744 -98 692 -212 730 -156 b 751 -40 749 -79 751 -59 b 548 194 751 76 665 181 "},v84:{x_min:25.859375,x_max:164.6875,ha:168,o:"m 34 369 b 40 370 35 370 38 370 b 59 353 49 370 50 367 b 164 40 122 254 155 158 b 164 0 164 33 164 16 b 164 -40 164 -16 164 -34 b 59 -353 155 -158 122 -254 b 40 -371 53 -366 47 -371 b 34 -370 38 -371 36 -370 b 25 -358 28 -367 25 -363 b 31 -337 25 -352 27 -347 b 92 0 72 -234 92 -117 b 31 335 92 116 72 233 b 25 356 27 345 25 352 b 34 369 25 363 28 366 "},v86:{x_min:-571.671875,x_max:570.3125,ha:582,o:"m -386 173 b -381 174 -385 174 -383 174 b -370 173 -377 174 -372 173 b -281 86 -367 172 -347 151 b -196 0 -235 37 -196 0 b -126 84 -196 0 -164 37 b -50 174 -55 173 -57 172 b -44 174 -49 174 -47 174 b -35 173 -42 174 -38 173 b 53 86 -32 172 -12 151 b 138 0 100 37 138 0 b 208 84 140 0 170 37 b 284 174 279 173 277 172 b 289 174 285 174 288 174 b 299 173 294 174 298 173 b 462 11 303 172 338 134 l 475 -1 l 503 34 b 541 76 534 72 536 74 b 548 77 544 77 545 77 b 570 56 560 77 570 68 b 567 48 570 54 568 51 b 392 -172 564 41 397 -166 b 378 -176 387 -174 382 -176 b 368 -174 374 -176 371 -176 b 280 -87 367 -173 345 -152 b 194 0 234 -38 194 0 b 125 -86 194 0 163 -38 b 49 -174 54 -174 55 -173 b 43 -176 47 -176 46 -176 b 34 -174 40 -176 36 -174 b -54 -87 31 -173 10 -152 b -140 0 -102 -38 -140 0 b -209 -86 -141 0 -171 -38 b -285 -174 -280 -174 -279 -173 b -291 -176 -287 -176 -289 -176 b -300 -174 -295 -176 -299 -174 b -464 -12 -304 -173 -340 -137 l -476 0 l -504 -34 b -543 -77 -534 -73 -537 -76 b -549 -79 -545 -79 -547 -79 b -571 -58 -562 -79 -571 -69 b -568 -49 -571 -55 -570 -52 b -392 172 -566 -43 -396 167 b -386 173 -390 172 -387 173 "},v8a:{x_min:-170.140625,x_max:168.78125,ha:172,o:"m -160 567 b -122 567 -159 567 -149 567 l -87 567 l -84 566 b -74 553 -78 563 -77 560 b -20 366 -73 551 -49 466 b 31 186 8 267 31 186 b 85 371 31 186 55 269 b 140 559 114 473 138 557 b 153 567 141 564 148 567 b 168 559 159 567 166 564 b 168 555 168 557 168 557 b 92 281 168 548 159 513 b 14 13 50 134 14 13 b 0 0 14 6 6 0 b -17 15 -8 0 -17 8 b -93 283 -17 15 -51 136 b -170 552 -166 533 -170 548 b -170 553 -170 552 -170 552 b -160 567 -170 560 -167 564 "},v8b:{x_min:0,x_max:319.859375,ha:326,o:"m 149 508 b 159 509 152 509 155 509 b 186 494 170 509 181 503 b 190 440 190 487 190 488 l 190 430 l 190 377 l 242 377 l 251 377 b 303 373 298 377 296 377 b 319 345 314 367 319 356 b 304 319 319 335 314 324 b 250 315 296 315 299 315 l 242 315 l 190 315 l 190 262 l 190 252 b 186 198 190 204 190 205 b 159 183 179 188 170 183 b 132 198 148 183 138 188 b 127 252 127 205 127 204 l 127 262 l 127 315 l 76 315 l 68 315 b 14 319 20 315 21 315 b 0 347 4 324 0 335 b 14 373 0 356 4 367 b 68 377 21 377 20 377 l 76 377 l 127 377 l 127 430 l 127 440 b 132 494 127 488 127 487 b 149 508 136 501 142 505 "},v8c:{x_min:-330.75,x_max:329.390625,ha:336,o:"m -133 483 b -117 484 -127 484 -122 484 b 31 373 -51 484 9 440 b 35 348 34 365 35 356 b -25 285 35 313 10 285 b -87 331 -55 285 -76 302 b -167 402 -100 376 -133 402 b -191 398 -175 402 -183 401 b -227 341 -215 388 -227 369 b -225 320 -227 334 -227 327 b -13 74 -209 230 -125 133 b 6 65 -4 70 5 66 l 9 63 l 10 65 b 117 231 12 68 40 112 l 189 341 l 242 424 b 268 460 262 456 264 458 b 283 464 273 463 277 464 b 308 438 296 464 308 453 l 308 437 b 287 396 308 430 308 428 l 95 98 l 59 43 l 58 41 l 65 37 b 253 -156 151 -8 217 -77 b 281 -285 272 -199 281 -244 b 148 -481 281 -381 231 -463 b 115 -485 137 -484 126 -485 b -32 -376 51 -485 -9 -442 b -36 -349 -35 -366 -36 -358 b 25 -287 -36 -315 -12 -287 b 85 -333 54 -287 74 -302 b 166 -403 99 -377 133 -403 b 190 -399 174 -403 182 -402 b 225 -342 215 -390 225 -370 b 224 -322 225 -335 225 -328 b 12 -76 208 -231 125 -134 b -8 -66 2 -72 -6 -68 l -10 -65 l -12 -66 b -118 -231 -13 -68 -42 -113 l -190 -342 l -243 -426 b -269 -462 -264 -458 -265 -458 b -284 -466 -274 -464 -279 -466 b -310 -440 -298 -466 -310 -455 l -310 -438 b -288 -398 -310 -430 -308 -430 l -96 -99 l -59 -44 l -59 -43 l -66 -38 b -281 284 -198 33 -281 158 l -281 284 b -133 483 -281 392 -220 474 m 254 177 b 266 179 258 177 262 179 b 319 149 287 179 307 167 b 329 115 326 140 329 127 b 319 79 329 102 326 90 b 268 51 307 61 287 51 b 221 72 250 51 234 58 b 205 115 210 84 205 99 b 254 177 205 142 223 170 m -281 -54 b -269 -52 -277 -52 -273 -52 b -223 -73 -253 -52 -235 -59 b -206 -116 -212 -84 -206 -101 b -216 -151 -206 -129 -209 -141 b -269 -179 -228 -170 -249 -179 b -314 -159 -285 -179 -302 -173 b -330 -116 -325 -147 -330 -131 b -281 -54 -330 -88 -313 -61 "},v8d:{x_min:-1.359375,x_max:255.890625,ha:261,o:"m 118 514 b 127 517 121 517 122 517 b 147 505 136 517 142 513 l 148 502 l 148 403 b 148 306 148 351 148 306 b 174 315 149 306 160 310 l 200 324 l 205 323 b 223 312 213 323 220 319 l 225 308 l 225 260 b 225 245 225 255 225 249 b 220 204 225 208 224 209 b 179 188 216 199 215 199 l 148 177 l 148 124 l 148 70 l 189 84 b 236 98 219 94 230 98 b 247 94 240 98 243 97 b 255 52 254 88 255 87 b 255 33 255 47 255 40 l 254 -12 l 253 -15 b 249 -22 253 -18 250 -20 l 245 -24 l 196 -41 l 148 -58 l 148 -108 b 148 -158 148 -136 148 -158 b 174 -148 148 -158 160 -154 b 204 -140 198 -140 200 -140 l 204 -140 b 224 -152 213 -140 221 -145 b 225 -201 224 -155 225 -177 b 224 -254 225 -226 224 -251 b 157 -284 220 -262 220 -262 l 148 -288 l 148 -395 l 148 -503 l 147 -506 b 127 -519 142 -514 134 -519 b 107 -506 119 -519 111 -514 l 106 -503 l 106 -403 b 106 -303 106 -316 106 -303 b 104 -303 104 -303 104 -303 b 88 -310 104 -303 96 -306 l 63 -319 b 51 -322 59 -320 55 -322 b 36 -315 46 -322 40 -319 b 31 -273 32 -309 31 -312 b 31 -258 31 -269 31 -263 l 31 -210 l 34 -206 b 40 -198 35 -204 38 -199 b 74 -186 42 -197 57 -191 l 106 -173 l 106 -123 b 106 -97 106 -112 106 -104 b 106 -72 106 -76 106 -72 b 104 -72 106 -72 106 -72 b 20 -99 89 -79 23 -99 b 0 -84 10 -99 2 -93 b -1 -37 0 -81 -1 -59 b 0 11 -1 -15 0 9 b 58 40 4 22 2 22 l 106 56 l 106 109 b 106 123 106 115 106 119 b 106 162 106 147 106 162 b 81 155 106 162 93 159 b 50 147 65 149 55 147 b 36 152 43 147 40 148 b 31 194 32 158 31 156 b 31 209 31 198 31 204 l 31 256 l 34 260 b 76 281 38 269 38 269 l 106 292 l 106 396 l 106 502 l 107 505 b 118 514 110 509 114 513 "},v8f:{x_min:-21.78125,x_max:362.0625,ha:369,o:"m 302 1031 b 308 1032 304 1032 307 1032 b 330 1016 318 1032 325 1027 b 362 867 351 970 362 920 b 340 738 362 824 353 780 l 336 727 l 340 717 b 362 591 355 677 362 634 b 257 323 362 496 325 401 b 204 272 243 306 227 290 b 20 56 129 206 66 133 b -1 18 12 44 0 22 b -19 4 -4 9 -12 4 l -21 4 l -21 140 l -21 276 l -12 277 b 167 333 61 288 127 309 b 319 598 262 388 319 491 b 311 664 319 620 317 642 l 310 673 l 304 664 b 204 548 279 620 250 587 b 20 333 129 483 66 409 b -1 292 12 320 0 298 b -19 280 -4 285 -12 280 l -21 280 l -21 416 l -21 552 l -12 553 b 167 609 61 564 127 585 b 319 874 264 666 319 770 b 294 992 319 914 311 954 b 288 1011 288 1004 288 1007 b 302 1031 288 1021 294 1028 "},v90:{x_min:-171.5,x_max:483.1875,ha:493,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 495 20 616 20 616 b 20 373 20 427 20 373 b 115 410 20 373 63 390 l 210 448 l 210 531 b 212 620 210 614 210 616 b 231 632 215 628 223 632 b 246 627 236 632 242 631 b 251 541 251 620 251 628 l 251 463 l 315 489 b 387 514 368 509 381 514 b 393 513 390 514 392 514 b 406 494 402 510 406 502 b 397 476 406 487 404 480 b 323 446 396 474 363 462 l 251 417 l 251 283 l 251 148 l 254 151 b 370 199 291 183 332 199 b 415 191 385 199 400 197 b 483 84 458 176 483 134 b 461 0 483 58 476 29 b 332 -142 439 -40 411 -72 l 255 -215 b 231 -229 240 -229 239 -229 b 216 -223 224 -229 220 -227 b 210 -158 210 -217 210 -223 b 210 -120 210 -148 210 -136 l 210 -29 l 205 -34 b 100 -142 182 -65 159 -88 l 23 -215 b -1 -229 9 -229 6 -229 b -19 -217 -9 -229 -16 -224 l -20 -215 l -21 48 l -21 310 l -83 287 b -152 262 -133 266 -145 262 b -157 263 -153 262 -155 262 b -171 283 -166 266 -171 274 b -161 301 -171 290 -167 297 b -91 328 -160 302 -129 315 l -21 356 l -21 487 l -20 617 l -19 621 b -8 631 -17 626 -12 630 m 210 288 b 210 401 210 351 210 401 b 114 365 209 401 167 384 l 20 327 l 20 238 l 20 148 l 21 151 b 140 199 59 183 102 199 b 206 180 164 199 187 192 l 209 177 b 209 177 209 177 209 177 b 210 288 210 177 210 199 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 m 341 131 b 328 133 337 133 332 133 b 322 133 326 133 323 133 b 257 87 296 129 273 113 l 251 80 l 251 -37 l 251 -156 l 255 -152 b 375 81 328 -72 375 20 l 375 83 b 341 131 375 113 367 126 "},v92:{x_min:0,x_max:598.890625,ha:611,o:"m 62 181 b 77 183 66 183 72 183 b 91 181 83 183 88 183 b 202 131 100 180 106 177 l 299 87 l 394 131 b 517 183 499 181 502 183 b 519 183 517 183 518 183 b 598 104 567 183 598 144 b 577 49 598 84 592 65 b 518 15 567 38 563 37 b 484 0 499 6 484 0 b 518 -16 484 -1 499 -8 b 577 -51 563 -38 567 -40 b 598 -105 592 -66 598 -86 b 519 -184 598 -145 567 -184 b 517 -184 518 -184 517 -184 b 394 -133 502 -184 499 -183 l 299 -88 l 202 -133 b 81 -184 99 -183 95 -184 b 77 -184 80 -184 78 -184 b 0 -105 29 -184 0 -145 b 20 -51 0 -86 5 -66 b 80 -16 29 -40 34 -38 b 114 -1 98 -8 114 -1 b 80 15 114 0 98 6 b 20 49 34 37 29 38 b 0 104 6 65 0 84 b 62 181 0 140 23 174 m 88 134 b 74 136 85 134 80 136 b 68 134 72 136 69 136 b 46 104 54 130 46 117 b 55 81 46 95 49 88 b 149 34 59 76 53 80 b 224 -1 190 15 224 0 b 144 -38 224 -1 187 -18 b 54 -84 59 -79 58 -79 b 46 -105 49 -90 46 -98 b 76 -137 46 -122 58 -137 b 78 -137 77 -137 77 -137 b 194 -86 87 -137 76 -141 b 298 -36 250 -58 298 -36 b 298 -36 298 -36 298 -36 b 402 -84 299 -36 345 -58 b 518 -137 522 -141 510 -137 b 521 -137 519 -137 519 -137 b 551 -105 539 -137 551 -122 b 541 -83 551 -98 548 -90 b 447 -36 537 -77 544 -81 b 374 -1 406 -16 374 -1 b 447 34 374 0 406 15 b 541 81 544 80 537 76 b 551 104 548 88 551 97 b 521 136 551 120 539 136 b 518 136 519 136 519 136 b 517 136 518 136 517 136 l 517 136 b 402 83 511 136 511 136 b 298 34 345 56 299 34 b 298 34 298 34 298 34 b 194 84 298 34 250 56 b 88 134 137 111 89 133 "},v93:{x_min:0,x_max:438.28125,ha:447,o:"m 212 205 b 219 205 213 205 216 205 b 239 183 228 205 231 204 b 421 -163 298 40 363 -83 b 438 -191 434 -180 438 -186 b 436 -197 438 -192 438 -195 b 424 -206 434 -204 431 -206 b 406 -201 420 -206 415 -205 b 216 -156 347 -172 281 -156 b 23 -205 148 -156 80 -173 b 14 -206 20 -206 17 -206 b 0 -191 6 -206 0 -201 b 6 -176 0 -187 1 -183 b 202 192 63 -104 142 45 b 212 205 205 199 208 202 m 264 48 l 249 81 l 243 94 l 242 91 b 89 -126 208 36 137 -66 b 81 -138 85 -133 81 -138 b 81 -138 81 -138 81 -138 b 81 -138 81 -138 81 -138 b 95 -133 81 -138 87 -136 b 280 -94 156 -108 221 -94 b 334 -98 299 -94 317 -95 b 343 -99 338 -99 343 -99 b 343 -99 343 -99 343 -99 b 338 -94 343 -99 341 -97 b 264 48 318 -58 287 1 "},v94:{x_min:-149.71875,x_max:148.359375,ha:151,o:"m -9 215 b 0 217 -6 217 -4 217 b 19 205 8 217 14 213 b 20 142 20 202 20 201 l 20 84 l 23 84 b 144 -27 81 74 129 30 b 148 -66 147 -40 148 -54 b 36 -213 148 -134 103 -197 b 0 -219 24 -217 12 -219 b -145 -104 -68 -219 -129 -173 b -149 -68 -148 -91 -149 -79 b -24 84 -149 6 -98 74 l -21 84 l -21 142 b -19 205 -20 201 -20 202 b -9 215 -17 209 -13 213 m -21 -15 b -23 41 -21 37 -21 41 b -23 41 -23 41 -23 41 b -76 11 -35 40 -62 26 b -108 -65 -98 -11 -108 -38 b -1 -176 -108 -122 -65 -176 b 107 -65 63 -176 107 -122 b 74 11 107 -38 96 -11 b 20 41 61 26 32 41 b 20 -15 20 41 20 15 b 19 -74 20 -72 20 -72 b 0 -87 14 -83 6 -87 b -19 -74 -8 -87 -16 -83 b -21 -15 -20 -72 -20 -72 "},v95:{x_min:0,x_max:406.96875,ha:415,o:"m 55 181 b 70 183 61 183 66 183 b 111 170 85 183 99 179 b 160 130 115 167 137 149 l 202 95 l 245 130 b 319 181 299 176 302 179 b 334 183 325 183 330 183 b 406 109 375 183 406 148 b 401 81 406 99 405 91 b 348 24 394 65 390 59 b 318 -1 332 11 318 0 b 348 -26 318 -1 332 -12 b 401 -83 390 -61 394 -66 b 406 -111 405 -93 406 -101 b 334 -184 406 -149 375 -184 b 319 -183 330 -184 325 -184 b 245 -131 302 -180 299 -177 l 202 -97 l 160 -131 b 85 -183 107 -177 103 -180 b 70 -184 80 -184 76 -184 b 0 -111 31 -184 0 -149 b 4 -83 0 -101 1 -93 b 58 -26 10 -66 16 -61 b 88 -1 74 -12 88 -1 b 58 24 88 0 74 11 b 10 69 23 54 17 59 b 0 109 2 81 0 95 b 55 181 0 142 21 173 m 83 133 b 72 136 78 136 76 136 b 57 131 66 136 61 134 b 46 109 49 126 46 117 b 50 93 46 104 47 98 b 107 45 51 91 77 70 b 160 0 137 20 160 0 b 107 -47 160 -1 137 -22 b 50 -94 77 -72 51 -93 b 46 -111 47 -99 46 -105 b 59 -134 46 -120 50 -130 b 72 -137 62 -136 68 -137 b 83 -136 76 -137 80 -136 b 144 -84 84 -134 107 -116 b 202 -36 176 -58 202 -36 b 261 -84 202 -36 230 -58 b 323 -136 299 -116 321 -134 b 334 -137 326 -136 330 -137 b 345 -134 338 -137 343 -136 b 360 -111 355 -130 360 -120 b 355 -94 360 -105 359 -99 b 299 -47 353 -93 329 -72 b 245 0 269 -22 245 -1 b 299 45 245 0 269 20 b 355 93 329 70 353 91 b 360 109 359 98 360 104 b 345 133 360 119 355 129 b 334 136 343 134 338 136 b 323 134 330 136 326 134 b 261 83 321 133 299 115 b 202 34 230 56 202 34 b 144 83 202 34 176 56 b 83 133 106 115 84 133 "},v97:{x_min:-228.671875,x_max:227.3125,ha:232,o:"m -217 487 l -213 488 l 0 488 l 212 488 l 216 487 b 225 476 220 484 224 480 l 227 473 l 227 244 l 227 15 l 225 12 b 206 0 223 4 215 0 b 197 1 204 0 200 0 b 187 12 193 4 189 6 l 186 15 l 186 138 l 186 262 l -1 262 l -187 262 l -187 138 l -187 15 l -189 12 b -208 0 -193 4 -200 0 b -227 12 -216 0 -223 4 l -228 15 l -228 244 l -228 473 l -227 476 b -217 487 -225 480 -221 484 "},v9a:{x_min:-21.78125,x_max:367.5,ha:375,o:"m 230 1031 b 238 1032 232 1032 235 1032 b 259 1014 245 1032 251 1027 b 367 662 330 906 367 782 b 364 602 367 641 367 621 b 232 317 352 488 304 384 b 57 120 155 245 103 187 b -1 18 31 84 6 40 b -19 4 -4 11 -12 4 l -21 4 l -21 159 l -21 315 l -16 315 b 96 335 10 315 62 324 b 315 695 227 380 315 527 b 313 738 315 709 314 724 b 224 991 304 825 273 916 b 216 1013 219 999 216 1007 b 230 1031 216 1021 220 1028 "},v9b:{x_min:-24.5,x_max:313.0625,ha:319,o:"m -24 -133 l -24 -5 l -20 -5 b -1 -19 -12 -5 -4 -11 b 142 -213 13 -61 74 -144 b 258 -376 196 -269 230 -315 b 313 -605 295 -449 313 -528 b 292 -742 313 -652 306 -699 b 288 -752 289 -748 288 -752 b 288 -752 288 -752 288 -752 b 292 -764 289 -753 291 -757 b 313 -907 306 -811 313 -860 b 292 -1045 313 -954 306 -1002 b 288 -1054 289 -1050 288 -1054 b 288 -1054 288 -1054 288 -1054 b 292 -1067 289 -1054 291 -1060 b 313 -1210 306 -1113 313 -1161 b 292 -1346 313 -1257 306 -1304 b 288 -1357 289 -1353 288 -1357 b 288 -1357 288 -1357 288 -1357 b 292 -1368 289 -1357 291 -1363 b 313 -1512 306 -1415 313 -1464 b 292 -1648 313 -1560 306 -1605 b 288 -1660 289 -1654 288 -1660 b 288 -1660 288 -1660 288 -1660 b 292 -1671 289 -1660 291 -1665 b 313 -1814 306 -1719 313 -1766 b 250 -2040 313 -1897 291 -1977 b 232 -2062 238 -2057 236 -2059 b 221 -2065 230 -2063 225 -2065 b 200 -2045 210 -2065 201 -2057 b 200 -2043 200 -2044 200 -2044 b 208 -2026 200 -2037 202 -2034 b 269 -1826 249 -1966 269 -1897 b 153 -1544 269 -1726 230 -1625 b -9 -1472 115 -1506 58 -1481 b -21 -1471 -14 -1471 -19 -1471 l -24 -1471 l -24 -1343 l -24 -1215 l -20 -1215 b -1 -1229 -12 -1215 -4 -1221 b 142 -1424 13 -1270 74 -1353 b 257 -1582 196 -1478 228 -1524 b 264 -1594 261 -1589 264 -1594 l 264 -1594 b 265 -1582 264 -1594 264 -1589 b 270 -1525 268 -1562 270 -1544 b 153 -1243 270 -1424 228 -1321 b -9 -1170 115 -1203 58 -1178 b -21 -1168 -14 -1170 -19 -1168 l -24 -1168 l -24 -1041 l -24 -913 l -20 -913 b -1 -927 -12 -913 -4 -918 b 142 -1121 13 -967 74 -1050 b 257 -1281 196 -1175 228 -1221 b 264 -1292 261 -1286 264 -1292 l 264 -1292 b 265 -1279 264 -1292 264 -1286 b 270 -1222 268 -1261 270 -1242 b 153 -941 270 -1121 228 -1018 b -9 -867 115 -900 58 -875 b -21 -866 -14 -867 -19 -866 l -24 -866 l -24 -738 l -24 -610 l -20 -610 b -1 -624 -12 -610 -4 -616 b 142 -818 13 -664 74 -749 b 257 -978 196 -873 228 -918 b 264 -989 261 -984 264 -989 l 264 -989 b 265 -977 264 -989 264 -984 b 270 -920 268 -959 270 -939 b 153 -638 270 -818 228 -716 b -9 -564 115 -598 58 -573 b -21 -563 -14 -564 -19 -563 l -24 -563 l -24 -435 l -24 -308 l -20 -308 b -1 -322 -12 -308 -4 -313 b 142 -516 13 -363 74 -446 b 257 -675 196 -571 228 -616 b 264 -687 261 -681 264 -687 l 264 -687 b 265 -674 264 -687 264 -681 b 270 -617 268 -656 270 -637 b 153 -335 270 -516 228 -413 b -9 -262 115 -295 58 -270 b -21 -260 -14 -262 -19 -260 l -24 -260 l -24 -133 "},v9c:{x_min:-166.0625,x_max:-25.859375,ha:0,o:"m -49 369 b -42 370 -46 369 -44 370 b -27 360 -36 370 -29 366 b -25 355 -27 359 -25 358 b -32 335 -25 351 -28 347 b -92 52 -66 248 -87 159 b -93 -1 -93 43 -93 20 b -92 -54 -93 -23 -93 -45 b -32 -337 -85 -162 -66 -251 b -25 -355 -27 -349 -25 -352 b -42 -371 -25 -365 -32 -371 b -61 -353 -50 -371 -51 -369 b -163 -63 -119 -262 -153 -165 b -166 -1 -166 -37 -166 -31 b -163 62 -166 30 -166 36 b -61 352 -153 163 -119 260 b -49 369 -54 365 -51 366 "},v9e:{x_min:0,x_max:607.0625,ha:619,o:"m 243 631 b 250 632 246 632 249 632 b 270 620 259 632 268 628 l 272 616 l 272 201 l 272 -212 l 270 -216 b 251 -229 268 -224 259 -229 b 227 -215 243 -229 240 -229 l 151 -142 b 32 -16 81 -80 53 -49 b 0 84 9 18 0 52 b 111 199 0 149 42 199 b 137 197 119 199 127 198 b 228 151 168 191 197 177 l 231 148 l 231 383 b 232 620 231 616 231 616 b 243 631 234 624 238 630 m 168 131 b 152 133 163 133 157 133 b 107 102 130 133 111 120 b 106 86 107 97 106 91 b 111 41 106 73 108 56 b 227 -152 125 -13 171 -90 l 231 -156 l 231 -37 l 231 80 l 225 87 b 168 131 210 111 190 126 m 347 631 b 353 632 348 632 351 632 b 374 620 363 632 371 628 b 375 383 375 616 375 616 l 375 148 l 377 151 b 492 199 415 183 454 199 b 537 191 507 199 522 197 b 607 84 582 176 607 134 b 583 0 607 58 598 29 b 455 -142 562 -40 533 -72 l 378 -215 b 355 -229 364 -229 362 -229 b 334 -216 345 -229 337 -224 l 333 -212 l 333 201 l 333 616 l 334 620 b 347 631 337 624 341 630 m 465 131 b 451 133 461 133 455 133 b 445 133 449 133 446 133 b 379 87 419 129 396 113 l 375 80 l 375 -37 l 375 -156 l 378 -152 b 499 81 451 -72 499 20 l 499 83 b 465 131 499 113 490 126 "},va3:{x_min:58.53125,x_max:228.671875,ha:294,o:"m 138 371 b 142 373 140 371 141 373 b 178 342 149 373 156 366 b 228 251 217 297 228 278 b 228 244 228 248 228 247 b 176 147 227 212 212 184 b 123 73 152 122 132 93 b 121 62 122 70 121 66 b 145 13 121 48 129 31 b 153 -2 151 6 153 1 b 149 -9 153 -5 152 -6 b 144 -11 148 -11 145 -11 b 129 -1 140 -11 136 -8 b 61 87 89 37 68 68 b 58 113 59 95 58 105 b 110 215 58 144 74 177 b 163 287 134 240 155 269 b 166 299 166 291 166 295 b 141 348 166 313 157 330 b 133 360 134 356 133 358 b 133 363 133 362 133 362 b 138 371 133 367 136 370 "},va5:{x_min:0,x_max:349.8125,ha:357,o:"m 88 302 b 103 303 93 302 98 303 b 202 224 149 303 191 270 b 205 199 204 216 205 208 b 178 129 205 173 196 147 l 175 126 l 182 127 b 307 249 236 142 284 190 b 313 259 308 254 311 258 b 329 267 317 265 323 267 b 349 247 340 267 349 259 b 201 -263 349 242 204 -258 b 182 -273 197 -270 190 -273 b 163 -260 174 -273 166 -269 b 161 -256 161 -259 161 -258 b 217 -59 161 -248 170 -220 b 272 129 247 43 272 127 b 272 129 272 129 272 129 b 264 122 272 129 268 126 b 140 80 227 94 183 80 b 36 115 102 80 65 91 b 0 194 10 136 0 165 b 88 302 0 244 32 292 "},va9:{x_min:-24.5,x_max:314.421875,ha:321,o:"m -24 -145 l -24 -5 l -20 -5 b 0 -23 -9 -5 -2 -12 b 27 -87 4 -38 14 -66 b 138 -220 53 -136 88 -177 b 235 -328 179 -255 208 -288 b 314 -592 287 -409 314 -501 b 292 -732 314 -639 307 -687 l 289 -742 l 294 -756 b 314 -896 307 -802 314 -849 b 292 -1035 314 -943 307 -991 l 289 -1045 l 294 -1057 b 314 -1197 307 -1104 314 -1152 b 292 -1338 314 -1246 307 -1292 l 289 -1347 l 294 -1360 b 314 -1500 307 -1407 314 -1454 b 273 -1689 314 -1565 300 -1628 b 250 -1712 265 -1710 261 -1712 b 228 -1691 236 -1712 228 -1704 l 228 -1685 l 234 -1675 b 270 -1507 258 -1621 270 -1564 b 98 -1193 270 -1381 209 -1261 b 40 -1174 76 -1179 58 -1174 b -10 -1189 24 -1174 8 -1178 b -20 -1192 -14 -1192 -16 -1192 l -24 -1192 l -24 -1052 l -24 -913 l -20 -913 b 0 -931 -9 -913 -2 -920 b 27 -995 4 -946 14 -974 b 138 -1128 53 -1043 88 -1085 b 257 -1275 190 -1172 228 -1220 b 262 -1283 259 -1279 262 -1283 l 262 -1283 b 269 -1249 264 -1282 268 -1260 b 270 -1206 270 -1233 270 -1220 b 98 -891 270 -1075 206 -957 b 40 -871 76 -877 58 -871 b -10 -886 24 -871 8 -875 b -20 -889 -14 -889 -16 -889 l -24 -889 l -24 -749 l -24 -610 l -20 -610 b 0 -628 -9 -610 -2 -617 b 27 -692 4 -644 14 -671 b 138 -825 53 -741 88 -782 b 257 -973 190 -870 228 -917 b 262 -981 259 -977 262 -981 l 262 -981 b 269 -946 264 -979 268 -957 b 270 -903 270 -931 270 -917 b 98 -588 270 -774 206 -655 b 40 -569 76 -574 58 -569 b -10 -584 24 -569 8 -574 b -20 -587 -14 -587 -16 -587 l -24 -587 l -24 -448 l -24 -308 l -20 -308 b 0 -326 -9 -308 -2 -315 b 27 -390 4 -341 14 -369 b 138 -523 53 -438 88 -480 b 257 -670 190 -567 228 -614 b 262 -678 259 -674 262 -678 b 262 -678 262 -678 262 -678 b 269 -644 264 -677 268 -656 b 270 -601 270 -628 270 -614 b 98 -285 270 -471 206 -352 b 40 -266 76 -273 58 -266 b -10 -281 24 -266 8 -272 b -20 -284 -14 -284 -16 -284 l -24 -284 l -24 -145 "},vaa:{x_min:-1.359375,x_max:752.703125,ha:768,o:"m 490 985 b 504 986 495 986 500 986 b 604 907 551 986 593 954 b 607 884 607 900 607 892 b 581 813 607 857 597 831 l 578 810 l 583 811 b 710 932 638 827 687 873 b 714 943 711 936 713 942 b 730 952 720 949 725 952 b 752 931 741 952 752 943 b 200 -946 752 927 204 -941 b 182 -957 197 -953 190 -957 b 163 -945 174 -957 166 -953 b 161 -939 161 -942 161 -942 b 217 -743 161 -931 170 -904 b 272 -555 247 -639 272 -555 b 272 -555 272 -555 272 -555 b 264 -560 272 -555 268 -557 b 140 -603 227 -589 182 -603 b 36 -567 102 -603 65 -592 b -1 -487 12 -548 -1 -517 b 17 -427 -1 -466 5 -445 b 103 -380 38 -395 70 -380 b 191 -433 137 -380 172 -398 b 205 -484 201 -448 205 -466 b 178 -553 205 -509 196 -535 l 175 -557 l 182 -555 b 307 -435 236 -539 284 -494 b 372 -213 308 -430 372 -215 b 372 -213 372 -213 372 -213 b 364 -219 372 -213 368 -216 b 240 -262 328 -247 283 -262 b 137 -226 202 -262 166 -249 b 99 -145 112 -206 99 -176 b 118 -84 99 -124 106 -104 b 204 -38 138 -54 171 -38 b 292 -91 238 -38 273 -56 b 306 -141 302 -106 306 -124 b 279 -212 306 -167 296 -194 l 276 -215 l 281 -213 b 408 -93 336 -198 385 -151 b 473 129 409 -88 473 127 b 473 129 473 129 473 129 b 465 122 473 129 469 126 b 341 80 428 94 383 80 b 236 115 303 80 266 91 b 200 195 213 136 200 165 b 217 256 200 217 206 238 b 304 303 239 287 272 303 b 393 249 338 303 374 285 b 406 199 402 234 406 217 b 379 129 406 173 397 148 l 377 126 l 382 127 b 509 248 436 142 485 190 b 574 470 510 254 574 469 b 574 470 574 470 574 470 b 566 464 574 470 570 467 b 442 421 529 435 484 421 b 337 458 404 421 367 433 b 300 538 314 477 300 508 b 318 598 300 559 306 580 b 404 645 340 630 372 645 b 494 592 439 645 475 627 b 507 541 502 577 507 559 b 480 471 507 516 498 489 l 477 467 l 483 470 b 608 589 537 485 586 531 b 675 811 611 595 675 810 b 675 811 675 811 675 811 b 666 806 675 811 671 809 b 543 763 628 777 585 763 b 438 799 504 763 468 775 b 401 878 412 820 401 849 b 490 985 401 928 434 977 "},vab:{x_min:0,x_max:272.21875,ha:278,o:"m 243 631 b 250 632 246 632 249 632 b 270 620 259 632 268 628 l 272 616 l 272 201 l 272 -212 l 270 -216 b 251 -229 268 -224 259 -229 b 227 -215 243 -229 240 -229 l 151 -142 b 32 -16 81 -80 53 -49 b 0 84 9 18 0 52 b 111 199 0 149 42 199 b 137 197 119 199 127 198 b 228 151 168 191 197 177 l 231 148 l 231 383 b 232 620 231 616 231 616 b 243 631 234 624 238 630 m 168 131 b 152 133 163 133 157 133 b 107 102 130 133 111 120 b 106 86 107 97 106 91 b 111 41 106 73 108 56 b 227 -152 125 -13 171 -90 l 231 -156 l 231 -37 l 231 80 l 225 87 b 168 131 210 111 190 126 "},vad:{x_min:0,x_max:873.828125,ha:892,o:"m 0 0 l 0 703 l 81 703 l 164 703 l 164 0 l 164 -705 l 81 -705 l 0 -705 l 0 0 m 225 0 l 225 703 l 246 703 l 268 703 l 268 366 l 268 30 l 274 36 b 314 79 284 44 302 63 b 413 302 357 137 392 213 b 432 327 419 324 421 327 b 449 306 443 327 447 322 b 611 115 457 195 529 115 b 651 122 624 115 638 117 b 728 316 705 140 724 188 b 729 388 728 342 729 366 b 671 635 729 533 711 602 b 581 662 649 652 616 662 b 477 637 545 662 510 653 l 475 635 l 477 634 b 503 627 488 632 495 631 b 545 556 532 612 545 584 b 491 480 545 524 526 491 b 465 474 481 476 473 474 b 379 563 417 474 379 516 b 389 602 379 576 382 588 b 541 691 409 641 479 681 b 582 694 555 692 568 694 b 865 462 714 694 834 598 b 873 392 871 440 873 416 b 865 317 873 367 871 341 b 639 84 839 194 748 101 b 612 83 630 83 620 83 b 511 116 577 83 543 94 b 504 120 509 119 506 120 b 504 120 504 120 504 120 b 469 59 504 120 488 93 l 432 -1 l 469 -61 b 504 -122 488 -94 504 -122 b 504 -122 504 -122 504 -122 b 511 -117 506 -122 509 -120 b 612 -84 543 -95 577 -84 b 665 -91 630 -84 647 -87 b 869 -338 771 -122 850 -216 b 873 -392 872 -356 873 -374 b 798 -595 873 -469 847 -539 b 581 -695 741 -662 660 -695 b 406 -626 517 -695 454 -671 b 381 -563 389 -607 381 -585 b 465 -477 381 -519 413 -477 b 545 -559 514 -477 545 -519 b 503 -628 545 -587 532 -613 b 477 -635 495 -632 488 -634 l 475 -637 l 477 -638 b 581 -663 510 -655 545 -663 b 671 -637 616 -663 649 -653 b 729 -391 711 -603 729 -534 b 728 -317 729 -367 728 -344 b 623 -117 722 -173 698 -124 b 611 -116 619 -116 615 -116 b 449 -308 528 -116 457 -198 b 432 -328 447 -323 443 -328 b 413 -303 421 -328 419 -326 b 314 -80 392 -215 357 -138 b 274 -37 302 -65 284 -45 l 268 -31 l 268 -367 l 268 -705 l 246 -705 l 225 -705 l 225 0 "},vb1:{x_min:78.9375,x_max:485.921875,ha:417,o:"m 362 378 b 378 380 367 380 372 380 b 472 348 415 380 453 367 b 485 315 481 338 485 327 b 462 273 485 298 477 281 b 439 267 454 269 446 267 b 398 290 424 267 409 274 b 344 319 385 309 364 319 b 281 269 315 319 289 301 b 279 262 280 266 279 262 b 276 256 279 260 277 258 b 274 249 276 254 274 251 b 238 127 273 248 257 192 b 201 4 217 61 201 5 b 166 -1 198 -1 200 -1 b 153 -1 163 -1 157 -1 b 141 -1 148 -1 144 -1 b 104 4 106 -1 107 -1 b 104 6 104 5 104 5 b 142 144 104 13 110 34 b 182 278 164 219 181 276 b 183 288 182 281 182 285 b 185 302 185 292 185 298 b 164 330 185 317 176 328 b 159 330 163 330 161 330 b 102 302 140 330 119 320 b 91 294 95 295 93 294 b 88 294 91 294 89 294 b 78 303 83 294 78 298 b 81 312 78 306 78 309 b 200 373 106 347 160 373 b 215 371 205 373 209 371 b 266 335 235 367 254 353 b 269 331 268 333 269 331 b 269 331 269 331 269 331 b 273 335 269 331 270 334 b 362 378 298 359 330 376 "},vb3:{x_min:0,x_max:227.3125,ha:232,o:"m 91 213 b 100 215 93 215 96 215 b 227 58 167 215 224 144 b 227 52 227 56 227 54 b 61 -201 227 -43 164 -138 b 29 -216 44 -212 36 -216 b 23 -210 27 -216 24 -213 b 21 -205 21 -208 21 -206 b 34 -192 21 -201 25 -197 b 122 -55 89 -161 122 -106 b 104 6 122 -33 117 -12 l 103 9 l 96 9 b 4 79 57 9 17 38 b 0 112 1 90 0 101 b 91 213 0 163 36 209 "},vb4:{x_min:-597.53125,x_max:596.171875,ha:608,o:"m -533 324 b -525 327 -530 326 -528 327 b -504 305 -514 327 -504 317 b -504 305 -504 305 -504 305 b -513 284 -504 299 -504 299 b -556 112 -541 226 -556 167 b -545 33 -556 84 -552 58 b -524 -20 -541 15 -532 -9 l -522 -23 l -491 15 l -413 111 b -355 174 -367 169 -363 174 b -351 174 -353 174 -352 174 b -254 86 -343 174 -348 179 b -168 -1 -208 37 -168 -1 b -100 84 -168 -1 -137 37 b -23 173 -28 173 -29 172 b -19 174 -21 174 -20 174 b -8 173 -14 174 -10 173 b 80 86 -5 172 13 151 b 166 -1 127 37 166 -1 b 235 84 166 -1 197 37 b 311 173 306 173 304 172 b 317 174 313 174 314 174 b 326 173 319 174 323 173 b 490 11 329 172 366 134 l 502 -1 l 530 34 b 568 76 560 72 563 74 b 575 77 570 77 573 77 b 596 56 586 77 596 68 b 594 48 596 54 596 51 b 417 -172 592 41 424 -166 b 405 -176 415 -174 409 -176 b 396 -174 401 -176 398 -176 b 307 -87 393 -173 372 -152 b 221 -1 259 -38 221 -1 b 152 -86 221 -1 190 -38 b 76 -176 81 -174 83 -173 b 70 -176 74 -176 73 -176 b 61 -174 66 -176 62 -174 b -27 -87 58 -173 38 -152 b -114 -1 -74 -38 -112 -1 b -182 -86 -114 -1 -145 -38 b -258 -176 -253 -174 -253 -173 b -264 -176 -259 -176 -262 -176 b -274 -174 -268 -176 -272 -174 b -438 -11 -277 -173 -348 -102 l -449 0 l -479 -37 b -524 -80 -513 -80 -514 -80 l -524 -80 b -553 -52 -534 -80 -540 -74 b -597 109 -583 -8 -597 48 b -560 280 -597 165 -585 224 b -533 324 -548 310 -540 322 "},vb6:{x_min:0,x_max:556.6875,ha:568,o:"m 289 545 b 298 546 292 545 295 546 b 318 533 306 546 315 541 b 319 428 319 530 319 528 l 319 327 l 334 327 b 526 223 412 326 485 285 b 543 172 537 206 543 190 b 447 76 543 122 503 76 b 445 76 446 76 446 76 b 359 165 394 77 359 119 b 368 205 359 179 362 192 b 441 251 382 233 412 251 b 455 249 446 251 451 251 b 460 248 458 249 460 248 b 460 248 460 248 460 248 b 454 254 460 249 458 251 b 334 295 419 280 378 294 l 319 295 l 319 4 l 319 -287 l 321 -285 b 328 -285 322 -285 325 -285 b 524 -99 424 -277 507 -198 b 541 -79 526 -84 530 -79 b 556 -97 551 -79 556 -84 b 548 -133 556 -105 553 -117 b 334 -317 521 -233 434 -306 b 322 -319 329 -317 323 -317 l 319 -319 l 319 -424 b 319 -471 319 -444 319 -459 b 313 -541 319 -544 318 -535 b 298 -548 308 -545 303 -548 b 279 -534 289 -548 281 -542 b 277 -424 277 -531 277 -530 l 277 -317 l 273 -317 b 13 -95 153 -305 51 -217 b 0 2 4 -62 0 -29 b 182 295 0 126 66 238 b 274 324 210 309 249 320 l 277 324 l 277 427 b 279 533 277 528 277 530 b 289 545 281 538 285 542 m 277 2 b 277 291 277 161 277 291 b 268 288 277 291 273 290 b 144 1 179 265 144 184 b 276 -284 144 -199 175 -267 l 277 -285 l 277 2 "},vb7:{x_min:-176.9375,x_max:251.8125,ha:257,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 503 20 616 20 614 b 20 391 20 442 20 391 b 84 424 20 391 49 406 l 147 456 l 152 456 b 153 456 153 456 153 456 b 175 435 166 456 175 446 b 172 427 175 433 174 430 b 92 380 170 420 172 421 l 20 342 l 20 245 l 20 148 l 21 151 b 137 199 59 183 99 199 b 182 191 152 199 167 197 b 251 84 227 176 251 134 b 228 0 251 58 243 29 b 100 -142 206 -40 178 -72 l 23 -215 b 0 -229 9 -229 6 -229 b -20 -216 -9 -229 -17 -224 b -21 54 -21 -212 -21 -212 b -21 322 -21 201 -21 322 b -85 290 -21 322 -50 308 l -148 256 l -153 256 b -155 256 -155 256 -155 256 b -176 277 -167 256 -176 266 b -174 285 -176 280 -175 283 b -93 333 -171 294 -174 292 l -21 370 l -21 494 b -20 620 -21 616 -21 616 b -8 631 -17 624 -13 630 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 "},vb9:{x_min:-122.5,x_max:121.140625,ha:124,o:"m -16 145 b 0 147 -10 147 -5 147 b 121 -1 66 147 121 77 b 114 -49 121 -16 118 -33 b -1 -148 95 -112 47 -148 b -85 -106 -31 -148 -61 -134 b -122 -1 -110 -76 -122 -38 b -16 145 -122 68 -81 134 m 12 111 b 0 113 8 113 4 113 b -68 22 -29 113 -61 73 b -70 0 -69 15 -70 6 b -13 -113 -70 -49 -47 -98 b -1 -115 -9 -115 -5 -115 b 63 -40 24 -115 53 -83 b 68 -1 66 -27 68 -15 b 12 111 68 48 46 97 "},vba:{x_min:-118.421875,x_max:597.53125,ha:381,o:"m 460 574 b 464 574 461 574 462 574 b 488 574 470 574 481 574 b 500 573 491 574 498 574 b 594 503 543 570 588 538 b 597 488 596 498 597 494 b 528 417 597 449 564 417 b 502 423 519 417 510 419 b 465 481 477 434 465 458 b 488 528 465 499 472 516 b 490 530 490 530 490 530 b 490 530 490 530 490 530 b 468 517 488 530 475 523 b 349 340 419 485 377 420 b 347 330 348 334 347 330 b 383 328 347 328 363 328 b 428 326 423 328 424 328 b 442 302 438 320 442 312 b 430 281 442 294 438 285 b 385 276 424 277 426 276 l 377 276 l 332 276 l 330 269 b 178 -117 303 126 250 -9 b 1 -249 129 -194 69 -237 b -20 -251 -6 -251 -13 -251 b -114 -187 -65 -251 -100 -227 b -118 -156 -117 -177 -118 -166 b -51 -84 -118 -116 -91 -84 b -31 -87 -46 -84 -39 -86 b 16 -152 0 -95 16 -124 b -12 -205 16 -173 8 -194 b -16 -208 -14 -206 -16 -208 b -14 -208 -16 -208 -14 -208 b -9 -206 -14 -208 -12 -208 b 74 -124 23 -197 54 -166 b 172 224 98 -79 125 22 b 185 276 178 252 183 274 b 185 276 185 276 185 276 b 141 276 185 276 181 276 b 91 280 96 276 96 276 b 77 302 83 285 77 294 b 91 326 77 312 83 320 b 148 328 95 328 96 328 l 198 330 l 202 341 b 460 574 249 473 351 566 "},vbf:{x_min:-53.078125,x_max:513.140625,ha:485,o:"m 185 383 b 196 384 187 383 191 384 b 277 334 230 384 259 365 b 288 301 281 324 288 306 b 288 297 288 298 288 297 b 294 302 289 297 291 299 b 394 370 323 338 367 367 b 404 371 398 370 401 371 b 510 272 453 371 498 328 b 513 237 513 262 513 251 b 507 172 513 217 511 192 b 326 -34 487 59 412 -26 b 314 -36 322 -36 318 -36 b 274 -24 298 -36 283 -31 l 265 -16 b 224 44 246 -1 232 20 b 223 49 224 47 223 49 b 223 49 223 49 223 49 b 149 -197 221 48 149 -194 b 149 -198 149 -197 149 -198 b 170 -210 149 -202 155 -205 b 187 -215 174 -210 175 -212 b 204 -231 201 -219 204 -222 b 197 -245 204 -240 202 -242 l 194 -248 l 76 -248 l -42 -248 l -46 -245 b -53 -231 -51 -242 -53 -240 b -35 -215 -53 -222 -49 -217 b -13 -210 -21 -212 -20 -212 b -6 -208 -10 -209 -8 -208 b 0 -206 -6 -208 -2 -206 b 25 -188 13 -201 21 -195 b 163 280 28 -183 163 276 b 166 291 163 283 164 287 b 167 302 167 295 167 299 b 155 324 167 315 161 324 b 155 324 155 324 155 324 b 65 230 125 322 85 280 b 53 215 61 217 58 215 b 51 215 53 215 51 215 b 42 224 46 215 42 217 b 57 263 42 231 47 244 b 140 360 77 305 104 337 b 152 370 144 365 149 369 b 185 383 157 376 172 381 m 374 306 b 366 308 371 308 368 308 b 300 273 348 308 321 294 b 284 254 288 262 287 259 b 280 242 283 249 281 245 b 257 169 279 240 270 213 l 236 98 l 236 93 b 251 48 238 77 243 61 b 279 27 258 37 272 27 b 281 27 279 27 280 27 b 291 31 281 27 287 30 b 396 170 334 52 378 109 b 406 247 402 197 406 224 b 401 277 406 259 405 270 b 374 306 397 290 383 303 "},vc3:{x_min:-10.890625,x_max:299.4375,ha:294,o:"m 136 460 b 142 462 137 462 140 462 b 166 449 152 462 161 456 b 171 428 168 446 168 445 b 288 131 194 322 238 209 b 298 115 295 120 296 117 b 299 106 298 112 299 109 b 273 81 299 91 287 81 b 255 86 268 81 261 83 b 155 116 225 104 183 116 l 152 116 l 149 108 b 141 83 148 102 144 91 b 134 48 137 69 134 58 b 149 9 134 34 140 24 b 153 -1 152 5 153 1 b 149 -9 153 -5 152 -6 b 144 -11 148 -11 147 -11 b 122 2 138 -11 133 -6 b 95 61 104 20 95 38 b 107 108 95 74 99 90 b 108 113 107 111 108 112 b 107 113 108 113 108 113 b 102 113 106 113 104 113 b 31 86 76 108 53 98 b 14 80 24 81 20 80 b -10 106 0 80 -10 91 b 0 131 -10 115 -9 116 b 115 430 49 209 91 317 b 136 460 119 451 123 456 "},vd0:{x_min:-10.890625,x_max:299.4375,ha:294,o:"m 44 174 b 51 174 47 174 49 174 b 68 173 55 174 61 174 l 287 112 l 551 40 b 615 20 617 22 609 23 b 626 0 622 16 626 8 b 615 -22 626 -9 622 -18 b 613 -23 613 -23 613 -23 b 613 -23 613 -23 613 -23 b 287 -113 613 -24 597 -29 l 68 -174 b 53 -176 61 -176 57 -176 b 39 -172 47 -176 43 -174 b 27 -151 31 -167 27 -159 b 39 -129 27 -141 31 -133 b 230 -74 43 -124 20 -131 l 370 -36 l 468 -9 b 498 0 484 -4 498 -1 b 468 8 498 0 484 2 l 370 34 l 230 73 b 40 126 28 129 43 124 b 27 149 31 131 27 140 b 44 174 27 161 34 170 m 205 110 l 205 300 b 205 330 245 330 245 300 l 245 300 l 245 -300 b 245 -330 205 -330 205 -300 l 205 -300 l 205 110 l 345 90 m 345 90 l 345 330 b 345 360 385 360 385 330 l 385 330 l 385 -270 b 385 -300 345 -300 345 -270 l 345 -270 l 345 90 "},vd1:{x_min:-20,x_max:320,ha:257,o:"m -8 200 b -8 210 8 200 16 200 l 20 148 -199 l 23 -615 b 0 -629 9 -629 6 -629 l -21 -612 l -21 -201 l -21 216 l -20 200 m 16 200 l 310 0 l 240 0 l 16 140 l 16 -120 l 240 0 l 310 0 l 16 -200 "},vd2:{x_min:0,x_max:430.75,ha:386,o:"m 0 200 l 0 -200 l 430 -200 l 430 200 l 0 200 "},vd3:{x_min:0,x_max:430.75,ha:386,o:"m 0 200 l 0 -200 l 430 -200 l 430 200 l 0 200 l 50 150 l 380 150 l 380 -150 l 50 -150 l 50 150 "},vd4:{x_min:0,x_max:430.75,ha:360,o:"m 0 150 l 0 -150 l 430 -150 l 430 150 l 0 150 "},vd5:{x_min:0,x_max:430.75,ha:360,o:"m 0 150 l 0 -150 l 430 -150 l 430 150 l 0 150 l 50 100 l 380 100 l 380 -100 l 50 -100 l 50 100"},vd6:{x_min:0,x_max:430.75,ha:360,o:"m -146 537 b -138 538 -143 538 -141 538 b -118 525 -129 538 -121 533 b -117 390 -117 522 -117 521 b -115 259 -117 268 -117 259 b -115 259 -115 259 -115 259 b -59 272 -104 263 -62 272 b -39 259 -50 272 -42 267 b -37 209 -38 257 -37 233 b -39 159 -37 185 -38 162 b -85 138 -43 149 -44 149 l -117 131 l -117 21 b -115 -88 -117 -80 -117 -88 b -115 -88 -115 -88 -115 -88 b -59 -75 -104 -84 -62 -75 b -44 -81 -52 -75 -48 -77 b -38 -124 -38 -87 -38 -85 b -38 -138 -38 -124 -38 -138 b -38 -152 -38 -138 -38 -152 b -44 -195 -38 -191 -38 -190 b -85 -209 -48 -200 -48 -200 l -117 -217 l -117 -349 b -118 -486 -117 -481 -117 -482 b -138 -499 -121 -494 -129 -499 b -153 -493 -143 -499 -149 -497 b -159 -415 -158 -487 -159 -496 b -159 -355 -159 -398 -159 -379 b -159 -227 -159 -284 -159 -227 b -205 -238 -159 -227 -180 -232 b -250 -249 -230 -244 -250 -249 b -251 -386 -251 -249 -251 -311 b -252 -525 -251 -521 -251 -522 b -272 -538 -255 -534 -264 -538 b -287 -532 -277 -538 -283 -536 b -293 -452 -292 -527 -293 -536 b -293 -391 -293 -436 -293 -415 b -294 -260 -293 -269 -293 -260 b -294 -260 -294 -260 -294 -260 b -348 -272 -306 -264 -345 -272 b -368 -259 -357 -272 -365 -267 b -369 -209 -369 -257 -369 -233 b -368 -159 -369 -185 -369 -162 b -323 -139 -364 -149 -362 -148 l -293 -131 l -293 -22 b -294 87 -293 80 -293 87 b -294 87 -294 87 -294 87 b -348 75 -306 84 -345 75 b -368 88 -357 75 -365 80 b -369 138 -369 91 -369 114 b -368 188 -369 162 -369 186 b -323 209 -364 198 -362 199 l -293 216 l -293 349 b -292 486 -293 481 -293 482 b -272 499 -288 494 -280 499 b -257 493 -266 499 -261 497 b -251 414 -251 487 -251 496 b -251 354 -251 398 -251 378 b -251 226 -251 284 -251 226 b -205 238 -250 226 -230 231 b -159 249 -180 244 -159 249 b -159 385 -159 249 -159 310 b -157 525 -159 521 -159 522 b -146 537 -156 530 -151 535 z m -159 11 b -159 120 -159 98 -159 120 l -159 120 b -175 116 -160 120 -167 119 b -221 105 -184 114 -204 109 l -251 98 l -251 -12 b -251 -121 -251 -72 -251 -121 b -205 -110 -250 -121 -230 -116 b -159 -99 -180 -104 -159 -99 b -159 11 -159 -99 -159 -49 z m 89 517 b 97 519 92 518 94 519 b 117 505 106 519 114 513 b 119 376 119 502 119 501 l 119 249 l 145 258 b 176 267 169 266 172 267 b 177 267 176 267 177 267 b 196 255 186 267 192 263 l 197 252 l 197 205 b 197 181 197 195 197 187 b 193 149 197 153 197 153 b 152 131 190 144 187 143 l 119 120 l 119 10 b 119 -100 119 -62 119 -100 b 145 -91 120 -100 131 -96 b 173 -82 159 -86 171 -82 b 176 -81 174 -81 175 -81 b 196 -94 185 -81 193 -87 b 198 -151 197 -97 198 -125 b 197 -194 198 -172 197 -192 b 153 -218 193 -203 192 -204 l 119 -230 l 119 -367 l 118 -504 l 117 -507 b 97 -519 113 -514 105 -519 b 82 -512 92 -519 87 -517 b 76 -434 77 -507 76 -516 b 76 -374 76 -418 76 -398 b 76 -245 76 -303 76 -245 b 52 -254 76 -245 65 -249 b 19 -263 34 -260 25 -263 b 6 -257 13 -263 10 -261 b 0 -214 0 -251 0 -253 b 0 -200 0 -210 0 -205 b 0 -188 0 -196 0 -192 b 6 -143 0 -147 0 -149 b 46 -126 10 -139 10 -139 l 76 -115 l 76 -5 b 76 106 76 56 76 106 b 51 98 76 106 64 102 b 18 89 34 92 25 89 b 6 95 13 89 10 91 b 0 139 0 101 0 99 b 0 153 0 143 0 148 b 0 179 0 163 0 172 b 44 225 0 215 3 211 l 76 236 l 76 369 b 78 505 76 501 76 502 b 89 517 80 510 85 515 z "},vd7:{x_min:0,x_max:430.75,ha:360,o:"m 283 633 b 291 634 286 634 289 634 b 311 621 300 634 308 629 b 313 505 313 618 313 617 b 313 393 313 443 313 393 b 378 425 313 393 343 407 l 443 458 l 448 458 b 449 458 449 458 449 458 b 471 437 462 458 471 448 b 469 429 471 434 470 432 b 387 382 466 421 469 423 l 313 344 l 313 247 l 313 150 l 315 152 b 433 201 353 184 394 201 b 479 193 448 201 464 198 b 549 86 524 177 549 135 b 526 1 549 59 541 29 b 395 -143 504 -39 475 -71 b 316 -214 351 -182 341 -191 b 292 -229 302 -228 300 -229 b 272 -216 283 -229 275 -224 b 271 55 271 -212 271 -212 b 270 323 271 203 270 323 b 205 291 270 323 241 308 l 140 258 l 135 258 b 134 258 135 258 134 258 b 112 279 121 258 112 267 b 114 287 112 281 113 284 b 196 334 117 295 114 293 l 271 371 l 271 495 b 272 621 271 617 271 618 b 283 633 274 626 279 631 z m 404 133 b 391 134 400 134 395 134 b 384 134 388 134 386 134 b 318 88 358 130 335 114 l 313 81 l 313 -37 l 313 -156 l 316 -152 b 439 83 391 -71 439 22 l 439 84 b 404 133 439 115 430 128 z m -8 633 l -8 633 b 0 634 -6 634 -3 634 b 20 621 8 634 17 629 b 21 384 21 618 21 617 l 21 150 l 24 152 b 141 201 62 184 102 201 b 187 193 157 201 172 198 b 257 86 232 177 257 135 b 234 1 257 59 250 29 b 103 -143 212 -39 183 -71 b 24 -214 60 -182 49 -191 b 0 -229 10 -228 8 -229 b -20 -216 -9 -229 -17 -224 l -21 -212 l -21 203 l -21 618 l -20 621 b -8 633 -18 626 -13 631 z m 113 133 l 113 133 b 99 134 109 134 103 134 b 93 134 97 134 94 134 b 26 88 66 130 43 114 l 21 81 l 21 -37 l 21 -156 l 25 -152 b 148 83 99 -71 148 22 l 148 84 b 113 133 148 115 138 128 z "}
5},cssFontWeight:"normal",ascender:1903,underlinePosition:-125,cssFontStyle:"normal",boundingBox:{yMin:-2065.375,xMin:-695.53125,yMax:1901.578125,xMax:1159.671875},resolution:1e3,descender:-2066,familyName:"VexFlow-18",lineHeight:4093,underlineThickness:50};function Ma(e,t,i,s,r,n){let a,o,l,h=0;function u(){return t+e[h++]*s}function c(){return i+e[h++]*r}for(;h<e.length;)switch(a=e[h++],a){case"m":case"l":n[a](u(),c());break;case"q":o=u(),l=c(),n.q(u(),c(),o,l);break;case"b":o=u(),l=c(),n.b(u(),c(),u(),c(),o,l);break;default:break}}var wt=class _i extends fe{static loadMetrics(t,i,s){let r=t.glyphs[i];if(!r)throw new w.RERR("BadGlyph",`Glyph ${i} does not exist in font.`);let n=r.x_min,a=r.x_max,o=r.ha,l;if(r.o)return s?r.cached_outline?l=r.cached_outline:(l=r.o.split(" "),r.cached_outline=l):(r.cached_outline&&delete r.cached_outline,l=r.o.split(" ")),{x_min:n,x_max:a,ha:o,outline:l};throw new w.RERR("BadGlyph",`Glyph ${i} has no outline defined.`)}static renderGlyph(t,i,s,r,n,a){let o=r*72/(Hs.resolution*100),l=_i.loadMetrics(Hs,n,!a);_i.renderOutline(t,l.outline,o,i,s)}static renderOutline(t,i,s,r,n){t.beginPath(),t.moveTo(r,n),Ma(i,r,n,s,-s,{m:t.moveTo.bind(t),l:t.lineTo.bind(t),q:t.quadraticCurveTo.bind(t),b:t.bezierCurveTo.bind(t)}),t.fill()}static getOutlineBoundingBox(t,i,s,r){let n=new Th;return Ma(t,s,r,i,-i,{m:n.addPoint.bind(n),l:n.addPoint.bind(n),q:n.addQuadraticCurve.bind(n),b:n.addBezierCurve.bind(n)}),new Sr(n.x1,n.y1,n.width(),n.height())}constructor(t,i,s){super(),this.setAttribute("type","Glyph"),this.code=t,this.point=i,this.options={cache:!0,font:Hs},this.metrics=null,this.x_shift=0,this.y_shift=0,this.originShift={x:0,y:0},s?this.setOptions(s):this.reset()}setOptions(t){w.Merge(this.options,t),this.reset()}setPoint(t){return this.point=t,this}setStave(t){return this.stave=t,this}setXShift(t){return this.x_shift=t,this}setYShift(t){return this.y_shift=t,this}reset(){this.scale=this.point*72/(this.options.font.resolution*100),this.metrics=_i.loadMetrics(this.options.font,this.co
5de,this.options.cache),this.bbox=_i.getOutlineBoundingBox(this.metrics.outline,this.scale,0,0)}getMetrics(){if(!this.metrics)throw new w.RuntimeError("BadGlyph",`Glyph ${this.code} is not initialized.`);return{x_min:this.metrics.x_min*this.scale,x_max:this.metrics.x_max*this.scale,width:this.bbox.getW(),height:this.bbox.getH()}}setOriginX(t){let{bbox:i}=this,s=(t-Math.abs(i.getX()/i.getW()))*i.getW();this.originShift.x=-s}setOriginY(t){let{bbox:i}=this,s=(t-Math.abs(i.getY()/i.getH()))*i.getH();this.originShift.y=-s}setOrigin(t,i){this.setOriginX(t),this.setOriginY(i)}render(t,i,s){if(!this.metrics)throw new w.RuntimeError("BadGlyph",`Glyph ${this.code} is not initialized.`);let r=this.metrics.outline,n=this.scale;this.setRendered(),this.applyStyle(t),_i.renderOutline(t,r,n,i+this.originShift.x,s+this.originShift.y),this.restoreStyle(t)}renderToStave(t){if(this.checkContext(),!this.metrics)throw new w.RuntimeError("BadGlyph",`Glyph ${this.code} is not initialized.`);if(!this.stave)throw new w.RuntimeError("GlyphError","No valid stave");let i=this.metrics.outline,s=this.scale;this.setRendered(),this.applyStyle(),_i.renderOutline(this.context,i,s,t+this.x_shift,this.stave.getYForGlyphs()+this.y_shift),this.restoreStyle()}},D={STEM_WIDTH:1.5,STEM_HEIGHT:35,STAVE_LINE_THICKNESS:1,RESOLUTION:16384,DEFAULT_NOTATION_FONT_SCALE:39,DEFAULT_TABLATURE_FONT_SCALE:39,SLASH_NOTEHEAD_WIDTH:15,TEXT_HEIGHT_OFFSET_HACK:1,IsKerned:!0};D.clefProperties=e=>{if(!e)throw new w.RERR("BadArgument","Invalid clef: "+e);let t=D.clefProperties.values[e];if(!t)throw new w.RERR("BadArgument","Invalid clef: "+e);return t},D.clefProperties.values={treble:{line_shift:0},bass:{line_shift:6},tenor:{line_shift:4},alto:{line_shift:3},soprano:{line_shift:1},percussion:{line_shift:0},"mezzo-soprano":{line_shift:2},"baritone-c":{line_shift:5},"baritone-f":{line_shift:5},subbass:{line_shift:7},french:{line_shift:-1}},D.keyProperties=(e,t,i)=>{t===void 0&&(t="treble");let s={octave_shift:0};typeof i=="object"&&w.Merge(s,i);let r=e.split("/");if(r.length<2)throw new w.RERR("BadArguments",`Key must have note + octave and an optional glyph: ${e}`);let n=r[0].toUpperCase(),a=D.keyProperties.note_values[n];if(!a)throw new w.RERR("BadArguments","Invalid key name: "+n);a.octave&&(r[1]=a.octave);let o=parseInt(r[1],10);o+=-1*s.octave_shift;let l=(o*7-28+a.index)/2;l+=D.clefProperties(t).line_shift;let h=0;l<=0&&l*2%2==0&&(h=1),l>=6&&l*2%2==0&&(h=-1);let u=a.int_val===void 0?null:o*12+a.int_val,c=a.code,d=a.shift_right,f={};if(r.length>2&&r[2]){let p=r[2].toUpperCase();f=D.keyProperties.customNoteHeads[p]||{}}return{key:n,octave:o,line:l,int_value:u,accidental:a.accidental,code:c,stroke:h,shift_right:d,displaced:!1,...f}},D.keyProperties.note_values={C:{index:0,int_val:0,accidental:null},CN:{index:0,int_val:0,accidental:"n"},"C#":{index:0,int_val:1,accidental:"#"},"C##":{index:0,int_val:2,accidental:"##"},CB:{index:0,int_val:-1,accidental:"b"},CBB:{index:0,int_val:-2,accidental:"bb"},D:{index:1,int_val:2,accidental:null},DN:{index:1,int_val:2,accidental:"n"},"D#":{index:1,int_val:3,accidental:"#"},"D##":{index:1,int_val:4,accidental:"##"},DB:{index:1,int_val:1,accidental:"b"},DBB:{index:1,int_val:0,accidental:"bb"},E:{index:2,int_val:4,accidental:null},EN:{index:2,int_val:4,accidental:"n"},"E#":{index:2,int_val:5,accidental:"#"},"E##":{index:2,int_val:6,accidental:"##"},EB:{index:2,int_val:3,accidental:"b"},EBB:{index:2,int_val:2,accidental:"bb"},F:{index:3,int_val:5,accidental:null},FN:{index:3,int_val:5,accidental:"n"},"F#":{index:3,int_val:6,accidental:"#"},"F##":{index:3,int_val:7,accidental:"##"},FB:{index:3,int_val:4,accidental:"b"},FBB:{index:3,int_val:3,accidental:"bb"},G:{index:4,int_val:7,accidental:null},GN:{index:4,int_val:7,accidental:"n"},"G#":{index:4,int_val:8,accidental:"#"},"G##":{index:4,int_val:9,accidental:"##"},GB:{index:4,int_val:6,accidental:"b"},GBB:{index:4,int_val:5,accidental:"bb"},A:{index:5,int_val:9,accidental:null},AN:{index:5,int_val:9,accidental:"n"},"A#":{index:5,int_val:10,accidental:"#"},"A##":{index:5,int_val:11,accidental:"##"},AB:{index:5,int_val:8,accidental:"b"},ABB:{index:5,int_val:7,accidental:"bb"},B:{index:6,int_val:11,accidental:null},BN:{index:6,int_val:11,accidental:"n"},"B#":{index:6,int_val:12,accidental:"#"},"B##":{index:6,int_val:13,accidental:"##"},BB:{index:6,int_val:10,accidental:"b"},BBB:{index:6,int_val:9,accidental:"bb"},R:{index:6,int_val:9,rest:!0},X:{index:6,accidental:"",octave:4,code:"v3e",shift_right:5.5}},D.keyProperties.customNoteHeads={D0:{code:"v27",shift_right:0,stem_up_x_offset:0,stem_down_x_offset:0,stem_up_y_offset:-1,stem_down_y_offset:0},D1:{code:"v2d",shift_right:-.5},D2:{code:"v22",shift_right:-.5},D3:{code:"v70",shift_right:-.5},T0:{code:"v49",shift_right:-2,stem_up_y_offset:-4,stem_down_y_offset:4},T1:{code:"v93",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},T2:{code:"v40",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},T3:{code:"v7d",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},X0:{code:"v92",stem_up_x_offset:-2,stem_down_x_offset:0,stem_up_y_offset:4,stem_down_y_offset:4},X1:{code:"v95",shift_right:-.5,stem_up_y_offset:4,stem_down_y_offset:4},X2:{code:"v3e",shift_right:.5,stem_up_y_offset:4,stem_down_y_offset:4},X3:{code:"v3b",shift_right:0,stem_up_x_offset:-1.2,stem_down_x_offset:0,stem_up_y_offset:-1,stem_down_y_offset:2},S1:{code:"vd3",shift_right:0},S2:{code:"vd2",shift_right:0},R1:{code:"vd5",shift_right:0},R2:{code:"vd4",shift_right:0}},D.integerToNote=e=>{if(e===void 0)throw new w.RERR("BadArguments","Undefined integer for integerToNote");if(e<-2)throw new w.RERR("BadArguments",`integerToNote requires integer > -2: ${e}`);let t=D.integerToNote.table[e];if(!t)throw new w.RERR("BadArguments",`Unknown note value for integer: ${e}`);return t},D.integerToNote.table={0:"C",1:"C#",2:"D",3:"D#",4:"E",5:"F",6:"F#",7:"G",8:"G#",9:"A",10:"A#",11:"B"},D.tabToGlyph=(e,t=1)=>{let i=null,s=0,r=0;if(e.toString().toUpperCase()==="X"){let n=new wt("v7f",D.DEFAULT_TABLATURE_FONT_SCALE).getMetrics();i="v7f",s=n.width,r=-n.height/2}else s=D.textWidth(e.toString());return{text:e,code:i,getWidth:()=>s*t,shift_y:r}},D.textWidth=e=>7*e.toString().length,D.articulationCodes=e=>D.articulationCodes.articulations[e],D.articulationCodes.articulations={"a.":{code:"v23",between_lines:!0},av:{code:"v28",between_lines:!0},"a>":{code:"v42",between_lines:!0},"a-":{code:"v25",between_lines:!0},"a^":{code:"va",between_lines:!1},"a+":{code:"v8b",between_lines:!1},ao:{code:"v94",between_lines:!1},ah:{code:"vb9",between_lines:!1},"a@a":{code:"v43",between_lines:!1},"a@u":{code:"v5b",between_lines:!1},"a|":{code:"v75",between_lines:!1},am:{code:"v97",between_lines:!1},"a,":{code:"vb3",between_lines:!1}},D.accidentalCodes=e=>D.accidentalCodes.accidentals[e],D.accidentalCodes.accidentals={"#":{code:"v18",parenRightPaddingAdjustment:-1},"##":{code:"v7f",parenRightPaddingAdjustment:-1},b:{code:"v44",parenRightPaddingAdjustment:-2},bb:{code:"v26",parenRightPaddingAdjustment:-2},n:{code:"v4e",parenRightPaddingAdjustment:-1},"{":{code:"v9c",parenRightPaddingAdjustment:-1},"}":{code:"v84",parenRightPaddingAdjustment:-1},db:{code:"v9e",parenRightPaddingAdjustment:-1},d:{code:"vab",parenRightPaddingAdjustment:0},bbs:{code:"v90",parenRightPaddingAdjustment:-1},"++":{code:"v51",parenRightPaddingAdjustment:-1},"+":{code:"v78",parenRightPaddingAdjustment:-1},"+-":{code:"v8d",parenRightPaddingAdjustment:-1},"++-":{code:"v7a",parenRightPaddingAdjustment:-1},bs:{code:"vb7",parenRightPaddingAdjustment:-1},bss:{code:"v39",parenRightPaddingAdjustment:-1},o:{code:"vd0",parenRightPaddingAdjustment:-1},k:{code:"vd1",parenRightPaddingAdjustment:-1},ashs:{code:"vd6",parenRightPaddingAdjustment:-1},afhf:{code:"vd7",parenRightPaddingAdjustment:-1}},D.accidentalColumnsTable={1:{a:[1],b:[1]},2:{a:[1,2]},3:{a:[1,3,2],b:[1,2,1],second_on_bottom:[1,2,3]},4:{a:[1,3,4,2],b:[1,2,3,1],spaced_out_tetrachord:[1,2,1,2]},5:{a:[1,3,5,4,2],b:[1,2,4,3,1],spaced_out_pentachord:[1,2,3,2,1],very_spaced_out_pentachord:[1,2,1,2,1]},6:{a:[1,3,5,6,4,2],b:[1,2,4,5,3,1],spaced_out_hexachord:[1,3,2,1,3,2],very_spaced_out_hexachord:[1,2,1,2,1,2]}},D.ornamentCodes=e=>D.ornamentCodes.ornaments[e],D.ornamentCodes.ornaments={mordent:{code:"v1e"},mordent_inverted:{code:"v45"},turn:{code:"v72"},turn_inverted:{code:"v33"},tr:{code:"v1f"}
5,upprall:{code:"v60"},downprall:{code:"vb4"},prallup:{code:"v6d"},pralldown:{code:"v2c"},upmordent:{code:"v29"},downmordent:{code:"v68"},lineprall:{code:"v20"},prallprall:{code:"v86"}},D.keySignature=e=>{let t=D.keySignature.keySpecs[e];if(!t)throw new w.RERR("BadKeySignature",`Bad key signature spec: '${e}'`);if(!t.acc)return[];let i=D.keySignature.accidentalList(t.acc),s=[];for(let r=0;r<t.num;++r){let n=i[r];s.push({type:t.acc,line:n})}return s},D.keySignature.keySpecs={C:{acc:null,num:0},Am:{acc:null,num:0},F:{acc:"b",num:1},Dm:{acc:"b",num:1},Bb:{acc:"b",num:2},Gm:{acc:"b",num:2},Eb:{acc:"b",num:3},Cm:{acc:"b",num:3},Ab:{acc:"b",num:4},Fm:{acc:"b",num:4},Db:{acc:"b",num:5},Bbm:{acc:"b",num:5},Gb:{acc:"b",num:6},Ebm:{acc:"b",num:6},Cb:{acc:"b",num:7},Abm:{acc:"b",num:7},G:{acc:"#",num:1},Em:{acc:"#",num:1},D:{acc:"#",num:2},Bm:{acc:"#",num:2},A:{acc:"#",num:3},"F#m":{acc:"#",num:3},E:{acc:"#",num:4},"C#m":{acc:"#",num:4},B:{acc:"#",num:5},"G#m":{acc:"#",num:5},"F#":{acc:"#",num:6},"D#m":{acc:"#",num:6},"C#":{acc:"#",num:7},"A#m":{acc:"#",num:7}},D.unicode={sharp:"♯",flat:"♭",natural:"♮",triangle:"△","o-with-slash":"ø",degrees:"°",circle:"○"},D.keySignature.accidentalList=e=>({b:[2,.5,2.5,1,3,1.5,3.5],"#":[0,1.5,-.5,1,2.5,.5,2]})[e],D.parseNoteDurationString=e=>{if(typeof e!="string")return null;let t=/(\d*\/?\d+|[a-z])(d*)([nrhms]|$)/.exec(e);if(!t)return null;let i=t[1],s=t[2].length,r=t[3];return r.length===0&&(r="n"),{duration:i,dots:s,type:r}},D.parseNoteStruct=e=>{let t=e.duration,i=D.parseNoteDurationString(t);if(!i)return null;let s=D.durationToTicks(i.duration);if(s==null)return null;let r=e.type,n=[];if(r){if(!D.getGlyphProps.validTypes[r])return null}else r=i.type||"n",e.keys!==void 0&&e.keys.forEach((l,h)=>{let u=l.split("/");u&&u.length===3&&(n[h]=u[2])});let a=e.dots?e.dots:i.dots;if(typeof a!="number")return null;let o=s;for(let l=0;l<a;l++){if(o<=1)return null;o/=2,s+=o}return{duration:i.duration,type:r,customTypes:n,dots:a,ticks:s}},D.sanitizeDuration=e=>{let t=D.durationAliases[e];if(t!==void 0&&(e=t),D.durationToTicks.durations[e]===void 0)throw new w.RERR("BadArguments",`The provided duration is not valid: ${e}`);return e},D.durationToFraction=e=>new ie().parse(D.sanitizeDuration(e)),D.durationToNumber=e=>D.durationToFraction(e).value(),D.durationToTicks=e=>{e=D.sanitizeDuration(e);let t=D.durationToTicks.durations[e];return t===void 0?null:t},D.durationToTicks.durations={"1/2":D.RESOLUTION*2,1:D.RESOLUTION/1,2:D.RESOLUTION/2,4:D.RESOLUTION/4,8:D.RESOLUTION/8,16:D.RESOLUTION/16,32:D.RESOLUTION/32,64:D.RESOLUTION/64,128:D.RESOLUTION/128,256:D.RESOLUTION/256},D.durationAliases={w:"1",h:"2",q:"4",b:"256"},D.getGlyphProps=(e,t)=>{e=D.sanitizeDuration(e);let i=D.getGlyphProps.duration_codes[e];if(i===void 0)return null;t||(t="n");let s=i.type[t];if(s===void 0){let r=D.keyProperties.customNoteHeads[t.toUpperCase()];if(r===void 0)return null;s={code_head:r.code,...r}}return{...i.common,...s}},D.getGlyphProps.validTypes={n:{name:"note"},r:{name:"rest"},h:{name:"harmonic"},m:{name:"muted"},s:{name:"slash"}},D.getGlyphProps.duration_codes={"1/2":{common:{getWidth(e=D.DEFAULT_NOTATION_FONT_SCALE){return new wt(this.code_head||"v53",e).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-D.STEM_HEIGHT,stem_down_extension:-D.STEM_HEIGHT,tabnote_stem_up_extension:-D.STEM_HEIGHT,tabnote_stem_down_extension:-D.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v53"},h:{code_head:"v59"},m:{code_head:"vf",stem_offset:0},r:{code_head:"v31",rest:!0,position:"B/5",dot_shiftY:.5},s:{getWidth:()=>D.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},1:{common:{getWidth(e=D.DEFAULT_NOTATION_FONT_SCALE){return new wt(this.code_head||"v1d",e).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-D.STEM_HEIGHT,stem_down_extension:-D.STEM_HEIGHT,tabnote_stem_up_extension:-D.STEM_HEIGHT,tabnote_stem_down_extension:-D.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v1d"},h:{code_head:"v46"},m:{code_head:"v92",stem_offset:-3},r:{code_head:"v5c",rest:!0,position:"D/5",dot_shiftY:.5},s:{getWidth:()=>D.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},2:{common:{getWidth(e=D.DEFAULT_NOTATION_FONT_SCALE){return new wt(this.code_head||"v81",e).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v81"},h:{code_head:"v2d"},m:{code_head:"v95",stem_offset:-3},r:{code_head:"vc",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5},s:{getWidth:()=>D.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},4:{common:{getWidth(e=D.DEFAULT_NOTATION_FONT_SCALE){return new wt(this.code_head||"vb",e).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e",stem_offset:-3},r:{code_head:"v7c",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1.5,line_below:1.5},s:{getWidth:()=>D.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},8:{common:{getWidth(e=D.DEFAULT_NOTATION_FONT_SCALE){return new wt(this.code_head||"vb",e).getMetrics().width},stem:!0,stem_offset:0,flag:!0,beam_count:1,code_flag_upstem:"v54",code_flag_downstem:"v9a",stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"va5",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:1},s:{getWidth:()=>D.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},16:{common:{beam_count:2,getWidth(e=D.DEFAULT_NOTATION_FONT_SCALE){return new wt(this.code_head||"vb",e).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v3f",code_flag_downstem:"v8f",stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v3c",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:2},s:{getWidth:()=>D.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},32:{common:{beam_count:3,getWidth(e=D.DEFAULT_NOTATION_FONT_SCALE){return new wt(this.code_head||"vb",e).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v47",code_flag_downstem:"v2a",stem_up_extension:9,stem_down_extension:9,tabnote_stem_up_extension:8,tabnote_stem_down_extension:5,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v55",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:2},s:{getWidth:()=>D.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},64:{common:{beam_count:4,getWidth(e=D.DEFAULT_NOTATION_FONT_SCALE){return new wt(this.code_head||"vb",e).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"va9",code_flag_downstem:"v58",stem_up_extension:13,stem_down_extension:13,tabnote_stem_up_extension:12,tabnote_stem_down_extension:9,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v38",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:3},s:{getWidth:()=>D.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},128:{common:{beam_count:5,getWidth(e=D.DEFAULT_NOTATION_FONT_SCALE){return new wt(this.code_head||"vb",e).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v9b",code_flag_downstem:"v30",stem_up_extension:22,stem_down_extension:22,tabnote_stem_up_extension:21,tabnote_stem_down_extension:18,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"vaa",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:1.5,line_above:3,line_below:3},s:{getWidth:()=>D.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}}},D.smufl={},D.smufl.to_code_points={bracketTop:"v1b",bracketBottom:"v10",barlineTick:"v6f",segno:"v8c",coda:"v4d",gClef:"v83",cClef:"vad",fClef:"v79",unpitchedPercussionClef1:"v59","6stringTabClef":"v2f",timeSig0:"v0",timeSig1:"v1",timeSig2:"v2",timeSig3:"v3",timeSig4:"v4",timeSig5:"v5",timeSig6:"v6",timeSig7:"v7",timeSig8:"v8",timeSig9:"v9",timeSigCommon:"v41",timeSigCutCommon:"vb6",noteheadDoubleWhole:"v53",noteheadWhole:"v1d",noteheadHalf:"v81",noteheadBlack:"vb",noteheadXWhole:"v92",noteheadXHalf:"v95",noteheadXBlack:"v3e",noteheadCircleX:"v3b",noteheadTriangleUpWhole:"v49",noteheadTriangleUpHalf:"v93",noteheadTriangleUp
vendor: 4,597 bytes, line 5
5Black:"v40",noteheadDiamondWhole:"v46",noteheadDiamondHalf:"v2d",noteheadDiamondBlack:"v22",augmentationDot:"v23",tremolo1:"v74",flag8thUp:"v54",flag8thDown:"v9a",flag16thUp:"v3f",flag16thDown:"v8f",flag32ndUp:"v47",flag32ndDown:"v2a",flag64thUp:"va9",flag64thDown:"v58",flag128thUp:"v9b",flag128thDown:"v30",accidentalFlat:"v44",accidentalNatural:"v4e",accidentalSharp:"v18",accidentalDoubleSharp:"v7f",accidentalDoubleFlat:"v26",accidentalParensLeft:"v9c",accidentalParensRight:"v84",accidentalQuarterToneFlatStein:"vab",accidentalThreeQuarterTonesFlatZimmermann:"v9e",accidentalQuarterToneSharpStein:"v78",accidentalThreeQuarterTonesSharpStein:"v51",accidentalBuyukMucennebFlat:"v39",accidentalBakiyeFlat:"vb7",accidentalKomaSharp:"v51",accidentalKucukMucennebSharp:"v8d",accidentalKoron:"vd1",accidentalSori:"vd0",articAccentAbove:"v42",articAccentBelow:"v42",articTenutoAbove:"v25",articTenutoBelow:"v25",articStaccatoAbove:"v23",articStaccatoBelow:"v23",articStaccatissimoAbove:"v28",articMarcatoAbove:"va",fermataAbove:"v43",fermataBelow:"v5b",breathMarkComma:"v6c",breathMarkUpbow:"v8a",caesura:"v34",caesuraCurved:"v4b",restMaxima:"v59",restDoubleWhole:"v31",restWhole:"v5c",restHalf:"vc",restQuarter:"v7c",rest8th:"va5",rest16th:"v3c",rest32nd:"v55",rest64th:"v38",rest128th:"vaa",dynamicPiano:"vbf",dynamicMezzo:"v62",dynamicForte:"vba",dynamicRinforzando:"vba",dynamicSforzando:"v4a",dynamicZ:"v80",ornamentTrill:"v1f",ornamentTurn:"v72",ornamentTurnSlash:"v33",ornamentMordent:"v45",ornamentMordentInverted:"v1e",ornamentTremblement:"v86",ornamentPrecompAppoggTrill:"v20",ornamentPrecompSlideTrillDAnglebert:"v60",ornamentPrecompSlideTrillBach:"v29",ornamentPrecompTrillSuffixDandrieu:"v6d",ornamentPrecompDoubleCadenceUpperPrefix:"vb4",ornamentPrecompDoubleCadenceUpperPrefixTurn:"v68",ornamentPrecompTrillLowerSuffix:"v2c",stringsDownBow:"v94",stringsUpBow:"v75",stringsHarmonic:"vb9",pluckedSnapPizzicatoAbove:"v94",pluckedLeftHandPizzicato:"v8b",keyboardPedalPed:"v36",keyboardPedalUp:"v5d",pictChokeCymbal:"vb3",wiggleArpeggiatoUp:"va3",arrowheadBlackUp:"vc3",arrowheadBlackDown:"v52"},D.TIME4_4={num_beats:4,beat_value:4,resolution:D.RESOLUTION};var Br=class Qr{static get WIDTH(){return 600}static get HEIGHT(){return 400}static get CANVAS_BROWSER_SIZE_LIMIT(){return 32767}static SanitizeCanvasDims(t,i){return Math.max(t,i)>this.CANVAS_BROWSER_SIZE_LIMIT&&(w.W("Canvas dimensions exceed browser limit. Cropping to "+this.CANVAS_BROWSER_SIZE_LIMIT),t>this.CANVAS_BROWSER_SIZE_LIMIT&&(t=this.CANVAS_BROWSER_SIZE_LIMIT),i>this.CANVAS_BROWSER_SIZE_LIMIT&&(i=this.CANVAS_BROWSER_SIZE_LIMIT)),[t,i]}constructor(t){this.vexFlowCanvasContext=t,t.canvas?this.canvas=t.canvas:this.canvas={width:Qr.WIDTH,height:Qr.HEIGHT}}clear(){this.vexFlowCanvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}openGroup(){}closeGroup(){}add(){}setFont(t,i,s){return this.vexFlowCanvasContext.font=(s||"")+" "+i+"pt "+t,this}setRawFont(t){return this.vexFlowCanvasContext.font=t,this}setFillStyle(t){return this.vexFlowCanvasContext.fillStyle=t,this}setBackgroundFillStyle(t){return this.background_fillStyle=t,this}setStrokeStyle(t){return this.vexFlowCanvasContext.strokeStyle=t,this}setShadowColor(t){return this.vexFlowCanvasContext.shadowColor=t,this}setShadowBlur(t){return this.vexFlowCanvasContext.shadowBlur=t,this}setLineWidth(t){return this.vexFlowCanvasContext.lineWidth=t,this}setLineCap(t){return this.vexFlowCanvasContext.lineCap=t,this}setLineDash(t){return this.vexFlowCanvasContext.lineDash=t,this}scale(t,i){return this.vexFlowCanvasContext.scale(parseFloat(t),parseFloat(i))}resize(t,i){return[t,i]=this.SanitizeCanvasDims(parseInt(t,10),parseInt(i,10)),this.vexFlowCanvasContext.resize(t,i)}rect(t,i,s,r){return this.vexFlowCanvasContext.rect(t,i,s,r)}fillRect(t,i,s,r){return this.vexFlowCanvasContext.fillRect(t,i,s,r)}clearRect(t,i,s,r){return this.vexFlowCanvasContext.clearRect(t,i,s,r)}beginPath(){return this.vexFlowCanvasContext.beginPath()}moveTo(t,i){return this.vexFlowCanvasContext.moveTo(t,i)}lineTo(t,i){return this.vexFlowCanvasContext.lineTo(t,i)}bezierCurveTo(t,i,s,r,n,a){return this.vexFlowCanvasContext.bezierCurveTo(t,i,s,r,n,a)}quadraticCurveTo(t,i,s,r){return this.vexFlowCanvasContext.quadraticCurveTo(t,i,s,r)}arc(t,i,s,r,n,a){return this.vexFlowCanvasContext.arc(t,i,s,r,n,a)}glow(){return this.vexFlowCanvasContext.glow()}fill(){return this.vexFlowCanvasContext.fill()}stroke(){return this.vexFlowCanvasContext.stroke()}closePath(){return this.vexFlowCanvasContext.closePath()}measureText(t){return this.vexFlowCanvasContext.measureText(t)}
5fillText(t,i,s){return this.vexFlowCanvasContext.fillText(t,i,s)}save(){return this.vexFlowCanvasContext.save()}restore(){return this.vexFlowCanvasContext.restore()}},Ph=class{constructor(e){this.element=e,this.paper=Raphael(e),this.path="",this.pen={x:0,y:0},this.lineWidth=1,this.state={scale:{x:1,y:1},font_family:"Arial",font_size:8,font_weight:800},this.attributes={"stroke-width":.3,fill:"black",stroke:"black",font:"10pt Arial"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white",font:"10pt Arial"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[]}openGroup(){}closeGroup(){}add(){}setFont(e,t,i){return this.state.font_family=e,this.state.font_size=t,this.state.font_weight=i,this.attributes.font=(this.state.font_weight||"")+" "+this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}setRawFont(e){return this.attributes.font=e,this}setFillStyle(e){return this.attributes.fill=e,this}setBackgroundFillStyle(e){return this.background_attributes.fill=e,this.background_attributes.stroke=e,this}setStrokeStyle(e){return this.attributes.stroke=e,this}setShadowColor(e){return this.shadow_attributes.color=e,this}setShadowBlur(e){return this.shadow_attributes.width=e,this}setLineWidth(e){this.attributes["stroke-width"]=e,this.lineWidth=e}setLineDash(){return this}setLineCap(){return this}scale(e,t){return this.state.scale={x:e,y:t},this.attributes.transform="S"+e+","+t+",0,0",this.attributes.scale=e+","+t+",0,0",this.attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this.background_attributes.transform="S"+e+","+t+",0,0",this.background_attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}clear(){this.paper.clear()}resize(e,t){return this.element.style.width=e,this.paper.setSize(e,t),this}setViewBox(e){this.paper.canvas.setAttribute("viewBox",e)}rect(e,t,i,s){return s<0&&(t+=s,s=-s),this.paper.rect(e,t,i-.5,s-.5).attr(this.attributes).attr("fill","none").attr("stroke-width",this.lineWidth),this}fillRect(e,t,i,s){return s<0&&(t+=s,s=-s),this.paper.rect(e,t,i-.5,s-.5).attr(this.attributes),this}clearRect(e,t,i,s){return s<0&&(t+=s,s=-s),this.paper.rect(e,t,i-.5,s-.5).attr(this.background_attributes),this}beginPath(){return this.path="",this.pen.x=0,this.pen.y=0,this}moveTo(e,t){return this.path+="M"+e+","+t,this.pen.x=e,this.pen.y=t,this}lineTo(e,t){return this.path+="L"+e+","+t,this.pen.x=e,this.pen.y=t,this}bezierCurveTo(e,t,i,s,r,n){return this.path+="C"+e+","+t+","+i+","+s+","+r+","+n,this.pen.x=r,this.pen.y=n,this}quadraticCurveTo(e,t,i,s){return this.path+="Q"+e+","+t+","+i+","+s,this.pen.x=i,this.pen.y=s,this}arc(e,t,i,s,r,n){function a(l){for(;l<0;)l+=Math.PI*2;for(;l>Math.PI*2;)l-=Math.PI*2;return l}if(s=a(s),r=a(r),s>r){let l=s;s=r,r=l,n=!n}let o=r-s;return o>Math.PI?(this.arcHelper(e,t,i,s,s+o/2,n),this.arcHelper(e,t,i,s+o/2,r,n)):this.arcHelper(e,t,i,s,r,n),this}arcHelper(e,t,i,s,r,n){let a=e+i*Math.cos(s),o=t+i*Math.sin(s),l=e+i*Math.cos(r),h=t+i*Math.sin(r),u=0,c=0;n?(c=1,r-s<Math.PI&&(u=1)):r-s>Math.PI&&(u=1),this.path+="M"+a+","+o+",A"+i+","+i+",0,"+u+","+c+","+l+","+h+"M"+this.pen.x+","+this.pen.y}glow(){let e=this.paper.set();if(this.shadow_attributes.width>0){let t=this.shadow_attributes,i=t.width/2;for(let s=1;s<=i;s++)e.push(this.paper.path(this.path).attr({stroke:t.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(t.width/i*s).toFixed(3),opacity:+((t.opacity||.3)/i).toFixed(3),transform:this.attributes.transform,scale:this.attributes.scale}))}return e}fill(){let e=this.paper.path(this.path).attr(this.attributes).attr("stroke-width",0);return this.glow(e),this}stroke(){let e=this.lineWidth*(this.state.scale.x+this.state.scale.y)/2,t=this.paper.path(this.path).attr(this.attributes).attr("fill","none").attr("stroke-width",e);return this.glow(t),this}closePath(){return this.path+="Z",this}measureText(e){let t=this.paper.text(0,0,e).attr(this.attributes).attr("fill","none").attr("stroke","none"),i=t.getBBox();return t.remove(),{width:i.width,height:i.height}}fillText(e,t,i){return this.paper.text(t+this.measureText(e).width/2,i-this.state.font_size/(2.25*this.state.scale.y),e).attr(this.attributes),this}save(){return this.state_stack.push({state:{font_family:this.state.font_family},attributes:{font:this.attributes.font,fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color}}),this}restore(){let e=this.state_stack.pop();return this.state.font_family=e.state.font_family,this.attributes.font=e.attributes.font,this.attributes.fill=e.attributes.fill,this.attributes.stroke=e.attributes.stroke,this.attributes["stroke-width"]=e.attributes["stroke-width"],this.shadow_attributes.width=e.shadow_attributes.width,this.shadow_attributes.color=e.shadow_attributes.color,this}},tn={path:{x:!0,y:!0,width:!0,height:!0},rect:{},text:{width:!0,height:!0}};{let e={"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0};w.Merge(tn.rect,e),w.Merge(tn.path,e)}var Lh=class{constructor(e){this.element=e,this.svgNS="http://www.w3.org/2000/svg";let t=this.create("svg");this.element.appendChild(t),this.svg=t,this.groups=[this.svg],this.parent=this.svg,this.path="",this.pen={x:NaN,y:NaN},this.lineWidth=1,this.state={scale:{x:1,y:1},"font-family":"Arial","font-size":"8pt","font-weight":"normal"},this.attributes={"stroke-width":.3,fill:"black",stroke:"black","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[],this.iePolyfill()}create(e){return document.createElementNS(this.svgNS,e)}openGroup(e,t,i){let s=this.create("g");return this.groups.push(s),this.parent.appendChild(s),this.parent=s,e&&s.setAttribute("class",w.Prefix(e)),t&&s.setAttribute("id",w.Prefix(t)),i&&i.pointerBBox&&s.setAttribute("pointer-events","boun
5ding-box"),s}closeGroup(){this.groups.pop(),this.parent=this.groups[this.groups.length-1]}add(e){this.parent.appendChild(e)}iePolyfill(){typeof navigator<"u"&&(this.ie=/MSIE 9/i.test(navigator.userAgent)||/MSIE 10/i.test(navigator.userAgent)||/rv:11\.0/i.test(navigator.userAgent)||/Trident/i.test(navigator.userAgent))}setFont(e,t,i){let s=!1,r=!1,n="normal";typeof i=="string"&&(i.indexOf("italic")!==-1&&(i=i.replace(/italic/g,""),r=!0),i.indexOf("bold")!==-1&&(i=i.replace(/bold/g,""),s=!0),i=i.replace(/ /g,"")),i=s?"bold":i,i=i===void 0||i===""?"normal":i,n=r?"italic":n;let a={"font-family":e,"font-size":t+"pt","font-weight":i,"font-style":n};return this.fontSize=Number(t),w.Merge(this.attributes,a),w.Merge(this.state,a),this}setRawFont(e){e=e.trim();let t=e.split(" ");return this.attributes["font-family"]=t[1],this.state["font-family"]=t[1],this.attributes["font-size"]=t[0],this.state["font-size"]=t[0],this.fontSize=Number(t[0].match(/\d+/)),this}setFillStyle(e){return this.attributes.fill=e,this}setBackgroundFillStyle(e){return this.background_attributes.fill=e,this.background_attributes.stroke=e,this}setStrokeStyle(e){return this.attributes.stroke=e,this}setShadowColor(e){return this.shadow_attributes.color=e,this}setShadowBlur(e){return this.shadow_attributes.width=e,this}setLineWidth(e){this.attributes["stroke-width"]=e,this.lineWidth=e}setLineDash(e){if(Object.prototype.toString.call(e)==="[object Array]")return e=e.join(", "),this.attributes["stroke-dasharray"]=e,this;throw new w.RERR("ArgumentError","lineDash must be an array of integers.")}setLineCap(e){return this.attributes["stroke-linecap"]=e,this}resize(e,t){this.width=e,this.height=t,this.element.style.width=e;let i={width:e,height:t};return this.applyAttributes(this.svg,i),this.scale(this.state.scale.x,this.state.scale.y),this}scale(e,t){this.state.scale={x:e,y:t};let i=this.width/e,s=this.height/t;return this.setViewBox(0,0,i,s),this}setViewBox(...e){if(e.length===1){let[t]=e;this.svg.setAttribute("viewBox",t)}else{let[t,i,s,r]=e,n=t+" "+i+" "+s+" "+r;this.svg.setAttribute("viewBox",n)}}applyAttributes(e,t){let i=tn[e.nodeName];return Object.keys(t).forEach(s=>{i&&i[s]||e.setAttributeNS(null,s,t[s])}),e}clear(){for(;this.svg.lastChild;)this.svg.removeChild(this.svg.lastChild);this.scale(this.state.scale.x,this.state.scale.y)}rect(e,t,i,s,r){s<0&&(t+=s,s*=-1);let n=this.create("rect");return r===void 0&&(r={fill:"none","stroke-width":this.lineWidth,stroke:"black"}),w.Merge(r,{x:e,y:t,width:i,height:s}),this.applyAttributes(n,r),this.add(n),this}fillRect(e,t,i,s){return s<0&&(t+=s,s*=-1),this.rect(e,t,i,s,this.attributes),this}clearRect(e,t,i,s){return this.rect(e,t,i,s,this.background_attributes),this}beginPath(){return this.path="",this.pen.x=NaN,this.pen.y=NaN,this}moveTo(e,t){return this.path+="M"+e+" "+t,this.pen.x=e,this.pen.y=t,this}lineTo(e,t){return this.path+="L"+e+" "+t,this.pen.x=e,this.pen.y=t,this}bezierCurveTo(e,t,i,s,r,n){return this.path+="C"+e+" "+t+","+i+" "+s+","+r+" "+n,this.pen.x=r,this.pen.y=n,this}quadraticCurveTo(e,t,i,s){return this.path+="Q"+e+" "+t+","+i+" "+s,this.pen.x=i,this.pen.y=s,this}arc(e,t,i,s,r,n){function a(l){for(;l<0;)l+=Math.PI*2;for(;l>Math.PI*2;)l-=Math.PI*2;return l}if(s=a(s),r=a(r),s>r){let l=s;s=r,r=l,n=!n}let o=r-s;return o>Math.PI?(this.arcHelper(e,t,i,s,s+o/2,n),this.arcHelper(e,t,i,s+o/2,r,n)):this.arcHelper(e,t,i,s,r,n),this}arcHelper(e,t,i,s,r,n){let a=e+i*Math.cos(s),o=t+i*Math.sin(s),l=e+i*Math.cos(r),h=t+i*Math.sin(r),u=0,c=0;n?(c=1,r-s<Math.PI&&(u=1)):r-s>Math.PI&&(u=1),this.path+="M"+a+" "+o+" A"+i+" "+i+" 0 "+u+" "+c+" "+l+" "+h,!isNaN(this.pen.x)&&!isNaN(this.pen.y)&&(this.peth+="M"+this.pen.x+" "+this.pen.y)}closePath(){return this.path+="Z",this}glow(){if(this.shadow_attributes.width>0){let e=this.shadow_attributes,t=e.width/2;for(let i=1;i<=t;i++){let s={stroke:e.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(e.width*.4/t*i).toFixed(3),opacity:+((e.opacity||.3)/t).toFixed(3)},r=this.create("path");s.d=this.path,this.applyAttributes(r,s),this.add(r)}}return this}fill(e){this.glow();let t=this.create("path");return e===void 0&&(e={},w.Merge(e,this.attributes),e.stroke="none"),e.d=this.path,this.applyAttributes(t,e),this.add(t),this}stroke(){this.glow();let e=this.create("path"),t={};return w.Merge(t,this.attributes),t.fill="none",t["stroke-width"]=this.lineWidth,t.d=this.path,this.applyAttributes(e,t),this.add(e),this}measureText(e){let t=this.create("text");if(typeof t.getBBox!="function")return{x:0,y:0,width:0,height:0};t.textContent=e,this.applyAttributes(t,this.attributes),this.svg.appendChild(t);let i=t.getBBox();return this.ie&&e!==""&&this.attributes["font-style"]==="italic"&&(i=this.ieMeasureTextFix(i,e)),this.svg.removeChild(t),i}ieMeasureTextFix(e){let t=1.196*Number(this.fontSize)+1.9598,i=e.width-t,s=e.height-1.5;return{x:e.x,y:e.y,width:i,height:s}}fillText(e,t,i){if(!e||e.length<=0)return;let s={};w.Merge(s,this.attributes),s.stroke="none",s.x=t,s.y=i;let r=this.create("text");r.textContent=e,this.applyAttributes(r,s),this.add(r)}save(){return this.state_stack.push({state:{"font-family":this.state["font-family"],"font-weight":this.state["font-weight"],"font-style":this.state["font-style"],"font-size":this.state["font-size"],scale:this.state.scale},attributes:{"font-family":this.attributes["font-family"],"font-weight":this.attributes["font-weight"],"font-style":this.attributes["font-style"],"font-size":this.attributes["font-size"],fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"],"stroke-dasharray":this.attributes["stroke-dasharray"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color},lineWidth:this.lineWidth}),this}restore(){let e=this.state_stack.pop();return this.state["font-family"]=e.state["font-family"],this.state["font-weight"]=e.state["font-weight"],this.state["font-style"]=e.state["font-style"],this.state["font-size"]=e.state["font-size"],this.state.scale=e.state.scale,this.attributes["font-family"]=e.attributes["font-family"],this.attributes["font-weight"]=e.attributes["font-weight"],this.attributes["font-style"]=e.attributes["font-style"],this.attributes["font-size"]=e.attributes["font-size"],this.attributes.fill=e.attributes.fill,this.attributes.stroke=e.attributes.stroke,this.attributes["stroke-width"]=e.attributes["stroke-width"],this.attributes["stroke-dasharray"]=e.attributes["stroke-dasharray"],this.shadow_attributes.width=e.shadow_attributes.width,this.shadow_attributes.color=e.shadow_attributes.color,this.lineWidth=e.lineWidth,this}},wa=null,ke=class we{static get Backends(){return{CANVAS:1,RAPHAEL:2,SVG:3,VML:4}}static get LineEndType(){return{NONE:1,UP:2,DOWN:3}}static get USE_CANVAS_PROXY(){return!1}static get lastContext(){return wa}static set lastContext(t){wa=t}static buildContext(t,i,s,r,n){let a=new we(t,i);s&&r&&a.resize(s,r),n||(n="#FFF");let o=a.getContext();
5return o.setBackgroundFillStyle(n),we.lastContext=o,o}static getCanvasContext(t,i,s,r){return we.buildContext(t,we.Backends.CANVAS,i,s,r)}static getRaphaelContext(t,i,s,r){return we.buildContext(t,we.Backends.RAPHAEL,i,s,r)}static getSVGContext(t,i,s,r){return we.buildContext(t,we.Backends.SVG,i,s,r)}static bolsterCanvasContext(t){return we.USE_CANVAS_PROXY?new Br(t):(t.vexFlowCanvasContext=t,["clear","setFont","setRawFont","setFillStyle","setBackgroundFillStyle","setStrokeStyle","setShadowColor","setShadowBlur","setLineWidth","setLineCap","setLineDash","openGroup","closeGroup","getGroup"].forEach(i=>{t[i]=t[i]||Br.prototype[i]}),t)}static drawDashedLine(t,i,s,r,n,a){t.beginPath();let o=r-i,l=n-s,h=Math.atan2(l,o),u=i,c=s;t.moveTo(i,s);let d=0,f=!0;for(;!((o<0?u<=r:u>=r)&&(l<0?c<=n:c>=n));){let p=a[d++%a.length],m=u+Math.cos(h)*p;u=o<0?Math.max(r,m):Math.min(r,m);let g=c+Math.sin(h)*p;c=l<0?Math.max(n,g):Math.min(n,g),f?t.lineTo(u,c):t.moveTo(u,c),f=!f}t.closePath(),t.stroke()}constructor(t,i){if(this.elementId=t,!this.elementId)throw new w.RERR("BadArgument","Invalid id for renderer.");if(this.element=document.getElementById(t),this.element||(this.element=t),this.ctx=null,this.paper=null,this.backend=i,this.backend===we.Backends.CANVAS){if(!this.element.getContext)throw new w.RERR("BadElement",`Can't get canvas context from element: ${t}`);this.ctx=we.bolsterCanvasContext(this.element.getContext("2d"))}else if(this.backend===we.Backends.RAPHAEL)this.ctx=new Ph(this.element);else if(this.backend===we.Backends.SVG)this.ctx=new Lh(this.element);
5else throw new w.RERR("InvalidBackend",`No support for backend: ${this.backend}`)}resize(t,i){if(this.backend===we.Backends.CANVAS){if(!this.element.getContext)throw new w.RERR("BadElement",`Can't get canvas context from element: ${this.elementId}`);[t,i]=Br.SanitizeCanvasDims(t,i);let s=window.devicePixelRatio||1;this.element.width=t*s,this.element.height=i*s,this.element.style.width=t+"px",this.element.style.height=i+"px",this.ctx=we.bolsterCanvasContext(this.element.getContext("2d")),this.ctx.scale(s,s)}else this.ctx.resize(t,i);return this}getContext(){return this.ctx}};function _h(...e){gt.DEBUG&&w.L("Vex.Flow.Stem",e)}var gt=class xi extends fe{static get CATEGORY(){return"stem"}static get UP(){return 1}static get DOWN(){return-1}static get WIDTH(){return D.STEM_WIDTH}static get HEIGHT(){return D.STEM_HEIGHT}constructor(t={}){super(),this.setAttribute("type","Stem"),this.x_begin=t.x_begin||0,this.x_end=t.x_end||0,this.y_top=t.y_top||0,this.y_bottom=t.y_bottom||0,this.stem_extension=t.stem_extension||0,this.stem_direction=t.stem_direction||0,this.hide=t.hide||!1,this.isStemlet=t.isStemlet||!1,this.stemletHeight=t.stemletHeight||0,this.renderHeightAdjustment=0,this.setOptions(t)}setOptions(t){this.stem_up_y_offset=t.stem_up_y_offset||0,this.stem_down_y_offset=t.stem_down_y_offset||0}setNoteHeadXBounds(t,i){return this.x_begin=t,this.x_end=i,this}setDirection(t){this.stem_direction=t}setExtension(t){this.stem_extension=t}getExtension(){return this.stem_extension}setYBounds(t,i){this.y_top=t,this.y_bottom=i}getCategory(){return xi.CATEGORY}getHeight(){let t=this.stem_direction===xi.UP?this.stem_up_y_offset:this.stem_down_y_offset;return(this.y_bottom-this.y_top)*this.stem_direction+(xi.HEIGHT-t+this.stem_extension)*this.stem_direction}getBoundingBox(){throw new w.RERR("NotImplemented","getBoundingBox() not implemented.")}getExtents(){let t=this.stem_direction===xi.UP,i=[this.y_top,this.y_bottom],s=xi.HEIGHT+this.stem_extension,r=(t?Math.min:Math.max)(...i),n=(t?Math.max:Math.min)(...i);return{topY:r+s*-this.stem_direction,baseY:n}}setVisibility(t){return this.hide=!t,this}setStemlet(t,i){return this.isStemlet=t,this.stemletHeight=i,this}draw(){if(this.setRendered(),this.hide)return;let t=this.checkContext(),i,s,r=this.stem_direction;r===xi.DOWN?(i=this.x_begin,s=this.y_top+this.stem_down_y_offset):(i=this.x_end,s=this.y_bottom-this.stem_up_y_offset);let n=this.getHeight();_h("Rendering stem - ","Top Y: ",this.y_top,"Bottom Y: ",this.y_bottom);let a=this.isStemlet?n-this.stemletHeight*this.stem_direction:0;t.save(),this.applyStyle(t),t.beginPath(),t.setLineWidth(xi.WIDTH),t.moveTo(i,s-a),t.lineTo(i,s-n-this.renderHeightAdjustment*r),t.stroke(),this.restoreStyle(t),t.restore()}},lr=class ui extends fe{static get LOCATION_TOP(){return 1}static get LOCATION_BOTTOM(){return-1}static get NESTING_OFFSET(){return 15}constructor(t,i){if(super(),this.setAttribute("type","Tuplet"),!t||!t.length)throw new w.RuntimeError("BadArguments","No notes provided for tuplet.");this.options=w.Merge({},i),this.notes=t,this.num_notes="num_notes"in this.options?this.options.num_notes:t.length,this.options.beats_occupied&&this.beatsOccupiedDeprecationWarning(),this.notes_occupied=this.options.notes_occupied||this.options.beats_occupied||2,"bracketed"in this.options?this.bracketed=this.options.bracketed:this.bracketed=t.some(s=>s.beam===null),this.ratioed="ratioed"in this.options?this.options.ratioed:Math.abs(this.notes_occupied-this.num_notes)>1,this.point=28,this.y_pos=16,this.x_pos=100,this.width=200,this.location=this.options.location||ui.LOCATION_TOP,Ti.AlignRestsToNotes(t,!0,!0),this.resolveGlyphs(),this.attach()}attach(){for(let t=0;t<this.notes.length;t++)this.notes[t].setTuplet(this)}detach(){for(let t=0;t<this.notes.length;t++)this.notes[t].resetTuplet(this)}setBracketed(t){return this.bracketed=!!t,this}setRatioed(t){return this.ratioed=!!t,this}setTupletLocation(t){if(!t)t=ui.LOCATION_TOP;else if(t!==ui.LOCATION_TOP&&t!==ui.LOCATION_BOTTOM)throw new w.RERR("BadArgument","Invalid tuplet location: "+t);return this.location=t,this}getNotes(){return this.notes}getNoteCount(){return this.num_notes}beatsOccupiedDeprecationWarning(){let t=["beats_occupied has been deprecated as an ","option for tuplets. Please use notes_occupied ","instead. Calls to getBeatsOccupied and ","setBeatsOccupied should now be routed to ","getNotesOccupied and setNotesOccupied instead"].join("");console&&console.warn?console.warn(t):console&&console.log(t)}getBeatsOccupied(){return this.beatsOccupiedDeprecationWarning(),this.getNotesOccupied()}setBeatsOccupied(t){return this.beatsOccupiedDeprecationWarning(),this.setNotesOccupied(t)}getNotesOccupied(){return this.notes_occupied}setNotesOccupied(t){this.detach(),this.notes_occupied=t,this.resolveGlyphs(),this.attach()}resolveGlyphs(){this.numerator_glyphs=[];let t=this.num_notes;for(;t>=1;)this.numerator_glyphs.unshift(new wt("v"+t%10,this.point)),t=parseInt(t/10,10);for(this.denom_glyphs=[],t=this.notes_occupied;t>=1;)this.denom_glyphs.unshift(new wt("v"+t%10,this.point)),t=parseInt(t/10,10)}getNestedTupletCount(){let t=this.location,i=this.notes[0],s=n(i,t),r=n(i,t);function n(a,o){return a.tupletStack.filter(l=>l.location===o).length}
5return this.notes.forEach(a=>{let o=n(a,t);s=o>s?o:s,r=o<r?o:r}),s-r}getYPosition(){let t=this.getNestedTupletCount()*ui.NESTING_OFFSET*-this.location,i=this.options.y_offset||0,s=this.notes[0],r;if(this.location===ui.LOCATION_TOP){r=s.getStave().getYForLine(0)-15;for(let n=0;n<this.notes.length;++n){let a=this.notes[n].getStemDirection()===gt.UP?this.notes[n].getStemExtents().topY-10:this.notes[n].getStemExtents().baseY-20;a<r&&(r=a)}}else{r=s.getStave().getYForLine(4)+20;for(let n=0;n<this.notes.length;++n){let a=this.notes[n].getStemDirection()===gt.UP?this.notes[n].getStemExtents().baseY+20:this.notes[n].getStemExtents().topY+10;a>r&&(r=a)}}return r+t+i}draw(){this.checkContext(),this.setRendered();let t=this.notes[0],i=this.notes[this.notes.length-1];this.bracketed?(this.x_pos=t.getTieLeftX()-5,this.width=i.getTieRightX()-this.x_pos+5):(this.x_pos=t.getStemX(),this.width=i.getStemX()-this.x_pos),this.y_pos=this.getYPosition();let s=(o,l)=>o+l.getMetrics().width,r=this.numerator_glyphs.reduce(s,0);this.ratioed&&(r=this.denom_glyphs.reduce(s,r),r+=this.point*.32);let n=this.x_pos+this.width/2-r/2;if(this.bracketed){let o=this.width/2-r/2-5;o>0&&(this.context.fillRect(this.x_pos,this.y_pos,o,1),this.context.fillRect(this.x_pos+this.width/2+r/2+5,this.y_pos,o,1),this.context.fillRect(this.x_pos,this.y_pos+(this.location===ui.LOCATION_BOTTOM),1,this.location*10),this.context.fillRect(this.x_pos+this.width,this.y_pos+(this.location===ui.LOCATION_BOTTOM),1,this.location*10))}let a=0;if(this.numerator_glyphs.forEach(o=>{o.render(this.context,n+a,this.y_pos+this.point/3-2),a+=o.getMetrics().width}),this.ratioed){let o=n+a+this.point*.16,l=this.point*.06;this.context.beginPath(),this.context.arc(o,this.y_pos-this.point*.08,l,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),this.context.beginPath(),this.context.arc(o,this.y_pos+this.point*.12,l,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),a+=this.point*.32,this.denom_glyphs.forEach(h=>{h.render(this.context,n+a,this.y_pos+this.point/3-2),a+=h.getMetrics().width})}}};function Ta(e){let t=0;return e.forEach(i=>{i.keyProps&&i.keyProps.forEach(s=>{t+=s.line-3})}),t>=0?gt.DOWN:gt.UP}var Ah=(e,t)=>{let i=e.getStemExtents().topY,s=e.getStemX(),r=t.getStemExtents().topY,n=t.getStemX();return(r-i)/(n-s)},kr="L",Rh="R",Pa="B",vs=class en extends fe{static getDefaultBeamGroups(t){(!t||t==="c")&&(t="4/4");let i={"1/2":["1/2"],"2/2":["1/2"],"3/2":["1/2"],"4/2":["1/2"],"1/4":["1/4"],"2/4":["1/4"],"3/4":["1/4"],"4/4":["1/4"],"1/8":["1/8"],"2/8":["2/8"],"3/8":["3/8"],"4/8":["2/8"],"1/16":["1/16"],"2/16":["2/16"],"3/16":["3/16"],"4/16":["2/16"]}[t];if(i===void 0){let s=parseInt(t.split("/")[0],10),r=parseInt(t.split("/")[1],10);if(s%3==0)return[new ie(3,r)];if(r>4)return[new ie(2,r)];if(r<=4)return[new ie(1,r)]}else return i.map(s=>new ie().parse(s));return[new ie(1,4)]}static applyAndGetBeams(t,i,s){return en.generateBeams(t.getTickables(),{groups:s,stem_direction:i})}static generateBeams(t,i){i||(i={}),(!i.groups||!i.groups.length)&&(i.groups=[new ie(2,8)]);let s=i.groups.map(y=>{if(!y.multiply)throw new w.RuntimeError("InvalidBeamGroups","The beam groups must be an array of Vex.Flow.Fractions");return y.clone().multiply(D.RESOLUTION,1)}),r=t,n=0,a=[],o=[];function l(y){return y.reduce((M,P)=>P.getTicks().clone().add(M),new ie(0,1))}function h(){s.length-1>n?n+=1:n=0}function u(){let y=[];r.forEach(M=>{if(y=[],M.shouldIgnoreTicks()){a.push(o),o=y;return}o.push(M);
5let P=s[n].clone(),L=l(o),B=D.durationToNumber(M.duration)<8;B&&M.tuplet&&(P.numerator*=2),L.greaterThan(P)?(B||y.push(o.pop()),a.push(o),o=y,h()):L.equals(P)&&(a.push(o),o=y,h())}),o.length>0&&a.push(o)}function c(){return a.filter(y=>{if(y.length>1){let M=!0;return y.forEach(P=>{P.getIntrinsicTicks()>=D.durationToTicks("4")&&(M=!1)}),M}return!1})}function d(){let y=[];a.forEach(M=>{let P=[];M.forEach((L,B,A)=>{let G=B===0||B===A.length-1,H=A[B-1],T=!i.beam_rests&&L.isRest(),I=i.beam_rests&&i.beam_middle_only&&L.isRest()&&G,v=!1;if(i.maintain_stem_directions&&H&&!L.isRest()&&!H.isRest()){let dt=H.getStemDirection();v=L.getStemDirection()!==dt}let U=parseInt(L.duration,10)<8;T||I||v||U?(P.length>0&&y.push(P),P=v?[L]:[]):P.push(L)}),P.length>0&&y.push(P)}),a=y}function f(){a.forEach(y=>{let M;if(i.maintain_stem_directions){let P=p(y);M=P?P.getStemDirection():gt.UP}else M=i.stem_direction?i.stem_direction:Ta(y);m(y,M)})}function p(y){for(let M=0;M<y.length;M++){let P=y[M];if(!P.isRest())return P}return!1}function m(y,M){y.forEach(P=>{P.setStemDirection(M)})}function g(){let y=[];return a.forEach(M=>{let P=null;M.forEach(L=>{L.tuplet&&P!==L.tuplet&&(P=L.tuplet,y.push(P))})}),y}u(),d(),f();let b=c(),S=g(),E=[];return b.forEach(y=>{let M=new en(y);i.show_stemlets&&(M.render_options.show_stemlets=!0),i.secondary_breaks&&(M.render_options.secondary_break_ticks=D.durationToTicks(i.secondary_breaks)),i.flat_beams===!0&&(M.render_options.flat_beams=!0,M.render_options.flat_beam_offset=i.flat_beam_offset),E.push(M)}),S.forEach(y=>{let M=y.notes[0].stem_direction===gt.DOWN?lr.LOCATION_BOTTOM:lr.LOCATION_TOP;y.setTupletLocation(M);let P=!1;for(let L=0;L<y.notes.length;L++)if(y.notes[L].beam===null){P=!0;break}y.setBracketed(P)}),E}constructor(t,i){if(super(),this.setAttribute("type","Beam"),!t||t===[])throw new w.RuntimeError("BadArguments","No notes provided for beam.");if(t.length===1)throw new w.RuntimeError("BadArguments","Too few notes for beam.");if(this.ticks=t[0].getIntrinsicTicks(),this.ticks>=D.durationToTicks("4"))throw new w.RuntimeError("BadArguments","Beams can only be applied to notes shorter than a quarter note.");let s,r;for(this.stem_direction=gt.UP,s=0;s<t.length;++s)if(r=t[s],r.hasStem()){this.stem_direction=r.getStemDirection();break}let n=this.stem_direction;for(i&&t[0].getCategory()==="stavenotes"?n=Ta(t):i&&t[0].getCategory()==="tabnotes"&&(n=t.reduce((a,o)=>a+o.stem_direction,0)>-1?gt.UP:gt.DOWN),s=0;s<t.length;++s)r=t[s],i&&(r.setStemDirection(n),this.stem_direction=n),r.setBeam(this);this.postFormatted=!1,this.notes=t,this.beam_count=this.getBeamCount(),this.break_on_indices=[],this.render_options={beam_width:5,max_slope:.25,min_slope:-.25,slope_iterations:20,slope_cost:100,show_stemlets:!1,stemlet_extension:7,partial_beam_length:10,flat_beams:!1,min_flat_beam_offset:15}}getNotes(){return this.notes}getBeamCount(){return this.notes.map(t=>t.getGlyph().beam_count).reduce((t,i)=>i>t?i:t)}breakSecondaryAt(t){return this.break_on_indices=t,this}getSlopeY(t,i,s,r){return s+(t-i)*r}calculateSlope(){let{notes:t,stem_direction:i,render_options:{max_slope:s,min_slope:r,slope_iterations:n,slope_cost:a}}=this,o=t[0],l=Ah(o,t[t.length-1]),h=(s-r)/n,u=Number.MAX_VALUE,c=0,d=0;for(let f=r;f<=s;f+=h){let p=0,m=0;for(let S=1;S<t.length;++S){let E=t[S],y=this.getSlopeY(E.getStemX(),o.getStemX(),o.getStemExtents().topY,f)+m,M=E.getStemExtents().topY;if(M*i<y*i){let P=Math.abs(M-y);m+=P*-i,p+=P*S}else p+=(M-y)*i}let g=l/2,b=a*Math.abs(g-f)+Math.abs(p);b<u&&(u=b,c=f,d=m)}this.slope=c,this.y_shift=d}calculateFlatSlope(){let{notes:t,stem_direction:i,render_options:{beam_width:s,min_flat_beam_offset:r,flat_beam_offset:n}}=this,a=0,o=0,l=0,h=0;for(let p=0;p<t.length;p++){let m=t[p],g=m.getStemExtents().topY;a+=g,i===gt.DOWN&&h<g?(h=g,o=Math.max(...m.getYs()),l=m.getBeamCount()):i===gt.UP&&(h===0||h>g)&&(h=g,o=Math.min(...m.getYs()),l=m.getBeamCount())}let u=a/t.length,c=s*1.5,d=r+l*c,f=o+d*-i;i===gt.DOWN&&u<f?u=o+d:i===gt.UP&&u>f&&(u=o-d),n?(i===gt.DOWN&&u>n||i===gt.UP&&u<n)&&(this.render_options.flat_beam_offset=u):this.render_options.flat_beam_offset=u,this.slope=0,this.y_shift=0}getBeamYToDraw(){let t=this.notes[0].getStemExtents().topY;return this.render_options.flat_beams&&this.render_options.flat_beam_offset&&(t=this.render_options.flat_beam_offset),t}applyStemExtensions(){let{notes:t,slope:i,y_shift:s,stem_direction:r,beam_count:n,render_options:{show_stemlets:a,stemlet_extension:o,beam_width:l}}=this,h=t[0],u=this.getBeamYToDraw(),c=h.getStemX();for(let d=0;d<t.length;++d){let f=t[d],p=f.getStemX(),{topY:m}=f.getStemExtents(),g=this.getSlopeY(p,c,u,i)+s,b=f.getStem().getExtension(),S=r===gt.
5UP?m-g:g-m;if(f.stem.setExtension(b+S),f.stem.renderHeightAdjustment=-gt.WIDTH/2,f.isRest()&&a){let E=l,y=(n-1)*E*1.5+E;f.stem.setVisibility(!0).setStemlet(!0,y+o)}}}lookupBeamDirection(t,i,s,r){if(t==="4")return kr;let n=`${D.durationToNumber(t)/2}`,a=i<D.durationToTicks(n),o=r<D.durationToTicks(n),l=s<D.durationToTicks(n);return a&&o&&l?Pa:a&&!o&&l?kr:!a&&o&&l?Rh:this.lookupBeamDirection(n,i,s,r)}getBeamLines(t){let i=D.durationToTicks(t),s=[],r=!1,n=null,a=this.render_options.partial_beam_length,o=!1,l=0;for(let u=0;u<this.notes.length;++u){let c=this.notes[u],d=c.ticks.value();l+=d;let f=!1;parseInt(t,10)>=8&&(f=this.break_on_indices.indexOf(u)!==-1,this.render_options.secondary_break_ticks&&l>=this.render_options.secondary_break_ticks&&(l=0,f=!0));let p=c.getIntrinsicTicks()<i,m=c.getStemX()-gt.WIDTH/2,g=this.notes[u-1],b=this.notes[u+1],S=b&&b.getIntrinsicTicks()<i,E=g&&g.getIntrinsicTicks()<i,y=g&&b&&p&&!E&&!S;if(p)if(r)n=s[s.length-1],n.end=m,f&&(r=!1,b&&!S&&n.end===null&&(n.end=n.start-a));else{if(n={start:m,end:null},r=!0,y){let M=g.getIntrinsicTicks(),P=b.getIntrinsicTicks(),L=c.getIntrinsicTicks(),B=this.lookupBeamDirection(t,M,L,P);[kr,Pa].includes(B)?n.end=n.start-a:n.end=n.start+a}else S?f&&(n.end=n.start-a,r=!1):(o||u===0)&&b?n.end=n.start+a:n.end=n.start-a;s.push(n)}else r=!1;o=f}let h=s[s.length-1];return h&&h.end===null&&(h.end=h.start-a),s}drawStems(){this.notes.forEach(t=>{t.getStem()&&t.getStem().setContext(this.context).draw()},this)}drawBeamLines(){this.checkContext();let t=["4","8","16","32","64"],i=this.notes[0],s=this.getBeamYToDraw(),r=i.getStemX(),n=this.render_options.beam_width*this.stem_direction;for(let a=0;a<t.length;++a){let o=t[a],l=this.getBeamLines(o);for(let h=0;h<l.length;++h){let u=l[h],c=u.start,d=this.getSlopeY(c,r,s,this.slope),f=u.end,p=this.getSlopeY(f,r,s,this.slope);this.context.beginPath(),this.context.moveTo(c,d),this.context.lineTo(c,d+n),this.context.lineTo(f+1,p+n),this.context.lineTo(f+1,p),this.context.closePath(),this.context.fill()}s+=n*1.5}}preFormat(){return this}postFormat(){this.postFormatted||(this.notes[0].getCategory()==="tabnotes"||this.render_options.flat_beams?this.calculateFlatSlope():this.calculateSlope(),this.applyStemExtensions(),this.postFormatted=!0)}draw(){this.checkContext(),this.setRendered(),!this.unbeamable&&(this.postFormatted||this.postFormat(),this.drawStems(),this.applyStyle(),this.drawBeamLines(),this.restoreStyle())}},Qe=class Ei extends fe{static get Mode(){return{STRICT:1,SOFT:2,FULL:3}}constructor(t){if(super(),this.setAttribute("type","Voice"),typeof t=="string"){let i=t.match(/(\d+)\/(\d+)/);i&&(t={num_beats:i[1],beat_value:i[2],resolution:D.RESOLUTION})}this.time=w.Merge({num_beats:4,beat_value:4,resolution:D.RESOLUTION},t),this.totalTicks=new ie(this.time.num_beats*(this.time.resolution/this.time.beat_value),1),this.resolutionMultiplier=1,this.tickables=[],this.ticksUsed=new ie(0,1),this.smallestTickCount=this.totalTicks.clone(),this.largestTickWidth=0,this.stave=null,this.mode=Ei.Mode.STRICT,this.voiceGroup=null}getTotalTicks(){return this.totalTicks}getTicksUsed(){return this.ticksUsed}getLargestTickWidth(){return this.largestTickWidth}getSmallestTickCount(){return this.smallestTickCount}getTickables(){return this.tickables}getMode(){return this.mode}setMode(t){return this.mode=t,this}getResolutionMultiplier(){return this.resolutionMultiplier}getActualResolution(){return this.resolutionMultiplier*this.time.resolution}setStave(t){return this.stave=t,this.boundingBox=null,this}getBoundingBox(){let t,i,s,r;if(!this.boundingBox){if(!this.stave)throw new w.RERR("NoStave","Can't get bounding box without stave.");for(t=this.stave,i=null,r=0;r<this.tickables.length;++r)this.tickables[r].setStave(t),s=this.tickables[r].getBoundingBox(),s&&(i=i?i.mergeWith(s):s);this.boundingBox=i}return this.boundingBox}getVoiceGroup(){if(!this.voiceGroup)throw new w.RERR("NoVoiceGroup","No voice group for voice.");return this.voiceGroup}setVoiceGroup(t){return this.voiceGroup=t,this}setStrict(t){return this.mode=t?Ei.Mode.STRICT:Ei.Mode.SOFT,this}isComplete(){return this.mode===Ei.Mode.STRICT||this.mode===Ei.Mode.FULL?this.ticksUsed.equals(this.totalTicks):!0}addTickable(t){if(!t.shouldIgnoreTicks()){let i=t.getTicks();if(this.ticksUsed.add(i),(this.mode===Ei.Mode.STRICT||this.mode===Ei.Mode.FULL)&&this.ticksUsed.greaterThan(this.totalTicks))throw this.ticksUsed.subtract(i),new w.RERR("BadArgument","Too many ticks.");i.lessThan(this.smallestTickCount)&&(this.smallestTickCount=i.clone()),this.resolutionMultiplier=this.ticksUsed.denominator,this.totalTicks.add(0,this.ticksUsed.denominator)}return this.tickables.push(t),t.setVoice(this),this}addTickables(t){for(let i=0;i<t.length;++i)this.addTickable(t[i]);return this}preFormat(){return this.preFormatted?this:(this.tickables.forEac
5h(t=>{t.getStave()||t.setStave(this.stave)}),this.preFormatted=!0,this)}draw(t=this.context,i=this.stave){this.setRendered();let s=null;for(let r=0;r<this.tickables.length;++r){let n=this.tickables[r];if(i&&n.setStave(i),!n.getStave())throw new w.RuntimeError("MissingStave","The voice cannot draw tickables without staves.");if(r===0&&(s=n.getBoundingBox()),r>0&&s){let a=n.getBoundingBox();a&&s.mergeWith(a)}n.setContext(t),n.drawWithStyle()}this.boundingBox=s}};function La(e,t,i,s,r){if(t!==Ki.type.BOLD_DOUBLE_LEFT&&t!==Ki.type.BOLD_DOUBLE_RIGHT)throw new w.RERR("InvalidConnector","A REPEAT_BEGIN or REPEAT_END type must be provided.");let n=3,a=3.5;t===Ki.type.BOLD_DOUBLE_RIGHT&&(n=-5,a=3),e.fillRect(i+n,s,1,r-s),e.fillRect(i-2,s,a,r-s)}var Ki=class Dt extends fe{static get type(){return{SINGLE_RIGHT:0,SINGLE_LEFT:1,SINGLE:1,DOUBLE:2,BRACE:3,BRACKET:4,BOLD_DOUBLE_LEFT:5,BOLD_DOUBLE_RIGHT:6,THIN_DOUBLE:7,NONE:8}}static get typeString(){return{singleRight:Dt.type.SINGLE_RIGHT,singleLeft:Dt.type.SINGLE_LEFT,single:Dt.type.SINGLE,double:Dt.type.DOUBLE,brace:Dt.type.BRACE,bracket:Dt.type.BRACKET,boldDoubleLeft:Dt.type.BOLD_DOUBLE_LEFT,boldDoubleRight:Dt.type.BOLD_DOUBLE_RIGHT,thinDouble:Dt.type.THIN_DOUBLE,none:Dt.type.NONE}}constructor(t,i){super(),this.setAttribute("type","StaveConnector"),this.thickness=D.STAVE_LINE_THICKNESS,this.width=3,this.top_stave=t,this.bottom_stave=i,this.type=Dt.type.DOUBLE,this.font={family:"times",size:16,weight:"normal"},this.x_shift=0,this.texts=[]}setType(t){return t=typeof t=="string"?Dt.typeString[t]:t,t>=Dt.type.SINGLE_RIGHT&&t<=Dt.type.NONE&&(this.type=t),this}setText(t,i){return this.texts.push({content:t,options:w.Merge({shift_x:0,shift_y:0},i)}),this}setFont(t){w.Merge(this.font,t)}setXShift(t){if(typeof t!="number")throw w.RERR("InvalidType","x_shift must be a Number");return this.x_shift=t,this}draw(){let t=this.checkContext();this.setRendered();let i=this.top_stave.getYForLine(0),s=this.bottom_stave.getYForLine(this.bottom_stave.getNumLines()-1)+this.thickness,r=this.width,n=this.top_stave.getX();(this.type===Dt.type.SINGLE_RIGHT||this.type===Dt.type.BOLD_DOUBLE_RIGHT||this.type===Dt.type.THIN_DOUBLE)&&(n=this.top_stave.getX()+this.top_stave.width);let a=s-i;switch(this.type){case Dt.type.SINGLE:r=1;break;case Dt.type.SINGLE_LEFT:r=1;break;case Dt.type.SINGLE_RIGHT:r=1;break;case Dt.type.DOUBLE:n-=this.width+2;break;case Dt.type.BRACE:{r=12;let o=this.top_stave.getX()-2+this.x_shift,l=i,h=o,u=s,c=o-r,d=l+a/2,f=c-.9*r,p=l+.2*a,m=o+1.1*r,g=d-.135*a,b=m,S=d+.135*a,E=f,y=u-.2*a,M=c-r,P=y,L=o+.4*r,B=d+.135*a,A=L,G=d-.135*a,H=M,T=p;t.beginPath(),t.moveTo(o,l),t.bezierCurveTo(f,p,m,g,c,d),t.bezierCurveTo(b,S,E,y,h,u),t.bezierCurveTo(M,P,L,B,c,d),t.bezierCurveTo(A,G,H,T,o,l),t.fill(),t.stroke();break}case Dt.type.BRACKET:i-=4,s+=4,a=s-i,wt.renderGlyph(t,n-5,i-3,40,"v1b",!0),wt.renderGlyph(t,n-5,s+3,40,"v10",!0),n-=this.width+2;break;case Dt.type.BOLD_DOUBLE_LEFT:La(t,this.type,n+this.x_shift,i,s);break;case Dt.type.BOLD_DOUBLE_RIGHT:La(t,this.type,n,i,s);break;case Dt.type.THIN_DOUBLE:r=1;break;case Dt.type.NONE:break;default:throw new w.RERR("InvalidType",`The provided StaveConnector.type (${this.type}
5) is invalid`)}this.type!==Dt.type.BRACE&&this.type!==Dt.type.BOLD_DOUBLE_LEFT&&this.type!==Dt.type.BOLD_DOUBLE_RIGHT&&this.type!==Dt.type.NONE&&t.fillRect(n,i,r,a),this.type===Dt.type.THIN_DOUBLE&&t.fillRect(n-3,i,r,a),t.save(),t.lineWidth=2,t.setFont(this.font.family,this.font.size,this.font.weight);for(let o=0;o<this.texts.length;o++){let l=this.texts[o],h=t.measureText(""+l.content).width,u=this.top_stave.getX()-h-24+l.options.shift_x,c=(this.top_stave.getYForLine(0)+this.bottom_stave.getBottomLineY())/2+l.options.shift_y;t.fillText(""+l.content,u,c+4)}t.restore()}},To=class extends fe{constructor(){super(),this.setAttribute("type","Tickable"),this.ticks=new ie(0,1),this.intrinsicTicks=0,this.tickMultiplier=new ie(1,1),this.width=0,this.x_shift=0,this.voice=null,this.tickContext=null,this.modifierContext=null,this.modifiers=[],this.preFormatted=!1,this.postFormatted=!1,this.tuplet=null,this.tupletStack=[],this.align_center=!1,this.center_x_shift=0,this.ignore_ticks=!1,this.formatterMetrics={freedom:{left:0,right:0},duration:"",iterations:0,space:{used:0,mean:0,deviation:0}}}reset(){return this}getTicks(){return this.ticks}shouldIgnoreTicks(){return this.ignore_ticks}getWidth(){return this.width}getFormatterMetrics(){return this.formatterMetrics}setXShift(e){this.x_shift=e}getCenterXShift(){return this.isCenterAligned()?this.center_x_shift:0}isCenterAligned(){return this.align_center}setCenterAlignment(e){return this.align_center=e,this}getVoice(){if(!this.voice)throw new w.RERR("NoVoice","Tickable has no voice.");return this.voice}setVoice(e){this.voice=e}getTuplet(){return this.tuplet}resetTuplet(e){let t,i;if(e){let s=this.tupletStack.indexOf(e);return s!==-1&&(this.tupletStack.splice(s,1),t=e.getNoteCount(),i=e.getNotesOccupied(),this.applyTickMultiplier(t,i)),this}for(;this.tupletStack.length;)e=this.tupletStack.pop(),t=e.getNoteCount(),i=e.getNotesOccupied(),this.applyTickMultiplier(t,i);return this}setTuplet(e){if(e){this.tupletStack.push(e);let t=e.getNoteCount(),i=e.getNotesOccupied();this.applyTickMultiplier(i,t)}return this.tuplet=e,this}addToModifierContext(e){this.modifierContext=e,this.preFormatted=!1}addModifier(e){return this.modifiers.push(e),this.preFormatted=!1,this}getModifiers(){return this.modifiers}setTickContext(e){this.tickContext=e,this.preFormatted=!1}preFormat(){this.preFormatted||(this.width=0,this.modifierContext&&(this.modifierContext.preFormat(),this.width+=this.modifierContext.getWidth()))}postFormat(){return this.postFormatted||(this.postFormatted=!0),this}getIntrinsicTicks(){return this.intrinsicTicks}setIntrinsicTicks(e){this.intrinsicTicks=e,this.ticks=this.tickMultiplier.clone().multiply(this.intrinsicTicks)}getTickMultiplier(){return this.tickMultiplier}applyTickMultiplier(e,t){this.tickMultiplier.multiply(e,t),this.ticks=this.tickMultiplier.clone().multiply(this.intrinsicTicks)}setDuration(e){let t=e.numerator*(D.RESOLUTION/e.denominator);this.ticks=this.tickMultiplier.clone().multiply(t),this.intrinsicTicks=this.ticks.value()}},ze=class sn extends To{static get CATEGORY(){return"note"}static get STAVEPADDING(){return 12}static plotMetrics(t,i,s){let r=i.getMetrics(),n=i.getAbsoluteX()-r.modLeftPx-r.extraLeftPx,a=i.getAbsoluteX()-r.extraLeftPx,o=i.getAbsoluteX(),l=i.getAbsoluteX()+r.noteWidth,h=i.getAbsoluteX()+r.noteWidth+r.extraRightPx,u=i.getAbsoluteX()+r.noteWidth+r.extraRightPx+r.modRightPx,c=u+i.getFormatterMetrics().freedom.right,d=u-n;t.save(),t.setFont("Arial",8,""),t.fillText(Math.round(d)+"px",n+i.getXShift(),s);let f=s+7;function p(g,b,S,E=f){t.beginPath(),t.setStrokeStyle(S),t.setFillStyle(S),t.setLineWidth(3),t.moveTo(g+i.getXShift(),E),t.lineTo(b+i.getXShift(),E),t.stroke()}p(n,a,"red"),p(a,o,"#999"),p(o,l,"green"),p(l,h,"#999"),p(h,u,"red"),p(u,c,"#DD0"),p(n-i.getXShift(),n,"#BBB"),w.drawDot(t,o+i.getXShift(),f,"blue");let m=i.getFormatterMetrics();if(m.iterations>0){let g=m.space.deviation,b=g>=0?"+":"";t.setFillStyle("red"),t.fillText(b+Math.round(g),o+i.getXShift(),s-10)}t.restore()}constructor(t){if(super(),this.setAttribute("type","Note"),!t)throw new w.RuntimeError("BadArguments","Note must have valid initialization data to i
5dentify duration and type.");let i=D.parseNoteStruct(t);if(!i)throw new w.RuntimeError("BadArguments",`Invalid note initialization object: ${JSON.stringify(t)}`);if(this.duration=i.duration,this.dots=i.dots,this.noteType=i.type,this.customTypes=i.customTypes,t.duration_override?this.setDuration(t.duration_override):this.setIntrinsicTicks(i.ticks),this.modifiers=[],this.glyph=D.getGlyphProps(this.duration,this.noteType),this.customGlyphs=this.customTypes.map(s=>D.getGlyphProps(this.duration,s)),this.positions&&(typeof this.positions!="object"||!this.positions.length))throw new w.RuntimeError("BadArguments","Note keys must be array type.");this.playNote=null,this.tickContext=null,this.modifierContext=null,this.ignore_ticks=!1,this.width=0,this.extraLeftPx=0,this.extraRightPx=0,this.x_shift=0,this.left_modPx=0,this.right_modPx=0,this.voice=null,this.preFormatted=!1,this.ys=[],t.align_center&&this.setCenterAlignment(t.align_center),this.stave=null,this.render_options={annotation_spacing:5,stave_padding:sn.STAVEPADDING}}getPlayNote(){return this.playNote}setPlayNote(t){return this.playNote=t,this}isRest(){return!1}addStroke(t,i){return i.setNote(this),i.setIndex(t),this.modifiers.push(i),this.setPreFormatted(!1),this}getStave(){return this.stave}setStave(t){return this.stave=t,this.setYs([t.getYForLine(0)]),this.context=this.stave.context,this}getCategory(){return sn.CATEGORY}setContext(t){return this.context=t,this}getExtraLeftPx(){return this.extraLeftPx}getExtraRightPx(){return this.extraRightPx}setExtraLeftPx(t){return this.extraLeftPx=t,this}setExtraRightPx(t){return this.extraRightPx=t,this}shouldIgnoreTicks(){return this.ignore_ticks}getLineNumber(){return 0}getLineForRest(){return 0}getGlyph(){return this.glyph}getGlyphWidth(){return this.glyph.getWidth(this.render_options.glyph_font_scale)}setYs(t){return this.ys=t,this}getYs(){if(this.ys.length===0)throw new w.RERR("NoYValues","No Y-values calculated for this note.");return this.ys}getYForTopText(t){if(!this.stave)throw new w.RERR("NoStave","No stave attached to this note.");return this.stave.getYForTopText(t)}getBoundingBox(){return null}getVoice(){if(!this.voice)throw new w.RERR("NoVoice","Note has no voice.");return this.voice}setVoice(t){return this.voice=t,this.preFormatted=!1,this}getTickContext(){return this.tickContext}setTickContext(t){return this.tickContext=t,this.preFormatted=!1,this}getDuration(){return this.duration}isDotted(){return this.dots>0}hasStem(){return!1}getDots(){return this.dots}getNoteType(){return this.noteType}setBeam(){return this}setModifierContext(t){return this.modifierContext=t,this}addModifier(t,i=0){return t.setNote(this),t.setIndex(i),this.modifiers.push(t),this.setPreFormatted(!1),this}getModifierStartXY(){if(!this.preFormatted)throw new w.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");return{x:this.getAbsoluteX(),y:this.ys[0]}}getMetrics(){if(!this.preFormatted)throw new w.RERR("UnformattedNote","Can't call getMetrics on an unformatted note.");let t=0,i=0;this.modifierContext!=null&&(t=this.modifierContext.state.left_shift,i=this.modifierContext.state.right_shift);let s=this.getWidth();return{width:s,noteWidth:s-t-i-this.extraLeftPx-this.extraRightPx,left_shift:this.x_shift,modLeftPx:t,modRightPx:i,extraLeftPx:this.extraLeftPx,extraRightPx:this.extraRightPx}}setWidth(t){this.width=t}getWidth(){if(!this.preFormatted)throw new w.RERR("UnformattedNote","Can't call GetWidth on an unformatted note.");return this.width+(this.modifierContext?this.modifierContext.getWidth():0)}setXShift(t){return this.x_shift=t,this}getXShift(){return this.x_shift}getX(){if(!this.tickContext)throw new w.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");return this.tickContext.getX()+this.x_shift}
5getAbsoluteX(){if(!this.tickContext)throw new w.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");let t=this.tickContext.getX();return this.stave&&(t+=this.stave.getNoteStartX()+this.render_options.stave_padding),this.isCenterAligned()&&(t+=this.getCenterXShift()),t}setPreFormatted(t){if(this.preFormatted=t,this.preFormatted){let i=this.tickContext.getExtraPx();this.left_modPx=Math.max(this.left_modPx,i.left),this.right_modPx=Math.max(this.right_modPx,i.right)}}};function Ch(...e){yr.DEBUG&&w.L("Vex.Flow.NoteHead",e)}function Nh(e,t,i,s,r,n){let a=D.SLASH_NOTEHEAD_WIDTH;e.save(),e.setLineWidth(D.STEM_WIDTH);let o=!1;if(D.durationToNumber(t)>2&&(o=!0),o||(i-=D.STEM_WIDTH/2*r),e.beginPath(),e.moveTo(i,s+n),e.lineTo(i,s+1),e.lineTo(i+a,s-n),e.lineTo(i+a,s),e.lineTo(i,s+n),e.closePath(),o?e.fill():e.stroke(),D.durationToFraction(t).equals(.5)){let l=[-3,-1,a+1,a+3];for(let h=0;h<l.length;h++)e.beginPath(),e.moveTo(i+l[h],s-10),e.lineTo(i+l[h],s+11),e.stroke()}e.restore()}var yr=class Po extends ze{static get CATEGORY(){return"notehead"}constructor(t){if(super(t),this.setAttribute("type","NoteHead"),this.index=t.index,this.x=t.x||0,this.y=t.y||0,this.note_type=t.note_type,this.duration=t.duration,this.displaced=t.displaced||!1,this.stem_direction=t.stem_direction||me.STEM_UP,this.line=t.line,this.glyph=D.getGlyphProps(this.duration,this.note_type),!this.glyph)throw new w.RuntimeError("BadArguments",`No glyph found for duration '${this.duration}' and type '${this.note_type}'`);this.glyph_code=this.glyph.code_head,this.x_shift=t.x_shift||0,t.custom_glyph_code&&(this.custom_glyph=!0,this.glyph_code=t.custom_glyph_code,this.stem_up_x_offset=t.stem_up_x_offset||0,this.stem_down_x_offset=t.stem_down_x_offset||0),this.style=t.style,this.slashed=t.slashed,w.Merge(this.render_options,{glyph_font_scale:t.glyph_font_scale||D.DEFAULT_NOTATION_FONT_SCALE,stroke_px:3}),this.setWidth(this.glyph.getWidth(this.render_options.glyph_font_scale))}getCategory(){return Po.CATEGORY}getWidth(){return this.width}isDisplaced(){return this.displaced===!0}getGlyph(){return this.glyph}setX(t){return this.x=t,this}getY(){return this.y}setY(t){return this.y=t,this}getLine(){return this.line}setLine(t){return this.line=t,this}getAbsoluteX(){let t=this.preFormatted?super.getAbsoluteX():this.x,i=gt.WIDTH/2;return t+(this.displaced?(this.width-i)*this.stem_direction:0)}getBoundingBox(){if(!this.preFormatted)throw new w.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");let t=this.stave.getSpacingBetweenLines(),i=t/2,s=this.y-i;return new D.BoundingBox(this.getAbsoluteX(),s,this.width,t)}setStave(t){let i=this.getLine();return this.stave=t,this.setY(t.getYForNote(i)),this.context=this.stave.context,this}preFormat(){if(this.preFormatted)return this;let t=this.getWidth()+this.extraLeftPx+this.extraRightPx;return this.setWidth(t),this.setPreFormatted(!0),this}draw(){this.checkContext(),this.setRendered();let t=this.context,i=this.getAbsoluteX();this.custom_glyph&&(i+=this.stem_direction===gt.UP?this.stem_up_x_offset:this.stem_down_x_offset);let s=this.y;Ch("Drawing note head '",this.note_type,this.duration,"' at",i,s);let r=this.stem_direction,n=this.render_options.glyph_font_scale;if(this.style&&this.applyStyle(t),this.note_type==="s"){let a=this.stave.getSpacingBetweenLines();Nh(t,this.duration,i,s,r,a)}else wt.renderGlyph(t,i,s,n,this.glyph_code);this.style&&this.restoreStyle(t)}},Fn=class extends ze{constructor(e){super(e),this.setAttribute("type","StemmableNote"),this.stem=null,this.stemExtensionOverride=null,this.beam=null}getStem(){return this.stem}setStem(e){return this.stem=e,this}buildStem(){let e=new gt;return this.setStem(e),this}buildFlag(){let{glyph:e,beam:t}=this,i=t===null;if(e&&e.flag&&i){let s=this.getStemDirection()===gt.DOWN?e.code_flag_downstem:e.code_flag_upstem;this.flag=new wt(s,this.render_options.glyph_font_scale)}}getTopGlyph(){return this.getStemDirection()===gt.DOWN?this.customGlyphs[this.customGlyphs.length-1]:this.customGlyphs[0]}getStemLength(){return gt.HEIGHT+this.getStemExtension()}getBeamCount(){let e=this.getGlyph();return e?e.beam_count:0}getStemMinumumLength(){let e=D.durationToFraction(this.duration).value(
5)<=1?0:20;switch(this.duration){case"8":this.beam??(e=35);break;case"16":e=this.beam==null?35:25;break;case"32":e=this.beam==null?45:35;break;case"64":e=this.beam==null?50:40;break;case"128":e=this.beam==null?55:45;break;default:break}return e}getStemDirection(){return this.stem_direction}setStemDirection(e){if(e||(e=gt.UP),e!==gt.UP&&e!==gt.DOWN)throw new w.RERR("BadArgument",`Invalid stem direction: ${e}`);if(this.stem_direction=e,this.stem){this.stem.setDirection(e),this.stem.setExtension(this.getStemExtension());let t=this.getTopGlyph()||this.getGlyph();this.stem.setOptions({stem_up_y_offset:t.stem_up_y_offset,stem_down_y_offset:t.stem_down_y_offset})}return this.reset(),this.flag&&this.buildFlag(),this.beam=null,this.preFormatted&&this.preFormat(),this}getStemX(){let e=this.getAbsoluteX()+this.x_shift,t=this.getAbsoluteX()+this.x_shift+this.getGlyphWidth();return this.stem_direction===gt.DOWN?e:t}getCenterGlyphX(){return this.getAbsoluteX()+this.x_shift+this.getGlyphWidth()/2}getStemExtension(){let e=this.getGlyph();
5return this.stemExtensionOverride==null?e?this.getStemDirection()===1?e.stem_up_extension:e.stem_down_extension:0:this.stemExtensionOverride}setStemLength(e){return this.stemExtensionOverride=e-gt.HEIGHT,this}getStemExtents(){return this.stem.getExtents()}setBeam(e){return this.beam=e,this}getYForTopText(e){let t=this.getStemExtents();return this.hasStem()?Math.min(this.stave.getYForTopText(e),t.topY-this.render_options.annotation_spacing*(e+1)):this.stave.getYForTopText(e)}getYForBottomText(e){let t=this.getStemExtents();return this.hasStem()?Math.max(this.stave.getYForTopText(e),t.baseY+this.render_options.annotation_spacing*e):this.stave.getYForBottomText(e)}hasFlag(){return D.getGlyphProps(this.duration).flag&&!this.beam}postFormat(){return this.beam&&this.beam.postFormat(),this.postFormatted=!0,this}drawStem(e){this.checkContext(),this.setRendered(),this.setStem(new gt(e)),this.stem.setContext(this.context).draw()}},St=class ci extends fe{static get CATEGORY(){return"none"}static get Position(){return{LEFT:1,RIGHT:2,ABOVE:3,BELOW:4}}static get PositionString(){return{above:ci.Position.ABOVE,below:ci.Position.BELOW,left:ci.Position.LEFT,right:ci.Position.RIGHT}}constructor(){super(),this.setAttribute("type","Modifier"),this.width=0,this.note=null,this.index=null,this.text_line=0,this.position=ci.Position.LEFT,this.modifier_context=null,this.x_shift=0,this.y_shift=0,this.spacingFromNextModifier=0}getCategory(){return ci.CATEGORY}getWidth(){return this.width}setWidth(t){return this.width=t,this}getNote(){return this.note}setNote(t){return this.note=t,this}getIndex(){return this.index}setIndex(t){return this.index=t,this}getModifierContext(){return this.modifier_context}setModifierContext(t){return this.modifier_context=t,this}getPosition(){return this.position}setPosition(t){return this.position=typeof t=="string"?ci.PositionString[t]:t,this}setTextLine(t){return this.text_line=t,this}setYShift(t){return this.y_shift=t,this}setSpacingFromNextModifier(t){this.spacingFromNextModifier=t}getSpacingFromNextModifier(){return this.spacingFromNextModifier}setXShift(t){this.x_shift=0,this.position===ci.Position.LEFT?this.x_shift-=t:this.x_shift+=t}getXShift(){return this.x_shift}draw(){throw this.checkContext(),new w.RERR("MethodNotImplemented","draw() not implemented for this modifier.")}alignSubNotesWithNote(t,i){let s=i.getTickContext(),r=s.getExtraPx(),n=s.getX()-r.left-r.extraLeft+this.getSpacingFromNextModifier();t.forEach(a=>{let o=a.getTickContext();a.setStave(i.stave),o.setXOffset(n)})}},xr=class Lo extends St{static get CATEGORY(){return"dots"}static format(t,i){let s=i.right_shift;if(!t||t.length===0)return!1;let r=[],n={};for(let d=0;d<t.length;++d){let f=t[d],p=f.getNote(),m,g;typeof p.getKeyProps=="function"?(m=p.getKeyProps()[f.getIndex()],g=m.displaced?p.getExtraRightPx():0):(m={line:.5},g=0);let b=p.getAttribute("id");r.push({line:m.line,note:p,note_id:b,dot:f}),n[b]=Math.max(n[b]||g,g)}r.sort((d,f)=>f.line-d.line);let a=s,o=0,l=null,h=null,u=null,c=0;for(let d=0;d<r.length;++d){let{dot:f,note:p,note_id:m,line:g}=r[d];(g!==l||p!==h)&&(a=n[m]),!p.isRest()&&g!==l&&(Math.abs(g%1)===.5?c=0:(c=.5,(h!=null&&!h.isRest()&&l-g===.5||g+c===u)&&(c=-.5))),p.isRest()?f.dot_shiftY+=-c:f.dot_shiftY=-c,u=g+c,f.setXShift(a),a+=f.getWidth()+1,o=a>o?a:o,l=g,h=p}return i.right_shift+=o,!0}constructor(){super(),this.setAttribute("type","Dot"),this.note=null,this.index=null,this.position=St.Position.RIGHT,this.radius=2,this.setWidth(5),this.dot_shiftY=0}getCategory(){return Lo.CATEGORY}setNote(t){this.note=t,this.note.getCategory()==="gracenotes"&&(this.radius*=.5,this.setWidth(3))}setDotShiftY(t){return this.dot_shiftY=t,this}draw(){if(this.checkContext(),this.setRendered(),!this.note||this.index===null)throw new w.RERR("NoAttachedNote","Can't draw dot without a note and index.");let t=this.note.stave.options.spacing_between_lines_px,i=this.note.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});this.note.getCategory()==="tabnotes"&&(i.y=this.note.getStemExtents().baseY);let s=i.x+this.x_shift+this.width-this.radius,r=i.y+this.y_shift+this.dot_shiftY*t,n=this.context;n.beginPath(),n.arc(s,r,this.radius,0,Math.PI*2,!1),n.fill()}};function Ih(...e){me.DEBUG&&w.L("Vex.Flow.StaveNote",e)}var Bh=e=>gt.WIDTH/(2*-e.getStemDirection()),kh=(e,t)=>t===(e.getStemDirection()===gt.UP?e.keyProps.length-1:0);function Si(e,t,i){let s=+!t.isrest*i;e.line+=s,e.maxLine+=s,e.minLine+=s,e.note.setKeyLine(0,e.note.getKeyLine(0)+s)}function Fh(e,t,i){let s=e.line-w.MidLine(t.minLine,i.maxLine);e.note.setKeyLine(0,e.note.getKeyLine(0)-s),e.line-=s,e.maxLine-=s,e.minLine-=s}var me=class Xs extends Fn{static get CATEGORY(){return"stavenotes"}static get STEM_UP(){return gt.UP}static get STEM_DOWN(){return gt.DOWN}static get DEFAULT_LEDGER_LINE_OFFSET(){return 3}static format(t,i){if(!t||t.length<2)return!1;if(t[0].getStave())return Xs.formatByY(t,i);let s=[];for(let c=0;c<t.length;c++){let d=t[c].getKeyProps(),f=d[0].line,p=d[d.length-1].line,m=t[c].getStemDirection(),g=t[c].getStemLength()/10,b=t[c].getStemMinumumLength()/10,S;t[c].isRest()?(S=f+t[c].glyph.line_above,p=f-t[c].glyph.line_below):(S=m===1?d[d.length-1].line+g:d[d.length-1].line,p=m===1?d[0].line:d[0].line-g),s.push({line:d[0].line,maxLine:S,minLine:p,isrest:t[c].isRest(),stemDirection:m,stemMax:g,stemMin:b,voice_shift:t[c].getVoiceShiftWidth(),is_displaced:t[c].isDisplaced(),note:t[c]})}let r=s.length,n=s[0],a=r>2?s[1]:null,o=r>2?s[2]:s[1];r===2&&n.stemDirection===-1&&o.stemDirection===1&&(n=s[1],o=s[0]);let l=Math.max(n.voice_shift,o.voice_shift),h=0,u;if(r===2){let c=n.stemDirection===o.stemDirection?0:.5;return n.stemDirection===o.stemDirection&&n.minLine<=o.maxLine&&(n.isrest||(u=Math.abs(n.line-(o.maxLine+.5)),u=Math.max(u,n.stemMin),n.minLine=n.line-u,n.note.setStemLength(u*10))),n.minLine<=o.maxLine+c&&(n.isrest?Si(n,o,1):o.isrest?Si(o,n,-1):(h=l,n.stemDirection===o.stemDirection?n.note.setXShift(h+3):o.note.setXShift(h))),!0}return a!==null&&a.minLine<o.maxLine+.5&&(a.isrest||(u=Math.abs(a.line-(o.maxLine+.5)),u=Math.max(u,a.stemMin),a.minLine=a.line-u,a.note.setStemLength(u*10))),a.isrest&&!n.isrest&&!o.isrest&&(n.minLine<=a.maxLine||a.minLine<=o.maxLine)?(a.maxLine-a.minLine<n.minLine-o.maxLine?Fh(a,n,o):(h=l+3,a.note.setXShift(h)),!0):n.isrest&&a.isrest&&o.isrest?(Si(n,a,1),Si(o,a,-1),!0):(a.isrest&&n.isrest&&a.minLine<=o.maxLine&&Si(a,o,1),a.isrest&&o.isrest&&n.minLine<=a.maxLine&&Si(a,n,-1),n.isrest&&n.minLine<=a.maxLine&&Si(n,a,1),o.isrest&&a.minLine<=o.maxLine&&Si(o,a,-1),(!n.isrest&&!a.isrest&&n.minLine<=a.maxLine+.5||!a.isrest&&!o.isrest&&a.minLine<=o.maxLine)&&(h=l+3,a.note.setXShift(h)),!0)}static formatByY(t,i){let s=!0;for(let n=0;n<t.length;n++)s=s&&t[n].getStave()!=null;if(!s)throw new w.RERR("Stave Missing","All notes must have a stave - Vex.Flow.ModifierContext.formatMultiVoice!");let r=0;for(let n=0;n<t.length-1;n++){let a=t[n],o=t[n+1];a.getStemDirection()===gt.DOWN&&(a=t[n+1],o=t[n]);let l=a.getKeyProps(),h=o.getKeyProps(),u=.5,c=a.getStave().getYForLine(5-l[0].line+u);
5o.getStave().getYForLine(5-h[h.length-1].line-u)-c<0&&(r=a.getVoiceShiftWidth()+2,o.setXShift(r))}i.right_shift+=r}static postFormat(t){return t?(t.forEach(i=>i.postFormat()),!0):!1}constructor(t){if(super(t),this.setAttribute("type","StaveNote"),this.keys=t.keys,this.clef=t.clef,this.octave_shift=t.octave_shift,this.beam=null,this.glyph=D.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new w.RuntimeError("BadArguments",`Invalid note initialization data (No glyph found): ${JSON.stringify(t)}`);this.displaced=!1,this.dot_shiftY=0,this.keyProps=[],this.use_default_head_x=!1,this.note_heads=[],this.modifiers=[],w.Merge(this.render_options,{glyph_font_scale:t.glyph_font_scale||D.DEFAULT_NOTATION_FONT_SCALE,stroke_px:t.stroke_px||Xs.DEFAULT_LEDGER_LINE_OFFSET}),this.calculateKeyProps(),this.buildStem(),t.auto_stem?this.autoStem():this.setStemDirection(t.stem_direction),this.reset(),this.buildFlag()}reset(){super.reset();let t=this.note_heads.map(i=>i.getStyle());this.buildNoteHeads(),this.note_heads.forEach((i,s)=>i.setStyle(t[s])),this.stave&&this.note_heads.forEach(i=>i.setStave(this.stave)),this.calcExtraPx()}setBeam(t){return this.beam=t,this.calcExtraPx(),this}getCategory(){return Xs.CATEGORY}buildStem(){this.setStem(new gt({hide:!!this.isRest()}))}buildNoteHeads(){this.note_heads=[];let t=this.getStemDirection(),i=this.getKeys(),s=null,r=null,n=!1,a,o,l;t===gt.UP?(a=0,o=i.length,l=1):t===gt.DOWN&&(a=i.length-1,o=-1,l=-1);for(let h=a;h!==o;h+=l){let u=this.keyProps[h],c=u.line;s===null?s=c:(r=Math.abs(s-c),r===0||r===.5?n=!n:(n=!1,this.use_default_head_x=!0)),s=c;let d=new yr({duration:this.duration,note_type:this.noteType,displaced:n,stem_direction:t,custom_glyph_code:u.code,glyph_font_scale:this.render_options.glyph_font_scale,x_shift:u.shift_right,stem_up_x_offset:u.stem_up_x_offset,stem_down_x_offset:u.stem_down_x_offset,line:u.line});this.note_heads[h]=d}}autoStem(){this.minLine=this.keyProps[0].line,this.maxLine=this.keyProps[this.keyProps.length-1].line;let t=(this.minLine+this.maxLine)/2<3?gt.UP:gt.DOWN;this.setStemDirection(t)}calculateKeyProps(){let t=null;for(let i=0;i<this.keys.length;++i){let s=this.keys[i];this.glyph.rest&&(this.glyph.position=s);let r={octave_shift:this.octave_shift||0},n=D.keyProperties(s,this.clef,r);if(!n)throw new w.RuntimeError("BadArguments",`Invalid key for note properties: ${s}`);n.key==="R"&&(this.duration==="1"||this.duration==="w"?n.line=4:n.line=3);let a=n.line;t===null?t=a:Math.abs(t-a)===.5&&(this.displaced=!0,n.displaced=!0,this.keyProps.length>0&&(this.keyProps[i-1].displaced=!0)),t=a,this.keyProps.push(n)}t=-1/0,this.keyProps.forEach(i=>{i.line<t&&w.W("Unsorted keys in note will be sorted. See https://github.com/0xfe/vexflow/issues/104 for details."),t=i.line}),this.keyProps.sort((i,s)=>i.line-s.line)}getBoundingBox(){if(!this.preFormatted)throw new w.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");let{width:t,modLeftPx:i,extraLeftPx:s}=this.getMetrics(),r=this.getAbsoluteX()-i-s,n=0,a=0,o=this.getStave().getSpacingBetweenLines()/2,l=o*2;if(this.isRest()){let h=this.ys[0],u=D.durationToFraction(this.duration);u.equals(1)||u.equals(2)?(n=h-o,a=h+o):(n=h-this.glyph.line_above*l,a=h+this.glyph.line_below*l)}else if(this.glyph.stem){let h=this.getStemExtents();h.baseY+=o*this.stem_direction,n=Math.min(h.topY,h.baseY),a=Math.max(h.topY,h.baseY)}else{n=null,a=null;for(let h=0;h<this.ys.length;++h){let u=this.ys[h];h===0?(n=u,a=u):(n=Math.min(u,n),a=Math.max(u,a))}n-=o,a+=o}return new Sr(r,n,t,a-n)}getLineNumber(t){if(!this.keyProps.length)throw new w.RERR("NoKeyProps","Can't get bottom note line, because note is not initialized properly.");let i=this.keyProps[0].line;for(let s=0;s<this.keyProps.length;s++){let r=this.keyProps[s].line;t?r>i&&(i=r):r<i&&(i=r)}return i}isRest(){return this.glyph.rest}isChord(){return!this.isRest()&&this.keys.length>1}hasStem(){return this.glyph.stem}hasFlag(){return super.hasFlag()&&!this.isRest()}getStemX(){return this.noteType==="r"?this.getCenterGlyphX():super.getStemX()+Bh(this)}getYForTopText(t){let i=this.getStemExtents();return Math.min(this.stave.getYForTopText(t),i.topY-this.render_options.annotation_spacing*(t+1))}getYForBottomText(t){let i=this.getStemExtents();return Math.max(this.stave.getYForTopText(t),i.baseY+this.render_options.annotation_spacing*t)}setStave(t){super.setStave(t);let i=this.note_heads.map(s=>(s.setStave(t),s.getY()));if(this.setYs(i),this.stem){let{y_top:s,y_bottom:r}=this.getNoteHeadBounds();this.stem.setYBounds(s,r)}return this}getKeys(){return this.keys}getKeyProps(){return this.keyProps}isDisplaced(){return this.displaced}setNoteDisplaced(t){return this.displaced=t,this}getTieRightX(){let t=this.getAbsoluteX();return t+=this.getGlyphWidth()+this.x_shift+this.extraRightPx,this.modifierContext&&(t+=this.modifierContext.getExtraRightPx()),t}getTieLeftX(){let t=this.getAbsoluteX();return t+=this.x_shift-this.extraLeftPx,t}getLineForRest(){let t=this.keyProps[0].line;if(this.keyProps.length>1){let i=this.keyProps[this.keyProps.length-1].line,s=Math.max(t,i),r=Math.min(t,i);t=w.MidLine(s,r)}return t}getModifierStartXY(t,i,s){if(s=s||{},!this.preFormatted)throw new w.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(this.ys.length===0)throw new w.RERR("NoYValues","No Y-Values calculated for this note.");let{ABOVE:r,BELOW:n,LEFT:a,RIGHT:o}=St.Position,l=0;return t===a?l=-2:t===o?(l=this.getGlyphWidth()+this.x_shift+2,this.stem_direction===gt.UP&&this.hasFlag()&&(s.forceFlagRight||kh(this,i))&&(l+=this.flag.getMetrics().width)):(t===n||t===r)&&(l=this.getGlyphWidth()/2),{x:this.getAbsoluteX()+l,y:this.ys[i]}}setStyle(t){super.setStyle(t),this.note_heads.forEach(i=>
5i.setStyle(t)),this.stem.setStyle(t)}setStemStyle(t){this.getStem().setStyle(t)}getStemStyle(){return this.stem.getStyle()}setLedgerLineStyle(t){this.ledgerLineStyle=t}getLedgerLineStyle(){return this.ledgerLineStyle}setFlagStyle(t){this.flagStyle=t}getFlagStyle(){return this.flagStyle}setKeyStyle(t,i){return this.note_heads[t].setStyle(i),this}setKeyLine(t,i){return this.keyProps[t].line=i,this.reset(),this}getKeyLine(t){return this.keyProps[t].line}addToModifierContext(t){this.setModifierContext(t);for(let i=0;i<this.modifiers.length;++i)this.modifierContext.addModifier(this.modifiers[i]);return this.modifierContext.addModifier(this),this.setPreFormatted(!1),this}addModifier(t,i){return i.setNote(this),i.setIndex(t),this.modifiers.push(i),this.setPreFormatted(!1),this}addAccidental(t,i){return this.addModifier(t,i)}addArticulation(t,i){return this.addModifier(t,i)}addAnnotation(t,i){return this.addModifier(t,i)}addDot(t){let i=new xr;return i.setDotShiftY(this.glyph.dot_shiftY),this.dots++,this.addModifier(t,i)}addDotToAll(){for(let t=0;t<this.keys.length;++t)this.addDot(t);return this}getAccidentals(){return this.modifierContext.getModifiers("accidentals")}getDots(){return this.modifierContext.getModifiers("dots")}getVoiceShiftWidth(){return this.getGlyphWidth()*(this.displaced?2:1)}calcExtraPx(){this.setExtraLeftPx(this.displaced&&this.stem_direction===gt.DOWN?this.getGlyphWidth():0),this.setExtraRightPx(!this.hasFlag()&&this.displaced&&this.stem_direction===gt.UP?this.getGlyphWidth():0)}preFormat(){if(this.preFormatted)return;this.modifierContext&&this.modifierContext.preFormat();let t=this.getGlyphWidth()+this.extraLeftPx+this.extraRightPx;this.glyph.flag&&this.beam===null&&this.stem_direction===gt.UP&&(t+=this.getGlyphWidth()),this.setWidth(t),this.setPreFormatted(!0)}getNoteHeadBounds(){let t=null,i=null,s=null,r=null,n=this.stave.getNumLines(),a=1,o=!1,l=!1,h=n,u=a;return this.note_heads.forEach(c=>{let d=c.getLine(),f=c.getY();(t===null||f<t)&&(t=f),(i===null||f>i)&&(i=f),r===null&&c.isDisplaced()&&(r=c.getAbsoluteX()),s===null&&!c.isDisplaced()&&(s=c.getAbsoluteX()),n=d>n?d:n,a=d<a?d:a,c.isDisplaced()?(o=o===!1?d:Math.max(d,o),l=l===!1?d:Math.min(d,l)):(h=Math.max(d,h),u=Math.min(d,u))},this),{y_top:t,y_bottom:i,displaced_x:r,non_displaced_x:s,highest_line:n,lowest_line:a,highest_displaced_line:o,lowest_displaced_line:l,highest_non_displaced_line:h,lowest_non_displaced_line:u}}getNoteHeadBeginX(){return this.getAbsoluteX()+this.x_shift}getNoteHeadEndX(){return this.getNoteHeadBeginX()+this.getGlyphWidth()}drawLedgerLines(){let{stave:t,glyph:i,render_options:{stroke_px:s},context:r}=this,n=i.getWidth()+s*2,a=2*(i.getWidth()+s)-gt.WIDTH/2;if(this.isRest())return;if(!r)throw new w.RERR("NoCanvasContext","Can't draw without a canvas context.");
5let{highest_line:o,lowest_line:l,highest_displaced_line:h,highest_non_displaced_line:u,lowest_displaced_line:c,lowest_non_displaced_line:d,displaced_x:f,non_displaced_x:p}=this.getNoteHeadBounds(),m=Math.min(f,p),g=(S,E,y)=>{let M;M=y&&E?m-s:E?p-s:f-s;let P=E&&y?a:n;r.beginPath(),r.moveTo(M,S),r.lineTo(M+P,S),r.stroke()},b={...t.getStyle()||{},...this.getLedgerLineStyle()||{}};this.applyStyle(r,b);for(let S=6;S<=o;++S){let E=p!==null&&S<=u,y=f!==null&&S<=h;g(t.getYForNote(S),E,y)}for(let S=0;S>=l;--S){let E=p!==null&&S>=d,y=f!==null&&S>=c;g(t.getYForNote(S),E,y)}this.restoreStyle(r,b)}drawModifiers(){if(!this.context)throw new w.RERR("NoCanvasContext","Can't draw without a canvas context.");let t=this.context;t.openGroup("modifiers");for(let i=0;i<this.modifiers.length;i++){let s=this.modifiers[i],r=this.note_heads[s.getIndex()],n=r.getStyle();r.applyStyle(t,n),s.setContext(t),s.drawWithStyle(),r.restoreStyle(t,n)}t.closeGroup()}drawFlag(){let{stem:t,beam:i,context:s}=this;if(!s)throw new w.RERR("NoCanvasContext","Can't draw without a canvas context.");let r=i===null;if(this.getGlyph().flag&&r){let{y_top:n,y_bottom:a}=this.getNoteHeadBounds(),o=t.getHeight(),l=this.getStemX(),h=this.getStemDirection()===gt.DOWN?n-o+2:a-o-2;s.openGroup("flag",null,{pointerBBox:!0}),this.applyStyle(s,this.getFlagStyle()||!1),this.flag.render(s,l,h),this.restoreStyle(s,this.getFlagStyle()||!1),s.closeGroup()}}drawNoteHeads(){this.note_heads.forEach(t=>{this.context.openGroup("notehead",null,{pointerBBox:!0}),t.setContext(this.context).draw(),this.context.closeGroup()})}drawStem(t){if(!this.context)throw new w.RERR("NoCanvasContext","Can't draw without a canvas context.");t&&this.setStem(new gt(t)),this.context.openGroup("stem",null,{pointerBBox:!0}),this.stem.setContext(this.context).draw(),this.context.closeGroup()}draw(){if(!this.context)throw new w.RERR("NoCanvasContext","Can't draw without a canvas context.");if(!this.stave)throw new w.RERR("NoStave","Can't draw without a stave.");if(this.ys.length===0)throw new w.RERR("NoYValues","Can't draw note without Y values.");let t=this.getNoteHeadBeginX(),i=this.hasStem()&&!this.beam;this.note_heads.forEach(r=>r.setX(t));let s=this.getStemX();this.stem.setNoteHeadXBounds(s,s),Ih("Rendering ",this.isChord()?"chord :":"note :",this.keys),this.drawLedgerLines(),this.applyStyle(),this.setAttribute("el",this.context.openGroup("stavenote",this.getAttribute("id"))),this.context.openGroup("note",null,{pointerBBox:!0}),i&&this.drawStem(),this.drawNoteHeads(),this.drawFlag(),this.context.closeGroup(),this.drawModifiers(),this.context.closeGroup(),this.restoreStyle(),this.setRendered()}},Dn=class _o extends St{static get CATEGORY(){return"frethandfinger"}static format(t,i){let{left_shift:s,right_shift:r}=i;if(!t||t.length===0)return!1;let n=[],a=null,o=0,l=0;for(let m=0;m<t.length;++m){let g=t[m],b=g.getNote(),S=g.getPosition(),E=b.getKeyProps()[g.getIndex()];if(b!==a){for(let y=0;y<b.keys.length;++y){let M=b.getKeyProps()[y];s===0&&(o=M.displaced?b.getExtraLeftPx():o),r===0&&(l=M.displaced?b.getExtraRightPx():l)}a=b}n.push({note:b,num:g,pos:S,line:E.line,shiftL:o,shiftR:l})}n.sort((m,g)=>g.line-m.line);let h=0,u=0,c=0,d=0,f=null,p=null;for(let m=0;m<n.length;++m){let g=0,{note:b,pos:S,num:E,line:y,shiftL:M,shiftR:P}=n[m];(y!==f||b!==p)&&(h=s+M,u=r+P);let L=E.getWidth()+1;S===St.Position.LEFT?(E.setXShift(s+h),g=s+L,c=g>c?g:c):S===St.Position.RIGHT&&(E.setXShift(u),g=l+L,d=g>d?g:d),f=y,p=b}return i.left_shift+=c,i.right_shift+=d,!0}constructor(t){super(),this.setAttribute("type","FretHandFinger"),this.note=null,this.index=null,this.finger=t,this.width=7,this.position=St.Position.LEFT,this.x_shift=0,this.y_shift=0,this.x_offset=0,this.y_offset=0,this.font={family:"sans-serif",size:9,weight:"bold"}}getCategory(){return _o.CATEGORY}setFretHandFinger(t){return this.finger=t,this}setOffsetX(t){return this.x_offset=t,this}setOffsetY(t){return this.y_offset=t,this}draw(){if(this.checkContext(),!this.note||this.index==null)throw new w.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();let t=this.context,i=this.note.getModifierStartXY(this.position,this.index),s=i.x+this.x_shift+this.x_offset,r=i.y+this.y_shift+this.y_offset+5;switch(this.position){case St.Position.ABOVE:s-=4,r-=12;break;case St.Position.BELOW:s-=2,r+=10;break;case St.Position.LEFT:s-=this.width;break;case St.Position.RIGHT:s+=1;break;default:throw new w.RERR("InvalidPostion",`The position ${this.position} does not exist`)}t.save(),t.setFont(this.font.family,this.font.size,this.font.weight),t.fillText(""+this.finger,s,r),t.restore(
5)}},mi=class ve{static get NUM_TONES(){return 12}static get roots(){return["c","d","e","f","g","a","b"]}static get root_values(){return[0,2,4,5,7,9,11]}static get root_indices(){return{c:0,d:1,e:2,f:3,g:4,a:5,b:6}}static get canonical_notes(){return["c","c#","d","d#","e","f","f#","g","g#","a","a#","b"]}static get diatonic_intervals(){return["unison","m2","M2","m3","M3","p4","dim5","p5","m6","M6","b7","M7","octave"]}static get diatonic_accidentals(){return{unison:{note:0,accidental:0},m2:{note:1,accidental:-1},M2:{note:1,accidental:0},m3:{note:2,accidental:-1},M3:{note:2,accidental:0},p4:{note:3,accidental:0},dim5:{note:4,accidental:-1},p5:{note:4,accidental:0},m6:{note:5,accidental:-1},M6:{note:5,accidental:0},b7:{note:6,accidental:-1},M7:{note:6,accidental:0},octave:{note:7,accidental:0}}}static get intervals(){return{u:0,unison:0,m2:1,b2:1,min2:1,S:1,H:1,2:2,M2:2,maj2:2,T:2,W:2,m3:3,b3:3,min3:3,M3:4,3:4,maj3:4,4:5,p4:5,"#4":6,b5:6,aug4:6,dim5:6,5:7,p5:7,"#5":8,b6:8,aug5:8,6:9,M6:9,maj6:9,b7:10,m7:10,min7:10,dom7:10,M7:11,maj7:11,8:12,octave:12}}static get scales(){return{major:[2,2,1,2,2,2,1],dorian:[2,1,2,2,2,1,2],mixolydian:[2,2,1,2,2,1,2],minor:[2,1,2,2,1,2,2]}}static get scaleTypes(){return{M:ve.scales.major,m:ve.scales.minor}}static get accidentals(){return["bb","b","n","#","##"]}static get noteValues(){return{c:{root_index:0,int_val:0},cn:{root_index:0,int_val:0},"c#":{root_index:0,int_val:1},"c##":{root_index:0,int_val:2},cb:{root_index:0,int_val:11},cbb:{root_index:0,int_val:10},d:{root_index:1,int_val:2},dn:{root_index:1,int_val:2},"d#":{root_index:1,int_val:3},"d##":{root_index:1,int_val:4},db:{root_index:1,int_val:1},dbb:{root_index:1,int_val:0},e:{root_index:2,int_val:4},en:{root_index:2,int_val:4},"e#":{root_index:2,int_val:5},"e##":{root_index:2,int_val:6},eb:{root_index:2,int_val:3},ebb:{root_index:2,int_val:2},f:{root_index:3,int_val:5},fn:{root_index:3,int_val:5},"f#":{root_index:3,int_val:6},"f##":{root_index:3,int_val:7},fb:{root_index:3,int_val:4},fbb:{root_index:3,int_val:3},g:{root_index:4,int_val:7},gn:{root_index:4,int_val:7},"g#":{root_index:4,int_val:8},"g##":{root_index:4,int_val:9},gb:{root_index:4,int_val:6},gbb:{root_index:4,int_val:5},a:{root_index:5,int_val:9},an:{root_index:5,int_val:9},"a#":{root_index:5,int_val:10},"a##":{root_index:5,int_val:11},ab:{root_index:5,int_val:8},abb:{root_index:5,int_val:7},b:{root_index:6,int_val:11},bn:{root_index:6,int_val:11},"b#":{root_index:6,int_val:0},"b##":{root_index:6,int_val:1},bb:{root_index:6,int_val:10},bbb:{root_index:6,int_val:9}}}isValidNoteValue(t){return!(t==null||t<0||t>=ve.NUM_TONES)}isValidIntervalValue(t){return this.isValidNoteValue(t)}getNoteParts(t){if(!t||t.length<1||t.length>3)throw new w.RERR("BadArguments","Invalid note name: "+t);let i=t.toLowerCase(),s=/^([cdefgab])(b|bb|n|#|##)?$/.exec(i);if(s!=null)return{root:s[1],accidental:s[2]};throw new w.RERR("BadArguments","Invalid note name: "+t)}getKeyParts(t){if(!t||t.length<1)throw new w.RERR("BadArguments","Invalid key: "+t);let i=t.toLowerCase(),s=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(i);if(s!=null){let r=s[1],n=s[2],a=s[3];return a||(a="M"),{root:r,accidental:n,type:a}}else throw new w.RERR("BadArguments",`Invalid key: ${t}`)}getNoteValue(t){let i=ve.noteValues[t];if(i==null)throw new w.RERR("BadArguments",`Invalid note name: ${t}`);return i.int_val}getIntervalValue(t){let i=ve.intervals[t];if(i==null)throw new w.RERR("BadArguments",`Invalid interval name: ${t}`);return i}getCanonicalNoteName(t){if(!this.isValidNoteValue(t))throw new w.RERR("BadArguments",`Invalid note value: ${t}`);return ve.canonical_notes[t]}getCanonicalIntervalName(t){if(!this.isValidIntervalValue(t))throw new w.RERR("BadArguments",`Invalid interval value: ${t}`);return ve.diatonic_intervals[t]}getRelativeNoteValue(t,i,s){if(s??(s=1),s!==1&&s!==-1)throw new w.RERR("BadArguments",`Invalid direction: ${s}`);let r=(t+s*i)%ve.NUM_TONES;return r<0&&(r+=ve.NUM_TONES),r}getRelativeNoteName(t,i){let s=this.getNoteParts(t),r=this.getNoteValue(s.root),n=i-r;if(Math.abs(n)>ve.NUM_TONES-3){let o=1;n>0&&(o=-1);let l=(i+1+(r+1))%ve.NUM_TONES*o;if(Math.abs(l)>
52)throw new w.RERR("BadArguments",`Notes not related: ${t}, ${i})`);n=l}if(Math.abs(n)>2)throw new w.RERR("BadArguments",`Notes not related: ${t}, ${i})`);let a=s.root;if(n>0)for(let o=1;o<=n;++o)a+="#";else if(n<0)for(let o=-1;o>=n;--o)a+="b";return a}getScaleTones(t,i){let s=[t],r=t;for(let n=0;n<i.length;n+=1)r=this.getRelativeNoteValue(r,i[n]),r!==t&&s.push(r);return s}getIntervalBetween(t,i,s){if(s??(s=1),s!==1&&s!==-1)throw new w.RERR("BadArguments",`Invalid direction: ${s}`);if(!this.isValidNoteValue(t)||!this.isValidNoteValue(i))throw new w.RERR("BadArguments",`Invalid notes: ${t}, ${i}`);let r=s===1?i-t:t-i;return r<0&&(r+=ve.NUM_TONES),r}createScaleMap(t){let i=this.getKeyParts(t),s=ve.scaleTypes[i.type],r=i.root;if(i.accidental&&(r+=i.accidental),!s)throw new w.RERR("BadArguments","Unsupported key type: "+t);let n=this.getScaleTones(this.getNoteValue(r),s),a=ve.root_indices[i.root],o={};for(let l=0;l<ve.roots.length;++l){let h=(a+l)%ve.roots.length,u=ve.roots[h],c=this.getRelativeNoteName(u,n[l]);c.length===1&&(c+="n"),o[u]=c}return o}};function Ds(...e){Er.DEBUG&&w.L("Vex.Flow.Accidental",e)}var as=e=>e.getMetrics().width,Er=class rn extends St{static get CATEGORY(){return"accidentals"}static format(t,i){let s=i.left_shift+1;if(!t||t.length===0)return;let r=[],n=null,a=0,o;for(let g=0;g<t.length;++g){let b=t[g],S=b.getNote(),E=S.getStave(),y=S.getKeyProps()[b.getIndex()];if(S!==n){for(let M=0;M<S.keys.length;++M)o=S.getKeyProps()[M],a=o.displaced?S.getExtraLeftPx():a;n=S}if(E!==null){let M=E.options.spacing_between_lines_px,P=E.getYForLine(y.line),L=Math.round(P/M*2)/2;r.push({y:P,line:L,shift:a,acc:b,lineSpace:M})}else r.push({line:y.line,shift:a,acc:b})}r.sort((g,b)=>b.line-g.line);let l=[],h=0,u=null;for(let g=0;g<r.length;g++){let b=r[g];(u===null||u!==b.line)&&l.push({line:b.line,flatLine:!0,dblSharpLine:!0,numAcc:0,width:0}),b.acc.type!=="b"&&b.acc.type!=="bb"&&(l[l.length-1].flatLine=!1),b.acc.type!=="##"&&(l[l.length-1].dblSharpLine=!1),l[l.length-1].numAcc++,l[l.length-1].width+=b.acc.getWidth()+3,h=b.shift>h?b.shift:h,u=b.line}let c=0;for(let g=0;g<l.length;g++){let b=!1,S=g,E=g;for(;E+1<l.length&&!b;)this.checkCollision(l[E],l[E+1])?E++:b=!0;let y=T=>l[S+T],M=T=>T.map(y),P=(T,I)=>{let[v,U]=M([T,I]).map(dt=>dt.line);return v-U},L=(...T)=>T.map(M).every(I=>!this.checkCollision(...I)),B=E-S+1,A=this.checkCollision(l[S],l[E])?"a":"b";switch(B){case 3:A==="a"&&P(1,2)===.5&&P(0,1)!==.5&&(A="second_on_bottom");break;case 4:L([0,2],[1,3])&&(A="spaced_out_tetrachord");break;case 5:A==="b"&&L([1,3])&&(A="spaced_out_pentachord",L([0,2],[2,4])&&(A="very_spaced_out_pentachord"));break;case 6:L([0,3],[1,4],[2,5])&&(A="spaced_out_hexachord"),L([0,2],[2,4],[1,3],[3,5])&&(A="very_spaced_out_hexachord");break;default:break}let G,H;if(B>=7){let T=2,I=!0;for(;I===!0;){I=!1;for(let v=0;v+T<l.length;v++)if(this.checkCollision(l[v],l[v+T])){I=!0,T++;break}}for(G=g;G<=E;G++)H=(G-g)%T+1,l[G].column=H,c=c>H?c:H}else for(G=g;G<=E;G++)H=D.accidentalColumnsTable[B][A][G-g],l[G].column=H,c=c>H?c:H;g=E}let d=[],f=[];for(let g=0;g<=c;g++)d[g]=0,f[g]=0;d[0]=h+s,f[0]=h+s,l.forEach(g=>{g.width>d[g.column]&&(d[g.column]=g.width)});for(let g=1;g<d.length;g++)f[g]=d[g]+f[g-1];let p=f[f.length-1],m=0;l.forEach(g=>{let b=0,S=m+g.numAcc;for(;m<S;m++){let E=f[g.column-1]+b;r[m].acc.setXShift(E),b+=r[m].acc.getWidth()+3,Ds("Line, accCount, shift: ",g.line,m,E)}}),i.left_shift+=p}static checkCollision(t,i){let s=i.line-t.line,r=3;s>0?(r=i.flatLine||i.dblSharpLine?2.5:3,t.dblSharpLine&&(s-=.5)):(r=t.flatLine||t.dblSharpLine?2.5:3,i.dblSharpLine&&(s-=.5));let n=Math.abs(s)<r;return Ds("Line_1, Line_2, Collision: ",t.line,i.line,n),n}static applyAccidentals(t,i){let s=[],r={};t.forEach(o=>{let l=new ie(0,1);
5o.getTickables().forEach(h=>{if(h.shouldIgnoreTicks())return;let u=r[l.value()];u?u.push(h):(s.push(l.value()),r[l.value()]=[h]),l.add(h.getTicks())})});let n=new mi;i||(i="C");let a=n.createScaleMap(i);s.forEach(o=>{let l=r[o],h=[],u=c=>{c.isRest()||c.shouldIgnoreTicks()||(c.keys.forEach((d,f)=>{let p=n.getNoteParts(d.split("/")[0]),m=p.accidental||"n",g=p.root+m,b=a[p.root]===g,S=h.indexOf(g)>-1;if(!b||b&&S){a[p.root]=g;let E=new rn(m);c.addAccidental(f,E),h.push(g)}}),c.getModifiers().forEach(d=>{d.getCategory()==="gracenotegroups"&&d.getGraceNotes().forEach(u)}))};l.forEach(u)})}constructor(t=null){if(super(),this.setAttribute("type","Accidental"),Ds("New accidental: ",t),this.note=null,this.index=null,this.type=t,this.position=St.Position.LEFT,this.render_options={font_scale:38,stroke_px:3,parenLeftPadding:2,parenRightPadding:2},this.accidental=D.accidentalCodes(this.type),!this.accidental)throw new w.RERR("ArgumentError",`Unknown accidental type: ${t}`);this.cautionary=!1,this.parenLeft=null,this.parenRight=null,this.reset()}reset(){let t=this.render_options.font_scale;this.glyph=new wt(this.accidental.code,t),this.glyph.setOriginX(1),this.cautionary&&(this.parenLeft=new wt(D.accidentalCodes("{").code,t),this.parenRight=new wt(D.accidentalCodes("}").code,t),this.parenLeft.setOriginX(1),this.parenRight.setOriginX(1))}getCategory(){return rn.CATEGORY}getWidth(){let t=this.cautionary?as(this.parenLeft)+as(this.parenRight)+this.render_options.parenLeftPadding+this.render_options.parenRightPadding:0;return as(this.glyph)+t}setNote(t){if(!t)throw new w.RERR("ArgumentError",`Bad note value: ${t}`);this.note=t,this.note.getCategory()==="gracenotes"&&(this.render_options.font_scale=25,this.reset())}setAsCautionary(){return this.cautionary=!0,this.render_options.font_scale=28,this.reset(),this}draw(){let{context:t,type:i,position:s,note:r,index:n,cautionary:a,x_shift:o,y_shift:l,glyph:h,parenLeft:u,parenRight:c,render_options:{parenLeftPadding:d,parenRightPadding:f}}=this;if(this.checkContext(),!(r&&n!=null))throw new w.RERR("NoAttachedNote","Can't draw accidental without a note and index.");let p=r.getModifierStartXY(s,n),m=p.x+o,g=p.y+l;Ds("Rendering: ",i,m,g),a?(c.render(t,m,g),m-=as(c),m-=f,m-=this.accidental.parenRightPaddingAdjustment,h.render(t,m,g),m-=as(h),m-=d,u.render(t,m,g)):h.render(t,m,g),this.setRendered()}},On=class Ao extends St{static get CATEGORY(){return"notesubgroup"}static format(t,i){if(!t||t.length===0)return!1;let s=0;for(let r=0;r<t.length;++r){let n=t[r];n.preFormat(),s+=n.getWidth()}return i.left_shift+=s,!0}constructor(t){return super(),this.setAttribute("type","NoteSubGroup"),this.note=null,this.index=null,this.position=St.Position.LEFT,this.subNotes=t,this.subNotes.forEach(i=>{i.ignore_ticks=!1}),this.width=0,this.preFormatted=!1,this.formatter=new Ti,this.voice=new Qe({num_beats:4,beat_value:4,resolution:D.RESOLUTION}).setStrict(!1),this.voice.addTickables(this.subNotes),this}getCategory(){return Ao.CATEGORY}preFormat(){this.preFormatted||(this.formatter.joinVoices([this.voice]).format([this.voice],0),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}setNote(t){this.note=t}setWidth(t){this.width=t}getWidth(){return this.width}draw(){this.checkContext();let t=this.getNote();if(!(t&&this.index!==null))throw new w.RuntimeError("NoAttachedNote","Can't draw notes without a parent note and parent note index.");this.setRendered(),this.alignSubNotesWithNote(this.subNotes,t),this.subNotes.forEach(i=>i.setContext(this.context).drawWithStyle())}},vr=class extends fe{constructor(e,t){super(),this.setAttribute("type","StaveTie"),this.notes=e,this.context=null,this.text=t,this.direction=null,this.render_options={cp1:8,cp2:12,text_shift_x:0,first_x_shift:0,last_x_shift:0,y_shift:7,tie_spacing:0,font:{family:"Arial",size:10,style:""}},this.font=this.render_options.font,this.setNotes(e)}setFont(e){return this.font=e,this}setDirection(e){return this.direction=e,this}setNotes(e){if(!e.first_note&&!e.last_note)throw new w.RuntimeError("BadArguments","Tie needs to have either first_note or last_note set.");if(e.first_indices||(e.first_indices=[0]),e.last_indices||(e.last_indices=[0]),e.first_indices.length!==e.last_indices.length)throw new w.RuntimeError("BadArguments","Tied notes must have similar index sizes");return this.first_note=e.first_note,this.first_indices=e.first_indices,this.last_note=e.last_note,this.last_indices=e.last_indices,this}isPartial(){return!this.first_note||!this.last_note}renderTie(e){if(e.first_ys.length===0||e.last_ys.length===0)throw new w.RERR("BadArguments","No Y-values to render");let t=this.context,i=this.render_options.cp1,s=this.render_options.cp2;Math.abs(e.last_x_px-e.first_x_px)<10&&(i=2,s=8);let r=this.render_options.first_x_shift,n=this.render_options.last_x_shift,a=this.render_options.y_shift*e.direction;for(let o=0;o<this.first_indices.length;++o){let l=(e.last_x_px+n+(e.first_x_px+r))/2,h=e.first_ys[this.first_indices[o]]+a,u=e.last_ys[this.last_indices[o]]+a;if(isNaN(h)||isNaN(u))throw new w.RERR("BadArguments","Bad indices for tie rendering.");let c=(h+u)/2+i*e.direction,d=(h+u)/2+s*e.direction;
5t.beginPath(),t.moveTo(e.first_x_px+r,h),t.quadraticCurveTo(l,c,e.last_x_px+n,u),t.quadraticCurveTo(l,d,e.first_x_px+r,h),t.closePath(),t.fill()}}renderText(e,t){if(!this.text)return;let i=(e+t)/2;i-=this.context.measureText(this.text).width/2,this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.style),this.context.fillText(this.text,i+this.render_options.text_shift_x,(this.first_note||this.last_note).getStave().getYForTopText()-1),this.context.restore()}draw(){this.checkContext(),this.setRendered();let e=this.first_note,t=this.last_note,i,s,r,n,a;return e?(i=e.getTieRightX()+this.render_options.tie_spacing,a=e.getStemDirection(),r=e.getYs()):(i=t.getStave().getTieStartX(),r=t.getYs(),this.first_indices=this.last_indices),t?(s=t.getTieLeftX()+this.render_options.tie_spacing,a=t.getStemDirection(),n=t.getYs()):(s=e.getStave().getTieEndX(),n=e.getYs(),this.last_indices=this.first_indices),this.direction&&(a=this.direction),this.renderTie({first_x_px:i,last_x_px:s,first_ys:r,last_ys:n,direction:a}),this.renderText(i,s),!0}},Vn=class nn extends vr{static createHammeron(t){return new nn(t,"H")}static createPulloff(t){return new nn(t,"P")}constructor(t,i){super(t,i),this.setAttribute("type","TabTie"),this.render_options.cp1=9,this.render_options.cp2=11,this.render_options.y_shift=3,this.setNotes(t)}draw(){this.checkContext(),this.setRendered();let t=this.first_note,i=this.last_note,s,r,n,a;return t?(s=t.getTieRightX()+this.render_options.tie_spacing,n=t.getYs()):(s=i.getStave().getTieStartX(),n=i.getYs(),this.first_indices=this.last_indices),i?(r=i.getTieLeftX()+this.render_options.tie_spacing,a=i.getYs()):(r=t.getStave().getTieEndX(),a=t.getYs(),this.last_indices=this.first_indices),this.renderTie({first_x_px:s,last_x_px:r,first_ys:n,last_ys:a,direction:-1}),this.renderText(s,r),!0}};function Dh(...e){Mr.DEBUG&&w.L("Vex.Flow.GraceNoteGroup",e)}var Mr=class Ro extends St{static get CATEGORY(){return"gracenotegroups"}static format(t,i){if(!t||t.length===0)return!1;let s=[],r=null,n=0;for(let l=0;l<t.length;++l){let h=t[l],u=h.getNote(),c=u.getCategory()===me.CATEGORY,d=c?4:0;if(c&&u!==r){for(let f=0;f<u.keys.length;++f)n=u.getKeyProps()[f].displaced?u.getExtraLeftPx():n;r=u}s.push({shift:n,gracenote_group:h,spacing:d})}let a=s[0].shift,o;for(let l=0;l<s.length;++l){let h=s[l].gracenote_group;h.preFormat(),o=h.getWidth()+s[l].spacing,a=Math.max(o,a)}for(let l=0;l<s.length;++l){let h=s[l].gracenote_group;o=h.getWidth()+s[l].spacing,h.setSpacingFromNextModifier(a-Math.min(o,a))}return i.left_shift+=a,!0}constructor(t,i){return super(),this.setAttribute("type","GraceNoteGroup"),this.note=null,this.index=null,this.position=St.Position.LEFT,this.grace_notes=t,this.width=0,this.preFormatted=!1,this.show_slur=i,this.slur=null,this.formatter=new Ti,this.voice=new Qe({num_beats:4,beat_value:4,resolution:D.RESOLUTION}).setStrict(!1),this.render_options={slur_y_shift:0},this.beams=[],this.voice.addTickables(this.grace_notes),this}getCategory(){return Ro.CATEGORY}preFormat(){this.preFormatted||(this.formatter.joinVoices([this.voice]).format([this.voice],0),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}beamNotes(t){if(t=t||this.grace_notes,t.length>1){let i=new vs(t);i.render_options.beam_width=3,i.render_options.partial_beam_length=4,this.beams.push(i)}return this}setNote(t){this.note=t}setWidth(t){this.width=t}getWidth(){return this.width}getGraceNotes(){return this.grace_notes}draw(){this.checkContext();let t=this.getNote();if(Dh("Drawing grace note group for:",t),!(t&&this.index!==null))throw new w.RuntimeError("NoAttachedNote","Can't draw grace note without a parent note and parent note index.");if(this.setRendered(),this.alignSubNotesWithNote(this.getGraceNotes(),t),this.grace_notes.forEach(i=>{i.setContext(this.context).draw()}),this.beams.forEach(i=>{i.setContext(this.context).draw()}),this.show_slur){let i=this.getNote().getCategory()===me.CATEGORY,s=i?vr:Vn;this.slur=new s({last_note:this.grace_notes[0],first_note:t,first_indices:[0],last_indices:[0]}),this.slur.render_options.cp2=12,this.slur.render_options.y_shift=(i?7:5)+this.render_options.slur_y_shift,this.slur.setContext(this.context).draw()}}},Co=class _e extends St{static get CATEGORY(){return"strokes"}static get Type(){return{BRUSH_DOWN:1,BRUSH_UP:2,ROLL_DOWN:3,ROLL_UP:4,RASQUEDO_DOWN:5,RASQUEDO_UP:6,ARPEGGIO_DIRECTIONLESS:7}}static format(t,i){let s=i.left_shift;if(!t||t.length===0)return this;let r=t.map(o=>{let l=o.getNote();if(l instanceof me){let{line:h,displaced:u}=l.getKeyProps()[o.getIndex()];return{line:h,shift:u?l.getExtraLeftPx():0,stroke:o}}else{let{str:h}=l.getPositions()[o.getIndex()];return{line:h,shift:0,stroke:o}}}),n=s,a=r.reduce((o,{stroke:l,shift:h})=>(l.setXShift(n+h),Math.max(l.getWidth()+0,o)),0);return i.left_shift+=a,!0}constructor(t,i){super(),this.setAttribute("type","Stroke"),this.note=null,this.options=w.Merge({},i),this.all_voices="all_voices"in this.options?this.options.all_voices:!0,this.note_end=null,this.index=null,this.type=t,this.position=St.Position.LEFT,this.render_options={font_scale:38,stroke_px:3,stroke_spacing:10},this.font={family:"serif",size:10,weight:"bold italic"},this.setXShift(0),this.setWidth(10)}getCategory(){return _e.CATEGORY}getPosition(){return this.position}addEndNote(t){return this.note_end=t,this}draw(){if(this.checkContext(),this.setRendered(),!(this.note&&this.index!=null))throw new w.RERR("NoAttachedNote","Can't draw stroke without a note and index.");let t=this.note.getModifierStartXY(this.position,this.index),i=this.note.getYs(),s=t.y,r=t.y,n=t.x-5,a=this.note.stave.options.spacing_between_lines_px,o=this.getModifierContext().getModifiers(this.note.getCategory());for(let f=0;f<o.length;f++){i=o[f].getYs();for(let p=0;p<i.length;p++)(this.note===o[f]||this.all_voices)&&(s=w.Min(s,i[p]),r=w.Max(r,i[p]))}let l,h,u,c,d;switch(this.type){case _e.Type.BRUSH_DOWN:l="vc3",h=-3,u=s-a/2+10,r+=a/2;break;case _e.Type.BRUSH_UP:l="v11",h=.5,u=r+a/2,s-=a/2;break;case _e.Type.ROLL_DOWN:case _e.Type.RASQUEDO_DOWN:l="vc3",h=-3,c=this.x_shift+h-2,this.note instanceof me?(s+=1.5*a,(r-s)%2==0?r+=a:r+=.5*a,u=s-a,d=r+a+2):(s+=1.5*a,r+=a,u=s-.75*a,d=r+.25*a);break;case _e.Type.ROLL_UP:case _e.Type.RASQUEDO_UP:l="v52",h=-4,c=this.x_shift+h-1,this.note instanceof me?(u=a/2,s+=.5*a,(r-s)%2==0&&(r+=a/2),u=r+.5*a,d=s-1.25*a
5):(s+=.25*a,r+=.5*a,u=r+.25*a,d=s-a);break;case _e.Type.ARPEGGIO_DIRECTIONLESS:s+=.5*a,r+=a;break;default:throw new w.RERR("InvalidType",`The stroke type ${this.type} does not exist`)}if(this.type===_e.Type.BRUSH_DOWN||this.type===_e.Type.BRUSH_UP)this.context.fillRect(n+this.x_shift,s,1,r-s);else if(this.note instanceof me)for(let f=s;f<=r;f+=a)wt.renderGlyph(this.context,n+this.x_shift-4,f,this.render_options.font_scale,"va3");else{let f;for(f=s;f<=r;f+=10)wt.renderGlyph(this.context,n+this.x_shift-4,f,this.render_options.font_scale,"va3");this.type===_e.Type.RASQUEDO_DOWN&&(d=f+.25*a)}this.type!==_e.Type.ARPEGGIO_DIRECTIONLESS&&(wt.renderGlyph(this.context,n+this.x_shift+h,u,this.render_options.font_scale,l),(this.type===_e.Type.RASQUEDO_DOWN||this.type===_e.Type.RASQUEDO_UP)&&(this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight),this.context.fillText("R",n+c,d),this.context.restore()))}},Gn=class No extends St{static get CATEGORY(){return"stringnumber"}static format(t,i){let s=i.left_shift,r=i.right_shift;if(!t||t.length===0)return this;let n=[],a=null,o=0,l=0,h,u,c,d,f;for(h=0;h<t.length;++h)for(u=t[h],c=u.getNote(),h=0;h<t.length;++h){u=t[h],c=u.getNote(),d=u.getPosition();let E=c.getKeyProps()[u.getIndex()];if(c!==a){for(let y=0;y<c.keys.length;++y)f=c.getKeyProps()[y],s===0&&(o=f.displaced?c.getExtraLeftPx():o),r===0&&(l=f.displaced?c.getExtraRightPx():l);a=c}n.push({pos:d,note:c,num:u,line:E.line,shiftL:o,shiftR:l})}n.sort((E,y)=>y.line-E.line);let p=0,m=0,g=0,b=null,S=null;for(h=0;h<n.length;++h){let E=0;c=n[h].note,d=n[h].pos,u=n[h].num;let y=n[h].line,M=n[h].shiftL,P=n[h].shiftR;(y!==b||c!==S)&&(s+M,p=r+P);let L=u.getWidth()+1;d===St.Position.LEFT?(u.setXShift(s),E=o+L,m=E>m?E:m):d===St.Position.RIGHT&&(u.setXShift(p),E+=L,g=E>g?E:g),b=y,S=c}return i.left_shift+=m,i.right_shift+=g,!0}constructor(t){super(),this.setAttribute("type","StringNumber"),this.note=null,this.last_note=null,this.index=null,this.string_number=t,this.setWidth(20),this.position=St.Position.ABOVE,this.x_shift=0,this.y_shift=0,this.x_offset=0,this.y_offset=0,this.dashed=!0,this.leg=ke.LineEndType.NONE,this.radius=8,this.font={family:"sans-serif",size:10,weight:"bold"}}getCategory(){return No.CATEGORY}getNote(){return this.note}setNote(t){return this.note=t,this}getIndex(){return this.index}setIndex(t){return this.index=t,this}setLineEndType(t){return t>=ke.LineEndType.NONE&&t<=ke.LineEndType.DOWN&&(this.leg=t),this}setStringNumber(t){return this.string_number=t,this}setOffsetX(t){return this.x_offset=t,this}setOffsetY(t){return this.y_offset=t,this}setLastNote(t){return this.last_note=t,this}setDashed(t){return this.dashed=t,this}draw(){let t=this.checkContext();if(!(this.note&&this.index!=null))throw new w.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();let i=this.note.stave.options.spacing_between_lines_px,s=this.note.getModifierStartXY(this.position,this.index),r=s.x+this.x_shift+this.x_offset,n=s.y+this.y_shift+this.y_offset;switch(this.position){case St.Position.ABOVE:case St.Position.BELOW:{let o=this.note.getStemExtents(),l=o.topY,h=o.baseY+2;this.note.stem_direction===me.STEM_DOWN&&(l=o.baseY,h=o.topY-2),n=this.position===St.Position.ABOVE?this.note.hasStem()?l-i*1.75:s.y-i*1.75:this.note.hasStem()?h+i*1.5:s.y+i*1.75,n+=this.y_shift+this.y_offset;break}case St.Position.LEFT:r-=this.radius/2+5;break;case St.Position.RIGHT:r+=this.radius/2+6;break;default:throw new w.RERR("InvalidPosition",`The position ${this.position} is invalid`)}t.save(),t.beginPath(),t.arc(r,n,this.radius,0,Math.PI*2,!1),t.lineWidth=1.5,t.stroke(),t.setFont(this.font.family,this.font.size,this.font.weight);let a=r-t.measureText(this.string_number).width/2;if(t.fillText(""+this.string_number,a,n+4.5),this.last_note!=null){let o=this.last_note.getStemX()-this.note.getX()+5;t.strokeStyle="#000000",t.lineCap="round",t.lineWidth=.6,this.dashed?ke.drawDashedLine(t,r+10,n,r+o,n,[3,3]):ke.drawDashedLine(t,r+10,n,r+o,n,[3,0]);let l,h;switch(this.leg){case ke.LineEndType.UP:l=-10,h=this.dashed?[3,3]:[3,0],ke.drawDashedLine(t,r+o,n,r+o,n+l,h);break;case ke.LineEndType.DOWN:l=10,h=this.dashed?[3,3]:[3,0],ke.drawDashedLine(t,r+o,n,r+o,n+l,h);break;default:break}}
5t.restore()}};function Oh(...e){Ns.DEBUG&&w.L("Vex.Flow.Articulation",e)}var{ABOVE:Ii,BELOW:cs}=St.Position,Io=(e,t)=>e(t/.5)*.5,Wn=(e,t)=>t===Ii?e<=5:e>=1,Bo=(e,t)=>Wn(e,t)?t===Ii?Math.ceil:Math.floor:Math.round,Vh=(e,t,i,s)=>{let r=Io(Bo(t,i),t),n=e&&Wn(r,i),a=r%1==0;return n&&a?r+.5*-s:r},Un=e=>{let t=e.getCategory();return t==="stavenotes"||t==="gracenotes"},Gh=(e,t)=>{let i=e.getStave(),s=e.getStemDirection(),{topY:r,baseY:n}=e.getStemExtents();if(Un(e))return e.hasStem()?s===gt.UP?r:n:Math.min(...e.getYs());if(e.getCategory()==="tabnotes")return e.hasStem()&&s===gt.UP?r:i.getYForTopText(t);throw new w.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},Wh=(e,t)=>{let i=e.getStave(),s=e.getStemDirection(),{topY:r,baseY:n}=e.getStemExtents();if(Un(e))return e.hasStem()?s===gt.UP?n:r:Math.max(...e.getYs());if(e.getCategory()==="tabnotes")return e.hasStem()?s===gt.UP?i.getYForBottomText(t):r:i.getYForBottomText(t);throw new w.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},Uh=(e,t)=>{let i=t===Ii&&e.getStemDirection()===gt.UP||t===cs&&e.getStemDirection()===gt.DOWN;return Un(e)?e.hasStem()&&i?.5:1:e.hasStem()&&i?1:0},Ns=class Ys extends St{static get CATEGORY(){return"articulations"}static get INITIAL_OFFSET(){return-.5}static format(t,i){if(!t||t.length===0)return!1;let s=o=>o.getPosition()===Ii,r=o=>o.getPosition()===cs,n=(o,l,h)=>Io(Bo(l,h),o.glyph.getMetrics().height/10+.5);t.filter(s).forEach(o=>{o.setTextLine(i.top_text_line),i.top_text_line+=n(o,i.top_text_line,Ii)}),t.filter(r).forEach(o=>{o.setTextLine(i.text_line),i.text_line+=n(o,i.text_line,cs)});let a=t.map(o=>o.getWidth()).reduce((o,l)=>Math.max(l,o));return i.left_shift+=a/2,i.right_shift+=a/2,!0}static easyScoreHook({articulations:t},i,s){if(!t)return;let r={staccato:"a.",tenuto:"a-"};t.split(",").map(n=>n.trim().split(".")).map(([n,a])=>{let o={type:r[n]};return a&&(o.position=St.PositionString[a]),s.getFactory().Articulation(o)}).map(n=>i.addModifier(0,n))}constructor(t){if(super(),this.setAttribute("type","Articulation"),this.note=null,this.index=null,this.type=t,this.position=cs,this.render_options={font_scale:38},this.articulation=D.articulationCodes(this.type),!this.articulation)throw new w.RERR("ArgumentError",`Articulation not found: ${this.type}`);this.glyph=new wt(this.articulation.code,this.render_options.font_scale),this.setWidth(this.glyph.getMetrics().width)}getCategory(){return Ys.CATEGORY}draw(){let{note:t,index:i,position:s,glyph:r,articulation:{between_lines:n},text_line:a,context:o}=this;if(this.checkContext(),!t||i==null)throw new w.RERR("NoAttachedNote","Can't draw Articulation without a note and index.");this.setRendered();let l=t.getStave(),h=l.getSpacingBetweenLines(),u=t.getCategory()==="tabnotes",{x:c}=t.getModifierStartXY(s,i),d=!n||u,f=Uh(t,s),p={[Ii]:()=>{r.setOrigin(.5,1);let m=Gh(t,a)-(a+f)*h;return d?Math.min(l.getYForTopText(Ys.INITIAL_OFFSET),m):m},[cs]:()=>{r.setOrigin(.5,0);let m=Wh(t,a)+(a+f)*h;return d?Math.max(l.getYForBottomText(Ys.INITIAL_OFFSET),m):m}}[s]();if(!u){let m=s===Ii?-1:1,g=u?t.positions[i].str:t.getKeyProps()[i].line,b=(t.getYs()[i]-p)/h+g,S=Vh(n,b,s,m);Wn(S,s)&&r.setOrigin(.5,.5),p+=Math.abs(S-b)*h*m}Oh(`Rendering articulation at (x: ${c}, y: ${p})`),r.render(o,c,p)}},$i=class extends To{static getNextContext(e){let t=e.tContexts;return t[t.indexOf(e)+1]}constructor(){super(),this.setAttribute("type","TickContext"),this.currentTick=new ie(0,1),this.maxTicks=new ie(0,1),this.minTicks=null,this.padding=3,this.x=0,this.xBase=0,this.xOffset=0,this.tickables=[],this.notePx=0,this.extraLeftPx=0,this.extraRightPx=0,this.tContexts=[]}getX(){return this.x}setX(e){return this.x=e,this.xBase=e,this.xOffset=0,this}getXBase(){return this.xBase}setXBase(e){this.xBase=e,this.x=e+this.xOffset}getXOffset(){return this.xOffset}setXOffset(e){this.xOffset=e,this.x=this.xBase+e}getWidth(){return this.width+this.padding*2}setPadding(e){return this.padding=e,this}getMaxTicks(){return this.maxTicks}getMinTicks(){return this.minTicks}getTickables(){return this.tickables}getCenterAlignedTickables(){return this.tickables.filter(e=>e.isCenterAligned())}getMetrics(){let{width:e,notePx:t,extraLeftPx:i,extraRightPx:s}=this;return{width:e,notePx:t,extraLeftPx:i,extraRightPx:s}}getCurrentTick(){return this.currentTick}setCurrentTick(e){this.currentTick=e,this.preFormatted=!1}getExtraPx(){let e=0,t=0,i=0,s=0;for(let r=0;r<this.tickables.length;r++){i=Math.max(this.tickables[r].extraLeftPx||0,i),s=Math.max(this.tickables[r].extraRightPx||0,s);let n=this.tickables[r].modifierContext;n&&n!=null&&(e=Math.max(e,n.state.left_shift),t=Math.max(t,n.state.right_shift))}return{left:e,right:t,extraLeft:i,extraRight:s}}addTickable(e){if(!e)throw new w.RERR("BadArgument","Invalid tickable added.");if(!e.shouldIgnoreTicks()){this.ignore_ticks=!1;let t=e.getTicks();t.greaterThan(this.maxTicks)&&(this.maxTicks=t.clone()),(this.minTicks==null||t.lessThan(this.minTicks))&&(this.minTicks=t.clone())}return e.setTickContext(this),this.tickables.push(e),this.preFormatted=!1,this}preFormat(){if(this.preFormatted)return this;for(let e=0;e<this.tickables.length;++e){let t=this.tickables[e];t.preFormat();let i=t.getMetrics();this.extraLeftPx=Math.max(this.extraLeftPx,i.extraLeftPx+i.modLeftPx),this.extraRightPx=Math.max(this.extraRightPx,i.extraRightPx+i.modRightPx),this.notePx=Math.max(this.notePx,i.noteWidth),this.width=this.notePx+this.extraLeftPx+this.extraRightPx}return this}postFormat(){return this.postFormatted||(this.postFormatted=!0),this}};function zh(...e){zn.DEBUG&&w.L("Vex.Flow.Ornament",e)}var zn=class ko extends St{static get CATEGORY(){return"ornaments"}static format(t,i){if(!t||t.length===0)return!1;let s=0;for(let r=0;r<t.length;++r){let n=t[r];s=Math.max(n.getWidth(),s),n.getPosition()===St.Position.ABOVE?(n.setTextLine(i.top_text_line),i.top_text_line+=2):(n.setTextLine(i.text_line),i.text_line+=2)}return i.left_shift+=s/2,i.right_shift+=s/2,!0}constructor(t){if(super(),this.setAttribute("type","Ornament"),this.note=null,this.index=null,this.type=t,this.position=St.Position.ABOVE,this.delayed=!1,this.accidentalUpper=null,this.accidentalLower=null,this.render_options={font_scale:38,accidentalLowerPadding:3,accidentalUpperPadding:3},this.ornament=D.ornamentCodes(this.type),!this.ornament)throw new w.RERR("ArgumentError",`Ornament not found: '${this.type}'`);this.glyph=new wt(this.ornament.code,this.render_options.font_scale),this.glyph.setOrigin(.5,1)}getCategory(){return ko.CATEGORY}setDelayed(t){return this.delayed=t,this}setUpperAccidental(t){let i=this.render_options.font_scale/1.3;return this.accidentalUpper=new wt(D.accidentalCodes(t).code,i),this.accidentalUpper.setOrigin(.5,1),this}setLowerAccidental(t){let i=this.render_options.font_scale/1.3;return this.accidentalLower=new wt(D.accidentalCodes(t).code,i),this.accidentalLower.setOrigin(.5,1),this}draw(){if(this.checkContext(),!this.note||this.index==null)throw new w.RERR("NoAttachedNote","Can't draw Ornament without a note and index.");this.setRendered();let t=this.context,i=this.note.getStemDirection(),s=this.note.getStave(),r=this.note.getStem().getExtents(),n=i===me.STEM_DOWN?r.baseY:r.topY;this.note.getCategory()==="tabnotes"&&(this.note.hasStem()?i===me.STEM_DOWN&&(n=s.getYForTopText(this.text_line)):n=s.getYForTopText(this.text_line));
5let a=i===me.STEM_DOWN,o=s.getSpacingBetweenLines(),l=1;!a&&this.note.beam&&(l+=.5);let h=o*(this.text_line+l),u=n-h,c=this.note.getModifierStartXY(this.position,this.index).x,d=Math.min(s.getYForTopText(this.text_line),u);if(d+=this.y_shift,this.delayed){let f=0;if(this.delayXShift!==void 0)f=this.delayXShift;else{f+=this.glyph.getMetrics().width/2;let p=$i.getNextContext(this.note.getTickContext());p?f+=(p.getX()-c)*.5:f+=(s.x+s.width-c)*.5,this.delayXShift=f}c+=f}zh("Rendering ornament: ",this.ornament,c,d),this.accidentalLower&&(this.accidentalLower.render(t,c,d),d-=this.accidentalLower.getMetrics().height,d-=this.render_options.accidentalLowerPadding),this.glyph.render(t,c,d),d-=this.glyph.getMetrics().height,this.accidentalUpper&&(d-=this.render_options.accidentalUpperPadding,this.accidentalUpper.render(t,c,d))}};function Hh(...e){wr.DEBUG&&w.L("Vex.Flow.Annotation",e)}var wr=class le extends St{static get CATEGORY(){return"annotations"}static get Justify(){return{LEFT:1,CENTER:2,RIGHT:3,CENTER_STEM:4}}static get JustifyString(){return{left:le.Justify.LEFT,right:le.Justify.RIGHT,center:le.Justify.CENTER,centerStem:le.Justify.CENTER_STEM}}static get VerticalJustify(){return{TOP:1,CENTER:2,BOTTOM:3,CENTER_STEM:4}}static get VerticalJustifyString(){return{above:le.VerticalJustify.TOP,top:le.VerticalJustify.TOP,below:le.VerticalJustify.BOTTOM,bottom:le.VerticalJustify.BOTTOM,center:le.VerticalJustify.CENTER,centerStem:le.VerticalJustify.CENTER_STEM}}static format(t,i){if(!t||t.length===0)return!1;let s=0;for(let r=0;r<t.length;++r){let n=t[r];s=Math.max(n.getWidth(),s),n.getPosition()===St.Position.ABOVE?(n.setTextLine(i.top_text_line),i.top_text_line++):(n.setTextLine(i.text_line),i.text_line++)}return i.left_shift+=s/2,i.right_shift+=s/2,!0}constructor(t){super(),this.setAttribute("type","Annotation"),this.note=null,this.index=null,this.text=t,this.justification=le.Justify.CENTER,this.vert_justification=le.VerticalJustify.TOP,this.font={family:"Arial",size:10,weight:""},this.setWidth(D.textWidth(t))}getCategory(){return le.CATEGORY}setFont(t,i,s){return this.font={family:t,size:i,weight:s},this}setVerticalJustification(t){return this.vert_justification=typeof t=="string"?le.VerticalJustifyString[t]:t,this}getJustification(){return this.justification}setJustification(t){return this.justification=typeof t=="string"?le.JustifyString[t]:t,this}draw(){if(this.checkContext(),!this.note)throw new w.RERR("NoNoteForAnnotation","Can't draw text annotation without an attached note.");this.setRendered();let t=this.note.getModifierStartXY(St.Position.ABOVE,this.index);this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);let i=this.context.measureText(this.text).width,s=this.context.measureText("m").width,r,n;r=this.justification===le.Justify.LEFT?t.x:this.justification===le.Justify.RIGHT?t.x-i:this.justification===le.Justify.CENTER?t.x-i/2:this.note.getStemX()-i/2;let a,o,l=this.note.hasStem(),h=this.note.getStave();if(l&&(a=this.note.getStem().getExtents(),o=h.getSpacingBetweenLines()),this.vert_justification===le.VerticalJustify.BOTTOM){if(n=h.getYForBottomText(this.text_line+D.TEXT_HEIGHT_OFFSET_HACK),l){let u=this.note.getStemDirection()===1?a.baseY:a.topY;n=Math.max(n,u+o*(this.text_line+2))}}else if(this.vert_justification===le.VerticalJustify.CENTER){let u=this.note.getYForTopText(this.text_line)-1;n=u+(h.getYForBottomText(this.text_line)-u)/2+s/2}else if(this.vert_justification===le.VerticalJustify.TOP)n=Math.min(h.getYForTopText(this.text_line),this.note.getYs()[0]-10),l&&(n=Math.min(n,a.topY-5-o*this.text_line));else{let u=this.note.getStemExtents();n=u.topY+(u.baseY-u.topY)/2+s/2}Hh("Rendering annotation: ",this.text,r,n),this.context.fillText(this.text,r,n),this.context.restore()}},Hn=class Xe extends St{static get CATEGORY(){return"bends"}static get UP(){return 0}static get DOWN(){return 1}static format(t,i){if(!t||t.length===0)return!1;let s=0,r=i.top_text_line;for(let n=0;n<t.length;++n){let a=t[n];a.setXShift(s),s=a.getWidth(),a.setTextLine(r)}return i.right_shift+=s,i.top_text_line+=1,!0}constructor(t,i,s){super(),this.setAttribute("type","Bend"),this.text=t,this.x_shift=0,this.release=i||!1,this.font="10pt Arial",this.render_options={line_width:1.5,line_style:"#777777",bend_width:8,release_width:8},s?this.phrase=s:(this.phrase=[{type:Xe.UP,text:this.text}],this.release&&this.phrase.push({type:Xe.DOWN,text:""})),this.updateWidth()}getCategory(){return Xe.CATEGORY}setXShift(t){this.x_shift=t,this.updateWidth()}setFont(t){return this.font=t,this}getText(){return this.text}updateWidth(){let t=this;function i(r){let n;return n=t.context?t.context.measureText(r).width:D.textWidth(r),n}let s=0;for(let r=0;r<this.phrase.length;++r){let n=this.phrase[r];if("width"in n)s+=n.width;else{let a=n.type===Xe.UP?this.render_options.bend_width:this.render_options.release_width;n.width=w.Max(a,i(n.text))+3,n.draw_width=n.width/2,s+=n.width}}return this.setWidth(s+this.x_shift),this}draw(){if(this.checkContext(),!(this.note&&this.index!=null))throw new w.RERR("NoNoteForBend","Can't draw bend without a note or index.");this.setRendered();let t=this.note.getModifierStartXY(St.Position.RIGHT,this.index);t.x+=3,t.y+=.5;let i=this.x_shift,s=this.context,r=this.note.getStave().getYForTopText(this.text_line)+3,n=this.note.getStave().getYForTopText(this.text_line)-1,a=this;function o(f,p,m,g){let b=f+m,S=p;s.save(),s.beginPath(),s.setLineWidth(a.render_options.line_width),s.setStrokeStyle(a.render_options.line_style),s.setFillStyle(a.render_options.line_style),s.moveTo(f,p),s.quadraticCurveTo(b,S,f+m,g),s.stroke(),s.restore(
5)}function l(f,p,m,g){s.save(),s.beginPath(),s.setLineWidth(a.render_options.line_width),s.setStrokeStyle(a.render_options.line_style),s.setFillStyle(a.render_options.line_style),s.moveTo(f,g),s.quadraticCurveTo(f+m,g,f+m,p),s.stroke(),s.restore()}function h(f,p,m){let g=m||1;s.beginPath(),s.moveTo(f,p),s.lineTo(f-4,p+4*g),s.lineTo(f+4,p+4*g),s.closePath(),s.fill()}function u(f,p){s.save(),s.setRawFont(a.font);let m=f-s.measureText(p).width/2;s.fillText(p,m,n),s.restore()}let c=null,d=0;for(let f=0;f<this.phrase.length;++f){let p=this.phrase[f];f===0&&(p.draw_width+=i),d=p.draw_width+(c?c.draw_width:0)-(f===1?i:0),p.type===Xe.UP&&(c&&c.type===Xe.UP&&h(t.x,r),o(t.x,t.y,d,r)),p.type===Xe.DOWN&&(c&&c.type===Xe.UP&&l(t.x,t.y,d,r),c&&c.type===Xe.DOWN&&(h(t.x,t.y,-1),l(t.x,t.y,d,r)),c===null&&(d=p.draw_width,l(t.x,t.y,d,r))),u(t.x+d,p.text),c=p,c.x=t.x,t.x+=d}c.type===Xe.UP?h(c.x+d,r):c.type===Xe.DOWN&&h(c.x+d,t.y,-1)}},Xn=class an extends St{static get CATEGORY(){return"vibratos"}static format(t,i,s){if(!t||t.length===0)return!1;let r=i.top_text_line,n=0,a=i.right_shift-7,o=s.getModifiers(Hn.CATEGORY);o&&o.length>0&&r--;for(let l=0;l<t.length;++l){let h=t[l];h.setXShift(a),h.setTextLine(r),n+=h.getWidth(),a+=n}return i.right_shift+=n,i.top_text_line+=1,!0}constructor(){super(),this.setAttribute("type","Vibrato"),this.position=St.Position.RIGHT,this.render_options={harsh:!1,vibrato_width:20,wave_height:6,wave_width:4,wave_girth:2},this.setVibratoWidth(this.render_options.vibrato_width)}getCategory(){return an.CATEGORY}setHarsh(t){return this.render_options.harsh=t,this}setVibratoWidth(t){return this.render_options.vibrato_width=t,this.setWidth(t),this}draw(){let t=this.checkContext();if(!this.note)throw new w.RERR("NoNoteForVibrato","Can't draw vibrato without an attached note.");this.setRendered();let i=this.note.getModifierStartXY(St.Position.RIGHT,this.index).x+this.x_shift,s=this.note.getYForTopText(this.text_line)+2;an.renderVibrato(t,i,s,this.render_options)}static renderVibrato(t,i,s,r){let{harsh:n,vibrato_width:a,wave_width:o,wave_girth:l,wave_height:h}=r,u=a/o;t.beginPath();let c;if(n){for(t.moveTo(i,s+l+1),c=0;c<u/2;++c)t.lineTo(i+o,s-h/2),i+=o,t.lineTo(i+o,s+h/2),i+=o;for(c=0;c<u/2;++c)t.lineTo(i-o,s-h/2+l+1),i-=o,t.lineTo(i-o,s+h/2+l+1),i-=o;t.fill()}else{for(t.moveTo(i,s+l),c=0;c<u/2;++c)t.quadraticCurveTo(i+o/2,s-h/2,i+o,s),i+=o,t.quadraticCurveTo(i+o/2,s+h/2,i+o,s),i+=o;for(c=0;c<u/2;++c)t.quadraticCurveTo(i-o/2,s+h/2+l,i-o,s+l),i-=o,t.quadraticCurveTo(i-o/2,s-h/2+l,i-o,s+l),i-=o;t.fill()}}};function _a(...e){Ms.DEBUG&&w.L("Vex.Flow.ModifierContext",e)}var Ms=class{constructor(){this.modifiers={},this.preFormatted=!1,this.postFormatted=!1,this.width=0,this.spacing=0,this.state={left_shift:0,right_shift:0,text_line:0,top_text_line:0},this.PREFORMAT=[me,xr,Dn,Er,Co,Mr,On,Gn,Ns,zn,wr,Hn,Xn],this.POSTFORMAT=[me]}addModifier(e){let t=e.getCategory();return this.modifiers[t]||(this.modifiers[t]=[]),this.modifiers[t].push(e),e.setModifierContext(this),this.preFormatted=!1,this}getModifiers(e){return this.modifiers[e]}getWidth(){return this.width}getExtraLeftPx(){return this.state.left_shift}getExtraRightPx(){return this.state.right_shift}getState(){return this.state}getMetrics(){if(!this.formatted)throw new w.RERR("UnformattedModifier","Unformatted modifier has no metrics.");return{width:this.state.left_shift+this.state.right_shift+this.spacing,spacing:this.spacing,extra_left_px:this.state.left_shift,extra_right_px:this.state.right_shift}}preFormat(){this.preFormatted||(this.PREFORMAT.forEach(e=>{_a("Preformatting ModifierContext: ",e.CATEGORY),e.format(this.getModifiers(e.CATEGORY),this.state,this)}),this.width=this.state.left_shift+this.state.right_shift,this.preFormatted=!0)}postFormat(){this.postFormatted||this.POSTFORMAT.forEach(e=>{_a("Postformatting ModifierContext: ",e.CATEGORY),e.postFormat(this.getModifiers(e.CATEGORY),this)})}};function Xh(...e){Ti.DEBUG&&w.L("Vex.Flow.Formatter",e)}function Aa(e,t,i,s){let r=t;for(i+=1;i<e.length;i+=1){let n=e[i];if(!n.isRest()&&!n.shouldIgnoreTicks()){r=n.getLineForRest();break}}if(s&&t!==r){let n=Math.max(t,r),a=Math.min(t,r);r=w.MidLine(n,a)}return r}function Ra(e,t,i){if(!e||!e.length)throw new w.RERR("BadArgument","No voices to format");let s=e[0].getTotalTicks(),r=e.reduce((l,h)=>
5{if(!h.getTotalTicks().equals(s))throw new w.RERR("TickMismatch","Voices should have same total note duration in ticks.");if(h.getMode()===Qe.Mode.STRICT&&!h.isComplete())throw new w.RERR("IncompleteVoice","Voice does not have enough notes.");return Math.max(l,ie.LCM(l,h.getResolutionMultiplier()))},1),n={},a=[],o=[];return e.forEach(l=>{let h=new ie(0,r);l.getTickables().forEach(u=>{let c=h.numerator;if(!n[c]){let d=new t;o.push(d),n[c]=d}i(u,n[c]),a.push(c),h.add(u.getTicks())})}),{map:n,array:o,list:w.SortAndUnique(a,(l,h)=>l-h,(l,h)=>l===h),resolutionMultiplier:r}}var Ti=class js{static SimpleFormat(t,i=0,{paddingBetween:s=10}={}){t.reduce((r,n)=>{n.addToModifierContext(new Ms);let a=new $i().addTickable(n).preFormat(),o=a.getExtraPx();return a.setX(r+o.left),r+a.getWidth()+o.right+s},i)}static plotDebugging(t,i,s,r,n){let a=s+ze.STAVEPADDING,o=i.contextGaps;function l(h,u,c){t.beginPath(),t.setStrokeStyle(c),t.setFillStyle(c),t.setLineWidth(1),t.fillRect(h,r,u-h,n-r)}t.save(),t.setFont("Arial",8,""),o.gaps.forEach(h=>{l(a+h.x1,a+h.x2,"#aaa"),t.fillText(Math.round(h.x2-h.x1),a+h.x1,n+12)}),t.fillText(Math.round(o.total)+"px",a-20,n+12),t.setFillStyle("red"),t.fillText("Loss: "+i.lossHistory.map(h=>Math.round(h)),a-20,n+22),t.restore()}static FormatAndDraw(t,i,s,r){let n={auto_beam:!1,align_rests:!1};typeof r=="object"?w.Merge(n,r):typeof r=="boolean"&&(n.auto_beam=r);let a=new Qe(D.TIME4_4).setMode(Qe.Mode.SOFT).addTickables(s),o=n.auto_beam?vs.applyAndGetBeams(a):[];return new js().joinVoices([a],{align_rests:n.align_rests}).formatToStave([a],i,{align_rests:n.align_rests,stave:i}),a.setStave(i).draw(t,i),o.forEach(l=>l.setContext(t).draw()),a.getBoundingBox()}static FormatAndDrawTab(t,i,s,r,n,a,o){let l={auto_beam:a,align_rests:!1};typeof o=="object"?w.Merge(l,o):typeof o=="boolean"&&(l.auto_beam=o);let h=new Qe(D.TIME4_4).setMode(Qe.Mode.SOFT).addTickables(n),u=new Qe(D.TIME4_4).setMode(Qe.Mode.SOFT).addTickables(r),c=l.auto_beam?vs.applyAndGetBeams(h):[];new js().joinVoices([h],{align_rests:l.align_rests}).joinVoices([u]).formatToStave([h,u],s,{align_rests:l.align_rests}),h.draw(t,s),u.draw(t,i),c.forEach(d=>d.setContext(t).draw()),new Ki(s,i).setContext(t).draw()}static AlignRestsToNotes(t,i,s){return t.forEach((r,n)=>{if(r instanceof me&&r.isRest()){if(r.tuplet&&!s)return;let a=r.getGlyph().position.toUpperCase();if(a!=="R/4"&&a!=="B/4")return;if(i||r.beam!=null){let o=r.getKeyProps()[0];if(n===0)o.line=Aa(t,o.line,n,!1),r.setKeyLine(0,o.line);else if(n>0&&n<t.length){let l;t[n-1].isRest()?(l=t[n-1].getKeyProps()[0].line,o.line=l):(l=t[n-1].getLineForRest(),o.line=Aa(t,l,n,!0)),r.setKeyLine(0,o.line)}}}}),this}constructor(){this.minTotalWidth=0,this.hasMinTotalWidth=!1,this.totalTicks=new ie(0,1),this.tickContexts=null,this.modiferContexts=null,this.contextGaps={total:0,gaps:[]},this.voices=[]}alignRests(t,i){if(!t||!t.length)throw new w.RERR("BadArgument","No voices to format rests");t.forEach(s=>js.AlignRestsToNotes(s.getTickables(),i))}preCalculateMinTotalWidth(t){if(this.hasMinTotalWidth)return this.minTotalWidth;if(!this.tickContexts){if(!t)throw new w.RERR("BadArgument","'voices' required to run preCalculateMinTotalWidth");this.createTickContexts(t)}let{list:i,map:s}=this.tickContexts;return this.minTotalWidth=i.map(r=>{let n=s[r];return n.preFormat(),n.getWidth()}).reduce((r,n)=>r+n,0),this.hasMinTotalWidth=!0,this.minTotalWidth}getMinTotalWidth(){if(!this.hasMinTotalWidth)throw new w.RERR("NoMinTotalWidth","Call 'preCalculateMinTotalWidth' or 'preFormat' before calling 'getMinTotalWidth'");return this.minTotalWidth}createModifierContexts(t){let i=Ra(t,Ms,(s,r)=>s.addToModifierContext(r));return this.modiferContexts=i,i}createTickContexts(t){let i=Ra(t,$i,(s,r)=>r.addTickable(s));return i.array.forEach(s=>{s.tContexts=i.array}),this.totalTicks=t[0].getTicksUsed().clone(),this.tickContexts=i,i}preFormat(t=0,i,s,r){let{list:n,map:a,resolutionMultiplier:o}=this.tickContexts;s&&r&&s.forEach(f=>f.setStave(r).preFormat());let l=0,h=0,u=t/2;if(this.minTotalWidth=0,n.forEach(f=>{let p=a[f];i&&p.setContext(i),p.preFormat();let m=p.getWidth();this.minTotalWidth+=m;let g=p.getMetrics();l=l+h+g.extraLeftPx,p.setX(l),h=m-g.extraLeftPx}),this.minTotalWidth=l+h,this.hasMinTotalWidth=!0,t<=0)return;let c=(t-this.minTotalWidth)/(this.totalTicks.value()*o),d=0;
5n.forEach((f,p)=>{let m=n[p-1]||0,g=a[f],b=(f-m)*c;d+=b,g.setX(g.getX()+d),g.getCenterAlignedTickables().forEach(S=>{S.center_x_shift=u-g.getX()})}),n.length!==1&&(this.justifyWidth=t,this.lossHistory=[],this.evaluate())}evaluate(){let t=this.justifyWidth;this.contextGaps={total:0,gaps:[]},this.tickContexts.list.forEach((n,a)=>{if(a===0)return;let o=this.tickContexts.list[a-1],l=this.tickContexts.map[o],h=this.tickContexts.map[n],u=l.getMetrics(),c=l.getX()+u.width,d=h.getX(),f=d-c;this.contextGaps.total+=f,this.contextGaps.gaps.push({x1:c,x2:d}),h.getFormatterMetrics().freedom.left=f,l.getFormatterMetrics().freedom.right=f});let i=this.durationStats={};function s(n,a){let o=i[n];o===void 0?i[n]={mean:a,count:1}:(o.count+=1,o.mean=(o.mean+a)/2)}this.voices.forEach(n=>{n.getTickables().forEach((a,o,l)=>{let h=a.getTicks().clone().simplify().toString(),u=a.getMetrics(),c=a.getFormatterMetrics(),d=a.getX()+u.noteWidth+u.modRightPx+u.extraRightPx,f=0;if(o<l.length-1){let p=l[o+1],m=p.getMetrics();f=p.getX()-m.modLeftPx-m.extraLeftPx-d,c.space.used=p.getX()-a.getX(),p.getFormatterMetrics().freedom.left=f}else f=t-d,c.space.used=t-a.getX();c.freedom.right=f,s(h,c.space.used)})});let r=0;return this.voices.forEach(n=>
5{n.getTickables().forEach(a=>{let o=a.getTicks().clone().simplify().toString(),l=a.getFormatterMetrics();l.iterations+=1,l.space.deviation=l.space.used-i[o].mean,l.duration=o,l.space.mean=i[o].mean,r+=i[o].mean**2})}),this.totalCost=Math.sqrt(r),this.lossHistory.push(this.totalCost),this}tune(){let t=r=>r.reduce((n,a)=>n+a);function i(r,n,a,o){r.setX(r.getX()+o),r.getFormatterMetrics().freedom.left+=o,r.getFormatterMetrics().freedom.right-=o,n&&(n.getFormatterMetrics().freedom.right+=o),a&&(a.getFormatterMetrics().freedom.left-=o)}let s=0;return this.tickContexts.list.forEach((r,n,a)=>{let o=this.tickContexts.map[r],l=n>0?this.tickContexts.map[a[n-1]]:null,h=n<a.length-1?this.tickContexts.map[a[n+1]]:null;i(o,l,h,s);let u=-t(o.getTickables().map(d=>d.getFormatterMetrics().space.deviation));u>0?s=-Math.min(o.getFormatterMetrics().freedom.right,Math.abs(u)):u<0&&(s=h?Math.min(h.getFormatterMetrics().freedom.right,Math.abs(u)):0);let c=Math.min(5,Math.abs(s));s=s>0?c:-c}),this.evaluate()}postFormat(){let t=i=>i.list.forEach(s=>i.map[s].postFormat());return t(this.modiferContexts),t(this.tickContexts),this}joinVoices(t){return this.createModifierContexts(t),this.hasMinTotalWidth=!1,this}format(t,i,s){let r={align_rests:!1,context:null,stave:null};return w.Merge(r,s),this.voices=t,this.alignRests(t,r.align_rests),this.createTickContexts(t),this.preFormat(i,r.context,t,r.stave),r.stave&&this.postFormat(),this}formatToStave(t,i,s){let r=i.getNoteEndX()-i.getNoteStartX()-10;Xh("Formatting voices to width: ",r);let n={context:i.getContext()};return w.Merge(n,s),this.format(t,r,n)}},Ot=class Fo extends fe{static get Position(){return{LEFT:1,RIGHT:2,ABOVE:3,BELOW:4,BEGIN:5,END:6}}constructor(){super(),this.setAttribute("type","StaveModifier"),this.padding=10,this.position=Fo.Position.ABOVE,this.layoutMetrics=null}getPosition(){return this.position}setPosition(t){return this.position=t,this}getStave(){return this.stave}setStave(t){return this.stave=t,this}getWidth(){return this.width}setWidth(t){return this.width=t,this}getX(){return this.x}setX(t){return this.x=t,this}getCategory(){return""}makeSpacer(t){return{getContext(){return!0},setStave(){},renderToStave(){},getMetrics(){return{width:t}}}}placeGlyphOnLine(t,i,s){t.setYShift(i.getYForLine(s)-i.getYForGlyphs())}getPadding(t){return t!==void 0&&t<2?0:this.padding}setPadding(t){return this.padding=t,this}setLayoutMetrics(t){return this.layoutMetrics=t,this}getLayoutMetrics(){return this.layoutMetrics}},Pe=class Me extends Ot{static get CATEGORY(){return"barlines"}static get type(){return{SINGLE:1,DOUBLE:2,END:3,REPEAT_BEGIN:4,REPEAT_END:5,REPEAT_BOTH:6,NONE:7}}static get typeString(){return{single:Me.type.SINGLE,double:Me.type.DOUBLE,end:Me.type.END,repeatBegin:Me.type.REPEAT_BEGIN,repeatEnd:Me.type.REPEAT_END,repeatBoth:Me.type.REPEAT_BOTH,none:Me.type.NONE}}constructor(t){super(),this.setAttribute("type","Barline"),this.thickness=D.STAVE_LINE_THICKNESS;let i=Me.type;this.widths={},this.widths[i.SINGLE]=5,this.widths[i.DOUBLE]=5,this.widths[i.END]=5,this.widths[i.REPEAT_BEGIN]=5,this.widths[i.REPEAT_END]=5,this.widths[i.REPEAT_BOTH]=5,this.widths[i.NONE]=5,this.paddings={},this.paddings[i.SINGLE]=0,this.paddings[i.DOUBLE]=0,this.paddings[i.END]=0,this.paddings[i.REPEAT_BEGIN]=15,this.paddings[i.REPEAT_END]=15,this.paddings[i.REPEAT_BOTH]=15,this.paddings[i.NONE]=0,this.layoutMetricsMap={},this.layoutMetricsMap[i.SINGLE]={xMin:0,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[i.DOUBLE]={xMin:-3,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[i.END]={xMin:-5,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[i.REPEAT_END]={xMin:-10,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[i.REPEAT_BEGIN]={xMin:-2,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[i.REPEAT_BOTH]={xMin:-10,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[i.NONE]={xMin:0,xMax:0,paddingLeft:5,paddingRight:5},this.setPosition(Ot.Position.BEGIN),this.setType(t)}getCategory(){return Me.CATEGORY}getType(){return this.type}setType(t){return this.type=typeof t=="string"?Me.typeString[t]:t,this.setWidth(this.widths[this.type]),this.setPadding(this.paddings[this.type]),this.setLayoutMetrics(this.layoutMetricsMap[this.type]),this}draw(t){switch(t.checkContext(),this.setRendered(),this.type){case Me.type.SINGLE:this.drawVerticalBar(t,this.x,!1);break;case Me.type.DOUBLE:this.drawVerticalBar(t,this.x,!0);break;case Me.type.END:this.drawVerticalEndBar(t,this.x);break;case Me.type.REPEAT_BEGIN:this.drawRepeatBar(t,this.x,!0),t.getX()!==this.x&&this.drawVerticalBar(t,t.getX());break;case Me.type.REPEAT_END:this.drawRepeatBar(t,this.x,!1);break;case Me.type.REPEAT_BOTH:this.drawRepeatBar(t,this.x,!1),this.drawRepeatBar(t,this.x,!0);break;default:break}}drawVerticalBar(t,i,s){t.checkContext();let r=t.getTopLineTopY(),n=t.getBottomLineBottomY();s&&t.context.fillRect(i-3,r,1,n-r),t.context.fillRect(i,r,1,n-r)}drawVerticalEndBar(t,i){t.checkContext();let s=t.getTopLineTopY(),r=t.getBottomLineBottomY();t.context.fillRect(i-5,s,1,r-s),t.context.fillRect(i-2,s,3,r-s)}drawRepeatBar(t,i,s){t.checkContext();let r=t.getTopLineTopY(),n=t.getBottomLineBottomY(),a=3;s||(a=-5),t.context.fillRect(i+a,r,1,n-r),t.context.fillRect(i-2,r,3,n-r),s?a+=4:a-=4;let o=i+a+2/2,l=(t.getNumLines()-1)*t.getSpacingBetweenLines();l=l/2-t.getSpacingBetweenLines()/2;let h=r+l+2/2;t.context.beginPath(),t.context.arc(o,h,2,0,Math.PI*2,!1),t.context.fill(),h+=t.getSpacingBetweenLines(),t.context.beginPath(),t.context.arc(o,h,2,0,Math.PI*2,!1),t.context.fill()}},on=class Ie extends Ot{static get CATEGORY(){return"repetitions"}static get type(){return{NONE:1,CODA_LEFT:2,CODA_RIGHT:3,SEGNO_LEFT:4,SEGNO_RIGHT:5,DC:6,DC_AL_CODA:7,DC_AL_FINE:8,DS:9,DS_AL_CODA:10,DS_AL_FINE:11,FINE:12}}constructor(t,i,s){super(),this.setAttribute("type","Repetition"),this.symbol_type=t,this.x=i,this.x_shift=0,this.y_shift=s,this.font={family:"times",size:12,weight:"bold italic"}}getCategory(){return Ie.CATEGORY}setShiftX(t){return this.x_shift=t,this}setShiftY(t){return this.y_shift=t,this}draw(t,i){switch(this.setRendered(),this.symbol_type){case Ie.type.CODA_RIGHT:this.drawCodaFixed(t,i+t.width);break;case Ie.type.CODA_LEFT:this.drawSymbolText(t,i,"Coda",!0);break;case Ie.type.SEGNO_LEFT:this.drawSignoFixed(t,i);break;case Ie.type.SEGNO_RIGHT:this.drawSignoFixed(t,i+t.width);break;case Ie.type.DC:this.drawSymbolText(t,i,"D.C.",!1);break;case Ie.type.DC_AL_CODA:this.drawSymbolText(t,i,"D.C. al",!0);break;case Ie.type.DC_AL_FINE:this.drawSymbolText(t,i,"D.C. al Fine",!1);break;case Ie.type.DS:this.drawSymbolText(t,i,"D.S.",!1);break;case Ie.type.DS_AL_CODA:this.drawSymbolText(t,i,"D.S. al",!0);break;case Ie.type.DS_AL_FINE:this.drawSymbolText(t,i,"D.S. al Fine",!1);break;case Ie.type.FINE:this.drawSymbolText(t,i,"Fine",!1);break;default:break}return this}drawCodaFixed(t,i){let s=t.getYForTopText(t.options.num_lines)+this.y_shift;return wt.renderGlyph(t.context,this.x+i+this.x_shift,s+25,40,"v4d",!0),this}drawSignoFixed(t,i){let s=t.getYForTopText(t.options.num_lines)+this.y_shift;return wt.renderGlyph(t.context,this.x+i+this.x_shift,s+25,30,"v8c",!0),this}drawSymbolText(t,i,s,r){let n=t.checkContext();n.save(),n.setFont(this.font.family,this.font.size,this.font.weight);let a=0+this.x_shift,o=i+this.x_shift;
5this.symbol_type===Ie.type.CODA_LEFT?(a=this.x+t.options.vertical_bar_width,o=a+n.measureText(s).width+12):(o=this.x+i+t.width-5+this.x_shift,a=o-+n.measureText(s).width-12);let l=t.getYForTopText(t.options.num_lines)+this.y_shift;return r&&wt.renderGlyph(n,o,l,40,"v4d",!0),n.fillText(s,a,l+5),n.restore(),this}},Yh=class Do extends Ot{static get CATEGORY(){return"stavesection"}constructor(t,i,s){super(),this.setAttribute("type","StaveSection"),this.setWidth(16),this.section=t,this.x=i,this.shift_x=0,this.shift_y=s,this.font={family:"sans-serif",size:12,weight:"bold"}}getCategory(){return Do.CATEGORY}setStaveSection(t){return this.section=t,this}setShiftX(t){return this.shift_x=t,this}setShiftY(t){return this.shift_y=t,this}draw(t,i){let s=t.checkContext();this.setRendered(),s.save(),s.lineWidth=2,s.setFont(this.font.family,this.font.size,this.font.weight);let r=s.measureText(""+this.section).width,n=r+6;n<18&&(n=18);let a=t.getYForTopText(3)+this.shift_y,o=this.x+i;return s.beginPath(),s.lineWidth=2,s.rect(o,a,n,20),s.stroke(),o+=(n-r)/2,s.fillText(""+this.section,o,a+16),s.restore(),this}},Oo=class Vo extends Ot{static get CATEGORY(){return"stavetempo"}constructor(t,i,s){super(),this.setAttribute("type","StaveTempo"),this.tempo=t,this.position=St.Position.ABOVE,this.x=i,this.shift_x=10,this.shift_y=s,this.font={family:"times",size:14,weight:"bold"},this.render_options={glyph_font_scale:30}}getCategory(){return Vo.CATEGORY}setTempo(t){return this.tempo=t,this}setShiftX(t){return this.shift_x=t,this}setShiftY(t){return this.shift_y=t,this}draw(t,i){let s=t.checkContext();this.setRendered();let r=this.render_options,n=r.glyph_font_scale/38,a=this.tempo.name,o=this.tempo.duration,l=this.tempo.dots,h=this.tempo.bpm,u=this.font,c=this.x+this.shift_x+i,d=t.getYForTopText(1)+this.shift_y;if(s.save(),a&&(s.setFont(u.family,u.size,u.weight),s.fillText(a,c,d),c+=s.measureText(a).width),o&&h){s.setFont(u.family,u.size,"normal"),a&&(c+=s.measureText(" ").width,s.fillText("(",c,d),c+=s.measureText("(").width);let f=D.getGlyphProps(o);if(c+=3*n,wt.renderGlyph(s,c,d,r.glyph_font_scale,f.code_head),c+=f.getWidth()*n,f.stem){let p=30;f.beam_count&&(p+=3*(f.beam_count-1)),p*=n;let m=d-p;s.fillRect(c-n,m,n,p),f.flag&&(wt.renderGlyph(s,c,m,r.glyph_font_scale,f.code_flag_upstem),l||(c+=6*n))}for(let p=0;p<l;p++)c+=6*n,s.beginPath(),s.arc(c,d+2*n,2*n,0,Math.PI*2,!1),s.fill();s.fillText(" = "+h+(a?")":""),c+3*n,d)}return s.restore(),this}},hr=class Ai extends ze{static get Justification(){return{LEFT:1,CENTER:2,RIGHT:3}}static get GLYPHS(){return{segno:{code:"v8c",point:40,x_shift:0,y_shift:-10},tr:{code:"v1f",point:40,x_shift:0,y_shift:0},mordent_upper:{code:"v1e",point:40,x_shift:0,y_shift:0},mordent_lower:{code:"v45",point:40,x_shift:0,y_shift:0},f:{code:"vba",point:40,x_shift:0,y_shift:0},p:{code:"vbf",point:40,x_shift:0,y_shift:0},m:{code:"v62",point:40,x_shift:0,y_shift:0},s:{code:"v4a",point:40,x_shift:0,y_shift:0},z:{code:"v80",point:40,x_shift:0,y_shift:0},coda:{code:"v4d",point:40,x_shift:0,y_shift:-8},pedal_open:{code:"v36",point:40,x_shift:0,y_shift:0},pedal_close:{code:"v5d",point:40,x_shift:0,y_shift:3},caesura_straight:{code:"v34",point:40,x_shift:0,y_shift:2},caesura_curved:{code:"v4b",point:40,x_shift:0,y_shift:2},breath:{code:"v6c",point:40,x_shift:0,y_shift:0},tick:{code:"v6f",point:50,x_shift:0,y_shift:0},turn:{code:"v72",point:40,x_shift:0,y_shift:0},turn_inverted:{code:"v33",point:40,x_shift:0,y_shift:0},mordent:{code:"v1e",point:40,x_shift:0,y_shift:0}}}constructor(t){if(super(t),this.setAttribute("type","TextNote"),this.text=t.text,this.superscript=t.superscript,this.subscript=t.subscript,this.glyph_type=t.glyph,this.glyph=null,this.font={family:"Arial",size:12,weight:""},t.font&&(this.font=t.font),this.glyph_type){let i=Ai.GLYPHS[this.glyph_type];if(!i)throw new w.RERR("Invalid glyph type: "+this.glyph_type);this.glyph=new wt(i.code,i.point,{cache:!1}),i.width?this.setWidth(i.width):this.setWidth(this.glyph.getMetrics().width),this.glyph_struct=i}else this.setWidth(D.textWidth(this.text));this.line=t.line||0,this.smooth=t.smooth||!1,this.ignore_ticks=t.ignore_ticks||!1,this.justification=Ai.Justification.LEFT}setJustification(t){return this.justification=t,this}setLine(t){return this.line=t,this}preFormat(){this.checkContext(),!this.preFormatted&&(this.smooth?this.setWidth(0):this.glyph||this.setWidth(this.context.measureText(this.text).width),this.justification===Ai.Justification.CENTER?this.extraLeftPx=this.width/2:this.justification===Ai.Justification.RIGHT&&(this.extraLeftPx=this.width),this.setPreFormatted(!0))}draw(){if(this.checkContext(),!this.stave)throw new w.RERR("NoStave","Can't draw without a stave.");this.setRendered();let t=this.context,i=this.getAbsoluteX();this.justification===Ai.Justification.CENTER?i-=this.getWidth()/2:this.justification===Ai.Justification.RIGHT&&(i-=this.getWidth());let s;if(this.glyph)s=this.stave.getYForLine(this.line+-3),this.glyph.render(this.context,i+this.glyph_struct.x_shift,s+this.glyph_struct.y_shift);else{s=this.stave.getYForLine(this.line+-3),this.applyStyle(t),t.setFont(this.font.family,this.font.size,this.font.weight),t.fillText(this.text,i,s);let r=t.measureText("M").width,n=t.measureText(this.text).width;this.superscript&&(t.setFont(this.font.family,this.font.size/1.3,this.font.weight),t.fillText(this.superscript,i+n+2,s-r/2.2)),this.subscript&&(t.setFont(this.font.family,this.font.size/1.3,this.font.weight),t.fillText(this.subscript,i+n+2,s+r/2.2-1)),this.restoreStyle(t)}}},jh=class Go extends Ot{static get CATEGORY(){return"stavetext"}constructor(t,i,s){super(),this.setAttribute("type","StaveText"),this.setWidth(16),this.text=t,this.position=i,this.options={shift_x:0,shift_y:0,justification:hr.Justification.CENTER},w.Merge(this.options,s),this.font={family:"times",size:16,weight:"normal"}}getCategory(){return Go.CATEGORY}setStaveText(t){return this.text=t,this}setShiftX(t){return this.shift_x=t,this}setShiftY(t){return this.shift_y=t,this}setFont(t){w.Merge(this.font,t)}setText(t){this.text=t}draw(t){let i=t.checkContext();this.setRendered(),i.save(),i.lineWidth=2,i.setFont(this.font.family,this.font.size,this.font.weight);let s=i.measureText(""+this.text).width,r,n,a=Ot.Position,o=hr.Justification;switch(this.position){case a.LEFT:case a.RIGHT:n=(t.getYForLine(0)+t.getBottomLineY())/2+this.options.shift_y,r=this.position===a.LEFT?t.getX()-s-24+this.options.shift_x:t.getX()+t.getWidth()+24+this.options.shift_x;break;case a.ABOVE:case a.BELOW:r=t.getX()+this.options.shift_x,this.options.justification===o.CENTER?r+=t.getWidth()/2-s/2:this.options.justification===o.RIGHT&&(r+=t.getWidth()-s),n=this.position===a.ABOVE?t.getYForTopText(2)+this.options.shift_y:t.getYForBottomText(2)+this.options.shift_y;break;default:throw new w.RERR("InvalidPosition","Value Must be in Modifier.Position.")}
5return i.fillText(""+this.text,r,n+4),i.restore(),this}};function Kh(...e){ws.DEBUG&&w.L("Vex.Flow.Clef",e)}var ws=class zi extends Ot{static get CATEGORY(){return"clefs"}static get types(){return{treble:{code:"v83",line:3},bass:{code:"v79",line:1},alto:{code:"vad",line:2},tenor:{code:"vad",line:1},percussion:{code:"v59",line:2},soprano:{code:"vad",line:4},"mezzo-soprano":{code:"vad",line:3},"baritone-c":{code:"vad",line:0},"baritone-f":{code:"v79",line:2},subbass:{code:"v79",line:0},french:{code:"v83",line:4},tab:{code:"v2f"}}}static get sizes(){return{default:{point:40,width:26},small:{point:32,width:20}}}static get annotations(){return{"8va":{code:"v8",sizes:{default:{point:20,attachments:{treble:{line:-1.2,x_shift:11}}},small:{point:18,attachments:{treble:{line:-.4,x_shift:8}}}}},"8vb":{code:"v8",sizes:{default:{point:20,attachments:{treble:{line:6.3,x_shift:10},bass:{line:4,x_shift:1}}},small:{point:18,attachments:{treble:{line:5.8,x_shift:6},bass:{line:3.5,x_shift:.5}}}}}}}constructor(t,i,s){super(),this.setAttribute("type","Clef"),this.setPosition(Ot.Position.BEGIN),this.setType(t,i,s),this.setWidth(zi.sizes[this.size].width),Kh("Creating clef:",t)}getCategory(){return zi.CATEGORY}setType(t,i,s){if(this.type=t,this.clef=zi.types[t],i===void 0?this.size="default":this.size=i,this.clef.point=zi.sizes[this.size].point,this.glyph=new wt(this.clef.code,this.clef.point),s!==void 0){let r=zi.annotations[s];this.annotation={code:r.code,point:r.sizes[this.size].point,line:r.sizes[this.size].attachments[this.type].line,x_shift:r.sizes[this.size].attachments[this.type].x_shift},this.attachment=new wt(this.annotation.code,this.annotation.point),this.attachment.metrics.x_max=0,this.attachment.setXShift(this.annotation.x_shift)}else this.annotation=void 0;return this}getWidth(){if(this.type==="tab"&&!this.stave)throw new w.RERR("ClefError","Can't get width without stave.");return this.width}setStave(t){if(this.stave=t,this.type!=="tab")return this;let i,s,r=this.stave.getOptions().num_lines;switch(r){case 8:i=55,s=14;break;case 7:i=47,s=8;break;case 6:i=40,s=1;break;case 5:i=30,s=-6;break;case 4:i=23,s=-12;break;default:throw new w.RERR("ClefError",`Invalid number of lines: ${r}`)}return this.glyph.setPoint(i),this.glyph.setYShift(s),this}draw(){if(!this.x)throw new w.RERR("ClefError","Can't draw clef without x.");if(!this.stave)throw new w.RERR("ClefError","Can't draw clef without stave.");this.setRendered(),this.glyph.setStave(this.stave),this.glyph.setContext(this.stave.context),this.clef.line!==void 0&&this.placeGlyphOnLine(this.glyph,this.stave,this.clef.line),this.glyph.renderToStave(this.x),this.annotation!==void 0&&(this.placeGlyphOnLine(this.attachment,this.stave,this.annotation.line),this.attachment.setStave(this.stave),this.attachment.setContext(this.stave.context),this.attachment.renderToStave(this.x))}},ur=class ln extends Ot{static get CATEGORY(){return"keysignatures"}static get accidentalSpacing(){return{"#":{above:6,below:4},b:{above:4,below:7},n:{above:4,below:1},"##":{above:6,below:4},bb:{above:4,below:7},db:{above:4,below:7},d:{above:4,below:7},bbs:{above:4,below:7},"++":{above:6,below:4},"+":{above:6,below:4},"+-":{above:6,below:4},"++-":{above:6,below:4},bs:{above:4,below:10},bss:{above:4,below:10}}}constructor(t,i,s){super(),this.setAttribute("type","KeySignature"),this.setKeySig(t,i,s),this.setPosition(Ot.Position.BEGIN),this.glyphFontScale=38,this.glyphs=[],this.xPositions=[],this.paddingForced=!1}getCategory(){return ln.CATEGORY}convertToGlyph(t,i){let s=new wt(D.accidentalCodes(t.type).code,this.glyphFontScale),r=1;if(t.type==="n"&&i){let o=ln.accidentalSpacing[i.type];o&&(r=i.line>=t.line?o.above:o.below)}this.placeGlyphOnLine(s,this.stave,t.line),this.glyphs.push(s);let n=this.xPositions[this.xPositions.length-1],a=s.getMetrics().width+r;this.xPositions.push(n+a),this.width+=a}cancelKey(t){return this.formatted=!1,this.cancelKeySpec=t,this}convertToCancelAccList(t){let i=D.keySignature(t),s=this.accList.length>0&&i.length>0&&i[0].type!==this.accList[0].type,r=s?i.length:i.length-this.accList.length;if(r<1)return;let n=[];for(let a=0;a<r;a++){let o=a;s||(o=i.length-r+a);let l=i[o];n.push({type:"n",line:l.line})}return this.accList=n.concat(this.accList),{accList:n,type:i[0].type}}addToStave(t){return this.paddingForced=!0,t.addModifier(this),this}convertAccLines(t,i,s=this.accList){let r=0,n;switch(t){case"soprano":i==="#"?n=[2.5,.5,2,0,1.5,-.5,1]:r=-1;break;case"mezzo-soprano":i==="b"?n=[0,2,.5,2.5,1,3,1.5]:r=1.5;break;case"alto":r=.5;break;case"tenor":i==="#"?n=[3,1,2.5,.5,2,0,1.5]:r=-.5;break;case"baritone-f":case"baritone-c":i==="b"?n=[.5,2.5,1,3,1.5,3.5,2]:r=2;break;case"bass":case"french":r=1;break;default:break}let a;if(n!==void 0)for(a=0;a<s.length;++a)s[a].line=n[a];else if(r!==0)for(a=0;a<s.length;++a)s[a].line+=r}getPadding(t){return this.formatted||this.format(),this.glyphs.length===0||!this.paddingForced&&t<2?0:this.padding}getWidth(){return this.formatted||this.format(),this.width}setKeySig(t,i,s){return this.formatted=!1,this.keySpec=t,this.cancelKeySpec=i,this.alterKeySpec=s,this}alterKey(t){return this.formatted=!1,this.alterKeySpec=t,this}convertToAlterAccList(t){let i=Math.min(t.length,this.accList.length);for(let s=0;s<i;++s)t[s]&&(this.accList[s].type=t[s])}format(){if(!this.stave)throw new w.RERR("KeySignatureError","Can't draw key signature without stave.");this.width=0,this.glyphs=[],this.xPositions=[0],this.accList=D.keySignature(this.keySpec);let t=this.accList,i=t.length>0?t[0].type:null,s;if(this.cancelKeySpec&&(s=this.convertToCancelAccList(this.cancelKeySpec)),this.alterKeySpec&&this.convertToAlterAccList(this.alterKeySpec),this.accList.length>0){let r=(this.position===Ot.Position.END?this.stave.endClef:this.stave.clef)||this.stave.clef;s&&this.convertAccLines(r,s.type,s.accList),this.convertAccLines(r,i,t);for(let n=0;n<this.accList.length;++n)this.convertToGlyph(this.accList[n],this.accList[n+1])}this.formatted=!0}
5draw(){if(!this.x)throw new w.RERR("KeySignatureError","Can't draw key signature without x.");if(!this.stave)throw new w.RERR("KeySignatureError","Can't draw key signature without stave.");this.formatted||this.format(),this.setRendered();for(let t=0;t<this.glyphs.length;t++){let i=this.glyphs[t],s=this.x+this.xPositions[t];i.setStave(this.stave),i.setContext(this.stave.context),i.renderToStave(s)}}},qh=e=>{let t=e.split("/").filter(i=>i!=="");if(t.length!==2)throw new w.RERR("BadTimeSignature",`Invalid time spec: ${e}. Must be in the form "<numerator>/<denominator>"`);t.forEach(i=>{if(isNaN(Number(i)))throw new w.RERR("BadTimeSignature",`Invalid time spec: ${e}. Must contain two valid numbers.`)})},Ts=class hn extends Ot{static get CATEGORY(){return"timesignatures"}static get glyphs(){return{C:{code:"v41",point:40,line:2},"C|":{code:"vb6",point:40,line:2}}}constructor(t=null,i=15,s=!0){if(super(),this.setAttribute("type","TimeSignature"),this.validate_args=s,t===null)return;let r=i;this.point=40,this.topLine=2,this.bottomLine=4,this.setPosition(Ot.Position.BEGIN),this.setTimeSig(t),this.setWidth(this.timeSig.glyph.getMetrics().width),this.setPadding(r)}getCategory(){return hn.CATEGORY}parseTimeSpec(t){if(t==="C"||t==="C|"){let{line:r,code:n,point:a}=hn.glyphs[t];return{line:r,num:!1,glyph:new wt(n,a)}}this.validate_args&&qh(t);let[i,s]=t.split("/").map(r=>r.split(""));return{num:!0,glyph:this.makeTimeSignatureGlyph(i,s)}}makeTimeSignatureGlyph(t,i){let s=new wt("v0",this.point);s.topGlyphs=[],s.botGlyphs=[];let r=0;for(let c=0;c<t.length;++c){let d=t[c],f=new wt("v"+d,this.point);s.topGlyphs.push(f),r+=f.getMetrics().width}let n=0;for(let c=0;c<i.length;++c){let d=i[c],f=new wt("v"+d,this.point);s.botGlyphs.push(f),n+=f.getMetrics().width}let a=r>n?r:n,o=s.getMetrics().x_min;s.getMetrics=()=>({x_min:o,x_max:o+a,width:a});let l=(a-r)/2,h=(a-n)/2,u=this;return s.renderToStave=function(c){let d=c+l;for(let f=0;f<this.topGlyphs.length;++f){let p=this.topGlyphs[f];wt.renderOutline(this.context,p.metrics.outline,p.scale,d+p.x_shift,this.stave.getYForLine(u.topLine)),d+=p.getMetrics().width}d=c+h;for(let f=0;f<this.botGlyphs.length;++f){let p=this.botGlyphs[f];u.placeGlyphOnLine(p,this.stave,p.line),wt.renderOutline(this.context,p.metrics.outline,p.scale,d+p.x_shift,this.stave.getYForLine(u.bottomLine)),d+=p.getMetrics().width}},s}getTimeSig(){return this.timeSig}setTimeSig(t){return this.timeSig=this.parseTimeSpec(t),this}draw(){if(!this.x)throw new w.RERR("TimeSignatureError","Can't draw time signature without x.");if(!this.stave)throw new w.RERR("TimeSignatureError","Can't draw time signature without stave.");this.setRendered(),this.timeSig.glyph.setStave(this.stave),this.timeSig.glyph.setContext(this.stave.context),this.placeGlyphOnLine(this.timeSig.glyph,this.stave,this.timeSig.line),this.timeSig.glyph.renderToStave(this.x)}},Wo=class Ri extends Ot{static get CATEGORY(){return"voltas"}static get type(){return{NONE:1,BEGIN:2,MID:3,END:4,BEGIN_END:5}}constructor(t,i,s,r){super(),this.setAttribute("type","Volta"),this.volta=t,this.x=s,this.y_shift=r,this.number=i,this.font={family:"sans-serif",size:9,weight:"bold"}}getCategory(){return Ri.CATEGORY}setShiftY(t){return this.y_shift=t,this}draw(t,i){let s=t.checkContext();this.setRendered();let r=t.width,n=t.getYForTopText(t.options.num_lines)+this.y_shift,a=1.5*t.options.spacing_between_lines_px;switch(this.volta){case Ri.type.BEGIN:s.fillRect(this.x+i,n,1,a);break;case Ri.type.END:r-=5,s.fillRect(this.x+i+r,n,1,a);break;case Ri.type.BEGIN_END:r-=3,s.fillRect(this.x+i,n,1,a),s.fillRect(this.x+i+r,n,1,a);break;default:break}return(this.volta===Ri.type.BEGIN||this.volta===Ri.type.BEGIN_END)&&(s.save(),s.setFont(this.font.family,this.font.size,this.font.weight),s.fillText(this.number,this.x+i+5,n+15),s.restore()),s.fillRect(this.x+i,n,r,1),this}},Yn=class extends fe{constructor(e,t,i,s){super(),this.setAttribute("type","Stave"),this.x=e,this.y=t,this.width=i,this.formatted=!1,this.start_x=e+5,this.end_x=e+i,this.modifiers=[],this.measure=0,this.clef="treble",this.endClef=void 0,this.font={family:"sans-serif",size:8,weight:""},this.options={vertical_bar_width:10,glyph_spacing_px:10,num_lines:5,fill_style:"#999999",left_bar:!0,right_bar:!0,spacing_between_lines_px:10,space_above_staff_ln:4,space_below_staff_ln:4,top_text_position:1},this.bounds={x:this.x,y:this.y,w:this.width,h:0},w.Merge(this.options,s),this.resetLines();let r=Pe.type;this.addModifier(new Pe(this.options.left_bar?r.SINGLE:r.NONE)),this.addEndModifier(new Pe(this.options.right_bar?r.SINGLE:r.NONE))}space(e){return this.options.spacing_between_lines_px*e}resetLines(){this.options.line_config=[];for(let e=0;e<this.options.num_lines;e++)this.options.line_config.push({visible:!0});this.height=(this.options.num_lines+this.options.space_above_staff_ln)*this.options.spacing_between_lines_px,this.options.bottom_text_position=this.options.num_lines}getOptions(){return this.options}setNoteStartX(e){this.formatted||this.format(),this.start_x=e;let t=this.modifiers[0];return t.setX(this.start_x-t.getWidth()),this}getNoteStartX(){return this.formatted||this.format(),this.start_x}getNoteEndX(){return this.formatted||this.format(),this.end_x}getTieStartX(){return this.start_x}getTieEndX(){return this.x+this.width}getX(){return this.x}getNumLines(){return this.options.num_lines}setNumLines(e){return this.options.num_lines=parseInt(e,10),this.resetLines(),this}setY(e){return this.y=e,this}getTopLineTopY(){return this.getYForLine(0)-D.STAVE_LINE_THICKNESS/2}getBottomLineBottomY(){return this.getYForLine(this.getNumLines()-1)+D.STAVE_LINE_THICKNESS/2}setX(e){let t=e-this.x;this.formatted=!1,this.x=e,this.start_x+=t,this.end_x+=t;for(let i=0;i<this.modifiers.length;i++){let s=this.modifiers[i];s.x!==void 0&&(s.x+=t)}return this}setWidth(e){return this.formatted=!1,this.width=e,this.end_x=this.x+e,this}getWidth(){return this.width}getStyle(){return{fillStyle:this.options.fill_style,strokeStyle:this.options.fill_style,lineWidth:D.STAVE_LINE_THICKNESS,...this.style||{}}}setMeasure(e){return this.measure=e,this}
5getModifierXShift(e=0){if(typeof e!="number")throw new w.RERR("InvalidIndex","Must be of number type");if(this.formatted||this.format(),this.getModifiers(Ot.Position.BEGIN).length===1)return 0;let t=this.start_x-this.x,i=this.modifiers[0];return i.getType()===Pe.type.REPEAT_BEGIN&&t>i.getWidth()&&(t-=i.getWidth()),t}setRepetitionTypeLeft(e,t){return this.modifiers.push(new on(e,this.x,t)),this}setRepetitionTypeRight(e,t){return this.modifiers.push(new on(e,this.x,t)),this}setVoltaType(e,t,i){return this.modifiers.push(new Wo(e,t,this.x,i)),this}setSection(e,t){return this.modifiers.push(new Yh(e,this.x,t)),this}setTempo(e,t){return this.modifiers.push(new Oo(e,this.x,t)),this}setText(e,t,i){return this.modifiers.push(new jh(e,t,i)),this}getHeight(){return this.height}getSpacingBetweenLines(){return this.options.spacing_between_lines_px}getBoundingBox(){return new Sr(this.x,this.y,this.width,this.getBottomY()-this.y)}getBottomY(){let e=this.options,t=e.spacing_between_lines_px;return this.getYForLine(e.num_lines)+e.space_below_staff_ln*t}getBottomLineY(){return this.getYForLine(this.options.num_lines)}getYForLine(e){let t=this.options,i=t.spacing_between_lines_px,s=t.space_above_staff_ln;return this.y+e*i+s*i}getLineForY(e){let t=this.options,i=t.spacing_between_lines_px,s=t.space_above_staff_ln;return(e-this.y)/i-s}getYForTopText(e){let t=e||0;return this.getYForLine(-t-this.options.top_text_position)}getYForBottomText(e){let t=e||0;return this.getYForLine(this.options.bottom_text_position+t)}getYForNote(e){let t=this.options,i=t.spacing_between_lines_px,s=t.space_above_staff_ln;return this.y+s*i+5*i-e*i}getYForGlyphs(){return this.getYForLine(3)}addModifier(e,t){return t!==void 0&&e.setPosition(t),e.setStave(this),this.formatted=!1,this.modifiers.push(e),this}addEndModifier(e){return this.addModifier(e,Ot.Position.END),this}setBegBarType(e){let{SINGLE:t,REPEAT_BEGIN:i,NONE:s}=Pe.type;return(e===t||e===i||e===s)&&(this.modifiers[0].setType(e),this.formatted=!1),this}setEndBarType(e){return e!==Pe.type.REPEAT_BEGIN&&(this.modifiers[1].setType(e),this.formatted=!1),this}setClef(e,t,i,s){s===void 0&&(s=Ot.Position.BEGIN),s===Ot.Position.END?this.endClef=e:this.clef=e;let r=this.getModifiers(s,ws.CATEGORY);return r.length===0?this.addClef(e,t,i,s):r[0].setType(e,t,i),this}setEndClef(e,t,i){return this.setClef(e,t,i,Ot.Position.END),this}setKeySignature(e,t,i){i===void 0&&(i=Ot.Position.BEGIN);let s=this.getModifiers(i,ur.CATEGORY);return s.length===0?this.addKeySignature(e,t,i):s[0].setKeySig(e,t),this}setEndKeySignature(e,t){return this.setKeySignature(e,t,Ot.Position.END),this}setTimeSignature(e,t,i){i===void 0&&(i=Ot.Position.BEGIN);let s=this.getModifiers(i,Ts.CATEGORY);return s.length===0?this.addTimeSignature(e,t,i):s[0].setTimeSig(e),this}setEndTimeSignature(e,t){return this.setTimeSignature(e,t,Ot.Position.END),this}addKeySignature(e,t,i){return i===void 0&&(i=Ot.Position.BEGIN),this.addModifier(new ur(e,t).setPosition(i),i),this}addClef(e,t,i,s){return s===void 0||s===Ot.Position.BEGIN?this.clef=e:s===Ot.Position.END&&(this.endClef=e),this.addModifier(new ws(e,t,i),s),this}addEndClef(e,t,i){return this.addClef(e,t,i,Ot.Position.END),this}addTimeSignature(e,t,i){return this.addModifier(new Ts(e,t),i),this}addEndTimeSignature(e,t){return this.addTimeSignature(e,t,Ot.Position.END),this}addTrebleGlyph(){return this.addClef("treble"),this}getModifiers(e,t){return e===void 0&&t===void 0?this.modifiers:this.modifiers.filter(i=>(e===void 0||e===i.getPosition())&&(t===void 0||t===i.getCategory()))}sortByCategory(e,t){for(let i=e.length-1;i>=0;i--)for(let s=0;s<i;s++)if(t[e[s].getCategory()]>t[e[s+1].getCategory()]){let r=e[s];e[s]=e[s+1],e[s+1]=r}}format(){let e=this.modifiers[0],t=this.modifiers[1],i=this.getModifiers(Ot.Position.BEGIN),s=this.getModifiers(Ot.Position.END);this.sortByCategory(i,{barlines:0,clefs:1,keysignatures:2,timesignatures:3}),this.sortByCategory(s,{timesignatures:0,keysignatures:1,barlines:2,clefs:3}),i.length>1&&e.getType()===Pe.type.REPEAT_BEGIN&&(i.push(i.splice(0,1)[0]),i.splice(0,0,new Pe(Pe.type.SINGLE))),s.indexOf(t)>0&&s.splice(0,0,new Pe(Pe.type.NONE));let r,n,a,o=0,l=this.x;for(let c=0;c<i.length;
5c++)a=i[c],n=a.getPadding(c+o),r=a.getWidth(),l+=n,a.setX(l),l+=r,n+r===0&&o--;this.start_x=l,l=this.x+this.width;let h={left:0,right:0,paddingRight:0,paddingLeft:0},u=0;for(let c=0;c<s.length;c++){a=s[c],u=a.getCategory()==="barlines"?c:u,h.right=0,h.left=0,h.paddingRight=0,h.paddingLeft=0;let d=a.getLayoutMetrics();d?(c!==0&&(h.right=d.xMax||0,h.paddingRight=d.paddingRight||0),h.left=-d.xMin||0,h.paddingLeft=d.paddingLeft||0,c===s.length-1&&(h.paddingLeft=0)):(h.paddingRight=a.getPadding(c-u),c!==0&&(h.right=a.getWidth()),c===0&&(h.left=a.getWidth())),l-=h.paddingRight,l-=h.right,a.setX(l),l-=h.left,l-=h.paddingLeft}this.end_x=s.length===1?this.x+this.width:l,this.formatted=!0}draw(){this.checkContext(),this.setRendered(),this.formatted||this.format();let e=this.options.num_lines,t=this.width,i=this.x,s;for(let r=0;r<e;r++)s=this.getYForLine(r),this.applyStyle(),this.options.line_config[r].visible&&(this.context.beginPath(),this.context.moveTo(i,s),this.context.lineTo(i+t,s),this.context.stroke()),this.restoreStyle();for(let r=0;r<this.modifiers.length;r++)typeof this.modifiers[r].draw=="function"&&(this.modifiers[r].applyStyle(this.context),this.modifiers[r].draw(this,this.getModifierXShift(r)),this.modifiers[r].restoreStyle(this.context));if(this.measure>0){this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);let r=this.context.measureText(""+this.measure).width;s=this.getYForTopText(0)+3,this.context.fillText(""+this.measure,this.x-r/2,s),this.context.restore()}return this}drawVertical(e,t){this.drawVerticalFixed(this.x+e,t)}drawVerticalFixed(e,t){this.checkContext();let i=this.getYForLine(0),s=this.getYForLine(this.options.num_lines-1);t&&this.context.fillRect(e-3,i,1,s-i+1),this.context.fillRect(e,i,1,s-i+1)}drawVerticalBar(e){this.drawVerticalBarFixed(this.x+e,!1)}drawVerticalBarFixed(e){this.checkContext();let t=this.getYForLine(0),i=this.getYForLine(this.options.num_lines-1);this.context.fillRect(e,t,1,i-t+1)}getConfigForLines(){return this.options.line_config}setConfigForLine(e,t){if(e>=this.options.num_lines||e<0)throw new w.RERR("StaveConfigError","The line number must be within the range of the number of lines in the Stave.");if(t.visible===void 0)throw new w.RERR("StaveConfigError","The line configuration object is missing the 'visible' property.");if(typeof t.visible!="boolean")throw new w.RERR("StaveConfigError","The line configuration objects 'visible' property must be true or false.");return this.options.line_config[e]=t,this}setConfigForLines(e){if(e.length!==this.options.num_lines)throw new w.RERR("StaveConfigError","The length of the lines configuration array must match the number of lines in the Stave");for(let t in e)e[t]||(e[t]=this.options.line_config[t]),w.Merge(this.options.line_config[t],e[t]);return this.options.line_config=e,this}},Uo=class extends Yn{constructor(e,t,i,s){let r={spacing_between_lines_px:13,num_lines:6,top_text_position:1};w.Merge(r,s),super(e,t,i,r),this.setAttribute("type","TabStave")}getYForGlyphs(){return this.getYForLine(2.5)}addTabGlyph(){return this.addClef("tab"),this}};function Jh(e,t){let i=[],s=[];for(let r=1;r<=e;r++)t.indexOf(r)>-1?(i.push(s),s=[]):s.push(r);return s.length>0&&i.push(s),i}function $h(e,t,i,s){let r=s!==1,n=s!==-1,a=i.getSpacingBetweenLines(),o=i.getNumLines(),l=[];return t.forEach(h=>{let u=h.indexOf(o)>-1,c=h.indexOf(1)>-1;if(r&&c||n&&u)return;h.length===1&&h.push(h[0]);let d=[];h.forEach((f,p,m)=>{let g=f===1,b=f===o,S=i.getYForLine(f-1);p===0&&!g?S-=a/2-1:p===m.length-1&&!b&&(S+=a/2-1),d.push(S),s===1&&g?d.push(e-2):s===-1&&b&&d.push(e+2)}),l.push(d.sort((f,p)=>f-p))}),l}var jn=class zo extends Fn{static get CATEGORY(){return"tabnotes"}constructor(t,i){if(super(t),this.setAttribute("type","TabNote"),this.ghost=!1,this.positions=t.positions,w.Merge(this.render_options,{glyph_font_scale:D.DEFAULT_TABLATURE_FONT_SCALE,draw_stem:i,draw_dots:i,draw_stem_through_stave:!1,y_shift:0,scale:1,font:"10pt Arial"}),this.glyph=D.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new w.RuntimeError("BadArguments",`Invalid note initialization data (No glyph found): ${JSON.stringify(t)}`);this.buildStem(),t.stem_direction?this.setStemDirection(t.stem_direction):this.setStemDirection(gt.UP),this.ghost=!1,this.updateWidth()}reset(){this.stave&&this.setStave(this.stave)}getCategory(){return zo.CATEGORY}setGhost(t){return this.ghost=t,this.updateWidth(),this}
5hasStem(){return this.render_options.draw_stem}getStemExtension(){let t=this.getGlyph();return this.stem_extension_override==null?t?this.getStemDirection()===1?t.tabnote_stem_up_extension:t.tabnote_stem_down_extension:0:this.stem_extension_override}addDot(){let t=new xr;return this.dots+=1,this.addModifier(t,0)}updateWidth(){this.glyphs=[],this.width=0;for(let t=0;t<this.positions.length;++t){let i=this.positions[t].fret;this.ghost&&(i="("+i+")");let s=D.tabToGlyph(i,this.render_options.scale);this.glyphs.push(s),this.width=Math.max(s.getWidth(),this.width)}this.glyph.getWidth=()=>this.width}setStave(t){super.setStave(t),this.context=t.context;let i;if(this.context){let r=this.context;for(this.width=0,i=0;i<this.glyphs.length;++i){let n=this.glyphs[i],a=""+n.text;a.toUpperCase()!=="X"&&(r.save(),r.setRawFont(this.render_options.font),n.width=r.measureText(a).width,r.restore(),n.getWidth=()=>n.width),this.width=Math.max(n.getWidth(),this.width)}this.glyph.getWidth=()=>this.width}let s=this.positions.map(({str:r})=>t.getYForLine(r-1));return this.setYs(s),this.stem&&this.stem.setYBounds(this.getStemY(),this.getStemY()),this}getPositions(){return this.positions}addToModifierContext(t){this.setModifierContext(t);for(let i=0;i<this.modifiers.length;++i)this.modifierContext.addModifier(this.modifiers[i]);return this.modifierContext.addModifier(this),this.preFormatted=!1,this}getTieRightX(){let t=this.getAbsoluteX(),i=this.glyph.getWidth();return t+=i/2,t+=-this.width/2+this.width+2,t}getTieLeftX(){let t=this.getAbsoluteX(),i=this.glyph.getWidth();return t+=i/2,t-=this.width/2+2,t}getModifierStartXY(t,i){if(!this.preFormatted)throw new w.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(this.ys.length===0)throw new w.RERR("NoYValues","No Y-Values calculated for this note.");let s=0;return t===St.Position.LEFT?s=-2:t===St.Position.RIGHT?s=this.width+2:(t===St.Position.BELOW||t===St.Position.ABOVE)&&(s=this.glyph.getWidth()/2),{x:this.getAbsoluteX()+s,y:this.ys[i]}}getLineForRest(){return this.positions[0].str}preFormat(){this.preFormatted||(this.modifierContext&&this.modifierContext.preFormat(),this.setPreFormatted(!0))}getStemX(){return this.getCenterGlyphX()}getStemY(){let t=this.stave.getNumLines()-.5,i=gt.UP===this.stem_direction?-.5:t;return this.stave.getYForLine(i)}getStemExtents(){return this.stem.getExtents()}drawFlag(){let{beam:t,glyph:i,context:s,stem:r,stem_direction:n,render_options:{draw_stem:a,glyph_font_scale:o}}=this,l=t==null&&a;if(i.flag&&l){let h=this.getStemX()+1,u=this.getStemY()-r.getHeight(),c=n===gt.DOWN?i.code_flag_downstem:i.code_flag_upstem;wt.renderGlyph(s,h,u,o,c)}}drawModifiers(){this.modifiers.forEach(t=>{t.getCategory()==="dots"&&!this.render_options.draw_dots||(t.setContext(this.context),t.drawWithStyle())})}drawStemThrough(){let t=this.getStemX(),i=this.getStemY(),s=this.context,r=this.render_options.draw_stem_through_stave;if(this.render_options.draw_stem&&r){let n=$h(i,Jh(this.stave.getNumLines(),this.positions.map(a=>a.str)),this.getStave(),this.getStemDirection());s.save(),s.setLineWidth(gt.WIDTH),n.forEach(a=>{a.length!==0&&(s.beginPath(),s.moveTo(t,a[0]),s.lineTo(t,a[a.length-1]),s.stroke(),s.closePath())}),s.restore()}}drawPositions(){let t=this.context,i=this.getAbsoluteX(),s=this.ys;for(let r=0;r<this.positions.length;++r){let n=s[r]+this.render_options.y_shift,a=this.glyphs[r],o=i+this.glyph.getWidth()/2-a.getWidth()/2;if(t.clearRect(o-2,n-3,a.getWidth()+4,6),a.code)wt.renderGlyph(t,o,n,this.render_options.glyph_font_scale*this.render_options.scale,a.code);else{t.save(),t.setRawFont(this.render_options.font);let l=a.text.toString();t.fillText(l,o,n+5*this.render_options.scale),t.restore()}}}draw(){if(this.checkContext(),!this.stave)throw new w.RERR("NoStave","Can't draw without a stave.");if(this.ys.length===0)throw new w.RERR("NoYValues","Can't draw note without Y values.");this.setRendered();let t=this.beam==null&&this.render_options.draw_stem;this.drawPositions(),this.drawStemThrough();let i=this.getStemX();this.stem.setNoteHeadXBounds(i,i),t&&(this.context.openGroup("stem",null,{pointerBBox:!0}),this.stem.setContext(this.context).draw(),this.context.closeGroup()),this.drawFlag(),this.drawModifiers()}};function Zh(...e){Kn.DEBUG&&w.L("Vex.Flow.VibratoBracket",e)}var Kn=class extends fe{constructor(e){super(),this.setAttribute("type","VibratoBracket"),this.start=e.start,this.stop=e.stop,this.line=1,this.render_options={harsh:!1,wave_height:6,wave_width:4,wave_girth:2}}setLine(e){return this.line=e,this}setHarsh(e){return this.render_options.harsh=e,this}draw(){let e=this.context;this.setRendered();let t=this.start?this.start.getStave().getYForTopText(this.line):this.stop.getStave().getYForTopText(this.line),i=this.start?this.start.getAbsoluteX():this.stop.getStave().getTieStartX(),s=this.stop?this.stop.getAbsoluteX()-this.stop.getWidth()-5:this.start.getStave().getTieEndX()-10;this.render_options.vibrato_width=s-i,Zh("Rendering VibratoBracket: start_x:",i,"stop_x:",s,"y:",t),Xn.renderVibrato(e,i,t,this.render_options)}},Fr;function Qh(){if(!Fr){let e=new yr({duration:"w",note_type:"r"});Fr={glyph_font_scale:e.render_options.glyph_font_scale,glyph_code:e.glyph_code,width:e.getWidth()}}return Fr}var Ho=class extends fe{constructor(e,t){super(),this.setAttribute("type","MultiMeasureRest"),this.render_options={show_number:!0,number_line:-.5,number_glyph_point:40,padding_left:void 0,padding_right:void 0,line:2,spacing_between_lines_px:10,line_thickness:void 0,serif_thickness:2,use_symbols:!1,symbol_spacing:void 0,semibrave_rest_glyph_scale:D.DEFAULT_NOTATION_FONT_SCALE},w.Merge(this.render_options,t),this.number_of_measures=e,this.xs={left:NaN,right:NaN}}getXs(){return this.xs}setStave(e){return this.stave=e,this}getStave(){return this.stave}drawLine(e,t,i,s){let r=this.stave.getYForLine(this.render_options.line),n=(i-t)*.1;t+=n,i-=n;let a={thickness:this.render_options.serif_thickness,height:s},o=s*.25;isNaN(this.render_options.line_thickness)||(o=this.render_options.line_thickness*.5),e.save(),e.beginPath(),e.moveTo(t,r-s),e.lineTo(t+a.thickness,r-s),e.lineTo(t+a.thickness,r-o),e.lineTo(i-a.thickness,r-o),e.lineTo(i-a.thickness,r-s),e.lineTo(i,r-s),e.lineTo(i,r+s),e.lineTo(i-a.thickness,r+s),e.lineTo(i-a.thickness,r+o),e.lineTo(t+a.thickness,r+o),e.lineTo(t+a.thickness,r+s),e.lineTo(t,r+s),e.closePath(),e.fill()}
5drawSymbols(e,t,i,s){let r=Math.floor(this.number_of_measures/4),n=this.number_of_measures%4,a=Math.floor(n/2),o=n%2,l=Qh(),h=l.width*(this.render_options.semibrave_rest_glyph_scale/l.glyph_font_scale),u={2:{width:h*.5,height:s},1:{width:h}},c=h*1.35;isNaN(this.render_options.symbol_spacing)||(c=this.render_options.symbol_spacing);let d=r*u[2].width+a*u[2].width+o*u[1].width+(r+a+o-1)*c,f=t+(i-t)*.5-d*.5,p=this.stave.getYForLine(this.render_options.line-1),m=this.stave.getYForLine(this.render_options.line),g=this.stave.getYForLine(this.render_options.line+1);e.save(),e.setStrokeStyle("none"),e.setLineWidth(0);for(let b=0;b<r;++b)e.fillRect(f,m-u[2].height,u[2].width,u[2].height),e.fillRect(f,g-u[2].height,u[2].width,u[2].height),f+=u[2].width+c;for(let b=0;b<a;++b)e.fillRect(f,m-u[2].height,u[2].width,u[2].height),f+=u[2].width+c;for(let b=0;b<o;++b)wt.renderGlyph(e,f,p,this.render_options.semibrave_rest_glyph_scale,l.glyph_code),f+=u[1].width+c;e.restore()}draw(){this.checkContext(),this.setRendered();let e=this.context,t=this.stave,i=this.render_options.spacing_between_lines_px,s=t.getNoteStartX(),r=t.getNoteEndX(),n=t.getModifiers(Ot.Position.BEGIN);if(n.length===1&&n[0].getCategory()==="barlines"&&(s-=n[0].getWidth()),isNaN(this.render_options.padding_left)||(s=t.getX()+this.render_options.padding_left),isNaN(this.render_options.padding_right)||(r=t.getX()+t.getWidth()-this.render_options.padding_right),this.xs.left=s,this.xs.right=r,this.render_options.use_symbols?this.drawSymbols(e,s,r,i):this.drawLine(e,s,r,i),this.render_options.show_number){let a="/"+this.number_of_measures,o=new Ts(null,void 0,!1);o.point=this.render_options.number_glyph_point,o.setTimeSig(a),o.setStave(t),o.x=s+(r-s)*.5-o.timeSig.glyph.getMetrics().width*.5,o.bottomLine=this.render_options.number_line,o.setContext(e).draw()}}},Xo=class Yo extends ze{static get CATEGORY(){return"clefnote"}constructor(t,i,s){super({duration:"b"}),this.setAttribute("type","ClefNote"),this.setType(t,i,s),this.ignore_ticks=!0}setType(t,i,s){return this.type=t,this.clef_obj=new ws(t,i,s),this.clef=this.clef_obj.clef,this.glyph=new wt(this.clef.code,this.clef.point),this.setWidth(this.glyph.getMetrics().width),this}getClef(){return this.clef}setContext(t){return this.context=t,this.glyph.setContext(this.context),this}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}getCategory(){return Yo.CATEGORY}preFormat(){return this.setPreFormatted(!0),this}draw(){if(!this.stave)throw new w.RERR("NoStave","Can't draw without a stave.");this.glyph.getContext()||this.glyph.setContext(this.context),this.setRendered();let t=this.getAbsoluteX();if(this.glyph.setStave(this.stave),this.glyph.setYShift(this.stave.getYForLine(this.clef.line)-this.stave.getYForGlyphs()),this.glyph.renderToStave(t),this.clef_obj.annotation!==void 0){let i=new wt(this.clef_obj.annotation.code,this.clef_obj.annotation.point);i.getContext()||i.setContext(this.context),i.setStave(this.stave),i.setYShift(this.stave.getYForLine(this.clef_obj.annotation.line)-this.stave.getYForGlyphs()),i.setXShift(this.clef_obj.annotation.x_shift),i.renderToStave(t)}}},jo=class extends ze{constructor(e,t,i){super({duration:"b"}),this.setAttribute("type","KeySigNote"),this.keySignature=new ur(e,t,i),this.ignore_ticks=!0}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this.keySignature.setStave(this.stave),this.keySignature.format(),this.setWidth(this.keySignature.width),this}draw(){this.stave.checkContext(),this.setRendered(),this.keySignature.x=this.getAbsoluteX(),this.keySignature.setContext(this.context),this.keySignature.draw()}},Ko=class extends ze{constructor(e,t){super({duration:"b"}),this.setAttribute("type","TimeSigNote");let i=new Ts(e,t);this.timeSig=i.getTimeSig(),this.setWidth(this.timeSig.glyph.getMetrics().width),this.ignore_ticks=!0}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){this.stave.checkContext(),this.setRendered(),this.timeSig.glyph.getContext()||this.timeSig.glyph.setContext(this.context),this.timeSig.glyph.setStave(this.stave),this.timeSig.glyph.setYShift(this.stave.getYForLine(this.timeSig.line)-this.stave.getYForGlyphs()),this.timeSig.glyph.renderToStave(this.getAbsoluteX())}},tu=class di extends Vn{static get SLIDE_UP(){return 1}static get SLIDE_DOWN(){return-1}
5static createSlideUp(t){return new di(t,di.SLIDE_UP)}static createSlideDown(t){return new di(t,di.SLIDE_DOWN)}constructor(t,i){if(super(t,"sl."),this.setAttribute("type","TabSlide"),!i){let s=t.first_note.getPositions()[0].fret,r=t.last_note.getPositions()[0].fret;i=parseInt(s,10)>parseInt(r,10)?di.SLIDE_DOWN:di.SLIDE_UP}this.slide_direction=i,this.render_options.cp1=11,this.render_options.cp2=14,this.render_options.y_shift=.5,this.setFont({font:"Times",size:10,style:"bold italic"}),this.setNotes(t)}renderTie(t){if(t.first_ys.length===0||t.last_ys.length===0)throw new w.RERR("BadArguments","No Y-values to render");let i=this.context,s=t.first_x_px,r=t.first_ys,n=t.last_x_px,a=this.slide_direction;if(a!==di.SLIDE_UP&&a!==di.SLIDE_DOWN)throw new w.RERR("BadSlide","Invalid slide direction");for(let o=0;o<this.first_indices.length;++o){let l=r[this.first_indices[o]]+this.render_options.y_shift;if(isNaN(l))throw new w.RERR("BadArguments","Bad indices for slide rendering.");i.beginPath(),i.moveTo(s,l+3*a),i.lineTo(n,l-3*a),i.closePath(),i.stroke()}this.setRendered()}},qn=class Ks extends me{static get CATEGORY(){return"gracenotes"}static get LEDGER_LINE_OFFSET(){return 2}static get SCALE(){return .66}constructor(t){super(Object.assign(t,{glyph_font_scale:D.DEFAULT_NOTATION_FONT_SCALE*Ks.SCALE,stroke_px:Ks.LEDGER_LINE_OFFSET})),this.setAttribute("type","GraceNote"),this.slash=t.slash,this.slur=!0,this.buildNoteHeads(),this.width=3}getStemExtension(){if(this.stem_extension_override!=null)return this.stem_extension_override;let t=this.getGlyph();if(t){let i=super.getStemExtension();if(t.stem){let s=this.getStaveNoteScale();i=(gt.HEIGHT+i)*s-gt.HEIGHT}return i}return 0}getCategory(){return Ks.CATEGORY}getStaveNoteScale(){return this.render_options.glyph_font_scale/D.DEFAULT_NOTATION_FONT_SCALE}draw(){super.draw(),this.setRendered();let t=this.stem;if(this.slash&&t){let i=this.getStaveNoteScale(),s=i/.66,r,n=this.beam;if(n)n.postFormatted||n.postFormat(),r=this.calcBeamedNotesSlashBBox(8*s,8*s,{stem:6*s,beam:5*s});else{let o=this.getStemDirection(),l=this.getNoteHeadBounds(),h=t.getHeight(),u=this.getAbsoluteX(),c=o===D.Stem.DOWN?l.y_top-h:l.y_bottom-h,d=o===D.Stem.DOWN?this.glyph.stem_down_extension:this.glyph.stem_up_extension,f=D.STEM_HEIGHT;f-=f/2.8,f+=d,c+=f*i*o;let p=o===D.Stem.UP?{x1:1,y1:0,x2:13,y2:-9}:{x1:-4,y1:1,x2:13,y2:9};u+=p.x1*s,c+=p.y1*s,r={x1:u,y1:c,x2:u+p.x2*s,y2:c+p.y2*s}}let a=this.context;a.save(),a.setLineWidth(1*s),a.beginPath(),a.moveTo(r.x1,r.y1),a.lineTo(r.x2,r.y2),a.closePath(),a.stroke(),a.restore()}}calcBeamedNotesSlashBBox(t,i,s){let r=this.beam,n=r.slope,a=r.notes[r.notes.length-1]===this?-1:1,o=Math.atan(n*a),l={dx:Math.cos(o)*i,dy:Math.sin(o)*i};t*=this.getStemDirection();let h=Math.atan((l.dy-t)/l.dx),u=Math.cos(h)*s.stem*a,c=Math.sin(h)*s.stem,d=Math.cos(h)*s.beam*a,f=Math.sin(h)*s.beam,p=this.getStemX(),m=r.notes[0].getStemX(),g=this.beam.getBeamYToDraw()+(p-m)*n;return{x1:p-u,y1:g+t-c,x2:p+l.dx*a+d,y2:g+l.dy+f}}},eu=class qo extends jn{static get CATEGORY(){return"gracetabnotes"}constructor(t){super(t,!1),this.setAttribute("type","GraceTabNote"),w.Merge(this.render_options,{y_shift:.3,scale:.6,font:"7.5pt Arial"}),this.updateWidth()}getCategory(){return qo.CATEGORY}draw(){super.draw(),this.setRendered()}},iu=class un{static get names(){return{standard:"E/5,B/4,G/4,D/4,A/3,E/3",dagdad:"D/5,A/4,G/4,D/4,A/3,D/3",dropd:"E/5,B/4,G/4,D/4,A/3,D/3",eb:"Eb/5,Bb/4,Gb/4,Db/4,Ab/3,Db/3",standardBanjo:"D/5,B/4,G/4,D/4,G/5"}}constructor(t="E/5,B/4,G/4,D/4,A/3,E/3,B/2,E/2"){this.setTuning(t)}noteToInteger(t){return D.keyProperties(t).int_value}setTuning(t){un.names[t]&&(t=un.names[t]),this.tuningString=t,this.tuningValues=[],this.numStrings=0;let i=t.split(/\s*,\s*/);if(i.length===0)throw new w.RERR("BadArguments","Invalid tuning string: "+t);this.numStrings=i.length;for(let s=0;s<this.numStrings;++s)this.tuningValues[s]=this.noteToInteger(i[s])}getValueForString(t){let i=parseInt(t,10);if(i<1||i>this.numStrings)throw new w.RERR("BadArguments",`String number must be between 1 and ${this.numStrings}:${t}`);return this.tuningValues[i-1]}getValueForFret(t,i){let s=this.getValueForString(i),r=parseInt(t,10);if(r<0)throw new w.RERR("BadArguments","Fret number must be 0 or higher: "+t);return s+r}getNoteForFret(t,i){let s=this.getValueForFret(t,i),r=Math.floor(s/12),n=s%12;return D.integerToNote(n)+"/"+r}},su=class{constructor(e){this.music=new mi,this.setKey(e)}setKey(e){return this.key=e,this.reset(),this}getKey(){return this.key}reset(){if(this.keyParts=this.music.getKeyParts(this.key),this.keyString=this.keyParts.root,this.keyParts.accidental&&(this.keyString+=this.keyParts.accidental),!mi.scaleTypes[this.keyParts.type])throw new w.RERR("BadArguments",`Unsupported key type: ${this.key}`);this.scale=this.music.getScaleTones(this.music.getNoteValue(this.keyString),mi.scaleTypes[this.keyParts.type]),this.scaleMap={},this.scaleMapByValue={},this.originalScaleMapByValue={};let e=mi.root_indices[this.keyParts.root];for(let t=0;t<mi.roots.length;++t){let i=(e+t)%mi.roots.length,s=mi.roots[i],r=this.music.getRelativeNoteName(s,this.scale[t]);this.scaleMap[s]=r,this.scaleMapByValue[this.scale[t]]=r,this.originalScaleMapByValue[this.scale[t]]=r}return this}getAccidental(e){let t=this.music.getKeyParts(e).root,i=this.music.getNoteParts(this.scaleMap[t]);return{note:this.scaleMap[t],accidental:i.accidental}}selectNote(e){e=e.toLowerCase();let t=this.music.getNoteParts(e),i=this.scaleMap[t.root],s=this.music.getNoteParts(i);if(i===e)return{note:i,accidental:t.accidental,change:!1};let r=this.scaleMapByValue[this.music.getNoteValue(e)];if(r!=null)return{note:r,accidental:this.music.getNoteParts(r).accidental,change:!1};let n=this.originalScaleMapByValue[this.music.getNoteValue(e)];return n==null?s.root===e?(delete this.scaleMapByValue[this.music.getNoteValue(this.scaleMap[t.root])],this.scaleMapByValue[this.music.getNoteValue(s.root)]=s.root,this.scaleMap[s.root]=s.root,{note:s.root,accidental:null,change:!0}):(delete this.scaleMapByValue[this.music.getNoteValue(this.scaleMap[t.root])],this.scaleMapByValue[this.music.getNoteValue(e)]=e,delete this.scaleMap[s.root],this.scaleMap[s.root]=e,{note:e,accidental:t.accidental,change:!0}):(this.scaleMap[s.root]=n,delete this.scaleMapByValue[this.music.getNoteValue(i)],this.scaleMapByValue[this.music.getNoteValue(e)]=n,{note:n,accidental:this.music.getNoteParts(n).accidental,change:!0})}},ru=class qs extends fe{static get type(){return{CRESC:1,DECRESC:2}}static FormatByTicksAndDraw(t,i,s,r,n,a){let o=i.pixelsPerTick;
5if(o==null)throw new w.RuntimeError("BadArguments","A valid Formatter must be provide to draw offsets by ticks.");let l=o*a.left_shift_ticks,h=o*a.right_shift_ticks,u={height:a.height,y_shift:a.y_shift,left_shift_px:l,right_shift_px:h};new qs({first_note:s.first_note,last_note:s.last_note},r).setContext(t).setRenderOptions(u).setPosition(n).draw()}constructor(t,i){super(),this.setAttribute("type","StaveHairpin"),this.notes=t,this.hairpin=i,this.position=St.Position.BELOW,this.render_options={height:10,y_shift:0,left_shift_px:0,right_shift_px:0},this.setNotes(t)}setPosition(t){return(t===St.Position.ABOVE||t===St.Position.BELOW)&&(this.position=t),this}setRenderOptions(t){return t.height!=null&&t.y_shift!=null&&t.left_shift_px!=null&&t.right_shift_px!=null&&(this.render_options=t),this}setNotes(t){if(!t.first_note&&!t.last_note)throw new w.RuntimeError("BadArguments","Hairpin needs to have either first_note or last_note set.");return this.first_note=t.first_note,this.last_note=t.last_note,this}renderHairpin(t){let i=this.checkContext(),s=this.render_options.y_shift+20,r=t.first_y;this.position===St.Position.ABOVE&&(s=-s+30,r=t.first_y-t.staff_height);let n=this.render_options.left_shift_px,a=this.render_options.right_shift_px;switch(i.beginPath(),this.hairpin){case qs.type.CRESC:i.moveTo(t.last_x+a,r+s),i.lineTo(t.first_x+n,r+this.render_options.height/2+s),i.lineTo(t.last_x+a,r+this.render_options.height+s);break;case qs.type.DECRESC:i.moveTo(t.first_x+n,r+s),i.lineTo(t.last_x+a,r+this.render_options.height/2+s),i.lineTo(t.first_x+n,r+this.render_options.height+s);break;default:break}i.stroke(),i.closePath()}draw(){this.checkContext(),this.setRendered();let t=this.first_note,i=this.last_note,s=t.getModifierStartXY(this.position,0),r=i.getModifierStartXY(this.position,0);return this.renderHairpin({first_x:s.x,last_x:r.x,first_y:t.getStave().y+t.getStave().height,last_y:i.getStave().y+i.getStave().height,staff_height:t.getStave().height}),!0}},Jo=class fi extends fe{static get Position(){return{NEAR_HEAD:1,NEAR_TOP:2}}static get PositionString(){return{nearHead:fi.Position.NEAR_HEAD,nearTop:fi.Position.NEAR_TOP}}constructor(t,i,s){super(),this.setAttribute("type","Curve"),this.render_options={spacing:2,thickness:2,x_shift:0,y_shift:10,position:fi.Position.NEAR_HEAD,position_end:fi.Position.NEAR_HEAD,invert:!1,cps:[{x:0,y:10},{x:0,y:10}]},w.Merge(this.render_options,s),this.setNotes(t,i)}setNotes(t,i){if(!t&&!i)throw new w.RuntimeError("BadArguments","Curve needs to have either first_note or last_note set.");return this.from=t,this.to=i,this}isPartial(){return!this.from||!this.to}renderCurve(t){let i=this.context,s=this.render_options.cps,r=this.render_options.x_shift,n=this.render_options.y_shift*t.direction,a=t.first_x+r,o=t.first_y+n,l=t.last_x-r,h=t.last_y+n,u=this.render_options.thickness,c=(l-a)/(s.length+2);i.beginPath(),i.moveTo(a,o),i.bezierCurveTo(a+c+s[0].x,o+s[0].y*t.direction,l-c+s[1].x,h+s[1].y*t.direction,l,h),i.bezierCurveTo(l-c+s[1].x,h+(s[1].y+u)*t.direction,a+c+s[0].x,o+(s[0].y+u)*t.direction,a,o),i.stroke(),i.closePath(),i.fill()}draw(){this.checkContext(),this.setRendered();let t=this.from,i=this.to,s,r,n,a,o,l="baseY",h="baseY";function u(f){return typeof f=="string"?fi.PositionString[f]:f}let c=u(this.render_options.position),d=u(this.render_options.position_end);return c===fi.Position.NEAR_TOP&&(l="topY",h="topY"),d===fi.Position.NEAR_HEAD?h="baseY":d===fi.Position.NEAR_TOP&&(h="topY"),t?(s=t.getTieRightX(),o=t.getStemDirection(),n=t.getStemExtents()[l]):(s=i.getStave().getTieStartX(),n=i.getStemExtents()[l]),i?(r=i.getTieLeftX(),o=i.getStemDirection(),a=i.getStemExtents()[h]):(r=t.getStave().getTieEndX(),a=t.getStemExtents()[h]),this.renderCurve({first_x:s,last_x:r,first_y:n,last_y:a,direction:o*(this.render_options.invert===!0?-1:1)}),!0}};function Ca(...e){Jn.DEBUG&&w.L("Vex.Flow.TextDynamics",e)}var Jn=class cn extends ze{static get GLYPHS(){return{f:{code:"vba",width:12},p:{code:"vbf",width:14},m:{code:"v62",width:17},s:{code:"v4a",width:10},z:{code:"v80",width:12},r:{code:"vb1",width:12}}}constructor(t){super(t),this.setAttribute("type","TextDynamics"),this.sequence=t.text.toLowerCase(),this.line=t.line||0,this.glyphs=[],w.Merge(this.render_options,{glyph_font_size:40}),Ca("New Dynamics Text: ",this.sequence)}setLine(t){return this.line=t,this}preFormat(){let t=0;return this.sequence.split("").forEach(i=>
5{let s=cn.GLYPHS[i];if(!s)throw new w.RERR("Invalid dynamics character: "+i);let r=this.render_options.glyph_font_size,n=new wt(s.code,r);this.glyphs.push(n),t+=s.width}),this.setWidth(t),this.preFormatted=!0,this}draw(){this.setRendered();let t=this.getAbsoluteX(),i=this.stave.getYForLine(this.line+-3);Ca("Rendering Dynamics: ",this.sequence);let s=t;this.glyphs.forEach((r,n)=>{let a=this.sequence[n];r.render(this.context,s,i),s+=cn.GLYPHS[a].width})}};function Na(e,t,i,s,r,n,a){e.beginPath(),e.moveTo(t,i),e.lineTo(s,r),e.lineTo(n,a),e.lineTo(t,i),e.closePath(),e.fill()}function nu(e,t,i,s){let r=s.draw_start_arrow&&s.draw_end_arrow,n=t.x,a=t.y,o=i.x,l=i.y,h=Math.sqrt((o-n)*(o-n)+(l-a)*(l-a)),u=(h-s.arrowhead_length/3)/h,c,d,f,p;s.draw_end_arrow||r?(c=Math.round(n+(o-n)*u),d=Math.round(a+(l-a)*u)):(c=o,d=l),s.draw_start_arrow||r?(f=n+(o-n)*(1-u),p=a+(l-a)*(1-u)):(f=n,p=a),s.color&&(e.setStrokeStyle(s.color),e.setFillStyle(s.color)),e.beginPath(),e.moveTo(f,p),e.lineTo(c,d),e.stroke(),e.closePath();let m=Math.atan2(l-a,o-n),g=Math.abs(s.arrowhead_length/Math.cos(s.arrowhead_angle)),b,S,E,y,M,P;(s.draw_end_arrow||r)&&(b=m+Math.PI+s.arrowhead_angle,E=o+Math.cos(b)*g,y=l+Math.sin(b)*g,S=m+Math.PI-s.arrowhead_angle,M=o+Math.cos(S)*g,P=l+Math.sin(S)*g,Na(e,E,y,o,l,M,P)),(s.draw_start_arrow||r)&&(b=m+s.arrowhead_angle,E=n+Math.cos(b)*g,y=a+Math.sin(b)*g,S=m-s.arrowhead_angle,M=n+Math.cos(S)*g,P=a+Math.sin(S)*g,Na(e,E,y,n,a,M,P))}var $o=class vi extends fe{static get TextVerticalPosition(){return{TOP:1,BOTTOM:2}}static get TextJustification(){return{LEFT:1,CENTER:2,RIGHT:3}}constructor(t){super(),this.setAttribute("type","StaveLine"),this.notes=t,this.text="",this.font={family:"Arial",size:10,weight:""},this.render_options={padding_left:4,padding_right:3,line_width:1,line_dash:null,rounded_end:!0,color:null,draw_start_arrow:!1,draw_end_arrow:!1,arrowhead_length:10,arrowhead_angle:Math.PI/8,text_position_vertical:vi.TextVerticalPosition.TOP,text_justification:vi.TextJustification.CENTER},this.setNotes(t)}setFont(t){return this.font=t,this}setText(t){return this.text=t,this}setNotes(t){if(!t.first_note&&!t.last_note)throw new w.RuntimeError("BadArguments","Notes needs to have either first_note or last_note set.");if(t.first_indices||(t.first_indices=[0]),t.last_indices||(t.last_indices=[0]),t.first_indices.length!==t.last_indices.length)throw new w.RuntimeError("BadArguments","Connected notes must have similar index sizes");return this.first_note=t.first_note,this.first_indices=t.first_indices,this.last_note=t.last_note,this.last_indices=t.last_indices,this}applyLineStyle(){let t=this.checkContext(),i=this.render_options;i.line_dash&&t.setLineDash(i.line_dash),i.line_width&&t.setLineWidth(i.line_width),i.rounded_end?t.setLineCap("round"):t.setLineCap("square")}
5applyFontStyle(){let t=this.checkContext();this.font&&t.setFont(this.font.family,this.font.size,this.font.weight),this.render_options.color&&(t.setStrokeStyle(this.render_options.color),t.setFillStyle(this.render_options.color))}draw(){let t=this.checkContext();this.setRendered();let i=this.first_note,s=this.last_note,r=this.render_options;t.save(),this.applyLineStyle();let n,a;this.first_indices.forEach((d,f)=>{let p=this.last_indices[f];n=i.getModifierStartXY(2,d),a=s.getModifierStartXY(1,p);let m=n.y>a.y;n.x+=i.getMetrics().modRightPx+r.padding_left,a.x-=s.getMetrics().modLeftPx+r.padding_right;let g=i.getGlyph().getWidth();i.getKeyProps()[d].displaced&&i.getStemDirection()===1&&(n.x+=g+r.padding_left),s.getKeyProps()[p].displaced&&s.getStemDirection()===-1&&(a.x-=g+r.padding_right),n.y+=m?-3:1,a.y+=m?2:0,nu(t,n,a,this.render_options)}),t.restore();let o=t.measureText(this.text).width,l=r.text_justification,h=0;l===vi.TextJustification.LEFT?h=n.x:l===vi.TextJustification.CENTER?h=(a.x-n.x)/2+n.x-o/2:l===vi.TextJustification.RIGHT&&(h=a.x-o);let u,c=r.text_position_vertical;return c===vi.TextVerticalPosition.TOP?u=i.getStave().getYForTopText():c===vi.TextVerticalPosition.BOTTOM&&(u=i.getStave().getYForBottomText(D.TEXT_HEIGHT_OFFSET_HACK)),t.save(),this.applyFontStyle(),t.fillText(this.text,h,u),t.restore(),this}};function au(...e){Ps.DEBUG&&w.L("Vex.Flow.PedalMarking",e)}function Dr(e,t,i,s,r){let n=Ps.GLYPHS[e];new wt(n.code,r).render(t,i+n.x_shift,s+n.y_shift)}var Ps=class Be extends fe{static get GLYPHS(){return{pedal_depress:{code:"v36",x_shift:-10,y_shift:0},pedal_release:{code:"v5d",x_shift:-2,y_shift:3}}}static get Styles(){return{TEXT:1,BRACKET:2,MIXED:3}}static get StylesString(){return{text:Be.Styles.TEXT,bracket:Be.Styles.BRACKET,mixed:Be.Styles.MIXED}}static createSustain(t){return new Be(t)}static createSostenuto(t){let i=new Be(t);return i.setStyle(Be.Styles.MIXED),i.setCustomText("Sost. Ped."),i}static createUnaCorda(t){let i=new Be(t);return i.setStyle(Be.Styles.TEXT),i.setCustomText("una corda","tre corda"),i}constructor(t){super(),this.setAttribute("type","PedalMarking"),this.notes=t,this.style=Be.TEXT,this.line=0,this.custom_depress_text="",this.custom_release_text="",this.font={family:"Times New Roman",size:12,weight:"italic bold"},this.render_options={bracket_height:10,text_margin_right:6,bracket_line_width:1,glyph_point_size:40,color:"black"}}setCustomText(t,i){return this.custom_depress_text=t||"",this.custom_release_text=i||"",this}setStyle(t){if(t<1&&t>3)throw new w.RERR("InvalidParameter","The style must be one found in PedalMarking.Styles");return this.style=t,this}setLine(t){return this.line=t,this}drawBracketed(){let t=this.context,i=!1,s,r,n=this;this.notes.forEach((a,o,l)=>{i=!i;let h=a.getAbsoluteX(),u=a.getStave().getYForBottomText(n.line+3);if(h<s)throw new w.RERR("InvalidConfiguration","The notes provided must be in order of ascending x positions");let c=l[o+1]===a,d=l[o-1]===a,f=0;if(i)if(f=d?5:0,n.style===Be.Styles.MIXED&&!d)if(n.custom_depress_text){let p=t.measureText(n.custom_depress_text).width;t.fillText(n.custom_depress_text,h-p/2,u),f=p/2+n.render_options.text_margin_right}else Dr("pedal_depress",t,h,u,n.render_options.glyph_point_size),f=20+n.render_options.text_margin_right;else t.beginPath(),t.moveTo(h,u-n.render_options.bracket_height),t.lineTo(h+f,u),t.stroke(),t.closePath();else f=c?-5:0,t.beginPath(),t.moveTo(s,r),t.lineTo(h+f,u),t.lineTo(h,u-n.render_options.bracket_height),t.stroke(),t.closePath();s=h+f,r=u})}drawText(){let t=this.context,i=!1,s=this,r=s.render_options.glyph_point_size;this.notes.forEach(n=>{i=!i;let a=n.getStave(),o=n.getAbsoluteX(),l=a.getYForBottomText(s.line+3),h=0;i?s.custom_depress_text?(h=t.measureText(s.custom_depress_text).width,t.fillText(s.custom_depress_text,o-h/2,l)):Dr("pedal_depress",t,o,l,r):s.custom_release_text?(h=t.measureText(s.custom_release_text).width,t.fillText(s.custom_release_text,o-h/2,l)):Dr("pedal_release",t,o,l,r)})}draw(){let t=this.checkContext();this.setRendered(),t.save(),t.setStrokeStyle(this.render_options.color),t.setFillStyle(this.render_options.color),t.setFont(this.font.family,this.font.size,this.font.weight),au("Rendering Pedal Marking"),this.style===Be.Styles.BRACKET||this.style===Be.Styles.MIXED?(t.
5setLineWidth(this.render_options.bracket_line_width),this.drawBracketed()):this.style===Be.Styles.TEXT&&this.drawText(),t.restore()}};function ou(...e){$n.DEBUG&&w.L("Vex.Flow.TextBracket",e)}var $n=class pi extends fe{static get Positions(){return{TOP:1,BOTTOM:-1}}static get PositionString(){return{top:pi.Positions.TOP,bottom:pi.Positions.BOTTOM}}constructor({start:t,stop:i,text:s="",superscript:r="",position:n=pi.Positions.TOP}){super(),this.setAttribute("type","TextBracket"),this.start=t,this.stop=i,this.text=s,this.superscript=r,this.position=typeof n=="string"?pi.PositionString[n]:n,this.line=1,this.font={family:"Serif",size:15,weight:"italic"},this.render_options={dashed:!0,dash:[5],color:"black",line_width:1,show_bracket:!0,bracket_height:8,underline_superscript:!0}}applyStyle(t){return t.setFont(this.font.family,this.font.size,this.font.weight),t.setStrokeStyle(this.render_options.color),t.setFillStyle(this.render_options.color),t.setLineWidth(this.render_options.line_width),this}setDashed(t,i){return this.render_options.dashed=t,i&&(this.render_options.dash=i),this}setFont(t){return this.font={...this.font,...t},this}setLine(t){return this.line=t,this}draw(){let t=this.context;this.setRendered();let i=0;switch(this.position){case pi.Positions.TOP:i=this.start.getStave().getYForTopText(this.line);break;case pi.Positions.BOTTOM:i=this.start.getStave().getYForBottomText(this.line+D.TEXT_HEIGHT_OFFSET_HACK);break;default:throw new w.RERR("InvalidPosition",`The position ${this.position} is invalid`)}let s={x:this.start.getAbsoluteX(),y:i},r={x:this.stop.getAbsoluteX(),y:i};ou("Rendering TextBracket: start:",s,"stop:",r,"y:",i);let n=this.render_options.bracket_height*this.position;t.save(),this.applyStyle(t),t.fillText(this.text,s.x,s.y);let a=t.measureText(this.text).width,o=t.measureText("M").width,l=s.y-o/2.5;t.setFont(this.font.family,this.font.size/1.4,this.font.weight),t.fillText(this.superscript,s.x+a+1,l);let h=t.measureText(this.superscript).width,u=t.measureText("M").width,c=s.x,d=l,f=r.x+this.stop.getGlyph().getWidth();this.position===pi.Positions.TOP?(c+=a+h+5,d-=u/2.7):this.position===pi.Positions.BOTTOM&&(d+=u/2.7,c+=a+2,this.render_options.underline_superscript||(c+=h)),this.render_options.dashed?(ke.drawDashedLine(t,c,d,f,d,this.render_options.dash),this.render_options.show_bracket&&ke.drawDashedLine(t,f,d+1*this.position,f,d+n,this.render_options.dash)):(t.beginPath(),t.moveTo(c,d),t.lineTo(f,d),this.render_options.show_bracket&&t.lineTo(f,d+n),t.stroke(),t.closePath()),t.restore()}};function lu(...e){Zn.DEBUG&&w.L("Vex.Flow.BarNote",e)}var Zn=class extends ze{constructor(e=Pe.type.SINGLE){super({duration:"b"}),this.setAttribute("type","BarNote"),this.metrics={widths:{}};let t=Pe.type;this.metrics.widths={[t.SINGLE]:8,[t.DOUBLE]:12,[t.END]:15,[t.REPEAT_BEGIN]:14,[t.REPEAT_END]:14,[t.REPEAT_BOTH]:18,[t.NONE]:0},this.ignore_ticks=!0,this.setType(e)}getType(){return this.type}setType(e){return this.type=typeof e=="string"?Pe.typeString[e]:e,this.setWidth(this.metrics.widths[this.type]),this}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){if(this.checkContext(),!this.stave)throw new w.RERR("NoStave","Can't draw without a stave.");lu("Rendering bar line at: ",this.getAbsoluteX());let e=new Pe(this.type);e.setX(this.getAbsoluteX()),e.draw(this.stave),this.setRendered()}},Zo=class extends Fn{constructor(e){if(!e)throw new w.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");let t;if(typeof e=="string")t={duration:e};else if(typeof e=="object")t=e;else throw new w.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");super(t),this.setAttribute("type","GhostNote"),this.setWidth(0)}isRest(){return!0}setStave(e){super.setStave(e)}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){if(!this.stave)throw new w.RERR("NoStave","Can't draw without a stave.");this.setRendered();for(let e=0;e<this.modifiers.length;++e){let t=this.modifiers[e];t.setContext(this.context),t.drawWithStyle()}}},hu=class Hi extends St{static get CATEGORY(){return"tremolo"}static get YOFFSETSTEMUP(){return-9}static get YOFFSETSTEMDOWN(){return-21}static get XOFFSETSTEMUP(){return 6}static get XOFFSETSTEMDOWN(){return-2}constructor(t){super(),this.setAttribute("type","Tremolo"),this.num=t,this.note=null,this.index=null,this.position=St.Position.CENTER,this.code="v74"}getCategory(){return Hi.CATEGORY}draw(){if(this.checkContext(),!(this.note&&this.index!=null))throw new w.RERR("NoAttachedNote","Can't draw Tremolo without a note and index.");this.setRendered();let t=this.note.getStemDirection();this.y_spacing=4*t;let i=this.note.getModifierStartXY(this.position,this.index).x,s=this.note.stem.getExtents().topY,r=this.note.getCategory()==="gracenotes"?qn.SCALE:1;t<0?s+=Hi.YOFFSETSTEMDOWN*r:s+=Hi.YOFFSETSTEMUP*r,this.font={family:"Arial",size:16*r,weight:""},this.render_options={font_scale:35*r,stroke_px:3,stroke_spacing:10*r},i+=t<0?Hi.XOFFSETSTEMDOWN:Hi.XOFFSETSTEMUP;
5for(let n=0;n<this.num;++n)wt.renderGlyph(this.context,i,s,this.render_options.font_scale,this.code),s+=this.y_spacing}};function uu(...e){Qo.DEBUG&&w.L("Vex.Flow.Crescendo",e)}function cu(e,t){let i=t.begin_x,s=t.end_x,r=t.y,n=t.height/2;e.beginPath(),t.reverse?(e.moveTo(i,r-n),e.lineTo(s,r),e.lineTo(i,r+n)):(e.moveTo(s,r-n),e.lineTo(i,r),e.lineTo(s,r+n)),e.stroke(),e.closePath()}var Qo=class extends ze{constructor(e){super(e),this.setAttribute("type","Crescendo"),this.decrescendo=!1,this.line=e.line||0,this.height=15,w.Merge(this.render_options,{extend_left:0,extend_right:0,y_shift:0})}setLine(e){return this.line=e,this}setHeight(e){return this.height=e,this}setDecrescendo(e){return this.decrescendo=e,this}preFormat(){return this.preFormatted=!0,this}draw(){this.checkContext(),this.setRendered();let e=this.getTickContext(),t=$i.getNextContext(e),i=this.getAbsoluteX(),s=t?t.getX():this.stave.x+this.stave.width,r=this.stave.getYForLine(this.line+-3)+1;uu("Drawing ",this.decrescendo?"decrescendo ":"crescendo ",this.height,"x",i-s),cu(this.context,{begin_x:i-this.render_options.extend_left,end_x:s+this.render_options.extend_right,y:r+this.render_options.y_shift,height:this.height,reverse:this.decrescendo})}};function du(...e){Qn.DEBUG&&w.L("Vex.Flow.Parser",e)}var Ia=w.MakeException("ParserError");function Js(e){return e.matchedString===void 0?e.results?Js(e.results):e.length===1?Js(e[0]):e.length===0?null:e.map(Js):e.matchedString}var Qn=class{constructor(e){this.grammar=e}parse(e){this.line=e,this.pos=0,this.errorPos=-1;let t=this.expect(this.grammar.begin());return t.errorPos=this.errorPos,t}matchFail(e){this.errorPos===-1&&(this.errorPos=this.pos),this.pos=e}matchSuccess(){this.errorPos=-1}matchToken(e,t=!1){let i=RegExp(t?"^(("+e+"))":"^(("+e+")\\s*)"),s=this.line.slice(this.pos).match(i);return s===null?{success:!1,pos:this.pos}:{success:!0,matchedString:s[2],incrementPos:s[1].length,pos:this.pos}}expectOne(e,t=!1){let i=[],s=this.pos,r=!0,n=!1;t=t===!0||e.maybe===!0;for(let l=0;l<e.expect.length;l++){let h=e.expect[l],u=this.pos,c=this.expect(h);if(c.success){if(i.push(c),n=!0,e.or)break}else if(r=!1,!e.or){this.pos=u;break}}let a=e.or&&n||r,o=a||t===!0;return t&&!a&&(this.pos=s),o?this.matchSuccess():this.matchFail(s),{success:o,results:i,numMatches:+!!a}}expectOneOrMore(e,t=!1){let i=[],s=this.pos,r=0,n=!0;do{let o=this.expectOne(e);o.success?(r++,i.push(o.results)):n=!1}while(n);let a=r>0||t===!0;return t&&!(r>0)&&(this.pos=s),a?this.matchSuccess():this.matchFail(s),{success:a,results:i,numMatches:r}}expectZeroOrMore(e){return this.expectOneOrMore(e,!0)}expect(e){du("Evaluating rules:",e);let t;if(!e)throw new Ia("Invalid Rule: "+e,e);let i=e.bind(this.grammar)();if(i.token)t=this.matchToken(i.token,i.noSpace===!0),t.success&&(this.pos+=t.incrementPos);else if(i.expect)t=i.oneOrMore?this.expectOneOrMore(i):i.zeroOrMore?this.expectZeroOrMore(i):this.expectOne(i);else throw new Ia("Bad grammar! No `token` or `expect` property",i);return t.matches=[],t.results&&t.results.forEach(s=>t.matches.push(Js(s))),i.run&&t.success&&i.run(t),t}};function ii(...e){ta.DEBUG&&w.L("Vex.Flow.EasyScore",e)}var fu=w.MakeException("EasyScoreError"),pu=class{constructor(e){this.builder=e}begin(){return this.LINE}LINE(){return{expect:[this.PIECE,this.PIECES,this.EOL]}}PIECE(){return{expect:[this.CHORDORNOTE,this.PARAMS],run:()=>this.builder.commitPiece()}}PIECES(){return{expect:[this.COMMA,this.PIECE],zeroOrMore:!0}}PARAMS(){return{expect:[this.DURATION,this.TYPE,this.DOTS,this.OPTS]}}CHORDORNOTE(){return{expect:[this.CHORD,this.SINGLENOTE],or:!0}}CHORD(){return{expect:[this.LPAREN,this.NOTES,this.RPAREN],run:e=>this.builder.addChord(e.matches[1])}}NOTES(){return{expect:[this.NOTE],oneOrMore:!0}}NOTE(){return{expect:[this.NOTENAME,this.ACCIDENTAL,this.OCTAVE]}}SINGLENOTE(){return{expect:[this.NOTENAME,this.ACCIDENTAL,this.OCTAVE],run:e=>this.builder.addSingleNote(e.matches[0],e.matches[1],e.matches[2])}}ACCIDENTAL(){return{expect:[this.ACCIDENTALS],maybe:!0}}DOTS(){return{expect:[this.DOT],zeroOrMore:!0,run:e=>this.builder.setNoteDots(e.matches[0])}}TYPE(){return{expect:[this.SLASH,this.MAYBESLASH,this.TYPES],maybe:!0,run:e=>this.builder.setNoteType(e.matches[2])}}DURATION(){return{expect:[this.SLASH,this.DURATIONS],maybe:!0,run:e=>this.builder.setNoteDuration(e.matches[1])}}OPTS(){return{expect:[this.LBRACKET,this.KEYVAL,this.KEYVALS,this.RBRACKET],maybe:!0}}KEYVALS(){return{expect:[this.COMMA,this.KEYVAL],zeroOrMore:!0}}KEYVAL(){let e=t=>t.slice(1,-1);return{expect:[this.KEY,this.EQUALS,this.VAL],run:t=>this.builder.addNoteOption(t.matches[0],e(t.matches[2]))}}VAL(){return{expect:[this.SVAL,this.DVAL],or:!0}}KEY(){return{token:"[a-zA-Z][a-zA-Z0-9]*"}}DVAL(){return{token:'["][^"]*["]'}}SVAL(){return{token:"['][^']*[']"}}NOTENAME(){return{token:"[a-gA-G]"}}
5OCTAVE(){return{token:"[0-9]+"}}ACCIDENTALS(){return{token:"bbs|bb|bss|bs|b|db|d|##|#|n|\\+\\+-|\\+-|\\+\\+|\\+|k|o"}}DURATIONS(){return{token:"[0-9whq]+"}}TYPES(){return{token:"[rRsSxX]"}}LPAREN(){return{token:"[(]"}}RPAREN(){return{token:"[)]"}}COMMA(){return{token:"[,]"}}DOT(){return{token:"[.]"}}SLASH(){return{token:"[/]"}}MAYBESLASH(){return{token:"[/]?"}}EQUALS(){return{token:"[=]"}}LBRACKET(){return{token:"\\["}}RBRACKET(){return{token:"\\]"}}EOL(){return{token:"$"}}},mu=class{constructor(e){this.factory=e,this.commitHooks=[],this.reset()}reset(e={}){this.options={stem:"auto",clef:"treble"},this.elements={notes:[],accidentals:[]},this.rollingDuration="8",this.resetPiece(),Object.assign(this.options,e)}getFactory(){return this.factory}getElements(){return this.elements}addCommitHook(e){this.commitHooks.push(e)}resetPiece(){ii("resetPiece"),this.piece={chord:[],duration:this.rollingDuration,dots:0,type:void 0,options:{}}}setNoteDots(e){ii("setNoteDots:",e),e&&(this.piece.dots=e.length)}setNoteDuration(e){ii("setNoteDuration:",e),this.rollingDuration=this.piece.duration=e||this.rollingDuration}setNoteType(e){ii("setNoteType:",e),e&&(this.piece.type=e)}addNoteOption(e,t){ii("addNoteOption: key:",e,"value:",t),this.piece.options[e]=t}addNote(e,t,i){ii("addNote:",e,t,i),this.piece.chord.push({key:e,accid:t,octave:i})}addSingleNote(e,t,i){ii("addSingleNote:",e,t,i),this.addNote(e,t,i)}addChord(e){ii("startChord"),typeof e[0]=="object"?e.forEach(t=>{t&&this.addNote(...t)}):this.addSingleNote(e[0]),ii("endChord")}commitPiece(){ii("commitPiece");let{factory:e}=this;if(!e)return;let t={...this.options,...this.piece.options},{stem:i,clef:s}=t,r=i.toLowerCase()==="auto",n=!r&&i.toLowerCase()==="up"?me.STEM_UP:me.STEM_DOWN,{chord:a,duration:o,dots:l,type:h}=this.piece,u=a.map(f=>f.key+"/"+f.octave),c=e.StaveNote({keys:u,duration:o,dots:l,type:h,clef:s,auto_stem:r});r||c.setStemDirection(n);let d=a.map(f=>f.accid||null);d.forEach((f,p)=>{f&&c.addAccidental(p,e.Accidental({type:f}))});for(let f=0;f<l;f++)c.addDotToAll();this.commitHooks.forEach(f=>f(t,c,this)),this.elements.notes.push(c),this.elements.accidentals.concat(d),this.resetPiece()}};function gu({id:e},t){e!==void 0&&t.setAttribute("id",e)}function bu(e,t){e.class&&e.class.split(/\s*,\s*/).forEach(i=>t.addClass(i))}var ta=class{constructor(e={}){this.setOptions(e),this.defaults={clef:"treble",time:"4/4",stem:"auto"}}set(e){return Object.assign(this.defaults,e),this}setOptions(e){return this.options={factory:null,builder:null,commitHooks:[gu,bu,Ns.easyScoreHook],throwOnError:!1,...e},this.factory=this.options.factory,this.builder=this.options.builder||new mu(this.factory),this.grammar=new pu(this.builder),this.parser=new Qn(this.grammar),this.options.commitHooks.forEach(t=>this.addCommitHook(t)),this}setContext(e){return this.factory&&this.factory.setContext(e),this}parse(e,t={}){this.builder.reset(t);let i=this.parser.parse(e);if(!i.success&&this.options.throwOnError)throw new fu("Error parsing line: "+e,i);return i}beam(e,t={}){return this.factory.Beam({notes:e,options:t}),e}tuplet(e,t={}){return this.factory.Tuplet({notes:e,options:t}),e}notes(e,t={}){return t={clef:this.defaults.clef,stem:this.defaults.stem,...t},this.parse(e,t),this.builder.getElements().notes}voice(e,t){return t={time:this.defaults.time,...t},this.factory.Voice(t).addTickables(e)}addCommitHook(e){return this.builder.addCommitHook(e)}};function Su(...e){ea.DEBUG&&w.L("Vex.Flow.Factory",e)}var yu=w.MakeException("FactoryError");function oe(e={},t){let i=t.options;return e=Object.assign(t,e),e.options=Object.assign(i,e.options),e}var ea=class tl{constructor(t){Su("New factory: ",t);let i={stave:{space:10},renderer:{context:null,elementId:"",backend:ke.Backends.SVG,width:500,height:200,background:"#FFF"},font:{face:"Arial",point:10,style:""}};this.options=i,this.setOptions(t)}static newFromElementId(t,i=500,s=200){return new tl({renderer:{elementId:t,width:i,height:s}})}reset(){this.renderQ=[],this.systems=[],this.staves=[],this.voices=[],this.stave=null}getOptions(){return this.options}setOptions(t){for(let i of["stave","renderer","font"])Object.assign(this.options[i],t[i]);(this.options.renderer.elementId!==null||this.options.renderer.context)&&this.initRenderer(),this.reset()}initRenderer(){let{elementId:t,backend:i,width:s,height:r,background:n}=this.options.renderer;if(t==="")throw new yu("HTML DOM element not set in Factory");this.context=ke.buildContext(t,i,s,r,n)}getContext(){return this.context}setContext(t){return this.context=t,this}getStave(){return this.stave}getVoices(){return this.voices}space(t){return this.options.stave.space*t}Stave(t){t=oe(t,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:this.options.stave.space}});let i=new Yn(t.x,t.y,t.width,t.options);return this.staves.push(i),i.setContext(this.context),this.stave=i,i}TabStave(t){t=oe(t,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:this.options.stave.space*1.3}});let i=new Uo(t.x,t.y,t.width,t.options);return this.staves.push(i),i.setContext(this.context),this.stave=i,i}StaveNote(t){let i=new me(t);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}GhostNote(t){let i=new Zo(t);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}TextNote(t){let i=new hr(t);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}BarNote(t){t=oe(t,{type:"single",options:{}});let i=new Zn(t.type);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}ClefNote(t){t=oe(t,{type:"treble",options:{size:"default"}});let i=new Xo(t.type,t.options.size,t.options.annotation);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}TimeSigNote(t){t=oe(t,{time:"4/4",options:{}});let i=new Ko(t.time);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}KeySigNote(t){let i=new jo(t.key,t.cancelKey,t.alterKey);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}TabNote(t){let i=new jn(t);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}GraceNote(t){let i=new qn(t);return this.stave&&i.setStave(this.stave),i.setContext(this.context),i}GraceNoteGroup(t){let i=new Mr(t.notes,t.slur);return i.setContext(this.context),i}Accidental(t){t=oe(t,{type:null,options:{}});let i=new Er(t.type);return i.setContext(this.context),i}Annotation(t){t=oe(t,{text:"p",vJustify:"below",hJustify:"center",fontFamily:"Times",fontSize:14,fontWeight:"bold italic",options:{}});let i=new wr(t.text);return i.setJustification(t.hJustify),i.setVerticalJustification(t.vJustify),i.setFont(t.fontFamily,t.fontSize,t.fontWeight),i.setContext(this.context),i}Articulation(t){t=oe(t,{type:"a.",position:"above",options:{}});let i=new Ns(t.type);return i.setPosition(t.position),i.setContext(this.context),i}TextDynamics(t){t=oe(t,{text:"p",duration:"q",dots:0,line:0,options:{}});let i=new Jn({text:t.text,line:t.line,duration:t.duration,dots:t.dots});return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}Fingering(t){t=oe(t,{number:"0",position:"left",options:{}});let i=new Dn(t.number);return i.setPosition(t.position),i.setContext(this.context),i}StringNumber(t){t=oe(t,{number:"0",position:"left",options:{}});let i=new Gn(t.number);return i.setPosition(t.position),i.setContext(this.context),i}TickContext(){return new $i().setContext(this.context)}ModifierContext(){return new Ms}MultiMeasureRest(t){let i=new Ho(t.number_of_measures,t);return i.setContext(this.context),this.renderQ.push(i),i}Voice(t){t=oe(t,{time:"4/4",options:{}});let i=new Qe(t.time);return this.voices.push(i),i}StaveConnector(t){t=oe(t,{top_stave:null,bottom_stave:null,type:"double",options:{}});let i=new Ki(t.top_stave,t.bottom_stave);return i.setType(t.type).setContext(this.context),this.renderQ.push(i),i}Formatter(){return new Ti}Tuplet(t){t=oe(t,{notes:[],options:{}});
5let i=new lr(t.notes,t.options).setContext(this.context);return this.renderQ.push(i),i}Beam(t){t=oe(t,{notes:[],options:{autoStem:!1,secondaryBeamBreaks:[]}});let i=new vs(t.notes,t.options.autoStem).setContext(this.context);return i.breakSecondaryAt(t.options.secondaryBeamBreaks),this.renderQ.push(i),i}Curve(t){t=oe(t,{from:null,to:null,options:{}});let i=new Jo(t.from,t.to,t.options).setContext(this.context);return this.renderQ.push(i),i}StaveTie(t){t=oe(t,{from:null,to:null,first_indices:[0],last_indices:[0],text:null,options:{direction:void 0}});let i=new vr({first_note:t.from,last_note:t.to,first_indices:t.first_indices,last_indices:t.last_indices},t.text);return t.options.direction&&i.setDirection(t.options.direction),i.setContext(this.context),this.renderQ.push(i),i}StaveLine(t){t=oe(t,{from:null,to:null,first_indices:[0],last_indices:[0],options:{}});let i=new $o({first_note:t.from,last_note:t.to,first_indices:t.first_indices,last_indices:t.last_indices});return t.options.text&&i.setText(t.options.text),t.options.font&&i.setFont(t.options.font),i.setContext(this.context),this.renderQ.push(i),i}VibratoBracket(t){t=oe(t,{from:null,to:null,options:{harsh:!1}});let i=new Kn({start:t.from,stop:t.to});return t.options.line&&i.setLine(t.options.line),t.options.harsh&&i.setHarsh(t.options.harsh),i.setContext(this.context),this.renderQ.push(i),i}TextBracket(t){t=oe(t,{from:null,to:null,text:"",options:{superscript:"",position:1}});let i=new $n({start:t.from,stop:t.to,text:t.text,superscript:t.options.superscript,position:t.options.position});return t.options.line&&i.setLine(t.options.line),t.options.font&&i.setFont(t.options.font),i.setContext(this.context),this.renderQ.push(i),i}System(t={}){t.factory=this;let i=new el(t).setContext(this.context);return this.systems.push(i),i}EasyScore(t={}){return t.factory=this,new ta(t)}PedalMarking(t={}){t=oe(t,{notes:[],options:{style:"mixed"}});let i=new Ps(t.notes);return i.setStyle(Ps.StylesString[t.options.style]),i.setContext(this.context),this.renderQ.push(i),i}NoteSubGroup(t={}){t=oe(t,{notes:[],options:{}});let i=new On(t.notes);return i.setContext(this.context),i}draw(){this.systems.forEach(t=>t.setContext(this.context).format()),this.staves.forEach(t=>t.setContext(this.context).draw()),this.voices.forEach(t=>t.setContext(this.context).draw()),this.renderQ.forEach(t=>{t.isRendered()||t.setContext(this.context).draw()}),this.systems.forEach(t=>t.setContext(this.context).draw()),this.reset()}};function Ba(e,t){let i=t.options;return e=Object.assign(t,e),e.options=Object.assign(i,e.options),e}var el=class extends fe{constructor(e={}){super(),this.setAttribute("type","System"),this.setOptions(e),this.parts=[]}setOptions(e={}){this.options=Ba(e,{x:10,y:10,width:500,connector:null,spaceBetweenStaves:12,factory:null,debugFormatter:!1,formatIterations:0,options:{}}),this.factory=this.options.factory||new ea({renderer:{el:null}})}setContext(e){return super.setContext(e),this.factory.setContext(e),this}addConnector(e="double"){return this.connector=this.factory.StaveConnector({top_stave:this.parts[0].stave,bottom_stave:this.parts[this.parts.length-1].stave,type:e}),this.connector}addStave(e){return e=Ba(e,{stave:null,voices:[],spaceAbove:0,spaceBelow:0,debugNoteMetrics:!1,options:{left_bar:!1}}),e.stave||(e.stave=this.factory.Stave({x:this.options.x,y:this.options.y,width:this.options.width,options:e.options})),e.voices.forEach(t=>t.setContext(this.context).setStave(e.stave).getTickables().forEac
5h(i=>i.setStave(e.stave))),this.parts.push(e),e.stave}format(){let e=new Ti;this.formatter=e;let t=this.options.y,i=0,s=[],r=[];this.parts.forEach(a=>{t+=a.stave.space(a.spaceAbove),a.stave.setY(t),e.joinVoices(a.voices),t+=a.stave.space(a.spaceBelow),t+=a.stave.space(this.options.spaceBetweenStaves),a.debugNoteMetrics&&(r.push({y:t,voice:a.voices[0]}),t+=15),s=s.concat(a.voices),i=Math.max(i,a.stave.getNoteStartX())}),this.parts.forEach(a=>a.stave.setNoteStartX(i));let n=this.options.width-(i-this.options.x)-ze.STAVEPADDING;e.format(s,n);for(let a=0;a<this.options.formatIterations;a++)e.tune();this.startX=i,this.debugNoteMetricsYs=r,this.lastY=t}draw(){let e=this.checkContext();this.setRendered(),this.options.debugFormatter&&Ti.plotDebugging(e,this.formatter,this.startX,this.options.y,this.lastY),this.debugNoteMetricsYs.forEach(t=>{t.voice.getTickables().forEach(i=>ze.plotMetrics(e,i,t.y))})}};w.Flow=D,w.Flow.Element=fe,w.Flow.Fraction=ie,w.Flow.Renderer=ke,w.Flow.Formatter=Ti,w.Flow.Music=mi,w.Flow.Glyph=wt,w.Flow.Stave=Yn,w.Flow.StaveNote=me,w.Flow.StaveModifier=Ot,w.Flow.StaveTempo=Oo,w.Flow.Voice=Qe,w.Flow.Accidental=Er,w.Flow.Beam=vs,w.Flow.StaveTie=vr,w.Flow.TabStave=Uo,w.Flow.TabNote=jn,w.Flow.Bend=Hn,w.Flow.Vibrato=Xn,w.Flow.VibratoBracket=Kn,w.Flow.Note=ze,w.Flow.ModifierContext=Ms,w.Flow.MultiMeasureRest=Ho,w.Flow.TickContext=$i,w.Flow.Articulation=Ns,w.Flow.Annotation=wr,w.Flow.Barline=Pe,w.Flow.NoteHead=yr,w.Flow.StaveConnector=Ki,w.Flow.ClefNote=Xo,w.Flow.KeySignature=ur,w.Flow.KeySigNote=jo,w.Flow.TimeSignature=Ts,w.Flow.TimeSigNote=Ko,w.Flow.Stem=gt,w.Flow.TabTie=Vn,w.Flow.Clef=ws,w.Flow.Dot=xr,w.Flow.Modifier=St,w.Flow.TabSlide=tu,w.Flow.Tuplet=lr,w.Flow.GraceNote=qn,w.Flow.GraceTabNote=eu,w.Flow.Tuning=iu,w.Flow.KeyManager=su,w.Flow.StaveHairpin=ru,w.Flow.BoundingBox=Sr,w.Flow.Stroke=Co,w.Flow.TextNote=hr,w.Flow.Curve=Jo,w.Flow.TextDynamics=Jn,w.Flow.StaveLine=$o,w.Flow.Ornament=zn,w.Flow.PedalMarking=Ps,w.Flow.TextBracket=$n,w.Flow.FretHandFinger=Dn,w.Flow.Repetition=on,w.Flow.BarNote=Zn,w.Flow.GhostNote=Zo,w.Flow.NoteSubGroup=On,w.Flow.GraceNoteGroup=Mr,w.Flow.Tremolo=hu,w.Flow.StringNumber=Gn,w.Flow.Crescendo=Qo,w.Flow.Volta=Wo,w.Flow.Font=Hs,w.Flow.System=el,w.Flow.Factory=ea,w.Flow.Parser=Qn,w.Flow.EasyScore=ta,w.Flow.Registry=or;var vt=w,ia=class{constructor(e,t,i){this.instrumentalGroups=[],this.name=e,this.musicSheet=t,this.parent=i}get InstrumentalGroups(){return this.instrumentalGroups}get Parent(){return this.parent}get Name(){return this.name}set Name(e){this.name=e}get GetMusicSheet(){return this.musicSheet}},il=class{constructor(e,t){this.isTab=!1,this.voices=[],this.volume=1,this.stafflineCount=5,this.hasLyrics=!1,this.openTieDict={},this.parentInstrument=e,this.id=t,this.audible=!0,this.Visible=!0,this.following=!0}get ParentInstrument(){return this.parentInstrument}set ParentInstrument(e){this.parentInstrument=e}get Voices(){return this.voices}get Id(){return this.id}get Volume(){return this.volume}set Volume(e){this.volume=e}get StafflineCount(){return this.stafflineCount}set StafflineCount(e){this.stafflineCount=e}isVisible(){return this.Visible&&this.ParentInstrument.Visible}},cr=class extends ia{constructor(e,t,i,s){super(void 0,i,s),this.Trans
5pose=0,this.voices=[],this.staves=[],this.hasLyrics=!1,this.hasChordSymbols=!1,this.lyricVersesNumbers=[],this.subInstruments=[],this.id=e,this.idString=t,this.nameLabel=new Nt(t)}get Voices(){return this.voices}get Staves(){return this.staves}get NameLabel(){return this.nameLabel}get HasLyrics(){return this.hasLyrics}set HasLyrics(e){this.hasLyrics=e}get HasChordSymbols(){return this.hasChordSymbols}set HasChordSymbols(e){this.hasChordSymbols=e}get LyricVersesNumbers(){return this.lyricVersesNumbers}set LyricVersesNumbers(e){this.lyricVersesNumbers=e}get Name(){return this.nameLabel.text}set Name(e){this.nameLabel.text=e}get IdString(){return this.idString}get Id(){return this.id}get MidiInstrumentId(){return this.subInstruments[0].midiInstrumentID}set MidiInstrumentId(e){this.subInstruments[0].midiInstrumentID=e}get Volume(){return this.subInstruments[0].volume}set Volume(e){for(let t=0,i=this.subInstruments.length;t<i;++t){let s=this.subInstruments[t];s.volume=e}}get PlaybackTranspose(){return this.playbackTranspose}set PlaybackTranspose(e){this.playbackTranspose=e}get SubInstruments(){return this.subInstruments}getSubInstrument(e){for(let t=0,i=this.subInstruments.length;t<i;++t){let s=this.subInstruments[t];if(s.idString===e)return s}}get PartAbbreviation(){return this.partAbbreviation}set PartAbbreviation(e){this.partAbbreviation=e}get Visible(){return this.voices.length>0?this.Voices[0].Visible:!1}isVisible(){if(!this.Visible)return!1;for(let e of this.Staves)if(e.Visible)return!0;return!1}set Visible(e){for(let t=0,i=this.Voices.length;t<i;++t){let s=this.Voices[t];s.Visible=e}}get Audible(){let e=!1;for(let t=0,i=this.Voices.length;t<i;++t){let s=this.Voices[t];e=e||s.Audible}return e}set Audible(e){for(let t=0,i=this.Voices.length;t<i;++t){let s=this.Voices[t];s.Audible=e}for(let t=0,i=this.staves.length;t<i;++t){let s=this.staves[t];s.audible=e}}get Following(){let e=!1;for(let t=0,i=this.Voices.length;t<i;++t){let s=this.Voices[t];e=e||s.Following}return e}set Following(e){for(let t=0,i=this.Voices.length;t<i;++t){let s=this.Voices[t];s.Following=e}for(let t=0,i=this.staves.length;t<i;++t){let s=this.staves[t];s.following=e}}SetVoiceAudible(e,t){for(let i=0,s=this.Voices.length;i<s;++i){let r=this.Voices[i];if(r.VoiceId===e){r.Audible=t;break}}}SetVoiceFollowing(e,t){for(let i=0,s=this.Voices.length;i<s;++i){let r=this.Voices[i];if(r.VoiceId===e){r.Following=t;break}}}SetStaffAudible(e,t){let i=this.staves[e-1];if(i.audible=t,t)for(let s=0,r=i.Voices.length;s<r;++s){let n=i.Voices[s];n.Audible=!0}else for(let s=0,r=i.Voices.length;s<r;++s){let n=i.Voices[s],a=!1;for(let o=0,l=this.Staves.length;o<l;++o){let h=this.Staves[o];if(!(h.Id===e||!h.audible))for(let u=0,c=h.Voices.length;u<c;++u)h.Voices[u]===n&&(a=!0)}a||(n.Audible=!1)}}SetStaffFollow(e,t){let i=this.staves[e-1];if(i.following=t,t)for(let s=0,r=i.Voices.length;s<r;++s){let n=i.Voices[s];n.Following=!0}else for(let s=0,r=i.Voices.length;s<r;++s){let n=i.Voices[s],a=!1;for(let o=0,l=this.Staves.length;o<l;++o){let h=this.Staves[o];if(!(h.Id===e||!h.following))for(let u=0,c=h.Voices.length;u<c;++u)h.Voices[u]===n&&(a=!0)}a||(n.Following=!1)}}areAllVoiceVisible(){for(let e of this.Voices)if(!e.Visible)return!1;return!0}createStaves(e){for(let t=0;t<e;t++)this.staves.push(new il(this,t+1))}toString(){return`${this.Name} , id: ${this.id}, idstring: ${this.idString}`}},sl=class extends ue{constructor(e){super(),this.needsToBeRedrawn=!0,this.staffLines=[],this.graphicalMeasures=[],this.labels=new We.Dictionary,this.measureNumberLabels=[],this.objectsToRedraw=[],this.instrumentBrackets=[],this.groupBrackets=[],this.graphicalMarkedAreas=[],this.graphicalComments=[],this.systemLines=[],this.breaksPage=!1,this.id=e,this.boundingBox=new Yt(this),this.maxLabelLength=0}get Parent(){return this.parent}set Parent(e){if(this.parent){let t=this.parent.MusicSystems.indexOf(this,0);t>-1&&this.parent.MusicSystems.splice(t,1)}this.parent=e,this.boundingBox.Parent=e.PositionAndShape}get NextSystem(){let e=this.Parent.MusicSystems.indexOf(this);return e===this.Parent.MusicSystems.length?void 0:this.Parent.MusicSystems[e+1]}get StaffLines(){return this.staffLines}set StaffLines(e){this.staffLines=e}get GraphicalMeasures(){return this.graphicalMeasures}get MeasureNumberLabels(){return this.measureNumberLabels}get Labels(){return this.labels.values()}get ObjectsToRedraw(){return this.objectsToRedraw}get InstrumentBrackets(){return this.instrumentBrackets}get GroupBrackets(){return this.groupBrackets}get GraphicalMarkedAreas(){return this.graphicalMarkedAreas}get GraphicalComments(){return this.graphicalComments}get SystemLines(){return this.systemLines}get Id(){return this.id}get MaxLabelLength(){return this.maxLabelLength}createSystemLeftLine(e,t,i){let s=-e/2;i&&(s=this.maxLabelLength+t-e/2);let r=this.staffLines[0].Measures[0],n;this.staffLines.length>1&&(n=this.staffLines[this.staffLines.length-1].Measures[0]);let a=this.createSystemLine(s,e,ft.SingleThin,wi.MeasureBegin,this,r,n);this.SystemLines.push(a),a.PositionAndShape.RelativePosition=new k(s,0),a.PositionAndShape.BorderLeft=0,a.PositionAndShape.BorderRight=e,a.PositionAndShape.BorderTop=a.PositionAndShape.Parent.BorderTop,a.PositionAndShape.BorderBottom=a.PositionAndShape.Parent.BorderBottom,this.createLinesForSystemLine(a)}createVerticalLineForMeasure(e,t,i,s,r,n){let a=n.ParentStaffLine,o=new k(a.PositionAndShape.RelativePosition.x,a.PositionAndShape.RelativePosition.y),l=a.ParentStaff.ParentInstrument.Staves;if(a.ParentStaff===l[0]){let h;l.length>1&&(h=this.getBottomStaffLine(a).Measures[r]);let u=this.createSystemLine(e,t,i,s,this,n,h),c=o.x+e;u.PositionAndShape.RelativePosition=new k(c,0),u.PositionAndShape.BorderLeft=0,u.PositionAndShape.BorderRight=t,this.SystemLines.push(u)}}setYPositionsToVerticalLineObjectsAndCreateLines(e){}calculateBorders(e){}alignBeginInstructions(){}GetLeftBorderAbsoluteXPosition(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].Measures[0].beginInstructionsWidth}GetRightBorderAbsoluteXPosition(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].StaffLines[0].End.x}AddGraphicalMeasures(e){for(let t=0,i=e.length;t<i;++t){let s=e[t];s.ParentMusicSystem=this}this.graphicalMeasures.push(e)}GetSystemsFirstTimeStamp(){return this.graphicalMeasures[0][0].parentSourceMeasure.AbsoluteTimestamp}GetSystemsLastTimeStamp(){let e=this.graphicalMeasures[this.graphicalMeasures.length-1][0].parentSourceMeasure;return N.plus(e.AbsoluteTimestamp,e.Duration)}createInstrumentBrackets(e,t){for(let i=0,s=e.length;i<s;++i){let r=e[i];if(r.Staves.length>1){let n,a;for(let o=0,l=this.staffLines.length;o<l;++o){let h=this.staffLines[o];h.ParentStaff===r.Staves[0]&&h.ParentStaff.Visible&&(n=h),h.ParentStaff===r.Staves[r.Staves.length-1]&&h.ParentStaff.Visible&&(a=h)}n&&a&&this.createInstrumentBracket(n,a)}}}createGroupBrackets(e,t,i){for(let s=0,r=e.length;s<r;++s){let n=e[s];if(n.InstrumentalGroups.length<1)continue;let a=this.findFirstVisibleInstrumentInInstrumentalGroup(n),o=this.findLastVisibleInstrumentInInstrumentalGroup(n);if(!a||!o)continue;let l,h;for(let u=0,c=this.staffLines.length;u<c;++u){let d=this.staffLines[u];d.ParentStaff===a.Staves[0]&&(l=d),d.ParentStaff===o.Staves[0]&&(h=d)}l&&h&&this.createGroupBracket(l,h,i),!(n.InstrumentalGroups.length<1)&&this.createGroupBrackets(n.InstrumentalGroups,t,i+1)}}createMusicSystemLabel(e,t,i,s=!1){let r=t;for(let a=0,o=this.staffLines.length;a<o;++a){let l=this.staffLines[a].ParentStaff.ParentInstrument,h;if(s)h=l.NameLabel,(!this.rules.RenderPartNames||!h?.print)&&(h=new Nt("",l.NameLabel.textAlignment,l.NameLabel.font),t=0);else{if(!this.rules.RenderPartAbbreviations||!this.rules.RenderPartNames||this.staffLines.length===1||!l.PartAbbreviation||l.PartAbbreviation==="")return;let u=l.PartAbbreviation;h=new Nt(u,l.NameLabel.textAlignment,l.NameLabel.font)}if(l?.NameLabel?.print){let u=new pe(h,e,mt.LeftCenter,this.rules,this.boundingBox);
5u.setLabelPositionAndShapeBorders(),this.labels.setValue(l,u)}else t=0}this.maxLabelLength=0;let n=this.labels.values();for(let a=0,o=n.length;a<o;++a){let l=n[a];l.Label.print&&l.PositionAndShape.Size.width>this.maxLabelLength&&(this.maxLabelLength=l.PositionAndShape.Size.width,t=r)}this.updateMusicSystemStaffLineXPosition(t)}setMusicSystemLabelsYPosition(){this.labels.forEach((e,t)=>{let i=0,s=0;for(let r=0;r<this.staffLines.length;r++)if(this.staffLines[r].ParentStaff.ParentInstrument===e){for(let n=r;n<this.staffLines.length;n++){let a=this.staffLines[n];if(a.ParentStaff.ParentInstrument!==e)break;i+=a.PositionAndShape.RelativePosition.y,s++}break}s>0&&(t.PositionAndShape.RelativePosition=new k(0,i/s+2))})}checkStaffEntriesForStaffEntryLink(){let e=!1,t=!1;for(let i=0;i<this.staffLines.length-1;i++){for(let s=0,r=this.staffLines[i].Measures.length;s<r;++s){let n=this.staffLines[i].Measures[s];for(let a=0,o=n.staffEntries.length;a<o;++a)n.staffEntries[a].sourceStaffEntry.Link&&(e=!0)}for(let s=0,r=this.staffLines[i+1].Measures.length;s<r;++s){let n=this.staffLines[i+1].Measures[s];for(let a=0,o=n.staffEntries.length;a<o;++a)n.staffEntries[a].sourceStaffEntry.Link&&(t=!0)}}return!!(e&&t)}getBottomStaffLine(e){let t=e.ParentStaff.ParentInstrument.Staves,i;for(let s=t.length-1;s>=0;s--)if(t[s]?.Visible){i=t[s];break}for(let s of e.ParentMusicSystem.staffLines)if(s.ParentStaff===i)return s}createSystemLine(e,t,i,s,r,n,a=void 0){throw Error("not implemented")}createLinesForSystemLine(e){}calcBracketsWidth(){let e=0;for(let t=0,i=this.GroupBrackets.length;t<i;++t){let s=this.GroupBrackets[t];e=Math.max(e,s.PositionAndShape.Size.width)}for(let t=0,i=this.InstrumentBrackets.length;t<i;++t){let s=this.InstrumentBrackets[t];e=Math.max(e,s.PositionAndShape.Size.width)}return e}createInstrumentBracket(e,t){}createGroupBracket(e,t,i){}findFirstVisibleInstrumentInInstrumentalGroup(e){for(let t=0,i=e.InstrumentalGroups.length;t<i;++t){let s=e.InstrumentalGroups[t];if(s instanceof cr){if(s.isVisible())return s;continue}return this.findFirstVisibleInstrumentInInstrumentalGroup(s)}}findLastVisibleInstrumentInInstrumentalGroup(e){let t;for(let i=e.InstrumentalGroups.length-1;i>=0;i--){if(t=e.InstrumentalGroups[i],t instanceof cr){if(t.isVisible())return t;continue}return this.findLastVisibleInstrumentInInstrumentalGroup(t)}}updateMusicSystemStaffLineXPosition(e){for(let t=0,i=this.StaffLines.length;t<i;++t){let s=this.StaffLines[t],r=s.PositionAndShape.RelativePosition;r.x=this.maxLabelLength+e,s.PositionAndShape.RelativePosition=r,s.PositionAndShape.BorderRight=this.boundingBox.Size.width-this.maxLabelLength-e;for(let n=0;n<s.StaffLines.length;n++){let a=new k(s.PositionAndShape.Size.width,s.StaffLines[n].End.y);s.StaffLines[n].End=a}}}},sa=class extends ue{constructor(e,t,i,s,r=void 0){super(),this.lineType=e,this.linePosition=t,this.parentMusicSystem=i,this.topMeasure=s,this.bottomMeasure=r,this.parentTopStaffLine=s?.ParentStaffLine,this.boundingBox=new Yt(this,i.PositionAndShape)}static getObjectWidthForLineType(e,t){switch(t){case ft.SingleThin:return e.SystemThinLineWidth;case ft.DoubleThin:return e.SystemThinLineWidth*2+e.DistanceBetweenVerticalSystemLines;case ft.ThinBold:return e.SystemThinLineWidth+e.SystemBoldLineWidth+e.DistanceBetweenVerticalSystemLines;case ft.BoldThinDots:return e.SystemThinLineWidth+e.SystemBoldLineWidth+e.DistanceBetweenVerticalSystemLines+e.SystemDotWidth+e.DistanceBetweenDotAndLine;case ft.DotsThinBold:return e.SystemThinLineWidth+e.SystemBoldLineWidth+e.DistanceBetweenVerticalSystemLines+e.SystemDotWidth+e.DistanceBetweenDotAndLine;case ft.DotsBoldBoldDots:return 2*e.SystemBoldLineWidth+2*e.SystemDotWidth+2*e.DistanceBetweenDotAndLine+e.DistanceBetweenVerticalSystemLines;default:return 0}}},Ce=(function(e){return e[e.Unused_first_Symbol=0]="Unused_first_Symbol",e[e.BLACK_HEAD=1]="BLACK_HEAD",e[e.UPWARDS_TAIL=2]="UPWARDS_TAIL",e[e.DOWNWARDS_TAIL=3]="DOWNWARDS_TAIL",e[e.UPWARDS_DOUBLE_TAIL=4]="UPWARDS_DOUBLE_TAIL",e[e.DOWNWARDS_DOUBLE_TAIL=5]="DOWNWARDS_DOUBLE_TAIL",e[e.UPWARDS_TRIPLE_TAIL=6]="UPWARDS_TRIPLE_TAIL",e[e.DOWNWARDS_TRIPLE_TAIL=7]="DOWNWARDS_TRIPLE_TAIL",e[e.UPWARDS_QUAD_TAIL=8]="UPWARDS_QUAD_TAIL",e[e.DOWNWARDS_QUAD_TAIL=9]="DOWNWARDS_QUAD_TAIL",e[e.ROUND_HEAD=10]="ROUND_HEAD",e[e.WHITE_HEAD=11]="WHITE_HEAD",e[e.G_CLEF=12]="G_CLEF",e[e.F_CLEF=13]="F_CLEF",e[e.C_CLEF=14]="C_CLEF",e[e.BREVE=15]="BREVE",e[e.BREVE_REST=16]="BREVE_REST",e[e.COMMON_TIME=17]="COMMON_TIME",e[e.CUT_TIME=18]="CUT_TIME",e[e.WHOLE_REST=19]="WHOLE_REST",e[e.HALF_REST=20]="HALF_REST",e[e.QUARTER_REST=21]="QUARTER_REST",e[e.EIGHTH_REST=22]="EIGHTH_REST",e[e.SIXTEENTH_REST=23]="SIXT
5EENTH_REST",e[e.THIRTYSECOND_REST=24]="THIRTYSECOND_REST",e[e.SIXTYFOURTH_REST=25]="SIXTYFOURTH_REST",e[e.FLAT=26]="FLAT",e[e.SHARP=27]="SHARP",e[e.NATURAL=28]="NATURAL",e[e.DOUBLE_FLAT=29]="DOUBLE_FLAT",e[e.DOUBLE_SHARP=30]="DOUBLE_SHARP",e[e.ZERO=31]="ZERO",e[e.ONE=32]="ONE",e[e.TWO=33]="TWO",e[e.THREE=34]="THREE",e[e.FOUR=35]="FOUR",e[e.FIVE=36]="FIVE",e[e.SIX=37]="SIX",e[e.SEVEN=38]="SEVEN",e[e.EIGHT=39]="EIGHT",e[e.NINE=40]="NINE",e[e.DOT=41]="DOT",e[e.FERMATA=42]="FERMATA",e[e.INVERTED_FERMATA=43]="INVERTED_FERMATA",e[e.SPICCATO=44]="SPICCATO",e[e.TENUTO=45]="TENUTO",e[e.MARCATO=46]="MARCATO",e[e.MARCATISSIMO=47]="MARCATISSIMO",e[e.INVERTED_MARCATISSIMO=48]="INVERTED_MARCATISSIMO",e[e.P=49]="P",e[e.F=50]="F",e[e.S=51]="S",e[e.Z=52]="Z",e[e.M=53]="M",e[e.R=54]="R",e[e.SEGNO=55]="SEGNO",e[e.CODA=56]="CODA",e[e.DRUM_CLEF=57]="DRUM_CLEF",e[e.G_CLEF_SUB8=58]="G_CLEF_SUB8",e[e.G_CLEF_SUPER8=59]="G_CLEF_SUPER8",e[e.G_CLEF_SUB15=60]="G_CLEF_SUB15",e[e.G_CLEF_SUPER15=61]="G_CLEF_SUPER15",e[e.F_CLEF_SUB8=62]="F_CLEF_SUB8",e[e.F_CLEF_SUPER8=63]="F_CLEF_SUPER8",e[e.F_CLEF_SUB15=64]="F_CLEF_SUB15",e[e.F_CLEF_SUPER15=65]="F_CLEF_SUPER15",e[e.DOWN_BOW=66]="DOWN_BOW",e[e.MORDENT=67]="MORDENT",e[e.INVERTED_MORDENT=68]="INVERTED_MORDENT",e[e.TURN=69]="TURN",e[e.INVERTED_TURN=70]="INVERTED_TURN",e[e.LEFTHAND_PIZZICATO=71]="LEFTHAND_PIZZICATO",e[e.RELEASE_PED=72]="RELEASE_PED",e[e.ENGAGE_PED=73]="ENGAGE_PED",e[e.VA8=74]="VA8",e[e.VB8=75]="VB8",e[e.TRILL=76]="TRILL",e[e.MA15=77]="MA15",e[e.MB15=78]="MB15",e[e.HIGH=79]="HIGH",e[e.PLAY=80]="PLAY",e[e.MIC=81]="MIC",e[e.SNAP_PIZZICATO=82]="SNAP_PIZZICATO",e[e.NATURAL_HARMONIC=83]="NATURAL_HARMONIC",e[e.EditPen=84]="EditPen",e[e.PEDAL_BRACKET=85]="PEDAL_BRACKET",e[e.PEDAL_MIXED=86]="PEDAL_MIXED",e[e.PEDAL_SYMBOL=87]="PEDAL_SYMBOL",e})({}),xu=(function(e){return e[e.All=0]="All",e[e.NoOverlays=1]="NoOverlays",e[e.Leadsheet=2]="Leadsheet",e})({}),$s=(function(e){return e[e.Normal=0]="Normal",e[e.Disabled=1]="Disabled",e[e.Selected=2]="Selected",e[e.Clickable=3]="Clickable",e[e.PlaybackSymbols=4]="PlaybackSymbols",e[e.FollowSymbols=5]="FollowSymbols",e[e.QFeedbackNotFound=6]="QFeedbackNotFound",e[e.QFeedbackOk=7]="QFeedbackOk",e[e.QFeedbackPerfect=8]="QFeedbackPerfect",e[e.Debug1=9]="Debug1",e[e.Debug2=10]="Debug2",e[e.Debug3=11]="Debug3",e})({}),Zs=(function(e){return e[e.Following=0]="Following",e[e.Midi=1]="Midi",e[e.Manual=2]="Manual",e})({}),Tr=class extends Es{constructor(e,t,i,s){if(super(e,t,i),this.IsVerbal){let r=new Nt(e.Label);this.label=new pe(r,s||this.rules.ContinuousDynamicTextHeight,mt.LeftCenter,this.rules,this.PositionAndShape),this.label.Label.fontStyle=Qt.Italic,this.label.setLabelPositionAndShapeBorders(),this.PositionAndShape.calculateBoundingBox(),e.ColorXML&&this.rules.ExpressionsUseXMLColor&&(this.label.ColorXML=e.ColorXML)}}},rl=class{constructor(e){this.parentStaffline=e,this.rules=this.parentStaffline.ParentMusicSystem.rules}alignDynamicExpressions(){let e=[],t=[];for(let i=0;i<this.parentStaffline.AbstractExpressions.length-1;i++){let s=this.parentStaffline.AbstractExpressions[i],r=this.parentStaffline.AbstractExpressions[i+1];if(s?.SourceExpression?.Placement===r?.SourceExpression?.Placement){let n=this.getDistance(s.PositionAndShape,r.PositionAndShape);Math.abs(n.x)<this.rules.DynamicExpressionMaxDistance?(t.indexOf(s)===-1&&t.push(s),t.push(r)):(e.push(t),t=[])}}e.push(t);for(let i of e)if(i.length>0){let s=i.map(n=>n.PositionAndShape.Center.y),r=Math.max(...s);for(let n=0;n<i.length;n++){let a=i[n],o=s[n]-r;if(a instanceof Tr?(a.shiftYPosition(-o),a.calcPsi()):(a.PositionAndShape.RelativePosition.y-=o*.8,a.PositionAndShape.calculateBoundingBox()),a.squeeze){let l=n<i.length-1?i[n+1]:void 0,h=n>0?i[n-1]:void 0;if(l){let u=this.getOverlap(a.PositionAndShape,l.PositionAndShape);a.squeeze(-(u.x+this.rules.DynamicExpressionSpacer))}if(h){let u=this.getOverlap(h.PositionAndShape,a.PositionAndShape);a.squeeze(u.x+this.rules.DynamicExpressionSpacer)}}}}}getDistance(e,t){let i=e.RelativePosition.x+e.BorderMarginRight,s=t.RelativePosition.x+t.BorderMarginLeft,r=e.RelativePosition.y+e.BorderMarginBottom,n=t.RelativePosition.y+t.BorderMarginTop;return new k(s-i,n-r)}getOverlap(e,t){return new k(e.RelativePosition.x+e.BorderMarginRight-(t.RelativePosition.x+t.BorderMarginLeft),e.RelativePosition.y+e.BorderMarginBottom-(t.RelativePosition.y+t.BorderMarginTop))}},Eu=vt.Flow,vu=class{},ra=class{getInnerElement(){return this.inner}getCanvas(){return this.canvas}getRenderElement(){let e=this.canvas;
5return this.getVexflowBackendType()===Eu.Renderer.Backends.CANVAS&&(e=this.inner),e}getRenderer(){return this.renderer}removeAllChildrenFromContainer(e){for(;e.children.length!==0;)e.removeChild(e.children.item(0))}removeFromContainer(e){let t=this.getRenderElement();for(let i=0;i<e.children.length;i++)if(e.children.item(i)===t){e.removeChild(t);break}}resize(e,t){this.renderer.resize(e,t),this.width=e,this.height=t}},Or=vt.Flow,Pr=class extends ra{constructor(e){super(),this.rules=e}getVexflowBackendType(){return Or.Renderer.Backends.CANVAS}getOSMDBackendType(){return ni.Canvas}getCanvasSize(){return document.getElementById("osmdCanvasPage"+this.graphicalMusicPage.PageNumber)?.offsetHeight}initialize(e,t){this.zoom=t,this.canvas=document.createElement("canvas"),this.graphicalMusicPage||(this.graphicalMusicPage=new sr(void 0),this.graphicalMusicPage.PageNumber=1),this.canvas.id="osmdCanvasVexFlowBackendCanvas"+this.graphicalMusicPage.PageNumber,this.inner=document.createElement("div"),this.inner.id="osmdCanvasPage"+this.graphicalMusicPage.PageNumber,this.inner.style.position="relative",this.canvas.style.zIndex="0",this.inner.appendChild(this.canvas),e.appendChild(this.inner),this.renderer=new Or.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext()}initializeHeadless(e=300,t=300){this.graphicalMusicPage||(this.graphicalMusicPage=new sr(void 0),this.graphicalMusicPage.PageNumber=1),this.canvas=document.createElement("canvas"),this.canvas.width=e,this.canvas.height=t,this.renderer=new Or.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext()}getContext(){return this.ctx}free(){this.canvas&&(this.canvas.width=0,this.canvas.height=0,this.canvas.remove(),delete this.canvas,this.canvas=null)}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.rules.PageBackgroundColor&&(this.ctx.save(),this.ctx.setFillStyle(this.rules.PageBackgroundColor),this.zoom=1,this.ctx.fillRect(0,0,this.canvas.width/this.zoom,this.canvas.height/this.zoom),this.ctx.restore())}scale(e){this.ctx.scale(e,e)}translate(e,t){this.CanvasRenderingCtx.translate(e,t)}renderText(e,t,i,s,r,n,a=void 0,o=void 0){let l=this.CanvasRenderingCtx.font;this.CanvasRenderingCtx.save(),this.CanvasRenderingCtx.font=Ht.font(e,t,i,this.rules,o),this.CanvasRenderingCtx.fillStyle=a,this.CanvasRenderingCtx.strokeStyle=a,this.CanvasRenderingCtx.fillText(s,n.x,n.y+r),this.CanvasRenderingCtx.restore(),this.CanvasRenderingCtx.font=l}renderRectangle(e,t,i,s=1){let r=this.CanvasRenderingCtx.fillStyle;i?this.CanvasRenderingCtx.fillStyle=i:this.CanvasRenderingCtx.fillStyle=Ht.style(t),this.CanvasRenderingCtx.globalAlpha=s,this.ctx.fillRect(e.x,e.y,e.width,e.height),this.CanvasRenderingCtx.fillStyle=r,this.CanvasRenderingCtx.globalAlpha=1}renderLine(e,t,i="#FF0000FF",s=2,r){let n=this.CanvasRenderingCtx.strokeStyle;this.CanvasRenderingCtx.strokeStyle=i,this.CanvasRenderingCtx.beginPath(),this.CanvasRenderingCtx.moveTo(e.x,e.y),this.CanvasRenderingCtx.lineTo(t.x,t.y),this.CanvasRenderingCtx.stroke(),this.CanvasRenderingCtx.strokeStyle=n}renderCurve(e){this.ctx.beginPath(),this.ctx.moveTo(e[0].x,e[0].y),this.ctx.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y),this.ctx.lineTo(e[7].x,e[7].y),this.ctx.bezierCurveTo(e[6].x,e[6].y,e[5].x,e[5].y,e[4].x,e[4].y),this.ctx.lineTo(e[0].x,e[0].y),this.ctx.closePath(),this.ctx.fill()}renderPath(e,t=!0,i){this.ctx.beginPath();let s;for(let r of e){if(!s){this.ctx.moveTo(r.x,r.y),s=r;continue}this.ctx.lineTo(r.x,r.y)}this.ctx.closePath(),t?this.ctx.fill():this.ctx.stroke()}renderWavyLine(e,t,i="#000000",s=1,r=2,n=4,a){let o=this.CanvasRenderingCtx,l=o.strokeStyle,h=o.lineWidth,u=t.x-e.x,c=t.y-e.y,d=Math.sqrt(u*u+c*c),f=Math.atan2(c,u),p=3.5,m=Math.max(1,Math.floor(d/5)),g=d/m;o.save(),o.translate(e.x,e.y),o.rotate(f),o.strokeStyle=i,o.lineWidth=1.2,o.lineCap="round",o.lineJoin="round",o.beginPath(),o.moveTo(0,0);for(let b=0;b<m;b++){let S=b*g,E=S+g*.25,y=S+g*.5,M=S+g*.75,P=S+g;o.bezierCurveTo(E,-p,y,-p,y,0),o.bezierCurveTo(y,p,M,p,P,0)}o.stroke(),o.restore(),o.strokeStyle=l,o.lineWidth=h}get CanvasRenderingCtx(){return this.ctx.vexFlowCanvasContext}},ka=vt.Flow,dr=class extends ra{constructor(e){super(),this.rules=e}
5getVexflowBackendType(){return ka.Renderer.Backends.SVG}getOSMDBackendType(){return ni.SVG}getCanvasSize(){return document.getElementById("osmdCanvasPage"+this.graphicalMusicPage.PageNumber)?.offsetHeight}initialize(e,t){this.zoom=t,this.canvas=document.createElement("div"),this.canvas.id="osmdCanvasPage"+this.graphicalMusicPage.PageNumber,this.inner=this.canvas,this.inner.style.position="relative",this.canvas.style.zIndex="0",e.appendChild(this.inner),this.renderer=new ka.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext(),this.ctx.svg.id="osmdSvgPage"+this.graphicalMusicPage.PageNumber}getContext(){return this.ctx}getSvgElement(){return this.ctx.svg}removeNode(e){let t=this.ctx?.svg;if(!t)return!1;try{t.removeChild(e)}catch(i){return W.default.error(i),!1}return!0}free(){let e=this.ctx.svg;for(;e.lastChild;)e.removeChild(e.lastChild)}clear(){this.ctx&&(this.free(),this.rules.PageBackgroundColor&&(this.ctx.svg.style["background-color"]=this.rules.PageBackgroundColor))}scale(e){this.ctx.scale(e,e)}translate(e,t){}renderText(e,t,i,s,r,n,a=void 0,o=void 0){this.ctx.save();let l=this.ctx.openGroup("text");a&&(this.ctx.attributes.fill=a,this.ctx.attributes.stroke=a);let h=o;(!o||o==="default")&&(h=this.rules.DefaultFontFamily),this.ctx.setFont(h,e,Ht.fontStyle(t)),this.ctx.attributes["font-size"]=`${e}px`,this.ctx.state["font-size"]=`${e}px`;let u="normal",c="normal";switch(t){case Qt.Bold:u="bold";break;case Qt.Italic:c="italic";break;case Qt.BoldItalic:u="bold",c="italic";break;default:u="normal"}return this.ctx.attributes["font-weight"]=u,this.ctx.state["font-weight"]=u,this.ctx.attributes["font-style"]=c,this.ctx.state["font-style"]=c,this.ctx.fillText(s,n.x,n.y+r),this.ctx.closeGroup(),this.ctx.restore(),l}renderRectangle(e,t,i,s=1){this.ctx.save();let r=this.ctx.openGroup("rect");return i?this.ctx.attributes.fill=i:this.ctx.attributes.fill=Ht.style(t),this.ctx.attributes["fill-opacity"]=s,this.ctx.fillRect(e.x,e.y,e.width,e.height),this.ctx.restore(),this.ctx.attributes["fill-opacity"]=1,this.ctx.closeGroup(),r}renderLine(e,t,i="#FF0000FF",s=2,r){this.ctx.save();let n=this.ctx.openGroup("line",r);return this.ctx.beginPath(),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(t.x,t.y),this.ctx.attributes.stroke=i,this.ctx.lineWidth=s,this.ctx.stroke(),this.ctx.closeGroup(),this.ctx.restore(),n}renderCurve(e,t,i){let s;t&&i&&(s=`${i.getSVGId()}-slur`);let r=this.ctx.openGroup("curve",s);return this.ctx.beginPath(),this.ctx.moveTo(e[0].x,e[0].y),this.ctx.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y),this.ctx.lineTo(e[7].x,e[7].y),this.ctx.bezierCurveTo(e[6].x,e[6].y,e[5].x,e[5].y,e[4].x,e[4].y),this.ctx.lineTo(e[0].x,e[0].y),this.ctx.closePath(),this.ctx.fill(),this.ctx.closeGroup(),r}renderPath(e,t=!0,i){let s=this.ctx.openGroup("path",i);this.ctx.beginPath();let r;for(let n of e){if(!r){this.ctx.moveTo(n.x,n.y),r=n;continue}this.ctx.lineTo(n.x,n.y)}return this.ctx.closePath(),t?this.ctx.fill():this.ctx.stroke(),this.ctx.stroke(),this.ctx.closeGroup(),s}renderWavyLine(e,t,i="#000000",s=1,r=2,n=4,a){let o=t.x-e.x,l=t.y-e.y,h=Math.sqrt(o*o+l*l),u=Math.atan2(l,o)*180/Math.PI,c=document.createElementNS("http://www.w3.org/2000/svg","g");a&&c.setAttribute("id",a),c.setAttribute("class","vf-glissando"),c.setAttribute("transform",`translate(${e.x}, ${e.y}) rotate(${u})`);let d=3.5,f=Math.max(1,Math.floor(h/5)),p=h/f,m="M 0 0";for(let b=0;b<f;b++){let S=b*p,E=S+p*.25,y=S+p*.5,M=S+p*.75,P=S+p;m+=` C ${E} ${-d}, ${y} ${-d}, ${y} 0`,m+=` C ${y} ${d}, ${M} ${d}, ${P} 0`}let g=document.createElementNS("http://www.w3.org/2000/svg","path");return g.setAttribute("d",m),g.setAttribute("stroke",i),g.setAttribute("stroke-width","1.2"),g.setAttribute("fill","none"),g.setAttribute("stroke-linecap","round"),g.setAttribute("stroke-linejoin","round"),c.appendChild(g),this.ctx.svg.appendChild(c),c}export(){let e=this.ctx.svg.cloneNode(!0),t=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),i=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",t);i.replaceChild(e,i.documentElement);let s=new XMLSerializer().serializeToString(i),r=document.createElement("a");r.href="data:image/svg+xml; charset=utf8, "+encodeURIComponent(s.replace(/></g,`>
6\r<`)),r.download="opensheetmusicdisplay_download.svg",r.innerHTML=window.location.href+"/download",document.body.appendChild(r)}},nl=class{constructor(e){this.Glissando=e,this.staffEntries=[]}calculateLine(e){let t=this.staffEntries[0],i=this.staffEntries[this.staffEntries.length-1],s=t.findGraphicalNoteFromNote(this.Glissando.StartNote),r=i.findGraphicalNoteFromNote(this.Glissando.EndNote);if(!s&&!r)return;let n=t.parentMeasure.ParentStaffLine,a,o,l,h;if(s&&t.parentMeasure.ParentStaffLine===this.StaffLine)a=s.PositionAndShape.RelativePosition.x+s.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+s.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x+e.GlissandoNoteOffset,l=s.PositionAndShape.AbsolutePosition.y;else{a=i.parentMeasure.beginInstructionsWidth-.4;let d=this.Glissando.Direction===re.Down?-1:1;l=r.PositionAndShape.AbsolutePosition.y+d*e.GlissandoStafflineStartYDistanceToNote}if(r&&i.parentMeasure.ParentStaffLine===this.StaffLine)o=r.PositionAndShape.RelativePosition.x+r.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+r.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x-.5-e.GlissandoNoteOffset,a>o&&(a=o-e.GlissandoStafflineStartMinimumWidth),h=r.PositionAndShape.AbsolutePosition.y;
6else{if(n.Measures.last().parentSourceMeasure.HasEndLine)return;o=n.PositionAndShape.Size.width,o-a>e.GlissandoStafflineEndOffset&&(a=o-e.GlissandoStafflineEndOffset);let d=this.Glissando.Direction===re.Down?1:-1;h=s.PositionAndShape.AbsolutePosition.y+d*e.GlissandoStafflineStartYDistanceToNote}let u=new k(a,l),c=new k(o,h);this.Width===void 0&&(this.Width=e.GlissandoDefaultWidth),this.Line=new Ae(u,c,this.Width)}},dn=class extends nl{},fr=class{constructor(e=1,t=0){this.notes=[],this.extendedNoteList=[],this.BeamNumberOffsetToXML=0,this.AutoGenerated=!1,this.SecondaryBreakIndices=[],this.BeamNumber=e,this.BeamNumberOffsetToXML=t}get Notes(){return this.notes}set Notes(e){this.notes=e}get ExtendedNoteList(){return this.extendedNoteList}set ExtendedNoteList(e){this.extendedNoteList=e}addNoteToBeam(e){e&&(e.NoteBeam=this,this.notes.push(e),this.extendedNoteList.push(e))}},Mu=(function(e){return e[e.BeamNone=-1]="BeamNone",e[e.BeamBegin=0]="BeamBegin",e[e.BeamContinue=1]="BeamContinue",e[e.BeamEnd=2]="BeamEnd",e[e.BeamForward=3]="BeamForward",e[e.BeamBackward=4]="BeamBackward",e})({}),Lr=class extends Bn{constructor(e,t,i){super(e,t,i)}applyBordersFromVexflow(){let e=this.vfStaveNote;if(!e.getNoteHeadBeginX)return;let t=e.getBoundingBox(),i=e.getNoteHeadBeginX()-t.x;this.PositionAndShape.RelativePosition.y=t.y/10,this.PositionAndShape.BorderTop=0,this.PositionAndShape.BorderBottom=t.h/10;let s=(e.width-(e.paddingRight??0))/2;this.PositionAndShape.BorderLeft=-(i+s)/10,this.PositionAndShape.BorderRight=(t.w-i)/10}set vfStaveNote(e){this.mVexFlowStaveNote=e}
6get vfStaveNote(){return this.mVexFlowStaveNote}applyCustomNoteheads(){let e=this.vfStaveNote;if(e)for(let t=0;t<this.notes.length;t++){let i=this.notes[t].sourceNote;e.note_heads&&i.CustomNoteheadVFCode&&(e.note_heads[t].glyph_code=i.CustomNoteheadVFCode)}}color(){let e=this.rules.DefaultColorNotehead,t=this.rules.DefaultColorRest,i=this.rules.DefaultColorStem,s="#00000000",r,n,a=this.vfStaveNote;for(let c=0;c<this.notes.length;c++){let d=this.notes[c];if(n=d.sourceNote.NoteheadColor,r=n,this.rules.ColoringMode===bi.AutoColoring||this.rules.ColoringMode===bi.CustomColorSet)if(d.sourceNote.isRest())r=this.rules.ColoringSetCurrent.getValue(-1);else{let f=d.sourceNote.Pitch.FundamentalNote;r=this.rules.ColoringSetCurrent.getValue(f)}if(!d.sourceNote.PrintObject||d.sourceNote.Notehead?.Shape===Vt.NONE?r=s:(!r||r==="#000000")&&(r=this.rules.DefaultColorNotehead),!n&&this.rules.ColoringMode===bi.XML&&d.sourceNote.PrintObject&&d.sourceNote.Notehead?.Shape!==Vt.NONE&&(!d.sourceNote.isRest()&&e?r=e:d.sourceNote.isRest()&&t&&(r=t)),r&&d.sourceNote.PrintObject&&d.sourceNote.Notehead?.Shape!==Vt.NONE)d.sourceNote.NoteheadColorCurrentlyRendered=r;else if(!r)continue;if(this.rules.ColoringEnabled&&d.sourceNote.NoteBeam&&this.rules.ColorBeams){let f=d.sourceNote.NoteBeam.Notes,p=!0;for(let m=0;m<f.length;m++)f[m].NoteheadColorCurrentlyRendered!==r&&(p=!1);p&&a?.beam?.setStyle&&a.beam.setStyle({fillStyle:r,strokeStyle:r})}if(a){if(a.note_heads){let f=a.note_heads[c];f&&f.setStyle({fillStyle:r,strokeStyle:r})}a.setLedgerLineStyle&&(r===s?a.setLedgerLineStyle({fillStyle:r,strokeStyle:r,lineWidth:this.rules.LedgerLineWidth}):a.setLedgerLineStyle({fillStyle:this.rules.LedgerLineColorDefault,lineWidth:this.rules.LedgerLineWidth,strokeStyle:this.rules.LedgerLineColorDefault}))}}let o=i,l=!1;this.rules.ColoringEnabled&&(o=this.parentVoiceEntry.StemColor,(!o||o==="#000000")&&(o=i),this.rules.ColorStemsLikeNoteheads&&r&&(o=r,l=!0));let h=!0;for(let c of this.parentVoiceEntry.Notes)if(c.PrintObject&&c.Notehead?.Shape!==Vt.NONE){h=!1;break}h&&(o=s);let u={fillStyle:o,strokeStyle:o};a&&a.setStemStyle&&(!h&&l&&(this.parentVoiceEntry.StemColor=o),a.setStemStyle(u),a.flag&&a.setFlagStyle&&this.rules.ColorFlags&&a.setFlagStyle(u))}},Tt=class{static translateText(e,t){if(!this.defaultTextTranslation)return t}},Fa,_r=(function(e){return e[e.UNDEFINED=0]="UNDEFINED",e[e._1024th=1]="_1024th",e[e._512th=2]="_512th",e[e._256th=3]="_256th",e[e._128th=4]="_128th",e[e._64th=5]="_64th",e[e._32nd=6]="_32nd",e[e._16th=7]="_16th",e[e.EIGTH=8]="EIGTH",e[e.QUARTER=9]="QUARTER",e[e.HALF=10]="HALF",e[e.WHOLE=11]="WHOLE",e[e.BREVE=12]="BREVE",e[e.LONG=13]="LONG",e[e.MAXIMA=14]="MAXIMA",e})({}),Zi=class{static NoteTypeToString(e){return this.NoteTypeXmlValues[e]}static StringToNoteType(e){let t=this.NoteTypeXmlValues.indexOf(e);return t===-1?_r.UNDEFINED:t}static getNoteDurationFromType(e){switch(e){case"1024th":return new N(1,1024);case"512th":return new N(1,512);case"256th":return new N(1,256);case"128th":return new N(1,128);case"64th":return new N(1,64);case"32th":case"32nd":return new N(1,32);case"16th":return new N(1,16);case"eighth":return new N(1,8);case"quarter":return new N(1,4);case"half":return new N(1,2);case"whole":return new N(1,1);case"breve":return new N(2,1);case"long":return new N(4,1);case"maxima":return new N(8,1);default:throw new Se(Tt.translateText("ReaderErrorMessages/NoteDurationError","Invalid note duration."))}}};Fa=Zi,Fa.NoteTypeXmlValues=["","1024th","512th","256th","128th","64th","32nd","16th","eigth","quarter","half","whole","breve","long","maxima"];var ct=vt.Flow,wu=ct.NoteSubGroup,Qi=class al extends Ni{constructor(t,i,s){super(t,i,s),this.octaveOffset=3,this.vfVoices={},this.vfTies=[],this.vfRepetitionWords=[],this.hasMetronomeMark=!1,this.connectors=[],this.beams={},this.autoVfBeams=[],this.autoTupletVfBeams=[],this.vfbeams={},this.tuplets={},this.vftuplets={},this.minimumStaffEntriesWidth=-1,s?this.rules=s.ParentMusicSystem.rules:i?this.rules=i.Rules:this.rules=new Li,this.resetLayout()}setAbsoluteCoordinates(t,i){this.stave.setX(t).setY(i)}resetLayout(){this.stave=new ct.Stave(0,0,0,{fill_style:this.rules.StaffLineColor,space_above_staff_ln:0,space_below_staff_ln:0}),this.InitiallyActiveClef&&(this.stave.clef=Ht.Clef(this.InitiallyActiveClef).type),this.stave.MeasureNumber=this.MeasureNumber,this.hasMetronomeMark=!1,this.ParentStaff&&this.setLineNumber(this.ParentStaff.StafflineCount),this.stave.setBegBarType(ct.Barline.type.NONE),this.parentSourceMeasure&&this.parentSourceMeasure.endingBarStyleEnum===ft.None&&this.stave.setEndBarType(ct.Barline.type.NONE),this.updateInstructionWidth()}clean(){this.vfTies.length=0,this.connectors=[],this.resetLayout()}getLineWidth(t){switch(t){case ft.BoldThinDots:case ft.DotsThinBold:return 10/10;case ft.DotsBoldBoldDots:return 10/10+this.rules.RepeatEndStartPadding;default:return 0}}addClefAtBegin(t){if(this.rules.RenderClefsAtBeginningOfStaffline){if(this.octaveOffset=t.OctaveOffset,t.ClefType===yt.TAB)this.stave.addClef("tab",void 0,void 0,void 0);else{let i=Ht.Clef(t,"default");this.stave.addClef(i.type,i.size,i.annotation,ct.StaveModifier.Position.BEGIN)}this.updateInstructionWidth()}}setLineNumber(t){t!==5&&(t===0?(this.stave.setNumLines(0),this.stave.getBottomLineY=function(){return this.getYForLine(this.options.num_lines)}):t===1?(this.stave.options.line_config=[{visible:!1},{visible:!1},{visible:!0},{visible:!1},{visible:!1}],this.stave.getBottomLineY=function(){return this.getYForLine(2)}):t===2?(this.stave.options.line_config=[{visible:!1},{visible:!1},{visible:!0},{visible:!0},{visible:!1}],this.stave.getBottomLineY=function(){return this.getYForLine(3)}):t===3?(this.stave.options.line_config=[{visible:!1},{visible:!0},{visible:!0},{visible:!0},{visible:!1}],this.stave.getBottomLineY=function(){return this.getYForLine(2)}):(this.stave.setNumLines(t),this.stave.getBottomLineY=function(){return this.getYForLine(this.options.num_lines)}
6))}addKeyAtBegin(t,i,s){if(!(!this.rules.RenderKeySignatures||!this.ShowKeySignature)&&!(this.isTabMeasure&&!this.rules.TabKeySignatureRendered&&!this.rules.TabKeySignatureSpacingAdded)&&!(this.parentSourceMeasure?.isReducedToMultiRest&&!this.rules.MultipleRestMeasureAddKeySignature)){if(this.stave.setKeySignature(Ht.keySignature(t),Ht.keySignature(i),void 0),this.isTabMeasure&&!this.rules.TabKeySignatureRendered){let r=this.stave.getModifiers();for(let n of r)if(n instanceof ct.KeySignature){n.setStyle({fillStyle:"#00000000"}),n.hidden=!0;break}}this.updateInstructionWidth()}}addRhythmAtBegin(t){if(this.isTabMeasure&&!this.rules.TabTimeSignatureRendered&&!this.rules.TabTimeSignatureSpacingAdded)return;let i=Ht.TimeSignature(t);this.stave.addModifier(i,ct.StaveModifier.Position.BEGIN),(!this.ShowTimeSignature||this.isTabMeasure&&!this.rules.TabTimeSignatureRendered)&&(i.setStyle({fillStyle:"#00000000"}),i.hidden=!0),this.updateInstructionWidth()}addClefAtEnd(t,i=!0){if(this.isTabMeasure)return;let s=Ht.Clef(t,"small");if(!(!i&&this.stave.endClef)){this.stave.setEndClef(s.type,s.size,s.annotation);for(let r of this.stave.getModifiers())if(i){let n=r.originalStrokeStyle,a=r.originalFillStyle;r.getStyle()&&(n&&a?(r.getStyle().strokeStyle=n,r.getStyle().fillStyle=a):(r.getStyle().strokeStyle=null,r.getStyle().fillStyle=null))}else if(r.getCategory()==="clefs"&&r.getPosition()===ct.StaveModifier.Position.END&&r.type===s.type){let n="#12345600",a=r.getStyle();a&&(r.originalStrokeStyle=a.strokeStyle,r.originalFillStyle=a.fillStyle),r.setStyle({strokeStyle:n,fillStyle:n})}return this.parentSourceMeasure.hasEndClef=!0,this.updateInstructionWidth()}}addMeasureLine(t,i,s=!0){switch(i){case wi.MeasureBegin:t===ft.BoldThinDots&&(s||(this.stave.modifiers[0].draw=function(r){switch(r.checkContext(),this.setRendered(),this.type){case ct.Barline.type.SINGLE:this.drawVerticalBar(r,this.x,!1);break;case ct.Barline.type.DOUBLE:this.drawVerticalBar(r,this.x,!0);break;case ct.Barline.type.END:this.drawVerticalEndBar(r,this.x);break;case ct.Barline.type.REPEAT_BEGIN:this.drawRepeatBar(r,this.x,!0);break;case ct.Barline.type.REPEAT_END:this.drawRepeatBar(r,this.x,!1);break;case ct.Barline.type.REPEAT_BOTH:this.drawRepeatBar(r,this.x,!1),this.drawRepeatBar(r,this.x,!0);break;default:break}}),this.stave.setBegBarType(ct.Barline.type.REPEAT_BEGIN));break;case wi.MeasureEnd:switch(t){case ft.DotsBoldBoldDots:this.stave.setEndBarType(ct.Barline.type.REPEAT_BOTH);break;case ft.DotsThinBold:this.stave.setEndBarType(ct.Barline.type.REPEAT_END);break;case ft.DoubleThin:this.stave.setEndBarType(ct.Barline.type.DOUBLE);break;case ft.ThinBold:this.stave.setEndBarType(ct.Barline.type.END);break;case ft.DoubleBold:this.stave.setEndBarType(8);break;case ft.None:this.stave.setEndBarType(ct.Barline.type.NONE);break;default:break}break;default:break}}addMeasureNumber(){let t=this.MeasureNumber.toString(),i=Qs.ABOVE;this.stave.setText(t,i,{justification:1,shift_x:0,shift_y:0})}addWordRepetition(t){let i,s=ct.StaveModifier.Position.END,r=this.beginInstructionsWidth;switch(t.type){case J.Segno:i=ct.Repetition.type.SEGNO_LEFT,s=ct.StaveModifier.Position.LEFT;break;case J.Coda:i=ct.Repetition.type.CODA_LEFT,s=ct.StaveModifier.Position.LEFT;break;case J.DaCapo:i=ct.Repetition.type.DC;break;case J.DalSegno:i=ct.Repetition.type.DS;break;case J.Fine:i=ct.Repetition.type.FINE;break;case J.ToCoda:i=ct.Repetition.type.TO_CODA;break;case J.DaCapoAlFine:i=ct.Repetition.type.DC_AL_FINE;break;case J.DaCapoAlCoda:i=ct.Repetition.type.DC_AL_CODA;break;case J.DalSegnoAlFine:i=ct.Repetition.type.DS_AL_FINE;break;case J.DalSegnoAlCoda:i=ct.Repetition.type.DS_AL_CODA;break;default:break}if(i){let n=new ct.Repetition(i,r,-this.rules.RepetitionSymbolsYOffset);n.xShiftAsPercentOfStaveWidth=this.rules.RepetitionEndInstructionXShiftAsPercentOfStaveWidth,this.stave.addModifier(n,s);return}this.addVolta(t)}addVolta(t){let i=ct.Volta.type.BEGIN;if(t.type===J.Ending){switch(t.alignment){case Pt.Begin:i=this.parentSourceMeasure.endsRepetitionEnding()?ct.Volta.type.BEGIN_END:ct.Volta.type.BEGIN;break;case Pt.Discontinue:if(this.parentSourceMeasure.beginsRepetitionEnding())return;i=ct.Volta.type.MID;break;case Pt.End:if(this.parentSourceMeasure.beginsRepetitionEnding())return;i=ct.Volta.type.END;break;case Pt.Mid:i=ct.Volta.type.MID;break;default:break}let s=this.ParentStaffLine.SkyBottomLineCalculator,r=this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginLeft+.4,n=Math.max(this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginRight,r+.4),a=s.get
6SkyLineMinInRange(r,n)-2,o=-6.1+this.rules.VoltaOffset,l=this.rules.VoltaOffset;if(a<o){let c=a-o;l+=c,o=a}let h,u=this.parentSourceMeasure.MeasureNumber;for(let c=0;c<this.ParentStaffLine.Measures.length;c++){let d=this.ParentStaffLine.Measures[c];d instanceof al&&(d.MeasureNumber===u-1||d.MeasureNumber+d.parentSourceMeasure?.multipleRestMeasures===u)&&(h=d)}if(h){let c=h.stave.getModifiers();for(let d=0;d<c.length;d++){let f=c[d];if(f.hasOwnProperty("volta")){let p=h.ParentStaffLine.SkyBottomLineCalculator,m=h.PositionAndShape.AbsolutePosition.x+h.PositionAndShape.BorderMarginLeft+.4,g=Math.max(h.PositionAndShape.AbsolutePosition.x+h.PositionAndShape.BorderMarginRight,m+.4),b=p.getSkyLineMinInRange(m,g);if(b<=o){let S=b-o;l+=S,o=b}else f.y_shift=l*10,h.ParentStaffLine.SkyBottomLineCalculator.updateSkyLineInRange(m,g,o)}}}l*=10,this.stave.setVoltaType(i,t.endingIndices[0],l),s.updateSkyLineInRange(r,n,o)}}setWidth(t){super.setWidth(t),this.stave.setWidth(t*10)}layoutSymbols(){}draw(t){let i=t.openGroup();i&&(i.classList?.add("vf-measure"),i.id=`${this.MeasureNumber}`),this.stave.setContext(t).draw();for(let s in this.vfVoices)this.vfVoices.hasOwnProperty(s)&&(t.save(),this.vfVoices[s].draw(t,this.stave),t.restore());for(let s in this.vfbeams)if(this.vfbeams.hasOwnProperty(s))for(let r of this.vfbeams[s])r.setContext(t).draw();if(this.autoVfBeams)for(let s of this.autoVfBeams)s.setContext(t).draw();if(!this.isTabMeasure||this.rules.TupletNumbersInTabs){if(this.autoTupletVfBeams)for(let s of this.autoTupletVfBeams)s.setContext(t).draw();for(let s in this.vftuplets)if(this.vftuplets.hasOwnProperty(s))for(let r=0;r<this.tuplets[s].length;r++){let n=this.tuplets[s][r][0],a=this.vftuplets[s][r];a&&(!n.RenderTupletNumber||n.ShowNumberNoneGivenInXml&&this.rules.TupletNumberUseShowNoneXMLValue?a.RenderTupletNumber=!1:a.RenderTupletNumber=!0,a.setContext(t).draw())}}for(let s of this.vfTies)s instanceof ct.TabSlide||(s.setContext(t),s.draw());t.closeGroup();for(let s of this.connectors)t.openGroup("connector"),s.setContext(t).draw(),t.closeGroup();this.correctNotePositions()}format(){this.formatVoices&&this.formatVoices((this.PositionAndShape.Size.width-this.beginInstructionsWidth-this.endInstructionsWidth)*10,this)}correctNotePositions(){if(this.isTabMeasure){for(let t of this.getVoicesWithinMeasure())for(let i of t.VoiceEntries)for(let s of i.Notes){let r=s,n=this.rules.GNote(s);r.StringNumberTab>=0&&(n.parentVoiceEntry.PositionAndShape.RelativePosition.y=(r.StringNumberTab-1)*this.rules.TabStaffInterlineHeightForBboxes)}return}for(let t of this.getVoicesWithinMeasure())for(let i of t.VoiceEntries)for(let s of i.Notes){if(s.isRest())continue;let r=this.rules.GNote(s);if(!r?.vfnote)return;let n=r.vfnote[0],a=0;r.parentVoiceEntry.parentVoiceEntry.StemDirection===Rt.Up&&r.vfnote[0].getDuration()!=="w"?a+=3.5:a+=.5;let o=-r.notehead(n).line;a+=o+r.parentVoiceEntry.notes.last().notehead().line,r.PositionAndShape.RelativePosition.y=a}}getVoicesWithinMeasure(){let t=[];for(let i of this.staffEntries)for(let s of i.graphicalVoiceEntries)t.indexOf(s.parentVoiceEntry.ParentVoice)===-1&&t.push(s.parentVoiceEntry.ParentVoice);return t}getGraphicalVoiceEntriesPerVoice(t){let i=[];for(let s of this.staffEntries)for(let r of s.graphicalVoiceEntries)r.parentVoiceEntry.ParentVoice===t&&i.push(r);return i}getRestFilledVexFlowStaveNotesPerVoice(t){let i,s=this.getGraphicalVoiceEntriesPerVoice(t);for(let a=0;a<s.length;a++){let o=s[a],l=o.notes[0].sourceNote.getAbsoluteTimestamp(),h=new N;for(let u of o.notes){let c=N.plus(u.sourceNote.getAbsoluteTimestamp(),u.sourceNote.Length);h.lt(c)&&(h=c)}if(i){let u=N.minus(l,i);if(u.RealValue>0){W.default.trace(`Ghost Found in between (measure ${this.MeasureNumber})`);let c=this.createGhostGves(u);s.splice(a,0,...c),a+=c.length}}else{let u=N.minus(l,this.parentSourceMeasure.AbsoluteTimestamp);if(u.RealValue>0){W.default.trace(`Ghost Found at start (measure ${this.MeasureNumber})`);let c=this.createGhostGves(u);s.splice(0,0,...c),a+=c.length}}i=h}let r=N.plus(this.parentSourceMeasure.AbsoluteTimestamp,this.parentSourceMeasure.Duration),n=N.minus(r,i);if(n.RealValue>0){W.default.trace(`Ghost Found at end (measure ${this.MeasureNumber})`);let a=this.createGhostGves(n);s=s.concat(a)}return s}createGhostGves(t){let i=Ht.GhostNotes(t),s=[];for(let r of i){let n=new Lr(void 0,void 0,this.rules);
6n.vfStaveNote=r,s.push(n)}return s}handleBeam(t,i){let s=t.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId,r=this.beams[s];r||(r=this.beams[s]=[]);let n;for(let o of r)o[0]===i&&(n=o);n||(n=[i,[]],r.push(n));let a=t.parentVoiceEntry;n[1].indexOf(a)<0&&n[1].push(a)}handleTuplet(t,i){let s=t.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;i=t.sourceNote.NoteTuplet;let r=this.tuplets[s];r||(r=this.tuplets[s]=[]);let n;for(let o of r)o[0]===i&&(n=o);n||(n=[i,[]],r.push(n));let a=t.parentVoiceEntry;n[1].indexOf(a)<0&&n[1].push(a)}finalizeBeams(){if(this.vfbeams={},this.isTabMeasure&&!this.rules.TabBeamsRendered)return;let t=[];for(let i in this.beams)if(this.beams.hasOwnProperty(i)){let s=this.vfbeams[i];s||(s=this.vfbeams[i]=[]);for(let r of this.beams[i]){let n=!1;for(let f of r[0].Notes)if(f.Length.RealValue>=new N(1,4).RealValue&&(!f.TypeLength||f.TypeLength.RealValue>.125)){n=!0;break}if(n){W.default.debug("Beam between note >= quarter, likely tremolo, currently unsupported. continuing.");continue}let a=[],o=r[0],l=r[1],h=!0;for(let f of l)f.parentVoiceEntry.ParentVoice===o.Notes[0].ParentVoiceEntry.ParentVoice&&(h=f.parentVoiceEntry.WantedStemDirection===Rt.Undefined);let u=!1,c,d=[];for(let f of l){let p=f.vfStaveNote;p&&(a.push(p),t.push(p)),f.parentVoiceEntry.IsGrace&&(u=!0),f.parentVoiceEntry.StemColor&&this.rules.ColoringEnabled&&d.push(f.parentVoiceEntry.StemColor)}if(a.length>1){let f=new ct.Beam(a,h);if(o.SecondaryBreakIndices?.length>0&&f.breakSecondaryAt(o.SecondaryBreakIndices),u&&(f.render_options.beam_width=3,f.render_options.partial_beam_length=4),d.length>=2&&this.rules.ColorBeams){c=d[0];for(let p of d)if(p!==c){c=void 0;break}f.setStyle({fillStyle:c,strokeStyle:c})}this.rules.FlatBeams&&(f.render_options.flat_beams=!0,f.render_options.flat_beam_offset=this.rules.FlatBeamOffset,f.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),s.push(f)}else W.default.debug("Warning! Beam with no notes!")}}this.rules.AutoBeamNotes&&this.autoBeamNotes(t)}autoBeamNotes(t){if(!this.rules.AutoBeamTabs&&this.isTabMeasure)return;let i=60,s=[],r=[],n,a=[];this.autoTupletVfBeams=[];let o=[];this.autoVfBeams=[];let l=this.parentSourceMeasure.ActiveTimeSignature;l||(l=this.parentSourceMeasure.Duration);for(let c of this.staffEntries)for(let d of c.graphicalVoiceEntries){let f=d.vfStaveNote,p=d.notes[0],m={vfStaveNote:f,sourceNote:p.sourceNote},g=c.relInMeasureTimestamp.isOnBeat(l),b=r.length>=2,S=p.sourceNote.Length.RealValue-new N(1,4).RealValue>-N.FloatInaccuracyTolerance,E=d.parentVoiceEntry.IsGrace||S||t.contains(f);if(E||g){if(b){for(let M of r)s.push(M);o.push(s.slice()),s=[]}if(r=[],E)continue}let y=d.notes[0].sourceNote.NoteTuplet;if(y){let M=!1;for(let P of y.Notes){for(let L of P)if(L.NoteTypeXml>=_r.QUARTER||L.ParentVoiceEntry.IsGrace||L.isRest()&&!this.rules.AutoBeamOptions.beam_rests){M=!0;break}if(M)break}if(!n)n=y;else if(n!==y){if(a.length>1){let P=[];for(let A of a)P.push(A.vfStaveNote);let L=new ct.Beam(P,!0);this.rules.FlatBeams&&(L.render_options.flat_beams=!0,L.render_options.flat_beam_offset=this.rules.FlatBeamOffset,L.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(L);let B=new fr(i++);B.AutoGenerated=!0;for(let A of a)B.addNoteToBeam(A.sourceNote)}a=[],n=y}M||a.push(m);continue}else n=void 0;r.push(m)}if(a.length>=2){let c=[];for(let p of a)c.push(p.vfStaveNote);let d=new ct.Beam(c,!0);this.rules.FlatBeams&&(d.render_options.flat_beams=!0,d.render_options.flat_beam_offset=this.rules.FlatBeamOffset,d.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(d);let f=new fr(i++);f.AutoGenerated=!0;for(let p of a)f.addNoteToBeam(p.sourceNote)}if(r.length>=2){for(let c of r)s.push(c);o.push(s)}let h=this.rules.AutoBeamOptions,u={beam_middle_only:h.beam_middle_rests_only,beam_rests:h.beam_rests,maintain_stem_directions:h.maintain_stem_directions};if(h.groups&&h.groups.length){let c=[];for(let d of h.groups)c.push(new ct.Fraction(d[0],d[1]));u.groups=c}for(let c of o){let d=[];for(let p of c)d.push(p.vfStaveNote);let f=ct.Beam.generateBeams(d,u);
6for(let p of f)this.rules.FlatBeams&&(p.render_options.flat_beams=!0,p.render_options.flat_beam_offset=this.rules.FlatBeamOffset,p.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoVfBeams.push(p)}}finalizeTuplets(){this.vftuplets={};for(let t in this.tuplets)if(this.tuplets.hasOwnProperty(t)){let i=this.vftuplets[t];i||(i=this.vftuplets[t]=[]);for(let s of this.tuplets[t]){let r=[],n=s[1];for(let a of n)r.push(a.vfStaveNote);if(r.length>1){let a=s[0],o=a.Notes[0][0].NormalNotes,l=a.shouldBeBracketed(this.rules.TupletsBracketedUseXMLValue,this.rules.TupletsBracketed,this.rules.TripletsBracketed,this.isTabMeasure,this.rules.TabTupletsBracketed),h=ct.Tuplet.LOCATION_TOP;a.tupletLabelNumberPlacement===C.Below&&(h=ct.Tuplet.LOCATION_BOTTOM);let u=0;this.isTabMeasure&&(u=this.rules.TabTupletYOffsetBottom*10,h===ct.Tuplet.LOCATION_TOP&&(u=this.rules.TabTupletYOffsetTop*-10,a.Notes[0][0]?.hasTabEffects()&&(u-=this.rules.TabTupletYOffsetEffects*10)));let c=new ct.Tuplet(r,{bracketed:l,location:h,notes_occupied:o,num_notes:a.TupletLabelNumber,ratioed:a.Ratioed,y_offset:u});i.push(c)}else W.default.debug("Warning! Tuplet with no notes! Trying to ignore, but this is a serious problem.")}}}layoutStaffEntry(t){}graphicalMeasureCreatedCalculations(){let t,i=[],s=[];for(let n of this.staffEntries){t=!1,i=[];for(let a of n.graphicalVoiceEntries){if(a.parentVoiceEntry.IsGrace){i.push(a),s.push(a),t||(t=a.parentVoiceEntry.GraceSlur);continue}if(a.vfStaveNote=Ht.StaveNote(a),i.length>0){let o=[];for(let u=0;u<i.length;u++){let c=i[u];c.GraceSlash=c.parentVoiceEntry.GraceNoteSlash,u>0&&(c.GraceSlash=!1);let d=Ht.StaveNote(c);c.vfStaveNote=d,o.push(d)}let l=new ct.GraceNoteGroup(o,t),h=this.rules.GraceNoteGroupXMargin;o.length>1&&(h/=3),l.spacing=h*10,a.vfStaveNote.addModifier(0,l),i=[]}}}if(i.length>0)for(let n of i)n.vfStaveNote=Ht.StaveNote(n),n.parentVoiceEntry.GraceAfterMainNote=!0;this.finalizeBeams(),this.finalizeTuplets();let r=this.getVoicesWithinMeasure();if(this.rules.RenderFingerings)for(let n of this.staffEntries)n.setModifierXOffsets();for(let n of r){if(!n)continue;this.vfVoices[n.VoiceId]=new ct.Voice({beat_value:this.parentSourceMeasure.ActiveTimeSignature.Denominator,num_beats:this.parentSourceMeasure.ActiveTimeSignature.Numerator,resolution:ct.RESOLUTION}).setMode(ct.Voice.Mode.SOFT);let a=this.getRestFilledVexFlowStaveNotesPerVoice(n);for(let o of a){if(o.parentVoiceEntry&&o.parentVoiceEntry.IsGrace&&!o.parentVoiceEntry.GraceAfterMainNote)continue;let l=o;if(l.vfStaveNote.getTicks().denominator===0&&(l.vfStaveNote.getTicks().denominator=1),o.notes.length>0&&o.notes[0].sourceNote&&o.notes[0].sourceNote.NoteTuplet){let u=o.notes[0].graphicalNoteLength,c=l.vfStaveNote.getTicks();c.numerator=u.Numerator*ct.RESOLUTION,c.denominator=u.Denominator,c.simplify()}let h=l.parentStaffEntry;if(h&&h.vfClefBefore){if(o.notes[0]&&!o.notes[0].sourceNote.PrintObject){let d=this.rules.DefaultColorMusic||"#000000";h.vfClefBefore.setStyle({fillStyle:d,strokeStyle:d})}let u=new wu([h.vfClefBefore]),c=l.vfStaveNote;c&&typeof c.addModifier=="function"&&c.addModifier(0,u)}if(o.notes.length===0||!o.notes[0]||!o.notes[0].sourceNote.PrintObject){this.vfVoices[n.VoiceId].addTickable(l.vfStaveNote);continue}o.parentVoiceEntry&&this.rules.RenderFingerings&&((this.rules.FingeringPosition===C.Left||this.rules.FingeringPosition===C.Right)&&this.createFingerings(o),this.createStringNumber(o)),this.createArpeggio(o),this.vfVoices[n.VoiceId].addTickable(l.vfStaveNote)}}this.setStemDirectionFromVexFlow();for(let n of s)this.createFingerings(n),this.createStringNumber(n),this.createArpeggio(n);this.createArticulations(),this.createOrnaments()}createArpeggio(t){if(t.parentVoiceEntry&&t.parentVoiceEntry.Arpeggio){let i=t.parentVoiceEntry.Arpeggio;if(t.notes&&t.notes.length>1){let s=Ht.StrokeTypeFromArpeggioType(i.type),r=new ct.Stroke(s,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&t.vfStaveNote.addStroke(0,r)}else W.default.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn.
7                voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.`)}}setStemDirectionFromVexFlow(){for(let t of this.staffEntries)for(let i of t.graphicalVoiceEntries)for(let s of i.notes){let r=s.vfnote;if(!(!r||!r[0]))switch(r[0].getStemDirection()){case ct.Stem.UP:i.parentVoiceEntry.StemDirection=Rt.Up;break;case ct.Stem.DOWN:i.parentVoiceEntry.StemDirection=Rt.Down;break;default:}}}createArticulations(){for(let t=0,i=this.staffEntries.length;t<i;++t){let s=this.staffEntries[t].graphicalVoiceEntries;for(let r of s){let n=r.vfStaveNote;Ht.generateArticulations(n,r.notes[0],this.rules)}}}createOrnaments(){for(let t=0,i=this.staffEntries.length;t<i;++t){let s=this.staffEntries[t].graphicalVoiceEntries;for(let r in s)if(s.hasOwnProperty(r)){let n=s[r].vfStaveNote,a=s[r].notes[0].sourceNote.ParentVoiceEntry.Orn
7amentContainer;a&&Ht.generateOrnaments(n,a)}}}createFingerings(t){let i=t,s=0;for(let a of t.notes)a.sourceNote.Fingering&&s++;let r=[];for(let a of t.parentVoiceEntry.TechnicalInstructions)a.type===xs.Fingering&&r.push(a);if(r.length>s){let a=0;for(let o of t.notes)if(o.sourceNote.Fingering)a++;else{if(a>r.length-1)break;o.sourceNote.Fingering=r[a],a++}}let n=-1;for(let a of t.notes){let o=a.sourceNote.Fingering;if(!o){n++;continue}n++;let l=this.rules.FingeringPosition;this.rules.FingeringPositionGrace===C.AboveOrBelow&&(this.isUpperStaffOfInstrument()?l=C.Above:this.isLowerStaffOfInstrument()&&(l=C.Below)),o.placement!==C.NotYetDefined&&(l=o.placement);let h=this.rules.FingeringOffsetX,u;switch(l){default:case C.Left:u=ct.StaveModifier.Position.LEFT,h-=a.baseFingeringXOffset*10;break;case C.Right:u=ct.StaveModifier.Position.RIGHT,h+=a.baseFingeringXOffset*10;break;case C.Above:u=ct.StaveModifier.Position.ABOVE;break;case C.Below:u=ct.StaveModifier.Position.BELOW;break;case C.NotYetDefined:let d=t.parentStaffEntry.sourceStaffEntry.ParentStaff;t.notes.length>1||t.parentStaffEntry.graphicalVoiceEntries.length>1?u=ct.StaveModifier.Position.LEFT:d.idInMusicSheet===0?(u=ct.StaveModifier.Position.ABOVE,l=C.Above):(u=ct.StaveModifier.Position.BELOW,l=C.Below)}let c=new ct.FretHandFinger(o.value);if(c.setPosition(u),c.setOffsetX(h),l===C.Above||l===C.Below){let d=l===C.Above?-1:1,f=l===C.Above?n:s-1-n;if(this.rules.FingeringInsideStafflines&&s>1){let p=c.getWidth()/2,m=s*2.5;c.setOffsetY(d*(f+m)*p)}else if(!this.rules.FingeringInsideStafflines){let p=new ct.StringNumber(o.value);p.radius=0,p.setPosition(u),p.setOffsetY(d*f*p.getWidth()*2/3),i.vfStaveNote.addModifier(n,p);continue}}i.vfStaveNote.addModifier(n,c)}}createStringNumber(t){if(!this.rules.RenderStringNumbersClassical)return;let i=t;t.notes.forEach((s,r)=>{let n=s.sourceNote.StringInstruction;if(n){let a=n.value;switch(a){case"1":a="I";break;case"2":a="II";break;case"3":a="III";break;case"4":a="IV";break;case"5":a="V";break;case"6":a="VI";break;default:}let o=new ct.StringNumber(a);o.radius=0;let l=-this.rules.StringNumberOffsetY;t.notes.length>1||t.parentStaffEntry.graphicalVoiceEntries.length>1?(o.setOffsetX(s.baseStringNumberXOffset*13),o.setPosition(ct.Modifier.Position.RIGHT)):o.setPosition(ct.Modifier.Position.ABOVE),o.setOffsetY(l),i.vfStaveNote.addModifier(r,o)}})}lineTo(t,i,s=0){let r=new ct.StaveConnector(t.getVFStave(),this.stave);r.setType(i),s!==0&&r.setXShift(s),this.connectors.push(r)}getVFStave(){return this.stave}updateInstructionWidth(){let t=0,i=0,s=this.stave.getModifiers();for(let r of s)r.getPosition()===Qs.BEGIN?t+=r.getWidth()+r.getPadding(void 0):r.getPosition()===Qs.END&&(i+=r.getWidth()+r.getPadding(void 0));this.beginInstructionsWidth=(t??0)/10,this.endInstructionsWidth=(i??0)/10}addStaveTie(t,i){this.vfTies.push(t),i.vfTie=t,i.Tie.TieDirection===C.Below&&t.setDirection(1)}},Qs=(function(e){return e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.ABOVE=3]="ABOVE",e[e.BELOW=4]="BELOW",e[e.BEGIN=5]="BEGIN",e[e.END=6]="END",e})({}),Tu=vt.Flow,na=class extends Qi{constructor(e,t=void 0,i=void 0){super(e,t,i),this.minimumStaffEntriesWidth=-1,i?this.rules=i.ParentMusicSystem.rules:t&&(this.rules=t.Rules),this.resetLayout(),this.multiRestElement=new Tu.MultiMeasureRest(t.multipleRestMeasures,{})}draw(e){let t=e.openGroup();t&&(t.classList?.add("vf-measure"),t.classList?.add("multi"),t.id=`${this.MeasureNumber}`),this.stave.setContext(e).draw(),this.multiRestElementSVG=e.openGroup("multirest"),this.multiRestElement.setStave(this.stave),this.multiRestElement.setContext(e),this.multiRestElement.draw(),this.multiRestElement.id=`vf-multi${this.MeasureNumber}`,e.closeGroup(),e.closeGroup();for(let i of this.connectors)i.setContext(e).draw()}format(){for(let e of this.staffEntries){let t=this.PositionAndShape.Size.width-this.beginInstructionsWidth;e.PositionAndShape.RelativePosition.x=this.PositionAndShape.Size.width/2+this.beginInstructionsWidth/3,e.PositionAndShape.RelativePosition.y=0;let i=e.graphicalVoiceEntries[0]?.notes[0]?.PositionAndShape;i.BorderLeft=-t/3,i.BorderRight=t/3,i.BorderTop=1,i.BorderBottom=3,e.PositionAndShape.calculateBoundingBox()}}getVoicesWithinMeasure(){return[]}getGraphicalVoiceEntriesPerVoice(e){return[]}getRestFilledVexFlowStaveNotesPerVoice(e){return[]}handleBeam(e,t){}handleTuplet(e,t){}finalizeBeams(){}finalizeTuplets(){}layoutStaffEntry(e){}graphicalMeasureCreatedCalculations(){}createArticulations(){}createOrnaments(){}createFingerings(e){}getVFStave(){return this.stave}},ts=class extends In{constructor(e,t,i,s=se.NONE,r,n=void 0){if(super(e,t,r,n),this.clef=i,this.octaveShift=s,e.Pitch){let a=e.isRest()?e.Pitch:Us.getPitchFromOctaveShift(e.Pitch,s);this.vfpitch=Ht.pitch(a,e.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0}}setAccidental(e){let t=this.drawPitch(e);this.vfpitch=Ht.pitch(t,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.DrawnAccidental=t.Accidental}drawPitch(e){return Us.getPitchFromOctaveShift(e,this.octaveShift)}Transpose(e,t,i,s){let r=super.Transpose(e,t,i,s),n=Us.getPitchFromOctaveShift(r,this.octaveShift);return this.vfpitch=Ht.pitch(n,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0,n}setIndex(e,t){this.vfnote=[e,t],this.vfnoteIndex=t}notehead(e=void 0){let t=e;t||(t=this.vfnote[0]);let i=t.note_heads;return i&&i.length>this.vfnoteIndex&&i[this.vfnoteIndex]?t.note_heads[this.vfnoteIndex]:{line:0}}Clef(){return this.clef}getSVGId(){if(this.vfnote)return this.vfnote[0].getAttribute("id")}setVisible(e,t={}){let i=t.applyToBeams??!0,s=t.applyToLedgerLines??!0,r=t.applyToNotehead??!0,n=t.applyToSlurs??!0,a=t.applyToStem??!0,o=t.applyToTies??!0,l="visibility",h=e?"visible":"hidden";
7if(r&&this.getSVGGElement()?.setAttribute(l,h),a&&this.getStemSVG()?.setAttribute(l,h),i)for(let u of this.getBeamSVGs())u?.setAttribute(l,h);if(s)for(let u of this.getLedgerLineSVGs())u?.setAttribute(l,h);if(o)for(let u of this.getTieSVGs())u?.setAttribute(l,h);if(n)for(let u of this.getSlurSVGs())u?.setAttribute(l,h)}getSVGGElement(){if(this.vfnote)return this.vfnote[0].getAttribute("el")}getStemSVG(){let e=document.getElementById("vf-"+this.getSVGId()+"-stem");return e?.children.length>0?e.children[0]:e}getBeamSVGs(){let e=[];for(let t=0;;t++){let i=document.getElementById(`vf-${this.getSVGId()}-beam${t}`);if(!i)break;e.push(i)}return e}getLedgerLineSVGs(){let e=[],t=`vf-${this.getSVGId()}ledgers`,i=document.getElementById(t);if(!i)return[];for(let s of i.childNodes)e.push(s);return e}getTieSVGs(){let e=[],t=document.querySelectorAll(`[id='vf-${this.getSVGId()}-tie']`);for(let i of t)e.push(i);return e}getSlurSVGs(){let e=[],t=document.querySelectorAll(`[id='vf-${this.getSVGId()}-slur']`);for(let i of t)e.push(i);return e}getNoteheadSVGs(){let e=this.getVFNoteSVG(),t=[];if(e?.children?.length)for(let i of e.children)i.classList.contains("vf-notehead")&&t.push(i);return t}getFlagSVG(){let e=this.getVFNoteSVG();if(e?.children?.length){for(let t of e.children)if(t.classList.contains("vf-flag"))return t}}getVFNoteSVG(){if(this.parentVoiceEntry.parentStaffEntry.parentMeasure.isMultiRestMeasure())return this.parentVoiceEntry.parentStaffEntry.parentMeasure.multiRestElement;let e=this.getSVGGElement();for(let t of e?.children)if(t.classList.contains("vf-note"))return t}getModifierSVGs(){let e=this.getSVGGElement(),t=[];if(e?.children?.length)for(let i of e?.children)i.classList.contains("vf-modifiers")&&t.push(i);return t}
7setColor(e,t={}){let i=t.applyToBeams??!1,s=t.applyToFlag??!0,r=t.applyToLedgerLines??!1,n=t.applyToLyrics??!1,a=t.applyToModifiers??!0,o=t.applyToNoteheads??!0,l=t.applyToSlurs??!1,h=t.applyToStem??!0,u=t.applyToTies??!1,c=t.applyToMultiRestMeasure??!0,d=t.applyToMultiRestMeasureNumber??!0,f=t.applyToMultiRestMeasureRestBar??!0;if(i){let p=this.getBeamSVGs();for(let m of p)for(let g of m.children)g.setAttribute("fill",e)}if(s){let p=this.getFlagSVG();if(p)for(let m of p.children)m.setAttribute("fill",e)}if(r){let p=this.getLedgerLineSVGs();for(let m of p)m.setAttribute("stroke",e)}if(n){let p=this.getLyricsSVGs();for(let m of p)for(let g of m.children)g.setAttribute("stroke",e),g.setAttribute("fill",e)}if(c&&this.parentVoiceEntry.parentStaffEntry.parentMeasure instanceof na){let p=this.parentVoiceEntry.parentStaffEntry.parentMeasure.multiRestElementSVG;if(p?.children?.length)for(let m of p.children)if(m.children?.length){if(d)for(let g of m.children)g.setAttribute("fill",e)}else f&&m.setAttribute("fill",e)}if(a){let p=this.getModifierSVGs();for(let m of p)for(let g of m.children)g.setAttribute("fill",e)}if(o){let p=this.getNoteheadSVGs();for(let m of p)for(let g of m.children)g.setAttribute("fill",e)}if(l){let p=this.getSlurSVGs();for(let m of p)for(let g of m.children)g.setAttribute("fill",e)}if(h){let p=this.getStemSVG();p&&p.setAttribute("stroke",e)}if(u){let p=this.getTieSVGs();for(let m of p)for(let g of m.children)g.setAttribute("fill",e)}}},aa=class extends Cs{constructor(e,t,i){super(t,e,i.parentSourceMeasure),this.mInstantaneousDynamicExpression=e,this.mMeasure=i}updateSkyBottomLine(){let e=this.parentStaffLine.SkyBottomLineCalculator,t=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginLeft,i=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginRight,s=0;switch(this.Placement){case C.Above:s=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginTop,e.updateSkyLineInRange(t,i,s);break;case C.Below:s=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginBottom,e.updateBottomLineInRange(t,i,s);break;default:W.default.error("Placement for GraphicalInstantaneousDynamicExpression is unknown")}}},Gi=(function(e){return e[e.p=0]="p",e[e.f=1]="f",e[e.s=2]="s",e[e.z=3]="z",e[e.m=4]="m",e[e.r=5]="r",e})({}),Vr,Oi=class Kt extends Pi{static staticConstructor(){Kt.dynamicToRelativeVolumeDict.setValue(Jt.ffffff,127/127),Kt.dynamicToRelativeVolumeDict.setValue(Jt.fffff,126/127),Kt.dynamicToRelativeVolumeDict.setValue(Jt.ffff,125/127),Kt.dynamicToRelativeVolumeDict.setValue(Jt.fff,124/127),Kt.dynamicToRelativeVolumeDict.setValue(Jt.ff,122/127),Kt.dynamicToRelativeVolumeDict.setValue(Jt.f,108/127),Kt.dynamicToRelativeVolumeDict.setValue(Jt.mf,76/127),Kt.dynamicToRelativeVolumeDict.setValue(Jt.sf,.5),Kt.dynamicToRelativeVolumeDict.setValue(Jt.sfp,.5),Kt.dynamicToRelativeVolumeDict.setValue(Jt.sfpp,.5),Kt.dynamicToRelativeVolumeDict.setValue(Jt.fp,.5),Kt.dynamicToRelativeVolumeDict.setValue(Jt.rf,.5),Kt.dynamicToRelativeVolumeDict.setValue(Jt.rfz,.5),Kt.dynamicToRelativeVolumeDict.setValue(Jt.sfz,.5),Kt.dynamicToRelativeVolumeDict.setValue(Jt.sffz,.5),Kt.dynamicToRelativeVolumeDict.setValue(Jt.fz,.5),Kt.dynamicToRelativeVolumeDict.setValue(Jt.mp,60/127),Kt.dynamicToRelativeVolumeDict.setValue(Jt.p,28/127),Kt.dynamicToRelativeVolumeDict.setValue(Jt.pp,12/127),Kt.dynamicToRelativeVolumeDict.setValue(Jt.ppp,10/127),Kt.dynamicToRelativeVolumeDict.setValue(Jt.pppp,7/127),Kt.dynamicToRelativeVolumeDict.setValue(Jt.ppppp,5/127),Kt.dynamicToRelativeVolumeDict.setValue(Jt.pppppp,4/127)}constructor(t,i,s,r,n){super(s),this.parentMeasure=n,this.dynamicEnum=Jt[t.toLowerCase()],this.soundDynamic=i,this.staffNumber=r}get ParentMultiExpression(){return this.multiExpression}set ParentMultiExpression(t){this.multiExpression=t}get DynEnum(){return this.dynamicEnum}set DynEnum(t){this.dynamicEnum=t}get SoundDynamic(){return this.soundDynamic}set SoundDynamic(t){this.soundDynamic=t}get Placement(){return this.placement}set Placement(t){this.placement=t}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t}get Length(){return Math.abs(this.length)<1e-4&&(this.length=this.calculateLength()),this.length}get MidiVolume(){return this.Volume*127}get Volume(){return Kt.dynamicToRelativeVolumeDict.getValue(this.dynamicEnum)}static isInputStringInstantaneousDynamic(t){return t?Kt.isStringInStringList(Kt.listInstantaneousDynamics,t):!1}getDynamicExpressionSymbol(t){switch(t){case"p":return Gi.p;case"f":return Gi.f;case"s":return Gi.s;case"z":return Gi.z;case"m":return Gi.m;case"r":return Gi.r;
7default:throw new io("unknown DynamicExpressionSymbolEnum: "+t)}}calculateLength(){return W.default.debug("[Andrea] instantaneousDynamicExpression: not implemented: calculateLength!"),0}};Vr=Oi,Vr.dynamicToRelativeVolumeDict=new We.Dictionary,Vr.listInstantaneousDynamics=["pppppp","ppppp","pppp","ppp","pp","p","ffffff","fffff","ffff","fff","ff","f","mf","mp","sf","sff","sp","spp","fp","rf","rfz","sfz","sffz","fz"];var Jt=(function(e){return e[e.pppppp=0]="pppppp",e[e.ppppp=1]="ppppp",e[e.pppp=2]="pppp",e[e.ppp=3]="ppp",e[e.pp=4]="pp",e[e.p=5]="p",e[e.mp=6]="mp",e[e.mf=7]="mf",e[e.f=8]="f",e[e.ff=9]="ff",e[e.fff=10]="fff",e[e.ffff=11]="ffff",e[e.fffff=12]="fffff",e[e.ffffff=13]="ffffff",e[e.sf=14]="sf",e[e.sff=15]="sff",e[e.sfp=16]="sfp",e[e.sfpp=17]="sfpp",e[e.fp=18]="fp",e[e.rf=19]="rf",e[e.rfz=20]="rfz",e[e.sfz=21]="sfz",e[e.sffz=22]="sffz",e[e.fz=23]="fz",e[e.other=24]="other",e})({});Oi.staticConstructor();var ol=class extends aa{constructor(e,t,i){super(e,t,i);let s=new Nt(this.Expression);this.label=new pe(s,this.rules.ContinuousDynamicTextHeight,mt.CenterCenter,this.rules,this.PositionAndShape),this.label.Label.fontStyle=Qt.BoldItalic,this.label.setLabelPositionAndShapeBorders(),this.PositionAndShape.calculateBoundingBox()}get InstantaneousDynamic(){return this.mInstantaneousDynamicExpression}get Expression(){return Jt[this.mInstantaneousDynamicExpression.DynEnum]}},Da=vt.Flow,oa=class extends ue{constructor(e,t,i=0){super(),this.Visible=!0,this.PositionAndShape=new Yt(this,e.ParentMusicSystem.PositionAndShape);let s=e.Measures[0],r=t.Measures[0];this.addConnector(s.getVFStave(),r.getVFStave(),Da.StaveConnector.type.BRACKET,i)}draw(e){this.Visible&&this.vexflowConnector.setContext(e).draw();let t=this.vexflowConnector,i=t.top_stave.getYForLine(0),s=t.bottom_stave.getYForLine(t.bottom_stave.getNumLines()-1)+t.thickness;this.PositionAndShape.AbsolutePosition.x=(t.top_stave.getX()-2+t.x_shift)/10,this.PositionAndShape.AbsolutePosition.y=i/10,this.PositionAndShape.Size.height=(s-i)/10,this.PositionAndShape.Size.width=12/10}addConnector(e,t,i,s){this.vexflowConnector=new Da.StaveConnector(e,t).setType(i).setXShift(s*-5)}},Pu=vt.Flow,fn=class extends oa{constructor(e,t,i=0){super(e,t,i),this.vexflowConnector.setType(Pu.StaveConnector.type.BRACE)}},ll=class extends ue{constructor(e,t){super(),this.getOctaveShift=e,this.setSymbol(),this.PositionAndShape=new Yt(this,t)}setSymbol(){switch(this.getOctaveShift.Type){case se.VA8:this.octaveSymbol=Ce.VA8;break;case se.VB8:this.octaveSymbol=Ce.VB8;break;case se.MA15:this.octaveSymbol=Ce.MA15;break;case se.MB15:this.octaveSymbol=Ce.MB15;break;default:throw new gi("")}}},os=vt.Flow,pn=class extends ll{constructor(e,t){switch(super(e,t),e.Type){case se.VA8:this.position=os.TextBracket.Positions.TOP,this.supscript="va",this.text="8";break;case se.MA15:this.position=os.TextBracket.Positions.TOP,this.supscript="ma",this.text="15";break;case se.VB8:this.position=os.TextBracket.Positions.BOTTOM,this.supscript="vb",this.text="8";break;case se.MB15:this.position=os.TextBracket.Positions.BOTTOM,this.supscript="mb",this.text="15";break;default:W.default.error("Unknown or NONE octaveshift. This should not be called!");break}}setStartNote(e){for(let t of e.graphicalVoiceEntries){let i=t;if(i?.vfStaveNote)return this.startNote=i.vfStaveNote,!0}return!1}setEndNote(e){for(let t of e.graphicalVoiceEntries){let i=t;if(i?.vfStaveNote)return this.endNote=i.vfStaveNote,this.endMeasure=e.parentMeasure,this.endMeasure?.parentSourceMeasure.Rules.OctaveShiftOnWholeMeasureNoteUntilEndOfMeasure&&i.notes[0].sourceNote.isWholeMeasureNote()&&(this.graphicalEndAtMeasureEnd=!0),!0}return!1}getTextBracket(){let e=this.endNote,t,i=this;this.graphicalEndAtMeasureEnd&&(t={getAbsoluteX(){return(i.endMeasure.PositionAndShape.AbsolutePosition.x+i.endMeasure.PositionAndShape.Size.width)*10},getGlyph(){return{getWidth(){return 0}}}}),t&&(e=t);let s=new os.TextBracket({position:this.position,start:this.startNote,stop:e,superscript:this.supscript,text:this.text});return this.endsOnDifferentStaffLine&&(s.render_options.show_bracket=!1),s}},Lu=vt.Flow,mn=(function(e){return e[e.NEAR_HEAD=1]="NEAR_HEAD",e[e.NEAR_TOP=2]="NEAR_TOP",e})({}),_u=class hl{constructor(t){this.vfStartNote=void 0,this.vfEndNote=void 0,this.parentSlur=t}static createFromVexflowSlur(t){return new hl(t.parentSlur)}get vfSlur(){return this.parentSlur}curve_Options(){return{cps:[{x:0,y:10},{x:0,y:10}],invert:!1,position:mn.NEAR_TOP,position_end:mn.NEAR_TOP,spacing:2,thickness:2,x_shift:0,y_shift:10}}createVexFlowCurve(){this.vfCurve=new Lu.Curve(this.vfStartNote,this.vfEndNote,void 0)}},la=class extends Nn{constructor(e,t,i){super(e,t,i)}calculateXPosition(){let e=this.parentMeasure.getVFStave(),t=0;for(let i of this.graphicalVoiceEntries)if(i.vfStaveNote){if(i.vfStaveNote.setStave(e),!i.vfStaveNote.preFormatted)continue;i.applyBordersFromVexflow();let s=!1,r=this.PositionAndShape;i.notes[0].sourceNote.isWholeRest()&&!this.hasOnlyRests()&&(s=!0,r=i.PositionAndShape),this.parentMeasure.ParentStaff.isTab?r.RelativePosition.x=(i.vfStaveNote.getAbsoluteX()+i.vfStaveNote.glyph.getWidth())/10:(r.RelativePosition.x=i.vfStaveNote.getBoundingBox().getX()/10,s&&(r.RelativePosition.x-=e.getNoteStartX()/10,r.RelativePosition.x-=1.3));let n=i.notes[0].sourceNote;n.isRest()&&n.Length.RealValue===this.parentMeasure.parentSourceMeasure.ActiveTimeSignature.RealValue&&(r.RelativePosition.x+=this.parentMeasure.parentSourceMeasure.Rules.WholeRestXShiftVexflow-.1,i.PositionAndShape.BorderLeft=-.7,i.PositionAndShape.BorderRight=.7),i.PositionAndShape.BorderLeft<t&&(t=i.PositionAndShape.BorderLeft)}this.PositionAndShape.RelativePosition.x-=t,this.PositionAndShape.calculateBoundingBox()}setMaxAccidentals(){for(let e of this.graphicalVoiceEntries)for(let t of e.notes)if(t.DrawnAccidental!==q.NONE)return this.MaxAccidentals=1;return this.MaxAccidentals=0}setModifierXOffsets(){let e=[];for(let t of this.graphicalVoiceEntries)t.parentVoiceEntry?.IsGrace??!1?this.applyModifierOffsets(t.notes):e.push(...t.notes);this.applyModifierOffsets(e)}applyModifierOffsets(e){if(e.length===0)return;let t=e.map(r=>r.staffLine),i=this.calculateModifierXOffsets(t,.5),s=this.calculateModifierXOffsets(t,1);e.forEach((r,n)=>{r.baseFingeringXOffset=i[n],r.baseStringNumberXOffset=s[n]})}calculateModifierXOffsets(e,t){let i=[];for(let s=0;s<e.length;s++){let r=0,n=!0;for(;n;)for(let a=s;a>=0;a--){if(Math.abs(e[s]-e[a])<=t&&r===i[a]){r++,n=!0;break}n=!1}i.push(r)}return i}},ha=class extends ue{constructor(e){super(),this.parentStaffLine=e;let t=e.PositionAndShape;this.boundingBox=new Yt(this,t),this.boundingBox.BorderRight=6,this.boundingBox.BorderBottom=4.5,this.boundingBox.BorderLeft=-1.5,this.boundingBox.BorderTop=-1.5}},pr=class{constructor(e,t){this.skyLine=e,this.bottomLine=t}},ul=class{constructor(e){this.mStaffLineParent=e,this.mRules=e.ParentMusicSystem.rules}updateLines(e){let t=this.StaffLineParent.Measures;if(e.length!==t.length)if(W.default.warn("SkyBottomLineCalculator: lengths of calculation result array and measure array do not match"),e.length<t.length)for(;e.length<t.length;)e.push(new pr([],[]));else e=e.slice(0,t.length);let i=Math.max(Math.ceil(this.StaffLineParent.PositionAndShape.Size.width*this.SamplingUnit),1);this.mSkyLine=[],this.mBottomLine=[];for(let{skyLine:l,bottomLine:h}of e)this.mSkyLine.push(...l),this.mBottomLine.push(...h);let s=this.mSkyLine.length/i,r=[],n=[];for(let l=0;l<this.mSkyLine.length&&r.length!==i;l+=s){let h=Math.min(this.mSkyLine.length,l+s),u=this.mSkyLine.slice(l,h+1);
7r.push(Math.min(...u)),u=this.mBottomLine.slice(l,h+1),n.push(Math.max(...u))}this.mSkyLine=r,this.mBottomLine=n,this.mSkyLine.length!==i&&W.default.debug(`SkyLine calculation was not correct (${this.mSkyLine.length} instead of ${i})`);let a=Math.max(...this.mSkyLine);this.mSkyLine=this.mSkyLine.map(l=>(l-a)/10+this.StaffLineParent.TopLineOffset);let o=Math.min(...this.mBottomLine);this.mBottomLine=this.mBottomLine.map(l=>(l-o)/10+this.StaffLineParent.BottomLineOffset)}calculateLines(){let e=this.mRules.SamplingUnit,t=[],i=new Pr(this.mRules);for(let s of this.StaffLineParent.Measures){s.PositionAndShape.calculateAbsolutePositionsRecursive(0,0);let r=s.getVFStave(),n=r.getWidth();!(n>0)&&!s.IsExtraGraphicalMeasure&&(W.default.warn("SkyBottomLineCalculator: width not > 0 in measure "+s.MeasureNumber),n=50),i.initializeHeadless(n);let a=i.getContext(),o=i.getCanvas();n=o.width;let l=o.height;r.setY(r.y+100);let h=r.getWidth();r.setWidth(n),s.format(),r.setWidth(h);try{s.draw(a)}catch(p){W.default.warn("SkyBottomLineCalculator.calculateLines.draw",p)}let u=a.getImageData(0,0,n,l),c=Math.max(Math.ceil(s.PositionAndShape.Size.width*e),1),d=Array(c),f=Array(c);for(let p=0;p<n;p++){for(let m=0;m<l;m++){let g=m*n*4+p*4;if(u.data[g+3]>0){d[p]=m;break}}for(let m=l;m>0;m--){let g=m*n*4+p*4;if(u.data[g+3]>0){f[p]=m;break}}}for(let p=0;p<d.length;p++)d[p]===void 0&&(d[p]=Math.max(this.findPreviousValidNumber(p,d),this.findNextValidNumber(p,d)));for(let p=0;p<f.length;p++)f[p]===void 0&&(f[p]=Math.max(this.findPreviousValidNumber(p,f),this.findNextValidNumber(p,f)));t.push(new pr(d,f)),i.clear()}this.updateLines(t)}updateSkyLineWithLine(e,t,i){let s=Math.floor(e.x*this.SamplingUnit),r=Math.ceil(t.x*this.SamplingUnit);for(let n=s+1;n<Math.min(r,this.SkyLine.length);n++)this.SkyLine[n]=i}updateSkyLineWithWedge(e,t){let i=Math.floor(e.x*this.SamplingUnit),s=Math.ceil(t.x*this.SamplingUnit),r=(t.y-e.y)/(t.x-e.x);s-i<=1&&(s++,r=0),i<0&&(i=0),i>=this.BottomLine.length&&(i=this.BottomLine.length-1),s<0&&(s=0),s>=this.BottomLine.length&&(s=this.BottomLine.length),this.SkyLine[i]=e.y;for(let n=i+1;n<Math.min(s,this.SkyLine.length);n++)this.SkyLine[n]=this.SkyLine[n-1]+r/this.SamplingUnit}updateBottomLineWithWedge(e,t){let i=Math.floor(e.x*this.SamplingUnit),s=Math.ceil(t.x*this.SamplingUnit),r=(t.y-e.y)/(t.x-e.x);s-i<=1&&(s++,r=0),i<0&&(i=0),i>=this.BottomLine.length&&(i=this.BottomLine.length-1),s<0&&(s=0),s>=this.BottomLine.length&&(s=this.BottomLine.length),this.BottomLine[i]=e.y;for(let n=i+1;n<s;n++)this.BottomLine[n]=this.BottomLine[n-1]+r/this.SamplingUnit}updateSkyLineInRange(e,t,i){this.updateInRange(this.mSkyLine,e,t,i)}updateBottomLineInRange(e,t,i){this.updateInRange(this.BottomLine,e,t,i)}resetSkyLineInRange(e,t){this.updateInRange(this.SkyLine,e,t)}resetBottomLineInRange(e,t){this.setInRange(this.BottomLine,e,t)}setSkyLineWithValue(e){this.SkyLine.forEach(t=>t=e)}setBottomLineWithValue(e){this.BottomLine.forEach(t=>t=e)}getLeftIndexForPointX(e,t){let i=Math.floor(e*this.SamplingUnit);return i<0?0:i>=t?t-1:i}getRightIndexForPointX(e,t){let i=Math.ceil(e*this.SamplingUnit);return i<0?0:i>=t?t-1:i}updateStaffLineBorders(){this.mStaffLineParent.PositionAndShape.BorderTop=this.getSkyLineMin(),this.mStaffLineParent.PositionAndShape.BorderMarginTop=this.getSkyLineMin(),this.mStaffLineParent.PositionAndShape.BorderBottom=this.getBottomLineMax(),this.mStaffLineParent.PositionAndShape.BorderMarginBottom=this.getBottomLineMax()}getSkyLineMin(){return Math.min(...this.SkyLine.filter(e=>!isNaN(e)))}getSkyLineMinAtPoint(e){let t=Math.round(e*this.SamplingUnit);return this.mSkyLine[t]}getSkyLineMinInRange(e,t){return this.getMinInRange(this.SkyLine,e,t)}getBottomLineMax(){return Math.max(...this.BottomLine.filter(e=>!isNaN(e)))}getBottomLineMaxAtPoint(e){let t=Math.round(e*this.SamplingUnit);return this.mBottomLine[t]}getBottomLineMaxInRange(e,t){return this.getMaxInRange(this.BottomLine,e,t)}getBottomLineMaxInBoundingBox(e){let t=Math.floor(e.AbsolutePosition.x+e.BorderLeft),i=Math.ceil(e.AbsolutePosition.x+e.BorderRight);return this.getMaxInRange(this.mBottomLine,t,i)}updateWithBoundingBoxRecursively(e){if(e.ChildElements&&e.ChildElements.length>0)this.updateWithBoundingBoxRecursively(e);else{let t=e.BorderTop+e.AbsolutePosition.y,i=e.BorderBottom+e.AbsolutePosition.y;if(t<0){let s=Math.floor(e.AbsolutePosition.x+e.BorderLeft),r=Math.ceil(e.AbsolutePosition.x+e.BorderRight);this.updateInRange(this.mSkyLine,s,r,t)}else if(i>this.StaffLineParent.StaffHeight){let s=Math.floor(e.AbsolutePosition.x+e.BorderLeft),r=Math.ceil(e.AbsolutePosition.x+e.BorderRight);this.updateInRange(this.mBottomLine,s,r,i)}}}findPreviousValidNumber(e,t){for(let i=e;i>=0;i--)if(!isNaN(t[i]))return t[i];return 0}findNextValidNumber(e,t){if(e>=t.length)return t[e-1];for(let i=e;i<t.length;i++)if(!isNaN(t[i]))return t[i];return 0}drawPixel(e,t,i="#FF0000FF"){let s=t.getContext(),r=s.fillStyle;s.fillStyle=i,s.fillRect(e.x,e.y,2,2),s.fillStyle=r}updateInRange(e,t=0,i=e.length,s=0){if(t=Math.floor(t*this.SamplingUnit),i=Math.ceil(i*this.SamplingUnit),i<t)throw Error("start index of line is greater than the end index");t<0&&(t=0),i>e.length&&(i=e.length);for(let r=t;r<i;r++)e[r]=Math.abs(s)>Math.abs(e[r])?s:e[r]}setInRange(e,t=0,i=e.length,s=0){if(t=Math.floor(t*this.SamplingUnit),i=Math.ceil(i*this.SamplingUnit),i<t)throw Error("start index of line is greater then the end index");t<0&&(t=0),i>e.length&&(i=e.length);for(let r=t;r<i;r++)e[r]=s}getMinInRange(e,t,i){if(t=Math.floor(t*this.SamplingUnit),i=Math.ceil(i*this.SamplingUnit),!e)return Number.MAX_VALUE;if(t<0&&(t=0),t>=e.length&&(t=e.length-1),i<0&&(i=0),i>=e.length&&(i=e.length),t>=0&&i<=e.length)return Math.min(...e.slice(t,i+1))}getMaxInRange(e,t,i){if(t=Math.floor(t*this.SamplingUnit),i=Math.ceil(i*this.SamplingUnit),!e)return Number.MIN_VALUE;if(t<0&&(t=0),t>=e.length&&(t=e.length-1),i<0&&(i=0),i>=e.length&&(i=e.length),t>=0&&i<=e.length)return Math.max(...e.slice(t,i+1))}get SamplingUnit(){return this.mRules.SamplingUnit}get StaffLineParent(){return this.mStaffLineParent}get SkyLine(){return this.mSkyLine}get BottomLine(){return this.mBottomLine}},cl=class extends ue{constructor(e,t){super(),this.measures=[],this.staffLines=[,,,,,],this.octaveShifts=[],this.lyricLines=[],this.lyricsDashes=[],this.abstractExpressions=[],this.graphicalSlurs=[],this.graphicalGlissandi=[],this.Pedals=[],this.parentMusicSystem=e,this.parentStaff=t,this.boundingBox=new Yt(this,e.PositionAndShape),this.skyBottomLine=new ul(this),this.staffHeight=this.parentMusicSystem.rules.StaffHeight,this.topLineOffset=0,this.bottomLineOffset=4,this.calculateStaffLineOffsets()}calculateStaffLineOffsets(){if(this.ParentStaff.isTab)this.ParentStaff.StafflineCount===5?this.staffHeight=this.bottomLineOffset=this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight*6:this.staffHeight=this.bottomLineOffset=this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight*this.ParentStaff.StafflineCount;else switch(this.ParentStaff.StafflineCount){case 4:this.bottomLineOffset=1;break;case 3:this.topLineOffset=1,this.bottomLineOffset=1;break;case 2:this.topLineOffset=2,this.bottomLineOffset=1;break;case 1:this.topLineOffset=2,this.bottomLineOffset=2;break;default:break}}get Measures(){return this.measures}set Measures(e){this.measures=e}get StaffLines(){return this.staffLines}set StaffLines(e){this.staffLines=e}get NextStaffLine(){let e=this.parentMusicSystem.StaffLines.indexOf(this);return e===this.parentMusicSystem.StaffLines.length?void 0:this.parentMusicSystem.StaffLines[e+1]}get LyricLines(){return this.lyricLines}get AbstractExpressions(){return this.abstractExpressions}set AbstractExpressions(e){this.abstractExpressions=e}set LyricLines(e){this.lyricLines=e}get LyricsDashes(){return this.lyricsDashes}set LyricsDashes(e){this.lyricsDashes=e}
7get ParentMusicSystem(){return this.parentMusicSystem}set ParentMusicSystem(e){this.parentMusicSystem=e}get ParentStaff(){return this.parentStaff}set ParentStaff(e){this.parentStaff=e}get SkyBottomLineCalculator(){return this.skyBottomLine}get SkyLine(){return this.skyBottomLine.SkyLine}get BottomLine(){return this.skyBottomLine.BottomLine}get OctaveShifts(){return this.octaveShifts}set OctaveShifts(e){this.octaveShifts=e}get StaffHeight(){return this.staffHeight}get TopLineOffset(){return this.topLineOffset}get BottomLineOffset(){return this.bottomLineOffset}get GraphicalSlurs(){return this.graphicalSlurs}get GraphicalGlissandi(){return this.graphicalGlissandi}addSlurToStaffline(e){this.graphicalSlurs.push(e)}addGlissandoToStaffline(e){this.graphicalGlissandi.push(e),e.StaffLine=this}addActivitySymbolClickArea(){let e=new ha(this),t=this.PositionAndShape;e.PositionAndShape.RelativePosition=new k(t.RelativePosition.x+t.BorderRight+.5,t.RelativePosition.y+.5),e.PositionAndShape.Parent=this.parentMusicSystem.PositionAndShape}isPartOfMultiStaffInstrument(){return this.parentStaff.ParentInstrument.Staves.length>1}findClosestStaffEntry(e){let t;for(let i=0,s=this.Measures.length;i<s;++i){let r=this.Measures[i];for(let n=0,a=r.staffEntries.length;n<a;++n){let o=r.staffEntries[n];Math.abs(o.PositionAndShape.RelativePosition.x-e+r.PositionAndShape.RelativePosition.x)<5&&(t=o)}}return t}},ua=class extends cl{constructor(e,t){super(e,t),this.slursInVFStaffLine=[],this.alignmentManager=new rl(this)}get SlursInVFStaffLine(){return this.slursInVFStaffLine}addVFSlurToVFStaffline(e){this.slursInVFStaffLine.push(e)}get AlignmentManager(){return this.alignmentManager}},gn=class bn{constructor(t){this.staffPitchListMapping=new We.Dictionary,this.baseLineNote=ut.B,this.baseLineOctave=1,this.rules=t}trackNote(t){if(!(t instanceof ts)||t.Clef().ClefType!==yt.percussion||t.sourceNote.isRest()||this.rules.PercussionOneLineCutoff===0||this.rules.PercussionForceVoicesOneLineCutoff===-1)return;let i=t.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet,s;this.staffPitchListMapping.containsKey(i)||this.staffPitchListMapping.setValue(i,[]),s=this.staffPitchListMapping.getValue(i);let r=t.sourceNote.Pitch;bn.findOrInsert(s,r)}static PitchIndexOf(t,i,s=0){if(s>t.length-1)return-1;for(let r=s;r<t.length;r++){let n=t[r];if(i.OperatorEquals(n))return r}return-1}static findOrInsert(t,i){for(let s=0;s<t.length;s++){let r=t[s];if(i.OperatorEquals(r))return s;if(i.OperatorFundamentalLessThan(r))return t.splice(s,0,i),s}return t.push(i),t.length-1}positionNote(t){let i=t.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet;if(!(t instanceof ts)||t.sourceNote.isRest()||!this.staffPitchListMapping.containsKey(i))return t;let s=this.staffPitchListMapping.getValue(i),r=this.rules.PercussionUseXMLDisplayStep&&t.sourceNote.displayStepUnpitched!==void 0;if(s.length>this.rules.PercussionOneLineCutoff&&!r&&!this.rules.PercussionUseCajon2NoteSystem)return t;let n=t,a=t.sourceNote.Pitch,o=this.baseLineNote,l=this.baseLineOctave;if(this.rules.PercussionUseCajon2NoteSystem?a.FundamentalNote===ut.C&&(o=ut.G,l=1):this.rules.PercussionUseXMLDisplayStep&&t.sourceNote.displayStepUnpitched!==void 0&&(o=t.sourceNote.displayStepUnpitched,l=t.sourceNote.displayOctaveUnpitched+this.rules.PercussionOneLineXMLDisplayStepOctaveOffset),s.length<=this.rules.PercussionForceVoicesOneLineCutoff)n.setAccidental(new Ct(o,l,a.Accidental));else{let h=bn.PitchIndexOf(s,a);if(h>-1){let u=Math.ceil(s.length/2);if(!this.rules.PercussionUseXMLDisplayStep)if(h>=u)switch(l=2,(h-u)%5){case 1:o=ut.E;break;case 2:o=ut.G;break;case 3:o=ut.B;break;case 4:o=ut.D,l=3;break;default:o=ut.C;break}else switch(h%5){case 1:o=ut.F;break;case 2:o=ut.D;break;case 3:o=ut.B,l=0;break;case 4:o=ut.G,l=0;break;default:o=ut.A;break}let c=new Ct(o,l,a.Accidental);n.setAccidental(c);let d=n.parentVoiceEntry.parentVoiceEntry;!this.rules.SetWantedStemDirectionByXml&&d.Notes.length<2&&(c.Octave>this.baseLineOctave||c.FundamentalNote===this.baseLineNote&&c.Octave===this.baseLineOctave?n.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=Rt.Up:n.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=Rt.Down)}}return n}getStafflineUniquePositionCount(t){return this.staffPitchListMapping.containsKey(t)?this.staffPitchListMapping.getValue(t).length:0}},Wi=vt.Flow,dl=class extends Qi{constructor(e,t=void 0,i=void 0){super(e,t,i),this.isTabMeasure=!0}resetLayout(){let e=this.ParentStaff.StafflineCount??6;this.stave=new Wi.TabStave(0,0,0,{space_above_staff_ln:0,space_below_staff_ln:0,num_lines:e}),this.updateInstructionWidth()}graphicalMeasureCreatedCalculations(){for(let t=0,i=this.staffEntries.length;t<i;++t){let s=this.staffEntries[t];for(let r of s.graphicalVoiceEntries)if(r.notes[0].sourceNote.isRest()){let n=Ht.GhostNotes(r.notes[0].sourceNote.Length);r.vfStaveNote=n[0],r.vfGhostNotes=n}else r.vfStaveNote=Ht.CreateTabNote(r)}this.finalizeTuplets();let e=this.getVoicesWithinMeasure();for(let t of e){if(!t)continue;this.vfVoices[t.VoiceId]=new Wi.Voice({beat_value:this.parentSourceMeasure.Duration.Denominator,num_beats:this.parentSourceMeasure.Duration.Numerator,resolution:Wi.RESOLUTION}).setMode(Wi.Voice.Mode.SOFT);let i=this.getRestFilledVexFlowStaveNotesPerVoice(t);for(let s of i){if(s.parentVoiceEntry&&s.parentVoiceEntry.IsGrace&&!s.parentVoiceEntry.GraceAfterMainNote)continue;let r=s;if(s.notes.length===0||!s.notes[0]||!s.notes[0].sourceNote.PrintObject){if(r.vfGhostNotes)for(let n of r.vfGhostNotes)this.vfVoices[t.VoiceId].addTickable(n);else this.vfVoices[t.VoiceId].addTickable(r.vfStaveNote);continue}if(s.parentVoiceEntry&&s.parentVoiceEntry.Arpeggio){let n=s.parentVoiceEntry.Arpeggio;if(s.notes&&s.notes.length>1){let a=Ht.StrokeTypeFromArpeggioType(n.type),o=new Wi.Stroke(a,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&r.vfStaveNote.addStroke(0,o)}else W.default.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn.
8                        voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.`)}if(r.vfGhostNotes)for(let n of r.vfGhostNotes)this.vfVoices[t.VoiceId].addTickable(n);else this.vfVoices[t.VoiceId].addTickable(r.vfStaveNote)}}}addClefAtBegin(e){e.ClefType===yt.TAB&&super.addClefAtBegin(e)}draw(e){super.draw(e);let t=this.parentSourceMeasure;t.multipleRestMeasures&&this.rules.RenderMultipleRestMeasures&&(this.multiRestElement=new Wi.MultiMeasureRest(t.multipleRestMeasures,{}),this.multiRestElement.setStave(this.stave),this.multiRestElement.setContext(e),this.multiRestElement.draw())}},ca=class{constructor(e){this.fontSize=20,this.fontSizeStandard=this.fontSize;let t=document.createElement("canvas");this.context=t.getContext("2d"),this.rules=e}computeTextWidthToHeightRatio(e,t,i,s=void 0,r=this.fontSize){return this.context.font=Ht.font(r,i,t,this.rules,s),this.context.measureText(e).width/r}setFontSize(e=this.fontSizeStandard){return this.fontSize=e,e}},fl=class{constructor(e,t){this.drawableBoundingBoxElement="None",this.skyLineVisible=!1,this.bottomLineVisible=!1,this.phonicScoreMode=Zs.Manual,this.textMeasurer=e,this.splitScreenLineColor=-1,this.drawingParameters=t,this.rules=t.Rules}set Mode(e){this.phonicScoreMode=e}drawSheet(e){if(this.graphicalMusicSheet=e,this.rules=e.ParentMusicSheet.Rules,this.drawSplitScreenLine(),this.drawingParameters.drawCursors)for(let i of e.Cursors){if(!i)continue;let s=new Yt(i);s.AbsolutePosition=i.Start,s.BorderBottom=i.End.y-i.Start.y,s.BorderRight=i.Width/2,s.BorderLeft=-i.Width/2,this.isVisible(s)&&this.drawLineAsVerticalRectangle(i,$t.Cursor)}this.drawingParameters.drawScrollIndicator&&this.drawScrollIndicator();let t=Math.min(this.graphicalMusicSheet.MusicPages.length,this.rules.MaxPageToDrawNumber);for(let i=0;i<t;i++){let s=this.graphicalMusicSheet.MusicPages[i];this.drawPage(s)}}drawLineAsHorizontalRectangle(e,t){let i=new Ze(e.Start.x,e.End.y-e.Width/2,e.End.x-e.Start.x,e.Width);i=this.applyScreenTransformationForRect(i),this.renderRectangle(i,t,e.styleId,e.colorHex)}drawLineAsVerticalRectangle(e,t){let i=e.Start,s=e.Width,r=new Ze(i.x-s/2,i.y,s,e.End.y-i.y);r=this.applyScreenTransformationForRect(r),this.renderRectangle(r,t,e.styleId)}drawLineAsHorizontalRectangleWithOffset(e,t,i){let s=new k(e.Start.x+t.x,e.Start.y+t.y),r=new k(e.End.x+t.x,e.End.y+t.y),n=e.Width,a=new Ze(s.x,r.y-n/2,r.x-s.x,n);a=this.applyScreenTransformationForRect(a),this.renderRectangle(a,i,e.styleId)}drawLineAsVerticalRectangleWithOffset(e,t,i){let s=new k(e.Start.x+t.x,e.Start.y+t.y),r=new k(e.End.x+t.x,e.End.y+t.y),n=e.Width,a=new Ze(s.x,s.y,n,r.y-s.y);a=this.applyScreenTransformationForRect(a),this.renderRectangle(a,i,e.styleId)}drawRectangle(e,t){let i=e.PositionAndShape,s=new Ze(i.AbsolutePosition.x,i.AbsolutePosition.y,i.BorderRight,i.BorderBottom);s=this.applyScreenTransformationForRect(s),this.renderRectangle(s,t,e.style)}calculatePixelDistance(e){throw Error("not implemented")}drawLabel(e,t){if(!this.isVisible(e.PositionAndShape))return;let i=e.Label;if(i.text.trim()==="")return;let s=this.applyScreenTransformation(e.PositionAndShape.AbsolutePosition),r=this.calculatePixelDistance(i.fontHeight),n=this.calculatePixelDistance(e.PositionAndShape.Size.width),a=Math.ceil(n),o=Math.ceil(r*(.2+e.TextLines.length));switch(i.textAlignment){case mt.LeftTop:break;case mt.LeftCenter:s.y-=o/2;break;case mt.LeftBottom:s.y-=o;break;case mt.CenterTop:s.x-=a/2;break;case mt.CenterCenter:s.x-=a/2,s.y-=o/2;break;case mt.CenterBottom:s.x-=a/2,s.y-=o;break;case mt.RightTop:s.x-=a;break;case mt.RightCenter:s.x-=a,s.y-=o/2;break;case mt.RightBottom:s.x-=a,s.y-=o;break;default:throw new gi("")}return this.renderLabel(e,t,a,o,r,s)}applyScreenTransformation(e){throw Error("not implemented")}applyScreenTransformations(e){let t=[];for(let i of e)t.push(this.applyScreenTransformation(i));return t}applyScreenTransformationForRect(e){throw Error("not implemented")}drawSplitScreenLine(){}renderRectangle(e,t,i,s=void 0,r=1){throw Error("not implemented")}drawScrollIndicator(){}drawSelectionStartSymbol(e){}drawSelectionEndSymbol(e){}renderLabel(e,t,i,s,r,n){throw Error("not implemented")}renderSystemToScreen(e,t,i){}drawMeasure(e){throw Error("not implemented")}drawSkyLine(e){}drawBottomLine(e){}drawInstrumentBrace(e,t){}drawGroupBracket(e,t){}isVisible(e){return!0}
8drawMusicSystem(e){let t=this.getSystemAbsBoundingRect(e),i=this.getSytemBoundingBoxInPixels(t);this.drawMusicSystemComponents(e,i,t)}getSytemBoundingBoxInPixels(e){let t=this.applyScreenTransformationForRect(e);return t.x=Math.round(t.x),t.y=Math.round(t.y),t}getSystemAbsBoundingRect(e){let t=e.PositionAndShape.BoundingRectangle;return new Ze(e.PositionAndShape.AbsolutePosition.x+e.PositionAndShape.BorderLeft-1,e.PositionAndShape.AbsolutePosition.y+e.PositionAndShape.BorderTop-1,t.width+6,t.height+2)}drawMusicSystemComponents(e,t,i){let s=this.graphicalMusicSheet.SelectionStartSymbol,r=this.graphicalMusicSheet.SelectionEndSymbol;this.drawingParameters.drawSelectionStartSymbol&&s!==void 0&&this.isVisible(s.PositionAndShape)&&this.drawSelectionStartSymbol(s),this.drawingParameters.drawSelectionEndSymbol&&r!==void 0&&this.isVisible(r.PositionAndShape)&&this.drawSelectionEndSymbol(r);for(let o of e.StaffLines)this.drawStaffLine(o),this.rules.RenderLyrics&&(o.LyricsDashes.length>0&&this.drawDashes(o.LyricsDashes),o.LyricLines.length>0&&this.drawLyricLines(o.LyricLines,o));for(let o of e.SystemLines)this.drawSystemLineObject(o);if(this.rules.RenderSystemLabelsAfterFirstPage||e.Parent===e.Parent.Parent.MusicPages[0])for(let o of e.Labels)o.SVGNode=this.drawLabel(o,$t.Notes);let n=this.graphicalMusicSheet.ParentMusicSheet.Instruments,a=n.filter(o=>o.isVisible()).length;for(let o of e.InstrumentBrackets)this.drawInstrumentBrace(o,e);if(n.length>0)if(a>1)for(let o of e.GroupBrackets)this.drawGroupBracket(o,e);else for(let o of e.GroupBrackets)o.Visible=!1;if(!this.leadSheet)for(let o of e.MeasureNumberLabels)o.SVGNode=this.drawLabel(o,$t.Notes),o.SVGNode?.classList?.add("measure-number");for(let o of e.StaffLines)this.drawStaffLineSymbols(o);this.drawingParameters.drawMarkedAreas&&this.drawMarkedAreas(e),this.drawingParameters.drawComments&&this.drawComment(e)}activateSystemRendering(e,t,i,s){return!0}drawSystemLineObject(e){}drawStaffLine(e){for(let t of e.Measures)this.drawMeasure(t);this.rules.RenderLyrics&&e.LyricsDashes.length>0&&this.drawDashes(e.LyricsDashes),this.drawOctaveShifts(e),this.drawPedals(e),this.drawExpressions(e),this.skyLineVisible&&this.drawSkyLine(e),this.bottomLineVisible&&this.drawBottomLine(e)}drawLyricLines(e,t){t.LyricLines.forEach(i=>{i.Start.y+=t.PositionAndShape.AbsolutePosition.y,i.End.y+=t.PositionAndShape.AbsolutePosition.y,i.Start.x+=t.PositionAndShape.AbsolutePosition.x,i.End.x+=t.PositionAndShape.AbsolutePosition.x,this.drawGraphicalLine(i,this.rules.LyricUnderscoreLineWidth,i.colorHex)})}drawExpressions(e){}drawGraphicalLine(e,t,i="black"){return this.drawLine(e.Start,e.End,i,t)}drawLine(e,t,i="#FF0000FF",s){}drawDashes(e){e.forEach(t=>{t.SVGNode=this.drawLabel(t,$t.Notes),t.SVGNode?.classList.add("dash")})}drawOctaveShifts(e){}drawStaffLines(e){if(e.StaffLines){let t=e.PositionAndShape.AbsolutePosition;for(let i=0;i<5;i++)this.drawLineAsHorizontalRectangleWithOffset(e.StaffLines[i],t,$t.Notes)}}drawInstantaneousDynamic(e){throw Error("not implemented")}drawContinuousDynamic(e){throw Error("not implemented")}drawSymbol(e,t,i,s=1,r=$t.Notes){}get leadSheet(){return this.graphicalMusicSheet.LeadSheet}set leadSheet(e){this.graphicalMusicSheet.LeadSheet=e}drawPage(e){if(this.isVisible(e.PositionAndShape)){for(let t of e.MusicSystems)this.isVisible(t.PositionAndShape)&&this.drawMusicSystem(t);if(e===e.Parent.MusicPages[0])for(let t of e.Labels)t.SVGNode=this.drawLabel(t,$t.Notes);this.drawableBoundingBoxElement&&this.drawBoundingBoxes(e.PositionAndShape,0,this.drawableBoundingBoxElement)}}drawBoundingBoxes(e,t=0,i="all",s=!1){let r=e.DataObject.constructor.name,n=!1;if(i==="all"?n=!0:i==="VexFlowStaffEntry"?n=e.DataObject instanceof la:i==="VexFlowMeasure"?n=e.DataObject instanceof Qi:i==="VexFlowGraphicalNote"?n=e.DataObject instanceof ts:i==="VexFlowVoiceEntry"?n=e.DataObject instanceof Lr:i==="GraphicalLabel"?n=e.DataObject instanceof pe:i==="VexFlowStaffLine"?n=e.DataObject instanceof ua:i==="SystemLine"?n=e.DataObject instanceof sa:i==="StaffLineActivitySymbol"?n=e.DataObject instanceof ha:i==="VexFlowContinuousDynamicExpression"&&(n=e.DataObject instanceof Tr),n||r===i){let a;s&&(a=r),this.drawBoundingBox(e,void 0,!0,a,t)}
8t++,e.ChildElements.forEach(a=>this.drawBoundingBoxes(a,t,i))}drawBoundingBox(e,t=void 0,i=!1,s=void 0,r=0){let n=new Ze(e.AbsolutePosition.x+e.BorderMarginLeft,e.AbsolutePosition.y+e.BorderMarginTop,e.BorderMarginRight-e.BorderMarginLeft,e.BorderMarginBottom-e.BorderMarginTop);i&&(this.drawLineAsHorizontalRectangle(new Ae(new k(e.AbsolutePosition.x-1,e.AbsolutePosition.y),new k(e.AbsolutePosition.x+1,e.AbsolutePosition.y),.1,At.BaseWritingColor,t),r-1),this.drawLineAsVerticalRectangle(new Ae(new k(e.AbsolutePosition.x,e.AbsolutePosition.y-1),new k(e.AbsolutePosition.x,e.AbsolutePosition.y+1),.1,At.BaseWritingColor,t),r-1)),n=this.applyScreenTransformationForRect(n);let a=this.renderRectangle(n,$t.Background,r,t,.5);if(s){let o=new pe(new Nt(s),.8,mt.CenterCenter,this.rules);o.setLabelPositionAndShapeBorders(),this.renderLabel(o,r,n.width,n.height,n.height,new k(n.x,n.y+12))}return a}drawMarkedAreas(e){for(let t of e.GraphicalMarkedAreas)t&&(t.systemRectangle&&this.drawRectangle(t.systemRectangle,$t.Background),t.settings&&(t.settings.SVGNode=this.drawLabel(t.settings,$t.Comment)),t.labelRectangle&&this.drawRectangle(t.labelRectangle,$t.Background),t.label&&(t.label.SVGNode=this.drawLabel(t.label,$t.Comment)))}drawComment(e){for(let t of e.GraphicalComments)t&&(t.settings&&(t.settings.SVGNode=this.drawLabel(t.settings,$t.Comment)),t.label&&(t.label.SVGNode=this.drawLabel(t.label,$t.Comment)))}drawStaffLineSymbols(e){let t=e.ParentStaff.ParentInstrument,i=e.PositionAndShape.AbsolutePosition.x,s=e.PositionAndShape.AbsolutePosition.y+2,r=e.PositionAndShape.BorderRight;t.highlight&&this.drawingParameters.drawHighlights&&this.drawLineAsHorizontalRectangle(new Ae(new k(i,s),new k(i+r,s),4,At.Highlighted),$t.Highlight);let n=$s.Disabled,a=Ce.PLAY,o=this.drawingParameters.drawActivitySymbols;switch(this.phonicScoreMode){case Zs.Midi:a=Ce.PLAY,this.midiPlaybackAvailable&&e.ParentStaff.audible&&(n=$s.PlaybackSymbols);break;case Zs.Following:a=Ce.MIC,e.ParentStaff.following&&(n=$s.FollowSymbols);break;default:o=!1;break}if(o){let l=new k(i+r+2,s);this.drawSymbol(a,n,l)}if(this.drawingParameters.drawErrors)for(let l of e.Measures){let h=l.PositionAndShape,u=h.AbsolutePosition.x,c=h.AbsolutePosition.y+2;l.hasError&&this.graphicalMusicSheet.ParentMusicSheet.DrawErroneousMeasures&&this.drawLineAsHorizontalRectangle(new Ae(new k(u,c),new k(u+h.BorderRight,c),4,At.ErrorUnderlay),$t.MeasureError)}}},mr=class{constructor(e=Ve.default,t){this.drawCursors=!0,this.drawTitle=!0,this.drawSubtitle=!0,this.drawLyricist=!0,this.drawComposer=!0,this.drawCopyright=!1,this.drawCredits=!0,this.drawPartNames=!0,this.fingeringPosition=C.Left,this.drawHiddenNotes=!1,this.rules=t,this.rules||(this.rules=new Li),this.DrawingParametersEnum=e}set DrawingParametersEnum(e){switch(this.drawingParametersEnum=e,e){case Ve.allon:this.setForAllOn();break;case Ve.thumbnail:this.setForThumbnail();break;case Ve.leadsheet:this.setForLeadsheet();break;case Ve.compact:this.setForCompactMode();break;case Ve.compacttight:this.setForCompactTightMode();break;case Ve.default:default:this.setForDefault()}}get DrawingParametersEnum(){return this.drawingParametersEnum}setForAllOn(){this.drawHighlights=!0,this.drawErrors=!0,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!0,this.drawScrollIndicator=!0,this.drawComments=!0,this.drawMarkedAreas=!0,this.DrawTitle=!0,this.DrawSubtitle=!0,this.DrawComposer=!0,this.DrawLyricist=!0,this.drawCredits=!0,this.DrawPartNames=!0,this.drawHiddenNotes=!0,this.rules.CompactMode=!1}setForDefault(){this.rules.loadDefaultValues(),this.setForAllOn(),this.drawHiddenNotes=!1}setForThumbnail(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!1,this.drawSelectionStartSymbol=!1,this.drawCursors=!1,this.drawActivitySymbols=!1,this.drawScrollIndicator=!1,this.drawComments=!0,this.drawMarkedAreas=!0,this.drawHiddenNotes=!1}setForCompactMode(){this.rules.CompactMode=!0,this.DrawCredits=!1,this.drawHiddenNotes=!1}setForCompactTightMode(){this.setForCompactMode(),this.DrawPartNames=!1,this.rules.VoiceSpacingMultiplierVexflow=.65,this.rules.VoiceSpacingAddendVexflow=2,this.rules.MinSkyBottomDistBetweenStaves=1,this.rules.MinSkyBottomDistBetweenSystems=1,this.rules.BetweenStaffDistance=2.5,this.rules.StaffDistance=3.5,this.rules.MinimumDistanceBetweenSystems=1,this.rules.PageBottomMargin=0,this.rules.PageLeftMargin=2,this.rules.PageRightMargin=2}setForLeadsheet(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!1,this.drawScrollIndicator=!0,this.drawComments=!0,this.drawMarkedAreas=!0}get DrawCredits(){return this.drawCredits}set DrawCredits(e){this.drawCredits=e,this.DrawComposer=e,this.DrawTitle=e,this.DrawSubtitle=e,this.DrawLyricist=e,this.DrawCopyright=e}get DrawTitle(){return this.drawTitle}set DrawTitle(e){this.drawTitle=e,this.rules.RenderTitle=e,e||(this.DrawSubtitle=!1)}get DrawSubtitle(){return this.drawSubtitle}set DrawSubtitle(e){this.drawSubtitle=e,this.rules.RenderSubtitle=e,e&&(this.DrawTitle=!0)}get DrawComposer(){return this.drawComposer}set DrawComposer(e){this.drawComposer=e,this.rules.RenderComposer=e}get DrawLyricist(){return this.drawLyricist}set DrawLyricist(e){this.drawLyricist=e,this.rules.RenderLyricist=e}get DrawCopyright(){return this.drawCopyright}set DrawCopyright(e){this.drawCopyright=e,this.rules.RenderCopyright=e}get DrawPartNames(){return this.drawPartNames}set DrawPartNames(e){this.drawPartNames=e,this.rules.RenderPartNames=e,this.rules.RenderPartNames||(this.rules.RenderPartAbbreviations=!1)}get FingeringPosition(){return this.fingeringPosition}set FingeringPosition(e){this.fingeringPosition=e,this.rules.FingeringPosition=e}get Rules(){return this.rules}set Rules(e){this.rules=e}},Au=vt.Flow;var pl=class extends fl{constructor(e=new mr){super(new ca(e.Rules),e),this.backends=[],this.zoom=1,this.pageIdx=0}get Backends(){return this.backends}drawSheet(e){this.rules.DefaultVexFlowNoteFont==="gonville"&&(vt.Flow.DEFAULT_FONT_STACK=[vt.Flow.Fonts?.Gonville,vt.Flow.Fonts?.Bravura,vt.Flow.Fonts?.Custom]),vt.Flow.STAVE_LINE_THICKNESS=this.rules.StaffLineWidth*10,vt.Flow.STEM_WIDTH=this.rules.StemWidth*10,vt.Flow.DEFAULT_NOTATION_FONT_SCALE=this.rules.VexFlowDefaultNotationFontScale,vt.Flow.DEFAULT_TAB_FONT_SCALE=this.rules.VexFlowDefaultTabFontScale,this.pageIdx=0;for(let t of e.MusicPages){if(t.PageNumber>this.rules.MaxPageToDrawNumber)break;let i=this.backends[this.pageIdx];i.graphicalMusicPage=t,i.scale(this.zoom),this.pageIdx+=1}this.pageIdx=0,this.backend=this.backends[0],super.drawSheet(e)}drawPage(e){e&&(this.backend=this.backends[e.PageNumber-1],super.drawPage(e),this.pageIdx+=1)}clear(){for(let e of this.backends)e.clear()}async drawSheetAsync(e,t){let{yieldToMain:i}=await Promise.resolve().then(()=>(Ji(),qi));this.rules.DefaultVexFlowNoteFont==="gonville"&&(vt.Flow.DEFAULT_FONT_STACK=[vt.Flow.Fonts?.Gonville,vt.Flow.Fonts?.Bravura,vt.Flow.Fonts?.Custom]),vt.Flow.STAVE_LINE_THICKNESS=this.rules.StaffLineWidth*10,vt.Flow.STEM_WIDTH=this.rules.StemWidth*10,vt.Flow.DEFAULT_NOTATION_FONT_SCALE=this.rules.VexFlowDefaultNotationFontScale,vt.Flow.DEFAULT_TAB_FONT_SCALE=this.rules.VexFlowDefaultTabFontScale,this.graphicalMusicSheet=e,this.rules=e.ParentMusicSheet.Rules,this.pageIdx=0;for(let a of e.MusicPages){if(a.PageNumber>this.rules.MaxPageToDrawNumber)break;let o=this.backends[this.pageIdx];o.graphicalMusicPage=a,o.scale(this.zoom),this.pageIdx+=1}let s=0,r=0,n=Math.min(e.MusicPages.length,this.rules.MaxPageToDrawNumber);for(let a=0;a<n;a++)s+=e.MusicPages[a].MusicSystems.length;this.pageIdx=0;for(let a=0;a<n;a++){let o=e.MusicPages[a];if(this.backend=this.backends[o.PageNumber-1],!this.isVisible(o.PositionAndShape)){this.pageIdx++;continue}for(let l of o.MusicSystems)t?.(r,s),await i(),this.isVisible(l.PositionAndShape)&&this.drawMusicSystem(l),r++;if(o===o.Parent.MusicPages[0])for(let l of o.Labels)l.SVGNode=this.drawLabel(l,$t.Notes);this.pageIdx++}if(t?.(s,s),this.drawSplitScreenLine(),this.drawingParameters.drawCursors)for(let a of e.Cursors){if(!a)continue;let o=new Yt(a);
8o.AbsolutePosition=a.Start,o.BorderBottom=a.End.y-a.Start.y,o.BorderRight=a.Width/2,o.BorderLeft=-a.Width/2,this.isVisible(o)&&this.drawLineAsVerticalRectangle(a,$t.Cursor)}this.drawingParameters.drawScrollIndicator&&this.drawScrollIndicator()}setZoom(e){this.zoom=e}calculatePixelDistance(e){return e*10}drawStaffLine(e){let t=this.backend.getContext(),i=t.openGroup();i&&(i.classList.add("staffline"),e.ParentStaff&&(i.id=`${e.ParentStaff.ParentInstrument?.Name}${e.ParentStaff.ParentInstrument?.Id}-${e.ParentStaff?.Id}`)),super.drawStaffLine(e);let s=e.PositionAndShape.AbsolutePosition;this.rules.RenderSlurs&&this.drawSlurs(e,s),this.rules.RenderGlissandi&&(console.log("RenderGlissandi enabled, count:",e.GraphicalGlissandi?.length??0),this.drawGlissandi(e,s)),t.closeGroup()}drawSlurs(e,t){for(let i of e.GraphicalSlurs)i.slur.isCrossed()||this.drawSlur(i,t)}drawGlissandi(e,t){for(let i of e.GraphicalGlissandi)this.drawGlissando(i,t)}drawGlissandoWavyLine(e,t,i,s,r){let n=s-t,a=r-i,o=Math.sqrt(n*n+a*a),l=Math.max(1,Math.floor(o/10));e.save();for(let h=0;h<l;h++){let u=(h+.5)/l,c=t+n*u,d=i+a*u;e.save(),e.openGroup?.("glissando-glyph");let f=e;f.state&&(f.state.scale={x:1,y:1}),Au.Glyph.renderGlyph(e,c-4,d,38,"va3"),e.closeGroup?.(),e.restore()}e.restore()}drawGlissando(e,t){e.StaffLine.ParentStaff.isTab||e.calculateLine(this.rules);let i=this.backend.getContext();if(e.Line){let s=new k(e.Line.Start.x+t.x,e.Line.Start.y),r=new k(e.Line.End.x+t.x,e.Line.End.y),n=this.applyScreenTransformation(s),a=this.applyScreenTransformation(r);this.drawGlissandoWavyLine(i,n.x,n.y,a.x,a.y)}else{let s=e.vfTie;if(s){let r=s.notes;if(r&&(r.first_note||r.last_note)){s.setContext(i);let n=r.first_note,a=r.last_note,o,l,h,u;if(n){let c=r.first_indices?.[0]??0;o=n.getAbsoluteX()+n.getWidth(),l=n.getYForTopText?.(c)??n.getStave()?.getYForLine(0)??0;let d=n.getYs?.();d&&d[c]!==void 0&&(l=d[c])}if(a){let c=r.last_indices?.[0]??0;h=a.getAbsoluteX(),u=a.getYForTopText?.(c)??a.getStave()?.getYForLine(0)??0;let d=a.getYs?.();d&&d[c]!==void 0&&(u=d[c])}o!==void 0&&h!==void 0?this.drawGlissandoWavyLine(i,o,l,h,u):s.draw()}else s.setContext(i),s.draw()}}}drawSlur(e,t){let i=[],s=new k(e.bezierStartPt.x+t.x,e.bezierStartPt.y+t.y),r=new k(e.bezierStartControlPt.x+t.x,e.bezierStartControlPt.y+t.y),n=new k(e.bezierEndControlPt.x+t.x,e.bezierEndControlPt.y+t.y),a=new k(e.bezierEndPt.x+t.x,e.bezierEndPt.y+t.y);i.push(this.applyScreenTransformation(s)),i.push(this.applyScreenTransformation(r)),i.push(this.applyScreenTransformation(n)),i.push(this.applyScreenTransformation(a)),e.placement===C.Above?(s.y-=.05,r.y-=.3,n.y-=.3,a.y-=.05):(s.y+=.05,r.y+=.3,n.y+=.3,a.y+=.05),i.push(this.applyScreenTransformation(s)),i.push(this.applyScreenTransformation(r)),i.push(this.applyScreenTransformation(n)),i.push(this.applyScreenTransformation(a));let o=this.rules.GNote(e.slur.StartNote);e.SVGElement=this.backend.renderCurve(i,!0,o)}drawMeasure(e){e.setAbsoluteCoordinates(e.PositionAndShape.AbsolutePosition.x*10,e.PositionAndShape.AbsolutePosition.y*10);try{e.draw(this.backend.getContext())}catch(i){W.default.warn("VexFlowMusicSheetDrawer.drawMeasure",i)}let t=0;for(let i of e.staffEntries)this.drawStaffEntry(i),t=this.drawBuzzRolls(i,t)}drawBuzzRolls(e,t){for(let i of e.graphicalVoiceEntries)for(let s of i.notes)if(s.sourceNote.TremoloInfo?.tremoloUnmeasured){let r=this.rules.TremoloBuzzRollThickness,n=.9,a=.5,o=s,l,h,u=o.vfnote[0].getStemDirection(),c;if(this.backend instanceof dr&&(c=o.getStemSVG()),c?.getBbox!==void 0){let S=c.getBBox();l=new k(S.x/10,S.y/10),h=S.height/10}else h=o.vfnote[0].getStemLength()/10,l=new k(o.vfnote[0].getStem().x_begin/10,o.vfnote[0].getStem().y_top/10),u===1&&(l.y-=h);let d=l.y+h/3;o.vfnote[0].getBeamCount()>1&&(d=l.y+h/2,u===-1&&(d-=a+.2));let f=l.x-.5,p=d,m=[],g=[new k(0,-r),new k(n-r,0),new k(-n+r,-a),new k(0,-r),new k(n,0),new k(0,r),new k(-n+r,0),new k(n-r,a),new k(0,r),new k(-n,0)],b=new k(f,p);m.push(b);for(let S of g)b=m.last(),m.push(new k(b.x+S.x,b.y-S.y));this.DrawPath(m,o.ParentMusicPage,!0,`buzzRoll${t}`),t++}return t}drawLine(e,t,i="#000000FF",s=.2){return e=this.applyScreenTransformation(e),t=this.applyScreenTransformation(t),this.backend.renderLine(e,t,i,s*10)}DrawOverlayLine(e,t,i,s="#FF0000FF",r=.2,n){if(!i.PageNumber||i.PageNumber>this.backends.length||i.PageNumber<1){console.log("VexFlowMusicSheetDrawer.drawOverlayLine: invalid page number / music page number doesn't correspond to an existing backend.");return}let a=i.PageNumber-1,o=this.backends[a];return e=this.applyScreenTransformation(e),t=this.applyScreenTransformation(t),n||(n=`overlayLine ${e.x}/${e.y}`),o.renderLine(e,t,s,r*10,n)}DrawPath(e,t,i=!0,s){let r=t.PageNumber-1,n=this.backends[r],a=[];for(let o of e)a.push(this.applyScreenTransformation(o));return n.renderPath(a,i,s)}drawSkyLine(e){let t=e.PositionAndShape.AbsolutePosition,i=e.PositionAndShape.Size.width;this.drawSampledLine(e.SkyLine,t,i)}drawBottomLine(e){let t=new k(e.PositionAndShape.AbsolutePosition.x,e.PositionAndShape.AbsolutePosition.y),i=e.PositionAndShape.Size.width;this.drawSampledLine(e.BottomLine,t,i,"#0000FFFF")}drawSampledLine(e,t,i,s="#FF0000FF"){let r=[],n=0;for(let o=0;o<e.length;o++)e[o]!==n&&(r.push(o),n=e[o]);let a=t;if(r.length>0){let o=this.rules.SamplingUnit,l=new k(a.x,a.y),h=new k(r[0]/o+a.x,a.y);this.drawLine(l,h,s);let u,c;e[0]>=0&&(u=new k(r[0]/o+a.x,a.y),c=new k(r[0]/o+a.x,a.y+e[r[0]]),this.drawLine(u,c,s));for(let d=1;d<r.length;d++)l=new k(r[d-1]/o+a.x,a.y+e[r[d-1]]),h=new k(r[d]/o+a.x,a.y+e[r[d-1]]),this.drawLine(l,h,s),u=new k(r[d]/o+a.x,a.y+e[r[d-1]]),c=new k(r[d]/o+a.x,a.y+e[r[d]]),this.drawLine(u,c,s);r[r.length-1]<e.length?(l=new k(r[r.length-1]/o+a.x,a.y+e[r[r.length-1]]),h=new k(a.x+i,a.y+e[r[r.length-1]]),this.drawLine(l,h,s)):(l=new k(r[r.length-1]/o+a.x,a.y),h=new k(a.x+i,a.y),this.drawLine(l,h,s))}else{let o=new k(a.x,a.y),l=new k(a.x+i,a.y);this.drawLine(o,l,s)}}drawStaffEntry(e){if(e.FingeringEntries.length>0)for(let t of e.FingeringEntries)t.SVGNode=this.drawLabel(t,$t.Notes);if(e.graphicalChordContainers!==void 0&&e.graphicalChordContainers.length>
80)for(let t of e.graphicalChordContainers){let i=t.GraphicalLabel;i.SVGNode=this.drawLabel(i,$t.Notes)}this.rules.RenderLyrics&&e.LyricsEntries.length>0&&this.drawLyrics(e.LyricsEntries,$t.Notes)}drawLyrics(e,t){e.forEach(i=>{let s=i.GraphicalLabel;s.Label.colorDefault=this.rules.DefaultColorLyrics,s.SVGNode=this.drawLabel(s,t),s.SVGNode?.classList.add("lyrics")})}drawInstrumentBrace(e,t){let i=this.backend.getContext();i.openGroup("brace"),e.draw(i),i.closeGroup()}drawGroupBracket(e,t){let i=this.backend.getContext();i.openGroup("bracket"),e.draw(i),i.closeGroup()}drawOctaveShifts(e){for(let t of e.OctaveShifts)if(t){let i=t,s=this.backend.getContext(),r=i.getTextBracket();this.rules.DefaultColorMusic&&(r.render_options.color=this.rules.DefaultColorMusic),r.setContext(s);try{r.draw()}catch(n){W.default.warn(n)}}}drawPedals(e){for(let t of e.Pedals)if(t){let i=t,s=this.backend.getContext(),r=i.getPedalMarking();r.render_options.color=this.rules.DefaultColorMusic,r.setContext(s),r.draw()}}drawExpressions(e){for(let t of e.AbstractExpressions)if(t instanceof aa)this.drawInstantaneousDynamic(t);else if(t instanceof Yi){if(t.SourceExpression.parentMeasure?.MeasureNumber<=1&&!this.rules.RenderFirstTempoExpression)continue;let i=t.GraphicalLabel;i.SVGNode=this.drawLabel(i,$t.Notes)}else if(t instanceof Es)this.drawContinuousDynamic(t);else if(t instanceof wo){let i=t.Label;i.SVGNode=this.drawLabel(i,$t.Notes)}else W.default.warn("Unkown type of expression!")}drawInstantaneousDynamic(e){let t=e.Label;t.SVGNode=this.drawLabel(t,$t.Notes)}drawContinuousDynamic(e){if(e.IsVerbal){let t=e.Label;t.SVGNode=this.drawLabel(t,$t.Notes)}else for(let t of e.Lines){let i=new k(e.ParentStaffLine.PositionAndShape.AbsolutePosition.x+t.Start.x,e.ParentStaffLine.PositionAndShape.AbsolutePosition.y+t.Start.y),s=new k(e.ParentStaffLine.PositionAndShape.AbsolutePosition.x+t.End.x,e.ParentStaffLine.PositionAndShape.AbsolutePosition.y+t.End.y);t.SVGElement=this.drawLine(i,s,t.colorHex??"#000000",t.Width)}}renderLabel(e,t,i,s,r,n){if(!e.Label.print)return;let a=e.Label.fontHeight*10,{font:o}=e.Label,l;this.rules.ColoringEnabled&&(l=e.Label.colorDefault,e.ColorXML&&(l=e.ColorXML),l||(l=this.rules.DefaultColorLabel));let{fontStyle:h,fontFamily:u}=e.Label;h||(h=this.rules.DefaultFontStyle),u||(u=this.rules.DefaultFontFamily);let c;for(let d=0;d<e.TextLines?.length;d++){let f=e.TextLines[d],p=this.calculatePixelDistance(f.xOffset),m=new k(n.x+p,n.y),g=this.backend.renderText(a,h,o,f.text,r,m,l,e.Label.fontFamily);c?c.appendChild(g):c=g,n.y+=r,e.TextLines.length>1&&(n.y+=this.rules.SpacingBetweenTextLines)}return c}renderRectangle(e,t,i,s,r){return this.backend.renderRectangle(e,i,s,r)}applyScreenTransformation(e){return new k(e.x*10,e.y*10)}applyScreenTransformationForRect(e){return new Ze(e.x*10,e.y*10,e.width*10,e.height*10)}},ml=class{constructor(e,t=Ge.ARPEGGIO_DIRECTIONLESS){this.parentVoiceEntry=e,this.type=t,this.notes=[]}addNote(e){this.notes.push(e),e.Arpeggio=this}},Ge=(function(e){return e[e.BRUSH_DOWN=1]="BRUSH_DOWN",e[e.BRUSH_UP=1+e.BRUSH_DOWN]="BRUSH_UP",e[e.ROLL_DOWN=1+e.BRUSH_UP]="ROLL_DOWN",e[e.ROLL_UP=1+e.ROLL_DOWN]="ROLL_UP",e[e.RASQUEDO_DOWN=1+e.ROLL_UP]="RASQUEDO_DOWN",e[e.RASQUEDO_UP=1+e.RASQUEDO_DOWN]="RASQUEDO_UP",e[e.ARPEGGIO_DIRECTIONLESS=1+e.RASQUEDO_UP]="ARPEGGIO_DIRECTIONLESS",e})({}),Gr,ot=vt.Flow,Ht=class Ye{static durations(t,i){let s=[],r=t.clone();for(;r.RealValue>1e-4;){let n=r.RealValue;if(n>=2)s.push("1/2"),r.Sub(new N(2,1));else if(n>=1)s.push("w"),r.Sub(new N(1,1));else if(n<1&&n>=.5){if(i&&n>.5)return["w"];s.push("h"),r.Sub(new N(1,2))}else if(n<.5&&n>=.25){if(i&&n>.25)return["h"];s.push("q"),r.Sub(new N(1,4))}else if(n<.25&&n>=.125){if(i&&n>.125)return["q"];s.push("8"),r.Sub(new N(1,8))}else if(n<.125&&n>=.0625){if(i&&n>.0625)return["8"];s.push("16"),r.Sub(new N(1,16))}else if(n<.0625&&n>=.03125){if(i&&n>.03125)return["16"];s.push("32"),r.Sub(new N(1,32))}else if(n<.03125&&n>=.015625){if(i&&n>.015625)return["32"];s.push("64"),r.Sub(new N(1,64))}else{if(i)return["64"];s.push("128"),r.Sub(new N(1,128))}}return s}static pitch(t,i,s,r=void 0,n=void 0){let a=n;n===void 0&&(a=3),i&&n===void 0&&(a=0,s.ClefType===yt.F&&(a=2),s.ClefType===yt.C&&(a=2));let o=ut[t.FundamentalNote].toLowerCase(),l=Ct.accidentalVexflow(t.Accidental),h=t.Octave-s.OctaveOffset+a,u="";return r&&(u=this.NoteHeadCode(r)),[o+"n/"+h+u,l,s]}static restToNotePitch(t,i){let s=t.Octave;switch(i){case yt.C:case yt.F:s+=2;break;case yt.G:default:}return new Ct(t.FundamentalNote,s,q.NONE)}static NoteHeadCode(t){let i=t.Filled?"2":"1";switch(t.Shape){case Vt.NORMAL:return"";case Vt.NONE:return"";case Vt.DIAMOND:return"/D"+i;case Vt.TRIANGLE:return"/T"+i;case Vt.TRIANGLE_INVERTED:return"/TI";case Vt.X:return"/X"+i;case Vt.CIRCLEX:return"/X3";case Vt.RECTANGLE:return"/R"+i;case Vt.SQUARE:return"/S"+i;case Vt.SLASH:return"";default:return""}}static GhostNotes(t){let i=[],s=Ye.durations(t,!1);for(let r of s)i.push(new ot.GhostNote({duration:r}));return i}static StaveNote(t){t.sortForVexflow();let i=t.notes,s=t.parentStaffEntry.parentMeasure.parentSourceMeasure.Rules,r=i[0],n=[],a=[],o=r.graphicalNoteLength,l=r.sourceNote.NoteTuplet!==void 0,h=Ye.durations(o,l)[0];r.sourceNote.TypeLength!==void 0&&r.sourceNote.TypeLength!==o&&r.sourceNote.TypeLength.RealValue!==0&&(h=Ye.durations(r.sourceNote.TypeLength,l)[0],r.numberOfDots=r.sourceNote.DotsXml);let u,c=r.numberOfDots,d=!1,f=0,p=!1,m;
8for(let y of i){if(c<y.numberOfDots&&(c=y.numberOfDots),y.sourceNote.isRest()){if(p=!0,y.sourceNote.Pitch){n=[y.vfpitch[0]];break}else{n=["b/4"];let P=y.parentVoiceEntry?.parentVoiceEntry;if(P){let L=y.parentVoiceEntry?.parentStaffEntry.parentMeasure.staffEntries,B,A,G=-1;for(let H=0;H<L.length;H++)if(L[H]?.graphicalVoiceEntries[0]?.parentVoiceEntry===P){G=H;break}if(G>=1&&L.length-1>=G+1&&(B=L[G-1]?.graphicalVoiceEntries[0]?.parentVoiceEntry,A=L[G+1]?.graphicalVoiceEntries[0]?.parentVoiceEntry,B&&A)){let H=B.Notes[0],T=A.Notes[0];if(H.NoteBeam?.Notes.includes(T)){let I=B.Notes.last().Pitch,v=y.Clef();n=[Ye.pitch(Ye.restToNotePitch(I.getTransposedPitch(-2),v.ClefType),!1,v)[0]]}}}}if((y.sourceNote.IsWholeMeasureRest||o.RealValue===y.sourceNote.SourceMeasure.ActiveTimeSignature.RealValue)&&(n=["d/5"],t.parentStaffEntry.parentMeasure.ParentStaff.StafflineCount===1&&(n=["b/4"]),h="w",c=0,d=!0,f=s.WholeRestXShiftVexflow*10),y.sourceNote.ParentStaff.Voices.length>1){let P=y.parentVoiceEntry.parentStaffEntry.graphicalVoiceEntries,L=y.parentVoiceEntry.parentVoiceEntry.ParentVoice.VoiceId,B,A;for(let G of P)for(let H of G.notes){if(H===y||H.sourceNote.isRest()||!H.sourceNote.PrintObject)continue;let T=H.parentVoiceEntry.parentVoiceEntry.WantedStemDirection,I=L===1||L===5,v=I?1:-1,U=H.sourceNote.Pitch.getHalfTone();(!B||v===1&&U>B||v===-1&&U<B)&&(B=U,A=0,I&&T===Rt.Up||!I&&T===Rt.Down?A+=7:I?A+=1:A+=2,h.includes("8")||T===Rt.Up&&v===-1&&(A+=1),H.sourceNote.NoteBeam&&(A+=1),h.includes("w")&&(A/=2),A+=Math.ceil(s.RestCollisionYPadding)*.5,A*=v,y.lineShift=A)}if(B>0){let G=3,H=y.Clef();switch(H.ClefType){case yt.F:G=5;break;case yt.C:G=4;break;default:break}m=Ct.fromHalftone(B),n=[Ye.pitch(m,!0,H,void 0,G)[0]]}}break}let M=y.vfpitch;n.push(M[0]),a.push(M[1]),u||(u=Ye.Clef(M[2]).type)}for(let y=0,M=c;y<M;++y)h+="d";i.length===1&&i[0].sourceNote.Notehead?.Shape===Vt.SLASH&&(h+="s"),p&&(h+="r");let g,b={align_center:d,auto_stem:!0,clef:u,duration:h,keys:n,slash:t.GraceSlash},S=t.notes[0].sourceNote;if(S.IsCueNote&&(b.glyph_font_scale=ot.DEFAULT_NOTATION_FONT_SCALE*ot.GraceNote.SCALE,b.stroke_px=ot.GraceNote.LEDGER_LINE_OFFSET),t.parentVoiceEntry.IsGrace||t.notes[0].sourceNote.IsCueNote)g=new ot.GraceNote(b);else{g=new ot.StaveNote(b),g.stagger_same_whole_notes=s.StaggerSameWholeNotes;let y=t.parentStaffEntry.LyricsEntries,M=!0,P=0;if(y.length>0&&s.RenderLyrics&&s.LyricsUseXPaddingForLongLyrics){let L=t.parentStaffEntry.parentMeasure,B=L.staffEntries.indexOf(t.parentStaffEntry),A=[];for(let T=B+1;T<L.staffEntries.length;T++){let I=L.staffEntries[T];I.graphicalVoiceEntries[0]&&A.push(I)}let G,H=t.parentStaffEntry.relInMeasureTimestamp.clone();for(let T of A){let I=T.relInMeasureTimestamp.clone();if(G=N.minus(I,t.parentVoiceEntry.Timestamp),G.RealValue>.25){M=!1;break}if(T.LyricsEntries.length>0)break;let v=N.minus(I,H);P+=v.RealValue*32,H=I}}if(s.RenderLyrics&&s.LyricsUseXPaddingForLongLyrics&&y.length>0&&M){let L=!1,B=0;for(let G of i)if(G.sourceNote.Length.RealValue<=.125){L=!0;break}let A=!1;for(let G of y){let H=s.LyricsXPaddingWidthThreshold,T=G.GraphicalLabel.PositionAndShape.Size.width;if(G.hasDashFromLyricWord()&&(T+=.5),T>H){B+=T-H;let I=t.parentStaffEntry,v=I.parentMeasure.staffEntries,U=v.indexOf(I)===v.length-1;U&&(P+=s.LyricsXPaddingReductionForLastNoteInMeasure),L||(P+=s.LyricsXPaddingReductionForLongNotes),(s.LyricsXPaddingForLastNoteInMeasure||!U)&&T>H+P&&(A=!0,B-=P);break}}A&&(g.paddingRight=10*s.LyricsXPaddingFactorForLongLyrics*B)}}let E=t.notes[0].lineShift;if(E!==0&&(g.getKeyProps()[0].line+=E),i.length>1)for(let y=0;y<i.length;y++)i[y].sourceNote.Notehead?.Shape===Vt.SLASH&&(g.note_heads[y].note_type="s");if(g.getKeyProps().forEach(({line:y},M)=>t.notes[M].staffLine=y),(s.LedgerLineWidth||s.LedgerLineStrokeStyle)&&(g.ledgerLineStyle||(g.ledgerLineStyle={}),s.LedgerLineWidth&&(g.ledgerLineStyle.lineWidth=s.LedgerLineWidth),s.LedgerLineStrokeStyle&&(g.ledgerLineStyle.strokeStyle=s.LedgerLineStrokeStyle)),s.ColoringEnabled){let y=s.DefaultColorStem,M=t.parentVoiceEntry.StemColor;!M&&y&&(M=y);let P={fillStyle:M,strokeStyle:M};M&&(g.setStemStyle(P),g.flag&&s.ColorFlags&&g.setFlagStyle(P))}if(g.x_shift=f,t.parentVoiceEntry.IsGrace&&t.notes[0].sourceNote.NoteBeam&&(t.parentVoiceEntry.WantedStemDirection=t.notes[0].sourceNote.NoteBeam.Notes[0].ParentVoiceEntry.WantedStemDirection),t.parentVoiceEntry)switch(t.parentVoiceEntry.WantedStemDirection){case Rt.Up:g.setStemDirection(ot.Stem.UP),t.parentVoiceEntry.StemDirection=Rt.Up;break;case Rt.Down:g.setStemDirection(ot.Stem.DOWN),t.parentVoiceEntry.StemDirection=Rt.Down;break;default:}for(let y=0,M=i.length;y<M;y+=1){if(i[y].setIndex(g,y),a[y]){if(a[y]==="###"){g.addAccidental(y,new ot.Accidental("##")),g.addAccidental(y,new ot.Accidental("#"));continue}else if(a[y]==="bbs"){g.addAccidental(y,new ot.Accidental("bb")),g.addAccidental(y,new ot.Accidental("b"));continue}g.addAccidental(y,new ot.Accidental(a[y]))}let P=i[y].sourceNote.TremoloStrokes;if(P>0){let L=new ot.Tremolo(P);L.extra_stroke_scale=s.TremoloStrokeScale,L.y_spacing_scale=s.TremoloYSpacingScale,g.addModifier(y,L)}}if(S.Length.RealValue===.25&&S.Notehead&&S.Notehead.Filled===!1){let y=g.getKeyProps();for(let M=0;M<y.length;M++)y[M].code="v81"}for(let y=0,M=c;y<M;++y)g.addDotToAll();return g}static generateArticulations(t,i,s){if(!(!t||t.getAttribute("type")==="GhostNote"))for(let r of i.sourceNote.ParentVoiceEntry.Articulations){let n=ot.Modifier.Position.ABOVE;if(t.getStemDirection()===ot.Stem.UP&&(n=ot.Modifier.Position.BELOW,s.ArticulationAboveNoteForStemUp)){let l=i.parentVoiceEntry.parentStaffEntry.parentMeasure?.ParentStaff,h=l?.ParentInstrument.Staves;(h.length===1||h.length===2&&l!==h[1])&&(n=ot.Modifier.Position.ABOVE)}let a,o=r.articulationEnum;switch(s.ArticulationPlacementFromXML&&(r.placement===C.Above?n=ot.Modifier.Position.ABOVE:r.placement===C.Below&&(n=ot.Modifier.Position.BELOW)),o){case Et.accent:{a=new ot.Articulation("a>");let l=i.sourceNote.NoteSlurs;for(let h of l)h.StartNote===i.sourceNote&&(h.PlacementXml===C.Above?a.setYShift(-s.SlurStartArticulationYOffsetOfArticulation*10):h.PlacementXml===C.Below&&a.setYShift(s.SlurStartArticulationYOffsetOfArticulation*10));a.render_options={...a.render_options,extra_left_px:0,extra_right_px:0},a.getWidth&&(a.getWidth=function(){return 0});break}case Et.breathmark:a=new ot.Articulation("abr"),r.placement===C.Above&&(n=ot.Modifier.Position.ABOVE),a.breathMarkDistance=s.BreathMarkDistance;break;case Et.downbow:a=new ot.Articulation("am"),r.placement===void 0&&(n=ot.Modifier.Position.ABOVE,r.placement=C.Above);break;case Et.fermata:a=new ot.Articulation("a@a"),n=ot.Modifier.Position.ABOVE,r.placement=C.Above;break;case Et.marcatodown:a=new ot.Articulation("a|");break;case Et.marcatoup:a=new ot.Articulation("a^"),n=ot.Modifier.Position.ABOVE;break;case Et.invertedfermata:{let l=i.sourceNote.ParentVoiceEntry;if(l!==i.sourceNote.ParentVoiceEntry.ParentSourceStaffEntry.VoiceEntries.last()){l.Articulations=l.Articulations.slice(l.Articulations.indexOf(r)),l.ParentSourceStaffEntry.VoiceEntries.last().Articulations.push(r);continue}a=new ot.Articulation("a@u"),n=ot.Modifier.Position.BELOW,r.placement=C.Below;break}case Et.lefthandpizzicato:a=new ot.Articulation("a+");break;case Et.naturalharmonic:a=new ot.Articulation("ah");break;
8case Et.snappizzicato:a=new ot.Articulation("ao");break;case Et.staccatissimo:a=new ot.Articulation("av");break;case Et.staccato:a=new ot.Articulation("a.");break;case Et.tenuto:a=new ot.Articulation("a-");break;case Et.upbow:a=new ot.Articulation("a|"),r.placement===void 0&&(n=ot.Modifier.Position.ABOVE,r.placement=C.Above);break;case Et.strongaccent:a=new ot.Articulation("a^");break;default:break}a&&(a.setPosition(n),t.addModifier(0,a))}}static generateOrnaments(t,i){let s=ot.Modifier.Position.ABOVE;i.placement===C.Below&&(s=ot.Modifier.Position.BELOW);let r;switch(i.GetOrnament){case he.DelayedInvertedTurn:r=new ot.Ornament("turn_inverted"),r.setDelayed(!0);break;case he.DelayedTurn:r=new ot.Ornament("turn"),r.setDelayed(!0);break;case he.InvertedMordent:r=new ot.Ornament("mordent"),r.setDelayed(!1);break;case he.InvertedTurn:r=new ot.Ornament("turn_inverted"),r.setDelayed(!1);break;case he.Mordent:r=new ot.Ornament("mordent_inverted"),r.setDelayed(!1);break;case he.Trill:r=new ot.Ornament("tr"),r.setDelayed(!1);break;case he.Turn:r=new ot.Ornament("turn"),r.setDelayed(!1);break;default:W.default.warn("unhandled OrnamentEnum type: "+i.GetOrnament);return}r&&(i.AccidentalBelow!==q.NONE&&r.setLowerAccidental(Ct.accidentalVexflow(i.AccidentalBelow)),i.AccidentalAbove!==q.NONE&&r.setUpperAccidental(Ct.accidentalVexflow(i.AccidentalAbove)),r.setPosition(s),t.addModifier(0,r))}static StrokeTypeFromArpeggioType(t){switch(t){case Ge.ARPEGGIO_DIRECTIONLESS:return ot.Stroke.Type.ARPEGGIO_DIRECTIONLESS;case Ge.BRUSH_DOWN:return ot.Stroke.Type.BRUSH_UP;case Ge.BRUSH_UP:return ot.Stroke.Type.BRUSH_DOWN;case Ge.RASQUEDO_DOWN:return ot.Stroke.Type.RASQUEDO_UP;case Ge.RASQUEDO_UP:return ot.Stroke.Type.RASQUEDO_DOWN;case Ge.ROLL_DOWN:return ot.Stroke.Type.ROLL_UP;case Ge.ROLL_UP:return ot.Stroke.Type.ROLL_DOWN;default:return ot.Stroke.Type.ARPEGGIO_DIRECTIONLESS}}static CreateTabNote(t){let i=[],s=t.notes.reverse(),r=[],n=t.notes[0].graphicalNoteLength,a=t.notes[0].sourceNote.NoteTuplet!==void 0,o=Ye.durations(n,a)[0],l=0,h=!1,u=t.parentStaffEntry.parentMeasure.parentSourceMeasure.Rules,c=!1;for(let f of t.notes){let p=f.sourceNote,m={str:p.StringNumberTab,fret:p.FretNumber};f.sourceNote instanceof kn||(W.default.info(`invalid tab note: ${f.sourceNote.Pitch.ToString()} in measure ${t.parentStaffEntry.parentMeasure.MeasureNumber}, likely missing XML string+fret number.`),m={str:1,fret:0}),u.TabUseXNoteheadShapeForTabNote&&f.sourceNote.Notehead?.Shape===Vt.X&&(m.fret="x",c=!0),i.push(m),p.BendArray&&p.BendArray.forEach(function(g){let b,S=g.bendalter-m.fret;b=S>1?"Full":S===1?"1/2":"1/4",g.direction==="up"?r.push({type:ot.Bend.UP,text:b,width:10}):r.push({type:ot.Bend.DOWN,text:b,width:10})}),p.VibratoStroke&&(h=!0),l<f.numberOfDots&&(l=f.numberOfDots)}for(let f=0,p=l;f<p;++f)o+="d";let d=new ot.TabNote({duration:o,positions:i});c&&(d.render_options.scale=u.TabXNoteheadScale,d.render_options.TabUseXNoteheadAlternativeGlyph=u.TabUseXNoteheadAlternativeGlyph,d.updateWidth()),u.UsePageBackgroundColorForTabNotes&&(d.BackgroundColor=u.PageBackgroundColor);for(let f=0,p=s.length;f<p;f+=1)s[f].setIndex(d,f);return r.forEach(function(f){f.type===ot.Bend.UP?d.addModifier(new ot.Bend(f.text,!1)):d.addModifier(new ot.Bend(f.text,!0))}),h&&d.addModifier(new ot.Vibrato),d}static Clef(t,i="default"){let s,r;switch(i!=="default"&&i!=="small"&&(W.default.warn(`Invalid VexFlow clef size "${i}" specified. Using "default".`),i="default"),t.ClefType){case yt.G:switch(t.Line){case 1:s="french";break;case 2:s="treble";break;default:s="treble",W.default.error(`Clef ${yt[t.ClefType]} on line ${t.Line} not supported by VexFlow. Using default value "${s}".`)}break;case yt.F:switch(t.Line){case 4:s="bass";break;case 3:s="baritone-f";break;case 5:s="subbass";break;default:s="bass",W.default.error(`Clef ${yt[t.ClefType]} on line ${t.Line} not supported by VexFlow. Using default value "${s}".`)}break;case yt.C:switch(t.Line){case 3:s="alto";break;case 4:s="tenor";break;case 1:s="soprano";break;case 2:s="mezzo-soprano";break;default:s="alto",W.default.error(`Clef ${yt[t.ClefType]} on line ${t.Line} not supported by VexFlow. Using default value "${s}".`)}break;case yt.percussion:s="percussion";break;case yt.TAB:s="treble";break;default:W.default.info("bad clef type: "+t.ClefType),s="treble"}return t.OctaveOffset===1&&s!=="bass"?r="8va":t.OctaveOffset===-1&&(r="8vb"),{type:s,size:i,annotation:r}}static TimeSignature(t){let i;switch(t.SymbolEnum){case Ke.NONE:i=t.Rhythm.Numerator+"/"+t.Rhythm.Denominator;break;case Ke.COMMON:i="C";break;case Ke.CUT:i="C|";break;default:}return new ot.TimeSignature(i)}static keySignature(t){if(!t)return;let i;switch(t.Mode){case ai.minor:i=Ye.minorMap[t.Key]+"m";break;case ai.major:i=Ye.majorMap[t.Key];break;case ai.none:i=Ye.majorMap[t.Key];break;default:i="C"}return i}static line(t,i){switch(t){case ft.SingleThin:return i===wi.MeasureBegin?ot.StaveConnector.type.SINGLE:ot.StaveConnector.type.SINGLE_RIGHT;case ft.DoubleThin:return ot.StaveConnector.type.THIN_DOUBLE;case ft.ThinBold:return ot.StaveConnector.type.BOLD_DOUBLE_RIGHT;case ft.BoldThinDots:return ot.StaveConnector.type.BOLD_DOUBLE_LEFT;case ft.DotsThinBold:return ot.StaveConnector.type.BOLD_DOUBLE_RIGHT;case ft.DotsBoldBoldDots:return ot.StaveConnector.type.BOLD_DOUBLE_RIGHT;case ft.None:return ot.StaveConnector.type.NONE;default:}}static font(t,i=Qt.Regular,s=jr.TimesNewRoman,r,n=void 0){let a="normal",o="normal",l=`'${r.DefaultFontFamily}'`;switch(i){case Qt.Bold:o="bold";break;case Qt.Italic:a="italic";break;case Qt.BoldItalic:a="italic",o="bold";break;case Qt.Underlined:break;default:break}return jr.Kokila,n&&n!=="default"&&(l=`'${n}'`),a+" "+o+" "+Math.floor(t)+"px "+l}static fontStyle(t){switch(t){case Qt.Bold:return"bold";case Qt.Italic:return"italic";case Qt.BoldItalic:return"italic bold";default:return"normal"}}static style(t){return Bt.getValue(t)}};Gr=Ht,Gr.majorMap={"-1":"F","-2":"Bb","-3":"Eb","-4":"Ab","-5":"Db","-6":"Gb","-7":"Cb","-8":"Fb",0:"
8C",1:"G",2:"D",3:"A",4:"E",5:"B",6:"F#",7:"C#",8:"G#"},Gr.minorMap={"-1":"D","-2":"G","-3":"C","-4":"F","-5":"Bb","-6":"Eb","-7":"Ab","-8":"Db",0:"A",1:"E",2:"B",3:"F#",4:"C#",5:"G#",6:"D#",7:"A#",8:"E#"};var gl=class extends sl{constructor(e,t){super(e),this.rules=t}calculateBorders(e){if(this.staffLines.length===0)return;let t=this.calcBracketsWidth();this.boundingBox.BorderLeft=-t,this.boundingBox.BorderMarginLeft=-t,this.boundingBox.XBordersHaveBeenSet=!0;let i=this.staffLines[0].SkyBottomLineCalculator.getSkyLineMin();this.boundingBox.BorderTop=i,this.boundingBox.BorderMarginTop=i;let s=this.staffLines[this.staffLines.length-1],r=s.SkyBottomLineCalculator.getBottomLineMax()+s.PositionAndShape.RelativePosition.y;this.boundingBox.BorderBottom=r,this.boundingBox.BorderMarginBottom=r,this.boundingBox.XBordersHaveBeenSet=!0,this.boundingBox.YBordersHaveBeenSet=!0}createSystemLine(e,t,i,s,r,n,a=void 0){let o=n,l=!1;if(a){l=!0,a.addMeasureLine(i,s),o&&o.addMeasureLine(i,s,l);let h=0;if(i===ft.BoldThinDots&&s===wi.MeasureBegin&&n.beginInstructionsWidth>0&&(h=o.getVFStave().getModifierXShift(0)),a.lineTo(n,Ht.line(i,s),h),i===ft.DotsBoldBoldDots){let u=a.ParentStaffLine.Measures.indexOf(a)+1,c=a.ParentStaffLine.Measures[u],d=n.ParentStaffLine.Measures[u];c&&d&&(c.lineTo(d,Ht.line(ft.BoldThinDots,s)),c.addMeasureLine(ft.BoldThinDots,s))}}else o&&o.addMeasureLine(i,s,l);return new sa(i,s,this,n,a)}createInstrumentBracket(e,t){let i=new fn(e,t);this.InstrumentBrackets.push(i)}createGroupBracket(e,t,i){let s=e,r=t;if(i===0){let n=new oa(s,r,i);this.GroupBrackets.push(n)}else{let n=new fn(s,r,i);this.GroupBrackets.push(n)}}},It,Bi=class j extends Pi{constructor(t,i,s){super(i),this.label=t,this.staffNumber=s,this.setMoodType()}static isInputStringMood(t){return t?j.isStringInStringList(j.listMoodAffettuoso,t)||j.isStringInStringList(j.listMoodAgitato,t)||j.isStringInStringList(j.listMoodAnimato,t)||j.isStringInStringList(j.listMoodAppassionato,t)||j.isStringInStringList(j.listMoodBrillante,t)||j.isStringInStringList(j.listMoodCantabile,t)||j.isStringInStringList(j.listMoodDolce,t)||j.isStringInStringList(j.listMoodEnergico,t)||j.isStringInStringList(j.listMoodEroico,t)||j.isStringInStringList(j.listMoodEspressivo,t)||j.isStringInStringList(j.listMoodFurioso,t)||j.isStringInStringList(j.listMoodGiocoso,t)||j.isStringInStringList(j.listMoodGioioso,t)||j.isStringInStringList(j.listMoodGrandioso,t)||j.isStringInStringList(j.listMoodGrazioso,t)||j.isStringInStringList(j.listMoodLacrimoso,t)||j.isStringInStringList(j.listMoodLeggiero,t)||j.isStringInStringList(j.listMoodMaestoso,t)||j.isStringInStringList(j.listMoodMalinconico,t)||j.isStringInStringList(j.listMoodMarcato,t)||j.isStringInStringList(j.listMoodMarziale,t)||j.isStringInStringList(j.listMoodMesto,t)||j.isStringInStringList(j.listMoodMorendo,t)||j.isStringInStringList(j.listMoodNobilmente,t)||j.isStringInStringList(j.listMoodPatetico,t)||j.isStringInStringList(j.listMoodPesante,t)||j.isStringInStringList(j.listMoodSaltando,t)||j.isStringInStringList(j.listMoodSautille,t)||j.isStringInStringList(j.listMoodScherzando,t)||j.isStringInStringList(j.listMoodSostenuto,t)||j.isStringInStringList(j.listMoodSpiccato,t)||j.isStringInStringList(j.listMoodTenerezza,t)||j.isStringInStringList(j.listMoodTranquillamente,t)||j.isStringInStringList(j.listMoodTrionfante,t):!1}get Label(){return this.label}set Label(t){this.label=t}get Mood(){return this.moodType}set Mood(t){this.moodType=t}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t}get Placement(){return this.placement}set Placement(t){this.placement=t}setMoodType(){j.isStringInStringList(j.listMoodAffettuoso,this.label)?this.moodType=Ft.Affettuoso:j.isStringInStringList(j.listMoodAgitato,this.label)?this.moodType=Ft.Agitato:j.isStringInStringList(j.listMoodAnimato,this.label)?this.moodType=Ft.Animato:j.isStringInStringList(j.listMoodAppassionato,this.label)?this.moodType=Ft.Appassionato:j.isStringInStringList(j.listMoodBrillante,this.label)?this.moodType=Ft.Brillante:j.isStringInStringList(j.listMoodCantabile,this.label)?this.moodType=Ft.Cantabile:j.isStringInStringList(j.listMoodDolce,this.label)?this.moodType=Ft.Dolce:j.isStringInStringList(j.listMoodEnergico,this.label)?this.moodType=Ft.Energico:j.isStringInStringList(j.listMoodEroico,this.label)?this.moodType=Ft.Eroico:j.isStringInStringList(j.listMoodEspressivo,this.label)?this.moodType=Ft.Espressivo:j.isStringInStringList(j.listMoodFurioso,this.label)?this.moodType=Ft.Furioso:j.isStringInStringList(j.listMoodGiocoso,this.label)?this.moodType=Ft.Giocoso:j.isStringInStringList(j.listMoodGioioso,this.label)?this.moodType=Ft.Gioioso:j.isStringInStringList(j.listMoodGrandioso,this.label)?this.moodType=Ft.Grandioso:j.isStringInStringList(j.listMoodGrazioso,this.label)?this.moodType=Ft.Grazioso:j.isStringInStringList(j.listMoodLacrimoso,this.label)?this.moodType=Ft.Lacrimoso:j.isStringInStringList(j.listMoodLeggiero,this.label)?this.moodType=Ft.Leggiero:j.isStringInStringList(j.listMoodMaestoso,this.label)?this.moodType=Ft.Maestoso:j.isStringInStringList(j.listMoodMalinconico,this.label)?this.moodType=Ft.Malinconico:j.isStringInStringList(j.listMoodMarcato,this.label)?this.moodType=Ft.Marcato:j.isStringInStringList(j.listMoodMarziale,this.label)?this.moodType=Ft.Marziale:j.isStringInStringList(j.listMoodMesto,this.label)?this.moodType=Ft.Mesto:j.isStringInStringList(j.listMoodMorendo,this.label)?this.moodType=Ft.Morendo:j.isStringInStringList(j.listMoodNobilmente,this.label)?this.moodType=Ft.Nobilmente:j.isStringInStringList(j.listMoodPatetico,this.label)?this.moodType=Ft.Patetico:j.isStringInStringList(j.listMoodPesante,this.label)?this.moodType=Ft.Pesante:j.isStringInStringList(j.listMoodSaltando,this.label)?this.moodType=Ft.Saltando:j.isStringInStringList(j.listMoodSautille,this.label)?this.moodType=Ft.Sautille:j.isStringInStringList(j.listMoodScherzando,this.label)?this.moodType=Ft.Scherzando:j.isStringInStringList(j.listMoodSostenuto,this.label)?this.moodType=Ft.Sostenuto:j.isStringInStringList(j.listMoodSpiccato,this.label)?this.moodType=Ft.Spiccato:j.isStringInStringList(j.listMoodTenerezza,this.label)?this.moodType=Ft.Tenerezza:j.isStringInStringList(j.listMoodTranquillamente,this.label)?this.moodType=Ft.Tranquillamente:j.isStringInStringList(j.listMoodTrionfante,this.label)&&(this.moodType=Ft.Trionfante)}};It=Bi,It.listMoodAffettuoso=["affettuoso"],It.listMoodAgitato=["agitato"],It.listMoodAppassionato=["appassionato"],It.listMoodAnimato=["animato","lively"],It.listMoodBrillante=["brillante"],It.listMoodCantabile=["cantabile"],It.listMoodDolce=["dolce"],It.listMoodEnergico=["energico"],It.listMoodEroico=["eroico"],It.listMoodEspressivo=["espressivo"],It.listMoodFurioso=["furioso"],It.listMoodGiocoso=["giocoso"],It.listMoodGioioso=["gioioso"],It.listMoodLacrimoso=["lacrimoso"],It.listMoodGrandioso=["grandioso"],It.listMoodGrazioso=["grazioso"],It.listMoodLeggiero=["leggiero"],It.listMoodMaestoso=["maestoso"],It.listMoodMalinconico=["malinconico"],It.listMoodMarcato=["marcato"],It.listMoodMarziale=["marziale"],It.listMoodMesto=["mesto"],It.listMoodMorendo=["morendo"],It.listMoodNobilmente=["nobilmente"],It.listMoodPatetico=["patetico"],It.listMoodPesante=["pesante"],It.listMoodSautille=["sautille"],It.listMoodSaltando=["saltando"],It.listMoodScherzando=["scherzando"],It.listMoodSostenuto=["sostenuto"],It.listMoodSpiccato=["spiccato"],It.listMoodTenerezza=["tenerezza"],It.listMoodTranquillamente=["tranquillamente"],It.listMoodTrionfante=["tri
8onfante"];var Ft=(function(e){return e[e.Affettuoso=0]="Affettuoso",e[e.Agitato=1]="Agitato",e[e.Appassionato=2]="Appassionato",e[e.Animato=3]="Animato",e[e.Brillante=4]="Brillante",e[e.Cantabile=5]="Cantabile",e[e.Dolce=6]="Dolce",e[e.Energico=7]="Energico",e[e.Eroico=8]="Eroico",e[e.Espressivo=9]="Espressivo",e[e.Furioso=10]="Furioso",e[e.Giocoso=11]="Giocoso",e[e.Gioioso=12]="Gioioso",e[e.Lacrimoso=13]="Lacrimoso",e[e.Grandioso=14]="Grandioso",e[e.Grazioso=15]="Grazioso",e[e.Leggiero=16]="Leggiero",e[e.Maestoso=17]="Maestoso",e[e.Malinconico=18]="Malinconico",e[e.Marcato=19]="Marcato",e[e.Marziale=20]="Marziale",e[e.Mesto=21]="Mesto",e[e.Morendo=22]="Morendo",e[e.Nobilmente=23]="Nobilmente",e[e.Patetico=24]="Patetico",e[e.Pesante=25]="Pesante",e[e.Sautille=26]="Sautille",e[e.Saltando=27]="Saltando",e[e.Scherzando=28]="Scherzando",e[e.Sostenuto=29]="Sostenuto",e[e.Spiccato=30]="Spiccato",e[e.Tenerezza=31]="Tenerezza",e[e.Tranquillamente=32]="Tranquillamente",e[e.Trionfante=33]="Trionfante",e[e.Vivace=34]="Vivace",e})({}),ds=class extends Pi{constructor(e,t,i,s){super(t),this.label=e,this.staffNumber=s,i===void 0&&(i=mt.LeftBottom),this.textAlignment=i}get Label(){return this.label}get Placement(){return this.placement}set Placement(e){this.placement=e}get StaffNumber(){return this.staffNumber}set StaffNumber(e){this.staffNumber=e}get TextAlignment(){return this.textAlignment}},bl=class{constructor(e,t){this.unknownList=[],this.moodList=[],this.expressions=[],this.sourceMeasure=e,this.timestamp=t}get SourceMeasureParent(){return this.sourceMeasure}set SourceMeasureParent(e){this.sourceMeasure=e}get StaffNumber(){return this.staffNumber}set StaffNumber(e){this.staffNumber=e}get Timestamp(){return this.timestamp}set Timestamp(e){this.timestamp=e}get AbsoluteTimestamp(){return N.plus(this.timestamp,this.sourceMeasure.AbsoluteTimestamp)}get InstantaneousDynamic(){return this.instantaneousDynamic}set InstantaneousDynamic(e){this.instantaneousDynamic=e}get EndingContinuousDynamic(){return this.endingContinuousDynamic}set EndingContinuousDynamic(e){this.endingContinuousDynamic=e}get StartingContinuousDynamic(){return this.startingContinuousDynamic}set StartingContinuousDynamic(e){this.startingContinuousDynamic=e}get MoodList(){return this.moodList}get UnknownList(){return this.unknownList}get EntriesList(){return this.expressions}get OctaveShiftStart(){return this.octaveShiftStart}set OctaveShiftStart(e){this.octaveShiftStart=e}get OctaveShiftEnd(){return this.octaveShiftEnd}set OctaveShiftEnd(e){this.octaveShiftEnd=e}get CombinedExpressionsText(){return this.combinedExpressionsText}set CombinedExpressionsText(e){this.combinedExpressionsText=e}getPlacementOfFirstEntry(){let e=C.Above;return this.expressions.length>0&&(this.expressions[0].expression instanceof Oi||this.expressions[0].expression instanceof Ue||this.expressions[0].expression instanceof Bi||this.expressions[0].expression instanceof ds)&&(e=this.expressions[0].expression.Placement),e}getFontstyleOfFirstEntry(){let e=Qt.Regular;return this.expressions.length>0&&(this.expressions[0].expression instanceof Ue||this.expressions[0].expression instanceof Bi?e=Qt.Italic:this.expressions[0].expression instanceof ds&&(e=this.expressions[0].expression.fontStyle??Qt.Regular)),e}getColorXMLOfFirstEntry(){let e;return this.expressions.length>=1&&(e=this.expressions[0].expression.ColorXML),e}addExpression(e,t){e instanceof Oi?(this.instantaneousDynamic&&this.removeExpressionFromEntryList(this.InstantaneousDynamic),this.instantaneousDynamic=e,this.instantaneousDynamic.ParentMultiExpression=this):e instanceof Ue?this.startingContinuousDynamic=e:e instanceof Bi?this.moodList.push(e):e instanceof ds&&this.unknownList.push(e),this.addExpressionToEntryList(e,t)}CompareTo(e){return this.Timestamp.RealValue>e.Timestamp.RealValue?1:this.Timestamp.RealValue<e.Timestamp.RealValue?-1:0}addExpressionToEntryList(e,t){let i=new Ru;i.prefix=t,i.expression=e,e instanceof Ue||e instanceof Bi||e instanceof ds?i.label=e.L
8abel:i.label="",this.expressions.push(i)}removeExpressionFromEntryList(e){for(let t=0,i=this.expressions.length;t<i;++t)if(this.expressions[t].expression===e){this.expressions.splice(t,1);break}}},Ru=class{},Sl=class{constructor(e,t){this.expressions=[],this.sourceMeasure=e,this.timestamp=t}get Timestamp(){return this.timestamp}get AbsoluteTimestamp(){return N.plus(this.sourceMeasure.AbsoluteTimestamp,this.timestamp)}get SourceMeasureParent(){return this.sourceMeasure}set SourceMeasureParent(e){this.sourceMeasure=e}get InstantaneousTempo(){return this.instantaneousTempo}get ContinuousTempo(){return this.continuousTempo}get EntriesList(){return this.expressions}get CombinedExpressionsText(){return this.combinedExpressionsText}set CombinedExpressionsText(e){this.combinedExpressionsText=e}getPlacementOfFirstEntry(){let e=C.Above;return this.expressions.length>0&&(this.expressions[0].Expression instanceof Fe||this.expressions[0].Expression instanceof Fi)&&(e=this.expressions[0].Expression.Placement),e}getFontstyleOfFirstEntry(){let e=Qt.Regular;return this.expressions[0].Expression instanceof Fe?e=Qt.Bold:this.expressions[0].Expression instanceof Fi&&(e=Qt.Italic),e}addExpression(e,t){if(this.checkIfAlreadyExists(e))return;e instanceof Fe?this.instantaneousTempo=e:e instanceof Fi&&(this.continuousTempo=e);let i=new Cu;
8i.prefix=t,i.Expression=e,i.label=e.Label,this.expressions.push(i)}CompareTo(e){return this.Timestamp.RealValue>e.Timestamp.RealValue?1:this.Timestamp.RealValue<e.Timestamp.RealValue?-1:0}checkIfAlreadyExists(e){for(let t of this.expressions)if(t.label===e.Label)return!0;return!1}clearInstantaneousTempo(){this.instantaneousTempo=void 0}clearContinuousTempo(){this.continuousTempo=void 0}},Cu=class{get Expression(){return this.expression}set Expression(e){this.expression=e}},Nu=class extends Pi{constructor(e,t){super(t),this.label=e}},da=class extends ue{constructor(e,t,i,s,r,n){super(),this.chordSymbolContainer=e,this.boundingBox=new Yt(this,t),this.rules=n,this.calculateLabel(i,r,s)}get GetChordSymbolContainer(){return this.chordSymbolContainer}get GraphicalLabel(){return this.graphicalLabel}calculateLabel(e,t,i){let s=rr.calculateChordText(this.chordSymbolContainer,t,i),r=this.GetChordSymbolContainer.Placement===C.Above?this.rules.ChordSymbolTextAlignmentTop:this.rules.ChordSymbolTextAlignmentBottom;this.graphicalLabel=new pe(new Nt(s),e,r,this.rules,this.boundingBox),this.graphicalLabel.PositionAndShape.RelativePosition=new k(this.rules.ChordSymbolRelativeXOffset,0),this.graphicalLabel.Label.colorDefault=this.rules.DefaultColorChordSymbol}},Iu=vt.Flow,yl=class{createMusicSystem(e,t){return new gl(e,t)}createStaffLine(e,t){return new ua(e,t)}createGraphicalMeasure(e,t,i=!1){return new Qi(t,e,void 0)}createMultiRestMeasure(e,t,i){return new na(t,e,i)}createTabStaffMeasure(e,t){return new dl(t,e)}createExtraGraphicalMeasure(e){let t=new Qi(e.ParentStaff,void 0,e);return t.IsExtraGraphicalMeasure=!0,t.ExtraGraphicalMeasurePreviousMeasure=e.Measures.last(),t}createStaffEntry(e,t){return new la(t,e,void 0)}createVoiceEntry(e,t){return new Lr(e,t)}createNote(e,t,i,s=se.NONE,r,n=void 0){return new ts(e,t,i,s,r,n)}createGraceNote(e,t,i,s,r=se.NONE){return new ts(e,t,i,r,s)}addGraphicalAccidental(e,t){e.setAccidental(t)}addFermataAtTiedEndNote(e,t){}createInStaffClef(e,t){let i=e,s=Ht.Clef(t,"small");i.vfClefBefore=new Iu.ClefNote(s.type,s.size,s.annotation)}createChordSymbols(e,t,i,s){let r=t.parentMeasure.parentSourceMeasure.Rules,n=0,a=r.ChordSymbolXSpacing;for(let o of e.ChordContainers){if(!o)continue;let l=t.PositionAndShape;t.graphicalVoiceEntries.length===1&&t.graphicalVoiceEntries[0].notes.length===1&&t.graphicalVoiceEntries[0].notes[0].sourceNote.isWholeRest()&&(l=t.parentMeasure.PositionAndShape,n+=t.parentMeasure.beginInstructionsWidth,n+=r.ChordSymbolWholeMeasureRestXOffset);let h=new da(o,l,r.ChordSymbolTextHeight,i,s,r),u=h.GetChordSymbolContainer.Placement,c=h.GraphicalLabel;u===C.Below?c.PositionAndShape.RelativePosition.y=r.StaffHeight+r.ChordSymbolYOffset:c.PositionAndShape.RelativePosition.y-=r.ChordSymbolYOffset,c.setLabelPositionAndShapeBorders();let d=0;c.PositionAndShape.Size.width<r.ChordSymbolExtraXShiftWidthThreshold&&(d=r.ChordSymbolExtraXShiftForShortChordSymbols),c.PositionAndShape.RelativePosition.x+=n+d,c.setLabelPositionAndShapeBorders(),h.PositionAndShape.calculateBoundingBox(),t.graphicalChordContainers.push(h),n+=c.PositionAndShape.Size.width+a}}createGraphicalTechnicalInstruction(e,t){}},xl=class{constructor(e,t){this.elementHeight=300,this.canvas=new Pr(e),this.measures=t,this.maxWidth=Math.max(...this.measures.map(i=>{let s=i.getVFStave().getWidth();return!(s>0)&&!i.IsExtraGraphicalMeasure&&(W.default.warn("SkyBottomLineBatchCalculatorBackend: width not > 0 in measure "+i.MeasureNumber),s=50),s})),this.samplingUnit=e.SamplingUnit}initialize(){if(this.tableConfiguration={...this.getPreferredRenderingConfiguration(this.maxWidth,this.elementHeight),elementHeight:this.elementHeight},this.tableConfiguration.numRows<1||this.tableConfiguration.numColumns<1)throw W.default.warn("SkyBottomLineBatchCalculatorBackend: numRows or numColumns in tableConfiguration is 0"),Error("numRows or numColumns in tableConfiguration is 0");this.tableConfiguration.elementWidth<this.maxWidth&&W.default.warn("SkyBottomLineBatchCalculatorBackend: elementWidth in tableConfiguration is less than the width of widest measure");let e=this.tableConfiguration.elementWidth*this.tableConfiguration.numColumns,t=this.elementHeight*this.tableConfiguration.numRows;return this.canvas.initializeHeadless(e,t),this.onInitialize(this.tableConfiguration),this}calculateLines(){let{numColumns:e,numRows:t,elementWidth:i}=this.tableConfiguration,s=this.elementHeight,r=e*t,n=this.canvas.getContext(),a=n,o=this.canvas.getCanvas(),l=[];for(let h=0;h<this.measures.length;h+=r){n.clear();let u=this.measures.slice(h,h+r);for(let d=0;d<u.length;++d){let f=u[d],p=f.getVFStave(),m=d%e,g=Math.floor(d/e),b=p.getWidth();!(b>0)&&!f.IsExtraGraphicalMeasure&&(b=50),b=Math.floor(b),f.PositionAndShape.calculateAbsolutePositionsRecursive(0,0),p.setX(0);let S=p.y+100;p.setY(S);let E=p.getWidth();p.setWidth(b),f.format(),p.setWidth(E);try{a.translate(m*i,g*s),f.draw(n),a.translate(-m*i,-g*s)}catch(y){W.default.warn("SkyBottomLineBatchCalculatorBackend.calculateLines.draw",y)}}let c=this.calculateFromCanvas(o,n,u,this.samplingUnit,this.tableConfiguration);l.push(...c)}return l}},Oa=class extends xl{constructor(e,t){super(e,t)}getPreferredRenderingConfiguration(e,t){return{elementWidth:Math.ceil(e),numColumns:6,numRows:6}}onInitialize(e){}calculateFromCanvas(e,t,i,s,r){let n=e.width,a=t.getImageData(0,0,e.width,e.height),{elementWidth:o,elementHeight:l,numColumns:h}=r,u=[];for(let c=0;c<i.length;++c){let d=i[c],f=Math.floor(d.getVFStave().getWidth()),p=Math.max(Math.ceil(d.PositionAndShape.Size.width*s),1),m=c%h,g=Math.floor(c/h),b=m*o,S=b+f,E=g*l,y=E+l,M=Array(Math.max(p,f)).fill(0),P=Array(Math.max(p,f)).fill(0);for(let A=b;A<S;++A){M[A-b]=0;for(let G=E;G<y;++G){let H=G*n*4+A*4;if(a.data[H+3]>0){M[A-b]=G-E;break}}P[A-b]=l;for(let G=y-1;G>=E;G--){let H=G*n*4+A*4;if(a.data[H+3]>0){P[A-b]=G-E;break}}}let L=Math.max(...M),B=Math.min(...P);for(let A=0;A<f;++A)M[A]=M[A]===0?L:M[A],P[A]=P[A]===l?B:P[A];u.push(new pr(M,P))}return u}},Bu=`attribute vec4 a_position;
9varying vec4 v_position;
10
11void main() {
12    gl_Position = a_position;
13    v_position = a_position;
14}
15`,ku=`precision mediump float;
16uniform sampler2D u_image;
17varying vec4 v_position;
18
19#define NUM_ROWS 5
20#define ELEMENT_HEIGHT 300
21
22void main() {
23    const float halfPixel = 1.0 / float(ELEMENT_HEIGHT * 2);
24
25    vec2 absolutePosition = (v_position.xy + vec2(1.0)) / vec2(2.0);
26    float absX = absolutePosition.x;
27    float absY = absolutePosition.y;
28
29    int skyLine = 0;
30    for (int i = 0; i < ELEMENT_HEIGHT; ++i) {
31        float ratioY = float(i) / float(ELEMENT_HEIGHT);
32        float relY = (ratioY - 0.5 + halfPixel) / float(NUM_ROWS);
33        float x = absX;
34        float y = absY + relY;
35
36        float currentAlpha = texture2D(u_image, vec2(x, y)).a;
37        if (currentAlpha > 0.0) {
38            skyLine = i;
39            break;
40        }
41    }
42
43    int bottomLine = ELEMENT_HEIGHT;
44    for (int i = ELEMENT_HEIGHT - 1; i >= 0; --i) {
45        float ratioY = float(i) / float(ELEMENT_HEIGHT);
46        float relY = (ratioY - 0.5 + halfPixel) / float(NUM_ROWS);
47        float x = absX;
48        float y = absY + relY;
49
50        float currentAlpha = texture2D(u_image, vec2(x, y)).a;
51        if (currentAlpha > 0.0) {
52            bottomLine = i;
53            break;
54        }
55    }
56
57    int r = skyLine;
58    if (r > 256) {
59        r -= 256;
60    }
61    int g = bottomLine;
62    if (g > 256) {
63        g -= 256;
64    }
65    int b = (skyLine / 256 * 16) + (bottomLine / 256);
66
67    gl_FragColor = vec4(float(r) / 255.0, float(g) / 255.0, float(b) / 255.0, 1.0);
68}
69`;function Va(e,t,i){let s=e.createShader(t);if(!s)throw W.default.warn("WebGLSkyBottomLineCalculatorBackend: Could not create a WebGL shader"),Error("Could not create a WebGL shader");if(e.shaderSource(s,i),e.compileShader(s),!e.getShaderParameter(s,e.COMPILE_STATUS))throw W.default.warn(`Shader compilation failed
70`+e.getShaderInfoLog(s)),e.deleteShader(s),Error("WebGL shader compilation failed");return s}function Fu(e,t,i){let s=e.createProgram();if(!s)throw W.default.warn("WebGLSkyBottomLineCalculatorBackend: Could not create a WebGL program"),Error("Could not create a WebGL program");if(e.attachShader(s,t),e.attachShader(s,i),e.linkProgram(s),!e.getProgramParameter(s,e.LINK_STATUS))throw W.default.warn(`WebGLSkyBottomLineCalculatorBackend: WebGL program link failed
71`+e.getProgramInfoLog(s)),e.deleteProgram(s),Error("WebGL program link failed");return s}function Du(e,t,i,s){let r=e.createBuffer();if(!r)throw W.default.warn("WebGLSkyBottomLineCalculatorBackend: WebGL buffer creation failed"),Error("WebGL buffer creation failed");e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array(Le.flat(s)),e.STATIC_DRAW),e.useProgram(t);let n=e.getAttribLocation(t,i);return e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),r}function Ou(e,t,i,s){let r=e.createTexture();if(!r)throw W.default.warn("WebGLSkyBottomLineCalculatorBackend: WebGL texture creation failed"),Error("WebGL texture creation failed");e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);let n=e.getUniformLocation(t,s);if(!n)throw W.default.warn("WebGLSkyBottomLineCalculatorBackend: WebGL invalid uniform name"),Error("WebGL invalid uniform name");return e.uniform1i(n,i),r}function Vu(e,t){let i=e;for(let[s,r]of Object.entries(t)){let n=RegExp(`#define ${s} .*`);i=i.replace(n,`#define ${s} ${r}`)}return i}function Gu(){let e=document.createElement("canvas").getContext("webgl");return e.getParameter(e.MAX_TEXTURE_SIZE)}var Wu=class extends xl{constructor(e,t){super(e,t)}getPreferredRenderingConfiguration(e,t){let i=Math.min(4096,Gu()),s=Math.ceil(e);return{elementWidth:s,numColumns:Math.min(5,Math.floor(i/s)),numRows:Math.min(5,Math.floor(i/t))}}onInitialize(e){let{elementWidth:t,elementHeight:i,numColumns:s,numRows:r}=e,n=document.createElement("canvas");n.width=t*s,n.height=r;let a=n.getContext("webgl");
71if(!a)throw W.default.warn("WebGLSkyBottomLineCalculatorBackend: No WebGL support"),Error("No WebGL support");this.gl=a;let o=Fu(a,Va(a,a.VERTEX_SHADER,Bu),Va(a,a.FRAGMENT_SHADER,Vu(ku,{NUM_ROWS:r,ELEMENT_HEIGHT:i})));Du(a,o,"a_position",[[-1,-1],[1,-1],[1,1],[-1,-1],[1,1],[-1,1]]),this.texture=Ou(a,o,0,"u_image")}calculateFromCanvas(e,t,i,s,r){let n=this.gl,{elementWidth:a,elementHeight:o,numColumns:l}=r;n.viewport(0,0,n.canvas.width,n.canvas.height),n.bindTexture(n.TEXTURE_2D,this.texture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),n.drawArrays(n.TRIANGLES,0,6);let h=new Uint8Array(n.canvas.width*n.canvas.height*4);n.readPixels(0,0,n.canvas.width,n.canvas.height,n.RGBA,n.UNSIGNED_BYTE,h);let u=[];for(let c=0;c<i.length;++c){let d=i[c],f=Math.floor(d.getVFStave().getWidth()),p=Math.max(Math.ceil(d.PositionAndShape.Size.width*s),1),m=c%l,g=Math.floor(c/l),b=m*a*4,S=g*a*l*4,E=Array(Math.max(p,f)).fill(0),y=Array(Math.max(p,f)).fill(0);for(let L=0;L<f;++L){let B=h[L*4+b+S],A=h[L*4+b+S+1],G=h[L*4+b+S+2],H=B+Math.floor(G/16)*256,T=A+G%16*256;E[L]=H,y[L]=T}let M=Math.max(...E),P=Math.min(...y);for(let L=0;L<f;++L)E[L]=E[L]===0?M:E[L],y[L]=y[L]===o?P:y[L];u.push(new pr(E,y))}return u}},Ga=class{constructor(e,t){let i=new Map;for(let s of e){let r=s.ParentMusicSystem.rules;(()=>{if(i.has(r))return i.get(r);{let n=[];return i.set(r,n),n}})().push({skyBottomLineCalculator:s.SkyBottomLineCalculator,measures:s.Measures})}this.batches=new Map;for(let[s,r]of i.entries()){let n=Le.flat(r.map(o=>o.measures)),a=(()=>{if(t===ir.Plain)return new Oa(s,n).initialize();try{return new Wu(s,n).initialize()}catch{return W.default.info("Couldn't create WebGLBackend for Skyline. Using fallback."),new Oa(s,n).initialize()}})();a.initialize(),this.batches.set(s,{backend:a,entries:r})}}calculateLines(){for(let[,{backend:e,entries:t}]of this.batches){let i=e.calculateLines(),s=0;for(let{skyBottomLineCalculator:r,measures:n}of t){let a=s+n.length;r.updateLines(i.slice(s,a)),s=a}}}},El=class{constructor(e,t=void 0,i=void 0){this.tie=e,this.startNote=t,this.endNote=i}get SVGElement(){return this.vfTie.getAttribute("el")}get GetTie(){return this.tie}get StartNote(){return this.startNote}get Tie(){return this.tie}set StartNote(e){this.startNote=e}get EndNote(){return this.endNote}set EndNote(e){this.endNote=e}},Mi=class{constructor(e,t,i,s){this.lyricsEntry=e,this.graphicalStaffEntry=t;let r=t.parentMeasure.parentSourceMeasure.Rules.LyricsAlignmentStandard;e.Text.length>=4&&e.Parent.Notes[0].Length.Denominator>4&&mt.LeftBottom;let n=new Nt(e.Text),a=this.graphicalStaffEntry.parentMeasure.parentSourceMeasure.Rules;this.graphicalLabel=new pe(n,i,r,a,t.PositionAndShape),this.graphicalLabel.Label.colorDefault=a.DefaultColorLyrics,this.graphicalLabel.PositionAndShape.RelativePosition=new k(0,s),this.graphicalLabel.setLabelPositionAndShapeBorders(),this.graphicalLabel.PositionAndShape.Size.width<a.LyricsExtraXShiftForShortLyricsWidthThreshold&&(this.graphicalLabel.PositionAndShape.RelativePosition.x+=a.LyricsExtraXShiftForShortLyrics,this.graphicalLabel.CenteringXShift=a.LyricsExtraXShiftForShortLyrics),r===mt.LeftBottom&&--this.graphicalLabel.PositionAndShape.RelativePosition.x}hasDashFromLyricWord(){if(!this.ParentLyricWord)return!1;let e=this.ParentLyricWord.GraphicalLyricsEntries.indexOf(this);return this.ParentLyricWord.GraphicalLyricsEntries.length>1&&e<this.ParentLyricWord.GraphicalLyricsEntries.length-1}get LyricsEntry(){return this.lyricsEntry}get ParentLyricWord(){return this.graphicalLyricWord}set ParentLyricWord(e){this.graphicalLyricWord=e}get GraphicalLabel(){return this.graphicalLabel}set GraphicalLabel(e){this.graphicalLabel=e}get StaffEntryParent(){return this.graphicalStaffEntry}set StaffEntryParent(e){this.graphicalStaffEntry=e}},vl=class{constructor(e){this.graphicalLyricsEntries=[],this.lyricWord=e,this.initialize()}get GetLyricWord(){return this.lyricWord}get GraphicalLyricsEntries(){return this.graphicalLyricsEntries}set GraphicalLyricsEntries(e){this.graphicalLyricsEntries=e}isFilled(){for(let e=0;e<this.graphicalLyricsEntries.length;e++)if(!this.graphicalLyricsEntries[e])return!1;return!0}initialize(){for(let e=0;e<this.lyricWord.Syllables.length;e++)this.graphicalLyricsEntries.push(void 0)}},Wa,fa=class ee{constructor(){ee.tPow3=Array(ee.bezierCurveStepSize),ee.oneMinusTPow3=Array(ee.bezierCurveStepSize),ee.bezierFactorOne=Array(ee.bezierCurveStepSize),ee.bezierFactorTwo=Array(ee.bezierCurveStepSize);for(let t=0;t<ee.bezierCurveStepSize;t++){let i=t/ee.bezierCurveStepSize;ee.tPow3[t]=i**3,ee.oneMinusTPow3[t]=(1-i)**3,ee.bezierFactorOne[t]=3*(1-i)**2*i,ee.bezierFactorTwo[t]=3*(1-i)*i**2}}calculateCurvePointAtIndex(t){let i=Math.round(t*ee.bezierCurveStepSize);return i<0||i>=ee.bezierCurveStepSize?new k:new k(ee.oneMinusTPow3[i]*this.bezierStartPt.x+ee.bezierFactorOne[i]*this.bezierStartControlPt.x+ee.bezierFactorTwo[i]*this.bezierEndControlPt.x+ee.tPow3[i]*this.bezierEndPt.x,ee.oneMinusTPow3[i]*this.bezierStartPt.y+ee.bezierFactorOne[i]*this.bezierStartControlPt.y+ee.bezierFactorTwo[i]*this.bezierEndControlPt.y+ee.tPow3[i]*this.bezierEndPt.y)}};Wa=fa,Wa.bezierCurveStepSize=1e3;var Sn=class yn{constructor(){this.matrix=[];for(let t=0;t<2;t++){this.matrix[t]=[];for(let i=0;i<2;i++)this.matrix[t][i]=0}}static getRotationMatrix(t){let i=new yn,s=Math.cos(t),r=Math.sin(t);
71return i.matrix[0][0]=s,i.matrix[0][1]=-r,i.matrix[1][0]=r,i.matrix[1][1]=s,i}scalarMultiplication(t){for(let i=0;i<2;i++)for(let s=0;s<2;s++)this.matrix[i][s]*=t}getTransposeMatrix(){let t=new yn;for(let i=0;i<2;i++)for(let s=0;s<2;s++)t.matrix[i][s]=this.matrix[s][i];return t}vectorMultiplication(t){let i=new k;return i.x=t.x*this.matrix[0][0]+t.y*this.matrix[0][1],i.y=t.x*this.matrix[1][0]+t.y*this.matrix[1][1],i}},Ua,Wr=vt.Flow,Ss=class Ci extends fa{constructor(t,i){super(),this.staffEntries=[],this.slur=t,this.rules=i}static Compare(t,i){if(t.staffEntries.length<1)return-1;if(i.staffEntries.length<1)return 1;let s=N.minus(t.staffEntries[t.staffEntries.length-1].getAbsoluteTimestamp(),t.staffEntries[0].getAbsoluteTimestamp()),r=N.minus(i.staffEntries[i.staffEntries.length-1].getAbsoluteTimestamp(),i.staffEntries[0].getAbsoluteTimestamp());return s.RealValue>r.RealValue?1:r.RealValue>s.RealValue?-1:0}calculateCurve(t){let i=this.staffEntries[0],s=this.staffEntries[this.staffEntries.length-1],r=i.findGraphicalNoteFromNote(this.slur.StartNote);!r&&this.graceStart&&(r=i.findGraphicalNoteFromGraceNote(this.slur.StartNote)),r||(r=i.findEndTieGraphicalNoteFromNoteWithStartingSlur(this.slur.StartNote,this.slur));let n=s.findGraphicalNoteFromNote(this.slur.EndNote);!n&&this.graceEnd&&(n=s.findGraphicalNoteFromGraceNote(this.slur.EndNote));let a=i.parentMeasure.ParentStaffLine,o=a.SkyBottomLineCalculator;this.calculatePlacement(o,a);let l=this.calculateStartAndEnd(r,n,a,t,o),h=l.startX,u=l.endX,c=l.startY,d=l.endY,f=t.SlurTangentMinAngle,p=t.SlurTangentMaxAngle,m;if(this.placement===C.Above){c-=t.SlurNoteHeadYOffset,d-=t.SlurNoteHeadYOffset;let g=new k(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,c);r?g.x+=this.staffEntries[0].PositionAndShape.BorderRight:g.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(g.x+=s.PositionAndShape.RelativePosition.x);let b=new k(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,d);if(n?b.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:b.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(b.x+=s.staffEntryParent.PositionAndShape.RelativePosition.x),m=this.calculateTopPoints(g,b,a,o),m.length===0){let it=new k((b.x-g.x)/2+g.x,(b.y-g.y)/2+g.y);m.push(it)}let S=Math.atan((d-c)/(u-h)),E=new k(0,0),y=new k(u-h,-(d-c)),M=Sn.getRotationMatrix(S),P=M.getTransposeMatrix();y=M.vectorMultiplication(y);let L=this.calculateTranslatedAndRotatedPointListAbove(m,h,c,M),B=this.calculateMaxLeftSlope(L,E,y),A=this.calculateMaxRightSlope(L,E,y),G=E.y-E.x*B,H=y.y-y.x*A,T=new k,I=!1;Math.abs(Math.abs(B)-Math.abs(A))<1e-4?(T.x=y.x/2,T.y=0,I=!0):(T.x=(H-G)/(B-A),T.y=B*T.x+G);let v=this.calculateHeightWidthRatio(y.x,L),U=f,dt=-f;if(!I){let it=this.calculateAngles(f,B,A,p);U=it.startAngle,dt=it.endAngle}let Y=this.calculateControlPoints(y.x,U,dt,L,v,c,d),at=Y.startControlPoint,X=Y.endControlPoint;at=P.vectorMultiplication(at),at.x+=h,at.y=-at.y+c,X=P.vectorMultiplication(X),X.x+=h,X.y=-X.y+c,this.bezierStartPt=new k(h,c-0),this.bezierStartControlPt=new k(at.x,at.y-0),this.bezierEndControlPt=new k(X.x,X.y-0),this.bezierEndPt=new k(u,d-0);let Z=a.SkyLine.length,O=o.getLeftIndexForPointX(this.bezierStartPt.x,Z),V=o.getLeftIndexForPointX(this.bezierEndPt.x,Z),ht=this.bezierEndPt.x-this.bezierStartPt.x,nt=o.SamplingUnit;for(let it=O;it<V;it++){let Ut=it/nt-this.bezierStartPt.x,jt=this.calculateCurvePointAtIndex(Math.abs(Ut)/ht),Mt=o.getLeftIndexForPointX(jt.x,Z);Mt>=O&&(a.SkyLine[Mt]=Math.min(a.SkyLine[Mt],jt.y)),Mt++,Mt<Z&&(a.SkyLine[Mt]=Math.min(a.SkyLine[Mt],jt.y))}}else{c+=t.SlurNoteHeadYOffset,d+=t.SlurNoteHeadYOffset;let g=new k(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,c);r?g.x+=this.staffEntries[0].PositionAndShape.BorderRight:g.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(g.x+=s.PositionAndShape.RelativePosition.x);let b=new k(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,d);if(n?b.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:b.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(b.x+=s.staffEntryParent.PositionAndShape.RelativePosition.x),m=this.calculateBottomPoints(g,b,a,o),m.length===0){let it=new k((b.x-g.x)/2+g.x,(b.y-g.y)/2+g.y);m.push(it)}let S=Math.atan((d-c)/(u-h)),E=new k(0,0),y=new k(u-h,d-c),M=Sn.getRotationMatrix(-S),P=M.getTransposeMatrix();y=M.vectorMultiplication(y);let L=this.calculateTranslatedAndRotatedPointListBelow(m,h,c,M),B=this.calculateMaxLeftSlope(L,E,y),A=this.calculateMaxRightSlope(L,E,y),G=E.y-E.x*B,H=y.y-y.x*A,T=new k,I=!1;Math.abs(Math.abs(B)-Math.abs(A))<1e-4?(T.x=y.x/2,T.y=0,I=!0):(T.x=(H-G)/(B-A),T.y=B*T.x+G);let v=this.calculateHeightWidthRatio(y.x,L),U=f,dt=-f;if(!I){let it=this.calculateAngles(f,B,A,p);U=it.startAngle,dt=it.endAngle}let Y=this.calculateControlPoints(y.x,U,dt,L,v,c,d),at=Y.startControlPoint,X=Y.endControlPoint;at=P.vectorMultiplication(at),at.x+=h,at.y+=c,X=P.vectorMultiplication(X),X.x+=h,X.y+=c,this.bezierStartPt=new k(h,c+0),this.bezierStartControlPt=new k(at.x,at.y+0),this.bezierEndControlPt=new k(X.x,X.y+0),this.bezierEndPt=new k(u,d+0);let Z=a.BottomLine.length,O=o.getLeftIndexForPointX(this.bezierStartPt.x,Z),V=o.getLeftIndexForPointX(this.bezierEndPt.x,Z),ht=this.bezierEndPt.x-this.bezierStartPt.x,nt=o.SamplingUnit;for(let it=O;it<V;it++){let Ut=it/nt-this.bezierStartPt.x,jt=this.calculateCurvePointAtIndex(Math.abs(Ut)/ht),Mt=o.getLeftIndexForPointX(jt.x,Z);Mt>=O&&(a.BottomLine[Mt]=Math.max(a.BottomLine[Mt],jt.y)),Mt++,Mt<Z&&(a.BottomLine[Mt]=Math.max(a.BottomLine[Mt],jt.y))}}}calculateStartAndEnd(t,i,s,r,n){let a=0,o=0,l=0,h=0;if(t){a=t.PositionAndShape.RelativePosition.x+t.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+t.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x,this.graceStart&&(a+=t.parentVoiceEntry.parentStaffEntry.staffEntryParent.PositionAndShape.RelativePosition.x);let u=t.parentVoiceEntry;this.placement===C.Above?(o=u.PositionAndShape.RelativePosition.y+u.PositionAndShape.BorderTop,this.rules.SlurPlacementUseSkyBottomLine&&(o=Math.min(h,u.parentStaffEntry.getSkylineMin()))):(o=u.PositionAndShape.RelativePosition.y+u.PositionAndShape.BorderBottom,this.rules.SlurPlacementUseSkyBottomLine&&(o=Math.max(h,u.parentStaffEntry.getBottomlineMax()))),u.parentVoiceEntry.StemDirection===Rt.Down&&this.placement===C.Below&&(a-=.5),u.parentVoiceEntry.StemDirection===Rt.Up&&this.placement===C.Above&&(a+=.5)}else a=0;if(i){l=i.PositionAndShape.RelativePosition.x+i.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+i.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x,this.graceEnd&&(l+=i.parentVoiceEntry.parentStaffEntry.staffEntryParent.PositionAndShape.RelativePosition.x);let u=i.parentVoiceEntry,c;for(let d of u.parentVoiceEntry.Articulations)if(c=d.placement,d.placement===C.NotYetDefined){for(let f of i.vfnote[0].modifiers)if(f.getCategory()===Wr.Articulation.CATEGORY){f.position===Wr.Modifier.Position.ABOVE?(d.placement=C.Above,c=C.Above):f.position===Wr.Modifier.Position.BELOW&&(d.placement=C.Below,c=C.Below);break}}this.placement===C.Above?(h=u.PositionAndShape.RelativePosition.y+u.PositionAndShape.BorderTop,this.rules.SlurPlacementUseSkyBottomLine&&(h=Math.min(h,u.parentStaffEntry.getSkylineMin())),c===C.Above&&(h-=this.rules.SlurEndArticulationYOffset)):(h=u.PositionAndShape.RelativePosition.y+u.PositionAndShape.BorderBottom,this.rules.SlurPlacementUseSkyBottomLine&&(h=Math.max(h,u.parentStaffEntry.getBottomlineMax())),c===C.Below&&(h+=this.rules.SlurEndArticulationYOffset)),u.parentVoiceEntry.StemDirection===Rt.Down&&this.placement===C.Below&&(l-=.5),u.parentVoiceEntry.StemDirection===Rt.Up&&this.placement===C.Above&&(l+=.5)}else l=s.PositionAndShape.Size.width;return!t&&!i&&(o=-1.5,h=-1.5),t||(o=this.placement===C.Above?h-1:h+1),i||(h=this.placement===C.Above?o-1:o+1),this.slur.startNoteHasMoreStartingSlurs()&&this.slur.isSlurLonger()&&(this.placement===C.Above?o-=r.SlursStartingAtSameStaffEntryYOffset:o+=r.SlursStartingAtSameStaffEntryYOffset),this.slur.endNoteHasMoreEndingSlurs()&&this.slur.isSlurLonger()&&(this.placement===C.Above?h-=r.SlursStartingAtSameStaffEntryYOffset:h+=r.SlursStartingAtSameStaffEntryYOffset),this.placement===C.Above?(o=Math.min(o,1.5),h=Math.min(h,1.5)):(o=Math.max(o,s.StaffHeight-1.5),h=Math.max(h,s.StaffHeight-1.5)),{startX:a,startY:o,endX:l,endY:h}}calculatePlacement(t,i){if(this.rules.SlurPlacementFromXML&&this.slur.PlacementXml!==C.NotYetDefined){this.placement=this.slur.PlacementXml;return}for(let a=0,o=this.staffEntries.length;a<o;++a)if(this.staffEntries[a].parentMeasure.hasMultipleVoices()){this.slur.StartNote.ParentVoiceEntry.ParentVoice instanceof ki||this.slur.EndNote.ParentVoiceEntry.ParentVoice instanceof ki?this.placement=C.Below:this.placement=C.Above;return}for(let a=0,o=this.staffEntries.length;a<o;++a)if(this.staffEntries[a].LyricsEntries.length>0){this.placement=C.Above;return}let s=this.staffEntries[0],r=this.staffEntries[this.staffEntries.length-1],n=s.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection;if(n===r.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection)this.placement=n===Rt.Up?C.Below:C.Above,this.rules.SlurPlacementAtStems&&(this.placement=n===Rt.Up?C.Above:C.Below);else{let a=s.PositionAndShape.BorderLeft+s.PositionAndShape.RelativePosition.x+s.parentMeasure.PositionAndShape.RelativePosition.x,o=r.PositionAndShape.BorderRight+r.PositionAndShape.RelativePosition.x+r.parentMeasure.PositionAndShape.RelativePosition.x;this.graceStart&&(a+=r.PositionAndShape.RelativePosition.x),this.graceEnd&&(o+=r.staffEntryParent.PositionAndShape.RelativePosition.x);let l=t.getSkyLineMinInRange(a,o)*-1;t.getBottomLineMaxInRange(a,o)-i.StaffHeight>l?this.placement=C.Above:this.placement=C.Below}}calculateTopPoints(t,i,s,r){let n=[],a=r.getRightIndexForPointX(t.x,s.SkyLine.length),o=r.getLeftIndexForPointX(i.x,s.SkyLine.length);a<0&&(a=0),o>=s.SkyLine.length&&(o=s.SkyLine.length-1);for(let l=a;l<o;l++){let h=s.SkyLine[l];
71if(h!==0){let u=new k((.5+l)/r.SamplingUnit,h);n.push(u)}}return n}calculateBottomPoints(t,i,s,r){let n=[],a=r.getRightIndexForPointX(t.x,s.BottomLine.length),o=r.getLeftIndexForPointX(i.x,s.BottomLine.length);a<0&&(a=0),o>=s.BottomLine.length&&(o=s.BottomLine.length-1);for(let l=a;l<o;l++){let h=s.BottomLine[l];if(h!==0){let u=new k((.5+l)/r.SamplingUnit,h);n.push(u)}}return n}calculateMaxLeftSlope(t,i,s){let r=-Number.MAX_VALUE,n=i.x,a=i.y;for(let o=0;o<t.length;o++)Math.abs(t[o].y-Number.MAX_VALUE)<1e-4||Math.abs(t[o].y- -Number.MAX_VALUE)<1e-4||(r=Math.max(r,(t[o].y-a)/(t[o].x-n)));return r=Math.max(r,Math.abs(s.y-a)/(s.x-n)),r=Math.min(r,5.6713),r}calculateMaxRightSlope(t,i,s){let r=Number.MAX_VALUE,n=s.x,a=s.y;for(let o=0;o<t.length;o++)Math.abs(t[o].y-Number.MAX_VALUE)<1e-4||Math.abs(t[o].y- -Number.MAX_VALUE)<1e-4||(r=Math.min(r,(a-t[o].y)/(n-t[o].x)));return r=Math.min(r,(a-i.y)/(n-i.x)),r=Math.max(r,-5.6713),r}getPointListMaxY(t){let i=-Number.MAX_VALUE;for(let s=0,r=t.length;s<r;++s){let n=t[s];Math.abs(n.y- -Number.MAX_VALUE)<1e-4||Math.abs(n.y-Number.MAX_VALUE)<1e-4||(i=Math.max(i,n.y))}return i}calculateTranslatedAndRotatedPointListAbove(t,i,s,r){let n=[];for(let a=0;a<t.length;a++){if(Math.abs(t[a].y-Number.MAX_VALUE)<1e-4||Math.abs(t[a].y- -Number.MAX_VALUE)<1e-4)continue;let o=new k(t[a].x-i,-(t[a].y-s));o=r.vectorMultiplication(o),n.push(o)}return n}calculateTranslatedAndRotatedPointListBelow(t,i,s,r){let n=[];for(let a=0;a<t.length;a++){if(Math.abs(t[a].y-Number.MAX_VALUE)<1e-4||Math.abs(t[a].y- -Number.MAX_VALUE)<1e-4)continue;let o=new k(t[a].x-i,t[a].y-s);o=r.vectorMultiplication(o),n.push(o)}return n}calculateHeightWidthRatio(t,i){return i.length===0?0:Math.max(0,this.getPointListMaxY(i))/t}calculateControlPoints(t,i,s,r,n,a,o){let l=this.rules.SlurHeightFactor,h=1,u=this.rules.SlurHeightFlattenLongSlursCutoffAngle,c=this.rules.SlurHeightFlattenLongSlursCutoffWidth;i>u&&t>c&&(h+=t/70*this.rules.SlurHeightFlattenLongSlursFactorByWidth,h*=1+i/30*this.rules.SlurHeightFlattenLongSlursFactorByAngle,l/=h);let d=Math.min(.5,Math.max(.1,1.7*i/80*l*Math.max(n,.05)**.4)),f=Math.min(.5,Math.max(.1,1.7*-s/80*l*Math.max(n,.05)**.4)),p=new k;p.x=t*d*Math.cos(i*Ci.degreesToRadiansFactor),p.y=t*d*Math.sin(i*Ci.degreesToRadiansFactor);let m=new k;m.x=t-t*f*Math.cos(s*Ci.degreesToRadiansFactor),m.y=-(t*f*Math.sin(s*Ci.degreesToRadiansFactor));let g=p.y-m.y;for(;this.rules.SlurMaximumYControlPointDistance&&Math.abs(g)>this.rules.SlurMaximumYControlPointDistance;)g<0?(p.y+=1,--m.y):(--p.y,m.y+=1),g=p.y-m.y;return{startControlPoint:p,endControlPoint:m}}calculateAngles(t,i,s,r){let n=Math.atan(i)/Ci.degreesToRadiansFactor;i>0?n+=20:n-=20;let a=Math.atan(s)/Ci.degreesToRadiansFactor;return s<0?a-=20:a+=20,{startAngle:Math.min(Math.max(t,n),r),endAngle:Math.max(Math.min(-t,a),-r)}}};Ua=Ss,Ua.degreesToRadiansFactor=Math.PI/180;var Uu=class extends ue{constructor(e,t){super(),this.getPedal=e,this.setSymbol(),this.PositionAndShape=new Yt(this,t)}setSymbol(){!this.getPedal.IsLine&&this.getPedal.IsSign?this.pedalSymbol=Ce.PEDAL_SYMBOL:this.getPedal.IsLine&&this.getPedal.IsSign?this.pedalSymbol=Ce.PEDAL_MIXED:this.pedalSymbol=Ce.PEDAL_BRACKET}},Ur=class extends Uu{constructor(e,t,i=!1,s=!1){switch(super(e,t),this.vfStyle=vt.Flow.PedalMarking.Styles.BRACKET,this.ChangeBegin=!1,this.ChangeEnd=!1,this.line=-3,this.EndSymbolPositionAndShape=void 0,this.ChangeBegin=e.ChangeBegin,this.ChangeEnd=e.ChangeEnd,this.pedalSymbol){case Ce.PEDAL_SYMBOL:this.vfStyle=vt.Flow.PedalMarking.Styles.TEXT,this.EndSymbolPositionAndShape=new Yt(this,t);break;case Ce.PEDAL_MIXED:i&&s?this.vfStyle=vt.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:i?this.vfStyle=vt.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:s?this.vfStyle=vt.Flow.PedalMarking.Styles.MIXED_OPEN_END:this.vfStyle=vt.Flow.PedalMarking.Styles.MIXED;break;case Ce.PEDAL_BRACKET:default:i&&s?this.vfStyle=vt.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:i?this.vfStyle=vt.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:s?this.vfStyle=vt.Flow.PedalMarking.Styles.BRACKET_OPEN_END:this.vfStyle=vt.Flow.PedalMarking.Styles.BRACKET;break}}setStartNote(e){if(!e)return!1;for(let t of e.graphicalVoiceEntries){let i=t;if(i?.vfStaveNote)return this.startNote=i.vfStaveNote,this.startVfVoiceEntry=i,!0}return!1}setEndNote(e){if(!e)return!1;for(let t of e.graphicalVoiceEntries){let i=t;
71if(i?.vfStaveNote)return this.endNote=i.vfStaveNote,this.endVfVoiceEntry=i,!0}return!1}setEndMeasure(e){this.endMeasure=e}CalculateBoundingBox(){}setLine(e){this.line=e}getPedalMarking(){let e=new vt.Flow.PedalMarking([this.startNote,this.endNote]);return this.endMeasure&&e.setEndStave(this.endMeasure.getVFStave()),e.setStyle(this.vfStyle),e.setLine(this.line),e.setCustomText(this.DepressText,this.ReleaseText),(!this.endVfVoiceEntry||this.getPedal.EndsStave)&&(e.EndsStave=!0),this.getPedal.BeginsStave&&(e.BeginsStave=!0),e.ChangeBegin=this.ChangeBegin,e.ChangeEnd=this.ChangeEnd,e}setEndsStave(e,t){t?.gte(e.parentSourceMeasure.Duration)&&(this.getPedal.EndsStave=!0)}setBeginsStave(e,t){e&&t.RealValue===0&&(this.getPedal.BeginsStave=!0)}},za,yi=vt.Flow,ys=class Ml extends Xt{constructor(t){super(),this.beamsNeedUpdate=!1,this.rules=t,Xt.symbolFactory=new yl,Xt.TextMeasurer=new ca(this.rules),Xt.stafflineNoteCalculator=new gn(this.rules),this.rules.DefaultVexFlowNoteFont?.toLowerCase()==="gonville"?vt.Flow.DEFAULT_FONT_STACK=[vt.Flow.Fonts?.Gonville,vt.Flow.Fonts?.Bravura,vt.Flow.Fonts?.Custom]:this.rules.DefaultVexFlowNoteFont?.toLowerCase()==="petaluma"&&(vt.Flow.DEFAULT_FONT_STACK=[vt.Flow.Fonts?.Petaluma,vt.Flow.Fonts?.Gonville,vt.Flow.Fonts?.Bravura])}clearRecreatedObjects(){super.clearRecreatedObjects(),Xt.stafflineNoteCalculator=new gn(this.rules);for(let t of this.graphicalMusicSheet.MeasureList)for(let i of t)i?.clean()}formatMeasures(){for(let t of this.graphicalMusicSheet.MeasureList)if(!(!t||!t[0])){t.find(i=>i?.isVisible()).format();for(let i of t){for(let s of i.staffEntries)s.calculateXPosition();i.finalizeBeams()}}this.beamsNeedUpdate=!1}calculateMeasureXLayout(t){let i=[];for(let u of t)u?.isVisible()&&i.push(u);if(i.length===0)return 0;t=i;let s=[],r=new yi.Formatter({softmaxFactor:this.rules.SoftmaxFactorVexFlow}),n=t[0].staffEntries.length,a=1;for(let u of t){if(!u)continue;let c=0;for(let p of u.staffEntries)c+=p.setMaxAccidentals();u.parentSourceMeasure.ImplicitMeasure&&(n=Math.max(u.staffEntries.length,n),a=Math.max(u.staffEntries.length+c,a));let d=u.vfVoices,f=[];for(let p in d)if(d.hasOwnProperty(p)){let m=d[p];u.hasOnlyRests&&!m.ticksUsed.equals(m.totalTicks)&&(m.ticksUsed=m.totalTicks),f.push(m),s.push(m)}if(f.length===0){W.default.debug("Found a measure with no voices. Continuing anyway.",d);continue}r.joinVoices(f)}let o=12,l=t[0].parentSourceMeasure,h=.3;if(s.length>0){if(o=r.preCalculateMinTotalWidth(s)/10*this.rules.VoiceSpacingMultiplierVexflow+this.rules.VoiceSpacingAddendVexflow+n*h,l?.ImplicitMeasure){o=l.Duration.RealValue/l.ActiveTimeSignature.RealValue*o;let d=0,f=l.measureListIndex;if(f>1)for(let p of this.graphicalMusicSheet.MeasureList[f-1]){let m=p?.parentSourceMeasure.endingBarStyleEnum;if(m===ft.ThinBold||m===ft.DotsThinBold){d=this.rules.PickupMeasureRepetitionSpacing;break}}o+=d,n>1?o+=a*h*1.5:f>1&&n===1&&(o+=this.rules.PickupMeasureSpacingSingleNoteAddend),o*=this.rules.PickupMeasureWidthMultiplier}Xt.setMeasuresMinStaffEntriesWidth(t,o);let u=(d,f)=>{r.formatToStave(s,f.getVFStave())},c=(d,f)=>{r.formatToStave(s,f.getVFStave(),{align_rests:!0,context:void 0})};for(let d of t){if(this.rules.AlignRests===ms.Never)d.formatVoices=u;else if(this.rules.AlignRests===ms.Always)d.formatVoices=c;else if(this.rules.AlignRests===ms.Auto){let f=!1;for(let p of d.staffEntries){let m=0,g=0;for(let b of p.graphicalVoiceEntries)if(b.parentVoiceEntry.IsGrace||b&&b.notes&&b.notes[0]&&b.notes[0].sourceNote&&b.notes[0].sourceNote.PrintObject&&m++,b&&b.notes&&b.notes[0]&&b.notes[0].sourceNote&&b.notes[0].sourceNote.isRest()&&b.notes[0].sourceNote.PrintObject&&g++,m>1&&g>=1){f=!0;break}if(f)break}f?d.formatVoices=c:d.formatVoices=u}if(d===t[0]){let f=d;f.formatVoices(o*10,f)}}}for(let u of t)if(u)for(let c of u.staffEntries)c.calculateXPosition();for(let u of t){if(!u)continue;let c=u.vfVoices,d=[];for(let f in c)c.hasOwnProperty(f)&&d.push(c[f]);if(d.length===0){W.default.debug("Found a measure with no voices. Continuing anyway.",c);continue}r.joinVoices(d)}return o}calculateElongationFactor(t,i,s,r,n,a,o,l){let h=n,u=0;for(let c of t){let d=c.GraphicalLabel.Label.textAlignment,f=o,p=l;if(c instanceof Mi&&c.ParentLyricWord){c.LyricsEntry.SyllableIndex>0&&(f=this.rules.BetweenSyllableMinimumDistance,Gs.IsCenterAligned(d)&&(f+=1));let H=c.ParentLyricWord.GetLyricWord.Syllables;H.length>1&&c.LyricsEntry.SyllableIndex<H.length-1&&(this.dashSpace===void 0&&(this.dashSpace=1.5),p-=this.dashSpace)}let m=c instanceof Mi?c.GraphicalLabel.PositionAndShape:c.PositionAndShape,g=m.Size.width,b=i.PositionAndShape.RelativePosition.x+m.BorderLeft;c instanceof da&&c.PositionAndShape.Parent.DataObject instanceof Ni&&(b=this.rules.ChordSymbolWholeMeasureRestXOffset+m.BorderMarginLeft+c.PositionAndShape.Parent.DataObject.beginInstructionsWidth),s[u]!==void 0&&s[u].extend;let S,E;s[u]&&(E=b-s[u].xPosition);let y,M,P=r*n;Gs.IsCenterAligned(d)?(p/=4,y=P-b,M=g/2-p,s[u]&&(S=s[u].labelWidth/2+g/2+f)):Gs.IsLeft(d)&&(y=P-b,M=g-p,s[u]&&(S=s[u].labelWidth+f));let L=1,B=M/y,A=1;if(c instanceof Mi&&c.LyricsEntry){if(s[u]){let H=s[u].sourceNoteDuration;A=S/E,H.Denominator>4&&(A*=1.1)}}else s[u]&&(A=S/E);L=Math.max(B,A),h=Math.max(h,L);
71let G=Math.max(S-E||0,0);s[u]&&(G+=s[u].cumulativeOverlap),s[u]={cumulativeOverlap:G,extend:c instanceof Mi?c.LyricsEntry.extend:!1,labelWidth:g,measureNumber:a,sourceNoteDuration:c instanceof Mi?c.LyricsEntry&&c.LyricsEntry.Parent.Notes[0].Length:!1,text:c instanceof Mi?c.LyricsEntry.Text:c.GraphicalLabel.Label.text,xPosition:b},u++}return h}calculateElongationFactorFromStaffEntries(t,i,s,r){let n=s,a={},o={};for(let l of t)l.LyricsEntries.length>0&&this.rules.RenderLyrics&&(n=this.calculateElongationFactor(l.LyricsEntries,l,a,i,n,r,this.rules.HorizontalBetweenLyricsDistance,this.rules.LyricOverlapAllowedIntoNextMeasure)),l.graphicalChordContainers.length>0&&this.rules.RenderChordSymbols&&(n=this.calculateElongationFactor(l.graphicalChordContainers,l,o,i,n,r,this.rules.ChordSymbolXSpacing,this.rules.ChordOverlapAllowedIntoNextMeasure));return n}calculateMeasureWidthFromStaffEntries(t,i){let s=1;for(let r of t)!r||r.staffEntries.length===0||!r.isVisible()||(s=this.calculateElongationFactorFromStaffEntries(r.staffEntries,i,s,r.MeasureNumber));return s=Math.min(s,this.rules.MaximumLyricsElongationFactor),i*s}createGraphicalTie(t,i,s,r,n){return new El(t,r,n)}updateStaffLineBorders(t){t.SkyBottomLineCalculator.updateStaffLineBorders()}graphicalMeasureCreatedCalculations(t){t.rules=this.rules,t.graphicalMeasureCreatedCalculations()}layoutVoiceEntry(t,i,s,r){for(let n=0;n<i.length;n++)i[n]=Xt.stafflineNoteCalculator.positionNote(i[n])}layoutStaffEntry(t){t.parentMeasure.layoutStaffEntry(t)}initGraphicalMeasuresCreation(){}layoutArticulationMarks(t,i,s){}layoutGraphicalTie(t,i,s){let r=t.StartNote,n=t.EndNote,a,o=0;r&&r.vfnote&&r.vfnote.length>=2&&(a=r.vfnote[0],o=r.vfnote[1]);let l,h=0;if(n&&n.vfnote&&n.vfnote.length>=2&&(l=n.vfnote[0],h=n.vfnote[1]),i){if(a){let u=new yi.StaveTie({first_indices:[o],first_note:a});r.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(u,t)}if(l){let u=new yi.StaveTie({last_indices:[h],last_note:l});n.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(u,t)}}else if(a||l){let u;if(s)if(t.Tie.Type==="S"){let c=t.StartNote.sourceNote,d=t.EndNote.sourceNote,f=1;c.FretNumber>d.FretNumber&&(f=-1),u=new yi.TabSlide({first_indices:[o],first_note:a,last_indices:[h],last_note:l},f)}else u=new yi.TabTie({first_indices:[o],first_note:a,last_indices:[h],last_note:l},t.Tie.Type);else{u=new yi.StaveTie({first_indices:[o],first_note:a,last_indices:[h],last_note:l});let c=t.Tie.getTieDirection(r.sourceNote);c===C.Below?u.setDirection(1):c===C.Above&&u.setDirection(-1)}n.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(u,t)}}calculateDynamicExpressionsForMultiExpression(t,i,s){if(i<this.rules.MinMeasureToDrawIndex||i>this.rules.MaxMeasureToDrawIndex)return;let r=t.AbsoluteTimestamp,n=this.graphicalMusicSheet.MeasureList[i],a=n[s].ParentStaffLine,o=n[s],l=t.StartingContinuousDynamic,h=l!==void 0&&!l.IsStartOfSoftAccent,u=this.getRelativePositionInStaffLineFromTimestamp(r,s,a,a?.isPartOfMultiStaffInstrument(),void 0,h);if(u.x<=0&&(u.x=o.beginInstructionsWidth+this.rules.RhythmRightMargin),t.InstantaneousDynamic){let c=new ol(t.InstantaneousDynamic,a,o);this.calculateGraphicalInstantaneousDynamicExpression(c,u,r),this.dynamicExpressionMap.set(r.RealValue,c.PositionAndShape)}if(l){let c=new Tr(l,a,o.parentSourceMeasure);if(c.StartMeasure=o,c.IsSoftAccent=t.StartingContinuousDynamic.IsStartOfSoftAccent,!c.IsVerbal&&l.EndMultiExpression)try{this.calculateGraphicalContinuousDynamic(c,u),c.updateSkyBottomLine()}catch{}else c.IsVerbal?this.calculateGraphicalVerbalContinuousDynamic(c,u):W.default.warn("This continuous dynamic is not covered. measure"+t.SourceMeasureParent.MeasureNumber)}}createMetronomeMark(t){let i=t.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber,s=Math.max(t.StaffNumber-1,0),r=this.graphicalMusicSheet.findGraphicalMeasureByMeasureNumber(i,s),n=r===this.graphicalMusicSheet.MeasureList[0][0];if(r.hasMetronomeMark)return;let a=r.getVFStave(),o="q";if(t.beatUnit){let d=Zi.getNoteDurationFromType(t.beatUnit);o=Ht.durations(d,!1)[0]}let l=this.rules.MetronomeMarkYShift,h=!1;for(let d of t.parentMeasure.TempoExpressions){let f=d.InstantaneousTempo?.TempoType===Wt.metronomeMark;if(d.getPlacementOfFirstEntry()===C.Above&&!f){h=!0;break}}h&&(l-=1.4);let u=this.graphicalMusicSheet.MeasureList[0][0].ParentStaffLine?.SkyLine;a.setTempo({bpm:t.TempoInBpm,dots:t.dotted,duration:o},l*10);let c=n?this.rules.MetronomeMarkXShift*10:0;a.getModifiers()[a.getModifiers().length-1].setShiftX(c),r.hasMetronomeMark=!0,u&&(u[0]=Math.min(u[0],-4.5+l))}calculateRehearsalMark(t){let i=t.rehearsalExpression;if(!i)return;let s=this.graphicalMusicSheet.MeasureList[0][0].MeasureNumber,r=Math.max(t.MeasureNumber-s,0);for(let n of this.graphicalMusicSheet.MeasureList[r]){let a=n?.getVFStave();if(!a||!n.isVisible())continue;let o=-this.rules.RehearsalMarkYOffsetDefault-this.rules.RehearsalMarkYOffset;n.parentSourceMeasure.isReducedToMultiRest&&(o+=this.rules.RehearsalMarkYOffsetAddedForRehearsalMarks);let l=this.rules.RehearsalMarkXOffsetDefault+this.rules.RehearsalMarkXOffset;t.IsSystemStartMeasure&&(l+=this.rules.RehearsalMarkXOffsetSystemStartMeasure);let h=this.rules.RehearsalMarkFontSize;a.setSection(i.label,o,l,h);return}}calculateSingleOctaveShift(t,i,s,r){let n=i.OctaveShiftStart,a=n.ParentStartMultiExpression.Timestamp,o=n.ParentEndMultiExpression?.Timestamp,l=this.rules.MinMeasureToDrawIndex,h=this.rules.MaxMeasureToDrawIndex,u=this.graphicalMusicSheet.MeasureList[s][r].ParentStaffLine;u||(u=this.graphicalMusicSheet.MeasureList[l][r].ParentStaffLine);let c;c=n.ParentEndMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(n.ParentEndMultiExpression.SourceMeasureParent,r):this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(r,!0),c.MeasureNumber>h+1&&(c=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(r,!0));let d;if(d=n.ParentStartMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(n.ParentStartMultiExpression.SourceMeasureParent,r):this.graphicalMusicSheet.MeasureList[l][r],d.MeasureNumber<l+1&&(d=this.graphicalMusicSheet.MeasureList[l][r]),d.MeasureNumber<l+1||d.MeasureNumber>h+1||c.MeasureNumber<l+1||c.MeasureNumber>h+1)return;let f=c.ParentStaffLine;if(f||(f=u),c&&u&&f){let p=new pn(n,u.PositionAndShape);if(!p.startNote){let b;for(let S of d.staffEntries)if(S){b=S;break}if(!b||(p.setStartNote(b),!p.startNote))return}if(!p.endNote){let b;for(let S=c.staffEntries.length-1;S>=0;S++)if(c.staffEntries[S]){b=c.staffEntries[S];break}if(!b){p.graphicalEndAtMeasureEnd=!0;return}if(p.setEndNote(b),!p.endNote)return}let m=d.findGraphicalStaffEntryFromTimestamp(a);m||(m=d.staffEntries[0]);let g=c.findGraphicalStaffEntryFromTimestamp(o);if(!g)for(let b=c.staffEntries.length-1;b>=0;b--){let S=c.staffEntries[b];if(S.relInMeasureTimestamp?.lte(o)){g=S;break}}if(g||(g=c.staffEntries[c.staffEntries.length-1]),p.setStartNote(m),f!==u){p.endsOnDifferentStaffLine=!0;let b=this.findLastStafflineMeasure(u);b===void 0&&(b=c);let S=b.staffEntries[b.staffEntries.length-1];if(p.setEndNote(S),p.graphicalEndAtMeasureEnd=!0,p.endMeasure=b,f.ParentMusicSystem.Id-u.ParentMusicSystem.Id>0)for(let E=u.ParentMusicSystem.Id;E<f.ParentMusicSystem.Id;E++){let y=E+1,M=this.musicSystems[y],P;for(let I of M.StaffLines)if(I.ParentStaff.idInMusicSheet===r){P=I;break}if(!P)continue;let L=P.Measures[0],B=new pn(n,L.PositionAndShape),A=this.findLastStafflineMeasure(P);E<f.ParentMusicSystem.Id-1&&(B.endsOnDifferentStaffLine=!0,B.graphicalEndAtMeasureEnd=!0,B.endMeasure=A);let G=L.staffEntries[0],H=A.staffEntries[A.staffEntries.length-1];c.ParentStaffLine===P&&(A=c,H=g),H.graphicalVoiceEntries.length===1&&H.graphicalVoiceEntries[0].notes.length===1&&H.graphicalVoiceEntries[0].notes[0].sourceNote.isWholeMeasureNote()&&(B.graphicalEndAtMeasureEnd=!0,B.endMeasure=A);let T="VexFlowMusicSheetCalculator.calculateSingleOctaveShift: ";G||W.default.warn(T+"no firstNote found"),H||W.default.warn(T+"no lastNote found"),B.setStartNote(G),B.setEndNote(H),P.OctaveShifts.push(B),this.calculateOctaveShiftSkyBottomLine(G,H,B,P)}this.calculateOctaveShiftSkyBottomLine(m,S,p,u)}else p.setEndNote(g),this.calculateOctaveShiftSkyBottomLine(m,g,p,u);u.OctaveShifts.push(p)}else W.default.warn("End measure or staffLines for octave shift are undefined! This should not happen!")}findLastStafflineMeasure(t){for(let i=t.Measures.length-1;i>=0;i--){let s=t.Measures[i];if(s.staffEntries.length>0)return s}}calculateSinglePedal(t,i,s,r){let n=i.PedalStart,a=n.ParentStartMultiExpression.Timestamp,o=n.ParentEndMultiExpression?.Timestamp,l=this.rules.MinMeasureToDrawIndex,h=this.rules.MaxMeasureToDrawIndex,u=this.graphicalMusicSheet.MeasureList[s][r].ParentStaffLine;u||(u=this.graphicalMusicSheet.MeasureList[l][r].ParentStaffLine);let c;c=n.ParentEndMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(n.ParentEndMultiExpression.SourceMeasureParent,r):this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(r,!0),c.MeasureNumber>h+1&&(c=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(r,!0));let d;if(n.ParentEndMultiExpression?d=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(n.ParentStartMultiExpression.SourceMeasureParent,r):(d=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(n.ParentStartMultiExpression.SourceMeasureParent,r),d||(d=this.graphicalMusicSheet.MeasureList[l][r])),d.MeasureNumber<l+1&&(d=this.graphicalMusicSheet.MeasureList[l][r]),d.parentSourceMeasure.measureListIndex<l||d.parentSourceMeasure.measureListIndex>h||c.parentSourceMeasure.measureListIndex<l||c.parentSourceMeasure.measureListIndex>h)return;let f=c.ParentStaffLine;if(f||(f=u),c&&u&&f){let p=!1;u!==f&&(p=!0);let m=new Ur(n,u.PositionAndShape,!1,p);m.setEndsStave(c,o);let g=d.findGraphicalStaffEntryFromTimestamp(a);g||(g=d.staffEntries[0]);let b=c.findGraphicalStaffEntryFromTimestamp(o);if(b||(b=c.staffEntries[c.staffEntries.length-1]),!m.setStartNote(g))return;if(m.setBeginsStave(m.startNote.isRest(),a),f!==u)if(m.pedalSymbol===Ce.PEDAL_SYMBOL){m.setEndNote(b),m.setEndMeasure(c),m.ReleaseText=" ",m.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(m.startVfVoiceEntry,m.endVfVoiceEntry,m,u);let S=f.Measures[0],E=new Ur(n,S.PositionAndShape);m.setEndsStave(c,o);let y=S.staffEntries[0];if(!E.setStartNote(y))return;E.setEndNote(b),E.setEndMeasure(c),m.setEndMeasure(c),f.Pedals.push(E),E.CalculateBoundingBox(),E.DepressText=" ",this.calculatePedalSkyBottomLine(E.startVfVoiceEntry,E.endVfVoiceEntry,E,f)}else{let S=this.findLastStafflineMeasure(u);S===void 0&&(S=c);let E=S.staffEntries[S.staffEntries.length-1];m.setEndNote(E),m.setEndMeasure(c),m.ChangeEnd=!1;let y=f.ParentMusicSystem.Id-u.ParentMusicSystem.Id;if(y>0){let M=1;for(let P=u.ParentMusicSystem.Id;P<f.ParentMusicSystem.Id;P++){let L=this.musicSystems[P+1].StaffLines[r],B=L.Measures[0],A=!1,G=!1;M<y?A=!0:G=!0,M++;let H=new Ur(n,B.PositionAndShape,!0,A);m.setEndsStave(c,o),H.ChangeBegin=!1,G?H.ChangeEnd=n.ChangeEnd:H.ChangeEnd=!1;let T=this.findLastStafflineMeasure(L),I=B.staffEntries[0],v=T.staffEntries[T.staffEntries.length-1];if(c.ParentStaffLine===L?(T=c,H.setEndMeasure(c),v=b):H.setEndMeasure(L.Measures.last(
71)),!H.setStartNote(I))break;H.setEndNote(v),m.setEndMeasure(c),L.Pedals.push(H),H.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(H.startVfVoiceEntry,H.endVfVoiceEntry,H,L)}}m.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(m.startVfVoiceEntry,m.endVfVoiceEntry,m,u)}else m.setEndNote(b),m.setEndMeasure(c),m.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(m.startVfVoiceEntry,m.endVfVoiceEntry,m,u);u.Pedals.push(m)}else W.default.warn("End measure or staffLines for pedal are undefined! This should not happen!")}calculatePedalSkyBottomLine(t,i,s,r){let n=i?.PositionAndShape;n||(n=s.endMeasure.PositionAndShape);let a=vt.Flow.PedalMarking.Styles,o=s.getPedalMarking(),l=o.line+3+(r.StaffLines.length-1),h=o.render_options.text_margin_right/10,u=t.PositionAndShape.AbsolutePosition.x-h;(o.style===a.MIXED||o.style===a.MIXED_OPEN_END||o.style===a.TEXT)&&--u;let c,d=r.StaffLines.length-1;for(let f of r.Pedals){let p=f.getPedalMarking().line+3+(r.StaffLines.length-1);d=Math.max(p,d)}if(s.EndSymbolPositionAndShape){let f=o.render_options.glyph_point_size/20;c=u+3.4;let p=n.AbsolutePosition.x-h,m=p+1.5;d=Math.max(r.SkyBottomLineCalculator.getBottomLineMaxInRange(u,c),d),d=Math.max(l+f*2,d);let g=r.SkyBottomLineCalculator.getBottomLineMaxInRange(p,m);s.DepressText||(d=Math.max(d,g)),s.setLine(d-3-(r.StaffLines.length-1)),r.SkyBottomLineCalculator.updateBottomLineInRange(u,c,d+f),r.SkyBottomLineCalculator.updateBottomLineInRange(p,m,d+f)}else{let f=o.render_options.bracket_height/10;if(o.EndsStave)c=i?i.parentStaffEntry.parentMeasure.PositionAndShape.AbsolutePosition.x+i.parentStaffEntry.parentMeasure.PositionAndShape.Size.width-h:n.AbsolutePosition.x+n.Size.width;else switch(o.style){case a.BRACKET_OPEN_END:case a.BRACKET_OPEN_BOTH:case a.MIXED_OPEN_END:c=n.AbsolutePosition.x+n.BorderRight-h;break;default:c=n.AbsolutePosition.x+n.BorderLeft-h;break}let p=i?.parentStaffEntry?.vfClefBefore;if(p){let m=p.getWidth()/10;c+=m}if(d=Math.max(r.SkyBottomLineCalculator.getBottomLineMaxInRange(u,c),d),d===1/0)return;if(d=Math.max(d,l+f),s.setLine(d-3-(r.StaffLines.length-1)),u>c){let m=c;c=u,u=m}r.SkyBottomLineCalculator.updateBottomLineInRange(u,c,d+f)}for(let f of r.Pedals){let p=f,m=p.getPedalMarking(),g=m.line+3+(r.StaffLines.length-1);if(d>g){let b=m.render_options.text_margin_right/10,S=p.startVfVoiceEntry.PositionAndShape.AbsolutePosition.x-b,E;p.setLine(d-3-(r.StaffLines.length-1));let y=p.endVfVoiceEntry?.PositionAndShape;if(y||(y=p.endMeasure.PositionAndShape),p.EndSymbolPositionAndShape){let M=o.render_options.glyph_point_size/20;E=S+3.4;let P=y.AbsolutePosition.x-b,L=P+1.5;r.SkyBottomLineCalculator.updateBottomLineInRange(S,E,d+M),r.SkyBottomLineCalculator.updateBottomLineInRange(P,L,d+M)}else{let M=m.render_options.bracket_height/10;if(m.EndsStave)E=y.AbsolutePosition.x+y.Size.width-b;else switch(o.style){case a.BRACKET_OPEN_END:case a.BRACKET_OPEN_BOTH:case a.MIXED_OPEN_END:E=y.AbsolutePosition.x+y.BorderRight-b;break;default:E=y.AbsolutePosition.x+y.BorderLeft-b;break}let P=p.endVfVoiceEntry?.parentStaffEntry?.vfClefBefore;if(P){let L=P.getWidth()/10;E+=L}if(S>E){let L=S;S=E,E=L}r.SkyBottomLineCalculator.updateBottomLineInRange(S,E,d+M)}}}}calculateOctaveShiftSkyBottomLine(t,i,s,r){if(!i){W.default.warn("octaveshift: no endStaffEntry");return}let n=i.PositionAndShape;s.graphicalEndAtMeasureEnd&&(n=i.parentMeasure.PositionAndShape);let a=t.PositionAndShape.Size.width,o=n.Size.width;t.hasOnlyRests()?a=-a:a/=2,s.graphicalEndAtMeasureEnd||(i.hasOnlyRests()?o*=2:o/=2,t===i&&(o*=2));let l=t.PositionAndShape.AbsolutePosition.x-a,h=n.AbsolutePosition.x+o;if(l>h){let d=l;l=h,h=d}s.PositionAndShape.Size.width=h-l;let u=s.getTextBracket(),c=u.font.size/10;if(u.position===yi.TextBracket.Positions.TOP){let d=Math.ceil(r.SkyBottomLineCalculator.getSkyLineMinInRange(l,h));if(d===1/0)return;u.start.getStave().options.top_text_position=Math.abs(d),r.SkyBottomLineCalculator.updateSkyLineInRange(l,h,d-c*2)}else{let d=r.SkyBottomLineCalculator.getBottomLineMaxInRange(l,h);if(d===1/0)return;u.start.getStave().options.bottom_text_position=d,r.SkyBottomLineCalculator.updateBottomLineInRange(l,h,d+c*1.5)}}calculateWordRepetitionInstruction(t,i){let s,r=this.graphicalMusicSheet.MeasureList[i];for(let n=0,a=r.length;n<a;++n){let o=r[n];if(o&&o.ParentStaffLine&&o.ParentStaff.isVisible()){s=o;break}}s&&s.addWordRepetition(t)}async calculateSkyBottomLinesAsync(t){let i=Le.flat(this.musicSystems.map(o=>o.StaffLines)),s=this.countRenderedMeasures(i);if(this.rules.AlwaysSetPreferredSkyBottomLineBackendAutomatically&&this.rules.setPreferredSkyBottomLineBackendAutomatically(s),s<this.rules.SkyBottomLineBatchMinMeasures){for(let o of i)o.SkyBottomLineCalculator.calculateLines();return}let r=[],n=0,a=()=>{r.length!==0&&(new Ga(r,this.rules.PreferredSkyBottomLineBatchCalculatorBackend).calculateLines(),r=[],n=0)};for(let o of i)r.push(o),n+=o.Measures.length,n>=Ml.MaxMeasuresPerSkyBottomLineBatch&&(a(),await t());a()}countRenderedMeasures(t){let i=0;for(let s of t)for(let r of s.Measures)r&&i++;return i}calculateSkyBottomLines(){let t=Le.flat(this.musicSystems.map(s=>s.StaffLines)),i=this.countRenderedMeasures(t);if(this.rules.AlwaysSetPreferredSkyBottomLineBackendAutomatically&&this.rules.setPreferredSkyBottomLineBackendAutomatically(i),i>=this.rules.SkyBottomLineBatchMinMeasures)new Ga(t,this.rules.PreferredSkyBottomLineBatchCalculatorBackend).calculateLines();else for(let s of t)s.SkyBottomLineCalculator.calculateLines()}calculateExpressionAlignements(){for(let t of this.musicSystems)for(let i of t.StaffLines)try{i.AlignmentManager.alignDynamicExpressions(),i.AbstractExpressions.forEach(s=>{s.updateSkyBottomLine()})}catch{}}handleTiedGraphicalNote(t,i,s,r,n,a,o,l){}handleBeam(t,i,s){t.parentVoiceEntry.parentStaffEntry.parentMeasure.handleBeam(t,i)}
71handleVoiceEntryLyrics(t,i,s){t.LyricsEntries.forEach((r,n)=>{let a=new Mi(n,i,this.rules.LyricsHeight,this.rules.StaffHeight);if(i.LyricsEntries.push(a),a.GraphicalLabel.setLabelPositionAndShapeBorders(),n.Word){let o=n.Word.Syllables.indexOf(n),l=s.indexOf(n.Word);if(l===-1&&(s.push(n.Word),l=s.indexOf(n.Word)),this.graphicalLyricWords.length===0||l>this.graphicalLyricWords.length-1){let h=new vl(n.Word);a.ParentLyricWord=h,h.GraphicalLyricsEntries[o]=a,this.graphicalLyricWords.push(h)}else{let h=this.graphicalLyricWords[l];a.ParentLyricWord=h,h.GraphicalLyricsEntries[o]=a,h.isFilled()&&(s.splice(l,1),this.graphicalLyricWords.splice(this.graphicalLyricWords.indexOf(h),1))}}})}handleVoiceEntryOrnaments(t,i,s){}handleVoiceEntryArticulations(t,i,s){}handleVoiceEntryTechnicalInstructions(t,i,s){}handleTuplet(t,i,s){t.parentVoiceEntry.parentStaffEntry.parentMeasure.handleTuplet(t,i)}findIndexGraphicalSlurFromSlur(t,i){for(let s=0;s<t.length;s++)if(t[s].slur===i)return s;return-1}indexOfGraphicalGlissFromGliss(t,i){for(let s=0;s<t.length;s++)if(t[s].Glissando===i)return s;return-1}calculateSlurs(){let t={};for(let i of this.graphicalMusicSheet.MeasureList[0])t[i.ParentStaff.idInMusicSheet]=[];for(let i of this.musicSystems)for(let s of i.StaffLines){let r=t[s.ParentStaff.idInMusicSheet];for(let n=0;n<r.length;n++){let a=r[n],o=new Ss(a.slur,this.rules);s.addSlurToStaffline(o),r[n]=o}for(let n of s.Measures)for(let a of n.staffEntries){for(let o of a.graphicalVoiceEntries)for(let l of o.notes)for(let h of l.sourceNote.NoteSlurs)if(!(!h.EndNote||!h.StartNote)){if(h.StartNote===l.sourceNote){let u=new Ss(h,this.rules);r.push(u),s.addSlurToStaffline(u)}if(h.EndNote===l.sourceNote){let u=this.findIndexGraphicalSlurFromSlur(r,h);if(u>=0){let c=r[u];c.staffEntries.indexOf(a)===-1&&c.staffEntries.push(a),r.splice(u,1)}}}for(let o of r)o.staffEntries.indexOf(a)===-1&&o.staffEntries.push(a)}}for(let i of this.musicSystems)for(let s of i.StaffLines){let r=s.GraphicalSlurs.sort(Ss.Compare);for(let n of r)n.slur.isCrossed()||n.calculateCurve(this.rules)}}calculateGlissandi(){let t={};for(let i of this.graphicalMusicSheet.MeasureList[0])t[i.ParentStaff.idInMusicSheet]=[];for(let i of this.musicSystems)for(let s of i.StaffLines){let r=t[s.ParentStaff.idInMusicSheet];for(let n=0;n<r.length;n++){let a=r[n],o=new dn(a.Glissando);s.addGlissandoToStaffline(o),r[n]=o}for(let n of s.Measures)for(let a of n.staffEntries){for(let o of a.graphicalVoiceEntries)for(let l of o.notes){let h=l.sourceNote.NoteGlissando;if(!(!h?.EndNote||!h?.StartNote)){if(h.StartNote===l.sourceNote){let u=new dn(h);r.push(u),s.addGlissandoToStaffline(u)}if(h.EndNote===l.sourceNote){let u=this.indexOfGraphicalGlissFromGliss(r,h);if(u>=0){let c=r[u];c.staffEntries.indexOf(a)===-1&&c.staffEntries.push(a),r.splice(u,1)}}}}for(let o of r)o.staffEntries.indexOf(a)===-1&&o.staffEntries.push(a)}}for(let i of this.musicSystems)for(let s of i.StaffLines)for(let r of s.GraphicalGlissandi)if(s.ParentStaff.isTab){let n=r.Glissando.StartNote,a=r.Glissando.EndNote,o=r.staffEntries[0].findGraphicalNoteFromNote(n),l=r.staffEntries.last().findGraphicalNoteFromNote(a);if(!o&&!l)return;let h=1;n.FretNumber>a.FretNumber&&(h=-1);let u,c,d;o&&o.vfnote&&o.vfnote.length>=2&&(d=o.vfnote[0],u=[0]);let f;l&&l.vfnote&&l.vfnote.length>=2&&(f=l.vfnote[0],c=[0]);let p=new yi.TabSlide({first_indices:u,first_note:d,last_indices:c,last_note:f},h),m=o?.parentVoiceEntry.parentStaffEntry.parentMeasure;m&&(m.vfTies.push(p),r.vfTie=p);let g=l?.parentVoiceEntry.parentStaffEntry.parentMeasure;g&&(g.vfTies.push(p),r.vfTie=p)}}};za=ys,za.MaxMeasuresPerSkyBottomLineBatch=40;var Os=class{constructor(e,t){e instanceof Ue?this.continuousDynamicExpression=e:e instanceof Oi&&(this.instantaneousDynamicExpression=e),this.staffNumber=t}static Compare(e,t){return e.parMultiExpression().AbsoluteTimestamp.CompareTo(t.parMultiExpression().AbsoluteTimestamp)}parMultiExpression(){if(this.continuousDynamicExpression)return this.continuousDynamicExpression.StartMultiExpression;if(this.instantaneousDynamicExpression)return this.instantaneousDynamicExpression.ParentMultiExpression}},xn=class wl{constructor(t,i,s){this.currentMeasureIndex=0,this.currentPartIndex=0,this.currentVoiceEntryIndex=-1,this.currentDynamicEntryIndex=0,this.currentTempoEntryIndex=0,this.currentDynamicChangingExpressions=[],this.repetitionIterationCountDictKeys=[],this.repetitionIterationCountDictValues=[],this.currentRepetition=void 0,this.endReached=!1,this.frontReached=!1,this.currentTimeStamp=new N(0,1),this.currentEnrolledMeasureTimestamp=new N(0,1),this.currentRelativeInMeasureTimestamp=new N(0,1),this.currentVerticalContainerInMeasureTimestamp=new N(0,1),this.jumpResponsibleRepetition=void 0,this.activeDynamicExpressions=[],this.SkipInvisibleNotes=!0;try{this.frontReached=!0,this.musicSheet=t,this.currentBpm=t.userStartTempoInBPM,this.currentVoiceEntries=void 0,this.frontReached=!1;for(let r of this.musicSheet.Repetitions)this.setRepetitionIterationCount(r,1);for(let r=0;r<t.getCompleteNumberOfStaves();r++)this.ActiveDynamicExpressions.push(void 0);this.currentMeasure=this.musicSheet.SourceMeasures[0],i||(i=new N);do this.moveToNext();while((!this.currentVoiceEntries||this.currentTimeStamp.lt(i))&&!this.endReached);for(let r=0;r<this.activeDynamicExpressions.length;r++)if(this.activeDynamicExpressions[r])if(this.activeDynamicExpressions[r]instanceof Ue){let n=this.activeDynamicExpressions[r];this.currentDynamicChangingExpressions.push(new Os(n,r))}else{let n=this.activeDynamicExpressions[r];this.currentDynamicChangingExpressions.push(new Os(n,r))}this.currentTempoChangingExpression=this.activeTempoExpression}catch(r){W.default.info("MusicPartManagerIterator: "+r)}}get EndReached(){return this.endReached}get FrontReached(){return this.frontReached}get CurrentMeasure(){return this.currentMeasure}get CurrentRepetition(){return this.currentRepetition}get CurrentRepetitionIteration(){return this.CurrentRepetition?this.getRepetitionIterationCount(this.CurrentRepetition):0}get CurrentJumpResponsibleRepetitionIterationBeforeJump(){return this.jumpResponsibleRepetition?this.getRepetitionIterationCount(this.jumpResponsibleRepetition)-1:0}get CurrentBpm(){return this.currentBpm}set CurrentBpm(t){this.currentBpm=t}get CurrentVoiceEntries(){return this.currentVoiceEntries}get CurrentMeasureIndex(){return this.currentMeasureIndex}get CurrentEnrolledTimestamp(){return N.plus(this.currentEnrolledMeasureTimestamp,this.currentVerticalContainerInMeasureTimestamp)}get CurrentSourceTimestamp(){return this.currentTimeStamp}get CurrentRelativeInMeasureTimestamp(){return this.currentRelativeInMeasureTimestamp}get JumpOccurred(){return this.backJumpOccurred||this.forwardJumpOccurred}get ActiveTempoExpression(){return this.activeTempoExpression}get ActiveDynamicExpressions(){return this.activeDynamicExpressions}get CurrentTempoChangingExpression(){return this.currentTempoChangingExpression}get JumpResponsibleRepetition(){return this.jumpResponsibleRepetition}clone(t=void 0,i=void 0){let s=new wl(this.musicSheet,t??this.currentTimeStamp,i);return s.currentVoiceEntryIndex=this.currentVoiceEntryIndex,s.currentMappingPart=this.currentMappingPart,s.currentPartIndex=this.currentPartIndex,s.currentVoiceEntries=this.currentVoiceEntries,s.endReached=this.endReached,s.frontReached=this.frontReached,s}CurrentVisibleVoiceEntries(t){let i=[];if(!this.currentVoiceEntries)return i;
71if(t){for(let s of this.currentVoiceEntries)s.ParentVoice.Parent.IdString===t.IdString&&this.getVisibleEntries(s,i);return i}for(let s of this.currentVoiceEntries)this.getVisibleEntries(s,i);return i}CurrentAudibleVoiceEntries(t){let i=[];if(this.currentVoiceEntries)if(t){for(let s of this.currentVoiceEntries)if(s.ParentVoice.Parent.IdString===t.IdString)return this.getAudibleEntries(s,i),i}else for(let s of this.currentVoiceEntries)this.getAudibleEntries(s,i);return i}getCurrentDynamicChangingExpressions(){return this.currentDynamicChangingExpressions}CurrentScoreFollowingVoiceEntries(t){let i=[];if(!this.currentVoiceEntries)return i;if(t){for(let s of this.currentVoiceEntries)if(s.ParentVoice.Parent.IdString===t.IdString)return this.getScoreFollowingEntries(s,i),i}else for(let s of this.currentVoiceEntries)this.getScoreFollowingEntries(s,i);return i}currentPlaybackSettings(){return this.musicSheet.SheetPlaybackSetting}moveToPrevious(){this.frontReached||(this.currentVoiceEntries&&(this.currentVoiceEntries=[]),this.recursiveMoveBack())}moveToPreviousVisibleVoiceEntry(t){for(;!this.frontReached;)if(this.moveToPrevious(),this.checkEntries(t))return}moveToNext(){if(this.forwardJumpOccurred=this.backJumpOccurred=!1,!this.endReached&&(this.frontReached&&(this.frontReached=!1,this.currentVoiceEntryIndex=-1),this.currentVoiceEntries&&(this.currentVoiceEntries.length=0),this.recursiveMove(),this.currentMeasure||(this.currentTimeStamp=new N(99999,1),this.currentMeasure=this.musicSheet.SourceMeasures.last()),this.CurrentTempoChangingExpression!==void 0&&!this.musicSheet.IgnoreTempoInstructions))if(this.CurrentTempoChangingExpression.ContinuousTempo!==void 0&&this.currentMeasure.Rules.UseInterpolatedTempoForAccelerandoEtc){let t=this.CurrentTempoChangingExpression.ContinuousTempo.getInterpolatedTempo(this.CurrentSourceTimestamp);t>0&&(this.currentBpm=t)}else this.musicSheet.IgnoreTempoInstructions||this.CurrentTempoChangingExpression.InstantaneousTempo?.TempoInBpm&&(this.currentBpm=this.CurrentTempoChangingExpression.InstantaneousTempo.TempoInBpm)}moveToNextVisibleVoiceEntry(t){for(;!this.endReached;)if(this.moveToNext(),this.checkEntries(t))return}resetRepetitionIterationCount(t){return this.setRepetitionIterationCount(t,1),1}incrementRepetitionIterationCount(t){return this.repetitionIterationCountDictKeys.indexOf(t)===-1?this.setRepetitionIterationCount(t,1):this.setRepetitionIterationCount(t,this.getRepetitionIterationCount(t)+1)}setRepetitionIterationCount(t,i){let s=this.repetitionIterationCountDictKeys.indexOf(t);return s===-1?(this.repetitionIterationCountDictKeys.push(t),this.repetitionIterationCountDictValues.push(i)):this.repetitionIterationCountDictValues[s]=i,i}getRepetitionIterationCount(t){let i=this.repetitionIterationCountDictKeys.indexOf(t);if(i!==-1)return this.repetitionIterationCountDictValues[i]}handleRepetitionsAtMeasureBegin(){for(let t=0,i=this.currentMeasure.FirstRepetitionInstructions.length;t<i;++t){let s=this.currentMeasure.FirstRepetitionInstructions[t];if(!s.parentRepetition)continue;let r=s.parentRepetition;this.currentRepetition=r,r.StartIndex===this.currentMeasureIndex&&this.JumpResponsibleRepetition!==void 0&&r!==this.JumpResponsibleRepetition&&r.StartIndex>=this.JumpResponsibleRepetition.StartIndex&&r.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(r)}}handleRepetitionsAtMeasureEnd(){for(let t=0,i=this.currentMeasure.LastRepetitionInstructions.length;t<i;++t){let s=this.currentMeasure.LastRepetitionInstructions[t],r=s.parentRepetition;if(r){if(r.BackwardJumpInstructions.indexOf(s)>-1&&this.getRepetitionIterationCount(r)<r.UserNumberOfRepetitions&&!r.SkipRepetition&&!this.musicSheet.Rules.CursorIgnoreRepetitions){this.doBackJump(r);return}if(s===r.forwardJumpInstruction&&(this.JumpResponsibleRepetition!==void 0&&r!==this.JumpResponsibleRepetition&&r.StartIndex>=this.JumpResponsibleRepetition.StartIndex&&r.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(r),this.repetitionIterationCountDictKeys.contains(r))){let n=r.getForwardJumpTargetForIteration(this.getRepetitionIterationCount(r));if(n>=0){this.currentMeasureIndex=n,this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.jumpResponsibleRepetition=r,this.forwardJumpOccurred=!0;return}n===-2&&(this.endReached=!0)}}}this.currentMeasureIndex++,this.JumpResponsibleRepetition!==void 0&&this.currentMeasureIndex>this.JumpResponsibleRepetition.EndIndex&&(this.jumpResponsibleRepetition=void 0)}doBackJump(t){t.SkipRepetition||this.musicSheet.Rules.CursorIgnoreRepetitions||(this.currentMeasureIndex=t.getBackwardJumpTarget(),this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.incrementRepetitionIterationCount(t),this.jumpResponsibleRepetition=t,this.backJumpOccurred=!0)}
71activateCurrentRhythmInstructions(){if(this.currentMeasure!==void 0&&this.currentMeasure.FirstInstructionsStaffEntries.length>0&&this.currentMeasure.FirstInstructionsStaffEntries[0]!==void 0){let t=this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions;for(let i=0,s=t.length;i<s;++i){let r=t[i];r instanceof Re&&(this.musicSheet.SheetPlaybackSetting.rhythm=r.Rhythm)}}}activateCurrentDynamicOrTempoInstructions(){let t=this.musicSheet.TimestampSortedDynamicExpressionsList;for(;this.currentDynamicEntryIndex>0&&(this.currentDynamicEntryIndex>=t.length||t[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentDynamicEntryIndex--;for(;this.currentDynamicEntryIndex<t.length&&t[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.lt(this.CurrentSourceTimestamp);)this.currentDynamicEntryIndex++;for(;this.currentDynamicEntryIndex<t.length&&t[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.Equals(this.CurrentSourceTimestamp);){let s=t[this.currentDynamicEntryIndex],r=s.staffNumber;this.CurrentSourceTimestamp.Equals(s.parMultiExpression().AbsoluteTimestamp)&&(s.continuousDynamicExpression?this.activeDynamicExpressions[r]=s.continuousDynamicExpression:s.instantaneousDynamicExpression&&(this.activeDynamicExpressions[r]=s.instantaneousDynamicExpression)),this.currentDynamicEntryIndex++}this.currentDynamicChangingExpressions.length=0;for(let s=0;s<this.activeDynamicExpressions.length;s++)if(this.activeDynamicExpressions[s]){let r,n;if(this.activeDynamicExpressions[s]instanceof Ue){let a=this.activeDynamicExpressions[s];r=a.StartMultiExpression.AbsoluteTimestamp,n=a.EndMultiExpression.AbsoluteTimestamp,this.CurrentSourceTimestamp.gte(r)&&this.CurrentSourceTimestamp.lte(n)&&this.currentDynamicChangingExpressions.push(new Os(a,s))}else{let a=this.activeDynamicExpressions[s];this.CurrentSourceTimestamp.Equals(a.ParentMultiExpression.AbsoluteTimestamp)&&this.currentDynamicChangingExpressions.push(new Os(a,s))}}let i=this.musicSheet.TimestampSortedTempoExpressionsList;for(;this.currentTempoEntryIndex>0&&(this.currentTempoEntryIndex>=i.length||i[this.currentTempoEntryIndex].AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentTempoEntryIndex--;for(;this.currentTempoEntryIndex<i.length&&i[this.currentTempoEntryIndex].AbsoluteTimestamp.lt(this.CurrentSourceTimestamp);)this.currentTempoEntryIndex++;for(;this.currentTempoEntryIndex<i.length&&i[this.currentTempoEntryIndex].AbsoluteTimestamp.Equals(this.CurrentSourceTimestamp);)this.activeTempoExpression=i[this.currentTempoEntryIndex],this.currentTempoEntryIndex++;if(this.currentTempoChangingExpression=void 0,this.activeTempoExpression){let s=this.activeTempoExpression.AbsoluteTimestamp;this.activeTempoExpression.ContinuousTempo&&(s=this.activeTempoExpression.ContinuousTempo.AbsoluteEndTimestamp),(this.CurrentSourceTimestamp.gte(this.activeTempoExpression.AbsoluteTimestamp)||this.CurrentSourceTimestamp.lte(s))&&(this.currentTempoChangingExpression=this.activeTempoExpression)}}recursiveMoveBack(){if(this.currentVoiceEntryIndex>0){this.currentVoiceEntryIndex--;let t=this.currentMeasure.VerticalSourceStaffEntryContainers[this.currentVoiceEntryIndex];this.currentVoiceEntries=this.getVoiceEntries(t),this.currentVerticalContainerInMeasureTimestamp=t.Timestamp,this.currentRelativeInMeasureTimestamp=this.currentVerticalContainerInMeasureTimestamp,this.currentTimeStamp=N.plus(this.currentMeasure.AbsoluteTimestamp,this.currentVerticalContainerInMeasureTimestamp),this.activateCurrentDynamicOrTempoInstructions();let i=this.musicSheet.SelectionEnd;i&&this.currentTimeStamp.lt(i)&&(this.endReached=!1),this.currentMeasureIndex=this.musicSheet.SourceMeasures.indexOf(this.CurrentMeasure);return}else if(this.currentVoiceEntryIndex===0&&this.currentMeasureIndex!==0){let t=this.musicSheet.SourceMeasures[this.currentMeasureIndex-1];this.currentMeasureIndex--,this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex];let i=t.VerticalSourceStaffEntryContainers[t.VerticalSourceStaffEntryContainers.length-1];this.currentVoiceEntries=this.getVoiceEntries(i),this.currentVerticalContainerInMeasureTimestamp=i.Timestamp,this.currentVoiceEntryIndex=t.VerticalSourceStaffEntryContainers.length-1,this.currentRelativeInMeasureTimestamp=this.currentVerticalContainerInMeasureTimestamp,this.currentTimeStamp=N.plus(this.currentMeasure.AbsoluteTimestamp,i.Timestamp),this.activateCurrentDynamicOrTempoInstructions();let s=this.musicSheet.SelectionEnd;s&&this.currentTimeStamp.lt(s)&&(this.endReached=!1);return}this.frontReached=!0,this.currentTimeStamp=new N(-1,1)}recursiveMove(){if(this.currentVoiceEntryIndex++,this.currentVoiceEntryIndex===0&&(this.handleRepetitionsAtMeasureBegin(),this.activateCurrentRhythmInstru
71ctions()),this.currentVoiceEntryIndex>=0&&this.currentVoiceEntryIndex<this.currentMeasure.VerticalSourceStaffEntryContainers.length){let t=this.currentMeasure.VerticalSourceStaffEntryContainers[this.currentVoiceEntryIndex];this.currentVoiceEntries=this.getVoiceEntries(t),this.currentVerticalContainerInMeasureTimestamp=t.Timestamp,this.currentRelativeInMeasureTimestamp=this.currentVerticalContainerInMeasureTimestamp,this.currentTimeStamp=N.plus(this.currentMeasure.AbsoluteTimestamp,this.currentVerticalContainerInMeasureTimestamp);let i=this.musicSheet.SelectionEnd;i&&this.currentTimeStamp.gte(i)&&(this.endReached=!0),this.activateCurrentDynamicOrTempoInstructions();return}if(this.currentEnrolledMeasureTimestamp.Add(this.currentMeasure.Duration),this.handleRepetitionsAtMeasureEnd(),this.currentMeasureIndex>=0&&this.currentMeasureIndex<this.musicSheet.SourceMeasures.length){this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentTimeStamp=N.plus(this.currentMeasure.AbsoluteTimestamp,this.currentVerticalContainerInMeasureTimestamp),this.currentVoiceEntryIndex=-1,this.recursiveMove();return}this.currentVerticalContainerInMeasureTimestamp=new N,this.currentMeasure=void 0,this.currentVoiceEntries=void 0,this.endReached=!0}checkEntries(t){let i=this.CurrentVisibleVoiceEntries();if(i.length>0){if(!t)return!0;for(let s=0,r=i.length;s<r;++s)if(i[s].Notes[0].Pitch)return!0}return!1}getVisibleEntries(t,i){if(t.ParentVoice.Visible){let s=!1;for(let r of t.Notes)if(r.PrintObject&&r.Notehead?.Shape!==Vt.NONE){s=!0;break}if(!s&&this.SkipInvisibleNotes)return;i.push(t)}}getAudibleEntries(t,i){if(t.hasTie()){let s=t.Notes[0];if(s.NoteTie!==void 0&&s.NoteTie.StartNote!==s)return}t.ParentVoice.Audible&&t.ParentSourceStaffEntry.ParentStaff.audible&&i.push(t)}getScoreFollowingEntries(t,i){t.ParentVoice.Following&&t.ParentVoice.Parent.Following&&i.push(t)}getVoiceEntries(t){let i=[];for(let s of t.StaffEntries)if(s)for(let r of s.VoiceEntries)i.push(r);return i}},Tl=class{constructor(e){this.musicSheet=e}reInit(){this.init()}init(){this.parts=this.musicSheet.Repetitions.slice(),this.sheetStart=this.musicSheet.SelectionStart=new N(0,1),this.sheetEnd=this.musicSheet.SelectionEnd=this.musicSheet.SheetEndTimestamp,this.calcMapping()}getCurrentRepetitionTimestampTransform(e){let t;for(let i=this.timestamps.length-1;i>=0;i--)if(t=this.timestamps[i],e.gte(t.$from))return t;return this.timestamps[0]}absoluteEnrolledToSheetTimestamp(e){if(this.timestamps.length===0)return e;let t=this.getCurrentRepetitionTimestampTransform(e);return N.plus(e,N.minus(t.to,t.$from))}get Parts(){return this.parts}get MusicSheet(){return this.musicSheet}getIterator(e){return e?new xn(this.musicSheet,e,void 0):new xn(this.musicSheet,this.musicSheet.SelectionStart,this.musicSheet.SelectionEnd)}setSelectionStart(e){this.musicSheet.SelectionStart=e,this.musicSheet.SelectionEnd=void 0}setSelectionRange(e,t){this.musicSheet.SelectionStart=e??this.sheetStart,this.musicSheet.SelectionEnd=t??this.sheetEnd}calcMapping(){let e=[],t=this.getIterator(),i=t.CurrentRepetition,s=new En(t.CurrentEnrolledTimestamp.clone(),t.CurrentSourceTimestamp.clone(),void 0,0);for(e.push(s);!t.EndReached;){if(t.JumpOccurred||i!==t.CurrentRepetition){if(i=t.CurrentRepetition,t.backJumpOccurred){let r=t.JumpResponsibleRepetition;s.nextBackJump=t.CurrentEnrolledTimestamp,s.curRepetition=r,s.curRepetitionIteration=t.CurrentJumpResponsibleRepetitionIterationBeforeJump;for(let n=this.timestamps.length-2;n>=0&&!(e[n].to.lt(r.AbsoluteTimestamp)||e[n].curRepetition);n--)e[n].nextBackJump=s.nextBackJump,e[n].curRepetition=r,e[n].curRepetitionIteration=s.curRepetitionIteration}s=new En(t.CurrentEnrolledTimestamp.clone(),t.CurrentSourceTimestamp.clone(),void 0,0),e.push(s)}t.moveToNext()}this.timestamps=e}},En=class{constructor(e,t,i,s){this.$from=e,this.to=t,this.curRepetition=i,this.curRepetitionIteration=s,this.nextBackJump=void 0,this.nextForwardJump=void 0}},pa=class{constructor(e){this.enrolledTimestamps=[],this.visible=!0,this.musicSheet=e}get Visible(){return this.visible}set Visible(e){this.visible=e}getFirstSourceMeasure(){return this.musicSheet.SourceMeasures[this.startIndex]}getLastSourceMeasure(){return this.musicSheet.SourceMeasures[this.endIndex]}},vn=class extends pa{constructor(e,t,i){super(e),this.musicSheet=e,this.startIndex=t,this.endIndex=i}get MeasuresCount(){return this.endIndex-this.startIndex+1}get StartIndex(){return this.startIndex}get EndIndex(){return this.endIndex}get ParentRepetition(){return this.parentRepetition}set ParentRepetition(e){this.parentRepetition=e}get AbsoluteTimestamp(){return N.createFromFraction(this.musicSheet.SourceMeasures[this.startIndex].AbsoluteTimestamp)}setStartIndex(e){this.startIndex=e}setEndIndex(e){this.endIndex=e}},Ls=class extends pa{constructor(e,t=!1){super(e),this.SkipRepetition=!1,this.userNumberOfRepetitions=0,this.backwardJumpInstructions=[],this.endingParts=[],this.endingIndexDict={},this.visibles=[],this.fromWords=!1,this.repetitonIterationOrder=[],this.numberOfEndings=1,this.musicSheet2=e,this.virtualOverallRepetition=t}get BackwardJumpInstructions(){return this.backwardJumpInstructions}get EndingIndexDict(){return this.endingIndexDict}get EndingParts(){return this.endingParts}get Visibles(){return this.visibles}set Visibles(e){this.visibles=e}get DefaultNumberOfRepetitions(){let e=2;return this.virtualOverallRepetition&&(e=1),Math.max(e,Object.keys(this.endingIndexDict).length,this.checkRepetitionForMultipleLyricVerses())}get UserNumberOfRepetitions(){return this.userNumberOfRepetitions}set UserNumberOfRepetitions(e){this.userNumberOfRepetitions=e,this.repetitonIterationOrder=[];let t=this.userNumberOfRepetitions-this.NumberOfEndings;for(let i=1;i<=this.userNumberOfRepetitions;i++)i<=t?this.repetitonIterationOrder.push(1):this.repetitonIterationOrder.push(i-t)}getForwardJumpTargetForIteration(e){let t=this.repetitonIterationOrder[e-1];return this.endingIndexDict[t]?this.endingIndexDict[t].part.StartIndex:-1}getBackwardJumpTarget(){return this.startMarker.measureIndex}setEndingsStartIndex(e,t){let i=new Mn(new vn(this.musicSheet2,t,t));this.endingParts.push(i);for(let s of e)try{this.endingIndexDict[s]=i,i.endingIndices.push(s),this.numberOfEndings<s&&(this.numberOfEndings=s)}catch(r){W.default.error("Repetition: Exception.",r)}}setEndingStartIndex(e,t){let i=new Mn(new vn(this.musicSheet2,t,t));this.EndingIndexDict[e]=i,this.endingParts.push(i),i.endingIndices.push(e),this.numberOfEndings<e&&(this.numberOfEndings=e)}setEndingEndIndex(e,t){this.endingIndexDict[e]&&this.endingIndexDict[e].part.setEndIndex(t)}get NumberOfEndings(){return this.numberOfEndings}get FromWords(){return this.fromWords}set FromWords(e){this.fromWords=e}get AbsoluteTimestamp(){return N.createFromFraction(this.musicSheet2.SourceMeasures[this.startMarker.measureIndex].AbsoluteTimestamp)}get StartIndex(){return this.startMarker.measureIndex}get EndIndex(){if(this.BackwardJumpInstructions.length===0)return this.StartIndex;let e=this.backwardJumpInstructions[this.backwardJumpInstructions.length-1].measureIndex;return this.endingIndexDict[this.NumberOfEndings]&&(e=Math.max(this.endingIndexDict[this.NumberOfEndings].part.EndIndex,e)),e}checkRepetitionForMultipleLyricVerses(){let e=0,t=this.StartIndex,i=this.EndIndex;for(let s=t;s<=i;s++){let r=this.musicSheet2.SourceMeasures[s];for(let n=0;n<r.CompleteNumberOfStaves;n++)if(r.VerticalSourceStaffEntryContainers[n]){for(let a of r.VerticalSourceStaffEntryContainers[n].StaffEntries)if(a){let o=0;for(let l of a.VoiceEntries)o+=l.LyricsEntries.keys.length;e=Math.max(e,o)}}}return e}get FirstSourceMeasureNumber(){return this.getFirstSourceMeasure().MeasureNumber}get LastSourceMeasureNumber(){return this.getLastSourceMeasure().MeasureNumber}coversIdenticalMeasures(e){return this.StartIndex===e.StartIndex&&this.EndIndex===e.EndIndex}removeFromRepetitionInstructions(){this.startMarker!==void 0&&(this.startMarker.parentRepetition=void 0),this.endMarker!==void 0&&(this.endMarker.parentRepetition=void 0);for(let e of this.BackwardJumpInstructions)e.parentRepetition=void 0}},Mn=class{constructor(e){this.endingIndices=[],this.part=e}ToString(){return this.endingIndices.join(", ")}},Pl=class{constructor(){this.measureErrors={},this.errors=[],this.tempErrors=[]}finalizeMeasure(e){let t=this.measureErrors[e];t||(t=[]),this.measureErrors[e]=t.concat(this.tempErrors),this.tempErrors=[]}pushMeasureError(e){this.tempErrors.push(e)}push(e){this.errors.push(e)}},zu=class Ll{constructor(t=new N,i=100){this.rhythm=t,this.beatsPerMinute=i,this.beatLengthInMilliseconds=6e4/i,this.beatRealValue=1/4}static createFrom(t){return new Ll(t.Rhythm,t.BeatsPerMinute)}get BeatsPerMinute(){return this.beatsPerMinute}set BeatsPerMinute(t){this.beatsPerMinute=t,this.beatLengthInMilliseconds=6e4/this.beatsPerMinute}get Rhythm(){return this.rhythm}set Rhythm(t){this.rhythm=t}get BeatRealValue(){return this.beatRealValue}get BeatLengthInMilliseconds(){return this.beatLengthInMilliseconds}getDurationInMilliseconds(t){return(typeof t=="number"?t:t.RealValue)*this.BeatLengthInMilliseconds/this.beatRealValue}getDurationAsNoteDuration(t,i=1024){let s=t/this.BeatLengthInMilliseconds,r=Math.floor(s),n=new N(r,4),a=s-r;return r=Math.round(a/(1/i)/4),a!==0&&r===0&&t>0&&(r=1),n.Add(new N(r,i)),n}},Ha,ma=class{constructor(){this.idString="uninitialized",this.sourceMeasures=[],this.repetitions=[],this.dynListStaves=[],this.timestampSortedDynamicExpressionsList=[],this.timestampSortedTempoExpressionsList=[],this.instrumentalGroups=[],this.instruments=[],this.musicPartManager=void 0,this.musicSheetErrors=new Pl,this.staves=[],this.transpose=0,this.defaultStartTempoInBpm=0,this.drawErroneousMeasures=!1,this.hasBeenOpenedForTheFirstTime=!1,this.currentEnrolledPosition=new N(0,1),this.MeasureWidthFactor=1,this.IgnoreTempoInstructions=!1,this.playbackSettings=new zu,this.playbackSettings.rhythm=new N(4,4,0,!1),this.userStartTempoInBPM=100,this.pageWidth=120,this.MusicPartManager=new Tl(this),this.hasBPMInfo=!1}static getIndexFromStaff(e){return e.idInMusicSheet}get SourceMeasures(){return this.sourceMeasures}set SourceMeasures(e){this.sourceMeasures=e}get Repetitions(){return this.repetitions}set Repetitions(e){this.repetitions=e}get DynListStaves(){return this.dynListStaves}set TimestampSortedTempoExpressionsList(e){this.timestampSortedTempoExpressionsList=e}get TimestampSortedTempoExpressionsList(){return this.timestampSortedTempoExpressionsList}get TimestampSortedDynamicExpressionsList(){return this.timestampSortedDynamicExpressionsList}get InstrumentalGroups(){return this.instrumentalGroups}get Parts(){return this.instruments}get Instruments(){return this.instruments}get SheetPlaybackSetting(){return this.playbackSettings}set SheetPlaybackSetting(e){this.playbackSettings=e}get DrawErroneousMeasures(){return this.drawErroneousMeasures}set DrawErroneousMeasures(e){this.drawErroneousMeasures=e}get HasBeenOpenedForTheFirstTime(){return this.hasBeenOpenedForTheFirstTime}set HasBeenOpenedForTheFirstTime(e){this.hasBeenOpenedForTheFirstTime=e}InitializeStartTempoInBPM(e){this.userStartTempoInBPM=e}get DefaultStartTempoInBpm(){return this.defaultStartTempoInBpm}set DefaultStartTempoInBpm(e){this.defaultStartTempoInBpm=e,this.InitializeStartTempoInBPM(e)}get Path(){return this.path}set Path(e){this.path=e}get Staves(){return this.staves}get TitleString(){return this.title?this.title.text:""}set TitleString(e){this.Title=new Nt(e)}get SubtitleString(){return this.subtitle?this.subtitle.text:""}set SubtitleString(e){this.Subtitle=new Nt(e)}get ComposerString(){return this.composer?this.composer.text:""}set ComposerString(e){this.Composer=new Nt(e)}get LyricistString(){return this.lyricist?this.lyricist.text:""}set LyricistString(e){this.Lyricist=new Nt(e)}get CopyrightString(){return this.copyright?this.copyright.text:""}set CopyrightString(e){this.Copyright=new Nt(e,mt.CenterBottom,void 0,!0)}get Title(){return this.title}set Title(e){this.title=e}get Subtitle(){return this.subtitle}set Subtitle(e){this.subtitle=e}get Composer(){return this.composer}set Composer(e){this.composer=e}get Lyricist(){return this.lyricist}set Lyricist(e){this.lyricist=e}get Copyright(){return this.copyright}
71set Copyright(e){this.copyright=e}get Rules(){return this.rules||(W.default.debug("warning: sheet.Rules was undefined. Creating new EngravingRules."),this.rules=new Li),this.rules}set Rules(e){this.rules=e}get SheetErrors(){return this.musicSheetErrors}get SelectionStart(){return this.selectionStart}set SelectionStart(e){this.selectionStart=e.clone(),this.currentEnrolledPosition=e.clone()}get SelectionEnd(){return this.selectionEnd}set SelectionEnd(e){this.selectionEnd=e}set HasBPMInfo(e){this.hasBPMInfo=e}get HasBPMInfo(){return this.hasBPMInfo}addMeasure(e){this.sourceMeasures.push(e),e.measureListIndex=this.sourceMeasures.length-1}checkForInstrumentWithNoVoice(){for(let e=0,t=this.instruments.length;e<t;++e){let i=this.instruments[e];if(i.Voices.length===0){let s=new Rs(i,1);i.Voices.push(s)}}}getStaffFromIndex(e){return this.staves[e]}fillStaffList(){let e=0;for(let t=0,i=this.instruments.length;t<i;++t){let s=this.instruments[t];for(let r=0,n=s.Staves.length;r<n;++r){let a=s.Staves[r];a.idInMusicSheet=e,this.staves.push(a),e++}}}get MusicPartManager(){return this.musicPartManager}set MusicPartManager(e){this.musicPartManager=e}getCompleteNumberOfStaves(){let e=0;for(let t=0,i=this.instruments.length;t<i;++t){let s=this.instruments[t];e+=s.Staves.length}return e}getListOfMeasuresFromIndeces(e,t){let i=[];for(let s=e;s<=t;s++)i.push(this.sourceMeasures[s]);return i}getNextSourceMeasure(e){let t=this.sourceMeasures.indexOf(e);return t===this.sourceMeasures.length-1?e:this.sourceMeasures[t+1]}getFirstSourceMeasure(){return this.sourceMeasures[0]}getLastSourceMeasure(){return this.sourceMeasures[this.sourceMeasures.length-1]}resetAllNoteStates(){let e=this.MusicPartManager.getIterator();for(;!e.EndReached&&e.CurrentVoiceEntries;){for(let t=0,i=e.CurrentVoiceEntries.length;t<i;++t){let s=e.CurrentVoiceEntries[t];for(let r=0,n=s.Notes.length;r<n;++r){let a=s.Notes[r];a.state=eo.Normal}}e.moveToNext()}}getMusicSheetInstrumentIndex(e){return this.Instruments.indexOf(e)}getGlobalStaffIndexOfFirstStaff(e){let t=this.getMusicSheetInstrumentIndex(e),i=0;for(let s=0;s<t;s++)i+=this.Instruments[s].Staves.length;return i}setRepetitionNewUserNumberOfRepetitions(e,t){let i=0;for(let s=0;s<this.repetitions.length;s++)if(this.repetitions[s]instanceof Ls)if(e===i){this.repetitions[s].UserNumberOfRepetitions=t;break}else i++}getRepetitionByIndex(e){let t=0;for(let i=0;i<this.repetitions.length;i++)if(this.repetitions[i]instanceof Ls){if(e===t)return this.repetitions[i];t++}}CompareTo(e){return this.Title.text.localeCompare(e.Title.text)}getExpressionsStartTempoInBPM(){if(this.TimestampSortedTempoExpressionsList.length>0){let e=this.TimestampSortedTempoExpressionsList[0];if(e.InstantaneousTempo)return e.InstantaneousTempo.TempoInBpm;if(e.ContinuousTempo)return e.ContinuousTempo.StartTempo}return this.userStartTempoInBPM}get Errors(){return this.musicSheetErrors.measureErrors}get FirstMeasureNumber(){try{return this.getFirstSourceMeasure().MeasureNumber}catch(e){return W.default.info("MusicSheet.FirstMeasureNumber: ",e),0}}get LastMeasureNumber(){try{return this.getLastSourceMeasure().MeasureNumber}catch(e){return W.default.info("MusicSheet.LastMeasureNumber: ",e),0}}get CurrentEnrolledPosition(){return this.currentEnrolledPosition.clone()}set CurrentEnrolledPosition(e){this.currentEnrolledPosition=e.clone()}get Transpose(){return this.transpose}set Transpose(e){this.transpose=e}get FullNameString(){return this.ComposerString+" "+this.TitleString}get IdString(){return this.idString}set IdString(e){this.idString=e}getEnrolledSelectionStartTimeStampWorkaround(){let e=this.MusicPartManager.getIterator(this.SelectionStart);return N.createFromFraction(e.CurrentEnrolledTimestamp)}get SheetEndTimestamp(){let e=this.getLastSourceMeasure();return N.plus(e.AbsoluteTimestamp,e.Duration)}getSourceMeasureFromTimeStamp(e){for(let t=0,i=this.sourceMeasures.length;t<i;++t){let s=this.sourceMeasures[t];for(let r=0,n=s.VerticalSourceStaffEntryContainers.length;r<n;++r){let a=s.VerticalSourceStaffEntryContainers[r];if(e.Equals(a.getAbsoluteTimestamp()))return s}}return this.findSourceMeasureFromTimeStamp(e)}findSourceMeasureFromTimeStamp(e){for(let t of this.sourceMeasures)if(t.AbsoluteTimestamp.lte(e)&&e.lt(N.plus(t.AbsoluteTimestamp,t.Duration)))return t}getVisibleInstruments(){let e=[];for(let t=0,i=this.Instruments.length;t<i;++t){let s=this.Instruments[t];s.Voices.length>0&&s.Voices[0].Visible&&e.push(s)}return e}};Ha=ma,Ha.defaultTitle="defaultTitle";var _l=class{constructor(e,t){this.printNewSystemXml=!1,this.printNewPageXml=!1,this.IsSystemStartMeasure=!1,this.WidthFactor=1,this.hasLyrics=!1,this.hasMoodExpressions=!1,this.allRests=!1,this.isReducedToMultiRest=!1,this.multipleRestMeasureNumber=0,this.staffLinkedExpressions=[],this.tempoExpressions=[],this.verticalSourceStaffEntryContainers=[],this.graphicalMeasureErrors=[],this.firstRepetitionInstructions=[],this.lastRepetitionInstructions=[],this.completeNumberOfStaves=e,this.impl
71icitMeasure=!1,this.hasEndLine=!1,this.endingBarStyleXml="",this.endingBarStyleEnum=ft.SingleThin,this.firstInstructionsStaffEntries=Array(e),this.lastInstructionsStaffEntries=Array(e),this.rules=t,this.TempoInBPM=0;for(let i=0;i<e;i++)this.graphicalMeasureErrors.push(!1),this.staffLinkedExpressions.push([])}get MeasureNumber(){return this.measureNumber}set MeasureNumber(e){this.measureNumber=e}getPrintedMeasureNumber(){return this.rules.UseXMLMeasureNumbers&&Number.isInteger(this.MeasureNumberXML)?(this.MeasureNumberPrinted=this.MeasureNumberXML,this.MeasureNumberPrinted):(this.MeasureNumberPrinted=this.MeasureNumber,this.MeasureNumberPrinted)}get AbsoluteTimestamp(){return this.absoluteTimestamp}set AbsoluteTimestamp(e){this.absoluteTimestamp=e}get CompleteNumberOfStaves(){return this.completeNumberOfStaves}get Duration(){return this.duration}set Duration(e){this.duration=e}get ActiveTimeSignature(){return this.activeTimeSignature}set ActiveTimeSignature(e){this.activeTimeSignature=e}get ImplicitMeasure(){return this.implicitMeasure}set ImplicitMeasure(e){this.implicitMeasure=e}get HasEndLine(){return this.hasEndLine}set HasEndLine(e){this.hasEndLine=e}get StaffLinkedExpressions(){return this.staffLinkedExpressions}get TempoExpressions(){return this.tempoExpressions}get VerticalSourceStaffEntryContainers(){return this.verticalSourceStaffEntryContainers}get FirstInstructionsStaffEntries(){return this.firstInstructionsStaffEntries}get LastInstructionsStaffEntries(){return this.lastInstructionsStaffEntries}get FirstRepetitionInstructions(){return this.firstRepetitionInstructions}get LastRepetitionInstructions(){return this.lastRepetitionInstructions}getErrorInMeasure(e){return this.graphicalMeasureErrors[e]}setErrorInGraphicalMeasure(e,t){this.graphicalMeasureErrors[e]=t}getNextMeasure(e){return e[this.measureListIndex+1]}getPreviousMeasure(e){if(this.measureListIndex>1)return e[this.measureListIndex-1]}get Rules(){return this.rules}get VerticalMeasureList(){return this.verticalMeasureList}set VerticalMeasureList(e){this.verticalMeasureList=e}get TempoInBPM(){return this.tempoInBPM}set TempoInBPM(e){this.tempoInBPM=e}findOrCreateStaffEntry(e,t,i){let s,r;for(let a of this.verticalSourceStaffEntryContainers)if(a.Timestamp.Equals(e)){r=a;break}if(r)return r.StaffEntries[t]?s=r.StaffEntries[t]:(s=new be(r,i),r.StaffEntries[t]=s),{createdNewContainer:!1,staffEntry:s};let n=this.verticalSourceStaffEntryContainers[this.verticalSourceStaffEntryContainers.length-1];if(this.verticalSourceStaffEntryContainers.length===0||n.Timestamp.lt(e)){let a=new bs(this,e.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.push(a),s=new be(a,i),a.StaffEntries[t]=s}else for(let a=this.verticalSourceStaffEntryContainers.length-1;a>=0;a--){if(this.verticalSourceStaffEntryContainers[a].Timestamp.lt(e)){let o=new bs(this,e.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(a+1,0,o),s=new be(o,i),o.StaffEntries[t]=s;break}if(a===0){let o=new bs(this,e.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(a,0,o),s=new be(o,i),o.StaffEntries[t]=s;break}}return{createdNewContainer:!0,staffEntry:s}}findOrCreateVoiceEntry(e,t){let i,s=!1;for(let r of e.VoiceEntries)if(r.ParentVoice===t){i=r;break}return i||(i=new As(e.Timestamp,t,e),s=!0),{createdVoiceEntry:s,voiceEntry:i}}getPreviousSourceStaffEntryFromIndex(e,t){for(let i=t-1;i>=0;i--)if(this.verticalSourceStaffEntryContainers[i][e])return this.verticalSourceStaffEntryContainers[i][e]}getVerticalContainerIndexByTimestamp(e){for(let t=0,i=this.VerticalSourceStaffEntryContainers.length;t<i;++t)if(this.VerticalSourceStaffEntryContainers[t].Timestamp.Equals(e))return t;return-1}getVerticalContainerByTimestamp(e){for(let t=0,i=this.VerticalSourceStaffEntryContainers.length;t<i;++t){let s=this.VerticalSourceStaffEntryContainers[t];if(s.Timestamp.Equals(e))return s}}checkForEmptyVerticalContainer(e){let t=0;for(let i=0;i<this.completeNumberOfStaves;i++)this.verticalSourceStaffEntryContainers[e][i]||t++;t===this.completeNumberOfStaves&&this.verticalSourceStaffEntryContainers.splice(e,1)}reverseCheck(e,t){let i=new N(0,1),s=[];for(let r=0;r<e.Instruments.length;r++){let n=new N(0,1),a=e.getGlobalStaffIndexOfFirstStaff(e.Instruments[r]);for(let o=0;o<e.Instruments[r].Staves.length;o++){let l=this.getLastSourceStaffEntryForInstrument(a+o);if(l!==void 0&&!l.hasTie()){let h=this.verticalSourceStaffEntryContainers.indexOf(l.VerticalContainerParent);for(let u=h-1;u>=0;u--){let c=this.verticalSourceStaffEntryContainers[u][a+o];if(c!==void 0&&c.hasTie()&&n.lt(N.plus(c.Timestamp,c.calculateMaxNoteLength()))){n=N.plus(c.Timestamp,c.calculateMaxNoteLength());break}}}}s.push(n)}for(let r=0,n=s.length;r<n;++r){let a=s[r];i.lt(a)&&(i=a)}return N.max(i,t)}calculateInstrumentsDuration(e,t){let i=[];for(let s=0;s<e.Instruments.length;s++){let r=new N(0,1),n=e.getGlobalStaffIndexOfFirstStaff(e.Instruments[s]);for(let a=0;a<e.Instruments[s].Staves.length;a++){let o=this.getLastSourceStaffEntryForInstrument(n+a);if(o!==void 0&&o.Timestamp){let l=o.calculateMaxNoteLength(!1);r.lt(N.plus(o.Timestamp,l))&&(r=N.plus(o.Timestamp,l))}}r.lt(t[s])&&(r=t[s]),i.push(r)}return i}getEntriesPerStaff(e){let t=[];
71for(let i of this.VerticalSourceStaffEntryContainers){let s=i.StaffEntries[e];s&&t.push(s)}return t}hasBeginInstructions(){for(let e=0,t=this.FirstInstructionsStaffEntries.length;e<t;e++){let i=this.FirstInstructionsStaffEntries[e];if(i!==void 0&&i.Instructions.length>0)return!0}return!1}beginsWithRepetition(){return this.beginsWithLineRepetition()||this.beginsWithWordRepetition()}beginsWithLineRepetition(){for(let e=0,t=this.FirstRepetitionInstructions.length;e<t;++e){let i=this.FirstRepetitionInstructions[e];if(i.type===J.StartLine){if(i.parentRepetition!==void 0&&i.parentRepetition.FromWords)continue;return!0}if(i.parentRepetition!==void 0&&i===i.parentRepetition.startMarker&&!i.parentRepetition.FromWords&&i.type!==J.None)return!0}return!1}endsWithLineRepetition(){for(let e=0,t=this.LastRepetitionInstructions.length;e<t;++e){let i=this.LastRepetitionInstructions[e];if(i.type===J.BackJumpLine)return!0;let s=i.parentRepetition;if(s&&!s.FromWords){for(let r=0,n=s.BackwardJumpInstructions.length;r<n;++r)if(i===s.BackwardJumpInstructions[r])return!0}}return!1}beginsWithWordRepetition(){for(let e=0,t=this.FirstRepetitionInstructions.length;e<t;++e){let i=this.FirstRepetitionInstructions[e];if(i.parentRepetition!==void 0&&i===i.parentRepetition.startMarker&&i.parentRepetition.FromWords)return!0}return!1}endsWithWordRepetition(){for(let e=0,t=this.LastRepetitionInstructions.length;e<t;++e){let i=this.LastRepetitionInstructions[e],s=i.parentRepetition;if(s&&s.FromWords){for(let r=0,n=s.BackwardJumpInstructions.length;r<n;++r)if(i===s.BackwardJumpInstructions[r])return!0;if(i===s.forwardJumpInstruction)return!0}}return!1}beginsRepetitionEnding(){for(let e of this.FirstRepetitionInstructions)if(e.type===J.Ending&&e.alignment===Pt.Begin)return!0;return!1}endsRepetitionEnding(){for(let e of this.LastRepetitionInstructions)if(e.type===J.Ending&&e.alignment===Pt.End)return!0;return!1}getKeyInstruction(e){if(this.FirstInstructionsStaffEntries[e]){let t=this.FirstInstructionsStaffEntries[e];for(let i=0,s=t.Instructions.length;i<s;++i){let r=t.Instructions[i];if(r instanceof ye)return r}}}getLastSourceStaffEntryForInstrument(e,t=!0){let i;for(let s=this.verticalSourceStaffEntryContainers.length-1;s>=0;s--)if(i=this.verticalSourceStaffEntryContainers[s].StaffEntries[e],i&&(!t||i.VoiceEntries.length>0))return i}canBeReducedToMultiRest(){if(this.firstRepetitionInstructions.length>0||this.lastRepetitionInstructions.length>0)return!1;let e=!0,t=!1;for(let i of this.verticalSourceStaffEntryContainers)if(i){for(let s of i.StaffEntries)if(!(!s||!s.ParentStaff.isVisible())){if(s.ChordContainers.length>0)return!1;s.ParentStaff.hasLyrics&&(t=!0);for(let r of s.VoiceEntries){for(let n of r.Notes)if(!n.isRest()){e=!1;break}if(!e)break}}}if(!e||t||this.hasMoodExpressions||this.tempoExpressions.length>0)return!1;for(let i of this.staffLinkedExpressions)if(i.length>0)return!1;for(let i of this.lastInstructionsStaffEntries)for(let s=0,r=i?.Instructions.length;s<r;++s)if(i.Instructions[s]instanceof Zt)return!1;return this.Duration?.RealValue===this.ActiveTimeSignature?.RealValue}},Al=class{constructor(e,t){this.notes=[],this.TieNumber=1,this.TieDirection=C.NotYetDefined,this.NoteIndexToTieDirection={},this.AddNote(e),this.type=t}getTieDirection(e){if(!e)return this.TieDirection;for(let t=0;t<this.Notes.length;t++)if(this.Notes[t]===e)return this.NoteIndexToTieDirection[t]||this.TieDirection;return W.default.debug("tie.getTieDuration note not in tie.Notes"),this.TieDirection}get Notes(){return this.notes}get Type(){return this.type}get StartNote(){return this.notes[0]}get Duration(){let e=new N;for(let t of this.notes)e.Add(t.Length);return e}get Pitch(){return this.StartNote.Pitch}AddNote(e){this.notes.push(e),e.NoteTie=this}},wn=class{constructor(e,t=!1){this.PlacementFromXml=!1,this.RenderTupletNumber=!0,this.notes=[],this.fractions=[],this.tupletLabelNumber=e,this.bracket=t}shouldBeBracketed(e,t,i,s=!1,r=!1){if(s)return r;if(e&&this.BracketedXmlValue!==void 0)return this.BracketedXmlValue;let n=this.Notes[0][0].NoteBeam;if(n){for(let a of this.Notes)if(a[0].NoteBeam!==n)return!0}else return!0;return this.Bracket||this.TupletLabelNumber===3&&i||this.TupletLabelNumber!==3&&t}get TupletLabelNumber(){return this.tupletLabelNumber}set TupletLabelNumber(e){this.tupletLabelNumber=e}get Notes(){return this.notes}set Notes(e){this.notes=e}get Fractions(){return this.fractions}set Fractions(e){this.fractions=e}get Bracket(){return this.bracket}set Bracket(e){this.bracket=e}getNoteIndex(e){for(let t=this.notes.length-1;t>=0;t--)for(let i=0;i<this.notes[t].length;i++)if(e===this.notes[t][i])return t;return 0}},Hu=class{constructor(){this.syllables=[]}get Syllables(){return this.syllables}containsVoiceEntry(e){for(let t=0,i=this.Syllables.length;t<i;++t)if(this.Syllables[t].Parent===e)return!0;return!1}findLyricEntryInVoiceEntry(e){for(let t=0,i=this.Syllables.length;t<i;++t){let s=this.Syllables[t];if(s.Parent===e)return s}}},ls=class{constructor(e,t,i,s,r=-1){this.text=e,this.word=i,this.parent=s,this.verseNumber=t,r>=0&&(this.syllableIndex=r)}get Text(){return this.text}set Text(e){this.text=e}get Word(){return this.word}get Parent(){return this.parent}set Parent(e){this.parent=e}get VerseNumber(){return this.verseNumber}get SyllableIndex(){return this.syllableIndex}get IsTranslation(){return this.VerseNumber.endsWith("translation")}get IsChorus(){return this.VerseNumber.startsWith("chorus")}get FontStyle(){return this.IsChorus||this.IsTranslation?Qt.Italic:Qt.Regular}},Rl=class{constructor(e){this.openLyricWords={},this.musicSheet=e}addLyricEntry(e,t){if(e){let i=e;for(let s=0,r=i.length;s<r;++s){let n=i[s];try{let a="single";
71if(n.element("text")){let o=n.element("text");if(n.element("syllabic")&&(a=n.element("syllabic").value),o){let l="",h=n.elements();for(let d of h)(d.name==="text"||d.name==="elision")&&(l+=d.value);if(l=l.replace("  "," "),n.element("elision")!==void 0&&l==="-"){let d=n.elements(),f=0;for(let g=0;g<d.length;g++)if(d[g].name==="elision"){f=g;break}let p,m;if(f>0)for(let g=f;g<d.length;g++){let b=d[g];b.name==="text"&&(p=b),b.name==="syllabic"&&(m=b)}p!==void 0&&m&&(o=p,a="middle")}let u="1";n.attributes()!==void 0&&n.attribute("number")&&(u=n.attribute("number").value);let c;if(a==="single"||a==="end"){if(this.openLyricWords[u]){this.currentLyricWord=this.openLyricWords[u];let d=this.currentLyricWord.Syllables.length;c=new ls(l,u,this.currentLyricWord,t,d),this.currentLyricWord.Syllables.push(c),delete this.openLyricWords[u],this.currentLyricWord=void 0}else c=new ls(l,u,void 0,t);c.extend=n.element("extend")!==void 0}else if(a==="begin")this.openLyricWords[u]&&(delete this.openLyricWords[u],this.currentLyricWord=void 0),this.currentLyricWord=new Hu,this.openLyricWords[u]=this.currentLyricWord,c=new ls(l,u,this.currentLyricWord,t,0),this.currentLyricWord.Syllables.push(c);else if(a==="middle")if(this.openLyricWords[u]){this.currentLyricWord=this.openLyricWords[u];let d=this.currentLyricWord.Syllables.length;c=new ls(l,u,this.currentLyricWord,t,d),this.currentLyricWord.Syllables.push(c)}else c=new ls(l,u,void 0,t);c&&(t.LyricsEntries[u]||(t.LyricsEntries.setValue(u,c),t.ParentSourceStaffEntry?.VerticalContainerParent?.ParentMeasure&&(t.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.hasLyrics=!0)),t.ParentVoice.Parent.LyricVersesNumbers.includes(u)||t.ParentVoice.Parent.LyricVersesNumbers.push(u))}}}catch{let a=Tt.translateText("ReaderErrorMessages/LyricError","Error while reading lyric entry.");this.musicSheet.SheetErrors.pushMeasureError(a);continue}}}}},Cl=class{constructor(e){this.linkStaffEntries=[],this.voiceEntry=e}get GetVoiceEntry(){return this.voiceEntry}get LinkStaffEntries(){return this.linkStaffEntries}set LinkStaffEntries(e){this.linkStaffEntries=e}},zr=class{constructor(e,t){this.articulationEnum=e,this.placement=t}Equals(e){return e.articulationEnum===this.articulationEnum&&e.placement===this.placement}},Xu=class{constructor(){}get StartNote(){return this.startNote}set StartNote(e){this.startNote=e}get EndNote(){return this.endNote}set EndNote(e){this.endNote=e}startNoteHasMoreStartingSlurs(){if(!this.startNote)return!1;for(let e=0,t=this.startNote.NoteSlurs.length;e<t;++e){let i=this.startNote.NoteSlurs[e];if(i!==this&&i.StartNote===this.startNote)return!0}return!1}endNoteHasMoreEndingSlurs(){if(!this.endNote)return!1;for(let e=0,t=this.endNote.NoteSlurs.length;e<t;++e){let i=this.endNote.NoteSlurs[e];if(i!==this&&i.EndNote===this.endNote)return!0}return!1}isCrossed(){return this.startNote.ParentStaffEntry.ParentStaff!==this.endNote.ParentStaffEntry.ParentStaff}isSlurLonger(){if(!this.endNote||!this.startNote)return!1;let e=N.minus(this.endNote.getAbsoluteTimestamp(),this.startNote.getAbsoluteTimestamp());for(let t=0,i=this.startNote.NoteSlurs.length;t<i;++t){let s=this.startNote.NoteSlurs[t];if(s!==this&&s.EndNote!==void 0&&s.StartNote!==void 0&&N.minus(s.EndNote.getAbsoluteTimestamp(),s.StartNote.getAbsoluteTimestamp()).CompareTo(e)===-1)return!0}for(let t=0,i=this.endNote.NoteSlurs.length;t<i;++t){let s=this.endNote.NoteSlurs[t];if(s!==this&&s.EndNote!==void 0&&s.StartNote!==void 0&&N.minus(s.EndNote.getAbsoluteTimestamp(),s.StartNote.getAbsoluteTimestamp()).CompareTo(e))return!0}return!1}},Nl=class{constructor(e){this.rules=e}getAccEnumFromString(e){switch(e){case"sharp":return q.SHARP;case"flat":return q.FLAT;case"natural":return q.NATURAL;case"double-sharp":case"sharp-sharp":return q.DOUBLESHARP;case"double-flat":case"flat-flat":return q.DOUBLEFLAT;case"triple-sharp":return q.TRIPLESHARP;case"triple-flat":return q.TRIPLEFLAT;case"quarter-sharp":return q.QUARTERTONESHARP;case"quarter-flat":return q.QUARTERTONEFLAT;case"three-quarters-sharp":return q.THREEQUARTERSSHARP;case"three-quarters-flat":return q.THREEQUARTERSFLAT;case"slash-quarter-sharp":return q.SLASHQUARTERSHARP;case"slash-sharp":return q.SLASHSHARP;case"double-slash-flat":return q.DOUBLESLASHFLAT;case"sori":return q.SORI;case"koron":return q.KORON;default:return q.NONE}}addArticulationExpression(e,t){if(e!==void 0&&e.elements().length>0){let i=e.elements();for(let s=0,r=i.length;s<r;++s){let n=i[s],a=n.name;try{a=a.replace("-","");let o=Et[a];if(As.isSupportedArticulation(o)){let l=C.NotYetDefined,h=n.attribute("placement")?.value;h==="above"?l=C.Above:h==="below"&&(l=C.Below);let u=new zr(o,l);if(a==="staccato")t.Articulations.length>0&&t.Articulations[0].articulationEnum!==Et.staccato&&t.Articulations.splice(0,0,u);else if(a==="breathmark")l===C.NotYetDefined&&(u.placement=C.Above);else if(a==="strongaccent"){let c=n?.attribute("type")?.value;c==="up"?u.articulationEnum=Et.marcatoup:c==="down"&&(u.articulationEnum=Et.marcatodown)}else if(o===Et.softaccent){let c=t.ParentSourceStaffEntry.ParentStaff.Id-1;l===C.NotYetDefined&&(l=C.Above,c>0&&(l=C.Below));let d=t.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure,f=new bl(d,t.Timestamp);f.StartingContinuousDynamic=new Ue(ne.crescendo,l,c,d,-1),f.StartingContinuousDynamic.IsStartOfSoftAccent=!0,f.StartingContinuousDynamic.StartMultiExpression=f,f.StartingContinuousDynamic.EndMultiExpression=f,f.EndingContinuousDynamic=new Ue(ne.diminuendo,l,c,d,-1),f.EndingContinuousDynamic.StartMultiExpression=f,f.EndingContinuousDynamic.EndMultiExpression=f,d.StaffLinkedExpressions[c].push(f)}t.hasArticulation(u)||t.Articulations.push(u)}}catch(o){W.default.debug("addArticulationExpression","Invalid note articulation.",o);return}}}}addFermata(e,t){let i=Et.fermata;e.attributes().length>0&&e.attribute("type")&&e.attribute("type").value==="inverted"&&(i=Et.invertedfermata);let s=C.Above;e.attribute("placement")?.value==="below"&&(s=C.Below),t.Articulations.push(new zr(i,s))}addTechnicalArticulations(e,t,i){let s={bend:Et.bend,"down-bow":Et.downbow,"open-string":Et.naturalharmonic,"snap-pizzicato":Et.snappizzicato,stopped:Et.lefthandpizzicato,"up-bow":Et.upbow,harmonic:Et.naturalharmonic};for(let a in s){if(!s.hasOwnProperty(a))continue;let o=s[a],l=e.element(a);if(l){let h;l.attribute("placement")?.value==="above"&&(h=C.Above),l.attribute("placement")?.value==="below"&&(h=C.Below);let u=new zr(o,h);t.hasArticulation(u)||t.Articulations.push(u)}}let r=e.elements("fingering");for(let a of r){let o=this.createTechnicalInstruction(a,i);o.type=xs.Fingering,i.Fingering||(i.Fingering=o),t.TechnicalInstructions.push(o)}let n=e.element("string");if(n){let a=this.createTechnicalInstruction(n,i);a.type=xs.String,i.StringInstruction=a,t.TechnicalInstructions.push(a)}}createTechnicalInstruction(e,t){let i=new bo;i.sourceNote=t,i.value=e.value;let s=e.attribute("placement");return this.rules.FingeringPositionFromXML&&(i.placement=this.getPlacement(s)),i}
71getPlacement(e,t=C.NotYetDefined){if(t!==C.NotYetDefined)return t;if(e)switch(e.value){case"above":return C.Above;case"below":return C.Below;case"left":return C.Left;case"right":return C.Right;default:return C.NotYetDefined}else return C.NotYetDefined}addOrnament(e,t){if(e){let i,s={"delayed-inverted-turn":he.DelayedInvertedTurn,"delayed-turn":he.DelayedTurn,"inverted-mordent":he.InvertedMordent,"inverted-turn":he.InvertedTurn,mordent:he.Mordent,"trill-mark":he.Trill,turn:he.Turn};for(let r in s){if(!s.hasOwnProperty(r))continue;let n=e.element(r);if(n){i=new fo(s[r]);let a=n.attribute("placement");a&&a.value==="below"&&(i.placement=C.Below)}}if(i){let r=e.elements("accidental-mark");if(r){let n=C.Below,a=q.NONE,o=r;for(let l=0,h=o.length;l<h;++l){let u=o[l],c=u.value;a=this.getAccEnumFromString(c);let d=u.attribute("placement");u.hasAttributes&&d&&(c=d.value,c==="above"?n=C.Above:c==="below"&&(n=C.Below)),n===C.Above?i.AccidentalAbove=a:n===C.Below&&(i.AccidentalBelow=a)}}t.OrnamentContainer=i}}}},Tn=class{constructor(e,t,i,s,r=void 0){this.openBeams=[],this.beamNumberOffset=0,this.currentOctaveShift=0,this.tupletDict={},this.openTupletNumber=0,this.staff=t,this.instrument=t.ParentInstrument,this.musicSheet=this.instrument.GetMusicSheet,this.slurReader=s,this.pluginManager=e,r?this.voice=new ki(this.instrument,i,r):this.voice=new Rs(this.instrument,i),this.instrument.Voices.push(this.voice),this.staff.Voices.push(this.voice),this.lyricsReader=new Rl(this.musicSheet),this.articulationReader=new Nl(this.musicSheet.Rules)}get openTieDict(){return this.staff.openTieDict}get GetVoice(){return this.voice}get OctaveShift(){return this.currentOctaveShift}set OctaveShift(e){this.currentOctaveShift=e}createVoiceEntry(e,t,i,s=!1,r=!1,n=!1){this.currentVoiceEntry=new As(e.clone(),this.voice,t,s,r,n),i&&this.voice.VoiceEntries.push(this.currentVoiceEntry)}read(e,t,i,s,r,n,a,o,l,h,u,c,d,f,p,m,g,b,S,E,y){this.currentStaffEntry=a,this.currentMeasure=o;try{this.currentNote=n?this.addRestNote(e.element("rest"),t,s,i,r,d,f,S):this.addSingleNote(e,t,s,i,r,u,c,d,f,p,m,g,b,S,E),this.currentNote.DotsXml=y;let M=e.elements("lyric");this.lyricsReader!==void 0&&M&&(this.lyricsReader.addLyricEntry(M,this.currentVoiceEntry),this.voice.Parent.HasLyrics=!0);let P=!1,L=e.element("notations");if(L){this.articulationReader&&this.readArticulations(L,this.currentVoiceEntry,this.currentNote);let B=L.elements("slur"),A=L.elements("slide"),G=L.elements("glissando");this.slurReader!==void 0&&(B.length>0||A.length>0)&&!this.currentNote.ParentVoiceEntry.IsGrace&&(this.slurReader.addSlur(B,this.currentNote),A.length>0&&this.slurReader.addSlur(A,this.currentNote),G.length>0&&this.slurReader.addSlur(G,this.currentNote));let H=L.elements("tuplet");H.length>0&&(this.openTupletNumber=this.addTuplet(e,H),P=!0);let T=L.element("arpeggiate");if(T!==void 0){let U;if(this.currentVoiceEntry.Arpeggio)U=this.currentVoiceEntry.Arpeggio;else{let dt=!1;for(let Y of this.currentStaffEntry.VoiceEntries)if(Y.Arpeggio){dt=!0,U=Y.Arpeggio;break}if(!dt){let Y=Ge.ARPEGGIO_DIRECTIONLESS,at=T.attribute("direction");if(at)switch(at.value){case"up":Y=Ge.ROLL_UP;break;case"down":Y=Ge.ROLL_DOWN;break;default:Y=Ge.ARPEGGIO_DIRECTIONLESS}U=new ml(this.currentVoiceEntry,Y),this.currentVoiceEntry.Arpeggio=U}}U.addNote(this.currentNote)}let I=L.elements("tied");I.length>0&&this.addTie(I,l,h,Ws.SIMPLE);let v=L.element("technical");if(v){let U=v.elements("hammer-on");U.length>0&&this.addTie(U,l,h,Ws.HAMMERON);let dt=v.elements("pull-off");dt.length>0&&this.addTie(dt,l,h,Ws.PULLOFF)}}e.element("time-modification")!==void 0&&!P&&this.handleTimeModificationNode(e)}catch(M){W.default.warn(M);let P=Tt.translateText("ReaderErrorMessages/NoteError","Ignored erroneous Note.");this.musicSheet.SheetErrors.pushMeasureError(P),this.musicSheet.SheetErrors.pushMeasureError(M)}return this.currentNote}checkForStaffEntryLink(e,t,i,s){let r=new Cl(this.currentVoiceEntry);r.LinkStaffEntries.push(i),i.Link=r;let n=this.currentVoiceEntry.Timestamp.clone(),a=s.getVerticalContainerByTimestamp(n);return i=a.StaffEntries[e],i||(i=new be(a,t),a.StaffEntries[e]=i),i.VoiceEntries.push(this.currentVoiceEntry),r.LinkStaffEntries.push(i),i.Link=r,i}checkForOpenBeam(){this.openBeams.length>0&&this.currentNote&&this.handleOpenBeam()}checkOpenTies(){let e=this.openTieDict;for(let t in e)if(e.hasOwnProperty(t)){let i=e[t];N.plus(i.StartNote.ParentStaffEntry.Timestamp,i.Duration).lt(i.StartNote.SourceMeasure.Duration)&&delete e[t]}}hasVoiceEntry(){return this.currentVoiceEntry!==void 0}readArticulations(e,t,i){let s=e.element("articulations");s&&this.articulationReader.addArticulationExpression(s,t);let r=e.element("fermata");r&&this.articulationReader.addFermata(r,t);let n=e.element("technical");n&&this.articulationReader.addTechnicalArticulations(n,t,i);let a=e.element("ornaments");a&&this.articulationReader.addOrnament(a,t)}addSingleNote(e,t,i,s,r,n,a,o,l,h,u,c,d,f,p){let m=0,g,b=q.NONE,S=ut.C,E=ut.C,y=0,M=0,P,L,B,A=e.elements();for(let Y=0,at=A.length;Y<at;++Y){let X=A[Y];try{if(X.name==="pitch"){let Z=X.elements();for(let O=0,V=Z.length;O<V;++O){let ht=Z[O];L=void 0,B=void 0;try{if(ht.name==="step"){if(S=ut[ht.value],S===void 0){let nt=Tt.translateText("ReaderErrorMessages/NotePitchError","Invalid pitch while reading note.");throw this.musicSheet.SheetErrors.pushMeasureError(nt),new Se(nt,void 0)}}else if(ht.name==="alter"){if(m=parseFloat(ht.value),isNaN(m)){let nt=Tt.translateText("ReaderErrorMessages/NoteAlterationError","Invalid alteration while reading note.");throw this.musicSheet.SheetErrors.pushMeasureError(nt),new Se(nt,void 0)}b=Ct.AccidentalFromHalfTones(m)}else if(ht.name==="octave"&&(y=parseInt(ht.value,10),isNaN(y))){let nt=Tt.translateText("ReaderErrorMessages/NoteOctaveError","Invalid octave value while reading note.");throw this.musicSheet.SheetErrors.pushMeasureError(nt),new Se(nt,void 0)}}catch(nt){W.default.info("VoiceGenerator.addSingleNote read Step: ",nt.message)}}}else if(X.name==="accidental")g=X.value,g==="natural"?b=q.NATURAL:g==="slash-flat"?b=q.SLASHFLAT:g==="slash-quarter-sharp"?b=q.SLASHQUARTERSHARP:g==="slash-sharp"?b=q.SLASHSHARP:g==="double-slash-flat"?b=q.DOUBLESLASHFLAT:g==="sori"?b=q.SORI:g==="koron"&&(b=q.KORON);
71else if(X.name==="unpitched"){let Z=X.element("display-step"),O=X.element("display-octave");if(O&&(y=parseInt(O.value,10),M=y-3,a&&(y+=1),this.instrument.Staves[0].StafflineCount===1&&(M+=1)),Z){S=ut[Z.value.toUpperCase()];let V=0,ht=this.musicSheet.Rules.PercussionXMLDisplayStepNoteValueShift;this.instrument.Staves[0].StafflineCount===1&&(ht-=3),[E,V]=Ct.lineShiftFromNoteEnum(S,ht),M+=V}}else X.name==="instrument"?X.firstAttribute&&(P=X.firstAttribute.value):X.name==="notehead"&&(L=X.value,X.attribute("filled")&&(B=X.attribute("filled").value==="yes"))}catch(Z){W.default.info("VoiceGenerator.addSingleNote: ",Z)}}y-=Ct.OctaveXmlDifference;let G=new Ct(S,y,b,g),H=N.createFromFraction(t),T,I=-1,v=-1,U=[],dt=e.element("notations");if(dt){let Y=dt.element("technical");if(Y){let at=Y.element("string");at&&(I=parseInt(at.value,10));let X=Y.element("fret");X&&(v=parseInt(X.value,10)),Y.elements("bend").forEach(function(Z){let O=Z.element("bend-alter");Z.element("release")===void 0?U.push({bendalter:parseInt(O.value,10),direction:"up"}):U.push({bendalter:parseInt(O.value,10),direction:"down"})})}}return T=I<0||v<0?new Di(this.currentVoiceEntry,this.currentStaffEntry,H,G,this.currentMeasure):new kn(this.currentVoiceEntry,this.currentStaffEntry,H,G,this.currentMeasure,I,v,U,p),this.addNoteInfo(T,i,o,l,r,E,M,f,f),T.TypeLength=s,T.IsGraceNote=h,T.StemDirectionXml=u,T.TremoloInfo=c,T.PlaybackInstrumentId=P,(L!==void 0&&L!=="normal"||B!==void 0)&&(T.Notehead=new xo(T,L,B)),u===Rt.None&&(d="#00000000"),this.currentVoiceEntry.Notes.push(T),this.currentVoiceEntry.StemDirectionXml=u,d&&(this.currentVoiceEntry.StemColorXml=d,this.currentVoiceEntry.StemColor=d,T.StemColorXml=d),e.elements("beam")&&!n&&this.createBeam(e,T),T}addRestNote(e,t,i,s,r,n,a,o){let l=N.createFromFraction(t),h=e.element("display-step"),u=e.element("display-octave"),c,d,f;h&&u&&(c=ut[h.value.toUpperCase()],d=parseInt(u.value,10),f=new Ct(c,d,q.NONE,void 0,!0));let p=new Di(this.currentVoiceEntry,this.currentStaffEntry,l,f,this.currentMeasure,!0);return this.addNoteInfo(p,i,n,a,r,c,d,o,o),p.TypeLength=s,this.currentVoiceEntry.Notes.push(p),this.openBeams.length>0&&this.openBeams.last().ExtendedNoteList.push(p),p}addNoteInfo(e,t,i,s,r,n,a,o,l){e.NoteTypeXml=t,e.PrintObject=i,e.IsCueNote=s,e.NormalNotes=r,e.displayStepUnpitched=n,e.displayOctaveUnpitched=a,e.NoteheadColorXml=o,e.NoteheadColor=o}createBeam(e,t){try{let i=e.element("beam"),s;if(i!==void 0&&i.hasAttributes&&(s=i.attribute("number")),s){let r=parseInt(s.value,10),n=e.elements("beam"),a=n[0].value;n&&(a==="begin"?(r===this.openBeams.last()?.BeamNumber?(this.beamNumberOffset++,r+=this.beamNumberOffset):this.openBeams.last()&&this.handleOpenBeam(),this.openBeams.push(new fr(r,this.beamNumberOffset))):r+=this.beamNumberOffset);let o=!1;if(!(r>0&&r<=this.openBeams.length)||!this.openBeams[r-1]){W.default.debug("[OSMD] invalid beamnumber");return}for(let l=0,h=this.openBeams[r-1].Notes.length;l<h;++l){let u=this.openBeams[r-1].Notes[l];this.currentVoiceEntry===u.ParentVoiceEntry&&(o=!0)}if(!o){let l=this.openBeams[r-1];if(l.addNoteToBeam(t),a==="continue"&&n.length>1){for(let h=1;h<n.length;h++)if(n[h].value==="end"){let u=l.Notes.length-1;u>0&&l.SecondaryBreakIndices.push(u);break}}a==="end"&&this.endBeam()}}}catch(i){let s=Tt.translateText("ReaderErrorMessages/BeamError","Error while reading beam.");throw this.musicSheet.SheetErrors.pushMeasureError(s),new Se("",i)}}endBeam(){this.openBeams.pop(),this.beamNumberOffset=Math.max(0,this.beamNumberOffset-1)}handleOpenBeam(){let e=this.openBeams.last();if(e.Notes.length===0){this.endBeam();return}if(e.Notes.length===1){let t=e.Notes[0];t.NoteBeam=void 0,this.endBeam();return}if(this.currentNote===Le.last(e.Notes))this.endBeam();else{let t=Le.last(e.Notes).ParentStaffEntry,i=this.currentMeasure.getVerticalContainerIndexByTimestamp(t.Timestamp),s=t.VerticalContainerParent.StaffEntries.indexOf(t);if(i<this.currentMeasure.VerticalSourceStaffEntryContainers.length-1){let r=this.currentMeasure.VerticalSourceStaffEntryContainers[i+1].StaffEntries[s];if(r)for(let n=0,a=r.VoiceEntries.length;n<a;++n){let o=r.VoiceEntries[n];if(o.ParentVoice===this.voice){let l=o.Notes[0];l.Length.lte(new N(1,8))&&this.openBeams.last().addNoteToBeam(l),this.endBeam()}}}else this.endBeam()}}addTuplet(e,t){let i=!1,s;if(t!==void 0&&t.length>1){let r=e.element("time-modification");r&&(r=r.element("actual-notes"));let n=t;for(let a=0,o=n.length;a<o;++a){let l=n[a];if(l!==void 0&&l.attributes()){let h=l.attribute("bracket");h&&h.value==="yes"?(i=!0,s=!0):h&&h.value==="no"&&(s=!1);let u=this.musicSheet.Rules.TupletsRatioed,c=l.attribute("show-number");c&&c.value==="both"&&this.musicSheet.Rules.TupletsRatioedUseXMLValue&&(u=!0);let d=this.readShowNumberNoneGiven(l),f=l.attribute("type");if(f&&f.value==="start"){let p=1;l.attribute("number")&&(p=parseInt(l.attribute("number").value,10));let m=0;if(r&&(m=parseInt(r.value,10),isNaN(m))){let E=Tt.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(E),new Se(E,void 0)}let g=new wn(m,i);
71g.Ratioed=u,g.BracketedXmlValue=s,g.ShowNumberNoneGivenInXml=d,g.tupletLabelNumberPlacement=C.Above;let b=l.attribute("placement");b&&(b.value==="below"&&(g.tupletLabelNumberPlacement=C.Below),g.PlacementFromXml=!0),this.tupletDict[p]&&(delete this.tupletDict[p],Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--),this.tupletDict[p]=g;let S=[];S.push(this.currentNote),g.Notes.push(S),g.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=g,this.openTupletNumber=p}else if(f.value==="stop"){let p=1;l.attribute("number")&&(p=parseInt(l.attribute("number").value,10));let m=this.tupletDict[p];if(m){let g=l.attribute("placement");g&&(g.value==="below"?m.tupletLabelNumberPlacement=C.Below:m.tupletLabelNumberPlacement=C.Above,m.PlacementFromXml=!0);let b=[];if(b.push(this.currentNote),m.Notes.push(b),!m.PlacementFromXml){let S=!1;for(let E of m.Notes){for(let y of E)if(!y.isRest()){y.StemDirectionXml===Rt.Down?m.tupletLabelNumberPlacement=C.Below:m.tupletLabelNumberPlacement=C.Above,S=!0;break}if(S)break}}m.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=m,delete this.tupletDict[p],Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--}}}}}else if(t[0]){let r=t[0];if(r.hasAttributes){let n=r.attribute("type").value,a=1;r.attribute("number")&&(a=parseInt(r.attribute("number").value,10));let o=isNaN(a),l=this.readShowNumberNoneGiven(r),h=r.attribute("bracket");h&&h.value==="yes"?(i=!0,s=!0):h&&h.value==="no"&&(s=!1);let u=this.musicSheet.Rules.TupletsRatioed,c=r.attribute("show-number");if(c&&c.value==="both"&&this.musicSheet.Rules.TupletsRatioedUseXMLValue&&(u=!0),n==="start"){let d=0,f=e.element("time-modification");if(f&&(f=f.element("actual-notes")),f&&(d=parseInt(f.value,10),isNaN(d))){let b=Tt.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(b),new Se(b)}o&&(this.openTupletNumber++,a=this.openTupletNumber);let p=this.tupletDict[a];p||(p=this.tupletDict[a]=new wn(d,i),p.Ratioed=u,p.BracketedXmlValue=s,p.ShowNumberNoneGivenInXml=l,p.tupletLabelNumberPlacement=C.Above);let m=r.attribute("placement");m&&(m.value==="below"?p.tupletLabelNumberPlacement=C.Below:p.tupletLabelNumberPlacement=C.Above,p.PlacementFromXml=!0);let g=[];g.push(this.currentNote),p.Notes.push(g),p.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=p,this.openTupletNumber=a}else if(n==="stop"){o&&(a=this.openTupletNumber);let d=this.tupletDict[this.openTupletNumber];if(d){let f=r.attribute("placement");f&&(f.value==="below"?d.tupletLabelNumberPlacement=C.Below:d.tupletLabelNumberPlacement=C.Above,d.PlacementFromXml=!0);let p=[];if(p.push(this.currentNote),d.Notes.push(p),!d.PlacementFromXml){let m=!1;for(let g of d.Notes){for(let b of g)if(!b.isRest()){b.StemDirectionXml===Rt.Down?d.tupletLabelNumberPlacement=C.Below:d.tupletLabelNumberPlacement=C.Above,m=!0;break}if(m)break}}d.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=d,Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--,delete this.tupletDict[a]}}}}return this.openTupletNumber}readShowNumberNoneGiven(e){let t=e.attribute("show-number");return!!(t?.value&&t.value==="none")}handleTimeModificationNode(e){if(this.tupletDict[this.openTupletNumber])try{let t=this.tupletDict[this.openTupletNumber],i=Le.last(t.Notes),s=i[0].ParentVoiceEntry,r;s.Timestamp.Equals(this.currentVoiceEntry.Timestamp)?r=i:(r=[],t.Notes.push(r),t.Fractions.push(this.getTupletNoteDurationFromType(e))),r.push(this.currentNote),this.currentNote.NoteTuplet=t}catch(t){let i=Tt.translateText("ReaderErrorMessages/TupletNumberError","Invalid tuplet number.");throw this.musicSheet.SheetErrors.pushMeasureError(i),t}else if(this.currentVoiceEntry.Notes.length>0){let t=this.currentVoiceEntry.Notes[0];if(t.NoteTuplet){let i=t.NoteTuplet;Le.last(i.Notes).push(this.currentNote),this.currentNote.NoteTuplet=i}}}addTie(e,t,i,s){if(e){if(e.length===1){let r=e[0];if(r!==void 0&&r.attributes()){let n=this.getTieDirection(r),a=r.attribute("type").value;try{if(a==="start"){let o=this.findCurrentNoteInTieDict(this.currentNote);o<0&&delete this.openTieDict[o];let l=this.getNextAvailableNumberForTie(),h=new Al(this.currentNote,s);this.openTieDict[l]=h,h.TieNumber=l,h.TieDirection=n}else if(a==="stop"){let o=this.findCurrentNoteInTieDict(this.currentNote),l=this.openTieDict[o];l&&(l.AddNote(this.currentNote),delete this.openTieDict[o])}}catch{let o=Tt.translateText("ReaderErrorMessages/TieError","Error while reading tie.");this.musicSheet.SheetErrors.pushMeasureError(o)}}}else if(e.length===2){let r=this.findCurrentNoteInTieDict(this.currentNote);if(r>=0){let n=this.openTieDict[r];n.AddNote(this.currentNote);for(let a of e)if(a.attribute("type").value==="start"){let o=this.getTieDirection(a);n.NoteIndexToTieDirection[n.Notes.length-1]=o}}}}}getTieDirection(e){let t=C.NotYetDefined,i=e.attribute("placement");
71i&&(i.value==="above"?t=C.Above:i.value==="below"&&(t=C.Below));let s=e.attribute("orientation");return s&&(s.value==="over"?t=C.Above:s.value==="under"&&(t=C.Below)),t}getNextAvailableNumberForTie(){let e=Object.keys(this.openTieDict);if(e.length===0)return 1;e.sort((t,i)=>t-+i);for(let t=0;t<e.length;t++)if(""+(t+1)!==e[t])return t+1;return+e[e.length-1]+1}findCurrentNoteInTieDict(e){let t=this.openTieDict;for(let i in t)if(t.hasOwnProperty(i)){let s=t[i],r=s.Notes[0],n=e;if(s.Pitch.FundamentalNote===e.Pitch.FundamentalNote&&s.Pitch.Octave===e.Pitch.Octave||r.StringNumberTab!==void 0&&r.StringNumberTab===n.StringNumberTab)return parseInt(i,10)}return-1}getTupletNoteDurationFromType(e){if(e.element("type")){let t=e.element("type");if(t){let i=t.value;try{return Zi.getNoteDurationFromType(i)}catch(s){let r=Tt.translateText("ReaderErrorMessages/NoteDurationError","Invalid note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(r),new Se("",s)}}}}},Il=class Bl{static readChordSymbol(t,i,s){let r=t.element("root"),n=t.element("kind"),a=t.element("numeral"),o=n.attribute("text");if(!r&&!a)return;let l,h=t.element("bass");if(h){let y=h.element("bass-step"),M=h.element("bass-alter"),P=ut.C;if(y)try{P=ut[y.value.trim()]}catch(B){let A=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");i.SheetErrors.pushMeasureError(A),W.default.debug("InstrumentReader.readChordSymbol",A,B);return}let L=q.NONE;if(M)try{L=Ct.AccidentalFromHalfTones(parseInt(M.value,10))}catch(B){let A=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");i.SheetErrors.pushMeasureError(A),W.default.debug("InstrumentReader.readChordSymbol",A,B)}l=new Ct(P,1,L)}let u=[],c=t.elements("degree");for(let y of c)if(y){let M=y.element("degree-value"),P=y.element("degree-alter"),L=y.element("degree-type");if(!M||!P||!L)return;let B;try{B=parseInt(M.value.trim(),10)}catch(H){let T=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");i.SheetErrors.pushMeasureError(T),W.default.debug("InstrumentReader.readChordSymbol",T,H);return}let A;try{A=Ct.AccidentalFromHalfTones(parseInt(P.value,10))}catch(H){let T=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");i.SheetErrors.pushMeasureError(T),W.default.debug("InstrumentReader.readChordSymbol",T,H);return}let G;try{G=gs[L.value.trim().toLowerCase()]}catch(H){let T=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");i.SheetErrors.pushMeasureError(T),W.default.debug("InstrumentReader.readChordSymbol",T,H);return}u.push(new oo(B,A,G))}let d=Bl.readPlacement(t);if(d!==C.Below&&(d=C.Above),a){let y=a.element("numeral-root"),M=y?.attribute("text")?.value??y?.value,P=new rr(void 0,Gt.none,l,u,i.Rules,d);return P.NumeralText=M,P}let f=r.element("root-step"),p=r.element("root-alter");if(r&&!f)return;let m;try{m=ut[f.value.trim()]}catch(y){let M=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");i.SheetErrors.pushMeasureError(M),W.default.debug("InstrumentReader.readChordSymbol",M,y);return}let g=q.NONE;if(p)try{g=Ct.AccidentalFromHalfTones(parseInt(p.value,10))}catch(y){let M=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");i.SheetErrors.pushMeasureError(M),W.default.debug("InstrumentReader.readChordSymbol",M,y)}let b=new Ct(m,1,g),S=n.value.trim().replace("-","");if(o)switch(o.value){case"aug":S="augmented";break;case"dim":S="diminished";break;default:}let E;try{E=Gt[S]}catch(y){let M=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");i.SheetErrors.pushMeasureError(M),W.default.debug("InstrumentReader.readChordSymbol",M,y);return}return new rr(b,E,l,u,i.Rules,d)}static readPlacement(t){let i=t.attribute("placement")?.value;return i==="above"?C.Above:i==="below"?C.Below:C.NotYetDefined}},Xa=class{constructor(e=!1,t=!0){this.ChangeEnd=!1,this.ChangeBegin=!1,this.EndsStave=!1,this.BeginsStave=!1,this.line=e,this.sign=t}get IsLine(){return this.line}get IsSign(){return this.sign}},kl=class{constructor(e,t,i){this.openContinuousDynamicExpressions=[],this.openOctaveShifts=new Map,this.pendingOctaveShiftStops=new Map,this.musicSheet=e,this.staffNumber=i,this.globalStaffIndex=e.getGlobalStaffIndexOfFirstStaff(t)+(i-1),this.initialize()}readExpressionParameters(e,t,i,s,r,n,a){this.initialize(),this.divisions=i;let o=e.element("offset");if(o!==void 0&&!a)try{this.offsetDivisions=parseInt(o.value,10)}catch(c){let d="ReaderErrorMessages/ExpressionOffsetError, Invalid expression offset -> set to default.";W.default.debug("ExpressionReader.readExpressionParameters",d,c),this.musicSheet.SheetErrors.pushMeasureError(d),this.offsetDivisions=0}this.directionTimestamp=N.createFromFraction(s);let l=new N(Math.abs(this.offsetDivisions),i*4);this.offsetDivisions>0?s.RealValue>0?(l=N.multiply(N.minus(s,r),l),this.directionTimestamp=N.plus(l,s)):this.directionTimestamp=N.createFromFraction(l):this.offsetDivisions<0&&(s.RealValue>0?(l=N.multiply(N.minus(s,r),l),this.directionTimestamp=N.minus(s,l)):this.directionTimestamp=N.createFromFraction(l));let h=e.elements("direction-type"),u=e.attribute("placement");
71if(u)try{let c=u.value;c==="below"?this.placement=C.Below:c==="above"&&(this.placement=C.Above)}catch(c){let d=Tt.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");W.default.debug("ExpressionReader.readExpressionParameters",d,c),this.musicSheet.SheetErrors.pushMeasureError(d),this.placement=C.Below}try{for(let c of h){let d=c.element("wedge");if(d){let f=d.attribute("default-y");f&&(this.WedgeYPosXml=parseInt(f.value,10),this.placement===C.NotYetDefined&&this.readExpressionPlacement(f,"read wedge y pos"))}if(this.placement===C.NotYetDefined){let f=c.element("dynamics");if(f){let g=f.attribute("default-y");g&&this.readExpressionPlacement(g,"read dynamics y pos")}let p=c.element("words");if(p){let g=p.attribute("default-y");g&&this.readExpressionPlacement(g,"read words y pos")}let m=c.element("rehearsal");if(m){let g=m.attribute("default-y");g&&this.readExpressionPlacement(g,"read rehearsal pos")}}}}catch(c){let d=Tt.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement. Set to default.");W.default.debug("ExpressionReader.readExpressionParameters",d,c),this.musicSheet.SheetErrors.pushMeasureError(d),this.placement=C.Below}this.placement===C.NotYetDefined&&(t.Staves.length>1?this.placement=C.Below:t.HasLyrics?this.placement=C.Above:this.placement=C.Below)}read(e,t,i,s=void 0){let r=!1,n=!1,a=i.clone(),o=e.element("offset");if(o?.value){let u=Number.parseInt(o.value,10);a.Add(new N(u,4*this.divisions))}let l=e.element("sound");if(l){let u=l.attribute("tempo"),c=l.attribute("dynamics");if(u&&(u.value.match(/^(\d+)(\.\d+)?$/)?.length>0?this.soundTempo=Math.round(Number.parseFloat(u.value)):(W.default.info("invalid xml tempo: "+u.value),this.soundTempo=100),t.TempoInBPM=this.soundTempo,this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,r=!0),c){let d=c.value.match(/\d+/);this.soundDynamic=d===void 0?100:parseInt(d[0],10),n=!0}}let h=e.elements("direction-type");for(let u of h){let c=u.element("metronome");if(c){let d=c.element("beat-unit"),f=c.element("beat-unit-dot")!==void 0,p=c.element("per-minute");if(d!==void 0&&p){c.hasAttributes&&c.attribute("default-x")!==void 0&&(this.directionTimestamp=N.createFromFraction(a));let m=p.value.match(/(\d+\.?\d*)/),g=m?parseFloat(m[1]):NaN;this.createNewTempoExpressionIfNeeded(t);let b=new Fe(void 0,this.placement,this.staffNumber,g,this.currentMultiTempoExpression,!0);b.parentMeasure=t,this.soundTempo=g,t.TempoInBPM=this.soundTempo*(f?1.5:1),this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,b.dotted=f,b.beatUnit=d.value,this.currentMultiTempoExpression.addExpression(b,""),this.currentMultiTempoExpression.CombinedExpressionsText="test"}continue}if(c=u.element("dynamics"),c){let d=e.element("notations")!==void 0;this.interpretInstantaneousDynamics(c,t,a,d);continue}if(c=u.element("words"),c){if(r){this.createNewTempoExpressionIfNeeded(t),this.currentMultiTempoExpression.CombinedExpressionsText=c.value;let d=new Fe(c.value,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);this.currentMultiTempoExpression.addExpression(d,"")}else n||this.interpretWords(c,t,a);continue}if(c=u.element("wedge"),c){this.interpretWedge(e,c,t,s,t.MeasureNumber);continue}if(c=u.element("rehearsal"),c){this.interpretRehearsalMark(c,t,i,t.MeasureNumber);continue}}}closeOpenExpressions(e,t){for(let i of this.openContinuousDynamicExpressions)this.createNewMultiExpressionIfNeeded(e,i.NumberXml,t),this.closeOpenContinuousDynamic(i,e,t);this.openContinuousTempoExpression&&this.closeOpenContinuousTempo(N.plus(e.AbsoluteTimestamp,t))}addOctaveShift(e,t,i){let s=1,r=e.element("staff");if(r)try{s=parseInt(r.value,10)}catch(o){let l=Tt.translateText("ReaderErrorMessages/OctaveShiftStaffError","Invalid octave shift staff number. Set to default");this.musicSheet.SheetErrors.pushMeasureError(l),s=1,W.default.debug("ExpressionReader.addOctaveShift",l,o)}let n=e.elements("direction-type"),a=this.readPlacement(e);
71for(let o of n){let l=o.element("octave-shift");if(l!==void 0&&l.hasAttributes)try{let h=this.readNumber(l);if(l.attribute("size")){let u=parseInt(l.attribute("size").value,10),c=0;u===8?c=1:u===15&&(c=2);let d=l.attribute("type")?.value;if(d||(a===C.Above?d="down":a===C.Below&&(d="up")),d==="up"||d==="down"){let f=new Us(d,c);f.StaffNumber=s,f.numberXml=h,this.getMultiExpression=this.createNewMultiExpressionIfNeeded(t,h),this.getMultiExpression.OctaveShiftStart=f,f.ParentStartMultiExpression=this.getMultiExpression,this.openOctaveShifts.set(h,f);let p=this.pendingOctaveShiftStops.get(h);p&&(this.pendingOctaveShiftStops.delete(h),this.getMultiExpression=this.createNewMultiExpressionIfNeeded(p.measure,h,p.endTimestamp),this.getMultiExpression.OctaveShiftEnd=f,f.ParentEndMultiExpression=this.getMultiExpression,this.openOctaveShifts.delete(h))}else if(d==="stop"){let f=this.openOctaveShifts.get(h);if(f){this.getMultiExpression=this.createNewMultiExpressionIfNeeded(t,f.numberXml,i);let p=this.getMultiExpression;p.OctaveShiftEnd=f,f.ParentEndMultiExpression=this.getMultiExpression,this.openOctaveShifts.delete(h)}else{let p=N.minus(this.directionTimestamp,new N(1,4*this.divisions));this.pendingOctaveShiftStops.set(h,{measure:t,endTimestamp:p})}}else d||W.default.debug("octave-shift missing type in xml")}}catch(h){let u=Tt.translateText("ReaderErrorMessages/OctaveShiftError","Error while reading octave shift.");this.musicSheet.SheetErrors.pushMeasureError(u),W.default.debug("ExpressionReader.addOctaveShift",u,h)}}}addPedalMarking(e,t,i){let s=e.elements("direction-type");for(let r of s){let n=r.element("pedal");if(n&&n.hasAttributes){let a=!1,o=!1;try{switch(n.attribute("line")?.value==="yes"?o=!0:n.attribute("line")?.value==="no"?(o=!1,a=!0):n.attribute("sign")?.value==="yes"?a=!0:(a=!1,o=!0),n.attribute("type").value){case"start":this.openPedal&&this.openPedal.IsLine&&this.endOpenPedal(t),this.createNewMultiExpressionIfNeeded(t,-1),this.openPedal=new Xa(o,a),this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openPedal&&this.endOpenPedal(t,i);break;case"change":this.openPedal&&this.openPedal.IsLine&&(this.openPedal.ChangeEnd=!0,this.createNewMultiExpressionIfNeeded(t,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.createNewMultiExpressionIfNeeded(t,-1),this.openPedal=new Xa(o,a),this.openPedal.ChangeBegin=!0,this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression);break;case"continue":break;default:break}}catch(l){let h=Tt.translateText("ReaderErrorMessages/PedalError","Error while reading pedal.");this.musicSheet.SheetErrors.pushMeasureError(h),W.default.debug("ExpressionReader.addPedalMarking",h,l)}}}}endOpenPedal(e,t){this.createNewMultiExpressionIfNeeded(e,-1,t),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.openPedal=void 0}initialize(){this.placement=C.NotYetDefined,this.soundTempo=0,this.soundDynamic=0,this.offsetDivisions=0}readPlacement(e){let t=e.attribute("placement")?.value;return t==="above"?C.Above:t==="below"?C.Below:C.NotYetDefined}readExpressionPlacement(e,t){try{let i=this.readPosition(e);i<0?this.placement=C.Below:i>0&&(this.placement=C.Above)}catch(i){W.default.debug("ExpressionReader.readExpressionParameters",t,i)}}readPosition(e){try{let t=parseInt(e.value,10);return t<0?this.placement=C.Below:t>0&&(this.placement=C.Above),t}catch(t){W.default.debug("ExpressionReader.readExpressionParameters",t)}}interpretInstantaneousDynamics(e,t,i,s){if(e.hasElements){e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=N.createFromFraction(i));let r=this.readNumber(e),n=e.elements()[0]?.name;if(n==="other-dynamics"&&(n=e.elements()[0].value),n){if(t.Rules?.IgnoreRepeatedDynamics){let o;try{o=Jt[n]}catch{let l=Tt.translateText("ReaderErrorMessages/DynamicError","Error while reading dynamic.");this.musicSheet.SheetErrors.pushMeasureError(l);return}if(this.activeInstantaneousDynamic?.DynEnum===o)return}s?this.createNewMultiExpressionIfNeeded(t,r,N.createFromFraction(i)):this.createNewMultiExpressionIfNeeded(t,r);let a=new Oi(n,this.soundDynamic,this.placement,this.staffNumber,t);a.InMeasureTimestamp=i.clone(),this.getMultiExpression.addExpression(a,""),this.activeInstantaneousDynamic?this.activeInstantaneousDynamic.DynEnum=a.DynEnum:this.activeInstantaneousDynamic=new Oi(n,0,C.NotYetDefined,1,t)}}}interpretWords(e,t,i){let s=e.value;if(t.Rules.IgnoreBracketsWords&&(/^\(\s*\)$/.test(s)||/^\[\s*\]$/.test(s)))return;let r,n=e.attribute("font-style"),a,o,l;n&&(a=n.value,a==="italic"&&(r=Qt.Italic));let h=e.attribute("font-weight");h&&(o=h.value,o==="bold"&&(r=Qt.Bold,a==="italic"&&(r=Qt.BoldItalic)));let u=e.attribute("color");u&&(l=u.value);let c;if(t.Rules.PlaceWordsInsideStafflineFromXml){let d=e.attribute("default-y")?.value;d?.length>0&&(c=Number.parseInt(d,10))}if(s.length>0){if(e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=N.createFromFraction(i)),this.checkIfWordsNodeIsRepetitionInstruction(s))return;this.fillMultiOrTempoExpression(s,t,i,r,l,c),this.initialize()}}readNumber(e){let t=1,i=e.attribute("number")?.value;return i&&(t=Number.parseInt(i,10)),t}interpretWedge(e,t,i,s,r){t!==void 0&&t.hasAttributes&&t.attribute("default-x")&&(this.directionTimestamp=N.createFromFraction(s));let n=this.readNumber(t),a=t.attribute("type")?.value?.toLowerCase();this.lastWedge&&this.lastWedge.parentMeasure.MeasureNumberXML===i.MeasureNumberXML&&this.lastWedge.StaffNumber===this.staffNumber&&this.placement===this.lastWedge.Placement&&this.WedgeYPosXml!==void 0&&this.lastWedge.YPosXml===this.WedgeYPosXml&&this.lastWedge.StartMultiExpression.Timestamp.Equals(this.directionTimestamp)&&this.lastWedge.DynamicType===ne[a]||(a==="stop"?(this.createNewMultiExpressionIfNeeded(i,n,s),this.getMultiExpression.EndOffsetFraction=new N(this.offsetDivisions,this.divisions*4)):this.createNewMultiExpressionIfNeeded(i,n),this.addWedge(t,i,s),this.initialize())}interpretRehearsalMark(e,t,i,s){t.rehearsalExpression=new Nu(e.value,this.placement)}createNewMultiExpressionIfNeeded(e,t,i=void 0){i||(i=this.directionTimestamp);let s=this.getMultiExpression;return(!s||s&&(s.SourceMeasureParent!==e||s.numberXml!==t||s.SourceMeasureParent===e&&!s.Timestamp.Equals(i)))&&(this.getMultiExpression=s=new bl(e,N.createFromFraction(i)),this.getMultiExpression.numberXml=t,e.StaffLinkedExpressions[this.globalStaffIndex].push(s)),s}createNewTempoExpressionIfNeeded(e){(!this.currentMultiTempoExpression||this.currentMultiTempoExpression.SourceMeasureParent!==e||this.currentMultiTempoExpression.Timestamp!==this.directionTimestamp)&&(this.currentMultiTempoExpression=new Sl(e,N.createFromFraction(this.directionTimestamp)),e.TempoExpressions.push(this.currentMultiTempoExpression))}addWedge(e,t,i){if(e!==void 0&&e.hasAttributes){let s=this.readNumber(e),r=e.attribute("type").value.toLowerCase();try{if(r==="crescendo"||r==="diminuendo"){let n=new Ue(ne[r],this.placement,this.staffNumber,t,s);this.lastWedge=n,this.lastWedge.YPosXml=this.WedgeYPosXml,this.openContinuousDynamicExpressions.push(n);let a=this.getMultiExpression;a||(a=this.createNewMultiExpressionIfNeeded(t,s)),a.StartingContinuousDynamic=n,n.StartMultiExpression=a,this.activeInstantaneousDynamic!==void 0&&this.activeInstantaneousDynamic.StaffNumber===n.StaffNumber&&(this.activeInstantaneousDynamic=void 0)}else if(r==="stop")for(let n of this.openContinuousDynamicExpressions)n.NumberXml===s&&this.closeOpenContinuousDynamic(n,t,i)}catch(n){let a="ReaderErrorMessages/WedgeError, Error while reading Crescendo / Diminuendo.";this.musicSheet.SheetErrors.pushMeasureError(a),W.default.debug("ExpressionReader.addWedge",a,n)}}}fillMultiOrTempoExpression(e,t,i,s,r,n=void 0){if(!e)return;let a=e.trim();this.createExpressionFromString("",a,t,i,e,s,r,n)}createExpressionFromString(e,t,i,s,r,n,a,o=void 0){let l=Fe.isInputStringInstantaneousTempo(t),h=Fi.isInputStringContinuousTempo(t);if(l||h){if(i.TempoExpressions.length>0)for(let f=0,p=i.TempoExpressions.length;f<p;++f){let m=i.TempoExpressions[f];if(m.Timestamp===this.directionTimestamp&&m.InstantaneousTempo!==void 0&&m.InstantaneousTempo.Label.indexOf(t)!==-1)return!1}if(this.createNewTempoExpressionIfNeeded(i),this.currentMultiTempoExpression.CombinedExpressionsText=r,l){let f=new Fe(t,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);return f.ColorXML=a,this.currentMultiTempoExpression.addExpression(f,e),!0}if(h){let f=new Fi(t,this.placement,this.staffNumber,this.currentMultiTempoExpression);return f.ColorXML=a,this.currentMultiTempoExpression.addExpression(f,e),!0}}if(Ue.isInputStringContinuousDynamic(t)){let f=new Ue(void 0,this.placement,this.staffNumber,i,-1,t);f.ColorXML=a;let p=this.getMultiExpression;return p&&this.closeOpenContinuousDynamic(p.StartingContinuousDynamic,i,s),this.createNewMultiExpressionIfNeeded(i,-1),this.activeInstantaneousDynamic!==void 0&&this.activeInstantaneousDynamic.StaffNumber===f.StaffNumber&&(this.activeInstantaneousDynamic=void 0),this.openContinuousDynamicExpressions.push(f),f.StartMultiExpression=this.getMultiExpression,this.getMultiExpression.addExpression(f,e),!0}if(Bi.isInputStringMood(t)){let f=this.createNewMultiExpressionIfNeeded(i,-1);i.hasMoodExpressions=!0;let p=new Bi(t,this.placement,this.staffNumber);return p.fontStyle=n,p.ColorXML=a,f.addExpression(p,e),!0}let u=this.createNewMultiExpressionIfNeeded(i,-1,s);if(i.TempoExpressions.length>0)for(let f=0,p=i.TempoExpressions.length;f<p;++f){let m=i.TempoExpressions[f];if(m.Timestamp===this.directionTimestamp&&m.InstantaneousTempo!==void 0&&m.EntriesList.length>0&&!this.hasDigit(t)&&this.globalStaffIndex>0){if(m.EntriesList[0].label.indexOf(t)>=0)return!1;break}}let c=this.musicSheet.Rules.UnknownExpressionTextAlignment;this.musicSheet.Rules.CompactMode&&(c=mt.LeftBottom);let d=new ds(t,this.placement,c,this.staffNumber);return d.fontStyle=n,d.ColorXML=a,d.defaultYXml=o,d.parentMeasure=i,u.addExpression(d,e),!1}closeOpenContinuousDynamic(e,t,i){if(!e)return;let s=e.NumberXml;e.EndMultiExpression=this.createNewMultiExpressionIfNeeded(t,s,i),e.StartMultiExpression.EndingContinuousDynamic=e,this.openContinuousDynamicExpressions=this.openContinuousDynamicExpressions.filter(r=>r!==e)}closeOpenContinuousTempo(e){this.openContinuousTempoExpression.AbsoluteEndTimestamp=e,this.openContinuousTempoExpression=void 0}checkIfWordsNodeIsRepetitionInstruction(e){return e=e.trim().toLowerCase(),e==="coda"||e==="tocoda"||e==="to coda"||e==="fine"||e==="d.c."||e==="dacapo"||e==="da capo"||e==="d.s."||e==="dalsegno"||e==="dal segno"||e==="d.c. al fine"||e==="d.s. al fine"||e==="d.c. al coda"||e==="d.s. al coda"}hasDigit(e){return/\d/.test(e)}},Fl=class{constructor(e){this.notes=[],this.XMLNumber=1,this.AddNote(e),this.StartNote=e,this.Direction=re.NotYetDefined}get Notes(){return this.notes}get Duration(){let e=new N;for(let t of this.notes)e.Add(t.Length);return e}get Pitch(){return this.StartNote.Pitch}AddNote(e){this.notes.push(e),e.NoteGlissando=this,this.notes.length===2&&(this.notes[0].Pitch.getHalfTone()<this.notes[1].Pitch.getHalfTone()?this.Direction=re.Up:this.Direction=re.Down)}},Dl=class{constructor(e){this.openSlurDict={},this.musicSheet=e}addSlur(e,t){try{if(e){for(let i of e)if(i.attributes().length>0){let s=i.attribute("type").value,r=1;try{i.attribute("number")&&(r=parseInt(i.attribute("number").value,10))}catch(l){W.default.debug("VoiceGenerator.addSlur number: ",l)}let n=C.NotYetDefined,a=i.attribute("placement");
71a&&a.value&&(a.value==="above"?n=C.Above:a.value==="below"&&(n=C.Below));let o=i.attribute("orientation");if(o&&o.value&&(o.value==="over"?n=C.Above:o.value==="under"&&(n=C.Below)),s==="start"){let l=this.openSlurDict[r];l||(l=new Xu,this.openSlurDict[r]=l),l.StartNote=t,l.PlacementXml=n}else if(s==="stop"){let l=this.openSlurDict[r];if(l){let h=i.name;if(h==="slide"||h==="glissando"){let u=l.StartNote,c=new Fl(u);c.AddNote(t),c.EndNote=t,t.NoteGlissando=c,delete this.openSlurDict[r]}else l.EndNote=t,t.isDuplicateSlur(l)||(t.NoteSlurs.push(l),l.StartNote.NoteSlurs.push(l)),delete this.openSlurDict[r]}}}}}catch{let i=Tt.translateText("ReaderErrorMessages/SlurError","Error while reading slur.");this.musicSheet.SheetErrors.pushMeasureError(i)}}},Ol=class{constructor(e,t,i,s){this.voiceGeneratorsDict={},this.staffMainVoiceGeneratorDict={},this.divisions=0,this.currentClefNumber=1,this.currentXmlMeasureIndex=0,this.activeKeyHasBeenInitialized=!1,this.abstractInstructions=[],this.repetitionInstructionReader=t,this.xmlMeasureList=i,this.musicSheet=s.GetMusicSheet,this.instrument=s,this.activeClefs=Array(s.Staves.length),this.activeClefsHaveBeenInitialized=Array(s.Staves.length);for(let r=0;r<s.Staves.length;r++)this.activeClefsHaveBeenInitialized[r]=!1;this.createExpressionGenerators(s.Staves.length),this.slurReader=new Dl(this.musicSheet),this.pluginManager=e}get ActiveKey(){return this.activeKey}get MaxTieNoteFraction(){return this.maxTieNoteFraction}get ActiveRhythm(){return this.activeRhythm}set ActiveRhythm(e){this.activeRhythm=e}readNextXmlMeasure(e,t,i){if(this.currentXmlMeasureIndex>=this.xmlMeasureList.length)return!1;this.currentMeasure=e,this.followingMultirestMeasures=Math.max(this.followingMultirestMeasures-1,0),this.inSourceMeasureInstrumentIndex=this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument),this.repetitionInstructionReader&&this.repetitionInstructionReader.prepareReadingMeasure(e,this.currentXmlMeasureIndex);let s=new N(0,1),r=new N(0,1),n=!1;this.maxTieNoteFraction=new N(0,1);let a=!1;try{let o=this.xmlMeasureList[this.currentXmlMeasureIndex],l=o.elements(),h;e.Rules.UseXMLMeasureNumbers&&!Number.isInteger(e.MeasureNumberXML)&&(h=parseInt(o.attribute("number")?.value,10),Number.isInteger(h)&&(e.MeasureNumberXML=h));let u=o.attribute("osmdWidthFactor");if(u){let d=Number.parseFloat(u.value);typeof d=="number"&&!isNaN(d)?e.WidthFactor=d:W.default.info(`xml parse: osmdWidthFactor invalid for measure ${h}`)}let c;for(let d=0;d<l.length;d++){let f=l[d];if(d>0&&(c=l[d-1]),f.name==="print")f.attribute("new-system")?.value==="yes"&&(e.printNewSystemXml=!0),f.attribute("new-page")?.value==="yes"&&(e.printNewPageXml=!0);else if(f.name==="attributes"){let p=f.element("divisions");if(p&&(this.divisions=parseInt(p.value,10),isNaN(this.divisions))){let b=Tt.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(W.default.debug("InstrumentReader.readNextXmlMeasure",b),this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push(b+this.instrument.Name);else throw n=!0,new Se(b+this.instrument.Name)}if(!f.element("divisions")&&this.divisions===0&&this.currentXmlMeasureIndex===0){let b=Tt.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push(b+this.instrument.Name);else throw n=!0,new Se(b+this.instrument.Name)}this.addAbstractInstruction(f,i,c,s.clone()),s.Equals(new N(0,1))&&this.isAttributesNodeAtBeginOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],f)&&this.saveAbstractInstructionList(this.instrument.Staves.length,!0),this.isAttributesNodeAtEndOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],f,s)&&this.saveClefInstructionAtEndOfMeasure();let m=f.elements("staff-details");for(let b of m){let S=b.element("staff-lines");if(S){let E=1,y=b.attribute("number");y&&(E=parseInt(y.value,10)),this.instrument.Staves[E-1].StafflineCount=parseInt(S.value,10)}}let g=f.element("measure-style");if(g){let b=g.element("multiple-rest");
71if(b){let S=b.value,E=0;try{E=Number.parseInt(S,10),e.multipleRestMeasures!==void 0&&E!==e.multipleRestMeasures?e.multipleRestMeasures=0:(e.multipleRestMeasures=E,this.currentMultirestStartMeasure=e,this.followingMultirestMeasures=E+1)}catch(y){console.log("multirest parse error: "+y)}}}}else if(f.name==="note"){let p=!0;f.attribute("print-object")?.value==="no"&&(p=!1);let m=this.getNoteStaff(f);this.currentStaff=this.instrument.Staves[m-1];let g=f.element("chord")!==void 0;if(f.element("voice")){let Z=parseInt(f.element("voice").value,10);this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(Z,m-1)}else(!g||!this.currentVoiceGenerator)&&(this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(1,m-1));let b=0,S=new N(0,1),E=2,y,M=f.element("rest")!==void 0;if(f.element("duration")){if(b=parseInt(f.element("duration").value,10),isNaN(b)){let Z=Tt.translateText("ReaderErrorMessages/NoteDurationError","Invalid Note Duration.");this.musicSheet.SheetErrors.pushMeasureError(Z),W.default.debug("InstrumentReader.readNextXmlMeasure",Z);continue}else if(S=new N(b,4*this.divisions),M&&S.RealValue>this.ActiveRhythm?.Rhythm.RealValue&&(S=this.ActiveRhythm.Rhythm.clone()),b===0?S=this.getNoteDurationFromTypeNode(f):y=this.getNoteDurationFromTypeNode(f),f.element("time-modification")){S=this.getNoteDurationForTuplet(f);let Z=f.element("time-modification");Z?.element("normal-notes")&&(E=parseInt(Z.element("normal-notes").value,10))}}let P=f.combinedElement("notations"),L=f.element("grace")!==void 0||b===0||g&&a,B=!1,A=!1;if(L){let Z=f.element("grace");Z&&Z.attributes()&&Z.attribute("slash")&&Z.attribute("slash").value==="yes"&&(B=!0),S=this.getNoteDurationFromTypeNode(f),P&&P.element("slur")&&(A=!0)}let[G,H]=this.getCueNoteAndNoteTypeXml(f),[T,I,v]=this.getStemDirectionAndColors(f),U=!1,dt;if(P){let Z=P.element("ornaments");Z&&(dt=this.getTremoloInfo(Z),U=this.getVibratoStrokes(Z))}let Y=g?r.clone():s.clone();this.currentStaffEntry=this.currentMeasure.findOrCreateStaffEntry(Y,this.inSourceMeasureInstrumentIndex+m-1,this.currentStaff).staffEntry,(!this.currentVoiceGenerator.hasVoiceEntry()||!g&&!L&&!a||L&&!a||L&&!g||!L&&a)&&this.currentVoiceGenerator.createVoiceEntry(Y,this.currentStaffEntry,!L,L,B,A),!L&&!g&&(r=s.clone(),s.Add(S)),g&&this.currentStaffEntry!==void 0&&this.currentStaffEntry.ParentStaff!==this.currentStaff&&(this.currentStaffEntry=this.currentVoiceGenerator.checkForStaffEntryLink(this.inSourceMeasureInstrumentIndex+m-1,this.currentStaff,this.currentStaffEntry,this.currentMeasure));let at=this.currentStaffEntry!==void 0&&this.currentStaffEntry.Timestamp!==void 0&&this.currentStaffEntry.Timestamp.Equals(new N(0,1))&&!this.currentStaffEntry.hasNotes();this.saveAbstractInstructionList(this.instrument.Staves.length,at),this.activeRhythm;let X=f.elements("dot").length;if(this.currentVoiceGenerator.read(f,S,y,H,E,M,this.currentStaffEntry,this.currentMeasure,t,this.maxTieNoteFraction,g,i,p,G,L,T,dt,I,v,U,X),P!==void 0&&P.element("dynamics")){let Z=this.expressionReaders[this.readExpressionStaffNumber(f)-1];Z&&(Z.readExpressionParameters(f,this.instrument,this.divisions,s,r,this.currentMeasure.MeasureNumber,!1),Z.read(f,this.currentMeasure,r))}a=L}else if(f.name==="forward"){let p=parseInt(f.element("duration").value,10);s.Add(new N(p,4*this.divisions))}else if(f.name==="backup"){let p=parseInt(f.element("duration").value,10);s.Sub(new N(p,4*this.divisions)),s.IsNegative()&&(s=new N(0,1)),r.Sub(new N(p,4*this.divisions)),r.IsNegative()&&(r=new N(0,1))}else if(f.name==="direction"){let p=f.elements("direction-type"),m=p[0],g=Math.min(1,s.RealValue);this.activeRhythm!==void 0&&this.activeRhythm.Rhythm&&(g/=this.activeRhythm.Rhythm.RealValue);let b=!1;if(this.repetitionInstructionReader&&(b=this.repetitionInstructionReader.handleRepetitionInstructionsFromWordsOrSymbols(m,g)),!b){let S=this.expressionReaders[0],E=this.readExpressionStaffNumber(f)-1;E<this.expressionReaders.length&&(S=this.expressionReaders[E]),S&&(p.some(y=>y.element("octave-shift"))&&(S.readExpressionParameters(f,this.instrument,this.divisions,s,r,this.currentMeasure.MeasureNumber,!0),S.addOctaveShift(f,this.currentMeasure,r.clone())),p.some(y=>
71y.element("pedal"))&&(S.readExpressionParameters(f,this.instrument,this.divisions,s,r,this.currentMeasure.MeasureNumber,!0),S.addPedalMarking(f,this.currentMeasure,s.clone())),S.readExpressionParameters(f,this.instrument,this.divisions,s,r,this.currentMeasure.MeasureNumber,!1),S.read(f,this.currentMeasure,s,r.clone()))}}else if(f.name==="barline"){this.repetitionInstructionReader&&this.repetitionInstructionReader.handleLineRepetitionInstructions(f)&&(this.currentMeasure.HasEndLine=!0);let p=f.attribute("location")?.value??"right";if(d===l.length-1||p==="right"){let m=f.element("bar-style")?.value;m&&(this.currentMeasure.endingBarStyleXml=m,this.currentMeasure.endingBarStyleEnum=mo.xmlBarlineStyleToSystemLinesEnum(m))}}else if(f.name==="sound")try{if(f.attribute("tempo")){let p=parseFloat(f.attribute("tempo").value);this.currentXmlMeasureIndex===0&&(this.musicSheet.DefaultStartTempoInBpm=p,this.musicSheet.HasBPMInfo=!0)}}catch(p){W.default.debug("InstrumentReader.readTempoInstruction",p)}else if(f.name==="harmony"){let p=this.getNoteStaff(f);this.currentStaff=this.instrument.Staves[p-1];let m=s.clone();this.currentStaffEntry=this.currentMeasure.findOrCreateStaffEntry(m,this.inSourceMeasureInstrumentIndex+p-1,this.currentStaff).staffEntry,this.currentStaffEntry.ChordContainers.push(Il.readChordSymbol(f,this.musicSheet,this.activeKey))}}for(let d in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(d)&&this.voiceGeneratorsDict[d].checkForOpenBeam();if(this.currentXmlMeasureIndex===this.xmlMeasureList.length-1){for(let d=0;d<this.instrument.Staves.length;d++)this.activeClefsHaveBeenInitialized[d]||this.createDefaultClefInstruction(this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument)+d);this.activeKeyHasBeenInitialized||this.createDefaultKeyInstruction();for(let d=0;d<this.expressionReaders.length;d++){let f=this.expressionReaders[d];f&&f.closeOpenExpressions(this.currentMeasure,s)}}this.musicSheet.HasBPMInfo?e.TempoInBPM===0&&this.previousMeasure&&(this.currentMeasure.TempoInBPM=this.previousMeasure.TempoInBPM):this.currentMeasure.TempoInBPM=120}catch(o){if(n)throw new Se(o.Message);let l=Tt.translateText("ReaderErrorMessages/MeasureError","Error while reading Measure.");this.musicSheet.SheetErrors.pushMeasureError(l),W.default.debug("InstrumentReader.readNextXmlMeasure",l,o)}return this.previousMeasure=this.currentMeasure,this.currentXmlMeasureIndex+=1,!0}getStemDirectionAndColors(e){let t=Rt.Undefined,i,s=e.element("stem");if(s){t=this.getStemDirectionType(s);let a=s.attribute("color");a&&(i=this.parseXmlColor(a.value))}let r=this.getNoteHeadColorXml(e),n=this.getNoteColorXml(e);return n&&!r&&(r=n),n&&!i&&(i=n),[t,i,r]}parseXmlColor(e){return e}doCalculationsAfterDurationHasBeenSet(){for(let e in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(e)&&this.voiceGeneratorsDict[e].checkOpenTies()}getOrCreateVoiceGenerator(e,t){let i=this.instrument.Staves[t],s=this.voiceGeneratorsDict[e];if(s)i.Voices.indexOf(s.GetVoice)===-1&&i.Voices.push(s.GetVoice);else{let r=this.staffMainVoiceGeneratorDict[t];r?(s=new Tn(this.pluginManager,i,e,this.slurReader,r.GetVoice),i.Voices.push(s.GetVoice),this.voiceGeneratorsDict[e]=s):(s=new Tn(this.pluginManager,i,e,this.slurReader),i.Voices.push(s.GetVoice),this.voiceGeneratorsDict[e]=s,this.staffMainVoiceGeneratorDict[t]=s)}return s}createExpressionGenerators(e){this.expressionReaders=Array(e);for(let t=0;t<e;t++)this.expressionReaders[t]=new kl(this.musicSheet,this.instrument,t+1)}createDefaultClefInstruction(e){let t;t=this.musicSheet.SourceMeasures.length>0?this.musicSheet.SourceMeasures[0]:this.currentMeasure;let i=new Zt(yt.G,0,2),s;t.FirstInstructionsStaffEntries[e]?(s=t.FirstInstructionsStaffEntries[e],s.removeFirstInstructionOfTypeClefInstruction()):(s=new be(void 0,void 0),t.FirstInstructionsStaffEntries[e]=s),i.Parent=s,s.Instructions.splice(0,0,i)}createDefaultKeyInstruction(){let e;e=this.musicSheet.SourceMeasures.length>0?this.musicSheet.SourceMeasures[0]:this.currentMeasure;let t=new ye(void 0,0,ai.major);for(let i=this.inSourceMeasureInstrumentIndex;i<this.inSourceMeasureInstrumentIndex+this.instrument.Staves.length;i++)if(e.FirstInstructionsStaffEntries[i]){let s=e.FirstInstructionsStaffEntries[i];t.Parent=s,s.removeFirstInstructionOfTypeKeyInstruction(),s.Instructions[0]instanceof Zt?s.Instructions.splice(1,0,t):s.Instructions.splice(0,0,t)}else{let s=new be(void 0,void 0);e.FirstInstructionsStaffEntries[i]=s,t.Parent=s,s.Instructions.push(t)}}isAttributesNodeAtBeginOfMeasure(e,t){let i=e.elements(),s=i.indexOf(t);if(s>0&&i[s-1].name==="backup")return!0;let r=-1;for(let n=0;n<i.length;n++)if(i[n].name==="note"){r=n;break}return s<r&&r>0||r<0}isAttributesNodeAtEndOfMeasure(e,t,i){if(i.Equals(this.ActiveRhythm?.Rhythm))return!0;let s=e.elements().slice(),r=0;for(let a=0;a<s.length;a++)if(s[a]===t){r=a;break}let n=0;for(let a=r;a<s.length;a++)if(s[a].name==="note"){n=a;break}return r>n}getNoteDurationFromTypeNode(e){let t=e.element("type");if(t){let i=t.value;return Zi.getNoteDurationFromType(i)}return new N(0,4*this.divisions)}addAbstractInstruction(e,t,i,s){if(e.element("divisions")&&e.elements().length===1)return;let r=e.element("transpose");if(r){let o=r.element("chromatic");o&&(this.instrument.PlaybackTranspose=parseInt(o.value,10))}let n=e.elements("clef"),a;if(n.length>0)for(let o=0,l=n.length;o<l;
71++o){let h=n[o],u=yt.G,c=2,d=1,f=0,p=h.element("line");if(p)try{c=parseInt(p.value,10)}catch(S){a=Tt.translateText("ReaderErrorMessages/ClefLineError","Invalid clef line. Using default."),this.musicSheet.SheetErrors.pushMeasureError(a),c=2,W.default.debug("InstrumentReader.addAbstractInstruction",a,S)}let m=h.element("sign");if(m)try{u=yt[m.value],Zt.isSupportedClef(u)||(a=Tt.translateText("ReaderErrorMessages/ClefError","Unsupported clef. Using default."),this.musicSheet.SheetErrors.pushMeasureError(a),u=yt.G,c=2),u===yt.TAB&&(f=-1)}catch(S){a=Tt.translateText("ReaderErrorMessages/ClefError","Invalid clef. Using default."),this.musicSheet.SheetErrors.pushMeasureError(a),u=yt.G,c=2,W.default.debug("InstrumentReader.addAbstractInstruction",a,S)}let g=h.element("clef-octave-change");if(g)try{f=parseInt(g.value,10)}catch{a=Tt.translateText("ReaderErrorMessages/ClefOctaveError","Invalid clef octave. Using default."),this.musicSheet.SheetErrors.pushMeasureError(a),f=0}if(h.hasAttributes&&h.attribute("number"))try{d=parseInt(h.attribute("number").value,10),d>this.currentClefNumber&&(d=this.currentClefNumber),this.currentClefNumber=d+1}catch{a=Tt.translateText("ReaderErrorMessages/ClefError","Invalid clef. Using default."),this.musicSheet.SheetErrors.pushMeasureError(a),d=1,this.currentClefNumber=d+1}let b=new Zt(u,f,c);this.abstractInstructions.push([d,b,s])}if(e.element("key")!==void 0&&this.instrument.MidiInstrumentId!==lt.Percussion){let o=0,l=e.element("key").element("fifths");if(l)try{o=parseInt(l.value,10)}catch(d){a=Tt.translateText("ReaderErrorMessages/KeyError","Invalid key. Set to default."),this.musicSheet.SheetErrors.pushMeasureError(a),o=0,W.default.debug("InstrumentReader.addAbstractInstruction",a,d)}let h=ai.none,u=e.element("key");if(u&&(u=u.element("mode")),u)try{h=ai[u.value]}catch(d){a=Tt.translateText("ReaderErrorMessages/KeyError","Invalid key/mode. Set to default."),this.musicSheet.SheetErrors.pushMeasureError(a),h=ai.major,W.default.debug("InstrumentReader.addAbstractInstruction",a,d)}let c=new ye(void 0,o,h);this.abstractInstructions.push([1,c,s])}if(e.element("time")){let o=e.element("time"),l=Ke.NONE,h=!0;if(o!==void 0&&o.hasAttributes){let g=o.attribute("symbol");g&&(g.value==="common"?l=Ke.COMMON:g.value==="cut"&&(l=Ke.CUT));let b=o.attribute("print-object");b&&b.value==="no"&&(h=!1)}let u=0,c=0,d=o&&o.element("senza-misura")!==void 0,f=e.elements("time"),p=[],m=[];for(let g=0,b=f.length;g<b;++g){let S=f[g];p.push.apply(p,S.elements("beats")),m.push.apply(m,S.elements("beat-type"))}if(d)this.abstractInstructions.push([1,new Re(new N(4,4,0,!1),Ke.NONE),s]);else{try{if(p!==void 0&&p.length>0&&m!==void 0&&p.length===m.length){let b=p.length,S=Array(b),E=0;for(let y=0;y<b;y++){let M=p[y].value,P=0,L=0;if(M.indexOf("+")!==-1){let B=M.split("+");for(let A=0,G=B.length;A<G;++A)P+=parseInt(B[A],10)}else P=parseInt(M,10);L=parseInt(m[y].value,10),E=Math.max(E,L),S[y]=new N(P,L,0,!1)}for(let y=0;y<b;y++)S[y].Denominator===E?u+=S[y].Numerator:u+=E/S[y].Denominator*S[y].Numerator;c=E}else u=parseInt(e.element("time").element("beats").value,10),c=parseInt(e.element("time").element("beat-type").value,10)}catch(b){a=Tt.translateText("ReaderErrorMessages/RhythmError","Invalid rhythm. Set to default."),this.musicSheet.SheetErrors.pushMeasureError(a),u=4,c=4,W.default.debug("InstrumentReader.addAbstractInstruction",a,b)}let g=new Re(new N(u,c,0,!1),l);g.PrintObject=h,this.abstractInstructions.push([1,g,s])}}}saveAbstractInstructionList(e,t){for(let i=this.abstractInstructions.length-1;i>=0;i--){let s=this.abstractInstructions[i],r=s[0],n=s[1],a=s[2];if(n instanceof Zt){let o=n;if(this.currentXmlMeasureIndex===0||r<=this.activeClefs.length&&o!==this.activeClefs[r-1])if(!t&&this.currentStaffEntry!==void 0&&!this.currentStaffEntry.hasNotes()&&r-1===this.instrument.Staves.indexOf(this.currentStaffEntry.ParentStaff)){let l=o,h=this.currentStaffEntry;if(a&&Math.abs(a.RealValue-h.Timestamp.RealValue)>.01)continue;l.Parent=h,h.removeFirstInstructionOfTypeClefInstruction(),h.Instructions.push(l),this.activeClefs[r-1]=o,this.abstractInstructions.splice(i,1)}else if(t){if(a.RealValue!==0)continue;let l;if(this.currentMeasure){let h=o,u=this.inSourceMeasureInstrumentIndex+r-1,c=this.currentMeasure.FirstInstructionsStaffEntries[u];if(this.currentXmlMeasureIndex===0)if(!c)l=new be(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[u]=l,h.Parent=l,l.Instru
71ctions.push(h),this.activeClefsHaveBeenInitialized[r-1]=!0;else if(this.currentMeasure.FirstInstructionsStaffEntries[u]!==void 0&&!(c.Instructions[0]instanceof Zt))l=c,h.Parent=l,l.removeFirstInstructionOfTypeClefInstruction(),l.Instructions.splice(0,0,h),this.activeClefsHaveBeenInitialized[r-1]=!0;else{let d=new be(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[u]=d,h.Parent=d,d.Instructions.push(h)}else if(this.activeClefsHaveBeenInitialized[r-1]){let d=this.previousMeasure;this.followingMultirestMeasures>0&&this.currentMeasure.Rules.RenderMultipleRestMeasures&&(d=this.currentMultirestStartMeasure);let f=new be(void 0,void 0);d.LastInstructionsStaffEntries[u]=f,h.Parent=f,f.Instructions.push(h)}else{let d=this.musicSheet.SourceMeasures[0];d.FirstInstructionsStaffEntries[u]?(l=d.FirstInstructionsStaffEntries[u],l.removeFirstInstructionOfTypeClefInstruction()):l=new be(void 0,void 0),h.Parent=l,l.Instructions.splice(0,0,h),this.activeClefsHaveBeenInitialized[r-1]=!0}this.activeClefs[r-1]=o,this.abstractInstructions.splice(i,1)}}else{let l,h=this.activeRhythm.Rhythm;h.RealValue>0&&a.RealValue/h.RealValue>.9&&h.RealValue!==a.RealValue&&(this.currentMeasure.LastInstructionsStaffEntries[r-1]||(this.currentMeasure.LastInstructionsStaffEntries[r-1]=new be(void 0,this.instrument.Staves[r-1])),l=this.currentMeasure.LastInstructionsStaffEntries[r-1]),l&&(o.Parent=l,l.Instructions.push(o),this.activeClefs[r-1]=o,this.abstractInstructions.splice(i,1))}else r<=this.activeClefs.length&&o===this.activeClefs[r-1]&&this.abstractInstructions.splice(i,1)}if(n instanceof ye){let o=n;if(!this.activeKey||this.activeKey.Key!==o.Key){this.activeKey=o,this.abstractInstructions.splice(i,1);let l;if(this.activeKeyHasBeenInitialized?l=this.currentMeasure:(this.activeKeyHasBeenInitialized=!0,l=this.currentXmlMeasureIndex>0?this.musicSheet.SourceMeasures[0]:this.currentMeasure),l)for(let h=this.inSourceMeasureInstrumentIndex;h<this.inSourceMeasureInstrumentIndex+e;h++){let u=o;if(l.FirstInstructionsStaffEntries[h]){let c=l.FirstInstructionsStaffEntries[h];u.Parent=c,c.removeFirstInstructionOfTypeKeyInstruction(),c.Instructions.length===0?c.Instructions.push(u):c.Instructions[0]instanceof Zt?c.Instructions.splice(1,0,u):c.Instructions.splice(0,0,u)}else{let c=new be(void 0,void 0);l.FirstInstructionsStaffEntries[h]=c,u.Parent=c,c.Instructions.push(u)}}}else this.abstractInstructions.splice(i,1)}if(n instanceof Re){let o=n;if(!this.activeRhythm||this.activeRhythm!==o){if(this.activeRhythm=o,this.abstractInstructions.splice(i,1),this.currentMeasure)for(let l=this.inSourceMeasureInstrumentIndex;l<this.inSourceMeasureInstrumentIndex+e;l++){let h=o,u;this.currentMeasure.FirstInstructionsStaffEntries[l]?(u=this.currentMeasure.FirstInstructionsStaffEntries[l],u.removeFirstInstructionOfTypeRhythmInstruction()):(u=new be(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[l]=u),h.Parent=u,u.Instructions.push(h)}}else this.abstractInstructions.splice(i,1)}}}saveClefInstructionAtEndOfMeasure(){for(let e=this.abstractInstructions.length-1;e>=0;e--){let t=this.abstractInstructions[e][0],i=this.abstractInstructions[e][1];if(i instanceof Zt){let s=i;if(!this.activeClefs[t-1]||s.ClefType!==this.activeClefs[t-1].ClefType||s.ClefType===this.activeClefs[t-1].ClefType&&s.Line!==this.activeClefs[t-1].Line){let r=new be(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[this.inSourceMeasureInstrumentIndex+t-1]=r;let n=s;n.Parent=r,r.Instructions.push(n),this.activeClefs[t-1]=s,this.abstractInstructions.splice(e,1)}}}}getNoteDurationForTuplet(e){let t=e.element("duration");return new N(Number.parseInt(t.value,10),this.divisions*4)}readExpressionStaffNumber(e){let t=1;if(e.element("staff")){let i=e.element("staff");if(i)try{t=parseInt(i.value,10)}catch(s){let r=Tt.translateText("ReaderErrorMessages/ExpressionStaffError","Invalid Expression staff number. Set to default.");this.musicSheet.SheetErrors.pushMeasureError(r),t=1,W.default.debug("InstrumentReader.readExpressionStaffNumber",r,s)}}return t}readDivisionsFromNotes(){let e=0,t=this.currentXmlMeasureIndex,i=!1;for(;!i;){let s=this.xmlMeasureList[t].elements();for(let r=0,n=s.length;r<n;++r){let a=s[r];
71if(a.name==="note"&&!a.element("time-modification")){let o=a.element("duration"),l=a.element("type");if(o!==void 0&&l){let h=l.value,u=0;try{u=parseInt(o.value,10)}catch(c){W.default.debug("InstrumentReader.readDivisionsFromNotes",c);continue}switch(h){case"1024th":e=u/4*1024;break;case"512th":e=u/4*512;break;case"256th":e=u/4*256;break;case"128th":e=u/4*128;break;case"64th":e=u/4*64;break;case"32nd":e=u/4*32;break;case"16th":e=u/4*16;break;case"eighth":e=u/4*8;break;case"quarter":e=u/4*4;break;case"half":e=u/4*2;break;case"whole":e=u/4;break;case"breve":e=u/4/2;break;case"long":e=u/4/4;break;case"maxima":e=u/4/8;break;default:break}}}if(e>0){i=!0;break}}if(e===0&&(t++,t===this.xmlMeasureList.length))throw new Se(Tt.translateText("ReaderErrorMEssages/DivisionsError","Invalid divisions value at Instrument: ")+this.instrument.Name)}return e}getCueNoteAndNoteTypeXml(e){let t=e.element("cue"),i=!1;t&&(i=!0);let s=e.element("type"),r=_r.UNDEFINED;return s&&(s.attribute("size")?.value==="cue"&&(i=!0),r=Zi.StringToNoteType(s.value)),[i,r]}getStemDirectionType(e){switch(e.value){case"down":return Rt.Down;case"up":return Rt.Up;case"double":return Rt.Double;case"none":return Rt.None;default:return Rt.Undefined}}getNoteHeadColorXml(e){let t=e.element("notehead");if(t){let i=t.attribute("color");if(i)return this.parseXmlColor(i.value)}return null}getNoteColorXml(e){let t=e.attribute("color");return t?this.parseXmlColor(t.value):null}getTremoloInfo(e){let t,i,s=e.element("tremolo");if(s){let r=s.attribute("type");if(r){if(r.value==="single"){let n=parseInt(s.value,10);n>0&&(t=n)}else t=0;r.value==="unmeasured"&&(i=!0)}}return{tremoloStrokes:t,tremoloUnmeasured:i}}getVibratoStrokes(e){let t=e.element("wavy-line");if(t!==void 0){let i=t.attribute("type");if(i&&i.value==="start")return!0}return!1}getNoteStaff(e){let t=1;return this.instrument.Staves.length>1&&e.element("staff")&&(t=parseInt(e.element("staff").value,10),isNaN(t)&&(W.default.debug("InstrumentReader.readNextXmlMeasure.get staff number"),t=1)),t}},Ya,gr=class fs{constructor(t){this.parentInstrument=t,this.fixedKey=-1,this.name=this.parseMidiInstrument(this.parentInstrument.Name),this.midiInstrumentID=fs.midiInstrument[this.name],this.volume=1}get ParentInstrument(){return this.parentInstrument}static isPianoInstrument(t){return t===lt.Acoustic_Grand_Piano||t===lt.Bright_Acoustic_Piano||t===lt.Electric_Grand_Piano||t===lt.Electric_Piano_1||t===lt.Electric_Piano_2}setMidiInstrument(t){this.midiInstrumentID=fs.midiInstrument[this.parseMidiInstrument(t)]}parseMidiInstrument(t){try{if(t){let i=t.toLowerCase().trim();for(let s in fs.midiInstrument)if(i.indexOf(s)!==-1)return s}if(this.parentInstrument.Name){let i=this.parentInstrument.Name.toLowerCase().trim();for(let s in fs.midiInstrument)if(i.indexOf(s)!==-1)return s}}catch{W.default.error("Error parsing MIDI Instrument. Default to Grand Piano.")}return"unnamed"}};Ya=gr,Ya.midiInstrument={alt:lt.Synth_Voice,alto:lt.Synth_Voice,banjo:lt.Banjo,bariton:lt.Synth_Voice,baritone:lt.Synth_Voice,bass:lt.Synth_Voice,blockfloete:lt.Recorder,brass:lt.Trombone,bratsche:lt.Viola,cello:lt.Cello,clarinet:lt.Clarinet,contrabass:lt.Contrabass,drums:lt.Percussion,flute:lt.Flute,floete:lt.Flute,frenchhorn:lt.French_Horn,gitarre:lt.Acoustic_Guitar_nylon,guitar:lt.Acoustic_Guitar_nylon,harfe:lt.Orchestral_Harp,harp:lt.Orchestral_Harp,klarinette:lt.Clarinet,klavier:lt.Acoustic_Grand_Piano,kontrabass:lt.Contrabass,oboe:lt.Oboe,organ:lt.Church_Organ,orgel:lt.Church_Organ,orgue:lt.Church_Organ,percussion:lt.Percussion,piano:lt.Acoustic_Grand_Piano,piccolo:lt.Piccolo,posaune:lt.Trombone,recorder:lt.Recorder,sax:lt.Tenor_Sax,schlagwerk:lt.Percussion,schlagzeug:lt.Percussion,sopran:lt.Synth_Voice,steeldrum:lt.Steel_Drums,streicher:lt.String_Ensemble_1,strings:lt.String_Ensemble_1,tenor:lt.Synth_Voice,tpt:lt.Trumpet,trombone:lt.Trombone,trompete:lt.Trumpet,trumpet:lt.Trumpet,tuba:lt.Tuba,unnamed:lt.Acoustic_Grand_Piano,viola:lt.Viola,violin:lt.Violin,"violon-c":lt.Cello,"violon.":lt.Violin,voice:lt.Synth_Voice,woodblock:lt.Woodblock};var Ne=class{static StringContainsSeparatedWord(e,t,i=!1){return RegExp("( |^)"+t+"([ .]|$)",i?"i":void 0).test(e)}},Vl=class{set MusicSheet(e){this.musicSheet=e,this.xmlMeasureList=Array(this.musicSheet.Instruments.length),this.repetitionInstructions=[]}prepareReadingMeasure(e,t){this.currentMeasureIndex=t}handleLineRepetitionInstructions(e){let t=!1;if(e.elements().length>0){let i="",s=!1,r="",n="",a="",o=[],l=e.element("bar-style");l&&(a=l.value),i=e.attributes().length>0&&e.attribute("location")?e.attribute("location").value:"right";let h=e.elements();for(let u=0,c=h.length;u<c;++u){let d=h[u];if(d.name==="repeat"&&d.hasAttributes)s=!0,r=d.attribute("direction").value;else if(d.name==="ending"&&d.hasAttributes&&d.attribute("type")!==void 0&&d.attribute("number")){if(d.attribute("print-object")?.value==="no")continue;n=d.attribute("type").value;let f=d.attribute("number").value;d.value&&(f=d.value);let p=f.split("[,+]");for(let m=0,g=p.length;m<g;++m){let b=p[m],S=b.match("[0-9]");if(b.search("-")!==-1&&S.length===2){let E=parseInt(S[0],10),y=parseInt(S[1],10);for(let M=E;M<=y;M++)o.push(M)}else for(let E=0,y=S.length;E<y;++E){let M=S[E];o.push(parseInt(M,10))}}}}if(a==="light-heavy"&&o.length===0&&!s&&(t=!0),s||o.length>0)if(i==="left"){if(n==="start"){let u=new Lt(this.currentMeasureIndex,J.Ending,Pt.Begin,void 0,o);this.addInstruction(this.repetitionInstructions,u)}if(r==="forward"){let u=new Lt(this.currentMeasureIndex,J.StartLine);this.addInstruction(this.repetitionInstructions,u)}}else{if(n==="stop"){let u=new Lt(this.currentMeasureIndex,J.Ending,Pt.End,void 0,o);this.addInstruction(this.repetitionInstructions,u)}else if(n==="discontinue"){let u=new Lt(this.currentMeasureIndex,J.Ending,Pt.Discontinue,void 0,o);this.addInstruction(this.repetitionInstructions,u)}if(r==="backward"){let u=new Lt(this.currentMeasureIndex,J.BackJumpLine);this.addInstruction(this.repetitionInstructions,u)}}}return t}handleRepetitionInstructionsFromWordsOrSymbols(e,t){let i=e.element("words"),s=this.currentMeasureIndex;if(i){let r="d\\s?\\.s\\.",n=i.value.trim().toLowerCase();if(Ne.StringContainsSeparatedWord(n,r+" al fine",!0)){let o=new Lt(s,J.DalSegnoAlFine);return this.addInstruction(this.repetitionInstructions,o),!0}let a="d\\.\\s?c\\.";if(Ne.StringContainsSeparatedWord(n,a+" al coda",!0)){let o=new Lt(s,J.DaCapoAlCoda);return this.addInstruction(this.repetitionInstructions,o),!0}if(Ne.StringContainsSeparatedWord(n,a+" al fine",!0)){let o=new Lt(s,J.DaCapoAlFine);return this.addInstruction(this.repetitionInstructions,o),!0}if(Ne.StringContainsSeparatedWord(n,a+" al coda",!0)){let o=new Lt(s,J.DaCapoAlCoda);return this.addInstruction(this.repetitionInstructions,o),!0}if(Ne.StringContainsSeparatedWord(n,a)||Ne.StringContainsSeparatedWord(n,"da\\s?capo",!0)){let o=new Lt(s,J.DaCapo);return this.addInstruction(this.repetitionInstructions,o),!0}if(Ne.StringContainsSeparatedWord(n,r,!0)||Ne.StringContainsSeparatedWord(n,"dal\\s?segno",!0)){let o;return o=Ne.StringContainsSeparatedWord(n,"al\\s?coda",!0)?new Lt(s,J.DalSegnoAlCoda):new Lt(s,J.DalSegno),this.addInstruction(this.repetitionInstructions,o),!0}if(Ne.StringContainsSeparatedWord(n,"to\\s?coda",!0)||Ne.StringContainsSeparatedWord(n,"a (la )?coda",!0)){let o=new Lt(s,J.ToCoda);return this.addInstruction(this.repetitionInstructions,o),!0}if(Ne.StringContainsSeparatedWord(n,"fine",!0)){let o=new Lt(s,J.Fine);return this.addInstruction(this.repetitionInstructions,o),!0}if(Ne.StringContainsSeparatedWord(n,"coda",!0)){let o=new Lt(s,J.Coda);return this.addInstruction(this.repetitionInstructions,o),!0}if(Ne.StringContainsSeparatedWord(n,"segno",!0)){let o=new Lt(s,J.Segno);return this.addInstruction(this.repetitionInstructions,o),!0}}else if(e.element("segno")){let r=new Lt(s,J.Segno);return this.addInstruction(this.repetitionInstructions,r),!0}else if(e.element("coda")){let r=new Lt(s,J.Coda);return this.addInstruction(this.repetitionInstructions,r),!0}return!1}removeRedundantInstructions(){let e=0,t=0,i=0,s=0;for(let r=0;r<this.repetitionInstructions.length;r++){let n=this.repetitionInstructions[r];switch(n.type){case J.Coda:i>0&&this.findInstructionInPreviousMeasure(r,n.measureIndex,J.ToCoda)&&
71(n.type=J.None);break;case J.Segno:if(e-s>0){let a=!1;for(let o=0,l=this.repetitionInstructions.length;o<l;++o){let h=this.repetitionInstructions[o];if(n.measureIndex-h.measureIndex===1)switch(h.type){case J.BackJumpLine:i-t>0?h.type=J.DalSegnoAlCoda:h.type=J.DalSegno,n.type=J.None,a=!0;break;case J.DalSegno:case J.DalSegnoAlFine:case J.DalSegnoAlCoda:n.type=J.None,a=!0;break;default:break}if(a)break}if(a)break;i-t>0?n.type=J.DalSegnoAlCoda:n.type=J.DalSegno,n.alignment=Pt.End,n.measureIndex--}break;default:break}if(this.backwardSearchForPreviousIdenticalInstruction(r,n)||n.type===J.None)this.repetitionInstructions.splice(r,1),r--;else switch(n.type){case J.Fine:break;case J.ToCoda:i++;break;case J.Coda:t++;break;case J.Segno:e++;break;case J.DalSegnoAlFine:case J.DalSegnoAlCoda:s++;break;default:break}}this.repetitionInstructions.sort(ar.Compare)}findInstructionInPreviousMeasure(e,t,i){for(let s=e-1;s>=0;s--){let r=this.repetitionInstructions[s];if(t-r.measureIndex===1&&r.type===i)return!0}return!1}backwardSearchForPreviousIdenticalInstruction(e,t){for(let i=e-1;i>=0;i--)if(this.repetitionInstructions[i].equals(t))return!0;return!1}addInstruction(e,t){let i=!0;for(let s=0,r=e.length;s<r;++s){let n=e[s];if(t.equals(n)){i=!1;break}}i&&e.push(t)}},Yu=class{constructor(e,t,i,s=-1,r=!1){this.repetitionRun=-1,this.sourceMusicPart=e,this.parentPartListEntry=i,this.startTimestamp=t.clone(),this.repetitionRun=s,this.parentRepetition=i,this.isEnding=r}get IsRepetition(){return this.parentRepetition!==void 0}get IsEnding(){return this.isEnding}get IsLastRepetitionRun(){return this.IsRepetition&&this.repetitionRun+1===this.parentRepetition.UserNumberOfRepetitions}get RepetitionRun(){return this.repetitionRun}get ParentPartListEntry(){return this.parentPartListEntry}get SourceMusicPart(){return this.sourceMusicPart}get StartTimestamp(){return this.startTimestamp}CompareTo(e){return e?this.startTimestamp.CompareTo(e.startTimestamp):1}},Gl=class{constructor(){this.repetitionInstructions=[],this.openRepetitions=[],this.lastRepetitionCommonPartStartIndex=0}calculateRepetitions(e,t){this.musicSheet=e,this.repetitionInstructions=t,this.openRepetitions.length=0,this.lastRepetitionCommonPartStartIndex=0;let i=this.musicSheet.SourceMeasures;for(let n of this.repetitionInstructions){this.currentMeasureIndex=n.measureIndex;try{this.currentMeasure=i[this.currentMeasureIndex],this.handleRepetitionInstructions(n)}catch(a){W.default.error("RepetitionCalculator: calculateRepetitions",a)}}for(;this.openRepetitions.length>0;)try{let n=this.openRepetitions.last();if(n.RepetitonUnderConstruction.FromWords){if(n.WaitingForCoda){let a=n.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex+1;a>=this.musicSheet.SourceMeasures.length&&(a=-1),n.RepetitonUnderConstruction.setEndingStartIndex(2,a)}else if(n.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){this.openRepetitions.splice(this.openRepetitions.length-1,1);continue}}else if(n.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){let a=i.length-1,o=new Lt(a,J.BackJumpLine,Pt.End,n.RepetitonUnderConstruction);n.RepetitonUnderConstruction.BackwardJumpInstructions.push(o),i[a].LastRepetitionInstructions.push(o)}this.finalizeRepetition(this.openRepetitions.last())}catch{try{let n=this.openRepetitions.last().RepetitonUnderConstruction;for(let a of this.repetitionInstructions)a.parentRepetition===n&&(a.parentRepetition=void 0);this.openRepetitions.splice(this.openRepetitions.length-1,1)}catch(n){W.default.error("RepetitionCalculator: calculateRepetitions2",n)}}let s=!1,r=this.musicSheet.SourceMeasures.length-1;for(let n of this.musicSheet.Repetitions)if(n.StartIndex===0&&n.EndIndex===r){s=!0;break}if(!s){let n=new Ls(this.musicSheet,!0);n.FromWords=!0,n.startMarker=new Lt(0,J.StartLine),n.startMarker.parentRepetition=n,this.musicSheet.SourceMeasures[0].FirstRepetitionInstructions.push(n.startMarker),n.endMarker=new Lt(r,J.BackJumpLine),n.endMarker.parentRepetition=n,n.BackwardJumpInstructions.push(n.endMarker),n.UserNumberOfRepetitions=n.DefaultNumberOfRepetitions,this.musicSheet.Repetitions.push(n)}for(let n=0,a=this.musicSheet.SourceMeasures.length;n<a;++n){let o=this.musicSheet.SourceMeasures[n];o.FirstRepetitionInstructions.length>1&&o.FirstRepetitionInstructions.sort(ar.Compare),o.LastRepetitionInstructions.length>1&&o.LastRepetitionInstructions.sort(ar.Compare)}}handleRepetitionInstructions(e){let t;switch(e.type){case J.StartLine:t=this.createNewRepetition(this.currentMeasureIndex),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!1,t.RepetitonUnderConstruction.startMarker=e,this.currentMeasure.FirstRepetitionInstructions.push(e);break;case J.BackJumpLine:t=this.getOrCreateCurrentRepetition2(!1),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e),t.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(t);break;case J.Ending:if(t=this.getOrCreateCurrentRepetition(),e.parentRepetition=t.RepetitonUnderConstruction,e.endingIndices.contains(1)&&e.alignment===Pt.Begin){if(t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0||t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)){t=void 0;for(let i=this.openRepetitions.length-1;i>=0;i--){let s=this.openRepetitions[i];if(s.RepetitonUnderConstruction.BackwardJumpInstructions.length===0)for(t=s;this.openRepetitions.length-1>i;){let r=this.openRepetitions.last();this.finalizeRepetition(r)}}t===void 0&&(t=this.createNewRepetition(0),t.RepetitonUnderConstruction.startMarker=new Lt(0,J.None))}t.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new Lt(this.currentMeasureIndex-1,J.ForwardJump,Pt.End,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].LastRepetitionInstructions.push(t.RepetitonUnderConstruction.forwardJumpInstruction))}if(e.alignment===Pt.Begin)t.RepetitonUnderConstruction.setEndingsStartIndex(e.endingIndices,this.currentMeasureIndex),this.currentMeasure.FirstRepetitionInstructions.push(e);else for(let i=0,s=e.endingIndices.length;i<s;++i){let r=e.endingIndices[i];t.RepetitonUnderConstruction.setEndingEndIndex(r,this.currentMeasureIndex),this.currentMeasure.LastRepetitionInstructions.push(e)}break;case J.Segno:if(t=this.getCurrentRepetition(!0),t!==void 0&&t.SegnoFound&&t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&Math.abs(t.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex-this.currentMeasureIndex)<=1)break;t=this.createNewRepetition(this.currentMeasureIndex),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=e,this.currentMeasure.FirstRepetitionInstructions.push(e);break;case J.Fine:if(this.openRepetitions.length===0||(t=this.getCurrentRepetition(!0),t===void 0))break;e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.forwardJumpInstruction===void 0?(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=e,t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.currentMeasure.LastRepetitionInstructions.push(e)):this.currentMeasure.LastRepetitionInstructions.push(new Lt(this.currentMeasureIndex,J.Fine,Pt.End,void 0));break;case J.ToCoda:if(this.openRepetitions.length===0||(t=this.getCurrentRepetition(!0),t===void 0))break;t.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.ToCodaFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=e,this.currentMeasure.LastRepetitionInstructions.push(e));break;case J.Coda:if(this.openRepetitions.length===0)break;t=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=t.RepetitonUnderConstruction,t.WaitingForCoda?(t.CodaFound=!0,t.RepetitonUnderConstruction.setEndingStartIndex(2,this.currentMeasureIndex),this.currentMeasure.LastRepetitionInstructions.push(e),this.finalizeRepetition(t),this.currentMeasureIndex>0&&(this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].printNewSystemXml=!0)):t.ToCodaFound||(t.RepetitonUnderConstruction.BackwardJumpInstructions.length===0?(t.ToCodaFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new Lt(this.currentMeasureIndex,J.ToCoda,Pt.End,t.RepetitonUnderConstruction),this.currentMeasure.LastRepetitionInstructions.push(t.RepetitonUnderConstruction.forwardJumpInstruction)):this.currentMeasure.LastRepetitionInstructions.push(new Lt(this.currentMeasureIndex,J.Coda,Pt.Begin,void 0)));break;case J.DaCapo:t=this.getOrCreateCurrentRepetition(),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&this.finalizeRepetition(t),t.RepetitonUnderConstruction.StartIndex!==0&&(t=this.createNewRepetition(0)),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.startMarker=new Lt(0,J.None,Pt.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e),t.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(t);break;case J.DalSegno:if(t=this.getOrCreateCurrentRepetition2(!0),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(t),t=this.createNewRepetition(0),t.RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.startMarker=new Lt(0,J.None,Pt.Begin,t.RepetitonUnderConstruction)),e.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){let i=this.findInstructionInMainListBackwards(J.Segno,e.measureIndex);i>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new Lt(i,J.Segno,Pt.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[i].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)&&t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;
71case J.DalSegnoAlFine:if(this.openRepetitions.length===0)break;if(t=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){let i=this.findInstructionInMainListBackwards(J.Segno,e.measureIndex);i>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new Lt(i,J.Segno,Pt.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[i].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}if(!t.FineFound){let i=this.findInstructionInMainListBackwards(J.Fine,e.measureIndex);i>=0&&(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new Lt(i,J.Fine,Pt.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[i].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case J.DaCapoAlFine:if(t=this.getOrCreateCurrentRepetition(),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(t),t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker!==void 0&&t.RepetitonUnderConstruction.StartIndex!==0&&(t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker=new Lt(0,J.None,Pt.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.FromWords=!0,e.parentRepetition=t.RepetitonUnderConstruction,!t.FineFound){let i=this.findInstructionInMainListBackwards(J.Fine,e.measureIndex);i>=0&&(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new Lt(i,J.Fine,Pt.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[i].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case J.DalSegnoAlCoda:if(this.openRepetitions.length===0)break;if(t=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){let i=this.findInstructionInMainListBackwards(J.Segno,e.measureIndex);i>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new Lt(i,J.Segno,Pt.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[i].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}if(!t.ToCodaFound){let i=this.findInstructionInMainListBackwards(J.ToCoda,e.measureIndex);if(i>=0)t.RepetitonUnderConstruction.forwardJumpInstruction=new Lt(i,J.ToCoda,Pt.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[i].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0;else{let s=this.findInstructionInMainListBackwards(J.Coda,e.measureIndex);s>=0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new Lt(s,J.ToCoda,Pt.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0)}}t.ToCodaFound&&(t.WaitingForCoda=!0),t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case J.DaCapoAlCoda:if(t=this.getOrCreateCurrentRepetition(),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0?(this.finalizeRepetition(t),t=this.createNewRepetition(0)):t.RepetitonUnderConstruction.EndingParts.length===0&&(t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker!==void 0&&t.RepetitonUnderConstruction.StartIndex!==0&&(t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker=new Lt(0,J.None,Pt.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.FromWords=!0,e.parentRepetition=t.RepetitonUnderConstruction,!t.ToCodaFound){let i=this.findInstructionInMainListBackwards(J.ToCoda,e.measureIndex);if(i>=0)t.RepetitonUnderConstruction.forwardJumpInstruction=new Lt(i,J.ToCoda,Pt.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[i].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0;else{let s=this.findInstructionInMainListBackwards(J.Coda,e.measureIndex);s>=0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new Lt(s,J.ToCoda,Pt.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0)}}t.ToCodaFound&&(t.WaitingForCoda=!0),t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case J.None:break;default:throw new gi("currentRepetitionInstruction")}return!0}findInstructionInMainListBackwards(e,t){for(let i=this.repetitionInstructions.length-1;i>=0;i--){let s=this.repetitionInstructions[i];if(s.measureIndex<=t&&s.type===e)return s.measureIndex}return-1}finalizeRepetition(e){let t=e.RepetitonUnderConstruction;if(t.BackwardJumpInstructions.length>0){let i=!0,s=this.getLastFinalizedRepetition();if(s!==void 0&&t.coversIdenticalMeasures(s)){if(t.NumberOfEndings>s.NumberOfEndings){let r=this.musicSheet.Repetitions.indexOf(s,0);r>-1&&this.musicSheet.Repetitions.splice(r,1),s.removeFromRepetitionInstructions(),this.musicSheet.Repetitions.push(t)}i=!1,t.removeFromRepetitionInstructions()}else this.musicSheet.Repetitions.push(t);if(i){t.startMarker.type===J.None&&this.musicSheet.SourceMeasures[t.StartIndex].FirstRepetitionInstructions.push(t.startMarker);let r=t.DefaultNumberOfRepetitions;t.BackwardJumpInstructions.length===1&&t.BackwardJumpInstructions[0].Times>0&&(r=t.BackwardJumpInstructions[0].Times),t.UserNumberOfRepetitions=r}}this.openRepetitions.splice(this.openRepetitions.length-1,1)}getCurrentRepetition(e){let t;for(let i=this.openRepetitions.length-1;i>=0;i--)if(this.openRepetitions[i].RepetitonUnderConstruction.FromWords===e){for(t=this.openRepetitions[i];i<this.openRepetitions.length-1;)this.finalizeRepetition(this.openRepetitions.last());return t}return t}getOrCreateCurrentRepetition(){if(this.openRepetitions.length>0)return this.openRepetitions.last();let e=this.createNewRepetition(0);return e.RepetitonUnderConstruction.startMarker=new Lt(0,J.None,Pt.Begin,e.RepetitonUnderConstruction),e}getOrCreateCurrentRepetition2(e){let t;for(let i=this.openRepetitions.length-1;i>=0;i--)if(t=this.openRepetitions[i],t.RepetitonUnderConstruction.FromWords===e){for(;i<this.openRepetitions.length-1;)this.finalizeRepetition(this.openRepetitions.last());return t}return t=this.createNewRepetition(this.lastRepetitionCommonPartStartIndex),t.RepetitonUnderConstruction.startMarker=new Lt(this.lastRepetitionCommonPartStartIndex,J.None,Pt.Begin,t.RepetitonUnderConstruction),this.lastRepetitionCommonPartStartIndex=this.currentMeasureIndex+1,t.RepetitonUnderConstruction.FromWords=e,t}createNewRepetition(e){if(this.openRepetitions.length>0){let i=this.openRepetitions.last(),s=i.RepetitonUnderConstruction;if(s.BackwardJumpInstructions.length>0){let r=Object.keys(s.EndingIndexDict);(r.length===0||s.EndingIndexDict[r[r.length-1]].part.EndIndex>=0)&&this.finalizeRepetition(i)}}let t=new Wl(this.musicSheet);return this.lastRepetitionCommonPartStartIndex=e,this.openRepetitions.push(t),t}getLastFinalizedRepetition(){if(this.musicSheet.Repetitions.length>0)return this.musicSheet.Repetitions.last()}},Wl=class{constructor(e){this.RepetitonUnderConstruction=new Ls(e)}},Pn=class{static createRepetitionInstructionReader(){return new Vl}static createRepetitionCalculator(){return new Gl}},Ul=class{constructor(){this.voiceMeasureReadPlugins=[]}addVoiceMeasureReadPlugin(e){this.voiceMeasureReadPlugins.push(e)}processVoiceMeasureReadPlugins(e,t,i){for(let s of this.voiceMeasureReadPlugins)try{s.measureReadCalculations(e,t,i)}catch(r){W.default.info("VoiceGenerator.addSingleNote: ",r)}}},zl=class{constructor(e=void 0,t=new Li){this.completeNumberOfStaves=0,this.pluginManager=new 
71Ul,e?this.afterSheetReadingModules=e:this.afterSheetReadingModules=[],this.repetitionInstructionReader=Pn.createRepetitionInstructionReader(),this.repetitionCalculator=Pn.createRepetitionCalculator(),this.rules=t}get PluginManager(){return this.pluginManager}get CompleteNumberOfStaves(){return this.completeNumberOfStaves}static doCalculationsAfterDurationHasBeenSet(e){for(let t of e)t.doCalculationsAfterDurationHasBeenSet()}createMusicSheet(e,t){try{return this._createMusicSheet(e,t)}catch(i){W.default.error("MusicSheetReader.CreateMusicSheet",i);return}}_removeFromArray(e,t){let i=e.indexOf(t);i!==-1&&e.splice(i,1)}trimString(e){return e.replace(/^\s+|\s+$/g,"")}_lastElement(e){return e[e.length-1]}_createMusicSheet(e,t){let i=[],s=0;this.musicSheet=new ma,this.musicSheet.Path=t,this.musicSheet.Rules=this.rules;let r=e.attribute("osmdMeasureWidthFactor");if(r){let c=Number.parseFloat(r.value);typeof c=="number"&&!isNaN(c)?this.musicSheet.MeasureWidthFactor=c:W.default.info("xml parse: osmdMeasureWidthFactor invalid")}if(!e)throw new Se("Undefined root element");this.pushSheetLabels(e,t);let n=e.element("part-list");if(!n)throw new Se("Undefined partListNode");let a=e.elements("part"),o=n.elements();this.initializeReading(o,a,i);let l=!0;this.currentFraction=new N(0,1);let h=!1,u=e.element("identification");for(u&&(u=u.element("encoding")),u&&(u=u.element("software")),u!==void 0&&u.value==="Guitar Pro 5"&&(h=!0);l;){this.currentMeasure!==void 0&&this.currentMeasure.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(s=0),this.currentMeasure=new _l(this.completeNumberOfStaves,this.musicSheet.Rules);for(let c of i)try{l=l&&c.readNextXmlMeasure(this.currentMeasure,this.currentFraction,h)}catch(d){throw new Se(Tt.translateText("ReaderErrorMessages/InstrumentError","Error while reading instruments."),d)}l&&(this.musicSheet.addMeasure(this.currentMeasure),this.checkIfRhythmInstructionsAreSetAndEqual(i),this.checkSourceMeasureForNullEntries(),s=this.setSourceMeasureDuration(i,s),this.currentMeasure.AbsoluteTimestamp=this.currentFraction.clone(),this.musicSheet.SheetErrors.finalizeMeasure(this.currentMeasure.MeasureNumber),this.currentFraction.Add(this.currentMeasure.Duration),this.previousMeasure=this.currentMeasure)}this.repetitionInstructionReader&&(this.repetitionInstructionReader.removeRedundantInstructions(),this.repetitionCalculator&&this.repetitionCalculator.calculateRepetitions(this.musicSheet,this.repetitionInstructionReader.repetitionInstructions)),this.musicSheet.checkForInstrumentWithNoVoice(),this.musicSheet.fillStaffList();for(let c=0,d=this.afterSheetReadingModules.length;c<d;++c)this.afterSheetReadingModules[c].calculate(this.musicSheet);return this.musicSheet.userStartTempoInBPM=this.musicSheet.userStartTempoInBPM||this.musicSheet.DefaultStartTempoInBpm,this.musicSheet}initializeReading(e,t,i){let s=this.createInstrumentGroups(e);this.completeNumberOfStaves=this.getCompleteNumberOfStavesFromXml(t),t.length!==0&&(this.repetitionInstructionReader.MusicSheet=this.musicSheet,this.currentFraction=new N(0,1),this.currentMeasure=void 0,this.previousMeasure=void 0);let r=0;for(let n of t){let a=n.attribute("id");if(a){let o=s[a.value],l=n.elements("measure"),h=1;try{h=this.getInstrumentNumberOfStavesFromXml(n)}catch{let u=Tt.translateText("ReaderErrorMessages/InstrumentStavesNumberError","Invalid number of staves at instrument: ");this.musicSheet.SheetErrors.push(u+o.Name);continue}o.createStaves(h),i.push(new Ol(this.pluginManager,this.repetitionInstructionReader,l,o)),this.repetitionInstructionReader&&(this.repetitionInstructionReader.xmlMeasureList[r]=l),r++}}}checkIfRhythmInstructionsAreSetAndEqual(e){let t=[];for(let r=0;r<this.completeNumberOfStaves;r++)if(this.currentMeasure.FirstInstructionsStaffEntries[r]){let n=this.currentMeasure.FirstInstructionsStaffEntries[r].Instructions[this.currentMeasure.FirstInstructionsStaffEntries[r].Instructions.length-1];n instanceof Re&&t.push(n)}let i=0,s=-1;for(let r=0,n=t.length;r<n;++r){let a=t[r];if(a.Rhythm.RealValue>i){if(this.areRhythmInstructionsMixed(t)&&a.SymbolEnum!==Ke.NONE)continue;i=a.Rhythm.RealValue,s=t.indexOf(a)}}if(t.length>0&&t.length<this.completeNumberOfStaves){let r=t[s].clone();for(let n=0;n<this.completeNumberOfStaves;n++)this.currentMeasure.FirstInstructionsStaffEntries[n]!==void 0&&!(this._lastElement(this.currentMeasure.FirstInstructionsStaffEntries[n].Instructions)instanceof Re)&&(this.currentMeasure.FirstInstructionsStaffEntries[n].removeAllInstructionsOfTypeRhythmInstru
71ction(),this.currentMeasure.FirstInstructionsStaffEntries[n].Instructions.push(r.clone())),this.currentMeasure.FirstInstructionsStaffEntries[n]||(this.currentMeasure.FirstInstructionsStaffEntries[n]=new be(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[n].Instructions.push(r.clone()));for(let n=0,a=e.length;n<a;++n){let o=e[n];o.ActiveRhythm=r}}if(t.length===0&&this.currentMeasure===this.musicSheet.SourceMeasures[0]){let r=new Re(new N(4,4,0,!1),Ke.NONE);for(let n=0;n<this.completeNumberOfStaves;n++)this.currentMeasure.FirstInstructionsStaffEntries[n]?this.currentMeasure.FirstInstructionsStaffEntries[n].removeAllInstructionsOfTypeRhythmInstruction():this.currentMeasure.FirstInstructionsStaffEntries[n]=new be(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[n].Instructions.push(r);for(let n=0,a=e.length;n<a;++n){let o=e[n];o.ActiveRhythm=r}}for(let r=0,n=t.length;r<n;++r){let a=t[r];if(a.Rhythm.RealValue<i&&this._lastElement(this.currentMeasure.FirstInstructionsStaffEntries[t.indexOf(a)].Instructions)instanceof Re){let o=this.currentMeasure.FirstInstructionsStaffEntries[t.indexOf(a)].Instructions;o[o.length-1]=t[s].clone()}Math.abs(a.Rhythm.RealValue-i)<1e-6&&a.SymbolEnum!==Ke.NONE&&this.areRhythmInstructionsMixed(t)&&(a.SymbolEnum=Ke.NONE)}}areRhythmInstructionsMixed(e){for(let t=1;t<e.length;t++)if(Math.abs(e[t].Rhythm.RealValue-e[0].Rhythm.RealValue)<1e-6&&e[t].SymbolEnum!==e[0].SymbolEnum)return!0;return!1}setSourceMeasureDuration(e,t){let i=new N(0,1),s=[];for(let a of e){s.push(a.MaxTieNoteFraction);let o=a.ActiveRhythm.Rhythm;i.lt(o)&&(i=new N(o.Numerator,o.Denominator,0,!1))}let r=this.currentMeasure.calculateInstrumentsDuration(this.musicSheet,s),n=new N(0,1);for(let a of r)n.lt(a)&&(n=a);N.Equal(n,i)?this.checkFractionsForEquivalence(n,i):n.lt(i)&&(n=this.currentMeasure.reverseCheck(this.musicSheet,n),this.checkFractionsForEquivalence(n,i)),this.currentMeasure.ImplicitMeasure=this.checkIfMeasureIsImplicit(n,i),(!this.currentMeasure.ImplicitMeasure||t>0)&&t++,this.currentMeasure.Duration=n,this.currentMeasure.ActiveTimeSignature=i,this.currentMeasure.MeasureNumber=t;for(let a=0;a<r.length;a++){let o=r[a];if(this.currentMeasure.ImplicitMeasure&&o!==n||!N.Equal(o,i)&&!this.allInstrumentsHaveSameDuration(r,n)){let l=this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.musicSheet.Instruments[a]);for(let h=0;h<this.musicSheet.Instruments[a].Staves.length;h++)if(!this.graphicalMeasureIsEmpty(l+h)){this.currentMeasure.setErrorInGraphicalMeasure(l+h,!0);let u=Tt.translateText("ReaderErrorMessages/MissingNotesError","Given Notes don't correspond to measure duration.");this.musicSheet.SheetErrors.pushMeasureError(u)}}}return t}checkFractionsForEquivalence(e,t){if(t.Denominator>e.Denominator){let i=t.Denominator/e.Denominator;e.expand(i)}}checkIfMeasureIsImplicit(e,t){return!this.previousMeasure&&e.lt(t)?!0:this.previousMeasure?N.plus(this.previousMeasure.Duration,e).Equals(t):!1}allInstrumentsHaveSameDuration(e,t){let i=0;for(let s=0,r=e.length;s<r;++s)e[s].Equals(t)&&i++;return i===e.length&&t!==new N(0,1)}graphicalMeasureIsEmpty(e){let t=0;for(let i=0;i<this.currentMeasure.VerticalSourceStaffEntryContainers.length;i++)this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries[e]||t++;return t===this.currentMeasure.VerticalSourceStaffEntryContainers.length}checkSourceMeasureForNullEntries(){for(let e=this.currentMeasure.VerticalSourceStaffEntryContainers.length-1;e>=0;e--)for(let t=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries.length-1;t>=0;t--){let i=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries[t];if(i)for(let s=i.VoiceEntries.length-1;s>=0;s--){let r=i.VoiceEntries[s];r.Notes.length===0&&(this._removeFromArray(r.ParentVoice.VoiceEntries,r),this._removeFromArray(i.VoiceEntries,r))}i!==void 0&&i.VoiceEntries.length===0&&i.ChordContainers.length===0&&(this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries[t]=void 0)}for(let e=this.currentMeasure.VerticalSourceStaffEntryContainers.length-1;e>=0;e--){let t=0;for(let i=0,s=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries.length;i<s;++i)this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries[i]||t++;t===this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries.length&&this._removeFromArray(this.currentMeasure.VerticalSourceStaffEntryContainers,this.currentMeasure.VerticalSourceStaffEntryContainers[e])}}pushSheetLabels(e,t){this.readComposer(e),this.readTitle(e),this.readCopyright(e);try{(!this.musicSheet.Title||!this.musicSheet.Composer||!this.musicSheet.Subtitle)&&this.readTitleAndComposerFromCredits(e)}catch(i){W.default.info("MusicSheetReader.pushSheetLabels","readTitleAndComposerFromCredits",i)}try{if(!this.musicSheet.Title){let i=Math.max(0,t.lastIndexOf("/"),t.lastIndexOf("\\")),s=t.substr(i).split(".",1);this.musicSheet.Title=new Nt(s[0])}}catch(i){W.default.info("MusicSheetReader.pushSheetLabels","read title from file name",i)}}presentAttrsWithValue(e,t){for(let i of e.attributes())if(i.value===t)return!0;return!1}readComposer(e){let t=e.element("identification");if(t){let i=t.elements("creator");for(let s=0,r=i.length;s<r;++s){let n=i[s];
71if(n.hasAttributes){if(this.presentAttrsWithValue(n,"composer")){this.musicSheet.Composer=new Nt(this.trimString(n.value));continue}(this.presentAttrsWithValue(n,"lyricist")||this.presentAttrsWithValue(n,"poet"))&&(this.musicSheet.Lyricist=new Nt(this.trimString(n.value)))}}}}readCopyright(e){let t=e.elements("identification");if(t.length>0){let i=t[0].elements("rights");if(i.length>0)for(let s=0,r=i.length;s<r;++s){let n=i[s];if(n.value){this.musicSheet.Copyright=new Nt(n.value,mt.CenterBottom,void 0,!0);break}}}}readTitleAndComposerFromCredits(e){if(this.rules.SheetComposerSubtitleUseLegacyParsing){this.readTitleAndComposerFromCreditsLegacy(e);return}let t=this.computeSystemYCoordinates(e);if(t===0)return;let i,s,r,n=e.elements("credit");for(let a=0,o=n.length;a<o;++a){let l=n[a];if(!l.attribute("page"))return;if(l.attribute("page").value==="1"){let h;if(l){let u=!1,c=!1,d=l.element("credit-type");d?.value==="subtitle"?u=!0:d?.value==="composer"&&(c=!0);let f=u||c;h=l.elements("credit-words");for(let p of h){let m=p.value?.trim();if(m==="Copyright ©")continue;let g=p.attribute("justify")?.value;g==="right"?(c=!0,f=!0):g==="center"&&i&&(u=!0,f=!0);let b=p.attribute("default-y")?.value,S=b!=null,E=S?parseFloat(b):Number.MIN_VALUE;if(S&&E>t||f){if(!i&&!f)i=m;else if(c||g==="right")r?r+=`
72`+m:r=m;else if(u||g!=="right"&&g!=="left")s?s+=`
73`+m:s=m;else if(g==="left"){this.musicSheet.Lyricist||(this.musicSheet.Lyricist=new Nt(m));break}}}}}}if(!this.musicSheet.Title&&i&&(this.musicSheet.Title=new Nt(this.trimString(i))),!this.musicSheet.Subtitle&&s&&(this.musicSheet.Subtitle=new Nt(this.trimString(s))),r){let a=!1;this.musicSheet.Composer?(r.match(`
74`)??[]).length+1>=(this.musicSheet.Composer.text.match(`
75`)??[]).length+1&&(a=!0):a=!0,a&&(this.musicSheet.Composer=new Nt(this.trimString(r)))}}readTitleAndComposerFromCreditsLegacy(e){let t=this.computeSystemYCoordinates(e);if(t===0)return;let i=1,s,r=0,n,a,o=e.elements("credit");for(let l=0,h=o.length;l<h;++l){let u=o[l];if(!u.attribute("page"))return;if(u.attribute("page").value==="1"){let c;if(u){if(c=u.element("credit-words"),!c.attribute("justify"))break;let d=c.attribute("justify")?.value,f=c.attribute("default-y")?.value,p=f!=null,m=p?parseFloat(f):Number.MIN_VALUE,g=!1;if(u.element("credit-type")?.value==="subtitle"&&(g=!0),p&&m>t||g){if(!this.musicSheet.Title&&!g){let b=c.attribute("font-size")?.value;if(b){let S=parseFloat(b);i<S&&(i=S,s=c.value)}}switch(this.musicSheet.Subtitle||(d!=="right"&&d!=="left"||g)&&(r<m?(r=m,a&&(n=a),a=c.value):n?n+=`
76`+c.value:n=c.value),d){case"right":this.musicSheet.Composer||(this.musicSheet.Composer=new Nt(this.trimString(c.value)));break;case"left":this.musicSheet.Lyricist||(this.musicSheet.Lyricist=new Nt(this.trimString(c.value)));break;default:break}}}}}!this.musicSheet.Title&&s&&(this.musicSheet.Title=new Nt(this.trimString(s))),!this.musicSheet.Subtitle&&n&&(this.musicSheet.Subtitle=new Nt(this.trimString(n)))}computeSystemYCoordinates(e){if(!e.element("defaults"))return 0;let t=0,i=0;try{let n=e.element("defaults")?.element("page-layout")?.element("page-height").value??"0";t=parseFloat(n)}catch{return W.default.info("MusicSheetReader.computeSystemYCoordinates(): couldn't find page height, not reading title/composer."),0}let s=!1,r=e.elements("part");for(let n=0,a=r.length;n<a;++n){let o=r[n].elements("measure");for(let l=0,h=o.length;l<h;++l){let u=o[l];if(u.element("print")){let c=u.element("print").elements("system-layout");for(let d=0,f=c.length;d<f;++d){let p=c[d];if(p.element("top-system-distance")){let m=p.element("top-system-distance").value;i=parseFloat(m),s=!0;break}}break}}if(s)break}if(e.element("defaults").element("system-layout")&&e.element("defaults").element("system-layout").element("top-system-distance")){let n=e.element("defaults").element("system-layout").element("top-system-distance").value;i=parseFloat(n)}return i===0?0:t-i}readTitle(e){let t=e.element("work"),i;t&&(i=t.element("work-title"),i&&i.value&&(this.musicSheet.Title=new Nt(this.trimString(i.value))));let s=e.element("movement-title"),r="";if(s&&(this.musicSheet.Title?r=this.trimString(s.value):this.musicSheet.Title=new Nt(this.trimString(s.value))),t){let n=t.element("work-number");if(n){let a=n.value;a&&(r=r===""?a:r+", "+a)}}r&&(this.musicSheet.Subtitle=new Nt(r))}createInstrumentGroups(e){let t=0,i={},s;try{let r=e;for(let n=0,a=r.length;n<a;++n){let o=r[n];if(o.name==="score-part"){let l=o.attribute("id").value,h=new cr(t,l,this.musicSheet,s);t++;let u=o.elements();for(let c=0,d=u.length;c<d;++c){let f=u[c];try{if(f.name==="part-name")h.Name=f.value,f.attribute("print-object")&&f.attribute("print-object").value==="no"&&(h.NameLabel.print=!1);else if(f.name==="part-abbreviation")h.PartAbbreviation=f.value;else if(f.name==="score-instrument"){let p=new gr(h);p.idString=f.firstAttribute.value,h.SubInstruments.push(p);let m=f.element("instrument-name");m&&(p.name=m.value,p.setMidiInstrument(m.value))}else if(f.name==="midi-instrument"){let p=h.getSubInstrument(f.firstAttribute.value);for(let g=0,b=h.SubInstruments.length;g<b;++g){let S=h.SubInstruments[g];if(S.idString===f.value){p=S;break}}let m=f.elements();for(let g=0,b=m.length;g<b;++g){let S=m[g];try{if(S.name==="midi-channel")parseInt(S.value,10)===10&&(h.MidiInstrumentId=lt.Percussion);else if(S.name==="midi-program")h.SubInstruments.length>0&&h.MidiInstrumentId!==lt.Percussion&&(p.midiInstrumentID=Math.max(0,parseInt(S.value,10)-1));else if(S.name==="midi-unpitched")p.fixedKey=Math.max(0,parseInt(S.value,10));else if(S.name==="volume")try{let E=parseFloat(S.value);p.volume=E/127}catch(E){W.default.debug("ExpressionReader.readExpressionParameters","read volume",E)}else if(S.name==="pan")try{let E=parseFloat(S.value);p.pan=E/64}catch(E){W.default.debug("ExpressionReader.readExpressionParameters","read pan",E)}}catch(E){W.default.info("MusicSheetReader.createInstrumentGroups midi settings: ",E)}}}}catch(p){W.default.info("MusicSheetReader.createInstrumentGroups: ",p)}}if(h.SubInstruments.length===0){let c=new gr(h);h.SubInstruments.push(c)}i[l]=h,s?(s.InstrumentalGroups.push(h),this.musicSheet.Instruments.push(h)):(this.musicSheet.InstrumentalGroups.push(h),this.musicSheet.Instruments.push(h))}else if(o.name==="part-group"&&o.attribute("type").value==="start"){let l=new ia("group",this.musicSheet,s);s?s.InstrumentalGroups.push(l):this.musicSheet.InstrumentalGroups.push(l),s=l}else if(o.name==="part-group"&&o.attribute("type").value==="stop"&&s){if(s.InstrumentalGroups.length===1){let l=s.InstrumentalGroups[0];s.Parent?(s.Parent.InstrumentalGroups.push(l),this._removeFromArray(s.Parent.InstrumentalGroups,s)):(this.musicSheet.InstrumentalGroups.push(l),this._removeFromArray(this.musicSheet.InstrumentalGroups,s))}s=s.Parent}}}catch(r){throw new Se(Tt.translateText("ReaderErrorMessages/InstrumentError","Error while reading Instruments"),r)}for(let r=0,n=this.musicSheet.Instruments.length;r<n;++r){let a=this.musicSheet.Instruments[r];a.Name||(a.Name="Instr. "+a.IdString)}return i}getCompleteNumberOfStavesFromXml(e){let t=0;for(let i of e){let s=i.elements("measure");if(s.length>0){let r=s[0];if(r){let n=r.element("attributes");
76n&&(n=n.element("staves")),n?t+=parseInt(n.value,10):t++}}}if(isNaN(t)||t<=0)throw new Se(Tt.translateText("ReaderErrorMessages/StaffError","Invalid number of staves."));return t}getInstrumentNumberOfStavesFromXml(e){let t=0,i=e.element("measure");if(i){let s=i.element("attributes"),r;s&&(r=s.element("staves")),t=!s||!r?1:parseInt(r.value,10)}if(isNaN(t)||t<=0)throw new Se(Tt.translateText("ReaderErrorMessages/StaffError","Invalid number of Staves."));return t}},Hl=Ka(xe(((e,t)=>{(function(i){typeof e=="object"&&t!==void 0?t.exports=i():typeof define=="function"&&define.amd?define([],i):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=i()})(function(){return(function i(s,r,n){function a(h,u){if(!r[h]){if(!s[h]){var c=typeof ks=="function"&&ks;if(!u&&c)return c(h,!0);if(o)return o(h,!0);var d=Error("Cannot find module '"+h+"'");throw d.code="MODULE_NOT_FOUND",d}var f=r[h]={exports:{}};s[h][0].call(f.exports,function(p){var m=s[h][1][p];return a(m||p)},f,f.exports,i,s,r,n)}return r[h].exports}for(var o=typeof ks=="function"&&ks,l=0;l<n.length;l++)a(n[l]);return a})({1:[function(i,s,r){var n=i("./utils"),a=i("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(l){for(var h,u,c,d,f,p,m,g=[],b=0,S=l.length,E=S,y=n.getTypeOf(l)!=="string";b<l.length;)E=S-b,c=y?(h=l[b++],u=b<S?l[b++]:0,b<S?l[b++]:0):(h=l.charCodeAt(b++),u=b<S?l.charCodeAt(b++):0,b<S?l.charCodeAt(b++):0),d=h>>2,f=(3&h)<<4|u>>4,p=1<E?(15&u)<<2|c>>6:64,m=2<E?63&c:64,g.push(o.charAt(d)+o.charAt(f)+o.charAt(p)+o.charAt(m));return g.join("")},r.decode=function(l){var h,u,c,d,f,p,m=0,g=0,b="data:";if(l.substr(0,b.length)===b)throw Error("Invalid base64 input, it looks like a data url.");var S,E=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===o.charAt(64)&&E--,l.charAt(l.length-2)===o.charAt(64)&&E--,E%1!=0)throw Error("Invalid base64 input, bad content length.");for(S=a.uint8array?new Uint8Array(0|E):Array(0|E);m<l.length;)h=o.indexOf(l.charAt(m++))<<2|(d=o.indexOf(l.charAt(m++)))>>4,u=(15&d)<<4|(f=o.indexOf(l.charAt(m++)))>>2,c=(3&f)<<6|(p=o.indexOf(l.charAt(m++))),S[g++]=h,f!==64&&(S[g++]=u),p!==64&&(S[g++]=c);return S}},{"./support":30,"./utils":32}],2:[function(i,s,r){var n=i("./external"),a=i("./stream/DataWorker"),o=i("./stream/Crc32Probe"),l=i("./stream/DataLengthProbe");function h(u,c,d,f,p){this.compressedSize=u,this.uncompressedSize=c,this.crc32=d,this.compression=f,this.compressedContent=p}h.prototype={getContentWorker:function(){var u=new a(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),c=this;return u.on("end",function(){if(this.streamInfo.data_length!==c.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new a(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},h.createWorkerFrom=function(u,c,d){return u.pipe(new o).pipe(new l("uncompressedSize")).pipe(c.compressWorker(d)).pipe(new l("compressedSize")).withStreamInfo("compression",c)},s.exports=h},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(i,s,r){var n=i("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=i("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(i,s,r){var n=i("./utils"),a=(function(){for(var o,l=[],h=0;h<256;h++){o=h;for(var u=0;u<8;u++)o=1&o?3988292384^o>>>1:o>>>1;l[h]=o}return l})();s.exports=function(o,l){return o!==void 0&&o.length?n.getTypeOf(o
vendor: 30,393 bytes, lines 76-77
76)==="string"?(function(h,u,c,d){var f=a,p=d+c;h^=-1;for(var m=d;m<p;m++)h=h>>>8^f[255&(h^u.charCodeAt(m))];return-1^h})(0|l,o,o.length,0):(function(h,u,c,d){var f=a,p=d+c;h^=-1;for(var m=d;m<p;m++)h=h>>>8^f[255&(h^u[m])];return-1^h})(0|l,o,o.length,0):0}},{"./utils":32}],5:[function(i,s,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(i,s,r){var n=null;n=typeof Promise<"u"?Promise:i("lie"),s.exports={Promise:n}},{lie:37}],7:[function(i,s,r){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=i("pako"),o=i("./utils"),l=i("./stream/GenericWorker"),h=n?"uint8array":"array";function u(c,d){l.call(this,"FlateWorker/"+c),this._pako=null,this._pakoAction=c,this._pakoOptions=d,this.meta={}}r.magic="\b\0",o.inherits(u,l),u.prototype.processChunk=function(c){this.meta=c.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(h,c.data),!1)},u.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var c=this;this._pako.onData=function(d){c.push({data:d,meta:c.meta})}},r.compressWorker=function(c){return new u("Deflate",c)},r.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(i,s,r){function n(f,p){var m,g="";for(m=0;m<p;m++)g+=String.fromCharCode(255&f),f>>>=8;return g}function a(f,p,m,g,b,S){var E,y,M=f.file,P=f.compression,L=S!==h.utf8encode,B=o.transformTo("string",S(M.name)),A=o.transformTo("string",h.utf8encode(M.name)),G=M.comment,H=o.transformTo("string",S(G)),T=o.transformTo("string",h.utf8encode(G)),I=A.length!==M.name.length,v=T.length!==G.length,U="",dt="",Y="",at=M.dir,X=M.date,Z={crc32:0,compressedSize:0,uncompressedSize:0};p&&!m||(Z.crc32=f.crc32,Z.compressedSize=f.compressedSize,Z.uncompressedSize=f.uncompressedSize);var O=0;p&&(O|=8),L||!I&&!v||(O|=2048);var V=0,ht=0;at&&(V|=16),b==="UNIX"?(ht=798,V|=(function(it,Ut){var jt=it;return it||(jt=Ut?16893:33204),(65535&jt)<<16})(M.unixPermissions,at)):(ht=20,V|=(function(it){return 63&(it||0)})(M.dosPermissions)),E=X.getUTCHours(),E<<=6,E|=X.getUTCMinutes(),E<<=5,E|=X.getUTCSeconds()/2,y=X.getUTCFullYear()-1980,y<<=4,y|=X.getUTCMonth()+1,y<<=5,y|=X.getUTCDate(),I&&(dt=n(1,1)+n(u(B),4)+A,U+="up"+n(dt.length,2)+dt),v&&(Y=n(1,1)+n(u(H),4)+T,U+="uc"+n(Y.length,2)+Y);var nt="";return nt+=`
77\0`,nt+=n(O,2),nt+=P.magic,nt+=n(E,2),nt+=n(y,2),nt+=n(Z.crc32,4),nt+=n(Z.compressedSize,4),nt+=n(Z.uncompressedSize,4),nt+=n(B.length,2),nt+=n(U.length,2),{fileRecord:c.LOCAL_FILE_HEADER+nt+B+U,dirRecord:c.CENTRAL_FILE_HEADER+n(ht,2)+nt+n(H.length,2)+"\0\0\0\0"+n(V,4)+n(g,4)+B+U+H}}var o=i("../utils"),l=i("../stream/GenericWorker"),h=i("../utf8"),u=i("../crc32"),c=i("../signature");function d(f,p,m,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=m,this.encodeFileName=g,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(d,l),d.prototype.push=function(f){var p=f.meta.percent||0,m=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,l.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:m?(p+100*(m-g-1))/m:100}}))},d.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var p=this.streamFiles&&!f.file.dir;if(p){var m=a(f,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(f){this.accumulate=!1;var p=this.streamFiles&&!f.file.dir,m=a(f,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),p)this.push({data:(function(g){return c.DATA_DESCRIPTOR+n(g.crc32,4)+n(g.compressedSize,4)+n(g.uncompressedSize,4)})(f),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var f=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var m=this.bytesWritten-f,g=(function(b,S,E,y,M){var P=o.transformTo("string",M(y));return c.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(b,2)+n(b,2)+n(S,4)+n(E,4)+n(P.length,2)+P})(this.dirRecords.length,m,f,this.zipComment,this.encodeFileName);this.push({data:g,meta:{percent:100}})},d.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},d.prototype.registerPrevious=function(f){this._sources.push(f);var p=this;return f.on("data",function(m){p.processChunk(m)}),f.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),f.on("error",function(m){p.error(m)}),this},d.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},d.prototype.error=function(f){var p=this._sources;if(!l.prototype.error.call(this,f))return!1;for(var m=0;m<p.length;m++)try{p[m].error(f)}catch{}return!0},d.prototype.lock=function(){l.prototype.lock.call(this);for(var f=this._sources,p=0;p<f.length;p++)f[p].lock()},s.exports=d},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(i,s,r){var n=i("../compressions"),a=i("./ZipFileWorker");r.generateWorker=function(o,l,h){var u=new a(l.streamFiles,h,l.platform,l.encodeFileName),c=0;try{o.forEach(function(d,f){c++;var p=(function(S,E){var y=S||E,M=n[y];if(!M)throw Error(y+" is not a valid compression method !");return M})(f.options.compression,l.compression),m=f.options.compressionOptions||l.compressionOptions||{},g=f.dir,b=f.date;f._compressWorker(p,m).withStreamInfo("file",{name:d,dir:g,date:b,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(u)}),u.entriesCount=c}catch(d){u.error(d)}return u}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(i,s,r){function n(){if(!(this instanceof n))return new n;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var a=new n;for(var o in this)typeof this[o]!="function"&&(a[o]=this[o]);return a}}(n.prototype=i("./object")).loadAsync=i("./load"),n.support=i("./support"),n.defaults=i("./defaults"),n.version="3.10.1",n.loadAsync=function(a,o){return new n().loadAsync(a,o)},n.external=i("./external"),s.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(i,s,r){var n=i("./utils"),a=i("./external"),o=i("./utf8"),l=i("./zipEntries"),h=i("./stream/Crc32Probe"),u=i("./nodejsUtils");function c(d){return new a.Promise(function(f,p){var m=d.decompressed.getContentWorker().pipe(new h);m.on("error",function(g){p(g)}).on("end",function(){m.streamInfo.crc32===d.decompressed.crc32?f():p(Error("Corrupted zip : CRC32 mismatch"))}).resume()})}s.exports=function(d,f){var p=this;return f=n.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),u.isNode&&u.isStream(d)?a.Promise.reject(Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",d,!0,f.optimizedBinaryString,f.base64).then(function(m){var g=new l(f);return g.load(m),g}).then(function(m){var g=[a.Promise.resolve(m)],b=m.files;if(f.checkCRC32)for(var S=0;S<b.length;S++)g.push(c(b[S]));return a.Promise.all(g)}).then(function(m){for(var g=m.shift(),b=g.files,S=0;S<b.length;S++){var E=b[S],y=E.fileNameStr,M=n.resolve(E.fileNameStr);p.file(M,E.decompressed,{binary:!0,optimizedBinaryString:!0,date:E.date,dir:E.dir,comment:E.fileCommentStr.length?E.fileCommentStr:null,unixPermissions:E.unixPermissions,dosPermissions:E.dosPermissions,createFolders:f.createFolders}),E.dir||(p.file(M).unsafeOriginalName=y)}return g.zipComment.length&&(p.comment=g.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(i,s,r){var n=i("../utils"),a=i("../stream/GenericWorker");function o(l,h){a.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(h)}n.inherits(o,a),o.prototype._bindStream=function(l){var h=this;(this._stream=l).pause(),l.on("data",function(u){h.push({data:u,meta:{percent:0}})}).on("error",function(u){h.isPaused?this.generatedError=u:h.error(u)}).on("end",function(){h.isPaused?h._upstreamEnded=!0:h.end()})},o.prototype.pause=function(){return!!a.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},s.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(i,s,r){var n=i("readable-stream").Readable;function a(o,l,h){n.call(this,l),this._helper=o;var u=this;o.on("data",function(c,d){u.push(c)||u._helper.pause(),h&&h(d)}).on("error",function(c){u.emit("error",c)}).on("end",function(){u.push(null)})}i("../utils").inherits(a,n),a.prototype._read=function(){this._helper.resume()},s.exports=a},{"../utils":32,"readable-stream":16}],14:[function(i,s,r){s.exports={isNode:typeof Buffer<"u",newBufferFrom:function(n,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(n,a);if(typeof n=="number")throw Error('The "data" argument must not be a number');return new Buffer(n,a)},allocBuffer:function(n){if(Buffer.alloc)return Buffer.alloc(n);var a=new Buffer(n);return a.fill(0),a},isBuffer:function(n){return Buffer.isBuffer(n)},isStream:function(n){return n&&typeof n.on=="function"&&typeof n.pause=="function"&&typeof n.resume=="function"}}},{}],15:[function(i,s,r){function n(y,M,P){var L,B=o.getTypeOf(M),A=o.extend(P||{},u);A.date=A.date||new Date,A.compression!==null&&(A.compression=A.compression.toUpperCase()),typeof A.unixPermissions=="string"&&(A.unixPermissions=parseInt(A.unixPermissions,8)),A.unixPermissions&&16384&A.unixPermissions&&(A.dir=!0),A.dosPermissions&&16&A.dosPermissions&&(A.dir=!0),A.dir&&(y=b(y)),A.createFolders&&(L=g(y))&&S.call(this,L,!0);var G=B==="string"&&A.binary===!1&&A.base64===!1;P&&P.binary!==void 0||(A.binary=!G),(M instanceof c&&M.uncompressedSize===0||A.dir||!M||M.length===0)&&(A.base64=!1,A.binary=!0,M="",A.compression="STORE",B="string");var H=null;H=M instanceof c||M instanceof l?M:p.isNode&&p.isStream(M)?new m(y,M):o.prepareContent(y,M,A.binary,A.optimizedBinaryString,A.base64);var T=new d(y,H,A);this.files[y]=T}var a=i("./utf8"),o=i("./utils"),l=i("./stream/GenericWorker"),h=i("./stream/StreamHelper"),u=i("./defaults"),c=i("./compressedObject"),d=i("./zipObject"),f=i("./generate"),p=i("./nodejsUtils"),m=i("./nodejs/NodejsStreamInputAdapter"),g=function(y){y.slice(-1)==="/"&&(y=y.substring(0,y.length-1));var M=y.lastIndexOf("/");return 0<M?y.substring(0,M):""},b=function(y){return y.slice(-1)!=="/"&&(y+="/"),y},S=function(y,M){return M=M===void 0?u.createFolders:M,y=b(y),this.files[y]||n.call(this,y,null,{dir:!0,createFolders:M}),this.files[y]};function E(y){return Object.prototype.toString.call(y)==="[object RegExp]"}s.exports={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(y){var M,P,L;for(M in this.files)L=this.files[M],(P=M.slice(this.root.length,M.length))&&M.slice(0,this.root.length)===this.root&&y(P,L)},filter:function(y){var M=[];return this.forEach(function(P,L){y(P,L)&&M.push(L)}),M},file:function(y,M,P){if(arguments.length!==1)return y=this.root+y,n.call(this,y,M,P),this;if(E(y)){var L=y;return this.filter(function(A,G){return!G.dir&&L.test(A)})}var B=this.files[this.root+y];return B&&!B.dir?B:null},folder:function(y){if(!y)return this;if(E(y))return this.filter(function(B,A){return A.dir&&y.test(B)});var M=this.root+y,P=S.call(this,M),L=this.clone();return L.root=P.name,L},remove:function(y){y=this.root+y;var M=this.files[y];if(M||(y.slice(-1)!=="/"&&(y+="/"),M=this.files[y]),M&&!M.dir)delete this.files[y];else for(var P=this.filter(function(B,A){return A.name.slice(0,y.length)===y}),L=0;L<P.length;L++)delete this.files[P[L].name];return this},generate:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(y){var M,P={};try{if((P=o.extend(y||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=P.type.toLowerCase(),P.compression=P.compression.toUpperCase(),P.type==="binarystring"&&(P.type="string"),!P.type)throw Error("No output type specified.");o.checkSupport(P.type),P.platform!=="darwin"&&P.platform!=="freebsd"&&P.platform!=="linux"&&P.platform!=="sunos"||(P.platform="UNIX"),P.platform==="win32"&&(P.platform="DOS");var L=P.comment||this.comment||"";M=f.generateWorker(this,P,L)}catch(B){(M=new l("error")).error(B)}return new h(M,P.type||"string",P.mimeType)},generateAsync:function(y,M){return this.generateInternalStream(y).accumulate(M)},generateNodeStream:function(y,M){return(y=y||{}).type||(y.type="nodebuffer"),this.generateInternalStream(y).toNodejsStream(M)}}},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(i,s,r){s.exports=i("stream")},{stream:void 0}],17:[function(i,s,r){var n=i("./DataReader");function a(o){n.call(this,o);for(var l=0;l<this.data.length;l++)o[l]=255&o[l]}i("../utils").inherits(a,n),a.prototype.byteAt=function(o){return this.data[this.zero+o]},a.prototype.lastIndexOfSignature=function(o){for(var l=o.charCodeAt(0),h=o.charCodeAt(1),u=o.charCodeAt(2),c=o.charCodeAt(3),d=this.length-4;0<=d;--d)if(this.data[d]===l&&this.data[d+1]===h&&this.data[d+2]===u&&this.data[d+3]===c)return d-this.zero;return-1},a.prototype.readAndCheckSignature=function(o){var l=o.charCodeAt(0),h=o.charCodeAt(1),u=o.charCodeAt(2),c=o.charCodeAt(3),d=this.readData(4);return l===d[0]&&h===d[1]&&u===d[2]&&c===d[3]},a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},s.exports=a},{"../utils":32,"./DataReader":18}],18:[function(i,s,r){var n=i("../utils");function a(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var l,h=0;for(this.checkOffset(o),l=this.index+o-1;l>=this.index;l--)h=(h<<8)+this.byteAt(l);return this.index+=o,h},readString:function(o){return n.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},s.exports=a},{"../utils":32}],19:[function(i,s,r){var n=i("./Uint8ArrayReader");function a(o){n.call(this,o)}i("../utils").inherits(a,n),a.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},s.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(i,s,r){var n=i("./DataReader");function a(o){n.call(this,o)}i("../utils").inherits(a,n),a.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},a.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},a.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},a.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},s.exports=a},{"../utils":32,"./DataReader":18}],21:[function(i,s,r){var n=i("./ArrayReader");function a(o){n.call(this,o)}i("../utils").inherits(a,n),a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array;var l=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},s.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(i,s,r){var n=i("../utils"),a=i("../support"),o=i("./ArrayReader"),l=i("./StringReader"),h=i("./NodeBufferReader"),u=i("./Uint8ArrayReader");s.exports=function(c){var d=n.getTypeOf(c);return n.checkSupport(d),d!=="string"||a.uint8array?d==="nodebuffer"?new h(c):a.uint8array?new u(n.transformTo("uint8array",c)):new o(n.transformTo("array",c)):new l(c)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(i,s,r){r.LOCAL_FILE_HEADER="PK��",r.CENTRAL_FILE_HEADER="PK��",r.CENTRAL_DIRECTORY_END="PK��",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK�\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK��",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(i,s,r){var n=i("./GenericWorker"),a=i("../utils");function o(l){n.call(this,"ConvertWorker to "+l),this.destType=l}a.inherits(o,n),o.prototype.processChunk=function(l){this.push({data:a.transformTo(this.destType,l.data),meta:l.meta})},s.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(i,s,r){var n=i("./GenericWorker"),a=i("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}i("../utils").inherits(o,n),o.prototype.processChunk=function(l){this.streamInfo.crc32=a(l.data,this.streamInfo.crc32||0),this.push(l)},s.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(i,s,r){var n=i("../utils"),a=i("./GenericWorker");function o(l){a.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}n.inherits(o,a),o.prototype.processChunk=function(l){if(l){var h=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=h+l.data.length}a.prototype.processChunk.call(this,l)},s.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(i,s,r){var n=i("../utils"),a=i("./GenericWorker");function o(l){a.call(this,"DataWorker");var h=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(u){h.dataIsReady=!0,h.data=u,h.max=u&&u.length||0,h.type=n.getTypeOf(u),h.isPaused||h._tickAndRepeat()},function(u){h.error(u)})}n.inherits(o,a),o.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,h=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,h);break;case"uint8array":l=this.data.subarray(this.index,h);break;case"array":case"nodebuffer":l=this.data.slice(this.index,h)}return this.index=h,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(i,s,r){function n(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,o){return this._listeners[a].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,o){if(this._listeners[a])for(var l=0;l<this._listeners[a].length;l++)this._listeners[a][l].call(this,o)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var o=this;return a.on("data",function(l){o.processChunk(l)}),a.on("end",function(){o.end()}),a.on("error",function(l){o.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var a=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,o){return this.extraStreamInfo[a]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},s.exports=n},{}],29:[function(i,s,r){var n=i("../utils"),a=i("./ConvertWorker"),o=i("./GenericWorker"),l=i("../base64"),h=i("../support"),u=i("../external"),c=null;if(h.nodestream)try{c=i("../nodejs/NodejsStreamOutputAdapter")}catch{}function d(p,m){return new u.Promise(function(g,b){var S=[],E=p._internalType,y=p._outputType,M=p._mimeType;p.on("data",function(P,L){S.push(P),m&&m(L)}).on("error",function(P){S=[],b(P)}).on("end",function(){try{g((function(P,L,B){switch(P){case"blob":return n.newBlob(n.transformTo("arraybuffer",L),B);case"base64":return l.encode(L);default:return n.transformTo(P,L)}})(y,(function(P,L){var B,A=0,G=null,H=0;for(B=0;B<L.length;B++)H+=L[B].length;switch(P){case"string":return L.join("");case"array":return Array.prototype.concat.apply([],L);case"uint8array":for(G=new Uint8Array(H),B=0;B<L.length;B++)G.set(L[B],A),A+=L[B].length;return G;case"nodebuffer":return Buffer.concat(L);default:throw Error("concat : unsupported type '"+P+"'")}})(E,S),M))}catch(P){b(P)}S=[]}).resume()})}function f(p,m,g){var b=m;switch(m){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=m,this._mimeType=g,n.checkSupport(b),this._worker=p.pipe(new a(b)),p.lock()}catch(S){this._worker=new o("error"),this._worker.error(S)}}f.prototype={accumulate:function(p){return d(this,p)},on:function(p,m){var g=this;return p==="data"?this._worker.on(p,function(b){m.call(g,b.data,b.meta)}):this._worker.on(p,function(){n.delay(m,arguments,g)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(n.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new c(this,{objectMode:this._outputType!=="nodebuffer"},p)}},s.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(i,s,r){if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",r.nodebuffer=typeof Buffer<"u",r.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")r.blob=!1;else{var n=new ArrayBuffer(0);try{r.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(n),r.blob=a.getBlob("application/zip").size===0}catch{r.blob=!1}}}try{r.nodestream=!!i("readable-stream").Readable}catch{r.nodestream=!1}},{"readable-stream":16}],31:[function(i,s,r){for(var n=i("./utils"),a=i("./support"),o=i("./nodejsUtils"),l=i("./stream/GenericWorker"),h=Array(256),u=0;u<256;u++)h[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;h[254]=h[254]=1;function c(){l.call(this,"utf-8 decode"),this.leftOver=null}function d(){l.call(this,"utf-8 encode")}r.utf8encode=function(f){return a.nodebuffer?o.newBufferFrom(f,"utf-8"):(function(p){var m,g,b,S,E,y=p.length,M=0;for(S=0;S<y;S++)(64512&(g=p.charCodeAt(S)))==55296&&S+1<y&&(64512&(b=p.charCodeAt(S+1)))==56320&&(g=65536+(g-55296<<10)+(b-56320),S++),M+=g<128?1:g<2048?2:g<65536?3:4;for(m=a.uint8array?new Uint8Array(M):Array(M),S=E=0;E<M;S++)(64512&(g=p.charCodeAt(S)))==55296&&S+1<y&&(64512&(b=p.charCodeAt(S+1)))==56320&&(g=65536+(g-55296<<10)+(b-56320),S++),g<128?m[E++]=g:(g<2048?m[E++]=192|g>>>6:(g<65536?m[E++]=224|g>>>12:(m[E++]=240|g>>>18,m[E++]=128|g>>>12&63),m[E++]=128|g>>>6&63),m[E++]=128|63&g);return m})(f)},r.utf8decode=function(f){return a.nodebuffer?n.transformTo("nodebuffer",f).toString("utf-8"):(function(p){var m,g,b,S,E=p.length,y=Array(2*E);for(m=g=0;m<E;)if((b=p[m++])<128)y[g++]=b;else if(4<(S=h[b]))y[g++]=65533,m+=S-1;else{for(b&=S===2?31:S===3?15:7;1<S&&m<E;)b=b<<6|63&p[m++],S--;1<S?y[g++]=65533:b<65536?y[g++]=b:(b-=65536,y[g++]=55296|b>>10&1023,y[g++]=56320|1023&b)}return y.length!==g&&(y.subarray?y=y.subarray(0,g):y.length=g),n.applyFromCharCode(y)})(f=n.transformTo(a.uint8array?"uint8array":"array",f))},n.inherits(c,l),c.prototype.processChunk=function(f){var p=n.transformTo(a.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var m=p;(p=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),p.set(m,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var g=(function(S,E){var y;for((E=E||S.length)>S.length&&(E=S.length),y=E-1;0<=y&&(192&S[y])==128;)y--;return y<0||y===0?E:y+h[S[y]]>E?y:E})(p),b=p;g!==p.length&&(a.uint8array?(b=p.subarray(0,g),this.leftOver=p.subarray(g,p.length)):(b=p.slice(0,g),this.leftOver=p.slice(g,p.length))),this.push({data:r.utf8decode(b),meta:f.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=c,n.inherits(d,l),d.prototype.processChunk=function(f){this.push({data:r.utf8encode(f.data),meta:f.meta})},r.Utf8EncodeWorker=d},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(i,s,r){var n=i("./support"),a=i("./base64"),o=i("./nodejsUtils"),l=i("./external");function h(m){return m}function u(m,g){for(var b=0;b<m.length;++b)g[b]=255&m.charCodeAt(b);return g}i("setimmediate"),r.newBlob=function(m,g){r.checkSupport("blob");try{return new Blob([m],{type:g})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(m),b.getBlob(g)}catch{throw Error("Bug : can't construct the Blob.")}}};var c={stringifyByChunk:function(m,g,b){var S=[],E=0,y=m.length;if(y<=b)return String.fromCharCode.apply(null,m);for(;E<y;)g==="array"||g==="nodebuffer"?S.push(String.fromCharCode.apply(null,m.slice(E,Math.min(E+b,y)))):S.push(String.fromCharCode.apply(null,m.subarray(E,Math.min(E+b,y)))),E+=b;return S.join("")},stringifyByChar:function(m){for(var g="",b=0;b<m.length;b++)g+=String.fromCharCode(m[b]);return g},applyCanBeUsed:{uint8array:(function(){try{return n.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return n.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}})()}};function d(m){var g=65536,b=r.getTypeOf(m),S=!0;if(b==="uint8array"?S=c.applyCanBeUsed.uint8array:b==="nodebuffer"&&(S=c.applyCanBeUsed.nodebuffer),S)for(;1<g;)try{return c.stringifyByChunk(m,b,g)}catch{g=Math.floor(g/2)}return c.stringifyByChar(m)}function f(m,g){for(var b=0;b<m.length;b++)g[b]=m[b];return g}r.applyFromCharCode=d;var p={};p.string={string:h,array:function(m){return u(m,Array(m.length))},arraybuffer:function(m){return p.string.uint8array(m).buffer},uint8array:function(m){return u(m,new Uint8Array(m.length))},nodebuffer:function(m){return u(m,o.allocBuffer(m.length))}},p.array={string:d,array:h,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return o.newBufferFrom(m)}},p.arraybuffer={string:function(m){return d(new Uint8Array(m))},array:function(m){return f(new Uint8Array(m),Array(m.byteLength))},arraybuffer:h,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return o.newBufferFrom(new Uint8Array(m))}},p.uint8array={string:d,array:function(m){return f(m,Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:h,nodebuffer:function(m){return o.newBufferFrom(m)}},p.nodebuffer={string:d,array:function(m){return f(m,Array(m.length))},arraybuffer:function(m){return p.nodebuffer.uint8array(m).buffer},uint8array:function(m){return f(m,new Uint8Array(m.length))},nodebuffer:h},r.transformTo=function(m,g){return g=g||"",m?(r.checkSupport(m),p[r.getTypeOf(g)][m](g)):g},r.resolve=function(m){for(var g=m.split("/"),b=[],S=0;S<g.length;S++){var E=g[S];E==="."||E===""&&S!==0&&S!==g.length-1||(E===".."?b.pop():b.push(E))}return b.join("/")},r.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":n.nodebuffer&&o.isBuffer(m)?"
77nodebuffer":n.uint8array&&m instanceof Uint8Array?"uint8array":n.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(m){if(!n[m.toLowerCase()])throw Error(m+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(m){var g,b,S="";for(b=0;b<(m||"").length;b++)S+="\\x"+((g=m.charCodeAt(b))<16?"0":"")+g.toString(16).toUpperCase();return S},r.delay=function(m,g,b){setImmediate(function(){m.apply(b||null,g||[])})},r.inherits=function(m,g){function b(){}b.prototype=g.prototype,m.prototype=new b},r.extend=function(){var m,g,b={};for(m=0;m<arguments.length;m++)for(g in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],g)&&b[g]===void 0&&(b[g]=arguments[m][g]);return b},r.prepareContent=function(m,g,b,S,E){return l.Promise.resolve(g).then(function(y){return n.blob&&(y instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(y))!==-1)&&typeof FileReader<"u"?new l.Promise(function(M,P){var L=new FileReader;L.onload=function(B){M(B.target.result)},L.onerror=function(B){P(B.target.error)},L.readAsArrayBuffer(y)}):y}).then(function(y){var M=r.getTypeOf(y);return M?(M==="arraybuffer"?y=r.transformTo("uint8array",y):M==="string"&&(E?y=a.decode(y):b&&S!==!0&&(y=(function(P){return u(P,n.uint8array?new Uint8Array(P.length):Array(P.length))})(y))),y):l.Promise.reject(Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(i,s,r){var n=i("./reader/readerFor"),a=i("./utils"),o=i("./signature"),l=i("./zipEntry"),h=i("./support");function u(c){this.files=[],this.loadOptions=c}u.prototype={checkSignature:function(c){if(!this.reader.readAndCheckSignature(c)){this.reader.index-=4;var d=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+a.pretty(d)+", expected "+a.pretty(c)+")")}},isSignature:function(c,d){var f=this.reader.index;this.reader.setIndex(c);var p=this.reader.readString(4)===d;return this.reader.setIndex(f),p},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var c=this.reader.readData(this.zipCommentLength),d=h.uint8array?"uint8array":"array",f=a.transformTo(d,c);this.zipComment=this.loadOptions.decodeFileName(f)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var c,d,f,p=this.zip64EndOfCentralSize-44;0<p;)c=this.reader.readInt(2),d=this.reader.readInt(4),f=this.reader.readData(d),this.zip64ExtensibleData[c]={id:c,length:d,value:f}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var c,d;for(c=0;c<this.files.length;c++)d=this.files[c],this.reader.setIndex(d.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),d.readLocalPart(this.reader),d.handleUTF8(),d.processAttributes()},readCentralDir:function(){var c;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(c=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(c);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var c=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(c<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?Error("Corrupted zip: can't find end of central directory"):Error("Can't find end of central directory : is this a zip f
77ile ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(c);var d=c;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(c=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(c),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var p=d-f;if(0<p)this.isSignature(d,o.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(c){this.reader=n(c)},load:function(c){this.prepareReader(c),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},s.exports=u},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(i,s,r){var n=i("./reader/readerFor"),a=i("./utils"),o=i("./compressedObject"),l=i("./crc32"),h=i("./utf8"),u=i("./compressions"),c=i("./support");function d(f,p){this.options=f,this.loadOptions=p}d.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var p,m;if(f.skip(22),this.fileNameLength=f.readInt(2),m=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((p=(function(g){for(var b in u)if(Object.prototype.hasOwnProperty.call(u,b)&&u[b].magic===g)return u[b];return null})(this.compressionMethod))===null)throw Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,p,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var p=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");f.skip(p),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=n(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&
vendor: 12,711 bytes, line 77
77(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var p,m,g,b=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<b;)p=f.readInt(2),m=f.readInt(2),g=f.readData(m),this.extraFields[p]={id:p,length:m,value:g};f.setIndex(b)},handleUTF8:function(){var f=c.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=h.utf8decode(this.fileName),this.fileCommentStr=h.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var m=a.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var g=this.findExtraFieldUnicodeComment();if(g!==null)this.fileCommentStr=g;else{var b=a.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var p=n(f.value);return p.readInt(1)===1&&l(this.fileName)===p.readInt(4)?h.utf8decode(p.readData(f.length-5)):null}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var p=n(f.value);return p.readInt(1)===1&&l(this.fileComment)===p.readInt(4)?h.utf8decode(p.readData(f.length-5)):null}return null}},s.exports=d},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(i,s,r){function n(p,m,g){this.name=p,this.dir=g.dir,this.date=g.date,this.comment=g.comment,this.unixPermissions=g.unixPermissions,this.dosPermissions=g.dosPermissions,this._data=m,this._dataBinary=g.binary,this.options={compression:g.compression,compressionOptions:g.compressionOptions}}var a=i("./stream/StreamHelper"),o=i("./stream/DataWorker"),l=i("./utf8"),h=i("./compressedObject"),u=i("./stream/GenericWorker");n.prototype={internalStream:function(p){var m=null,g="string";try{if(!p)throw Error("No output type specified.");var b=(g=p.toLowerCase())==="string"||g==="text";g!=="binarystring"&&g!=="text"||(g="string"),m=this._decompressWorker();var S=!this._dataBinary;S&&!b&&(m=m.pipe(new l.Utf8EncodeWorker)),!S&&b&&(m=m.pipe(new l.Utf8DecodeWorker))}catch(E){(m=new u("error")).error(E)}return new a(m,g,"")},async:function(p,m){return this.internalStream(p).accumulate(m)},nodeStream:function(p,m){return this.internalStream(p||"nodebuffer").toNodejsStream(m)},_compressWorker:function(p,m){if(this._data instanceof h&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var g=this._decompressWorker();return this._dataBinary||(g=g.pipe(new l.Utf8EncodeWorker)),h.createWorkerFrom(g,p,m)},_decompressWorker:function(){return this._data instanceof h?this._data.getContentWorker():this._data instanceof u?this._data:new o(this._data)}};for(var c=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],d=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<c.length;f++)n.prototype[c[f]]=d;s.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(i,s,r){(function(n){var a,o,l=n.MutationObserver||n.WebKitMutationObserver;if(l){var h=0,u=new l(p),c=n.document.createTextNode("");u.observe(c,{characterData:!0}),a=function(){c.data=h=++h%2}}else if(n.setImmediate||n.MessageChannel===void 0)a="document"in n&&"onreadystatechange"in n.document.createElement("script")?function(){var m=n.document.createElement("script");m.onreadystatechange=function(){p(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},n.document.documentElement.appendChild(m)}:function(){setTimeout(p,0)};else{var d=new n.MessageChannel;d.port1.onmessage=p,a=function(){d.port2.postMessage(0)}}var f=[];function p(){var m,g;o=!0;for(var b=f.length;b;){for(g=f,f=[],m=-1;++m<b;)g[m]();b=f.length}o=!1}s.exports=function(m){f.push(m)!==1||o||a()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(i,s,r){var n=i("immediate");function a(){}var o={},l=["REJECTED"],h=["FULFILLED"],u=["PENDING"];function c(b){if(typeof b!="function")throw TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,b!==a&&m(this,b)}function d(b,S,E){this.promise=b,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof E=="function"&&(this.onRejected=E,this.callRejected=this.otherCallRejected)}function f(b,S,E){n(function(){var y;try{y=S(E)}catch(M){return o.reject(b,M)}y===b?o.reject(b,TypeError("Cannot resolve promise with itself")):o.resolve(b,y)})}function p(b){var S=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof S=="function")return function(){S.apply(b,arguments)}}function m(b,S){var E=!1;function y(L){E||(E=!0,o.reject(b,L))}function M(L){E||(E=!0,o.resolve(b,L))}var P=g(function(){S(M,y)});P.status==="error"&&y(P.value)}function g(b,S){var E={};try{E.value=b(S),E.status="success"}catch(y){E.status="error",E.value=y}return E}(s.exports=c).prototype.finally=function(b){if(typeof b!="function")return this;var S=this.constructor;return this.then(function(E){return S.resolve(b()).then(function(){return E})},function(E){return S.resolve(b()).then(function(){throw E})})},c.prototype.catch=function(b){return this.then(null,b)},c.prototype.then=function(b,S){if(typeof b!="function"&&this.state===h||typeof S!="function"&&this.state===l)return this;var E=new this.constructor(a);return this.state===u?this.queue.push(new d(E,b,S)):f(E,this.state===h?b:S,this.outcome),E},d.prototype.callFulfilled=function(b){o.resolve(this.promise,b)},d.prototype.otherCallFulfilled=function(b){f(this.promise,this.onFulfilled,b)},d.prototype.callRejected=function(b){o.reject(this.promise,b)},d.prototype.otherCallRejected=function(b){f(this.promise,this.onRejected,b)},o.resolve=function(b,S){var E=g(p,S);if(E.status==="error")return o.reject(b,E.value);var y=E.value;if(y)m(b,y);else{b.state=h,b.outcome=S;for(var M=-1,P=b.queue.length;++M<P;)b.queue[M].callFulfilled(S)}return b},o.reject=function(b,S){b.state=l,b.outcome=S;for(var E=-1,y=b.queue.length;++E<y;)b.queue[E].callRejected(S);return b},c.resolve=function(b){return b instanceof this?b:o.resolve(new this(a),b)},c.reject=function(b){var S=new this(a);return o.reject(S,b)},c.all=function(b){var S=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(TypeError("must be an array"));var E=b.length,y=!1;if(!E)return this.resolve([]);for(var M=Array(E),P=0,L=-1,B=new this(a);++L<E;)A(b[L],L);return B;function A(G,H){S.resolve(G).then(function(T){M[H]=T,++P!==E||y||(y=!0,o.resolve(B,M))},function(T){y||(y=!0,o.reject(B,T))})}},c.race=function(b){var S=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(TypeError("must be an array"));var E=b.length,y=!1;if(!E)return this.resolve([]);for(var M=-1,P=new this(a);++M<E;)L=b[M],S.resolve(L).then(function(B){y||(y=!0,o.resolve(P,B))},function(B){y||(y=!0,o.reject(P,B))});var L;return P}},{immediate:36}],38:[function(i,s,r){var n={};(0,i("./lib/utils/common").assign)(n,i("./lib/deflate"),i("./lib/inflate"),i("./lib/zlib/constants")),s.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(i,s,r){var n=i("./zlib/deflate"),a=i("./utils/common"),o=i("./utils/strings"),l=i("./zlib/messages"),h=i("./zlib/zstream"),u=Object.prototype.toString,c=0,d=-1,f=0,p=8;function m(b){if(!(this instanceof m))return new m(b);this.options=a.assign({level:d,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},b||{});var S=this.options;S.raw&&0<S.windowBits?S.windowBits=-S.windowBits:S.gzip&&0<S.windowBits&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var E=n.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(E!==c)throw Error(l[E]);if(S.header&&n.deflateSetHeader(this.strm,S.header),S.dictionary){var y;if(y=typeof S.dictionary=="string"?o.string2buf(S.dictionary):u.call(S.dictionary)==="[object ArrayBuffer]"?new Uint8Array(S.dictionary):S.dictionary,(E=n.deflateSetDictionary(this.strm,y))!==c)throw Error(l[E]);this._dict_set=!0}}function g(b,S){var E=new m(S);if(E.push(b,!0),E.err)throw E.msg||l[E.err];return E.result}m.prototype.push=function(b,S){var E,y,M=this.strm,P=this.options.chunkSize;if(this.ended)return!1;y=S===~~S?S:S===!0?4:0,typeof b=="string"?M.input=o.string2buf(b):u.call(b)==="[object ArrayBuffer]"?M.input=new Uint8Array(b):M.input=b,M.next_in=0,M.avail_in=M.input.length;do{if(M.avail_out===0&&(M.output=new a.Buf8(P),M.next_out=0,M.avail_out=P),(E=n.deflate(M,y))!==1&&E!==c)return this.onEnd(E),!(this.ended=!0);M.avail_out!==0&&(M.avail_in!==0||y!==4&&y!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(a.shrinkBuf(M.output,M.next_out))):this.onData(a.shrinkBuf(M.output,M.next_out)))}while((0<M.avail_in||M.avail_out===0)&&E!==1);return y===4?(E=n.deflateEnd(this.strm),this.onEnd(E),this.ended=!0,E===c):y!==2||(this.onEnd(c),!(M.avail_out=0))},m.prototype.onData=function(b){this.chunks.push(b)},m.prototype.onEnd=function(b){b===c&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},r.Deflate=m,r.deflate=g,r.deflateRaw=function(b,S){return(S=S||{}).raw=!0,g(b,S)},r.gzip=function(b,S){return(S=S||{}).gzip=!0,g(b,S)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(i,s,r){var n=i("./zlib/inflate"),a=i("./utils/common"),o=i("./utils/strings"),l=i("./zlib/constants"),h=i("./zlib/messages"),u=i("./zlib/zstream"),c=i("./zlib/gzheader"),d=Object.prototype.toString;function f(m){if(!(this instanceof f))return new f(m);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},m||{});var g=this.options;g.raw&&0<=g.windowBits&&g.windowBits<16&&(g.windowBits=-g.windowBits,g.windowBits===0&&(g.windowBits=-15)),!(0<=g.windowBits&&g.windowBits<16)||m&&m.windowBits||(g.windowBits+=32),15<g.windowBits&&g.windowBits<48&&!(15&g.windowBits)&&(g.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var b=n.inflateInit2(this.strm,g.windowBits);if(b!==l.Z_OK)throw Error(h[b]);this.header=new c,n.inflateGetHeader(this.strm,this.header)}function p(m,g){var b=new f(g);if(b.push(m,!0),b.err)throw b.msg||h[b.err];return b.result}f.prototype.push=function(m,g){var b,S,E,y,M,P,L=this.strm,B=this.options.chunkSize,A=this.options.dictionary,G=!1;if(this.ended)return!1;S=g===~~g?g:g===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof m=="string"?L.input=o.binstring2buf(m):d.call(m)==="[object ArrayBuffer]"?L.input=new Uint8Array(m):L.input=m,L.next_in=0,L.avail_in=L.input.length;do{if(L.avail_out===0&&(L.output=new a.Buf8(B),L.next_out=0,L.avail_out=B),(b=n.inflate(L,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&A&&(P=typeof A=="string"?o.string2buf(A):d.call(A)==="[object ArrayBuffer]"?new Uint8Array(A):A,b=n.inflateSetDictionary(this.strm,P)),b===l.Z_BUF_ERROR&&G===!0&&(b=l.Z_OK,G=!1),b!==l.Z_STREAM_END&&b!==l.Z_OK)return this.onEnd(b),!(this.ended=!0);L.next_out&&(L.avail_out!==0&&b!==l.Z_STREAM_END&&(L.avail_in!==0||S!==l.Z_FINISH&&S!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(E=o.utf8border(L.output,L.next_out),y=L.next_out-E,M=o.buf2string(L.output,E),L.next_out=y,L.avail_out=B-y,y&&a.arraySet(L.output,L.output,E,y,0),this.onData(M)):this.onData(a.shrinkBuf(L.output,L.next_out)))),L.avail_in===0&&L.avail_out===0&&(G=!0)}while((0<L.avail_in||L.avail_out===0)&&b!==l.Z_STREAM_END);return b===l.Z_STREAM_END&&(S=l.Z_FINISH),S===l.Z_FINISH?(b=n.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===l.Z_OK):S!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(L.avail_out=0))},f.prototype.onData=function(m){this.chunks.push(m)},f.prototype.onEnd=function(m){m===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},r.Inflate=f,r.inflate=p,r.inflateRaw=function(m,g){return(g=g||{}).raw=!0,p(m,g)},r.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(i,s,r){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";r.assign=function(l){for(var h=Array.prototype.slice.call(arguments,1);h.length;){var u=h.shift();if(u){if(typeof u!="object")throw TypeError(u+"must be non-object");for(var c in u)u.hasOwnProperty(c)&&(l[c]=u[c])}}return l}
vendor: 9,687 bytes, line 77
77,r.shrinkBuf=function(l,h){return l.length===h?l:l.subarray?l.subarray(0,h):(l.length=h,l)};var a={arraySet:function(l,h,u,c,d){if(h.subarray&&l.subarray)l.set(h.subarray(u,u+c),d);else for(var f=0;f<c;f++)l[d+f]=h[u+f]},flattenChunks:function(l){var h,u,c,d,f,p;for(h=c=0,u=l.length;h<u;h++)c+=l[h].length;for(p=new Uint8Array(c),h=d=0,u=l.length;h<u;h++)f=l[h],p.set(f,d),d+=f.length;return p}},o={arraySet:function(l,h,u,c,d){for(var f=0;f<c;f++)l[d+f]=h[u+f]},flattenChunks:function(l){return[].concat.apply([],l)}};r.setTyped=function(l){l?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,a)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,o))},r.setTyped(n)},{}],42:[function(i,s,r){var n=i("./common"),a=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var l=new n.Buf8(256),h=0;h<256;h++)l[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;function u(c,d){if(d<65537&&(c.subarray&&o||!c.subarray&&a))return String.fromCharCode.apply(null,n.shrinkBuf(c,d));for(var f="",p=0;p<d;p++)f+=String.fromCharCode(c[p]);return f}l[254]=l[254]=1,r.string2buf=function(c){var d,f,p,m,g,b=c.length,S=0;for(m=0;m<b;m++)(64512&(f=c.charCodeAt(m)))==55296&&m+1<b&&(64512&(p=c.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(p-56320),m++),S+=f<128?1:f<2048?2:f<65536?3:4;for(d=new n.Buf8(S),m=g=0;g<S;m++)(64512&(f=c.charCodeAt(m)))==55296&&m+1<b&&(64512&(p=c.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(p-56320),m++),f<128?d[g++]=f:(f<2048?d[g++]=192|f>>>6:(f<65536?d[g++]=224|f>>>12:(d[g++]=240|f>>>18,d[g++]=128|f>>>12&63),d[g++]=128|f>>>6&63),d[g++]=128|63&f);return d},r.buf2binstring=function(c){return u(c,c.length)},r.binstring2buf=function(c){for(var d=new n.Buf8(c.length),f=0,p=d.length;f<p;f++)d[f]=c.charCodeAt(f);return d},r.buf2string=function(c,d){var f,p,m,g,b=d||c.length,S=Array(2*b);for(f=p=0;f<b;)if((m=c[f++])<128)S[p++]=m;else if(4<(g=l[m]))S[p++]=65533,f+=g-1;else{for(m&=g===2?31:g===3?15:7;1<g&&f<b;)m=m<<6|63&c[f++],g--;1<g?S[p++]=65533:m<65536?S[p++]=m:(m-=65536,S[p++]=55296|m>>10&1023,S[p++]=56320|1023&m)}return u(S,p)},r.utf8border=function(c,d){var f;for((d=d||c.length)>c.length&&(d=c.length),f=d-1;0<=f&&(192&c[f])==128;)f--;return f<0||f===0?d:f+l[c[f]]>d?f:d}},{"./common":41}],43:[function(i,s,r){s.exports=function(n,a,o,l){for(var h=65535&n|0,u=n>>>16&65535|0,c=0;o!==0;){for(o-=c=2e3<o?2e3:o;u=u+(h=h+a[l++]|0)|0,--c;);h%=65521,u%=65521}return h|u<<16|0}},{}],44:[function(i,s,r){s.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(i,s,r){var n=(function(){for(var a,o=[],l=0;l<256;l++){a=l;for(var h=0;h<8;h++)a=1&a?3988292384^a>>>1:a>>>1;o[l]=a}return o})();s.exports=function(a,o,l,h){var u=n,c=h+l;a^=-1;for(var d=h;d<c;d++)a=a>>>8^u[255&(a^o[d])];return-1^a}},{}],46:[function(i,s,r){var n,a=i("../utils/common"),o=i("./trees"),l=i("./adler32"),h=i("./crc32"),u=i("./messages"),c=0,d=4,f=0,p=-2,m=-1,g=4,b=2,S=8,E=9,y=286,M=30,P=19,L=2*y+1,B=15,A=3,G=258,H=G+A+1,T=42,I=113,v=1,U=2,dt=3,Y=4;function at(x,$){return x.msg=u[$],$}function X(x){return(x<<1)-(4<x?9:0)}function Z(x){for(var $=x.length;0<=--$;)x[$]=0}function O(x){var $=x.state,K=$.pending;K>x.avail_out&&(K=x.avail_out),K!==0&&(a.arraySet(x.output,$.pending_buf,$.pending_out,K,x.next_out),x.next_out+=K,$.pending_out+=K,x.total_out+=K,x.avail_out-=K,$.pending-=K,$.pending===0&&($.pending_out=0))}function V(x,$){o._tr_flush_block(x,0<=x.block_start?x.block_start:-1,x.strstart-x.block_start,$),x.block_start=x.strstart,O(x.strm)}function ht(x,$){x.pending_buf[x.pending++]=$}function nt(x,$){x.pending_buf[x.pending++]=$>>>8&255,x.pending_buf[x.pending++]=255&$}function it(x,$){var K,R,_=x.max_chain_length,F=x.strstart,Q=x.prev_length,et=x.nice_match,z=x.strstart>x.w_size-H?x.strstart-(x.w_size-H):0,st=x.window,pt=x.w_mask,rt=x.prev,xt=x.strstart+G,qt=st[F+Q-1],kt=st[F+Q];x.prev_length>=x.good_match&&(_>>=2),et>x.lookahead&&(et=x.lookahead);do if(st[(K=$)+Q]===kt&&st[K+Q-1]===qt&&st[K]===st[F]&&st[++K]===st[F+1]){F+=2,K++;do;while(st[++F]===st[++K]&&st[++F]===st[++K]&&st[++F]===st[++K]&&st[++F]===st[++K]&&st[++F]===st[++K]&&st[++F]===st[++K]&&st[++F]===st[++K]&&st[++F]===st[++K]&&F<xt);if(R=G-(xt-F),F=xt-G,Q<R){if(x.match_start=$,et<=(Q=R))break;qt=st[F+Q-1],kt=st[F+Q]}}while(($=rt[$&pt])>z&&--_!=0);return Q<=x.lookahead?Q:x.lookahead}function Ut(x){var $,K,R,_,F,Q,et,z,st,pt,rt=x.w_size;do{if(_=x.window_size-x.lookahead-x.strstart,x.strstart>=rt+(rt-H)){for(a.arraySet(x.window,x.window,rt,rt,0),x.match_start-=rt,x.strstart-=rt,x.block_start-=rt,$=K=x.hash_size;R=x.head[--$],x.head[$]=rt<=R?R-rt:0,--K;);for($=K=rt;R=x.prev[--$],x.prev[$]=rt<=R?R-rt:0,--K;);_+=rt}if(x.strm.avail_in===0)break;if(Q=x.strm,et=x.window,z=x.strstart+x.lookahead,st=_,pt=void 0,pt=Q.avail_in,st<pt&&(pt=st),K=pt===0?0:(Q.avail_in-=pt,a.arraySet(et,Q.input,Q.next_in,pt,z),Q.state.wrap===1?Q.adler=l(Q.adler,et,pt,z):Q.state.wrap===2&&(Q.adler=h(Q.adler,et,pt,z)),Q.next_in+=pt,Q.total_in+=pt,pt),x.lookahead+=K,x.lookahead+x.insert>=A)for(F=x.strstart-x.insert,x.ins_h=x.window[F],x.ins_h=(x.ins_h<<x.hash_shift^x.window[F+1])&x.hash_mask;x.insert&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[F+A-1])&x.hash_mask,x.prev[F&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=F,F++,x.insert--,!(x.lookahead+x.insert<A)););}while(x.lookahead<H&&x.strm.avail_in!==0)}function jt(x,$){for(var K,R;;){if(x.lookahead<H){if(Ut(x),x.lookahead<H&&$===c)return v;if(x.lookahead===0)break}if(K=0,x.lookahead>=A&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+A-1])&x.hash_mask,K=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart),K!==0&&x.strstart-K<=x.w_size-H&&(x.match_length=it(x,K)),x.match_length>=A)if(R=o._tr_tally(x,x.strstart-x.match_start,x.match_length-A),x.lookahead-=x.match_length,x.match_length<=x.max_lazy_match&&x.lookahead>=A){for(x.match_length--;x.strstart++,x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+A-1])&x.hash_mask,K=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart,--x.match_length!=0;);x.strstart++}else x.strstart+=x.match_length,x.match_length=0,x.ins_h=x.window[x.strstart],x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+1])&x.hash_mask;else R=o._tr_tally(x,0,x.window[x.strstart]),x.lookahead--,x.strstart++;if(R&&(V(x,!1),x.strm.avail_out===0))return v}return x.insert=x.strstart<A-1?x.strstart:A-1,$===d?(V(x,!0),x.strm.avail_out===0?dt:Y):x.last_lit&&(V(x,!1),x.strm.avail_out===0)?v:U}function Mt(x,$){for(var K,R,_;;){if(x.lookahead<H){if(Ut(x),x.lookahead<H&&$===c)return v;if(x.lookahead===0)break}if(K=0,x.lookahead>=A&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+A-1])&x.hash_mask,K=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart),x.prev_length=x.match_length,x.prev_match=x.match_start,x.match_length=A-1,K!==0&&x.prev_length<x.max_lazy_match&&x.strstart-K<=x.w_size-H&&(x.match_length=it(x,K),x.match_length<=5&&(x.strategy===1||x.match_length===A&&4096<x.strstart-x.match_start)&&(x.match_length=A-1)),x.prev_length>=A&&x.match_length<=x.prev_length){for(_=x.strstart+x.lookahead-A,R=o._tr_tally(x,x.strstart-1-x.prev_match,x.prev_length-A),x.lookahead-=x.prev_length-1,x.prev_length-=2;++x.strstart<=_&&(x.ins_h=(x.ins_h<<x.hash_shift^x.window[x.strstart+A-1])&x.hash_mask,K=x.prev[x.strstart&x.w_mask]=x.head[x.ins_h],x.head[x.ins_h]=x.strstart),--x.prev_length!=0;);if(x.match_available=0,x.match_length=A-1,x.strstart++,R&&(V(x,!1),x.strm.avail_out===0))return v}else if(x.match_available){if((R=o._tr_tally(x,0,x.window[x.strstart-1]))&&V(x,!1),x.strstart++,x.lookahead--,x.strm.avail_out===0)return v}else x.match_available=1,x.strstart++,x.lookahead--}return x.match_available&&(R=o._tr_tally(x,0,x.window[x.strstart-1]),x.match_available=0),x.insert=x.strstart<A-1?x.strstart:A-1,$===d?(V(x,!0),x.strm.avail_out===0?dt:Y):x.last_lit&&(V(x,!1),x.strm.avail_out===0)?v:U}function zt(x,$,K,R,_){this.good_length=x,this.max_lazy=$,this.nice_length=K,this.max_chain=R,this.func=_}function Ee(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=S,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(2*L),this.dyn_dtree=new a.Buf16(2*(2*M+1)),this.bl_tree=new a.Buf16(2*(2*P+1)),Z(this.dyn_ltree),Z(this.dyn_dtree),Z(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(B+1),this.heap=new a.Buf16(2*y+1),Z(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*y+1),Z(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ce(x){var $;return x&&x.state?(x.total_in=x.total_out=0,x.data_type=b,($=x.state).pending=0,$.pending_out=0,$.wrap<0&&($.wrap=-$.wrap),$.status=$.
vendor: 3,142 bytes, line 77
77wrap?T:I,x.adler=$.wrap===2?0:1,$.last_flush=c,o._tr_init($),f):at(x,p)}function ti(x){var $=ce(x);return $===f&&(function(K){K.window_size=2*K.w_size,Z(K.head),K.max_lazy_match=n[K.level].max_lazy,K.good_match=n[K.level].good_length,K.nice_match=n[K.level].nice_length,K.max_chain_length=n[K.level].max_chain,K.strstart=0,K.block_start=0,K.lookahead=0,K.insert=0,K.match_length=K.prev_length=A-1,K.match_available=0,K.ins_h=0})(x.state),$}function Je(x,$,K,R,_,F){if(!x)return p;var Q=1;if($===m&&($=6),R<0?(Q=0,R=-R):15<R&&(Q=2,R-=16),_<1||E<_||K!==S||R<8||15<R||$<0||9<$||F<0||g<F)return at(x,p);R===8&&(R=9);var et=new Ee;return(x.state=et).strm=x,et.wrap=Q,et.gzhead=null,et.w_bits=R,et.w_size=1<<et.w_bits,et.w_mask=et.w_size-1,et.hash_bits=_+7,et.hash_size=1<<et.hash_bits,et.hash_mask=et.hash_size-1,et.hash_shift=~~((et.hash_bits+A-1)/A),et.window=new a.Buf8(2*et.w_size),et.head=new a.Buf16(et.hash_size),et.prev=new a.Buf16(et.w_size),et.lit_bufsize=1<<_+6,et.pending_buf_size=4*et.lit_bufsize,et.pending_buf=new a.Buf8(et.pending_buf_size),et.d_buf=1*et.lit_bufsize,et.l_buf=3*et.lit_bufsize,et.level=$,et.strategy=F,et.method=K,ti(x)}n=[new zt(0,0,0,0,function(x,$){var K=65535;for(K>x.pending_buf_size-5&&(K=x.pending_buf_size-5);;){if(x.lookahead<=1){if(Ut(x),x.lookahead===0&&$===c)return v;if(x.lookahead===0)break}x.strstart+=x.lookahead,x.lookahead=0;var R=x.block_start+K;if((x.strstart===0||x.strstart>=R)&&(x.lookahead=x.strstart-R,x.strstart=R,V(x,!1),x.strm.avail_out===0)||x.strstart-x.block_start>=x.w_size-H&&(V(x,!1),x.strm.avail_out===0))return v}return x.insert=0,$===d?(V(x,!0),x.strm.avail_out===0?dt:Y):(x.strstart>x.block_start&&(V(x,!1),x.strm.avail_out),v)}),new zt(4,4,8,4,jt),new zt(4,5,16,8,jt),new zt(4,6,32,32,jt),new zt(4,4,16,16,Mt),new zt(8,16,32,32,Mt),new zt(8,16,128,128,Mt),new zt(8,32,128,256,Mt),new zt(32,128,258,1024,Mt),new zt(32,258,258,4096,Mt)],r.deflateInit=function(x,$){return Je(x,$,S,15,8,0)},r.deflateInit2=Je,r.deflateReset=ti,r.deflateResetKeep=ce,r.deflateSetHeader=function(x,$){return x&&x.state&&x.state.wrap===2?(x.state.gzhead=$,f):p},r.deflate=function(x,$){var K,R,_,F;if(!x||!x.state||5<$||$<0)return x?at(x,p):p;if(R=x.state,!x.output||!x.input&&x.avail_in!==0||R.status===666&&$!==d)return at(x,x.avail_out===0?-5:p);if(R.strm=x,K=R.last_flush,R.last_flush=$,R.status===T)if(R.wrap===2)x.adler=0,ht(R,31),ht(R,139),ht(R,8),R.gzhead?(ht(R,+!!R.gzhead.text+(R.gzhead.hcrc?2:0)+(R.gzhead.extra?4:0)+(R.gzhead.name?8:0)+(R.gzhead.comment?16:0)),ht(R,255&R.gzhead.time),ht(R,R.gzhead.time>>8&255),ht(R,R.gzhead.time>>16&255),ht(R,R.gzhead.time>>24&255),ht(R,R.level===9?2:2<=R.strategy||R.level<2?4:0),ht(R,255&R.gzhead.os),R.gzhead.extra&&R.gzhead.extra.length&&(ht(R,255&R.gzhead.extra.length),ht(R,R.gzhead.extra.length>>8&255)),R.gzhead.hcrc&&(x.adler=h(x.adler,R.pending_buf,R.pending,0)),R.gzindex=0,R.status=69):(ht(R,0),ht(R,0),ht(R,0),ht(R,0),ht(R,0),ht(R,R.level===9?2:2<=R.strategy||R.level<2?4:0),ht(R,3),R.status=I);else{var Q=S+(R.w_bits-8<<4)<<8;Q|=(2<=R.strategy||R.level<2?0:R.level<6?1:R.level===6?2:3)<<6,R.strstart!==0&&(Q|=32),Q+=31-Q%31,R.status=I,nt
vendor: 3,090 bytes, line 77
77(R,Q),R.strstart!==0&&(nt(R,x.adler>>>16),nt(R,65535&x.adler)),x.adler=1}if(R.status===69)if(R.gzhead.extra){for(_=R.pending;R.gzindex<(65535&R.gzhead.extra.length)&&(R.pending!==R.pending_buf_size||(R.gzhead.hcrc&&R.pending>_&&(x.adler=h(x.adler,R.pending_buf,R.pending-_,_)),O(x),_=R.pending,R.pending!==R.pending_buf_size));)ht(R,255&R.gzhead.extra[R.gzindex]),R.gzindex++;R.gzhead.hcrc&&R.pending>_&&(x.adler=h(x.adler,R.pending_buf,R.pending-_,_)),R.gzindex===R.gzhead.extra.length&&(R.gzindex=0,R.status=73)}else R.status=73;if(R.status===73)if(R.gzhead.name){_=R.pending;do{if(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>_&&(x.adler=h(x.adler,R.pending_buf,R.pending-_,_)),O(x),_=R.pending,R.pending===R.pending_buf_size)){F=1;break}F=R.gzindex<R.gzhead.name.length?255&R.gzhead.name.charCodeAt(R.gzindex++):0,ht(R,F)}while(F!==0);R.gzhead.hcrc&&R.pending>_&&(x.adler=h(x.adler,R.pending_buf,R.pending-_,_)),F===0&&(R.gzindex=0,R.status=91)}else R.status=91;if(R.status===91)if(R.gzhead.comment){_=R.pending;do{if(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>_&&(x.adler=h(x.adler,R.pending_buf,R.pending-_,_)),O(x),_=R.pending,R.pending===R.pending_buf_size)){F=1;break}F=R.gzindex<R.gzhead.comment.length?255&R.gzhead.comment.charCodeAt(R.gzindex++):0,ht(R,F)}while(F!==0);R.gzhead.hcrc&&R.pending>_&&(x.adler=h(x.adler,R.pending_buf,R.pending-_,_)),F===0&&(R.status=103)}else R.status=103;if(R.status===103&&(R.gzhead.hcrc?(R.pending+2>R.pending_buf_size&&O(x),R.pending+2<=R.pending_buf_size&&(ht(R,255&x.adler),ht(R,x.adler>>8&255),x.adler=0,R.status=I)):R.status=I),R.pending!==0){if(O(x),x.avail_out===0)return R.last_flush=-1,f}else if(x.avail_in===0&&X($)<=X(K)&&$!==d)return at(x,-5);if(R.status===666&&x.avail_in!==0)return at(x,-5);if(x.avail_in!==0||R.lookahead!==0||$!==c&&R.status!==666){var et=R.strategy===2?(function(z,st){for(var pt;;){if(z.lookahead===0&&(Ut(z),z.lookahead===0)){if(st===c)return v;break}if(z.match_length=0,pt=o._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++,pt&&(V(z,!1),z.strm.avail_out===0))return v}return z.insert=0,st===d?(V(z,!0),z.strm.avail_out===0?dt:Y):z.last_lit&&(V(z,!1),z.strm.avail_out===0)?v:U})(R,$):R.strategy===3?(function(z,st){for(var pt,rt,xt,qt,kt=z.window;;){if(z.lookahead<=G){if(Ut(z),z.lookahead<=G&&st===c)return v;if(z.lookahead===0)break}if(z.match_length=0,z.lookahead>=A&&0<z.strstart&&(rt=kt[xt=z.strstart-1])===kt[++xt]&&rt===kt[++xt]&&rt===kt[++xt]){qt=z.strstart+G;do;while(rt===kt[++xt]&&rt===kt[++xt]&&rt===kt[++xt]&&rt===kt[++xt]&&rt===kt[++xt]&&rt===kt[++xt]&&rt===kt[++xt]&&rt===kt[++xt]&&xt<qt);z.match_length=G-(qt-xt),z.match_length>z.lookahead&&(z.match_length=z.lookahead)}if(z.match_length>=A?(pt=o._tr_tally(z,1,z.match_length-A),z.lookahead-=z.match_length,z.strstart+=z.match_length,z.match_length=0):(pt=o._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++),pt&&(V(z,!1),z.strm.avail_out===0))return v}return z.insert=0,st===d?(V(z,!0),z.strm.avail_out===0?dt:Y):z.last_lit&&(V(z,!1),z.strm.avail_out===0)?v:U})(R,$):n[R.level].func(R,$);
vendor: 21,600 bytes, line 77
77if(et!==dt&&et!==Y||(R.status=666),et===v||et===dt)return x.avail_out===0&&(R.last_flush=-1),f;if(et===U&&($===1?o._tr_align(R):$!==5&&(o._tr_stored_block(R,0,0,!1),$===3&&(Z(R.head),R.lookahead===0&&(R.strstart=0,R.block_start=0,R.insert=0))),O(x),x.avail_out===0))return R.last_flush=-1,f}return $===d?R.wrap<=0?1:(R.wrap===2?(ht(R,255&x.adler),ht(R,x.adler>>8&255),ht(R,x.adler>>16&255),ht(R,x.adler>>24&255),ht(R,255&x.total_in),ht(R,x.total_in>>8&255),ht(R,x.total_in>>16&255),ht(R,x.total_in>>24&255)):(nt(R,x.adler>>>16),nt(R,65535&x.adler)),O(x),0<R.wrap&&(R.wrap=-R.wrap),R.pending===0?1:f):f},r.deflateEnd=function(x){var $;return x&&x.state?($=x.state.status)!==T&&$!==69&&$!==73&&$!==91&&$!==103&&$!==I&&$!==666?at(x,p):(x.state=null,$===I?at(x,-3):f):p},r.deflateSetDictionary=function(x,$){var K,R,_,F,Q,et,z,st,pt=$.length;if(!x||!x.state||(F=(K=x.state).wrap)===2||F===1&&K.status!==T||K.lookahead)return p;for(F===1&&(x.adler=l(x.adler,$,pt,0)),K.wrap=0,pt>=K.w_size&&(F===0&&(Z(K.head),K.strstart=0,K.block_start=0,K.insert=0),st=new a.Buf8(K.w_size),a.arraySet(st,$,pt-K.w_size,K.w_size,0),$=st,pt=K.w_size),Q=x.avail_in,et=x.next_in,z=x.input,x.avail_in=pt,x.next_in=0,x.input=$,Ut(K);K.lookahead>=A;){for(R=K.strstart,_=K.lookahead-(A-1);K.ins_h=(K.ins_h<<K.hash_shift^K.window[R+A-1])&K.hash_mask,K.prev[R&K.w_mask]=K.head[K.ins_h],K.head[K.ins_h]=R,R++,--_;);K.strstart=R,K.lookahead=A-1,Ut(K)}return K.strstart+=K.lookahead,K.block_start=K.strstart,K.insert=K.lookahead,K.lookahead=0,K.match_length=K.prev_length=A-1,K.match_available=0,x.next_in=et,x.input=z,x.avail_in=Q,K.wrap=F,f},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(i,s,r){s.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(i,s,r){s.exports=function(n,a){var o=n.state,l=n.next_in,h,u,c,d,f,p,m,g,b,S,E,y,M,P,L,B,A,G,H,T,I,v=n.input,U;h=l+(n.avail_in-5),u=n.next_out,U=n.output,c=u-(a-n.avail_out),d=u+(n.avail_out-257),f=o.dmax,p=o.wsize,m=o.whave,g=o.wnext,b=o.window,S=o.hold,E=o.bits,y=o.lencode,M=o.distcode,P=(1<<o.lenbits)-1,L=(1<<o.distbits)-1;t:do{E<15&&(S+=v[l++]<<E,E+=8,S+=v[l++]<<E,E+=8),B=y[S&P];e:for(;;){if(S>>>=A=B>>>24,E-=A,(A=B>>>16&255)==0)U[u++]=65535&B;else{if(!(16&A)){if(!(64&A)){B=y[(65535&B)+(S&(1<<A)-1)];continue e}if(32&A){o.mode=12;break t}n.msg="invalid literal/length code",o.mode=30;break t}G=65535&B,(A&=15)&&(E<A&&(S+=v[l++]<<E,E+=8),G+=S&(1<<A)-1,S>>>=A,E-=A),E<15&&(S+=v[l++]<<E,E+=8,S+=v[l++]<<E,E+=8),B=M[S&L];i:for(;;){if(S>>>=A=B>>>24,E-=A,!(16&(A=B>>>16&255))){if(!(64&A)){B=M[(65535&B)+(S&(1<<A)-1)];continue i}n.msg="invalid distance code",o.mode=30;break t}if(H=65535&B,E<(A&=15)&&(S+=v[l++]<<E,(E+=8)<A&&(S+=v[l++]<<E,E+=8)),f<(H+=S&(1<<A)-1)){n.msg="invalid distance too far back",o.mode=30;break t}if(S>>>=A,E-=A,(A=u-c)<H){if(m<(A=H-A)&&o.sane){n.msg="invalid distance too far back",o.mode=30;break t}if(I=b,(T=0)===g){if(T+=p-A,A<G){for(G-=A;U[u++]=b[T++],--A;);T=u-H,I=U}}else if(g<A){if(T+=p+g-A,(A-=g)<G){for(G-=A;U[u++]=b[T++],--A;);if(T=0,g<G){for(G-=A=g;U[u++]=b[T++],--A;);T=u-H,I=U}}}else if(T+=g-A,A<G){for(G-=A;U[u++]=b[T++],--A;);T=u-H,I=U}for(;2<G;)U[u++]=I[T++],U[u++]=I[T++],U[u++]=I[T++],G-=3;G&&(U[u++]=I[T++],1<G&&(U[u++]=I[T++]))}else{for(T=u-H;U[u++]=U[T++],U[u++]=U[T++],U[u++]=U[T++],2<(G-=3););G&&(U[u++]=U[T++],1<G&&(U[u++]=U[T++]))}break}}break}}while(l<h&&u<d);l-=G=E>>3,S&=(1<<(E-=G<<3))-1,n.next_in=l,n.next_out=u,n.avail_in=l<h?h-l+5:5-(l-h),n.avail_out=u<d?d-u+257:257-(u-d),o.hold=S,o.bits=E}},{}],49:[function(i,s,r){var n=i("../utils/common"),a=i("./adler32"),o=i("./crc32"),l=i("./inffast"),h=i("./inftrees"),u=1,c=2,d=0,f=-2,p=1,m=852,g=592;function b(T){return(T>>>24&255)+(T>>>8&65280)+((65280&T)<<8)+((255&T)<<24)}function S(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function E(T){var I;return T&&T.state?(I=T.state,T.total_in=T.total_out=I.total=0,T.msg="",I.wrap&&(T.adler=1&I.wrap),I.mode=p,I.last=0,I.havedict=0,I.dmax=32768,I.head=null,I.hold=0,I.bits=0,I.lencode=I.lendyn=new n.Buf32(m),I.distcode=I.distdyn=new n.Buf32(g),I.sane=1,I.back=-1,d):f}function y(T){var I;return T&&T.state?((I=T.state).wsize=0,I.whave=0,I.wnext=0,E(T)):f}function M(T,I){var v,U;return T&&T.state?(U=T.state,I<0?(v=0,I=-I):(v=1+(I>>4),I<48&&(I&=15)),I&&(I<8||15<I)?f:(U.window!==null&&U.wbits!==I&&(U.window=null),U.wrap=v,U.wbits=I,y(T))):f}function P(T,I){var v,U;return T?(U=new S,(T.state=U).window=null,(v=M(T,I))!==d&&(T.state=null),v):f}var L,B,A=!0;function G(T){if(A){var I;for(L=new n.Buf32(512),B=new n.Buf32(32),I=0;I<144;)T.lens[I++]=8;for(;I<256;)T.lens[I++]=9;for(;I<280;)T.lens[I++]=7;for(;I<288;)T.lens[I++]=8;for(h(u,T.lens,0,288,L,0,T.work,{bits:9}),I=0;I<32;)T.lens[I++]=5;h(c,T.lens,0,32,B,0,T.work,{bits:5}),A=!1}T.lencode=L,T.lenbits=9,T.distcode=B,T.distbits=5}function H(T,I,v,U){var dt,Y=T.state;return Y.window===null&&(Y.wsize=1<<Y.wbits,Y.wnext=0,Y.whave=0,Y.window=new n.Buf8(Y.wsize)),U>=Y.wsize?(n.arraySet(Y.window,I,v-Y.wsize,Y.wsize,0),Y.wnext=0,Y.whave=Y.wsize):(U<(dt=Y.wsize-Y.wnext)&&(dt=U),n.arraySet(Y.window,I,v-U,dt,Y.wnext),(U-=dt)?(n.arraySet(Y.window,I,v-U,U,0),Y.wnext=U,Y.whave=Y.wsize):(Y.wnext+=dt,Y.wnext===Y.wsize&&(Y.wnext=0),Y.whave<Y.wsize&&(Y.whave+=dt))),0}r.inflateReset=y,r.inflateReset2=M,r.inflateResetKeep=E,r.inflateInit=function(T){return P(T,15)},r.inflateInit2=P,r.inflate=function(T,I){var v,U,dt,Y,at,X,Z,O,V,ht,nt,it,Ut,jt,Mt,zt,Ee,ce,ti,Je,x,$,K,R,_=0,F=new n.Buf8(4),Q=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!T||!T.state||!T.output||!T.input&&T.avail_in!==0)return f;(v=T.state).mode===12&&(v.mode=13),at=T.next_out,dt=T.output,Z=T.avail_out,Y=T.next_in,U=T.input,X=T.avail_in,O=v.hold,V=v.bits,ht=X,nt=Z,$=d;t:for(;;)switch(v.mode){case p:if(v.wrap===0){v.mode=13;break}for(;V<16;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}if(2&v.wrap&&O===35615){F[v.check=0]=255&O,F[1]=O>>>8&255,v.check=o(v.check,F,2,0),V=O=0,v.mode=2;break}if(v.flags=0,v.head&&(v.head.done=!1),!(1&v.wrap)||(((255&O)<<8)+(O>>8))%31){T.msg="incorrect header check",v.mode=30;break}if((15&O)!=8){T.msg="unknown compression method",v.mode=30;break}if(V-=4,x=8+(15&(O>>>=4)),v.wbits===0)v.wbits=x;else if(x>v.wbits){T.msg="invalid window size",v.mode=30;break}v.dmax=1<<x,T.adler=v.check=1,v.mode=512&O?10:12,V=O=0;break;case 2:for(;V<16;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}if(v.flags=O,(255&v.flags)!=8){T.msg="unknown compression method",v.mode=30;break}if(57344&v.flags){T.msg="unknown header flags set",v.mode=30;break}v.head&&(v.head.text=O>>8&1),512&v.flags&&(F[0]=255&O,F[1]=O>>>8&255,v.check=o(v.check,F,2,0)),V=O=0,v.mode=3;case 3:for(;V<32;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}v.head&&(v.head.time=O),512&v.flags&&(F[0]=255&O,F[1]=O>>>8&255,F[2]=O>>>16&255,F[3]=O>>>24&255,v.check=o(v.check,F,4,0)),V=O=0,v.mode=4;case 4:for(;V<16;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}v.head&&(v.head.xflags=255&O,v.head.os=O>>8),512&v.flags&&(F[0]=255&O,F[1]=O>>>8&255,v.check=o(v.check,F,2,0)),V=O=0,v.mode=5;case 5:if(1024&v.flags){for(;V<16;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}v.length=O,v.head&&(v.head.extra_len=O),512&v.flags&&(F[0]=255&O,F[1]=O>>>8&255,v.check=o(v.check,F,2,0)),V=O=0}else v.head&&(v.head.extra=null);v.mode=6;case 6:if(1024&v.flags&&(X<(it=v.length)&&(it=X),it&&(v.head&&(x=v.head.extra_len-v.length,v.head.extra||(v.head.extra=Array(v.head.extra_len)),n.arraySet(v.head.extra,U,Y,it,x)),512&v.flags&&(v.check=o(v.check,U,it,Y)),X-=it,Y+=it,v.length-=it),v.length))break t;v.length=0,v.mode=7;case 7:if(2048&v.flags){if(X===0)break t;for(it=0;x=U[Y+it++],v.head&&x&&v.length<65536&&(v.head.name+=String.fromCharCode(x)),x&&it<X;);if(512&v.flags&&(v.check=o(v.check,U,it,Y)),X-=it,Y+=it,x)break t}else v.head&&(v.head.name=null);v.length=0,v.mode=8;case 8:if(4096&v.flags){if(X===0)break t;for(it=0;x=U[Y+it++],v.head&&x&&v.length<65536&&(v.head.comment+=String.fromCharCode(x)),x&&it<X;);if(512&v.flags&&(v.check=o(v.check,U,it,Y)),X-=it,Y+=it,x)break t}else v.head&&(v.head.comment=null);v.mode=9;case 9:if(512&v.flags){for(;V<16;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}if(O!==(65535&v.check)){T.msg="header crc mismatch",v.mode=30;break}V=O=0}v.head&&(v.head.hcrc=v.flags>>9&1,v.head.done=!0),T.adler=v.check=0,v.mode=12;break;case 10:for(;V<32;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}T.adler=v.check=b(O),V=O=0,v.mode=11;case 11:if(v.havedict===0)return T.next_out=at,T.avail_out=Z,T.next_in=Y,T.avail_in=X,v.hold=O,v.bits=V,2;T.adler=v.check=1,v.mode=12;case 12:if(I===5||I===6)break t;case 13:if(v.last){O>>>=7&V,V-=7&V,v.mode=27;break}for(;V<3;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}switch(v.last=1&O,--V,3&(O>>>=1)){case 0:v.mode=14;break;case 1:if(G(v),v.mode=20,I!==6)break;O>>>=2,V-=2;break t;case 2:v.mode=17;break;case 3:T.msg="invalid block type",v.mode=30}O>>>=2,V-=2;break;case 14:for(O>>>=7&V,V-=7&V;V<32;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}if((65535&O)!=(O>>>16^65535)){T.msg="invalid stored block lengths",v.mode=30;break}if(v.length=65535&O,V=O=0,v.mode=15,I===6)break t;case 15:v.mode=16;case 16:if(it=v.length){if(X<it&&(it=X),Z<it&&(it=Z),it===0)break t;n.arraySet(dt,U,Y,it,at),X-=it,Y+=it,Z-=it,at+=it,v.length-=it;break}v.mode=12;break;case 17:for(;V<14;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}if(v.nlen=257+(31&O),O>>>=5,V-=5,v.ndist=1+(31&O),O>>>=5,V-=5,v.ncode=4+(15&O),O>>>=4,V-=4,286<v.nlen||30<v.ndist){T.msg="too many length or distance symbols",v.mode=30;break}v.have=0,v.mode=18;case 18:for(;v.have<v.ncode;){for(;V<3;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}v.lens[Q[v.have++]]=7&O,O>>>=3,V-=3}for(;v.have<19;)v.lens[Q[v.have++]]=0;if(v.lencode=v.lendyn,v.lenbits=7,K={bits:v.lenbits},$=h(0,v.lens,0,19,v.lencode,0,v.work,K),v.lenbits=K.bits,$){T.msg="invalid code lengths set",v.mode=30;break}v.have=0,v.mode=19;case 19:for(;v.have<v.nlen+v.ndist;){for(;zt=(_=v.lencode[O&(1<<v.lenbits)-1])>>>16&255,Ee=65535&_,!((Mt=_>>>24)<=V);){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}if(Ee<16)O>>>=Mt,V-=Mt,v.lens[v.have++]=Ee;else{if(Ee===16){for(R=Mt+2;V<R;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}if(O>>>=Mt,V-=Mt,v.have===0){T.msg="invalid bit length repeat",v.mode=30;break}x=v.lens[v.have-1],it=3+(3&O),O>>>=2,V-=2}else if(Ee===17){for(R=Mt+3;V<R;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}V-=Mt,x=0,it=3+(7&(O>>>=Mt)),O>>>=3,V-=3}else{for(R=Mt+7;V<R;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}V-=Mt,x=0,it=11+(127&(O>>>=Mt)),O>>>=7,V-=7}if(v.have+it>v.nlen+v.ndist){T.msg="invalid bit length repeat",v.mode=30;break}for(;it--;)v.lens[v.have++]=x}}if(v.mode===30)break;if(v.lens[256]===0){T.msg="invalid code -- missing end-of-block",v.mode=30;break}if(v.lenbits=9,K={bits:v.lenbits},$=h(u,v.lens,0,v.nlen,v.lencode,0,v.work,K),v.lenbits=K.bits,$){T.msg="invalid literal/lengths set",v.mode=30;break}if(v.distbits=6,v.distcode=v.distdyn,K={bits:v.distbits},$=h(c,v.lens,v.nlen,v.ndist,v.distcode,0,v.work,K),v.distbits=K.bits,$){T.msg="invalid distances set",v.mode=30;break}if(v.mode=20,I===6)break t;case 20:v.mode=21;case 21:if(6<=X&&258<=Z){T.next_out=at,T.avail_out=Z,T.next_in=Y,T.avail_in=X,v.hold=O,v.bits=V,l(T,nt),at=T.next_out,dt=T.output,Z=T.avail_out,Y=T.next_in,U=T.input,X=T.avail_in,O=v.hold,V=v.bits,v.mode===12&&(v.back=-1);break}for(v.back=0;zt=(_=v.lencode[O&(1<<v.lenbits)-1])>>>16&255,Ee=65535&_,!((Mt=_>>>24)<=V);){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}if(zt&&!(240&zt)){for(ce=Mt,ti=zt,Je=Ee;zt=(_=v.lencode[Je+((O&(1<<ce+ti)-1)>>ce)])>>>16&255,Ee=65535&_,!(ce+(Mt=_>>>24)<=V);){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}O>>>=ce,V-=ce,v.back+=ce}if(O>>>=Mt,V-=Mt,v.back+=Mt,v.length=Ee,zt===0){v.mode=26;break}if(32&zt){v.back=-1,v.mode=12;break}if(64&zt){T.msg="invalid literal/length code",v.mode=30;break}v.extra=15&zt,v.mode=22;case 22:if(v.extra){for(R=v.extra;V<R;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}v.length+=O&(1<<v.extra)-1,O>>>=v.extra,V-=v.extra,v.back+=v.extra}v.was=v.length,v.mode=23;case 23:for(;zt=(_=v.distcode[O&(1<<v.distbits)-1])>>>16&255,Ee=65535&_,!((Mt=_>>>24)<=V);){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}if(!(240&zt)){for(ce=Mt,ti=zt,Je=Ee;zt=(_=v.distcode[Je+((O&(1<<ce+ti)-1)>>ce)])>>>16&255,Ee=65535&_,!(ce+(Mt=_>>>24)<=V);){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}O>>>=ce,V-=ce,v.back+=ce}if(O>>>=Mt,V-=Mt,v.back+=Mt,64&zt){T.msg="invalid distance code",v.mode=30;break}v.offset=Ee,v.extra=15&zt,v.mode=24;case 24:if(v.extra){for(R=v.extra;V<R;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}v.offset+=O&(1<<v.extra)-1,O>>>=v.extra,V-=v.extra,v.back+=v.extra}if(v.offset>v.dmax){T.msg="invalid distance too far back",v.mode=30;break}v.mode=25;case 25:if(Z===0)break t;if(it=nt-Z,v.offset>it){if((it=v.offset-it)>v.whave&&v.sane){T.msg="invalid distance too far back",v.mode=30;break}Ut=it>v.wnext?(it-=v.wnext,v.wsize-it):v.wnext-it,it>v.length&&(it=v.length),jt=v.window}else jt=dt,Ut=at-v.offset,it=v.length;for(Z<it&&(it=Z),Z-=it,v.length-=it;dt[at++]=jt[Ut++],--it;);v.length===0&&(v.mode=21);break;case 26:if(Z===0)break t;dt[at++]=v.length,Z--,v.mode=21;break;case 27:if(v.wrap){for(;V<32;){if(X===0)break t;X--,O|=U[Y++]<<V,V+=8}if(nt-=Z,T.total_out+=nt,v.total+=nt,nt&&(T.adler=v.check=v.flags?o(v.check,dt,nt,at-nt):a(v.check,dt,nt,at-nt)),nt=Z,(v.flags?O:b(O))!==v.check){T.msg="incorrect data check",v.mode=30;break}V=O=0}v.mode=28;case 28:if(v.wrap&&v.flags){for(;V<32;){if(X===0)break t;X--,O+=U[Y++]<<V,V+=8}if(O!==(4294967295&v.total)){T.msg="incorrect length check",v.mode=30;break}V=O=0}v.mode=29;case 29:$=1;break t;case 30:$=-3;break t;case 31:return-4;default:return f}return T.next_out=at,T.avail_out=Z,T.next_in=Y,T.avail_in=X,v.hold=O,v.bits=V,(v.wsize||nt!==T.avail_out&&v.mode<30&&(v.mode<27||I!==4))&&H(T,T.output,T.next_out,nt-T.avail_out)?(v.mode=31,-4):(ht-=T.avail_in,nt-=T.avail_out,T.total_in+=ht,T.total_out+=nt,v.total+=nt,v.wrap&&nt&&(T.adler=v.check=v.flags?o(v.check,dt,nt,T.next_out-nt):a(v.check,dt,nt,T.next_out-nt)),T.data_type=v.bits+(v.last?64:0)+(v.mode===12?128:0)+(v.mode===20||v.mode===15?256:0),(ht==0&&nt===0||I===4)&&$===d&&($=-5),$)},r.inflateEnd=function(T){if(!T||!T.state)return f;var I=T.state;return I.window&&(I.window=null),T.state=null,d},r.inflateGetHeader=function(T,I){var v;return T&&T.state&&2&(v=T.state).wrap?((v.head=I).done=!1,d):f},r.inflateSetDictionary=function(T,I){var v,U=I.length;return T&&T.state?(v=T.state).wrap!==0&&v.mode!==11?f:v.mode===11&&a(1,I,U,0)!==v.check?-3:H(T,I,U,U)?(v.mode=31,-4):(v.havedict=1,d):f},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(i,s,r){var n=i("../utils/common"),a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],h=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];s.exports=function(u,c,d,f,p,m,g,b){var S,E,y,M,P,L,B,A,G,H=b.bits,T=0,I=0,v=0,U=0,dt=0,Y=0,at=0,X=0,Z=0,O=0,V=null,ht=0,nt=new n.Buf16(16),it=new n.Buf16(16),Ut=null,jt=0;for(T=0;T<=15;T++)nt[T]=0;for(I=0;I<f;I++)nt[c[d+I]]++;for(dt=H,U=15;1<=U&&nt[U]===0;U--);if(U<dt&&(dt=U),U===0)return p[m++]=20971520,p[m++]=20971520,b.bits=1,0;for(v=1;v<U&&nt[v]===0;v++);for(dt<v&&(dt=v),T=X=1;T<=15;T++)if(X<<=1,(X-=nt[T])<0)return-1;if(0<X&&(u===0||U!==1))return-1;for(it[1]=0,T=1;T<15;T++)it[T+1]=it[T]+nt[T];for(I=0;I<f;I++)c[d+I]!==0&&(g[it[c[d+I]]++]=I);if(L=u===0?(V=Ut=g,19):u===1?(V=a,ht-=257,Ut=o,jt-=257,256):(V=l,Ut=h,-1),T=v,P=m,at=I=O=0,y=-1,M=(Z=1<<(Y=dt))-1,u===1&&852<Z||u===2&&592<Z)return 1;for(;;){for(B=T-at,G=g[I]<L?(A=0,g[I]):g[I]>L?(A=Ut[jt+g[I]],V[ht+g[I]]):(A=96,0),S=1<<T-at,v=E=1<<Y;p[P+(O>>at)+(E-=S)]=B<<24|A<<16|G|0,E!==0;);for(S=1<<T-1;O&S;)S>>=1;if(S===0?O=0:(O&=S-1,O+=S),I++,--nt[T]==0){if(T===U)break;T=c[d+g[I]]}if(dt<T&&(O&M)!==y){for(at===0&&(at=dt),P+=v,X=1<<(Y=T-at);Y+at<U&&!((X-=nt[Y+at])<=0);)Y++,X<<=1;if(Z+=1<<Y,u===1&&852<Z||u===2&&592<Z)return 1;p[y=O&M]=dt<<24|Y<<16|P-m|0}}return O!==0&&(p[P+O]=T-at<<24|4194304),b.bits=dt,0}},{"../utils/common":41}],51:[function(i,s,r){s.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(i,s,r){var n=i("../utils/common"),a=0,o=1;function l(_){for(var F=_.length;0<=--F;)_[F]=0}var h=0,u=29,c=256,d=c+1+u,f=30,p=19,m=2*d+1,g=15,b=16,S=7,E=256,y=16,M=17,P=18,L=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],B=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],G=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],H=Array(2*(d+2));l(H);var T=Array(2*f);l(T);var I=Array(512);l(I);var v=Array(256);l(v);var U=Array(u);l(U);var dt,Y,at,X=Array(f);function Z(_,F,Q,et,z){this.static_tree=_,this.extra_bits=F,this.extra_base=Q,this.elems=et,this.max_length=z,this.has_stree=_&&_.length}function O(_,F){this.dyn_tree=_,this.max_code=0,this.stat_desc=F}function V(_){return _<256?I[_]:I[256+(_>>>7)]}function ht(_,F){_.pending_buf[_.pending++]=255&F,_.pending_buf[_.pending++]=F>>>8&255}function nt(_,F,Q){_.bi_valid>b-Q?(_.bi_buf|=F<<_.bi_valid&65535,ht(_,_.bi_buf),_.bi_buf=F>>b-_.bi_valid,_.bi_valid+=Q-b):(_.bi_buf|=F<<_.bi_valid&65535,_.bi_valid+=Q)}function it(_,F,Q){nt(_,Q[2*F],Q[2*F+1])}function Ut(_,F){for(var Q=0;Q|=1&_,_>>>=1,Q<<=1,0<--F;);return Q>>>1}function jt(_,F,Q){var et,z,st=Array(g+1),pt=0;for(et=1;et<=g;et++)st[et]=pt=pt+Q[et-1]<<1;for(z=0;z<=F;z++){var rt=_[2*z+1];rt!==0&&(_[2*z]=Ut(st[rt]++,rt))}}function Mt(_){var F;for(F=0;F<d;F++)_.dyn_ltree[2*F]=0;for(F=0;F<f;F++)_.dyn_dtree[2*F]=0;for(F=0;F<p;F++)_.bl_tree[2*F]=0;_.dyn_ltree[2*E]=1,_.opt_len=_.static_len=0,_.last_lit=_.matches=0}function zt(_){8<_.bi_valid?ht(_,_.bi_buf):0<_.bi_valid&&(_.pending_buf[_.pending++]=_.bi_buf),_.bi_buf=0,_.bi_valid=0}function Ee(_,F,Q,et){var z=2*F,st=2*Q;return _[z]<_[st]||_[z]===_[st]&&et[F]<=et[Q]}function ce(_,F,Q){for(var et=_.heap[Q],z=Q<<1;z<=_.heap_len&&(z<_.heap_len&&Ee(F,_.heap[z+1],_.heap[z],_.depth)&&z++,!Ee(F,et,_.heap[z],_.depth));)_.heap[Q]=_.heap[z],Q=z,z<<=1;_.heap[Q]=et}function ti(_,F,Q){var et,z,st,pt,rt=0;if(_.last_lit!==0)for(;et=_.pending_buf[_.d_buf+2*rt]<<8|_.pending_buf[_.d_buf+2*rt+1],z=_.pending_buf[_.l_buf+rt],rt++,et===0?it(_,z,F):(it(_,(st=v[z])+c+1,F),(pt=L[st])!==0&&nt(_,z-=U[st],pt),it(_,st=V(--et),Q),(pt=B[st])!==0&&nt(_,et-=X[st],pt)),rt<_.last_lit;);it(_,E,F)}function Je(_,F){var Q,et,z,st=F.dyn_tree,pt=F.stat_desc.static_tree,rt=F.stat_desc.has_stree,xt=F.stat_desc.elems,qt=-1;for(_.heap_len=0,_.heap_max=m,Q=0;Q<xt;Q++)st[2*Q]===0?st[2*Q+1]=0:(_.heap[++_.heap_len]=qt=Q,_.depth[Q]=0);for(;_.heap_len<2;)st[2*(z=_.heap[++_.heap_len]=qt<2?++qt:0)]=1,_.depth[z]=0,_.opt_len--,rt&&(_.static_len-=pt[2*z+1]);for(F.max_code=qt,Q=_.heap_len>>1;1<=Q;Q--)ce(_,st,Q);for(z=xt;Q=_.heap[1],_.heap[1]=_.heap[_.heap_len--],ce(_,st,1),et=_.heap[1],_.heap[--_.heap_max]=Q,_.heap[--_.heap_max]=et,st[2*z]=st[2*Q]+st[2*et],_.depth[z]=(_.depth[Q]>=_.depth[et]?_.depth[Q]:_.depth[et])+1,st[2*Q+1]=st[2*et+1]=z,_.heap[1]=z++,ce(_,st,1),2<=_.heap_len;);_.heap[--_.heap_max]=_.heap[1],(function(kt,He){var is,ei,ss,de,Is,Ar,oi=He.dyn_tree,ba=He.max_code,Jl=He.stat_desc.static_tree,$l=He.stat_desc.has_stree,Zl=He.stat_desc.extra_bits,Sa=He.stat_desc.extra_base,rs=He.stat_desc.max_length,Bs=0;for(de=0;de<=g;de++)kt.bl_count[de]=0;for(oi[2*kt.heap[kt.heap_max]+1]=0,is=kt.heap_max+1;is<m;is++)rs<(de=oi[2*oi[2*(ei=kt.heap[is])+1]+1]+1)&&(de=rs,Bs++),oi[2*ei+1]=de,ba<ei||(kt.bl_count[de]++,Is=0,Sa<=ei&&(Is=Zl[ei-Sa]),Ar=oi[2*ei],kt.opt_len+=Ar*(de+Is),$l&&(kt.static_len+=Ar*(Jl[2*ei+1]+Is)));if(Bs!==0){do{for(de=rs-1;kt.bl_count[de]===0;)de--;kt.bl_count[de]--,kt.bl_count[de+1]+=2,kt.bl_count[rs]--,Bs-=2}while(0<Bs);for(de=rs;de!==0;de--)for(ei=kt.bl_count[de];ei!==0;)ba<(ss=kt.heap[--is])||(oi[2*ss+1]!==de&&(kt.opt_len+=(de-oi[2*ss+1])*oi[2*ss],oi[2*ss+1]=de),ei--)}})(_,F),jt(st,qt,_.bl_count)}function x(_,F,Q){var et,z,st=-1,pt=F[1],rt=0,xt=7,qt=4;for(pt===0&&(xt=138,qt=3),F[2*(Q+1)+1]=65535,et=0;et<=Q;et++)z=pt,pt=F[2*(et+1)+1],++rt<xt&&z===pt||(rt<qt?_.bl_tree[2*z]+=rt:z===0?rt<=10?_.bl_tree[2*M]++:_.bl_tree[2*P]++:(z!==st&&_.bl_tree[2*z]++,_.bl_tree[2*y]++),st=z,qt=(rt=0)===pt?(xt=138,3):z===pt?(xt=6,3):(xt=7,4))}function $(_,F,Q){var et,z,st=-1,pt=F[1],rt=0,xt=7,qt=4;for(pt===0&&(xt=138,qt=3),et=0;et<=Q;et++)if(z=pt,pt=F[2*(et+1)+1],!(++rt<xt&&z===pt)){if(rt<qt)for(;it(_,z,_.bl_tree),--rt!=0;);else z===0?rt<=10?(it(_,M,_.bl_tree),nt(_,rt-3,3)):(it(_,P,_.bl_tree),nt(_,rt-11,7)):(z!==st&&(it(_,z,_.bl_tree),rt--),it(_,y,_.bl_tree),nt(_,rt-3,2));st=z,qt=(rt=0)===pt?(xt=138,3):z===pt?(xt=6,3):(xt=7,4)}}l(X);var K=!1;function R(_,F,Q,et){nt(_,(h<<1)+ +!!et,3),(function(z,st,pt,rt){zt(z),rt&&(ht(z,pt),ht(z,~pt)),n.arraySet(z.pen
77ding_buf,z.window,st,pt,z.pending),z.pending+=pt})(_,F,Q,!0)}r._tr_init=function(_){K||((function(){var F,Q,et,z,st,pt=Array(g+1);for(z=et=0;z<u-1;z++)for(U[z]=et,F=0;F<1<<L[z];F++)v[et++]=z;for(v[et-1]=z,z=st=0;z<16;z++)for(X[z]=st,F=0;F<1<<B[z];F++)I[st++]=z;for(st>>=7;z<f;z++)for(X[z]=st<<7,F=0;F<1<<B[z]-7;F++)I[256+st++]=z;for(Q=0;Q<=g;Q++)pt[Q]=0;for(F=0;F<=143;)H[2*F+1]=8,F++,pt[8]++;for(;F<=255;)H[2*F+1]=9,F++,pt[9]++;for(;F<=279;)H[2*F+1]=7,F++,pt[7]++;for(;F<=287;)H[2*F+1]=8,F++,pt[8]++;for(jt(H,d+1,pt),F=0;F<f;F++)T[2*F+1]=5,T[2*F]=Ut(F,5);dt=new Z(H,L,c+1,d,g),Y=new Z(T,B,0,f,g),at=new Z([],A,0,p,S)})(),K=!0),_.l_desc=new O(_.dyn_ltree,dt),_.d_desc=new O(_.dyn_dtree,Y),_.bl_desc=new O(_.bl_tree,at),_.bi_buf=0,_.bi_valid=0,Mt(_)},r._tr_stored_block=R,r._tr_flush_block=function(_,F,Q,et){var z,st,pt=0;0<_.level?(_.strm.data_type===2&&(_.strm.data_type=(function(rt){var xt,qt=4093624447;for(xt=0;xt<=31;xt++,qt>>>=1)if(1&qt&&rt.dyn_ltree[2*xt]!==0)return a;if(rt.dyn_ltree[18]!==0||rt.dyn_ltree[20]!==0||rt.dyn_ltree[26]!==0)return o;for(xt=32;xt<c;xt++)if(rt.dyn_ltree[2*xt]!==0)return o;return a})(_)),Je(_,_.l_desc),Je(_,_.d_desc),pt=(function(rt){var xt;for(x(rt,rt.dyn_ltree,rt.l_desc.max_code),x(rt,rt.dyn_dtree,rt.d_desc.max_code),Je(rt,rt.bl_desc),xt=p-1;3<=xt&&rt.bl_tree[2*G[xt]+1]===0;xt--);return rt.opt_len+=3*(xt+1)+5+5+4,xt})(_),z=_.opt_len+3+7>>>3,(st=_.static_len+3+7>>>3)<=z&&(z=st)):z=st=Q+5,Q+4<=z&&F!==-1?R(_,F,Q,et):_.strategy===4||st===z?(nt(_,2+ +!!et,3),ti(_,H,T)):(nt(_,4+ +!!et,3),(function(rt,xt,qt,kt){var He;for(nt(rt,xt-257,5),nt(rt,qt-1,5),nt(rt,kt-4,4),He=0;He<kt;He++)nt(rt,rt.bl_tree[2*G[He]+1],3);$(rt,rt.dyn_ltree,xt-1),$(rt,rt.dyn_dtree,qt-1)})(_,_.l_desc.max_code+1,_.d_desc.max_code+1,pt+1),ti(_,_.dyn_ltree,_.dyn_dtree)),Mt(_),et&&zt(_)},r._tr_tally=function(_,F,Q){return _.pending_buf[_.d_buf+2*_.last_lit]=F>>>8&255,_.pending_buf[_.d_buf+2*_.last_lit+1]=255&F,_.pending_buf[_.l_buf+_.last_lit]=255&Q,_.last_lit++,F===0?_.dyn_ltree[2*Q]++:(_.matches++,F--,_.dyn_ltree[2*(v[Q]+c+1)]++,_.dyn_dtree[2*V(F)]++),_.last_lit===_.lit_bufsize-1},r._tr_align=function(_){nt(_,2,3),it(_,E,H),(function(F){F.bi_valid===16?(ht(F,F.bi_buf),F.bi_buf=0,F.bi_valid=0):8<=F.bi_valid&&(F.pending_buf[F.pending++]=255&F.bi_buf,F.bi_buf>>=8,F.bi_valid-=8)})(_)}},{"../utils/common":41}],53:[function(i,s,r){s.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(i,s,r){(function(n){(function(a,o){if(!a.setImmediate){var l,h,u,c,d=1,f={},p=!1,m=a.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(a);g=g&&g.setTimeout?g:a,l={}.toString.call(a.process)==="[object process]"?function(y){process.nextTick(function(){S(y)})}:(function(){if(a.postMessage&&!a.importScripts){var y=!0,M=a.onmessage;return a.onmessage=function(){y=!1},a.postMessage("","*"),a.onmessage=M,y}})()?(c="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",E,!1):a.attachEvent("onmessage",E),function(y){a.postMessage(c+y,"*")}):a.MessageChannel?((u=new MessageChannel).port1.onmessage=function(y){S(y.data)},function(y){u.port2.postMessage(y)}):m&&"onreadystatechange"in m.createElement("script")?(h=m.documentElement,function(y){var M=m.createElement("script");M.onreadystatechange=function(){S(y),M.onreadystatechange=null,h.removeChild(M),M=null},h.appendChild(M)}):function(y){setTimeout(S,0,y)},g.setImmediate=function(y){typeof y!="function"&&(y=Function(""+y));for(var M=Array(arguments.length-1),P=0;P<M.length;P++)M[P]=arguments[P+1];return f[d]={callback:y,args:M},l(d),d++},g.clearImmediate=b}function b(y){delete f[y]}function S(y){if(p)setTimeout(S,0,y);else{var M=f[y];if(M){p=!0;try{(function(P){var L=P.callback,B=P.args;switch(B.length){case 0:L();break;case 1:L(B[0]);break;case 2:L(B[0],B[1]);break;case 3:L(B[0],B[1],B[2]);break;default:L.apply(o,B)}})(M)}finally{b(y),p=!1}}}}
77function E(y){y.source===a&&typeof y.data=="string"&&y.data.indexOf(c)===0&&S(+y.data.slice(c.length))}})(typeof self>"u"?n===void 0?this:n:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}))()),Xl=class{constructor(e){this.unzipSuccessful=!1,this.blob=e}async tryUnzip(){this.zipFile=new Hl.default;try{return this.unzipSuccessful=!0,await this.zipFile.loadAsync(this.blob),!0}catch{return this.unzipSuccessful=!1,!1}}getXmlString(){return ga.jszipToXMLstring(this.zipFile)}},ga=class{static MXLtoIXmlElement(e){return this.MXLtoXMLstring(e).then(t=>{let i=new Rn(new DOMParser().parseFromString(t,"text/xml").documentElement);return Promise.resolve(i)},t=>{throw Error("extractSheetFromMxl: "+t.message)})}static async jszipToXMLstring(e){let t=await e.file("META-INF/container.xml").async("text");if(!t.startsWith("<")){let r=await e.file("META-INF/container.xml").async("uint8array");t=new TextDecoder("utf-8").decode(r)}if(!t.startsWith("<")){let r=await e.file("META-INF/container.xml").async("uint8array");t=new TextDecoder("utf-16").decode(r)}let i=new DOMParser().parseFromString(t,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path"),s=await e.file(i).async("text");if(!s.substring(0,1).startsWith("<")){let r=await e.file(i).async("uint8array");return new TextDecoder("utf-16").decode(r)}return s}static MXLtoXMLstring(e){let t=new Hl.default;return t.loadAsync(e).then(async i=>this.jszipToXMLstring(t),i=>{throw W.default.error(i),i})}},ju=class extends ue{constructor(e){super(),this.parent=e}get Parent(){return this.parent}set Parent(e){this.parent=e}},Ku=class{constructor(e,t){this.label=e,this.settings=t}},qu=class{constructor(e,t=void 0,i=void 0,s=void 0){this.systemRectangle=e,this.labelRectangle=t,this.label=i,this.settings=s}},Ju=class extends ue{constructor(e,t,i,s){super(),this.boundingBox=new Yt(this,i),this.boundingBox.RelativePosition=e,this.boundingBox.BorderRight=t.x-e.x,this.boundingBox.BorderBottom=t.y-e.y,this.style=s}},$u=class{constructor(e){this.graphicalLinkedStaffEntries=[],this.staffEntryLink=e,this.initialize()}get GetStaffEntryLink(){return this.staffEntryLink}get GraphicalLinkedStaffEntries(){return this.graphicalLinkedStaffEntries}set GraphicalLinkedStaffEntries(e){this.graphicalLinkedStaffEntries=e}isFilled(){for(let e=0;e<this.graphicalLinkedStaffEntries.length;e++)if(!this.graphicalLinkedStaffEntries[e])return!1;return!0}getLinkedStaffEntriesGraphicalNotes(e){if(this.graphicalLinkedStaffEntries.indexOf(e)!==-1){let t=[];for(let i=0,s=this.graphicalLinkedStaffEntries.length;i<s;++i){let r=this.graphicalLinkedStaffEntries[i];for(let n of r.graphicalVoiceEntries)for(let a of n.notes)a.sourceNote.ParentStaffEntry.Link&&a.sourceNote.ParentVoiceEntry===this.staffEntryLink.GetVoiceEntry&&t.push(a)}return t}}initialize(){for(let e=0,t=this.staffEntryLink.LinkStaffEntries.length;e<t;++e)this.graphicalLinkedStaffEntries.push(void 0)}},Zu=class extends ue{constructor(e,t){super();let i=t,s=e.PositionAndShape.AbsolutePosition.y,r=.4,n=Le.last(e.StaffLines).PositionAndShape.RelativePosition.y+4;this.verticalLine=new Ae(new k(i,s),new k(i,s+n),r,At.SelectionSymbol);for(let a=0,o=e.StaffLines.length;a<o;++a){let l=e.StaffLines[a],h=new k(i,s+l.PositionAndShape.RelativePosition.y),u=[,,,];h.y-=.2,u[0].x=h.x-3,u[0].y=h.y+1.2,u[1].x=h.x-2,u[1].y=h.y+.4,u[2].x=h.x-2,u[2].y=h.y+2,this.arrows.push(u);let c=Array(8),d=.8;h.x-=.1,h.y+=.3;let f=.2;c[0].x=h.x-2,c[0].y=h.y+1.5-f,c[1].x=h.x-1,c[1].y=h.y+1.5-f,c[2].x=h.x-1,c[2].y=h.y+2.5,c[3].x=h.x-2,c[3].y=h.y+2.5,c[4].x=c[0].x,c[4].y=c[0].y-d,c[5].x=c[4].x+d+1,c[5].y=c[4].y,c[6].x=c[5].x,c[6].y=c[3].y+d,c[7].x=c[3].x,c[7].y=c[6].y,this.arrowlines.push(c)}this.boundingBox=new Yt(this),this.boundingBox.AbsolutePosition=new k(i,s),this.boundingBox.BorderLeft=-r,this.boundingBox.BorderRight=4,this.boundingBox.BorderBottom=n}},Qu=class extends ue{constructor(e,t){super();let i=t,s=e.PositionAndShape.AbsolutePosition.y,r=.4,n=Le.last(e.StaffLines).PositionAndShape.RelativePosition.y+4;this.verticalLine=new Ae(new k(i,s),new k(i,s+n),r,At.SelectionSymbol);for(let a=0,o=e.StaffLines.length;a<o;++a){let l=e.StaffLines[a],h=new k(i,s+l.PositionAndShape.RelativePosition.y),u=Array(7);u[0].x=h.x+4,u[0].y=h.y+2,u[1].x=h.x+2.5,u[1].y=h.y+.5,u[2].x=h.x+2.5,u[2].y=h.y+1.3,u[3].x=h.x+1,u[3].y=h.y+1.3,u[4].x=h.x+1,u[4].y=h.y+2.7,u[5].x=h.x+2.5,u[5].y=h.y+2.7,u[6].x=h.x+2.5,u[6].y=h.y+3.5,this.arrows.push(u)}this.boundingBox=new Yt(this),this.boundingBox.AbsolutePosition=new k(i,s),this.boundingBox.BorderLeft=-r,this.boundingBox.BorderRight=4,this.boundingBox.BorderBottom=n}},Yl=class Ln{calculate(t){Ln.processTempoExpressions(t)}static processTempoExpressions(t){let i=[];for(let o=0,l=t.SourceMeasures;o<l.length;o++){let h=l[o];h.TempoExpressions.sort(_n.Compare);for(let u=0,c=h.TempoExpressions;u<c.length;u++){let d=c[u];d.InstantaneousTempo!=null&&d.InstantaneousTempo.TempoType===Wt.none&&(d.InstantaneousTempo.TempoType=Wt.inst),i.push(d)}}i.sort(_n.Compare);let s=Ln.cleanExpListStartingEntry(t,i),r=[],n=null,a=s;for(let o=0,l=i;o<l.length;o++){let h=l[o];if(n===null||h.AbsoluteTimestamp!==n.AbsoluteTimestamp){if(h.InstantaneousTempo!=null&&h.InstantaneousTempo.TempoInBpm===0){let u=h.InstantaneousTempo;if(u.isMetronomeMark&&(u.TempoInBpm=a),u instanceof Fe&&u.TempoType!==Wt.change&&(u.TempoInBpm=Fe.getDefaultValueForInstTempo(u.InstTempo)),u.TempoType===Wt.change)switch(u.ChangeSubType){case ji.atempo:u.TempoInBpm=a;break;case ji.doppioMovimento:u.TempoInBpm=a*2;break;case ji.tempoprimo:u.TempoInBpm=s;break;default:break}a=u.TempoInBpm}}else(n!=null||h.AbsoluteTimestamp===n.AbsoluteTimestamp)&&(n.InstantaneousTempo!=null&&h.InstantaneousTempo!=null&&h.clearInstantaneousTempo(),h.ContinuousTempo!=null&&(n.ContinuousTempo===null&&n.addExpression(h.ContinuousTempo,""),h.clearContinuousTempo()));if(h.InstantaneousTempo===null&&h.ContinuousTempo===null){let u=h.SourceMeasureParent.TempoExpressions.indexOf(h);u>=0&&h.SourceMeasureParent.TempoExpressions.splice(u,1)}else r.push(h),n=h}a=s;for(let o=0;o<r.length;o++){let l=r[o];if(l.InstantaneousTempo!=null&&(a=l.InstantaneousTempo.TempoInBpm),l.ContinuousTempo!=null){let h=l.ContinuousTempo;h.StartTempo=a;let u=l.SourceMeasureParent.measureListIndex,c=u,d=Math.min(u+t.Rules.TempoChangeMeasureValidity,t.SourceMeasures.length-1);for(;c<=d;){let b=t.SourceMeasures[c],S=b.endingBarStyleEnum===ft.ThinBold;if(b.endsWithLineRepetition()||S||c===t.SourceMeasures.length-1)break;if(c>u&&b.beginsWithRepetition()){c--;break}else c++}let f=t.SourceMeasures[c],p=N.plus(f.AbsoluteTimestamp,N.minus(f.Duration,new N(1,64))),m;o<r.length-1&&(m=r[o+1].AbsoluteTimestamp,m.RealValue<p.RealValue&&(p=m)),h.AbsoluteEndTimestamp=p;let g=h.StartTempo*(1-t.Rules.TempoContinousFactor)*h.getTempoFactor();g*=Math.max(.6,Math.min(h.AbsoluteTimeSpan,2)/2)**(1/4),h.EndTempo=h.StartTempo+g}}t.TimestampSortedTempoExpressionsList=r,r[0]?.InstantaneousTempo&&(t.DefaultStartTempoInBpm=r[0].InstantaneousTempo.TempoInBpm)}static cleanExpListStartingEntry(t,i){if((i.length===0||!i[0].AbsoluteTimestamp.Equals(new N(0,1)))&&(i=[new Sl(t.SourceMeasures[0],new N(0,1))].concat(i)),!i[0].InstantaneousTempo){let r=new Fe("*generated",C.Above,1,0,i[0],!0);i[0].addExpression(r,"")}let s=i[0].InstantaneousTempo;return s.TempoInBpm===0&&(s.TempoInBpm===0&&t.DefaultStartTempoInBpm>0&&(s.TempoInBpm=t.DefaultStartTempoInBpm),s.TempoInBpm===0&&(s.TempoInBpm=Fe.getDefaultValueForInstTempo[bt.moderato])),s.TempoInBpm}},_n=class ps{static Compare(t,i){let s=0;if(s=ps.CompareNumber(t.AbsoluteTimestamp.RealValue,i.AbsoluteTimestamp.RealValue),s!==0)return s;let r=ps.calcSortPriority(t),n=ps.calcSortPriority(i);return s=ps.CompareNumber(r,n),s}static calcSortPriority(t){if(t.InstantaneousTempo!=null){switch(t.InstantaneousTempo.TempoType){case Wt.metronomeMark:return 1;case Wt.inst:return 2;case Wt.change:switch(t.InstantaneousTempo.ChangeSubType){case ji.atempo:case ji.doppioMovimento:return 3;case ji.tempoprimo:return 4;default:break}break;default:break}return 5}else return 9}
77static CompareNumber(t,i){return t<i?-1:t===i?0:1}},ja,jl=class tr{constructor(t,i=Xr.OSMDOptionsStandard()){if(this.version="1.9.7-release",this.cursorsOptions=[],this.cursors=[],this.zoom=1,this.zoomUpdated=!1,this.loadUrlTimeout=5e3,typeof t=="string"?this.container=document.getElementById(t):t&&"appendChild"in t&&(this.container=t),!this.container)throw Error("Please pass a valid div container to OpenSheetMusicDisplay");i.autoResize===void 0&&(i.autoResize=!0),this.backendType=ni.SVG,this.setOptions(i)}get cursor(){return this.cursors[0]}get Cursor(){return this.cursor}load(t,i="Untitled Score"){this.reset();let s=this;if(t instanceof Blob){let h=new Xl(t);return h.tryUnzip().then(()=>{if(h.unzipSuccessful)return h.getXmlString().then(u=>s.load(u));if(t instanceof Blob)return t.text().then(u=>s.load(u))})}else if(typeof t=="string"){let h=t;if(h.startsWith("PK��"))return W.default.debug("[OSMD] This is a zip file, unpack it first: "+h),ga.MXLtoXMLstring(h).then(c=>s.load(c),c=>{throw W.default.debug(c),Error("OpenSheetMusicDisplay: Invalid MXL file")});if(h.startsWith(""))return W.default.debug("[OSMD] UTF with BOM detected, truncate first 3 bytes and pass along: "+h),s.load(h.substring(3));let u=h;if(/^\s/.test(u)&&(u=u.trim()),u.startsWith("<?xml")){let c=this.OnXMLRead(u);W.default.debug("[OSMD] Finally parsing XML content, length: "+c.length),t=new DOMParser().parseFromString(c,"application/xml")}else{if(u.length<2083)return W.default.debug("[OSMD] Retrieve the file at the given URL: "+u),qa.ajax(u,this.loadUrlTimeout).then(c=>s.load(c),c=>{throw c});console.error("[OSMD] osmd.load(string): Could not process string. Did not find <?xml at beginning.")}}if(!t||!t.nodeName)return Promise.reject(Error("OpenSheetMusicDisplay: The document which was provided is invalid"));let r=t,n=r.childNodes;W.default.debug("[OSMD] load(), Document url: "+r.URL);let a;for(let h=0,u=n.length;h<u;h+=1){let c=n[h];if(c.nodeType===Node.ELEMENT_NODE&&c.nodeName.toLowerCase()==="score-partwise"){a=c;break}}if(!a)return console.error("Could not parse MusicXML, no valid partwise element found"),Promise.reject(Error("OpenSheetMusicDisplay: Document is not a valid 'partwise' MusicXML"));let o=new Rn(a),l=new zl([new Yl],this.rules);return this.sheet=l.createMusicSheet(o,i),this.sheet===void 0?Promise.reject(Error("given music sheet was incomplete or could not be loaded.")):(W.default.info(`[OSMD] Loaded sheet ${this.sheet.TitleString} successfully.`),this.needBackendUpdate=!0,this.updateGraphic(),Promise.resolve({}))}updateGraphic(){let t=new ys(this.rules);this.graphic=new nr(this.sheet,t),this.drawingParameters.drawCursors&&this.cursors.forEach(i=>{i.init(this.sheet.MusicPartManager,this.graphic)}),this.drawingParameters.DrawingParametersEnum===Ve.leadsheet&&(this.graphic.LeadSheet=!0)}render(){if(!this.graphic)throw Error("OSMD: load() needs to be called before render()");this.drawer?.clear(),this.Sheet.SourceMeasures[0].ImplicitMeasure&&(this.rules.MinMeasureToDrawNumber>1&&(this.rules.MinMeasureToDrawIndex=this.rules.MinMeasureToDrawNumber),this.rules.MaxMeasureToDrawNumber>0&&(this.rules.MaxMeasureToDrawIndex=this.rules.MaxMeasureToDrawNumber));let t=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(t=this.rules.SheetMaximumWidth),this.sheet.pageWidth=t/this.zoom/10,this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?(this.rules.PageHeight=this.sheet.pageWidth/this.rules.PageFormat.aspectRatio,W.default.debug("[OSMD] PageHeight: "+this.rules.PageHeight)):(W.default.debug("[OSMD] endless/undefined pageformat, id: "+this.rules.PageFormat.idString),this.rules.PageHeight=100001),this.graphic.reCalculate(),this.drawingParameters.drawCursors&&(this.graphic.Cursors.length=0),this.createOrRefreshRenderBackend(),this.needBackendUpdate=!1,this.drawer.setZoom(this.zoom),this.drawer.drawSheet(this.graphic),this.enableOrDisableCursors(this.drawingParameters.drawCursors),this.drawingParameters.drawCursors&&this.cursors.forEach(i=>{i.update()}),this.zoomUpdated=!1,this.rules.RenderCount++}
77async renderAsync(t){if(!this.graphic)throw Error("OSMD: load() needs to be called before renderAsync()");this.drawer?.clear(),this.Sheet.SourceMeasures[0].ImplicitMeasure&&(this.rules.MinMeasureToDrawNumber>1&&(this.rules.MinMeasureToDrawIndex=this.rules.MinMeasureToDrawNumber),this.rules.MaxMeasureToDrawNumber>0&&(this.rules.MaxMeasureToDrawIndex=this.rules.MaxMeasureToDrawNumber));let i=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(i=this.rules.SheetMaximumWidth),this.sheet.pageWidth=i/this.zoom/10,this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?this.rules.PageHeight=this.sheet.pageWidth/this.rules.PageFormat.aspectRatio:this.rules.PageHeight=100001;let{yieldToMain:s}=await Promise.resolve().then(()=>(Ji(),qi));await this.graphic.reCalculateAsync((n,a,o)=>{let l=Math.round(a/o*70);t?.(n,l,100)}),this.drawingParameters.drawCursors&&(this.graphic.Cursors.length=0),t?.("Preparing",70,100),await s(),this.createOrRefreshRenderBackend(),this.needBackendUpdate=!1,this.drawer.setZoom(this.zoom),await s();let r=this.drawer;typeof r.drawSheetAsync=="function"?await r.drawSheetAsync(this.graphic,(n,a)=>{let o=75+Math.round(n/a*25);t?.("Drawing",o,100)}):this.drawer.drawSheet(this.graphic),this.enableOrDisableCursors(this.drawingParameters.drawCursors),this.drawingParameters.drawCursors&&this.cursors.forEach(n=>{n.update()}),this.zoomUpdated=!1,this.rules.RenderCount++}createOrRefreshRenderBackend(){if(this.drawer&&this.drawer.Backends){this.drawer.Backends[0]&&this.drawer.Backends[0].removeAllChildrenFromContainer(this.container);for(let r of this.drawer.Backends)r.free();this.drawer.Backends.clear()}this.drawingParameters.Rules=this.rules,this.drawer=new pl(this.drawingParameters),this.drawer.drawableBoundingBoxElement=this.DrawBoundingBox,this.drawer.bottomLineVisible=this.drawBottomLine,this.drawer.skyLineVisible=this.drawSkyLine;let t=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(t=(this.EngravingRules.PageLeftMargin+this.graphic.MusicPages[0].PositionAndShape.Size.width+this.EngravingRules.PageRightMargin)*10*this.zoom);let i,s=32767;for(let r of this.graphic.MusicPages){if(r.PageNumber>this.rules.MaxPageToDrawNumber)break;let n=this.createBackend(this.backendType,r),a=" exceeds CanvasBackend limit of 32767. Cutting off score.";n.getOSMDBackendType()===ni.Canvas&&t>s&&(W.default.warn("[OSMD] Warning: width of "+t+a),t=s),this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?i=t/this.rules.PageFormat.aspectRatio:(i=r.PositionAndShape.Size.height,i+=this.rules.PageBottomMargin,n.getOSMDBackendType()===ni.Canvas&&(i+=.1),i+=r.PositionAndShape.BorderTop,this.rules.RenderTitle&&(i+=this.rules.TitleTopDistance),i*=this.zoom*10),n.getOSMDBackendType()===ni.Canvas&&i>s&&(W.default.warn("[OSMD] Warning: height of "+i+a),i=Math.min(i,s)),n.resize(t,i),n.clear(),n.getContext().setFillStyle(this.rules.DefaultColorMusic),n.getContext().setStrokeStyle(this.rules.DefaultColorMusic),this.drawer.Backends.push(n),this.graphic.drawer=this.drawer}}exportSVG(){for(let t of this.drawer?.Backends)t instanceof dr&&t.export()}IsReadyToRender(){return this.graphic!==void 0}clear(){this.drawer?.clear(),this.reset()}setOptions(t){if(this.rules||(this.rules=new Li),!this.drawingParameters&&!t.drawingParameters?this.drawingParameters=new mr(Ve.default,this.rules):t.drawingParameters&&(this.drawingParameters?this.drawingParameters.DrawingParametersEnum=Ve[t.drawingParameters.toLowerCase()]:this.drawingParameters=new mr(Ve[t.drawingParameters],this.rules)),t==null){W.default.warn(`warning: osmd.setOptions() called without an options parameter, has no effect.
78example usage: osmd.setOptions({drawCredits: false, drawPartNames: false})`);return}this.OnXMLRead=function(r){return r},t.onXMLRead&&(this.OnXMLRead=t.onXMLRead);let i=!this.drawer||!this.drawer.Backends||this.drawer.Backends.length<1;if(t.backend!==void 0){let r=Xr.BackendTypeFromString(t.backend);i=i||this.backendType!==r,this.backendType=r}this.needBackendUpdate=i,t.autoBeam!==void 0&&(this.rules.AutoBeamNotes=t.autoBeam);let s=t.autoBeamOptions;if(s&&(s.maintain_stem_directions===void 0&&(s.maintain_stem_directions=!1),this.rules.AutoBeamOptions=s,s.groups&&s.groups.length)){for(let r of s.groups)if(r.length!==2)throw Error("Eac
78h fraction in autoBeamOptions.groups must be of length 2, e.g. [3,4] for beaming three fourths")}t.percussionOneLineCutoff!==void 0&&(this.rules.PercussionOneLineCutoff=t.percussionOneLineCutoff),this.rules.PercussionOneLineCutoff!==0&&t.percussionForceVoicesOneLineCutoff!==void 0&&(this.rules.PercussionForceVoicesOneLineCutoff=t.percussionForceVoicesOneLineCutoff),t.alignRests!==void 0&&(this.rules.AlignRests=t.alignRests),t.coloringMode!==void 0&&this.setColoringMode(t),t.coloringEnabled!==void 0&&(this.rules.ColoringEnabled=t.coloringEnabled),t.colorStemsLikeNoteheads!==void 0&&(this.rules.ColorStemsLikeNoteheads=t.colorStemsLikeNoteheads),t.disableCursor&&(this.drawingParameters.drawCursors=!1),t.drawHiddenNotes&&(this.drawingParameters.drawHiddenNotes=!0),t.drawCredits!==void 0&&(this.drawingParameters.DrawCredits=t.drawCredits),t.drawComposer!==void 0&&(this.drawingParameters.DrawComposer=t.drawComposer),t.drawTitle!==void 0&&(this.drawingParameters.DrawTitle=t.drawTitle),t.drawSubtitle!==void 0&&(this.drawingParameters.DrawSubtitle=t.drawSubtitle),t.drawLyricist!==void 0&&(this.drawingParameters.DrawLyricist=t.drawLyricist),t.drawMetronomeMarks!==void 0&&(this.rules.MetronomeMarksDrawn=t.drawMetronomeMarks),t.drawPartNames!==void 0&&(this.drawingParameters.DrawPartNames=t.drawPartNames,t.drawPartAbbreviations||(this.rules.RenderPartAbbreviations=t.drawPartNames)),t.drawPartAbbreviations!==void 0&&(this.rules.RenderPartAbbreviations=t.drawPartAbbreviations),t.drawFingerings===!1&&(this.rules.RenderFingerings=!1),t.drawMeasureNumbers!==void 0&&(this.rules.RenderMeasureNumbers=t.drawMeasureNumbers),t.drawMeasureNumbersOnlyAtSystemStart&&(this.rules.RenderMeasureNumbersOnlyAtSystemStart=t.drawMeasureNumbersOnlyAtSystemStart),t.drawLyrics!==void 0&&(this.rules.RenderLyrics=t.drawLyrics),t.drawTimeSignatures!==void 0&&(this.rules.RenderTimeSignatures=t.drawTimeSignatures),t.drawSlurs!==void 0&&(this.rules.RenderSlurs=t.drawSlurs),t.measureNumberInterval!==void 0&&(this.rules.MeasureNumberLabelOffset=t.measureNumberInterval),t.useXMLMeasureNumbers!==void 0&&(this.rules.UseXMLMeasureNumbers=t.useXMLMeasureNumbers),t.fingeringPosition!==void 0&&(this.rules.FingeringPosition=Pi.PlacementEnumFromString(t.fingeringPosition)),t.fingeringInsideStafflines!==void 0&&(this.rules.FingeringInsideStafflines=t.fingeringInsideStafflines),t.newSystemFromXML!==void 0&&(this.rules.NewSystemAtXMLNewSystemAttribute=t.newSystemFromXML),t.newSystemFromNewPageInXML!==void 0&&(this.rules.NewSystemAtXMLNewPageAttribute=t.newSystemFromNewPageInXML),t.newPageFromXML!==void 0&&(this.rules.NewPageAtXMLNewPageAttribute=t.newPageFromXML),t.fillEmptyMeasuresWithWholeRest!==void 0&&(this.rules.FillEmptyMeasuresWithWholeRest=t.fillEmptyMeasuresWithWholeRest),t.followCursor!==void 0&&(this.FollowCursor=t.followCursor),t.setWantedStemDirectionByXml!==void 0&&(this.rules.SetWantedStemDirectionByXml=t.setWantedStemDirectionByXml),t.darkMode?(this.rules.applyDefaultColorMusic("#FFFFFF"),this.rules.PageBackgroundColor="#000000",this.rules.DarkModeEnabled=!0):t.darkMode===!1&&(this.rules.applyDefaultColorMusic("#000000"),this.rules.PageBackgroundColor=void 0,this.rules.DarkModeEnabled=!1),t.defaultColorMusic&&this.rules.applyDefaultColorMusic(t.defaultColorMusic),t.defaultColorNotehead&&(this.rules.DefaultColorNotehead=t.defaultColorNotehead),t.defaultColorRest&&(this.rules.DefaultColorRest=t.defaultColorRest),t.defaultColorStem&&(this.rules.DefaultColorStem=t.defaultColorStem),t.defaultColorLabel&&(this.rules.DefaultColorLabel=t.defaultColorLabel),t.defaultColorTitle&&(this.rules.DefaultColorTitle=t.defaultColorTitle),t.defaultFontFamily&&(this.rules.DefaultFontFamily=t.defaultFontFamily),t.defaultFontStyle&&(this.rules.DefaultFontStyle=t.defaultFontStyle),t.drawUpToMeasureNumber>=0&&(this.rules.MaxMeasureToDrawIndex=Math.max(t.drawUpToMeasureNumber-1,0),this.rules.MaxMeasureToDrawNumber=t.drawUpToMeasureNumber),t.drawFromMeasureNumber>=0&&(this.rules.MinMeasureToDrawIndex=Math.max(t.drawFromMeasureNumber-1,0),this.rules.MinMeasureToDrawNumber=t.drawFromMeasureNumber),t.drawUpToPageNumber&&(this.rules.MaxPageToDrawNumber=t.drawUpToPageNumber),t.drawUpToSystemNumber&&(this.rules.MaxSystemToDrawNumber=t.drawUpToSystemNumber),t.tupletsRatioed&&(this.rules.TupletsRatioed=!0),t.tupletsBracketed&&(this.rules.TupletsBracketed=!0),t.tripletsBracketed&&(this.rules.TripletsBracketed=!0),t.autoResize?(this.resizeHandlerAttached||this.autoResize(),this.autoResizeEnabled=!0):t.autoResize===!1&&(this.autoResizeEnabled=!1),t.pageFormat!==void 0&&this.setPageFormat(t.pageFormat),t.pageBackgroun
78dColor!==void 0&&(this.rules.PageBackgroundColor=t.pageBackgroundColor),t.renderSingleHorizontalStaffline!==void 0&&(this.rules.RenderSingleHorizontalStaffline=t.renderSingleHorizontalStaffline),t.spacingFactorSoftmax!==void 0&&(this.rules.SoftmaxFactorVexFlow=t.spacingFactorSoftmax),t.spacingBetweenTextLines!==void 0&&(this.rules.SpacingBetweenTextLines=t.spacingBetweenTextLines),t.stretchLastSystemLine!==void 0&&(this.rules.StretchLastSystemLine=t.stretchLastSystemLine),t.autoGenerateMultipleRestMeasuresFromRestMeasures!==void 0&&(this.rules.AutoGenerateMultipleRestMeasuresFromRestMeasures=t.autoGenerateMultipleRestMeasuresFromRestMeasures),t.cursorsOptions===void 0?this.cursorsOptions=[{type:ri.Standard,color:this.EngravingRules.DefaultColorCursor,alpha:.5,follow:!0}]:this.cursorsOptions=t.cursorsOptions,t.preferredSkyBottomLineBatchCalculatorBackend!==void 0&&(this.rules.PreferredSkyBottomLineBatchCalculatorBackend=t.preferredSkyBottomLineBatchCalculatorBackend),t.skyBottomLineBatchMinMeasures!==void 0&&(this.rules.SkyBottomLineBatchMinMeasures=t.skyBottomLineBatchMinMeasures)}setColoringMode(t){if(t.coloringMode===bi.XML){this.rules.ColoringMode=bi.XML;return}let i=[ut.C,ut.D,ut.E,ut.F,ut.G,ut.A,ut.B],s;if(t.coloringMode===bi.CustomColorSet){if(!t.coloringSetCustom||t.coloringSetCustom.length!==8)throw Error("Invalid amount of colors: With coloringModes.customColorSet, you have to provide a coloringSetCustom parameter (array) with 8 strings (C to B, rest note).");for(let n of t.coloringSetCustom)if(!/^\#[0-9a-fA-F]{6}$/.test(n))throw Error(`One of the color strings in options.coloringSetCustom was not a valid HTML Hex color:
79`+n);s=t.coloringSetCustom}else if(t.coloringMode===bi.AutoColoring){s=[];let n=Object.keys(Yr);for(let a=0;a<n.length;a++)s.push(Yr[n[a]])}let r=new We.Dictionary;for(let n=0;n<i.length;n++)r.setValue(i[n],s[n]);r.setValue(-1,s.last()),this.rules.ColoringSetCurrent=r,this.rules.ColoringMode=t.coloringMode}setLogLevel(t){switch(t){case"trace":W.default.setLevel(W.default.levels.TRACE);break;case"debug":W.default.setLevel(W.default.levels.DEBUG);break;case"info":W.default.setLevel(W.default.levels.INFO);break;case"warn":W.default.setLevel(W.default.levels.WARN);break;case"error":W.default.setLevel(W.default.levels.ERROR);break;case"silent":W.default.setLevel(W.default.levels.SILENT);break;default:W.default.warn(`Could not set log level to ${t}. Using warn instead.`),W.default.setLevel(W.default.levels.WARN);break}}getLogLevel(){return W.default.getLevel()}reset(){this.drawingParameters.drawCursors&&this.cursors.forEach(t=>{t.hide()}),this.sheet=void 0,this.graphic=void 0,this.zoom=1,this.rules.RenderCount=0}autoResize(){let t=this;this.handleResize(()=>{},()=>{this.graphic?.GetCalculator instanceof ys&&(this.graphic.GetCalculator.beamsNeedUpdate=!0),t.IsReadyToRender()&&t.renderAndScrollBack()})}renderAndScrollBack(){let t=window.scrollY/document.body.scrollHeight;this.render();let i=document.body.scrollHeight*t;window.scrollTo({top:i,behavior:"instant"})}handleResize(t,i){let s,r,n=this;function a(){n.AutoResizeEnabled&&(s=new Date().getTime(),r||(t(),s=new Date().getTime(),r=window.setTimeout(o,200)))}function o(){r=void 0,window.clearTimeout(r),new Date().getTime()-s<200?r=window.setTimeout(o,200):i()}window.attachEvent?window.attachEvent("onresize",a):window.addEventListener("resize",a),this.resizeHandlerAttached=!0,window.setTimeout(t,0),window.setTimeout(i,1)}enableOrDisableCursors(t){if(this.drawingParameters.drawCursors=t,t)for(let i=0;i<this.cursorsOptions.length;i++){let s=this.cursors[i]?.Hidden??!0,r=this.cursors[i]?.Iterator;this.cursors[i]?.hide();let n=this.drawer?.Backends[0];if(n&&this.rules.RestoreCursorAfterRerender&&this.cursors[i]){let a=this.cursors[i].updateCurrentPage();n=this.drawer.Backends[a-1]}n&&n.getRenderElement()&&(this.cursors[i]=new Ja(n.getRenderElement(),this,this.cursorsOptions[i])),this.sheet&&this.graphic&&this.cursors[i]&&this.cursors[i].init(this.sheet.MusicPartManager,this.graphic),this.rules.RestoreCursorAfterRerender&&(this.cursors[i].hidden=s,r&&(this.cursors[i].iterator=r,this.cursors[i].update()))}
79else this.cursors.forEach(i=>{i.hide()})}createBackend(t,i){let s;return s=t===void 0||t===ni.SVG?new dr(this.rules):new Pr(this.rules),s.graphicalMusicPage=i,s.initialize(this.container,this.zoom),s}static StringToPageFormat(t){let i=Te.UndefinedPageFormat;if(t.match("^[0-9]+x[0-9]+$")){let s=t.split("x"),r=Number.parseInt(s[0],10),n=Number.parseInt(s[1],10);r>0&&r<32768&&n>0&&n<32768&&(i=new Te(r,n,`customPageFormat${t}`))}return t=t.replace(" ","_"),t=t.replace("Landscape","L"),t=t.replace("Portrait","P"),tr.PageFormatStandards.hasOwnProperty(t)&&(i=tr.PageFormatStandards[t]),i}setPageFormat(t){let i=tr.StringToPageFormat(t);this.needBackendUpdate=!i.Equals(this.rules.PageFormat),this.rules.PageFormat=i}setCustomPageFormat(t,i){if(t>0&&i>0){let s=new Te(t,i);this.rules.PageFormat=s}}set DrawSkyLine(t){this.drawSkyLine=t,this.drawer&&(this.drawer.skyLineVisible=t)}get DrawSkyLine(){return this.drawer.skyLineVisible}set DrawBottomLine(t){this.drawBottomLine=t,this.drawer&&(this.drawer.bottomLineVisible=t)}get DrawBottomLine(){return this.drawer.bottomLineVisible}set DrawBoundingBox(t){this.setDrawBoundingBox(t,!0)}get DrawBoundingBox(){return this.drawBoundingBox}setDrawBoundingBox(t,i=!1){this.drawBoundingBox=t,this.drawer&&(this.drawer.drawableBoundingBoxElement=t),i&&this.renderAndScrollBack()}get AutoResizeEnabled(){return this.autoResizeEnabled}set AutoResizeEnabled(t){this.autoResizeEnabled=t}get Zoom(){return this.zoom}set Zoom(t){this.zoom=t,this.zoomUpdated=!0,this.graphic?.GetCalculator instanceof ys&&(this.graphic.GetCalculator.beamsNeedUpdate=this.zoomUpdated)}set FollowCursor(t){this.followCursor=t}get FollowCursor(){return this.followCursor}set TransposeCalculator(t){Xt.transposeCalculator=t}get TransposeCalculator(){return Xt.transposeCalculator}get Sheet(){return this.sheet}get Drawer(){return this.drawer}get GraphicSheet(){return this.graphic}get DrawingParameters(){return this.drawingParameters}get EngravingRules(){return this.rules}get Version(){return this.version}};ja=jl,ja.PageFormatStandards={A3_L:new Te(420,297,"A3_L"),A3_P:new Te(297,420,"A3_P"),A4_L:new Te(297,210,"A4_L"),A4_P:new Te(210,297,"A4_P"),A5_L:new Te(210,148,"A5_L"),A5_P:new Te(148,210,"A5_P"),A6_L:new Te(148,105,"A6_L"),A6_P:new Te(105,148,"A6_P"),Endless:Te.UndefinedPageFormat,Letter_L:new Te(279.4,215.9,"Letter_L"),Letter_P:new Te(215.9,279.4,"Letter_P")};var tc=class Kl{static log(t,i){return Math.log(i)/Math.log(t)}static log10(t){return Kl.log(10,t)}static meanSimple(t){let i=0;for(let s=0;s<t.length;s++)i+=t[s];return i/t.length}static meanWeighted(t,i){if(t.length!==i.length||t.length===0)return 0;let s=0,r=0;for(let n=0;n<t.length;n++){let a=i[n];s+=t[n]*a,r+=a}return s/r}},ec=class je{constructor(t,i,s){this.alpha=255,this.red=t,this.green=i,this.blue=s}static get Black(){return new je(0,0,0)}static get DeepSkyBlue(){return new je(0,191,255)}static get Green(){return new je(20,160,20)}static get Magenta(){return new je(255,0,255)}static get Orange(){return new je(255,128,0)}static get Red(){return new je(240,20,20)}static get Disabled(){return new je(225,225,225)}static get DarkBlue(){return new je(0,0,140)}static get Debug1(){return new je(200,0,140)}static get Debug2(){return new je(100,100,200)}static get Debug3(){return new je(0,50,140)}toString(){return"rgb("+this.red+","+this.green+","+this.blue+","+this.alpha+")"}},Hr,ql=class si{transposePitch(t,i,s){if(s===0)return t;let r=ut.C,n=0,a=q.NONE,o=Ct.CalculateTransposedHalfTone(t,s),l=o.halftone,h=o.overflow;for(let u=0;u<si.noteEnums.length;u++){let c=si.noteEnums[u];if(c===l){let d=u;return r=si.noteEnums[d],n=t.Octave+h,a=q.NONE,new Ct(r,n,a)}else if(c>l)break}for(let u=0;u<si.noteEnums.length;u++)if(si.noteEnums[u]>l){let c=u,d=Ct.HalfTonesFromAccidental(t.Accidental),f=d>0,p=d<0,m=i.Key>0,g=i.Key<0,b=!0;for(m?b=!0:g?b=!1:(f||p)&&(b=f),b&&c--;c<0;)c+=7,l+=12,h--;for(;c>=7;)c-=7,l-=12,h++;r=si.noteEnums[c],a=Ct.AccidentalFromHalfTones(l-r),n=t.Octave+h;break}return new Ct(r,n,a)}transposeKey(t,i){let s=0,r=0,n=t.keyTypeOriginal;if(i%12==0){t.Key=t.keyTypeOriginal,t.isTransposedBy=i;return}for(n>6?n-=12:n<-6&&(n+=12);s<si.keyMapping.length&&(r=si.keyMapping[s],r!==n);s++);let a=s+i;for(;a>=12;)a-=12;
79for(;a<0;)a+=12;t.Key=si.keyMapping[a],t.isTransposedBy=i}};Hr=ql,Hr.keyMapping=[0,-5,2,-3,4,-1,6,1,-4,3,-2,5],Hr.noteEnums=[ut.C,ut.D,ut.E,ut.F,ut.G,ut.A,ut.B];export{sc as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.