diff --git a/demo/data/rast-tetrachord.musicxml b/demo/data/rast-tetrachord.musicxml
index 0669d88..64a18f6 100644
--- a/demo/data/rast-tetrachord.musicxml
+++ b/demo/data/rast-tetrachord.musicxml
@@ -3,111 +3,263 @@
>>7)]}function w(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255;}function P(t,e,i){t.bi_valid>16-i?(t.bi_buf|=e<>=7;s>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(g[i]+r+1)]++,t.dyn_dtree[2*M(e)]++),t.last_lit===t.lit_bufsize-1},i._tr_align=function(t){P(t,2,3),T(t,256,f),function(t){16===t.bi_valid?(w(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8);}(t);};},{"../utils/common":41}],53:[function(t,e,i){e.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(t,e,s){(function(t){!function(t,e){if(!t.setImmediate){var i,s,n,r,o=1,a={},l=!1,h=t.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(t);c=c&&c.setTimeout?c:t,i="[object process]"==={}.toString.call(t.process)?function(t){browser$1.nextTick((function(){d(t);}));}:function(){if(t.postMessage&&!t.importScripts){var e=!0,i=t.onmessage;return t.onmessage=function(){e=!1;},t.postMessage("","*"),t.onmessage=i,e}}()?(r="setImmediate$"+Math.random()+"$",t.addEventListener?t.addEventListener("message",f,!1):t.attachEvent("onmessage",f),function(e){t.postMessage(r+e,"*");}):t.MessageChannel?((n=new MessageChannel).port1.onmessage=function(t){d(t.data);},function(t){n.port2.postMessage(t);}):h&&"onreadystatechange"in h.createElement("script")?(s=h.documentElement,function(t){var e=h.createElement("script");e.onreadystatechange=function(){d(t),e.onreadystatechange=null,s.removeChild(e),e=null;},s.appendChild(e);}):function(t){setTimeout(d,0,t);},c.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),s=0;s1}isVisible(){return this.ParentStaff.ParentInstrument.Visible}getGraphicalMeasureDurationFromStaffEntries(){let t=new n.Fraction(0,1);const e=[];for(let t=0,i=this.staffEntries.length;t0&&r.Add(e.notes[0].graphicalNoteLength);t.lt(r)&&(t=n.Fraction.createFromFraction(r));}return t}addGraphicalStaffEntry(t){this.staffEntries.push(t);}addGraphicalStaffEntryAtTimestamp(t){if(t)if(0===this.staffEntries.length||this.staffEntries[this.staffEntries.length-1].relInMeasureTimestamp.lt(t.relInMeasureTimestamp))this.staffEntries.push(t);else for(let e=this.staffEntries.length-1;e>=0;e--){if(this.staffEntries[e].relInMeasureTimestamp.lt(t.relInMeasureTimestamp)){this.staffEntries.splice(e+1,0,t);break}0===e&&this.staffEntries.splice(e,0,t);}}isPianoRightHand(){return this.isUpperStaffOfInstrument()}isPianoLeftHand(){return this.isLowerStaffOfInstrument()}isUpperStaffOfInstrument(){return 1===this.parentStaff.ParentInstrument.Staves.length||this.ParentStaff===this.parentStaff.ParentInstrument.Staves[0]}isLowerStaffOfInstrument(){return 1!==this.parentStaff.ParentInstrument.Staves.length&&this.ParentStaff===this.ParentStaff.ParentInstrument.Staves.last()}beginsWithLineRepetition(){const t=this.parentSourceMeasure;return !!t&&t.beginsWithLineRepetition()}endsWithLineRepetition(){const t=this.parentSourceMeasure;return !!t&&t.endsWithLineRepetition()}beginsWithWordRepetition(){const t=this.parentSourceMeasure;return !!t&&t.beginsWithWordRepetition()}endsWithWordRepetition(){const t=this.parentSourceMeasure;return !!t&&t.endsWithWordRepetition()}getTransposedHalftones(){return this.parentStaff.ParentInstrument.GetMusicSheet.Transpose+this.parentStaff.ParentInstrument.Transpose}}e.GraphicalMeasure=a;},599:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PagePlacementEnum=e.GraphicalMusicPage=void 0;const s=i(8911),n=i(4785),r=i(9086);class o extends n.GraphicalObject{constructor(t){super(),this.musicSystems=[],this.labels=[],this.parent=t,this.boundingBox=new s.BoundingBox(this,void 0);}get MusicSystems(){return this.musicSystems}set MusicSystems(t){this.musicSystems=t;}get Labels(){return this.labels}set Labels(t){this.labels=t;}get Parent(){return this.parent}set Parent(t){this.parent=t;}get PageNumber(){return this.pageNumber}set PageNumber(t){this.pageNumber=t;}setMusicPageAbsolutePosition(t,e){return new r.PointF2D(0,0)}}var a;e.GraphicalMusicPage=o,(a=e.PagePlacementEnum||(e.PagePlacementEnum={}))[a.Down=0]="Down",a[a.Right=1]="Right",a[a.RightDown=2]="RightDown";},4324:function(t,e,i){var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.SystemImageProperties=e.GraphicalMusicSheet=void 0;const n=i(525),r=i(6729),o=i(9086),a=i(289),l=i(5198),h=i(1797),c=i(8911),u=s(i(2043)),d=i(2337),f=i(5974),m=i(4785);e.GraphicalMusicSheet=class{constructor(t,e){this.musicPages=[],this.measureList=[],this.verticalGraphicalStaffEntryContainers=[],this.cursors=[],this.leadSheet=!1,this.musicSheet=t,this.numberOfStaves=this.musicSheet.Staves.length,this.calculator=e,this.calculator.initialize(this);}get ParentMusicSheet(){return this.musicSheet}get GetCalculator(){return this.calculator}get MusicPages(){return this.musicPages}set MusicPages(t){this.musicPages=t;}get MeasureList(){return this.measureList}set MeasureList(t){this.measureList=t;}get VerticalGraphicalStaffEntryContainers(){return this.verticalGraphicalStaffEntryContainers}set VerticalGraphicalStaffEntryContainers(t){this.verticalGraphicalStaffEntryContainers=t;}get Title(){return this.title}set Title(t){this.title=t;}get Subtitle(){return this.subtitle}set Subtitle(t){this.subtitle=t;}get Composer(){return this.composer}set Composer(t){this.composer=t;}get Lyricist(){return this.lyricist}set Lyricist(t){this.lyricist=t;}get Copyright(){return this.copyright}set Copyright(t){this.copyright=t;}get Cursors(){return this.cursors}get SelectionStartSymbol(){return this.selectionStartSymbol}get SelectionEndSymbol(){return this.selectionEndSymbol}get MinAllowedSystemWidth(){return this.minAllowedSystemWidth}set MinAllowedSystemWidth(t){this.minAllowedSystemWidth=t;}get NumberOfStaves(){return this.numberOfStaves}get LeadSheet(){return this.leadSheet}set LeadSheet(t){this.leadSheet=t;}static transformRelativeToAbsolutePosition(t){for(let e=0;e=0;e--){if(this.verticalGraphicalStaffEntryContainers[e].AbsoluteTimestamp.lt(t)){const i=new n.VerticalGraphicalStaffEntryContainer(this.numberOfStaves,t);return this.verticalGraphicalStaffEntryContainers.splice(e+1,0,i),i}if(this.verticalGraphicalStaffEntryContainers[e].AbsoluteTimestamp.Equals(t))return this.verticalGraphicalStaffEntryContainers[e]}}GetVerticalContainerFromTimestamp(t,e=0){const i=d.CollectionUtil.binarySearch(this.verticalGraphicalStaffEntryContainers,new n.VerticalGraphicalStaffEntryContainer(0,t),n.VerticalGraphicalStaffEntryContainer.compareByTimestamp,e);if(i>=0)return this.verticalGraphicalStaffEntryContainers[i]}GetInterpolatedIndexInVerticalContainers(t){const e=this.verticalGraphicalStaffEntryContainers;let i,s,n=0,r=e.length-1;if(t.lte(e[e.length-1].AbsoluteTimestamp)){for(;r-n>1;){const i=Math.floor((r+n)/2);if(e[n].AbsoluteTimestamp.Equals(t)){r=n;break}if(e[r].AbsoluteTimestamp.Equals(t)){n=r;break}if(e[i].AbsoluteTimestamp.Equals(t))return this.verticalGraphicalStaffEntryContainers.indexOf(e[i]);t.lt(e[i].AbsoluteTimestamp)?r=i:n=i;}if(n===r)return this.verticalGraphicalStaffEntryContainers.indexOf(e[n]);i=e[n].AbsoluteTimestamp,s=e[r].AbsoluteTimestamp;}else i=e[e.length-1].AbsoluteTimestamp,s=h.Fraction.plus(this.getLongestStaffEntryDuration(e.length-1),i),r=e.length;const o=s.RealValue-i.RealValue,a=r-(s.RealValue-t.RealValue)/o;return Math.min(a,this.verticalGraphicalStaffEntryContainers.length)}getVisibleStavesIndicesFromSourceMeasure(t){const e=[],i=[];for(let i=0,s=t.length;i{var e;return void 0!==(null===(e=t.parentStaffEntry)||void 0===e?void 0:e.relInMeasureTimestamp)}))}GetNearestNote(t,e){const i=this.GetNearestVoiceEntry(t);if(!i)return;let s,n=Number.MAX_SAFE_INTEGER;for(const e of i.notes){const i=e.PositionAndShape.AbsolutePosition.y,r=Math.abs(e.PositionAndShape.AbsolutePosition.x-t.x),o=Math.abs(i-t.y);r+o=0;t--)if(i=this.getStaffEntry(t),i){if(!e)return i;if(i.sourceStaffEntry.ParentStaff.ParentInstrument.Visible)return i}}findClosestRightStaffEntry(t,e){let i;for(let s=Math.max(0,Math.ceil(t));s0&&this.rules.RenderMultipleRestMeasures){a.isReducedToMultiRest=!0,a.multipleRestMeasureNumber=1;const i=a.multipleRestMeasures-1;r+=i;for(let s=1;s<=i;s++){const i=t.SourceMeasures.indexOf(a)+s;if(i>=t.SourceMeasures.length)break;const n=t.SourceMeasures[i];n.multipleRestMeasureNumber=s+1,n.isReducedToMultiRest=!0,e.push([void 0]);}}}if(this.rules.AutoGenerateMultipleRestMeasuresFromRestMeasures&&this.rules.RenderMultipleRestMeasures){let r,a=0;for(let l=0,h=t.SourceMeasures.length;l-50){let t=l/10;t+=this.rules.PlaceWordsInsideStafflineYOffset,u.PositionAndShape.RelativePosition.y=t;}const d=new N.GraphicalUnknownExpression(s,u,c,null===(n=o[i])||void 0===n?void 0:n.parentSourceMeasure,t);s.AbstractExpressions.push(d);}}clearRecreatedObjects(){for(let t=0,e=this.staffEntriesWithGraphicalTies.length;t0)&&(i=t.getSkyLineMinInRange(a,l));let h=0;0===s?(h+=this.rules.ChordSymbolYOffset,h+=.1):h+=this.rules.ChordSymbolYPadding,h*=-1;const c=n.GraphicalLabel;c.PositionAndShape.RelativePosition.y=i+h,c.setLabelPositionAndShapeBorders(),c.PositionAndShape.calculateBoundingBox(),t.updateSkyLineInRange(a,l,i+c.PositionAndShape.BorderMarginTop);}}}}calculateAlignedChordSymbolsOffset(t,e){let i=Number.MAX_SAFE_INTEGER;for(const s of t)for(const t of s.graphicalChordContainers){const n=s.PositionAndShape,r=t.PositionAndShape,o=r.BorderMarginLeft+n.AbsolutePosition.x,a=r.BorderMarginRight+n.AbsolutePosition.x;i=Math.min(i,e.getSkyLineMinInRange(o,a));}return i}layoutMeasureWithWholeRest(t,e,i){}layoutBeams(t){}layoutArticulationMarks(t,e,i){}layoutOrnament(t,e,i){}calculateRestNotePlacementWithinGraphicalBeam(t,e,i,s,n){}calculateTupletNumbers(){if(!this.rules.TupletNumberLimitConsecutiveRepetitions)return;let t,e,i,s=-1,n=0;const r={};for(const o of this.graphicalMusicSheet.ParentMusicSheet.Instruments)for(const a of o.Voices){n=0,r[a.VoiceId]={};for(const o of a.VoiceEntries)if(o.Notes.length>0){const l=o.Notes[0];if(!l.NoteTuplet||l.NoteTuplet.shouldBeBracketed(this.rules.TupletsBracketedUseXMLValue,this.rules.TupletsBracketed,this.rules.TripletsBracketed)){s=-1,n=0,e=void 0,t=void 0;continue}if(l.NoteTuplet===i)continue;let h=l.TypeLength;if(h||(v.default.warn("note missing TypeLength"),h=l.NoteTuplet.Fractions[0]),l.NoteTuplet!==e&&r[a.VoiceId][l.NoteTuplet.TupletLabelNumber]&&r[a.VoiceId][l.NoteTuplet.TupletLabelNumber][h.RealValue]){l.NoteTuplet.RenderTupletNumber=!1,i=l.NoteTuplet;continue}l.NoteTuplet.TupletLabelNumber===s&&h.Equals(t)&&!l.NoteTuplet.Bracket||(s=l.NoteTuplet.TupletLabelNumber,t=h,n=0),e=l.NoteTuplet,n++,n<=this.rules.TupletNumberMaxConsecutiveRepetitions&&(l.NoteTuplet.RenderTupletNumber=!0),n>this.rules.TupletNumberMaxConsecutiveRepetitions&&(l.NoteTuplet.RenderTupletNumber=!1,this.rules.TupletNumberAlwaysDisableAfterFirstMax&&(r[a.VoiceId][s]||(r[a.VoiceId][s]={}),r[a.VoiceId][s][h.RealValue]=!0)),i=e;}}}calculateSlurs(){}calculateGlissandi(){}calculateDynamicExpressionsForMultiExpression(t,e,i){}calculateGraphicalVerbalContinuousDynamic(t,e){const i=t.Label,s=e.x+i.PositionAndShape.BorderMarginLeft,n=e.x+i.PositionAndShape.BorderMarginRight,r=t.ContinuousDynamic.Placement,o=t.ParentStaffLine.SkyBottomLineCalculator;let a;r===P.PlacementEnum.Below?(a=o.getBottomLineMaxInRange(s,n),i.PositionAndShape.RelativePosition=new u.PointF2D(e.x,a-i.PositionAndShape.BorderMarginTop)):(a=o.getSkyLineMinInRange(s,n),i.PositionAndShape.RelativePosition=new u.PointF2D(e.x,a-i.PositionAndShape.BorderMarginBottom));}calculateGraphicalContinuousDynamic(t,e){var i;const s=t.IsSoftAccent,n=t.ParentStaffLine.ParentStaff.idInMusicSheet,o=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(t.ContinuousDynamic.EndMultiExpression.SourceMeasureParent,n);if(!o)return void v.default.warn("MusicSheetCalculator.calculateGraphicalContinuousDynamic: No endMeasure found");t.EndMeasure=o;const a=t.ParentStaffLine,l=o.ParentStaffLine,h=l&&a===l;let c=!1;l?c=null==l?void 0:l.isPartOfMultiStaffInstrument():a&&(c=null==a?void 0:a.isPartOfMultiStaffInstrument());const u=r.Fraction.createFromFraction(t.ContinuousDynamic.EndMultiExpression.AbsoluteTimestamp),d=this.graphicalMusicSheet.GetVerticalContainerFromTimestamp(u),f=d.getFirstNonNullStaffEntry().parentMeasure,m=f.PositionAndShape.AbsolutePosition.x+f.PositionAndShape.BorderRight;let p=new r.Fraction(0,0,0);for(const t of d.StaffEntries){const e=null===(i=null==t?void 0:t.sourceStaffEntry)||void 0===i?void 0:i.calculateMaxNoteLength(!1);(null==e?void 0:e.gt(p))&&(p=e);}const g=!s&&t.ContinuousDynamic.DynamicType===C.ContDynamicEnum.diminuendo,b=this.getRelativePositionInStaffLineFromTimestamp(u,n,l,c,0,g),S=r.Fraction.plus(u,p),y=this.getRelativePositionInStaffLineFromTimestamp(S,n,l,c,0,t.ContinuousDynamic.DynamicType===C.ContDynamicEnum.diminuendo),E=this.rules.SoftAccentWedgePadding,x=d.getFirstNonNullStaffEntry().PositionAndShape.Size.width,_=this.rules.SoftAccentSizeFactor;s?(e.x-=x/2*_+E,b.x=e.x+x/2*_):y.x>b.x&&y.x1){r=!0;break}let o=0;for(let e=0;et));}setBottomLineWithValue(t){this.BottomLine.forEach((e=>t));}getLeftIndexForPointX(t,e){const i=Math.floor(t*this.SamplingUnit);return i<0?0:i>=e?e-1:i}getRightIndexForPointX(t,e){const i=Math.ceil(t*this.SamplingUnit);return i<0?0:i>=e?e-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((t=>!isNaN(t))))}getSkyLineMinAtPoint(t){const e=Math.round(t*this.SamplingUnit);return this.mSkyLine[e]}getSkyLineMinInRange(t,e){return this.getMinInRange(this.SkyLine,t,e)}getBottomLineMax(){return Math.max(...this.BottomLine.filter((t=>!isNaN(t))))}getBottomLineMaxAtPoint(t){const e=Math.round(t*this.SamplingUnit);return this.mBottomLine[e]}getBottomLineMaxInRange(t,e){return this.getMaxInRange(this.BottomLine,t,e)}getBottomLineMaxInBoundingBox(t){const e=Math.floor(t.AbsolutePosition.x+t.BorderLeft),i=Math.ceil(t.AbsolutePosition.x+t.BorderRight);return this.getMaxInRange(this.mBottomLine,e,i)}updateWithBoundingBoxRecursively(t){if(t.ChildElements&&t.ChildElements.length>0)this.updateWithBoundingBoxRecursively(t);else {const e=t.BorderTop+t.AbsolutePosition.y,i=t.BorderBottom+t.AbsolutePosition.y;if(e<0){const i=Math.floor(t.AbsolutePosition.x+t.BorderLeft),s=Math.ceil(t.AbsolutePosition.x+t.BorderRight);this.updateInRange(this.mSkyLine,i,s,e);}else if(i>this.StaffLineParent.StaffHeight){const e=Math.floor(t.AbsolutePosition.x+t.BorderLeft),s=Math.ceil(t.AbsolutePosition.x+t.BorderRight);this.updateInRange(this.mBottomLine,e,s,i);}}}findPreviousValidNumber(t,e){for(let i=t;i>=0;i--)if(!isNaN(e[i]))return e[i];return 0}findNextValidNumber(t,e){if(t>=e.length)return e[t-1];for(let i=t;i{Object.defineProperty(e,"__esModule",{value:!0}),e.StaffLineActivitySymbol=void 0;const s=i(4785),n=i(8911);class r extends s.GraphicalObject{constructor(t){super(),this.parentStaffLine=t;const e=t.PositionAndShape;this.boundingBox=new n.BoundingBox(this,e),this.boundingBox.BorderRight=6,this.boundingBox.BorderBottom=4.5,this.boundingBox.BorderLeft=-1.5,this.boundingBox.BorderTop=-1.5;}}e.StaffLineActivitySymbol=r;},7771:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SystemLine=void 0;const s=i(6894),n=i(8911),r=i(4785);class o extends r.GraphicalObject{constructor(t,e,i,s,r){super(),this.lineType=t,this.linePosition=e,this.parentMusicSystem=i,this.topMeasure=s,this.bottomMeasure=r,this.parentTopStaffLine=null==s?void 0:s.ParentStaffLine,this.boundingBox=new n.BoundingBox(this,i.PositionAndShape);}static getObjectWidthForLineType(t,e){switch(e){case s.SystemLinesEnum.SingleThin:return t.SystemThinLineWidth;case s.SystemLinesEnum.DoubleThin:return 2*t.SystemThinLineWidth+t.DistanceBetweenVerticalSystemLines;case s.SystemLinesEnum.ThinBold:return t.SystemThinLineWidth+t.SystemBoldLineWidth+t.DistanceBetweenVerticalSystemLines;case s.SystemLinesEnum.BoldThinDots:case s.SystemLinesEnum.DotsThinBold:return t.SystemThinLineWidth+t.SystemBoldLineWidth+t.DistanceBetweenVerticalSystemLines+t.SystemDotWidth+t.DistanceBetweenDotAndLine;case s.SystemLinesEnum.DotsBoldBoldDots:return 2*t.SystemBoldLineWidth+2*t.SystemDotWidth+2*t.DistanceBetweenDotAndLine+t.DistanceBetweenVerticalSystemLines;default:return 0}}}e.SystemLine=o;},1225:(t,e)=>{var i;Object.defineProperty(e,"__esModule",{value:!0}),e.SystemLinePosition=void 0,(i=e.SystemLinePosition||(e.SystemLinePosition={}))[i.MeasureBegin=0]="MeasureBegin",i[i.MeasureEnd=1]="MeasureEnd";},6894:(t,e)=>{var i;Object.defineProperty(e,"__esModule",{value:!0}),e.SystemLinesEnumHelper=e.SystemLinesEnum=void 0,function(t){t[t.SingleThin=0]="SingleThin",t[t.DoubleThin=1]="DoubleThin",t[t.ThinBold=2]="ThinBold",t[t.BoldThinDots=3]="BoldThinDots",t[t.DotsThinBold=4]="DotsThinBold",t[t.DotsBoldBoldDots=5]="DotsBoldBoldDots",t[t.None=6]="None",t[t.Dotted=7]="Dotted",t[t.Dashed=8]="Dashed",t[t.Bold=9]="Bold",t[t.BoldThin=10]="BoldThin",t[t.DoubleBold=11]="DoubleBold",t[t.Tick=12]="Tick",t[t.Short=13]="Short";}(i=e.SystemLinesEnum||(e.SystemLinesEnum={})),e.SystemLinesEnumHelper=class{static xmlBarlineStyleToSystemLinesEnum(t){return "regular"===t?i.SingleThin:"dotted"===t?i.Dotted:"dashed"===t?i.Dashed:"heavy"===t?i.Bold:"light-light"===t?i.DoubleThin:"light-heavy"===t?i.ThinBold:"heavy-light"===t?i.BoldThin:"heavy-heavy"===t?i.DoubleBold:"tick"===t?i.Tick:"short"===t?i.Short:"none"===t?i.None:i.SingleThin}};},525:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VerticalGraphicalStaffEntryContainer=void 0,e.VerticalGraphicalStaffEntryContainer=class{constructor(t,e){this.staffEntries=[],this.absoluteTimestamp=e,this.staffEntries=new Array(t);}get Index(){return this.index}set Index(t){this.index=t;}get AbsoluteTimestamp(){return this.absoluteTimestamp}get StaffEntries(){return this.staffEntries}set StaffEntries(t){this.staffEntries=t;}static compareByTimestamp(t,e){const i=t.absoluteTimestamp.RealValue,s=e.absoluteTimestamp.RealValue;return is?1:0}getFirstNonNullStaffEntry(){for(let t=0,e=this.staffEntries.length;t0){let e=3;const i=t.Clef();switch(i.ClefType){case r.ClefEnum.F:e=5;break;case r.ClefEnum.C:e=4;}T=o.Pitch.fromHalftone(s),S=[M.pitch(T,!0,i,void 0,e)[0]];}}break}const n=t.vfpitch;S.push(n[0]),y.push(n[1]),w||(w=M.Clef(n[2]).type);}for(let t=0,e=A;t0){const t=e[0].elements("rights");if(t.length>0)for(let e=0,i=t.length;en){if(!this.musicSheet.Title){const e=null===(s=t.attribute("font-size"))||void 0===s?void 0:s.value;if(e){const i=parseFloat(e);l0&&n.MidiInstrumentId!==b.MidiInstrument.Percussion&&(t.midiInstrumentID=Math.max(0,parseInt(s.value,10)-1));else if("midi-unpitched"===s.name)t.fixedKey=Math.max(0,parseInt(s.value,10));else if("volume"===s.name)try{const e=parseFloat(s.value);t.volume=e/127;}catch(t){u.default.debug("ExpressionReader.readExpressionParameters","read volume",t);}else if("pan"===s.name)try{const e=parseFloat(s.value);t.pan=e/64;}catch(t){u.default.debug("ExpressionReader.readExpressionParameters","read pan",t);}}catch(t){u.default.info("MusicSheetReader.createInstrumentGroups midi settings: ",t);}}}}catch(t){u.default.info("MusicSheetReader.createInstrumentGroups: ",t);}}if(0===n.SubInstruments.length){const t=new g.SubInstrument(n);n.SubInstruments.push(t);}i[t]=n,s?(s.InstrumentalGroups.push(n),this.musicSheet.Instruments.push(n)):(this.musicSheet.InstrumentalGroups.push(n),this.musicSheet.Instruments.push(n));}else if("part-group"===r.name&&"start"===r.attribute("type").value){const t=new p.InstrumentalGroup("group",this.musicSheet,s);s?s.InstrumentalGroups.push(t):this.musicSheet.InstrumentalGroups.push(t),s=t;}else if("part-group"===r.name&&"stop"===r.attribute("type").value&&s){if(1===s.InstrumentalGroups.length){const t=s.InstrumentalGroups[0];s.Parent?(s.Parent.InstrumentalGroups.push(t),this._removeFromArray(s.Parent.InstrumentalGroups,s)):(this.musicSheet.InstrumentalGroups.push(t),this._removeFromArray(this.musicSheet.InstrumentalGroups,s));}s=s.Parent;}}}catch(t){const e=h.ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading Instruments");throw new c.MusicSheetReadingException(e,t)}for(let t=0,e=this.musicSheet.Instruments.length;t0)for(let t=0,s=i.TempoExpressions.length;t0&&!this.hasDigit(e)&&this.globalStaffIndex>0){if(s.EntriesList[0].label.indexOf(e)>=0)return !1;break}}let c=p.TextAlignmentEnum.CenterBottom;this.musicSheet.Rules.CompactMode&&(c=p.TextAlignmentEnum.LeftBottom);const m=new f.UnknownExpression(e,this.placement,c,this.staffNumber);return m.fontStyle=r,m.defaultYXml=l,h.addExpression(m,t),!1}closeOpenContinuousDynamic(t,e,i){if(!t)return;const s=t.NumberXml;t.EndMultiExpression=this.createNewMultiExpressionIfNeeded(e,s,i),t.StartMultiExpression.EndingContinuousDynamic=t,this.openContinuousDynamicExpressions=this.openContinuousDynamicExpressions.filter((e=>e!==t));}closeOpenContinuousTempo(t){this.openContinuousTempoExpression.AbsoluteEndTimestamp=t,this.openContinuousTempoExpression=void 0;}checkIfWordsNodeIsRepetitionInstruction(t){return "coda"===(t=t.trim().toLowerCase())||"tocoda"===t||"to coda"===t||"fine"===t||"d.c."===t||"dacapo"===t||"da capo"===t||"d.s."===t||"dalsegno"===t||"dal segno"===t||"d.c. al fine"===t||"d.s. al fine"===t||"d.c. al coda"===t||"d.s. al coda"===t}hasDigit(t){return /\d/.test(t)}};},2535:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LyricsReader=void 0;const s=i(2672),n=i(7274),r=i(6331);e.LyricsReader=class{constructor(t){this.openLyricWords={},this.musicSheet=t;}addLyricEntry(t,e){var i,o;if(t){const a=t;for(let t=0,l=a.length;t{Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractTempoExpression=void 0;const s=i(3748);class n extends s.AbstractExpression{constructor(t,e,i,s){super(e),this.label=t,this.staffNumber=i,this.parentMultiTempoExpression=s;}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}static isStringInStringList(t,e){for(const i of t)if(n.stringContainsSeparatedWord(e.toLowerCase().trim(),i.toLowerCase().trim()))return !0;return !1}static stringContainsSeparatedWord(t,e){return t===e||-1!==t.indexOf(" "+e)||-1!==t.indexOf(e+" ")}}e.AbstractTempoExpression=n;},7839:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ContDynamicEnum=e.ContinuousDynamicExpression=void 0;const s=i(3748),n=i(1797);class r extends s.AbstractExpression{constructor(t,e,i,s,n,r=""){super(e),super.parentMeasure=s,this.NumberXml=n,this.dynamicType=t,this.label=r,this.staffNumber=i,this.startVolume=-1,this.endVolume=-1,""!==r&&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&&(r.isStringInStringList(r.listContinuousDynamicIncreasing,t)||r.isStringInStringList(r.listContinuousDynamicDecreasing,t))}getInterpolatedDynamic(t){const e=this.StartMultiExpression.AbsoluteTimestamp;let i;if(i=this.EndMultiExpression?this.EndMultiExpression.AbsoluteTimestamp:n.Fraction.plus(this.startMultiExpression.SourceMeasureParent.AbsoluteTimestamp,this.startMultiExpression.SourceMeasureParent.Duration),t.lt(e))return -1;if(i.lt(t))return -2;const s=n.Fraction.minus(t,e).RealValue/n.Fraction.minus(i,e).RealValue;return Math.max(0,Math.min(99.9,this.startVolume+(this.endVolume-this.startVolume)*s))}isWedge(){return !this.label}setType(){r.isStringInStringList(r.listContinuousDynamicIncreasing,this.label)?this.dynamicType=o.crescendo:r.isStringInStringList(r.listContinuousDynamicDecreasing,this.label)&&(this.dynamicType=o.diminuendo);}}var o;e.ContinuousDynamicExpression=r,r.listContinuousDynamicIncreasing=["crescendo","cresc","cresc.","cres."],r.listContinuousDynamicDecreasing=["decrescendo","decresc","decr.","diminuendo","dim.","dim"],function(t){t[t.crescendo=0]="crescendo",t[t.diminuendo=1]="diminuendo";}(o=e.ContDynamicEnum||(e.ContDynamicEnum={}));},280:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ContinuousTempoType=e.ContinuousTempoExpression=void 0;const s=i(1797),n=i(9775);class r extends n.AbstractTempoExpression{constructor(t,e,i,s){super(t,e,i,s),this.setTempoType();}static isInputStringContinuousTempo(t){return !!t&&(r.isStringInStringList(r.listContinuousTempoFaster,t)||r.isStringInStringList(r.listContinuousTempoSlower,t))}static isIncreasingTempo(t){return t<=o.piuMosso}static isDecreasingTempo(t){return t>=o.allargando&&t<=o.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 AbsoluteEndTimestamp(){return this.absoluteEndTimestamp}set AbsoluteEndTimestamp(t){this.absoluteEndTimestamp=t;}get AbsoluteTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp}getAbsoluteFloatTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp.RealValue}getInterpolatedTempo(t){const e=s.Fraction.plus(this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.parentMultiTempoExpression.Timestamp);if(t.lt(e))return -1;if(this.absoluteEndTimestamp.lt(t))return -2;const i=s.Fraction.minus(t,e).RealValue/s.Fraction.minus(this.absoluteEndTimestamp,e).RealValue;return Math.max(0,Math.min(250,this.startTempo+(this.endTempo-this.startTempo)*i))}setTempoType(){r.isStringInStringList(r.listContinuousTempoFaster,this.label)?this.tempoType=o.accelerando:r.isStringInStringList(r.listContinuousTempoSlower,this.label)&&(this.tempoType=o.ritardando);}}var o;e.ContinuousTempoExpression=r,r.listContinuousTempoFaster=["accelerando","piu mosso","poco piu","stretto"],r.listContinuousTempoSlower=["poco meno","meno mosso","piu lento","calando","allargando","rallentando","ritardando","ritenuto","ritard.","ritard","rit.","rit","riten.","riten"],function(t){t[t.accelerando=0]="accelerando",t[t.stretto=1]="stretto",t[t.stringendo=2]="stringendo",t[t.mosso=3]="mosso",t[t.piuMosso=4]="piuMosso",t[t.allargando=5]="allargando",t[t.calando=6]="calando",t[t.menoMosso=7]="menoMosso",t[t.rallentando=8]="rallentando",t[t.ritardando=9]="ritardando",t[t.ritard=10]="ritard",t[t.rit=11]="rit",t[t.ritenuto=12]="ritenuto",t[t.rubato=13]="rubato",t[t.precipitando=14]="precipitando";}(o=e.ContinuousTempoType||(e.ContinuousTempoType={}));},5853:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OctaveEnum=e.OctaveShift=void 0;const s=i(8640);var n;e.OctaveShift=class{constructor(t,e){this.numberXml=1,this.setOctaveShiftValue(t,e);}get Type(){return this.octaveValue}set Type(t){this.octaveValue=t;}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t;}get ParentStartMultiExpression(){return this.startMultiExpression}set ParentStartMultiExpression(t){this.startMultiExpression=t;}get ParentEndMultiExpression(){return this.endMultiExpression}set ParentEndMultiExpression(t){this.endMultiExpression=t;}setOctaveShiftValue(t,e){this.octaveValue=1===e&&"down"===t?n.VA8:1===e&&"up"===t?n.VB8:2===e&&"down"===t?n.MA15:2===e&&"up"===t?n.MB15:n.NONE;}static getPitchFromOctaveShift(t,e){if(!t)return;let i=t.Octave;switch(e){case n.VA8:i-=1;break;case n.VB8:i+=1;break;case n.MA15:i-=2;break;case n.MB15:i+=2;break;case n.NONE:default:i+=0;}return new s.Pitch(t.FundamentalNote,i,t.Accidental)}},function(t){t[t.VA8=0]="VA8",t[t.VB8=1]="VB8",t[t.MA15=2]="MA15",t[t.MB15=3]="MB15",t[t.NONE=4]="NONE";}(n=e.OctaveEnum||(e.OctaveEnum={}));},308:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Pedal=void 0,e.Pedal=class{constructor(t=!1,e=!0){this.ChangeEnd=!1,this.ChangeBegin=!1,this.EndsStave=!1,this.BeginsStave=!1,this.line=t,this.sign=e;}get IsLine(){return this.line}get IsSign(){return this.sign}};},1928:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Slur=void 0;const s=i(1797);e.Slur=class{constructor(){}get StartNote(){return this.startNote}set StartNote(t){this.startNote=t;}get EndNote(){return this.endNote}set EndNote(t){this.endNote=t;}startNoteHasMoreStartingSlurs(){if(!this.startNote)return !1;for(let t=0,e=this.startNote.NoteSlurs.length;t