music21j-port
Version:
A toolkit for computer-aided musicology, Javascript version
20 lines • 322 kB
JavaScript
/**
* music21j 0.9.0 built on * 2019-07-23.
* Copyright (c) 2013-2019 Michael Scott Cuthbert and cuthbertLab
* BSD License, see LICENSE
*
* http://github.com/cuthbertLab/music21j
*/
!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b(require("vexflow"),require("MIDI"),require("jquery"),require("jsonpickle"),require("eventjs")):"function"==typeof define&&define.amd?define(["vexflow","MIDI","jquery","jsonpickle","eventjs"],b):a.music21=b(a.Vex,a.MIDI,a.$,a.jsonpickle,a.eventjs)}(this,function(a,b,c,d,e){"use strict";function f(a){if(!ea.has(a)){var b=da.call();ea.set(a,b)}return ea.get(a)}function g(a){return void 0!==Ca[a]?Ca[a]:a}function h(a){if(void 0===a)return"regular";if(a=a.toLowerCase(),Aa.includes(a))return a;if(void 0!==Ba[a])return Ba[a];throw new Da("cannot process style: "+a)}function i(a,b){if(a<1||a>12)throw new Error("cardinality "+a+" is not valid");if(b<1||b>tc[a])throw new Error("index "+b+" is invalid");return fc[a][b][2][1]>0?[0]:[-1,1]}function j(a,b,c,d){return{cardinality:a,forteClass:b,inversion:c,pcOriginal:d}}function k(a){void 0!==a&&void 0!==a.cardinality&&(a=[a.cardinality,a.forteClass,a.inversion,a.pcOriginal]);var b=a.slice(0,2),c=L(b,2),d=c[0],e=c[1],f=void 0;if(a.length>=3&&void 0!==a[2]&&(f=a[2]),d<1||d>13)throw new Error("cardinality "+d+" not valid");if(e<1||e>tc[d])throw new Error("index "+e+" not valid");var g=i(d,e);if(void 0!==f&&!g.includes(f))throw new Error("inversion "+f+" not valid");return void 0===f&&(f=g.includes(0)?0:1),[d,e,f]}function l(a){var b=k(a),c=L(b,3),d=c[0],e=c[1],f=c[2],g=String([e,f]);return sc[d][g][0]}function m(a){var b=k(a.slice(0,2)),c=L(b,3),d=c[0],e=c[1],f=c[2],g=String([e,f]);return sc[d][g][0]}function n(a){var b=k(a),c=L(b,3),d=c[0],e=c[1],f=c[2],g=String([e,f]);return sc[d][g][2]}function o(a){for(var b=[],c=1;c<13;c++){var d=0,e=!0,f=!1,g=void 0;try{for(var h,i=fc[c][Symbol.iterator]();!(e=(h=i.next()).done);e=!0){var k=h.value;void 0!==k?(S.arrayEquals(k[1],a)&&b.push(j(c,d)),d+=1):d+=1}}catch(a){f=!0,g=a}finally{try{!e&&i.return&&i.return()}finally{if(f)throw g}}}return b}function p(a){var b=k(a),c=L(b,3),d=c[0],e=c[1],f=(c[2],fc[d][e][3]);if(0!==f){var g=f;Array.isArray(f)&&(g=f[0]);var h=k([d,g,void 0]);return j(h[0],h[1],h[2])}}function q(a){var b=k(a);return wc[String(b)].name}function r(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"tn",c=k(a),d=L(c,3),e=d[0],f=d[1],g=d[2],h=void 0;return"tn"===b.toLowerCase()?-1===g?h="B":1===g?h="A":0===g&&(h=""):h="",e+"-"+f+h}function s(a){var b=a.orderedPitchClasses;if(!b.length)throw new Error("cannot access chord tables address for Chord with no pitches");var c=b.length;if(1===c)return j(1,1,0,b[0]);if(12===c)return j(12,1,0,0);for(var d=[],e=0;e<c;e++){for(var f=b.slice(e),g=0;g<e;g++)f.push(b[g]);var h=f[0],k=[],l=!0,m=!1,n=void 0;try{for(var o,p=f[Symbol.iterator]();!(l=(o=p.next()).done);l=!0){var q=o.value,r=Ya(q-h,12);k.push(r)}}catch(a){m=!0,n=a}finally{try{!l&&p.return&&p.return()}finally{if(m)throw n}}var s=[],t=!0,u=!1,v=void 0;try{for(var w,x=k[Symbol.iterator]();!(t=(w=x.next()).done);t=!0){var y=w.value;s.push(Ya(12-y,12))}}catch(a){u=!0,v=a}finally{try{!t&&x.return&&x.return()}finally{if(u)throw v}}s.reverse();for(var z=s[0],A=0;A<s.length;A++)s[A]=Ya(s[A]+(12-z),12);var B=[k,s,h];d.push(B)}for(var C=!1,D=void 0,E=void 0,F=void 0,G=0;G<fc[c].length;G++){var H=fc[c][G];if(void 0!==H){var I=H[0],J=i(c,G),K=!0,M=!1,N=void 0;try{for(var O,P=d[Symbol.iterator]();!(K=(O=P.next()).done);K=!0){var Q=L(O.value,3),R=Q[0],T=Q[1],U=Q[2];if(S.arrayEquals(I,R)){E=G,F=J.includes(0)?0:1,D=U,C=!0;break}if(S.arrayEquals(I,T)){E=G,F=J.includes(0)?0:-1,D=U,C=!0;break}}}catch(a){M=!0,N=a}finally{try{!K&&P.return&&P.return()}finally{if(M)throw N}}}}if(!C)throw new Error("cannot find a chord table address for "+b);return j(c,E,F,D)}function t(a,b){if(void 0===a)a=new Ja.Pitch("C4");else if(!(a instanceof Ja.Pitch))throw new O("Cannot make a scale not from a music21.pitch.Pitch object: "+a);void 0===b&&(b=["M","M","m","M","M","M","m"]);for(var c=new Ta.GenericInterval(2),d=[a],e=a,f=0;f<b.length;f++){var g=new Ta.DiatonicInterval(b[f],c),h=new Ta.Interval(g),i=h.transposePitch(e);R&&console.log("ScaleSimpleMajor -- adding pitch: "+i.name),d.push(i),e=i}return d}function u(a){return t(a,["M","M","m","M","M","M","m"])}function v(a,b){var c=["M","m","M","M","m","M","M"];return"string"==typeof b&&(b=b.replace(/\s/g,"-")),"harmonic"===b||"harmonic-minor"===b?(c[5]="A",c[6]="m"):"melodic"!==b&&"melodic-ascending"!==b&&"melodic-minor"!==b&&"melodic-minor-ascending"!==b||(c[4]="M",c[6]="m"),t(a,c)}function w(a){if("longa"===a)return"long";if("2048th"===a)throw new jd('Cannot convert "2048th" duration to MusicXML (too short).');return a}function x(a){var b={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return void 0===a||""===a?a:a.startsWith("#")?a.toUpperCase():b[a].toUpperCase()}function y(a){return new ld(a).parse()}function z(a){return a.replace(/-([a-z])/g,function(a){return a[1].toUpperCase()})}function A(a,b,d,e,f){var g=c(b).children(d);if(g){var h=g.contents().eq(0).text();void 0!==h&&""!==h&&(void 0!==f&&(h=f(h)),void 0===e&&(e=z(d)),a[e]=h)}}function B(a){return(new Yd).scoreFromText(a)}var C=b.default,D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},E=(function(){function a(a){this.value=a}function b(b){function c(a,b){return new Promise(function(c,e){var h={key:a,arg:b,resolve:c,reject:e,next:null};g?g=g.next=h:(f=g=h,d(a,b))})}function d(c,f){try{var g=b[c](f),h=g.value;h instanceof a?Promise.resolve(h.value).then(function(a){d("next",a)},function(a){d("throw",a)}):e(g.done?"return":"normal",g.value)}catch(a){e("throw",a)}}function e(a,b){switch(a){case"return":f.resolve({value:b,done:!0});break;case"throw":f.reject(b);break;default:f.resolve({value:b,done:!1})}f=f.next,f?d(f.key,f.arg):g=null}var f,g;this._invoke=c,"function"!=typeof b.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(b.prototype[Symbol.asyncIterator]=function(){return this}),b.prototype.next=function(a){return this._invoke("next",a)},b.prototype.throw=function(a){return this._invoke("throw",a)},b.prototype.return=function(a){return this._invoke("return",a)}}(),function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}),F=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),G=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},H=function a(b,c,d){null===b&&(b=Function.prototype);var e=Object.getOwnPropertyDescriptor(b,c);if(void 0===e){var f=Object.getPrototypeOf(b);return null===f?void 0:a(f,c,d)}if("value"in e)return e.value;var g=e.get;if(void 0!==g)return g.call(d)},I=function(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)},J=function(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b},K=function a(b,c,d,e){var f=Object.getOwnPropertyDescriptor(b,c);if(void 0===f){var g=Object.getPrototypeOf(b);null!==g&&a(g,c,d,e)}else if("value"in f&&f.writable)f.value=d;else{var h=f.set;void 0!==h&&h.call(e,d)}return d},L=function(){function a(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}return c}return function(b,c){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return a(b,c);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),M=function(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)},N=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.name=c.constructor.name,c.message=a,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(c,c.constructor):c.stack=new Error(a).stack,c}return I(b,a),b}(Error),O=function(a){function b(){return E(this,b),J(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return I(b,a),b}(N),P=function(a){function b(){return E(this,b),J(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return I(b,a),b}(O),Q=Object.freeze({Music21Exception:O,StreamException:P}),R=!1,S={};S.merge=function a(b,c){if(void 0===c||null===c)return b;for(var d in c)if({}.hasOwnProperty.call(c,d))try{c[d]&&c[d].constructor===Object?b[d]=a(b[d],c[d]):b[d]=c[d]}catch(a){b[d]=c[d]}return b},S.range=function(a,b,c){void 0===c&&(c=1),void 0===b&&(b=a,a=0);var d=Math.ceil((b-a)/c);return Array.apply(0,Array(d)).map(function(b,d){return d*c+a})},S.mixin=function(a,b){for(var c=Object.getPrototypeOf(a),d=Object.getPrototypeOf(b);c;){for(var e in Object.keys(c))({}).hasOwnProperty.call(c,e)&&(e in d||(d[e]=c[e]));c=Object.getPrototypeOf(c)}},S.aggregation=function(a){for(var b=arguments.length,c=Array(b>1?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];var e=function(a){function b(){var a;E(this,b);for(var d=arguments.length,e=Array(d),g=0;g<d;g++)e[g]=arguments[g];var h=J(this,(a=b.__proto__||Object.getPrototypeOf(b)).call.apply(a,[this].concat(e)));return c.forEach(function(a){f(h,new a)}),h}return I(b,a),b}(a),f=function(a,b){Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b)).forEach(function(c){c.match(/^(?:constructor|prototype|arguments|caller|name|bind|call|apply|toString|length)$/)||Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))})};return c.forEach(function(a){f(e.prototype,a.prototype),f(e,a)}),e},S.posMod=function(a,b){if(void 0===a||void 0===b)throw new Error("Modulo needs two numbers");return(a%b+b)%b},S.statisticalMode=function(a){if(0===a.length)return null;for(var b={},c=a[0],d=1,e=0;e<a.length;e++){var f=a[e];null==b[f]&&(b[f]=0),b[f]+=1,b[f]>d&&(c=f,d=b[f])}return c},S.fromRoman=function(a){var b=a.toUpperCase(),c=[1,10,100],d=["M","D","C","L","X","V","I"],e=[1e3,500,100,50,10,5,1],f=[],g=!0,h=!1,i=void 0;try{for(var j,k=b[Symbol.iterator]();!(g=(j=k.next()).done);g=!0){var l=j.value;if(!d.includes(l))throw new Error("Value is not a valid roman numeral: "+b)}}catch(a){h=!0,i=a}finally{try{!g&&k.return&&k.return()}finally{if(h)throw i}}for(var m=0;m<b.length;m++){var n=b[m],o=e[d.indexOf(n)];if(m<b.length-1){e[d.indexOf(b[m+1])]>o&&c.includes(o)&&(o*=-1)}f.push(o)}var p=0,q=!0,r=!1,s=void 0;try{for(var t,u=f[Symbol.iterator]();!(q=(t=u.next()).done);q=!0){p+=t.value}}catch(a){r=!0,s=a}finally{try{!q&&u.return&&u.return()}finally{if(r)throw s}}return p},S.toRoman=function(a){if("number"!=typeof a)throw new Error("expected integer, got "+(void 0===a?"undefined":D(a)));if(a<0||a>4e3)throw new Error("Argument must be between 1 and 3999");for(var b=[1e3,900,500,400,100,90,50,40,10,9,5,4,1],c=["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"],d="",e=0;e<b.length;e++){var f=Math.floor(a/b[e]);d+=c[e].repeat(f),a-=b[e]*f}return d},S.makeSVGright=function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"svg",b=arguments[1];void 0===b&&(b={});var c=document.createElementNS("http://www.w3.org/2000/svg",a);for(var d in b)({}).hasOwnProperty.call(b,d)&&c.setAttribute(d,b[d]);return c},S.ordinalAbbreviation=function(a,b){var c="",d=a%100;if(11===d||12===d||13===d)c="th";else{var e=a%10;c=1===e?"st":2===e?"nd":3===e?"rd":"th"}return"st"!==c&&b&&(c+="s"),c},S.rationalize=function(a,b,c){b=b||.001,c=c||50;for(var d=2;d<c;d++)if(Math.abs(a*d-Math.round(a*d))<b){var e=Math.round(a*d),f=d;return{numerator:e,denominator:f}}},S.stripPx=function(a){if("string"==typeof a){var b=a.indexOf("px");return a=a.slice(0,b),parseInt(a)}return a},S.urlParam=function(a){a=a.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var b=new RegExp("[\\?&]"+a+"=([^&#]*)"),c=b.exec(location.search);return null==c?"":decodeURIComponent(c[1].replace(/\+/g," "))},S.arrayEquals=function a(b,c){if(b.length!==c.length)return!1;for(var d=0;d<b.length;d++)if(b[d]instanceof Array&&c[d]instanceof Array){if(!a(b[d],c[d]))return!1}else if(b[d]!==c[d])return!1;return!0};var T={};T.value=0;var U=function(){function a(){E(this,a)}return F(a,[{key:"call",value:function(){var a=T.value;return T.value+=1,a}}]),a}();S.SingletonCounter=U,S.setWindowVisibilityWatcher=function(a){function b(b){var d="visible",e="hidden",f={focus:d,focusin:d,pageshow:d,blur:e,focusout:e,pagehide:e};b=b||window.event;var g="";g=b.type in f?f[b.type]:this[c]?"hidden":"visible",a(g,b)}var c="hidden";c in document?document.addEventListener("visibilitychange",b):"mozHidden"in document?(c="mozHidden",document.addEventListener("mozvisibilitychange",b)):"webkitHidden"in document?(c="webkitHidden",document.addEventListener("webkitvisibilitychange",b)):"msHidden"in document?(c="msHidden",document.addEventListener("msvisibilitychange",b)):"onfocusin"in document&&(document.onfocusin=b,document.onfocusout=b),window.onpageshow=window.onpagehide=window.onfocus=window.onblur=b,b({type:"visible"===document.visibilityState?"focus":"blur"})},S.urls={css:"/css",webResources:"/webResources",midiPlayer:"/webResources/midiPlayer",soundfontUrl:"/src/ext/soundfonts/FluidR3_GM/"},S.hyphenToCamelCase=function(a){return a.replace(/-([a-zA-Z])/,function(a,b){return b.toUpperCase()})},S.numToIntOrFloat=function(a){var b=Math.round(a);return Math.abs(a-b)<1e-6?b:a};var V={},W=function(){function a(){E(this,a),this._storedClasses=void 0,this.isProtoM21Object=!0,this.isMusic21Object=!1,this._cloneCallbacks={}}return F(a,[{key:"clone",value:function(){var a=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],b=arguments[1];if(!a)return G(Object.create(Object.getPrototypeOf(this)),this);var c=new this.constructor;void 0===b&&(b=new WeakMap);for(var d in this)if(!1!=={}.hasOwnProperty.call(this,d))if(d in this._cloneCallbacks)!0===this._cloneCallbacks[d]?c[d]=this[d]:!1===this._cloneCallbacks[d]?c[d]=void 0:this._cloneCallbacks[d](d,c,this);else if(void 0!==Object.getOwnPropertyDescriptor(this,d).get||void 0!==Object.getOwnPropertyDescriptor(this,d).set);else if("function"==typeof this[d]);else if("object"===D(this[d])&&null!==this[d]&&this[d].isProtoM21Object){var e=this[d],f=void 0;f=b.has(e)?b.get(e):this[d].clone(a,b),c[d]=f}else try{c[d]=this[d]}catch(a){if(!(a instanceof TypeError))throw a;console.log("typeError:",a,d)}return c}},{key:"isClassOrSubclass",value:function(a){a instanceof Array==!1&&(a=[a]);for(var b=0;b<a.length;b++)if(this.classes.includes(a[b]))return!0;return!1}},{key:"toString",value:function(){var a=this.stringInfo();return""!==a&&(a=" "+a),"<"+this.classes[0]+a+">"}},{key:"stringInfo",value:function(){return""}},{key:"classes",get:function(){if(void 0!==this._storedClasses)return this._storedClasses;for(var a=[],b=this.constructor,c=20;null!==b&&void 0!==b&&c&&(c-=1,""!==b.name);)a.push(b.name),b=Object.getPrototypeOf(b);return a.push("object"),this._storedClasses=a,a}}]),a}();V.ProtoM21Object=W;var X=function(){function a(b){E(this,a),this.client=b,this.method=void 0,this.origin=void 0}return F(a,[{key:"clone",value:function(){var b=new a(this.client);b.method=this.method,b.origin=this.origin}},{key:"chain",value:regeneratorRuntime.mark(function a(){var b;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:b=this.origin;case 1:if(void 0===b){a.next=7;break}return a.next=4,b;case 4:b=b.derivation.origin,a.next=1;break;case 7:case"end":return a.stop()}},a,this)})},{key:"rootDerivation",value:function(){var a=Array.from(this.chain());return a.length?a[a.length-1]:void 0}}]),a}(),Y=Object.freeze({Derivation:X,default:X}),Z={};Z.typeFromNumDict={1:"whole",2:"half",4:"quarter",8:"eighth",16:"16th",32:"32nd",64:"64th",128:"128th",256:"256th",512:"512th",1024:"1024th",0:"zero",.5:"breve",.25:"longa",.125:"maxima",.0625:"duplex-maxima"},Z.quarterTypeIndex=6,Z.ordinalTypeFromNum=["duplex-maxima","maxima","longa","breve","whole","half","quarter","eighth","16th","32nd","64th","128th","256th","512th","1024th"],Z.vexflowDurationArray=[void 0,void 0,void 0,void 0,"w","h","q","8","16","32",void 0,void 0,void 0,void 0,void 0];var $=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c._quarterLength=0,c._dots=0,c._durationNumber=void 0,c._type="zero",c._tuplets=[],"string"==typeof a?c.type=a:void 0!==a&&(c.quarterLength=a),c._cloneCallbacks._tuplets=c.cloneCallbacksTupletFunction,c}return I(b,a),F(b,[{key:"stringInfo",value:function(){return this.quarterLength.toString()}},{key:"cloneCallbacksTupletFunction",value:function(a,b,c){for(var d=[],e=0;e<c[a].length;e++){var f=c[a][e].clone();d.push(f)}b[a]=d}},{key:"_findDots",value:function(a){if(0===a)return 0;for(var b=Z.ordinalTypeFromNum.indexOf(this._type),c=Math.pow(2,Z.quarterTypeIndex-b),d=0;d<=4;d++){var e=(Math.pow(2,d)-1)/Math.pow(2,d),f=1+e;if(Math.abs(c*f-a)<1e-4)return d}return R&&console.log("no dots available for ql; probably a tuplet",a),0}},{key:"updateQlFromFeatures",value:function(){var a=Z.ordinalTypeFromNum.indexOf(this._type),b=Math.pow(2,Z.quarterTypeIndex-a),c=1+(Math.pow(2,this._dots)-1)/Math.pow(2,this._dots),d=b*c,e=d;this._tuplets.forEach(function(a){e*=a.tupletMultiplier()}),this._quarterLength=e}},{key:"updateFeaturesFromQl",value:function(){var a=this._quarterLength;if(this._tuplets=[],0===a)return this._type="zero",void(this._dots=0);var b=Math.floor(Math.log(a+1e-5)/Math.log(2)),c=Z.quarterTypeIndex-b;this._type=Z.ordinalTypeFromNum[c],this._dots=this._findDots(a);var d=Math.pow(2,Z.quarterTypeIndex-c),e=1+(Math.pow(2,this._dots)-1)/Math.pow(2,this._dots),f=d*e;if(f!==a&&0!==a){c-=1,this._type=Z.ordinalTypeFromNum[c],f*=2;var g=a/f,h=S.rationalize(g);if(void 0===h);else{var i=new Z.Tuplet(h.denominator,h.numerator,new Z.Duration(f));this.appendTuplet(i,!0)}}}},{key:"appendTuplet",value:function(a,b){a.frozen=!0,this._tuplets.push(a),!0!==b&&this.updateQlFromFeatures()}},{key:"dots",get:function(){return this._dots},set:function(a){this._dots=a,this.updateQlFromFeatures()}},{key:"quarterLength",get:function(){return this._quarterLength},set:function(a){void 0===a&&(a=1),this._quarterLength=a,this.updateFeaturesFromQl()}},{key:"type",get:function(){return this._type},set:function(a){if(-1===Z.ordinalTypeFromNum.indexOf(a))throw console.log("invalid type "+a),new O("invalid type "+a);this._type=a,this.updateQlFromFeatures()}},{key:"tuplets",get:function(){return this._tuplets}},{key:"vexflowDuration",get:function(){var a=Z.ordinalTypeFromNum.indexOf(this.type),b=Z.vexflowDurationArray[a];if(this.dots>0)for(var c=0;c<this.dots;c++)b+="d";return b}}]),b}(V.ProtoM21Object);Z.Duration=$;var _=function(a){function b(a,c,d,e){E(this,b);var f=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return f.numberNotesActual=a||3,f.numberNotesNormal=c||2,f.durationActual=d||new Z.Duration(.5),"number"==typeof f.durationActual&&(f.durationActual=new Z.Duration(f.durationActual)),f.durationNormal=e||f.durationActual,f.frozen=!1,f.type=void 0,f.bracket=!0,f.placement="above",f.tupletActualShow="number",f.tupletNormalShow=void 0,f}return I(b,a),F(b,[{key:"setDurationType",value:function(a){if(!0===this.frozen)throw new O("A frozen tuplet (or one attached to a duration) is immutable");return this.durationActual=new Z.Duration(a),this.durationNormal=this.durationActual,this.durationActual}},{key:"setRatio",value:function(a,b){if(!0===this.frozen)throw new O("A frozen tuplet (or one attached to a duration) is immutable");this.numberNotesActual=a||3,this.numberNotesNormal=b||2}},{key:"totalTupletLength",value:function(){return this.numberNotesNormal*this.durationNormal.quarterLength}},{key:"tupletMultiplier",value:function(){var a=this.durationActual.quarterLength;return this.totalTupletLength()/(this.numberNotesActual*a)}},{key:"fullName",get:function(){var a=this.numberNotesActual,b=this.numberNotesNormal;if(3===a&&2===b)return"Triplet";if(5===a&&(4===b||2===b))return"Quintuplet";if(6===a&&4===b)return"Sextuplet";var c=S.ordinalAbbreviation(b,!0);return"Tuplet of "+a.toString()+"/"+b.toString()+c}}]),b}(V.ProtoM21Object);Z.Tuplet=_;var aa=function(a){function b(){return E(this,b),J(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return I(b,a),b}(O),ba=function a(){E(this,a),this.isDead=!1,this.classString=void 0,this.globalSiteIndex=!1,this.siteIndex=void 0,this.site=void 0},ca=new ba;ca.globalSiteIndex=-2,ca.siteIndex=-2;var da=new S.SingletonCounter,ea=new WeakMap,fa=function(){function a(){E(this,a),this.siteDict=new Map,this.siteDict.set(ca.siteIndex,ca),this._siteIndex=0,this._lastID=-1}return F(a,[{key:"includes",value:function(a){var b=!0,c=!1,d=void 0;try{for(var e,f=this.siteDict[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=L(e.value,2);g[0];if(g[1].site===a)return!0}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}return!1}},{key:"_keysByTime",value:function(){var a=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],b=[],c=!0,d=!1,e=void 0;try{for(var f,g=this.siteDict[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=L(f.value,2),i=h[0],j=h[1],k=[j.siteIndex,i];b.push(k)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return b.sort(),a&&b.reverse(),b.map(function(a){return a[1]})}},{key:"add",value:function(a,b,c){void 0===b&&void 0!==a&&(b=f(a));var d=!1;if(this.siteDict.has(b)){var e=this.siteDict.get(b);e.isDead||void 0===e.site||(d=!0)}void 0!==a&&void 0===c&&(c=a.classes[0]);var g=void 0;d?(g=this.siteDict.get(b),g.isDead=!1):g=new ba,g.site=a,g.classString=c,g.siteIndex=this._siteIndex,this._siteIndex+=1,g.globalSiteIndex=da.call(),d||this.siteDict.set(b,g)}},{key:"remove",value:function(a){var b=f(a);return void 0!==b&&this.siteDict.delete(b)}},{key:"clear",value:function(){this.siteDict=new Map,this.siteDict.set(ca.siteIndex,ca),this._lastID=-1}},{key:"yieldSites",value:regeneratorRuntime.mark(function a(){var b,c,d,e,g,h,i,j,k,l,m=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:b=void 0,b=!0===m?this._keysByTime(!1):"reverse"===m?this._keysByTime(!0):Array.from(this.siteDict.keys()),void 0!==n&&(c=f(n),b.includes(c)&&b.splice(0,0,b.pop(b.indexOf(c)))),d=!0,e=!1,g=void 0,a.prev=6,h=b[Symbol.iterator]();case 8:if(d=(i=h.next()).done){a.next=27;break}if(j=i.value,(k=this.siteDict.get(j))!==ca){a.next=17;break}if(o){a.next=15;break}return a.next=15,k.site;case 15:a.next=24;break;case 17:if(void 0!==(l=k.site)){a.next=22;break}k.isDead=!0,a.next=24;break;case 22:return a.next=24,l;case 24:d=!0,a.next=8;break;case 27:a.next=33;break;case 29:a.prev=29,a.t0=a.catch(6),e=!0,g=a.t0;case 33:a.prev=33,a.prev=34,!d&&h.return&&h.return();case 36:if(a.prev=36,!e){a.next=39;break}throw g;case 39:return a.finish(36);case 40:return a.finish(33);case 41:case"end":return a.stop()}},a,this,[[6,29,33,41],[34,,36,40]])})},{key:"get",value:function(){var a=arguments.length>0&&void 0!==arguments[0]&&arguments[0],b=arguments[1],c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],d=Array.from(this.yieldSites(a,b,c));return void 0!==b&&d.includes(b)&&d.splice(0,0,d.pop(d.indexOf(b))),d}},{key:"getAttrByName",value:function(a){var b=!0,c=!1,d=void 0;try{for(var e,f=this.yieldSites("reverse")[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;if(void 0!==g&&a in g)return g[a]}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}}},{key:"getObjByClass",value:function(a,b){var c={callerFirst:this,sortByCreationTime:!1,priorityTarget:void 0,getElementMethod:"getElementAtOrBefore",memo:{}};S.merge(c,b);var d=c.memo,e=void 0,g=Array.from(this.yieldSites(c.sortByCreationTime,c.priorityTarget,!0)),h="string"==typeof a,i=!0,j=!1,k=void 0;try{for(var l,m=g[Symbol.iterator]();!(i=(l=m.next()).done);i=!0){var n=l.value;if(h){if(n.classes.includes(a)){e=n;break}}else if(n instanceof a){e=n;break}}}catch(a){j=!0,k=a}finally{try{!i&&m.return&&m.return()}finally{if(j)throw k}}if(void 0!==e)return e;var o=!0,p=!1,q=void 0;try{for(var r,s=g[Symbol.iterator]();!(o=(r=s.next()).done);o=!0){var t=r.value,u=f(t);if(u in d||(d[u]=t),void 0!==(e=t.getContextByClass(a,c)))break}}catch(a){p=!0,q=a}finally{try{!o&&s.return&&s.return()}finally{if(p)throw q}}return e}},{key:"length",get:function(){return this.siteDict.size}}]),a}(),ga=Object.freeze({SitesException:aa,SiteRef:ba,getId:f,Sites:fa}),ha={},ia=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c.classSortOrder=20,c._activeSite=void 0,c._naiveOffset=0,c._duration=new Z.Duration,c._derivation=void 0,c._priority=0,c.id=f(c),c.groups=[],c.sites=new fa,c.isMusic21Object=!0,c.isStream=!1,c.groups=[],c._cloneCallbacks._activeSite=function(a,b,c){b[a]=void 0},c._cloneCallbacks._derivation=function(a,b,c){var d=new X(b);d.origin=c,d.method="clone",b[a]=d},c._cloneCallbacks.sites=function(a,b,c){b[a]=new fa},c}return I(b,a),F(b,[{key:"stringInfo",value:function(){var a=this.id;if("number"==typeof a){for(a=a.toString(16);a.length<4;)a="0"+a;a="0x"+a}return a}},{key:"mergeAttributes",value:function(a){this.groups=a.groups.slice()}},{key:"getOffsetBySite",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return void 0===a?this._naiveOffset:a.elementOffset(this,b)}},{key:"setOffsetBySite",value:function(a,b){void 0!==a?a.setElementOffset(this,b):this._naiveOffset=b}},{key:"getOffsetInHierarchy",value:function(a){try{return this.getOffsetBySite(a)}catch(a){}var b=!0,c=!1,d=void 0;try{for(var e,f=this.contextSites()[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=L(e.value,3),h=g[0],i=g[1];g[2];if(h===a)return i}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}throw new Error("Element "+this+" is not in hierarchy of "+a)}},{key:"getContextByClass",value:function(a,b){var c=function a(b,c,d,e,f){for(var g=void 0,h=0;h<b.length;h++){var i=b._elements[h],j=b.elementOffset(i),k=i.isClassOrSubclass(f);if((!1!==c||k)&&(i.isStream||k)){if(e.includes("Before")&&j>=d)if(e.includes("At")&&void 0===g){g=i;try{g.activeSite=b}catch(a){}}else{if(void 0!==g&&g.isClassOrSubclass(f))return g;if(k)return i}else g=i;if(e.includes("After")&&j>d&&k)return i;if(i.isStream){var l=a(i,c,d+j,e,f);if(void 0!==l)return l}}}return void 0!==g&&g.isClassOrSubclass(f)?g:void 0},d={getElementMethod:"getElementAtOrBefore",sortByCreationTime:!1};S.merge(d,b);var e=d.getElementMethod,f=d.sortByCreationTime;if(void 0===a||a instanceof Array||(a=[a]),e.includes("At")&&this.isClassOrSubclass(a))return this;var g=!0,h=!1,i=void 0;try{for(var j,k=this.contextSites({returnSortTuples:!0,sortByCreationTime:f})[Symbol.iterator]();!(g=(j=k.next()).done);g=!0){var l=L(j.value,3),m=l[0],n=l[1],o=l[2];if(e.includes("At")&&m.isClassOrSubclass(a))return m;if("elementsOnly"===o||"elementsFirst"===o){var p=c(m,!1,n,e,a);if(void 0!==p){try{p.activeSite=m}catch(a){}return p}}else if("elementsOnly"!==o){if(e.includes("After")&&(void 0===a||m.isClassOrSubclass(a))&&!e.includes("NotSelf")&&this!==m)return m;var q=c(m,"semiFlat",n,e,a);if(void 0!==q){try{q.activeSite=m}catch(a){}return q}if(e.includes("Before")&&(void 0===a||m.isClassOrSubclass(a))&&(!e.includes("NotSelf")||this!==m))return m}}}catch(a){h=!0,i=a}finally{try{!g&&k.return&&k.return()}finally{if(h)throw i}}}},{key:"contextSites",value:regeneratorRuntime.mark(function a(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(c={callerFirst:void 0,memo:[],offsetAppend:0,sortByCreationTime:!1,priorityTarget:void 0,returnSortTuples:!1,followDerivation:!0},S.merge(c,b),d=c.memo,void 0!==c.callerFirst){a.next=10;break}if(c.callerFirst=this,!this.isStream||this in d){a.next=9;break}return e=this.recursionType,a.next=9,[this,0,e];case 9:d.push(this);case 10:void 0!==c.priorityTarget||c.sortByCreationType||(c.priorityTarget=this.activeSite),f=this,g=!0,h=!1,i=void 0,a.prev=15,j=this.sites.yieldSites(c.sortByCreationTime,c.priorityTarget,!0)[Symbol.iterator]();case 17:if(g=(k=j.next()).done){a.next=63;break}if(l=k.value,!d.includes(l)){a.next=21;break}return a.abrupt("continue",60);case 21:if(!l.classes.includes("SpannerStorage")){a.next=23;break}return a.abrupt("continue",60);case 23:return m=l.elementOffset(this),n=m+c.offsetAppend,o=n,p=l.recursionType,a.next=29,[l,o,p];case 29:d.push(l),q={callerFirst:c.callerFirst,memo:d,offsetAppend:o,returnSortTuples:!0,sortByCreationTime:c.sortByCreationTime},r=!0,s=!1,
t=void 0,a.prev=34,u=l.contextSites(q)[Symbol.iterator]();case 36:if(r=(v=u.next()).done){a.next=46;break}if(w=L(v.value,3),x=w[0],y=w[1],z=w[2],A=y,d.includes(x)){a.next=43;break}return a.next=42,[x,A,z];case 42:d.push(x);case 43:r=!0,a.next=36;break;case 46:a.next=52;break;case 48:a.prev=48,a.t0=a.catch(34),s=!0,t=a.t0;case 52:a.prev=52,a.prev=53,!r&&u.return&&u.return();case 55:if(a.prev=55,!s){a.next=58;break}throw t;case 58:return a.finish(55);case 59:return a.finish(52);case 60:g=!0,a.next=17;break;case 63:a.next=69;break;case 65:a.prev=65,a.t1=a.catch(15),h=!0,i=a.t1;case 69:a.prev=69,a.prev=70,!g&&j.return&&j.return();case 72:if(a.prev=72,!h){a.next=75;break}throw i;case 75:return a.finish(72);case 76:return a.finish(69);case 77:if(!c.followDerivation){a.next=129;break}B=!0,C=!1,D=void 0,a.prev=81,E=f.derivation.chain()[Symbol.iterator]();case 83:if(B=(F=E.next()).done){a.next=115;break}G=F.value,H=!0,I=!1,J=void 0,a.prev=88,K=G.contextSites({callerFirst:void 0,memo:d,offsetAppend:0,returnSortTuples:!0,sortByCreationTime:c.sortByCreationTime})[Symbol.iterator]();case 90:if(H=(M=K.next()).done){a.next=98;break}return N=L(M.value,3),O=N[0],P=N[1],Q=N[2],R=[O,P+c.offsetAppend,Q],a.next=95,R;case 95:H=!0,a.next=90;break;case 98:a.next=104;break;case 100:a.prev=100,a.t2=a.catch(88),I=!0,J=a.t2;case 104:a.prev=104,a.prev=105,!H&&K.return&&K.return();case 107:if(a.prev=107,!I){a.next=110;break}throw J;case 110:return a.finish(107);case 111:return a.finish(104);case 112:B=!0,a.next=83;break;case 115:a.next=121;break;case 117:a.prev=117,a.t3=a.catch(81),C=!0,D=a.t3;case 121:a.prev=121,a.prev=122,!B&&E.return&&E.return();case 124:if(a.prev=124,!C){a.next=127;break}throw D;case 127:return a.finish(124);case 128:return a.finish(121);case 129:case"end":return a.stop()}},a,this,[[15,65,69,77],[34,48,52,60],[53,,55,59],[70,,72,76],[81,117,121,129],[88,100,104,112],[105,,107,111],[122,,124,128]])})},{key:"activeSite",get:function(){return this._activeSite},set:function(a){if(void 0===a)this._activeSite=void 0,this._activeSiteStoredOffset=void 0;else{try{a.elementOffset(this)}catch(a){throw new aa("activeSite cannot be set for an object not in the stream")}this._activeSite=a}}},{key:"derivation",get:function(){return void 0===this._derivation&&(this._derivation=new X(this)),this._derivation},set:function(a){this._derivation=a}},{key:"measureNumber",get:function(){if(void 0!==this.activeSite&&this.activeSite.classes.includes("Measure"))return this.activeSite.number;var a=this.sites.getObjByClass("Measure");return void 0!==a?a.number:void 0}},{key:"offset",get:function(){return void 0===this.activeSite?this._naiveOffset:this.activeSite.elementOffset(this)},set:function(a){void 0===this.activeSite?this._naiveOffset=a:this.activeSite.setElementOffset(this,a)}},{key:"priority",get:function(){return this._priority},set:function(a){this._priority=a}},{key:"duration",get:function(){return this._duration},set:function(a){"object"===(void 0===a?"undefined":D(a))?this._duration=a:"number"==typeof a?this._duration.quarterLength=a:"string"==typeof a&&(this._duration.type=a)}},{key:"quarterLength",get:function(){return this.duration.quarterLength},set:function(a){this.duration.quarterLength=a}}]),b}(V.ProtoM21Object);ha.Music21Object=ia;var ja={},ka=function(b){function c(){E(this,c);var a=J(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));return a.name=void 0,a.placement="above",a.vexflowModifier=void 0,a.setPosition=void 0,a.dynamicScale=1,a.lengthScale=1,a}return I(c,b),F(c,[{key:"vexflow",value:function(){var b=new a.Flow.Articulation(this.vexflowModifier);return this.setPosition&&b.setPosition(this.setPosition),b}}]),c}(V.ProtoM21Object);ja.Articulation=ka;var la=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.name="length-articulation",a}return I(b,a),b}(ka);ja.LengthArticulation=la;var ma=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.name="dynamic-articulation",a}return I(b,a),b}(ka);ja.DynamicArticulation=ma;var na=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.name="pitch-articulation",a}return I(b,a),b}(ka);ja.PitchArticulation=na;var oa=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.name="timbre-articulation",a}return I(b,a),b}(ka);ja.TimbreArticulation=oa;var pa=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.name="accent",a.vexflowModifier="a>",a.dynamicScale=1.5,a}return I(b,a),b}(ma);ja.Accent=pa;var qa=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.name="strong accent",a.vexflowModifier="a^",a.dynamicScale=2,a}return I(b,a),b}(pa);ja.StrongAccent=qa;var ra=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.name="staccato",a.vexflowModifier="a.",a}return I(b,a),b}(la);ja.Staccato=ra;var sa=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.name="staccatissimo",a.vexflowModifier="av",a}return I(b,a),b}(ra);ja.Staccatissimo=sa;var ta=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.name="spiccato",a.vexflowModifier=void 0,a}return I(b,a),b}(ra);ja.Spiccato=ta;var ua=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return S.mixin(la,a),a.name="marcato",a.vexflowModifier="a^",a.dynamicScale=1.7,a}return I(b,a),b}(ma);ja.Marcato=ua;var va=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.name="tenuto",a.vexflowModifier="a-",a}return I(b,a),b}(la);ja.Tenuto=va;var wa={};wa.fftSize=2048,wa.AudioContextCaller=window.AudioContext||window.webkitAudioContext,wa._audioContext=null,wa.animationFrameCallbackId=null,Object.defineProperties(wa,{audioContext:{get:function(){return null!==wa._audioContext?wa._audioContext:(void 0!==C&&void 0!==C.WebAudio&&void 0!==C.WebAudio.getContext()?window.globalAudioContext=C.WebAudio.getContext():void 0===window.globalAudioContext&&(window.globalAudioContext=new wa.AudioContextCaller),wa._audioContext=window.globalAudioContext,wa._audioContext)},set:function(a){wa._audioContext=a}}}),wa.getUserMedia=function(a,b,c){void 0===c&&(c=function(){alert("navigator.getUserMedia either not defined (Safari, IE) or denied.")}),void 0===b&&(b=function(a){wa.userMediaStarted(a)});var d=navigator;d.getUserMedia=d.getUserMedia||d.webkitGetUserMedia||d.mozGetUserMedia||d.msGetUserMedia,void 0===d.getUserMedia&&c(),void 0===a&&(a={audio:{mandatory:{},optional:[]}}),d.getUserMedia(a,b,c)},wa.sampleBuffer=null,wa.currentAnalyser=null,wa.userMediaStarted=function(a){wa.sampleBuffer=new Float32Array(wa.fftSize/2);var b=wa.audioContext.createMediaStreamSource(a),c=wa.audioContext.createAnalyser();c.fftSize=wa.fftSize,b.connect(c),wa.currentAnalyser=c,wa.animateLoop()},wa.minFrequency=55,wa.maxFrequency=1050,wa.animateLoop=function(a){wa.currentAnalyser.getFloatTimeDomainData(wa.sampleBuffer);var b=wa.autoCorrelate(wa.sampleBuffer,wa.audioContext.sampleRate,wa.minFrequency,wa.maxFrequency);-1!==wa.sampleCallback(b)&&(wa.animationFrameCallbackId=window.requestAnimationFrame(wa.animateLoop))},wa.pitchSmoothingSize=40,wa.lastPitchClassesDetected=[],wa.lastPitchesDetected=[],wa.lastCentsDeviationsDetected=[],wa.smoothPitchExtraction=function(a){if(-1===a)wa.lastPitchClassesDetected.shift(),wa.lastPitchesDetected.shift(),wa.lastCentsDeviationsDetected.shift();else{var b=wa.midiNumDiffFromFrequency(a),c=L(b,2),d=c[0],e=c[1];wa.lastPitchClassesDetected.length>wa.pitchSmoothingSize&&(wa.lastPitchClassesDetected.shift(),wa.lastPitchesDetected.shift(),wa.lastCentsDeviationsDetected.shift()),wa.lastPitchClassesDetected.push(d%12),wa.lastPitchesDetected.push(d),wa.lastCentsDeviationsDetected.push(e)}var f=S.statisticalMode(wa.lastPitchClassesDetected);if(null===f)return[-1,0];for(var g=[],h=[],i=0;i<wa.lastPitchClassesDetected.length;i++)wa.lastPitchClassesDetected[i]===f&&(g.push(wa.lastPitchesDetected[i]),h.push(wa.lastCentsDeviationsDetected[i]));for(var j=S.statisticalMode(g),k=0,l=0,m=0;m<h.length;m++){var n=Math.pow(m,2)+1;l+=n*h[m],k+=n}return[j,Math.floor(l/k)]},wa.sampleCallback=function(a){var b=wa.smoothPitchExtraction(a),c=L(b,2);c[0],c[1]},wa.autoCorrelate=function(a,b,c,d){var e=a.length,f=Math.floor(e/2);void 0===c&&(c=0),void 0===d&&(d=b);for(var g=-1,h=0,i=0,j=!1,k=new Array(f),l=0;l<e;l++){var m=a[l];i+=m*m}if((i=Math.sqrt(i/e))<.01)return-1;for(var n=1,o=0;o<f;o++){var p=0,q=b/o;if(q<c)break;if(!(q>d)){for(var r=0;r<f;r++)p+=Math.abs(a[r]-a[r+o]);if(p=1-p/f,k[o]=p,p>.9&&p>n)j=!0,p>h&&(h=p,g=o);else if(j){var s=(k[g+1]-k[g-1])/k[g];return b/(g+8*s)}n=p}}return h>.01?b/g:-1},wa.midiNumDiffFromFrequency=function(a){var b=Math.log(a/440)/Math.log(2)*12+69,c=Math.round(b);return[c,Math.round(100*(b-c))]};var xa=function(){function a(b){E(this,a);var c=b||{};this.bufferLen=c.bufferLen||4096,this.config=c,this.recording=!1,this.currCallback=void 0,this.audioContext=wa.audioContext,this.frequencyCanvasInfo={id:"frequencyAnalyser",width:void 0,height:void 0,canvasContext:void 0,animationFrameID:void 0},this.waveformCanvasInfo={id:"waveformCanvas",width:void 0,height:void 0,canvasContext:void 0},this.analyserNode=void 0}return F(a,[{key:"initAudio",value:function(){var a=this;this.polyfillNavigator(),navigator.getUserMedia({audio:{mandatory:{googEchoCancellation:"false",googAutoGainControl:"false",googNoiseSuppression:"false",googHighpassFilter:"false"},optional:[]}},function(b){return a.audioStreamConnected(b)},function(a){console.log("Error getting audio -- try on google Chrome?"),console.log(a)})}},{key:"audioStreamConnected",value:function(a){var b=this.audioContext.createGain();this.audioContext.createMediaStreamSource(a).connect(b);var c=this.audioContext.createAnalyser();c.fftSize=2048,this.analyserNode=c,b.connect(c),this.connectSource(b);var d=this.audioContext.createGain();d.gain.value=0,b.connect(d),d.connect(this.audioContext.destination)}},{key:"connectSource",value:function(a){var b=this;this.context=a.context,this.setNode();var c=new Blob(["(",ya,")()"],{type:"application/javascript"}),d=URL.createObjectURL(c);this.worker=new Worker(d),this.worker.onmessage=function(a){var c=a.data;b.currCallback(c)},URL.revokeObjectURL(d),this.worker.postMessage({command:"init",config:{sampleRate:this.context.sampleRate}}),this.node.onaudioprocess=function(a){b.recording&&b.worker.postMessage({command:"record",buffer:[a.inputBuffer.getChannelData(0),a.inputBuffer.getChannelData(1)]})},a.connect(this.node),this.node.connect(this.context.destination)}},{key:"setNode",value:function(){return this.context.createScriptProcessor?this.node=this.context.createScriptProcessor(this.bufferLen,2,2):this.node=this.context.createJavaScriptNode(this.bufferLen,2,2),this.node}},{key:"configure",value:function(a){for(var b in a)Object.hasOwnProperty.call(a,b)&&(this.config[b]=a[b])}},{key:"record",value:function(){this.recording=!0}},{key:"stop",value:function(){this.recording=!1}},{key:"clear",value:function(){this.worker.postMessage({command:"clear"})}},{key:"getBuffers",value:function(a){this.currCallback=a||this.config.callback,this.worker.postMessage({command:"getBuffers"})}},{key:"exportWAV",value:function(a,b,c){var d=this,e="exportWAV";!0===c&&(e="exportMonoWAV"),this.currCallback=a||this.config.callback,b=b||this.config.type||"audio/wav",this.currCallback||(this.currCallback=function(a){d.setupDownload(a,"myRecording"+Date.now().toString()+".wav")}),this.worker.postMessage({command:e,type:b})}},{key:"exportMonoWAV",value:function(a,b){this.exportWAV(a,b,!0)}},{key:"setupDownload",value:function(a,b,c){c=c||"save";var d=(window.URL||window.webkitURL).createObjectURL(a),e=document.getElementById(c);e.href=d,e.download=b||"output.wav"}},{key:"polyfillNavigator",value:function(){if(navigator.getUserMedia||(navigator.getUserMedia=navigator.webkitGetUserMedia||navigator.mozGetUserMedia),window.AnalyserNode&&!window.AnalyserNode.prototype.getFloatTimeDomainData){var a=new Uint8Array(2048);window.AnalyserNode.prototype.getFloatTimeDomainData=function(b){this.getByteTimeDomainData(a);for(var c=b.length,d=0;d<c;d++)b[d]=.0078125*(a[d]-128)}}}},{key:"updateAnalysers",value:function(a){var b=this;if(!this.frequencyCanvasInfo.canvasContext){var c=document.getElementById(this.frequencyCanvasInfo.id);if(!c)return;this.frequencyCanvasInfo.width=c.width,this.frequencyCanvasInfo.height=c.height,this.frequencyCanvasInfo.canvasContext=c.getContext("2d")}var d=Math.round(this.frequencyCanvasInfo.width/3),e=new Uint8Array(this.analyserNode.frequencyBinCount);this.analyserNode.getByteFrequencyData(e);var f=this.frequencyCanvasInfo.canvasContext;f.clearRect(0,0,this.frequencyCanvasInfo.width,this.frequencyCanvasInfo.height),f.fillStyle="#F6D565",f.lineCap="round";for(var g=this.analyserNode.frequencyBinCount/d,h=0;h<d;++h){for(var i=0,j=Math.floor(h*g),k=0;k<g;k++)i+=e[j+k];i=i*(this.frequencyCanvasInfo.height/256)/g,f.fillStyle="hsl( "+Math.round(360*h/d)+", 100%, 50%)",f.fillRect(3*h,this.frequencyCanvasInfo.height,1,-1*i)}this.frequencyCanvasInfo.animationFrameID=window.requestAnimationFrame(function(a){return b.updateAnalysers(a)})}},{key:"drawWaveformCanvas",value:function(a){var b=a[0];if(!this.waveformCanvasInfo.context){var c=document.getElementById(this.waveformCanvasInfo.id);if(!c)return;this.waveformCanvasInfo.width=c.width,this.waveformCanvasInfo.height=c.height,this.waveformCanvasInfo.context=c.getContext("2d")}var d=this.waveformCanvasInfo.context,e=Math.ceil(b.length/this.waveformCanvasInfo.width),f=this.waveformCanvasInfo.height/2;d.fillStyle="silver",d.clearRect(0,0,this.waveformCanvasInfo.width,this.waveformCanvasInfo.height);for(var g=0;g<this.waveformCanvasInfo.width;g++){for(var h=1,i=-1,j=0;j<e;j++){var k=b[g*e+j];k<h&&(h=k),k>i&&(i=k)}d.fillRect(g,(1+h)*f,1,Math.max(1,(i-h)*f))}}},{key:"playBuffers",value:function(a){for(var b=a[0].length,c=this.context.createBuffer(2,b,this.context.sampleRate),d=0;d<2;d++)for(var e=c.getChannelData(d),f=0;f<b;f++)e[f]=a[d][f];var g=this.context.createBufferSource();return g.buffer=c,g.connect(this.context.destination),g.start(),g}}]),a}(),ya="function recorderWorkerJs() {\n /**\n *\n * Rewritten from Matt Diamond's recorderWorker -- MIT License\n */\n RecorderWorker = function RecorderWorker(parentContext) {\n this.parent = parentContext;\n this.recLength = 0;\n this.recBuffersL = [];\n this.recBuffersR = [];\n this.sampleRate = undefined;\n };\n RecorderWorker.prototype.onmessage = function onmessage(e) {\n switch (e.data.command) {\n case 'init':\n this.init(e.data.config);\n break;\n case 'record':\n this.record(e.data.buffer);\n break;\n case 'exportWAV':\n this.exportWAV(e.data.type);\n break;\n case 'exportMonoWAV':\n this.exportMonoWAV(e.data.type);\n break;\n case 'getBuffers':\n this.getBuffers();\n break;\n case 'clear':\n this.clear();\n break;\n default:\n break;\n }\n };\n RecorderWorker.prototype.postMessage = function postMessage(msg) {\n this.parent.postMessage(msg);\n };\n\n RecorderWorker.prototype.init = function init(config) {\n this.sampleRate = config.sampleRate;\n };\n\n RecorderWorker.prototype.record = function record(inputBuffer) {\n var inputBufferL = inputBuffer[0];\n var inputBufferR = inputBuffer[1];\n this.recBuffersL.push(inputBufferL);\n this.recBuffersR.push(inputBufferR);\n this.recLength += inputBufferL.length;\n };\n\n RecorderWorker.prototype.exportWAV = function exportWAV(type) {\n var bufferL = this.mergeBuffers(this.recBuffersL);\n var bufferR = this.mergeBuffers(this.recBuffersR);\n var interleaved = this.interleave(bufferL, bufferR);\n var dataview = this.encodeWAV(interleaved);\n var audioBlob = new Blob([dataview], { 'type': type });\n\n this.postMessage(audioBlob);\n };\n\n RecorderWorker.prototype.exportMonoWAV = function exportMonoWAV(type) {\n var bufferL = this.mergeBuffers(this.recBuffersL);\n var dataview = this.encodeWAV(bufferL);\n var audioBlob = new Blob([dataview], { 'type': type });\n\n this.postMessage(audioBlob);\n };\n\n RecorderWorker.prototype.mergeBuffers = function mergeBuffers(recBuffers) {\n var result = new Float32Array(this.recLength);\n var offset = 0;\n for (var i = 0; i < recBuffers.length; i++) {\n result.set(recBuffers[i], offset);\n offset += recBuffers[i].length;\n }\n return result;\n };\n\n RecorderWorker.prototype.getBuffers = function getBuffers() {\n var buffers = [];\n buffers.push(this.mergeBuffers(this.recBuffersL));\n buffers.push(this.mergeBuffers(this.recBuffersR));\n this.postMessage(buffers);\n };\n\n RecorderWorker.prototype.clear = function clear() {\n this.recLength = 0;\n this.recBuffersL = [];\n this.recBuffersR = [];\n }\n\n RecorderWorker.prototype.interleave = function interleave(inputL, inputR) {\n var combinedLength = inputL.length + inputR.length;\n var result = new Float32Array(combinedLength);\n\n var index = 0;\n var inputIndex = 0;\n\n while (index < combinedLength) {\n result[index++] = inputL[inputIndex];\n result[index++] = inputR[inputIndex];\n inputIndex++;\n }\n return result;\n }\n RecorderWorker.prototype.encodeWAV = function encodeWAV(samples, mono) {\n var buffer = new ArrayBuffer(44 + (samples.length * 2));\n var view = new DataView(buffer);\n\n /* RIFF identifier */\n writeString(view, 0, 'RIFF');\n\n /* file length */\n view.setUint32(4, 32 + samples.length * 2, true);\n\n /* RIFF type */\n writeString(view, 8, 'WAVE');\n\n /* format chunk identifier */\n writeString(view, 12, 'fmt ');\n\n /* format chunk length */\n view.setUint32(16, 16, true);\n\n /* sample format (raw) */\n view.setUint16(20, 1, true);\n\n /* channel count */\n view.setUint16(22, mono ? 1 : 2, true);\n\n /* sample rate */\n view.setUint32(24, this.sampleRate, true);\n\n /* byte rate (sample rate * block align) */\n view.setUint32(28, this.sampleRate * 4, true);\n\n /* block align (channel count * bytes per sample) */\n view.setUint16(32, 4, true);\n\n /* bits per sample */\n view.setUint16(34, 16, true);\n\n /* data chunk identifier */\n writeString(view, 36, 'data');\n\n /* data chunk length */\n view.setUint32(40, samples.length * 2, true);\n\n floatTo16BitPCM(view, 44, samples);\n\n return view;\n }\n\n function floatTo16BitPCM(output, offset, input) {\n for (var i = 0; i < input.length; i++, offset += 2) {\n var s = Math.max(-1, Math.min(1, input[i]));\n output.setInt16(offset, s < 0 ? s * 0x8000 : s * 0x7FFF, true);\n }\n }\n\n function writeString(view, offset, string) {\n for (var i = 0; i < string.length; i++) {\n view.setUint8(offset + i, string.charCodeAt(i));\n }\n }\n\n var recordWorker = new RecorderWorker(this);\n this.onmessage = (function mainOnMessage(e) { recordWorker.onmessage(e) }).bind(this);\n}",za={Recorder:xa},Aa=["regular","dotted","dashed","heavy","double","final","heavy-light","heavy-heavy","tick","short","none"],Ba={"light-light":"double","light-heavy":"final"},Ca={double:"light-light",final:"light-heavy"},Da=function(a){function b(){return E(this,b),J(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return I(b,a),b}(O),Ea=function(a){function b(a,c){E(this,b);var d=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return d._type=void 0,d.type=a,d.location=c,d}return I(b,a),F(b,[{key:"musicXMLBarStyle",value:function(){return g(this.type)}},{key:"type",get:function(){return this._type},set:function(a){this._type=h(a)}}]),b}(ha.Music21Object),Fa=Object.freeze({BarException:Da,Barline:Ea,default:Ea}),Ga={};Ga.validBeamTypes={start:!0,stop:!0,continue:!0,partial:!0},Ga.beamableDurationTypes=[Z.typeFromNumDict[8],Z.typeFromNumDict[16],Z.typeFromNumDict[32],Z.typeFromNumDict[64],Z.typeFromNumDict[128],Z.typeFromNumDict[256]];var Ha=function(a){function b(a,c){E(this,b);var d=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return d.type=a,d.direction=c,d.independentAngle=void 0,d.number=void 0,d}return I(b,a),b}(V.ProtoM21Object);Ga.Beam=Ha;var Ia=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.beamsList=[],a.feathered=!1,a}return I(b,a),F(b,null,[{key:"naiveBeams",value:function(a){var b=[],c=!0,d=!1,e=void 0;try{for(var f,g=a[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;if(Ga.beamableDurationTypes.includes(h.duration.type))if(h.isRest)b.push(void 0);else{var i=new Ga.Beams;i.fill(h.duration.type),b.push(i)}else b.push(void 0)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return b}},{key:"removeSandwichedUnbeamables",value:function(a){for(var b=void 0,c=void 0,d=0;d<a.length;d++)c=d!==a.length-1?a[d+1]:void 0,void 0===b&&void 0===c&&(a[d]=void 0),b=a[d];return a}},{key:"sanitizePartialBeams",value:function(a){for(var b=0;b<a.length;b++)if(void 0!==a[b]){var c=a[b].getTypes();if(c.includes("start")||c.includes("stop")||c.includes("continue")){var d=!1,e=!1,f=!0,g=!1,h=void 0;try{for(var i,j=a[b].beamsList[Symbol.iterator]();!(f=(i=j.next()).done);f=!0){var k=i.value;"start"!==k.type?"stop"!==k.type?d&&"partial"===k.type&&"left"===k.direction?k.direction="right":e&&"partial"===k.type&&"right"===k.direction&&(k.direction="left"):e=!0:d=!0}}catch(a){g=!0,h=a}finally{try{!f&&j.return&&j.return()}finally{if(g)throw h}}}else a[b]=void 0}return a}},{key:"mergeConnectingPartialBeams",value:function(a){for(var b=0;b<a.length-1;b++){var c=a[b],d=a[b+1];if(c&&d){var e=c.getNumbers();if(e&&0!==e.length){var f=!0,g=!1,h=void 0;try{for(var i,j=e[Symbol.iterator]();!(f=(i=j.next()).done);f=!0){var k=i.value,l=c.getByNumber(k);if("partial"===l.type&&"right"===l.direction&&d.getNumbers().includes(k)){var m=d.getByNumber(k);"partial"!==m.type&&"right"!==m.direction&&"continue"!==m.type&&"stop"!==m.type&&(l.type="start",l.direction=void 0,"partial"===m.type?m.type="stop":"start"===m.type&&(m.type="continue"),m.direction=void 0)}}}catch(a){g=!0,h=a}finally{try{!f&&j.return&&j.return()}finally{if(g)throw h}}}}}for(var n=1;n<a.length;n++){var o=a[n],p=a[n-1];if(o&&p){var q=o.getNumbers();if(q&&0!==q.length){var r=!0,s=!1,t=void 0;try{for(var u,v=q[Symbol.iterator]();!(r=(u=v.next()).done);r=!0){var w=u.value,x=o.getByNumber(w);if("partial"===x.type&&"left"===x.direction&&p.getNumbers().includes(w)){var y=p.getByNumber(w);"stop"===y.type&&(x.type="stop",x.direction=void 0,y.type="continue")}}}catch(a){s=!0,t=a}finally{try{!r&&v.return&&v.return()}finally{if(s)throw t}}}}}return a}}]),F(b,[{key:"append",value:function(a,b){var c=new Ga.Beam(a,b);return c.number=this.beamsList.length+1,this.beamsList.push(c),c}},{key:"fill",value:function(a,b){this.beamsList=[];var c=1;if(1===a||"8th"===a||a===Z.typeFromNumDict[8])c=1;else if(2===a||a===Z.typeFromNumDict[16])c=2;else if(3===a||a===Z.typeFromNumDict[32])c=3;else if(4===a||a===Z.typeFromNumDict[64])c=4;else if(5===a||a===Z.typeFromNumDict[128])c=5;else{if(6!==a&&a!==Z.typeFromNumDict[256])throw new O("cannot fill beams for level "+a);c=6}for(var d=1;d<=c;d++){var e=new Ga.Beam;e.number=d,this.beamsList.push(e)}return void 0!==b&&this.setAll(b),this}},{key:"getByNumber",value:function(a){if(!this.getNumbers().includes(a))throw new O("beam number error: "+a);var b=!0,c=!1,d=void 0;try{for(var e,f=this.beamsList[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;if(g.number===a)return g}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}}},{key:"getNumbers",value:function(){var a=[],b=!0,c=!1,d=void 0;try{for(var e,f=this.beamsList[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;a.push(g.number)}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}return a}},{key:"getTypeByNumber",value:function(a){var b=this.getByNumber(a);return void 0===b.direction?b.type:b.type+"-"+b.direction}},{key:"getTypes",value:function(){for(var a=[],b=0;b<this.length;b++)a.push(this.beamsList[b].type);return a}},{key:"setAll",value:function(a,b){if(void 0===Ga.validBeamTypes[a])throw new O("invalid beam type: "+a);for(var c=0;c<this.length;c++){var d=this.beamsList[c];d.type=a,d.direction=b}return this}},{key:"setByNumber",value:function(a,b,c){if(void 0===c){var d=b.split("-");b=d[0],c=d[1]}if(void 0===Ga.validBeamTypes[b])throw new O("invalid beam type: "+b);for(var e=0;e<this.length;e++)this.beamsList[e].number===a&&(this.beamsList[e].type=b,this.beamsList[e].direction=c);return this}},{key:"length",get:function(){return this.beamsList.length}}]),b}(V.ProtoM21Object);Ga.Beams=Ia;var Ja={},Ka=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c._name="",c._alter=0,c._modifier="",c._unicodeModifier="",c.displayType="normal",c.displayStatus=void 0,c.set(a),c}return I(b,a),F(b,[{key:"stringInfo",value:function(){return this.name}},{key:"set",value:function(a){if(void 0!==a&&void 0!==a.toLowerCase&&(a=a.toLowerCase()),"natural"===a||"n"===a||0===a||void 0===a)this._name="natural",this._alter=0,this._modifier="",this._unicodeModifier="♮";else if("sharp"===a||"#"===a||1===a)this._name="sharp",this._alter=1,this._modifier="#",this._unicodeModifier="♯";else if("flat"===a||"-"===a||"b"===a||-1===a)this._name="flat",this._alter=-1,this._modifier="-",this._unicodeModifier="♭";else if("double-flat"===a||"--"===a||-2===a)this._name="double-flat",this._alter=-2,this._modifier="--",this._unicodeModifier="𝄫";else if("double-sharp"===a||"##"===a||2===a)this._name="double-sharp",this._alter=2,this._modifier="##",this._unicodeModifier="𝄪";else if("triple-flat"===a||"---"===a||-3===a)this._name="triple-flat",this._alter=-3,this._modifier="---",this._unicodeModifier="♭𝄫";else if("triple-sharp"===a||"###"===a||3===a)this._name="triple-sharp",this._alter=3,this._modifier="###",this._unicodeModifier="𝄪";else if("quadruple-flat"===a||"----"===a||-4===a)this._name="quadruple-flat",this._alter=-4,this._modifier="----",this._unicodeModifier="♭𝄫";else{if("quadruple-sharp"!==a&&"####"!==a&&4!==a)throw new O("Accidental is not supported: "+a);this._name="quadruple-sharp",this._alter=4,this._modifier="####",this._unicodeModifier="𝄪"}}},{key:"name",get:function(){return this._name},set:function(a){this.set(a)}},{key:"alter",get:function(){return this._alter},set:function(a){this.set(a)}},{key:"modifier",get:function(){return this._modifier},set:function(a){this.set(a)}},{key:"vexflowModifier",get:function(){var a=this.modifier;if(""===a)return"n";if("#"===a)return"#";if("-"===a)return"b";if("##"===a)return"##";if("--"===a)return"bb";if("###"===a)return"###";if("---"===a)return"bbb";throw new O("Vexflow does not support: "+a)}},{key:"unicodeModifier",get:function(){return this._unicodeModifier}}]),b}(V.ProtoM21Object);Ja.Accidental=Ka,Ja.nameToMidi={C:0,D:2,E:4,F:5,G:7,A:9,B:11},Ja.nameToSteps={C:0,D:1,E:2,F:3,G:4,A:5,B:6},Ja.stepsToName=["C","D","E","F","G","A","B"],Ja.midiToName=["C","C#","D","E-","E","F","F#","G","A-","A","B-","B"];var La=function(a){function b(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"C";E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c._step="C",c._octave=4,c._accidental=void 0,c.spellingIsInferred=!1,"number"==typeof a?(a<12&&(a+=60),c.ps=a):a.match(/\d+/)?c.nameWithOctave=a:c.name=a,c}return I(b,a),F(b,[{key:"stringInfo",value:function(){return this.nameWithOctave}},{key:"_getEnharmonicHelper",value:function(){var a=arguments.length>0&&void 0!==arguments[0]&&arguments[0],b=arguments[1],c=!0;void 0===this.octave&&(c=!1);var d=this.clone();for(d.diatonicNoteNum+=b,void 0===d.accidental&&(d.accidental=new Ka(0));d.ps%12!=this.ps%12;)d.accidental.alter+=-1*b;return a?(this.step=d.step,this.accidental=d.accidental,void 0===d.microtone&&(this.microtone=d.microtone),this.octave=c?d.octave:void 0,d):d}},{key:"getHigherEnharmonic",value:function(){var a=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._getEnharmonicHelper(a,1)}},{key:"getLowerEnharmonic",value:function(){var a=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._getEnharmonicHelper(a,-1)}},{key:"vexflowName",value:function(a){var b=this;if(void 0!==a)try{b=a.convertPitchToTreble(this)}catch(b){console.log(b,a)}var c="n";return void 0!==this.accidental&&([0,-1,-2,1,2].includes(this.accidental.alter)?c=this.accidental.vexflowModifier:console.warn("unsupported accidental: "+this.accidental)),b.step+c+"/"+b.octave}},{key:"step",get:function(){return this._step},set:function(a){if(""===a)throw new TypeError("All notes must have a step");if("string"!=typeof a)throw new TypeError("Steps must be strings");if(a=a.toUpperCase(),!Ja.stepsToName.includes(a))throw new TypeError(a+" is not a valid step name.");this._step=a,this.spellingIsInferred=!1}},{key:"octave",get:function(){return this._octave},set:function(a){this._octave=a}},{key:"implicitOctave",get:function(){var a=this._octave;return void 0===a?4:a}},{key:"accidental",get:function(){return this._accidental},set:function(a){"object"!==(void 0===a?"undefined":D(a))&&void 0!==a&&(a=new Ja.Accidental(a)),this._accidental=a,this.spellingIsInferred=!1}},{key:"name",get:function(){return void 0===this.accidental?this.step:this.step+this.accidental.modifier},set:function(a){this.step=a.slice(0,1);var b=a.slice(1);this.accidental=b||void 0}},{key:"nameWithOctave",get:function(){return this.name+this.octave.toString()},set:function(a){var b=a.match(/\d+/);void 0!==b?(a=a.replace(/\d+/,""),this.octave=parseInt(b),this.name=a):this.name=a}},{key:"pitchClass",get:function(){return S.posMod(Math.round(this.ps),12)}},{key:"diatonicNoteNum",get:function(){return 7*this.octave+Ja.nameToSteps[this.step]+1},set:function(a){a-=1,this.octave=Math.floor(a/7);var b=S.posMod(Math.round(a),7);this.step=Ja.stepsToName[b]}},{key:"frequency",get:function(){return 440*Math.pow(2,(this.ps-69)/12)}},{key:"midi",get:function(){return Math.floor(this.ps)}},{key:"ps",get:function(){var a=0;return void 0!==this.accidental&&(a=this.accidental.alter),12*(this.octave+1)+Ja.nameToMidi[this.step]+a},set:function(a){this.name=Ja.midiToName[S.posMod(a,12)],this.octave=Math.floor(a/12)-1,this.spellingIsInferred=!0}},{key:"unicodeName",get:function(){return void 0!==this.accidental?this.step+this.accidental.unicodeModifier():this.step}},{key:"unicodeNameWithOctave",get:function(){
return void 0===this.octave?this.unicodeName:this.unicodeName+this.octave.toString()}}]),b}(V.ProtoM21Object);Ja.Pitch=La;var Ma={},Na=function(a){function b(){return E(this,b),J(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return I(b,a),b}(O);Ma.NotRestException=Na,Ma.noteheadTypeNames=["arrow down","arrow up","back slashed","circle dot","circle-x","circled","cluster","cross","diamond","do","fa","inverted triangle","la","left triangle","mi","none","normal","other","re","rectangle","slash","slashed","so","square","ti","triangle","x"],Ma.stemDirectionNames=["double","down","noStem","none","unspecified","up"];var Oa=function(a){function b(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,d=arguments[2],e=arguments[3],f=arguments[4];E(this,b);var g=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return g.lyricConnector="-",g.text=a,g._number=c,g.syllabic=d,g.applyRaw=e||!1,g.setTextAndSyllabic(g.text,g.applyRaw),g._identifier=f,g.style={fillStyle:"black",strokeStyle:"black",fontFamily:"Serif",fontSize:12,fontWeight:""},g}return I(b,a),F(b,[{key:"setTextAndSyllabic",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return void 0===a?(this.text=void 0,this):(b||0!==a.indexOf(this.lyricConnector)||a.slice(-1)!==this.lyricConnector?b||0!==a.indexOf(this.lyricConnector)?b||a.slice(-1)!==this.lyricConnector?(this.text=a,void 0===this.syllabic&&(this.syllabic="single")):(this.text=a.slice(0,-1),this.syllabic="begin"):(this.text=a.slice(1),this.syllabic="end"):(this.text=a.slice(1,-1),this.syllabic="middle"),this)}},{key:"identifier",get:function(){return this._identifier||this._number},set:function(a){this._identifier=a}},{key:"number",get:function(){return this._number},set:function(a){this._number=a}},{key:"rawText",get:function(){return"begin"===this.syllabic?this.text+this.lyricConnector:"middle"===this.syllabic?this.lyricConnector+this.text+this.lyricConnector:"end"===this.syllabic?this.lyricConnector+this.text:this.text},set:function(a){this.setTextAndSyllabic(a,!0)}}]),b}(V.ProtoM21Object);Ma.Lyric=Oa;var Pa=function(a){function c(a){E(this,c);var b=J(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));return b.isChord=!1,b.duration.quarterLength=void 0!==a?a:1,b.volume=60,b.activeVexflowNote=void 0,b.expressions=[],b.articulations=[],b.lyrics=[],b.tie=void 0,b}return I(c,a),F(c,[{key:"addLyric",value:function(a,b){var c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],d=arguments[3];if(void 0===b){var e=this.lyrics.length+1,f=new Ma.Lyric(a,e,void 0,c,d);this.lyrics.push(f)}else{for(var g=!1,h=0;h<this.lyrics.length;h++){var i=this.lyrics[h];if(i.number===b){i.text=a,g=!0;break}}if(!1===g){var j=new Ma.Lyric(a,b,void 0,c,d);this.lyrics.push(j)}}}},{key:"setStemDirectionFromClef",value:function(a){}},{key:"getStemDirectionFromClef",value:function(a){}},{key:"vexflowAccidentalsAndDisplay",value:function(a,b){if(this.duration.dots>0)for(var c=0;c<this.duration.dots;c++)a.addDotToAll();if(R&&console.log(this.stemDirection),"noStem"===this.stemDirection)a.hasStem=function(){return!1};else{var d=5;if(b.stave&&(d=Math.floor(b.stave.options.spacing_between_lines_px/2)),void 0!==b.clef&&void 0!==this.pitch){var e=b.clef.lowestLine+4,f=Math.abs(this.pitch.diatonicNoteNum-e),g=f-7;if(g>0&&void 0!==a.getStemLength){var h=g*d+a.getStemLength();a.setStemLength(h)}}}}},{key:"playMidi",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:120,c=arguments[1],d=arguments[2];if(void 0===d){var e=void 0;void 0!==this.activeSite&&(e=this.activeSite.instrument),d={instrument:e}}var f=this.midiVolume,g=0;void 0!==d.instrument&&(g=d.instrument.midiChannel);var h=this.duration.quarterLength,i=60*h*1e3/a,j=void 0;if(this.isClassOrSubclass("Note")){j=this.pitch.midi;var k=i/1e3;if(void 0!==c&&c.isClassOrSubclass("Note")?c.pitch.midi!==this.pitch.midi?k+=15/a:void 0===this.tie||"start"!==this.tie.type&&"continue"!==this.tie.type||(k+=60*c.duration.quarterLength/a):void 0===c&&(k+=60/a),void 0===this.tie||"start"===this.tie.type)try{b.noteOn(g,j,f,0),b.noteOff(g,j,k)}catch(a){}}else if(this.isClassOrSubclass("Chord"))for(var l=0;l<this._notes.length;l++){j=this._notes[l].pitch.midi;try{b.noteOn(g,j,f,0),b.noteOff(g,j,i/1e3)}catch(a){}}return i}},{key:"lyric",get:function(){return this.lyrics.length>0?this.lyrics[0].text:void 0},set:function(a){this.lyrics=[],void 0!==a&&!1!==a&&this.lyrics.push(new Ma.Lyric(a))}},{key:"midiVolume",get:function(){var a=this.volume;return void 0===a&&(a=60),void 0!==this.articulations&&this.articulations.forEach(function(b){a*=b.dynamicScale,a>127?a=127:isNaN(a)&&(a=60)}),a=Math.floor(a)}}]),c}(ha.Music21Object);Ma.GeneralNote=Pa;var Qa=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.notehead="normal",c.noteheadFill="default",c.noteheadColor="black",c.noteheadParenthesis=!1,c.volume=void 0,c.beams=new Ga.Beams,c._stemDirection="unspecified",c}return I(b,a),F(b,[{key:"stemDirection",get:function(){return this._stemDirection},set:function(a){if(void 0===a)a="unspecified";else if("none"===a)a="noStem";else if(!Ma.stemDirectionNames.includes(a))throw new Na("not a valid stem direction name: "+a);this._stemDirection=a}}]),b}(Pa);Ma.NotRest=Qa;var Ra=function(b){function c(a,b){E(this,c);var d=J(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,b));return d.isNote=!0,d.isRest=!1,void 0!==a&&void 0!==a.isClassOrSubclass&&!0===a.isClassOrSubclass("Pitch")?d.pitch=a:d.pitch=new Ja.Pitch(a),d}return I(c,b),F(c,[{key:"stringInfo",value:function(){return this.name}},{key:"setStemDirectionFromClef",value:function(a){return void 0!==a&&(this.stemDirection=this.getStemDirectionFromClef(a)),this}},{key:"getStemDirectionFromClef",value:function(a){if(void 0!==a){var b=a.lowestLine+4;return this.pitch.diatonicNoteNum-b>=0?"down":"up"}}},{key:"vexflowNote",value:function(b){var c={};S.merge(c,b);var d=c.clef,e=this.stemDirection;if(void 0!==this.activeSite&&void 0!==this.activeSite.renderOptions.stemDirection&&Ma.stemDirectionNames.includes(this.activeSite.renderOptions.stemDirection)?e=this.activeSite.renderOptions.stemDirection:[void 0,"unspecified"].includes(this.stemDirection)&&void 0!==b.clef&&(e=this.getStemDirectionFromClef(b.clef)),void 0!==this.duration){var f=this.duration.vexflowDuration;if(void 0!==f){var g=this.pitch.vexflowName(d),h="down"===e?a.Flow.StaveNote.STEM_DOWN:a.Flow.StaveNote.STEM_UP,i=new a.Flow.StaveNote({keys:[g],duration:f,stem_direction:h});if(this.vexflowAccidentalsAndDisplay(i,c),void 0!==this.pitch.accidental&&("n"!==this.pitch.accidental.vexflowModifier&&!1!==this.pitch.accidental.displayStatus?i.addAccidental(0,new a.Flow.Accidental(this.pitch.accidental.vexflowModifier)):"always"!==this.pitch.accidental.displayType&&!0!==this.pitch.accidental.displayStatus||i.addAccidental(0,new a.Flow.Accidental(this.pitch.accidental.vexflowModifier))),void 0!==this.articulations[0])for(var j=0;j<this.articulations.length;j++){var k=this.articulations[j];i.addArticulation(0,k.vexflow())}if(void 0!==this.expressions[0])for(var l=0;l<this.expressions.length;l++){var m=this.expressions[l];i.addArticulation(0,m.vexflow())}return void 0!==this.noteheadColor&&i.setStyle({fillStyle:this.noteheadColor,strokeStyle:this.noteheadColor}),this.activeVexflowNote=i,i}}}},{key:"name",get:function(){return this.pitch.name},set:function(a){this.pitch.name=a}},{key:"nameWithOctave",get:function(){return this.pitch.nameWithOctave},set:function(a){this.pitch.nameWithOctave=a}},{key:"step",get:function(){return this.pitch.step},set:function(a){this.pitch.step=a}},{key:"octave",get:function(){return this.pitch.octave},set:function(a){this.pitch.octave=a}},{key:"pitches",get:function(){return[this.pitch]},set:function(a){this.pitch=a[0]}}]),c}(Qa);Ma.Note=Ra;var Sa=function(b){function c(a){E(this,c);var b=J(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a));return b.isNote=!1,b.isRest=!0,b.name="rest",b.lineShift=void 0,b.color="black",b}return I(c,b),F(c,[{key:"stringInfo",value:function(){return this.duration.quarterLength.toString()}},{key:"vexflowNote",value:function(b){var c="b/4";if("whole"===this.duration.type&&void 0!==this.activeSite&&1!==this.activeSite.renderOptions.staffLines&&(c="d/5"),void 0!==this.lineShift){var d=new Ja.Pitch("B4"),e=this.lineShift;"whole"===this.duration.type&&(e+=2),d.diatonicNoteNum+=e,c=d.vexflowName(void 0)}var f=new a.Flow.StaveNote({keys:[c],duration:this.duration.vexflowDuration+"r"});if(this.duration.dots>0)for(var g=0;g<this.duration.dots;g++)f.addDotToAll();return void 0!==this.color&&f.setStyle({fillStyle:this.color,strokeStyle:this.color}),this.activeVexflowNote=f,f}}]),c}(Pa);Ma.Rest=Sa;var Ta={};Ta.Direction={DESCENDING:-1,OBLIQUE:0,ASCENDING:1},Ta.IntervalDirectionTerms=["Descending","Oblique","Ascending"],Ta.MusicOrdinals=[void 0,"Unison","Second","Third","Fourth","Fifth","Sixth","Seventh","Octave","Ninth","Tenth","Eleventh","Twelfth","Thirteenth","Fourteenth","Double Octave"];var Ua=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));void 0===a&&(a=1),c.value=a,c.directed=c.value,c.undirected=Math.abs(c.value),1===c.directed?c.direction=Ta.Direction.OBLIQUE:c.directed<0?c.direction=Ta.Direction.DESCENDING:c.directed>1&&(c.direction=Ta.Direction.ASCENDING),c.undirected>2?c.isSkip=!0:c.isSkip=!1,2===c.undirected?c.isDiatonicStep=!0:c.isDiatonicStep=!1,c.isStep=c.isDiatonicStep,1===c.undirected?c.isUnison=!0:c.isUnison=!1;var d=S.posMod(c.undirected,7),e=parseInt(c.undirected/7);return 0===d&&(e-=1,d=7),c.simpleUndirected=d,c.undirectedOctaves=e,c.semiSimpleUndirected=1===d&&e>=1?8:c.simpleUndirected,c.direction===Ta.Direction.DESCENDING?(c.octaves=-1*e,c.simpleDirected=1!==d?-1*d:1,c.semiSimpleDirected=-1*c.semiSimpleUndirected):(c.octaves=e,c.simpleDirected=d,c.semiSimpleDirected=c.semiSimpleUndirected),1===c.simpleUndirected||4===c.simpleUndirected||5===c.simpleUndirected?c.perfectable=!0:c.perfectable=!1,c.undirected<Ta.MusicOrdinals.length?c.niceName=Ta.MusicOrdinals[c.undirected]:c.niceName=c.undirected.toString(),c.simpleNiceName=Ta.MusicOrdinals[c.simpleUndirected],c.semiSimpleNiceName=Ta.MusicOrdinals[c.semiSimpleUndirected],1===Math.abs(c.directed)?c.staffDistance=0:c.directed>1?c.staffDistance=c.directed-1:c.directed<-1&&(c.staffDistance=c.directed+1),c.mod7inversion=9-c.semiSimpleUndirected,c.direction===Ta.Direction.DESCENDING?c.mod7=c.mod7inversion:c.mod7=c.simpleDirected,c}return I(b,a),F(b,[{key:"complement",value:function(){return new Ta.GenericInterval(this.mod7inversion)}},{key:"reverse",value:function(){return 1===this.undirected?new Ta.GenericInterval(1):new Ta.GenericInterval(this.undirected*(-1*this.direction))}},{key:"getDiatonic",value:function(a){return new Ta.DiatonicInterval(a,this)}},{key:"transposePitch",value:function(a){var b=new Ja.Pitch;b.step=a.step,b.octave=a.octave;var c=a.diatonicNoteNum,d=this.staffDistance,e=c+d,f=Ta.convertDiatonicNumberToStep(e),g=L(f,2),h=g[0],i=g[1];return b.step=h,b.octave=i,void 0!==a.accidental&&(b.accidental=new Ja.Accidental(a.accidental.name)),b}}]),b}(V.ProtoM21Object);Ta.GenericInterval=Ua,Ta.IntervalSpecifiersEnum={PERFECT:1,MAJOR:2,MINOR:3,AUGMENTED:4,DIMINISHED:5,DBLAUG:6,DBLDIM:7,TRPAUG:8,TRPDIM:9,QUADAUG:10,QUADDIM:11},Ta.IntervalNiceSpecNames=["ERROR","Perfect","Major","Minor","Augmented","Diminished","Doubly-Augmented","Doubly-Diminished","Triply-Augmented","Triply-Diminished","Quadruply-Augmented","Quadruply-Diminished"],Ta.IntervalPrefixSpecs=[void 0,"P","M","m","A","d","AA","dd","AAA","ddd","AAAA","dddd"],Ta.IntervalOrderedPerfSpecs=["dddd","ddd","dd","d","P","A","AA","AAA","AAAA"],Ta.IntervalPerfSpecifiers=[Ta.IntervalSpecifiersEnum.QUADDMIN,Ta.IntervalSpecifiersEnum.TRPDIM,Ta.IntervalSpecifiersEnum.DBLDIM,Ta.IntervalSpecifiersEnum.DIMINISHED,Ta.IntervalSpecifiersEnum.PERFECT,Ta.IntervalSpecifiersEnum.AUGMENTED,Ta.IntervalSpecifiersEnum.DBLAUG,Ta.IntervalSpecifiersEnum.TRPAUG,Ta.IntervalSpecifiersEnum.QUADAUG],Ta.IntervalPerfOffset=4,Ta.IntervalOrderedImperfSpecs=["dddd","ddd","dd","d","m","M","A","AA","AAA","AAAA"],Ta.IntervalSpecifiers=[Ta.IntervalSpecifiersEnum.QUADDMIN,Ta.IntervalSpecifiersEnum.TRPDIM,Ta.IntervalSpecifiersEnum.DBLDIM,Ta.IntervalSpecifiersEnum.DIMINISHED,Ta.IntervalSpecifiersEnum.MINOR,Ta.IntervalSpecifiersEnum.MAJOR,Ta.IntervalSpecifiersEnum.AUGMENTED,Ta.IntervalSpecifiersEnum.DBLAUG,Ta.IntervalSpecifiersEnum.TRPAUG,Ta.IntervalSpecifiersEnum.QUADAUG],Ta.IntervalMajOffset=5,Ta.IntervalSemitonesGeneric={1:0,2:2,3:4,4:5,5:7,6:9,7:11},Ta.IntervalAdjustPerfect={P:0,A:1,AA:2,AAA:3,AAAA:4,d:-1,dd:-2,ddd:-3,dddd:-4},Ta.IntervalAdjustImperf={M:0,m:-1,A:1,AA:2,AAA:3,AAAA:4,d:-2,dd:-3,ddd:-4,dddd:-5};var Va=function(a){function b(a,c){E(this,b);var d=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));void 0===a&&(a="P"),void 0===c?c=new Ta.GenericInterval(1):"number"==typeof c&&(c=new Ta.GenericInterval(c)),d.name="",d.specifier="number"==typeof a?a:Ta.IntervalPrefixSpecs.indexOf(a),d.generic=c,1!==c.undirected||a===Ta.IntervalSpecifiersEnum.PERFECT?d.direction=c.direction:Ta.IntervalPerfSpecifiers.indexOf(a)<=Ta.IntervalPerfSpecifiers.indexOf(Ta.IntervalSpecifiersEnum.DIMINISHED)?d.direction=Ta.Direction.DESCENDING:d.direction=Ta.Direction.ASCENDING;var e=Ta.IntervalDirectionTerms[d.direction+1];return d.name=Ta.IntervalPrefixSpecs[d.specifier]+c.undirected.toString(),d.niceName=Ta.IntervalNiceSpecNames[d.specifier]+" "+c.niceName,d.simpleName=Ta.IntervalPrefixSpecs[d.specifier]+c.simpleUndirected.toString(),d.simpleNiceName=Ta.IntervalNiceSpecNames[d.specifier]+" "+c.simpleNiceName,d.semiSimpleName=Ta.IntervalPrefixSpecs[d.specifier]+c.semiSimpleUndirected.toString(),d.semiSimpleNiceName=Ta.IntervalNiceSpecNames[d.specifier]+" "+c.semiSimpleNiceName,d.directedName=Ta.IntervalPrefixSpecs[d.specifier]+c.directed.toString(),d.directedNiceName=e+" "+d.niceName,d.directedSimpleName=Ta.IntervalPrefixSpecs[d.specifier]+c.simpleDirected.toString(),d.directedSimpleNiceName=e+" "+d.simpleNiceName,d.directedSemiSimpleName=Ta.IntervalPrefixSpecs[d.specifier]+c.semiSimpleDirected.toString(),d.directedSemiSimpleNiceName=e+" "+d.semiSimpleNameName,d.specificName=Ta.IntervalNiceSpecNames[d.specifier],d.perfectable=c.perfectable,d.isDiatonicStep=c.isDiatonicStep,d.isStep=c.isStep,d.isSkip=c.isSkip,d.perfectable?(d.orderedSpecifierIndex=Ta.IntervalOrderedPerfSpecs.indexOf(Ta.IntervalPrefixSpecs[d.specifier]),d.invertedOrderedSpecIndex=Ta.IntervalOrderedPerfSpecs.length-1-d.orderedSpecifierIndex,d.invertedOrderedSpecifier=Ta.IntervalOrderedPerfSpecs[d.invertedOrderedSpecIndex]):(d.orderedSpecifierIndex=Ta.IntervalOrderedImperfSpecs.indexOf(Ta.IntervalPrefixSpecs[d.specifier]),d.invertedOrderedSpecIndex=Ta.IntervalOrderedImperfSpecs.length-1-d.orderedSpecifierIndex,d.invertedOrderedSpecifier=Ta.IntervalOrderedImperfSpecs[d.invertedOrderedSpecIndex]),d.mod7inversion=d.invertedOrderedSpecifier+c.mod7inversion.toString(),d}return I(b,a),F(b,[{key:"getChromatic",value:function(){var a=Math.floor(Math.abs(this.generic.staffDistance)/7),b=Ta.IntervalSemitonesGeneric[this.generic.simpleUndirected],c=Ta.IntervalPrefixSpecs[this.specifier],d=0;d=this.generic.perfectable?Ta.IntervalAdjustPerfect[c]:Ta.IntervalAdjustImperf[c];var e=12*a+b+d;return this.generic.direction===Ta.Direction.DESCENDING&&(e*=-1),R&&(console.log("DiatonicInterval.getChromatic -- octaveOffset: "+a),console.log("DiatonicInterval.getChromatic -- semitonesStart: "+b),console.log("DiatonicInterval.getChromatic -- specName: "+c),console.log("DiatonicInterval.getChromatic -- semitonesAdjust: "+d),console.log("DiatonicInterval.getChromatic -- semitones: "+e)),new Ta.ChromaticInterval(e)}},{key:"transposePitch",value:function(a){return new Xa(this,this.getChromatic()).transposePitch(a)}},{key:"specifierAbbreviation",get:function(){return Ta.IntervalPrefixSpecs[this.specifier]}},{key:"cents",get:function(){return this.getChromatic().cents}}]),b}(V.ProtoM21Object);Ta.DiatonicInterval=Va;var Wa=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c.semitones=a,c.cents=Math.round(100*a,5),c.directed=a,c.undirected=Math.abs(a),0===c.directed?c.direction=Ta.Direction.OBLIQUE:c.directed===c.undirected?c.direction=Ta.Direction.ASCENDING:c.direction=Ta.Direction.DESCENDING,c.mod12=S.posMod(c.semitones,12),c.simpleUndirected=S.posMod(c.undirected,12),c.direction===Ta.Direction.DESCENDING?c.simpleDirected=-1*c.simpleUndirected:c.simpleDirected=c.simpleUndirected,c.intervalClass=c.mod12,c.mod12>6&&(c.intervalClass=12-c.mod12),1===c.undirected?c.isChromaticStep=!0:c.isChromaticStep=!1,c}return I(b,a),F(b,[{key:"reverse",value:function(){return new Ta.ChromaticInterval(this.undirected*(-1*this.direction))}},{key:"transposePitch",value:function(a){var b=!1;void 0===a.octave&&(b=!0);var c=a.ps,d=new Ja.Pitch;return d.ps=c+this.semitones,b&&(d.octave=void 0),d}}]),b}(V.ProtoM21Object);Ta.ChromaticInterval=Wa,Ta.IntervalStepNames=["C","D","E","F","G","A","B"],Ta.convertDiatonicNumberToStep=function(a){var b=void 0,c=void 0;return 0===a?["B",-1]:(a>0?(c=Math.floor((a-1)/7),b=a-1-7*c):(c=Math.floor(a/7),b=a-1-7*(c+1)),[Ta.IntervalStepNames[b],c])};var Xa=function(a){function b(){E(this,b);for(var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this)),c=void 0,d=void 0,e=arguments.length,f=Array(e),g=0;g<e;g++)f[g]=arguments[g];if(1===f.length){var h=f[0];if("string"==typeof h){var i=h.replace(/\d+/,"").replace(/-/,""),j=parseInt(h.replace(/\D+/,""));h.includes("-")&&(j*=-1);var k=new Ta.GenericInterval(j),l=new Ta.DiatonicInterval(i,k);a.diatonic=l,a.chromatic=a.diatonic.getChromatic()}else void 0!==h.specifier?(a.diatonic=h,a.chromatic=a.diatonic.getChromatic()):console.error("cant parse string arguments to Interval yet")}else if(2===f.length)if(void 0===f[0].pitch&&void 0===f[0].diatonicNoteNum)a.diatonic=f[0],a.chromatic=f[1];else{var m=f[0],n=f[1];if(void 0!==m.classes&&m.classes.includes("Pitch")){var o=m;m=new Ma.Note,m.pitch=o}if(void 0!==n.classes&&n.classes.includes("Pitch")){var p=n;n=new Ma.Note,n.pitch=p}var q=Ta.notesToGeneric(m,n),r=Ta.notesToChromatic(m,n);a.diatonic=Ta.intervalsToDiatonic(q,r),a.chromatic=r,c=m,d=n}return a._noteStart=c,a._noteEnd=d,a.reinit(),a}return I(b,a),F(b,[{key:"reinit",value:function(){this.direction=this.chromatic.direction,this.specifier=this.diatonic.specifier,this.diatonicType=this.diatonic.specifier,this.generic=this.diatonic.generic,this.name=this.diatonic.name,this.niceName=this.diatonic.niceName,this.simpleName=this.diatonic.simpleName,this.simpleNiceName=this.diatonic.simpleNiceName,this.semiSimpleName=this.diatonic.semiSimpleName,this.semiSimpleNiceName=this.diatonic.semiSimpleNiceName,this.directedName=this.diatonic.directedName,this.directedNiceName=this.diatonic.directedNiceName,this.directedSimpleName=this.diatonic.directedSimpleName,this.directedSimpleNiceName=this.diatonic.directedSimpleNiceName,this.isDiatonicStep=this.diatonic.isDiatonicStep,this.isChromaticStep=this.chromatic.isChromaticStep,this.semitones=this.chromatic.semitones,this.intervalClass=this.chromatic.intervalClass,this.cents=this.chromatic.cents,this.isStep=this.isChromaticStep||this.isDiatonicStep,this.isSkip=this.diatonic.isSkip}},{key:"isConsonant",value:function(){return-1!==["P5","m3","M3","m6","M6","P1"].indexOf(this.simpleName)}},{key:"transposePitch",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=b.reverse,d=void 0!==c&&c,e=(b.maxAccidental,this.diatonic.generic.transposePitch(a));e.accidental=void 0;var f=void 0;return f=d?-1*this.chromatic.semitones-Math.floor(e.ps-a.ps):this.chromatic.semitones-Math.floor(e.ps-a.ps),0!==f&&(e.accidental=new Ja.Accidental(f)),R&&(console.log("Interval.transposePitch -- new step "+e.step),console.log("Interval.transposePitch -- new octave "+e.octave),console.log("Interval.transposePitch -- fixing half steps for "+f)),e}},{key:"complement",get:function(){return new Ta.Interval(this.diatonic.mod7inversion)}},{key:"noteStart",get:function(){return this._noteStart},set:function(a){this._noteStart=a;var b=a.pitch,c=this.transposePitch(b);this._noteEnd=a.clone(),this._noteEnd.pitch=c}},{key:"noteEnd",get:function(){return this._noteEnd},set:function(a){this._noteEnd=a;var b=a.pitch,c=this.transposePitch(b,!0);this._noteStart=a.clone(),this._noteStart.pitch=c}}]),b}(V.ProtoM21Object);Ta.Interval=Xa,Ta.intervalFromGenericAndChromatic=function(a,b){"number"==typeof a&&(a=new Ua(a)),"number"==typeof b&&(b=new Wa(b));var c=Ta._getSpecifierFromGenericChromatic(a,b),d=new Va(c,a);return new Xa(d,b)},Ta.notesToGeneric=function(a,b){var c=a;void 0!==a.pitch&&(c=a.pitch);var d=b;void 0!==b.pitch&&(d=b.pitch);var e=d.diatonicNoteNum-c.diatonicNoteNum,f=Ta.convertStaffDistanceToInterval(e);return new Ta.GenericInterval(f)},Ta.convertStaffDistanceToInterval=function(a){return 0===a?1:a>0?a+1:a-1},Ta.notesToChromatic=function(a,b){var c=a;void 0!==a.pitch&&(c=a.pitch);var d=b;return void 0!==b.pitch&&(d=b.pitch),new Ta.ChromaticInterval(d.ps-c.ps)},Ta.intervalsToDiatonic=function(a,b){var c=Ta._getSpecifierFromGenericChromatic(a,b);return new Ta.DiatonicInterval(c,a)},Ta._getSpecifierFromGenericChromatic=function(a,b){var c=[void 0,0,2,4,5,7,9,11],d=c[a.simpleUndirected]+12*a.undirectedOctaves,e=0;e=a.direction!==b.direction&&a.direction!==Ta.Direction.OBLIQUE&&b.direction!==Ta.Direction.OBLIQUE?-1*b.undirected:1===a.undirected?b.directed:b.undirected;var f=Math.round(e);return a.perfectable?Ta.IntervalPerfSpecifiers[Ta.IntervalPerfOffset+f-d]:Ta.IntervalSpecifiers[Ta.IntervalMajOffset+f-d]};var Ya=S.posMod,Za=void 0,$a=void 0,_a=void 0,ab=void 0,bb=void 0,cb=void 0,db=void 0,eb=void 0,fb=void 0,gb=void 0,hb=void 0,ib=void 0,jb=void 0,kb=void 0,lb=void 0,mb=void 0,nb=void 0,ob=void 0,pb=void 0,qb=void 0,rb=void 0,sb=void 0,tb=void 0,ub=void 0,vb=void 0,wb=void 0,xb=void 0,yb=void 0,zb=void 0,Ab=void 0,Bb=void 0,Cb=void 0,Db=void 0,Eb=void 0,Fb=void 0,Gb=void 0,Hb=void 0,Ib=void 0;Za=[[0],[0,0,0,0,0,0],[1,1,1,1,11,11,11,11],0];var Jb=[void 0,Za];Za=[[0,1],[1,0,0,0,0,0],[1,1,0,0,9,9,8,8],0],$a=[[0,2],[0,1,0,0,0,0],[1,1,1,1,9,9,9,9],0],_a=[[0,3],[0,0,1,0,0,0],[1,1,1,1,9,9,9,9],0],ab=[[0,4],[0,0,0,1,0,0],[1,1,1,1,9,9,9,9],0],bb=[[0,5],[0,0,0,0,1,0],[1,1,0,0,9,9,8,8],0],cb=[[0,6],[0,0,0,0,0,1],[2,2,2,2,10,10,10],0];var Kb=[void 0,Za,$a,_a,ab,bb,cb];Za=[[0,1,2],[2,1,0,0,0,0],[1,1,0,0,7,7,4,4],0],$a=[[0,1,3],[1,1,1,0,0,0],[1,0,0,0,5,6,5,5],0],_a=[[0,1,4],[1,0,1,1,0,0],[1,0,0,0,5,6,5,5],0],ab=[[0,1,5],[1,0,0,1,1,0],[1,0,1,0,5,6,5,6],0],bb=[[0,1,6],[1,0,0,0,1,1],[1,0,0,1,6,7,7,6],0],cb=[[0,2,4],[0,2,0,1,0,0],[1,1,1,1,7,7,7,7],0],db=[[0,2,5],[0,1,1,0,1,0],[1,0,0,0,5,6,5,5],0],eb=[[0,2,6],[0,1,0,1,0,1],[1,0,0,1,6,7,7,6],0],fb=[[0,2,7],[0,1,0,0,2,0],[1,1,0,0,7,7,4,4],0],gb=[[0,3,6],[0,0,2,0,0,1],[1,1,1,1,8,8,8,8],0],hb=[[0,3,7],[0,0,1,1,1,0],[1,0,0,0,5,6,5,5],0],ib=[[0,4,8],[0,0,0,3,0,0],[3,3,3,3,9,9,9,9],0];var Lb=[void 0,Za,$a,_a,ab,bb,cb,db,eb,fb,gb,hb,ib];Za=[[0,1,2,3],[3,2,1,0,0,0],[1,1,0,0,5,5,1,1],0],$a=[[0,1,2,4],[2,2,1,1,0,0],[1,0,0,0,3,4,1,1],0],_a=[[0,1,3,4],[2,1,2,1,0,0],[1,1,0,0,3,3,2,2],0],ab=[[0,1,2,5],[2,1,1,1,1,0],[1,0,0,0,1,3,2,3],0],bb=[[0,1,2,6],[2,1,0,1,1,1],[1,0,0,0,2,4,3,2],0],cb=[[0,1,2,7],[2,1,0,0,2,1],[1,1,1,1,4,4,4,4],0],db=[[0,1,4,5],[2,0,1,2,1,0],[1,1,0,0,3,3,3,3],0],eb=[[0,1,5,6],[2,0,0,1,2,1],[1,1,1,1,4,4,4,4],0],fb=[[0,1,6,7],[2,0,0,0,2,2],[2,2,2,2,6,6,6,6],0],gb=[[0,2,3,5],[1,2,2,0,1,0],[1,1,1,1,3,3,3,3],0],hb=[[0,1,3,5],[1,2,1,1,1,0],[1,0,1,0,1,3,1,3],0],ib=[[0,2,3,6],[1,1,2,1,0,1],[1,0,0,0,2,4,3,2],0],jb=[[0,1,3,6],[1,1,2,0,1,1],[1,0,0,1,2,4,4,2],0],kb=[[0,2,3,7],[1,1,1,1,2,0],[1,0,0,0,1,3,2,3],0],lb=[[0,1,4,6],[1,1,1,1,1,1],[1,0,0,0,0,3,3,1],29],mb=[[0,1,5,7],[1,1,0,1,2,1],[1,0,0,0,2,4,3,2],0],nb=[[0,3,4,7],[1,0,2,2,1,0],[1,1,1,1,3,3,3,3],0],ob=[[0,1,4,7],[1,0,2,1,1,1],[1,0,0,1,2,4,4,2],0],pb=[[0,1,4,8],[1,0,1,3,1,0],[1,0,1,0,3,5,3,5],0],qb=[[0,1,5,8],[1,0,1,2,2,0],[1,1,0,0,3,3,3,3],0],rb=[[0,2,4,6],[0,3,0,2,0,1],[1,1,1,1,6,6,6,6],0],sb=[[0,2,4,7],[0,2,1,1,2,0],[1,0,0,0,3,4,1,1],0],tb=[[0,2,5,7],[0,2,1,0,3,0],[1,1,0,0,5,5,1,1],0],ub=[[0,2,4,8],[0,2,0,3,0,1],[1,1,1,1,6,6,6,6],0],vb=[[0,2,6,8],[0,2,0,2,0,2],[2,2,2,2,6,6,6,6],0],wb=[[0,3,5,8],[0,1,2,1,2,0],[1,1,0,0,3,3,2,2],0],xb=[[0,2,5,8],[0,1,2,1,1,1],[1,0,0,0,2,4,3,2],0],yb=[[0,3,6,9],[0,0,4,0,0,2],[4,4,4,4,8,8,8,8],0],zb=[[0,1,3,7],[1,1,1,1,1,1],[1,0,0,0,0,3,3,1],15];var Mb=[void 0,Za,$a,_a,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb,ub,vb,wb,xb,yb,zb];Za=[[0,1,2,3,4],[4,3,2,1,0,0],[1,1,0,0,3,3,0,0],0],$a=[[0,1,2,3,5],[3,3,2,1,1,0],[1,0,0,0,1,2,1,1],0],_a=[[0,1,2,4,5],[3,2,2,2,1,0],[1,0,0,0,1,1,1,0],0],ab=[[0,1,2,3,6],[3,2,2,1,1,1],[1,0,0,0,0,2,0,0],0],bb=[[0,1,2,3,7],[3,2,1,1,2,1],[1,0,0,0,0,1,1,1],0],cb=[[0,1,2,5,6],[3,1,1,2,2,1],[1,0,0,0,0,1,1,1],0],db=[[0,1,2,6,7],[3,1,0,1,3,2],[1,0,0,1,2,3,3,2],0],eb=[[0,2,3,4,6],[2,3,2,2,0,1],[1,1,0,0,2,2,0,0],0],fb=[[0,1,2,4,6],[2,3,1,2,1,1],[1,0,0,0,0,2,0,1],0],gb=[[0,1,3,4,6],[2,2,3,1,1,1],[1,0,0,0,0,1,1,0],0],hb=[[0,2,3,4,7],[2,2,2,2,2,0],[1,0,1,0,1,1,1,1],0],ib=[[0,1,3,5,6],[2,2,2,1,2,1],[1,1,1,1,0,0,0,0],[36]],jb=[[0,1,2,4,8],[2,2,1,3,1,1],[1,0,0,0,0,2,0,1],0],kb=[[0,1,2,5,7],[2,2,1,1,3,1],[1,0,0,0,0,1,1,1],0],lb=[[0,1,2,6,8],[2,2,0,2,2,2],[1,1,1,1,2,2,2,2],0],mb=[[0,1,3,4,7],[2,1,3,2,1,1],[1,0,0,0,0,1,1,0],0],nb=[[0,1,3,4,8],[2,1,2,3,2,0],[1,1,0,0,1,1,2,2],[37]],ob=[[0,1,4,5,7],[2,1,2,2,2,1],[1,0,0,0,0,1,1,0],[38]],pb=[[0,1,3,6,7],[2,1,2,1,2,2],[1,0,0,1,0,2,2,0],0],qb=[[0,1,3,7,8],[2,1,1,2,3,1],[1,0,0,0,0,1,1,1],0],rb=[[0,1,4,5,8],[2,0,2,4,2,0],[1,0,1,0,3,3,3,3],0],sb=[[0,1,4,7,8],[2,0,2,3,2,1],[1,1,1,1,2,2,2,2],0],tb=[[0,2,3,5,7],[1,3,2,1,3,0],[1,0,0,0,1,2,1,1],0],ub=[[0,1,3,5,7],[1,3,1,2,2,1],[1,0,0,0,0,2,0,1],0],vb=[[0,2,3,5,8],[1,2,3,1,2,1],[1,0,0,0,0,1,1,0],0],wb=[[0,2,4,5,8],[1,2,2,3,1,1],[1,0,1,0,0,2,0,2],0],xb=[[0,1,3,5,8],[1,2,2,2,3,0],[1,0,0,0,1,1,1,0],0],yb=[[0,2,3,6,8],[1,2,2,2,1,2],[1,0,0,1,0,2,2,0],0],zb=[[0,1,3,6,8],[1,2,2,1,3,1],[1,0,0,0,0,2,0,0],0],Ab=[[0,1,4,6,8],[1,2,1,3,2,1],[1,0,0,0,0,2,0,1],0],Bb=[[0,1,3,6,9],[1,1,4,1,1,2],[1,0,0,1,0,3,3,0],0],Cb=[[0,1,4,6,9],[1,1,3,2,2,1],[1,0,0,0,0,1,1,0],0],Db=[[0,2,4,6,8],[0,4,0,4,0,2],[1,1,1,1,6,6,6,6],0],Eb=[[0,2,4,6,9],[0,3,2,2,2,1],[1,1,0,0,2,2,0,0],0],Fb=[[0,2,4,7,9],[0,3,2,1,4,0],[1,1,0,0,3,3,0,0],0],Gb=[[0,1,2,4,7],[2,2,2,1,2,1],[1,0,0,1,0,1,1,0],12],Hb=[[0,3,4,5,8],[2,1,2,2,2,0],[1,1,0,0,1,1,2,2],17],Ib=[[0,1,2,5,8],[2,1,2,2,2,1],[1,0,0,0,0,1,1,0],18];var Nb=[void 0,Za,$a,_a,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb,ub,vb,wb,xb,yb,zb,Ab,Bb,Cb,Db,Eb,Fb,Gb,Hb,Ib];Za=[[0,1,2,3,4,5],[5,4,3,2,1,0],[1,1,0,0,1,1,0,0],0],$a=[[0,1,2,3,4,6],[4,4,3,2,1,1],[1,0,0,0,0,1,0,0],0],_a=[[0,1,2,3,5,6],[4,3,3,2,2,1],[1,0,0,0,0,0,0,0],36],ab=[[0,1,2,4,5,6],[4,3,2,3,2,1],[1,1,0,0,0,0,0,0],37],bb=[[0,1,2,3,6,7],[4,2,2,2,3,2],[1,0,0,0,0,1,0,0],0],cb=[[0,1,2,5,6,7],[4,2,1,2,4,2],[1,1,0,0,0,0,1,1],38],db=[[0,1,2,6,7,8],[4,2,0,2,4,3],[2,2,2,2,2,2,2,2],0],eb=[[0,2,3,4,5,7],[3,4,3,2,3,0],[1,1,1,1,1,1,1,1],0],fb=[[0,1,2,3,5,7],[3,4,2,2,3,1],[1,0,1,0,0,1,0,1],0],gb=[[0,1,3,4,5,7],[3,3,3,3,2,1],[1,0,0,0,0,0,0,0],39],hb=[[0,1,2,4,5,7],[3,3,3,2,3,1],[1,0,0,0,0,0,1,0],40],ib=[[0,1,2,4,6,7],[3,3,2,2,3,2],[1,0,0,1,0,0,0,0],41],jb=[[0,1,3,4,6,7],[3,2,4,2,2,2],[1,1,0,0,0,0,0,0],42],kb=[[0,1,3,4,5,8],[3,2,3,4,3,0],[1,0,1,0,1,0,1,0],0],lb=[[0,1,2,4,5,8],[3,2,3,4,2,1],[1,0,0,0,0,1,0,0],0],mb=[[0,1,4,5,6,8],[3,2,2,4,3,1],[1,0,1,0,0,1,0,1],0],nb=[[0,1,2,4,7,8],[3,2,2,3,3,2],[1,0,0,1,0,0,0,0],43],ob=[[0,1,2,5,7,8],[3,2,2,2,4,2],[1,0,0,0,0,1,0,0],0],pb=[[0,1,3,4,7,8],[3,1,3,4,3,1],[1,0,0,0,0,0,1,0],44],qb=[[0,1,4,5,8,9],[3,0,3,6,3,0],[3,3,3,3,3,3,3,3],0],rb=[[0,2,3,4,6,8],[2,4,2,4,1,2],[1,0,0,0,0,1,0,0],0],sb=[[0,1,2,4,6,8],[2,4,1,4,2,2],[1,0,1,0,0,1,0,1],0],tb=[[0,2,3,5,6,8],[2,3,4,2,2,2],[1,1,1,1,0,0,0,0],45],ub=[[0,1,3,4,6,8],[2,3,3,3,3,1],[1,0,0,0,0,0,0,0],46],vb=[[0,1,3,5,6,8],[2,3,3,2,4,1],[1,0,0,0,0,0,0,0],47],wb=[[0,1,3,5,7,8],[2,3,2,3,4,1],[1,1,0,0,0,0,0,0],48],xb=[[0,1,3,4,6,9],[2,2,5,2,2,2],[1,0,0,1,0,1,1,0],0],yb=[[0,1,3,5,6,9],[2,2,4,3,2,2],[1,1,1,1,0,0,0,0],49],zb=[[0,1,3,6,8,9],[2,2,4,2,3,2],[1,1,0,0,0,0,0,0],50],Ab=[[0,1,3,6,7,9],[2,2,4,2,2,3],[2,0,0,2,0,2,2,0],0],Bb=[[0,1,3,5,8,9],[2,2,3,4,3,1],[1,0,0,0,0,1,0,0],0],Cb=[[0,2,4,5,7,9],[1,4,3,2,5,0],[1,1,0,0,1,1,0,0],0],Db=[[0,2,3,5,7,9],[1,4,3,2,4,1],[1,0,0,0,0,1,0,0],0],Eb=[[0,1,3,5,7,9],[1,4,2,4,2,2],[1,0,0,0,0,1,0,0],0],Fb=[[0,2,4,6,8,10],[0,6,0,6,0,3],[6,6,6,6,6,6,6,6],0],Gb=[[0,1,2,3,4,7],[4,3,3,2,2,1],[1,0,0,0,0,0,0,0],3],Hb=[[0,1,2,3,4,8],[4,3,2,3,2,1],[1,1,0,0,0,0,0,0],4],Ib=[[0,1,2,3,7,8],[4,2,1,2,4,2],[1,1,0,0,0,0,1,1],6];var Ob=[[0,2,3,4,5,8],[3,3,3,3,2,1],[1,0,0,0,0,0,0,0],10],Pb=[[0,1,2,3,5,8],[3,3,3,2,3,1],[1,0,0,0,0,0,1,0],11],Qb=[[0,1,2,3,6,8],[3,3,2,2,3,2],[1,0,0,1,0,0,0,0],12],Rb=[[0,1,2,3,6,9],[3,2,4,2,2,2],[1,1,0,0,0,0,0,0],13],Sb=[[0,1,2,5,6,8],[3,2,2,3,3,2],[1,0,0,1,0,0,0,0],17],Tb=[[0,1,2,5,6,9],[3,1,3,4,3,1],[1,0,0,0,0,0,1,0],19],Ub=[[0,2,3,4,6,9],[2,3,4,2,2,2],[1,1,1,1,0,0,0,0],23],Vb=[[0,1,2,4,6,9],[2,3,3,3,3,1],[1,0,0,0,0,0,0,0],24],Wb=[[0,1,2,4,7,9],[2,3,3,2,4,1],[1,0,0,0,0,0,0,0],25],Xb=[[0,1,2,5,7,9],[2,3,2,3,4,1],[1,1,0,0,0,0,0,0],26],Yb=[[0,1,3,4,7,9],[2,2,4,3,2,2],[1,1,1,1,0,0,0,0],28],Zb=[[0,1,4,6,7,9],[2,2,4,2,3,2],[1,1,0,0,0,0,0,0],29],$b=[void 0,Za,$a,_a,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb,ub,vb,wb,xb,yb,zb,Ab,Bb,Cb,Db,Eb,Fb,Gb,Hb,Ib,Ob,Pb,Qb,Rb,Sb,Tb,Ub,Vb,Wb,Xb,Yb,Zb];Za=[[0,1,2,3,4,5,6],[6,5,4,3,2,1],[1,1,0,0,0,0,0,0],0],$a=[[0,1,2,3,4,5,7],[5,5,4,3,3,1],[1,0,0,0,0,0,0,0],0],_a=[[0,1,2,3,4,5,8],[5,4,4,4,3,1],[1,0,0,0,0,0,0,0],0],ab=[[0,1,2,3,4,6,7],[5,4,4,3,3,2],[1,0,0,0,0,0,0,0],0],bb=[[0,1,2,3,5,6,7],[5,4,3,3,4,2],[1,0,0,0,0,0,0,0],0],cb=[[0,1,2,3,4,7,8],[5,3,3,4,4,2],[1,0,0,0,0,0,0,0],0],db=[[0,1,2,3,6,7,8],[5,3,2,3,5,3],[1,0,0,1,0,0,0,0],0],eb=[[0,2,3,4,5,6,8],[4,5,4,4,2,2],[1,1,0,0,0,0,0,0],0],fb=[[0,1,2,3,4,6,8],[4,5,3,4,3,2],[1,0,0,0,0,0,0,0],0],gb=[[0,1,2,3,4,6,9],[4,4,5,3,3,2],[1,0,0,0,0,0,0,0],0],hb=[[0,1,3,4,5,6,8],[4,4,4,4,4,1],[1,0,1,0,0,0,0,0],0],ib=[[0,1,2,3,4,7,9],[4,4,4,3,4,2],[1,1,1,1,0,0,0,0],36],jb=[[0,1,2,4,5,6,8],[4,4,3,5,3,2],[1,0,0,0,0,0,0,0],0],kb=[[0,1,2,3,5,7,8],[4,4,3,3,5,2],[1,0,0,0,0,0,0,0],0],lb=[[0,1,2,4,6,7,8],[4,4,2,4,4,3],[1,1,1,1,0,0,0,0],0],mb=[[0,1,2,3,5,6,9],[4,3,5,4,3,2],[1,0,0,0,0,0,0,0],0],nb=[[0,1,2,4,5,6,9],[4,3,4,5,4,1],[1,1,0,0,0,0,0,0],37],ob=[[0,1,2,3,5,8,9],[4,3,4,4,4,2],[1,0,0,0,0,0,0,0],38],pb=[[0,1,2,3,6,7,9],[4,3,4,3,4,3],[1,0,0,1,0,0,0,0],0],qb=[[0,1,2,4,7,8,9],[4,3,3,4,5,2],[1,0,0,0,0,0,0,0],0],rb=[[0,1,2,4,5,8,9],[4,2,4,6,4,1],[1,0,1,0,0,0,0,0],0],sb=[[0,1,2,5,6,8,9],[4,2,4,5,4,2],[1,1,1,1,0,0,0,0],0],tb=[[0,2,3,4,5,7,9],[3,5,4,3,5,1],[1,0,0,0,0,0,0,0],0],ub=[[0,1,2,3,5,7,9],[3,5,3,4,4,2],[1,0,0,0,0,0,0,0],0],vb=[[0,2,3,4,6,7,9],[3,4,5,3,4,2],[1,0,0,0,0,0,0,0],0],wb=[[0,1,3,4,5,7,9],[3,4,4,5,3,2],[1,0,1,0,0,0,0,0],0],xb=[[0,1,2,4,5,7,9],[3,4,4,4,5,1],[1,0,0,0,0,0,0,0],0],yb=[[0,1,3,5,6,7,9],[3,4,4,4,3,3],[1,0,0,1,0,0,0,0],0],zb=[[0,1,2,4,6,7,9],[3,4,4,3,5,2],[1,0,0,0,0,0,0,0],0],Ab=[[0,1,2,4,6,8,9],[3,4,3,5,4,2],[1,0,0,0,0,0,0,0],0],Bb=[[0,1,3,4,6,7,9],[3,3,6,3,3,3],[1,0,0,1,0,0,0,0],0],Cb=[[0,1,3,4,6,8,9],[3,3,5,4,4,2],[1,0,0,0,0,0,0,0],0],Db=[[0,1,2,4,6,8,10],[2,6,2,6,2,3],[1,1,1,1,0,0,0,0],0],Eb=[[0,1,3,4,6,8,10],[2,5,4,4,4,2],[1,1,0,0,0,0,0,0],0],Fb=[[0,1,3,5,6,8,10],[2,5,4,3,6,1],[1,1,0,0,0,0,0,0],0],Gb=[[0,1,2,3,5,6,8],[4,4,4,3,4,2],[1,0,0,1,0,0,0,0],12],Hb=[[0,1,3,4,5,7,8],[4,3,4,5,4,1],[1,1,0,0,0,0,0,0],17],Ib=[[0,1,2,4,5,7,8],[4,3,4,4,4,2],[1,0,0,0,0,0,0,0],18];var _b=[void 0,Za,$a,_a,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb,ub,vb,wb,xb,yb,zb,Ab,Bb,Cb,Db,Eb,Fb,Gb,Hb,Ib];Za=[[0,1,2,3,4,5,6,7],[7,6,5,4,4,2],[1,1,0,0,0,0,0,0],0],$a=[[0,1,2,3,4,5,6,8],[6,6,5,5,4,2],[1,0,0,0,0,0,0,0],0],_a=[[0,1,2,3,4,5,6,9],[6,5,6,5,4,2],[1,1,0,0,0,0,0,0],0],
ab=[[0,1,2,3,4,5,7,8],[6,5,5,5,5,2],[1,0,0,0,0,0,0,0],0],bb=[[0,1,2,3,4,6,7,8],[6,5,4,5,5,3],[1,0,0,0,0,0,0,0],0],cb=[[0,1,2,3,5,6,7,8],[6,5,4,4,6,3],[1,1,1,1,0,0,0,0],0],db=[[0,1,2,3,4,5,8,9],[6,4,5,6,5,2],[1,1,0,0,0,0,0,0],0],eb=[[0,1,2,3,4,7,8,9],[6,4,4,5,6,3],[1,1,1,1,0,0,0,0],0],fb=[[0,1,2,3,6,7,8,9],[6,4,4,4,6,4],[2,2,2,2,0,0,0,0],0],gb=[[0,2,3,4,5,6,7,9],[5,6,6,4,5,2],[1,1,1,1,0,0,0,0],0],hb=[[0,1,2,3,4,5,7,9],[5,6,5,5,5,2],[1,0,1,0,0,0,0,0],0],ib=[[0,1,3,4,5,6,7,9],[5,5,6,5,4,3],[1,0,0,0,0,0,0,0],0],jb=[[0,1,2,3,4,6,7,9],[5,5,6,4,5,3],[1,0,0,1,0,0,0,0],0],kb=[[0,1,2,4,5,6,7,9],[5,5,5,5,6,2],[1,0,0,0,0,0,0,0],0],lb=[[0,1,2,3,4,6,8,9],[5,5,5,5,5,3],[1,0,0,0,0,0,0,0],29],mb=[[0,1,2,3,5,7,8,9],[5,5,4,5,6,3],[1,0,0,0,0,0,0,0],0],nb=[[0,1,3,4,5,6,8,9],[5,4,6,6,5,2],[1,1,1,1,0,0,0,0],0],ob=[[0,1,2,3,5,6,8,9],[5,4,6,5,5,3],[1,0,0,1,0,0,0,0],0],pb=[[0,1,2,4,5,6,8,9],[5,4,5,7,5,2],[1,0,1,0,0,0,0,0],0],qb=[[0,1,2,4,5,7,8,9],[5,4,5,6,6,2],[1,1,0,0,0,0,0,0],0],rb=[[0,1,2,3,4,6,8,10],[4,7,4,6,4,3],[1,1,1,1,0,0,0,0],0],sb=[[0,1,2,3,5,6,8,10],[4,6,5,5,6,2],[1,0,0,0,0,0,0,0],0],tb=[[0,1,2,3,5,7,8,10],[4,6,5,4,7,2],[1,1,0,0,0,0,0,0],0],ub=[[0,1,2,4,5,6,8,10],[4,6,4,7,4,3],[1,1,1,1,0,0,0,0],0],vb=[[0,1,2,4,6,7,8,10],[4,6,4,6,4,4],[2,2,2,2,0,0,0,0],0],wb=[[0,1,2,4,5,7,9,10],[4,5,6,5,6,2],[1,1,0,0,0,0,0,0],0],xb=[[0,1,2,4,5,7,8,10],[4,5,6,5,5,3],[1,0,0,0,0,0,0,0],0],yb=[[0,1,3,4,6,7,9,10],[4,4,8,4,4,4],[4,4,4,4,0,0,0,0],0],zb=[[0,1,2,3,5,6,7,9],[5,5,5,5,5,3],[1,0,0,0,0,0,0,0],15];var ac=[void 0,Za,$a,_a,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb,ub,vb,wb,xb,yb,zb];Za=[[0,1,2,3,4,5,6,7,8],[8,7,6,6,6,3],[1,1,0,0,0,0,0,0],0],$a=[[0,1,2,3,4,5,6,7,9],[7,7,7,6,6,3],[1,0,0,0,0,0,0,0],0],_a=[[0,1,2,3,4,5,6,8,9],[7,6,7,7,6,3],[1,0,0,0,0,0,0,0],0],ab=[[0,1,2,3,4,5,7,8,9],[7,6,6,7,7,3],[1,0,1,0,0,0,0,0],0],bb=[[0,1,2,3,4,6,7,8,9],[7,6,6,6,7,4],[1,0,0,1,0,0,0,0],0],cb=[[0,1,2,3,4,5,6,8,10],[6,8,6,7,6,3],[1,1,1,1,0,0,0,0],0],db=[[0,1,2,3,4,5,7,8,10],[6,7,7,6,7,3],[1,0,0,0,0,0,0,0],0],eb=[[0,1,2,3,4,6,7,8,10],[6,7,6,7,6,4],[1,0,0,1,0,0,0,0],0],fb=[[0,1,2,3,5,6,7,8,10],[6,7,6,6,8,3],[1,1,0,0,0,0,0,0],0],gb=[[0,1,2,3,4,6,7,9,10],[6,6,8,6,6,4],[1,1,1,1,0,0,0,0],0],hb=[[0,1,2,3,5,6,7,9,10],[6,6,7,7,7,3],[1,0,0,0,0,0,0,0],0],ib=[[0,1,2,4,5,6,8,9,10],[6,6,6,9,6,3],[3,3,3,3,0,0,0,0],0];var bc=[void 0,Za,$a,_a,ab,bb,cb,db,eb,fb,gb,hb,ib];Za=[[0,1,2,3,4,5,6,7,8,9],[9,8,8,8,8,4],[1,1,0,0,0,0,0,0],0],$a=[[0,1,2,3,4,5,6,7,8,10],[8,9,8,8,8,4],[1,1,1,1,0,0,0,0],0],_a=[[0,1,2,3,4,5,6,7,9,10],[8,8,9,8,8,4],[1,1,1,1,0,0,0,0],0],ab=[[0,1,2,3,4,5,6,8,9,10],[8,8,8,9,8,4],[1,1,1,1,0,0,0,0],0],bb=[[0,1,2,3,4,5,7,8,9,10],[8,8,8,8,9,4],[1,1,0,0,0,0,0,0],0],cb=[[0,1,2,3,4,6,7,8,9,10],[8,8,8,8,8,5],[2,2,2,2,0,0,0,0],0];var cc=[void 0,Za,$a,_a,ab,bb,cb];Za=[[0,1,2,3,4,5,6,7,8,9,10],[10,10,10,10,10,5],[1,1,1,1,0,0,0,0],0];var dc=[void 0,Za];Za=[[0,1,2,3,4,5,6,7,8,9,10,11],[12,12,12,12,12,6],[12,12,12,12,0,0,0,0],0];var ec=[void 0,Za],fc=[void 0,Jb,Kb,Lb,Mb,Nb,$b,_b,ac,bc,cc,dc,ec],gc={"1,0":[fc[1][1][0],fc[1][1][2],fc[1][1][1]]},hc={"1,0":[fc[2][1][0],fc[2][1][2],fc[2][1][1]],"2,0":[fc[2][2][0],fc[2][2][2],fc[2][2][1]],"3,0":[fc[2][3][0],fc[2][3][2],fc[2][3][1]],"4,0":[fc[2][4][0],fc[2][4][2],fc[2][4][1]],"5,0":[fc[2][5][0],fc[2][5][2],fc[2][5][1]],"6,0":[fc[2][6][0],fc[2][6][2],fc[2][6][1]]},ic={"1,0":[fc[3][1][0],fc[3][1][2],fc[3][1][1]],"2,1":[fc[3][2][0],fc[3][2][2],fc[3][2][1]],"2,-1":[[0,2,3],fc[3][2][2],fc[3][2][1]],"3,1":[fc[3][3][0],fc[3][3][2],fc[3][3][1]],"3,-1":[[0,3,4],fc[3][3][2],fc[3][3][1]],"4,1":[fc[3][4][0],fc[3][4][2],fc[3][4][1]],"4,-1":[[0,4,5],fc[3][4][2],fc[3][4][1]],"5,1":[fc[3][5][0],fc[3][5][2],fc[3][5][1]],"5,-1":[[0,5,6],fc[3][5][2],fc[3][5][1]],"6,0":[fc[3][6][0],fc[3][6][2],fc[3][6][1]],"7,1":[fc[3][7][0],fc[3][7][2],fc[3][7][1]],"7,-1":[[0,3,5],fc[3][7][2],fc[3][7][1]],"8,1":[fc[3][8][0],fc[3][8][2],fc[3][8][1]],"8,-1":[[0,4,6],fc[3][8][2],fc[3][8][1]],"9,0":[fc[3][9][0],fc[3][9][2],fc[3][9][1]],"10,0":[fc[3][10][0],fc[3][10][2],fc[3][10][1]],"11,1":[fc[3][11][0],fc[3][11][2],fc[3][11][1]],"11,-1":[[0,4,7],fc[3][11][2],fc[3][11][1]],"12,0":[fc[3][12][0],fc[3][12][2],fc[3][12][1]]},jc={"1,0":[fc[4][1][0],fc[4][1][2],fc[4][1][1]],"2,1":[fc[4][2][0],fc[4][2][2],fc[4][2][1]],"2,-1":[[0,2,3,4],fc[4][2][2],fc[4][2][1]],"3,0":[fc[4][3][0],fc[4][3][2],fc[4][3][1]],"4,1":[fc[4][4][0],fc[4][4][2],fc[4][4][1]],"4,-1":[[0,3,4,5],fc[4][4][2],fc[4][4][1]],"5,1":[fc[4][5][0],fc[4][5][2],fc[4][5][1]],"5,-1":[[0,4,5,6],fc[4][5][2],fc[4][5][1]],"6,0":[fc[4][6][0],fc[4][6][2],fc[4][6][1]],"7,0":[fc[4][7][0],fc[4][7][2],fc[4][7][1]],"8,0":[fc[4][8][0],fc[4][8][2],fc[4][8][1]],"9,0":[fc[4][9][0],fc[4][9][2],fc[4][9][1]],"10,0":[fc[4][10][0],fc[4][10][2],fc[4][10][1]],"11,1":[fc[4][11][0],fc[4][11][2],fc[4][11][1]],"11,-1":[[0,2,4,5],fc[4][11][2],fc[4][11][1]],"12,1":[fc[4][12][0],fc[4][12][2],fc[4][12][1]],"12,-1":[[0,3,4,6],fc[4][12][2],fc[4][12][1]],"13,1":[fc[4][13][0],fc[4][13][2],fc[4][13][1]],"13,-1":[[0,3,5,6],fc[4][13][2],fc[4][13][1]],"14,1":[fc[4][14][0],fc[4][14][2],fc[4][14][1]],"14,-1":[[0,4,5,7],fc[4][14][2],fc[4][14][1]],"15,1":[fc[4][15][0],fc[4][15][2],fc[4][15][1]],"15,-1":[[0,2,5,6],fc[4][15][2],fc[4][15][1]],"16,1":[fc[4][16][0],fc[4][16][2],fc[4][16][1]],"16,-1":[[0,2,6,7],fc[4][16][2],fc[4][16][1]],"17,0":[fc[4][17][0],fc[4][17][2],fc[4][17][1]],"18,1":[fc[4][18][0],fc[4][18][2],fc[4][18][1]],"18,-1":[[0,3,6,7],fc[4][18][2],fc[4][18][1]],"19,1":[fc[4][19][0],fc[4][19][2],fc[4][19][1]],"19,-1":[[0,4,7,8],fc[4][19][2],fc[4][19][1]],"20,0":[fc[4][20][0],fc[4][20][2],fc[4][20][1]],"21,0":[fc[4][21][0],fc[4][21][2],fc[4][21][1]],"22,1":[fc[4][22][0],fc[4][22][2],fc[4][22][1]],"22,-1":[[0,3,5,7],fc[4][22][2],fc[4][22][1]],"23,0":[fc[4][23][0],fc[4][23][2],fc[4][23][1]],"24,0":[fc[4][24][0],fc[4][24][2],fc[4][24][1]],"25,0":[fc[4][25][0],fc[4][25][2],fc[4][25][1]],"26,0":[fc[4][26][0],fc[4][26][2],fc[4][26][1]],"27,1":[fc[4][27][0],fc[4][27][2],fc[4][27][1]],"27,-1":[[0,3,6,8],fc[4][27][2],fc[4][27][1]],"28,0":[fc[4][28][0],fc[4][28][2],fc[4][28][1]],"29,1":[fc[4][29][0],fc[4][29][2],fc[4][29][1]],"29,-1":[[0,4,6,7],fc[4][29][2],fc[4][29][1]]},kc={"1,0":[fc[5][1][0],fc[5][1][2],fc[5][1][1]],"2,1":[fc[5][2][0],fc[5][2][2],fc[5][2][1]],"2,-1":[[0,2,3,4,5],fc[5][2][2],fc[5][2][1]],"3,1":[fc[5][3][0],fc[5][3][2],fc[5][3][1]],"3,-1":[[0,1,3,4,5],fc[5][3][2],fc[5][3][1]],"4,1":[fc[5][4][0],fc[5][4][2],fc[5][4][1]],"4,-1":[[0,3,4,5,6],fc[5][4][2],fc[5][4][1]],"5,1":[fc[5][5][0],fc[5][5][2],fc[5][5][1]],"5,-1":[[0,4,5,6,7],fc[5][5][2],fc[5][5][1]],"6,1":[fc[5][6][0],fc[5][6][2],fc[5][6][1]],"6,-1":[[0,1,4,5,6],fc[5][6][2],fc[5][6][1]],"7,1":[fc[5][7][0],fc[5][7][2],fc[5][7][1]],"7,-1":[[0,1,5,6,7],fc[5][7][2],fc[5][7][1]],"8,0":[fc[5][8][0],fc[5][8][2],fc[5][8][1]],"9,1":[fc[5][9][0],fc[5][9][2],fc[5][9][1]],"9,-1":[[0,2,4,5,6],fc[5][9][2],fc[5][9][1]],"10,1":[fc[5][10][0],fc[5][10][2],fc[5][10][1]],"10,-1":[[0,2,3,5,6],fc[5][10][2],fc[5][10][1]],"11,1":[fc[5][11][0],fc[5][11][2],fc[5][11][1]],"11,-1":[[0,3,4,5,7],fc[5][11][2],fc[5][11][1]],"12,0":[fc[5][12][0],fc[5][12][2],fc[5][12][1]],"13,1":[fc[5][13][0],fc[5][13][2],fc[5][13][1]],"13,-1":[[0,4,6,7,8],fc[5][13][2],fc[5][13][1]],"14,1":[fc[5][14][0],fc[5][14][2],fc[5][14][1]],"14,-1":[[0,2,5,6,7],fc[5][14][2],fc[5][14][1]],"15,0":[fc[5][15][0],fc[5][15][2],fc[5][15][1]],"16,1":[fc[5][16][0],fc[5][16][2],fc[5][16][1]],"16,-1":[[0,3,4,6,7],fc[5][16][2],fc[5][16][1]],"17,0":[fc[5][17][0],fc[5][17][2],fc[5][17][1]],"18,1":[fc[5][18][0],fc[5][18][2],fc[5][18][1]],"18,-1":[[0,2,3,6,7],fc[5][18][2],fc[5][18][1]],"19,1":[fc[5][19][0],fc[5][19][2],fc[5][19][1]],"19,-1":[[0,1,4,6,7],fc[5][19][2],fc[5][19][1]],"20,1":[fc[5][20][0],fc[5][20][2],fc[5][20][1]],"20,-1":[[0,1,5,7,8],fc[5][20][2],fc[5][20][1]],"21,1":[fc[5][21][0],fc[5][21][2],fc[5][21][1]],"21,-1":[[0,3,4,7,8],fc[5][21][2],fc[5][21][1]],"22,0":[fc[5][22][0],fc[5][22][2],fc[5][22][1]],"23,1":[fc[5][23][0],fc[5][23][2],fc[5][23][1]],"23,-1":[[0,2,4,5,7],fc[5][23][2],fc[5][23][1]],"24,1":[fc[5][24][0],fc[5][24][2],fc[5][24][1]],"24,-1":[[0,2,4,6,7],fc[5][24][2],fc[5][24][1]],"25,1":[fc[5][25][0],fc[5][25][2],fc[5][25][1]],"25,-1":[[0,3,5,6,8],fc[5][25][2],fc[5][25][1]],"26,1":[fc[5][26][0],fc[5][26][2],fc[5][26][1]],"26,-1":[[0,3,4,6,8],fc[5][26][2],fc[5][26][1]],"27,1":[fc[5][27][0],fc[5][27][2],fc[5][27][1]],"27,-1":[[0,3,5,7,8],fc[5][27][2],fc[5][27][1]],"28,1":[fc[5][28][0],fc[5][28][2],fc[5][28][1]],"28,-1":[[0,2,5,6,8],fc[5][28][2],fc[5][28][1]],"29,1":[fc[5][29][0],fc[5][29][2],fc[5][29][1]],"29,-1":[[0,2,5,7,8],fc[5][29][2],fc[5][29][1]],"30,1":[fc[5][30][0],fc[5][30][2],fc[5][30][1]],"30,-1":[[0,2,4,7,8],fc[5][30][2],fc[5][30][1]],"31,1":[fc[5][31][0],fc[5][31][2],fc[5][31][1]],"31,-1":[[0,3,6,8,9],fc[5][31][2],fc[5][31][1]],"32,1":[fc[5][32][0],fc[5][32][2],fc[5][32][1]],"32,-1":[[0,3,5,8,9],fc[5][32][2],fc[5][32][1]],"33,0":[fc[5][33][0],fc[5][33][2],fc[5][33][1]],"34,0":[fc[5][34][0],fc[5][34][2],fc[5][34][1]],"35,0":[fc[5][35][0],fc[5][35][2],fc[5][35][1]],"36,1":[fc[5][36][0],fc[5][36][2],fc[5][36][1]],"36,-1":[[0,3,5,6,7],fc[5][36][2],fc[5][36][1]],"37,0":[fc[5][37][0],fc[5][37][2],fc[5][37][1]],"38,1":[fc[5][38][0],fc[5][38][2],fc[5][38][1]],"38,-1":[[0,3,6,7,8],fc[5][38][2],fc[5][38][1]]},lc={"1,0":[fc[6][1][0],fc[6][1][2],fc[6][1][1]],"2,1":[fc[6][2][0],fc[6][2][2],fc[6][2][1]],"2,-1":[[0,2,3,4,5,6],fc[6][2][2],fc[6][2][1]],"3,1":[fc[6][3][0],fc[6][3][2],fc[6][3][1]],"3,-1":[[0,1,3,4,5,6],fc[6][3][2],fc[6][3][1]],"4,0":[fc[6][4][0],fc[6][4][2],fc[6][4][1]],"5,1":[fc[6][5][0],fc[6][5][2],fc[6][5][1]],"5,-1":[[0,1,4,5,6,7],fc[6][5][2],fc[6][5][1]],"6,0":[fc[6][6][0],fc[6][6][2],fc[6][6][1]],"7,0":[fc[6][7][0],fc[6][7][2],fc[6][7][1]],"8,0":[fc[6][8][0],fc[6][8][2],fc[6][8][1]],"9,1":[fc[6][9][0],fc[6][9][2],fc[6][9][1]],"9,-1":[[0,2,4,5,6,7],fc[6][9][2],fc[6][9][1]],"10,1":[fc[6][10][0],fc[6][10][2],fc[6][10][1]],"10,-1":[[0,2,3,4,6,7],fc[6][10][2],fc[6][10][1]],"11,1":[fc[6][11][0],fc[6][11][2],fc[6][11][1]],"11,-1":[[0,2,3,5,6,7],fc[6][11][2],fc[6][11][1]],"12,1":[fc[6][12][0],fc[6][12][2],fc[6][12][1]],"12,-1":[[0,1,3,5,6,7],fc[6][12][2],fc[6][12][1]],"13,0":[fc[6][13][0],fc[6][13][2],fc[6][13][1]],"14,1":[fc[6][14][0],fc[6][14][2],fc[6][14][1]],"14,-1":[[0,3,4,5,7,8],fc[6][14][2],fc[6][14][1]],"15,1":[fc[6][15][0],fc[6][15][2],fc[6][15][1]],"15,-1":[[0,3,4,6,7,8],fc[6][15][2],fc[6][15][1]],"16,1":[fc[6][16][0],fc[6][16][2],fc[6][16][1]],"16,-1":[[0,2,3,4,7,8],fc[6][16][2],fc[6][16][1]],"17,1":[fc[6][17][0],fc[6][17][2],fc[6][17][1]],"17,-1":[[0,1,4,6,7,8],fc[6][17][2],fc[6][17][1]],"18,1":[fc[6][18][0],fc[6][18][2],fc[6][18][1]],"18,-1":[[0,1,3,6,7,8],fc[6][18][2],fc[6][18][1]],"19,1":[fc[6][19][0],fc[6][19][2],fc[6][19][1]],"19,-1":[[0,1,4,5,7,8],fc[6][19][2],fc[6][19][1]],"20,0":[fc[6][20][0],fc[6][20][2],fc[6][20][1]],"21,1":[fc[6][21][0],fc[6][21][2],fc[6][21][1]],"21,-1":[[0,2,4,5,6,8],fc[6][21][2],fc[6][21][1]],"22,1":[fc[6][22][0],fc[6][22][2],fc[6][22][1]],"22,-1":[[0,2,4,6,7,8],fc[6][22][2],fc[6][22][1]],"23,0":[fc[6][23][0],fc[6][23][2],fc[6][23][1]],"24,1":[fc[6][24][0],fc[6][24][2],fc[6][24][1]],"24,-1":[[0,2,4,5,7,8],fc[6][24][2],fc[6][24][1]],"25,1":[fc[6][25][0],fc[6][25][2],fc[6][25][1]],"25,-1":[[0,2,3,5,7,8],fc[6][25][2],fc[6][25][1]],"26,0":[fc[6][26][0],fc[6][26][2],fc[6][26][1]],"27,1":[fc[6][27][0],fc[6][27][2],fc[6][27][1]],"27,-1":[[0,3,5,6,8,9],fc[6][27][2],fc[6][27][1]],"28,0":[fc[6][28][0],fc[6][28][2],fc[6][28][1]],"29,0":[fc[6][29][0],fc[6][29][2],fc[6][29][1]],"30,1":[fc[6][30][0],fc[6][30][2],fc[6][30][1]],"30,-1":[[0,2,3,6,8,9],fc[6][30][2],fc[6][30][1]],"31,1":[fc[6][31][0],fc[6][31][2],fc[6][31][1]],"31,-1":[[0,1,4,6,8,9],fc[6][31][2],fc[6][31][1]],"32,0":[fc[6][32][0],fc[6][32][2],fc[6][32][1]],"33,1":[fc[6][33][0],fc[6][33][2],fc[6][33][1]],"33,-1":[[0,2,4,6,7,9],fc[6][33][2],fc[6][33][1]],"34,1":[fc[6][34][0],fc[6][34][2],fc[6][34][1]],"34,-1":[[0,2,4,6,8,9],fc[6][34][2],fc[6][34][1]],"35,0":[fc[6][35][0],fc[6][35][2],fc[6][35][1]],"36,1":[fc[6][36][0],fc[6][36][2],fc[6][36][1]],"36,-1":[[0,3,4,5,6,7],fc[6][36][2],fc[6][36][1]],"37,0":[fc[6][37][0],fc[6][37][2],fc[6][37][1]],"38,0":[fc[6][38][0],fc[6][38][2],fc[6][38][1]],"39,1":[fc[6][39][0],fc[6][39][2],fc[6][39][1]],"39,-1":[[0,3,4,5,6,8],fc[6][39][2],fc[6][39][1]],"40,1":[fc[6][40][0],fc[6][40][2],fc[6][40][1]],"40,-1":[[0,3,5,6,7,8],fc[6][40][2],fc[6][40][1]],"41,1":[fc[6][41][0],fc[6][41][2],fc[6][41][1]],"41,-1":[[0,2,5,6,7,8],fc[6][41][2],fc[6][41][1]],"42,0":[fc[6][42][0],fc[6][42][2],fc[6][42][1]],"43,1":[fc[6][43][0],fc[6][43][2],fc[6][43][1]],"43,-1":[[0,2,3,6,7,8],fc[6][43][2],fc[6][43][1]],"44,1":[fc[6][44][0],fc[6][44][2],fc[6][44][1]],"44,-1":[[0,3,4,7,8,9],fc[6][44][2],fc[6][44][1]],"45,0":[fc[6][45][0],fc[6][45][2],fc[6][45][1]],"46,1":[fc[6][46][0],fc[6][46][2],fc[6][46][1]],"46,-1":[[0,3,5,7,8,9],fc[6][46][2],fc[6][46][1]],"47,1":[fc[6][47][0],fc[6][47][2],fc[6][47][1]],"47,-1":[[0,2,5,7,8,9],fc[6][47][2],fc[6][47][1]],"48,0":[fc[6][48][0],fc[6][48][2],fc[6][48][1]],"49,0":[fc[6][49][0],fc[6][49][2],fc[6][49][1]],"50,0":[fc[6][50][0],fc[6][50][2],fc[6][50][1]]},mc={"1,0":[fc[7][1][0],fc[7][1][2],fc[7][1][1]],"2,1":[fc[7][2][0],fc[7][2][2],fc[7][2][1]],"2,-1":[[0,2,3,4,5,6,7],fc[7][2][2],fc[7][2][1]],"3,1":[fc[7][3][0],fc[7][3][2],fc[7][3][1]],"3,-1":[[0,3,4,5,6,7,8],fc[7][3][2],fc[7][3][1]],"4,1":[fc[7][4][0],fc[7][4][2],fc[7][4][1]],"4,-1":[[0,1,3,4,5,6,7],fc[7][4][2],fc[7][4][1]],"5,1":[fc[7][5][0],fc[7][5][2],fc[7][5][1]],"5,-1":[[0,1,2,4,5,6,7],fc[7][5][2],fc[7][5][1]],"6,1":[fc[7][6][0],fc[7][6][2],fc[7][6][1]],"6,-1":[[0,1,4,5,6,7,8],fc[7][6][2],fc[7][6][1]],"7,1":[fc[7][7][0],fc[7][7][2],fc[7][7][1]],"7,-1":[[0,1,2,5,6,7,8],fc[7][7][2],fc[7][7][1]],"8,0":[fc[7][8][0],fc[7][8][2],fc[7][8][1]],"9,1":[fc[7][9][0],fc[7][9][2],fc[7][9][1]],"9,-1":[[0,2,4,5,6,7,8],fc[7][9][2],fc[7][9][1]],"10,1":[fc[7][10][0],fc[7][10][2],fc[7][10][1]],"10,-1":[[0,3,5,6,7,8,9],fc[7][10][2],fc[7][10][1]],"11,1":[fc[7][11][0],fc[7][11][2],fc[7][11][1]],"11,-1":[[0,2,3,4,5,7,8],fc[7][11][2],fc[7][11][1]],"12,0":[fc[7][12][0],fc[7][12][2],fc[7][12][1]],"13,1":[fc[7][13][0],fc[7][13][2],fc[7][13][1]],"13,-1":[[0,2,3,4,6,7,8],fc[7][13][2],fc[7][13][1]],"14,1":[fc[7][14][0],fc[7][14][2],fc[7][14][1]],"14,-1":[[0,1,3,5,6,7,8],fc[7][14][2],fc[7][14][1]],"15,0":[fc[7][15][0],fc[7][15][2],fc[7][15][1]],"16,1":[fc[7][16][0],fc[7][16][2],fc[7][16][1]],"16,-1":[[0,3,4,6,7,8,9],fc[7][16][2],fc[7][16][1]],"17,0":[fc[7][17][0],fc[7][17][2],fc[7][17][1]],"18,1":[fc[7][18][0],fc[7][18][2],fc[7][18][1]],"18,-1":[[0,1,4,6,7,8,9],fc[7][18][2],fc[7][18][1]],"19,1":[fc[7][19][0],fc[7][19][2],fc[7][19][1]],"19,-1":[[0,2,3,6,7,8,9],fc[7][19][2],fc[7][19][1]],"20,1":[fc[7][20][0],fc[7][20][2],fc[7][20][1]],"20,-1":[[0,1,2,5,7,8,9],fc[7][20][2],fc[7][20][1]],"21,1":[fc[7][21][0],fc[7][21][2],fc[7][21][1]],"21,-1":[[0,1,4,5,7,8,9],fc[7][21][2],fc[7][21][1]],"22,0":[fc[7][22][0],fc[7][22][2],fc[7][22][1]],"23,1":[fc[7][23][0],fc[7][23][2],fc[7][23][1]],"23,-1":[[0,2,4,5,6,7,9],fc[7][23][2],fc[7][23][1]],"24,1":[fc[7][24][0],fc[7][24][2],fc[7][24][1]],"24,-1":[[0,2,4,6,7,8,9],fc[7][24][2],fc[7][24][1]],"25,1":[fc[7][25][0],fc[7][25][2],fc[7][25][1]],"25,-1":[[0,2,3,5,6,7,9],fc[7][25][2],fc[7][25][1]],"26,1":[fc[7][26][0],fc[7][26][2],fc[7][26][1]],"26,-1":[[0,2,4,5,6,8,9],fc[7][26][2],fc[7][26][1]],"27,1":[fc[7][27][0],fc[7][27][2],fc[7][27][1]],"27,-1":[[0,2,4,5,7,8,9],fc[7][27][2],fc[7][27][1]],"28,1":[fc[7][28][0],fc[7][28][2],fc[7][28][1]],"28,-1":[[0,2,3,4,6,8,9],fc[7][28][2],fc[7][28][1]],"29,1":[fc[7][29][0],fc[7][29][2],fc[7][29][1]],"29,-1":[[0,2,3,5,7,8,9],fc[7][29][2],fc[7][29][1]],"30,1":[fc[7][30][0],fc[7][30][2],fc[7][30][1]],"30,-1":[[0,1,3,5,7,8,9],fc[7][30][2],fc[7][30][1]],"31,1":[fc[7][31][0],fc[7][31][2],fc[7][31][1]],"31,-1":[[0,2,3,5,6,8,9],fc[7][31][2],fc[7][31][1]],"32,1":[fc[7][32][0],fc[7][32][2],fc[7][32][1]],"32,-1":[[0,1,3,5,6,8,9],fc[7][32][2],fc[7][32][1]],"33,0":[fc[7][33][0],fc[7][33][2],fc[7][33][1]],"34,0":[fc[7][34][0],fc[7][34][2],fc[7][34][1]],"35,0":[fc[7][35][0],fc[7][35][2],fc[7][35][1]],"36,1":[fc[7][36][0],fc[7][36][2],fc[7][36][1]],"36,-1":[[0,2,3,5,6,7,8],fc[7][36][2],fc[7][36][1]],"37,0":[fc[7][37][0],fc[7][37][2],fc[7][37][1]],"38,1":[fc[7][38][0],fc[7][38][2],fc[7][38][1]],"38,-1":[[0,1,3,4,6,7,8],fc[7][38][2],fc[7][38][1]]},nc={"1,0":[fc[8][1][0],fc[8][1][2],fc[8][1][1]],"2,1":[fc[8][2][0],fc[8][2][2],fc[8][2][1]],"2,-1":[[0,2,3,4,5,6,7,8],fc[8][2][2],fc[8][2][1]],"3,0":[fc[8][3][0],fc[8][3][2],fc[8][3][1]],"4,1":[fc[8][4][0],fc[8][4][2],fc[8][4][1]],"4,-1":[[0,1,3,4,5,6,7,8],fc[8][4][2],fc[8][4][1]],"5,1":[fc[8][5][0],fc[8][5][2],fc[8][5][1]],"5,-1":[[0,1,2,4,5,6,7,8],fc[8][5][2],fc[8][5][1]],"6,0":[fc[8][6][0],fc[8][6][2],fc[8][6][1]],"7,0":[fc[8][7][0],fc[8][7][2],fc[8][7][1]],"8,0":[fc[8][8][0],fc[8][8][2],fc[8][8][1]],"9,0":[fc[8][9][0],fc[8][9][2],fc[8][9][1]],"10,0":[fc[8][10][0],fc[8][10][2],fc[8][10][1]],"11,1":[fc[8][11][0],fc[8][11][2],fc[8][11][1]],"11,-1":[[0,2,4,5,6,7,8,9],fc[8][11][2],fc[8][11][1]],"12,1":[fc[8][12][0],fc[8][12][2],fc[8][12][1]],"12,-1":[[0,2,3,4,5,6,8,9],fc[8][12][2],fc[8][12][1]],"13,1":[fc[8][13][0],fc[8][13][2],fc[8][13][1]],"13,-1":[[0,2,3,5,6,7,8,9],fc[8][13][2],fc[8][13][1]],"14,1":[fc[8][14][0],fc[8][14][2],fc[8][14][1]],"14,-1":[[0,2,3,4,5,7,8,9],fc[8][14][2],fc[8][14][1]],"15,1":[fc[8][15][0],fc[8][15][2],fc[8][15][1]],"15,-1":[[0,1,3,5,6,7,8,9],fc[8][15][2],fc[8][15][1]],"16,1":[fc[8][16][0],fc[8][16][2],fc[8][16][1]],"16,-1":[[0,1,2,4,6,7,8,9],fc[8][16][2],fc[8][16][1]],"17,0":[fc[8][17][0],fc[8][17][2],fc[8][17][1]],"18,1":[fc[8][18][0],fc[8][18][2],fc[8][18][1]],"18,-1":[[0,1,3,4,6,7,8,9],fc[8][18][2],fc[8][18][1]],"19,1":[fc[8][19][0],fc[8][19][2],fc[8][19][1]],"19,-1":[[0,1,3,4,5,7,8,9],fc[8][19][2],fc[8][19][1]],"20,0":[fc[8][20][0],fc[8][20][2],fc[8][20][1]],"21,0":[fc[8][21][0],fc[8][21][2],fc[8][21][1]],"22,1":[fc[8][22][0],fc[8][22][2],fc[8][22][1]],"22,-1":[[0,2,4,5,7,8,9,10],fc[8][22][2],fc[8][22][1]],"23,0":[fc[8][23][0],fc[8][23][2],fc[8][23][1]],"24,0":[fc[8][24][0],fc[8][24][2],fc[8][24][1]],"25,0":[fc[8][25][0],fc[8][25][2],fc[8][25][1]],"26,0":[fc[8][26][0],fc[8][26][2],fc[8][26][1]],"27,1":[fc[8][27][0],fc[8][27][2],fc[8][27][1]],"27,-1":[[0,2,3,5,6,8,9,10],fc[8][27][2],fc[8][27][1]],"28,0":[fc[8][28][0],fc[8][28][2],fc[8][28][1]],"29,1":[fc[8][29][0],fc[8][29][2],fc[8][29][1]],"29,-1":[[0,2,3,4,6,7,8,9],fc[8][29][2],fc[8][29][1]]},oc={"1,0":[fc[9][1][0],fc[9][1][2],fc[9][1][1]],"2,1":[fc[9][2][0],fc[9][2][2],fc[9][2][1]],"2,-1":[[0,2,3,4,5,6,7,8,9],fc[9][2][2],fc[9][2][1]],"3,1":[fc[9][3][0],fc[9][3][2],fc[9][3][1]],"3,-1":[[0,1,3,4,5,6,7,8,9],fc[9][3][2],fc[9][3][1]],"4,1":[fc[9][4][0],fc[9][4][2],fc[9][4][1]],"4,-1":[[0,1,2,4,5,6,7,8,9],fc[9][4][2],fc[9][4][1]],"5,1":[fc[9][5][0],fc[9][5][2],fc[9][5][1]],"5,-1":[[0,1,2,3,5,6,7,8,9],fc[9][5][2],fc[9][5][1]],"6,0":[fc[9][6][0],fc[9][6][2],fc[9][6][1]],"7,1":[fc[9][7][0],fc[9][7][2],fc[9][7][1]],"7,-1":[[0,2,3,5,6,7,8,9,10],fc[9][7][2],fc[9][7][1]],"8,1":[fc[9][8][0],fc[9][8][2],fc[9][8][1]],"8,-1":[[0,2,3,4,6,7,8,9,10],fc[9][8][2],fc[9][8][1]],"9,0":[fc[9][9][0],fc[9][9][2],fc[9][9][1]],"10,0":[fc[9][10][0],fc[9][10][2],fc[9][10][1]],"11,1":[fc[9][11][0],fc[9][11][2],fc[9][11][1]],"11,-1":[[0,1,3,4,5,7,8,9,10],fc[9][11][2],fc[9][11][1]],"12,0":[fc[9][12][0],fc[9][12][2],fc[9][12][1]]},pc={"1,0":[fc[10][1][0],fc[10][1][2],fc[10][1][1]],"2,0":[fc[10][2][0],fc[10][2][2],fc[10][2][1]],"3,0":[fc[10][3][0],fc[10][3][2],fc[10][3][1]],"4,0":[fc[10][4][0],fc[10][4][2],fc[10][4][1]],"5,0":[fc[10][5][0],fc[10][5][2],fc[10][5][1]],"6,0":[fc[10][6][0],fc[10][6][2],fc[10][6][1]]},qc={"1,0":[fc[11][1][0],fc[11][1][2],fc[11][1][1]]},rc={"1,0":[fc[12][1][0],fc[12][1][2],fc[12][1][1]]},sc={1:gc,2:hc,3:ic,4:jc,5:kc,6:lc,7:mc,8:nc,9:oc,10:pc,11:qc,12:rc},tc={0:1,1:1,2:6,3:19,4:43,5:66,6:80,7:66,8:43,9:19,10:6,11:1,12:1},uc={0:1,1:1,2:6,3:12,4:29,5:38,6:50,7:38,8:29,9:12,10:6,11:1,12:1},vc={"1,1,0":1,"2,1,0":1,"2,2,0":2,"2,3,0":3,"2,4,0":4,"2,5,0":5,"2,6,0":6,"3,1,0":1,"3,2,1":2,"3,2,-1":3,"3,3,1":4,"3,3,-1":5,"3,4,1":6,"3,4,-1":7,"3,5,1":8,"3,5,-1":9,"3,6,0":10,"3,7,1":11,"3,7,-1":12,"3,8,1":13,"3,8,-1":14,"3,9,0":15,"3,10,0":16,"3,11,1":17,"3,11,-1":18,"3,12,0":19,"4,1,0":1,"4,2,1":2,"4,2,-1":3,"4,3,0":4,"4,4,1":5,"4,4,-1":6,"4,5,1":7,"4,5,-1":8,"4,6,0":9,"4,7,0":10,"4,8,0":11,"4,9,0":12,"4,10,0":13,"4,11,1":14,"4,11,-1":15,"4,12,1":16,"4,12,-1":17,"4,13,1":18,"4,13,-1":19,"4,14,1":20,"4,14,-1":21,"4,15,1":22,"4,15,-1":23,"4,16,1":24,"4,16,-1":25,"4,17,0":26,"4,18,1":27,"4,18,-1":28,"4,19,1":29,"4,19,-1":30,"4,20,0":31,"4,21,0":32,"4,22,1":33,"4,22,-1":34,"4,23,0":35,"4,24,0":36,"4,25,0":37,"4,26,0":38,"4,27,1":39,"4,27,-1":40,"4,28,0":41,"4,29,1":42,"4,29,-1":43,"5,1,0":1,"5,2,1":2,"5,2,-1":3,"5,3,1":4,"5,3,-1":5,"5,4,1":6,"5,4,-1":7,"5,5,1":8,"5,5,-1":9,"5,6,1":10,"5,6,-1":11,"5,7,1":12,"5,7,-1":13,"5,8,0":14,"5,9,1":15,"5,9,-1":16,"5,10,1":17,"5,10,-1":18,"5,11,1":19,"5,11,-1":20,"5,12,0":21,"5,13,1":22,"5,13,-1":23,"5,14,1":24,"5,14,-1":25,"5,15,0":26,"5,16,1":27,"5,16,-1":28,"5,17,0":29,"5,18,1":30,"5,18,-1":31,"5,19,1":32,"5,19,-1":33,"5,20,1":34,"5,20,-1":35,"5,21,1":36,"5,21,-1":37,"5,22,0":38,"5,23,1":39,"5,23,-1":40,"5,24,1":41,"5,24,-1":42,"5,25,1":43,"5,25,-1":44,"5,26,1":45,"5,26,-1":46,"5,27,1":47,"5,27,-1":48,"5,28,1":49,"5,28,-1":50,"5,29,1":51,"5,29,-1":52,"5,30,1":53,"5,30,-1":54,"5,31,1":55,"5,31,-1":56,"5,32,1":57,"5,32,-1":58,"5,33,0":59,"5,34,0":60,"5,35,0":61,"5,36,1":62,"5,36,-1":63,"5,37,0":64,"5,38,1":65,"5,38,-1":66,"6,1,0":1,"6,2,1":2,"6,2,-1":3,"6,3,1":4,"6,3,-1":5,"6,4,0":6,"6,5,1":7,"6,5,-1":8,"6,6,0":9,"6,7,0":10,"6,8,0":11,"6,9,1":12,"6,9,-1":13,"6,10,1":14,"6,10,-1":15,"6,11,1":16,"6,11,-1":17,"6,12,1":18,"6,12,-1":19,"6,13,0":20,"6,14,1":21,"6,14,-1":22,"6,15,1":23,"6,15,-1":24,"6,16,1":25,"6,16,-1":26,"6,17,1":27,"6,17,-1":28,"6,18,1":29,"6,18,-1":30,"6,19,1":31,"6,19,-1":32,"6,20,0":33,"6,21,1":34,"6,21,-1":35,"6,22,1":36,"6,22,-1":37,"6,23,0":38,"6,24,1":39,"6,24,-1":40,"6,25,1":41,"6,25,-1":42,"6,26,0":43,"6,27,1":44,"6,27,-1":45,"6,28,0":46,"6,29,0":47,"6,30,1":48,"6,30,-1":49,"6,31,1":50,"6,31,-1":51,"6,32,0":52,"6,33,1":53,"6,33,-1":54,"6,34,1":55,"6,34,-1":56,"6,35,0":57,"6,36,1":58,"6,36,-1":59,"6,37,0":60,"6,38,0":61,"6,39,1":62,"6,39,-1":63,"6,40,1":64,"6,40,-1":65,"6,41,1":66,"6,41,-1":67,"6,42,0":68,"6,43,1":69,"6,43,-1":70,"6,44,1":71,"6,44,-1":72,"6,45,0":73,"6,46,1":74,"6,46,-1":75,"6,47,1":76,"6,47,-1":77,"6,48,0":78,"6,49,0":79,"6,50,0":80,"7,1,0":1,"7,2,1":2,"7,2,-1":3,"7,3,1":4,"7,3,-1":5,"7,4,1":6,"7,4,-1":7,"7,5,1":8,"7,5,-1":9,"7,6,1":10,"7,6,-1":11,"7,7,1":12,"7,7,-1":13,"7,8,0":14,"7,9,1":15,"7,9,-1":16,"7,10,1":17,"7,10,-1":18,"7,11,1":19,"7,11,-1":20,"7,12,0":21,"7,13,1":22,"7,13,-1":23,"7,14,1":24,"7,14,-1":25,"7,15,0":26,"7,16,1":27,"7,16,-1":28,"7,17,0":29,"7,18,1":30,"7,18,-1":31,"7,19,1":32,"7,19,-1":33,"7,20,1":34,"7,20,-1":35,"7,21,1":36,"7,21,-1":37,"7,22,0":38,"7,23,1":39,"7,23,-1":40,"7,24,1":41,"7,24,-1":42,"7,25,1":43,"7,25,-1":44,"7,26,1":45,"7,26,-1":46,"7,27,1":47,"7,27,-1":48,"7,28,1":49,"7,28,-1":50,"7,29,1":51,"7,29,-1":52,"7,30,1":53,"7,30,-1":54,"7,31,1":55,"7,31,-1":56,"7,32,1":57,"7,32,-1":58,"7,33,0":59,"7,34,0":60,"7,35,0":61,"7,36,1":62,"7,36,-1":63,"7,37,0":64,"7,38,1":65,"7,38,-1":66,"8,1,0":1,"8,2,1":2,"8,2,-1":3,"8,3,0":4,"8,4,1":5,"8,4,-1":6,"8,5,1":7,"8,5,-1":8,"8,6,0":9,"8,7,0":10,"8,8,0":11,"8,9,0":12,"8,10,0":13,"8,11,1":14,"8,11,-1":15,"8,12,1":16,"8,12,-1":17,"8,13,1":18,"8,13,-1":19,"8,14,1":20,"8,14,-1":21,"8,15,1":22,"8,15,-1":23,"8,16,1":24,"8,16,-1":25,"8,17,0":26,"8,18,1":27,"8,18,-1":28,"8,19,1":29,"8,19,-1":30,"8,20,0":31,"8,21,0":32,"8,22,1":33,"8,22,-1":34,"8,23,0":35,"8,24,0":36,"8,25,0":37,"8,26,0":38,"8,27,1":39,"8,27,-1":40,"8,28,0":41,"8,29,1":42,"8,29,-1":43,"9,1,0":1,"9,2,1":2,"9,2,-1":3,"9,3,1":4,"9,3,-1":5,"9,4,1":6,"9,4,-1":7,"9,5,1":8,"9,5,-1":9,"9,6,0":10,"9,7,1":11,"9,7,-1":12,"9,8,1":13,"9,8,-1":14,"9,9,0":15,"9,10,0":16,"9,11,1":17,"9,11,-1":18,"9,12,0":19,"10,1,0":1,"10,2,0":2,"10,3,0":3,"10,4,0":4,"10,5,0":5,"10,6,0":6,"11,1,0":1,"12,1,0":1},wc={"1,1,0":{name:["unison","monad","singleton"]},"2,1,0":{name:["interval class 1","minor second","m2","half step","semitone"]},"2,2,0":{name:["interval class 2","major second","M2","whole step","whole tone"]},"2,3,0":{name:["interval class 3","minor third","m3"]},"2,4,0":{name:["interval class 4","major third","M3"]},"2,5,0":{name:["interval class 5","perfect fourth","P4"]},"2,6,0":{name:["tritone","diminished fifth","augmented fourth"]},"3,1,0":{name:["chromatic trimirror"]},"3,2,1":{name:["phrygian trichord"]},"3,2,-1":{name:["minor trichord"]},"3,3,1":{name:["major-minor trichord"]},"3,3,-1":{name:["major-minor trichord"]},"3,4,1":{name:["incomplete major-seventh chord"]},"3,4,-1":{name:["incomplete major-seventh chord"]},"3,5,1":{name:["tritone-fourth"]},"3,5,-1":{name:["tritone-fourth"]},"3,6,0":{name:["whole-tone trichord"]},"3,7,1":{name:["incomplete minor-seventh chord"]},"3,7,-1":{name:["incomplete dominant-seventh chord"]},"3,8,1":{name:["incomplete dominant-seventh chord","Italian augmented sixth chord"]},"3,8,-1":{name:["incomplete half-diminished seventh chord"]},"3,9,0":{name:["quartal trichord"]},"3,10,0":{name:["diminished triad"]},"3,11,1":{name:["minor triad"]},"3,11,-1":{name:["major triad"]},"3,12,0":{name:["augmented triad","equal 3-part octave division"]},"4,1,0":{name:["chromatic tetramirror","BACH"]},"4,2,1":{name:["major-second tetracluster"]},"4,2,-1":{name:["major-second tetracluster"]},"4,3,0":{name:["alternating tetramirror"]},"4,4,1":{name:["minor third tetracluster"]},"4,4,-1":{name:["minor third tetracluster"]},"4,5,1":{name:["major third tetracluster"]},"4,5,-1":{name:["major third testacluster"]},"4,6,0":{name:["perfect fourth tetramirror"]},"4,7,0":{name:["Arabian tetramirror"]},"4,8,0":{name:["double-fourth tetramirror"]},"4,9,0":{name:["double tritone tetramirror"]},"4,10,0":{name:["minor tetramirror"]},"4,11,1":{name:["phrygian tetrachord"]},"4,11,-1":{name:["lydian tetrachord","major tetrachord"]},"4,12,1":{name:["harmonic minor tetrachord"]},"4,12,-1":{name:["major-third diminished terachord"]},"4,13,1":{name:["minor-second diminished tetrachord"]},"4,13,-1":{name:["perfect-fourth diminished tetrachord"]},"4,14,1":{name:["major-second minor tetrachord"]},"4,14,-1":{name:["perfect-fourth major tetrachord"]},"4,15,1":{name:["all-interval tetrachord"]},"4,15,-1":{name:["all-interval tetrachord"]},"4,16,1":{name:["minor-second quartal tetrachord"]},"4,16,-1":{name:["tritone quartal tetrachord"]},"4,17,0":{name:["major-minor tetramirror"]},"4,18,1":{name:["major-diminished tetrachord"]},"4,18,-1":{name:["minor-diminished tetrachord"]},"4,19,1":{name:["minor-augmented tetrachord"]},"4,19,-1":{name:["augmented major tetrachord"]},"4,20,0":{name:["major seventh chord"]},"4,21,0":{name:["whole-tone tetramirror"]},"4,22,1":{name:["major-second major tetrachord"]},"4,22,-1":{name:["perfect-fourth minor tetrachord"]},"4,23,0":{name:["quartal tetramirror"]},"4,24,0":{name:["augmented seventh chord"]},"4,25,0":{name:["Messiaen's truncated mode 6","French augmented sixth chord"]},"4,26,0":{name:["minor seventh chord"]},"4,27,1":{name:["half-diminished seventh chord"]},"4,27,-1":{name:["dominant seventh chord","major minor seventh chord","German augmented sixth chord","Swiss augmented sixth chord"]},"4,28,0":{name:["diminished seventh chord","equal 4-part octave division"]},"4,29,1":{name:["all-interval tetrachord"]},"4,29,-1":{name:["all-interval tetrachord"]},"5,1,0":{name:["chromatic pentamirror"]},"5,2,1":{name:["major-second pentacluster"]},"5,2,-1":{name:["major-second pentacluster"]},"5,3,1":{name:["minor-second major pentachord"]},"5,3,-1":{name:["Spanish pentacluster"]},"5,4,1":{name:["blues pentacluster"]},"5,4,-1":{name:["minor-third pentacluster"]},"5,5,1":{name:["major-third pentacluster"]},"5,5,-1":{name:["major-third pentacluster"]},"5,6,1":{name:["Asian pentacluster","quasi raga Megharanji"]},"5,6,-1":{name:["Asian pentacluster"]},"5,7,1":{name:["double pentacluster","quasi raga Nabhomani "]},"5,7,-1":{name:["double pentacluster"]},"5,8,0":{name:["tritone-symmetric pentamirror"]},"5,9,1":{name:["tritone-expanding pentachord"]},"5,9,-1":{name:["tritone-contracting pentachord"]},"5,10,1":{name:["alternating pentachord"]},"5,10,-1":{name:["alternating pentachord"]},"5,11,1":{name:["center-cluster pentachord"]},"5,11,-1":{name:["center-cluster pentachord"]},"5,12,0":{name:["locrian pentachord"]},"5,13,1":{name:["augmented pentacluster"]},"5,13,-1":{name:["augmented pentacluster"]},"5,14,1":{name:["double-seconds triple-fourth pentachord"]},"5,14,-1":{name:["double-seconds triple-fourth pentachord"]},"5,15,0":{name:["asssymetric pentamirror"]},"5,16,1":{name:["major-minor-diminished pentachord"]},"5,16,-1":{name:["major-minor diminished pentachord"]},"5,17,0":{name:["minor-major ninth chord"]},"5,18,1":{name:["Roma [Gypsy] pentachord"]},"5,18,-1":{name:["Roma [Gypsy] pentachord"]},"5,19,1":{name:["Javanese pentachord"]},"5,19,-1":{name:["Balinese pentachord"]},"5,20,1":{name:["Balinese Pelog pentatonic","quasi raga Bhupala","quasi raga Bibhas"]},"5,20,-1":{name:["Hirajoshi pentatonic","Iwato","Sakura","quasi raga Saveri"]},"5,21,1":{name:["major-augmented ninth chord","Syrian pentatonic","quasi raga Megharanji"]},"5,21,-1":{name:["Lebanese pentachord","augmented-minor chord"]},"5,22,0":{name:["Persian pentamirror","quasi raga Ramkali"]},"5,23,1":{name:["dorian pentachord","minor pentachord"]},"5,23,-1":{name:["major pentachord"]},"5,24,1":{name:["phrygian pentachord"]},"5,24,-1":{name:["lydian pentachord"]},"5,25,1":{name:["diminished-major ninth chord"]},"5,25,-1":{name:["minor-diminished ninth chord"]},"5,26,1":{name:["diminished-augmented ninth chord"]},"5,26,-1":{name:["augmented-diminished ninth chord"]},"5,27,1":{name:["major-ninth chord"]},"5,27,-1":{name:["minor-ninth chord"]},"5,28,1":{name:["augmented-sixth pentachord"]},"5,28,-1":{name:["Javanese pentatonic","augmented-sixth pentachord"]},"5,29,1":{name:["Kumoi pentachord"]},"5,29,-1":{name:["Kumoi pentachord"]},"5,30,1":{name:["enigmatic pentachord"]},"5,30,-1":{name:["enigmatic pentachord","altered pentatonic"]},"5,31,1":{name:["diminished minor-ninth chord"]},"5,31,-1":{name:["flat-ninth pentachord","quasi raga Ranjaniraga"]},"5,32,1":{name:["Neapolitan pentachord"]},"5,32,-1":{name:["Neapolitan pentachord"]},"5,33,0":{name:["whole-tone pentachord"]},"5,34,0":{name:["dominant-ninth","major-minor","Prometheus pentamirror","dominant pentatonic"]},"5,35,0":{name:["major pentatonic","black-key scale","blues pentatonic","slendro","quartal pentamirror"]},"5,36,1":{name:["major-seventh pentacluster"]},"5,36,-1":{name:["minor-seventh pentacluster"]},"5,37,0":{name:["center-cluster pentamirror"]},"5,38,1":{name:["diminished pentacluster"]},"5,38,-1":{name:["diminished pentacluster"]},"6,1,0":{name:["A all combinatorial [P6, I11, RI5, RI11]","chromatic hexamirror","first-order all-combinatorial"]},"6,2,1":{name:["combinatorial I [I11]"]},"6,2,-1":{name:["combinatorial I [I1]"]},"6,3,1":{},"6,3,-1":{},"6,4,0":{name:["combinatorial RI [RI6]"]},"6,5,1":{name:["combinatorial I [I11]"]},"6,5,-1":{name:["combinatorial I [I3]"]},"6,6,0":{name:["double cluster hexamirror"]},"6,7,0":{name:["B all combinatorial [P3, P9, I5, R6, R12, R8]","Messiaen's mode 5","second-order all combinatorial"]},"6,8,0":{name:["D all combinatorial [P6, I1, RI7]"]},"6,9,1":{name:["combinatorial I [I11]"]},"6,9,-1":{name:["combinatorial I [I3]"]},"6,10,1":{},"6,10,-1":{},"6,11,1":{},"6,11,-1":{},"6,12,1":{},"6,12,-1":{},"6,13,0":{name:["alternating hexamirror","combinatorial I [I7]"]},"6,14,1":{name:["combinatorial P [P6]"]},"6,14,-1":{name:["combinatorial P [P6]"]},"6,15,1":{name:["combinatorial I [I11]"]},"6,15,-1":{name:["combinatorial I [I5]"]},"6,16,1":{name:["combinatorial I [I3]"]},"6,16,-1":{name:["combinatorial I [I1]","quasi raga Megha"]},"6,17,1":{
name:["all tri-chord hexachord"]},"6,17,-1":{name:["all tri-chord hexachord [inverted form]"]},"6,18,1":{name:["combinatorial I [I11]"]},"6,18,-1":{name:["combinatorial I [I5]"]},"6,19,1":{},"6,19,-1":{},"6,20,0":{name:["E all combinatorial [P2, P6, P10, I3, I7, R4, R8, RI1, RI5, RI9]","Messiaen's truncated mode 3","Genus tertium","third-order all combinatorial"]},"6,21,1":{name:["combinatorial I [I1]"]},"6,21,-1":{name:["combinatorial I [I3]"]},"6,22,1":{name:["combinatorial I [I11]"]},"6,22,-1":{name:["combinatorial I [I5]"]},"6,23,0":{name:["combinatorial RI [RI8]","super-locrian hexa mirror"]},"6,24,1":{},"6,24,-1":{name:["melodic-minor hexachord"]},"6,25,1":{name:["locrian hexachord"]},"6,25,-1":{name:["minor hexachord"]},"6,26,0":{name:["phrygian hexamirror","combinatorial RI [RI8]"]},"6,27,1":{name:["combinatorial I [I11]"]},"6,27,-1":{name:["combinatorial I [I1]","pyramid hexachord"]},"6,28,0":{name:["double-phrygian heachord","combinatorial RI [RI6]"]},"6,29,0":{name:["combinatorial RI [RI9]"]},"6,30,1":{name:["Messiaen's truncated mode 2","minor-bitonal hexachord","combinatorial R [R6]","combinatorial I [I1, I7]"]},"6,30,-1":{name:["Stravinsky's Petrouchka-chord","Messiaen's truncated mode 2","major-bitonal hexachord","combinatorial R [R6]","combinatorial I [I1, I7]"]},"6,31,1":{name:["combinatorial I [I7]"]},"6,31,-1":{name:["combinatorial I [I11]"]},"6,32,0":{name:["C all combinatorial [P6, I3, RI9]","Guidon/Arezzo","Arezzo major diatonic","major hexamirror","quartal hexamirror","first-order all combinatorial"]},"6,33,1":{name:["dorian hexachord","combinatorial I [I6]"]},"6,33,-1":{name:["dominant-eleventh","lydian hexachord","combinatorial I [I1]"]},"6,34,1":{name:["Scriabin's Mystic-chord","Prometheus hexachord","combinatorial I [I11]"]},"6,34,-1":{name:["augmented-eleventh","harmonic hexachord","combinatorial I [I7]"]},"6,35,0":{name:["whole tone scale","6 equal part division","F all-combinatorial [P1, P3, P5, P7, P9, P11, I1, I3, I5, I7, I9, I11, R2, R4, R6, R8, R10, RI2, RI4, RI6, RI8, RI10]","Messiaen's mode 1","sixth-order all combinatorial"]},"6,36,1":{},"6,36,-1":{},"6,37,0":{name:["combinatorial RI [RI4]"]},"6,38,0":{name:["combinatorial RI [RI3]"]},"6,39,1":{},"6,39,-1":{},"6,40,1":{},"6,40,-1":{},"6,41,1":{},"6,41,-1":{},"6,42,0":{name:["combinatorial RI [RI3]"]},"6,43,1":{name:["complement of all tri-chord hexachord"]},"6,43,-1":{name:["complement of all-tri-chord hexachord [inverted form]"]},"6,44,1":{name:["Schoenberg Anagram hexachord"]},"6,44,-1":{name:["quasi raga Bauli"]},"6,45,0":{name:["combinatorial RI [RI6]"]},"6,46,1":{},"6,46,-1":{},"6,47,1":{},"6,47,-1":{name:["blues scale"]},"6,48,0":{name:["combinatorial RI [RI2]"]},"6,49,0":{name:["combinatorial RI [RI4]","Prometheus Neapolitan mode"]},"6,50,0":{name:["combinatorial RI [RI1]"]},"7,1,0":{name:["chromatic heptamirror"]},"7,2,1":{},"7,2,-1":{},"7,3,1":{},"7,3,-1":{},"7,4,1":{},"7,4,-1":{},"7,5,1":{},"7,5,-1":{},"7,6,1":{},"7,6,-1":{},"7,7,1":{},"7,7,-1":{},"7,8,0":{},"7,9,1":{},"7,9,-1":{},"7,10,1":{},"7,10,-1":{},"7,11,1":{},"7,11,-1":{},"7,12,0":{},"7,13,1":{},"7,13,-1":{},"7,14,1":{},"7,14,-1":{},"7,15,0":{},"7,16,1":{name:["Debussy's heptatonic"]},"7,16,-1":{},"7,17,0":{},"7,18,1":{},"7,18,-1":{},"7,19,1":{},"7,19,-1":{},"7,20,1":{name:["chromatic phrygian inverse"]},"7,20,-1":{name:["Greek chromatic","chromatic mixolydian","chromatic dorian","quasi raga Pantuvarali","mela Kanakangi"]},"7,21,1":{},"7,21,-1":{name:["Gypsy [Roma] hexatonic"]},"7,22,0":{name:["double harmonic scale","Persian","major Gypsy [Roma]","Hungarian minor","double harmonic scale","Asian","quasi raga Mayamdavagaula"]},"7,23,1":{},"7,23,-1":{name:["tritone major heptachord"]},"7,24,1":{},"7,24,-1":{name:["mystic heptaachord","Enigmatic heptatonic"]},"7,25,1":{},"7,25,-1":{},"7,26,1":{},"7,26,-1":{},"7,27,1":{},"7,27,-1":{name:["modified blues"]},"7,28,1":{},"7,28,-1":{},"7,29,1":{},"7,29,-1":{},"7,30,1":{name:["Neapolitan-minor mode"]},"7,30,-1":{},"7,31,1":{name:["alternating heptachord","Hungarian major mode"]},"7,31,-1":{name:["diminished scale","alternating heptachord"]},"7,32,1":{name:["harmonic minor scale","Spanish Gypsy","mela Kiravani"]},"7,32,-1":{name:["harmonic major scale","harmonic minor inverse","mela Cakravana","quasi raga Ahir Bhairav"]},"7,33,0":{name:["Neapolitan-major mode","leading-whole-tone mode"]},"7,34,0":{name:["melodic minor ascending scale","jazz minor","augmented thirteenth heptamirror","harmonic/super-locrian"]},"7,35,0":{name:["major scale","major diatonic heptachord","natural minor scale","dominant thirteenth","locrian","phrygian","major inverse"]},"7,36,1":{},"7,36,-1":{},"7,37,0":{},"7,38,1":{},"7,38,-1":{},"8,1,0":{name:["chromatic octamirror"]},"8,2,1":{},"8,2,-1":{},"8,3,0":{},"8,4,1":{},"8,4,-1":{},"8,5,1":{},"8,5,-1":{},"8,6,0":{},"8,7,0":{},"8,8,0":{},"8,9,0":{name:["Messiaen's mode 4"]},"8,10,0":{},"8,11,1":{},"8,11,-1":{name:["blues octatonic"]},"8,12,1":{},"8,12,-1":{},"8,13,1":{name:["blues octatonic"]},"8,13,-1":{},"8,14,1":{},"8,14,-1":{},"8,15,1":{},"8,15,-1":{},"8,16,1":{},"8,16,-1":{name:["enigmatic octachord"]},"8,17,0":{},"8,18,1":{},"8,18,-1":{},"8,19,1":{},"8,19,-1":{},"8,20,0":{},"8,21,0":{},"8,22,1":{},"8,22,-1":{name:["Spanish octatonic scale"]},"8,23,0":{name:["Greek","blues","quartal octachord","diatonic octad"]},"8,24,0":{},"8,25,0":{name:["Messiaen's mode 6"]},"8,26,0":{name:["blues","Spanish phrygian"]},"8,27,1":{},"8,27,-1":{},"8,28,0":{name:["octatonic scale","Messiaen's mode 2","alternating octatonic scale","diminished scale"]},"8,29,1":{},"8,29,-1":{},"9,1,0":{name:["chromatic nonamirror"]},"9,2,1":{},"9,2,-1":{},"9,3,1":{},"9,3,-1":{},"9,4,1":{},"9,4,-1":{},"9,5,1":{},"9,5,-1":{},"9,6,0":{},"9,7,1":{name:["nonatonic blues"]},"9,7,-1":{},"9,8,1":{},"9,8,-1":{},"9,9,0":{},"9,10,0":{},"9,11,1":{},"9,11,-1":{name:["diminishing nonachord"]},"9,12,0":{name:["Messiaen's mode 3","Tsjerepnin"]},"10,1,0":{name:["chromatic decamirror"]},"10,2,0":{},"10,3,0":{},"10,4,0":{},"10,5,0":{name:["major-minor mixed"]},"10,6,0":{name:["Messiaen's mode 7"]},"11,1,0":{name:["chromatic undecamirror"]},"12,1,0":{name:["aggregate","dodecachord","twelve-tone chromatic","chromatic scale","dodecamirror"]}},xc=Object.freeze({FORTE:fc,SCDICT:sc,TNMAX:tc,TNIMAX:uc,TNREF:vc,SCREF:wc,forteIndexToInversionsAvailable:i,addressToTransposedNormalForm:l,addressToPrimeForm:m,addressToIntervalVector:n,intervalVectorToAddress:o,addressToZAddress:p,addressToCommonNames:q,addressToForteName:r,seekChordTablesAddress:s}),yc={},zc=function(b){function c(a){E(this,c);var b=J(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));return void 0===a?a=[]:"string"==typeof a&&(a=a.split(/\s+/)),b.isChord=!0,b.isNote=!1,b.isRest=!1,b._overrides={},b._cache={},b._notes=[],b._chordTablesAddress=void 0,b._chordTablesAddressNeedsUpdating=!0,a.forEach(function(a){return b.add(a,!1)},b),a.length>0&&void 0!==a[0].duration&&a[0].duration.quarterLength!==b.duration.quarterLength&&(b.duration=a[0].duration),b.sortPitches(),b}return I(c,b),F(c,[{key:"stringInfo",value:function(){return this.pitches.map(function(a){return a.nameWithOctave}).join(" ")}},{key:"get",value:function(a){return"number"==typeof a?this._notes[a]:void 0}},{key:Symbol.iterator,value:regeneratorRuntime.mark(function a(){var b;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:b=0;case 1:if(!(b<this.length)){a.next=7;break}return a.next=4,this.get(b);case 4:b++,a.next=1;break;case 7:case"end":return a.stop()}},a,this)})},{key:"areZRelations",value:function(a){var b=p(this.chordTablesAddress);if(void 0===b)return!1;for(var c=["cardinality","forteClass","inversion"],d=0;d<c.length;d++){var e=c[d];if(a.chordTablesAddress[e]!==b[e])return!1}return!0}},{key:"getZRelation",value:function(){if(this.hasZRelation){var a=this.chordTablesAddress,b=n(a),d=o(b),e=void 0,f=!0,g=!1,h=void 0;try{for(var i,j=d[Symbol.iterator]();!(f=(i=j.next()).done);f=!0){var k=i.value;k.forteClass!==a.forteClass&&(e=k)}}catch(a){g=!0,h=a}finally{try{!f&&j.return&&j.return()}finally{if(g)throw h}}return new c(l(e))}}},{key:"setStemDirectionFromClef",value:function(a){if(void 0===a)return this;for(var b=a.lowestLine+4,c=0,d=this.pitches,e=0;e<this.pitches.length;e++){var f=d[e],g=f.diatonicNoteNum-b;Math.abs(g)>=Math.abs(c)&&(c=g)}return this.stemDirection=c>=0?"down":"up",this}},{key:"add",value:function(a){var b=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];a instanceof Array||(a=[a]);var c=!0,d=!1,e=void 0;try{for(var f,g=a[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;if("string"==typeof h)h=new Ma.Note(h);else if(h.isClassOrSubclass("Pitch")){var i=h,j=new Ma.Note;j.pitch=i,h=j}this._notes.push(h)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return!0===b&&this.sortPitches(),this._cache={},this}},{key:"sortPitches",value:function(){this._notes.sort(function(a,b){return a.pitch.ps-b.pitch.ps})}},{key:"removeDuplicatePitches",value:function(){for(var a=[],b=[],c=this.pitches,d=0;d<c.length;d++){var e=c[d];-1===a.indexOf(e.step)&&(a.push(e.step),b.push(e))}return new yc.Chord(b)}},{key:"root",value:function(a){if(void 0!==a&&(this._overrides.root=a,this._cache.root=a,this._cache.inversion=void 0),void 0!==this._overrides.root)return this._cache.root;if(void 0!==this._cache.root)return this._cache.root;var b=this.removeDuplicatePitches(),c=b.pitches;if(0===c.length)throw new O("No notes in Chord!");if(1===c.length)return this.pitches[0];for(var d=[3,5,7,2,4,6],e=0;e<c.length;e++){for(var f=c[e],g=[],h=0;h<d.length;h++){void 0!==b.getChordStep(d[h],f)?g.push(!0):g.push(!1)}for(var i=!1,j=0;j<c.length-1;j++)!1===g[j]&&(i=!0);if(!1===i)return b.pitches[e]}var k=b.pitches[0];return this._cache.root=k,k}},{key:"semitonesFromChordStep",value:function(a,b){void 0===b&&(b=this.root());var c=this.getChordStep(a,b);if(void 0!==c){var d=(c.ps-b.ps)%12;return d<0&&(d+=12),d}}},{key:"bass",value:function(){for(var a=void 0,b=this.pitches,c=0;c<b.length;c++){var d=b[c];void 0===a?a=d:d.ps<a.ps&&(a=d)}return a}},{key:"cardinality",value:function(){return this.removeDuplicatePitches().pitches.length}},{key:"isMajorTriad",value:function(){if(3!==this.cardinality())return!1;var a=this.semitonesFromChordStep(3),b=this.semitonesFromChordStep(5);return 4===a&&7===b}},{key:"isMinorTriad",value:function(){if(3!==this.cardinality())return!1;var a=this.semitonesFromChordStep(3),b=this.semitonesFromChordStep(5);return 3===a&&7===b}},{key:"isDiminishedTriad",value:function(){if(3!==this.cardinality())return!1;var a=this.semitonesFromChordStep(3),b=this.semitonesFromChordStep(5);return 3===a&&6===b}},{key:"isAugmentedTriad",value:function(){if(3!==this.cardinality())return!1;var a=this.semitonesFromChordStep(3),b=this.semitonesFromChordStep(5);return 4===a&&8===b}},{key:"isDominantSeventh",value:function(){return this.isSeventhOfType([0,4,7,10])}},{key:"isDiminishedSeventh",value:function(){return this.isSeventhOfType([0,3,6,9])}},{key:"isSeventhOfType",value:function(a){if(void 0===a)throw new O("intervalArray is required");var b=this.third,c=this.fifth,d=this.seventh;if(void 0===b||void 0===c||void 0===d)return!1;var e=this.root(),f=!0,g=!1,h=void 0;try{for(var i,j=this.pitches[Symbol.iterator]();!(f=(i=j.next()).done);f=!0){var k=i.value,l=new Ta.Interval(e,k);if(!a.includes(l.chromatic.mod12))return!1}}catch(a){g=!0,h=a}finally{try{!f&&j.return&&j.return()}finally{if(g)throw h}}return!0}},{key:"canBeDominantV",value:function(){return!(!this.isMajorTriad()&&!this.isDominantSeventh())}},{key:"canBeTonic",value:function(){return!(!this.isMajorTriad()&&!this.isMinorTriad())}},{key:"inversion",value:function(){for(var a=this.bass(),b=this.root(),c=[1,6,4,2,7,5,3],d=0;d<c.length;d++){var e=this.getChordStep(c[d],a);if(void 0!==e&&e.name===b.name)return d}}},{key:"vexflowNote",value:function(b){for(var c=b.clef,d=[],e=0;e<this._notes.length;e++)d.push(this._notes[e].pitch.vexflowName(c));var f=new a.Flow.StaveNote({keys:d,duration:this.duration.vexflowDuration});this.vexflowAccidentalsAndDisplay(f,b);for(var g=0;g<this._notes.length;g++){var h=this._notes[g];void 0!==h.pitch.accidental&&("n"!==h.pitch.accidental.vexflowModifier&&!1!==h.pitch.accidental.displayStatus?f.addAccidental(g,new a.Flow.Accidental(h.pitch.accidental.vexflowModifier)):"always"!==h.pitch.accidental.displayType&&!0!==h.pitch.accidental.displayStatus||f.addAccidental(g,new a.Flow.Accidental(h.pitch.accidental.vexflowModifier)))}return this.activeVexflowNote=f,f}},{key:"getChordStep",value:function(a,b){void 0===b&&(b=this.root()),a>=8&&(a%=7);for(var c=this.pitches,d=b.diatonicNoteNum,e=0;e<c.length;e++){var f=c[e],g=(f.diatonicNoteNum-d+1)%7;if(g<=0&&(g+=7),g===a)return f}}},{key:"length",get:function(){return this._notes.length}},{key:"pitches",get:function(){for(var a=[],b=0;b<this._notes.length;b++)a.push(this._notes[b].pitch);return a},set:function(a){this._notes=[];for(var b=0;b<a.length;b++){var c=void 0;if("string"==typeof a[b])c=new Ma.Note(a[b]);else if(a[b].isClassOrSubclass("Pitch"))c=new Ma.Note,c.pitch=a[b];else{if(!a[b].isClassOrSubclass("Note"))throw console.warn("bad pitch",a[b]),new O("Cannot add pitch from "+a[b]);c=a[b]}this._notes.push(c)}this._cache={},this._overrides={}}},{key:"orderedPitchClasses",get:function(){var a=[],b=!0,c=!1,d=void 0;try{for(var e,f=this.pitches[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;a.includes(g.pitchClass)||a.push(g.pitchClass)}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}return a.sort(function(a,b){return a-b}),a}},{key:"chordTablesAddress",get:function(){return this._chordTablesAddressNeedsUpdating&&(this._chordTablesAddress=s(this)),this._chordTablesAddressNeedsUpdating=!1,this._chordTablesAddress}},{key:"commonName",get:function(){var a=this,b=this.chordTablesAddress,c=q(b),d=this.forteClass,e={"3-11A":function(){return a.isMinorTriad()},"3-11B":function(){return a.isMajorTriad()},"3-10":function(){return a.isDiminishedTriad()},"3-12":function(){return a.isAugmentedTriad()}};if(void 0!==e[d]){var f=c[0];return(0,e[d])()||(f="enharmonic equivalent to "+f),f}return void 0===c?"":c[0]}},{key:"forteClass",get:function(){return r(this.chordTablesAddress,"tn")}},{key:"forteClassNumber",get:function(){return this.chordTablesAddress.forteClass}},{key:"forteClassTnI",get:function(){return r(this.chordTablesAddress,"tni")}},{key:"hasZRelation",get:function(){return void 0!==p(this.chordTablesAddress)}},{key:"intervalVector",get:function(){return n(this.chordTablesAddress)}},{key:"third",get:function(){return this.getChordStep(3)}},{key:"fifth",get:function(){return this.getChordStep(5)}},{key:"seventh",get:function(){return this.getChordStep(7)}}]),c}(Ma.NotRest);yc.Chord=zc,yc.chordDefinitions={major:["M3","m3"],minor:["m3","M3"],diminished:["m3","m3"],augmented:["M3","M3"],"major-seventh":["M3","m3","M3"],"dominant-seventh":["M3","m3","m3"],"minor-seventh":["m3","M3","m3"],"diminished-seventh":["m3","m3","m3"],"half-diminished-seventh":["m3","m3","M3"]};var Ac={};Ac.lowestLines={treble:31,soprano:29,"mezzo-soprano":27,alto:25,tenor:23,bass:19,percussion:31},Ac.nameToLine={treble:2,soprano:1,"mezzo-soprano":2,alto:3,tenor:4,bass:4,percussion:3},Ac.nameToSign={treble:"G",soprano:"C","mezzo-soprano":"C",alto:"C",tenor:"C",bass:"F",percussion:"percussion"};var Bc=function(a){function b(a,c){E(this,b);var d=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return d.classSortOrder=0,d.sign=void 0,d.line=1,void 0!==a?(a=a.toLowerCase(),d.name=a,d.lowestLine=Ac.lowestLines[a],d.sign=Ac.nameToSign[a],d.line=Ac.nameToLine[a]||1,d.lowestLineTrebleOffset=Ac.lowestLines.treble-d.lowestLine):(d.name=void 0,d.lowestLine=Ac.lowestLines.treble,d.lowestLineTrebleOffset=0),void 0===c?d.octaveChange=0:(d.octaveChange=c,d.lowestLine+=7*c,d.lowestLineTrebleOffset-=7*c),d}return I(b,a),F(b,[{key:"stringInfo",value:function(){return""}},{key:"convertPitchToTreble",value:function(a){if(void 0===this.lowestLine)return console.log("no first line defined for clef",this.name,this),a;var b=this.lowestLineTrebleOffset,c=new Ja.Pitch(a.step);return c.octave=a.octave,c.diatonicNoteNum+=b,c.accidental=a.accidental,c}}]),b}(ha.Music21Object);Ac.Clef=Bc;var Cc=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,"treble"));return a.sign="G",a.line=2,a}return I(b,a),b}(Bc);Ac.TrebleClef=Cc;var Dc=function(a){function b(){return E(this,b),J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,"treble",-1))}return I(b,a),b}(Bc);Ac.Treble8vbClef=Dc;var Ec=function(a){function b(){return E(this,b),J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,"treble",1))}return I(b,a),b}(Bc);Ac.Treble8vaClef=Ec;var Fc=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,"bass"));return a.sign="F",a.line=4,a}return I(b,a),b}(Bc);Ac.BassClef=Fc;var Gc=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,"bass",-1));return a.sign="F",a.line=4,a}return I(b,a),b}(Bc);Ac.Bass8vbClef=Gc;var Hc=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,"alto"));return a.sign="C",a.line=3,a}return I(b,a),b}(Bc);Ac.AltoClef=Hc;var Ic=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,"tenor"));return a.sign="C",a.line=4,a}return I(b,a),b}(Bc);Ac.TenorClef=Ic;var Jc=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,"soprano"));return a.sign="C",a.line=1,a}return I(b,a),b}(Bc);Ac.SopranoClef=Jc;var Kc=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,"mezzo-soprano"));return a.sign="C",a.line=2,a}return I(b,a),b}(Bc);Ac.MezzoSopranoClef=Kc;var Lc=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,"percussion"));return a.sign="percussion",a.line=3,a}return I(b,a),b}(Bc);Ac.PercussionClef=Lc,Ac.bestClef=function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=b.recurse,d=void 0===c||c,e=void 0;e=d?a.flat:a;for(var f=0,g=0,h=0;h<e.length;h++){var i=e.get(h);if(void 0!==i.pitch)f+=1,g+=i.pitch.diatonicNoteNum;else if(void 0!==i.pitches)for(var j=0;j<i.pitches.length;j++)f+=1,g+=i.pitches[j].diatonicNoteNum}var k=void 0;return k=0===f?29:g/f,k>28?new Ac.TrebleClef:new Ac.BassClef},Ac.clefFromString=function(a,b){void 0===b&&(b=0);var c=a.trim(),d=void 0,e=void 0;if("percussion"===c.toLowerCase())return new Ac.PercussionClef(a,b);if(2===c.length)d=c[0].toUpperCase(),e=parseInt(c[1]);else if(1===c.length)d=c[0].toUpperCase(),e="G"===d?2:"F"===d?4:"C"===d?3:0;else if(c.length>2){var f=c.toLowerCase(),g=!0,h=!1,i=void 0;try{for(var j,k=Object.keys(Ac)[Symbol.iterator]();!(g=(j=k.next()).done);g=!0){var l=j.value;if(l.includes("Clef")){var m=l.toLowerCase(),n=Ac[l];if("function"==typeof n&&(m===f||m===f+"clef"))return new n}}}catch(a){h=!0,i=a}finally{try{!g&&k.return&&k.return()}finally{if(h)throw i}}}var o=function(a,b){return a.length===b.length&&a.every(function(a,c){return a===b[c]})},p=[d,e,b];return o(p,["G",2,0])?new Ac.TrebleClef:o(p,["G",2,-1])?new Ac.Treble8vbClef:o(p,["G",2,1])?new Ac.Treble8vaClef:o(p,["F",4,0])?new Ac.BassClef:o(p,["F",4,-1])?new Ac.Bass8vbClef:o(p,["C",3,0])?new Ac.AltoClef:o(p,["C",4,0])?new Ac.TenorClef:new Ac.Clef(c,b)};var Mc=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.type="Scale",a}return I(b,a),F(b,[{key:"name",get:function(){return this.type}},{key:"isConcrete",get:function(){return!1}}]),b}(ha.Music21Object),Nc=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a._net=[],a.tonicDegree=1,a.octaveDuplicating=!0,a.deterministic=!0,a._alteredDegrees={},a._oneOctaveRealizationCache=void 0,a}return I(b,a),F(b,[{key:"equals",value:function(a){return!(!S.arrayEquals(this.classes,a.classes)||this.tonicDegree!==a.tonicDegree||!S.arrayEquals(this._net,a._net))}},{key:"buildNetworkFromPitches",value:function(a){var b=[],c=!0,d=!1,e=void 0;try{for(var f,g=a[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;"string"==typeof h?b.push(new Ja.Pitch(h)):h.classes.includes("Note")?b.push(h.pitch):b.push(h)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}a=b;var i=a[a.length-1];if(i.name===a[0]){var j=a[0].clone();if(i.ps>a[0])for(;j.ps<i.ps;)j.octave+=1;else for(;j.ps<i.ps;)j.octave+=-1;a.push(j)}for(var k=[],l=0;l<a.length-1;l++){var m=new Ta.Interval(a[l],a[l+1]);k.push(m)}this._net=k}},{key:"getDegreeMaxUnique",value:function(){return this._net.length}},{key:"getRealization",value:function(a,b,c,d,e,f){a="string"==typeof a?new Ja.Pitch(a):a.clone();var g=[a],h=!0,i=!1,j=void 0;try{for(var k,l=this._net[Symbol.iterator]();!(h=(k=l.next()).done);h=!0){a=k.value.transposePitch(a),g.push(a)}}catch(a){i=!0,j=a}finally{try{!h&&l.return&&l.return()}finally{if(i)throw j}}return g}},{key:"getPitchFromNodeDegree",value:function(a,b,c){for(var d=c-1,e=0;e<d;e++){a=this._net[e%this._net.length].transposePitch(a)}return a}},{key:"getRelativeNodeDegree",value:function(a,b,c,d,e){"string"==typeof c&&(c=new Ja.Pitch(c));var f=void 0;void 0!==this._oneOctaveRealizationCache?f=this._oneOctaveRealizationCache:(f=this.getRealization(a),this._oneOctaveRealizationCache=f);var g=[],h=!0,i=!1,j=void 0;try{for(var k,l=f[Symbol.iterator]();!(h=(k=l.next()).done);h=!0){var m=k.value;g.push(m.name)}}catch(a){i=!0,j=a}finally{try{!h&&l.return&&l.return()}finally{if(i)throw j}}var n=g.indexOf(c.name);return-1===n?void 0:n+1}}]),b}(Mc),Oc=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c.type="Abstract diatonic",c.tonicDegree=void 0,c.dominantDegree=void 0,c.octaveDuplicating=!0,c._buildNetwork(a),c}return I(b,a),F(b,[{key:"_buildNetwork",value:function(a){var b=["M2","M2","m2","M2","M2","M2","m2"],c=void 0;if(this.tonicDegree=1,this.dominantDegree=5,["major","ionian",void 0].includes(a))c=b,this.relativeMajorDegree=1,this.relativeMinorDegree=6;else if(["minor","aeolian"].includes(a)){var d;c=b.slice(5,7),(d=c).push.apply(d,M(b.slice(0,5))),this.relativeMajorDegree=3,this.relativeMinorDegree=1}this._net=[];var e=!0,f=!1,g=void 0;try{for(var h,i=c[Symbol.iterator]();!(e=(h=i.next()).done);e=!0){var j=h.value;this._net.push(new Ta.Interval(j))}}catch(a){f=!0,g=a}finally{try{!e&&i.return&&i.return()}finally{if(f)throw g}}}}]),b}(Nc),Pc=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.type="Abstract harmonic minor",a.octaveDuplicating=!0,a._buildNetwork(),a}return I(b,a),F(b,[{key:"_buildNetwork",value:function(){var a=["M2","m2","M2","M2","m2","A2","m2"];this._net=[];var b=!0,c=!1,d=void 0;try{for(var e,f=a[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;this._net.push(new Ta.Interval(g))}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}}}]),b}(Nc),Qc=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.type="Abstract ascending melodic minor",a.octaveDuplicating=!0,a._buildNetwork(),a}return I(b,a),F(b,[{key:"_buildNetwork",value:function(){var a=["M2","m2","M2","M2","M2","M2","m2"];this._net=[];var b=!0,c=!1,d=void 0;try{for(var e,f=a[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;this._net.push(new Ta.Interval(g))}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}}}]),b}(Nc),Rc=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return"string"==typeof a&&(a=new Ja.Pitch(a)),c.tonic=a,c.abstract=void 0,c}return I(b,a),F(b,[{key:"getTonic",value:function(){return this.tonic}},{key:"getPitches",value:function(a,b,c){var d=void 0;return d=void 0===this.tonic?new Ja.Pitch("C4"):this.tonic,this.abstract.getRealization(d)}},{key:"pitchFromDegree",value:function(a,b,c,d,e){return this.abstract.getPitchFromNodeDegree(this.tonic,this.abstract.tonicDegree,a)}},{key:"getScaleDegreeFromPitch",value:function(a,b,c){return this.abstract.getRelativeNodeDegree(this.tonic,this.abstract.tonicDegree,a)}},{key:"isConcrete",get:function(){return void 0!==this.tonic}}]),b}(Mc),Sc=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.abstract=new Oc,c.type="diatonic",c}return I(b,a),b}(Rc),Tc=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.type="major",c.abstract._buildNetwork(c.type),c}return I(b,a),b}(Sc),Uc=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.type="minor",c.abstract._buildNetwork(c.type),c}return I(b,a),b}(Sc),Vc=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.type="harmonic minor",c.abstract=new Pc,c}return I(b,a),b}(Rc),Wc=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.type="harmonic minor",c.abstract=new Qc,c}return I(b,a),b}(Rc),Xc={Scale:Mc,AbstractScale:Nc,AbstractDiatonicScale:Oc,AbstractHarmonicMinorScale:Pc,AbstractAscendingMelodicMinorScale:Qc,ConcreteScale:Rc,DiatonicScale:Sc,MajorScale:Tc,MinorScale:Uc,HarmonicMinorScale:Vc,AscendingMelodicMinorScale:Wc,ScaleSimpleMinor:v,ScaleSimpleMajor:u,SimpleDiatonicScale:t},Yc={};Yc.modeSharpsAlter={major:0,minor:-3,dorian:-2,phrygian:-4,lydian:1,mixolydian:-1,locrian:-5},Yc.convertKeyStringToMusic21KeyString=function(a){return"bb"===a?a="b-":"Bb"===a?a="B-":a.endsWith("b")&&!a.startsWith("b")&&(a=a.replace(/b$/,"-")),a};var Zc=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c.classSortOrder=2,c._sharps=a||0,c._alteredPitchesCache=void 0,c.flatMapping=["C","F","B-","E-","A-","D-","G-","C-","F-","B--","E--","A--","D--"],c.sharpMapping=["C","G","D","A","E","B","F#","C#","G#","D#","A#","E#","B#"],c}return I(b,a),F(b,[{key:"stringInfo",value:function(){return 0===this.sharps?"of no sharps or flats":-1===this.sharps?"of 1 flat":1===this.sharps?"of 1 sharp":this.sharps<0?"of "+Math.abs(this.sharps)+" flats":"of "+this.sharps+" sharps"}},{key:"majorName",value:function(){return this.sharps>=0?this.sharpMapping[this.sharps]:this.flatMapping[Math.abs(this.sharps)]}},{key:"minorName",value:function(){var a=this.sharps+3;return a>=0?this.sharpMapping[a]:this.flatMapping[Math.abs(a)]}},{key:"vexflow",value:function(){return console.log("calling deprecated function KeySignature.vexflow"),this.majorName().replace(/-/g,"b")}},{key:"accidentalByStep",value:function(a){for(var b=this.alteredPitches,c=0;c<b.length;c++)if(b[c].step===a){if(void 0===b[c].accidental)return;return new Ja.Accidental(b[c].accidental.alter)}}},{key:"transposePitchFromC",value:function(a){var b=void 0,c=void 0;if(0===this.sharps)return new Ja.Pitch(a.nameWithOctave);this.sharps<0?(c=Math.abs(this.sharps),b=new Ta.Interval("P4")):(c=this.sharps,b=new Ta.Interval("P5"));for(var d=a,e=0;e<c;e++)d=b.transposePitch(d),e%2==1&&(d.octave-=1);return d}},{key:"sharps",get:function(){return this._sharps},set:function(a){this._alteredPitchesCache=[],this._sharps=a}},{key:"width",get:function(){return 0===this.sharps?0:12*Math.abs(this.sharps)+6}},{key:"alteredPitches",get:function(){if(void 0!==this._alteredPitchesCache)return this._alteredPitchesCache;var a="P5",b="B";this.sharps<0&&(a="P4",b="F");for(var c=new Ta.Interval(a),d=[],e=new Ja.Pitch(b),f=0;f<Math.abs(this.sharps);f++)e=c.transposePitch(e),e.octave=4,d.push(e);return this._alteredPitchesCache=d,d}}]),b}(ha.Music21Object);Yc.KeySignature=Zc;var $c=function(a){function b(a,c){if(E(this,b),void 0===a&&(a="C"),void 0===c){c=a===a.toLowerCase()?"minor":"major"}var d="A-- E-- B-- F- C- G- D- A- E- B- F C G D A E B F# C# G# D# A# E# B#".split(" "),e=d.indexOf(a.toUpperCase());if(-1===e)throw new O("Cannot find the key for "+a);var f=Yc.modeSharpsAlter[c]||0,g=e+f-11;R&&console.log("Found sharps "+g+" for key: "+a);var h=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,g));return h.tonic=new Ja.Pitch(a),h.mode=c,h._scale=h.getScale(),h}return I(b,a),F(b,[{key:"stringInfo",value:function(){return this.tonicPitchNameWithCase+" "+this.mode}},{key:"getScale",value:function(a){void 0===a&&(a=this.mode);var b=this.tonic;return"major"===a?new Xc.MajorScale(b):"minor"===a?new Xc.MinorScale(b):["harmonic minor","harmonic-minor"].includes(a)?new Xc.HarmonicMinorScale(b):["melodic minor","melodic-minor"].includes(a)?new Xc.AscendingMelodicMinorScale(b):new Xc.ConcreteScale(b)}},{key:"getPitches",value:function(){var a;return(a=this._scale).getPitches.apply(a,arguments)}},{key:"pitchFromDegree",value:function(){var a;return(a=this._scale).pitchFromDegree.apply(a,arguments)}},{key:"getScaleDegreeFromPitch",value:function(){var a;return(a=this._scale).getScaleDegreeFromPitch.apply(a,arguments)}},{key:"tonicPitchNameWithCase",get:function(){var a=this.tonic.name;return"major"===this.mode?a=a.toUpperCase():"minor"===this.mode&&(a=a.toLowerCase()),a}},{key:"isConcrete",get:function(){return this._scale.isConcrete}}]),b}(Zc);Yc.Key=$c;var _c={},ad=function(b){function c(a){E(this,c);var b=J(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));return b.classSortOrder=4,b._numerator=4,b._denominator=4,b._beatGroups=[],b._overwrittenBeatCount=void 0,b._overwrittenBeatDuration=void 0,"string"==typeof a&&(b.ratioString=a),b}return I(c,b),F(c,[{key:"stringInfo",value:function(){return this.ratioString}},{key:"computeBeatGroups",value:function(){var a=[],b=this.numerator,c=this.denominator;if(c<8&&b>=5){var d=8/c;c=8,b*=d}if(c>=8){for(;b>=5;)a.push([3,c]),b-=3;4===b?(a.push([2,c]),a.push([2,c])):b>0&&a.push([b,c])}else 2===c?a.push([1,2]):c<=1?a.push([1,1]):a.push([2,8]);return a}},{key:"offsetToSpan",value:function(a){var b=this.beatDuration.quarterLength,c=Math.floor(a/b),d=c*b;return[d,d+b]}},{key:"getBeams",value:function(a,b){var c=this,d={measureStartOffset:0};S.merge(d,b);var e=d.measureStartOffset,f=Ga.Beams.naiveBeams(a);f=Ga.Beams.removeSandwichedUnbeamables(f);for(var g=0;g<Ga.beamableDurationTypes.length;g++){var h=0,i=!0,j=!1,k=void 0;try{for(var l,m=a[Symbol.iterator]();!(i=(l=m.next()).done);i=!0){var n=l.value;!function(b,d,g){var h=f[b];if(h&&void 0!==h){var i=g+1;if(h.getNumbers().includes(i)){var j=d.duration,k=d.offset+e,l=k,m=k+j.quarterLength,n=m,o=b===a.length-1,p=0===b,q=void 0,r=void 0;p||(r=f[b-1]),o||(q=f[b+1]);var s=c.offsetToSpan(l),t=L(s,2),u=t[0],v=t[1],w=0;if(void 0!==q&&(w=c.offsetToSpan(n)[0]),l===u&&m===v)return void(f[b]=void 0);var x=void 0;if(p)x="start",void 0!==q&&q.getNumbers().includes(i)||(x="partial-right");else if(o)x="start",void 0!==r&&r.getNumbers().includes(i)||(x="partial-left");else if(void 0!==r&&r.getNumbers().includes(i))if(void 0!==r&&r.getNumbers().includes(i)&&["stop","partial-left"].includes(r.getTypeByNumber(i)))x=void 0!==q?"start":"partial-left";else if(void 0!==q&&q.getNumbers().includes(i))if(n<v)x="continue";else{if(!(n>=w))return void console.warn("Cannot match beamType");x="stop"}else x="stop";else{if(1===i&&void 0===q)return void(f[b]=void 0);x=void 0===q&&i>1?"partial-left":n>=v?"partial-left":void 0!==q&&q.getNumbers().includes(i)?"start":"partial-right"}h.setByNumber(i,x)}}}(h,n,g),h+=1}}catch(a){j=!0,k=a}finally{try{!i&&m.return&&m.return()}finally{if(j)throw k}}}return f=Ga.Beams.sanitizePartialBeams(f),f=Ga.Beams.mergeConnectingPartialBeams(f)}},{key:"vexflowBeatGroups",value:function(){for(var b=this.beatGroups,c=[],d=0;d<b.length;d++){var e=b[d];c.push(new a.Flow.Fraction(e[0],e[1]))}return c}},{key:"numerator",get:function(){return this._numerator},set:function(a){this._numerator=a}},{
key:"denominator",get:function(){return this._denominator},set:function(a){this._denominator=a}},{key:"ratioString",get:function(){return this.numerator.toString()+"/"+this.denominator.toString()},set:function(a){var b=a.split("/");this.numerator=parseInt(b[0]),this.denominator=parseInt(b[1]),this._beatGroups=[]}},{key:"barDuration",get:function(){var a=4*this._numerator/this._denominator;return new Z.Duration(a)}},{key:"beatGroups",get:function(){return 0===this._beatGroups.length&&(this._beatGroups=this.computeBeatGroups()),this._beatGroups},set:function(a){this._beatGroups=a}},{key:"beatCount",get:function(){return void 0!==this._overwrittenBeatCount?this._overwrittenBeatCount:this.numerator>3&&this.numerator%3==0?this.numerator/3:this.numerator},set:function(a){return this._overwrittenBeatCount=a,a}},{key:"beatDuration",get:function(){var a=this.barDuration;return a.quarterLength/=this.beatCount,a},set:function(a){this._overwrittenBeatDuration=a}}]),c}(ha.Music21Object);_c.TimeSignature=ad;var bd={},cd=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c.classSortOrder=-25,c.partId=void 0,c.partName=void 0,c.partAbbreviation=void 0,c.instrumentId=void 0,c.instrumentName=a,c.instrumentAbbreviation=void 0,c.midiProgram=void 0,c._midiChannel=void 0,c.lowestNote=void 0,c.highestNote=void 0,c.transpostion=void 0,c.inGMPercMap=!1,c.soundfontFn=void 0,void 0!==a&&bd.find(a,c),c}return I(b,a),F(b,[{key:"autoAssignMidiChannel",value:function(a){void 0===a&&(a=bd.usedChannels);var b=0;this.inGMPercMap&&(b=10);for(var c=b;c<bd.maxMidi;c++)if(!(c%16==10&&!0!==this.inGMPercMap||void 0!==a[c]&&a[c]!==this.midiProgram))return a[c]=this.midiProgram,this.midiChannel=c,c}},{key:"oggSoundfont",get:function(){return this.soundfontFn+"-ogg.js"}},{key:"mp3Soundfont",get:function(){return this.soundfontFn+"-mp3.js"}},{key:"midiChannel",get:function(){return void 0===this._midiChannel&&this.autoAssignMidiChannel(),this._midiChannel},set:function(a){this._midiChannel=a}}]),b}(ha.Music21Object);bd.Instrument=cd,bd.usedChannels=[],bd.maxMidi=16,bd.info=[{fn:"acoustic_grand_piano",name:"Acoustic Grand Piano",midiNumber:0},{fn:"bright_acoustic_piano",name:"Bright Acoustic Piano",midiNumber:1},{fn:"electric_grand_piano",name:"Electric Grand Piano",midiNumber:2},{fn:"honkytonk_piano",name:"Honky-tonk Piano",midiNumber:3},{fn:"electric_piano_1",name:"Electric Piano 1",midiNumber:4},{fn:"electric_piano_2",name:"Electric Piano 2",midiNumber:5},{fn:"harpsichord",name:"Harpsichord",midiNumber:6},{fn:"clavinet",name:"Clavinet",midiNumber:7},{fn:"celesta",name:"Celesta",midiNumber:8},{fn:"glockenspiel",name:"Glockenspiel",midiNumber:9},{fn:"music_box",name:"Music Box",midiNumber:10},{fn:"vibraphone",name:"Vibraphone",midiNumber:11},{fn:"marimba",name:"Marimba",midiNumber:12},{fn:"xylophone",name:"Xylophone",midiNumber:13},{fn:"tubular_bells",name:"Tubular Bells",midiNumber:14},{fn:"dulcimer",name:"Dulcimer",midiNumber:15},{fn:"drawbar_organ",name:"Drawbar Organ",midiNumber:16},{fn:"percussive_organ",name:"Percussive Organ",midiNumber:17},{fn:"rock_organ",name:"Rock Organ",midiNumber:18},{fn:"church_organ",name:"Church Organ",midiNumber:19},{fn:"reed_organ",name:"Reed Organ",midiNumber:20},{fn:"accordion",name:"Accordion",midiNumber:21},{fn:"harmonica",name:"Harmonica",midiNumber:22},{fn:"tango_accordion",name:"Tango Accordion",midiNumber:23},{fn:"acoustic_guitar_nylon",name:"Acoustic Guitar (nylon)",midiNumber:24},{fn:"acoustic_guitar_steel",name:"Acoustic Guitar (steel)",midiNumber:25},{fn:"electric_guitar_jazz",name:"Electric Guitar (jazz)",midiNumber:26},{fn:"electric_guitar_clean",name:"Electric Guitar (clean)",midiNumber:27},{fn:"electric_guitar_muted",name:"Electric Guitar (muted)",midiNumber:28},{fn:"overdriven_guitar",name:"Overdriven Guitar",midiNumber:29},{fn:"distortion_guitar",name:"Distortion Guitar",midiNumber:30},{fn:"guitar_harmonics",name:"Guitar Harmonics",midiNumber:31},{fn:"acoustic_bass",name:"Acoustic Bass",midiNumber:32},{fn:"electric_bass_finger",name:"Electric Bass (finger)",midiNumber:33},{fn:"electric_bass_pick",name:"Electric Bass (pick)",midiNumber:34},{fn:"fretless_bass",name:"Fretless Bass",midiNumber:35},{fn:"slap_bass_1",name:"Slap Bass 1",midiNumber:36},{fn:"slap_bass_2",name:"Slap Bass 2",midiNumber:37},{fn:"synth_bass_1",name:"Synth Bass 1",midiNumber:38},{fn:"synth_bass_2",name:"Synth Bass 2",midiNumber:39},{fn:"violin",name:"Violin",midiNumber:40},{fn:"viola",name:"Viola",midiNumber:41},{fn:"cello",name:"Cello",midiNumber:42},{fn:"contrabass",name:"Contrabass",midiNumber:43},{fn:"tremolo_strings",name:"Tremolo Strings",midiNumber:44},{fn:"pizzicato_strings",name:"Pizzicato Strings",midiNumber:45},{fn:"orchestral_harp",name:"Orchestral Harp",midiNumber:46},{fn:"timpani",name:"Timpani",midiNumber:47},{fn:"string_ensemble_1",name:"String Ensemble 1",midiNumber:48},{fn:"string_ensemble_2",name:"String Ensemble 2",midiNumber:49},{fn:"synth_strings_1",name:"Synth Strings 1",midiNumber:50},{fn:"synth_strings_2",name:"Synth Strings 2",midiNumber:51},{fn:"choir_aahs",name:"Choir Aahs",midiNumber:52},{fn:"voice_oohs",name:"Voice Oohs",midiNumber:53},{fn:"synth_choir",name:"Synth Choir",midiNumber:54},{fn:"orchestra_hit",name:"Orchestra Hit",midiNumber:55},{fn:"trumpet",name:"Trumpet",midiNumber:56},{fn:"trombone",name:"Trombone",midiNumber:57},{fn:"tuba",name:"Tuba",midiNumber:58},{fn:"muted_trumpet",name:"Muted Trumpet",midiNumber:59},{fn:"french_horn",name:"French Horn",midiNumber:60},{fn:"brass_section",name:"Brass Section",midiNumber:61},{fn:"synth_brass_1",name:"Synth Brass 1",midiNumber:62},{fn:"synth_brass_2",name:"Synth Brass 2",midiNumber:63},{fn:"soprano_sax",name:"Soprano Sax",midiNumber:64},{fn:"alto_sax",name:"Alto Sax",midiNumber:65},{fn:"tenor_sax",name:"Tenor Sax",midiNumber:66},{fn:"baritone_sax",name:"Baritone Sax",midiNumber:67},{fn:"oboe",name:"Oboe",midiNumber:68},{fn:"english_horn",name:"English Horn",midiNumber:69},{fn:"bassoon",name:"Bassoon",midiNumber:70},{fn:"clarinet",name:"Clarinet",midiNumber:71},{fn:"piccolo",name:"Piccolo",midiNumber:72},{fn:"flute",name:"Flute",midiNumber:73},{fn:"recorder",name:"Recorder",midiNumber:74},{fn:"pan_flute",name:"Pan Flute",midiNumber:75},{fn:"blown_bottle",name:"Blown bottle",midiNumber:76},{fn:"shakuhachi",name:"Shakuhachi",midiNumber:77},{fn:"whistle",name:"Whistle",midiNumber:78},{fn:"ocarina",name:"Ocarina",midiNumber:79},{fn:"lead_1_square",name:"Lead 1 (square)",midiNumber:80},{fn:"lead_2_sawtooth",name:"Lead 2 (sawtooth)",midiNumber:81},{fn:"lead_3_calliope",name:"Lead 3 (calliope)",midiNumber:82},{fn:"lead_4_chiff",name:"Lead 4 chiff",midiNumber:83},{fn:"lead_5_charang",name:"Lead 5 (charang)",midiNumber:84},{fn:"lead_6_voice",name:"Lead 6 (voice)",midiNumber:85},{fn:"lead_7_fifths",name:"Lead 7 (fifths)",midiNumber:86},{fn:"lead_8_bass__lead",name:"Lead 8 (bass + lead)",midiNumber:87},{fn:"pad_1_new_age",name:"Pad 1 (new age)",midiNumber:88},{fn:"pad_2_warm",name:"Pad 2 (warm)",midiNumber:89},{fn:"pad_3_polysynth",name:"Pad 3 (polysynth)",midiNumber:90},{fn:"pad_4_choir",name:"Pad 4 (choir)",midiNumber:91},{fn:"pad_5_bowed",name:"Pad 5 (bowed)",midiNumber:92},{fn:"pad_6_metallic",name:"Pad 6 (metallic)",midiNumber:93},{fn:"pad_7_halo",name:"Pad 7 (halo)",midiNumber:94},{fn:"pad_8_sweep",name:"Pad 8 (sweep)",midiNumber:95},{fn:"fx_1_rain",name:"FX 1 (rain)",midiNumber:96},{fn:"fx_2_soundtrack",name:"FX 2 (soundtrack)",midiNumber:97},{fn:"fx_3_crystal",name:"FX 3 (crystal)",midiNumber:98},{fn:"fx_4_atmosphere",name:"FX 4 (atmosphere)",midiNumber:99},{fn:"fx_5_brightness",name:"FX 5 (brightness)",midiNumber:100},{fn:"fx_6_goblins",name:"FX 6 (goblins)",midiNumber:101},{fn:"fx_7_echoes",name:"FX 7 (echoes)",midiNumber:102},{fn:"fx_8_scifi",name:"FX 8 (sci-fi)",midiNumber:103},{fn:"sitar",name:"Sitar",midiNumber:104},{fn:"banjo",name:"Banjo",midiNumber:105},{fn:"shamisen",name:"Shamisen",midiNumber:106},{fn:"koto",name:"Koto",midiNumber:107},{fn:"kalimba",name:"Kalimba",midiNumber:108},{fn:"bagpipe",name:"Bagpipe",midiNumber:109},{fn:"fiddle",name:"Fiddle",midiNumber:110},{fn:"shanai",name:"Shanai",midiNumber:111},{fn:"tinkle_bell",name:"Tinkle Bell",midiNumber:112},{fn:"agogo",name:"Agogo",midiNumber:113},{fn:"steel_drums",name:"Steel Drums",midiNumber:114},{fn:"woodblock",name:"Woodblock",midiNumber:115},{fn:"taiko_drum",name:"Taiko Drum",midiNumber:116},{fn:"melodic_tom",name:"Melodic Tom",midiNumber:117},{fn:"synth_drum",name:"Synth Drum",midiNumber:118},{fn:"reverse_cymbal",name:"Reverse Cymbal",midiNumber:119},{fn:"guitar_fret_noise",name:"Guitar Fret Noise",midiNumber:120},{fn:"breath_noise",name:"Breath Noise",midiNumber:121},{fn:"seashore",name:"Seashore",midiNumber:122},{fn:"bird_tweet",name:"Bird Tweet",midiNumber:123},{fn:"telephone_ring",name:"Telephone Ring",midiNumber:124},{fn:"helicopter",name:"Helicopter",midiNumber:125},{fn:"applause",name:"Applause",midiNumber:126},{fn:"gunshot",name:"Gunshot",midiNumber:127}],bd.find=function(a,b){void 0===b&&(b=new bd.Instrument);for(var c=0;c<bd.info.length;c++){var d=bd.info[c];if(d.fn===a||d.name===a)return b.soundfontFn=d.fn,b.instrumentName=d.name,b.midiProgram=d.midiNumber,b}};var dd={},ed=function a(){E(this,a);var b={displayClef:!0,displayTimeSignature:!0,displayKeySignature:!0,scaleFactor:{x:.7,y:.7},top:0,left:void 0,width:void 0,overriddenWidth:void 0,height:void 0,naiveHeight:120,systemIndex:0,partIndex:0,measureIndex:0,systemMeasureIndex:0,systemPadding:void 0,naiveSystemPadding:40,stemDirection:void 0,maxSystemWidth:void 0,rightBarline:void 0,staffLines:5,staffConnectors:["single","brace"],staffPadding:60,events:{click:"play",dblclick:void 0},startNewSystem:!1,startNewPage:!1,showMeasureNumber:void 0};S.merge(this,b)};dd.RenderOptions=ed;var fd=new Ac.TrebleClef,gd={},hd=function(){function a(){E(this,a),this.voices=[],this.streams=[],this.textVoices=[],this.voiceToStreamMapping=new Map}return F(a,[{key:"allTickables",value:function(){var a=[];return a.push.apply(a,M(this.voices)),a.push.apply(a,M(this.textVoices)),a}},{key:"tickablesByStave",value:function(){var a=[],b=[],c=!0,d=!1,e=void 0;try{for(var f,g=this.allTickables()[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value,i=b.indexOf(h.stave),j=void 0;-1===i?(b.push(h.stave),j=[],a.push(j)):j=a[i],j.push(h)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return a}}]),a}();gd.RenderStack=hd;var id=function(){function b(a,d,e){E(this,b),this.stream=a,this.rendererType="svg",this.div=void 0,this.$div=void 0,this.$where=void 0,this.activeFormatter=void 0,this._vfRenderer=void 0,this._ctx=void 0,this.beamGroups=[],this.stacks=[],this.vfTies=[],this.systemBreakOffsets=[],this.vfTuplets=[],void 0!==e&&(void 0!==e.jquery?this.$where=e:this.$where=c(e)),void 0!==d&&(void 0!==d.jquery?(this.$div=d,this.div=d[0]):(this.div=d,this.$div=c(d)))}return F(b,[{key:"render",value:function(a){void 0===a&&(a=this.stream);var b=!1,c=!1,d=a.isFlat;a.isClassOrSubclass("Score")?b=!0:d||a.get(0).isFlat?d||(c=!0):b=!0,b?this.prepareScorelike(a):c?this.preparePartlike(a):this.prepareArrivedFlat(a),this.formatMeasureStacks(),this.drawTies(),this.drawMeasureStacks(),this.drawBeamGroups(),this.drawTuplets()}},{key:"prepareScorelike",value:function(a){var b=a.parts,c=!0,d=!1,e=void 0;try{for(var f,g=b[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;this.preparePartlike(h)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}this.addStaffConnectors(a)}},{key:"preparePartlike",value:function(a){this.systemBreakOffsets=[];for(var b=a.measures,c=0;c<b.length;c++){var d=b.get(c);d.renderOptions.startNewSystem&&this.systemBreakOffsets.push(d.offset),c===a.length-1&&(d.renderOptions.rightBarline="end"),void 0===this.stacks[c]&&(this.stacks[c]=new gd.RenderStack),this.prepareMeasure(d,this.stacks[c])}this.prepareTies(a)}},{key:"prepareArrivedFlat",value:function(a){var b=new gd.RenderStack;this.prepareMeasure(a,b),this.stacks[0]=b,this.prepareTies(a)}},{key:"prepareMeasure",value:function(a,b){if(void 0===a.hasVoices||!1===a.hasVoices())this.prepareFlat(a,b);else{var c=a.getElementsByClass("Voice").get(0).clone(!1),d=!0,e=!1,f=void 0;try{for(var g,h=a.getElementsNotOfClass("Voice")[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value;c.insert(i.offset,i)}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}var j=a.renderOptions,k=void 0,l=!0,m=!1,n=void 0;try{for(var o,p=Array.from(a.getElementsByClass("Voice")).entries()[Symbol.iterator]();!(l=(o=p.next()).done);l=!0){var q=L(o.value,2),r=q[0],s=q[1],t=s;0===r&&(t=c),k=this.prepareFlat(t,b,k,j),0===r&&(s.activeVFStave=t.activeVFStave,s.storedVexflowStave=t.activeVFStave)}}catch(a){m=!0,n=a}finally{try{!l&&p.return&&p.return()}finally{if(m)throw n}}}return b}},{key:"prepareFlat",value:function(a,b,c,d){a.makeNotation();var e=void 0;e=void 0!==c?c:this.renderStave(a,d),a.activeVFStave=e;var f=this.getVoice(a,e);return b.voices.push(f),b.streams.push(a),b.voiceToStreamMapping.set(f,a),a.hasLyrics()&&b.textVoices.push(this.getLyricVoice(a,e)),e}},{key:"renderStave",value:function(a,b){void 0===a&&(a=this.stream);var c=this.ctx,d=this.newStave(a,b);return this.setClefEtc(a,d,b),d.setContext(c),d.draw(),d}},{key:"drawMeasureStacks",value:function(){for(var a=this.ctx,b=0;b<this.stacks.length;b++)for(var c=this.stacks[b].allTickables(),d=0;d<c.length;d++){var e=c[d];e.draw(a)}}},{key:"drawTuplets",value:function(){var a=this.ctx;this.vfTuplets.forEach(function(b){b.setContext(a).draw()})}},{key:"drawTies",value:function(){for(var a=this.ctx,b=0;b<this.vfTies.length;b++)this.vfTies[b].setContext(a).draw()}},{key:"prepareTies",value:function(b){for(var c=b.flat.notesAndRests,d=0;d<c.length-1;d++){var e=c.get(d);if(void 0!==e.tie&&"stop"!==e.tie.type){for(var f=c.get(d+1),g=!0,h=0;h<this.systemBreakOffsets.length;h++){var i=this.systemBreakOffsets[h];if(e.offset<i&&f.offset>=i){g=!1;break}}if(g){var j=new a.Flow.StaveTie({first_note:e.activeVexflowNote,last_note:f.activeVexflowNote,first_indices:[0],last_indices:[0]});this.vfTies.push(j)}else{var k=new a.Flow.StaveTie({first_note:e.activeVexflowNote,first_indices:[0]});this.vfTies.push(k);var l=new a.Flow.StaveTie({last_note:f.activeVexflowNote,first_indices:[0]});this.vfTies.push(l)}}}}},{key:"getVoice",value:function(a,b){void 0===a&&(a=this.stream);var c=this.vexflowNotes(a,b),d=this.vexflowVoice(a);return d.setStave(b),d.addTickables(c),d}},{key:"getLyricVoice",value:function(a,b){var c=this.vexflowVoice(a),d=this.vexflowLyrics(a,b);return c.setStave(b),c.addTickables(d),c}},{key:"formatMeasureStacks",value:function(){for(var a=0;a<this.stacks.length;a++)for(var b=this.stacks[a],c=b.voices,d=b.streams,e=this.formatVoiceGroup(b),f=0;f<d.length;f++){var g=d[f],h=c[f];this.applyFormatterInformationToNotes(h.stave,g,e)}}},{key:"formatVoiceGroup",value:function(b,c){var d=b.allTickables(),e=b.voices,f=b.streams;void 0===c&&(c=f[0].autoBeam);var g=new a.Flow.Formatter;if(0===e.length)return g;for(var h=0,i=0;i<d.length;i++)d[i].stave.getNoteStartX()>h&&(h=d[i].stave.getNoteStartX());for(var j=0;j<d.length;j++)d[j].stave.setNoteStartX(h);var k=e[0].stave,l=b.tickablesByStave(),m=!0,n=!1,o=void 0;try{for(var p,q=l[Symbol.iterator]();!(m=(p=q.next()).done);m=!0){var r=p.value;g.joinVoices(r)}}catch(a){n=!0,o=a}finally{try{!m&&q.return&&q.return()}finally{if(n)throw o}}if(g.formatToStave(d,k),c)for(var s=0;s<e.length;s++){var t,u=e[s],v=b.voiceToStreamMapping.get(u),w=void 0;w=void 0!==v&&void 0!==v.getSpecialContext("timeSignature")?v.getSpecialContext("timeSignature").vexflowBeatGroups(a):[new a.Flow.Fraction(2,8)];var x=a.Flow.Beam.applyAndGetBeams(u,void 0,w);(t=this.beamGroups).push.apply(t,M(x))}return g}},{key:"drawBeamGroups",value:function(){for(var a=this.ctx,b=0;b<this.beamGroups.length;b++)this.beamGroups[b].setContext(a).draw()}},{key:"newStave",value:function(b,c){void 0===b&&(b=this.stream),void 0===c&&(c=b.renderOptions);var d=c.width;void 0===d&&(d=b.estimateStaffLength()+c.staffPadding);var e=c.top;void 0===e&&(e=0);var f=c.left;return void 0===f&&(f=10),R&&console.log("creating new stave: left:"+f+" top: "+e+" width: "+d),new a.Flow.Stave(f,e,d)}},{key:"setClefEtc",value:function(b,c,d){void 0===d&&(d=b.renderOptions);var e=b.getSpecialContext("clef")||b.getContextByClass("Clef");if(void 0===e&&b.length){e=b.get(0).getContextByClass("Clef")}if(e=e||fd,this.setStafflines(b,c),d.showMeasureNumber&&c.setMeasure(d.measureIndex+1),d.displayClef){var f=void 0;1===e.octaveChange?f="8va":-1===e.octaveChange&&(f="8vb"),c.addClef(e.name,"default",f)}var g=b.getSpecialContext("keySignature")||b.getContextByClass("KeySignature");if(void 0!==g&&d.displayKeySignature){var h=g.majorName().replace(/-/g,"b");c.addKeySignature(h)}var i=b.getSpecialContext("timeSignature")||b.getContextByClass("TimeSignature");if(void 0!==i&&d.displayTimeSignature&&c.addTimeSignature(i.numerator.toString()+"/"+i.denominator.toString()),void 0!==d.rightBarline){var j=d.rightBarline,k={single:"SINGLE",double:"DOUBLE",end:"END"},l=k[j];void 0!==l&&c.setEndBarType(a.Flow.Barline.type[l])}}},{key:"setStafflines",value:function(a,b){var c=a.renderOptions;5!==c.staffLines&&(0===c.staffLines?b.setNumLines(0):1===c.staffLines?b.options.line_config=[{visible:!1},{visible:!1},{visible:!0},{visible:!1},{visible:!1}]:2===c.staffLines?b.options.line_config=[{visible:!1},{visible:!1},{visible:!0},{visible:!0},{visible:!1}]:3===c.staffLines?b.options.line_config=[{visible:!1},{visible:!0},{visible:!0},{visible:!0},{visible:!1}]:b.setNumLines(c.staffLines))}},{key:"vexflowNotes",value:function(b,c){void 0===b&&(b=this.stream);var d=[],e=[],f=void 0,g=0,h=[],i=b.getSpecialContext("clef")||b.getContextByClass("Clef");if(void 0===i&&b.length){i=b.get(0).getContextByClass("Clef")}void 0===i&&(i=fd);var j={clef:i,stave:c},k=!0,l=!1,m=void 0;try{for(var n,o=b[Symbol.iterator]();!(k=(n=o.next()).done);k=!0){var p=n.value;if(p.isClassOrSubclass("GeneralNote")&&void 0!==p.duration){var q=p.vexflowNote(j);if(void 0===q){console.error("Cannot create a vexflowNote from: ",p);continue}if(void 0!==c&&q.setStave(c),d.push(q),p.duration.tuplets.length>0&&(void 0===f&&(f=p.duration.tuplets[0]),h.push(q),(g+=p.duration.quarterLength)>=f.totalTupletLength()||Math.abs(g-f.totalTupletLength())<.001)){var r={num_notes:f.numberNotesActual,notes_occupied:f.numberNotesNormal},s=new a.Flow.Tuplet(h,r);"ratio"===f.tupletNormalShow&&s.setRatioed(!0),e.push(s),g=0,f=void 0,h=[]}}}}catch(a){l=!0,m=a}finally{try{!k&&o.return&&o.return()}finally{if(l)throw m}}if(void 0!==f&&console.warn("incomplete tuplet found in stream: ",b),e.length>0){var t;(t=this.vfTuplets).push.apply(t,e)}return d}},{key:"vexflowLyrics",value:function(b,c){var d=function(b,d,e,f){var g=new a.Flow.TextNote({text:b,font:d,duration:e.vexflowDuration}).setLine(11).setStave(c).setJustification(a.Flow.TextNote.Justification.LEFT);return f&&g.setStyle(f.style),e.tuplets.length>0&&g.applyTickMultiplier(e.tuplets[0].numberNotesNormal,e.tuplets[0].numberNotesActual),g};void 0===b&&(b=this.stream);var e=[],f=!0,g=!1,h=void 0;try{for(var i,j=b[Symbol.iterator]();!(f=(i=j.next()).done);f=!0){var k=i.value,l=k.lyrics;if(void 0!==l){var m=void 0,n=k.duration,o=!1,p=void 0,q={family:"Serif",size:12,weight:""};if(0===l.length)m="";else{if(p=l[0],m=p.text,void 0===m&&(m=""),"middle"===p.syllabic||"begin"===p.syllabic){o=" "+p.lyricConnector;var r=k.duration.quarterLength/2;n=new Z.Duration(r)}p.style.fontFamily&&(q.family=p.style.fontFamily),p.style.fontSize&&(q.size=p.style.fontSize),p.style.fontWeight&&(q.weight=p.style.fontWeight)}var s=d(m,q,n,p);if(e.push(s),!1!==o){var t=d(o,q,n);e.push(t)}}}}catch(a){g=!0,h=a}finally{try{!f&&j.return&&j.return()}finally{if(g)throw h}}return e}},{key:"vexflowVoice",value:function(b){var c=b.duration.quarterLength,d=Math.round(c/(1/256)),e=1024;d%512==0?(e=2,d/=512):d%256==0?(e=4,d/=256):d%128==0?(e=8,d/=128):d%64==0?(e=16,d/=64):d%32==0?(e=32,d/=32):d%16==0?(e=64,d/=16):d%8==0?(e=128,d/=8):d%4==0?(e=256,d/=4):d%2==0&&(e=512,d/=2),R&&console.log("New voice, num_beats: "+d.toString()+" beat_value: "+e.toString());var f=new a.Flow.Voice({num_beats:d,beat_value:e,resolution:a.Flow.RESOLUTION});return f.setMode(a.Flow.Voice.Mode.SOFT),f}},{key:"staffConnectorsMap",value:function(b){return{brace:a.Flow.StaveConnector.type.BRACE,single:a.Flow.StaveConnector.type.SINGLE,double:a.Flow.StaveConnector.type.DOUBLE,bracket:a.Flow.StaveConnector.type.BRACKET}[b]}},{key:"addStaffConnectors",value:function(b){void 0===b&&(b=this.stream);var c=b.parts;if(!(c.length<2))for(var d=c.get(0),e=c.get(-1),f=d.measures,g=e.measures,h=f.length,i=0;i<h;i++){var j=f.get(i),k=g.get(i);if(j.renderOptions.startNewSystem){var l=j.activeVFStave,m=k.activeVFStave;if(void 0===l&&!j.isFlat){var n=j.getElementsByClass("Stream").get(0);if(void 0===(l=n.activeVFStave)){console.warn("No active VexFlow Staves defined for at least one measure");continue}}if(void 0===m&&!k.isFlat){var o=k.getElementsByClass("Stream").get(0);if(void 0===(m=o.activeVFStave)){console.warn("No active VexFlow Staves defined for at least one measure");continue}}for(var p=0;p<b.renderOptions.staffConnectors.length;p++){var q=new a.Flow.StaveConnector(l,m),r=b.renderOptions.staffConnectors[p],s=this.staffConnectorsMap(r);q.setType(s),q.setContext(this.ctx),q.draw()}}}}},{key:"removeFormatterInformation",value:function(a,b){a.storedVexflowStave=void 0;var c=!0,d=!1,e=void 0;try{for(var f,g=a[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;h.x=void 0,h.y=void 0,h.width=void 0,h.systemIndex=void 0,h.activeVexflowNote=void 0,b&&h.isClassOrSubclass("Stream")&&this.removeFormatterInformation(h,b)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}}},{key:"applyFormatterInformationToNotes",value:function(a,b,c){void 0===b&&(b=this.stream);var d=b.getSpecialContext("clef")||b.getContextByClass("Clef")||fd,e=0;void 0!==a&&(e=a.start_x+a.glyph_start_x,R&&(console.log("noteOffsetLeft: "+e+" ; stave.start_x: "+a.start_x),console.log("Bottom y: "+a.getBottomY())));var f=0,g=!0,h=!1,i=void 0;try{for(var j,k=b[Symbol.iterator]();!(g=(j=k.next()).done);g=!0){var l=j.value;if(l.isClassOrSubclass("GeneralNote")){var m=l.activeVexflowNote;if(void 0===m)continue;var n=parseInt(m.ticks),o=c.tickContexts.map[String(f)];if(f+=n,l.x=m.getAbsoluteX(),l.systemIndex=b.renderOptions.systemIndex,void 0===o)continue;l.width=o.width,void 0!==l.pitch&&(l.y=a.getBottomY()-(d.lowestLine-l.pitch.diatonicNoteNum)*a.options.spacing_between_lines_px)}}}catch(a){h=!0,i=a}finally{try{!g&&k.return&&k.return()}finally{if(h)throw i}}if(R){var p=!0,q=!1,r=void 0;try{for(var s,t=b[Symbol.iterator]();!(p=(s=t.next()).done);p=!0){var u=s.value;void 0!==u.pitch&&console.log(u.pitch.diatonicNoteNum+" "+u.x+" "+(u.x+u.width))}}catch(a){q=!0,r=a}finally{try{!p&&t.return&&t.return()}finally{if(q)throw r}}}b.storedVexflowStave=a}},{key:"vfRenderer",get:function(){var b=void 0;return b="canvas"===this.rendererType?a.Flow.Renderer.Backends.CANVAS:a.Flow.Renderer.Backends.SVG,void 0!==this._vfRenderer?this._vfRenderer:(this._vfRenderer=new a.Flow.Renderer(this.div,b),"svg"===this.rendererType&&this._vfRenderer.resize(this.$div.attr("width"),this.$div.attr("height")),this._vfRenderer)},set:function(a){this._vfRenderer=a}},{key:"ctx",get:function(){return void 0!==this._ctx?this._ctx:(this._ctx=this.vfRenderer.getContext(),this.stream&&this.stream.renderOptions&&this.stream.renderOptions.scaleFactor.x&&this.stream.renderOptions.scaleFactor.y&&this._ctx.scale(this.stream.renderOptions.scaleFactor.x,this.stream.renderOptions.scaleFactor.y),this._ctx)},set:function(a){this._ctx=a}}]),b}();gd.Renderer=id;var jd=function(a){function b(){return E(this,b),J(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return I(b,a),b}(O),kd=["Score","Part","Measure","Voice","GeneralNote"],ld=function(){function a(b){E(this,a),this.generalObj=b}return F(a,[{key:"parse",value:function(a){void 0===a&&(a=this.generalObj);var b=this.fromGeneralObj(a);return this.parseWellformedObject(b)}},{key:"parseWellformedObject",value:function(a){var b=new od(a);return b.parse(),b.asBytes()}},{key:"fromGeneralObj",value:function(a){var b=a.classes,c=void 0,d=!0,e=!1,f=void 0;try{for(var g,h=kd[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value;if(b.includes(i)){c=this["from"+i](a);break}}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}if(void 0===c)throw new jd("Cannot translate the object "+a+" to a complete musicXML document; put it in a Stream first!");return c}},{key:"fromScore",value:function(a){return a.makeNotation({inPlace:!1})}},{key:"fromPart",value:function(a){a.isFlat&&(a=a.makeMeasures());var b=new Sd;return b.insert(0,a),this.fromScore(b)}},{key:"fromMeasure",value:function(a){var b=a.makeNotation();void 0===a.clef&&(b.clef=Ac.bestClef(b,{recurse:!0}));var c=new Rd;return c.append(b),this.fromPart(c)}},{key:"fromVoice",value:function(a){var b=new Qd;return b.number=1,b.insert(0,a),this.fromMeasure(b)}},{key:"fromGeneralNote",value:function(a){var b=a.clone(!0),c=new Qd;return c.number=1,c.append(b),this.fromMeasure(c)}}]),a}(),md="3.0",nd=function(){function a(){E(this,a),this.doc=document.implementation.createDocument("","",null),this.xmlRoot=void 0}return F(a,[{key:"asBytes",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b=(a.noCopy,this.xmlHeader());return b+=(new XMLSerializer).serializeToString(this.xmlRoot)}},{key:"xmlHeader",value:function(){return'<?xml version="1.0" encoding="utf-8"?>\n <!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML '+md+' Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">\n '}},{key:"_setTagTextFromAttribute",value:function(a,b,c,d){var e=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},f=e.transform,g=e.forceEmpty,h=void 0!==g&&g;void 0===d&&(d=S.hyphenToCamelCase(c));var i=a[d];if(void 0!==f&&(i=f(i)),void 0!==i&&""!==i||h){var j=this.subElement(b,c);return void 0!==i&&(j.innerHTML=i),j}}},{key:"seta",value:function(a,b,c,d){return this._setTagTextFromAttribute(a,b,c,d)}},{key:"_setAttributeFromAttribute",value:function(a,b,c){var d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},e=d.attributeName,f=d.transform;void 0===e&&(e=S.hyphenToCamelCase(c));var g=a[e];void 0!==g&&(void 0!==f&&(g=f(g)),b.setAttribute(c,g.toString()))}},{key:"setb",value:function(a,b,c,d){return this._setAttributeFromAttribute(a,b,c,d)}},{key:"_synchronizeIds",value:function(a,b){}},{key:"addDividerComment",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",b=a.length;b>60&&(b=60);var c=Math.floor((60-b)/2),d=Math.ceil((60-b)/2),e="=".repeat(c)+" "+a+" "+"=".repeat(d),f=this.doc.createComment(e);this.xmlRoot.appendChild(f)}},{key:"subElement",value:function(a,b){var c=this.doc.createElement(b);return a.appendChild(c),c}},{key:"setColor",value:function(a,b){void 0!==b.color?a.setAttribute("color",x(b.color)):void 0!==b.style&&void 0!==b.style.color&&a.setAttribute("color",x(b.style.color))}},{key:"setEditorial",value:function(a,b){}},{key:"accidentalToMx",value:function(a){var b=void 0;b="double-flat"===a.name?"flat-flat":a.name;var c=this.doc.createElement("accidental");return c.innerHTML=b,c}},{key:"getRandomId",value:function(){for(var a="",b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",c=0;c<6;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}}]),a}(),od=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c.stream=void 0===a?new Sd:a,c.xmlRoot=c.doc.createElement("score-partwise"),c.xmlRoot.setAttribute("version",md),c.xmIdentification=void 0,c.scoreMetadata=void 0,c.spannerBundle=void 0,c.meterStream=void 0,c.scoreLayouts=void 0,c.firstScoreLayout=void 0,c.highestTime=0,c.refStreamOrTimeRange=[0,c.highestTime],c.partExporterList=[],c.instrumentList=[],c.midiChannelList=[],c.parts=[],c}return I(b,a),F(b,[{key:"parse",value:function(){return 0===this.stream.length?this.emptyObject():(this.scorePreliminaries(),this.parsePartlikeScore(),this.postPartProcess(),this.partExporterList=[],this.xmlRoot)}},{key:"emptyObject",value:function(){return this.xmlRoot}},{key:"scorePreliminaries",value:function(){this.setPartsAndRefStream(),this.highestTime=0}},{key:"setPartsAndRefStream",value:function(){var a=this.stream,b=a.getElementsByClass("Stream"),c=!0,d=!1,e=void 0;try{for(var f,g=b[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value,i=h.highestTime;i>this.highestTime&&(this.highestTime=i),this.refStreamOrTimeRange=[0,this.highestTime]}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}this.parts=b}},{key:"parsePartlikeScore",value:function(){var a=!0,b=!1,c=void 0;try{for(var d,e=this.parts[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){var f=d.value,g=new pd(f,{parent:this});g.parse(),this.partExporterList.push(g)}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}}},{key:"postPartProcess",value:function(){this.setScoreHeader();for(var a=0;a<this.partExporterList.length;a++){var b=this.partExporterList[a];this.addDividerComment("Part "+a.toString()),this.xmlRoot.appendChild(b.xmlRoot)}}},{key:"setScoreHeader",value:function(){this.setPartList()}},{key:"setPartList",value:function(){var a=this.subElement(this.xmlRoot,"part-list"),b=!0,c=!1,d=void 0;try{for(var e,f=this.partExporterList[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value,h=g.getXmlScorePart();a.appendChild(h)}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}return a}}]),b}(nd),pd=function(a){function b(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=c.parent;E(this,b);var e=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return e.stream=a,e.parent=d,e.xmlRoot=e.doc.createElement("part"),void 0===d?(e.meterStream=new Od,e.refStreamOrTimeRange=[0,0],e.midiChannelList=[]):(e.meterStream=d.meterStream,e.refStreamOrTimeRange=d.refStreamOrTimeRange,e.midiChannelList=d.midiChannelList),e.instrumentStream=void 0,e.firstInstrumentObject=void 0,e.lastDivisions=void 0,e.spannerBundle=a.spannerBundle,e.xmlPartId=e.getRandomId(),e}return I(b,a),F(b,[{key:"parse",value:function(){this.xmlRoot.setAttribute("id",this.xmlPartId);var a=this.stream.getElementsByClass("Stream"),b=!0,c=!1,d=void 0;try{for(var e,f=a[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;this.addDividerComment("Measure "+g.number.toString());var h=new ud(g,{parent:this});h.spannerBundle=this.spannerBundle;var i=h.parse();this.xmlRoot.appendChild(i)}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}return this.xmlRoot}},{key:"getXmlScorePart",value:function(){var a=this.doc.createElement("score-part");return a.setAttribute("id",this.xmlPartId),a}}]),b}(nd),qd=[["Note","noteToXml"],["Chord","chordToXml"],["Rest","restToXml"]],rd=[["Clef","clefToXml"],["KeySignature","keySignatureToXml"],["TimeSignature","timeSignatureToXml"]],sd=["LayoutBase","Barline"],td=10080,ud=function(a){function b(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=c.parent;E(this,b);var e=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return e.stream=a,e.parent=d,e.xmlRoot=e.doc.createElement("measure"),e.currentDivisions=td,e.transpositionInterval=void 0,e.mxTranspose=void 0,e.measureOffsetStart=0,e.offsetInMeasure=0,e.currentVoiceId=void 0,e.rbSpanners=[],e.spannerBundle=d.spannerBundle,e.objectSpannerBundle=e.spannerBundle,e}return I(b,a),F(b,[{key:"parse",value:function(){return this.setMxAttributes(),this.setMxAttributesObjectForStartOfMeasure(),this.mainElementsParse(),this.xmlRoot}},{key:"mainElementsParse",value:function(){var a=this.stream;if(!a.hasVoices())return void this.parseFlatElements(a,{
backupAfterwards:!1});var b=Array.from(a.voices),c=!0,d=!1,e=void 0;try{for(var f,g=b.entries()[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=L(f.value,2),i=h[0],j=h[1],k=!0;i===b.length-1&&(k=!1),this.parseFlatElements(j,{backupAfterwards:k})}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}}},{key:"parseFlatElements",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=b.backupAfterwards,d=void 0!==c&&c,e=this.xmlRoot,f=this.currentDivisions;this.offsetInMeasure=0;var g=void 0;a.classes.includes("Voice")&&void 0===(g=a.id)&&(g=this.getRandomId()),this.currentVoiceId=g;var h=!0,i=!1,j=void 0;try{for(var k,l=a[Symbol.iterator]();!(h=(k=l.next()).done);h=!0){var m=k.value;this.parseOneElement(m)}}catch(a){i=!0,j=a}finally{try{!h&&l.return&&l.return()}finally{if(i)throw j}}if(d){var n=Math.round(f*this.offsetInMeasure);if(n>0){var o=this.doc.createElement("backup");this.subElement(o,"duration").innerHTML=n.toString(),e.appendChild(o)}}this.currentVoiceId=void 0}},{key:"parseOneElement",value:function(a){var b=this,c=a.classes;c.includes("GeneralNote")&&(this.offsetInMeasure+=a.duration.quarterLength);var d=!1,e=!0,f=!1,g=void 0;try{for(var h,i=qd[Symbol.iterator]();!(e=(h=i.next()).done);e=!0){var j=L(h.value,2),k=j[0],l=j[1];if(c.includes(k)){this[l](a),d=!0;break}}}catch(a){f=!0,g=a}finally{try{!e&&i.return&&i.return()}finally{if(f)throw g}}var m=!0,n=!1,o=void 0;try{for(var p,q=rd[Symbol.iterator]();!(m=(p=q.next()).done);m=!0){if("break"===function(){var e=L(p.value,2),f=e[0],g=e[1];if(c.includes(f)){var h=function(a){return b[g](a)};return b.wrapObjectInAttributes(a,h),d=!0,"break"}}())break}}catch(a){n=!0,o=a}finally{try{!m&&q.return&&q.return()}finally{if(n)throw o}}d||sd.includes(a.classes[0])||console.warn("skipped object of class "+a.classes[0])}},{key:"noteToXml",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=b.noteIndexInChord,d=void 0===c?0:c,e=b.chordParent,f=0!==d,g=void 0;g=void 0===e?a:e;var h=this.doc.createElement("note");this.setColor(h,a);var i=g.duration;if(f&&this.subElement(h,"chord"),void 0!==a.pitch){var j=this.pitchToXml(a.pitch);h.appendChild(j)}else this.subElement(h,"rest");if(!0!==i.isGrace){var k=this.durationXml(i);h.appendChild(k)}if(void 0!==a.tie){var l=this.tieToXmlTie(a.tie),m=!0,n=!1,o=void 0;try{for(var p,q=l[Symbol.iterator]();!(m=(p=q.next()).done);m=!0){var r=p.value;h.appendChild(r)}}catch(a){n=!0,o=a}finally{try{!m&&q.return&&q.return()}finally{if(n)throw o}}}if(this.setEditorial(h,a),void 0!==this.currentVoiceId){var s=this.subElement(h,"voice"),t=void 0;t="number"==typeof t?this.currentVoiceId+1:this.currentVoiceId,s.innerHTML=t.toString()}this.subElement(h,"type").innerHTML=w(i.type);for(var u=0;u<i.dots;u++)this.subElement(h,"dot");if(void 0!==a.pitch&&void 0!==a.pitch.accidental&&!1!==a.pitch.accidental.displayStatus){var v=this.accidentalToMx(a.pitch.accidental);h.appendChild(v)}if(i.tuplets.length>0){var x=this.tupletToTimeModification(i.tuplets[0]);h.appendChild(x)}var y=void 0;if(f||[void 0,"unspecified"].includes(g.stemDirection)?g===a||[void 0,"unspecified"].includes(a.stemDirection)||(y=a.stemDirection):y=g.stemDirection,void 0!==y){var z=this.subElement(h,"stem"),A=y;"noStem"===A&&(A="none"),z.innerHTML=A}if(!f){var B=!0,C=!1,D=void 0;try{for(var E,F=g.lyrics[Symbol.iterator]();!(B=(E=F.next()).done);B=!0){var G=E.value;if(void 0!==G.text){var H=this.lyricToXml(G);h.appendChild(H)}}}catch(a){C=!0,D=a}finally{try{!B&&F.return&&F.return()}finally{if(C)throw D}}}return this.xmlRoot.appendChild(h),h}},{key:"restToXml",value:function(a){return this.noteToXml(a)}},{key:"chordToXml",value:function(a){var b=[],c=!0,d=!1,e=void 0;try{for(var f,g=Array.from(a).entries()[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=L(f.value,2),i=h[0],j=h[1],k=this.noteToXml(j,{noteIndexInChord:i,chordParent:a});b.push(k)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return b}},{key:"durationXml",value:function(a){var b=this.doc.createElement("duration");return b.innerHTML=Math.round(this.currentDivisions*a.quarterLength).toString(),b}},{key:"pitchToXml",value:function(a){var b=this.doc.createElement("pitch");if(this._setTagTextFromAttribute(a,b,"step"),void 0!==a.accidental){this.subElement(b,"alter").innerHTML=S.numToIntOrFloat(a.accidental.alter).toString()}return this._setTagTextFromAttribute(a,b,"octave","implicitOctave"),b}},{key:"tupletToTimeModification",value:function(a){var b=this.doc.createElement("time-modification");if(this._setTagTextFromAttribute(a,b,"actual-notes","numberNotesActual"),this._setTagTextFromAttribute(a,b,"normal-notes","numberNotesNormal"),void 0!==a.durationNormal){if(this.subElement(b,"normal-type").innerHTML=w(a.durationNormal.type),a.durationNormal.dots>0)for(var c=0;c<a.durationNormal.dots;c++)this.subElement(b,"normal-dot")}return b}},{key:"tieToXmlTie",value:function(a){var b=[],c=a.type;"continue"===a.type&&(c="stop");var d=this.doc.createElement("tie");if(d.setAttribute("type",c),b.push(d),"continue"===a.type){var e=this.doc.createElement("tie");e.setAttribute("type","start"),b.push(e)}return b}},{key:"wrapObjectInAttributes",value:function(a,b){if(0!==this.offsetInMeasure){var c=this.doc.createElement("attributes"),d=b(a);return c.appendChild(d),this.xmlRoot.appendChild(c),c}}},{key:"lyricToXml",value:function(a){var b=this.doc.createElement("lyric");return this._setTagTextFromAttribute(a,b,"syllabic"),this._setTagTextFromAttribute(a,b,"text","text",{forceEmpty:!0}),void 0!==a.identifier&&b.setAttribute("name",a.identifier.toString()),void 0!==a.number?b.setAttribute("number",a.number.toString()):void 0!==a.identifier&&b.setAttribute("number",a.identifier.toString()),b}},{key:"setMxAttributesObjectForStartOfMeasure",value:function(){var a=this.stream,b=this.doc.createElement("attributes"),c=!1;if(this.currentDivisions=td,void 0===this.parent||this.currentDivisions!==this.parent.lastDivisions){this.subElement(b,"divisions").innerHTML=this.currentDivisions.toString(),this.parent.lastDivisions=this.currentDivisions,c=!0}return a.classes.includes("Measure")&&(void 0!==a._keySignature&&(b.appendChild(this.keySignatureToXml(a._keySignature)),c=!0),void 0!==a._timeSignature&&(b.appendChild(this.timeSignatureToXml(a._timeSignature)),c=!0),void 0!==a._clef&&(b.appendChild(this.clefToXml(a._clef)),c=!0)),c&&this.xmlRoot.appendChild(b),b}},{key:"timeSignatureToXml",value:function(a){var b=this.doc.createElement("time");return this.subElement(b,"beats").innerHTML=a.numerator.toString(),this.subElement(b,"beat-type").innerHTML=a.denominator.toString(),b}},{key:"keySignatureToXml",value:function(a){var b=this.doc.createElement("key");return this.seta(a,b,"fifths","sharps"),void 0!==a.mode&&this.seta(a,b,"mode"),b}},{key:"clefToXml",value:function(a){var b=this.doc.createElement("clef"),c=a.sign||"G";return this.subElement(b,"sign").innerHTML=c,this.seta(a,b,"line"),void 0!==a.octaveChange&&0!==a.octaveChange&&this.seta(a,b,"clef-octave-change","octaveChange"),b}},{key:"setMxAttributes",value:function(){var a=this.stream;this.xmlRoot.setAttribute("number",a.measureNumberWithSuffix())}}]),b}(nd),vd=Object.freeze({GeneralObjectExporter:ld,XMLExporterBase:nd,ScoreExporter:od,PartExporter:pd,MeasureExporter:ud}),wd=function(a){function b(){return E(this,b),J(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return I(b,a),b}(O),xd=function a(){E(this,a)},yd=new xd,zd=function(){function a(){E(this,a)}return F(a,[{key:"reset",value:function(){}},{key:"call",value:function(a,b){return!0}}],[{key:"derivationStr",get:function(){return"streamFilter"}}]),a}(),Ad=function(a){function b(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return Array.isArray(a)||(a=[a]),c.target=a,c.numToFind=a.length,c}return I(b,a),F(b,null,[{key:"derivationStr",get:function(){return"is"}}]),F(b,[{key:"reset",value:function(){this.numToFind=this.target.length}},{key:"call",value:function(a,b){return 0===this.numToFind?yd:!!this.target.includes(a)&&(this.numToFind-=1,!0)}}]),b}(zd),Bd=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.numToFind=Number.MAX_SAFE_INTEGER,c}return I(b,a),F(b,null,[{key:"derivationStr",get:function(){return"IsNot"}}]),F(b,[{key:"reset",value:function(){}},{key:"call",value:function(a,c){var d=H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"call",this).call(this,a,c);return d===yd?d:!d}}]),b}(Ad),Cd=function(a){function b(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return Array.isArray(a)||(a=[a]),c.classList=a,c}return I(b,a),F(b,null,[{key:"derivationStr",get:function(){return"getElementsByClass"}}]),F(b,[{key:"call",value:function(a,b){return a.isClassOrSubclass(this.classList)}}]),b}(zd),Dd=function(a){function b(){return E(this,b),J(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return I(b,a),F(b,[{key:"call",value:function(a,c){return!H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"call",this).call(this,a,c)}}],[{key:"derivationStr",get:function(){return"getElementsNotOfClass"}}]),b}(Cd),Ed=function(a){function b(a,c){var d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},e=d.includeEndBoundary,f=void 0===e||e,g=d.mustFinishInSpan,h=void 0!==g&&g,i=d.mustBeginInSpan,j=void 0===i||i,k=d.includeElementsThatEndAtStart,l=void 0===k||k;E(this,b);var m=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return m.offsetStart=a,m.offsetEnd=c,m.includeEndBoundary=f,m.mustFinishInSpan=h,m.mustBeginInSpan=j,m.includeElementsThatEndAtStart=l,m.zeroLengthSearch=!1,void 0===c?(self.offsetEnd=a,m.zeroLengthSearch=!0):c<=a&&(m.zeroLengthSearch=!0),m}return I(b,a),F(b,null,[{key:"derivationStr",get:function(){return"getElementsByOffset"}}]),F(b,[{key:"call",value:function(a,b){return this.isElementOffsetInRange(a,a.offset)}},{key:"isElementOffsetInRange",value:function(a,b){if(b>this.offsetEnd)return!1;var c=a.duration,d=b+c.quarterLength;if(d<this.offsetStart)return!1;var e=!1;if(0===c.quarterLength&&(e=!0),this.zeroLengthSearch&&e)return!0;if(this.mustFinishInSpan){if(d>this.offsetEnd)return!1;if(!this.includeEndBoundary&&b===this.offsetEnd)return!1}if(this.mustBeginInSpan){if(b<this.offsetStart)return!1;if(!this.includeEndBoundary&&b===this.offsetEnd)return!1}else if(!e&&d===this.offsetEnd&&this.zeroLengthSearch)return!1;return!(!this.includeEndBoundary&&b===this.offsetEnd)&&!(!this.includeElementsThatEndAtStart&&d===this.offsetStart)}}]),b}(zd),Fd=Object.freeze({FilterException:wd,StopIterationSingleton:yd,StreamFilter:zd,IsFilter:Ad,IsNotFilter:Bd,ClassFilter:Cd,ClassNotFilter:Dd,OffsetFilter:Ed}),Gd=yd,Hd=function(a){function b(){return E(this,b),J(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return I(b,a),b}(P),Id=function(){function a(b){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=c.filterList,e=void 0===d?[]:d,f=c.restoreActiveSites,g=void 0===f||f,h=c.activeInformation,i=void 0===h?void 0:h,j=c.ignoreSorting,k=void 0!==j&&j;E(this,a),k||b.isSorted||!b.autoSort||b.sort(),this.srcStream=b,this.index=0,this.srcStreamElements=b.elements,this.streamLength=this.srcStreamElements.length,this.iterSection="_elements",this.cleanupOnStop=!1,this.restoreActiveSites=g,this.overrideDerivation=void 0,Array.isArray(e)||(e=[e]),this.filters=e,this._len=void 0,this._matchingElements=void 0,this.sectionIndex=0,void 0===i?(this.activeInformation={},this.updateActiveInformation()):this.activeInformation=i}return F(a,[{key:Symbol.iterator,value:regeneratorRuntime.mark(function a(){var b,c;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:this.reset();case 1:if(!(this.index<this.streamLength)){a.next=22;break}this.index+=1,b=void 0,a.prev=4,b=this.srcStreamElements[this.index-1],a.next=11;break;case 8:return a.prev=8,a.t0=a.catch(4),a.abrupt("continue",1);case 11:if(!1!==(c=this.matchesFilters(b))){a.next=14;break}return a.abrupt("continue",1);case 14:if(c!==Gd){a.next=16;break}return a.abrupt("break",22);case 16:return this.restoreActiveSites&&(b.activeSite=this.srcStream),this.updateActiveInformation(),a.next=20,b;case 20:a.next=1;break;case 22:this.cleanup();case 23:case"end":return a.stop()}},a,this,[[4,8]])})},{key:"get",value:function(a){var b=this.matchingElements();return a<0&&(a=b.length+a),b[a]}},{key:"updateActiveInformation",value:function(){var a=this.activeInformation;a.stream=this.srcStream,a.index=this.index-1,a.iterSection=this.iterSection,a.sectionIndex=this.sectionIndex}},{key:"reset",value:function(){this.index=0,this.iterSection="_elements",this.updateActiveInformation();var a=!0,b=!1,c=void 0;try{for(var d,e=this.filters[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){var f=d.value;void 0!==f.reset&&f.reset()}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}}},{key:"resetCaches",value:function(){this._len=void 0,this._matchingElements=void 0}},{key:"cleanup",value:function(){this.cleanupOnStop&&(this.reset(),this.srcStream=void 0,this.srcStreamElements=[])}},{key:"matchingElements",value:function(){if(void 0!==this._matchingElements)return this._matchingElements;var a=this.index,b=this.restoreActiveSites;this.restoreActiveSites=!0;var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=this[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value;c.push(i)}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}return this.reset(),this.index=a,this.restoreActiveSites=b,this._matchingElements=c,c}},{key:"matchesFilters",value:function(a){var b=!0,c=!1,d=void 0;try{for(var e,f=this.filters[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value,h=g.call(a,this);if(!1===h)return!1;if(h===Gd)return h}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}return!0}},{key:"stream",value:function(){var a=this.srcStream,b=a.clone(!1);b.elements=[];var c=this.matchingElements(),d=!0,e=!1,f=void 0;try{for(var g,h=c[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value,j=a.elementOffset(i,{stringReturns:!0});b.insert(j,i)}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}return b}},{key:"addFilter",value:function(a){var b=!0,c=!1,d=void 0;try{for(var e,f=this.filters[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){if(a===e.value)return this}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}return this.filters.push(a),this.resetCaches(),this}},{key:"removeFilter",value:function(a){var b=this.filters.indexOf(a);return-1!==b&&this.filters.splice(b,1),this.resetCaches(),this}},{key:"getElementsByClass",value:function(a){return this.addFilter(new Cd(a))}},{key:"getElementsNotOfClass",value:function(a){return this.addFilter(new Dd(a))}},{key:"getElementsByOffset",value:function(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];return this.addFilter(new(Function.prototype.bind.apply(Ed,[null].concat(b))))}},{key:"length",get:function(){return void 0!==this._len?this._len:(this._len=this.matchingElements().length,this.reset(),this._len)}},{key:"activeElementList",get:function(){return this.activeInformation.stream[this.activeInformation.iterSection]}},{key:"notes",get:function(){return this.addFilter(new Cd("NotRest"))}},{key:"notesAndRests",get:function(){return this.addFilter(new Cd("GeneralNote"))}},{key:"parts",get:function(){return this.addFilter(new Cd("Part"))}},{key:"spanners",get:function(){return this.addFilter(new Cd("Spanner"))}},{key:"voices",get:function(){return this.addFilter(new Cd("Voice"))}}]),a}(),Jd=function(a){function b(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};E(this,b);var d=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c));return d.nextToYield=[],d.nextOffsetToYield=void 0,d}return I(b,a),F(b,[{key:Symbol.iterator,value:regeneratorRuntime.mark(function a(){var b,c,d,e,f,g,h,i,j,k,l,m,n;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:this.reset(),this.sort();case 2:if(!(this.index<this.streamLength)){a.next=66;break}this.index+=1,b=void 0,a.prev=5,b=this.srcStreamElements[this.index-1],a.next=12;break;case 9:return a.prev=9,a.t0=a.catch(5),a.abrupt("continue",2);case 12:if(!1!==(c=this.matchesFilters(b))){a.next=15;break}return a.abrupt("continue",2);case 15:if(c!==Gd){a.next=17;break}return a.abrupt("break",66);case 17:d=[b],e=this.elementOffset(b),f=this.index;case 20:if(!(f<this.streamLength)){a.next=41;break}g=void 0,a.prev=22,g=this.srcStreamElements[this.index-1],a.next=29;break;case 26:return a.prev=26,a.t1=a.catch(22),a.abrupt("continue",38);case 29:if((h=this.elementOffset(g))===e){a.next=34;break}return this.nextToYield=[g],this.nextOffsetToYield=h,a.abrupt("break",41);case 34:if(this.matchesFilters(g)){a.next=36;break}return a.abrupt("continue",38);case 36:d.push(b),this.index=f;case 38:f++,a.next=20;break;case 41:if(!this.restoreActiveSites){a.next=61;break}for(i=!0,j=!1,k=void 0,a.prev=45,l=d[Symbol.iterator]();!(i=(m=l.next()).done);i=!0)n=m.value,n.activeSite=this.srcStream;a.next=53;break;case 49:a.prev=49,a.t2=a.catch(45),j=!0,k=a.t2;case 53:a.prev=53,a.prev=54,!i&&l.return&&l.return();case 56:if(a.prev=56,!j){a.next=59;break}throw k;case 59:return a.finish(56);case 60:return a.finish(53);case 61:return this.updateActiveInformation(),a.next=64,d;case 64:a.next=2;break;case 66:this.cleanup();case 67:case"end":return a.stop()}},a,this,[[5,9],[22,26],[45,49,53,61],[54,,56,60]])})},{key:"reset",value:function(){H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"reset",this).call(this),this.nextToYield=[],this.nextOffsetToYield=void 0}}]),b}(Id),Kd=function(a){function b(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=c.filterList,e=c.restoreActiveSites,f=c.activeInformation,g=c.streamsOnly,h=void 0!==g&&g,i=c.includeSelf,j=void 0!==i&&i,k=c.ignoreSorting;E(this,b);var l=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,{filterList:d,restoreActiveSites:e,activeInformation:f,ignoreSorting:k}));return l.returnSelf=j,l.includeSelf=j,l.ignoreSorting=k,l.iteratorStartOffsetInHierarchy=0,h&&l.filters.push(new Cd("Stream")),l.childRecursiveIterator=void 0,l}return I(b,a),F(b,[{key:"reset",value:function(){this.returnSelf=this.includeSelf,this.childRecursiveIterator=void 0,this.activeInformation.lastYielded=void 0,H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"reset",this).call(this)}},{key:Symbol.iterator,value:regeneratorRuntime.mark(function a(){var c,d,e,f,g,h,i,j;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(this.reset(),!this.returnSelf||!this.matchesFilters(this.srcStream)){a.next=10;break}return this.activeInformation.stream=void 0,this.activeInformation.index=-1,this.activeInformation.lastYielded=this.srcStream,this.returnSelf=!1,a.next=8,this.srcStream;case 8:a.next=11;break;case 10:this.returnSelf&&(this.returnSelf=!1);case 11:if(!(this.index<this.streamLength)){a.next=55;break}if(this.index+=1,void 0!==(c=this.srcStreamElements[this.index-1])){a.next=16;break}return a.abrupt("continue",11);case 16:if(!this.matchesFilters(c)){a.next=22;break}return this.restoreActiveSites&&(c.activeSite=this.srcStream),this.updateActiveInformation(),this.activeInformation.lastYielded=c,a.next=22,c;case 22:if(!c.isStream){a.next=53;break}this.childRecursiveIterator=new b(c,{restoreActiveSites:this.restoreActiveSites,filterList:this.filters,activeInformation:this.activeInformation,includeSelf:!1,ignoreSorting:this.ignoreSorting}),d=this.iteratorStartOffsetInHierarchy+this.srcStream.elementOffset(c),this.childRecursiveIterator.iteratorStartOffsetInHierarchy=d,e=!0,f=!1,g=void 0,a.prev=29,h=this.childRecursiveIterator[Symbol.iterator]();case 31:if(e=(i=h.next()).done){a.next=38;break}return j=i.value,a.next=35,j;case 35:e=!0,a.next=31;break;case 38:a.next=44;break;case 40:a.prev=40,a.t0=a.catch(29),f=!0,g=a.t0;case 44:a.prev=44,a.prev=45,!e&&h.return&&h.return();case 47:if(a.prev=47,!f){a.next=50;break}throw g;case 50:return a.finish(47);case 51:return a.finish(44);case 52:this.childRecursiveIterator=void 0;case 53:a.next=11;break;case 55:this.activeInformation.lastYielded=void 0,this.cleanup();case 57:case"end":return a.stop()}},a,this,[[29,40,44,52],[45,,47,51]])})},{key:"matchingElements",value:function(){var a=this.childRecursiveIterator,c=H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"matchingElements",this).call(this);return this.childRecursiveIterator=a,c}},{key:"iteratorStack",value:function(){for(var a=[this],b=this;void 0!==b.childRecursiveIterator;)b=b.childRecursiveIterator,a.push(b);return a}},{key:"streamStack",value:function(){return this.iteratorStack().map(function(a){return a.srcStream})}},{key:"currentHierarchyOffset",value:function(){var a=this.activeInformation.lastYielded;if(void 0!==a){var b=this.iteratorStack(),c=b[b.length-1],d=c.srcStream,e=c.iteratorStartOffsetInHierarchy;return a===d?e:e+d.elementOffset(a)}}}]),b}(Id),Ld=Object.freeze({StreamIteratorException:Hd,StreamIterator:Id,OffsetIterator:Jd,RecursiveIterator:Kd}),Md={filters:Fd,iterator:Ld},Nd=function(a){function b(){return E(this,b),J(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return I(b,a),b}(O);Md.StreamException=Nd;var Od=function(a){function d(){E(this,d);var a=J(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));return a.isStream=!0,a.isMeasure=!1,a.classSortOrder=-20,a.recursionType="elementsFirst",a._duration=void 0,a._elements=[],a._offsetDict=new WeakMap,a.autoSort=!0,a.isSorted=!0,a.isFlat=!0,a._clef=void 0,a.displayClef=void 0,a._keySignature=void 0,a._timeSignature=void 0,a._instrument=void 0,a._autoBeam=void 0,a.activeVFStave=void 0,a.activeVFRenderer=void 0,a.renderOptions=new dd.RenderOptions,a._tempo=void 0,a.staffLines=5,a._stopPlaying=!1,a._allowMultipleSimultaneousPlays=!0,a.changedCallbackFunction=void 0,a.DOMChangerFunction=function(b){var c=b.currentTarget,d=a.findNoteForClick(c,b),e=L(d,2),f=e[0],g=e[1];return void 0===g?void(R&&console.log("No note found")):a.noteChanged(f,g,c)},a}return I(d,a),F(d,[{key:Symbol.iterator,value:regeneratorRuntime.mark(function a(){var b;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:this.autoSort&&!this.isSorted&&this.sort(),b=0;case 2:if(!(b<this.length)){a.next=8;break}return a.next=5,this.get(b);case 5:b++,a.next=2;break;case 8:case"end":return a.stop()}},a,this)})},{key:"forEach",value:function(a,b){void 0!==b&&(a=a.bind(b));var c=0,d=!0,e=!1,f=void 0;try{for(var g,h=this[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){a(g.value,c,this),c+=1}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}}},{key:"_getFlatOrSemiFlat",value:function(a){var b=this.clone(!1);if(!this.isFlat){b.elements=[];var c=!0,d=!1,e=void 0;try{for(var f,g=this[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;if(h.isStream){a&&b.append(h);var i=this.elementOffset(h),j=h._getFlatOrSemiFlat(a),k=!0,l=!1,m=void 0;try{for(var n,o=j[Symbol.iterator]();!(k=(n=o.next()).done);k=!0){var p=n.value,q=j.elementOffset(p);b.insert(q+i,p)}}catch(a){l=!0,m=a}finally{try{!k&&o.return&&o.return()}finally{if(l)throw m}}}else b.insert(this.elementOffset(h),h)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}}return a?this.coreElementsChanged():(b.isFlat=!0,this.coreElementsChanged({updateIsFlat:!1})),b}},{key:"_specialContext",value:function(a){var b="_"+a;if(void 0!==this[b])return this[b];var c=!0,d=!1,e=void 0;try{for(var f,g=this.sites.yieldSites()[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;if(void 0!==h){var i=h._firstElementContext("attr")||h._specialContext("attr");if(void 0!==i)return i}}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}}},{key:"_firstElementContext",value:function(a){var b=this.getElementsByOffset(0).getElementsByClass(a.charAt(0).toUpperCase()+a.slice(1));return b.length?b.get(0):void 0}},{key:"getSpecialContext",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]&&arguments[1],c=this._firstElementContext(a);if(void 0!==c)return c;var d=this._specialContext(a);return void 0!==d?(b&&console.warn("Calling special context "+a+"!"),d):void 0}},{key:"clear",value:function(){this._elements=[],this._offsetDict=new WeakMap,this.isFlat=!0,this.isSorted=!0}},{key:"clone",value:function(){var a=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],b=Object.create(this.constructor.prototype);for(var c in this)if(!1!=={}.hasOwnProperty.call(this,c))if("_activeSite"===c)b[c]=this[c];else if("renderOptions"===c)b[c]=S.merge({},this[c]);else if(!0!==a&&"_elements"===c)b[c]=this[c].slice();else if(!0!==a&&"_offsetDict"===c){b._offsetDict=new WeakMap;var d=!0,e=!1,f=void 0;try{for(var g,h=this.elements[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value;b._offsetDict.set(i,this._offsetDict.get(i))}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}}else if(!a||"_elements"!==c&&"_offsetDict"!==c)"activeVexflowNote"===c||"storedVexflowstave"===c||(c in this._cloneCallbacks?!0===this._cloneCallbacks[c]?b[c]=this[c]:!1===this._cloneCallbacks[c]?b[c]=void 0:this._cloneCallbacks[c](c,b,this):void 0!==Object.getOwnPropertyDescriptor(this,c).get||void 0!==Object.getOwnPropertyDescriptor(this,c).set||"function"==typeof this[c]||(null!==this[c]&&void 0!==this[c]&&!0===this[c].isMusic21Object?b[c]=this[c].clone(a):b[c]=this[c]));else if("_elements"===c){b.clear();for(var j=0;j<this._elements.length;j++){var k=this._elements[j],l=k.clone(a);b._elements[j]=l,b._offsetDict.set(l,this._offsetDict.get(k)),l.activeSite=b}}return b.coreElementsChanged(),b}},{key:"coreElementsChanged",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b=a.updateIsFlat,c=void 0===b||b,d=a.clearIsSorted,e=void 0===d||d;a.memo,a.keepIndex;if(e&&(this.isSorted=!1),c){this.isFlat=!0;var f=!0,g=!1,h=void 0;try{for(var i,j=this._elements[Symbol.iterator]();!(f=(i=j.next()).done);f=!0){if(i.value.isStream){this.isFlat=!1;break}}}catch(a){g=!0,h=a}finally{try{!f&&j.return&&j.return()}finally{if(g)throw h}}}}},{key:"recurse",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b=a.streamsOnly,c=void 0!==b&&b,d=a.restoreActiveSites,e=void 0===d||d,f=a.classFilter,g=void 0===f?void 0:f,h=a.skipSelf,i=void 0===h||h,j=!i,k=new Kd(this,{streamsOnly:c,restoreActiveSites:e,includeSelf:j});return void 0!==g&&k.addFilter(new Cd(g)),k}},{key:"append",value:function(a){if(Array.isArray(a)){var b=!0,c=!1,d=void 0;try{for(var e,f=a[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;this.append(g)}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}return this}var h=a;try{void 0!==h.isClassOrSubclass&&h.isClassOrSubclass("NotRest");var i=this.highestTime;this._elements.push(h),this.setElementOffset(h,i),h.offset=i,h.sites.add(this),h.activeSite=this}catch(a){console.error("Cannot append element ",h," to stream ",this," : ",a)}return this.coreElementsChanged({clearIsSorted:!1}),this}},{key:"sort",value:function(){var a=this;return this.isSorted?this:(this._elements.sort(function(b,c){return a._offsetDict.get(b)-a._offsetDict.get(c)||b.priority-c.priority||b.classSortOrder-c.classSortOrder}),this.isSorted=!0,this)}},{key:"insert",value:function(a,b){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},d=c.ignoreSort,e=void 0!==d&&d,f=c.setActiveSite,g=void 0===f||f;if(void 0===b)throw new Nd("Cannot insert without an element.");try{e||a<=this.highestTime&&(this.isSorted=!1),this._elements.push(b),this.setElementOffset(b,a),b.sites.add(this),g&&(b.activeSite=this),this.coreElementsChanged({clearIsSorted:!1})}catch(a){console.error("Cannot insert element ",b," to stream ",this," : ",a)}return this}},{key:"insertAndShift",value:function(a,b){var c=void 0;void 0===b?(c=a,a=c.offset):c=b;for(var d=c.duration.quarterLength,e=!1,f=0;f<this.length;f++){var g=this._elements[f],h=this.elementOffset(g);!e&&h>=a&&(e=!0),e&&this.setElementOffset(g,h+d)}return this.insert(a,c),this}},{key:"index",value:function(a){!this.isSorted&&this.autoSort&&this.sort();var b=this._elements.indexOf(a);if(-1===b)throw new Nd("cannot find object ("+a+") in Stream");return b}},{key:"pop",value:function(){if(!this.isSorted&&this.autoSort&&this.sort(),this.length>0){var a=this.get(-1);return this._elements.pop(),this._offsetDict.delete(a),a.sites.remove(this),this.coreElementsChanged({clearIsSorted:!1}),a}}},{key:"remove",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=b.shiftOffsets,d=void 0!==c&&c,e=b.recurse,f=void 0!==e&&e;if(!0===d)throw new Nd("sorry cannot shiftOffsets yet");if(!0===f)throw new Nd("sorry cannot recurse yet");var g=void 0;g=Array.isArray(a)?a:[a];var h=-1,i=!0,j=!1,k=void 0;try{for(var l,m=g[Symbol.iterator]();!(i=(l=m.next()).done);i=!0){var n=l.value;h+=1;var o=void 0;try{o=this.index(n)}catch(a){if(a instanceof Nd)continue;throw a}this._elements.splice(o,1),this._offsetDict.delete(n),n.activeSite=void 0,n.sites.remove(this)}}catch(a){j=!0,k=a}finally{try{!i&&m.return&&m.return()}finally{if(j)throw k}}this.coreElementsChanged({clearIsSorted:!1})}},{key:"replace",value:function(a,b){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};c.recurse,c.allDerivated;try{this.index(a)}catch(a){if(a instanceof Nd)return;throw a}var d=this.elementOffset(a);this.remove(a),this.insert(d,b),this.coreElementsChanged({clearIsSorted:!1})}},{key:"get",value:function(a){this.isSorted||this.sort();var b=void 0;return void 0===a||isNaN(a)?void 0:Math.abs(a)>this._elements.length?void 0:a===this._elements.length?void 0:a<0?(b=this._elements[this._elements.length+a],b.activeSite=this,b):(b=this._elements[a],b.activeSite=this,b)}},{key:"set",value:function(a,b){var c=this.get(a);if(void 0===c)throw new Nd("Cannot set element at index "+a+".");return this.replace(c,b),this}},{key:"setElementOffset",value:function(a,b){var c=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!this._elements.includes(a)){if(c)return void this.insert(b,a);throw new Nd("Cannot set the offset for elemenet "+a.toString()+", not in Stream")}this._offsetDict.set(a,b),a.activeSite=this}},{key:"elementOffset",value:function(a){arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._offsetDict.has(a))return this._offsetDict.get(a);throw new Nd("An entry for this object "+a.toString()+" is not stored in this Stream.")}},{key:"makeMeasures",value:function(a){var b={meterStream:void 0,refStreamOrTimeRange:void 0,searchContext:!1,innerBarline:void 0,finalBarline:"final",bestClef:!1,inPlace:!1};S.merge(b,a);var c=void 0;c=this.hasVoices()?this.getElementsByClass("Voice").length:0;var d=this.getElementsByClass("TimeSignature");0===d.length&&d.append(this.timeSignature);for(var e=this.getSpecialContext("clef")||this.getContextByClass("Clef"),f=this.offsetMap(),g=0,h=0;h<f.length;h++)f[h].endTime>g&&(g=f[h].endTime);for(var i=new this.constructor,j=0,k=0,l=void 0,m=void 0,n=void 0;0===k||j<g;){m=new Md.Measure,m.number=k+1;var o=this.timeSignature;if(void 0===o)break;var p=o.barDuration.quarterLength;if(0===p)break;m.clef=e,m.timeSignature=o.clone();for(var q=0;q<c;q++){var r=new Md.Voice;r.id=q,m.insert(0,r)}i.insert(j,m),j+=p,k+=1}for(var s=0;s<f.length;s++){var t=f[s],u=t.element,v=t.offset,w=t.voiceIndex;l=void 0;for(var x=0;x<i.length;x++){m=i.get(x);var y=m.getSpecialContext("timeSignature");void 0!==y&&(l=y),n=m.getOffsetBySite(i);var z=n+l.barDuration.quarterLength;if(v>=n&&v<z)break}var A=v-n;if(m.clef!==u&&(0!==A||!u.isClassOrSubclass("TimeSignature"))){var B=m
;void 0!==w&&(B=m.getElementsByClass("Voice").get(w)),B.insert(A,u)}}if(!0!==b.inPlace)return i;this.elements=[];var C=!0,D=!1,E=void 0;try{for(var F,G=i[Symbol.iterator]();!(C=(F=G.next()).done);C=!0){var H=F.value;this.insert(H.offset,H)}}catch(a){D=!0,E=a}finally{try{!C&&G.return&&G.return()}finally{if(D)throw E}}return this}},{key:"containerInHierarchy",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=b.setActiveSite,d=void 0===c||c,e=a.sites,f=!0,g=!1,h=void 0;try{for(var i,j=this.recurse({skipSelf:!1,streamOnly:!0,restoreActiveSites:!1})[Symbol.iterator]();!(f=(i=j.next()).done);f=!0){var k=i.value;if(e.includes(k))return d&&(a.activeSite=k),k}}catch(a){g=!0,h=a}finally{try{!f&&j.return&&j.return()}finally{if(g)throw h}}}},{key:"chordify",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b=(a.addTies,a.addPartIdAsGroup,a.removeRedundantPitches,a.toSoundingPitch,this),c=void 0;return c=this.hasPartLikeStreams()?b.getElementsByClass("Stream").get(0):b,c.template({fillWithRests:!1,removeClasses:["GeneralNote"],retainVoices:!1})}},{key:"template",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b=a.fillWithRests,c=void 0===b||b,d=a.removeClasses,e=void 0===d?[]:d,f=a.retainVoices,g=void 0===f||f,h=this.cloneEmpty("template"),i={offset:void 0,endTime:void 0},j=!0,k=!1,l=void 0;try{for(var m,n=Md[Symbol.iterator]();!(j=(m=n.next()).done);j=!0){var o=m.value;if(o.isStream&&(g||o.classes.includes("Voice"))){!function(){if(c&&void 0!==i.offset){var a=i.endTime-i.offset,b=new Ma.Rest;b.duration.quarterLength=a,h.insert(i.offset,b),i.offset=void 0,i.endTime=void 0}}();var p=o.template({fillWithRests:c,removeClasses:e,retainVoices:g});h.insert(o.offset,p)}}}catch(a){k=!0,l=a}finally{try{!j&&n.return&&n.return()}finally{if(k)throw l}}}},{key:"cloneEmpty",value:function(a){var b=this.constructor();return b.mergeAttributes(this),b}},{key:"mergeAttributes",value:function(a){H(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"mergeAttributes",this).call(this,a);for(var b=["autoSort","isSorted","definesExplicitSystemBreaks","definesEExplicitPageeBreaks","_atSoundingPitch","_mutable"],c=0;c<b.length;c++){var e=b[c];Object.prototype.hasOwnProperty.call(a,e)&&(this[e]=a[e])}}},{key:"makeNotation",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b=a.inPlace,c=void 0===b||b,d=void 0;return d=c?this:this.clone(!0),this.makeAccidentals(),d}},{key:"makeBeams",value:function(a){var b={inPlace:!1};S.merge(b,a);var c=this;b.inPlace||(c=this.clone(!0));var d=void 0;if(this.classes.includes("Measure"))d=[c];else{d=[];var e=!0,f=!1,g=void 0;try{for(var h,i=c.getElementsByClass("Measure")[Symbol.iterator]();!(e=(h=i.next()).done);e=!0){var j=h.value;d.push(j)}}catch(a){f=!0,g=a}finally{try{!e&&i.return&&i.return()}finally{if(f)throw g}}}var k=void 0,l=!0,m=!1,n=void 0;try{for(var o,p=d[Symbol.iterator]();!(l=(o=p.next()).done);l=!0){var q=o.value;if(void 0!==q.timeSignature&&(k=q.timeSignature),void 0===k)throw new Nd("Need a Time Signature to process beams");if(!(q.length<=1)){var r=q.notesAndRests,s=[],t=!0,u=!1,v=void 0;try{for(var w,x=r[Symbol.iterator]();!(t=(w=x.next()).done);t=!0){var y=w.value;s.push(y.duration)}}catch(a){u=!0,v=a}finally{try{!t&&x.return&&x.return()}finally{if(u)throw v}}var z=s.map(function(a){return a.quarterLength}).reduce(function(a,b){return a+b}),A=k.barDuration.quarterLength;if(!(z>A)){var B=0;0!==q.paddingLeft&&void 0!==q.paddingLeft?B=q.paddingLeft:r.highestTime<A&&(B=A-r.highestTime);for(var C=k.getBeams(r,{measureStartOffset:B}),D=0;D<r.length;D++){var E=r.get(D),F=C[D];E.beams=void 0!==F?F:new Ga.Beams}}}}}catch(a){m=!0,n=a}finally{try{!l&&p.return&&p.return()}finally{if(m)throw n}}return c}},{key:"hasPartLikeStreams",value:function(){var a=!0,b=!1,c=void 0;try{for(var d,e=this[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){if(d.value.classes.includes("Part"))return!0}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}return!1}},{key:"hasLyrics",value:function(){var a=!0,b=!1,c=void 0;try{for(var d,e=this[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){if(void 0!==d.value.lyric)return!0}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}return!1}},{key:"offsetMap",value:function(){var a=[],b=[];this.hasVoices()?c.each(this.getElementsByClass("Voice"),function(a,c){b.push([c.flat,a])}):b=[[this,void 0]];for(var d=0;d<b.length;d++)for(var e=b[d][0],f=b[d][1],g=0;g<e.length;g++){var h=e.get(g),i=h.duration.quarterLength,j=e.elementOffset(h),k=j+i,l=new Md.OffsetMap(h,j,k,f);a.push(l)}return a}},{key:"getElementsByClass",value:function(a){return this.iter.getElementsByClass(a)}},{key:"getElementsNotOfClass",value:function(a){return this.iter.getElementsNotOfClass(a)}},{key:"getElementsByOffset",value:function(a,b){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},d=c.includeEndBoundary,e=void 0===d||d,f=c.mustFinishInSpan,g=void 0!==f&&f,h=c.mustBeginInSpan,i=void 0===h||h,j=c.includeElementsThatEndAtStart,k=void 0===j||j,l=c.classList,m=void 0===l?void 0:l,n=void 0;return n=void 0!==m?this.iter.getElementsByClass(m):this.iter,n.getElementsByOffset(a,b,{includeEndBoundary:e,mustFinishInSpan:g,mustBeginInSpan:i,includeElementsThatEndAtStart:k}),n}},{key:"playingWhenAttacked",value:function(a,b){var c=void 0;c=void 0!==b?a.getOffsetBySite(b):a.offset;var d=this.getElementsByOffset(c,c,{mustBeginInSpan:!1});if(0!==d.length){if(1===d.length)return d.get(0);var e=!0,f=!1,g=void 0;try{for(var h,i=d[Symbol.iterator]();!(e=(h=i.next()).done);e=!0){var j=h.value;if(a.constructor===j.constructor)return j}}catch(a){f=!0,g=a}finally{try{!e&&i.return&&i.return()}finally{if(f)throw g}}return d.get(0)}}},{key:"makeAccidentals",value:function(){var a={},b=["C","D","E","F","G","A","B"],d=this.keySignature||this.getContextByClass("KeySignature"),e=!0,f=!1,g=void 0;try{for(var h,i=b[Symbol.iterator]();!(e=(h=i.next()).done);e=!0){var j=h.value,k=0;if(void 0!==d){var l=d.accidentalByStep(j);void 0!==l&&(k=l.alter)}a[j]=k}}catch(a){f=!0,g=a}finally{try{!e&&i.return&&i.return()}finally{if(f)throw g}}for(var m=[],n=0;n<10;n++){var o=c.extend({},a);m.push(o)}var p=c.extend({},a),q=!0,r=!1,s=void 0;try{for(var t,u=this[Symbol.iterator]();!(q=(t=u.next()).done);q=!0){var v=t.value;if(void 0!==v.pitch){var w=v.pitch,x=m[w.octave];this._makeAccidentalForOnePitch(w,x,p)}else if(void 0!==v._notes){var y=!0,z=!1,A=void 0;try{for(var B,C=v._notes[Symbol.iterator]();!(y=(B=C.next()).done);y=!0){var D=B.value,E=D.pitch,F=m[E.octave];this._makeAccidentalForOnePitch(E,F,p)}}catch(a){z=!0,A=a}finally{try{!y&&C.return&&C.return()}finally{if(z)throw A}}}}}catch(a){r=!0,s=a}finally{try{!q&&u.return&&u.return()}finally{if(r)throw s}}return this}},{key:"_makeAccidentalForOnePitch",value:function(a,b,c){void 0===b&&(b={});var d=void 0;return d=void 0===a.accidental?0:a.accidental.alter,b[a.step]!==d||c[a.step]!==d?(void 0===a.accidental&&(a.accidental=new Ja.Accidental("natural")),a.accidental.displayStatus=!0):b[a.step]===d&&c[a.step]===d&&void 0!==a.accidental&&(a.accidental.displayStatus=!1),b[a.step]=d,c[a.step]=d,a}},{key:"setSubstreamRenderOptions",value:function(){return this}},{key:"resetRenderOptions",value:function(a,b){var c=this.renderOptions.events;if(this.renderOptions=new dd.RenderOptions,b&&(this.renderOptions.events=c),a){var d=!0,e=!1,f=void 0;try{for(var g,h=this[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value;i.isClassOrSubclass("Stream")&&i.resetRenderOptions(a,b)}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}}return this}},{key:"renderVexflowOnCanvas",value:function(a){return console.warn("renderVexflowOnCanvas is deprecated; call renderVexflow instead"),this.renderVexflow(a)}},{key:"write",value:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return y(this)}},{key:"renderVexflow",value:function(a){a.jquery&&(a=a[0]);var b=document.body.contains(a);b||document.body.appendChild(a);var c=a.tagName.toLowerCase();if(!0===this.autoBeam)try{this.makeBeams({inPlace:!0})}catch(a){if(!a.toString().includes("Time Signature"))throw a}var d=new gd.Renderer(this,a);return"canvas"===c?d.rendererType="canvas":"svg"===c&&(d.rendererType="svg"),d.render(),this.setRenderInteraction(a),this.activeVFRenderer=d,b||document.body.removeChild(a),d}},{key:"estimateStreamHeight",value:function(a){var b=this.renderOptions.naiveHeight,c=this.systemPadding;void 0===c&&(c=0);var d=void 0;if(this.isClassOrSubclass("Score")){var e=this.parts.length;d=this.numSystems(),(void 0===d||a)&&(d=1);var f=d*b*e+(d-1)*c;return d>1&&(f+=c/2),f}return this.isClassOrSubclass("Part")?(d=1,a||(d=this.numSystems()),R&&console.log("estimateStreamHeight for Part: numSystems ["+d+"] * staffHeight ["+b+"] + (numSystems ["+d+"] - 1) * systemPadding ["+c+"]."),d*b+(d-1)*c):b}},{key:"estimateStaffLength",value:function(){var a=void 0,b=void 0;if(void 0!==this.renderOptions.overriddenWidth)return this.renderOptions.overriddenWidth;if(this.hasVoices()){var c=0,d=!0,e=!1,f=void 0;try{for(var g,h=this[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value;if(i.isClassOrSubclass("Stream")){var j=i.estimateStaffLength()+i.renderOptions.staffPadding;j>c&&(c=j)}}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}return c}if(this.isFlat){var k=this.renderOptions;return b=30*this.notesAndRests.length,b+=k.displayClef?30:0,b+=k.displayKeySignature&&this.getSpecialContext("keySignature")?this.getSpecialContext("keySignature").width:0,b+=k.displayTimeSignature?30:0}for(b=0,a=0;a<this.length;a++){var l=this.get(a);if(l.isClassOrSubclass("Stream")&&(b+=l.estimateStaffLength()+l.renderOptions.staffPadding,0!==a&&!0===l.renderOptions.startNewSystem))break}return b}},{key:"playStream",value:function(a){var b={instrument:this.instrument,tempo:this.tempo,done:void 0,startNote:void 0};S.merge(b,a);var c=b.startNote,d=0;void 0!==c&&(d=c);var e=this.flat.elements,f=e.length-1;this._stopPlaying=!1;var g=this;return function a(b,c){if(d<=f&&!g._stopPlaying){var e=b[d],h=void 0,i=void 0;d<f?(h=b[d+1],i=h.offset-e.offset):i=e.duration.quarterLength;var j=1e3*i*60/c.tempo;R&&console.log("playing: ",e,i,j,c.tempo),void 0!==e.playMidi&&e.playMidi(c.tempo,h,c),d+=1,setTimeout(function(){a(b,c)},j)}else c&&c.done&&c.done.call()}(e,b),this}},{key:"stopPlayStream",value:function(){this._stopPlaying=!0;for(var a=0;a<127;a++)b.noteOff(0,a,0);return this}},{key:"createNewCanvas",value:function(a,b){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"svg";return console.warn("createNewCanvas is deprecated, use createNewDOM instead"),this.createNewDOM(a,b,c)}},{key:"createNewDOM",value:function(a,b){var d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"svg";this.isFlat||this.setSubstreamRenderOptions();var e="div";"canvas"===d&&(e="canvas");var f=c("<"+e+"/>");if(f.addClass("streamHolding"),f.css("display","inline-block"),void 0!==a)"string"==typeof a&&(a=S.stripPx(a)),f.attr("width",a);else{var g=this.estimateStaffLength()+this.renderOptions.staffPadding;f.attr("width",g)}if(void 0!==b)f.attr("height",b);else{var h=void 0;h=void 0===this.renderOptions.height?this.estimateStreamHeight():this.renderOptions.height,f.attr("height",h*this.renderOptions.scaleFactor.y)}return f}},{key:"createPlayableCanvas",value:function(a,b){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"svg";return console.warn("createPlayableCanvas is deprecated, use createPlayableDOM instead"),this.createPlayableDOM(a,b,c)}},{key:"createPlayableDOM",value:function(a,b){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"svg";return this.renderOptions.events.click="play",this.createDOM(a,b,c)}},{key:"createCanvas",value:function(a,b){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"svg";return console.warn("createCanvas is deprecated, use createDOM"),this.createDOM(a,b,c)}},{key:"createDOM",value:function(a,b){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"svg",d=this.createNewDOM(a,b,c);return this.renderVexflow(d),d}},{key:"appendNewCanvas",value:function(a,b,c){var d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"svg";return console.warn("appendNewCanvas is deprecated, use appendNewDOM instead"),this.appendNewDOM(a,b,c,d)}},{key:"appendNewDOM",value:function(a,b,d){var e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"svg";void 0===a&&(a=document.body);var f=a;void 0===a.jquery&&(f=c(a));var g=this.createDOM(b,d,e);return f.append(g),g[0]}},{key:"replaceCanvas",value:function(a,b){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"svg";return console.warn("replaceCanvas is deprecated, use replaceDOM instead"),this.replaceDOM(a,b,c)}},{key:"replaceDOM",value:function(a,b){var d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"svg";void 0===a&&(a=document.body);var e=void 0;e=void 0===a.jquery?c(a):a;var f=void 0;if(f=e.hasClass("streamHolding")?e:e.find(".streamHolding"),0===f.length)throw new O("No svg defined for replaceDOM!");f.length>1&&(f=c(f[f.length-1]));var g=void 0;if(b){var h=f.width()||parseInt(f.attr("width")),i=f.attr("height");g=this.createDOM(h,i,d)}else g=this.createDOM(void 0,void 0,d);return f.replaceWith(g),g}},{key:"setRenderInteraction",value:function(a){var b=this,d=a;if(void 0===a)return this;void 0===a.jquery&&(d=c(a));var e=function(){b.playStream()};return c.each(this.renderOptions.events,c.proxy(function(a,b){d.off(a),"string"==typeof b&&"play"===b?d.on(a,e):"string"==typeof b&&"resize"===a&&"reflow"===b?this.windowReflowStart(d):void 0!==b&&d.on(a,b)},this)),this}},{key:"recursiveGetStoredVexflowStave",value:function(){var a=this.storedVexflowStave;if(void 0===a){if(this.isFlat)return;return this.getElementsByClass("Stream").get(0).recursiveGetStoredVexflowStave()}return a}},{key:"getUnscaledXYforCanvas",value:function(a,b){return console.warn("getUnscaledXYforCanvas is deprecated, use getUnscaledXYforDOM instead"),this.getUnscaledXYforDOM(a,b)}},{key:"getUnscaledXYforDOM",value:function(a,b){var d=null;d=void 0===a?{left:0,top:0}:c(a).offset();var e=void 0,f=void 0;return void 0!==b.pageX&&void 0!==b.pageY?(e=b.pageX,f=b.pageY):(e=b.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,f=b.clientY+document.body.scrollTop+document.documentElement.scrollTop),[e-d.left,f-d.top]}},{key:"getScaledXYforCanvas",value:function(a,b){return console.warn("getScaledXYforCanvas is deprecated, use getScaledXYforDOM instead"),this.getScaledXYforDOM(a,b)}},{key:"getScaledXYforDOM",value:function(a,b){var c=this.getUnscaledXYforDOM(a,b),d=L(c,2),e=d[0],f=d[1],g=this.renderOptions.scaleFactor,h=f/g.y;return[e/g.x,h]}},{key:"diatonicNoteNumFromScaledY",value:function(a){var b=this.recursiveGetStoredVexflowStave();if(void 0===b)throw new Nd("Could not find vexflowStave for getting size");var c=this.clef||this.getContextByClass("Clef"),d=void 0!==c?c.lowestLine:31,e=b.options.spacing_between_lines_px,f=b.options.space_above_staff_ln,g=2*a/e,h=2*(b.options.num_lines-1+f)-g;return d+Math.round(h)}},{key:"getStreamFromScaledXandSystemIndex",value:function(a,b){return this}},{key:"noteElementFromScaledX",value:function(a,b,c,d){var e={allowBackup:!0,backupMaximum:70};S.merge(e,d);var f=void 0;void 0===b&&(b=10);var g=this.getStreamFromScaledXandSystemIndex(a,c);if(void 0!==g){var h={minDistanceSoFar:e.backupMaximum,note:void 0},i=!0,j=!1,k=void 0;try{for(var l,m=g.flat.notesAndRests[Symbol.iterator]();!(i=(l=m.next()).done);i=!0){var n=l.value,o=Math.abs(n.x-a),p=Math.abs(n.x+n.width-a),q=Math.min(o,p);if(o<b&&p<b){f=n;break}o<e.backupMaximum&&p<e.backupMaximum&&q<h.minDistanceSoFar&&(h.note=n,h.minDistanceSoFar=q)}}catch(a){j=!0,k=a}finally{try{!i&&m.return&&m.return()}finally{if(j)throw k}}return e.allowBackup&&void 0===f&&(f=h.note),f}}},{key:"findNoteForClick",value:function(a,b,c,d){if(void 0===c||void 0===d){var e=this.getScaledXYforDOM(a,b),f=L(e,2);c=f[0],d=f[1]}return[this.diatonicNoteNumFromScaledY(d),this.noteElementFromScaledX(c)]}},{key:"noteChanged",value:function(a,b,c){var d=b,e=new Ja.Pitch("C");e.diatonicNoteNum=a,e.accidental=d.pitch.accidental,d.pitch=e,d.stemDirection=void 0,this.activeNote=d;var f=this.redrawDOM(c),g={foundNote:d,svg:f};return void 0!==this.changedCallbackFunction?this.changedCallbackFunction(g):g}},{key:"redrawCanvas",value:function(a){return console.warn("redrawCanvas is deprecated, use redrawDOM instead"),this.redrawDOM(a)}},{key:"redrawDOM",value:function(a){this.isFlat||this.setSubstreamRenderOptions();var b=c(a),d=this.createNewDOM(a.width,a.height);return this.renderVexflow(d),b.replaceWith(d),d}},{key:"editableAccidentalCanvas",value:function(a,b){return console.warn("editableAccidentalCanvas is deprecated, use editableAccidentalDOM instead"),this.editableAccidentalDOM(a,b)}},{key:"editableAccidentalDOM",value:function(a,b){var d=c("<div/>").css("text-align","left").css("position","relative");this.renderOptions.events.click=this.DOMChangerFunction;var e=this.createDOM(a,b),f=this.getAccidentalToolbar(void 0,void 0,e);return d.append(f),d.append(c("<br clear='all'/>")),d.append(e),d}},{key:"getAccidentalToolbar",value:function(a,b,d){var e=this;void 0===a&&(a=-1),void 0===b&&(b=1),a=Math.round(a),b=Math.round(b);for(var f=function(a,b){var f=d;if(void 0===f){for(var g=c(b.target).parent(),h=99;h>0&&void 0!==g&&(void 0===f||void 0===f[0]);)h-=1,f=g.find(".streamHolding"),g=g.parent();if(void 0===f[0])return void console.log("Could not find a svg...")}if(void 0!==e.activeNote){var i=e.activeNote;i.pitch.accidental=new Ja.Accidental(a);var j=e.redrawDOM(f[0]);void 0!==e.changedCallbackFunction&&e.changedCallbackFunction({foundNote:i,svg:j})}},g=c("<div/>").attr("class","accidentalToolbar scoreToolbar"),h=a;h<=b;h++)!function(a){var b=new Ja.Accidental(a),d=c("<button>"+b.unicodeModifier+"</button>").click(function(b){return f(a,b)});Math.abs(a)>1&&(d.css("font-family","Bravura Text"),d.css("font-size","20px")),g.append(d)}(h);return g}},{key:"getPlayToolbar",value:function(){var a=this,b=c("<div/>").attr("class","playToolbar scoreToolbar"),d=c("<button>►</button>");d.click(function(){a.playStream()}),b.append(d);var e=c("<button>◼</button>");return e.click(function(){a.stopPlayStream()}),b.append(e),b}},{key:"windowReflowStart",value:function(a){var b=this,d=a;return c(window).bind("resizeEnd",function(){var a=d.parent(),e=a.width(),f=e;console.log("resizeEnd triggered",e),b.resetRenderOptions(!0,!0),b.maxSystemWidth=f-40,d.remove();var g=b.appendNewDOM(a);d=c(g)}),c(window).resize(function(){this.resizeTO&&clearTimeout(this.resizeTO),this.resizeTO=setTimeout(function(){c(this).trigger("resizeEnd")},200)}),setTimeout(function(){var a=c(window),b=a.data("triggerResizeOnCreateSvg");void 0!==b&&!0!==b||(c(this).trigger("resizeEnd"),a.data("triggerResizeOnCreateSvg",!1))},1e3),this}},{key:"hasVoices",value:function(){var a=!0,b=!1,c=void 0;try{for(var d,e=this[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){if(d.value.isClassOrSubclass("Voice"))return!0}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}return!1}},{key:"duration",get:function(){return void 0!==this._duration?this._duration:new Z.Duration(this.highestTime)},set:function(a){this._duration=a}},{key:"highestTime",get:function(){var a=0,b=!0,c=!1,d=void 0;try{for(var e,f=this[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value,h=g.offset;void 0!==g.duration&&(h+=g.duration.quarterLength),h>a&&(a=h)}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}return a}},{key:"semiFlat",get:function(){return this._getFlatOrSemiFlat(!0)}},{key:"flat",get:function(){return this._getFlatOrSemiFlat(!1)}},{key:"notes",get:function(){return this.getElementsByClass(["Note","Chord"])}},{key:"notesAndRests",get:function(){return this.getElementsByClass("GeneralNote")}},{key:"tempo",get:function(){return void 0===this._tempo&&void 0!==this.activeSite?this.activeSite.tempo:void 0===this._tempo?150:this._tempo},set:function(a){this._tempo=a}},{key:"instrument",get:function(){return void 0===this._instrument&&void 0!==this.activeSite?this.activeSite.instrument:this._instrument},set:function(a){"string"==typeof a&&(a=new bd.Instrument(a)),this._instrument=a}},{key:"clef",get:function(){return this.getSpecialContext("clef",!0)},set:function(a){var b=this._firstElementContext("clef");void 0!==b?this.replace(b,a):this.insert(0,a),this._clef=a}},{key:"keySignature",get:function(){return this.getSpecialContext("keySignature",!0)},set:function(a){var b=this._firstElementContext("keySignature");void 0!==b?this.replace(b,a):this.insert(0,a),this._keySignature=a}},{key:"timeSignature",get:function(){return this.getSpecialContext("timeSignature",!0)},set:function(a){"string"==typeof a&&(a=new _c.TimeSignature(a));var b=this._firstElementContext("timeSignature");void 0!==b?this.replace(b,a):this.insert(0,a),this._timeSignature=a}},{key:"autoBeam",get:function(){return this._specialContext("autoBeam")},set:function(a){this._autoBeam=a}},{key:"maxSystemWidth",get:function(){var a=750;return void 0===this.renderOptions.maxSystemWidth&&void 0!==this.activeSite?a=this.activeSite.maxSystemWidth:void 0!==this.renderOptions.maxSystemWidth&&(a=this.renderOptions.maxSystemWidth),a/this.renderOptions.scaleFactor.x},set:function(a){this.renderOptions.maxSystemWidth=a*this.renderOptions.scaleFactor.x}},{key:"parts",get:function(){return this.getElementsByClass("Part")}},{key:"measures",get:function(){return this.getElementsByClass("Measure")}},{key:"voices",get:function(){return this.getElementsByClass("Voice")}},{key:"length",get:function(){return this._elements.length}},{key:"elements",get:function(){return this._elements},set:function(a){var b=0;this.clear();var c=[],d=void 0,e=void 0;if(!0===a.isStream){var f=!0,g=!1,h=void 0;try{for(var i,j=a[Symbol.iterator]();!(f=(i=j.next()).done);f=!0){i.value}}catch(a){g=!0,h=a}finally{try{!f&&j.return&&j.return()}finally{if(g)throw h}}a=a.elements}for(d=0;d<a.length;d++){e=a[d];var k=e.offset;void 0===k||k===b?(this._elements.push(e),this.setElementOffset(e,b),void 0===e.duration&&console.error("No duration for ",e," in ",this),b+=e.duration.quarterLength):c.push(e)}for(d=0;d<c.length;d++)e=c[d],this.insert(e.offset,e);this.coreElementsChanged()}},{key:"iter",get:function(){return new Id(this)}}]),d}(ha.Music21Object);Md.Stream=Od;var Pd=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.recursionType="elementsFirst",a}return I(b,a),b}(Od);Md.Voice=Pd;var Qd=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.recursionType="elementsFirst",a.isMeasure=!0,a.number=0,a.numberSuffix="",a}return I(b,a),F(b,[{key:"stringInfo",value:function(){return this.measureNumberWithSuffix()+" offset="+this.offset.toString()}},{key:"measureNumberWithSuffix",value:function(){return this.number.toString()+this.numberSuffix}}]),b}(Od);Md.Measure=Qd;var Rd=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.recursionType="flatten",a.systemHeight=a.renderOptions.naiveHeight,a}return I(b,a),F(b,[{key:"numSystems",value:function(){for(var a=1,b=this.getElementsByClass("Stream"),c=1;c<b.length;c++)b.get(c).renderOptions.startNewSystem&&(a+=1);return a}},{key:"getMeasureWidths",value:function(){var a=[],b=!0,c=!1,d=void 0;try{for(var e,f=this[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;if(g.isClassOrSubclass("Measure")){var h=g.renderOptions;a[h.measureIndex]=h.width}}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}return a}},{key:"estimateStaffLength",value:function(){if(void 0!==this.renderOptions.overriddenWidth)return this.renderOptions.overriddenWidth;if(!this.isFlat){var a=0,b=!0,c=!0,d=!1,e=void 0;try{for(var f,g=this.getElementsByClass("Measure")[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;if(a+=h.estimateStaffLength()+h.renderOptions.staffPadding,!b&&!0===h.renderOptions.startNewSystem)break;b=!1}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return a}var i=new Md.Measure;return i.elements=this,i.estimateStaffLength()}},{key:"fixSystemInformation",value:function(a){void 0===a?a=this.systemHeight:R&&console.log("overridden systemHeight: "+a);var b=this.renderOptions.systemPadding||this.renderOptions.naiveSystemPadding,c=this.getMeasureWidths(),d=this.maxSystemWidth,e=[],f=[],g=0,h=20,i=void 0;for(i=0;i<c.length;i++){var j=h+c[i];j>d&&g!==i?(f.push(i-1),e.push(h),h=20+c[i],g=i):h=j}var k=0,l=0,m=void 0;for(i=0;i<this.length;i++){var n=this.get(i);if(void 0!==n.renderOptions){if(0===i&&(n.renderOptions.startNewSystem=!0),h=n.renderOptions.left,-1!==f.indexOf(i-1)){var o=n.renderOptions.width,p=n.estimateStaffLength()+n.renderOptions.staffPadding,q=o-p;n.renderOptions.displayClef=!0,n.renderOptions.displayKeySignature=!0,n.renderOptions.startNewSystem=!0;var r=n.estimateStaffLength()+n.renderOptions.staffPadding,s=r+q;n.renderOptions.width=s,l=h-20,m=l-(s-o),k+=1}else 0!==i&&(n.renderOptions.startNewSystem=!1,n.renderOptions.displayClef=!1,n.renderOptions.displayKeySignature=!1);n.renderOptions.systemIndex=k;var t=void 0;if(k>=e.length)t=1;else{t=d/e[k]}var u=h-l;void 0!==m&&(l=m,m=void 0),n.renderOptions.left=Math.floor(u*t),n.renderOptions.width=Math.floor(n.renderOptions.width*t);var v=n.renderOptions.top+k*(a+b);n.renderOptions.top=v}}return e}},{key:"setSubstreamRenderOptions",value:function(){var a=0,b=20,c=this.renderOptions,d=void 0,e=void 0,f=void 0,g=!0,h=!1,i=void 0;try{for(var j,k=this.getElementsByClass("Measure")[Symbol.iterator]();!(g=(j=k.next()).done);g=!0){var l=j.value,m=l.renderOptions;m.measureIndex=a,m.top=c.top,m.partIndex=c.partIndex,m.left=b,0===a?(f=l._clef,d=l._timeSignature,e=l._keySignature,m.displayClef=!0,m.displayKeySignature=!0,m.displayTimeSignature=!0):(void 0!==l._clef&&void 0!==f&&l._clef.name!==f.name?(console.log("changing clefs for ",m.measureIndex," from ",f.name," to ",l._clef.name),f=l._clef,m.displayClef=!0):m.displayClef=!1,void 0!==l._keySignature&&void 0!==e&&l._keySignature.sharps!==e.sharps?(e=l._keySignature,m.displayKeySignature=!0):m.displayKeySignature=!1,void 0!==l._timeSignature&&void 0!==d&&l._timeSignature.ratioString!==d.ratioString?(d=l._timeSignature,m.displayTimeSignature=!0):m.displayTimeSignature=!1),m.width=l.estimateStaffLength()+m.staffPadding,m.height=l.estimateStreamHeight(),b+=m.width,a+=1}}catch(a){h=!0,i=a}finally{try{!g&&k.return&&k.return()}finally{if(h)throw i}}return this}},{key:"systemIndexAndScaledY",value:function(a){var b=this.renderOptions.systemPadding;void 0===b&&(b=this.renderOptions.naiveSystemPadding);var c=Math.floor(a/(this.systemHeight+b));return[c,a-c*(this.systemHeight+b)]}},{key:"findNoteForClick",value:function(a,b,d,e){if(void 0===d||void 0===e){var f=this.getScaledXYforDOM(a,b),g=L(f,2);d=g[0],e=g[1]}R&&console.log("this.estimateStreamHeight(): "+this.estimateStreamHeight()+" / $(svg).height(): "+c(a).height());var h=this.systemIndexAndScaledY(e),i=L(h,2),j=i[0],k=i[1];return[this.diatonicNoteNumFromScaledY(k),this.noteElementFromScaledX(d,void 0,j)]}},{key:"getStreamFromScaledXandSystemIndex",value:function(a,b){var c=void 0,d=this.measures,e=!0,f=!1,g=void 0;try{for(var h,i=d[Symbol.iterator]();!(e=(h=i.next()).done);e=!0){var j=h.value,k=j.renderOptions,l=k.left,m=l+k.width,n=k.top,o=n+k.height;if(R&&console.log("Searching for X:"+Math.round(a)+" in Measure with boundaries L:"+l+" R:"+m+" T: "+n+" B: "+o),a>=l&&a<=m){if(void 0===b){c=j;break}if(k.systemIndex===b){c=j;break}}}}catch(a){f=!0,g=a}finally{try{!e&&i.return&&i.return()}finally{if(f)throw g}}return c}}]),b}(Od);Md.Part=Rd;var Sd=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.recursionType="elementsOnly",a.measureWidths=[],a.partSpacing=a.renderOptions.naiveHeight,a}return I(b,a),F(b,[{key:"getStreamFromScaledXandSystemIndex",value:function(a,b){return this.parts.get(0).getStreamFromScaledXandSystemIndex(a,b)}},{key:"setSubstreamRenderOptions",value:function(){var a=0,b=0,c=this.partSpacing,d=!0,e=!1,f=void 0;try{for(var g,h=this.parts[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value;i.renderOptions.partIndex=a,i.renderOptions.top=b,i.setSubstreamRenderOptions(),b+=c,a+=1}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}this.evenPartMeasureSpacing();var j=this.estimateStreamHeight(!0),k=!0,l=!1,m=void 0;try{for(var n,o=this.parts[Symbol.iterator]();!(k=(n=o.next()).done);k=!0){n.value.fixSystemInformation(j)}}catch(a){l=!0,m=a}finally{try{!k&&o.return&&o.return()}finally{if(l)throw m}}return this.renderOptions.height=this.estimateStreamHeight(),this}},{key:"estimateStaffLength",value:function(){if(void 0!==this.renderOptions.overriddenWidth)return this.renderOptions.overriddenWidth;var a=-1,b=!0,c=!1,d=void 0;try{for(var e,f=this.parts[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value,h=g.estimateStaffLength();h>a&&(a=h)}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}if(a>-1)return a;console.log("no parts found in score");var i=new Md.Part;return i.elements=this,i.estimateStaffLength()}},{key:"playStream",value:function(a){var b=!0,c=!1,d=void 0;try{for(var e,f=this[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;g.isClassOrSubclass("Part")&&g.playStream(a)}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}return this}},{key:"stopPlayStream",value:function(){var a=!0,b=!1,c=void 0;try{for(var d,e=this[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){var f=d.value;f.isClassOrSubclass("Part")&&f.stopPlayStream()}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}return this}},{key:"getMaxMeasureWidths",value:function(){var a=[],b=[],c=void 0,d=!0,e=!1,f=void 0;try{for(var g,h=this.parts[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value;b.push(i.getMeasureWidths())}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}for(c=0;c<b[0].length;c++){for(var j=0,k=0;k<this.length;k++)b[k][c]>j&&(j=b[k][c]);a.push(j)}return a}},{key:"systemIndexAndScaledY",value:function(a){var b=this.parts.length,c=b*this.partSpacing+this.systemPadding,d=Math.floor(a/c);return[d,a-d*c]}},{key:"findNoteForClick",value:function(a,b,c,d){if(void 0===c||void 0===d){var e=this.getScaledXYforDOM(a,b),f=L(e,2);c=f[0],d=f[1]}var g=this.systemIndexAndScaledY(d),h=L(g,2),i=h[0],j=h[1],k=Math.floor(j/this.partSpacing),l=j-k*this.partSpacing,m=this.parts.get(k);return void 0===m?[void 0,void 0]:[m.diatonicNoteNumFromScaledY(l),m.noteElementFromScaledX(c,void 0,i)]}},{key:"numSystems",value:function(){return this.getElementsByClass("Part").get(0).numSystems()}},{key:"evenPartMeasureSpacing",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b=a.setLeft,c=void 0===b||b,d=[],e=0,f=[],g=void 0,h=!0,i=!1,j=void 0;try{for(var k,l=this.parts[Symbol.iterator]();!(h=(k=l.next()).done);h=!0){var m=k.value,n=m.getMeasureWidths();for(g=0;g<n.length;g++){var o=n[g];void 0===d[g]?(d[g]=[],f[g]=o):o>f[g]&&(f[g]=o),d[g][e]=o}e+=1}}catch(a){i=!0,j=a}finally{try{!h&&l.return&&l.return()}finally{if(i)throw j}}for(var p=20,q=0;q<f.length;q++){var r=f[q],s=!0,t=!1,u=void 0;try{for(var v,w=this.parts[Symbol.iterator]();!(s=(v=w.next()).done);s=!0){var x=v.value,y=x.getElementsByClass("Measure").get(q),z=y.renderOptions;z.width=r,c&&(z.left=p)}}catch(a){t=!0,u=a}finally{try{!s&&w.return&&w.return()}finally{if(t)throw u}}p+=r}return this}},{key:"clef",get:function(){var a=H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"clef",this);return void 0===a?new Ac.TrebleClef:a},set:function(a){
K(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"clef",a,this)}},{key:"systemPadding",get:function(){var a=(this.parts.length,this.renderOptions.systemPadding);return void 0===a&&(a=this.renderOptions.naiveSystemPadding),a}}]),b}(Od);Md.Score=Sd;var Td=function a(b,c,d,e){E(this,a),this.element=b,this.offset=c,this.endTime=d,this.voiceIndex=e};Md.OffsetMap=Td;var Ud={},Vd=["start","stop","continue","let-ring","continue-let-ring"],Wd=function(a){function b(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"start";E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c._type=void 0,c.style="normal",c.type=a,c.placement=void 0,c}return I(b,a),F(b,[{key:"stringInfo",value:function(){return this.type}},{key:"type",get:function(){return this._type},set:function(a){if(!Vd.includes(a))throw new O("Type must be one of "+Vd+", not "+a);this._type=a}}]),b}(V.ProtoM21Object);Ud.Tie=Wd;var Xd={divisionsPerQuarter:10080},Yd=function(){function a(){E(this,a),this.xmlText=void 0,this.xmlUrl=void 0,this.$xmlRoot=void 0,this.stream=new Md.Score,this.definesExplicitSystemBreaks=!1,this.definesExplicitPageBreaks=!1,this.mxScorePartDict={},this.m21PartObjectsById={},this.partGroupList=[],this.parts=[],this.musicXmlVersion="1.0"}return F(a,[{key:"scoreFromUrl",value:function(a){var b=this;return this.xmlUrl=a,c.get(a,{},function(a,c){return b.scoreFromDOMTree(a)})}},{key:"scoreFromText",value:function(a){this.xmlText=a;var b=c.parseXML(a);return this.scoreFromDOMTree(b)}},{key:"scoreFromDOMTree",value:function(a){return this.$xmlRoot=c(c(a).children("score-partwise")),this.xmlRootToScore(this.$xmlRoot,this.stream),this.stream}},{key:"xmlRootToScore",value:function(a,b){var d=b;void 0===b&&(d=new Md.Score),this.parsePartList(a);var e=!0,f=!1,g=void 0;try{for(var h,i=a.children("part")[Symbol.iterator]();!(e=(h=i.next()).done);e=!0){var j=h.value,k=c(j),l=k.attr("id"),m=this.mxScorePartDict[l],n=this.xmlPartToPart(k,m);void 0!==n&&(d.insert(0,n),this.m21PartObjectsById[l]=n,this.parts.push(n))}}catch(a){f=!0,g=a}finally{try{!e&&i.return&&i.return()}finally{if(f)throw g}}return d}},{key:"xmlPartToPart",value:function(a,b){var c=new Zd(a,b,this);return c.parse(),c.stream}},{key:"parsePartList",value:function(a){var b=a.children("part-list");if(b){var d=!0,e=!1,f=void 0;try{for(var g,h=b[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value,j=c(i),k=j.attr("id");this.mxScorePartDict[k]=j}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}}}}]),a}(),Zd=function(){function a(b,c,d){E(this,a),this.$mxPart=b,this.$mxScorePart=c,void 0!==b&&(this.partId=b.attr("id")),this.stream=new Md.Part,this.atSoundingPitch=!0,this.staffReferenceList=[],this.lastTimeSignature=void 0,this.lastMeasureWasShort=!1,this.lastMeasureOffset=0,this.lastClefs={0:new Ac.TrebleClef},this.activeTuplets=[],this.activeTuplets.length=7,this.activeTuplets.fill(void 0),this.maxStaves=1,this.lastMeasureNumber=0,this.lastNumberSuffix=void 0,this.multiMeasureRestsToCapture=0,this.activeMultimeasureRestSpanner=void 0,this.activeInstrument=void 0,this.firstMeasureParsed=!1,this.$activeAttributes=void 0,this.lastDivisions=Xd.divisionsPerQuarter,this.appendToScoreAfterParse=!0,this.lastMeasureParser=void 0}return F(a,[{key:"parse",value:function(){this.parseXmlScorePart(),this.parseMeasures(),this.stream.clef=this.lastClefs[0]}},{key:"parseXmlScorePart",value:function(){A(this.stream,this.$mxScorePart,"part-name")}},{key:"parseMeasures",value:function(){var a=!0,b=!1,d=void 0;try{for(var e,f=this.$mxPart.children("measure")[Symbol.iterator]();!(a=(e=f.next()).done);a=!0){var g=e.value,h=c(g);this.xmlMeasureToMeasure(h)}}catch(a){b=!0,d=a}finally{try{!a&&f.return&&f.return()}finally{if(b)throw d}}void 0!==this.lastMeasureParser&&(this.lastMeasureParser.parent=void 0)}},{key:"xmlMeasureToMeasure",value:function(a){var b=new $d(a,this);b.parse(),void 0!==this.lastMeasureParser&&(this.lastMeasureParser.parent=void 0),this.lastMeasureParser=b,this.firstMeasureParsed=!0;var c=b.stream;this.setLastMeasureInfo(c),this.stream.append(c),this.adjustTimeAttributesFromMeasure(c)}},{key:"setLastMeasureInfo",value:function(a){a.number!==this.lastMeasureNumber&&(this.lastMeasureNumber=a.number,this.lastNumberSuffix=a.numberSuffix),void 0!==a.timeSignature?this.lastTimeSignature=a.timeSignature:void 0===this.lastTimeSignature&&(this.lastTimeSignature=new _c.TimeSignature("4/4"))}},{key:"adjustTimeAttributesFromMeasure",value:function(a){var b=a.highestTime,c=b;this.lastMeasureOffset+=c}}]),a}(),$d=function(){function a(b,c){E(this,a),this.$mxMeasure=b,this.$mxMeasureElements=[],this.divisions=void 0,this.parent=c,this.transposition=void 0,this.staffReference={},this.useVoices=!1,this.voicesById={},this.voiceIndices=new Set,this.staves=1,this.$activeAttributes=void 0,this.attributesAreInternal=!0,this.measureNumber=void 0,this.numberSuffix=void 0,this.divisions=void 0!==c?c.lastDivisions:Xd.divisionsPerQuarter,this.staffLayoutObjects=[],this.stream=new Md.Measure,this.$mxNoteList=[],this.$mxLyricList=[],this.nLast=void 0,this.chordVoice=void 0,this.fullMeasureRest=!1,this.restAndNoteCount={rest:0,note:0},this.lastClefs={0:void 0},this.parseIndex=0,this.offsetMeasureNote=0,this.attributeTagsToMethods={time:"handleTimeSignature",clef:"handleClef",key:"handleKeySignature"},this.musicDataMethods={note:"xmlToNote",attributes:"parseAttributesTag"}}return F(a,[{key:"parse",value:function(){this.parseMeasureAttributes();var a=this.$mxMeasure.children();this.$mxMeasureElements=[];var b=!0,d=!1,e=void 0;try{for(var f,g=a[Symbol.iterator]();!(b=(f=g.next()).done);b=!0){var h=f.value,i=c(h);this.$mxMeasureElements.push(i)}}catch(a){d=!0,e=a}finally{try{!b&&g.return&&g.return()}finally{if(d)throw e}}var j=0,k=!0,l=!1,m=void 0;try{for(var n,o=this.$mxMeasureElements[Symbol.iterator]();!(k=(n=o.next()).done);k=!0){var p=n.value,q=p[0].tagName;this.parseIndex=j;var r=this.musicDataMethods[q];void 0!==r&&this[r](p),j+=1}}catch(a){l=!0,m=a}finally{try{!k&&o.return&&o.return()}finally{if(l)throw m}}}},{key:"insertInMeasureOrVoice",value:function(a,b){this.stream.append(b)}},{key:"xmlToNote",value:function(a){var b=!1,c=this.$mxMeasureElements[this.parseIndex+1];void 0!==c&&"note"===c[0].tagName&&c.children("chord").length>0&&(b=!0);var d=!1,e=!1,f=0;a.children("rest").length>0&&(e=!0),a.children("chord").length>0&&(d=!0),b&&(d=!0);var g=void 0;if(d){var h;this.$mxNoteList.push(a),(h=this.$mxLyricList).push.apply(h,M(a.children("lyric")))}else d||e?(this.restAndNoteCount.rest+=1,g=this.xmlToRest(a)):(this.restAndNoteCount.note+=1,g=this.xmlToSimpleNote(a));if(d||(this.updateLyricsFromList(g,a.children("lyric")),this.insertInMeasureOrVoice(a,g),f=g.duration.quarterLength,this.nLast=g),this.$mxNoteList.length&&!b){var i=this.xmlToChord(this.$mxNoteList);this.updateLyricsFromList(i,this.$mxLyricList),this.insertInMeasureOrVoice(a,i),this.$mxNoteList=[],this.$mxLyricList=[],f=i.duration.quarterLength,this.nLast=i}this.offsetMeasureNote+=f}},{key:"xmlToChord",value:function(a){var b=[],c=!0,d=!1,e=void 0;try{for(var f,g=a[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;b.push(this.xmlToSimpleNote(h,!1))}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return new yc.Chord(b)}},{key:"xmlToSimpleNote",value:function(a,b){var c=new Ma.Note;return this.xmlToPitch(a,c.pitch),this.xmlNoteToGeneralNoteHelper(c,a,b)}},{key:"xmlToPitch",value:function(a,b){var d=b;void 0===b&&(d=new Ja.Pitch);var e=void 0;if("pitch"===a[0].tagName)e=a;else if(e=c(a.children("pitch")[0]),0===e.length)return d;A(d,e,"step"),A(d,e,"octave",void 0,parseInt);var f=e.children("alter"),g=void 0;f.length&&(g=parseFloat(f.text().trim()));var h=a.children("accidental");if(h.length){var i=this.xmlToAccidental(h);d.accidental=i,d.accidental.displayStatus=!0}else void 0===g||isNaN(g)||(d.accidental=new Ja.Accidental(g),d.accidental.displayStatus=!1);return d}},{key:"xmlToAccidental",value:function(a){var b=new Ja.Accidental,d=c(a[0]).text().trim().toLowerCase();return"flat-flat"===d&&(d="double-flat"),b.set(d),b}},{key:"xmlToRest",value:function(a){var b=new Ma.Rest;return this.xmlNoteToGeneralNoteHelper(b,a)}},{key:"xmlNoteToGeneralNoteHelper",value:function(a,b,c){return void 0===c&&(c=!0),this.xmlToDuration(b,a.duration),b.children("tie").length>0&&(a.tie=this.xmlToTie(b)),a}},{key:"xmlToDuration",value:function(a,b){var d=b;void 0===b&&(d=new Z.Duration);var e=this.divisions,f=a.children("duration")[0],g=0;if(f){g=parseFloat(c(f).text().trim())/e}var h=a.children("type")[0];if(h){var i=c(h).text().trim(),j=a.children("dot").length;d.type=i,d.dots=j}else d.quarterLength=g;return d}},{key:"xmlToTie",value:function(a){var b=new Ud.Tie,d=a.children("tie");if(d.length>1)b.type="continue";else{var e=c(d[0]);b.type=e.attr("type")}return b}},{key:"updateLyricsFromList",value:function(a,b){var d=1,e=!0,f=!1,g=void 0;try{for(var h,i=b[Symbol.iterator]();!(e=(h=i.next()).done);e=!0){var j=h.value,k=this.xmlToLyric(c(j));void 0!==k&&(0===k.number&&(k.number=d),a.lyrics.push(k),d+=1)}}catch(a){f=!0,g=a}finally{try{!e&&i.return&&i.return()}finally{if(f)throw g}}}},{key:"xmlToLyric",value:function(a,b){var c=b;void 0===b&&(c=new Ma.Lyric);try{c.text=a.children("text").text().trim()}catch(a){return}var d=a.attr("number");try{d=parseInt(d),c.number=d}catch(a){c.number=0,void 0!==d&&(c.identifier=d)}var e=a.get("name");void 0!==e&&(c.identifier=e);var f=a.children("syllabic");if(f.length&&(c.syllabic=f.text().trim()),void 0===b)return c}},{key:"insertIntoMeasureOrVoice",value:function(a,b){this.stream.insert(this.offsetMeasureNote,b)}},{key:"parseMeasureAttributes",value:function(){this.parseMeasureNumbers()}},{key:"parseMeasureNumbers",value:function(){var a=this.$mxMeasure.attr("number"),b=parseInt(a);this.stream.number=b,this.parent&&(this.parent.lastMeasureNumber=b),this.measureNumber=b}},{key:"parseAttributesTag",value:function(a){this.attributesAreInternal=!1,this.$activeAttributes=a;var b=!0,d=!1,e=void 0;try{for(var f,g=a.children()[Symbol.iterator]();!(b=(f=g.next()).done);b=!0){var h=f.value,i=h.tagName,j=c(h),k=this.attributeTagsToMethods[i];void 0!==k?this[k](j):"staves"===i?this.staves=parseInt(j.text()):"divisions"===i&&(this.divisions=parseFloat(j.text()))}}catch(a){d=!0,e=a}finally{try{!b&&g.return&&g.return()}finally{if(d)throw e}}void 0!==this.parent&&(this.parent.lastDivisions=this.divisions,this.parent.$activeAttributes=this.$activeAttributes)}},{key:"handleTimeSignature",value:function(a){var b=this.xmlToTimeSignature(a);this.insertIntoMeasureOrVoice(a,b)}},{key:"xmlToTimeSignature",value:function(a){var b=c(a.children("beats")[0]).text().trim(),d=c(a.children("beat-type")[0]).text().trim();return new _c.TimeSignature(b+"/"+d)}},{key:"handleClef",value:function(a){var b=this.xmlToClef(a);this.stream.clef=b,this.insertIntoMeasureOrVoice(a,b),this.lastClefs[0]=b}},{key:"xmlToClef",value:function(a){var b=c(a.children("sign")[0]).text().trim(),d=c(a.children("line")[0]).text().trim(),e=0,f=a.children("clef-octave-change");return f.length>0&&(e=parseInt(c(f[0]).text().trim())),Ac.clefFromString(b+d,e)}},{key:"handleKeySignature",value:function(a){var b=this.xmlToKeySignature(a);this.insertIntoMeasureOrVoice(a,b)}},{key:"xmlToKeySignature",value:function(a){var b=new Yc.KeySignature;return A(b,a,"fifths","sharps",parseInt),b._alteredPitchesCache=void 0,b}}]),a}(),_d={ScoreParser:Yd,PartParser:Zd,MeasureParser:$d},ae=Object.freeze({ScoreParser:Yd,PartParser:Zd,MeasureParser:$d,default:_d}),be=Object.freeze({parse:B}),ce={};ce.shortNames=["pppppp","ppppp","pppp","ppp","pp","p","mp","mf","f","fp","sf","ff","fff","ffff","fffff","ffffff"],ce.longNames={ppp:["pianississimo"],pp:["pianissimo"],p:["piano"],mp:["mezzopiano"],mf:["mezzoforte"],f:["forte"],fp:["fortepiano"],sf:["sforzando"],ff:["fortissimo"],fff:["fortississimo"]},ce.englishNames={ppp:["extremely soft"],pp:["very soft"],p:["soft"],mp:["moderately soft"],mf:["moderately loud"],f:["loud"],ff:["very loud"],fff:["extremely loud"]},ce.dynamicStrToScalar={None:[.5],n:[0],pppp:[.1],ppp:[.15],pp:[.25],p:[.35],mp:[.45],mf:[.55],f:[.7],fp:[.75],sf:[.85],ff:[.85],fff:[.9],ffff:[.95]};var de=function(a){function b(a){E(this,b);var c=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return c._value=void 0,c._volumeScalar=void 0,c.longName=void 0,c.englishName=void 0,c.value=a,c}return I(b,a),F(b,[{key:"value",get:function(){return this._value},set:function(a){"string"!=typeof a?(this._volumeScalar=a,this._value=a<=0?"n":a<.11?"pppp":a<.16?"ppp":a<.26?"pp":a<.36?"p":a<.5?"mp":a<.65?"mf":a<.8?"f":a<.9?"ff":"fff"):(this._value=a,this._volumeScalar=void 0),this._value in ce.longNames?this.longName=ce.longNames[this._value][0]:this.longName=void 0,this._value in ce.englishNames?this.englishName=ce.englishNames[this._value][0]:this.englishName=void 0}},{key:"volumeScalar",get:function(){return void 0!==this._volumeScalar?this._volumeScalar:this._value in ce.dynamicStrToScalar?ce.dynamicStrToScalar[this._value][0]:void 0},set:function(a){"number"==typeof a&&a<=1&&a>=0&&(this._volumeScalar=a)}}]),b}(ha.Music21Object);ce.Dynamic=de;var ee={},fe=function(b){function c(){E(this,c);var a=J(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));return a.name="expression",a.vexflowModifier="",a.setPosition=void 0,a}return I(c,b),F(c,[{key:"vexflow",value:function(){var b=new a.Flow.Articulation(this.vexflowModifier);return this.setPosition&&b.setPosition(this.setPosition),b}}]),c}(ha.Music21Object);ee.Expression=fe;var ge=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.name="fermata",a.vexflowModifier="a@a",a.setPosition=3,a}return I(b,a),b}(fe);ee.Fermata=ge;var he={"":[5,3],5:[5,3],6:[6,3],7:[7,5,3],9:[9,7,5,3],11:[11,9,7,5,3],13:[13,11,9,7,5,3],"6,5":[6,5,3],"4,3":[6,4,3],"4,2":[6,4,2],2:[6,4,2]},ie=function(){function a(){var b=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";E(this,a),this.notationColumn=b,this.figureStrings=void 0,this.origNumbers=void 0,this.origModStrings=void 0,this.numbers=void 0,this.modifierStrings=void 0,this._parseNotationColumn(),this._translateToLonghand(),this.modifiers=void 0,this.figures=void 0,this._getModifiers(),this._getFigures()}return F(a,[{key:"_parseNotationColumn",value:function(){var a=this.notationColumn,b=a.split(/,/),c=[],d=[],e=[],f=!0,g=!1,h=void 0;try{for(var i,j=b[Symbol.iterator]();!(f=(i=j.next()).done);f=!0){var k=i.value;k=k.trim(),e.push(k);var l="",m="",n=!0,o=!1,p=void 0;try{for(var q,r=k[Symbol.iterator]();!(n=(q=r.next()).done);n=!0){var s=q.value;s.match(/\d/)?l+=s:m+=s}}catch(a){o=!0,p=a}finally{try{!n&&r.return&&r.return()}finally{if(o)throw p}}var t=void 0;""!==l&&(t=parseInt(l)),c.push(t),""===m&&(m=void 0),d.push(m)}}catch(a){g=!0,h=a}finally{try{!f&&j.return&&j.return()}finally{if(g)throw h}}this.origNumbers=c,this.numbers=c,this.modifierStrings=d,this.figureStrings=e}},{key:"_translateToLonghand",value:function(){var a=this.numbers,b=a,c=this.modifierStrings,d=c,e=a.toString();if(void 0!==he[e]){b=he[e],d=[];var f=[],g=!0,h=!1,i=void 0;try{for(var j,k=a[Symbol.iterator]();!(g=(j=k.next()).done);g=!0){var l=j.value;void 0===l?f.push(3):f.push(l)}}catch(a){h=!0,i=a}finally{try{!g&&k.return&&k.return()}finally{if(h)throw i}}a=f;var m=!0,n=!1,o=void 0;try{for(var p,q=b[Symbol.iterator]();!(m=(p=q.next()).done);m=!0){var r=p.value,s=void 0;if(a.includes(r)){s=c[a.indexOf(r)]}d.push(s)}}catch(a){n=!0,o=a}finally{try{!m&&q.return&&q.return()}finally{if(n)throw o}}}else{var t=[],u=!0,v=!1,w=void 0;try{for(var x,y=a[Symbol.iterator]();!(u=(x=y.next()).done);u=!0){var z=x.value;void 0===z?t.push(3):t.push(z)}}catch(a){v=!0,w=a}finally{try{!u&&y.return&&y.return()}finally{if(v)throw w}}b=t}this.numbers=b,this.modifierStrings=d}},{key:"_getModifiers",value:function(){for(var a=[],b=0;b<this.numbers.length;b++){var c=this.modifierStrings[b],d=new le(c);a.push(d)}this.modifiers=a}},{key:"_getFigures",value:function(){for(var a=[],b=0;b<this.numbers.length;b++){var c=this.numbers[b],d=this.modifierStrings[b],e=new je(c,d);a.push(e)}this.figures=a}}]),a}(),je=function a(b,c){E(this,a),this.number=b,this.modifierString=c,this.modifier=new le(c)},ke={"+":"#","/":"-","\\":"#",b:"-",bb:"--",bbb:"---",bbbb:"-----","++":"##","+++":"###","++++":"####"},le=function(){function a(b){E(this,a),this.modifierString=b,this.accidental=this._toAccidental()}return F(a,[{key:"_toAccidental",value:function(){var a=this.modifierString;if(void 0!==a&&""!==a){var b=new Ja.Accidental;return void 0!==ke[a]&&(a=ke[a]),b.set(a),b}}},{key:"modifyPitchName",value:function(a){var b=new Ja.Pitch(a);return this.modifyPitch(b,!0),b.name}},{key:"modifyPitch",value:function(a,b){if(!0!==b&&(a=a.clone()),void 0===this.accidental)return a;if(0===this.accidental.alter||void 0===a.accidental)a.accidental=this.accidental.clone();else{var c=new Ja.Accidental,d=a.accidental.alter+this.accidental.alter;c.set(d),a.accidental=c}return a}}]),a}(),me={Notation:ie,Figure:je,Modifier:le},ne=d,oe=ne.unpickler,pe={},qe=function(){function a(){var b=this;E(this,a),this.debug=!0,this.knownUnparsables=["music21.spanner.Line","music21.instrument.Instrument","music21.layout.StaffGroup","music21.layout.StaffLayout","music21.layout.SystemLayout","music21.layout.PageLayout","music21.expressions.TextExpression","music21.bar.Barline","music21.tempo.MetronomeMark","music21.metadata.Metadata"],this.handlers={"music21.duration.Duration":{post_restore:function(a){return a.quarterLength=a._qtrLength,a}},"music21.meter.TimeSignature":{post_restore:function(a){return a._numerator=a.displaySequence._numerator,a._denominator=a.displaySequence._denominator,a}},"music21.stream.Part":{post_restore:function(a){return b.currentPart=a,b.lastClef=void 0,b.lastKeySignature=void 0,b.lastTimeSignature=void 0,b.streamPostRestore(a),a}},"music21.stream.Score":{post_restore:this.streamPostRestore.bind(this)},"music21.stream.Stream":{post_restore:this.streamPostRestore.bind(this)},"music21.stream.Measure":{post_restore:this.streamPostRestore.bind(this)},"music21.stream.Voice":{post_restore:this.streamPostRestore.bind(this)}},this.currentPart=void 0,this.lastClef=void 0,this.lastKeySignature=void 0,this.lastTimeSignature=void 0}return F(a,[{key:"streamPostRestore",value:function(a){var b=a._storedElementOffsetTuples;a._clef=this.lastClef,a._keySignature=this.lastKeySignature,a._timeSignature=this.lastTimeSignature;for(var c=0;c<b.length;c++){var d=b[c][0];d.offset=b[c][1];var e=d.classes;void 0===e&&(console.warn("M21object without classes: ",d),console.warn("Javascript classes are: ",d._py_class),e=[]);var f=this.currentPart;void 0===f&&(f=a);for(var g=!0,h=!1,i=0;i<e.length;i++){for(var j=e[i],k=0;k<this.knownUnparsables.length;k++){-1!==this.knownUnparsables[k].indexOf(j)&&(g=!1)}"TimeSignature"===j?(a._timeSignature=d,this.lastTimeSignature=d,void 0!==f&&void 0===f.timeSignature&&(f.timeSignature=d),g=!1):"Clef"===j?(a._clef=d,this.lastClef=d,void 0!==f&&void 0===f.clef&&(f.clef=d),g=!1):"KeySignature"===j?(a._keySignature=d,this.lastKeySignature=d,void 0!==f&&void 0===f.keySignature&&(f.keySignature=d),g=!1):"Part"===j&&(g=!1,h=!0)}g?a.append(d):h&&a.insert(0,d)}return a}},{key:"run",value:function(a){return oe.decode(a,this.handlers).stream}}]),a}();pe.Converter=qe;var re=function(a){function b(a,c){E(this,b),void 0===c&&(c={});var d=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return d._writeAsChord=!1,d._roman=void 0,d.chordStepModifications=[],d._degreesList=[],d._key=void 0,d._figure=a,!1!==c.parseFigure&&void 0!==d._figure&&d._parseFigure(),void 0===d._overrides.bass&&void 0!==d._overrides.root&&d.bass(d._overrides.root),(c.updatePitches&&void 0!==d._figure||void 0!==d._overrides.root||void 0!==d._overrides.bass)&&d._updatePitches(),!1!==c.parseFigure&&void 0!==d._figure&&-1!==d._figure.indexOf("sus")&&-1===d._figure.indexOf("sus2")&&d.root(d.bass()),d}return I(b,a),F(b,[{key:"_parseFigure",value:function(){}},{key:"_updatePitches",value:function(){}},{key:"findFigure",value:function(){}},{key:"figure",get:function(){return void 0===this._figure?this.findFigure():this._figure},set:function(a){this._figure=a,void 0!==this._figure&&(this._parseFigure(),this._updatePitches())}},{key:"key",get:function(){return this._key},set:function(a){"string"==typeof a?this._key=new Yc.Key(a):(this._key=a,this._roman=void 0)}}]),b}(yc.Chord),se={Harmony:re},te={};te.transposeOctave=0;var ue=function(){function a(b,c,d,e){E(this,a),this.timing=b,this.data1=c,this.data2=d,this.data3=e,this.midiCommand=c>>4,this.noteOff=8===this.midiCommand,this.noteOn=9===this.midiCommand,this.midiNote=void 0,(this.noteOn||this.noteOff)&&(this.midiNote=this.data2+12*te.transposeOctave,this.velocity=this.data3)}return F(a,[{key:"sendToMIDIjs",value:function(){void 0!==b&&void 0!==b.noteOn?this.noteOn?b.noteOn(0,this.midiNote,this.velocity,0):this.noteOff&&b.noteOff(0,this.midiNote,0):console.warn("could not playback note because no MIDIout defined")}},{key:"music21Note",value:function(){var a=new Ma.Note;return a.pitch.ps=this.midiNote,a}}]),a}();te.Event=ue,te.maxDelay=100,te.heldChordTime=0,te.heldChordNotes=void 0,te.timeOfLastNote=Date.now(),te._baseTempo=60,te.metronome=void 0,Object.defineProperties(te,{tempo:{enumerable:!0,get:function(){return void 0===this.metronome?this._baseTempo:this.metronome.tempo},set:function(a){void 0===this.metronome?this._baseTempo=a:this.metronome.tempo=a}}}),te.clearOldChords=function(){var a=Date.now();te.heldChordTime+te.maxDelay<a&&(te.heldChordTime=a,void 0!==te.heldChordNotes&&(te.sendOutChord(te.heldChordNotes),te.heldChordNotes=void 0)),setTimeout(te.clearOldChords,te.maxDelay)},te.makeChords=function(a){if(a.noteOn){var b=a.music21Note();if(void 0===te.heldChordNotes)te.heldChordNotes=[b];else{for(var c=0;c<te.heldChordNotes.length;c++){if(te.heldChordNotes[c].pitch.ps===b.pitch.ps)return}te.heldChordNotes.push(b)}}},te.lastElement=void 0,te.sendOutChord=function(a){var b=void 0;if(a.length>1)b=new yc.Chord(a);else{if(1!==a.length)return;b=a[0]}return b.stemDirection="noStem",te.quantizeLastNote(),te.lastElement=b,void 0!==te.callBacks.sendOutChord&&te.callBacks.sendOutChord(b),b},te.callBacks={raw:function(a,b,c,d){return new te.Event(a,b,c,d)},general:[te.sendToMIDIjs,te.quantizeLastNote],sendOutChord:function(a){}},te.quantizeLastNote=function(a){if(void 0!==a||void 0!==(a=this.lastElement)){a.stemDirection=void 0;var b=Date.now(),c=b-this.timeOfLastNote;this.timeOfLastNote=b;var d=6e4/this.tempo,e=c/d,f=Math.round(4*e)/4;return f>=4?f=4:f>=3?f=3:f>2?f=2:1.25===f?f=1:.75===f?f=.5:0===f&&(f=.125),a.duration.quarterLength=f,a}},te.sendToMIDIjs=function(a){a.sendToMIDIjs()},te.loadedSoundfonts={},te.postLoadCallback=function(a,d){R&&(console.log("soundfont loaded about to execute callback."),console.log("first playing two notes very softly -- seems to flush the buffer.")),c(".loadingSoundfont").remove();var e="undefined"!=typeof InstallTrigger,f="HTML Audio Tag"===b.technology,g=bd.find(a);if(void 0!==g&&(b.programChange(g.midiChannel,g.midiProgram),R&&console.log(a+" ("+g.midiProgram+") loaded on ",g.midiChannel),!1===e&&!1===f)){var h=g.midiChannel;b.noteOn(h,36,1,0),b.noteOff(h,36,1,.1),b.noteOn(h,48,1,.2),b.noteOff(h,48,1,.3),b.noteOn(h,60,1,.3),b.noteOff(h,60,1,.4)}void 0!==d&&d(g),te.loadedSoundfonts[a]=!0},te.loadSoundfont=function(a,d){if(!0===te.loadedSoundfonts[a]){if(void 0!==d){var e=bd.find(a);d(e)}}else if("loading"===te.loadedSoundfonts[a]){!function b(){if(!0===te.loadedSoundfonts[a]){if(R&&console.log("other process has finished loading; calling callback"),void 0!==d){var c=bd.find(a);d(c)}}else R&&console.log("waiting for other process load"),setTimeout(b,100)}()}else te.loadedSoundfonts[a]="loading",R&&console.log("waiting for document ready"),c(document).ready(function(){R&&console.log("document ready, waiting to load soundfont"),c(document.body).append(c("<div class='loadingSoundfont'><b>Loading MIDI Instrument</b>: audio will begin when this message disappears.</div>")),b.loadPlugin({soundfontUrl:S.urls.soundfontUrl,instrument:a,onsuccess:te.postLoadCallback.bind(b,a,d)})})};var ve=function(){function a(){E(this,a),this.player=new b.Players.PlayInstance,this.speed=1,this.$playDiv=void 0}return F(a,[{key:"addPlayer",value:function(a){var b=a;void 0===a&&(a=document.body),void 0===a.jquery&&(b=c(a));var d=c('<div class="midiPlayer">'),e=c('<div class="positionControls">'),f=c('<input type="image" alt="play" src="'+this.playPng()+'" align="absmiddle" value="play" class="playPause">'),g=c('<input type="image" alt="stop" src="'+this.stopPng()+'" align="absmiddle" value="stop" class="stopButton">');f.on("click",this.pausePlayStop.bind(this)),g.on("click",this.stopButton.bind(this)),e.append(f),e.append(g),d.append(e);var h=c('<div class="timeControls">'),i=c('<span class="timePlayed">0:00</span>'),j=c('<span class="capsule"><span class="cursor"></span></span>'),k=c('<span class="timeRemaining">-0:00</span>');return h.append(i),h.append(j),h.append(k),d.append(h),b.append(d),this.$playDiv=d,d}},{key:"stopButton",value:function(){this.pausePlayStop("yes")}},{key:"playPng",value:function(){return S.urls.midiPlayer+"/play.png"}},{key:"pausePng",value:function(){return S.urls.midiPlayer+"/pause.png"}},{key:"stopPng",value:function(){return S.urls.midiPlayer+"/stop.png"}},{key:"pausePlayStop",value:function(a){var b=void 0;b=void 0===this.$playDiv?{src:"doesnt matter"}:this.$playDiv.find(".playPause")[0],"yes"===a?(this.player.stop(),b.src=this.playPng()):this.player.playing||"pause"===a?(b.src=this.playPng(),this.player.pause(!0)):(b.src=this.pausePng(),this.player.resume())}},{key:"base64Load",value:function(a){var b=this.player;b.timeWarp=this.speed;var c=this;te.loadSoundfont("acoustic_grand_piano",function(){b.loadFile(a,function(){c.fileLoaded()},void 0,function(a){console.log(a)})})}},{key:"songFinished",value:function(){this.pausePlayStop("yes")}},{key:"fileLoaded",value:function(){this.updatePlaying()}},{key:"startAndUpdate",value:function(){this.player.start(),this.updatePlaying()}},{key:"updatePlaying",value:function(){function a(a){var b=a/60>>0,c=String(a-60*b>>0);return 1===c.length&&(c="0"+c),b+":"+c}var b=this,c=this,d=this.player;if(void 0!==this.$playDiv){var f=this.$playDiv,g=f.find(".timePlayed")[0],h=f.find(".timeRemaining")[0],i=f.find(".cursor")[0],j=f.find(".capsule");e.add(j[0],"drag",function(a,c){e.cancel(a);var d=b.player;d.currentTime=c.x/420*d.endTime,d.currentTime<0&&(d.currentTime=0),d.currentTime>d.endTime&&(d.currentTime=d.endTime),"down"===c.state?b.pausePlayStop("pause"):"up"===c.state&&b.pausePlayStop("play")}),d.setAnimation(function(b){var d=b.now/b.end,e=b.now>>0,f=b.end>>0;e===f&&c.songFinished(),i.style.width=100*d+"%",g.innerHTML=a(e),h.innerHTML="-"+a(f-e)})}}}]),a}();te.MidiPlayer=ve;var we={},xe=function(){function a(){E(this,a),this.classes=["Key"],this.callbacks=[],this.scaleFactor=1,this.parent=void 0,this.id=0,this.width=23,this.height=120,this.pitchObj=void 0,this.svgObj=void 0,this.noteNameSvgObj=void 0,this.keyStyle="",this.keyClass=""}return F(a,[{key:"makeKey",value:function(a){var b={style:this.keyStyle,x:a,y:0,class:"keyboardkey "+this.keyClass,id:this.id,width:this.width*this.scaleFactor,height:this.height*this.scaleFactor,rx:3,ry:3},c=S.makeSVGright("rect",b);for(var d in this.callbacks)({}).hasOwnProperty.call(this.callbacks,d)&&c.addEventListener(d,this.callbacks[d],!1);return this.svgObj=c,c}},{key:"addCircle",value:function(a){if(void 0!==this.svgObj&&void 0!==this.parent&&void 0!==this.parent.svgObj){void 0===a&&(a="red");var b=parseInt(this.svgObj.getAttribute("x")),c=b+this.parent.scaleFactor*this.width/2,d={stroke:a,"stroke-width":3,fill:"none",cx:c,cy:(this.height-10)*this.parent.scaleFactor,class:"keyboardkeyannotation",r:this.width*this.parent.scaleFactor/4},e=S.makeSVGright("circle",d);return this.parent.svgObj.appendChild(e),e}}},{key:"addNoteName",value:function(a){if(void 0===this.svgObj||void 0===this.parent||void 0===this.parent.svgObj)return this;if(0===this.id&&void 0===this.pitchObj)return this;if(void 0===this.pitchObj&&(this.pitchObj=new Ja.Pitch,this.pitchObj.ps=this.id),void 0!==this.pitchObj.accidental&&0!==this.pitchObj.accidental.alter)return this;var b=parseInt(this.svgObj.getAttribute("x")),c=this.pitchObj.name,d=14;!0===a&&(c=this.pitchObj.nameWithOctave,d=12,b-=2),d=Math.floor(d*parent.scaleFactor);var e="white";"whitekey"===this.keyClass&&(e="black");var f={fill:e,x:b+this.parent.scaleFactor*(this.width/2-5),y:this.parent.scaleFactor*(this.height-20),class:"keyboardkeyname","font-size":d},g=S.makeSVGright("text",f),h=document.createTextNode(c);return g.appendChild(h),this.noteNameSvgObj=g,this.parent.svgObj.appendChild(g),this}},{key:"removeNoteName",value:function(){void 0!==this.svgObj&&void 0!==this.parent&&void 0!==this.parent.svgObj&&void 0!==this.noteNameSvgObj&&(this.noteNameSvgObj.parentNode===this.parent.svgObj&&this.parent.svgObj.removeChild(this.noteNameSvgObj),this.noteNameSvgObj=void 0)}}]),a}();we.Key=xe;var ye=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.width=23,a.height=120,a.keyStyle="fill:#fffff6;stroke:black",a.keyClass="whitekey",a}return I(b,a),b}(xe);we.WhiteKey=ye;var ze=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.width=13,a.height=80,a.keyStyle="fill:black;stroke:black",a.keyClass="blackkey",a}return I(b,a),b}(xe);we.BlackKey=ze;var Ae=function(){function a(){var b=this;E(this,a),this.whiteKeyWidth=23,this._defaultWhiteKeyWidth=23,this._defaultBlackKeyWidth=13,this.scaleFactor=1,this.height=120,this.keyObjects={},this.svgObj=void 0,this.markC=!0,this.showNames=!1,this.showOctaves=!1,this.startPitch="C3",this.endPitch="C5",this._startDNN=void 0,this._endDNN=void 0,this.hideable=!1,this.scrollable=!1,this.callbacks={click:function(a){return b.clickHandler(a)}},this.sharpOffsets={0:14.3333,1:18.6666,3:13.25,4:16.25,5:19.75}}return F(a,[{key:"redrawSVG",value:function(){if(void 0!==this.svgObj){var a=this.svgObj,b=a.parentNode;this.keyObjects={};var c=this.createSVG();return b.replaceChild(c,a),c}}},{key:"appendKeyboard",value:function(a){void 0===a?a=document.body:void 0!==a.jquery&&(a=a[0]);var b=this.createSVG();return this.scrollable&&(b=this.wrapScrollable(b)[0]),this.hideable?this.appendHideableKeyboard(a,b):a.appendChild(b),this}},{key:"clickHandler",value:function(a){var c=a.id,d=this.keyObjects[c];if(void 0!==d){var e=d.keyStyle,f="#c0c000";"whitekey"===d.keyClass&&(f="yellow"),a.setAttribute("style","fill:"+f+";stroke:black"),te.loadSoundfont("acoustic_grand_piano",function(a){b.noteOn(a.midiChannel,c,100,0),b.noteOff(a.midiChannel,c,500)}),setTimeout(function(){a.setAttribute("style",e)},500)}}},{key:"createSVG",value:function(){if(void 0===this._startDNN)if("string"==typeof this.startPitch){var a=new Ja.Pitch(this.startPitch);this._startDNN=a.diatonicNoteNum}else this._startDNN=this.startPitch;if(void 0===this._endDNN)if("string"==typeof this.endPitch){var b=new Ja.Pitch(this.endPitch);this._endDNN=b.diatonicNoteNum}else this._endDNN=this.endPitch;for(var c=(this._startDNN-1)%7,d=1+this._endDNN-this._startDNN,e=this.whiteKeyWidth*this.scaleFactor*d,f=120*this.scaleFactor,g=f.toString()+"px",h=S.makeSVGright("svg",{"xml:space":"preserve",height:g,width:e.toString()+"px",class:"keyboardSVG"}),i=new Ja.Pitch("C4"),j=[],k=this,l=0;l<d;l++){i.diatonicNoteNum=this._startDNN+l;var m=new we.WhiteKey;m.id=i.midi,m.parent=this,this.keyObjects[i.midi]=m,m.scaleFactor=this.scaleFactor,m.width=this.whiteKeyWidth,m.callbacks.click=function(){k.callbacks.click(this)};var n=m.makeKey(this.whiteKeyWidth*this.scaleFactor*l);if(h.appendChild(n),(0===c||1===c||3===c||4===c||5===c)&&l!==d-1){var o=new we.BlackKey;o.id=i.midi+1,
this.keyObjects[i.midi+1]=o,o.parent=this,o.scaleFactor=this.scaleFactor,o.width=this._defaultBlackKeyWidth*this.whiteKeyWidth/this._defaultWhiteKeyWidth,o.callbacks.click=function(){k.callbacks.click(this)};var p=this.sharpOffsets[c];p*=this.whiteKeyWidth/this._defaultWhiteKeyWidth*this.scaleFactor;var q=o.makeKey(this.whiteKeyWidth*this.scaleFactor*l+p);j.push(q)}c+=1,c%=7}for(var r=0;r<j.length;r++)h.appendChild(j[r]);return this.svgObj=h,this.markC&&this.markMiddleC(),this.showNames&&this.markNoteNames(this.showOctaves),h}},{key:"markMiddleC",value:function(a){var b=this.keyObjects[60];void 0!==b&&b.addCircle("red")}},{key:"markNoteNames",value:function(a){this.removeNoteNames();for(var b in this.keyObjects)if({}.hasOwnProperty.call(this.keyObjects,b)){var c=this.keyObjects[b];c.addNoteName(a)}}},{key:"removeNoteNames",value:function(){for(var a in this.keyObjects)if({}.hasOwnProperty.call(this.keyObjects,a)){var b=this.keyObjects[a];b.removeNoteName()}}},{key:"wrapScrollable",value:function(a){var b=this,d=c("<div class='keyboardScrollableWrapper'></div>").css({display:"inline-block"}),e=c("<button class='keyboardOctaveDown'><<</button>").css({"font-size":Math.floor(15*this.scaleFactor).toString()+"px"}).bind("click",function(){te.transposeOctave-=1,b._startDNN-=7,b._endDNN-=7,b.redrawSVG()}),f=c("<button class='keyboardOctaveUp'>>></button>").css({"font-size":Math.floor(15*this.scaleFactor).toString()+"px"}).bind("click",function(){te.transposeOctave+=1,b._startDNN+=7,b._endDNN+=7,b.redrawSVG()}),g=c("<div style='display:inline-block; vertical-align: middle' class='keyboardScrollableInnerDiv'></div>");return g[0].appendChild(a),d.append(e),d.append(g),d.append(f),d}},{key:"appendHideableKeyboard",value:function(a,b){var d=c("<div class='keyboardHideableContainer'/>"),e=c("<div class='keyboardToggleInside'>↥</div>").css({display:"inline-block","padding-top":"40px","font-size":"40px"}),f=c("<div class='keyboardToggleOutside'/>").css({display:"inline-block","vertical-align":"top",background:"white"});f.append(e),f.data("defaultDisplay",d.find(".keyboardSVG").css("display")),f.data("state","down"),f.click(we.triggerToggleShow);var g=c("<div class='keyboardExplain'>Show keyboard</div>").css({display:"none","background-color":"white",padding:"10px 10px 10px 10px","font-size":"12pt"});return f.append(g),d.append(f),d[0].appendChild(b),c(a).append(d),d}}]),a}();we.triggerToggleShow=function(a){var b=c(this),d=b.data("state"),e=b.parent(),f=e.find(".keyboardScrollableWrapper");0===f.length&&(f=e.find(".keyboardSVG"));var g=b.find(".keyboardToggleInside"),h=e.find(".keyboardExplain");if("up"===d){g.text("↥"),g.css("padding-top","40px"),h.css("display","none");var i=b.data("defaultDisplay");void 0===i&&(i="inline"),f.css("display",i),b.data("state","down")}else f.css("display","none"),h.css("display","inline-block"),g.text("↧"),g.css("padding-top","10px"),b.data("state","up")},we.jazzHighlight=function(a){if(void 0!==a)if(a.noteOn){var b=a.midiNote;if(void 0!==this.keyObjects[b]){var c=this.keyObjects[b],d=c.svgObj,e="",f=(a.velocity+25)/127;if(f>1&&(f=1),"whitekey"===c.keyClass){var g=f.toString();e="rgba(255, 255, 0, "+g+")"}else{var h=Math.floor(255*f).toString();e="rgb("+h+","+h+",0)"}d.setAttribute("style","fill:"+e+";stroke:black")}}else if(a.noteOff){var i=a.midiNote;if(void 0!==this.keyObjects[i]){var j=this.keyObjects[i],k=j.svgObj;k.setAttribute("style",j.keyStyle)}}},we.Keyboard=Ae;var Be={};Be.makeLayoutFromScore=function(a,b){var c=a.parts,d=c.length,e=c.get(0),f=e.getElementsByClass("Measure").length,g=e.getMeasureWidths(),h=b||a.maxSystemWidth,i=new Be.LayoutScore,j=new Be.Page;j.measureStart=1,j.measureEnd=f,i.insert(0,j);var k=new Be.System,l=1;k.measureStart=1;var m=[],n=function(a,b,c){for(var d=0;d<b;d++){var e=new Be.Staff;e.measureStart=c,e.staffNumber=d+1,a.push(e)}};n(m,d,1);for(var o=[],p=[],q=0,r=20,s=0;s<g.length;s++){var t=r+g[s];if(t>h&&q!==s){for(var u=0;u<m.length;u++)m.measureEnd=s,k.insert(0,m[u]);m=[],n(m,d,s+1),k.measureEnd=s,j.insert(0,k),l+=1,k=new Be.System,k.measureStart=s+1,k.systemNumber=l,p.push(s-1),o.push(r),console.log("setting new width at "+r+" measure "+s),r=20+g[s],q=s}else r=t;for(var v=0;v<m.length;v++)m[v].append(c[v].get(s))}for(var w=0;w<m.length;w++)m.measureEnd=g.length-1,k.insert(0,m[w]);return j.insert(0,k),i};var Ce=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.scoreLayout=void 0,a.measureStart=void 0,a.measureEnd=void 0,a._width=void 0,a.height=void 0,a.top=0,a.left=0,a}return I(b,a),F(b,[{key:"pages",get:function(){return this.getElementsByClass("Page")}},{key:"width",get:function(){return this._width?this._width:this.activeSite?this.activeSite.width:void 0}}]),b}(Md.Score);Be.LayoutScore=Ce;var De=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.pageNumber=1,a.measureStart=void 0,a.measureEnd=void 0,a.systemStart=void 0,a.systemEnd=void 0,a.pageLayout=void 0,a}return I(b,a),F(b,[{key:"systems",get:function(){return this.getElementsByClass("System")}},{key:"width",get:function(){return this._width?this._width:this.activeSite?this.activeSite.width:void 0}}]),b}(Md.Score);Be.Page=De;var Ee=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.systemNumber=1,a.systemLayout=void 0,a.measureStart=void 0,a.measureEnd=void 0,a._width=void 0,a.height=void 0,a.top=void 0,a.left=void 0,a}return I(b,a),F(b,[{key:"staves",get:function(){return this.getElementsByClass("Staff")}},{key:"width",get:function(){return this._width?this._width:this.activeSite?this.activeSite.width:void 0}}]),b}(Md.Score);Be.System=Ee;var Fe=function(a){function b(){E(this,b);var a=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.staffNumber=1,a.optimized=0,a.top=void 0,a.left=void 0,a._width=void 0,a.height=void 0,a.inheritedHeight=void 0,a.staffLayout=void 0,a}return I(b,a),F(b,[{key:"width",get:function(){return this._width?this._width:this.activeSite?this.activeSite.width:void 0}}]),b}(Md.Part);Be.Staff=Fe;var Ge={m21ToXml:vd,xmlToM21:ae},He={};He.figureShorthands={53:"",3:"",63:"6",753:"7",75:"7",73:"7",9753:"9",975:"9",953:"9",97:"9",95:"9",93:"9",653:"65","6b53":"6b5",643:"43",642:"42",bb7b5b3:"o7",bb7b53:"o7",b7b5b3:"/o7"},He.functionalityScores={I:100,i:90,V7:80,V:70,V65:68,I6:65,V6:63,V43:61,I64:60,IV:59,i6:58,viio7:57,V42:55,viio65:53,viio6:52,"#viio65":51,ii:50,"#viio6":49,ii65:48,ii43:47,ii42:46,IV6:45,ii6:43,VI:42,"#VI":41,vi:40,viio:39,"#viio":39,iio:37,iio42:36,bII6:35,iio43:32,iio65:31,"#vio":28,"#vio6":28,III:22,v:20,VII:19,VII7:18,IV65:17,IV7:16,iii:15,iii6:12,vi6:10},He.expandShortHand=function(a){a=a.replace("/",""),a.match(/[b-]$/)&&(a+="3"),a=a.replace("11","x"),a=a.replace("13","y"),a=a.replace("15","z");for(var b=new RegExp("#*-*b*o*[1-9xyz]","g"),c=[],d=b.exec(a);null!==d;)c.push(d[0]),d=b.exec(a);1===c.length&&c[0].endsWith("3")&&(c=["5",c[0]]);var e=[],f=!0,g=!1,h=void 0;try{for(var i,j=c[Symbol.iterator]();!(f=(i=j.next()).done);f=!0){var k=i.value;k=k.replace("x","11"),k=k.replace("y","13"),k=k.replace("z","15"),e.push(k)}}catch(a){g=!0,h=a}finally{try{!f&&j.return&&j.return()}finally{if(g)throw h}}return e},He.correctSuffixForChordQuality=function(a,b){var c=a.semitonesFromChordStep(5),d="";6===c?d="o":8===c&&(d="+"),void 0!==b&&(b.startsWith("o")||b.startsWith("/o"))&&"o"===d&&(d="");var e=a.semitonesFromChordStep(7);return void 0!==e&&6===c&&10===e&&"o"===d&&(d="/o"),d+b},He.romanToNumber=[void 0,"i","ii","iii","iv","v","vi","vii"];var Ie=function(a){function b(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",c=arguments[1],d=arguments[2];E(this,b);var e={updatePitches:!1,parseFigure:!1};S.merge(e,d);var f=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,e));return f._parsingComplete=!1,f.primaryFigure=void 0,f.secondaryRomanNumeral=void 0,f.secondaryRomanNumeralKey=void 0,f.pivotChord=void 0,f.scaleCardinality=7,f._figure=void 0,f.caseMatters=!0,"number"==typeof a&&(f.caseMatters=!1),f.scaleDegree=void 0,f.frontAlterationString=void 0,f.frontAlterationTransposeInterval=void 0,f.frontAlterationAccidental=void 0,f.romanNumeralAlone=void 0,f.impliedQuality=void 0,f.impliedScale=void 0,f.scaleOffset=void 0,f.useImpliedScale=!1,f.bracketedAlterations=[],f.omittedSteps=[],f.followsKeyChange=!1,f._functionalityScore=void 0,f._scale=void 0,f.figure=a,f.key=c,f.numbers="",""!==a&&(f._parseFigure(),f._parsingComplete=!0,f._updatePitches()),f}return I(b,a),F(b,[{key:"stringInfo",value:function(){return this.figure+" in "+this.key.stringInfo()}},{key:"_parseFigure",value:function(){var a=void 0,b=this.impliedScale;this.useImpliedScale||(b=this.key);var c=this._correctForSecondaryRomanNumeral(b),d=L(c,2);a=d[0],b=d[1],"Cad64"===a&&(a="minor"===b.mode?"i64":"I64"),this.primaryFigure=a,a=this._parseOmittedSteps(a),a=this._parseBracketedAlterations(a),a=a.replace(/^N6/,"bII6"),a=a.replace(/^N/,"bII6"),a=this._parseFrontAlterations(a);var e=this._parseRNAloneAmidstAug6(a,b),f=L(e,2);a=f[0],b=f[1],a=this._setImpliedQualityFromString(a),this._tempRoot=b.pitchFromDegree(this.scaleDegree),this._fixMinorVIandVII(b);var g=He.expandShortHand(a);this.figuresNotationObj=new me.Notation(g.toString());var h=a.match(/\d+/);null!=h&&(a=a.replace(/\d+/,""),this.numbers=parseInt(h[0]))}},{key:"_parseFrontAlterations",value:function(a){var b="",c=void 0,d=void 0,e=new RegExp("^(b+|-+|#+)"),f=e.exec(a);if(null!=f){var g=f[1],h=g.length;"b"!==g[0]&&"-"!==g[0]||(h*=-1),c=Ta.intervalFromGenericAndChromatic(1,h),d=new Ja.Accidental(h),b=g,a=a.replace(e,"")}return this.frontAlterationString=b,this.frontAlterationTransposeInterval=c,this.frontAlterationAccidental=d,a}},{key:"_correctBracketedPitches",value:function(){var a=!0,b=!1,c=void 0;try{for(var d,e=this.bracketedAlterations[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){var f=d.value,g=L(f,2),h=g[0],i=g[1],j=this.getChordStep(i);if(void 0!==j){var k=new Ja.Accidental(h);void 0===j.accidental?j.accidental=k:j.accidental.set(j.accidental.alter+k.alter)}}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}}},{key:"_setImpliedQualityFromString",value:function(a){var b="";return a.startsWith("o")?(b="diminished",a=a.replace(/^o/,"")):a.startsWith("/o")?(b="half-diminished",a=a.replace(/^\/o/,"")):a.startsWith("+")?(b="augmented",a=a.replace(/^\+/,"")):a.endsWith("d7")?(b="dominant-seventh",a=a.replace(/d7$/,"7")):this.caseMatters&&this.romanNumeralAlone.toUpperCase()===this.romanNumeralAlone?b="major":this.caseMatters&&this.romanNumeralAlone.toLowerCase()===this.romanNumeralAlone&&(b="minor"),this.impliedQuality=b,a}},{key:"_fixMinorVIandVII",value:function(a){if("minor"===a.mode&&this.caseMatters&&(6===this.scaleDegree||7===this.scaleDegree)&&["minor","diminished","half-diminished"].includes(this.impliedQuality)){var b=this.frontAlterationTransposeInterval;if(void 0!==b){var c=Ta.add([b,new Ta.Interval("A1")]);this.frontAlterationTransposeInterval=c,this.frontAlterationAccidental.alter=this.frontAlterationAccidental.alter+1}else this.frontAlterationTransposeInterval=new Ta.Interval("A1"),this.frontAlterationAccidental=new Ja.Accidental(1);this._tempRoot=this.frontAlterationTransposeInterval.transposePitch(this._tempRoot)}}},{key:"_parseRNAloneAmidstAug6",value:function(a,b){var c="",d=new RegExp("(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2}|N)"),e=new RegExp("(It|Ger|Fr|Sw)"),f=d.exec(a),g=e.exec(a);if(null===f&&null===g)throw new O("No roman numeral found in "+a);return null!==g?("major"===b.mode&&(b=new Yc.Key(b.tonic.name,"minor"),this.impliedScale=b,this.useImpliedScale=!0),c=g[1],["It","Ger"].includes(c)?this.scaleDegree=4:this.scaleDegree=2,a=a.replace(e,""),this.romanNumeralAlone=c,"Fr"!==c&&this.bracketedAlterations.push(["#",1]),"Fr"!==c&&"Sw"!==c||this.bracketedAlterations.push(["#",3])):(c=f[1],this.scaleDegree=S.fromRoman(c),a=a.replace(d,""),this.romanNumeralAlone=c),[a,b]}},{key:"_updatePitches",value:function(){var a=void 0;a=void 0!==this.secondaryRomanNumeralKey?this.secondaryRomanNumeralKey:this.useImpliedScale?this.impliedScale:this.key,this.scaleCardinality=7;for(var b=this.bassScaleDegreeFromNotation(this.figuresNotationObj),c=a.pitchFromDegree(b,"ascending"),d=[c],e=c,f=this.figuresNotationObj.numbers.length,g=0;g<f;g++){var h=f-g-1,i=b+this.figuresNotationObj.numbers[h]-1,j=a.pitchFromDegree(i,"ascending"),k=this.figuresNotationObj.modifiers[h].modifyPitchName(j.name),l=new Ja.Pitch(k);l.octave=j.octave,l.ps<e.ps&&(l.octave+=1),d.push(l),e=l}if(void 0!==this.frontAlterationTransposeInterval){var m=[],n=!0,o=!1,p=void 0;try{for(var q,r=d[Symbol.iterator]();!(n=(q=r.next()).done);n=!0){var s=q.value,t=this.frontAlterationTransposeInterval.transposePitch(s);m.push(t)}}catch(a){o=!0,p=a}finally{try{!n&&r.return&&r.return()}finally{if(o)throw p}}this.pitches=m}else this.pitches=d;if(this._matchAccidentalsToQuality(this.impliedQuality),this.scaleOffset=this.frontAlterationTransposeInterval,this.omittedSteps.length){var u=[],v=!0,w=!1,x=void 0;try{for(var y,z=this.omittedSteps[Symbol.iterator]();!(v=(y=z.next()).done);v=!0){var A=y.value,B=this.getChordStep(A);void 0!==B&&u.push(B.name)}}catch(a){w=!0,x=a}finally{try{!v&&z.return&&z.return()}finally{if(w)throw x}}var C=[],D=!0,E=!1,F=void 0;try{for(var G,H=d[Symbol.iterator]();!(D=(G=H.next()).done);D=!0){var I=G.value;u.includes(I.name)||C.push(I)}}catch(a){E=!0,F=a}finally{try{!D&&H.return&&H.return()}finally{if(E)throw F}}this.pitches=C}this._correctBracketedPitches()}},{key:"bassScaleDegreeFromNotation",value:function(a){var b=new Ja.Pitch("C3"),c=b.diatonicNoteNum,d=[b],e=!0,f=!1,g=void 0;try{for(var h,i=a.numbers[Symbol.iterator]();!(e=(h=i.next()).done);e=!0){var j=h.value,k=j-1,l=c+k,m=Ta.convertDiatonicNumberToStep(l),n=L(m,2),o=n[0],p=n[1],q=new Ja.Pitch("C3");q.step=o,q.octave=p,d.push(q)}}catch(a){f=!0,g=a}finally{try{!e&&i.return&&i.return()}finally{if(f)throw g}}var r=new yc.Chord(d),s=r.root().diatonicNoteNum,t=s-c,u=S.posMod(this.scaleDegree-t,7);return 0===u&&(u=7),u}},{key:"_matchAccidentalsToQuality",value:function(a){for(var b=this._findSemitoneSizeForQuality(a),c=[3,5,7],d=0;d<c.length;d++){var e=c[d],f=b[d],g=this.semitonesFromChordStep(e);if(void 0!==f&&(void 0!==g&&g!==f)){var h=f-g;h>=6?h=-1*(12-h):h<=-6&&(h+=12);var i=this.getChordStep(e);if(void 0===i.accidental)i.accidental=new Ja.Accidental(h);else{var j=i.accidental;h+=j.alter,h>=6?h=-1*(12-h):h<=-6&&(h+=12),j.set(h)}}}}},{key:"_correctForSecondaryRomanNumeral",value:function(a,c){void 0===c&&(c=this._figure);var d=c,e=new RegExp("(.*?)/([#a-np-zA-NP-Z].*)"),f=e.exec(c);if(null!==f){var g=f[1],h=f[2],i=new b(h,a,this.caseMatters);this.secondaryRomanNumeral=i;var j=void 0;j="minor"===i.quality?"minor":"major"===i.quality?"minor":3===i.semitonesFromChordStep(3)?"minor":"major",this.secondaryRomanNumeralKey=new Yc.Key(i.root().name,j),a=this.secondaryRomanNumeralKey,d=g}return[d,a]}},{key:"_parseOmittedSteps",value:function(a){for(var b=[],c=new RegExp(/\[no(\d+)]s*/),d=c.exec(a);null!==d;){var e=d[1];e=parseInt(e),e=e%7||7,b.push(e),a=a.replace(c,""),d=c.exec(a)}return this.omittedSteps=b,a}},{key:"_parseBracketedAlterations",value:function(a){for(var b=this.bracketedAlterations,c=new RegExp(/\[(b+|-+|#+)(\d+)]/),d=c.exec(a);null!==d;){var e=d[1],f=parseInt(d[2]);b.push([e,f]),a=a.replace(c,""),d=c.exec(a)}return a}},{key:"_findSemitoneSizeForQuality",value:function(a){return"major"===a?[4,7]:"minor"===a?[3,7]:"diminished"===a?[3,6,9]:"half-diminished"===a?[3,6,10]:"augmented"===a?[4,8]:"dominant-seventh"===a?[4,7,10]:[]}},{key:"asString",value:function(a,b){var c=this.key,d=c.tonic.name,e=c.mode;void 0===b&&(b=this.inversion());var f="";1===b?f="roman"===a?"6":" (first inversion)":2===b&&(f="roman"===a?"64":" (second inversion)");var g=void 0,h=" in ",i="";"roman"===a?(g=this.figure,g=g.replace("/o","ø")):"nameOnly"===a?(g="",h="",i=" triad"):"bassName"===a?g=this.bass().name.replace(/-/,"b"):(g=this.degreeName,void 0!==this.numbers&&(g+=" "+this.numbers.toString()));var j=d.replace(/-/,"b");return"minor"===e&&(j=j.toLowerCase()),g+f+h+j+" "+e+i}},{key:"romanNumeral",get:function(){return void 0===this.frontAlterationAccidental?this.romanNumeralAlone:this.frontAlterationAccidental.modifier+this.romanNumeralAlone}},{key:"scale",get:function(){return void 0!==this._scale?this._scale:(this._scale=this.key.getScale(),this._scale)}},{key:"key",get:function(){return this._scale},set:function(a){this._scale="string"==typeof a?new Yc.Key(a):void 0===a?new Yc.Key("C"):a,void 0===a?(this.useImpliedScale=!0,this.impliedScale=new Xc.MajorScale("C")):(this.useImpliedScale=!1,this.impliedScale=!1),this._parsingComplete&&this._updatePitches()}},{key:"figure",get:function(){return this._figure},set:function(a){this._figure=a,this._parsingComplete&&(this._parseFigure(),this._updatePitches())}},{key:"figureAndKey",get:function(){var a=this.key.tonic.name,b="";return void 0!==this.key.mode&&(b=" "+this.key.mode)," minor"===b?a=a.toLowerCase():" major"===b&&(a=a.toUpperCase()),this.figure+" in "+a+b}},{key:"degreeName",get:function(){if(this.scaleDegree<7)return[void 0,"Tonic","Supertonic","Mediant","Subdominant","Dominant","Submediant"][this.scaleDegree];var a=this.key.tonic,b=(a.ps-this.root().ps)%12;return b<0&&(b+=12),1===b?"Leading-tone":"Subtonic"}}]),b}(se.Harmony);He.RomanNumeral=Ie;var Je={};Je.defaultTempoValues={larghissimo:16,largamente:32,grave:40,"molto adagio":40,largo:46,lento:52,adagio:56,slow:56,langsam:56,larghetto:60,adagietto:66,andante:72,andantino:80,"andante moderato":83,maestoso:88,moderato:92,moderate:92,allegretto:108,animato:120,"allegro moderato":128,allegro:132,fast:132,schnell:132,allegrissimo:140,"molto allegro":144,"très vite":144,vivace:160,vivacissimo:168,presto:184,prestissimo:208},Je.baseTempo=60;var Ke=function(a){function d(a){E(this,d);var b=J(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));return b._tempo=60,b.tempo=void 0===a?Je.baseTempo:a,b.numBeatsPerMeasure=4,b.minTempo=10,b.maxTempo=600,b.beat=b.numBeatsPerMeasure,b.chirpTimeout=void 0,b.silent=!1,b.flash=!1,b.tempoRanges=[0,40,60,72,120,144,240,999],b.tempoIncreases=[0,1,2,3,4,6,8,15,100],b}return I(d,a),F(d,[{key:"_silentFlash",value:function(a){this.$metronomeDiv.find(".metroFlash").css("background-color",a).fadeOut(1e3*this.beatLength/4,function(){c(this).css("background-color","#ffffff").fadeIn(1)})}},{key:"chirp",value:function(){this.beat+=1,this.beat>this.numBeatsPerMeasure?(this.beat=1,!0!==this.silent&&(b.noteOn(0,96,100,0),b.noteOff(0,96,.1)),!0===this.flash&&this._silentFlash("#0000f0")):(!0!==this.silent&&(b.noteOn(0,84,70,0),b.noteOff(0,84,.1)),!0===this.flash&&this._silentFlash("#ff0000"));var a=this;this.chirpTimeout=setTimeout(function(){a.chirp()},6e4/this.tempo)}},{key:"stopChirp",value:function(){void 0!==this.chirpTimeout&&(clearTimeout(this.chirpTimeout),this.chirpTimeout=void 0)}},{key:"increaseSpeed",value:function(){for(var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,b=0;b<a;b++){for(var c=this.tempo,d=0;d<this.tempoRanges.length;d++){var e=this.tempoRanges[d],f=this.tempoIncreases[d];if(c<e){c+=f,c=f*Math.round(c/f);break}}this.tempo=c}return this.tempo}},{key:"decreaseSpeed",value:function(){for(var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,b=0;b<a;b++){for(var c=this.tempo,d=this.tempoRanges.length,e=1;e<=d;e++){var f=this.tempoRanges[d-e],g=this.tempoIncreases[d-e+1];if(c>f){c-=g,c=g*Math.floor(c/g);break}}this.tempo=c}}},{key:"addDiv",value:function(a){var b=void 0;b=void 0!==a&&void 0!==a.jquery?a:c(void 0!==a?a:"body");var d=this,e=c('<span class="tempoHolder">'+this.tempo.toString()+"</span>");e.css({"font-size":"24px","padding-left":"10px","padding-right":"10px"});var f=c('<div class="metronomeRendered"></div>');f.append(e);var g=c("<button>start</button>");g.on("click",function(){d.chirp()});var h=c("<button>stop</button>");h.on("click",function(){d.stopChirp()}),f.prepend(h),f.prepend(g);var i=c("<button>up</button>");i.on("click",function(){d.increaseSpeed(),c(this).prevAll(".tempoHolder").html(d.tempo.toString())});var j=c("<button>down</button>");j.on("click",function(){d.decreaseSpeed(),c(this).prevAll(".tempoHolder").html(d.tempo.toString())}),f.append(i),f.append(j);var k=c('<span class="metroFlash"> </span>');return k.css("margin-left","40px"),k.css("height","40px"),f.append(k),b.append(f),this.$metronomeDiv=f,f}},{key:"tempo",get:function(){return this._tempo},set:function(a){this._tempo=a,this._tempo>this.maxTempo?this._tempo=this.maxTempo:this._tempo<this.minTempo&&(this._tempo=this.minTempo)}},{key:"beatLength",get:function(){return 60/this.tempo}}]),d}(V.ProtoM21Object);Je.Metronome=Ke;var Le={};Le.regularExpressions={REST:/r/,OCTAVE2:/([A-G])[A-G]+/,OCTAVE3:/([A-G])/,OCTAVE5:/([a-g])('+)/,OCTAVE4:/([a-g])/,EDSHARP:/\((#+)\)/,EDFLAT:/\((-+)\)/,EDNAT:/\(n\)/,SHARP:/^[A-Ga-g]+'*(#+)/,FLAT:/^[A-Ga-g]+'*(-+)/,NAT:/^[A-Ga-g]+'*n/,TYPE:/(\d+)/,TIE:/.~/,PRECTIE:/~/,ID_EL:/=([A-Za-z0-9]*)/,LYRIC:/_(.*)/,DOT:/\.+/,TIMESIG:/(\d+)\/(\d+)/,PARTBREAK:/partBreak/,TRIP:/trip{/,QUAD:/quad{/,ENDBRAC:/}$/},Le.TinyNotation=function(a){a=a.trim();var b=a.split(" "),c=void 0,d=new Md.Part,e=new Md.Measure;e.number=1;for(var f=4,g=1,h={lastNoteTied:!1,inTrip:!1,inQuad:!1,endTupletAfterNote:!1},i=Le.regularExpressions,j=1,k=0;k<b.length;k++){(e.duration.quarterLength>=f||Math.abs(e.duration.quarterLength-f)<1e-4)&&(d.append(e),j+=1,e=new Md.Measure,e.number=j);var l=b[k],m=void 0,n=void 0;if(i.PARTBREAK.exec(l))e.length>0&&(d.append(e),e=new Md.Measure),void 0===c&&(c=new Md.Score),c.insert(0,d),d=new Md.Part,h.lastNoteTied=!1,h.inTrip=!1,h.inQuad=!1,h.endTupletAfterNote=!1;else{if(i.TRIP.exec(l)&&(l=l.slice(5),h.inTrip=!0),i.QUAD.exec(l)&&(l=l.slice(5),h.inQuad=!0),i.ENDBRAC.exec(l)&&(l=l.slice(0,-1),h.endTupletAfterNote=!0),i.LYRIC.exec(l)){var o=l.split("_"),p=L(o,2);l=p[0],n=p[1]}if(i.TIMESIG.exec(l)){var q=i.TIMESIG.exec(l),r=new _c.TimeSignature;r.numerator=parseInt(q[1]),r.denominator=parseInt(q[2]),e.timeSignature=r,f=r.barDuration.quarterLength}else{if(i.REST.exec(l))m=new Ma.Rest(g);else if(i.OCTAVE2.exec(l)){var s=i.OCTAVE2.exec(l);m=new Ma.Note(s[1],g),m.pitch.octave=4-s[0].length}else if(i.OCTAVE3.exec(l)){var t=i.OCTAVE3.exec(l);m=new Ma.Note(t[1],g),m.pitch.octave=3}else if(i.OCTAVE5.exec(l)){var u=i.OCTAVE5.exec(l);m=new Ma.Note(u[1].toUpperCase(),g),m.pitch.octave=3+u[0].length}else if(i.OCTAVE4.exec(l)){var v=i.OCTAVE4.exec(l);m=new Ma.Note(v[1].toUpperCase(),g),m.pitch.octave=4}if(void 0!==m){if(void 0!==n&&(m.lyric=n),i.TIE.exec(l)?(m.tie=new Ud.Tie("start"),h.lastNoteTied&&(m.tie.type="continue"),h.lastNoteTied=!0):h.lastNoteTied&&(m.tie=new Ud.Tie("stop"),h.lastNoteTied=!1),i.SHARP.exec(l)){var w=i.SHARP.exec(l);m.pitch.accidental=new Ja.Accidental(w[1].length)}else if(i.FLAT.exec(l)){var x=i.FLAT.exec(l);m.pitch.accidental=new Ja.Accidental(-1*x[1].length)}else i.NAT.exec(l)&&(m.pitch.accidental=new Ja.Accidental("natural"),m.pitch.accidental.displayType="always");var y=i.TYPE.exec(l);if(y){var z=parseInt(y[0]);m.duration.quarterLength=4/z}if(y=i.DOT.exec(l)){var A=y[0].length,B=1-Math.pow(.5,A)+1;m.duration.quarterLength*=B}g=m.duration.quarterLength,h.inTrip&&m.duration.appendTuplet(new Z.Tuplet(3,2,m.duration.quarterLength)),h.inQuad&&m.duration.appendTuplet(new Z.Tuplet(4,3,m.duration.quarterLength)),h.endTupletAfterNote&&(h.inTrip=!1,h.inQuad=!1,h.endTupletAfterNote=!1),e.append(m)}}}}e.length>0&&d.append(e);var C=void 0;if(void 0!==c){d.length>0&&c.append(d);for(var D=0;D<c.length;D++){var E=c.get(D);E.clef=Ac.bestClef(E),E.getElementsByClass("Measure").get(0).clef=E.clef}C=c}else d.clef=Ac.bestClef(d),d.getElementsByClass("Measure").get(0).clef=d.clef,C=d;return C},Le.renderNotationDivs=function(a,b){void 0===a&&(a=".music21.tinyNotation");var d=[];void 0===b?d=c(a):(void 0===b.jquery&&(b=c(b)),d=b.find(a));for(var e=0;e<d.length;e++){var f=d[e],g=c(f),h=void 0;if(void 0!==g.attr("tinynotationcontents")?h=g.attr("tinynotationcontents"):void 0!==f.textContent&&(h=f.textContent,h=h.replace(/s+/g," ")),void 0!==String.prototype.trim&&void 0!==h&&(h=h.trim()),h){var i=Le.TinyNotation(h);g.hasClass("noPlayback")&&(i.renderOptions.events.click=void 0);var j=i.createDOM();g.attr("tinynotationcontents",h),g.empty(),g.data("stream",i),g.append(j)}}};var Me=[],Ne={antiParallel:"Anti-Parallel",contrary:"Contrary",noMotion:"No Motion",oblique:"Oblique",parallel:"Parallel",similar:"Similar"},Oe=function(a){function b(a,c,d,e,f){E(this,b);var g=J(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return Me.length||(Me.push(new Ta.Interval("P1")),Me.push(new Ta.Interval("P5")),Me.push(new Ta.Interval("P8"))),g.unison=Me[0],g.fifth=Me[1],g.octave=Me[2],g._v1n1=void 0,g._v1n2=void 0,g._v2n1=void 0,g._v2n2=void 0,g.v1n1=a,g.v1n2=c,g.v2n1=d,g.v2n2=e,g.vIntervals=[],g.hIntervals=[],g._key=void 0,void 0!==f&&(g.key=f),void 0!==a&&void 0!==c&&void 0!==d&&void 0!==e&&g._findIntervals(),g}return I(b,a),F(b,[{key:"_setVoiceNote",value:function(a,b){if(void 0===a)this[b]=a;else if("string"==typeof a)this[b]=new Ma.Note(a);else if(a.classes.includes("Note"))this[b]=a;else{var c=new Ma.Note(a.nameWithOctave);c.duration.quarterLength=0,this[b]=c}}},{key:"_findIntervals",value:function(){this.vIntervals.push(new Ta.Interval(this.v1n1,this.v2n1)),this.vIntervals.push(new Ta.Interval(this.v1n2,this.v2n2)),this.hIntervals.push(new Ta.Interval(this.v1n1,this.v1n2)),this.hIntervals.push(new Ta.Interval(this.v2n1,this.v2n2))}},{key:"motionType",value:function(){return this.obliqueMotion()?Ne.oblique:this.parallelMotion()?Ne.parallel:this.similarMotion()?Ne.similar:this.contraryMotion()?Ne.contrary:this.antiParallelMotion()?Ne.antiParallel:this.noMotion()?Ne.noMotion:void 0}},{key:"noMotion",value:function(){var a=!0,b=!1,c=void 0;try{for(var d,e=this.hIntervals[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){if("P1"!==d.value.name)return!1}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}return!0}},{key:"obliqueMotion",value:function(){if(this.noMotion())return!1;var a=!0,b=!1,c=void 0;try{for(var d,e=this.hIntervals[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){if("P1"===d.value.name)return!0}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}return!1}},{key:"similarMotion",value:function(){return!this.noMotion()&&this.hIntervals[0].direction===this.hIntervals[1].direction}},{key:"parallelMotion",value:function(a){return!!this.similarMotion()&&(this.vIntervals[0].directedSimpleName===this.vIntervals[1].directedSimpleName&&(void 0===a||("string"==typeof a&&(a=new Ta.Interval(a)),this.vIntervals[0].simpleName===a.simpleName)))}},{key:"contraryMotion",value:function(){return!this.noMotion()&&(!this.obliqueMotion()&&this.hIntervals[0].direction!==this.hIntervals[1].direction)}},{key:"outwardContraryMotion",value:function(){return this.contraryMotion()&&this.hIntervals[0].direction===Ta.Direction.ASCENDING}},{key:"inwardContraryMotion",value:function(){return this.contraryMotion()&&this.hIntervals[0].direction===Ta.Direction.DESCENDING}},{key:"antiParallelMotion",value:function(a){return!!this.contraryMotion()&&(this.vIntervals[0].simpleName===this.vIntervals[1].simpleName&&(void 0===a||("string"==typeof a?this.vIntervals[0].simpleName===a:this.vIntervals[0].simpleName===a.simpleName)))}},{key:"parallelInterval",value:function(a){return!(!this.parallelMotion()&&!this.antiParallelMotion())&&("string"==typeof a&&(a=new Ta.Interval(a)),this.vIntervals[0].semiSimpleName===a.semiSimpleName)}},{key:"parallelFifth",value:function(){return this.parallelInterval(this.fifth)}},{key:"parallelOctave",value:function(){return this.parallelInterval(this.octave)}},{key:"parallelUnison",value:function(){return this.parallelInterval(this.unison)}},{key:"parallelUnisonOrOctave",value:function(){return this.parallelUnison()||this.parallelOctave()}},{key:"hiddenInterval",value:function(a){return!this.parallelMotion()&&(!!this.similarMotion()&&("string"==typeof a&&(a=new Ta.Interval(a)),this.vIntervals[1].simpleName===a.simpleName))}},{key:"hiddenFifth",value:function(){return this.hiddenInterval(this.fifth)}},{key:"hiddenOctave",value:function(){return this.hiddenInterval(this.octave)}},{key:"voiceCrossing",value:function(){return this.v1n1.pitch.ps<this.v2n1.pitch.ps||this.v1n2.pitch.ps<this.v2n2.pitch.ps}},{key:"voiceOverlap",value:function(){return this.v1n2.pitch.ps<this.v2n1.pitch.ps||this.v2n2.pitch.ps>this.v1n1.pitch.ps}},{key:"isProperResolution",value:function(){if(this.noMotion())return!0;var a=void 0,b=void 0,c=void 0;if(void 0!==this.key&&(a=this.key.getScale(),b=a.getScaleDegreeFromPitch(this.v2n1),c=a.getScaleDegreeFromPitch(this.v2n2)),void 0!==this.key&&"minor"===this.key.mode&&(void 0===b||void 0===c)){var d=this.key.getScale("melodic-minor");void 0===b&&(b=d.getScaleDegreeFromPitch(this.v2n1)),void 0===c&&(c=d.getScaleDegreeFromPitch(this.v2n2))}var e=this.vIntervals[0].simpleName,f=this.vIntervals[1].generic.simpleUndirected;return"P4"===e?this.v1n1.pitch.ps>=this.v1n2.pitch.ps:"d5"===e?void 0!==a&&7!==b||(void 0===a||1===c)&&(this.inwardContraryMotion()&&3===f):"A4"===e?void 0!==a&&4!==b||(void 0===a||3===c)&&(this.outwardContraryMotion()&&6===f):"m7"!==e||(void 0!==a&&5!==b||(void 0===a||1===c)&&3===f)}},{key:"v1n1",get:function(){return this._v1n1},set:function(a){this._setVoiceNote(a,"_v1n1")}},{key:"v1n2",get:function(){return this._v1n2},set:function(a){this._setVoiceNote(a,"_v1n2")}},{key:"v2n1",get:function(){return this._v2n1},set:function(a){this._setVoiceNote(a,"_v2n1")}},{key:"v2n2",get:function(){return this._v2n2},set:function(a){this._setVoiceNote(a,"_v2n2")}},{key:"key",get:function(){return this._key},set:function(a){"string"==typeof a&&(a=new Yc.Key(Yc.convertKeyStringToMusic21KeyString(a))),this._key=a}}]),b}(ia),Pe={VoiceLeadingQuartet:Oe},Qe={};Qe.selectedOutputPort=void 0,Qe.selectedInputPort=void 0,Qe.access=void 0,Qe.$selectDiv=void 0,Qe.jazzDownloadUrl="http://jazz-soft.net/download/Jazz-Plugin/",Qe.storedPlugin=void 0,Qe.selectedJazzInterface=void 0,Qe.jazzMidiInArrived=function(a,b,c,d){var e={timestamp:a,data:[b,c,d]};return Qe.midiInArrived(e)},Qe.midiInArrived=function(a){var b=a.timeStamp,c=a.data[0],d=a.data[1],e=a.data[2],f=te.callBacks.raw(b,c,d,e);return te.callBacks.general instanceof Array?te.callBacks.general.forEach(function(a,b,c){a(f)}):void 0!==te.callBacks.general?te.callBacks.general(f):void 0},Qe.createPlugin=function(a,b){if(Qe.storedPlugin&&!0!==b)return Qe.storedPlugin;void 0===a&&(a=c("body")[0]);var d=document.createElement("object");return d.classid="CLSID:1ACE1618-1C7D-4561-AEE1-34842AA85E90",d.isJazz||(d.type="audio/x-jazz"),d.style.visibility="hidden",d.style.width="0px",d.style.height="0px",a.appendChild(d),d.isJazz?(Qe.storedPlugin=d,d):(a.removeChild(d),void console.error("Cannot use jazz plugin; install at "+Qe.jazzDownloadUrl))},Qe.createJazzSelector=function(a,b){var d={};S.merge(d,b);var e=Qe.createPlugin();if(void 0!==e){a.change(function(){var a=c("#midiInSelect option:selected").text();"None selected"!==a?Qe.selectedJazzInterface=e.MidiInOpen(a,Qe.jazzMidiInArrived):e.MidiInClose(),R&&console.log("current input changed to: "+Qe.selectedInterface)});var f=e.MidiInList(),g=c("<option value='None'>None selected</option>");a.append(g);for(var h=!1,i=[],j=0;j<f.length;j++){var k=c("<option value='"+f[j]+"'>"+f[j]+"</option>");f[j]===Qe.selectedJazzInterface&&(k.attr("selected",!0),h=!0),i.push(k),a.append(k)}return!1===h&&f.length>0?(a.val(f[0]),i[0].attr("selected",!0),Qe.selectedJazzInterface=e.MidiInOpen(f[0],Qe.jazzMidiInArrived),h=!0):g.attr("selected",!0),void 0!==d.onsuccess&&d.onsuccess(),!0===h&&void 0!==d.oninputsuccess?d.oninputsuccess():!1===h&&void 0!==d.oninputempty&&d.oninputempty(),a
}},Qe.selectionChanged=function(){var a=Qe.$select.val();if(a===Qe.selectedInputPort)return!1;var b=Qe.access.onstatechange;return Qe.access.onstatechange=function(){},R&&console.log("current input changed to: "+a),Qe.selectedInputPort=a,Qe.access.inputs.forEach(function(b){b.name===a?b.onmidimessage=Qe.midiInArrived:b.close()}),Qe.access.onstatechange=b,!1},Qe.createSelector=function(a,b){var d={autoUpdate:!0,existingMidiSelect:!1};S.merge(d,b),void 0===a&&(a=c("body")),void 0===a.jquery&&(a=c(a));var e=void 0,f=a.find("select#midiInSelect");return f.length>0?(e=f[0],d.existingMidiSelect=!0):(e=c("<select>").attr("id","midiInSelect"),a.append(e)),Qe.$select=e,void 0===navigator.requestMIDIAccess?Qe.createJazzSelector(e,d):(!0!==d.existingMidiSelect&&e.change(Qe.selectionChanged),navigator.requestMIDIAccess().then(function(a){Qe.access=a,Qe.populateSelect(),d.autoUpdate&&(a.onstatechange=Qe.populateSelect),Qe.$select.change(),void 0!==d.onsuccess&&d.onsuccess(),"None"!==Qe.selectedInputPort&&void 0!==d.oninputsuccess?d.oninputsuccess():"None"===Qe.selectedInputPort&&void 0!==d.oninputempty&&d.oninputempty()},function(b){a.html(b.message)})),te.clearOldChords(),e},Qe.populateSelect=function(){var a=Qe.access.inputs;Qe.$select.empty();var b=c("<option value='None'>None selected</option>");Qe.$select.append(b);var d=[],e=[],f=0;a.forEach(function(a){var b=c("<option value='"+a.name+"'>"+a.name+"</option>");d.push(b),e.push(a.name),Qe.$select.append(b),f+=1}),d.length>0?(Qe.$select.val(e[0]),d[0].attr("selected",!0)):b.attr("selected",!0),Qe.$select.change()},Qe.callBacks=te.callBacks;var Re={common:S,debug:R,prebase:V,base:ha,articulations:ja,audioRecording:za,audioSearch:wa,bar:Fa,beam:Ga,chord:yc,chordTables:xc,clef:Ac,converter:be,derivation:Y,dynamics:ce,duration:Z,exceptions21:Q,expressions:ee,figuredBass:me,fromPython:pe,harmony:se,instrument:bd,interval:Ta,key:Yc,keyboard:we,layout:Be,meter:_c,miditools:te,musicxml:Ge,note:Ma,pitch:Ja,renderOptions:dd,roman:He,scale:Xc,sites:ga,stream:Md,tempo:Je,tie:Ud,tinyNotation:Le,voiceLeading:Pe,vfShow:gd,webmidi:Qe};return Re.Music21Object=ha.Music21Object,Re});
//# sourceMappingURL=music21.min.js.map