function asyncGeneratorStep(t,e,i,n,r,o,s){try{var a=t[o](s),u=a.value}catch(l){return void i(l)}a.done?e(u):Promise.resolve(u).then(n,r)}function _asyncToGenerator(t){return function(){var e=this,i=arguments;return new Promise((function(n,r){var o=t.apply(e,i);function s(t){asyncGeneratorStep(o,n,r,s,a,"next",t)}function a(t){asyncGeneratorStep(o,n,r,s,a,"throw",t)}s(void 0)}))}}function _assertThisInitialized2(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _wrapNativeSuper2(t){var e="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper2=function(t){if(null===t||!_isNativeFunction2(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return _construct2(t,arguments,_getPrototypeOf2(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf2(i,t)})(t)}function _construct2(t,e,i){return(_construct2=_isNativeReflectConstruct()?Reflect.construct:function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&_setPrototypeOf2(r,i.prototype),r}).apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function _isNativeFunction2(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function _getPrototypeOf2(t){return(_getPrototypeOf2=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _inheritsLoose(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,_setPrototypeOf2(t,e)}function _setPrototypeOf2(t,e){return(_setPrototypeOf2=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _createForOfIteratorHelperLoose(t,e){var i;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=_unsupportedIterableToArray(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(i=t[Symbol.iterator]()).next.bind(i)}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i1&&(e[i[0].trim()]=i[1].trim())}})),e}function l(t){var e="";if(L(t))e=t;else if(T(t))for(var i=0;i-1&&t.splice(i,1)},E=Object.prototype.hasOwnProperty,w=function(t,e){return E.call(t,e)},T=Array.isArray,M=function(t){return"[object Map]"===N(t)},P=function(t){return"function"==typeof t},L=function(t){return"string"==typeof t},I=function(t){return"symbol"==typeof t},A=function(t){return null!==t&&"object"==typeof t},C=function(t){return A(t)&&P(t.then)&&P(t.catch)},R=Object.prototype.toString,N=function(t){return R.call(t)},k=function(t){return N(t).slice(8,-1)},F=function(t){return L(t)&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t},O=i(",key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),B=function(t){var e=Object.create(null);return function(i){return e[i]||(e[i]=t(i))}},D=/-(\w)/g,V=B((function(t){return t.replace(D,(function(t,e){return e?e.toUpperCase():""}))})),G=/\B([A-Z])/g,W=B((function(t){return t.replace(G,"-$1").toLowerCase()})),H=B((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})),U=B((function(t){return t?"on"+H(t):""})),z=function(t,e){return t!==e&&(t==t||e==e)},j=function(t,e){for(var i=0;i=n)&&u(t)}));else switch(void 0!==i&&u(s.get(i)),e){case"add":T(t)?F(i)&&u(s.get("length")):(u(s.get(J)),M(t)&&u(s.get(Z)));break;case"delete":T(t)||(u(s.get(J)),M(t)&&u(s.get(Z)));break;case"set":M(t)&&u(s.get(J))}a.forEach((function(s){s.options.onTrigger&&s.options.onTrigger({effect:s,target:t,key:i,type:e,newValue:n,oldValue:r,oldTarget:o}),s.options.scheduler?s.options.scheduler(s):s()}))}}var ut=i("__proto__,__v_isRef,__isVue"),lt=new Set(Object.getOwnPropertyNames(Symbol).map((function(t){return Symbol[t]})).filter(I)),ct=mt(),ht=mt(!1,!0),ft=mt(!0),dt=mt(!0,!0),pt={};function mt(t,e){return void 0===t&&(t=!1),void 0===e&&(e=!1),function(i,n,r){if("__v_isReactive"===n)return!t;if("__v_isReadonly"===n)return t;if("__v_raw"===n&&r===(t?zt:Ut).get(i))return i;var o=T(i);if(!t&&o&&w(pt,n))return Reflect.get(pt,n,r);var s=Reflect.get(i,n,r);return(I(n)?lt.has(n):ut(n))?s:(t||st(i,"get",n),e?s:te(s)?!o||!F(n)?s.value:s:A(s)?t?Xt(s):jt(s):s)}}function vt(t){return void 0===t&&(t=!1),function(e,i,n,r){var o=e[i];if(!t&&(n=Qt(n),!T(e)&&te(o)&&!te(n)))return o.value=n,!0;var s=T(e)&&F(i)?Number(i)1?r-1:0),s=1;s"})).join("\n"),n]);else{var a,u=["[Vue warn]: "+t].concat(o);n.length&&u.push.apply(u,["\n"].concat(de(n))),(a=console).warn.apply(a,u)}ot()}function fe(){var t=ue[ue.length-1];if(!t)return[];for(var e=[];t;){var i=e[0];i&&i.vnode===t?i.recurseCount++:e.push({vnode:t,recurseCount:0});var n=t.component&&t.component.parent;t=n&&n.vnode}return e}function de(t){var e=[];return t.forEach((function(t,i){var n,r,o,s,a,u,l,c,h,f;e.push.apply(e,(0===i?[]:["\n"]).concat((a=(s=t).vnode,u=s.recurseCount,l=u>0?"... ("+u+" recursive calls)":"",c=!!a.component&&null==a.component.parent,h=" at <"+Ar(a.component,a.type,c),f=">"+l,a.props?[h].concat((n=a.props,r=[],(o=Object.keys(n)).slice(0,3).forEach((function(t){r.push.apply(r,pe(t,n[t]))})),o.length>3&&r.push(" ..."),r),[f]):[h+f])))})),e}function pe(t,e,i){return L(e)?(e=JSON.stringify(e),i?e:[t+"="+e]):"number"==typeof e||"boolean"==typeof e||null==e?i?e:[t+"="+e]:te(e)?(e=pe(t,Qt(e.value),!0),i?e:[t+"=Ref<",e,">"]):P(e)?[t+"=fn"+(e.name?"<"+e.name+">":"")]:(e=Qt(e),i?e:[t+"=",e])}var me=((e={}).bc="beforeCreate hook",e.c="created hook",e.bm="beforeMount hook",e.m="mounted hook",e.bu="beforeUpdate hook",e.u="updated",e.bum="beforeUnmount hook",e.um="unmounted hook",e.a="activated hook",e.da="deactivated hook",e.ec="errorCaptured hook",e.rtc="renderTracked hook",e.rtg="renderTriggered hook",e[0]="setup function",e[1]="render function",e[2]="watcher getter",e[3]="watcher callback",e[4]="watcher cleanup function",e[5]="native event handler",e[6]="component event handler",e[7]="vnode hook",e[8]="directive hook",e[9]="transition hook",e[10]="app errorHandler",e[11]="app warnHandler",e[12]="ref function",e[13]="async component loader",e[14]="scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next",e);function ve(t,e,i,n){var r;try{r=n?t.apply(void 0,n):t()}catch(o){ge(o,e,i)}return r}function be(t,e,i,n){if(P(t)){var r=ve(t,e,i,n);return r&&C(r)&&r.catch((function(t){ge(t,e,i)})),r}for(var o=[],s=0;s100)throw new Error("Maximum recursive updates exceeded. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.");t.set(e,i+1)}else t.set(e,1)}var He=!1,Ue=new Set;("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}).__VUE_HMR_RUNTIME__={createRecord:Ye(Xe),rerender:Ye((function(t,e){var i=je.get(t);if(!i)return;e&&(i.component.render=e);Array.from(i.instances).forEach((function(t){e&&(t.render=e),t.renderCache=[],He=!0,t.update(),He=!1}))})),reload:Ye((function(t,e){var i=je.get(t);if(!i)return;var n=i.component,r=i.instances;if(!Ue.has(n)){for(var o in e=Cr(e)?e.__vccOpts:e,_(n,e),n)o in e||delete n[o];Ue.add(n),Oe((function(){Ue.delete(n)}))}Array.from(r).forEach((function(t){t.parent?Ne(t.parent.update):t.appContext.reload?t.appContext.reload():"undefined"!=typeof window?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required.")}))}))};var ze,je=new Map;function Xe(t,e){return e||(he("HMR API usage is out of date.\nPlease upgrade vue-loader/vite/rollup-plugin-vue or other relevant dependency that handles Vue SFC compilation."),e={}),!je.has(t)&&(je.set(t,{component:Cr(e)?e.__vccOpts:e,instances:new Set}),!0)}function Ye(t){return function(e,i){try{return t(e,i)}catch(n){console.error(n),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}var Ke=Ze("component:added"),qe=Ze("component:updated"),Je=Ze("component:removed");function Ze(t){return function(e){ze&&ze.emit(t,e.appContext.app,e.uid,e.parent?e.parent.uid:void 0,e)}}function Qe(t,e,i){ze&&ze.emit("component:emit",t.appContext.app,t,e,i)}function $e(t,e){for(var i=t.vnode.props||p,n=arguments.length,r=new Array(n>2?n-2:0),o=2;o1?g(s,{get attrs(){return oi(),l},slots:u,emit:c}):g(s,null)),v=i.props?l:li(l)}var _=e,x=void 0;if(e.patchFlag>0&&2048&e.patchFlag){var E=ai(e);_=E[0],x=E[1]}if(!1!==i.inheritAttrs&&v){var w=Object.keys(v),T=_.shapeFlag;if(w.length)if(1&T||6&T)a&&w.some(S)&&(v=ci(v,a)),_=qn(_,v);else if(!ri&&_.type!==On){for(var M=Object.keys(l),P=[],L=[],I=0,A=M.length;I renders non-element root node that cannot be animated."),_.transition=n.transition),x?x(_):e=_}catch(R){ge(R,t,1),e=Yn(On)}return ii=null,e}var ai=function(t){var e=t.children,i=t.dynamicChildren,n=ui(e);if(!n)return[t,void 0];var r=e.indexOf(n),o=i?i.indexOf(n):-1;return[Qn(n),function(n){e[r]=n,i&&(o>-1?i[o]=n:n.patchFlag>0&&(t.dynamicChildren=[].concat(i,[n])))}]};function ui(t){for(var e,i=0;i slots expect a single root node."),t=e}return Qn(t)}var pi=0,mi=function(t){return pi+=t};function vi(t,e,i,n){void 0===n&&(n=!1);var r={},o={};X(o,zn,1),bi(t,e,r,o),wi(r,t),i?t.props=n?r:Kt(r,!1,yt,Gt):t.type.props?t.props=r:t.props=o,t.attrs=o}function bi(t,e,i,n){var r=t.propsOptions,o=r[0],s=r[1];if(e)for(var a in e){var u=e[a];if(!O(a)){var l=void 0;o&&w(o,l=V(a))?i[l]=u:ei(t.emitsOptions,a)||(n[a]=u)}}if(s)for(var c=Qt(i),h=0;h-1,d[1]=b<0||v-1||w(d,"default"))&&o.push(h)}}}return t.__props=[r,o]}function Si(t){return"$"!==t[0]||(he('Invalid prop name: "'+t+'" is a reserved property.'),!1)}function _i(t){var e=t&&t.toString().match(/^\s*function (\w+)/);return e?e[1]:""}function xi(t,e){return _i(t)===_i(e)}function Ei(t,e){if(T(e)){for(var i=0,n=e.length;i1&&he(" can only be used on a single element or component. Use for lists.");var s=Qt(t),a=s.mode;a&&!["in-out","out-in","default"].includes(a)&&he("invalid mode: "+a);var u=e[0];if(o.isLeaving)return qi(u);var l=Ji(u);if(!l)return qi(u);var c=Ki(l,s,o,r);Zi(l,c);var h=r.subTree,f=h&&Ji(h),d=!1,p=l.type.getTransitionKey;if(p){var m=p();void 0===i?i=m:m!==i&&(i=m,d=!0)}if(f&&f.type!==On&&(!Un(l,f)||d)){var v=Ki(f,s,o,r);if(Zi(f,v),"out-in"===a)return o.isLeaving=!0,v.afterLeave=function(){o.isLeaving=!1,r.update()},qi(u);"in-out"===a&&(v.delayLeave=function(t,e,i){Yi(o,f)[String(f.key)]=f,t._leaveCb=function(){e(),t._leaveCb=void 0,delete c.delayedLeave},c.delayedLeave=i})}return u}}}};function Yi(t,e){var i=t.leavingVNodes,n=i.get(e.type);return n||(n=Object.create(null),i.set(e.type,n)),n}function Ki(t,e,i,n){var r=e.appear,o=e.mode,s=e.persisted,a=void 0!==s&&s,u=e.onBeforeEnter,l=e.onEnter,c=e.onAfterEnter,h=e.onEnterCancelled,f=e.onBeforeLeave,d=e.onLeave,p=e.onAfterLeave,m=e.onLeaveCancelled,v=e.onBeforeAppear,b=e.onAppear,g=e.onAfterAppear,y=e.onAppearCancelled,S=String(t.key),_=Yi(i,t),x=function(t,e){t&&be(t,n,9,e)},E={mode:o,persisted:a,beforeEnter:function(e){var n=u;if(!i.isMounted){if(!r)return;n=v||u}e._leaveCb&&e._leaveCb(!0);var o=_[S];o&&Un(t,o)&&o.el._leaveCb&&o.el._leaveCb(),x(n,[e])},enter:function(t){var e=l,n=c,o=h;if(!i.isMounted){if(!r)return;e=b||l,n=g||c,o=y||h}var s=!1,a=t._enterCb=function(e){s||(s=!0,x(e?o:n,[t]),E.delayedLeave&&E.delayedLeave(),t._enterCb=void 0)};e?(e(t,a),e.length<=1&&a()):a()},leave:function(e,n){var r=String(t.key);if(e._enterCb&&e._enterCb(!0),i.isUnmounting)return n();x(f,[e]);var o=!1,s=e._leaveCb=function(i){o||(o=!0,n(),x(i?m:p,[e]),e._leaveCb=void 0,_[r]===t&&delete _[r])};_[r]=t,d?(d(e,s),d.length<=1&&s()):s()},clone:function(t){return Ki(t,e,i,n)}};return E}function qi(t){if($i(t))return(t=qn(t)).children=null,t}function Ji(t){return $i(t)?t.children?t.children[0]:void 0:t}function Zi(t,e){6&t.shapeFlag&&t.component?Zi(t.component.subTree,e):128&t.shapeFlag?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function Qi(t,e){void 0===e&&(e=!1);for(var i=[],n=0,r=0;r1)for(var s=0;s1?e-1:0),n=1;n createApp(App)`")},unmount:function(){s?(t(null,a._container),function(t){ze&&ze.emit("app:unmount",t)}(a),delete a._container.__vue_app__):he("Cannot unmount an app that is not mounted.")},provide:function(t,e){return t in r.provides&&he('App already provides property with key "'+String(t)+'". It will be overwritten with the new value.'),r.provides[t]=e,a}};return a}}function yn(t,e){t.appContext.config.performance&&_n()&&vn.mark("vue-"+e+"-"+t.uid)}function Sn(t,e){if(t.appContext.config.performance&&_n()){var i="vue-"+e+"-"+t.uid,n=i+":end";vn.mark(n),vn.measure("<"+Ar(t,t.type)+"> "+e,i,n),vn.clearMarks(i),vn.clearMarks(n)}}function _n(){return void 0!==mn||("undefined"!=typeof window&&window.performance?(mn=!0,vn=window.performance):mn=!1),mn}function xn(t){return P(t)?{setup:t,name:t.name}:t}var En=function(t,e){var i;e&&e.pendingBranch?T(t)?(i=e.effects).push.apply(i,t):e.effects.push(t):Oe(t)},wn=function t(e,i,n,r){if(T(e))e.forEach((function(e,o){return t(e,i&&(T(i)?i[o]:i),n,r)}));else{var o;o=!r||function(t){return!!t.type.__asyncLoader}(r)?null:4&r.shapeFlag?r.component.exposed||r.component.proxy:r.el;var s=e.i,a=e.r;if(s){var u=i&&i.r,l=s.refs===p?s.refs={}:s.refs,c=s.setupState;if(null!=u&&u!==a&&(L(u)?(l[u]=null,w(c,u)&&(c[u]=null)):te(u)&&(u.value=null)),L(a)){var h=function(){l[a]=o,w(c,a)&&(c[a]=o)};o?(h.id=-1,En(h,n)):h()}else if(te(a)){var f=function(){a.value=o};o?(f.id=-1,En(f,n)):f()}else P(a)?ve(a,s,12,[o,l]):he("Invalid template ref type:",o,"("+typeof o+")")}else he("Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.")}};function Tn(t){return function(t,e){var i,n,r=t.insert,o=t.remove,s=t.patchProp,a=t.forcePatchProp,u=t.createElement,l=t.createText,c=t.createComment,h=t.setText,f=t.setElementText,d=t.parentNode,b=t.nextSibling,g=t.setScopeId,y=void 0===g?v:g,S=(t.cloneNode,t.insertStaticContent),x=function(t,e,i,n,r,o,s,a){void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=!1),void 0===a&&(a=!1),t&&!Un(t,e)&&(n=lt(t),et(t,r,o,!0),t=null),-2===e.patchFlag&&(a=!1,e.dynamicChildren=null);var u=e.type,l=e.ref,c=e.shapeFlag;switch(u){case Fn:E(t,e,i,n);break;case On:T(t,e,i,n);break;case Bn:null==t?M(e,i,n,s):P(t,e,i,s);break;case kn:G(t,e,i,n,r,o,s,a);break;default:1&c?A(t,e,i,n,r,o,s,a):6&c?H(t,e,i,n,r,o,s,a):64&c||128&c?u.process(t,e,i,n,r,o,s,a,ht):he("Invalid VNode type:",u,"("+typeof u+")")}null!=l&&r&&wn(l,t&&t.ref,o,e)},E=function(t,e,i,n){if(null==t)r(e.el=l(e.children),i,n);else{var o=e.el=t.el;e.children!==t.children&&h(o,e.children)}},T=function(t,e,i,n){null==t?r(e.el=c(e.children||""),i,n):e.el=t.el},M=function(t,e,i,n){var r=S(t.children,e,i,n);t.el=r[0],t.anchor=r[1]},P=function(t,e,i,n){if(e.children!==t.children){var r=b(t.anchor);I(t);var o=S(e.children,i,r,n);e.el=o[0],e.anchor=o[1]}else e.el=t.el,e.anchor=t.anchor},L=function(t,e,i){for(var n,o=t.el,s=t.anchor;o&&o!==s;)n=b(o),r(o,e,i),o=n;r(s,e,i)},I=function(t){for(var e,i=t.el,n=t.anchor;i&&i!==n;)e=b(i),o(i),i=e;o(n)},A=function(t,e,i,n,r,o,s,a){s=s||"svg"===e.type,null==t?R(e,i,n,r,o,s,a):F(t,e,r,o,s,a)},R=function(t,e,i,n,o,a,l){var c,h,d=t.type,p=t.props,m=t.shapeFlag,v=t.transition,b=t.scopeId,g=(t.patchFlag,t.dirs);if(c=t.el=u(t.type,a,p&&p.is),8&m?f(c,t.children):16&m&&k(t.children,c,null,n,o,a&&"foreignObject"!==d,l||!!t.dynamicChildren),g&&dn(t,null,n,"created"),p){for(var y in p)O(y)||s(c,y,null,p[y],a,t.children,n,o,ut);(h=p.onVnodeBeforeMount)&&Mn(h,n,t)}N(c,b,t,n),Object.defineProperty(c,"__vnode",{value:t,enumerable:!1}),Object.defineProperty(c,"__vueParentComponent",{value:n,enumerable:!1}),g&&dn(t,null,n,"beforeMount");var S=(!o||o&&!o.pendingBranch)&&v&&!v.persisted;S&&v.beforeEnter(c),r(c,e,i),((h=p&&p.onVnodeMounted)||S||g)&&En((function(){h&&Mn(h,n,t),S&&v.enter(c),g&&dn(t,null,n,"mounted")}),o)},N=function t(e,i,n,r){if(i&&y(e,i),r){var o=r.type.__scopeId;o&&o!==i&&y(e,o+"-s");var s=r.subTree;s.type===kn&&(s=ui(s.children)||s),n===s&&t(e,r.vnode.scopeId,r.vnode,r.parent)}},k=function(t,e,i,n,r,o,s,a){void 0===a&&(a=0);for(var u=a;u0){if(16&l)D(u,e,m,v,i,n,r);else if(2&l&&m.class!==v.class&&s(u,"class",null,v.class,r),4&l&&s(u,"style",m.style,v.style,r),8&l)for(var b=e.dynamicProps,g=0;g0&&(u=!0),He&&(f=0,u=!1,d=null),null==t?(r(c,i,n),r(h,i,n),k(e.children,i,h,o,s,a,u)):f>0&&64&f&&d&&t.dynamicChildren?(B(t.dynamicChildren,d,i,o,s,a),o&&o.type.__hmrId?Pn(t,e):(null!=e.key||o&&e===o.subTree)&&Pn(t,e,!0)):q(t,e,i,h,o,s,a,u)},H=function(t,e,i,n,r,o,s,a){null==t?512&e.shapeFlag?r.ctx.activate(e,i,n,s,a):U(e,i,n,r,o,s,a):z(t,e,a)},U=function(t,e,i,n,r,o,s){var a=t.component=function(t,e,i){var n=t.type,r=(e?e.appContext:t.appContext)||vr,o={uid:br++,vnode:t,type:n,parent:e,appContext:r,root:null,next:null,subTree:null,update:null,render:null,proxy:null,exposed:null,withProxy:null,effects:null,provides:e?e.provides:Object.create(r.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:yi(n,r),emitsOptions:ti(n,r),emit:null,emitted:null,ctx:p,data:p,props:p,attrs:p,slots:p,refs:p,setupState:p,setupContext:null,suspense:i,suspenseId:i?i.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null};return o.ctx=function(t){var e={};Object.defineProperty(e,"_",{configurable:!0,enumerable:!1,get:function(){return t}}),Object.keys(dr).forEach((function(i){Object.defineProperty(e,i,{configurable:!0,enumerable:!1,get:function(){return dr[i](t)},set:v})}));var i=t.appContext.config.globalProperties;return Object.keys(i).forEach((function(t){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get:function(){return i[t]},set:v})})),e}(o),o.root=e?e.root:o,o.emit=$e.bind(null,o),o}(t,n,r);if(a.type.__hmrId&&function(t){var e=t.type.__hmrId,i=je.get(e);i||(Xe(e,t.type),i=je.get(e)),i.instances.add(t)}(a),le(t),yn(a,"mount"),$i(t)&&(a.ctx.renderer=ht),yn(a,"init"),function(t,e){void 0===e&&(e=!1);wr=e;var i=t.vnode,n=i.props,r=i.children,o=Er(t);vi(t,n,o,e),function(t,e){if(32&t.vnode.shapeFlag){var i=e._;i?(t.slots=e,X(e,"_",i)):un(e,t.slots={})}else t.slots={},e&&ln(t,e);X(t.slots,zn,1)}(t,r);var s=o?function(t,e){var i=t.type;i.name&&xr(i.name,t.appContext.config);if(i.components)for(var n=Object.keys(i.components),r=0;r1?function(t){var e=function(e){t.exposed&&he("expose() should be called only once per setup()."),t.exposed=oe(e)};return Object.freeze({get props(){return t.props},get attrs(){return new Proxy(t.attrs,Pr)},get slots(){return Yt(t.slots)},get emit(){return function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r=0))return!(!r&&!a||a&&a.$stable)||n!==s&&(n?!s||fi(n,s,l):!!s);if(1024&u)return!0;if(16&u)return n?fi(n,s,l):!!s;if(8&u)for(var c=e.dynamicProps,h=0;h-1&&_e.splice(e,1)}(n.update),n.update()}else e.component=t.component,e.el=t.el,n.vnode=e},Y=function(t,e,i,r,o,s,a){t.update=Q((function(){if(t.isMounted){var u,l=t.next,c=t.bu,h=t.u,f=t.parent,p=t.vnode,m=l;le(l||t.vnode),l?(l.el=p.el,K(t,l,a)):l=p,c&&j(c),(u=l.props&&l.props.onVnodeBeforeUpdate)&&Mn(u,f,l,p),yn(t,"render");var v=si(t);Sn(t,"render");var b=t.subTree;t.subTree=v,yn(t,"patch"),x(b,v,d(b.el),lt(b),t,o,s),Sn(t,"patch"),l.el=v.el,null===m&&function(t,e){for(var i=t.vnode,n=t.parent;n&&n.subTree===i;)(i=n.vnode).el=e,n=n.parent}(t,v.el),h&&En(h,o),(u=l.props&&l.props.onVnodeUpdated)&&En((function(){Mn(u,f,l,p)}),o),qe(t),ce()}else{var g,y=e,S=y.el,_=y.props,E=t.bm,w=t.m,T=t.parent;E&&j(E),(g=_&&_.onVnodeBeforeMount)&&Mn(g,T,e),yn(t,"render");var M=t.subTree=si(t);if(Sn(t,"render"),S&&n?(yn(t,"hydrate"),n(e.el,M,t,o),Sn(t,"hydrate")):(yn(t,"patch"),x(null,M,i,r,t,o,s),Sn(t,"patch"),e.el=M.el),w&&En(w,o),g=_&&_.onVnodeMounted){var P=e;En((function(){Mn(g,T,P)}),o)}var L=t.a;L&&256&e.shapeFlag&&En(L,o),t.isMounted=!0,Ke(t),e=i=r=null}}),function(t){return{scheduler:Ne,allowRecurse:!0,onTrack:t.rtc?function(e){return j(t.rtc,e)}:void 0,onTrigger:t.rtg?function(e){return j(t.rtg,e)}:void 0}}(t))},K=function(t,e,i){e.component=t;var n=t.vnode.props;t.vnode=e,t.next=null,function(t,e,i,n){var r=t.props,o=t.attrs,s=t.vnode.patchFlag,a=Qt(r),u=t.propsOptions[0];if(t.type.__hmrId||t.parent&&t.parent.type.__hmrId||!(n||s>0)||16&s){var l;for(var c in bi(t,e,r,o),a)e&&(w(e,c)||(l=W(c))!==c&&w(e,l))||(u?!i||void 0===i[c]&&void 0===i[l]||(r[c]=gi(u,e||p,c,void 0,t)):delete r[c]);if(o!==a)for(var h in o)e&&w(e,h)||delete o[h]}else if(8&s)for(var f=t.vnode.dynamicProps,d=0;d0){if(128&h)return void Z(u,c,i,n,r,o,s,a);if(256&h)return void J(u,c,i,n,r,o,s,a)}8&d?(16&l&&ut(u,r,o),c!==u&&f(i,c)):16&l?16&d?Z(u,c,i,n,r,o,s,a):ut(u,r,o,!0):(8&l&&f(i,""),16&d&&k(c,i,n,r,o,s,a))},J=function(t,e,i,n,r,o,s,a){e=e||m;var u,l=(t=t||m).length,c=e.length,h=Math.min(l,c);for(u=0;uc?ut(t,r,o,!0,!1,h):k(e,i,n,r,o,s,a,h)},Z=function(t,e,i,n,r,o,s,a){for(var u=0,l=e.length,c=t.length-1,h=l-1;u<=c&&u<=h;){var f=t[u],d=e[u]=a?$n(e[u]):Qn(e[u]);if(!Un(f,d))break;x(f,d,i,null,r,o,s,a),u++}for(;u<=c&&u<=h;){var p=t[c],v=e[h]=a?$n(e[h]):Qn(e[h]);if(!Un(p,v))break;x(p,v,i,null,r,o,s,a),c--,h--}if(u>c){if(u<=h)for(var b=h+1,g=bh)for(;u<=c;)et(t[u],r,o,!0),u++;else{var y,S=u,_=u,E=new Map;for(u=_;u<=h;u++){var w=e[u]=a?$n(e[u]):Qn(e[u]);null!=w.key&&(E.has(w.key)&&he("Duplicate keys found during update:",JSON.stringify(w.key),"Make sure keys are unique."),E.set(w.key,u))}var T=0,M=h-_+1,P=!1,L=0,I=new Array(M);for(u=0;u=M)et(A,r,o,!0);else{var C=void 0;if(null!=A.key)C=E.get(A.key);else for(y=_;y<=h;y++)if(0===I[y-_]&&Un(A,e[y])){C=y;break}void 0===C?et(A,r,o,!0):(I[C-_]=u+1,C>=L?L=C:P=!0,x(A,e[C],i,null,r,o,s,a),T++)}}var R=P?function(t){var e,i,n,r,o,s=t.slice(),a=[0],u=t.length;for(e=0;e0&&(s[e]=a[n-1]),a[n]=e)}}n=a.length,r=a[n-1];for(;n-- >0;)a[n]=r,r=s[r];return a}(I):m;for(y=R.length-1,u=M-1;u>=0;u--){var N=_+u,k=e[N],F=N+10&&64&h)?ut(l,e,i,!1,!0):(o===kn&&(128&h||256&h)||!r&&16&c)&&ut(u,e,i),64&c&&(n||!Ln(t.props))&&t.type.remove(t,ht),n&&it(t)}((d=s&&s.onVnodeUnmounted)||p)&&En((function(){d&&Mn(d,e,t),p&&dn(t,null,e,"unmounted")}),i)}},it=function(t){var e=t.type,i=t.el,n=t.anchor,r=t.transition;if(e!==kn)if(e!==Bn){var s=function(){o(i),r&&!r.persisted&&r.afterLeave&&r.afterLeave()};if(1&t.shapeFlag&&r&&!r.persisted){var a=r.leave,u=r.delayLeave,l=function(){return a(i,s)};u?u(t.el,s,l):l()}else s()}else I(t);else nt(i,n)},nt=function(t,e){for(var i;t!==e;)i=b(t),o(t),t=i;o(e)},st=function(t,e,i){t.type.__hmrId&&function(t){je.get(t.type.__hmrId).instances.delete(t)}(t);var n=t.bum,r=t.effects,o=t.update,s=t.subTree,a=t.um;if(n&&j(n),r)for(var u=0;u0||6&d)&&32!==n&&Vn.push(p),p}function qn(t,e,i){var n;void 0===i&&(i=!1);var r=t.props,o=t.ref,s=t.patchFlag,a=t.children,u=e?er(r||{},e):r;return(n={__v_isVNode:!0}).__v_skip=!0,n.type=t.type,n.props=u,n.key=u&&jn(u),n.ref=e&&e.ref?i&&o?T(o)?o.concat(Xn(e)):[o,Xn(e)]:Xn(e):o,n.scopeId=t.scopeId,n.children=-1===s&&T(a)?a.map(Jn):a,n.target=t.target,n.targetAnchor=t.targetAnchor,n.staticCount=t.staticCount,n.shapeFlag=t.shapeFlag,n.patchFlag=e&&t.type!==kn?-1===s?16:16|s:s,n.dynamicProps=t.dynamicProps,n.dynamicChildren=t.dynamicChildren,n.appContext=t.appContext,n.dirs=t.dirs,n.transition=t.transition,n.component=t.component,n.suspense=t.suspense,n.ssContent=t.ssContent&&qn(t.ssContent),n.ssFallback=t.ssFallback&&qn(t.ssFallback),n.el=t.el,n.anchor=t.anchor,n}function Jn(t){var e=qn(t);return T(t.children)&&(e.children=t.children.map(Jn)),e}function Zn(t,e){return void 0===t&&(t=" "),void 0===e&&(e=0),Yn(Fn,null,t,e)}function Qn(t){return null==t||"boolean"==typeof t?Yn(On):T(t)?Yn(kn,null,t):"object"==typeof t?null===t.el?t:qn(t):Yn(Fn,null,String(t))}function $n(t){return null===t.el?t:qn(t)}function tr(t,e){var i=0,n=t.shapeFlag;if(null==e)e=null;else if(T(e))i=16;else if("object"==typeof e){if(1&n||64&n){var r=e.default;return void(r&&(r._c&&mi(1),tr(t,r()),r._c&&mi(-1)))}i=32;var o=e._;o||zn in e?3===o&&ii&&(1024&ii.vnode.patchFlag?(e._=2,t.patchFlag|=1024):e._=1):e._ctx=ii}else P(e)?(e={default:e,_ctx:ii},i=32):(e=String(e),64&n?(i=16,e=[Zn(e)]):i=8);t.children=e,t.shapeFlag|=i}function er(){for(var t=_({},arguments.length<=0?void 0:arguments[0]),e=1;e1)return i&&P(e)?e():e;he('injection "'+String(t)+'" not found.')}else he("inject() can only be used inside setup() or functional components.")}var nr=!1;function rr(t,e,i,n,r,o){void 0===i&&(i=[]),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===o&&(o=!1);var s=e.mixins,a=e.extends,u=e.data,l=e.computed,c=e.methods,h=e.watch,f=e.provide,d=e.inject,m=e.components,b=e.directives,g=e.beforeMount,y=e.mounted,S=e.beforeUpdate,x=e.updated,E=e.activated,w=e.deactivated,M=e.beforeDestroy,L=e.beforeUnmount,I=e.destroyed,C=e.unmounted,R=e.render,N=e.renderTracked,k=e.renderTriggered,F=e.errorCaptured,O=e.expose,B=t.proxy,D=t.ctx,V=t.appContext.mixins;o&&R&&t.render===v&&(t.render=R),o||(nr=!0,or("beforeCreate","bc",e,t,V),nr=!1,ur(t,V,i,n,r)),a&&rr(t,a,i,n,r,!0),s&&ur(t,s,i,n,r);var G,W,H,U=(G=Object.create(null),function(t,e){G[e]?he(t+' property "'+e+'" is already defined in '+G[e]+"."):G[e]=t}),z=t.propsOptions[0];if(z)for(var j in z)U("Props",j);if(d)if(T(d))for(var X=0;X."),A(n)?t.data===p?t.data=jt(n):_(t.data,n):he("data() should return an object.")}function cr(t,e,i,n){var r=n.includes(".")?function(t,e){var i=e.split(".");return function(){for(var e=t,n=0;n"]:qt(e)?["div",{},["span",t,"Reactive"],"<",s(e),">"+(Jt(e)?" (readonly)":"")]:Jt(e)?["div",{},["span",t,"Readonly"],"<",s(e),">"]:null:null},hasBody:function(t){return t&&t.__isVue},body:function(t){if(t&&t.__isVue)return["div",{}].concat(function(t){var e=[];t.type.props&&t.props&&e.push(o("props",Qt(t.props)));t.setupState!==p&&e.push(o("setup",t.setupState));t.data!==p&&e.push(o("data",Qt(t.data)));var i=a(t,"computed");i&&e.push(o("computed",i));var r=a(t,"inject");r&&e.push(o("injected",r));return e.push(["div",{},["span",{style:n.style+";opacity:0.66"},"$ (internal): "],["object",{object:t}]]),e}(t.$))}};window.devtoolsFormatters?window.devtoolsFormatters.push(r):window.devtoolsFormatters=[r]}function o(t,e){return e=_({},e),Object.keys(e).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},t],["div",{style:"padding-left:1.25em"}].concat(Object.keys(e).map((function(t){return["div",{},["span",n,t+": "],s(e[t],!1)]})))]:["span",{}]}function s(t,r){return void 0===r&&(r=!0),"number"==typeof t?["span",e,t]:"string"==typeof t?["span",i,JSON.stringify(t)]:"boolean"==typeof t?["span",n,t]:A(t)?["object",{object:r?Qt(t):t}]:["span",i,String(t)]}function a(t,e){var i=t.type;if(!P(i)){var n={};for(var r in t.ctx)u(i,r,e)&&(n[r]=t.ctx[r]);return n}}function u(t,e,i){var n=t[i];return!!(T(n)&&n.includes(e)||A(n)&&e in n)||(!(!t.extends||!u(t.extends,e,i))||(!(!t.mixins||!t.mixins.some((function(t){return u(t,e,i)})))||void 0))}function l(t){return t._shallow?"ShallowRef":t.effect?"ComputedRef":"Ref"}}var kr,Fr,Or="3.0.6",Br="http://www.w3.org/2000/svg",Dr="undefined"!=typeof document?document:null,Vr={insert:function(t,e,i){e.insertBefore(t,i||null)},remove:function(t){var e=t.parentNode;e&&e.removeChild(t)},createElement:function(t,e,i){return e?Dr.createElementNS(Br,t):Dr.createElement(t,i?{is:i}:void 0)},createText:function(t){return Dr.createTextNode(t)},createComment:function(t){return Dr.createComment(t)},setText:function(t,e){t.nodeValue=e},setElementText:function(t,e){t.textContent=e},parentNode:function(t){return t.parentNode},nextSibling:function(t){return t.nextSibling},querySelector:function(t){return Dr.querySelector(t)},setScopeId:function(t,e){t.setAttribute(e,"")},cloneNode:function(t){return t.cloneNode(!0)},insertStaticContent:function(t,e,i,n){var r=n?Fr||(Fr=Dr.createElementNS(Br,"svg")):kr||(kr=Dr.createElement("div"));r.innerHTML=t;for(var o=r.firstChild,s=o,a=s;s;)a=s,Vr.insert(s,e,i),s=r.firstChild;return[o,a]}};var Gr=/\s*!important$/;function Wr(t,e,i){if(T(i))i.forEach((function(i){return Wr(t,e,i)}));else if(e.startsWith("--"))t.setProperty(e,i);else{var n=function(t,e){var i=Ur[e];if(i)return i;var n=V(e);if("filter"!==n&&n in t)return Ur[e]=n;n=H(n);for(var r=0;rdocument.createEvent("Event").timeStamp&&(jr=function(){return performance.now()});var Xr=0,Yr=Promise.resolve(),Kr=function(){Xr=0};function qr(t,e,i,n,r){void 0===r&&(r=null);var o=t._vei||(t._vei={}),s=o[e];if(n&&s)s.value=n;else{var a=function(t){var e;if(Jr.test(t)){var i;for(e={};i=t.match(Jr);)t=t.slice(0,t.length-i[0].length),e[i[0].toLowerCase()]=!0}return[W(t.slice(2)),e]}(e),u=a[0],l=a[1];if(n)!function(t,e,i,n){t.addEventListener(e,i,n)}(t,u,o[e]=function(t,e){var i=function t(i){(i.timeStamp||jr())>=t.attached-1&&be(function(t,e){if(T(e)){var i=t.stopImmediatePropagation;return t.stopImmediatePropagation=function(){i.call(t),t._stopped=!0},e.map((function(t){return function(e){return!e._stopped&&t(e)}}))}return e}(i,t.value),e,5,[i])};return i.value=t,i.attached=function(){return Xr||(Yr.then(Kr),Xr=jr())}(),i}(n,r),l);else s&&(!function(t,e,i,n){t.removeEventListener(e,i,n)}(t,u,s,l),o[e]=void 0)}}var Jr=/(?:Once|Passive|Capture)$/;var Zr=/^on[a-z]/;var Qr="transition",$r="animation",to=function(t,e){var i=e.slots;return function(t,e,i){var n=arguments.length;return 2===n?A(e)&&!T(e)?Hn(e)?Yn(t,null,[e]):Yn(t,e):Yn(t,null,e):(n>3?i=Array.prototype.slice.call(arguments,2):3===n&&Hn(i)&&(i=[i]),Yn(t,e,i))}(Xi,function(t){var e=t.name,i=void 0===e?"v":e,n=t.type,r=t.css,o=void 0===r||r,s=t.duration,a=t.enterFromClass,u=void 0===a?i+"-enter-from":a,l=t.enterActiveClass,c=void 0===l?i+"-enter-active":l,h=t.enterToClass,f=void 0===h?i+"-enter-to":h,d=t.appearFromClass,p=void 0===d?u:d,m=t.appearActiveClass,v=void 0===m?c:m,b=t.appearToClass,g=void 0===b?f:b,y=t.leaveFromClass,S=void 0===y?i+"-leave-from":y,x=t.leaveActiveClass,E=void 0===x?i+"-leave-active":x,w=t.leaveToClass,T=void 0===w?i+"-leave-to":w,M={};for(var P in t)P in eo||(M[P]=t[P]);if(!o)return M;var L=function(t){if(null==t)return null;if(A(t))return[io(t.enter),io(t.leave)];var e=io(t);return[e,e]}(s),I=L&&L[0],C=L&&L[1],R=M.onBeforeEnter,N=M.onEnter,k=M.onEnterCancelled,F=M.onLeave,O=M.onLeaveCancelled,B=M.onBeforeAppear,D=void 0===B?R:B,V=M.onAppear,G=void 0===V?N:V,W=M.onAppearCancelled,H=void 0===W?k:W,U=function(t,e,i){ro(t,e?g:f),ro(t,e?v:c),i&&i()},z=function(t,e){ro(t,T),ro(t,E),e&&e()},j=function(t){return function(e,i){var r=t?G:N,o=function(){return U(e,t,i)};r&&r(e,o),oo((function(){ro(e,t?p:u),no(e,t?g:f),r&&r.length>1||ao(e,n,I,o)}))}};return _(M,{onBeforeEnter:function(t){R&&R(t),no(t,u),no(t,c)},onBeforeAppear:function(t){D&&D(t),no(t,p),no(t,v)},onEnter:j(!1),onAppear:j(!0),onLeave:function(t,e){var i=function(){return z(t,e)};no(t,S),document.body.offsetHeight,no(t,E),oo((function(){ro(t,S),no(t,T),F&&F.length>1||ao(t,n,C,i)})),F&&F(t,i)},onEnterCancelled:function(t){U(t,!1),k&&k(t)},onAppearCancelled:function(t){U(t,!0),H&&H(t)},onLeaveCancelled:function(t){z(t),O&&O(t)}})}(t),i)};to.displayName="Transition";var eo={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};function io(t){var e=Y(t);return function(t){"number"!=typeof t?he(" explicit duration is not a valid number - got "+JSON.stringify(t)+"."):isNaN(t)&&he(" explicit duration is NaN - the duration expression might be incorrect.")}(e),e}function no(t,e){e.split(/\s+/).forEach((function(e){return e&&t.classList.add(e)})),(t._vtc||(t._vtc=new Set)).add(e)}function ro(t,e){e.split(/\s+/).forEach((function(e){return e&&t.classList.remove(e)}));var i=t._vtc;i&&(i.delete(e),i.size||(t._vtc=void 0))}function oo(t){requestAnimationFrame((function(){requestAnimationFrame(t)}))}to.props=_({},Xi.props,eo);var so=0;function ao(t,e,i,n){var r=t._endId=++so,o=function(){r===t._endId&&n()};if(i)return setTimeout(o,i);var s=function(t,e){var i=window.getComputedStyle(t),n=function(t){return(i[t]||"").split(", ")},r=n("transitionDelay"),o=n("transitionDuration"),s=uo(r,o),a=n("animationDelay"),u=n("animationDuration"),l=uo(a,u),c=null,h=0,f=0;e===Qr?s>0&&(c=Qr,h=s,f=o.length):e===$r?l>0&&(c=$r,h=l,f=u.length):f=(c=(h=Math.max(s,l))>0?s>l?Qr:$r:null)?c===Qr?o.length:u.length:0;var d=c===Qr&&/\b(transform|all)(,|$)/.test(i.transitionProperty);return{type:c,timeout:h,propCount:f,hasTransform:d}}(t,e),a=s.type,u=s.timeout,l=s.propCount;if(!a)return n();var c=a+"end",h=0,f=function(){t.removeEventListener(c,d),o()},d=function(e){e.target===t&&++h>=l&&f()};setTimeout((function(){h: value "+i+" is invalid.",l)}}else{t._value=i;var u=null==i?"":i;t.value!==u&&(t.value=u)}}(t,e,n,s,a,u,l):("true-value"===e?t._trueValue=n:"false-value"===e&&(t._falseValue=n),function(t,e,i,n){if(n&&e.startsWith("xlink:"))null==i?t.removeAttributeNS(zr,e.slice(6,e.length)):t.setAttributeNS(zr,e,i);else{var o=r(e);null==i||o&&!1===i?t.removeAttribute(e):t.setAttribute(e,o?"":i)}}(t,e,n,o))}},forcePatchProp:function(t,e){return"value"===e}},Vr);function mo(){return fo||(fo=Tn(po))}var vo,bo;t("h",(function(){var t,e=(t=mo()).createApp.apply(t,arguments);go(e);var i=e.mount;return e.mount=function(t){var n=yo(t);if(n){var r=e._component;P(r)||r.render||r.template||(r.template=n.innerHTML),n.innerHTML="";var o=i(n);return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),o}},e}));function go(t){Object.defineProperty(t.config,"isNativeTag",{value:function(t){return f(t)||d(t)},writable:!1})}function yo(t){if(L(t)){var e=document.querySelector(t);return e||he('Failed to mount app: mount target selector "'+t+'" returned null.'),e}return t instanceof window.ShadowRoot&&"closed"===t.mode&&he('mounting on a ShadowRoot with `{mode: "closed"}` may lead to unpredictable bugs'),t}function So(t){var e={exports:{}};return t(e,e.exports),e.exports}(bo=c||(c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{})).__VUE__=!0,vo=bo.__VUE_DEVTOOLS_GLOBAL_HOOK__,ze=vo,Nr(),function(t,e){var i,n=t.document,r=n.documentElement,o=n.querySelector('meta[name="viewport"]'),s=n.querySelector('meta[name="flexible"]'),a=0,u=0,l=e.flexible||(e.flexible={});if(o){console.warn("将根据已有的meta标签来设置缩放比例");var c=o.getAttribute("content").match(/initial\-scale=([\d\.]+)/);c&&(u=parseFloat(c[1]),a=parseInt(1/u))}else if(s){var h=s.getAttribute("content");if(h){var f=h.match(/initial\-dpr=([\d\.]+)/),d=h.match(/maximum\-dpr=([\d\.]+)/);f&&(a=parseFloat(f[1]),u=parseFloat((1/a).toFixed(2))),d&&(a=parseFloat(d[1]),u=parseFloat((1/a).toFixed(2)))}}if(!a&&!u){t.navigator.appVersion.match(/android/gi);var p=t.navigator.appVersion.match(/iphone/gi),m=t.devicePixelRatio;u=1/(a=p?m>=3&&(!a||a>=3)?3:m>=2&&(!a||a>=2)?2:1:1)}if(r.setAttribute("data-dpr",a),!o)if((o=n.createElement("meta")).setAttribute("name","viewport"),o.setAttribute("content","initial-scale="+u+", maximum-scale="+u+", minimum-scale="+u+", user-scalable=no"),r.firstElementChild)r.firstElementChild.appendChild(o);else{var v=n.createElement("div");v.appendChild(o),n.write(v.innerHTML)}function b(){var e=r.getBoundingClientRect().width;e/a>540&&(e=540*a);var i=e/10;r.style.fontSize=i+"px",l.rem=t.rem=i}t.addEventListener("resize",(function(){clearTimeout(i),i=setTimeout(b,300)}),!1),t.addEventListener("pageshow",(function(t){t.persisted&&(clearTimeout(i),i=setTimeout(b,300))}),!1),"complete"===n.readyState?n.body.style.fontSize=12*a+"px":n.addEventListener("DOMContentLoaded",(function(t){n.body.style.fontSize=12*a+"px"}),!1),b(),l.dpr=t.dpr=a,l.refreshRem=b,l.rem2px=function(t){var e=parseFloat(t)*this.rem;return"string"==typeof t&&t.match(/rem$/)&&(e+="px"),e},l.px2rem=function(t){var e=parseFloat(t)/this.rem;return"string"==typeof t&&t.match(/px$/)&&(e+="rem"),e}}(window,window.lib||(window.lib={}));t("o",So((function(t,e){window,t.exports=function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=184)}([function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Fraction=void 0;var n=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=!0),this.numerator=0,this.denominator=1,this.wholeValue=0,this.numerator=t,this.denominator=e,this.wholeValue=i,n&&this.simplify(),this.setRealValue()}t.max=function(t,e){return t.RealValue>e.RealValue?t:e},t.Equal=function(t,e){return t.wholeValue===e.wholeValue&&t.Denominator===e.Denominator&&t.Numerator===e.Numerator},t.createFromFraction=function(e){return new t(e.numerator,e.denominator,e.wholeValue,!1)},t.plus=function(t,e){var i=t.clone();return i.Add(e),i},t.minus=function(t,e){var i=t.clone();return i.Sub(e),i},t.multiply=function(e,i){return new t((e.wholeValue*e.denominator+e.numerator)*(i.wholeValue*i.denominator+i.numerator),e.denominator*i.denominator)},t.greatestCommonDenominator=function(t,e){if(0===t)return e;if(1===e)return 1;for(;Math.abs(e)>1e-8;)t>e?t-=e:e-=t;return Math.round(t)};var e=t.prototype;return e.toString=function(){var t=this.numerator+"/"+this.denominator;return 0!==this.wholeValue&&(t=this.wholeValue+" "+t),t},e.clone=function(){return new t(this.numerator,this.denominator,this.wholeValue,!1)},e.GetExpandedNumerator=function(){return this.wholeValue*this.denominator+this.numerator},e.IsNegative=function(){return this.realValue<0},e.expand=function(t){this.numerator*=t,this.denominator*=t,0!==this.wholeValue&&(this.numerator+=this.wholeValue*this.denominator,this.wholeValue=0)},e.Add=function(t){return this.numerator=(this.wholeValue*this.denominator+this.numerator)*t.denominator+(t.wholeValue*t.denominator+t.numerator)*this.denominator,this.denominator=this.denominator*t.denominator,this.wholeValue=0,this.simplify(),this.setRealValue(),this},e.Sub=function(t){return this.numerator=(this.wholeValue*this.denominator+this.numerator)*t.denominator-(t.wholeValue*t.denominator+t.numerator)*this.denominator,this.denominator=this.denominator*t.denominator,this.wholeValue=0,this.simplify(),this.setRealValue(),this},e.Quantize=function(e){if(this.denominator<=e)return this;for(var i=new t(this.numerator+1,this.denominator,this.wholeValue);i.Denominator>e;)i.Numerator++;if(this.numerator>this.denominator){for(var n=new t(this.numerator-1,this.denominator,this.wholeValue);n.Denominator>e;)n.Numerator--;if(n.Denominatort.maximumAllowedNumber){var n=this.denominator/t.maximumAllowedNumber;this.numerator=Math.round(this.numerator/n),this.denominator=Math.round(this.denominator/n)}if(this.numerator>t.maximumAllowedNumber){var r=this.numerator/t.maximumAllowedNumber;this.numerator=Math.round(this.numerator/r),this.denominator=Math.round(this.denominator/r)}}else this.denominator=1},e.isOnBeat=function(e){var i=this.distanceFromBeat(e);return Math.abs(i)=0&&e<=o.levels.SILENT))throw"log.setLevel() called with invalid level: "+e;if(r=e,!1!==n&&function(t){var e=(i[t]||"silent").toUpperCase();if("undefined"!=typeof window){try{return void(window.localStorage[a]=e)}catch(t){}try{window.document.cookie=encodeURIComponent(a)+"="+e+";"}catch(t){}}}(e),s.call(o,e,t),"undefined"==typeof console&&en.length-1&&(o=1),s<0&&(s=n.length+s,o=-1),[n[s],o]},t.CalculateTransposedHalfTone=function(e,i){var n=e.fundamentalNote+e.AccidentalHalfTones+i;return t.WrapAroundCheck(n,12)},t.WrapAroundCheck=function(t,e){for(var i=0;t<0;)t+=e,i--;for(;t>=e;)t-=e,i++;return{overflow:i,halftone:t}},t.calcFrequency=function(e){var i,r=0;if(e instanceof t){var o=e;r=o.octave-1,i=o.fundamentalNote-n.A+o.AccidentalHalfTones}else"number"==typeof e&&(i=e-57);return 440*Math.pow(2,r)*Math.pow(2,i/12)},t.calcFractionalKey=function(e){return Math.log(e/440)/Math.LN10*t.halftoneFactor+57},t.fromFrequency=function(e){var i=t.calcFractionalKey(e)+.5,n=Math.floor(i/12)-t.octXmlDiff,o=Math.floor(i)%12,s=o,a=r.NONE;return-1===this.pitchEnumValues.indexOf(s)&&(s=o-1,a=r.SHARP),new t(s,n,a)},t.fromHalftone=function(e){var i=Math.floor(e/12)-t.octXmlDiff,n=e%12,o=n,s=r.NONE;return-1===this.pitchEnumValues.indexOf(o)&&(o=n-1,s=r.SHARP),new t(o,i,s)},t.ceiling=function(t){var e=t%=12;return-1===this.pitchEnumValues.indexOf(e)&&(e=t+1),e},t.floor=function(t){var e=t%=12;return-1===this.pitchEnumValues.indexOf(e)&&(e=t-1),e},t.HalfTonesFromAccidental=function(t){switch(t){case r.NONE:return 0;case r.SHARP:return 1;case r.FLAT:return-1;case r.NATURAL:return 0;case r.DOUBLESHARP:return 2;case r.DOUBLEFLAT:return-2;case r.QUARTERTONESHARP:return.5;case r.QUARTERTONEFLAT:return-.5;case r.TRIPLESHARP:return 3;case r.TRIPLEFLAT:return-3;default:throw new Error("Unhandled AccidentalEnum value")}},t.AccidentalFromHalfTones=function(t){switch(t){case 0:return r.NONE;case 1:return r.SHARP;case-1:return r.FLAT;case 2:return r.DOUBLESHARP;case-2:return r.DOUBLEFLAT;case.5:return r.QUARTERTONESHARP;case-.5:return r.QUARTERTONEFLAT;case 3:return r.TRIPLESHARP;case-3:return r.TRIPLEFLAT;default:return t>0&&t<1?r.QUARTERTONESHARP:t<0&&t>-1?r.QUARTERTONEFLAT:r.QUARTERTONESHARP}},t.accidentalVexflow=function(t){var e;switch(t){case r.NATURAL:e="n";break;case r.FLAT:e="b";break;case r.SHARP:e="#";break;case r.DOUBLESHARP:e="##";break;case r.TRIPLESHARP:e="++";break;case r.DOUBLEFLAT:e="bb";break;case r.TRIPLEFLAT:e="bbs";break;case r.QUARTERTONESHARP:e="+";break;case r.QUARTERTONEFLAT:e="d"}return e};var e=t.prototype;return e.getHalfTone=function(){return this.halfTone},e.getTransposedPitch=function(t){if(t>12)throw new Error("rewrite this method to handle bigger octave changes or don't use is with bigger octave changes!");return t>0?this.getHigherPitchByTransposeFactor(t):t<0?this.getLowerPitchByTransposeFactor(-t):this},e.DoEnharmonicChange=function(){switch(this.accidental){case r.FLAT:case r.DOUBLEFLAT:this.fundamentalNote=this.getPreviousFundamentalNote(this.fundamentalNote),this.accidental=t.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+12*(this.octave+t.octXmlDiff)));break;case r.SHARP:case r.DOUBLESHARP:this.fundamentalNote=this.getNextFundamentalNote(this.fundamentalNote),this.accidental=t.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+12*(this.octave+t.octXmlDiff)));break;default:return}},e.ToString=function(){var e=t.accidentalVexflow(this.accidental);return e||(e=""),"Key: "+t.getNoteEnumString(this.fundamentalNote)+e+", Note: "+this.fundamentalNote+", octave: "+this.octave.toString()},e.OperatorEquals=function(t){return!(!this||!t)&&this.FundamentalNote===t.FundamentalNote&&this.Octave===t.Octave&&this.Accidental===t.Accidental},e.OperatorNotEqual=function(t){return!(this===t)},e.OperatorFundamentalGreaterThan=function(t){var e=this;return e.Octave===t.Octave?e.FundamentalNote>t.FundamentalNote:e.Octave>t.Octave},e.OperatorFundamentalLessThan=function(t){var e=this;return e.Octave===t.Octave?e.FundamentalNotet.pitchEnumValues.length-1?(i=t.pitchEnumValues[n+e-t.pitchEnumValues.length],o++):i=t.pitchEnumValues[n+e],new t(i,o,r.NONE)},e.getLowerPitchByTransposeFactor=function(e){var i,n=t.pitchEnumValues.indexOf(this.fundamentalNote),o=this.octave;return n-e<0?(i=t.pitchEnumValues[t.pitchEnumValues.length+n-e],o--):i=t.pitchEnumValues[n-e],new t(i,o,r.NONE)},e.getNextFundamentalNote=function(e){var i=t.pitchEnumValues.indexOf(e);return i=(i+1)%t.pitchEnumValues.length,t.pitchEnumValues[i]},e.getPreviousFundamentalNote=function(e){var i=t.pitchEnumValues.indexOf(e);return i>0?t.pitchEnumValues[i-1]:t.pitchEnumValues[t.pitchEnumValues.length-1]},_createClass2(t,[{key:"AccidentalHalfTones",get:function(){return t.HalfTonesFromAccidental(this.accidental)}},{key:"Octave",get:function(){return this.octave}},{key:"FundamentalNote",get:function(){return this.fundamentalNote}},{key:"Accidental",get:function(){return this.accidental}},{key:"Frequency",get:function(){return this.frequency}}],[{key:"OctaveXmlDifference",get:function(){return t.octXmlDiff}}]),t}();e.Pitch=o,o.pitchEnumValues=[n.C,n.D,n.E,n.F,n.G,n.A,n.B],o.halftoneFactor=12/(Math.LN2/Math.LN10),o.octXmlDiff=3},function(t,e,i){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.PlacementEnum=e.AbstractExpression=void 0,e.AbstractExpression=function(){function t(t){this.placement=t}return t.isStringInStringList=function(t,e){for(var i=0,n=t.length;i.001;break;case r.Up:case r.Down:n=this.relativePosition.y,t.calculateMarginPositionAlongDirection(this,e),o=Math.abs(n-this.relativePosition.y)>.001;break;default:throw new s.ArgumentOutOfRangeException("direction")}}while(o)},e.collisionDetection=function(t){var e=Math.min(this.AbsolutePosition.x+this.borderRight,t.absolutePosition.x+t.borderRight)-Math.max(this.AbsolutePosition.x+this.borderLeft,t.absolutePosition.x+t.borderLeft),i=Math.min(this.AbsolutePosition.y+this.borderBottom,t.absolutePosition.y+t.borderBottom)-Math.max(this.AbsolutePosition.y+this.borderTop,t.absolutePosition.y+t.borderTop);return e>0&&i>0},e.liesInsideBorders=function(t){var e=this.AbsolutePosition.x+this.borderLeft<=t.absolutePosition.x+t.borderLeft&&t.absolutePosition.x+t.borderLeft<=this.AbsolutePosition.x+this.borderRight,i=this.AbsolutePosition.x+this.borderLeft<=t.absolutePosition.x+t.borderRight&&t.absolutePosition.x+t.borderRight<=this.AbsolutePosition.x+this.borderRight;if(e&&i){var n=this.AbsolutePosition.y+this.borderTop<=t.absolutePosition.y+t.borderTop&&t.absolutePosition.y+t.borderTop<=this.AbsolutePosition.y+this.borderBottom,r=this.AbsolutePosition.y+this.borderTop<=t.absolutePosition.y+t.borderBottom&&t.absolutePosition.y+t.borderBottom<=this.AbsolutePosition.y+this.borderBottom;if(n&&r)return!0}return!1},e.pointLiesInsideBorders=function(t){return this.AbsolutePosition.x+this.borderLeft<=t.x&&t.x<=this.AbsolutePosition.x+this.borderRight&&this.AbsolutePosition.y+this.borderTop<=t.y&&t.y<=this.AbsolutePosition.y+this.borderBottom},e.marginCollisionDetection=function(t){var e=Math.min(this.AbsolutePosition.x+this.borderMarginRight,t.absolutePosition.x+t.borderMarginRight)-Math.max(this.AbsolutePosition.x+this.borderMarginLeft,t.absolutePosition.x+t.borderMarginLeft),i=Math.min(this.AbsolutePosition.y+this.borderMarginBottom,t.absolutePosition.y+t.borderMarginBottom)-Math.max(this.AbsolutePosition.y+this.borderMarginTop,t.absolutePosition.y+t.borderMarginTop);return e>0&&i>0},e.liesInsideMargins=function(t){var e=this.AbsolutePosition.x+this.borderMarginLeft<=t.absolutePosition.x+t.borderMarginLeft&&t.absolutePosition.x+t.borderMarginLeft<=this.AbsolutePosition.x+this.borderMarginRight,i=this.AbsolutePosition.x+this.borderMarginLeft<=t.absolutePosition.x+t.borderMarginRight&&t.absolutePosition.x+t.borderMarginRight<=this.AbsolutePosition.x+this.borderMarginRight;if(e&&i){var n=this.AbsolutePosition.y+this.borderMarginTop<=t.absolutePosition.y+t.borderMarginTop&&t.absolutePosition.y+t.borderMarginTop<=this.AbsolutePosition.y+this.borderMarginBottom,r=this.AbsolutePosition.y+this.borderMarginTop<=t.absolutePosition.y+t.borderMarginBottom&&t.absolutePosition.y+t.borderMarginBottom<=this.AbsolutePosition.y+this.borderMarginBottom;if(n&&r)return!0}return!1},e.pointLiesInsideMargins=function(t){return this.AbsolutePosition.x+this.borderMarginLeft<=t.x&&t.x<=this.AbsolutePosition.x+this.borderMarginRight&&this.AbsolutePosition.y+this.borderMarginTop<=t.y&&t.y<=this.AbsolutePosition.y+this.borderMarginBottom},e.computeNonOverlappingPosition=function(t,e,i){this.RelativePosition=new a.PointF2D(i.x,i.y),this.setAbsolutePositionFromParent();var n=0,o=!1;do{switch(e){case r.Left:case r.Right:n=this.relativePosition.x,t.calculatePositionAlongDirection(this,e),o=Math.abs(n-this.relativePosition.x)>1e-4;break;case r.Up:case r.Down:n=this.relativePosition.y,t.calculatePositionAlongDirection(this,e),o=Math.abs(n-this.relativePosition.y)>1e-4;break;default:throw new s.ArgumentOutOfRangeException("direction")}}while(o)},e.getClickedObjectOfType=function(t){var e=this.dataObject;if(this.pointLiesInsideBorders(t)&&e)return e;for(var i=0,n=this.childElements.length;ithis.borderLeft?this.borderLeft:this.borderMarginLeft},set:function(t){this.borderMarginLeft=t,this.calculateMarginRectangle()}},{key:"BorderMarginRight",get:function(){return this.borderMarginRightthis.borderTop?this.borderTop:this.borderMarginTop},set:function(t){this.borderMarginTop=t,this.calculateMarginRectangle()}},{key:"BorderMarginBottom",get:function(){return this.borderMarginBottom-1&&this.parent.ChildElements.splice(e,1)}this.parent=t,this.parent.ChildElements.indexOf(this)>-1?o.default.error("BoundingBox of "+this.dataObject.constructor.name+" already in children list of "+this.parent.dataObject.constructor.name+"'s BoundingBox"):this.parent.ChildElements.push(this)}},{key:"DataObject",get:function(){return this.dataObject}},{key:"Center",get:function(){return new a.PointF2D(this.RelativePosition.x+(this.BorderMarginRight+this.BorderMarginLeft),this.RelativePosition.y+(this.BorderMarginBottom+this.BorderMarginTop))}}]),t}(),function(t){t[t.Left=0]="Left",t[t.Right=1]="Right",t[t.Up=2]="Up",t[t.Down=3]="Down"}(r=e.ColDirEnum||(e.ColDirEnum={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalObject=void 0;var n=function(t){function e(){return t.apply(this,arguments)||this}return _inheritsLoose(e,t),_createClass2(e,[{key:"PositionAndShape",get:function(){return this.boundingBox},set:function(t){this.boundingBox=t}}]),e}(i(111).AClassHierarchyTrackable);e.GraphicalObject=n},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.MidiInstrument=e.ClefEnum=e.ClefInstruction=void 0;var n,r,o=i(2),s=i(49),a=i(2),u=i(2),l=i(11),c=function(t){function e(e,i,r){var o;return void 0===e&&(e=n.G),void 0===i&&(i=0),void 0===r&&(r=2),(o=t.call(this,void 0)||this).clefType=n.G,o.line=2,o.octaveOffset=0,o.line=r,o.clefType=e,o.octaveOffset=i,o.calcParameters(),o}_inheritsLoose(e,t),e.getDefaultClefFromMidiInstrument=function(t){switch(t){case r.Acoustic_Grand_Piano:case r.Electric_Bass_finger:case r.Electric_Bass_pick:case r.Fretless_Bass:case r.Slap_Bass_1:case r.Slap_Bass_2:case r.Synth_Bass_1:case r.Synth_Bass_2:case r.Contrabass:return new e(n.F,0,4);default:return new e(n.G,0,2)}},e.getAllPossibleClefs=function(){for(var t=[],i=0;i<=2;i++){var r=new e(n.G,i,2);t.push(r)}for(var o=-2;o<=0;o++){var s=new e(n.F,o,4);t.push(s)}return t},e.isSupportedClef=function(t){switch(t){case n.G:case n.F:case n.C:case n.percussion:case n.TAB:return!0;default:return!1}};var i=e.prototype;return i.Equals=function(t){return this===t||!(!this||!t)&&this.clefPitch===t.clefPitch&&this.Line===t.Line},i.NotEqual=function(t){return!this.Equals(t)},i.ToString=function(){return"ClefType: "+this.clefType},i.calcParameters=function(){switch(this.clefType){case n.G:this.clefPitch=new o.Pitch(a.NoteEnum.G,1+this.octaveOffset,u.AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+2;break;case n.F:this.clefPitch=new o.Pitch(a.NoteEnum.F,0+this.octaveOffset,u.AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+1.5;break;case n.C:this.clefPitch=new o.Pitch(a.NoteEnum.C,1+this.octaveOffset,u.AccidentalEnum.NONE),this.referenceCyPosition=5-this.line;break;case n.percussion:this.clefPitch=new o.Pitch(a.NoteEnum.C,2,u.AccidentalEnum.NONE),this.referenceCyPosition=2;break;case n.TAB:this.clefPitch=new o.Pitch(a.NoteEnum.G,0,u.AccidentalEnum.NONE),this.referenceCyPosition=0;break;default:throw new l.ArgumentOutOfRangeException("clefType")}},_createClass2(e,[{key:"ClefType",get:function(){return this.clefType},set:function(t){this.clefType=t}},{key:"Line",get:function(){return this.line},set:function(t){this.line=t}},{key:"OctaveOffset",get:function(){return this.octaveOffset},set:function(t){this.octaveOffset=t}},{key:"ClefPitch",get:function(){return this.clefPitch},set:function(t){this.clefPitch=t}},{key:"ReferenceCyPosition",get:function(){return this.referenceCyPosition},set:function(t){this.referenceCyPosition=t}}]),e}(s.AbstractNotationInstruction);e.ClefInstruction=c,function(t){t[t.G=0]="G",t[t.F=1]="F",t[t.C=2]="C",t[t.percussion=3]="percussion",t[t.TAB=4]="TAB"}(n=e.ClefEnum||(e.ClefEnum={})),function(t){t[t.None=-1]="None",t[t.Acoustic_Grand_Piano=0]="Acoustic_Grand_Piano",t[t.Bright_Acoustic_Piano=1]="Bright_Acoustic_Piano",t[t.Electric_Grand_Piano=2]="Electric_Grand_Piano",t[t.Honky_tonk_Piano=3]="Honky_tonk_Piano",t[t.Electric_Piano_1=4]="Electric_Piano_1",t[t.Electric_Piano_2=5]="Electric_Piano_2",t[t.Harpsichord=6]="Harpsichord",t[t.Clavinet=7]="Clavinet",t[t.Celesta=8]="Celesta",t[t.Glockenspiel=9]="Glockenspiel",t[t.Music_Box=10]="Music_Box",t[t.Vibraphone=11]="Vibraphone",t[t.Marimba=12]="Marimba",t[t.Xylophone=13]="Xylophone",t[t.Tubular_Bells=14]="Tubular_Bells",t[t.Dulcimer=15]="Dulcimer",t[t.Drawbar_Organ=16]="Drawbar_Organ",t[t.Percussive_Organ=17]="Percussive_Organ",t[t.Rock_Organ=18]="Rock_Organ",t[t.Church_Organ=19]="Church_Organ",t[t.Reed_Organ=20]="Reed_Organ",t[t.Accordion=21]="Accordion",t[t.Harmonica=22]="Harmonica",t[t.Tango_Accordion=23]="Tango_Accordion",t[t.Acoustic_Guitar_nylon=24]="Acoustic_Guitar_nylon",t[t.Acoustic_Guitar_steel=25]="Acoustic_Guitar_steel",t[t.Electric_Guitar_jazz=26]="Electric_Guitar_jazz",t[t.Electric_Guitar_clean=27]="Electric_Guitar_clean",t[t.Electric_Guitar_muted=28]="Electric_Guitar_muted",t[t.Overdriven_Guitar=29]="Overdriven_Guitar",t[t.Distortion_Guitar=30]="Distortion_Guitar",t[t.Guitar_harmonics=31]="Guitar_harmonics",t[t.Acoustic_Bass=32]="Acoustic_Bass",t[t.Electric_Bass_finger=33]="Electric_Bass_finger",t[t.Electric_Bass_pick=34]="Electric_Bass_pick",t[t.Fretless_Bass=35]="Fretless_Bass",t[t.Slap_Bass_1=36]="Slap_Bass_1",t[t.Slap_Bass_2=37]="Slap_Bass_2",t[t.Synth_Bass_1=38]="Synth_Bass_1",t[t.Synth_Bass_2=39]="Synth_Bass_2",t[t.Violin=40]="Violin",t[t.Viola=41]="Viola",t[t.Cello=42]="Cello",t[t.Contrabass=43]="Contrabass",t[t.Tremolo_Strings=44]="Tremolo_Strings",t[t.Pizzicato_Strings=45]="Pizzicato_Strings",t[t.Orchestral_Harp=46]="Orchestral_Harp",t[t.Timpani=47]="Timpani",t[t.String_Ensemble_1=48]="String_Ensemble_1",t[t.String_Ensemble_2=49]="String_Ensemble_2",t[t.Synth_Strings_1=50]="Synth_Strings_1",t[t.Synth_Strings_2=51]="Synth_Strings_2",t[t.Choir_Aahs=52]="Choir_Aahs",t[t.Voice_Oohs=53]="Voice_Oohs",t[t.Synth_Voice=54]="Synth_Voice",t[t.Orchestra_Hit=55]="Orchestra_Hit",t[t.Trumpet=56]="Trumpet",t[t.Trombone=57]="Trombone",t[t.Tuba=58]="Tuba",t[t.Muted_Trumpet=59]="Muted_Trumpet",t[t.French_Horn=60]="French_Horn",t[t.Brass_Section=61]="Brass_Section",t[t.Synth_Brass_1=62]="Synth_Brass_1",t[t.Synth_Brass_2=63]="Synth_Brass_2",t[t.Soprano_Sax=64]="Soprano_Sax",t[t.Alto_Sax=65]="Alto_Sax",t[t.Tenor_Sax=66]="Tenor_Sax",t[t.Baritone_Sax=67]="Baritone_Sax",t[t.Oboe=68]="Oboe",t[t.English_Horn=69]="English_Horn",t[t.Bassoon=70]="Bassoon",t[t.Clarinet=71]="Clarinet",t[t.Piccolo=72]="Piccolo",t[t.Flute=73]="Flute",t[t.Recorder=74]="Recorder",t[t.Pan_Flute=75]="Pan_Flute",t[t.Blown_Bottle=76]="Blown_Bottle",t[t.Shakuhachi=77]="Shakuhachi",t[t.Whistle=78]="Whistle",t[t.Ocarina=79]="Ocarina",t[t.Lead_1_square=80]="Lead_1_square",t[t.Lead_2_sawtooth=81]="Lead_2_sawtooth",t[t.Lead_3_calliope=82]="Lead_3_calliope",t[t.Lead_4_chiff=83]="Lead_4_chiff",t[t.Lead_5_charang=84]="Lead_5_charang",t[t.Lead_6_voice=85]="Lead_6_voice",t[t.Lead_7_fifths=86]="Lead_7_fifths",t[t.Lead_8_bass_lead=87]="Lead_8_bass_lead",t[t.Pad_1_new_age=88]="Pad_1_new_age",t[t.Pad_2_warm=89]="Pad_2_warm",t[t.Pad_3_polysynth=90]="Pad_3_polysynth",t[t.Pad_4_choir=91]="Pad_4_choir",t[t.Pad_5_bowed=92]="Pad_5_bowed",t[t.Pad_6_metallic=93]="Pad_6_metallic",t[t.Pad_7_halo=94]="Pad_7_halo",t[t.Pad_8_sweep=95]="Pad_8_sweep",t[t.FX_1_rain=96]="FX_1_rain",t[t.FX_2_soundtrack=97]="FX_2_soundtrack",t[t.FX_3_crystal=98]="FX_3_crystal",t[t.FX_4_atmosphere=99]="FX_4_atmosphere",t[t.FX_5_brightness=100]="FX_5_brightness",t[t.FX_6_goblins=101]="FX_6_goblins",t[t.FX_7_echoes=102]="FX_7_echoes",t[t.FX_8_scifi=103]="FX_8_scifi",t[t.Sitar=104]="Sitar",t[t.Banjo=105]="Banjo",t[t.Shamisen=106]="Shamisen",t[t.Koto=107]="Koto",t[t.Kalimba=108]="Kalimba",t[t.Bag_pipe=109]="Bag_pipe",t[t.Fiddle=110]="Fiddle",t[t.Shanai=111]="Shanai",t[t.Tinkle_Bell=112]="Tinkle_Bell",t[t.Agogo=113]="Agogo",t[t.Steel_Drums=114]="Steel_Drums",t[t.Woodblock=115]="Woodblock",t[t.Taiko_Drum=116]="Taiko_Drum",t[t.Melodic_Tom=117]="Melodic_Tom",t[t.Synth_Drum=118]="Synth_Drum",t[t.Reverse_Cymbal=119]="Reverse_Cymbal",t[t.Guitar_Fret_Noise=120]="Guitar_Fret_Noise",t[t.Breath_Noise=121]="Breath_Noise",t[t.Seashore=122]="Seashore",t[t.Bird_Tweet=123]="Bird_Tweet",t[t.Telephone_Ring=124]="Telephone_Ring",t[t.Helicopter=125]="Helicopter",t[t.Applause=126]="Applause",t[t.Gunshot=127]="Gunshot",t[t.Percussion=128]="Percussion"}(r=e.MidiInstrument||(e.MidiInstrument={}))},function(t,e,i){i.r(e);var n=function(){};n.L=function(t,e){if(e){var i=Array.prototype.slice.call(e).join(" ");window. (t+": "+i)}},n.MakeException=function(t){return function(e){function i(i,n){var r;return(r=e.call(this,i)||this).name=t,r.message=i,r.data=n,r}return _inheritsLoose(i,e),i}(_wrapNativeSuper2(Error))},n.RERR=n.RuntimeError=function(){function t(t,e){this.code=t,this.message=e}return t.prototype.toString=function(){return"[RuntimeError] "+this.code+":"+this.message},t}(),n.Merge=function(t,e){for(var i in e)t[i]=e[i];return t},n.Min=Math.min,n.Max=Math.max,n.forEach=function(t,e){for(var i=0;i=e/2?parseInt(t/e,10)*e+e:parseInt(t/e,10)*e},n.MidLine=function(t,e){var i=e+(t-e)/2;return i%2>0&&(i=n.RoundN(10*i,5)/10),i},n.SortAndUnique=function(t,e,i){if(t.length>1){var n,r=[];t.sort(e);for(var o=0;o0},e.greaterThanEquals=function(e){var i=t.__compareB.copy(this);return i.subtract(e),i.numerator>=0},e.lessThan=function(t){return!this.greaterThanEquals(t)},e.lessThanEquals=function(t){return!this.greaterThan(t)},e.clone=function(){return new t(this.numerator,this.denominator)},e.copy=function(t){return"number"==typeof t?this.set(t||0,1):this.set(t.numerator,t.denominator)},e.quotient=function(){return Math.floor(this.numerator/this.denominator)},e.fraction=function(){return this.numerator%this.denominator},e.abs=function(){return this.denominator=Math.abs(this.denominator),this.numerator=Math.abs(this.numerator),this},e.toString=function(){return this.numerator+"/"+this.denominator},e.toSimplifiedString=function(){return t.__tmp.copy(this).simplify().toString()},e.toMixedString=function(){var e="",i=this.quotient(),n=t.__tmp.copy(this);return i<0?n.abs().fraction():n.fraction(),0!==i?(e+=i,0!==n.numerator&&(e+=" "+n.toSimplifiedString())):e=0===n.numerator?"0":n.toSimplifiedString(),e},e.parse=function(t){var e=t.split("/"),i=parseInt(e[0],10),n=e[1]?parseInt(e[1],10):1;return this.set(i,n)},t}();r.__compareA=new r,r.__compareB=new r,r.__tmp=new r;var o=n.MakeException("RegistryError");function s(t,e,i,n,r){t[e][i]||(t[e][i]={}),t[e][i][n]=r}var a=function(){function t(){this.clear()}t.enableDefaultRegistry=function(e){t.defaultRegistry=e},t.getDefaultRegistry=function(){return t.defaultRegistry},t.disableDefaultRegistry=function(){t.defaultRegistry=null};var e=t.prototype;return e.clear=function(){return this.index={id:{},type:{},class:{}},this},e.updateIndex=function(t){var e=t.id,i=t.name,n=t.value,r=t.oldValue,o=this.getElementById(e);null!==r&&this.index[i][r]&&delete this.index[i][r][e],null!==n&&s(this.index,i,n,o.getAttribute("id"),o)},e.register=function(e,i){var n=this;if(!(i=i||e.getAttribute("id")))throw new o("Can't add element without `id` attribute to registry",e);return e.setAttribute("id",i),s(this.index,"id",i,i,e),t.INDEXES.forEach((function(t){n.updateIndex({id:i,name:t,value:e.getAttribute(t),oldValue:null})})),e.onRegister(this),this},e.getElementById=function(t){return this.index.id[t]?this.index.id[t][t]:null},e.getElementsByAttribute=function(t,e){var i=this.index[t];return i&&i[e]?Object.keys(i[e]).map((function(t){return i[e][t]})):[]},e.getElementsByType=function(t){return this.getElementsByAttribute("type",t)},e.getElementsByClass=function(t){return this.getElementsByAttribute("class",t)},e.onUpdate=function(e){var i=e.id,n=e.name,r=e.value,o=e.oldValue;return function(t,e){return t.filter((function(t){return t===e})).length>0}(t.INDEXES.concat(["id","class"]),n)?(this.updateIndex({id:i,name:n,value:r,oldValue:o}),this):this},_createClass2(t,null,[{key:"INDEXES",get:function(){return["type"]}}]),t}();a.defaultRegistry=null;var u=function(){function t(e){var i=(void 0===e?{}:e).type;this.attrs={id:t.newID(),el:null,type:i||"Base",classes:{}},this.boundingBox=null,this.context=null,this.rendered=!1,a.getDefaultRegistry()&&a.getDefaultRegistry().register(this)}t.newID=function(){return"auto"+t.ID++};var e=t.prototype;return e.setStyle=function(t){return this.style=t,this},e.getStyle=function(){return this.style},e.applyStyle=function(t,e){return void 0===t&&(t=this.context),void 0===e&&(e=this.getStyle()),e?(t.save(),e.shadowColor&&t.setShadowColor(e.shadowColor),e.shadowBlur&&t.setShadowBlur(e.shadowBlur),e.fillStyle&&t.setFillStyle(e.fillStyle),e.strokeStyle&&t.setStrokeStyle(e.strokeStyle),e.lineWidth&&t.setLineWidth(e.lineWidth),this):this},e.restoreStyle=function(t,e){return void 0===t&&(t=this.context),void 0===e&&(e=this.getStyle()),e?(t.restore(),this):this},e.drawWithStyle=function(){this.checkContext(),this.applyStyle(),this.draw(),this.restoreStyle()},e.hasClass=function(t){return!0===this.attrs.classes[t]},e.addClass=function(t){return this.attrs.classes[t]=!0,this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:t,oldValue:null}),this},e.removeClass=function(t){return delete this.attrs.classes[t],this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:null,oldValue:t}),this},e.onRegister=function(t){return this.registry=t,this},e.isRendered=function(){return this.rendered},e.setRendered=function(t){return void 0===t&&(t=!0),this.rendered=t,this},e.getAttributes=function(){return this.attrs},e.getAttribute=function(t){return this.attrs[t]},e.setAttribute=function(t,e){var i=this.attrs.id,n=this.attrs[t];return this.attrs[t]=e,this.registry&&this.registry.onUpdate({id:i,name:t,value:e,oldValue:n}),this},e.getContext=function(){return this.context},e.setContext=function(t){return this.context=t,this},e.getBoundingBox=function(){return this.boundingBox},e.checkContext=function(){if(!this.context)throw new n.RERR("NoContext","No rendering context attached to instance");return this.context},t}();u.ID=1e3;var l=function(){function t(t,e,i,n){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.addPoint(t,e),this.addPoint(i,n)}var e=t.prototype;return e.width=function(){return this.x2-this.x1},e.height=function(){return this.y2-this.y1},e.addPoint=function(t,e){null!=t&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),tthis.x2&&(this.x2=t)),null!=e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))},e.addX=function(t){this.addPoint(t,null)},e.addY=function(t){this.addPoint(null,t)},e.addQuadraticCurve=function(t,e,i,n,r,o){var s=t+2/3*(i-t),a=e+2/3*(n-e),u=s+1/3*(r-t),l=a+1/3*(o-e);this.addBezierCurve(t,e,s,a,u,l,r,o)},e.addBezierCurve=function(t,e,i,n,r,o,s,a){var u,l=[t,e],c=[i,n],h=[r,o],f=[s,a];this.addPoint(l[0],l[1]),this.addPoint(f[0],f[1]);var d=function(t,e){return Math.pow(1-t,3)*l[e]+3*Math.pow(1-t,2)*t*c[e]+3*(1-t)*Math.pow(t,2)*h[e]+Math.pow(t,3)*f[e]};for(u=0;u<=1;u++){var p=6*l[u]-12*c[u]+6*h[u],m=-3*l[u]+9*c[u]-9*h[u]+3*f[u],v=3*c[u]-3*l[u];if(0!==m){var b=Math.pow(p,2)-4*v*m;if(!(b<0)){var g=(-p+Math.sqrt(b))/(2*m);0=6&&2*l%2==0&&(c=-1);var h=void 0!==a.int_val?12*u+a.int_val:null,f=a.code,d=a.shift_right,m={};if(o.length>2&&o[2]){var v=o[2].toUpperCase();m=p.keyProperties.customNoteHeads[v]||{}}return Object.assign({key:s,octave:u,line:l,int_value:h,accidental:a.accidental,code:f,stroke:c,shift_right:d,displaced:!1},m)},p.keyProperties.note_values={C:{index:0,int_val:0,accidental:null},CN:{index:0,int_val:0,accidental:"n"},"C#":{index:0,int_val:1,accidental:"#"},"C##":{index:0,int_val:2,accidental:"##"},CB:{index:0,int_val:-1,accidental:"b"},CBB:{index:0,int_val:-2,accidental:"bb"},D:{index:1,int_val:2,accidental:null},DN:{index:1,int_val:2,accidental:"n"},"D#":{index:1,int_val:3,accidental:"#"},"D##":{index:1,int_val:4,accidental:"##"},DB:{index:1,int_val:1,accidental:"b"},DBB:{index:1,int_val:0,accidental:"bb"},E:{index:2,int_val:4,accidental:null},EN:{index:2,int_val:4,accidental:"n"},"E#":{index:2,int_val:5,accidental:"#"},"E##":{index:2,int_val:6,accidental:"##"},EB:{index:2,int_val:3,accidental:"b"},EBB:{index:2,int_val:2,accidental:"bb"},F:{index:3,int_val:5,accidental:null},FN:{index:3,int_val:5,accidental:"n"},"F#":{index:3,int_val:6,accidental:"#"},"F##":{index:3,int_val:7,accidental:"##"},FB:{index:3,int_val:4,accidental:"b"},FBB:{index:3,int_val:3,accidental:"bb"},G:{index:4,int_val:7,accidental:null},GN:{index:4,int_val:7,accidental:"n"},"G#":{index:4,int_val:8,accidental:"#"},"G##":{index:4,int_val:9,accidental:"##"},GB:{index:4,int_val:6,accidental:"b"},GBB:{index:4,int_val:5,accidental:"bb"},A:{index:5,int_val:9,accidental:null},AN:{index:5,int_val:9,accidental:"n"},"A#":{index:5,int_val:10,accidental:"#"},"A##":{index:5,int_val:11,accidental:"##"},AB:{index:5,int_val:8,accidental:"b"},ABB:{index:5,int_val:7,accidental:"bb"},B:{index:6,int_val:11,accidental:null},BN:{index:6,int_val:11,accidental:"n"},"B#":{index:6,int_val:12,accidental:"#"},"B##":{index:6,int_val:13,accidental:"##"},BB:{index:6,int_val:10,accidental:"b"},BBB:{index:6,int_val:9,accidental:"bb"},R:{index:6,int_val:9,rest:!0},X:{index:6,accidental:"",octave:4,code:"v3e",shift_right:5.5}},p.keyProperties.customNoteHeads={D0:{code:"v27",shift_right:0,stem_up_x_offset:0,stem_down_x_offset:0,stem_up_y_offset:-1,stem_down_y_offset:0},D1:{code:"v2d",shift_right:-.5},D2:{code:"v22",shift_right:-.5},D3:{code:"v70",shift_right:-.5},T0:{code:"v49",shift_right:-2,stem_up_y_offset:-4,stem_down_y_offset:4},T1:{code:"v93",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},T2:{code:"v40",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},T3:{code:"v7d",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},X0:{code:"v92",stem_up_x_offset:-2,stem_down_x_offset:0,stem_up_y_offset:4,stem_down_y_offset:4},X1:{code:"v95",shift_right:-.5,stem_up_y_offset:4,stem_down_y_offset:4},X2:{code:"v3e",shift_right:.5,stem_up_y_offset:4,stem_down_y_offset:4},X3:{code:"v3b",shift_right:0,stem_up_x_offset:-1.2,stem_down_x_offset:0,stem_up_y_offset:-1,stem_down_y_offset:2},S1:{code:"vd3",shift_right:0},S2:{code:"vd2",shift_right:0},R1:{code:"vd5",shift_right:0},R2:{code:"vd4",shift_right:0}},p.integerToNote=function(t){if(void 0===t)throw new n.RERR("BadArguments","Undefined integer for integerToNote");if(t<-2)throw new n.RERR("BadArguments","integerToNote requires integer > -2: "+t);var e=p.integerToNote.table[t];if(!e)throw new n.RERR("BadArguments","Unknown note value for integer: "+t);return e},p.integerToNote.table={0:"C",1:"C#",2:"D",3:"D#",4:"E",5:"F",6:"F#",7:"G",8:"G#",9:"A",10:"A#",11:"B"},p.tabToGlyph=function(t,e){void 0===e&&(e=1);var i=null,n=0,r=0;if("X"===t.toString().toUpperCase()){var o=new d("v7f",p.DEFAULT_TABLATURE_FONT_SCALE).getMetrics();i="v7f",n=o.width,r=-o.height/2}else n=p.textWidth(t.toString());return{text:t,code:i,getWidth:function(){return n*e},shift_y:r}},p.textWidth=function(t){return 7*t.toString().length},p.articulationCodes=function(t){return p.articulationCodes.articulations[t]},p.articulationCodes.articulations={"a.":{code:"v23",between_lines:!0},av:{code:"v28",between_lines:!0},"a>":{code:"v42",between_lines:!0},"a-":{code:"v25",between_lines:!0},"a^":{code:"va",between_lines:!1},"a+":{code:"v8b",between_lines:!1},ao:{code:"v94",between_lines:!1},ah:{code:"vb9",between_lines:!1},"a@a":{code:"v43",between_lines:!1},"a@u":{code:"v5b",between_lines:!1},"a|":{code:"v75",between_lines:!1},am:{code:"v97",between_lines:!1},"a,":{code:"vb3",between_lines:!1}},p.accidentalCodes=function(t){return p.accidentalCodes.accidentals[t]},p.accidentalCodes.accidentals={"#":{code:"v18",parenRightPaddingAdjustment:-1},"##":{code:"v7f",parenRightPaddingAdjustment:-1},b:{code:"v44",parenRightPaddingAdjustment:-2},bb:{code:"v26",parenRightPaddingAdjustment:-2},n:{code:"v4e",parenRightPaddingAdjustment:-1},"{":{code:"v9c",parenRightPaddingAdjustment:-1},"}":{code:"v84",parenRightPaddingAdjustment:-1},db:{code:"v9e",parenRightPaddingAdjustment:-1},d:{code:"vab",parenRightPaddingAdjustment:0},bbs:{code:"v90",parenRightPaddingAdjustment:-1},"++":{code:"v51",parenRightPaddingAdjustment:-1},"+":{code:"v78",parenRightPaddingAdjustment:-1},"+-":{code:"v8d",parenRightPaddingAdjustment:-1},"++-":{code:"v7a",parenRightPaddingAdjustment:-1},bs:{code:"vb7",parenRightPaddingAdjustment:-1},bss:{code:"v39",parenRightPaddingAdjustment:-1},o:{code:"vd0",parenRightPaddingAdjustment:-1},k:{code:"vd1",parenRightPaddingAdjustment:-1},ashs:{code:"vd6",parenRightPaddingAdjustment:-1},afhf:{code:"vd7",parenRightPaddingAdjustment:-1}},p.accidentalColumnsTable={1:{a:[1],b:[1]},2:{a:[1,2]},3:{a:[1,3,2],b:[1,2,1],second_on_bottom:[1,2,3]},4:{a:[1,3,4,2],b:[1,2,3,1],spaced_out_tetrachord:[1,2,1,2]},5:{a:[1,3,5,4,2],b:[1,2,4,3,1],spaced_out_pentachord:[1,2,3,2,1],very_spaced_out_pentachord:[1,2,1,2,1]},6:{a:[1,3,5,6,4,2],b:[1,2,4,5,3,1],spaced_out_hexachord:[1,3,2,1,3,2],very_spaced_out_hexachord:[1,2,1,2,1,2]}},p.ornamentCodes=function(t){return p.ornamentCodes.ornaments[t]},p.ornamentCodes.ornaments={mordent:{code:"v1e"},mordent_inverted:{code:"v45"},turn:{code:"v72"},turn_inverted:{code:"v33"},tr:{code:"v1f"},upprall:{code:"v60"},downprall:{code:"vb4"},prallup:{code:"v6d"},pralldown:{code:"v2c"},upmordent:{code:"v29"},downmordent:{code:"v68"},lineprall:{code:"v20"},prallprall:{code:"v86"}},p.keySignature=function(t){var e=p.keySignature.keySpecs[t];if(!e)throw new n.RERR("BadKeySignature","Bad key signature spec: '"+t+"'");if(!e.acc)return[];for(var i=p.keySignature.accidentalList(e.acc),r=[],o=0;othis.CANVAS_BROWSER_SIZE_LIMIT&&(n.W("Canvas dimensions exceed browser limit. Cropping to "+this.CANVAS_BROWSER_SIZE_LIMIT),t>this.CANVAS_BROWSER_SIZE_LIMIT&&(t=this.CANVAS_BROWSER_SIZE_LIMIT),e>this.CANVAS_BROWSER_SIZE_LIMIT&&(e=this.CANVAS_BROWSER_SIZE_LIMIT)),[t,e]};var e=t.prototype;return e.clear=function(){this.vexFlowCanvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)},e.openGroup=function(){},e.closeGroup=function(){},e.add=function(){},e.setFont=function(t,e,i){return this.vexFlowCanvasContext.font=(i||"")+" "+e+"pt "+t,this},e.setRawFont=function(t){return this.vexFlowCanvasContext.font=t,this},e.setFillStyle=function(t){return this.vexFlowCanvasContext.fillStyle=t,this},e.setBackgroundFillStyle=function(t){return this.background_fillStyle=t,this},e.setStrokeStyle=function(t){return this.vexFlowCanvasContext.strokeStyle=t,this},e.setShadowColor=function(t){return this.vexFlowCanvasContext.shadowColor=t,this},e.setShadowBlur=function(t){return this.vexFlowCanvasContext.shadowBlur=t,this},e.setLineWidth=function(t){return this.vexFlowCanvasContext.lineWidth=t,this},e.setLineCap=function(t){return this.vexFlowCanvasContext.lineCap=t,this},e.setLineDash=function(t){return this.vexFlowCanvasContext.lineDash=t,this},e.scale=function(t,e){return this.vexFlowCanvasContext.scale(parseFloat(t),parseFloat(e))},e.resize=function(t,e){var i;return t=(i=this.SanitizeCanvasDims(parseInt(t,10),parseInt(e,10)))[0],e=i[1],this.vexFlowCanvasContext.resize(t,e)},e.rect=function(t,e,i,n){return this.vexFlowCanvasContext.rect(t,e,i,n)},e.fillRect=function(t,e,i,n){return this.vexFlowCanvasContext.fillRect(t,e,i,n)},e.clearRect=function(t,e,i,n){return this.vexFlowCanvasContext.clearRect(t,e,i,n)},e.beginPath=function(){return this.vexFlowCanvasContext.beginPath()},e.moveTo=function(t,e){return this.vexFlowCanvasContext.moveTo(t,e)},e.lineTo=function(t,e){return this.vexFlowCanvasContext.lineTo(t,e)},e.bezierCurveTo=function(t,e,i,n,r,o){return this.vexFlowCanvasContext.bezierCurveTo(t,e,i,n,r,o)},e.quadraticCurveTo=function(t,e,i,n){return this.vexFlowCanvasContext.quadraticCurveTo(t,e,i,n)},e.arc=function(t,e,i,n,r,o){return this.vexFlowCanvasContext.arc(t,e,i,n,r,o)},e.glow=function(){return this.vexFlowCanvasContext.glow()},e.fill=function(){return this.vexFlowCanvasContext.fill()},e.stroke=function(){return this.vexFlowCanvasContext.stroke()},e.closePath=function(){return this.vexFlowCanvasContext.closePath()},e.measureText=function(t){return this.vexFlowCanvasContext.measureText(t)},e.fillText=function(t,e,i){return this.vexFlowCanvasContext.fillText(t,e,i)},e.save=function(){return this.vexFlowCanvasContext.save()},e.restore=function(){return this.vexFlowCanvasContext.restore()},_createClass2(t,null,[{key:"WIDTH",get:function(){return 600}},{key:"HEIGHT",get:function(){return 400}},{key:"CANVAS_BROWSER_SIZE_LIMIT",get:function(){return 32767}}]),t}(),v=function(){function t(t){this.element=t,this.paper=Raphael(t),this.path="",this.pen={x:0,y:0},this.lineWidth=1,this.state={scale:{x:1,y:1},font_family:"Arial",font_size:8,font_weight:800},this.attributes={"stroke-width":.3,fill:"black",stroke:"black",font:"10pt Arial"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white",font:"10pt Arial"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[]}var e=t.prototype;return e.openGroup=function(){},e.closeGroup=function(){},e.add=function(){},e.setFont=function(t,e,i){return this.state.font_family=t,this.state.font_size=e,this.state.font_weight=i,this.attributes.font=(this.state.font_weight||"")+" "+this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this},e.setRawFont=function(t){return this.attributes.font=t,this},e.setFillStyle=function(t){return this.attributes.fill=t,this},e.setBackgroundFillStyle=function(t){return this.background_attributes.fill=t,this.background_attributes.stroke=t,this},e.setStrokeStyle=function(t){return this.attributes.stroke=t,this},e.setShadowColor=function(t){return this.shadow_attributes.color=t,this},e.setShadowBlur=function(t){return this.shadow_attributes.width=t,this},e.setLineWidth=function(t){this.attributes["stroke-width"]=t,this.lineWidth=t},e.setLineDash=function(){return this},e.setLineCap=function(){return this},e.scale=function(t,e){return this.state.scale={x:t,y:e},this.attributes.transform="S"+t+","+e+",0,0",this.attributes.scale=t+","+e+",0,0",this.attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this.background_attributes.transform="S"+t+","+e+",0,0",this.background_attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this},e.clear=function(){this.paper.clear()},e.resize=function(t,e){return this.element.style.width=t,this.paper.setSize(t,e),this},e.setViewBox=function(t){this.paper.canvas.setAttribute("viewBox",t)},e.rect=function(t,e,i,n){return n<0&&(e+=n,n=-n),this.paper.rect(t,e,i-.5,n-.5).attr(this.attributes).attr("fill","none").attr("stroke-width",this.lineWidth),this},e.fillRect=function(t,e,i,n){return n<0&&(e+=n,n=-n),this.paper.rect(t,e,i-.5,n-.5).attr(this.attributes),this},e.clearRect=function(t,e,i,n){return n<0&&(e+=n,n=-n),this.paper.rect(t,e,i-.5,n-.5).attr(this.background_attributes),this},e.beginPath=function(){return this.path="",this.pen.x=0,this.pen.y=0,this},e.moveTo=function(t,e){return this.path+="M"+t+","+e,this.pen.x=t,this.pen.y=e,this},e.lineTo=function(t,e){return this.path+="L"+t+","+e,this.pen.x=t,this.pen.y=e,this},e.bezierCurveTo=function(t,e,i,n,r,o){return this.path+="C"+t+","+e+","+i+","+n+","+r+","+o,this.pen.x=r,this.pen.y=o,this},e.quadraticCurveTo=function(t,e,i,n){return this.path+="Q"+t+","+e+","+i+","+n,this.pen.x=i,this.pen.y=n,this},e.arc=function(t,e,i,n,r,o){function s(t){for(;t<0;)t+=2*Math.PI;for(;t>2*Math.PI;)t-=2*Math.PI;return t}if((n=s(n))>(r=s(r))){var a=n;n=r,r=a,o=!o}var u=r-n;return u>Math.PI?(this.arcHelper(t,e,i,n,n+u/2,o),this.arcHelper(t,e,i,n+u/2,r,o)):this.arcHelper(t,e,i,n,r,o),this},e.arcHelper=function(t,e,i,n,r,o){var s=t+i*Math.cos(n),a=e+i*Math.sin(n),u=t+i*Math.cos(r),l=e+i*Math.sin(r),c=0,h=0;o?(h=1,r-nMath.PI&&(c=1),this.path+="M"+s+","+a+",A"+i+","+i+",0,"+c+","+h+","+u+","+l+"M"+this.pen.x+","+this.pen.y},e.glow=function(){var t=this.paper.set();if(this.shadow_attributes.width>0)for(var e=this.shadow_attributes,i=e.width/2,n=1;n<=i;n++)t.push(this.paper.path(this.path).attr({stroke:e.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(e.width/i*n).toFixed(3),opacity:+((e.opacity||.3)/i).toFixed(3),transform:this.attributes.transform,scale:this.attributes.scale}));return t},e.fill=function(){var t=this.paper.path(this.path).attr(this.attributes).attr("stroke-width",0);return this.glow(t),this},e.stroke=function(){var t=this.lineWidth*(this.state.scale.x+this.state.scale.y)/2,e=this.paper.path(this.path).attr(this.attributes).attr("fill","none").attr("stroke-width",t);return this.glow(e),this},e.closePath=function(){return this.path+="Z",this},e.measureText=function(t){var e=this.paper.text(0,0,t).attr(this.attributes).attr("fill","none").attr("stroke","none"),i=e.getBBox();return e.remove(),{width:i.width,height:i.height}},e.fillText=function(t,e,i){return this.paper.text(e+this.measureText(t).width/2,i-this.state.font_size/(2.25*this.state.scale.y),t).attr(this.attributes),this},e.save=function(){return this.state_stack.push({state:{font_family:this.state.font_family},attributes:{font:this.attributes.font,fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color}}),this},e.restore=function(){var t=this.state_stack.pop();return this.state.font_family=t.state.font_family,this.attributes.font=t.attributes.font,this.attributes.fill=t.attributes.fill,this.attributes.stroke=t.attributes.stroke,this.attributes["stroke-width"]=t.attributes["stroke-width"],this.shadow_attributes.width=t.shadow_attributes.width,this.shadow_attributes.color=t.shadow_attributes.color,this},t}(),b={path:{x:!0,y:!0,width:!0,height:!0},rect:{},text:{width:!0,height:!0}},g={"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0};n.Merge(b.rect,g),n.Merge(b.path,g);var y=function(){function t(t){this.element=t,this.svgNS="http://www.w3.org/2000/svg";var e=this.create("svg");this.element.appendChild(e),this.svg=e,this.groups=[this.svg],this.parent=this.svg,this.path="",this.pen={x:NaN,y:NaN},this.lineWidth=1,this.state={scale:{x:1,y:1},"font-family":"Arial","font-size":"8pt","font-weight":"normal"},this.attributes={"stroke-width":.3,fill:"black",stroke:"black","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[],this.iePolyfill()}var e=t.prototype;return e.create=function(t){return document.createElementNS(this.svgNS,t)},e.openGroup=function(t,e,i){var r=this.create("g");return this.groups.push(r),this.parent.appendChild(r),this.parent=r,t&&r.setAttribute("class",n.Prefix(t)),e&&r.setAttribute("id",n.Prefix(e)),i&&i.pointerBBox&&r.setAttribute("pointer-events","bounding-box"),r},e.closeGroup=function(){this.groups.pop(),this.parent=this.groups[this.groups.length-1]},e.add=function(t){this.parent.appendChild(t)},e.iePolyfill=function(){"undefined"!=typeof navigator&&(this.ie=/MSIE 9/i.test(navigator.userAgent)||/MSIE 10/i.test(navigator.userAgent)||/rv:11\.0/i.test(navigator.userAgent)||/Trident/i.test(navigator.userAgent))},e.setFont=function(t,e,i){var r=!1,o=!1,s="normal";"string"==typeof i&&(-1!==i.indexOf("italic")&&(i=i.replace(/italic/g,""),o=!0),-1!==i.indexOf("bold")&&(i=i.replace(/bold/g,""),r=!0),i=i.replace(/ /g,""));var a={"font-family":t,"font-size":e+"pt","font-weight":i=void 0===(i=r?"bold":i)||""===i?"normal":i,"font-style":s=o?"italic":s};return this.fontSize=Number(e),n.Merge(this.attributes,a),n.Merge(this.state,a),this},e.setRawFont=function(t){var e=(t=t.trim()).split(" ");return this.attributes["font-family"]=e[1],this.state["font-family"]=e[1],this.attributes["font-size"]=e[0],this.state["font-size"]=e[0],this.fontSize=Number(e[0].match(/\d+/)),this},e.setFillStyle=function(t){return this.attributes.fill=t,this},e.setBackgroundFillStyle=function(t){return this.background_attributes.fill=t,this.background_attributes.stroke=t,this},e.setStrokeStyle=function(t){return this.attributes.stroke=t,this},e.setShadowColor=function(t){return this.shadow_attributes.color=t,this},e.setShadowBlur=function(t){return this.shadow_attributes.width=t,this},e.setLineWidth=function(t){this.attributes["stroke-width"]=t,this.lineWidth=t},e.setLineDash=function(t){if("[object Array]"===Object.prototype.toString.call(t))return t=t.join(", "),this.attributes["stroke-dasharray"]=t,this;throw new n.RERR("ArgumentError","lineDash must be an array of integers.")},e.setLineCap=function(t){return this.attributes["stroke-linecap"]=t,this},e.resize=function(t,e){this.width=t,this.height=e,this.element.style.width=t;var i={width:t,height:e};return this.applyAttributes(this.svg,i),this.scale(this.state.scale.x,this.state.scale.y),this},e.scale=function(t,e){this.state.scale={x:t,y:e};var i=this.width/t,n=this.height/e;return this.setViewBox(0,0,i,n),this},e.setViewBox=function(){for(var t=arguments.length,e=new Array(t),i=0;i2*Math.PI;)t-=2*Math.PI;return t}if((n=s(n))>(r=s(r))){var a=n;n=r,r=a,o=!o}var u=r-n;return u>Math.PI?(this.arcHelper(t,e,i,n,n+u/2,o),this.arcHelper(t,e,i,n+u/2,r,o)):this.arcHelper(t,e,i,n,r,o),this},e.arcHelper=function(t,e,i,n,r,o){var s=t+i*Math.cos(n),a=e+i*Math.sin(n),u=t+i*Math.cos(r),l=e+i*Math.sin(r),c=0,h=0;o?(h=1,r-nMath.PI&&(c=1),this.path+="M"+s+" "+a+" A"+i+" "+i+" 0 "+c+" "+h+" "+u+" "+l,isNaN(this.pen.x)||isNaN(this.pen.y)||(this.peth+="M"+this.pen.x+" "+this.pen.y)},e.closePath=function(){return this.path+="Z",this},e.glow=function(){if(this.shadow_attributes.width>0)for(var t=this.shadow_attributes,e=t.width/2,i=1;i<=e;i++){var n={stroke:t.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(.4*t.width/e*i).toFixed(3),opacity:+((t.opacity||.3)/e).toFixed(3)},r=this.create("path");n.d=this.path,this.applyAttributes(r,n),this.add(r)}return this},e.fill=function(t){this.glow();var e=this.create("path");return void 0===t&&(n.Merge(t={},this.attributes),t.stroke="none"),t.d=this.path,this.applyAttributes(e,t),this.add(e),this},e.stroke=function(){this.glow();var t=this.create("path"),e={};return n.Merge(e,this.attributes),e.fill="none",e["stroke-width"]=this.lineWidth,e.d=this.path,this.applyAttributes(t,e),this.add(t),this},e.measureText=function(t){var e=this.create("text");if("function"!=typeof e.getBBox)return{x:0,y:0,width:0,height:0};e.textContent=t,this.applyAttributes(e,this.attributes),this.svg.appendChild(e);var i=e.getBBox();return this.ie&&""!==t&&"italic"===this.attributes["font-style"]&&(i=this.ieMeasureTextFix(i,t)),this.svg.removeChild(e),i},e.ieMeasureTextFix=function(t){var e=1.196*Number(this.fontSize)+1.9598,i=t.width-e,n=t.height-1.5;return{x:t.x,y:t.y,width:i,height:n}},e.fillText=function(t,e,i){if(t&&!(t.length<=0)){var r={};n.Merge(r,this.attributes),r.stroke="none",r.x=e,r.y=i;var o=this.create("text");o.textContent=t,this.applyAttributes(o,r),this.add(o)}},e.save=function(){return this.state_stack.push({state:{"font-family":this.state["font-family"],"font-weight":this.state["font-weight"],"font-style":this.state["font-style"],"font-size":this.state["font-size"],scale:this.state.scale},attributes:{"font-family":this.attributes["font-family"],"font-weight":this.attributes["font-weight"],"font-style":this.attributes["font-style"],"font-size":this.attributes["font-size"],fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"],"stroke-dasharray":this.attributes["stroke-dasharray"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color},lineWidth:this.lineWidth}),this},e.restore=function(){var t=this.state_stack.pop();return this.state["font-family"]=t.state["font-family"],this.state["font-weight"]=t.state["font-weight"],this.state["font-style"]=t.state["font-style"],this.state["font-size"]=t.state["font-size"],this.state.scale=t.state.scale,this.attributes["font-family"]=t.attributes["font-family"],this.attributes["font-weight"]=t.attributes["font-weight"],this.attributes["font-style"]=t.attributes["font-style"],this.attributes["font-size"]=t.attributes["font-size"],this.attributes.fill=t.attributes.fill,this.attributes.stroke=t.attributes.stroke,this.attributes["stroke-width"]=t.attributes["stroke-width"],this.attributes["stroke-dasharray"]=t.attributes["stroke-dasharray"],this.shadow_attributes.width=t.shadow_attributes.width,this.shadow_attributes.color=t.shadow_attributes.color,this.lineWidth=t.lineWidth,this},t}(),S=null,_=function(){function t(e,i){if(this.elementId=e,!this.elementId)throw new n.RERR("BadArgument","Invalid id for renderer.");if(this.element=document.getElementById(e),this.element||(this.element=e),this.ctx=null,this.paper=null,this.backend=i,this.backend===t.Backends.CANVAS){if(!this.element.getContext)throw new n.RERR("BadElement","Can't get canvas context from element: "+e);this.ctx=t.bolsterCanvasContext(this.element.getContext("2d"))}else if(this.backend===t.Backends.RAPHAEL)this.ctx=new v(this.element);else{if(this.backend!==t.Backends.SVG)throw new n.RERR("InvalidBackend","No support for backend: "+this.backend);this.ctx=new y(this.element)}}t.buildContext=function(e,i,n,r,o){var s=new t(e,i);n&&r&&s.resize(n,r),o||(o="#FFF");var a=s.getContext();return a.setBackgroundFillStyle(o),t.lastContext=a,a},t.getCanvasContext=function(e,i,n,r){return t.buildContext(e,t.Backends.CANVAS,i,n,r)},t.getRaphaelContext=function(e,i,n,r){return t.buildContext(e,t.Backends.RAPHAEL,i,n,r)},t.getSVGContext=function(e,i,n,r){return t.buildContext(e,t.Backends.SVG,i,n,r)},t.bolsterCanvasContext=function(e){return t.USE_CANVAS_PROXY?new m(e):(e.vexFlowCanvasContext=e,["clear","setFont","setRawFont","setFillStyle","setBackgroundFillStyle","setStrokeStyle","setShadowColor","setShadowBlur","setLineWidth","setLineCap","setLineDash","openGroup","closeGroup","getGroup"].forEach((function(t){e[t]=e[t]||m.prototype[t]})),e)},t.drawDashedLine=function(t,e,i,n,r,o){t.beginPath();var s=n-e,a=r-i,u=Math.atan2(a,s),l=e,c=i;t.moveTo(e,i);for(var h=0,f=!0;!(s<0?l<=n:l>=n)||!(a<0?c<=r:c>=r);){var d=o[h++%o.length],p=l+Math.cos(u)*d;l=s<0?Math.max(n,p):Math.min(n,p);var m=c+Math.sin(u)*d;c=a<0?Math.max(r,m):Math.min(r,m),f?t.lineTo(l,c):t.moveTo(l,c),f=!f}t.closePath(),t.stroke()};var e=t.prototype;return e.resize=function(e,i){if(this.backend===t.Backends.CANVAS){if(!this.element.getContext)throw new n.RERR("BadElement","Can't get canvas context from element: "+this.elementId);var r=m.SanitizeCanvasDims(e,i);e=r[0],i=r[1];var o=window.devicePixelRatio||1;this.element.width=e*o,this.element.height=i*o,this.element.style.width=e+"px",this.element.style.height=i+"px",this.ctx=t.bolsterCanvasContext(this.element.getContext("2d")),this.ctx.scale(o,o)}else this.ctx.resize(e,i);return this},e.getContext=function(){return this.ctx},_createClass2(t,null,[{key:"Backends",get:function(){return{CANVAS:1,RAPHAEL:2,SVG:3,VML:4}}},{key:"LineEndType",get:function(){return{NONE:1,UP:2,DOWN:3}}},{key:"USE_CANVAS_PROXY",get:function(){return!1}},{key:"lastContext",get:function(){return S},set:function(t){S=t}}]),t}(),x=function(t){function e(e){var i;return void 0===e&&(e={}),(i=t.call(this)||this).setAttribute("type","Stem"),i.x_begin=e.x_begin||0,i.x_end=e.x_end||0,i.y_top=e.y_top||0,i.y_bottom=e.y_bottom||0,i.stem_extension=e.stem_extension||0,i.stem_direction=e.stem_direction||0,i.hide=e.hide||!1,i.isStemlet=e.isStemlet||!1,i.stemletHeight=e.stemletHeight||0,i.renderHeightAdjustment=0,i.setOptions(e),i}_inheritsLoose(e,t);var i=e.prototype;return i.setOptions=function(t){this.stem_up_y_offset=t.stem_up_y_offset||0,this.stem_down_y_offset=t.stem_down_y_offset||0},i.setNoteHeadXBounds=function(t,e){return this.x_begin=t,this.x_end=e,this},i.setDirection=function(t){this.stem_direction=t},i.setExtension=function(t){this.stem_extension=t},i.getExtension=function(){return this.stem_extension},i.setYBounds=function(t,e){this.y_top=t,this.y_bottom=e},i.getCategory=function(){return e.CATEGORY},i.getHeight=function(){var t=this.stem_direction===e.UP?this.stem_up_y_offset:this.stem_down_y_offset;return(this.y_bottom-this.y_top)*this.stem_direction+(e.HEIGHT-t+this.stem_extension)*this.stem_direction},i.getBoundingBox=function(){throw new n.RERR("NotImplemented","getBoundingBox() not implemented.")},i.getExtents=function(){var t=this.stem_direction===e.UP,i=[this.y_top,this.y_bottom],n=e.HEIGHT+this.stem_extension,r=(t?Math.min:Math.max).apply(void 0,i),o=(t?Math.max:Math.min).apply(void 0,i);return{topY:r+n*-this.stem_direction,baseY:o}},i.setVisibility=function(t){return this.hide=!t,this},i.setStemlet=function(t,e){return this.isStemlet=t,this.stemletHeight=e,this},i.draw=function(){if(this.setRendered(),!this.hide){var t,i,r=this.checkContext(),o=this.stem_direction;o===e.DOWN?(t=this.x_begin,i=this.y_top+this.stem_down_y_offset):(t=this.x_end,i=this.y_bottom-this.stem_up_y_offset);var s=this.getHeight();!function(){for(var t=arguments.length,i=new Array(t),r=0;r1,o.point=28,o.y_pos=16,o.x_pos=100,o.width=200,o.location=o.options.location||e.LOCATION_TOP,pt.AlignRestsToNotes(i,!0,!0),o.resolveGlyphs(),o.attach(),_assertThisInitialized2(o)}_inheritsLoose(e,t);var i=e.prototype;return i.attach=function(){for(var t=0;t=1;)this.numerator_glyphs.unshift(new d("v"+t%10,this.point)),t=parseInt(t/10,10);for(this.denom_glyphs=[],t=this.notes_occupied;t>=1;)this.denom_glyphs.unshift(new d("v"+t%10,this.point)),t=parseInt(t/10,10)},i.getNestedTupletCount=function(){var t=this.location,e=this.notes[0],i=r(e,t),n=r(e,t);function r(t,e){return t.tupletStack.filter((function(t){return t.location===e})).length}return this.notes.forEach((function(e){var o=r(e,t);i=o>i?o:i,n=ot&&(t=u)}}return t+i+n},i.draw=function(){var t=this;this.checkContext(),this.setRendered();var i=this.notes[0],n=this.notes[this.notes.length-1];this.bracketed?(this.x_pos=i.getTieLeftX()-5,this.width=n.getTieRightX()-this.x_pos+5):(this.x_pos=i.getStemX(),this.width=n.getStemX()-this.x_pos),this.y_pos=this.getYPosition();var r=function(t,e){return t+e.getMetrics().width},o=this.numerator_glyphs.reduce(r,0);this.ratioed&&(o=this.denom_glyphs.reduce(r,o),o+=.32*this.point);var s=this.x_pos+this.width/2-o/2;if(this.bracketed){var a=this.width/2-o/2-5;a>0&&(this.context.fillRect(this.x_pos,this.y_pos,a,1),this.context.fillRect(this.x_pos+this.width/2+o/2+5,this.y_pos,a,1),this.context.fillRect(this.x_pos,this.y_pos+(this.location===e.LOCATION_BOTTOM),1,10*this.location),this.context.fillRect(this.x_pos+this.width,this.y_pos+(this.location===e.LOCATION_BOTTOM),1,10*this.location))}var u=0;if(this.numerator_glyphs.forEach((function(e){e.render(t.context,s+u,t.y_pos+t.point/3-2),u+=e.getMetrics().width})),this.ratioed){var l=s+u+.16*this.point,c=.06*this.point;this.context.beginPath(),this.context.arc(l,this.y_pos-.08*this.point,c,0,2*Math.PI,!0),this.context.closePath(),this.context.fill(),this.context.beginPath(),this.context.arc(l,this.y_pos+.12*this.point,c,0,2*Math.PI,!0),this.context.closePath(),this.context.fill(),u+=.32*this.point,this.denom_glyphs.forEach((function(e){e.render(t.context,s+u,t.y_pos+t.point/3-2),u+=e.getMetrics().width}))}},_createClass2(e,null,[{key:"LOCATION_TOP",get:function(){return 1}},{key:"LOCATION_BOTTOM",get:function(){return-1}},{key:"NESTING_OFFSET",get:function(){return 15}}]),e}(u);function w(t){var e=0;return t.forEach((function(t){t.keyProps&&t.keyProps.forEach((function(t){e+=t.line-3}))})),e>=0?x.DOWN:x.UP}var T="L",M="B",P=function(t){function e(e,i){var r,o,s;if((r=t.call(this)||this).setAttribute("type","Beam"),!e||e===[])throw new n.RuntimeError("BadArguments","No notes provided for beam.");if(1===e.length)throw new n.RuntimeError("BadArguments","Too few notes for beam.");if(r.ticks=e[0].getIntrinsicTicks(),r.ticks>=p.durationToTicks("4"))throw new n.RuntimeError("BadArguments","Beams can only be applied to notes shorter than a quarter note.");for(r.stem_direction=x.UP,o=0;o-1?x.UP:x.DOWN),o=0;o4?[new r(2,n)]:n<=4?[new r(1,n)]:[new r(1,4)]},e.applyAndGetBeams=function(t,i,n){return e.generateBeams(t.getTickables(),{groups:n,stem_direction:i})},e.generateBeams=function(t,i){i||(i={}),i.groups&&i.groups.length||(i.groups=[new r(2,8)]);var o=i.groups.map((function(t){if(!t.multiply)throw new n.RuntimeError("InvalidBeamGroups","The beam groups must be an array of Vex.Flow.Fractions");return t.clone().multiply(p.RESOLUTION,1)})),s=t,a=0,u=[],l=[];function c(){o.length-1>a?a+=1:a=0}!function(){var t=[];s.forEach((function(e){if(t=[],e.shouldIgnoreTicks())return u.push(l),void(l=t);l.push(e);var i=o[a].clone(),n=l.reduce((function(t,e){return e.getTicks().clone().add(t)}),new r(0,1)),s=p.durationToNumber(e.duration)<8;s&&e.tuplet&&(i.numerator*=2),n.greaterThan(i)?(s||t.push(l.pop()),u.push(l),l=t,c()):n.equals(i)&&(u.push(l),l=t,c())})),l.length>0&&u.push(l)}(),function(){var t=[];u.forEach((function(e){var n=[];e.forEach((function(e,r,o){var s=0===r||r===o.length-1,a=o[r-1],u=!i.beam_rests&&e.isRest(),l=i.beam_rests&&i.beam_middle_only&&e.isRest()&&s,c=!1;if(i.maintain_stem_directions&&a&&!e.isRest()&&!a.isRest()){var h=a.getStemDirection();c=e.getStemDirection()!==h}var f=parseInt(e.duration,10)<8;u||l||c||f?(n.length>0&&t.push(n),n=c?[e]:[]):n.push(e)})),n.length>0&&t.push(n)})),u=t}(),u.forEach((function(t){var e;if(i.maintain_stem_directions){var n=function(t){for(var e=0;e1){var e=!0;return t.forEach((function(t){t.getIntrinsicTicks()>=p.durationToTicks("4")&&(e=!1)})),e}return!1})),f=function(){var t=[];return u.forEach((function(e){var i=null;e.forEach((function(e){e.tuplet&&i!==e.tuplet&&(i=e.tuplet,t.push(i))}))})),t}(),d=[];return h.forEach((function(t){var n=new e(t);i.show_stemlets&&(n.render_options.show_stemlets=!0),i.secondary_breaks&&(n.render_options.secondary_break_ticks=p.durationToTicks(i.secondary_breaks)),!0===i.flat_beams&&(n.render_options.flat_beams=!0,n.render_options.flat_beam_offset=i.flat_beam_offset),d.push(n)})),f.forEach((function(t){var e=t.notes[0].stem_direction===x.DOWN?E.LOCATION_BOTTOM:E.LOCATION_TOP;t.setTupletLocation(e);for(var i=!1,n=0;nt?e:t}))},i.breakSecondaryAt=function(t){return this.break_on_indices=t,this},i.getSlopeY=function(t,e,i,n){return i+(t-e)*n},i.calculateSlope=function(){for(var t=this.notes,e=this.stem_direction,i=this.render_options,n=i.max_slope,r=i.min_slope,o=i.slope_iterations,s=i.slope_cost,a=t[0],u=function(t,e){var i=t.getStemExtents().topY,n=t.getStemX();return(e.getStemExtents().topY-i)/(e.getStemX()-n)}(a,t[t.length-1]),l=(n-r)/o,c=Number.MAX_VALUE,h=0,f=0,d=r;d<=n;d+=l){for(var p=0,m=0,v=1;vf)&&(l=f,a=Math.min.apply(Math,h.getYs()),u=h.getBeamCount())}var d=s/t.length,p=r+u*(1.5*n),m=a+p*-e;e===x.DOWN&&dm&&(d=a-p),o+this.render_options.flat_beam_offset_per_beam>0?(e===x.DOWN&&d>o&&!this.render_options.flat_beams||e===x.UP&&d0){var e=this.render_options.flat_beam_offset;this.render_options.flat_beam_offset_per_beam&&(e+=this.render_options.flat_beam_offset_per_beam*this.getBeamCount());for(var i,n=this.notes[0].note_heads[0].y,r=this.stem_direction>0?Math.min:Math.max,o=_createForOfIteratorHelperLoose(this.notes);!(i=o()).done;)for(var s,a=_createForOfIteratorHelperLoose(i.value.note_heads);!(s=a()).done;)n=r(n,s.value.y);t=n+e*-this.stem_direction}return t},i.applyStemExtensions=function(){for(var t=this.notes,e=this.slope,i=this.y_shift,n=this.stem_direction,r=this.beam_count,o=this.render_options,s=o.show_stemlets,a=o.stemlet_extension,u=o.beam_width,l=t[0],c=this.getBeamYToDraw(),h=l.getStemX(),f=0;f=8&&(c=-1!==this.break_on_indices.indexOf(u),this.render_options.secondary_break_ticks&&a>=this.render_options.secondary_break_ticks&&(a=0,c=!0));var h=l.getIntrinsicTicks()0&&i){var s=o.getBoundingBox();s&&i.mergeWith(s)}o.setContext(t),o.drawWithStyle()}this.boundingBox=i},_createClass2(e,null,[{key:"Mode",get:function(){return{STRICT:1,SOFT:2,FULL:3}}}]),e}(u);function I(t,e,i,r,o){if(e!==A.type.BOLD_DOUBLE_LEFT&&e!==A.type.BOLD_DOUBLE_RIGHT)throw new n.RERR("InvalidConnector","A REPEAT_BEGIN or REPEAT_END type must be provided.");var s=3,a=3.5;e===A.type.BOLD_DOUBLE_RIGHT&&(s=-5,a=3),t.fillRect(i+s,r,1,o-r),t.fillRect(i-2,r,a,o-r)}var A=function(t){function e(i,n){var r;return(r=t.call(this)||this).setAttribute("type","StaveConnector"),r.thickness=p.STAVE_LINE_THICKNESS,r.width=3,r.top_stave=i,r.bottom_stave=n,r.type=e.type.DOUBLE,r.font={family:"times",size:16,weight:"normal"},r.x_shift=0,r.texts=[],r}_inheritsLoose(e,t);var i=e.prototype;return i.setType=function(t){return(t="string"==typeof t?e.typeString[t]:t)>=e.type.SINGLE_RIGHT&&t<=e.type.NONE&&(this.type=t),this},i.setText=function(t,e){return this.texts.push({content:t,options:n.Merge({shift_x:0,shift_y:0},e)}),this},i.setFont=function(t){n.Merge(this.font,t)},i.setXShift=function(t){if("number"!=typeof t)throw n.RERR("InvalidType","x_shift must be a Number");return this.x_shift=t,this},i.draw=function(){var t=this.checkContext();this.setRendered();var i=this.top_stave.getYForLine(0),r=this.bottom_stave.getYForLine(this.bottom_stave.getNumLines()-1)+this.thickness,o=this.width,s=this.top_stave.getX();(this.type===e.type.SINGLE_RIGHT||this.type===e.type.BOLD_DOUBLE_RIGHT||this.type===e.type.THIN_DOUBLE)&&(s=this.top_stave.getX()+this.top_stave.width);var a=r-i;switch(this.type){case e.type.SINGLE:case e.type.SINGLE_LEFT:case e.type.SINGLE_RIGHT:o=1;break;case e.type.DOUBLE:s-=this.width+2;break;case e.type.BRACE:o=12;var u=this.top_stave.getX()-2+this.x_shift,l=i,c=u,h=r,f=u-o,p=l+a/2,m=f-.9*o,v=l+.2*a,b=u+1.1*o,g=p-.135*a,y=b,S=p+.135*a,_=m,x=h-.2*a,E=f-o,w=x,T=u+.4*o,M=p+.135*a,P=T,L=p-.135*a,A=E,C=v;t.beginPath(),t.moveTo(u,l),t.bezierCurveTo(m,v,b,g,f,p),t.bezierCurveTo(y,S,_,x,c,h),t.bezierCurveTo(E,w,T,M,f,p),t.bezierCurveTo(P,L,A,C,u,l),t.fill(),t.stroke();break;case e.type.BRACKET:a=(r+=4)-(i-=4),d.renderGlyph(t,s-5,i-3,40,"v1b",!0),d.renderGlyph(t,s-5,r+3,40,"v10",!0),s-=this.width+2;break;case e.type.BOLD_DOUBLE_LEFT:I(t,this.type,s+this.x_shift,i,r);break;case e.type.BOLD_DOUBLE_RIGHT:I(t,this.type,s,i,r);break;case e.type.THIN_DOUBLE:o=1;break;case e.type.NONE:break;default:throw new n.RERR("InvalidType","The provided StaveConnector.type ("+this.type+") is invalid")}this.type!==e.type.BRACE&&this.type!==e.type.BOLD_DOUBLE_LEFT&&this.type!==e.type.BOLD_DOUBLE_RIGHT&&this.type!==e.type.NONE&&t.fillRect(s,i,o,a),this.type===e.type.THIN_DOUBLE&&t.fillRect(s-3,i,o,a),t.save(),t.lineWidth=2,t.setFont(this.font.family,this.font.size,this.font.weight);for(var R=0;R0){var v=m.space.deviation,b=v>=0?"+":"";t.setFillStyle("red"),t.fillText(b+Math.round(v),a+e.getXShift(),i-10)}t.restore()};var i=e.prototype;return i.getPlayNote=function(){return this.playNote},i.setPlayNote=function(t){return this.playNote=t,this},i.isRest=function(){return!1},i.addStroke=function(t,e){return e.setNote(this),e.setIndex(t),this.modifiers.push(e),this.setPreFormatted(!1),this},i.getStave=function(){return this.stave},i.setStave=function(t){return this.stave=t,this.setYs([t.getYForLine(0)]),this.context=this.stave.context,this},i.getCategory=function(){return e.CATEGORY},i.setContext=function(t){return this.context=t,this},i.getExtraLeftPx=function(){return this.extraLeftPx},i.getExtraRightPx=function(){return this.extraRightPx},i.setExtraLeftPx=function(t){return this.extraLeftPx=t,this},i.setExtraRightPx=function(t){return this.extraRightPx=t,this},i.shouldIgnoreTicks=function(){return this.ignore_ticks},i.getLineNumber=function(){return 0},i.getLineForRest=function(){return 0},i.getGlyph=function(){return this.glyph},i.getGlyphWidth=function(){return this.glyph.getWidth(this.render_options.glyph_font_scale)},i.setYs=function(t){return this.ys=t,this},i.getYs=function(){if(0===this.ys.length)throw new n.RERR("NoYValues","No Y-values calculated for this note.");return this.ys},i.getYForTopText=function(t){if(!this.stave)throw new n.RERR("NoStave","No stave attached to this note.");return this.stave.getYForTopText(t)},i.getBoundingBox=function(){return null},i.getVoice=function(){if(!this.voice)throw new n.RERR("NoVoice","Note has no voice.");return this.voice},i.setVoice=function(t){return this.voice=t,this.preFormatted=!1,this},i.getTickContext=function(){return this.tickContext},i.setTickContext=function(t){return this.tickContext=t,this.preFormatted=!1,this},i.getDuration=function(){return this.duration},i.isDotted=function(){return this.dots>0},i.hasStem=function(){return!1},i.getDots=function(){return this.dots},i.getNoteType=function(){return this.noteType},i.setBeam=function(){return this},i.setModifierContext=function(t){return this.modifierContext=t,this},i.addModifier=function(t,e){return void 0===e&&(e=0),t.setNote(this),t.setIndex(e),this.modifiers.push(t),this.setPreFormatted(!1),this},i.getModifierStartXY=function(){if(!this.preFormatted)throw new n.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");return{x:this.getAbsoluteX(),y:this.ys[0]}},i.getMetrics=function(){if(!this.preFormatted)throw new n.RERR("UnformattedNote","Can't call getMetrics on an unformatted note.");var t=0,e=0;null!=this.modifierContext&&(t=this.modifierContext.state.left_shift,e=this.modifierContext.state.right_shift);var i=this.getWidth();return{width:i,noteWidth:i-t-e-this.extraLeftPx-this.extraRightPx,left_shift:this.x_shift,modLeftPx:t,modRightPx:e,extraLeftPx:this.extraLeftPx,extraRightPx:this.extraRightPx}},i.setWidth=function(t){this.width=t},i.getWidth=function(){if(!this.preFormatted)throw new n.RERR("UnformattedNote","Can't call GetWidth on an unformatted note.");return this.width+(this.modifierContext?this.modifierContext.getWidth():0)},i.setXShift=function(t){return this.x_shift=t,this},i.getXShift=function(){return this.x_shift},i.getX=function(){if(!this.tickContext)throw new n.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");return this.tickContext.getX()+this.x_shift},i.getAbsoluteX=function(){if(!this.tickContext)throw new n.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");var t=this.tickContext.getX();return this.stave&&(t+=this.stave.getNoteStartX()+this.render_options.stave_padding),this.isCenterAligned()&&(t+=this.getCenterXShift()),t},i.setPreFormatted=function(t){if(this.preFormatted=t,this.preFormatted){var e=this.tickContext.getExtraPx();this.left_modPx=Math.max(this.left_modPx,e.left),this.right_modPx=Math.max(this.right_modPx,e.right)}},_createClass2(e,null,[{key:"CATEGORY",get:function(){return"note"}},{key:"STAVEPADDING",get:function(){return 12}}]),e}(C),N=function(t){function e(e){var i;if((i=t.call(this,e)||this).setAttribute("type","NoteHead"),i.index=e.index,i.x=e.x||0,i.y=e.y||0,i.note_type=e.note_type,i.duration=e.duration,i.displaced=e.displaced||!1,i.stem_direction=e.stem_direction||D.STEM_UP,i.line=e.line,i.glyph=p.getGlyphProps(i.duration,i.note_type),!i.glyph)throw new n.RuntimeError("BadArguments","No glyph found for duration '"+i.duration+"' and type '"+i.note_type+"'");return i.glyph_code=i.glyph.code_head,i.x_shift=e.x_shift||0,e.custom_glyph_code&&(i.custom_glyph=!0,i.glyph_code=e.custom_glyph_code,i.stem_up_x_offset=e.stem_up_x_offset||0,i.stem_down_x_offset=e.stem_down_x_offset||0),i.style=e.style,i.slashed=e.slashed,n.Merge(i.render_options,{glyph_font_scale:e.glyph_font_scale||p.DEFAULT_NOTATION_FONT_SCALE,stroke_px:3}),i.setWidth(i.glyph.getWidth(i.render_options.glyph_font_scale)),_assertThisInitialized2(i)}_inheritsLoose(e,t);var i=e.prototype;return i.getCategory=function(){return e.CATEGORY},i.getWidth=function(){return this.width},i.isDisplaced=function(){return!0===this.displaced},i.getGlyph=function(){return this.glyph},i.setX=function(t){return this.x=t,this},i.getY=function(){return this.y},i.setY=function(t){return this.y=t,this},i.getLine=function(){return this.line},i.setLine=function(t){return this.line=t,this},i.getAbsoluteX=function(){var e=this.preFormatted?t.prototype.getAbsoluteX.call(this):this.x,i=x.WIDTH/2;return e+(this.displaced?(this.width-i)*this.stem_direction:0)},i.getBoundingBox=function(){if(!this.preFormatted)throw new n.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");var t=this.stave.getSpacingBetweenLines(),e=t/2,i=this.y-e;return new p.BoundingBox(this.getAbsoluteX(),i,this.width,t)},i.setStave=function(t){var e=this.getLine();return this.stave=t,this.setY(t.getYForNote(e)),this.context=this.stave.context,this},i.preFormat=function(){if(this.preFormatted)return this;var t=this.getWidth()+this.extraLeftPx+this.extraRightPx;return this.setWidth(t),this.setPreFormatted(!0),this},i.draw=function(){this.checkContext(),this.setRendered();var t=this.context,i=this.getAbsoluteX();this.custom_glyph&&(i+=this.stem_direction===x.UP?this.stem_up_x_offset:this.stem_down_x_offset);var r=this.y;!function(){for(var t=arguments.length,i=new Array(t),r=0;r2&&(a=!0),a||(i-=p.STEM_WIDTH/2*r),t.beginPath(),t.moveTo(i,n+o),t.lineTo(i,n+1),t.lineTo(i+s,n-o),t.lineTo(i+s,n),t.lineTo(i,n+o),t.closePath(),a?t.fill():t.stroke(),p.durationToFraction(e).equals(.5))for(var u=[-3,-1,s+1,s+3],l=0;lf?h:f,d=x,p=S}return e.right_shift+=f,!0};var i=e.prototype;return i.getCategory=function(){return e.CATEGORY},i.setNote=function(t){this.note=t,"gracenotes"===this.note.getCategory()&&(this.radius*=.5,this.setWidth(3))},i.setDotShiftY=function(t){return this.dot_shiftY=t,this},i.draw=function(){if(this.checkContext(),this.setRendered(),!this.note||null===this.index)throw new n.RERR("NoAttachedNote","Can't draw dot without a note and index.");var t=this.note.stave.options.spacing_between_lines_px,e=this.note.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});"tabnotes"===this.note.getCategory()&&(e.y=this.note.getStemExtents().baseY);var i=e.x+this.x_shift+this.width-this.radius,r=e.y+this.y_shift+this.dot_shiftY*t,o=this.context;o.beginPath(),o.arc(i,r,this.radius,0,2*Math.PI,!1),o.fill()},_createClass2(e,null,[{key:"CATEGORY",get:function(){return"dots"}}]),e}(F);function B(t,e,i){var n=(e.isrest?0:1)*i;t.line+=n,t.maxLine+=n,t.minLine+=n,t.note.setKeyLine(0,t.note.getKeyLine(0)+n)}var D=function(t){function e(i){var r;if((r=t.call(this,i)||this).setAttribute("type","StaveNote"),r.keys=i.keys,r.clef=i.clef,r.octave_shift=i.octave_shift,r.beam=null,r.glyph=p.getGlyphProps(r.duration,r.noteType),!r.glyph)throw new n.RuntimeError("BadArguments","Invalid note initialization data (No glyph found): "+JSON.stringify(i));return r.displaced=!1,r.dot_shiftY=0,r.keyProps=[],r.use_default_head_x=!1,r.note_heads=[],r.modifiers=[],n.Merge(r.render_options,{glyph_font_scale:i.glyph_font_scale||p.DEFAULT_NOTATION_FONT_SCALE,stroke_px:i.stroke_px||e.DEFAULT_LEDGER_LINE_OFFSET}),r.calculateKeyProps(),r.buildStem(),i.auto_stem?r.autoStem():r.setStemDirection(i.stem_direction),r.reset(),r.buildFlag(),_assertThisInitialized2(r)}_inheritsLoose(e,t),e.format=function(t,i){if(!t||t.length<2)return!1;if(t[0].getStave())return e.formatByY(t,i);for(var r=[],o=0;o2?r[1]:null,v=d>2?r[2]:r[1];2===d&&-1===p.stemDirection&&1===v.stemDirection&&(p=r[1],v=r[0]);var b,g=Math.max(p.voice_shift,v.voice_shift),y=0;if(2===d){var S=p.stemDirection===v.stemDirection?0:.5;return p.stemDirection===v.stemDirection&&p.minLine<=v.maxLine&&(p.isrest||(b=Math.abs(p.line-(v.maxLine+.5)),b=Math.max(b,p.stemMin),p.minLine=p.line-b,p.note.setStemLength(10*b))),p.minLine<=v.maxLine+S&&(p.isrest?B(p,v,1):v.isrest?B(v,p,-1):(y=g,p.stemDirection===v.stemDirection?p.note.setXShift(y+3):v.note.setXShift(y))),!0}return null!==m&&m.minLine0&&(this.keyProps[e-1].displaced=!0)),t=s,this.keyProps.push(o)}t=-1/0,this.keyProps.forEach((function(e){e.linee&&(e=r):r1},i.hasStem=function(){return this.glyph.stem},i.hasFlag=function(){return t.prototype.hasFlag.call(this)&&!this.isRest()},i.getStemX=function(){return"r"===this.noteType?this.getCenterGlyphX():t.prototype.getStemX.call(this)+(e=this,x.WIDTH/(2*-e.getStemDirection()));var e},i.getYForTopText=function(t){var e=this.getStemExtents();return Math.min(this.stave.getYForTopText(t),e.topY-this.render_options.annotation_spacing*(t+1))},i.getYForBottomText=function(t){var e=this.getStemExtents();return Math.max(this.stave.getYForTopText(t),e.baseY+this.render_options.annotation_spacing*t)},i.setStave=function(e){t.prototype.setStave.call(this,e);var i=this.note_heads.map((function(t){return t.setStave(e),t.getY()}));if(this.setYs(i),this.stem){var n=this.getNoteHeadBounds(),r=n.y_top,o=n.y_bottom;this.stem.setYBounds(r,o)}return this},i.getKeys=function(){return this.keys},i.getKeyProps=function(){return this.keyProps},i.isDisplaced=function(){return this.displaced},i.setNoteDisplaced=function(t){return this.displaced=t,this},i.getTieRightX=function(){var t=this.getAbsoluteX();return t+=this.getGlyphWidth()+this.x_shift+this.extraRightPx,this.modifierContext&&(t+=this.modifierContext.getExtraRightPx()),t},i.getTieLeftX=function(){var t=this.getAbsoluteX();return t+=this.x_shift-this.extraLeftPx},i.getLineForRest=function(){var t=this.keyProps[0].line;if(this.keyProps.length>1){var e=this.keyProps[this.keyProps.length-1].line,i=Math.max(t,e),r=Math.min(t,e);t=n.MidLine(i,r)}return t},i.getModifierStartXY=function(t,e,i){if(i=i||{},!this.preFormatted)throw new n.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(0===this.ys.length)throw new n.RERR("NoYValues","No Y-Values calculated for this note.");var r=F.Position,o=r.ABOVE,s=r.BELOW,a=r.LEFT,u=r.RIGHT,l=0;return t===a?l=-2:t===u?(l=this.getGlyphWidth()+this.x_shift+2,this.stem_direction===x.UP&&this.hasFlag()&&(i.forceFlagRight||function(t,e){return e===(t.getStemDirection()===x.UP?t.keyProps.length-1:0)}(this,e))&&(l+=this.flag.getMetrics().width)):t!==s&&t!==o||(l=this.getGlyphWidth()/2),{x:this.getAbsoluteX()+l,y:this.ys[e]}},i.setStyle=function(e){t.prototype.setStyle.call(this,e),this.note_heads.forEach((function(t){return t.setStyle(e)})),this.stem.setStyle(e)},i.setStemStyle=function(t){this.getStem().setStyle(t)},i.getStemStyle=function(){return this.stem.getStyle()},i.setLedgerLineStyle=function(t){this.ledgerLineStyle=t},i.getLedgerLineStyle=function(){return this.ledgerLineStyle},i.setFlagStyle=function(t){this.flagStyle=t},i.getFlagStyle=function(){return this.flagStyle},i.setKeyStyle=function(t,e){return this.note_heads[t].setStyle(e),this},i.setKeyLine=function(t,e){return this.keyProps[t].line=e,this.reset(),this},i.getKeyLine=function(t){return this.keyProps[t].line},i.addToModifierContext=function(t){this.setModifierContext(t);for(var e=0;ee)&&(e=f),null===n&&c.isDisplaced()&&(n=c.getAbsoluteX()),null!==i||c.isDisplaced()||(i=c.getAbsoluteX()),r=h>r?h:r,o=h=l;--E){var w=null!==m&&E>=d,T=null!==p&&E>=f;b(t.getYForNote(E),w,T)}this.restoreStyle(r,g)}},i.drawModifiers=function(){if(!this.context)throw new n.RERR("NoCanvasContext","Can't draw without a canvas context.");var t=this.context;t.openGroup("modifiers");for(var e=0;eb?x:b):T===F.Position.RIGHT&&(M.setXShift(v),g=(x=a+A)>g?x:g),y=P,S=w}return e.left_shift+=b,e.right_shift+=g,!0};var i=e.prototype;return i.getCategory=function(){return e.CATEGORY},i.setFretHandFinger=function(t){return this.finger=t,this},i.setOffsetX=function(t){return this.x_offset=t,this},i.setOffsetY=function(t){return this.y_offset=t,this},i.draw=function(){if(this.checkContext(),!this.note||null==this.index)throw new n.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();var t=this.context,e=this.note.getModifierStartXY(this.position,this.index),i=e.x+this.x_shift+this.x_offset,r=e.y+this.y_shift+this.y_offset+5;switch(this.position){case F.Position.ABOVE:i-=4,r-=12;break;case F.Position.BELOW:i-=2,r+=10;break;case F.Position.LEFT:i-=this.width;break;case F.Position.RIGHT:i+=1;break;default:throw new n.RERR("InvalidPostion","The position "+this.position+" does not exist")}t.save(),t.setFont(this.font.family,this.font.size,this.font.weight),t.fillText(""+this.finger,i,r),t.restore()},_createClass2(e,null,[{key:"CATEGORY",get:function(){return"frethandfinger"}}]),e}(F),G=function(){function t(){}var e=t.prototype;return e.isValidNoteValue=function(e){return!(null==e||e<0||e>=t.NUM_TONES)},e.isValidIntervalValue=function(t){return this.isValidNoteValue(t)},e.getNoteParts=function(t){if(!t||t.length<1)throw new n.RERR("BadArguments","Invalid note name: "+t);if(t.length>3)throw new n.RERR("BadArguments","Invalid note name: "+t);var e=t.toLowerCase(),i=/^([cdefgab])(b|bb|n|#|##)?$/.exec(e);if(null!=i)return{root:i[1],accidental:i[2]};throw new n.RERR("BadArguments","Invalid note name: "+t)},e.getKeyParts=function(t){if(!t||t.length<1)throw new n.RERR("BadArguments","Invalid key: "+t);var e=t.toLowerCase(),i=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(e);if(null!=i){var r=i[1],o=i[2],s=i[3];return s||(s="M"),{root:r,accidental:o,type:s}}throw new n.RERR("BadArguments","Invalid key: "+t)},e.getNoteValue=function(e){var i=t.noteValues[e];if(null==i)throw new n.RERR("BadArguments","Invalid note name: "+e);return i.int_val},e.getIntervalValue=function(e){var i=t.intervals[e];if(null==i)throw new n.RERR("BadArguments","Invalid interval name: "+e);return i},e.getCanonicalNoteName=function(e){if(!this.isValidNoteValue(e))throw new n.RERR("BadArguments","Invalid note value: "+e);return t.canonical_notes[e]},e.getCanonicalIntervalName=function(e){if(!this.isValidIntervalValue(e))throw new n.RERR("BadArguments","Invalid interval value: "+e);return t.diatonic_intervals[e]},e.getRelativeNoteValue=function(e,i,r){if(null==r&&(r=1),1!==r&&-1!==r)throw new n.RERR("BadArguments","Invalid direction: "+r);var o=(e+r*i)%t.NUM_TONES;return o<0&&(o+=t.NUM_TONES),o},e.getRelativeNoteName=function(e,i){var r=this.getNoteParts(e),o=this.getNoteValue(r.root),s=i-o;if(Math.abs(s)>t.NUM_TONES-3){var a=1;s>0&&(a=-1);var u=(i+1+(o+1))%t.NUM_TONES*a;if(Math.abs(u)>2)throw new n.RERR("BadArguments","Notes not related: "+e+", "+i+")");s=u}if(Math.abs(s)>2)throw new n.RERR("BadArguments","Notes not related: "+e+", "+i+")");var l=r.root;if(s>0)for(var c=1;c<=s;++c)l+="#";else if(s<0)for(var h=-1;h>=s;--h)l+="b";return l},e.getScaleTones=function(t,e){for(var i=[t],n=t,r=0;rg?_.shift:g,y=_.line}for(var x=0,E=function(t){for(var e=!1,n=t,r=t;r+1=7){for(var d=2,m=!0;!0===m;){m=!1;for(var v=0;v+dh?x:h}else for(c=t;c<=r;c++)h=p.accidentalColumnsTable[l][f][c-t],b[c].column=h,x=x>h?x:h;w=t=r},w=0;wT[t.column]&&(T[t.column]=t.width)}));for(var L=1;L0?(n=e.flatLine||e.dblSharpLine?2.5:3,t.dblSharpLine&&(i-=.5)):(n=t.flatLine||t.dblSharpLine?2.5:3,e.dblSharpLine&&(i-=.5));var r=Math.abs(i)-1;if(!c||c&&h){a[o.root]=l;var f=new e(u);i.addAccidental(r,f),n.push(l)}})),i.getModifiers().forEach((function(e){"gracenotegroups"===e.getCategory()&&e.getGraceNotes().forEach(t)})))};i.forEach(r)}))};var i=e.prototype;return i.reset=function(){var t=this.render_options.font_scale;this.glyph=new d(this.accidental.code,t),this.glyph.setOriginX(1),this.cautionary&&(this.parenLeft=new d(p.accidentalCodes("{").code,t),this.parenRight=new d(p.accidentalCodes("}").code,t),this.parenLeft.setOriginX(1),this.parenRight.setOriginX(1))},i.getCategory=function(){return e.CATEGORY},i.getWidth=function(){var t=this.cautionary?H(this.parenLeft)+H(this.parenRight)+this.render_options.parenLeftPadding+this.render_options.parenRightPadding:0;return H(this.glyph)+t},i.setNote=function(t){if(!t)throw new n.RERR("ArgumentError","Bad note value: "+t);this.note=t,"gracenotes"===this.note.getCategory()&&(this.render_options.font_scale=25,this.reset())},i.setAsCautionary=function(){return this.cautionary=!0,this.render_options.font_scale=28,this.reset(),this},i.draw=function(){var t=this.context,e=this.type,i=this.position,r=this.note,o=this.index,s=this.cautionary,a=this.x_shift,u=this.y_shift,l=this.glyph,c=this.parenLeft,h=this.parenRight,f=this.render_options,d=f.parenLeftPadding,p=f.parenRightPadding;if(this.checkContext(),!r||null==o)throw new n.RERR("NoAttachedNote","Can't draw accidental without a note and index.");var m=r.getModifierStartXY(i,o),v=m.x+a,b=m.y+u;W("Rendering: ",e,v,b),s?(h.render(t,v,b),v-=H(h),v-=p,v-=this.accidental.parenRightPaddingAdjustment,l.render(t,v,b),v-=H(l),v-=d,c.render(t,v,b)):l.render(t,v,b),this.setRendered()},_createClass2(e,null,[{key:"CATEGORY",get:function(){return"accidentals"}}]),e}(F),z=function(t){function e(e){var i;return(i=t.call(this)||this).setAttribute("type","NoteSubGroup"),i.note=null,i.index=null,i.position=F.Position.LEFT,i.subNotes=e,i.subNotes.forEach((function(t){t.ignore_ticks=!1})),i.width=0,i.preFormatted=!1,i.formatter=new pt,i.voice=new L({num_beats:4,beat_value:4,resolution:p.RESOLUTION}).setStrict(!1),i.voice.addTickables(i.subNotes),_assertThisInitialized2(i)||_assertThisInitialized2(i)}_inheritsLoose(e,t),e.format=function(t,e){if(!t||0===t.length)return!1;for(var i=0,n=0;n1){var e=new P(t);e.render_options.beam_width=3,e.render_options.partial_beam_length=4,this.beams.push(e)}return this},i.setNote=function(t){this.note=t},i.setWidth=function(t){this.width=t},i.getWidth=function(){return this.width},i.getGraceNotes=function(){return this.grace_notes},i.draw=function(){var t=this;this.checkContext();var i=this.getNote();if(function(){for(var t=arguments.length,i=new Array(t),r=0;rv?S:v):a===F.Position.RIGHT&&(o.setXShift(m),b=(S+=E)>b?S:b),g=_,y=s}return e.left_shift+=v,e.right_shift+=b,!0};var i=e.prototype;return i.getCategory=function(){return e.CATEGORY},i.getNote=function(){return this.note},i.setNote=function(t){return this.note=t,this},i.getIndex=function(){return this.index},i.setIndex=function(t){return this.index=t,this},i.setLineEndType=function(t){return t>=_.LineEndType.NONE&&t<=_.LineEndType.DOWN&&(this.leg=t),this},i.setStringNumber=function(t){return this.string_number=t,this},i.setOffsetX=function(t){return this.x_offset=t,this},i.setOffsetY=function(t){return this.y_offset=t,this},i.setLastNote=function(t){return this.last_note=t,this},i.setDashed=function(t){return this.dashed=t,this},i.draw=function(){var t=this.checkContext();if(!this.note||null==this.index)throw new n.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();var e=this.note.stave.options.spacing_between_lines_px,i=this.note.getModifierStartXY(this.position,this.index),r=i.x+this.x_shift+this.x_offset,o=i.y+this.y_shift+this.y_offset;switch(this.position){case F.Position.ABOVE:case F.Position.BELOW:var s=this.note.getStemExtents(),a=s.topY,u=s.baseY+2;this.note.stem_direction===D.STEM_DOWN&&(a=s.baseY,u=s.topY-2),o=this.position===F.Position.ABOVE?this.note.hasStem()?a-1.75*e:i.y-1.75*e:this.note.hasStem()?u+1.5*e:i.y+1.75*e,o+=this.y_shift+this.y_offset;break;case F.Position.LEFT:r-=this.radius/2+5;break;case F.Position.RIGHT:r+=this.radius/2+6;break;default:throw new n.RERR("InvalidPosition","The position "+this.position+" is invalid")}t.save(),t.beginPath(),t.arc(r,o,this.radius,0,2*Math.PI,!1),t.lineWidth=1.5,t.stroke(),t.setFont(this.font.family,this.font.size,this.font.weight);var l=r-t.measureText(this.string_number).width/2;if(t.fillText(""+this.string_number,l,o+4.5),null!=this.last_note){var c,h,f=this.last_note.getStemX()-this.note.getX()+5;switch(t.strokeStyle="#000000",t.lineCap="round",t.lineWidth=.6,this.dashed?_.drawDashedLine(t,r+10,o,r+f,o,[3,3]):_.drawDashedLine(t,r+10,o,r+f,o,[3,0]),this.leg){case _.LineEndType.UP:c=-10,h=this.dashed?[3,3]:[3,0],_.drawDashedLine(t,r+f,o,r+f,o+c,h);break;case _.LineEndType.DOWN:c=10,h=this.dashed?[3,3]:[3,0],_.drawDashedLine(t,r+f,o,r+f,o+c,h)}}t.restore()},_createClass2(e,null,[{key:"CATEGORY",get:function(){return"stringnumber"}}]),e}(F),J=F.Position,Z=J.ABOVE,Q=J.BELOW,$=function(t,e){return.5*t(e/.5)},tt=function(t,e){return e===Z?t<=5:t>=1},et=function(t,e){return tt(t,e)?e===Z?Math.ceil:Math.floor:Math.round},it=function(t){var e=t.getCategory();return"stavenotes"===e||"gracenotes"===e},nt=function(t){function e(e){var i;if((i=t.call(this)||this).setAttribute("type","Articulation"),i.note=null,i.index=null,i.type=e,i.position=Q,i.render_options={font_scale:38},i.articulation=p.articulationCodes(i.type),!i.articulation)throw new n.RERR("ArgumentError","Articulation not found: "+i.type);return i.glyph=new d(i.articulation.code,i.render_options.font_scale),i.setWidth(i.glyph.getMetrics().width),_assertThisInitialized2(i)}_inheritsLoose(e,t),e.format=function(t,e){if(!t||0===t.length)return!1;var i=function(t,e,i){return $(et(e,i),t.glyph.getMetrics().height/10+.5)};t.filter((function(t){return t.getPosition()===Z})).forEach((function(t){t.setTextLine(e.top_text_line),e.top_text_line+=i(t,e.top_text_line,Z)})),t.filter((function(t){return t.getPosition()===Q})).forEach((function(t){t.setTextLine(e.text_line),e.text_line+=i(t,e.text_line,Q)}));var n=t.map((function(t){return t.getWidth()})).reduce((function(t,e){return Math.max(e,t)}));return e.left_shift+=n/2,e.right_shift+=n/2,!0},e.easyScoreHook=function(t,e,i){var n=t.articulations;if(n){var r={staccato:"a.",tenuto:"a-"};n.split(",").map((function(t){return t.trim().split(".")})).map((function(t){var e=t[0],n=t[1],o={type:r[e]};return n&&(o.position=F.PositionString[n]),i.getFactory().Articulation(o)})).map((function(t){return e.addModifier(0,t)}))}};var i=e.prototype;return i.getCategory=function(){return e.CATEGORY},i.draw=function(){var t,i=this.note,r=this.index,o=this.position,s=this.glyph,a=this.articulation.between_lines,u=this.text_line,l=this.context;if(this.checkContext(),!i||null==r)throw new n.RERR("NoAttachedNote","Can't draw Articulation without a note and index.");this.setRendered();var c=i.getStave(),h=c.getSpacingBetweenLines(),f="tabnotes"===i.getCategory(),d=i.getModifierStartXY(o,r).x,p=!a||f,m=function(t,e){var i=e===Z&&t.getStemDirection()===x.UP||e===Q&&t.getStemDirection()===x.DOWN;return it(t)?t.hasStem()&&i?.5:1:t.hasStem()&&i?1:0}(i,o),v=(t={},t[Z]=function(){s.setOrigin(.5,1);var t=function(t,e){var i=t.getStave(),r=t.getStemDirection(),o=t.getStemExtents(),s=o.topY,a=o.baseY;if(it(t))return t.hasStem()?r===x.UP?s:a:Math.min.apply(Math,t.getYs());if("tabnotes"===t.getCategory())return t.hasStem()&&r===x.UP?s:i.getYForTopText(e);throw new n.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")}(i,u)-(u+m)*h;return p?Math.min(c.getYForTopText(e.INITIAL_OFFSET),t):t},t[Q]=function(){s.setOrigin(.5,0);var t=function(t,e){var i=t.getStave(),r=t.getStemDirection(),o=t.getStemExtents(),s=o.topY,a=o.baseY;if(it(t))return t.hasStem()?r===x.UP?a:s:Math.max.apply(Math,t.getYs());if("tabnotes"===t.getCategory())return t.hasStem()?r===x.UP?i.getYForBottomText(e):s:i.getYForBottomText(e);throw new n.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")}(i,u)+(u+m)*h;return p?Math.max(c.getYForBottomText(e.INITIAL_OFFSET),t):t},t)[o]();if(!f){var b=o===Z?-1:1,g=f?i.positions[r].str:i.getKeyProps()[r].line,y=(i.getYs()[r]-v)/h+g,S=function(t,e,i,n){var r=$(et(e,i),e);return t&&tt(r,i)&&r%1==0?r+.5*-n:r}(a,y,o,b);tt(S,o)&&s.setOrigin(.5,.5),v+=Math.abs(S-y)*h*b}!function(){for(var t=arguments.length,i=new Array(t),r=0;r0&&n--;for(var a=0;a0&&r0?t.tickContexts.map[r[n-1]]:null,a=n0?e=-Math.min(o.getFormatterMetrics().freedom.right,Math.abs(u)):u<0&&(e=a?Math.min(a.getFormatterMetrics().freedom.right,Math.abs(u)):0);var l=Math.min(5,Math.abs(e));e=e>0?l:-l})),this.evaluate()},e.postFormat=function(){var t=function(t){return t.list.forEach((function(e){return t.map[e].postFormat()}))};return t(this.modiferContexts),t(this.tickContexts),this},e.joinVoices=function(t){return this.createModifierContexts(t),this.hasMinTotalWidth=!1,this},e.format=function(t,e,i){var r={align_rests:!1,context:null,stave:null};return n.Merge(r,i),this.voices=t,this.alignRests(t,r.align_rests),this.createTickContexts(t),this.preFormat(e,r.context,t,r.stave),r.stave&&this.postFormat(),this},e.formatToStave=function(e,i,r){var o=i.getNoteEndX()-i.getNoteStartX()-10;!function(){for(var e=arguments.length,i=new Array(e),r=0;r=t.line?s.above:s.below)}this.placeGlyphOnLine(r,this.stave,t.line),this.glyphs.push(r);var a=this.xPositions[this.xPositions.length-1],u=r.getMetrics().width+o;this.xPositions.push(a+u),this.width+=u},i.cancelKey=function(t){return this.formatted=!1,this.cancelKeySpec=t,this},i.convertToCancelAccList=function(t){var e=p.keySignature(t),i=this.accList.length>0&&e.length>0&&e[0].type!==this.accList[0].type,n=i?e.length:e.length-this.accList.length;if(!(n<1)){for(var r=[],o=0;o0?e[0].type:null;if(this.cancelKeySpec&&(t=this.convertToCancelAccList(this.cancelKeySpec)),this.alterKeySpec&&this.convertToAlterAccList(this.alterKeySpec),this.accList.length>0){var r=(this.position===mt.Position.END?this.stave.endClef:this.stave.clef)||this.stave.clef;t&&this.convertAccLines(r,t.type,t.accList),this.convertAccLines(r,i,e);for(var o=0;o/"');e.forEach((function(e){if(isNaN(Number(e)))throw new n.RERR("BadTimeSignature","Invalid time spec: "+t+". Must contain two valid numbers.")}))}(t);var a=t.split("/").map((function(t){return t.split("")})),u=a[0],l=a[1];return{num:!0,glyph:this.makeTimeSignatureGlyph(u,l)}},i.makeTimeSignatureGlyph=function(t,e){var i=new d("v0",this.point);i.topGlyphs=[],i.botGlyphs=[];for(var n=0,r=0;ra?n:a,f=i.getMetrics().x_min;i.getMetrics=function(){return{x_min:f,x_max:f+h,width:h}};var p=(h-n)/2,m=(h-a)/2,v=this;return i.renderToStave=function(t){for(var e=t+p,i=0;ii.getWidth()&&(e-=i.getWidth()),e},i.setRepetitionTypeLeft=function(t,e){return this.modifiers.push(new bt(t,this.x,e)),this},i.setRepetitionTypeRight=function(t,e){return this.modifiers.push(new bt(t,this.x,e)),this},i.setVoltaType=function(t,e,i){return this.modifiers.push(new Tt(t,e,this.x,i)),this},i.setSection=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=12);var r=new gt(t,this.x+i,e);return r.font.size=n,this.modifiers.push(r),this},i.setTempo=function(t,e){return this.modifiers.push(new yt(t,this.x,e)),this},i.setText=function(t,e,i){return this.modifiers.push(new _t(t,e,i)),this},i.getHeight=function(){return this.height},i.getSpacingBetweenLines=function(){return this.options.spacing_between_lines_px},i.getBoundingBox=function(){return new c(this.x,this.y,this.width,this.getBottomY()-this.y)},i.getBottomY=function(){var t=this.options,e=t.spacing_between_lines_px;return this.getYForLine(t.num_lines)+t.space_below_staff_ln*e},i.getBottomLineY=function(){return this.getYForLine(this.options.num_lines)},i.getYForLine=function(t){var e=this.options,i=e.spacing_between_lines_px,n=e.space_above_staff_ln;return this.y+t*i+n*i},i.getLineForY=function(t){var e=this.options,i=e.spacing_between_lines_px,n=e.space_above_staff_ln;return(t-this.y)/i-n},i.getYForTopText=function(t){var e=t||0;return this.getYForLine(-e-this.options.top_text_position)},i.getYForBottomText=function(t){var e=t||0;return this.getYForLine(this.options.bottom_text_position+e)},i.getYForNote=function(t){var e=this.options,i=e.spacing_between_lines_px,n=e.space_above_staff_ln;return this.y+n*i+5*i-t*i},i.getYForGlyphs=function(){return this.getYForLine(3)},i.addModifier=function(t,e){return void 0!==e&&t.setPosition(e),t.setStave(this),this.formatted=!1,this.modifiers.push(t),this},i.addEndModifier=function(t){return this.addModifier(t,mt.Position.END),this},i.setBegBarType=function(t){var e=vt.type,i=e.SINGLE,n=e.REPEAT_BEGIN,r=e.NONE;return t!==i&&t!==n&&t!==r||(this.modifiers[0].setType(t),this.formatted=!1),this},i.setEndBarType=function(t){return t!==vt.type.REPEAT_BEGIN&&(this.modifiers[1].setType(t),this.formatted=!1),this},i.setClef=function(t,e,i,n){void 0===n&&(n=mt.Position.BEGIN),n===mt.Position.END?this.endClef=t:this.clef=t;var r=this.getModifiers(n,xt.CATEGORY);return 0===r.length?this.addClef(t,e,i,n):r[0].setType(t,e,i),this},i.setEndClef=function(t,e,i){return this.setClef(t,e,i,mt.Position.END),this},i.setKeySignature=function(t,e,i){void 0===i&&(i=mt.Position.BEGIN);var n=this.getModifiers(i,Et.CATEGORY);return 0===n.length?this.addKeySignature(t,e,i):n[0].setKeySig(t,e),this},i.setEndKeySignature=function(t,e){return this.setKeySignature(t,e,mt.Position.END),this},i.setTimeSignature=function(t,e,i){void 0===i&&(i=mt.Position.BEGIN);var n=this.getModifiers(i,wt.CATEGORY);return 0===n.length?this.addTimeSignature(t,e,i):n[0].setTimeSig(t),this},i.setEndTimeSignature=function(t,e){return this.setTimeSignature(t,e,mt.Position.END),this},i.addKeySignature=function(t,e,i){return void 0===i&&(i=mt.Position.BEGIN),this.addModifier(new Et(t,e).setPosition(i),i),this},i.addClef=function(t,e,i,n){return void 0===n||n===mt.Position.BEGIN?this.clef=t:n===mt.Position.END&&(this.endClef=t),this.addModifier(new xt(t,e,i),n),this},i.addEndClef=function(t,e,i){return this.addClef(t,e,i,mt.Position.END),this},i.addTimeSignature=function(t,e,i){return this.addModifier(new wt(t,e),i),this},i.addEndTimeSignature=function(t,e){return this.addTimeSignature(t,e,mt.Position.END),this},i.addTrebleGlyph=function(){return this.addClef("treble"),this},i.getModifiers=function(t,e){return void 0===t&&void 0===e?this.modifiers:this.modifiers.filter((function(i){return!(void 0!==t&&t!==i.getPosition()||void 0!==e&&e!==i.getCategory())}))},i.sortByCategory=function(t,e){for(var i=t.length-1;i>=0;i--)for(var n=0;ne[t[n+1].getCategory()]){var r=t[n];t[n]=t[n+1],t[n+1]=r}},i.format=function(){var t,e,i,n=this.modifiers[0],r=this.modifiers[1],o=this.getModifiers(mt.Position.BEGIN),s=this.getModifiers(mt.Position.END);this.sortByCategory(o,{barlines:0,clefs:1,keysignatures:2,timesignatures:3}),this.sortByCategory(s,{timesignatures:0,keysignatures:1,barlines:2,clefs:3}),o.length>1&&n.getType()===vt.type.REPEAT_BEGIN&&(o.push(o.splice(0,1)[0]),o.splice(0,0,new vt(vt.type.SINGLE))),s.indexOf(r)>0&&s.splice(0,0,new vt(vt.type.NONE));for(var a=0,u=this.x,l=0;l0){this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);var s=this.context.measureText(""+this.measure).width;t=this.getYForTopText(0)+3,this.context.fillText(""+this.measure,this.x-s/2,t),this.context.restore()}return this},i.drawVertical=function(t,e){this.drawVerticalFixed(this.x+t,e)},i.drawVerticalFixed=function(t,e){this.checkContext();var i=this.getYForLine(0),n=this.getYForLine(this.options.num_lines-1);e&&this.context.fillRect(t-3,i,1,n-i+1),this.context.fillRect(t,i,1,n-i+1)},i.drawVerticalBar=function(t){this.drawVerticalBarFixed(this.x+t,!1)},i.drawVerticalBarFixed=function(t){this.checkContext();var e=this.getYForLine(0),i=this.getYForLine(this.options.num_lines-1);this.context.fillRect(t,e,1,i-e+1)},i.getConfigForLines=function(){return this.options.line_config},i.setConfigForLine=function(t,e){if(t>=this.options.num_lines||t<0)throw new n.RERR("StaveConfigError","The line number must be within the range of the number of lines in the Stave.");if(void 0===e.visible)throw new n.RERR("StaveConfigError","The line configuration object is missing the 'visible' property.");if("boolean"!=typeof e.visible)throw new n.RERR("StaveConfigError","The line configuration objects 'visible' property must be true or false.");return this.options.line_config[t]=e,this},i.setConfigForLines=function(t){if(t.length!==this.options.num_lines)throw new n.RERR("StaveConfigError","The length of the lines configuration array must match the number of lines in the Stave");for(var e in t)t[e]||(t[e]=this.options.line_config[e]),n.Merge(this.options.line_config[e],t[e]);return this.options.line_config=t,this},e}(u),Pt=function(t){function e(e,i,r,o){var s,a={spacing_between_lines_px:13,num_lines:6,top_text_position:1};return n.Merge(a,o),(s=t.call(this,e,i,r,a)||this).setAttribute("type","TabStave"),s}_inheritsLoose(e,t);var i=e.prototype;return i.getYForGlyphs=function(){return this.getYForLine(2.5)},i.addTabGlyph=function(){return this.addClef("tab"),this},e}(Mt),Lt=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).setAttribute("type","TabNote"),r.ghost=!1,r.positions=e.positions,n.Merge(r.render_options,{glyph_font_scale:p.DEFAULT_TABLATURE_FONT_SCALE,draw_stem:i,draw_dots:i,draw_stem_through_stave:!1,y_shift:0,scale:1,font:"10pt Arial"}),r.glyph=p.getGlyphProps(r.duration,r.noteType),!r.glyph)throw new n.RuntimeError("BadArguments","Invalid note initialization data (No glyph found): "+JSON.stringify(e));return r.buildStem(),e.stem_direction?r.setStemDirection(e.stem_direction):r.setStemDirection(x.UP),r.ghost=!1,r.updateWidth(),_assertThisInitialized2(r)}_inheritsLoose(e,t);var i=e.prototype;return i.reset=function(){this.stave&&this.setStave(this.stave)},i.getCategory=function(){return e.CATEGORY},i.setGhost=function(t){return this.ghost=t,this.updateWidth(),this},i.hasStem=function(){return this.render_options.draw_stem},i.getStemExtension=function(){var t=this.getGlyph();return null!=this.stem_extension_override?this.stem_extension_override:t?1===this.getStemDirection()?t.tabnote_stem_up_extension:t.tabnote_stem_down_extension:0},i.addDot=function(){var t=new O;return this.dots+=1,this.addModifier(t,0)},i.updateWidth=function(){var t=this;this.glyphs=[],this.width=0;for(var e=0;e-1,c=e.indexOf(1)>-1;if(!(r&&c||o&&l)){1===e.length&&e.push(e[0]);var h=[];e.forEach((function(e,r,o){var u=1===e,l=e===a,c=i.getYForLine(e-1);0!==r||u?r!==o.length-1||l||(c+=s/2-1):c-=s/2-1,h.push(c),1===n&&u?h.push(t-2):-1===n&&l&&h.push(t+2)})),u.push(h.sort((function(t,e){return t-e})))}})),u}(e,function(t,e){for(var i=[],n=[],r=1;r<=t;r++)e.indexOf(r)>-1?(i.push(n),n=[]):n.push(r);return n.length>0&&i.push(n),i}(this.stave.getNumLines(),this.positions.map((function(t){return t.str}))),this.getStave(),this.getStemDirection());i.save(),i.setLineWidth(x.WIDTH),r.forEach((function(e){0!==e.length&&(i.beginPath(),i.moveTo(t,e[0]),i.lineTo(t,e[e.length-1]),i.stroke(),i.closePath())})),i.restore()}},i.drawPositions=function(){for(var t=this.context,e=this.getAbsoluteX(),i=this.ys,n=0;nparseInt(s,10)?e.SLIDE_DOWN:e.SLIDE_UP}return r.slide_direction=n,r.render_options.cp1=11,r.render_options.cp2=14,r.render_options.y_shift=.5,r.setFont({font:"Times",size:10,style:"bold italic"}),r.setNotes(i),_assertThisInitialized2(r)}return _inheritsLoose(e,t),e.createSlideUp=function(t){return new e(t,e.SLIDE_UP)},e.createSlideDown=function(t){return new e(t,e.SLIDE_DOWN)},e.prototype.renderTie=function(t){if(0===t.first_ys.length||0===t.last_ys.length)throw new n.RERR("BadArguments","No Y-values to render");var i=this.context,r=t.first_x_px,o=t.first_ys,s=t.last_x_px,a=this.slide_direction;if(a!==e.SLIDE_UP&&a!==e.SLIDE_DOWN)throw new n.RERR("BadSlide","Invalid slide direction");for(var u=0;uthis.numStrings)throw new n.RERR("BadArguments","String number must be between 1 and "+this.numStrings+":"+t);return this.tuningValues[e-1]},e.getValueForFret=function(t,e){var i=this.getValueForString(e),r=parseInt(t,10);if(r<0)throw new n.RERR("BadArguments","Fret number must be 0 or higher: "+t);return i+r},e.getNoteForFret=function(t,e){var i=this.getValueForFret(t,e),n=Math.floor(i/12),r=i%12;return p.integerToNote(r)+"/"+n},_createClass2(t,null,[{key:"names",get:function(){return{standard:"E/5,B/4,G/4,D/4,A/3,E/3",dagdad:"D/5,A/4,G/4,D/4,A/3,D/3",dropd:"E/5,B/4,G/4,D/4,A/3,D/3",eb:"Eb/5,Bb/4,Gb/4,Db/4,Ab/3,Db/3",standardBanjo:"D/5,B/4,G/4,D/4,G/5"}}}]),t}(),Dt=function(t){function e(e,i){var n;return(n=t.call(this)||this).setAttribute("type","StaveHairpin"),n.notes=e,n.hairpin=i,n.position=F.Position.BELOW,n.render_options={height:10,y_shift:0,left_shift_px:0,right_shift_px:0},n.setNotes(e),n}_inheritsLoose(e,t),e.FormatByTicksAndDraw=function(t,i,r,o,s,a){var u=i.pixelsPerTick;if(null==u)throw new n.RuntimeError("BadArguments","A valid Formatter must be provide to draw offsets by ticks.");var l=u*a.left_shift_ticks,c=u*a.right_shift_ticks,h={height:a.height,y_shift:a.y_shift,left_shift_px:l,right_shift_px:c};new e({first_note:r.first_note,last_note:r.last_note},o).setContext(t).setRenderOptions(h).setPosition(s).draw()};var i=e.prototype;return i.setPosition=function(t){return t!==F.Position.ABOVE&&t!==F.Position.BELOW||(this.position=t),this},i.setRenderOptions=function(t){return null!=t.height&&null!=t.y_shift&&null!=t.left_shift_px&&null!=t.right_shift_px&&(this.render_options=t),this},i.setNotes=function(t){if(!t.first_note&&!t.last_note)throw new n.RuntimeError("BadArguments","Hairpin needs to have either first_note or last_note set.");return this.first_note=t.first_note,this.last_note=t.last_note,this},i.renderHairpin=function(t){var i=this.checkContext(),n=this.render_options.y_shift+20,r=t.first_y;this.position===F.Position.ABOVE&&(n=30-n,r=t.first_y-t.staff_height);var o=this.render_options.left_shift_px,s=this.render_options.right_shift_px;switch(i.beginPath(),this.hairpin){case e.type.CRESC:i.moveTo(t.last_x+s,r+n),i.lineTo(t.first_x+o,r+this.render_options.height/2+n),i.lineTo(t.last_x+s,r+this.render_options.height+n);break;case e.type.DECRESC:i.moveTo(t.first_x+o,r+n),i.lineTo(t.last_x+s,r+this.render_options.height/2+n),i.lineTo(t.first_x+o,r+this.render_options.height+n)}i.stroke(),i.closePath()},i.draw=function(){this.checkContext(),this.setRendered();var t=this.first_note,e=this.last_note,i=t.getModifierStartXY(this.position,0),n=e.getModifierStartXY(this.position,0);return this.renderHairpin({first_x:i.x,last_x:n.x,first_y:t.getStave().y+t.getStave().height,last_y:e.getStave().y+e.getStave().height,staff_height:t.getStave().height}),!0},_createClass2(e,null,[{key:"type",get:function(){return{CRESC:1,DECRESC:2}}}]),e}(u),Vt=function(t){function e(i,r,o){var s;return(s=t.call(this)||this).setAttribute("type","Curve"),s.render_options={spacing:2,thickness:2,x_shift:0,y_shift:10,position:e.Position.NEAR_HEAD,position_end:e.Position.NEAR_HEAD,invert:!1,cps:[{x:0,y:10},{x:0,y:10}]},n.Merge(s.render_options,o),s.setNotes(i,r),s}_inheritsLoose(e,t);var i=e.prototype;return i.setNotes=function(t,e){if(!t&&!e)throw new n.RuntimeError("BadArguments","Curve needs to have either first_note or last_note set.");return this.from=t,this.to=e,this},i.isPartial=function(){return!this.from||!this.to},i.renderCurve=function(t){var e=this.context,i=this.render_options.cps,n=this.render_options.x_shift,r=this.render_options.y_shift*t.direction,o=t.first_x+n,s=t.first_y+r,a=t.last_x-n,u=t.last_y+r,l=this.render_options.thickness,c=(a-o)/(i.length+2);e.beginPath(),e.moveTo(o,s),e.bezierCurveTo(o+c+i[0].x,s+i[0].y*t.direction,a-c+i[1].x,u+i[1].y*t.direction,a,u),e.bezierCurveTo(a-c+i[1].x,u+(i[1].y+l)*t.direction,o+c+i[0].x,s+(i[0].y+l)*t.direction,o,s),e.stroke(),e.closePath(),e.fill()},i.draw=function(){this.checkContext(),this.setRendered();var t,i,n,r,o,s=this.from,a=this.to,u="baseY",l="baseY";function c(t){return"string"==typeof t?e.PositionString[t]:t}var h=c(this.render_options.position),f=c(this.render_options.position_end);return h===e.Position.NEAR_TOP&&(u="topY",l="topY"),f===e.Position.NEAR_HEAD?l="baseY":f===e.Position.NEAR_TOP&&(l="topY"),s?(t=s.getTieRightX(),o=s.getStemDirection(),n=s.getStemExtents()[u]):(t=a.getStave().getTieStartX(),n=a.getStemExtents()[u]),a?(i=a.getTieLeftX(),o=a.getStemDirection(),r=a.getStemExtents()[l]):(i=s.getStave().getTieEndX(),r=s.getStemExtents()[l]),this.renderCurve({first_x:t,last_x:i,first_y:n,last_y:r,direction:o*(!0===this.render_options.invert?-1:1)}),!0},_createClass2(e,null,[{key:"Position",get:function(){return{NEAR_HEAD:1,NEAR_TOP:2}}},{key:"PositionString",get:function(){return{nearHead:e.Position.NEAR_HEAD,nearTop:e.Position.NEAR_TOP}}}]),e}(u);function Gt(){for(var t=arguments.length,e=new Array(t),i=0;ir.y;n.x+=o.getMetrics().modRightPx+a.padding_left,r.x-=s.getMetrics().modLeftPx+a.padding_right;var h=o.getGlyph().getWidth();o.getKeyProps()[e].displaced&&1===o.getStemDirection()&&(n.x+=h+a.padding_left),s.getKeyProps()[l].displaced&&-1===s.getStemDirection()&&(r.x-=h+a.padding_right),n.y+=c?-3:1,r.y+=c?2:0,function(t,e,i,n){var r,o,s,a,u=n.draw_start_arrow&&n.draw_end_arrow,l=e.x,c=e.y,h=i.x,f=i.y,d=Math.sqrt((h-l)*(h-l)+(f-c)*(f-c)),p=(d-n.arrowhead_length/3)/d;n.draw_end_arrow||u?(r=Math.round(l+(h-l)*p),o=Math.round(c+(f-c)*p)):(r=h,o=f),n.draw_start_arrow||u?(s=l+(h-l)*(1-p),a=c+(f-c)*(1-p)):(s=l,a=c),n.color&&(t.setStrokeStyle(n.color),t.setFillStyle(n.color)),t.beginPath(),t.moveTo(s,a),t.lineTo(r,o),t.stroke(),t.closePath();var m,v,b,g,y=Math.atan2(f-c,h-l),S=Math.abs(n.arrowhead_length/Math.cos(n.arrowhead_angle));(n.draw_end_arrow||u)&&(m=y+Math.PI+n.arrowhead_angle,b=h+Math.cos(m)*S,g=f+Math.sin(m)*S,v=y+Math.PI-n.arrowhead_angle,Ht(t,b,g,h,f,h+Math.cos(v)*S,f+Math.sin(v)*S)),(n.draw_start_arrow||u)&&(m=y+n.arrowhead_angle,b=l+Math.cos(m)*S,g=c+Math.sin(m)*S,v=y-n.arrowhead_angle,Ht(t,b,g,l,c,l+Math.cos(v)*S,c+Math.sin(v)*S))}(i,n,r,t.render_options)})),i.restore();var u,l=i.measureText(this.text).width,c=a.text_justification,h=0;c===e.TextJustification.LEFT?h=n.x:c===e.TextJustification.CENTER?h=(r.x-n.x)/2+n.x-l/2:c===e.TextJustification.RIGHT&&(h=r.x-l);var f=a.text_position_vertical;return f===e.TextVerticalPosition.TOP?u=o.getStave().getYForTopText():f===e.TextVerticalPosition.BOTTOM&&(u=o.getStave().getYForBottomText(p.TEXT_HEIGHT_OFFSET_HACK)),i.save(),this.applyFontStyle(),i.fillText(this.text,h,u),i.restore(),this},_createClass2(e,null,[{key:"TextVerticalPosition",get:function(){return{TOP:1,BOTTOM:2}}},{key:"TextJustification",get:function(){return{LEFT:1,CENTER:2,RIGHT:3}}}]),e}(u);function zt(t,e,i,n,r){var o=jt.GLYPHS[t];new d(o.code,r).render(e,i+o.x_shift,n+o.y_shift)}var jt=function(t){function e(i){var n;return(n=t.call(this)||this).setAttribute("type","PedalMarking"),n.notes=i,n.style=e.TEXT,n.line=0,n.custom_depress_text="",n.custom_release_text="",n.font={family:"Times New Roman",size:12,weight:"italic bold"},n.render_options={bracket_height:10,text_margin_right:6,bracket_line_width:1,glyph_point_size:40,color:"black"},n}_inheritsLoose(e,t),e.createSustain=function(t){return new e(t)},e.createSostenuto=function(t){var i=new e(t);return i.setStyle(e.Styles.MIXED),i.setCustomText("Sost. Ped."),i},e.createUnaCorda=function(t){var i=new e(t);return i.setStyle(e.Styles.TEXT),i.setCustomText("una corda","tre corda"),i};var i=e.prototype;return i.setCustomText=function(t,e){return this.custom_depress_text=t||"",this.custom_release_text=e||"",this},i.setStyle=function(t){if(t<1&&t>3)throw new n.RERR("InvalidParameter","The style must be one found in PedalMarking.Styles");return this.style=t,this},i.setLine=function(t){return this.line=t,this},i.drawBracketed=function(){var t,i,r=this.context,o=!1,s=this;this.notes.forEach((function(a,u,l){o=!o;var c=a.getAbsoluteX(),h=a.getStave().getYForBottomText(s.line+3);if(c0||!0===e;return!e||r>0||(this.pos=n),a?this.matchSuccess():this.matchFail(n),{success:a,results:i,numMatches:r}},e.expectZeroOrMore=function(t){return this.expectOneOrMore(t,!0)},e.expect=function(e){var i;if(function(){for(var e=arguments.length,i=new Array(e),r=0;r=1?"w":i<1&&i>=.5?e&&i>.5?"w":"h":i<.5&&i>=.25?e&&i>.25?"h":"q":i<.25&&i>=.125?e&&i>.125?"q":"8":i<.125&&i>=.0625?e&&i>.0625?"8":"16":i<.0625&&i>=.03125?e&&i>.03125?"16":"32":i<.03125&&i>=.015625?e&&i>.015625?"32":"64":e?"64":"128"},t.pitch=function(t,e,i,n){var r=3;e&&(r=0,i.ClefType===o.ClefEnum.F&&(r=2),i.ClefType===o.ClefEnum.C&&(r=2));var a=c.NoteEnum[t.FundamentalNote].toLowerCase(),u=s.Pitch.accidentalVexflow(t.Accidental),l=t.Octave-i.OctaveOffset+r,h="";return n&&(h=this.NoteHeadCode(n)),[a+"n/"+l+h,u,i]},t.restToNotePitch=function(t,e){var i=t.Octave;switch(e){case o.ClefEnum.C:case o.ClefEnum.F:i+=2;break;case o.ClefEnum.G:}return new s.Pitch(t.FundamentalNote,i,l.AccidentalEnum.NONE)},t.NoteHeadCode=function(t){var e=t.Filled?"2":"1";switch(t.Shape){case y.NoteHeadShape.NORMAL:return"";case y.NoteHeadShape.DIAMOND:return"/D"+e;case y.NoteHeadShape.TRIANGLE:return"/T"+e;case y.NoteHeadShape.X:return"/X"+e;case y.NoteHeadShape.CIRCLEX:return"/X3";case y.NoteHeadShape.RECTANGLE:return"/R"+e;case y.NoteHeadShape.SQUARE:return"/S"+e;case y.NoteHeadShape.SLASH:default:return""}},t.GhostNote=function(e){return new r.default.Flow.GhostNote({duration:t.duration(e,!1)})},t.StaveNote=function(e){var i,n,o,s,a,u,l,c,h,f;e.sortForVexflow();var d=e.notes,p=e.parentStaffEntry.parentMeasure.parentSourceMeasure.Rules,m=d[0],b=[],g=[],_=m.graphicalNoteLength,x=void 0!==m.sourceNote.NoteTuplet,E=t.duration(_,x);void 0!==m.sourceNote.TypeLength&&m.sourceNote.TypeLength!==_&&(E=t.duration(m.sourceNote.TypeLength,x));for(var w,T,M=void 0,P=m.numberOfDots,L=!1,I=0,A=!1,C=!1,R=_createForOfIteratorHelperLoose(d);!(T=R()).done;){var N=T.value;if(P=1&&F.length-1>=D+1&&(O=null===(a=null===(s=F[D-1])||void 0===s?void 0:s.graphicalVoiceEntries[0])||void 0===a?void 0:a.parentVoiceEntry,B=null===(l=null===(u=F[D+1])||void 0===u?void 0:u.graphicalVoiceEntries[0])||void 0===l?void 0:l.parentVoiceEntry,O&&B)){var G=O.Notes[0],W=B.Notes[0];if(null===(c=G.NoteBeam)||void 0===c?void 0:c.Notes.includes(W)){var H=O.Notes.last().Pitch,U=N.Clef();b=[t.pitch(t.restToNotePitch(H.getTransposedPitch(-2),U.ClefType),!1,U,void 0)[0]]}}}if(_.RealValue===N.sourceNote.SourceMeasure.ActiveTimeSignature.RealValue&&(b=["d/5"],E="w",P=0,L=!0,I=p.WholeRestXShiftVexflow*S.unitInPixels),N.sourceNote.ParentStaff.Voices.length>1){for(var z=0,j=0;j1)switch(null===(f=null===(h=N.sourceNote.ParentVoiceEntry)||void 0===h?void 0:h.ParentVoice)||void 0===f?void 0:f.VoiceId){case 1:b=["e/5"];break;case 2:b=["f/4"]}}break}N.sourceNote.Notehead&&N.sourceNote.Notehead.Shape===y.NoteHeadShape.SLASH&&(A=!0);var X=N.vfpitch;b.push(X[0]),g.push(X[1]),M||(M=t.Clef(X[2]).type)}for(var Y=0,K=P;Y0){var nt=new r.default.Flow.Tremolo(it);nt.extra_stroke_scale=p.TremoloStrokeScale,nt.y_spacing_scale=p.TremoloYSpacingScale,w.addModifier(tt,nt)}}if(.25===J.Length.RealValue&&J.Notehead&&!1===J.Notehead.Filled)for(var rt=w.getKeyProps(),ot=0;ot");break;case v.ArticulationEnum.downbow:u=new r.default.Flow.Articulation("am"),void 0===s.placement&&(a=r.default.Flow.Modifier.Position.ABOVE);break;case v.ArticulationEnum.fermata:u=new r.default.Flow.Articulation("a@a"),a=r.default.Flow.Modifier.Position.ABOVE;break;case v.ArticulationEnum.marcatodown:u=new r.default.Flow.Articulation("a|");break;case v.ArticulationEnum.marcatoup:u=new r.default.Flow.Articulation("a^");break;case v.ArticulationEnum.invertedfermata:u=new r.default.Flow.Articulation("a@u"),a=r.default.Flow.Modifier.Position.BELOW;break;case v.ArticulationEnum.lefthandpizzicato:u=new r.default.Flow.Articulation("a+");break;case v.ArticulationEnum.naturalharmonic:u=new r.default.Flow.Articulation("ah");break;case v.ArticulationEnum.snappizzicato:u=new r.default.Flow.Articulation("ao");break;case v.ArticulationEnum.staccatissimo:u=new r.default.Flow.Articulation("av");break;case v.ArticulationEnum.staccato:u=new r.default.Flow.Articulation("a.");break;case v.ArticulationEnum.tenuto:u=new r.default.Flow.Articulation("a-");break;case v.ArticulationEnum.upbow:u=new r.default.Flow.Articulation("a|"),void 0===s.placement&&(a=r.default.Flow.Modifier.Position.ABOVE);break;case v.ArticulationEnum.strongaccent:u=new r.default.Flow.Articulation("a^")}u&&(u.setPosition(a),t.addModifier(0,u))}},t.generateOrnaments=function(t,e){var i=r.default.Flow.Modifier.Position.ABOVE;e.placement===x.PlacementEnum.Below&&(i=r.default.Flow.Modifier.Position.BELOW);var n=void 0;switch(e.GetOrnament){case g.OrnamentEnum.DelayedInvertedTurn:(n=new r.default.Flow.Ornament("turn_inverted")).setDelayed(!0);break;case g.OrnamentEnum.DelayedTurn:(n=new r.default.Flow.Ornament("turn")).setDelayed(!0);break;case g.OrnamentEnum.InvertedMordent:(n=new r.default.Flow.Ornament("mordent")).setDelayed(!1);break;case g.OrnamentEnum.InvertedTurn:(n=new r.default.Flow.Ornament("turn_inverted")).setDelayed(!1);break;case g.OrnamentEnum.Mordent:(n=new r.default.Flow.Ornament("mordent_inverted")).setDelayed(!1);break;case g.OrnamentEnum.Trill:(n=new r.default.Flow.Ornament("tr")).setDelayed(!1);break;case g.OrnamentEnum.Turn:(n=new r.default.Flow.Ornament("turn")).setDelayed(!1);break;default:return void m.default.warn("unhandled OrnamentEnum type: "+e.GetOrnament)}n&&(e.AccidentalBelow!==l.AccidentalEnum.NONE&&n.setLowerAccidental(s.Pitch.accidentalVexflow(e.AccidentalBelow)),e.AccidentalAbove!==l.AccidentalEnum.NONE&&n.setUpperAccidental(s.Pitch.accidentalVexflow(e.AccidentalAbove)),n.setPosition(i),t.addModifier(0,n))},t.StrokeTypeFromArpeggioType=function(t){switch(t){case _.ArpeggioType.ARPEGGIO_DIRECTIONLESS:return r.default.Flow.Stroke.Type.ARPEGGIO_DIRECTIONLESS;case _.ArpeggioType.BRUSH_DOWN:return r.default.Flow.Stroke.Type.BRUSH_UP;case _.ArpeggioType.BRUSH_UP:return r.default.Flow.Stroke.Type.BRUSH_DOWN;case _.ArpeggioType.RASQUEDO_DOWN:return r.default.Flow.Stroke.Type.RASQUEDO_UP;case _.ArpeggioType.RASQUEDO_UP:return r.default.Flow.Stroke.Type.RASQUEDO_DOWN;case _.ArpeggioType.ROLL_DOWN:return r.default.Flow.Stroke.Type.ROLL_UP;case _.ArpeggioType.ROLL_UP:return r.default.Flow.Stroke.Type.ROLL_DOWN;default:return r.default.Flow.Stroke.Type.ARPEGGIO_DIRECTIONLESS}},t.CreateTabNote=function(e){for(var i,n=[],o=e.notes.reverse(),s=[],a=e.notes[0].graphicalNoteLength,u=void 0!==e.notes[0].sourceNote.NoteTuplet,l=t.duration(a,u),c=0,h=!1,f=function(){var t=i.value,e=t.sourceNote,o={str:e.StringNumberTab,fret:e.FretNumber};n.push(o),e.BendArray&&e.BendArray.forEach((function(t){var e,i=t.bendalter-o.fret;e=i>1?"Full":1===i?"1/2":"1/4","up"===t.direction?s.push({type:r.default.Flow.Bend.UP,text:e,width:10}):s.push({type:r.default.Flow.Bend.DOWN,text:e,width:10})})),e.VibratoStroke&&(h=!0),c0)return!0;return!1},e.isStaccato=function(){for(var t,e=_createForOfIteratorHelperLoose(this.Articulations);!(t=e()).done;)if(t.value.articulationEnum===n.staccato)return!0;return!1},e.isAccent=function(){for(var t,e=_createForOfIteratorHelperLoose(this.Articulations);!(t=e()).done;){var i=t.value;if(i.articulationEnum===n.accent||i.articulationEnum===n.strongaccent)return!0}return!1},e.getVerseNumberForLyricEntry=function(t){var e=1;return this.lyricsEntries.forEach((function(i,n){t===n&&(e=i)})),e},e.createVoiceEntriesForOrnament=function(t,e){t||(t=this);var i=[];if(t.ornamentContainer){var n=this.notes[0],r=n.Length,s=t.ParentVoice,a=t.Timestamp,c=o.Fraction.createFromFraction(a);switch(t.ornamentContainer.GetOrnament){case u.OrnamentEnum.Trill:var h=new o.Fraction(r.Numerator,8*r.Denominator),f=n.Pitch.getTransposedPitch(1),d=e.getAlterationForPitch(f);t.OrnamentContainer.AccidentalAbove!==l.AccidentalEnum.NONE&&(d=t.ornamentContainer.AccidentalAbove);for(var p=0;p<8;p++)c=o.Fraction.plus(a,new o.Fraction(p*h.Numerator,h.Denominator)),p%2==0?this.createBaseVoiceEntry(c,h,s,n,i):this.createAlteratedVoiceEntry(c,h,s,n.SourceMeasure,f,d,i);break;case u.OrnamentEnum.Turn:var m=new o.Fraction(r.Numerator,4*r.Denominator),v=n.Pitch.getTransposedPitch(-1),b=e.getAlterationForPitch(v),g=n.Pitch.getTransposedPitch(1),y=e.getAlterationForPitch(g);this.createAlteratedVoiceEntry(c,m,s,n.SourceMeasure,g,y,i),c.Add(m),this.createBaseVoiceEntry(c,m,s,n,i),c.Add(m),this.createAlteratedVoiceEntry(c,m,s,n.SourceMeasure,v,b,i),c.Add(m),this.createBaseVoiceEntry(c,m,s,n,i);break;case u.OrnamentEnum.InvertedTurn:var S=new o.Fraction(r.Numerator,4*r.Denominator),_=n.Pitch.getTransposedPitch(-1),x=e.getAlterationForPitch(_),E=n.Pitch.getTransposedPitch(1),w=e.getAlterationForPitch(E);this.createAlteratedVoiceEntry(c,S,s,n.SourceMeasure,_,x,i),c.Add(S),this.createBaseVoiceEntry(c,S,s,n,i),c.Add(S),this.createAlteratedVoiceEntry(c,S,s,n.SourceMeasure,E,w,i),c.Add(S),this.createBaseVoiceEntry(c,S,s,n,i);break;case u.OrnamentEnum.DelayedTurn:var T=new o.Fraction(r.Numerator,2*r.Denominator),M=n.Pitch.getTransposedPitch(-1),P=e.getAlterationForPitch(M),L=n.Pitch.getTransposedPitch(1),I=e.getAlterationForPitch(L);this.createBaseVoiceEntry(c,T,s,n,i),c=o.Fraction.plus(a,T),T.Denominator=8*r.Denominator,this.createAlteratedVoiceEntry(c,T,s,n.SourceMeasure,L,I,i),c.Add(T),this.createBaseVoiceEntry(c,T,s,n,i),c.Add(T),this.createAlteratedVoiceEntry(c,T,s,n.SourceMeasure,M,P,i),c.Add(T),this.createBaseVoiceEntry(c,T,s,n,i);break;case u.OrnamentEnum.DelayedInvertedTurn:var A=new o.Fraction(r.Numerator,2*r.Denominator),C=n.Pitch.getTransposedPitch(-1),R=e.getAlterationForPitch(C),N=n.Pitch.getTransposedPitch(1),k=e.getAlterationForPitch(N);this.createBaseVoiceEntry(c,A,s,n,i),c=o.Fraction.plus(a,A),A.Denominator=8*r.Denominator,this.createAlteratedVoiceEntry(c,A,s,n.SourceMeasure,C,R,i),c.Add(A),this.createBaseVoiceEntry(c,A,s,n,i),c.Add(A),this.createAlteratedVoiceEntry(c,A,s,n.SourceMeasure,N,k,i),c.Add(A),this.createBaseVoiceEntry(c,A,s,n,i);break;case u.OrnamentEnum.Mordent:var F=new o.Fraction(r.Numerator,4*r.Denominator),O=n.Pitch.getTransposedPitch(1),B=e.getAlterationForPitch(O);this.createBaseVoiceEntry(c,F,s,n,i),c.Add(F),this.createAlteratedVoiceEntry(c,F,s,n.SourceMeasure,O,B,i),F.Denominator=2*r.Denominator,c=o.Fraction.plus(a,F),this.createBaseVoiceEntry(c,F,s,n,i);break;case u.OrnamentEnum.InvertedMordent:var D=new o.Fraction(r.Numerator,4*r.Denominator),V=n.Pitch.getTransposedPitch(-1),G=e.getAlterationForPitch(V);this.createBaseVoiceEntry(c,D,s,n,i),c.Add(D),this.createAlteratedVoiceEntry(c,D,s,n.SourceMeasure,V,G,i),D.Denominator=2*r.Denominator,c=o.Fraction.plus(a,D),this.createBaseVoiceEntry(c,D,s,n,i);break;default:throw new RangeError}return i}},e.createBaseVoiceEntry=function(e,i,n,r,o){var u=new t(e,n,r.ParentStaffEntry),l=new a.Pitch(r.Pitch.FundamentalNote,r.Pitch.Octave,r.Pitch.Accidental),c=new s.Note(u,void 0,i,l,r.SourceMeasure);u.Notes.push(c),o.push(u)},e.createAlteratedVoiceEntry=function(e,i,n,r,o,u,l){var c=new t(e,n,void 0),h=new a.Pitch(o.FundamentalNote,o.Octave,u),f=new s.Note(c,void 0,i,h,r);c.Notes.push(f),l.push(c)},_createClass2(t,[{key:"ParentSourceStaffEntry",get:function(){return this.parentSourceStaffEntry}},{key:"ParentVoice",get:function(){return this.parentVoice}},{key:"Timestamp",get:function(){return this.timestamp},set:function(t){this.timestamp=t}},{key:"Notes",get:function(){return this.notes}},{key:"IsGrace",get:function(){return this.isGrace},set:function(t){this.isGrace=t}},{key:"GraceAfterMainNote",get:function(){return this.graceAfterMainNote},set:function(t){this.graceAfterMainNote=t}},{key:"GraceNoteSlash",get:function(){return this.graceNoteSlash},set:function(t){this.graceNoteSlash=t}},{key:"GraceSlur",get:function(){return this.graceSlur},set:function(t){this.graceSlur=t}},{key:"Articulations",get:function(){return this.articulations}},{key:"TechnicalInstructions",get:function(){return this.technicalInstructions}},{key:"LyricsEntries",get:function(){return this.lyricsEntries}},{key:"Arpeggio",get:function(){return this.arpeggio},set:function(t){this.arpeggio=t}},{key:"OrnamentContainer",get:function(){return this.ornamentContainer},set:function(t){this.ornamentContainer=t}},{key:"WantedStemDirection",get:function(){return this.wantedStemDirection},set:function(t){this.wantedStemDirection=t}},{key:"StemDirectionXml",get:function(){return this.stemDirectionXml},set:function(t){this.stemDirectionXml=t}},{key:"StemDirection",get:function(){return this.stemDirection},set:function(t){this.stemDirection=t}},{key:"StemColorXml",get:function(){return this.stemColorXml},set:function(t){this.stemColorXml=t}},{key:"StemColor",get:function(){return this.stemColor},set:function(t){this.stemColor=t}}]),t}();e.VoiceEntry=h,function(t){t[t.accent=0]="accent",t[t.strongaccent=1]="strongaccent",t[t.marcatoup=2]="marcatoup",t[t.marcatodown=3]="marcatodown",t[t.invertedstrongaccent=4]="invertedstrongaccent",t[t.staccato=5]="staccato",t[t.staccatissimo=6]="staccatissimo",t[t.spiccato=7]="spiccato",t[t.tenuto=8]="tenuto",t[t.fermata=9]="fermata",t[t.invertedfermata=10]="invertedfermata",t[t.breathmark=11]="breathmark",t[t.caesura=12]="caesura",t[t.lefthandpizzicato=13]="lefthandpizzicato",t[t.naturalharmonic=14]="naturalharmonic",t[t.snappizzicato=15]="snappizzicato",t[t.upbow=16]="upbow",t[t.downbow=17]="downbow",t[t.scoop=18]="scoop",t[t.plop=19]="plop",t[t.doit=20]="doit",t[t.falloff=21]="falloff",t[t.stress=22]="stress",t[t.unstress=23]="unstress",t[t.detachedlegato=24]="detachedlegato",t[t.otherarticulation=25]="otherarticulation",t[t.bend=26]="bend"}(n=e.ArticulationEnum||(e.ArticulationEnum={})),function(t){t[t.Undefined=-1]="Undefined",t[t.Up=0]="Up",t[t.Down=1]="Down",t[t.None=2]="None",t[t.Double=3]="Double"}(r=e.StemDirectionType||(e.StemDirectionType={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var n=i(35);e.arrays=n;var r=i(157);e.Bag=r.default;var o=i(158);e.BSTree=o.default;var s=i(83);e.BSTreeKV=s.default;var a=i(29);e.Dictionary=a.default;var u=i(85);e.Heap=u.default;var l=i(159);e.LinkedDictionary=l.default;var c=i(53);e.LinkedList=c.default;var h=i(160);e.MultiDictionary=h.default;var f=i(86);e.FactoryDictionary=f.default;var d=i(86);e.DefaultDictionary=d.default;var p=i(84);e.Queue=p.default;var m=i(161);e.PriorityQueue=m.default;var v=i(82);e.Set=v.default;var b=i(162);e.Stack=b.default;var g=i(163);e.MultiRootTree=g.default;var y=i(10);e.util=y},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowMusicSheetDrawer=e.unitInPixels=void 0;var r=n(i(8)),o=i(119),s=i(46),a=i(4),u=i(63),l=i(22),c=i(3),h=i(70),f=i(79),d=n(i(1)),p=i(52),m=i(33),v=i(88);e.unitInPixels=10;var b=function(t){function i(e){var i;return void 0===e&&(e=new m.DrawingParameters),(i=t.call(this,new u.VexFlowTextMeasurer(e.Rules),e)||this).backends=[],i.zoom=1,i.pageIdx=0,i}_inheritsLoose(i,t);var n=i.prototype;return n.drawSheet=function(i){var n,o,s;"gonville"===this.rules.DefaultVexFlowNoteFont&&(r.default.Flow.DEFAULT_FONT_STACK=[null===(n=r.default.Flow.Fonts)||void 0===n?void 0:n.Gonville,null===(o=r.default.Flow.Fonts)||void 0===o?void 0:o.Bravura,null===(s=r.default.Flow.Fonts)||void 0===s?void 0:s.Custom]),r.default.Flow.STAVE_LINE_THICKNESS=this.rules.StaffLineWidth*e.unitInPixels,r.default.Flow.STEM_WIDTH=this.rules.StemWidth*e.unitInPixels,r.default.Flow.DEFAULT_NOTATION_FONT_SCALE=this.rules.VexFlowDefaultNotationFontScale,r.default.Flow.DEFAULT_TAB_FONT_SCALE=this.rules.VexFlowDefaultTabFontScale,this.pageIdx=0;for(var a,u=_createForOfIteratorHelperLoose(i.MusicPages);!(a=u()).done;){var l=a.value;if(l.PageNumber>this.rules.MaxPageToDrawNumber)break;var c=this.backends[this.pageIdx];c.graphicalMusicPage=l,c.scale(this.zoom),this.pageIdx+=1}this.pageIdx=0,this.backend=this.backends[0],t.prototype.drawSheet.call(this,i)},n.drawPage=function(e){e&&(this.backend=this.backends[e.PageNumber-1],t.prototype.drawPage.call(this,e),this.pageIdx+=1)},n.clear=function(){for(var t,e=_createForOfIteratorHelperLoose(this.backends);!(t=e()).done;)t.value.clear()},n.setZoom=function(t){this.zoom=t},n.calculatePixelDistance=function(t){return t*e.unitInPixels},n.drawStaffLine=function(e){t.prototype.drawStaffLine.call(this,e);var i=e.PositionAndShape.AbsolutePosition;this.rules.RenderSlurs&&this.drawSlurs(e,i)},n.drawSlurs=function(t,e){for(var i,n=_createForOfIteratorHelperLoose(t.GraphicalSlurs);!(i=n()).done;){var r=i.value;r.slur.isCrossed()||this.drawSlur(r,e)}},n.drawSlur=function(t,e){var i=[],n=new a.PointF2D(t.bezierStartPt.x+e.x,t.bezierStartPt.y+e.y),r=new a.PointF2D(t.bezierStartControlPt.x+e.x,t.bezierStartControlPt.y+e.y),o=new a.PointF2D(t.bezierEndControlPt.x+e.x,t.bezierEndControlPt.y+e.y),s=new a.PointF2D(t.bezierEndPt.x+e.x,t.bezierEndPt.y+e.y);i.push(this.applyScreenTransformation(n)),i.push(this.applyScreenTransformation(r)),i.push(this.applyScreenTransformation(o)),i.push(this.applyScreenTransformation(s)),t.placement===c.PlacementEnum.Above?(n.y-=.05,r.y-=.3,o.y-=.3,s.y-=.05):(n.y+=.05,r.y+=.3,o.y+=.3,s.y+=.05),i.push(this.applyScreenTransformation(n)),i.push(this.applyScreenTransformation(r)),i.push(this.applyScreenTransformation(o)),i.push(this.applyScreenTransformation(s)),this.backend.renderCurve(i)},n.drawMeasure=function(t){t.setAbsoluteCoordinates(t.PositionAndShape.AbsolutePosition.x*e.unitInPixels,t.PositionAndShape.AbsolutePosition.y*e.unitInPixels);try{t.draw(this.backend.getContext())}catch(t){d.default.warn("VexFlowMusicSheetDrawer.drawMeasure",t)}for(var i,n=_createForOfIteratorHelperLoose(t.staffEntries);!(i=n()).done;){var r=i.value;this.drawStaffEntry(r)}},n.drawLine=function(t,i,n,r){return void 0===n&&(n="#FF0000FF"),void 0===r&&(r=.2),t=this.applyScreenTransformation(t),i=this.applyScreenTransformation(i),this.backend.renderLine(t,i,n,r*e.unitInPixels)},n.DrawOverlayLine=function(t,i,n,r,o){if(void 0===r&&(r="#FF0000FF"),void 0===o&&(o=.2),!(!n.PageNumber||n.PageNumber>this.backends.length||n.PageNumber<1)){var s=n.PageNumber-1,a=this.backends[s];return t=this.applyScreenTransformation(t),i=this.applyScreenTransformation(i),a.renderLine(t,i,r,o*e.unitInPixels)} ("VexFlowMusicSheetDrawer.drawOverlayLine: invalid page number / music page number doesn't correspond to an existing backend.")},n.drawSkyLine=function(t){var e=t.PositionAndShape.AbsolutePosition,i=t.PositionAndShape.Size.width;this.drawSampledLine(t.SkyLine,e,i)},n.drawBottomLine=function(t){var e=new a.PointF2D(t.PositionAndShape.AbsolutePosition.x,t.PositionAndShape.AbsolutePosition.y),i=t.PositionAndShape.Size.width;this.drawSampledLine(t.BottomLine,e,i,"#0000FFFF")},n.drawSampledLine=function(t,e,i,n){void 0===n&&(n="#FF0000FF");for(var r=[],o=0,s=0;s0){var l,c,h=this.rules.SamplingUnit,f=new a.PointF2D(u.x,u.y),d=new a.PointF2D(r[0]/h+u.x,u.y);this.drawLine(f,d,n),t[0]>=0&&(l=new a.PointF2D(r[0]/h+u.x,u.y),c=new a.PointF2D(r[0]/h+u.x,u.y+t[r[0]]),this.drawLine(l,c,n));for(var p=1;p0)for(var e,i=_createForOfIteratorHelperLoose(t.graphicalChordContainers);!(e=i()).done;){var n=e.value;this.drawLabel(n.GraphicalLabel,l.GraphicalLayers.Notes)}this.rules.RenderLyrics&&t.LyricsEntries.length>0&&this.drawLyrics(t.LyricsEntries,l.GraphicalLayers.Notes)},n.drawLyrics=function(t,e){var i=this;t.forEach((function(t){return i.drawLabel(t.GraphicalLabel,e)}))},n.drawInstrumentBrace=function(t,e){t.draw(this.backend.getContext())},n.drawGroupBracket=function(t,e){t.draw(this.backend.getContext())},n.drawOctaveShifts=function(t){for(var e,i=_createForOfIteratorHelperLoose(t.OctaveShifts);!(e=i()).done;){var n=e.value;if(n){var r=n,o=this.backend.getContext(),s=r.getTextBracket();s.setContext(o),s.draw()}}},n.drawExpressions=function(t){for(var e,i=_createForOfIteratorHelperLoose(t.AbstractExpressions);!(e=i()).done;){var n=e.value;n instanceof f.GraphicalInstantaneousDynamicExpression?this.drawInstantaneousDynamic(n):n instanceof h.GraphicalInstantaneousTempoExpression?this.drawLabel(n.GraphicalLabel,l.GraphicalLayers.Notes):n instanceof p.GraphicalContinuousDynamicExpression?this.drawContinuousDynamic(n):n instanceof v.GraphicalUnknownExpression?this.drawLabel(n.Label,l.GraphicalLayers.Notes):d.default.warn("Unkown type of expression!")}},n.drawInstantaneousDynamic=function(t){this.drawLabel(t.Label,l.GraphicalLayers.Notes)},n.drawContinuousDynamic=function(t){if(t.IsVerbal)this.drawLabel(t.Label,l.GraphicalLayers.Notes);else for(var e,i=_createForOfIteratorHelperLoose(t.Lines);!(e=i()).done;){var n=e.value,r=new a.PointF2D(t.ParentStaffLine.PositionAndShape.AbsolutePosition.x+n.Start.x,t.ParentStaffLine.PositionAndShape.AbsolutePosition.y+n.Start.y),o=new a.PointF2D(t.ParentStaffLine.PositionAndShape.AbsolutePosition.x+n.End.x,t.ParentStaffLine.PositionAndShape.AbsolutePosition.y+n.End.y);this.drawLine(r,o,"black",n.Width)}},n.renderLabel=function(t,i,n,r,o,s){var u;if(!t.Label.print)return[];var l,c=[],h=t.Label.fontHeight*e.unitInPixels,f=t.Label.font;this.rules.ColoringEnabled&&((l=t.Label.colorDefault)||(l=this.rules.DefaultColorLabel));var d=t.Label,p=d.fontStyle,m=d.fontFamily;p||(p=this.rules.DefaultFontStyle),m||(m=this.rules.DefaultFontFamily);for(var v=0;v<(null===(u=t.TextLines)||void 0===u?void 0:u.length);v++){var b=t.TextLines[v],g=this.calculatePixelDistance(b.xOffset),y=new a.PointF2D(s.x+g,s.y);c.push(this.backend.renderText(h,p,f,b.text,o,y,l,t.Label.fontFamily)),s.y=s.y+o,t.TextLines.length>1&&(s.y+=this.rules.SpacingBetweenTextLines)}return c},n.renderRectangle=function(t,e,i,n,r){return this.backend.renderRectangle(t,i,n,r)},n.applyScreenTransformation=function(t){return new a.PointF2D(t.x*e.unitInPixels,t.y*e.unitInPixels)},n.applyScreenTransformationForRect=function(t){return new s.RectangleF2D(t.x*e.unitInPixels,t.y*e.unitInPixels,t.width*e.unitInPixels,t.height*e.unitInPixels)},_createClass2(i,[{key:"Backends",get:function(){return this.backends}}]),i}(o.MusicSheetDrawer);e.VexFlowMusicSheetDrawer=b},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MusicSheetCalculator=void 0;var r=i(68),o=i(0),s=i(36),a=i(7),u=i(30),l=i(14),c=i(113),h=i(4),f=i(31),d=i(24),p=i(9),m=i(18),v=i(41),b=i(5),g=i(115),y=i(116),S=i(7),_=n(i(1)),x=i(15),E=i(27),w=i(12),T=i(54),M=i(3),P=i(70),L=i(37),I=i(56),A=i(32),C=i(52),R=i(25),N=i(88),k=function(){function t(){this.staffEntriesWithGraphicalTies=[],this.staffEntriesWithOrnaments=[],this.staffEntriesWithChordSymbols=[],this.staffLinesWithLyricWords=[],this.graphicalLyricWords=[],this.abstractNotImplementedErrorMessage="abstract, not implemented"}t.setMeasuresMinStaffEntriesWidth=function(t,e){for(var i=0,n=t.length;i0&&this.rules.RenderMultipleRestMeasures){h.isReducedToMultiRest=!0,h.multipleRestMeasureNumber=1;var d=h.multipleRestMeasures-1;l+=d;for(var p=1;p<=d;p++){var m=t.SourceMeasures[h.MeasureNumber-1+p];m.multipleRestMeasureNumber=p+1,m.isReducedToMultiRest=!0,e.push([void 0])}}}if(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures&&this.rules.RenderMultipleRestMeasures){for(var v=void 0,b=0,g=0,y=t.SourceMeasures.length;g0){v.isReducedToMultiRest=!0,v.multipleRestMeasureNumber=1,b++,S.multipleRestMeasureNumber=b,S.isReducedToMultiRest=!0;for(var _=0;_1){v.multipleRestMeasures=b;var x=this.createGraphicalMeasuresForSourceMeasure(v,i,r,s,n);e[v.measureListIndex]=x,b=0,v=void 0}else b=0,v=void 0}if(b>1){v.multipleRestMeasures=b,v.isReducedToMultiRest=!0;var E=this.createGraphicalMeasuresForSourceMeasure(v,i,r,s,n);e[v.measureListIndex]=E,b=0,v=void 0}}var w=n.map((function(t){return t.ClefType===a.ClefEnum.percussion}));this.handleStaffEntries(w),this.calculateVerticalContainersList(),this.setIndicesToVerticalGraphicalContainers()},e.calculate=function(){this.musicSystems=[],this.clearSystemsAndMeasures(),this.clearRecreatedObjects(),this.createGraphicalTies(),this.calculateSheetLabelBoundingBoxes(),this.calculateXLayout(this.graphicalMusicSheet,this.maxInstrNameLabelLength()),this.graphicalMusicSheet.MusicPages.length=0,this.calculateMusicSystems(),r.GraphicalMusicSheet.transformRelativeToAbsolutePosition(this.graphicalMusicSheet)},e.calculateXLayout=function(e,i){if(this.graphicalMusicSheet.MeasureList.length>0){var n=this.graphicalMusicSheet.MeasureList[0],r=this.calculateMeasureXLayout(n);r=this.calculateMeasureWidthFromStaffEntries(n,r),t.setMeasuresMinStaffEntriesWidth(n,r);for(var o=1;o0)return;var o=e.Measures[r];0!==o.MeasureNumber&&1!==o.MeasureNumber||(i=o.MeasureNumber),n=o!==e.Measures[0]&&this.rules.MeasureNumberLabelXOffset?this.rules.MeasureNumberLabelXOffset:0;var s=this.rules.UseXMLMeasureNumbers&&1===o.MeasureNumber&&1!==o.parentSourceMeasure.getPrintedMeasureNumber();((o.MeasureNumber===i||o.MeasureNumber>=i+this.rules.MeasureNumberLabelOffset)&&!o.parentSourceMeasure.ImplicitMeasure||s)&&((1!==o.MeasureNumber||1===o.MeasureNumber&&o!==e.Measures[0]||s)&&this.calculateSingleMeasureNumberPlacement(o,e,t,n),i=o.MeasureNumber)}else _.default.warn("calculateMeasureNumberPlacement: measure undefined for system.Id "+t.Id)},e.calculateSingleMeasureNumberPlacement=function(t,e,i,n){void 0===n&&(n=0);var r=t.parentSourceMeasure.getPrintedMeasureNumber().toString(),o=new w.Label(r),s=new d.GraphicalLabel(o,this.rules.MeasureNumberLabelHeight,p.TextAlignmentEnum.LeftBottom,this.rules),a=e.SkyBottomLineCalculator;s.setLabelPositionAndShapeBorders(),s.PositionAndShape.Parent=i.PositionAndShape;var u,l=e.PositionAndShape.RelativePosition.x+t.PositionAndShape.RelativePosition.x-s.PositionAndShape.BorderMarginLeft+n,c=l,f=l-s.PositionAndShape.BorderLeft+s.PositionAndShape.BorderRight,m=.5+(c-=e.PositionAndShape.RelativePosition.x),v=(f-=e.PositionAndShape.RelativePosition.x)-.5,b=a.getSkyLineMinInRange(m,v);if(t===e.Measures[0]){var g=0;if(i.GroupBrackets.length>0)for(var y,S=_createForOfIteratorHelperLoose(i.GroupBrackets);!(y=S()).done;){var _=y.value;g=Math.min(g,_.PositionAndShape.BorderTop)}u=Math.min(b,g)}else u=b;u=Math.min(0,u),s.PositionAndShape.RelativePosition=new h.PointF2D(l,u),a.updateSkyLineInRange(c,f,u+s.PositionAndShape.BorderMarginTop),i.MeasureNumberLabels.push(s)},e.layoutGraphicalTie=function(t,e,i){throw new Error(this.abstractNotImplementedErrorMessage)},e.calculateSingleStaffLineLyricsPosition=function(t,e){for(var i=0,n=this.rules.StaffHeight,r=[],o=t.SkyBottomLineCalculator,s=t.Measures.length,a=0;a0){r.push(d),i=Math.max(i,d.LyricsEntries.length);for(var p=d.PositionAndShape.RelativePosition.x+l.x,m=Number.MAX_VALUE,v=Number.MIN_VALUE,b=0;b0){var C=t.PositionAndShape.Size.width,R=r[0].PositionAndShape.RelativePosition.x+r[0].PositionAndShape.BorderMarginLeft+r[0].parentMeasure.PositionAndShape.RelativePosition.x;R=R>C?C:R,o.updateBottomLineInRange(R,C,S)}return r},e.calculateLyricsExtendsAndDashes=function(t){for(var e=0,i=t.length;e0||t.UnknownList.length>0){for(var a="",u=0,l=t.EntriesList.length;ut.length-1&&(_.default.debug("minimum measure to draw index out of range. resetting min measure index to limit."),this.rules.MinMeasureToDrawIndex=t.length-1);for(var e=[],i=this.rules.MinMeasureToDrawIndex,n=t.length;if){var w=h.StaffLines[E].PositionAndShape.RelativePosition.y-r.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;S=this.rules.StaffHeight+w/2}else S=this.rules.WedgePlacementBelowY;S-=this.rules.WedgeOpeningLength/2,a||(x=S);var T=d.getBottomLineMaxInRange(v,g);if(T>S&&(S=T),fx&&(x=T),x+=this.rules.WedgeOpeningLength/2,x+=this.rules.WedgeVerticalMargin),S+=this.rules.WedgeOpeningLength/2,S+=this.rules.WedgeVerticalMargin}else if(p===M.PlacementEnum.Above){if(1===r.ParentStaff.ParentInstrument.Staves.length)S=this.rules.WedgePlacementAboveY;else{var I=0;f>0&&(I=f-1);var R=h.StaffLines[I];S=-(r.PositionAndShape.RelativePosition.y-R.PositionAndShape.RelativePosition.y-this.rules.StaffHeight)/2}S+=this.rules.WedgeOpeningLength/2,a||(x=S);var N=d.getSkyLineMinInRange(v,g);if(N1&&f>0){var k=r.findClosestStaffEntry(v),F=r.findClosestStaffEntry(g);k&&F&&k.parentVerticalContainer}a||((N=s.SkyBottomLineCalculator.getSkyLineMinInRange(b,y))-l/2?-l/2:a-t.PositionAndShape.BorderMarginBottom}else s=a-t.PositionAndShape.BorderMarginBottom;t.PositionAndShape.RelativePosition=new h.PointF2D(e.x,s)}else if(t.Placement===M.PlacementEnum.Below){var c=o.getBottomLineMaxInRange(n,r),f=i.ParentStaff.ParentInstrument.Staves[i.ParentStaff.ParentInstrument.Staves.length-1];if(i.isPartOfMultiStaffInstrument()&&i.ParentStaff!==f){var d=i.ParentMusicSystem.StaffLines[i.ParentMusicSystem.StaffLines.indexOf(i)+1].PositionAndShape.RelativePosition.y-i.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;s=c+t.PositionAndShape.BorderMarginBottomt.PositionAndShape.Size.width&&(c=(f=t.PositionAndShape.Size.width-this.rules.MeasureRightMargin)-u.PositionAndShape.MarginSize.width,e.x=c-u.PositionAndShape.BorderMarginLeft);var m=t.SkyBottomLineCalculator;return l=r===M.PlacementEnum.Below?m.getBottomLineMaxInRange(c,f):m.getSkyLineMinInRange(c,f),u.PositionAndShape.RelativePosition=new h.PointF2D(e.x,l),r===M.PlacementEnum.Below?m.updateBottomLineInRange(c,f,u.PositionAndShape.BorderMarginBottom+l):m.updateSkyLineInRange(c,f,u.PositionAndShape.BorderMarginTop+l),u},e.calculateTempoExpressionsForMultiTempoExpression=function(t,e,i){var n=o.Fraction.plus(t.AbsoluteTimestamp,e.Timestamp),r=this.graphicalMusicSheet.MeasureList[i],s=new h.PointF2D;if(e.ContinuousTempo||e.InstantaneousTempo){if(this.rules.MinMeasureToDrawIndex>0)return;if(!r[0])return;for(var a=r[0].ParentStaffLine,u=r[0].PositionAndShape.RelativePosition.x,l=0,c=0;c0){a=r[c].ParentStaffLine,u=r[c].PositionAndShape.RelativePosition.x,l=c;break}if(s=this.getRelativePositionInStaffLineFromTimestamp(n,l,a,a.isPartOfMultiStaffInstrument(),u),e.EntriesList.length>0&&e.EntriesList[0].Expression instanceof L.InstantaneousTempoExpression&&(e.EntriesList[0].Expression.Placement=M.PlacementEnum.Above,a.Measures[0].staffEntries.length>0&&0===Math.abs(s.x-a.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x)&&a.ParentMusicSystem===this.musicSystems[0])){var f=a.Measures[0].FirstInstructionStaffEntry;if(f){var d=f.GraphicalInstructions.last();s.x=d.PositionAndShape.RelativePosition.x}this.rules.CompactMode&&(s.x=a.PositionAndShape.RelativePosition.x+a.Measures[0].PositionAndShape.RelativePosition.x)}for(var m,v=_createForOfIteratorHelperLoose(e.EntriesList);!(m=v()).done;){var b=m.value,g=p.TextAlignmentEnum.CenterBottom;this.rules.CompactMode&&(g=p.TextAlignmentEnum.LeftBottom);var y=this.calculateLabel(a,s,b.label,e.getFontstyleOfFirstEntry(),b.Expression.Placement,this.rules.UnknownTextHeight,g);if(b.Expression instanceof L.InstantaneousTempoExpression){for(var S,x=_createForOfIteratorHelperLoose(a.AbstractExpressions);!(S=x()).done;){var E=S.value;E instanceof P.GraphicalInstantaneousTempoExpression&&(E.SourceExpression.Label,b.Expression.Label)}if(new P.GraphicalInstantaneousTempoExpression(b.Expression,y).ParentStaffLine||_.default.warn("Adding staffline didn't work"),this.rules.MetronomeMarksDrawn&&b.Expression.Enum===L.TempoEnum.metronomeMark){this.createMetronomeMark(b.Expression);continue}}else b.Expression,I.ContinuousTempoExpression}}},e.createMetronomeMark=function(t){throw new Error(this.abstractNotImplementedErrorMessage)},e.graphicalMeasureCreatedCalculations=function(t){},e.clearSystemsAndMeasures=function(){for(var t=0,e=this.graphicalMusicSheet.MusicPages.length;t-1&&h.PositionAndShape.ChildElements.splice(f,1),h.FirstInstructionStaffEntry=void 0,h.beginInstructionsWidth=0}if(h.LastInstructionStaffEntry){var d=h.PositionAndShape.ChildElements.indexOf(h.LastInstructionStaffEntry.PositionAndShape);d>-1&&h.PositionAndShape.ChildElements.splice(d,1),h.LastInstructionStaffEntry=void 0,h.endInstructionsWidth=0}}u.Measures=[],u.PositionAndShape.ChildElements=[]}o.StaffLines.length=0,o.PositionAndShape.ChildElements=[]}i.MusicSystems=[],i.PositionAndShape.ChildElements=[]}this.graphicalMusicSheet.MusicPages=[]},e.handleVoiceEntry=function(e,i,n,r,o,s,a,u,c,h,f){e.StemDirectionXml!==l.StemDirectionType.Undefined&&this.rules.SetWantedStemDirectionByXml&&void 0!==e.StemDirectionXml?e.WantedStemDirection=e.StemDirectionXml:this.calculateStemDirectionFromVoices(e);var d=i.findOrCreateGraphicalVoiceEntry(e);d.octaveShiftValue=u;var p,m=i.tabStaffEntry;m&&(p=m.findOrCreateGraphicalVoiceEntry(e));for(var v=0,b=e.Notes.length;v-1)){var y=void 0;if(e.IsGrace?y=t.symbolFactory.createGraceNote(g,d,o,this.rules,u):(y=t.symbolFactory.createNote(g,d,o,u,this.rules,void 0),t.stafflineNoteCalculator.trackNote(y)),g.Pitch&&this.checkNoteForAccidental(y,n,o,u),this.resetYPositionForLeadSheet(y.PositionAndShape),i.addGraphicalNoteToListAtCorrectYPosition(d,y),y.PositionAndShape.calculateBoundingBox(),this.leadSheet||(void 0!==g.NoteBeam&&g.PrintObject&&this.handleBeam(y,g.NoteBeam,a),void 0!==g.NoteTuplet&&g.PrintObject&&this.handleTuplet(y,g.NoteTuplet,s)),p){var S=t.symbolFactory.createNote(g,p,o,u,this.rules,void 0);m.addGraphicalNoteToListAtCorrectYPosition(p,S),S.PositionAndShape.calculateBoundingBox(),this.leadSheet||g.NoteTuplet&&this.handleTuplet(S,g.NoteTuplet,s)}}}return e.Articulations.length>0&&this.handleVoiceEntryArticulations(e.Articulations,e,i),e.TechnicalInstructions.length>0&&this.handleVoiceEntryTechnicalInstructions(e.TechnicalInstructions,e,i),e.LyricsEntries.size()>0&&this.handleVoiceEntryLyrics(e,i,r),e.OrnamentContainer&&this.handleVoiceEntryOrnaments(e.OrnamentContainer,e,i),u},e.resetYPositionForLeadSheet=function(t){this.leadSheet&&(t.RelativePosition=new h.PointF2D(t.RelativePosition.x,0))},e.layoutVoiceEntries=function(t,e){if(t.PositionAndShape.RelativePosition=new h.PointF2D(0,0),!this.leadSheet)for(var i,n=_createForOfIteratorHelperLoose(t.graphicalVoiceEntries);!(i=n()).done;){var r=i.value.notes;if(0!==r.length){var o=r[0].sourceNote.ParentVoiceEntry,s=void 0!==r[0].sourceNote.Pitch;this.layoutVoiceEntry(o,r,t,s)}}},e.maxInstrNameLabelLength=function(){for(var t,e,i=0,n=_createForOfIteratorHelperLoose(this.graphicalMusicSheet.ParentMusicSheet.Instruments);!(e=n()).done;){var r=e.value;if((null===(t=r.NameLabel)||void 0===t?void 0:t.print)&&r.Voices.length>0&&r.Voices[0].Visible){var o=r.NameLabel;this.rules.RenderPartNames||(o=new w.Label("",o.textAlignment,o.font));var s=new d.GraphicalLabel(o,this.rules.InstrumentLabelTextHeight,p.TextAlignmentEnum.LeftCenter,this.rules);s.setLabelPositionAndShapeBorders(),i=Math.max(i,s.PositionAndShape.MarginSize.width)}}return this.rules.RenderPartNames?i:0},e.calculateSheetLabelBoundingBoxes=function(){var t=this.graphicalMusicSheet.ParentMusicSheet,e=this.rules.DefaultColorTitle;if(void 0!==t.Title&&this.rules.RenderTitle){var i=new d.GraphicalLabel(t.Title,this.rules.SheetTitleHeight,p.TextAlignmentEnum.CenterBottom,this.rules);i.Label.IsCreditLabel=!0,i.Label.colorDefault=e,this.graphicalMusicSheet.Title=i,i.setLabelPositionAndShapeBorders()}else this.rules.RenderTitle||(this.graphicalMusicSheet.Title=void 0);if(void 0!==t.Subtitle&&this.rules.RenderSubtitle){var n=new d.GraphicalLabel(t.Subtitle,this.rules.SheetSubtitleHeight,p.TextAlignmentEnum.CenterCenter,this.rules);n.Label.IsCreditLabel=!0,n.Label.colorDefault=e,this.graphicalMusicSheet.Subtitle=n,n.setLabelPositionAndShapeBorders()}else this.rules.RenderSubtitle||(this.graphicalMusicSheet.Subtitle=void 0);if(void 0!==t.Composer&&this.rules.RenderComposer){var r=new d.GraphicalLabel(t.Composer,this.rules.SheetComposerHeight,p.TextAlignmentEnum.RightCenter,this.rules);r.Label.IsCreditLabel=!0,r.Label.colorDefault=e,this.graphicalMusicSheet.Composer=r,r.setLabelPositionAndShapeBorders()}else this.rules.RenderComposer||(this.graphicalMusicSheet.Composer=void 0);if(void 0!==t.Lyricist&&this.rules.RenderLyricist){var o=new d.GraphicalLabel(t.Lyricist,this.rules.SheetAuthorHeight,p.TextAlignmentEnum.LeftCenter,this.rules);o.Label.IsCreditLabel=!0,o.Label.colorDefault=e,this.graphicalMusicSheet.Lyricist=o,o.setLabelPositionAndShapeBorders()}else this.rules.RenderLyricist||(this.graphicalMusicSheet.Lyricist=void 0)},e.checkMeasuresForWholeRestNotes=function(){for(var t=0,e=this.musicSystems.length;t0&&1===c.graphicalVoiceEntries[0].notes.length){var h=c.graphicalVoiceEntries[0].notes[0];!h.sourceNote.Pitch&&new o.Fraction(1,2).lt(h.sourceNote.Length)&&this.layoutMeasureWithWholeRest(h,c,l)}}}},e.optimizeRestNotePlacement=function(t,e){if(0!==t.graphicalVoiceEntries.length){var i=t.graphicalVoiceEntries[0].notes;if(0!==i.length){var n=i[0],r=n.sourceNote.isRest();if(2===t.graphicalVoiceEntries.length){var o=!1,s=t.graphicalVoiceEntries[1].notes;s.length>0&&(o=s[0].sourceNote.isRest()),r&&o?this.calculateTwoRestNotesPlacementWithCollisionDetection(t):(r||o)&&this.calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(t)}else if(r&&t!==e.staffEntries[0]&&t!==e.staffEntries[e.staffEntries.length-1]){var a=e.staffEntries.indexOf(t),u=e.staffEntries[a-1],l=e.staffEntries[a+1];if(1===u.graphicalVoiceEntries.length){var c=u.graphicalVoiceEntries[0].notes[0];if(void 0!==c.sourceNote.NoteBeam&&1===l.graphicalVoiceEntries.length){var h=l.graphicalVoiceEntries[0].notes[0];void 0!==h.sourceNote.NoteBeam&&c.sourceNote.NoteBeam===h.sourceNote.NoteBeam&&(this.calculateRestNotePlacementWithinGraphicalBeam(t,n,c,l,h),t.PositionAndShape.calculateBoundingBox())}}}}}},e.getRelativePositionInStaffLineFromTimestamp=function(t,e,i,n,r){void 0===r&&(r=0);var s=new h.PointF2D,a=void 0,u=void 0,l=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,c=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(t),f=Math.min(Math.floor(c),l-1),d=Math.min(Math.ceil(c),l-1);if(f<0||e<0)return s;if(a=this.getFirstLeftNotNullStaffEntryFromContainer(f,e,n),u=this.getFirstRightNotNullStaffEntryFromContainer(d,e,n),a&&u){var p=a.parentMeasure.PositionAndShape.RelativePosition.x;r>0&&(p=r);var m=a.PositionAndShape.RelativePosition.x+p,v=u.PositionAndShape.RelativePosition.x+u.parentMeasure.PositionAndShape.RelativePosition.x;r>0&&(v=u.PositionAndShape.RelativePosition.x+p);var b=0;if(a!==u){var g=a.getAbsoluteTimestamp(),y=u.getAbsoluteTimestamp();b=o.Fraction.minus(t,g).RealValue/o.Fraction.minus(y,g).RealValue}a.parentMeasure.ParentStaffLine!==u.parentMeasure.ParentStaffLine&&(a.parentMeasure.ParentStaffLine===i?v=i.PositionAndShape.Size.width:m=i.PositionAndShape.RelativePosition.x),s=new h.PointF2D(m+(v-m)*b,0)}return s},e.getRelativeXPositionFromTimestamp=function(t){var e=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,i=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(t),n=Math.max(0,Math.min(Math.round(i),e-1)),r=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[n].getFirstNonNullStaffEntry();return r.PositionAndShape.RelativePosition.x+r.parentMeasure.PositionAndShape.RelativePosition.x},e.calculatePageLabels=function(t){var e;this.rules.RenderSingleHorizontalStaffline&&(t.PositionAndShape.BorderRight=t.PositionAndShape.Size.width,t.PositionAndShape.calculateBoundingBox(),this.graphicalMusicSheet.ParentMusicSheet.pageWidth=t.PositionAndShape.Size.width);var i=10;if(t.MusicSystems.length>0){var n=t.MusicSystems[0];i=n.PositionAndShape.RelativePosition.y+n.PositionAndShape.BorderTop}if(this.graphicalMusicSheet.Title){var r=this.graphicalMusicSheet.Title;r.PositionAndShape.Parent=t.PositionAndShape;var o=new h.PointF2D;o.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,o.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight,r.PositionAndShape.RelativePosition=o,t.Labels.push(r)}if(this.graphicalMusicSheet.Subtitle){var s=this.graphicalMusicSheet.Subtitle;s.PositionAndShape.Parent=t.PositionAndShape;var a=new h.PointF2D;a.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,a.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight+this.rules.SheetMinimumDistanceBetweenTitleAndSubtitle,s.PositionAndShape.RelativePosition=a,t.Labels.push(s)}var u,l=this.graphicalMusicSheet.Composer;if(l){l.PositionAndShape.Parent=t.PositionAndShape,l.setLabelPositionAndShapeBorders();var c=new h.PointF2D;c.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageRightMargin,c.y=i,c.y-=this.rules.SystemComposerDistance;var f=null===(e=l.TextLines)||void 0===e?void 0:e.length;f>1&&(c.y-=l.PositionAndShape.BorderBottom*(f-1)/f),u=c.y,l.PositionAndShape.RelativePosition=c,t.Labels.push(l)}var d=this.graphicalMusicSheet.Lyricist;if(d){d.PositionAndShape.Parent=t.PositionAndShape,d.setLabelPositionAndShapeBorders();var p=new h.PointF2D;p.x=this.rules.PageLeftMargin,p.y=i,p.y+=d.PositionAndShape.BorderBottom,p.y=Math.min(p.y,u),d.PositionAndShape.RelativePosition=p,t.Labels.push(d)}},e.createGraphicalTies=function(){for(var t=0;t=0&&this.staffEntriesWithGraphicalTies.push(r)}r=s}},e.createAccidentalCalculators=function(){var t=[],e=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(e)for(var i=0;i1)return;x=t.symbolFactory.createGraphicalMeasure(e,_)}if(x.hasError=e.getErrorInMeasure(p),e.FirstInstructionsStaffEntries[p])for(var E=0,w=e.FirstInstructionsStaffEntries[p].Instructions.length;E0){var j=F.Instructions[0];t.symbolFactory.createInStaffClef(V,j)}this.rules.RenderChordSymbols&&(null===(y=F.ChordContainers)||void 0===y?void 0:y.length)>0&&(F.ParentStaff.ParentInstrument.HasChordSymbols=!0,t.symbolFactory.createChordSymbols(F,V,r.ActiveKeyInstruction,this.graphicalMusicSheet.ParentMusicSheet.Transpose))}}if(r.doCalculationsAtEndOfMeasure(),e.LastInstructionsStaffEntries[p])for(var X=e.LastInstructionsStaffEntries[p],Y=0,K=X.Instructions.length;Y=1&&0===x.staffEntries.length){var rt=new f.SourceStaffEntry(new T.VerticalSourceStaffEntryContainer(x.parentSourceMeasure,x.parentSourceMeasure.AbsoluteTimestamp,x.parentSourceMeasure.CompleteNumberOfStaves),_),ot=new l.VoiceEntry(new o.Fraction(0,1),_.Voices[0],rt),st=new s.Note(ot,rt,o.Fraction.createFromFraction(e.Duration),void 0,e);st.PrintObject=this.rules.FillEmptyMeasuresWithWholeRest===R.FillEmptyMeasuresWithWholeRests.YesVisible,ot.Notes.push(st);var at=t.symbolFactory.createStaffEntry(rt,x);x.addGraphicalStaffEntry(at),at.relInMeasureTimestamp=ot.Timestamp;var ut=t.symbolFactory.createVoiceEntry(ot,at);at.graphicalVoiceEntries.push(ut);var lt=t.symbolFactory.createNote(st,ut,new a.ClefInstruction,u.OctaveEnum.NONE,void 0);t.stafflineNoteCalculator.trackNote(lt),ut.notes.push(lt)}x.hasOnlyRests=!0;for(var ct,ht=_createForOfIteratorHelperLoose(x.staffEntries);!(ct=ht()).done;){var ft=ct.value;if(x.hasOnlyRests=ft.hasOnlyRests(),!x.hasOnlyRests)break}return x},e.checkNoteForAccidental=function(t,e,i,n){var r=t.sourceNote.Pitch,o=this.graphicalMusicSheet.ParentMusicSheet.Transpose;0!==o&&t.sourceNote.ParentStaffEntry.ParentStaff.ParentInstrument.MidiInstrumentId!==S.MidiInstrument.Percussion&&(r=t.Transpose(e.ActiveKeyInstruction,i,o,n)),t.sourceNote.halfTone=r.getHalfTone(),e.checkAccidental(t,r)},e.handleStaffEntries=function(e){for(var i=0,n=this.graphicalMusicSheet.MeasureList.length;i0&&c.graphicalVoiceEntries[0].notes.length>0&&(this.layoutVoiceEntries(c,o),this.layoutStaffEntry(c))}this.graphicalMeasureCreatedCalculations(a)}}},e.calculateSkyBottomLines=function(){for(var t,e=_createForOfIteratorHelperLoose(this.musicSystems);!(t=e()).done;)for(var i,n=_createForOfIteratorHelperLoose(t.value.StaffLines);!(i=n()).done;)i.value.SkyBottomLineCalculator.calculateLines()},e.calculateExpressionAlignements=function(){},e.calculateStaffEntryArticulationMarks=function(){for(var t=0,e=this.musicSystems.length;t0&&this.layoutArticulationMarks(p.Articulations,p,h)}},e.calculateOrnaments=function(){for(var t=0,e=this.musicSystems.length;t0&&n.LyricVersesNumbers.sort()}for(var r=0,o=this.musicSystems.length;r=0&&(n=e.GraphicalLyricsEntries[i+1]),n){var r=t.StaffEntryParent.parentMeasure.ParentStaffLine,o=n.StaffEntryParent.parentMeasure.ParentStaffLine,s=t.StaffEntryParent,a=n.StaffEntryParent;if(t.StaffEntryParent.parentMeasure.ParentStaffLine===n.StaffEntryParent.parentMeasure.ParentStaffLine){var u=s.parentMeasure.PositionAndShape.RelativePosition.x+s.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,l=a.parentMeasure.PositionAndShape.RelativePosition.x+a.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.RelativePosition.x+n.GraphicalLabel.PositionAndShape.BorderMarginLeft,c=t.GraphicalLabel.PositionAndShape.RelativePosition.y,h=1;l-u>3*this.rules.MinimumDistanceBetweenDashes&&(h=Math.floor((l-u)/this.rules.MinimumDistanceBetweenDashes)-1),1===h?this.calculateSingleDashForLyricWord(r,u,l,c):this.calculateDashes(r,u,l,c)}else{var f=s.parentMeasure.PositionAndShape.RelativePosition.x+s.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,d=r.Measures[r.Measures.length-1],p=d.PositionAndShape.RelativePosition.x+d.PositionAndShape.Size.width,m=t.GraphicalLabel.PositionAndShape.RelativePosition.y;if(this.calculateDashes(r,f,p,m),o&&o.Measures[0]&&a.parentMeasure.ParentStaffLine&&(a!==a.parentMeasure.staffEntries[0]||a.parentMeasure!==a.parentMeasure.ParentStaffLine.Measures[0])){var v=o.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,b=a.parentMeasure.PositionAndShape.RelativePosition.x+a.PositionAndShape.RelativePosition.x+n.GraphicalLabel.PositionAndShape.BorderMarginLeft;m=n.GraphicalLabel.PositionAndShape.RelativePosition.y,this.calculateDashes(o,v,b,m)}}}},e.calculateDashes=function(t,e,i,n){var r=i-e;if(r<3*this.rules.MinimumDistanceBetweenDashes)this.calculateSingleDashForLyricWord(t,e,i,n);else{var o=Math.floor(r/this.rules.MinimumDistanceBetweenDashes)-1,s=r/(o+1),a=0;for(e+=s,i-=s;a<=Math.floor(o/2)&&i>e;)r=this.calculateRightAndLeftDashesForLyricWord(t,e,i,n),e+=s,i-=s,a++;r>2*s&&this.calculateSingleDashForLyricWord(t,e,i,n)}},e.calculateSingleDashForLyricWord=function(t,e,i,n){var r=new w.Label("-"),o=new d.GraphicalLabel(r,this.rules.LyricsHeight,p.TextAlignmentEnum.CenterBottom,this.rules);o.setLabelPositionAndShapeBorders(),t.LyricsDashes.push(o),-1===this.staffLinesWithLyricWords.indexOf(t)&&this.staffLinesWithLyricWords.push(t),o.PositionAndShape.Parent=t.PositionAndShape;var s=new h.PointF2D(e+(i-e)/2,n);o.PositionAndShape.RelativePosition=s},e.calculateLyricExtend=function(t){for(var e=t.GraphicalLabel.PositionAndShape.RelativePosition.y,i=t.StaffEntryParent,n=i.parentMeasure.ParentStaffLine,r=void 0,o=void 0,s=i.parentMeasure.ParentStaff.idInMusicSheet,a=i.parentVerticalContainer.Index+1;a0)break;(o=(r=u).parentMeasure.ParentStaffLine)||(o=i.parentMeasure.ParentStaffLine)}}if(r&&o)if(n===o&&r.parentMeasure.ParentStaffLine){var l=i.parentMeasure.PositionAndShape.RelativePosition.x+i.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,c=r.parentMeasure.PositionAndShape.RelativePosition.x+r.PositionAndShape.RelativePosition.x+r.PositionAndShape.BorderMarginRight;e-=t.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(n,l,c,e)}else{var h=n.Measures[n.Measures.length-1].PositionAndShape,f=i.parentMeasure.PositionAndShape.RelativePosition.x+i.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,d=h.RelativePosition.x+h.Size.width;if(e-=t.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(n,f,d,e),!r)return;if(r.parentMeasure.ParentStaffLine&&r.parentMeasure.staffEntries&&(r!==r.parentMeasure.staffEntries[0]||r.parentMeasure!==r.parentMeasure.ParentStaffLine.Measures[0])){var p=o.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,m=r.parentMeasure.PositionAndShape.RelativePosition.x+r.PositionAndShape.RelativePosition.x+r.PositionAndShape.BorderMarginRight;this.calculateSingleLyricWordWithUnderscore(o,p,m,e)}}},e.calculateSingleLyricWordWithUnderscore=function(t,e,i,n){var r=new h.PointF2D(e,n),o=new h.PointF2D(i,n),s=new E.GraphicalLine(r,o,this.rules.LyricUnderscoreLineWidth);t.LyricLines.push(s),-1===this.staffLinesWithLyricWords.indexOf(t)&&this.staffLinesWithLyricWords.push(t)},e.calculateRightAndLeftDashesForLyricWord=function(t,e,i,n){var r=new w.Label("-"),o=new d.GraphicalLabel(r,this.rules.LyricsHeight,p.TextAlignmentEnum.CenterBottom,this.rules);o.setLabelPositionAndShapeBorders(),t.LyricsDashes.push(o),-1===this.staffLinesWithLyricWords.indexOf(t)&&this.staffLinesWithLyricWords.push(t),o.PositionAndShape.Parent=t.PositionAndShape;var s=new h.PointF2D(e,n);o.PositionAndShape.RelativePosition=s;var a=new w.Label("-"),u=new d.GraphicalLabel(a,this.rules.LyricsHeight,p.TextAlignmentEnum.CenterBottom,this.rules);u.setLabelPositionAndShapeBorders(),t.LyricsDashes.push(u),u.PositionAndShape.Parent=t.PositionAndShape;var l=new h.PointF2D(i,n);return u.PositionAndShape.RelativePosition=l,u.PositionAndShape.RelativePosition.x-o.PositionAndShape.RelativePosition.x},e.calculateDynamicExpressions=function(){for(var t=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex),e=Math.min(this.rules.MinMeasureToDrawIndex,this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length);e<=t;e++)for(var i=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[e],n=0;n=0;n--)if(this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[n].StaffEntries[e])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[n].StaffEntries[e]},e.getFirstRightNotNullStaffEntryFromContainer=function(t,e,i){if(this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t].StaffEntries[e])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t].StaffEntries[e];for(var n=t+1;n0||e.StaffLinkedExpressions[i][n].UnknownList.length>0)&&this.calculateMoodAndUnknownExpression(e.StaffLinkedExpressions[i][n],t,i)},e.calculateStemDirectionFromVoices=function(t){if(void 0!==t.ParentSourceStaffEntry.Link)return t===t.ParentSourceStaffEntry.VoiceEntries[0]?void(t.WantedStemDirection=l.StemDirectionType.Up):void(t.WantedStemDirection=l.StemDirectionType.Down);t.ParentVoice instanceof v.LinkedVoice?t.WantedStemDirection=l.StemDirectionType.Down:t.ParentSourceStaffEntry.VoiceEntries.length>1&&(t.WantedStemDirection=l.StemDirectionType.Up)},e.setBeamNotesWantedStemDirections=function(t){if(t.Notes.length>0){var e=t.Notes[0].NoteBeam;if(e)for(var i,n=_createForOfIteratorHelperLoose(e.Notes);!(i=n()).done;){var r=i.value;if(r.ParentVoiceEntry.WantedStemDirection!==l.StemDirectionType.Undefined&&r.ParentVoiceEntry.ParentSourceStaffEntry.ParentStaff.Id===t.ParentSourceStaffEntry.ParentStaff.Id){t.WantedStemDirection=r.ParentVoiceEntry.WantedStemDirection;break}}}},_createClass2(t,[{key:"leadSheet",get:function(){return this.graphicalMusicSheet.LeadSheet}}],[{key:"TextMeasurer",get:function(){return t.textMeasurer},set:function(e){t.textMeasurer=e}}]),t}();e.MusicSheetCalculator=k},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.KeyEnum=e.NoteEnumToHalfToneLink=e.KeyInstruction=void 0;var n,r=i(49),o=i(2),s=i(2),a=function(t){function e(e,i,r){var o;return void 0===i&&(i=0),void 0===r&&(r=n.major),(o=t.call(this,e)||this).isTransposedBy=0,o.Key=i,o.keyTypeOriginal=i,o.mode=r,o.alteratedNotes=o.calcAlteratedNotes(),o}_inheritsLoose(e,t),e.copy=function(t){var i=new e(t.parent,t.Key,t.Mode);return i.keyTypeOriginal=t.keyTypeOriginal,i},e.getAllPossibleMajorKeyInstructions=function(){for(var t=[],i=-7;i<7;i++){var r=new e(void 0,i,n.major);t.push(r)}return t};var i=e.prototype;return i.calcAlteratedNotes=function(){var t=[];if(this.keyType>0)for(var i=0;i=0},i.getAlterationForPitch=function(t){return this.keyType>0&&this.alteratedNotes.indexOf(t.FundamentalNote)<=this.keyType?s.AccidentalEnum.SHARP:this.keyType<0&&this.alteratedNotes.indexOf(t.FundamentalNote)<=Math.abs(this.keyType)?s.AccidentalEnum.FLAT:s.AccidentalEnum.NONE},i.ToString=function(){return"Key: "+this.keyType+this.mode},i.OperatorEquals=function(t){return this===t||!(!this||!t)&&this.Key===t.Key&&this.Mode===t.Mode},i.OperatorNotEqual=function(t){return!this.OperatorEquals(t)},_createClass2(e,[{key:"Key",get:function(){return this.keyType},set:function(t){this.keyType=t,this.alteratedNotes=this.calcAlteratedNotes()}},{key:"Mode",get:function(){return this.mode},set:function(t){this.mode=t}},{key:"AlteratedNotes",get:function(){return this.alteratedNotes}}]),e}(r.AbstractNotationInstruction);e.KeyInstruction=a,a.sharpPositionList=[o.NoteEnum.F,o.NoteEnum.C,o.NoteEnum.G,o.NoteEnum.D,o.NoteEnum.A,o.NoteEnum.E,o.NoteEnum.B],a.flatPositionList=[o.NoteEnum.B,o.NoteEnum.E,o.NoteEnum.A,o.NoteEnum.D,o.NoteEnum.G,o.NoteEnum.C,o.NoteEnum.F],e.NoteEnumToHalfToneLink=function(){function t(t,e){this.note=t,this.halfTone=e}return t}(),function(t){t[t.major=0]="major",t[t.minor=1]="minor",t[t.none=2]="none",t[t.dorian=3]="dorian",t[t.phrygian=4]="phrygian",t[t.lydian=5]="lydian",t[t.mixolydian=6]="mixolydian",t[t.aeolian=7]="aeolian",t[t.ionian=8]="ionian",t[t.locrian=9]="locrian"}(n=e.KeyEnum||(e.KeyEnum={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.RhythmSymbolEnum=e.RhythmInstruction=void 0;var n=function(t){function e(e,i){var n;return(n=t.call(this,void 0)||this).rhythm=e,n.numerator=e.Numerator,n.denominator=e.Denominator,n.symbolEnum=i,n}_inheritsLoose(e,t);var i=e.prototype;return i.clone=function(){return new e(this.rhythm.clone(),this.symbolEnum)},i.OperatorEquals=function(t){return this===t||!(!this||!t)&&this.numerator===t.numerator&&this.denominator===t.denominator},i.OperatorNotEqual=function(t){return!(this===t)},i.ToString=function(){return"Rhythm: "+this.rhythm.toString()},_createClass2(e,[{key:"Rhythm",get:function(){return this.rhythm},set:function(t){this.rhythm=t}},{key:"SymbolEnum",get:function(){return this.symbolEnum},set:function(t){this.symbolEnum=t}}]),e}(i(49).AbstractNotationInstruction);e.RhythmInstruction=n,function(t){t[t.NONE=0]="NONE",t[t.COMMON=1]="COMMON",t[t.CUT=2]="CUT"}(e.RhythmSymbolEnum||(e.RhythmSymbolEnum={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.ITextTranslation=void 0,e.ITextTranslation=function(){function t(){}return t.translateText=function(t,e){if(!this.defaultTextTranslation)return e},t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.FontStyles=void 0,function(t){t[t.Regular=0]="Regular",t[t.Bold=1]="Bold",t[t.Italic=2]="Italic",t[t.BoldItalic=3]="BoldItalic",t[t.Underlined=4]="Underlined"}(e.FontStyles||(e.FontStyles={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AutoColorSet=e.NoteState=e.GraphicalLayers=e.StyleSets=e.OUTLINE_AND_FILL_STYLE_DICT=e.OutlineAndFillStyleEnum=void 0;var n,r=i(15);!function(t){t[t.BaseWritingColor=0]="BaseWritingColor",t[t.FollowingCursor=1]="FollowingCursor",t[t.AlternativeFollowingCursor=2]="AlternativeFollowingCursor",t[t.PlaybackCursor=3]="PlaybackCursor",t[t.Highlighted=4]="Highlighted",t[t.ErrorUnderlay=5]="ErrorUnderlay",t[t.Selected=6]="Selected",t[t.SelectionSymbol=7]="SelectionSymbol",t[t.DebugColor1=8]="DebugColor1",t[t.DebugColor2=9]="DebugColor2",t[t.DebugColor3=10]="DebugColor3",t[t.SplitScreenDivision=11]="SplitScreenDivision",t[t.GreyTransparentOverlay=12]="GreyTransparentOverlay",t[t.MarkedArea1=13]="MarkedArea1",t[t.MarkedArea2=14]="MarkedArea2",t[t.MarkedArea3=15]="MarkedArea3",t[t.MarkedArea4=16]="MarkedArea4",t[t.MarkedArea5=17]="MarkedArea5",t[t.MarkedArea6=18]="MarkedArea6",t[t.MarkedArea7=19]="MarkedArea7",t[t.MarkedArea8=20]="MarkedArea8",t[t.MarkedArea9=21]="MarkedArea9",t[t.MarkedArea10=22]="MarkedArea10",t[t.Comment1=23]="Comment1",t[t.Comment2=24]="Comment2",t[t.Comment3=25]="Comment3",t[t.Comment4=26]="Comment4",t[t.Comment5=27]="Comment5",t[t.Comment6=28]="Comment6",t[t.Comment7=29]="Comment7",t[t.Comment8=30]="Comment8",t[t.Comment9=31]="Comment9",t[t.Comment10=32]="Comment10"}(n=e.OutlineAndFillStyleEnum||(e.OutlineAndFillStyleEnum={})),e.OUTLINE_AND_FILL_STYLE_DICT=new r.Dictionary,e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.BaseWritingColor,"Thistle"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.FollowingCursor,"Aqua"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.AlternativeFollowingCursor,"Azure"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.PlaybackCursor,"Bisque"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.Highlighted,"CadetBlue"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.ErrorUnderlay,"DarkBlue"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.Selected,"DarkGoldenRod"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.SelectionSymbol,"BlanchedAlmond"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.DebugColor1,"Chartreuse"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.DebugColor2,"DarkGreen"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.DebugColor3,"DarkOrange"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.SplitScreenDivision,"FireBrick"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.GreyTransparentOverlay,"DarkSalmon"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.MarkedArea1,"DarkSeaGreen"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.MarkedArea2,"DarkOrchid"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.MarkedArea3,"Aquamarine"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.MarkedArea4,"DarkKhaki"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.MarkedArea5,"ForestGreen"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.MarkedArea6,"AliceBlue"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.MarkedArea7,"DeepPink"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.MarkedArea8,"Coral"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.MarkedArea9,"DarkOliveGreen"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.MarkedArea10,"Chocolate"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.Comment1,"DodgerBlue"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.Comment2,"Blue"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.Comment3,"Beige"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.Comment4,"Crimson"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.Comment5,"Fuchsia"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.Comment6,"Brown"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.Comment7,"BlanchedAlmond"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.Comment8,"CornflowerBlue"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.Comment9,"Cornsilk"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(n.Comment10,"DarkGrey"),function(t){t[t.MarkedArea=0]="MarkedArea",t[t.Comment=1]="Comment"}(e.StyleSets||(e.StyleSets={})),function(t){t[t.Background=0]="Background",t[t.Highlight=1]="Highlight",t[t.MeasureError=2]="MeasureError",t[t.SelectionSymbol=3]="SelectionSymbol",t[t.Cursor=4]="Cursor",t[t.PSI_Debug=5]="PSI_Debug",t[t.Notes=6]="Notes",t[t.Comment=7]="Comment",t[t.Debug_above=8]="Debug_above"}(e.GraphicalLayers||(e.GraphicalLayers={})),function(t){t[t.Normal=0]="Normal",t[t.Selected=1]="Selected",t[t.Follow_Confirmed=2]="Follow_Confirmed",t[t.QFeedback_NotFound=3]="QFeedback_NotFound",t[t.QFeedback_OK=4]="QFeedback_OK",t[t.QFeedback_Perfect=5]="QFeedback_Perfect",t[t.Debug1=6]="Debug1",t[t.Debug2=7]="Debug2",t[t.Debug3=8]="Debug3"}(e.NoteState||(e.NoteState={})),function(t){t.C="#d82c6b",t.D="#F89D15",t.E="#FFE21A",t.F="#4dbd5c",t.G="#009D96",t.A="#43469d",t.B="#76429c",t.Rest="#000000"}(e.AutoColorSet||(e.AutoColorSet={}))},function(t,e,i){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.SystemLinesEnumHelper=e.SystemLinesEnum=void 0,function(t){t[t.SingleThin=0]="SingleThin",t[t.DoubleThin=1]="DoubleThin",t[t.ThinBold=2]="ThinBold",t[t.BoldThinDots=3]="BoldThinDots",t[t.DotsThinBold=4]="DotsThinBold",t[t.DotsBoldBoldDots=5]="DotsBoldBoldDots",t[t.None=6]="None",t[t.Dotted=7]="Dotted",t[t.Dashed=8]="Dashed",t[t.Bold=9]="Bold",t[t.BoldThin=10]="BoldThin",t[t.DoubleBold=11]="DoubleBold",t[t.Tick=12]="Tick",t[t.Short=13]="Short"}(n=e.SystemLinesEnum||(e.SystemLinesEnum={})),e.SystemLinesEnumHelper=function(){function t(){}return t.xmlBarlineStyleToSystemLinesEnum=function(t){return"regular"===t?n.SingleThin:"dotted"===t?n.Dotted:"dashed"===t?n.Dashed:"heavy"===t?n.Bold:"light-light"===t?n.DoubleThin:"light-heavy"===t?n.ThinBold:"heavy-light"===t?n.BoldThin:"heavy-heavy"===t?n.DoubleBold:"tick"===t?n.Tick:"short"===t?n.Short:"none"===t?n.None:n.SingleThin},t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalLabel=void 0;var n=i(9),r=i(5),o=i(114),s=i(17),a=function(t){function e(e,i,n,o,s){var a;return(a=t.call(this)||this).label=e,a.boundingBox=new r.BoundingBox(_assertThisInitialized2(a),s),a.label.fontHeight=i,a.label.textAlignment=n,a.rules=o,a}_inheritsLoose(e,t);var i=e.prototype;return i.toString=function(){return this.label.text+" ("+this.boundingBox.RelativePosition.x+","+this.boundingBox.RelativePosition.y+")"},i.setLabelPositionAndShapeBorders=function(){var t,e;if(""!==this.Label.text.trim()){this.TextLines=[];for(var i=null!==(e=null===(t=this.rules)||void 0===t?void 0:t.LabelMarginBorderFactor)&&void 0!==e?e:.1,r=this.Label.text.split(/[\n\r]+/g),o=r.length,a=0,u=0;u0&&this.TextLines.length>1&&(v+=this.rules.SpacingBetweenTextLines*o/10);var b=this.PositionAndShape;switch(this.Label.textAlignment){case n.TextAlignmentEnum.CenterBottom:b.BorderTop=-v,b.BorderLeft=-a/2,b.BorderBottom=0,b.BorderRight=a/2;break;case n.TextAlignmentEnum.CenterCenter:b.BorderTop=-v/2,b.BorderLeft=-a/2,b.BorderBottom=v/2,b.BorderRight=a/2;break;case n.TextAlignmentEnum.CenterTop:b.BorderTop=0,b.BorderLeft=-a/2,b.BorderBottom=v,b.BorderRight=a/2;break;case n.TextAlignmentEnum.LeftBottom:b.BorderTop=-v,b.BorderLeft=0,b.BorderBottom=0,b.BorderRight=a;break;case n.TextAlignmentEnum.LeftCenter:b.BorderTop=-v/2,b.BorderLeft=0,b.BorderBottom=v/2,b.BorderRight=a;break;case n.TextAlignmentEnum.LeftTop:b.BorderTop=0,b.BorderLeft=0,b.BorderBottom=v,b.BorderRight=a;break;case n.TextAlignmentEnum.RightBottom:b.BorderTop=-v,b.BorderLeft=-a,b.BorderBottom=0,b.BorderRight=0;break;case n.TextAlignmentEnum.RightCenter:b.BorderTop=-v/2,b.BorderLeft=-a,b.BorderBottom=v/2,b.BorderRight=0;break;case n.TextAlignmentEnum.RightTop:b.BorderTop=0,b.BorderLeft=-a,b.BorderBottom=v,b.BorderRight=0}b.BorderMarginTop=b.BorderTop-v*i,b.BorderMarginLeft=b.BorderLeft-v*i,b.BorderMarginBottom=b.BorderBottom+v*i,b.BorderMarginRight=b.BorderRight+v*i}},_createClass2(e,[{key:"Label",get:function(){return this.label}}]),e}(o.Clickable);e.GraphicalLabel=a},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.OSMDOptions=e.BackendType=e.FillEmptyMeasuresWithWholeRests=e.AlignRestOption=void 0;var n,r=i(33);!function(t){t[t.Never=0]="Never",t[t.Always=1]="Always",t[t.Auto=2]="Auto"}(e.AlignRestOption||(e.AlignRestOption={})),function(t){t[t.No=0]="No",t[t.YesVisible=1]="YesVisible",t[t.YesInvisible=2]="YesInvisible"}(e.FillEmptyMeasuresWithWholeRests||(e.FillEmptyMeasuresWithWholeRests={})),function(t){t[t.SVG=0]="SVG",t[t.Canvas=1]="Canvas"}(n=e.BackendType||(e.BackendType={})),e.OSMDOptions=function(){function t(){}return t.OSMDOptionsStandard=function(){return{autoResize:!0,backend:"svg",drawingParameters:r.DrawingParametersEnum.default}},t.BackendTypeFromString=function(t){return t&&"canvas"===t.toLowerCase()?n.Canvas:n.SVG},t}()},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.PageFormat=e.EngravingRules=void 0;var r=i(45),o=n(i(1)),s=i(9),a=i(3),u=i(25),l=i(33),c=i(15),h=i(67),f=i(48),d=i(71),p=function(){function e(){this.NoteDistances=[1,1,1.3,1.6,2,2.5,3,4],this.NoteDistancesScalingFactors=[1,2,4,8,16,32,64,128],this.DurationDistanceDict={},this.DurationScalingDistanceDict={},this.NoteToGraphicalNoteMapObjectCount=0,this.loadDefaultValues()}var i=e.prototype;return i.loadDefaultValues=function(){this.SamplingUnit=3*e.unit,this.SheetTitleHeight=4,this.SheetSubtitleHeight=2,this.SheetMinimumDistanceBetweenTitleAndSubtitle=1,this.SheetComposerHeight=2,this.SheetAuthorHeight=2,this.CompactMode=!1,this.PagePlacementEnum=r.PagePlacementEnum.Down,this.PageHeight=100001,this.PageTopMargin=5,this.PageTopMarginNarrow=0,this.PageBottomMargin=5,this.PageLeftMargin=5,this.PageRightMargin=5,this.TitleTopDistance=5,this.TitleBottomDistance=1,this.StaffDistance=7,this.BetweenStaffDistance=5,this.MinimumStaffLineDistance=4,this.MinSkyBottomDistBetweenStaves=1,this.StaffHeight=4,this.TabStaffInterlineHeight=1.1111,this.BetweenStaffLinesDistance=e.unit,this.SystemLeftMargin=0,this.SystemRightMargin=0,this.SystemLabelsRightMargin=2,this.SystemComposerDistance=2,this.InstrumentLabelTextHeight=2,this.MinimumDistanceBetweenSystems=7,this.MinSkyBottomDistBetweenSystems=5,this.LastSystemMaxScalingFactor=1.4,this.AutoBeamNotes=!1,this.AutoBeamOptions={beam_middle_rests_only:!1,beam_rests:!1,maintain_stem_directions:!1},this.BeamWidth=e.unit/2,this.BeamSpaceWidth=e.unit/3,this.BeamForwardLength=1.25*e.unit,this.FlatBeams=!1,this.FlatBeamOffset=20,this.FlatBeamOffsetPerBeam=10,this.ClefLeftMargin=.5,this.ClefRightMargin=.75,this.PercussionOneLineCutoff=3,this.PercussionForceVoicesOneLineCutoff=1,this.PercussionOneLineUseXMLDisplayStep=!0,this.PercussionOneLineXMLDisplayStepOctaveOffset=0,this.BetweenKeySymbolsDistance=.2,this.KeyRightMargin=.75,this.RhythmRightMargin=1.25,this.ShowRhythmAgainAfterPartEndOrFinalBarline=!0,this.NewPartAndSystemAfterFinalBarline=!1,this.InStaffClefScalingFactor=.8,this.DistanceBetweenNaturalAndSymbolWhenCancelling=.4,this.NoteHelperLinesOffset=.25,this.MeasureLeftMargin=.7,this.MeasureRightMargin=0,this.DistanceBetweenLastInstructionAndRepetitionBarline=1,this.ArpeggioDistance=.6,this.StaccatoShorteningFactor=2,this.IdealStemLength=3,this.StemNoteHeadBorderYOffset=.2,this.StemMargin=.2,this.StemMinLength=2.5,this.StemMaxLength=4.5,this.BeamSlopeMaxAngle=10,this.StemMinAllowedDistanceBetweenNoteHeadAndBeamLine=1,this.SetWantedStemDirectionByXml=!0,this.GraceNoteScalingFactor=.6,this.GraceNoteXOffset=.2,this.WedgeOpeningLength=1.2,this.WedgeMeasureEndOpeningLength=.75,this.WedgeMeasureBeginOpeningLength=.75,this.WedgePlacementAboveY=-1.5,this.WedgePlacementBelowY=1.5,this.WedgeHorizontalMargin=.6,this.WedgeVerticalMargin=.5,this.DistanceOffsetBetweenTwoHorizontallyCrossedWedges=.3,this.WedgeMinLength=2,this.DistanceBetweenAdjacentDynamics=.75,this.TempoChangeMeasureValidity=4,this.TempoContinousFactor=.7,this.StaccatoScalingFactor=.8,this.BetweenDotsDistance=.8,this.OrnamentAccidentalScalingFactor=.65,this.ChordSymbolTextHeight=2,this.ChordSymbolTextAlignment=s.TextAlignmentEnum.LeftBottom,this.ChordSymbolRelativeXOffset=-1,this.ChordSymbolXSpacing=1,this.ChordOverlapAllowedIntoNextMeasure=0,this.ChordSymbolYOffset=2,this.ChordSymbolLabelTexts=new c.Dictionary,this.resetChordSymbolLabelTexts(this.ChordSymbolLabelTexts),this.CustomChords=[],this.resetChordNames(),this.RepetitionSymbolsYOffset=0,this.RehearsalMarkXOffsetDefault=10,this.RehearsalMarkXOffset=0,this.RehearsalMarkXOffsetSystemStartMeasure=-20,this.RehearsalMarkYOffsetDefault=-15,this.RehearsalMarkYOffset=0,this.RehearsalMarkFontSize=10,this.MeasureNumberLabelHeight=1.5*e.unit,this.MeasureNumberLabelOffset=2,this.MeasureNumberLabelXOffset=-.5,this.TupletsRatioed=!1,this.TupletsBracketed=!1,this.TripletsBracketed=!1,this.TupletNumberLabelHeight=1.5*e.unit,this.TupletNumberYOffset=.5,this.LabelMarginBorderFactor=.1,this.TupletVerticalLineLength=.5,this.TupletNumbersInTabs=!1,this.SlurPlacementFromXML=!0,this.BezierCurveStepSize=1e3,this.calculateCurveParametersArrays(),this.TieGhostObjectWidth=.75,this.TieYPositionOffsetFactor=.3,this.MinimumNeededXspaceForTieGhostObject=1,this.TieHeightMinimum=.28,this.TieHeightMaximum=1.2,this.TieHeightInterpolationK=.0288,this.TieHeightInterpolationD=.136,this.SlurNoteHeadYOffset=.5,this.SlurStemXOffset=.3,this.SlurSlopeMaxAngle=15,this.SlurTangentMinAngle=30,this.SlurTangentMaxAngle=80,this.SlurHeightFactor=1,this.SlurHeightFlattenLongSlursFactorByWidth=.24,this.SlurHeightFlattenLongSlursFactorByAngle=.36,this.SlurHeightFlattenLongSlursCutoffAngle=47,this.SlurHeightFlattenLongSlursCutoffWidth=16,this.SlursStartingAtSameStaffEntryYOffset=.8,this.RepetitionEndingLabelHeight=2,this.RepetitionEndingLabelXOffset=.5,this.RepetitionEndingLabelYOffset=.3,this.RepetitionEndingLineYLowerOffset=.5,this.RepetitionEndingLineYUpperOffset=.3,this.VoltaOffset=2.5,this.LyricsAlignmentStandard=s.TextAlignmentEnum.LeftBottom,this.LyricsHeight=2,this.LyricsYOffsetToStaffHeight=0,this.VerticalBetweenLyricsDistance=.5,this.HorizontalBetweenLyricsDistance=.2,this.BetweenSyllableMaximumDistance=10,this.BetweenSyllableMinimumDistance=.5,this.LyricOverlapAllowedIntoNextMeasure=3.4,this.MinimumDistanceBetweenDashes=10,this.MaximumLyricsElongationFactor=2.5,this.InstantaneousTempoTextHeight=2.3,this.ContinuousDynamicTextHeight=2.3,this.MoodTextHeight=2.3,this.UnknownTextHeight=2,this.ContinuousTempoTextHeight=2.3,this.DynamicExpressionMaxDistance=2,this.DynamicExpressionSpacer=.5,this.VexFlowDefaultNotationFontScale=39,this.VexFlowDefaultTabFontScale=39,this.TremoloStrokeScale=1,this.TremoloYSpacingScale=1,this.StemWidth=.15,this.StaffLineWidth=.1,this.StaffLineColor=void 0,this.LedgerLineWidth=1,this.LedgerLineStrokeStyle=void 0,this.LedgerLineColorDefault="#000000",this.WedgeLineWidth=.12,this.TupletLineWidth=.12,this.LyricUnderscoreLineWidth=.12,this.SystemThinLineWidth=.12,this.SystemBoldLineWidth=e.unit/2,this.SystemRepetitionEndingLineWidth=.12,this.SystemDotWidth=e.unit/5,this.DistanceBetweenVerticalSystemLines=.35,this.DistanceBetweenDotAndLine=.7,this.OctaveShiftLineWidth=.12,this.OctaveShiftVerticalLineLength=e.unit,this.GraceLineWidth=this.StaffLineWidth*this.GraceNoteScalingFactor,this.MultipleRestMeasureDefaultWidth=4,this.MinimumCrossedBeamDifferenceMargin=1e-4,this.VoiceSpacingMultiplierVexflow=.85,this.VoiceSpacingAddendVexflow=3,this.PickupMeasureWidthMultiplier=1,this.DisplacedNoteMargin=.1,this.MinNoteDistance=2,this.SubMeasureXSpacingThreshold=35,this.MeasureDynamicsMaxScalingFactor=2.5,this.WholeRestXShiftVexflow=-1.5,this.MetronomeMarksDrawn=!0,this.MetronomeMarkXShift=-6,this.MetronomeMarkYShift=-.5,this.SoftmaxFactorVexFlow=15,this.AlignRests=u.AlignRestOption.Never,this.FillEmptyMeasuresWithWholeRest=u.FillEmptyMeasuresWithWholeRests.No,this.ArpeggiosGoAcrossVoices=!1,this.RenderArpeggios=!0,this.RenderSlurs=!0,this.ColoringMode=l.ColoringModes.XML,this.ColoringEnabled=!0,this.ColorStemsLikeNoteheads=!1,this.ColorBeams=!0,this.ColorFlags=!0,this.DefaultColorNotehead="#000000",this.DefaultColorRest=this.DefaultColorNotehead,this.DefaultColorStem=this.DefaultColorNotehead,this.DefaultColorLabel=this.DefaultColorNotehead,this.DefaultColorTitle=this.DefaultColorNotehead,this.DefaultColorCursor="#33e02f",this.DefaultFontFamily="Times New Roman",this.DefaultFontStyle=h.FontStyles.Regular,this.DefaultVexFlowNoteFont="gonville",this.MaxMeasureToDrawIndex=Number.MAX_VALUE,this.MinMeasureToDrawIndex=0,this.MaxSystemToDrawNumber=Number.MAX_VALUE,this.MaxPageToDrawNumber=Number.MAX_VALUE,this.RenderComposer=!0,this.RenderTitle=!0,this.RenderSubtitle=!0,this.RenderLyricist=!0,this.RenderPartNames=!0,this.RenderPartAbbreviations=!0,this.RenderFingerings=!0,this.RenderMeasureNumbers=!0,this.RenderMeasureNumbersOnlyAtSystemStart=!1,this.UseXMLMeasureNumbers=!0,this.RenderLyrics=!0,this.RenderChordSymbols=!0,this.RenderMultipleRestMeasures=!0,this.AutoGenerateMutipleRestMeasuresFromRestMeasures=!0,this.RenderRehearsalMarks=!0,this.RenderKeySignatures=!0,this.RenderTimeSignatures=!0,this.ArticulationPlacementFromXML=!0,this.FingeringPosition=a.PlacementEnum.Left,this.FingeringInsideStafflines=!1,this.FingeringLabelFontHeight=1.7,this.FingeringOffsetX=0,this.RenderStringNumbersClassical=!0,this.StringNumberOffsetY=0,this.NewSystemAtXMLNewSystemAttribute=!1,this.NewPageAtXMLNewPageAttribute=!1,this.RestoreCursorAfterRerender=!0,this.StretchLastSystemLine=!1,e.FixStafflineBoundingBox=!1,this.PageFormat=m.UndefinedPageFormat,this.PageBackgroundColor=void 0,this.RenderSingleHorizontalStaffline=!1,this.SpacingBetweenTextLines=0,this.NoteToGraphicalNoteMap=new c.Dictionary,this.NoteToGraphicalNoteMapObjectCount=0;try{this.MaxInstructionsConstValue=this.ClefLeftMargin+this.ClefRightMargin+this.KeyRightMargin+this.RhythmRightMargin+11}catch(t){o.default.info("EngravingRules()",t)}},i.addGraphicalNoteToNoteMap=function(t,e){t.NoteToGraphicalNoteObjectId=this.NoteToGraphicalNoteMapObjectCount,this.NoteToGraphicalNoteMap.setValue(t.NoteToGraphicalNoteObjectId,e),this.NoteToGraphicalNoteMapObjectCount++},i.GNote=function(t){return d.GraphicalNote.FromNote(t,this)},i.clearMusicSheetObjects=function(){this.NoteToGraphicalNoteMap=new c.Dictionary,this.NoteToGraphicalNoteMapObjectCount=0},i.setChordSymbolLabelText=function(t,e){this.ChordSymbolLabelTexts.setValue(t,e)},i.resetChordSymbolLabelTexts=function(t){return t.setValue(f.ChordSymbolEnum.minor,"m"),t.setValue(f.ChordSymbolEnum.augmented,"aug"),t.setValue(f.ChordSymbolEnum.diminished,"dim"),t.setValue(f.ChordSymbolEnum.dominant,"7"),t.setValue(f.ChordSymbolEnum.majorseventh,"maj7"),t.setValue(f.ChordSymbolEnum.minorseventh,"m7"),t.setValue(f.ChordSymbolEnum.diminishedseventh,"dim7"),t.setValue(f.ChordSymbolEnum.augmentedseventh,"aug7"),t.setValue(f.ChordSymbolEnum.halfdiminished,"m7b5"),t.setValue(f.ChordSymbolEnum.majorminor,"m(maj7)"),t.setValue(f.ChordSymbolEnum.majorsixth,"maj6"),t.setValue(f.ChordSymbolEnum.minorsixth,"m6"),t.setValue(f.ChordSymbolEnum.dominantninth,"9"),t.setValue(f.ChordSymbolEnum.majorninth,"maj9"),t.setValue(f.ChordSymbolEnum.minorninth,"m9"),t.setValue(f.ChordSymbolEnum.dominant11th,"11"),t.setValue(f.ChordSymbolEnum.major11th,"maj11"),t.setValue(f.ChordSymbolEnum.minor11th,"m11"),t.setValue(f.ChordSymbolEnum.dominant13th,"13"),t.setValue(f.ChordSymbolEnum.major13th,"maj13"),t.setValue(f.ChordSymbolEnum.minor13th,"m13"),t.setValue(f.ChordSymbolEnum.suspendedsecond,"sus2"),t.setValue(f.ChordSymbolEnum.suspendedfourth,"sus4"),t.setValue(f.ChordSymbolEnum.power,"5"),t.setValue(f.ChordSymbolEnum.none,"N.C."),t},i.addChordName=function(t,e,i,n,r){if(void 0!==f.ChordSymbolEnum[e]){var o={adds:i,alts:n,subs:r};this.CustomChords.push(f.CustomChord.createCustomChord(t,f.ChordSymbolEnum[e],o))}},i.renameChord=function(t,e){f.CustomChord.renameCustomChord(t,e,this.CustomChords)},i.resetChordNames=function(){this.addChordName("alt","major",["#5","b9","#9"],["b5"],[]),this.addChordName("7alt","dominant",["#5","b9","#9"],["b5"],[]),this.addChordName("7sus4","dominant",["4"],[],["3"]),this.addChordName("7sus4","suspendedfourth",["7"],[],[]),this.addChordName("9sus4","dominantninth",["4"],[],["3"]),this.addChordName("9sus4","suspendedfourth",["9"],[],[]),this.addChordName("11sus4","dominant11th",["4"],[],["3"]),this.addChordName("11sus4","suspendedfourth",["11"],[],[]),this.addChordName("13sus4","dominant13th",["4"],[],["3"]),this.addChordName("13sus4","suspendedfourth",["13"],[],[]),this.addChordName("7sus2","dominant",["2"],[],["3"]),this.addChordName("7sus2","suspendedsecond",["7"],[],[]),this.addChordName("m7b5","minorseventh",[],["b5"],[]),this.addChordName("9sus2","dominantninth",["2"],[],["3"]),this.addChordName("9sus2","suspendedsecond",["9"],[],[]),this.addChordName("11sus2","dominant11th",["2"],[],["3"]),this.addChordName("11sus2","suspendedsecond",["11"],[],[]),this.addChordName("13sus2","dominant13th",["2"],[],["3"]),this.addChordName("13sus2","suspendedsecond",["13"],[],[]),this.addChordName("m(maj9)","majorminor",["9"],[],[]),this.addChordName("m(maj11)","majorminor",["11"],[],[]),this.addChordName("m(maj13)","majorminor",["13"],[],[]),this.addChordName("69","majorsixth",["9"],[],[]),this.addChordName("mi69","minorsixth",["9"],[],[])},i.calculateCurveParametersArrays=function(){this.TPower3=new Array(this.BezierCurveStepSize),this.OneMinusTPower3=new Array(this.BezierCurveStepSize),this.FactorOne=new Array(this.BezierCurveStepSize),this.FactorTwo=new Array(this.BezierCurveStepSize);for(var t=0;te.parentRepetition.StartIndex)return-1}if(t.alignment===r.Begin&&e.alignment===r.Begin){if(t.parentRepetition.EndIndexe.parentRepetition.EndIndex)return-1}}return 0},t}(),e.RepetitionInstruction=function(){function t(t,e,i,n,o){void 0===i&&(i=r.End),this.endingIndices=void 0,this.measureIndex=t,o&&(this.endingIndices=o.slice()),this.type=e,this.alignment=i,this.parentRepetition=n}var e=t.prototype;return e.CompareTo=function(t){var e=t;if(this.measureIndex>e.measureIndex)return 1;if(this.measureIndex0)return!0;return!1},e.hasTie=function(){for(var t=0,e=this.VoiceEntries.length;t=0;o--)if(r(t[o],e))return o;return-1},e.contains=function(t,e,i){return r(t,e,i)>=0},e.remove=function(t,e,i){var n=r(t,e,i);return!(n<0||(t.splice(n,1),0))},e.frequency=function(t,e,i){for(var r=i||n.defaultEquals,o=t.length,s=0,a=0;a=t.length||i<0||i>=t.length)return!1;var n=t[e];return t[e]=t[i],t[i]=n,!0},e.toString=function(t){return"["+t.toString()+"]"},e.forEach=function(t,e){for(var i=0,n=t;i0){h.default.trace("Ghost Found in between (measure "+this.MeasureNumber+")");var m=l.VexFlowConverter.GhostNote(p),g=new v.VexFlowVoiceEntry(void 0,void 0);g.vfStaveNote=m,i.splice(n,0,g),n++}}else{var y=b.Fraction.minus(a,this.parentSourceMeasure.AbsoluteTimestamp);if(y.RealValue>0){h.default.trace("Ghost Found at start (measure "+this.MeasureNumber+")");var S=l.VexFlowConverter.GhostNote(y),_=new v.VexFlowVoiceEntry(void 0,void 0);_.vfStaveNote=S,i.splice(0,0,_),n++}}e=u}var x=b.Fraction.plus(this.parentSourceMeasure.AbsoluteTimestamp,this.parentSourceMeasure.Duration),E=b.Fraction.minus(x,e);if(E.RealValue>0){h.default.trace("Ghost Found at end (measure "+this.MeasureNumber+")");var w=l.VexFlowConverter.GhostNote(E),T=new v.VexFlowVoiceEntry(void 0,void 0);T.vfStaveNote=w,i.push(T)}return i},i.handleBeam=function(t,e){var i,n=t.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId,r=this.beams[n];r||(r=this.beams[n]=[]);for(var o,s=_createForOfIteratorHelperLoose(r);!(o=s()).done;){var a=o.value;a[0]===e&&(i=a)}i||(i=[e,[]],r.push(i));var u=t.parentVoiceEntry;i[1].indexOf(u)<0&&i[1].push(u)},i.handleTuplet=function(t,e){var i=t.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;e=t.sourceNote.NoteTuplet;var n,r=this.tuplets[i];r||(r=this.tuplets[i]=[]);for(var o,s=_createForOfIteratorHelperLoose(r);!(o=s()).done;){var a=o.value;a[0]===e&&(n=a)}n||(n=[e,[]],r.push(n));var u=t.parentVoiceEntry;n[1].indexOf(u)<0&&n[1].push(u)},i.finalizeBeams=function(){this.vfbeams={};var t=[];for(var e in this.beams)if(this.beams.hasOwnProperty(e)){var i=this.vfbeams[e];i||(i=this.vfbeams[e]=[]);for(var n,r=_createForOfIteratorHelperLoose(this.beams[e]);!(n=r()).done;){for(var s,a=n.value,u=!1,l=_createForOfIteratorHelperLoose(a[0].Notes);!(s=l()).done;){var c=s.value;if(c.Length.RealValue>=new b.Fraction(1,4).RealValue&&(!c.TypeLength||c.TypeLength.RealValue>.125)){u=!0;break}}if(u)h.default.debug("Beam between note >= quarter, likely tremolo, currently unsupported. continuing.");else{for(var f,d=[],p=a[0],v=a[1],g=!0,y=_createForOfIteratorHelperLoose(v);!(f=y()).done;){var S=f.value;S.parentVoiceEntry.ParentVoice===p.Notes[0].ParentVoiceEntry.ParentVoice&&(g=S.parentVoiceEntry.WantedStemDirection===m.StemDirectionType.Undefined)}for(var _,x=void 0,E=!1,w=[],T=_createForOfIteratorHelperLoose(v);!(_=T()).done;){var M=_.value,P=M.vfStaveNote;P&&(d.push(P),t.push(P)),M.parentVoiceEntry.IsGrace&&(E=!0),M.parentVoiceEntry.StemColor&&this.rules.ColoringEnabled&&w.push(M.parentVoiceEntry.StemColor)}if(d.length>1){var L=new o.default.Flow.Beam(d,g);if(E&&(L.render_options.beam_width=3,L.render_options.partial_beam_length=4),w.length>=2&&this.rules.ColorBeams){x=w[0];for(var I,A=_createForOfIteratorHelperLoose(w);!(I=A()).done;)if(I.value!==x){x=void 0;break}L.setStyle({fillStyle:x,strokeStyle:x})}this.rules.FlatBeams&&(L.render_options.flat_beams=!0,L.render_options.flat_beam_offset=this.rules.FlatBeamOffset,L.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),i.push(L)}else h.default.debug("Warning! Beam with no notes!")}}}this.rules.AutoBeamNotes&&this.autoBeamNotes(t)},i.autoBeamNotes=function(t){var e,i=[],n=[],r=[];this.autoTupletVfBeams=[];var s=[];this.autoVfBeams=[];var a=this.parentSourceMeasure.ActiveTimeSignature;a||(a=this.parentSourceMeasure.Duration);for(var u,l=_createForOfIteratorHelperLoose(this.staffEntries);!(u=l()).done;)for(var c,h=u.value,f=_createForOfIteratorHelperLoose(h.graphicalVoiceEntries);!(c=f()).done;){var d=c.value,p=d.vfStaveNote,m=d.notes[0],v=h.relInMeasureTimestamp.isOnBeat(a),g=n.length>=2,y=m.sourceNote.Length.RealValue-new b.Fraction(1,4).RealValue>-b.Fraction.FloatInaccuracyTolerance,_=d.parentVoiceEntry.IsGrace||y||t.contains(p);if(_||v){if(g){for(var x,E=_createForOfIteratorHelperLoose(n);!(x=E()).done;){var w=x.value;i.push(w)}s.push(i.slice()),i=[]}if(n=[],_)continue}var T=d.notes[0].sourceNote.NoteTuplet;if(T){for(var M,P=!1,L=_createForOfIteratorHelperLoose(T.Notes);!(M=L()).done;){for(var I,A=_createForOfIteratorHelperLoose(M.value);!(I=A()).done;){var C=I.value;if(C.NoteTypeXml>=S.NoteType.QUARTER||C.ParentVoiceEntry.IsGrace||C.isRest()&&!this.rules.AutoBeamOptions.beam_rests){P=!0;break}}if(P)break}if(e){if(e!==T){if(r.length>1){var R=new o.default.Flow.Beam(r,!0);this.rules.FlatBeams&&(R.render_options.flat_beams=!0,R.render_options.flat_beam_offset=this.rules.FlatBeamOffset,R.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(R)}r=[],e=T}}else e=T;P||r.push(p)}else e=void 0,n.push(p)}if(r.length>=2){var N=new o.default.Flow.Beam(r,!0);this.rules.FlatBeams&&(N.render_options.flat_beams=!0,N.render_options.flat_beam_offset=this.rules.FlatBeamOffset,N.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(N)}if(n.length>=2){for(var k,F=_createForOfIteratorHelperLoose(n);!(k=F()).done;){var O=k.value;i.push(O)}s.push(i)}var B=this.rules.AutoBeamOptions,D={beam_middle_only:B.beam_middle_rests_only,beam_rests:B.beam_rests,maintain_stem_directions:B.maintain_stem_directions};if(B.groups&&B.groups.length){for(var V,G=[],W=_createForOfIteratorHelperLoose(B.groups);!(V=W()).done;){var H=V.value;G.push(new o.default.Flow.Fraction(H[0],H[1]))}D.groups=G}for(var U=0,z=s;U1){var c=s[0],f=c.Notes[0][0].NormalNotes,d=c.Bracket||3===c.TupletLabelNumber&&this.rules.TripletsBracketed||3!==c.TupletLabelNumber&&this.rules.TupletsBracketed,p=o.default.Flow.Tuplet.LOCATION_TOP;c.tupletLabelNumberPlacement===y.PlacementEnum.Below&&(p=o.default.Flow.Tuplet.LOCATION_BOTTOM),e.push(new o.default.Flow.Tuplet(a,{bracketed:d,location:p,notes_occupied:f,num_notes:c.TupletLabelNumber,ratioed:this.rules.TupletsRatioed}))}else h.default.debug("Warning! Tuplet with no notes! Trying to ignore, but this is a serious problem.")}}},i.layoutStaffEntry=function(t){},i.graphicalMeasureCreatedCalculations=function(){for(var t,e,i=[],n=[],r=_createForOfIteratorHelperLoose(this.staffEntries);!(e=r()).done;){t=!1,i=[];for(var s,a=_createForOfIteratorHelperLoose(e.value.graphicalVoiceEntries);!(s=a()).done;){var u=s.value;if(u.parentVoiceEntry.IsGrace)i.push(u),n.push(u),t||(t=u.parentVoiceEntry.GraceSlur);else if(u.notes[0].sourceNote.PrintObject,u.vfStaveNote=l.VexFlowConverter.StaveNote(u),i.length>0){for(var h=[],f=0;f0)for(var v,b=_createForOfIteratorHelperLoose(i);!(v=b()).done;){var y=v.value;y.vfStaveNote=l.VexFlowConverter.StaveNote(y),y.parentVoiceEntry.GraceAfterMainNote=!0}this.finalizeBeams(),this.finalizeTuplets();var S=this.getVoicesWithinMeasure();if(this.rules.RenderFingerings)for(var _,x=_createForOfIteratorHelperLoose(this.staffEntries);!(_=x()).done;)_.value.setModifierXOffsets();for(var E,w=_createForOfIteratorHelperLoose(S);!(E=w()).done;){var T=E.value;if(T){var M=!(T instanceof g.LinkedVoice);this.vfVoices[T.VoiceId]=new o.default.Flow.Voice({beat_value:this.parentSourceMeasure.Duration.Denominator,num_beats:this.parentSourceMeasure.Duration.Numerator,resolution:o.default.Flow.RESOLUTION}).setMode(o.default.Flow.Voice.Mode.SOFT);for(var P,L=_createForOfIteratorHelperLoose(this.getRestFilledVexFlowStaveNotesPerVoice(T));!(P=L()).done;){var I=P.value;if(!I.parentVoiceEntry||!I.parentVoiceEntry.IsGrace||I.parentVoiceEntry.GraceAfterMainNote){var A=I;if(0!==I.notes.length&&I.notes[0]&&I.notes[0].sourceNote.PrintObject){if(M){var C=A.parentStaffEntry;if(C&&C.vfClefBefore){var R=new c([C.vfClefBefore]);A.vfStaveNote.getCategory&&"stavenotes"===A.vfStaveNote.getCategory()&&A.vfStaveNote.addModifier(0,R)}}I.parentVoiceEntry&&this.rules.RenderFingerings&&(this.createFingerings(I),this.createStringNumber(I)),this.createArpeggio(I),this.vfVoices[T.VoiceId].addTickable(A.vfStaveNote)}else this.vfVoices[T.VoiceId].addTickable(A.vfStaveNote)}}}}for(var N=0,k=n;N1){var i=l.VexFlowConverter.StrokeTypeFromArpeggioType(e.type),n=new o.default.Flow.Stroke(i,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&t.vfStaveNote.addStroke(0,n)}else h.default.debug("[OSMD] arpeggio in measure "+this.MeasureNumber+" could not be drawn.\n voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.")}},i.setStemDirectionFromVexFlow=function(){for(var t,e=_createForOfIteratorHelperLoose(this.staffEntries);!(t=e()).done;)for(var i,n=_createForOfIteratorHelperLoose(t.value.graphicalVoiceEntries);!(i=n()).done;)for(var r,s=i.value,a=_createForOfIteratorHelperLoose(s.notes);!(r=a()).done;){var u=r.value.vfnote;if(u&&u[0])switch(u[0].getStemDirection()){case o.default.Flow.Stem.UP:s.parentVoiceEntry.StemDirection=m.StemDirectionType.Up;break;case o.default.Flow.Stem.DOWN:s.parentVoiceEntry.StemDirection=m.StemDirectionType.Down}}},i.createArticulations=function(){for(var t=0,e=this.staffEntries.length;t1||t.parentStaffEntry.graphicalVoiceEntries.length>1?d=o.default.Flow.StaveModifier.Position.LEFT:0===m.idInMusicSheet?(d=o.default.Flow.StaveModifier.Position.ABOVE,h=y.PlacementEnum.Above):(d=o.default.Flow.StaveModifier.Position.BELOW,h=y.PlacementEnum.Below)}var v=new o.default.Flow.FretHandFinger(c.value);if(v.setPosition(d),v.setOffsetX(p),h===y.PlacementEnum.Above||h===y.PlacementEnum.Below){var b=h===y.PlacementEnum.Above?-1:1,g=h===y.PlacementEnum.Above?a:n-1-a;if(this.rules.FingeringInsideStafflines&&n>1){var S=v.getWidth()/2,_=2.5*n;v.setOffsetY(b*(g+_)*S)}else if(!this.rules.FingeringInsideStafflines){var x=new o.default.Flow.StringNumber(c.value);x.radius=0,x.setPosition(d),x.setOffsetY(b*g*x.getWidth()*2/3),i.vfStaveNote.addModifier(a,x);continue}}i.vfStaveNote.addModifier(a,v)}else a++}},i.createStringNumber=function(t){var e=this;if(this.rules.RenderStringNumbersClassical){var i=t;t.notes.forEach((function(n,r){var s=n.sourceNote.StringInstruction;if(s){var a=s.value;switch(a){case"1":a="I";break;case"2":a="II";break;case"3":a="III";break;case"4":a="IV";break;case"5":a="V";break;case"6":a="VI"}var u=new o.default.Flow.StringNumber(a);u.radius=0;var l=-e.rules.StringNumberOffsetY;t.notes.length>1||t.parentStaffEntry.graphicalVoiceEntries.length>1?(u.setOffsetX(13*n.baseStringNumberXOffset),u.setPosition(o.default.Flow.Modifier.Position.RIGHT)):u.setPosition(o.default.Flow.Modifier.Position.ABOVE),u.setOffsetY(l),i.vfStaveNote.addModifier(r,u)}}))}},i.lineTo=function(t,e){var i=new o.default.Flow.StaveConnector(t.getVFStave(),this.stave);i.setType(e),this.connectors.push(i)},i.getVFStave=function(){return this.stave},i.updateInstructionWidth=function(){for(var t,e=0,i=0,n=_createForOfIteratorHelperLoose(this.stave.getModifiers());!(t=n()).done;){var o=t.value;o.getPosition()===r.BEGIN?e+=o.getWidth()+o.getPadding(void 0):o.getPosition()===r.END&&(i+=o.getWidth()+o.getPadding(void 0))}this.beginInstructionsWidth=(null!=e?e:0)/f.unitInPixels,this.endInstructionsWidth=(null!=i?i:0)/f.unitInPixels},e}(s.GraphicalMeasure);e.VexFlowMeasure=_,function(t){t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.ABOVE=3]="ABOVE",t[t.BELOW=4]="BELOW",t[t.BEGIN=5]="BEGIN",t[t.END=6]="END"}(r=e.StavePositionEnum||(e.StavePositionEnum={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.PagePlacementEnum=e.GraphicalMusicPage=void 0;var n=i(5),r=i(6),o=i(4),s=function(t){function e(e){var i;return(i=t.call(this)||this).musicSystems=[],i.labels=[],i.parent=e,i.boundingBox=new n.BoundingBox(_assertThisInitialized2(i),void 0),i}return _inheritsLoose(e,t),e.prototype.setMusicPageAbsolutePosition=function(t,e){return new o.PointF2D(0,0)},_createClass2(e,[{key:"MusicSystems",get:function(){return this.musicSystems},set:function(t){this.musicSystems=t}},{key:"Labels",get:function(){return this.labels},set:function(t){this.labels=t}},{key:"Parent",get:function(){return this.parent},set:function(t){this.parent=t}},{key:"PageNumber",get:function(){return this.pageNumber},set:function(t){this.pageNumber=t}}]),e}(r.GraphicalObject);e.GraphicalMusicPage=s,function(t){t[t.Down=0]="Down",t[t.Right=1]="Right",t[t.RightDown=2]="RightDown"}(e.PagePlacementEnum||(e.PagePlacementEnum={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.RectangleF2D=void 0;var n=i(66),r=i(4),o=function(){function t(t,e,i,n){this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=i,this.height=n}return t.createFromLocationAndSize=function(e,i){return new t(e.x,e.y,i.width,i.height)},_createClass2(t,[{key:"Location",get:function(){return new r.PointF2D(this.x,this.y)}},{key:"Size",get:function(){return new n.SizeF2D(this.width,this.height)}}]),t}();e.RectangleF2D=o},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.StaffLineActivitySymbol=void 0;var n=i(6),r=i(5),o=function(t){function e(e){var i;(i=t.call(this)||this).parentStaffLine=e;var n=e.PositionAndShape;return i.boundingBox=new r.BoundingBox(_assertThisInitialized2(i),n),i.boundingBox.BorderRight=6,i.boundingBox.BorderBottom=4.5,i.boundingBox.BorderLeft=-1.5,i.boundingBox.BorderTop=-1.5,i}return _inheritsLoose(e,t),e}(n.GraphicalObject);e.StaffLineActivitySymbol=o},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.ChordSymbolEnum=e.ChordDegreeText=e.CustomChord=e.Degree=e.ChordSymbolContainer=void 0;var n=i(2),r=i(17),o=i(2);e.ChordSymbolContainer=function(){function t(t,e,i,n,r){this.rootPitch=t,this.chordKind=e,this.bassPitch=i,this.degrees=n,this.rules=r}return t.calculateChordText=function(t,e,i){var u=t.RootPitch;if(r.MusicSheetCalculator.transposeCalculator&&(u=r.MusicSheetCalculator.transposeCalculator.transposePitch(t.RootPitch,i,e)),t.ChordKind===a.none)return t.getTextFromChordKindEnum(t.ChordKind);var l=n.Pitch.getNoteEnumString(u.FundamentalNote);u.Accidental!==o.AccidentalEnum.NONE&&(l+=this.getTextForAccidental(u.Accidental));for(var c,h={adds:[],alts:[],subs:[]},f=_createForOfIteratorHelperLoose(t.ChordDegrees);!(c=f()).done;){var d=c.value;if(d){var p="";switch(d.alteration!==o.AccidentalEnum.NONE&&(p+=this.getTextForAccidental(d.alteration)),p+=d.value,d.text){case s.add:h.adds.push(p);break;case s.alter:h.alts.push(p);break;case s.subtract:h.subs.push(p)}}}for(var m,v=t.getTextFromChordKindEnum(t.ChordKind),b=["adds","alts","subs"],g=_createForOfIteratorHelperLoose(t.rules.CustomChords);!(m=g()).done;){var y=m.value;if(y.chordKind===t.chordKind){for(var S,_=!0,x=_createForOfIteratorHelperLoose(b);!(S=x()).done;){for(var E,w=S.value,T=_createForOfIteratorHelperLoose(y.degrees[w]||[]);!(E=T()).done;){var M=E.value;if(h[w].indexOf(M)<0){_=!1;break}}if(!_)break}if(_){for(var P,L=_createForOfIteratorHelperLoose(b);!(P=L()).done;)for(var I,A=P.value,C=_createForOfIteratorHelperLoose(y.degrees[A]||[]);!(I=C()).done;){var R=I.value;h[A].splice(h[A].indexOf(R),1)}v=y.alternateName}}}if(l+=v,h.adds.length>0&&(l+="("+h.adds.join(",")+")"),h.alts.length>0&&(l+="(alt "+h.alts.join(",")+")"),h.subs.length>0&&(l+="(omit "+h.subs.join(",")+")"),t.BassPitch){var N=t.BassPitch;r.MusicSheetCalculator.transposeCalculator&&(N=r.MusicSheetCalculator.transposeCalculator.transposePitch(t.BassPitch,i,e)),l+="/",l+=n.Pitch.getNoteEnumString(N.FundamentalNote),l+=this.getTextForAccidental(N.Accidental)}return l},t.getTextForAccidental=function(t){var e="";switch(t){case o.AccidentalEnum.DOUBLEFLAT:e+="bb";break;case o.AccidentalEnum.FLAT:e+="b";break;case o.AccidentalEnum.SHARP:e+="#";break;case o.AccidentalEnum.DOUBLESHARP:e+="x"}return e},t.prototype.getTextFromChordKindEnum=function(t){var e;return null!==(e=this.rules.ChordSymbolLabelTexts.getValue(t))&&void 0!==e?e:""},_createClass2(t,[{key:"RootPitch",get:function(){return this.rootPitch}},{key:"ChordKind",get:function(){return this.chordKind}},{key:"BassPitch",get:function(){return this.bassPitch}},{key:"ChordDegrees",get:function(){return this.degrees}}]),t}(),e.Degree=function(){function t(t,e,i){this.value=t,this.alteration=e,this.text=i}return t}();var s,a,u=function(){function t(t,e,i){this.alternateName=t,this.chordKind=e,this.degrees=i}return t.createCustomChord=function(e,i,n){return new t(e,i,n)},t.renameCustomChord=function(t,e,i){for(var n,r=_createForOfIteratorHelperLoose(i);!(n=r()).done;){var o=n.value;o.alternateName===t&&(o.alternateName=e)}},t}();e.CustomChord=u,function(t){t[t.add=0]="add",t[t.alter=1]="alter",t[t.subtract=2]="subtract"}(s=e.ChordDegreeText||(e.ChordDegreeText={})),function(t){t[t.major=0]="major",t[t.minor=1]="minor",t[t.augmented=2]="augmented",t[t.diminished=3]="diminished",t[t.dominant=4]="dominant",t[t.majorseventh=5]="majorseventh",t[t.minorseventh=6]="minorseventh",t[t.diminishedseventh=7]="diminishedseventh",t[t.augmentedseventh=8]="augmentedseventh",t[t.halfdiminished=9]="halfdiminished",t[t.majorminor=10]="majorminor",t[t.majorsixth=11]="majorsixth",t[t.minorsixth=12]="minorsixth",t[t.dominantninth=13]="dominantninth",t[t.majorninth=14]="majorninth",t[t.minorninth=15]="minorninth",t[t.dominant11th=16]="dominant11th",t[t.major11th=17]="major11th",t[t.minor11th=18]="minor11th",t[t.dominant13th=19]="dominant13th",t[t.major13th=20]="major13th",t[t.minor13th=21]="minor13th",t[t.suspendedsecond=22]="suspendedsecond",t[t.suspendedfourth=23]="suspendedfourth",t[t.Neapolitan=24]="Neapolitan",t[t.Italian=25]="Italian",t[t.French=26]="French",t[t.German=27]="German",t[t.pedal=28]="pedal",t[t.power=29]="power",t[t.Tristan=30]="Tristan",t[t.none=31]="none"}(a=e.ChordSymbolEnum||(e.ChordSymbolEnum={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractNotationInstruction=void 0,e.AbstractNotationInstruction=function(){function t(t){this.printObject=!0,this.parent=t}return _createClass2(t,[{key:"Parent",get:function(){return this.parent},set:function(t){this.parent=t}},{key:"PrintObject",get:function(){return this.printObject},set:function(t){this.printObject=t}}]),t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.OrnamentEnum=e.OrnamentContainer=void 0;var n=i(2),r=i(3);e.OrnamentContainer=function(){function t(t){this.placement=r.PlacementEnum.Above,this.accidentalAbove=n.AccidentalEnum.NONE,this.accidentalBelow=n.AccidentalEnum.NONE,this.ornament=t}return _createClass2(t,[{key:"GetOrnament",get:function(){return this.ornament}},{key:"AccidentalAbove",get:function(){return this.accidentalAbove},set:function(t){this.accidentalAbove=t}},{key:"AccidentalBelow",get:function(){return this.accidentalBelow},set:function(t){this.accidentalBelow=t}}]),t}(),function(t){t[t.Trill=0]="Trill",t[t.Turn=1]="Turn",t[t.InvertedTurn=2]="InvertedTurn",t[t.DelayedTurn=3]="DelayedTurn",t[t.DelayedInvertedTurn=4]="DelayedInvertedTurn",t[t.Mordent=5]="Mordent",t[t.InvertedMordent=6]="InvertedMordent"}(e.OrnamentEnum||(e.OrnamentEnum={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Voice=void 0,e.Voice=function(){function t(t,e){this.voiceEntries=[],this.volume=1,this.parent=t,this.visible=!0,this.audible=!0,this.following=!0,this.voiceId=e}return _createClass2(t,[{key:"VoiceEntries",get:function(){return this.voiceEntries}},{key:"Parent",get:function(){return this.parent}},{key:"Visible",get:function(){return this.visible},set:function(t){this.visible=t}},{key:"Audible",get:function(){return this.audible},set:function(t){this.audible=t}},{key:"Following",get:function(){return this.following},set:function(t){this.following=t}},{key:"VoiceId",get:function(){return this.voiceId}},{key:"Volume",get:function(){return this.volume},set:function(t){this.volume=t}}]),t}()},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalContinuousDynamicExpression=void 0;var r=i(27),o=i(32),s=i(4),a=i(42),u=i(3),l=n(i(1)),c=function(t){function e(e,i,n){var r;return(r=t.call(this,i,e,n)||this).lines=[],r.isSplittedPart=!1,r.notToBeRemoved=!1,r}_inheritsLoose(e,t);var i=e.prototype;return i.updateSkyBottomLine=function(){var t,e=this.parentStaffLine.SkyBottomLineCalculator,i=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft:0,n=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight:0;switch(!this.IsVerbal&&this.lines.length<2&&l.default.warn("Not enough lines for SkyBottomLine calculation"),this.IsVerbal||this.ContinuousDynamic.DynamicType!==o.ContDynamicEnum.crescendo&&this.ContinuousDynamic.DynamicType!==o.ContDynamicEnum.diminuendo&&l.default.warn("GraphicalContinuousDynamicExpression.updateSkyBottomLine(): unhandled continuous dynamic type. start measure: "+(null===(t=this.startMeasure)||void 0===t?void 0:t.MeasureNumber)),this.Placement){case u.PlacementEnum.Above:if(this.IsVerbal){var r=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;e.updateSkyLineInRange(i,n,r)}else this.ContinuousDynamic.DynamicType===o.ContDynamicEnum.crescendo?e.updateSkyLineWithWedge(this.lines[0].Start,this.lines[0].End):this.ContinuousDynamic.DynamicType===o.ContDynamicEnum.diminuendo&&e.updateSkyLineWithWedge(this.lines[0].End,this.lines[0].Start);break;case u.PlacementEnum.Below:if(this.IsVerbal){var s=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;e.updateBottomLineInRange(i,n,s)}else this.ContinuousDynamic.DynamicType===o.ContDynamicEnum.crescendo?e.updateBottomLineWithWedge(this.lines[1].Start,this.lines[1].End):this.ContinuousDynamic.DynamicType===o.ContDynamicEnum.diminuendo&&e.updateBottomLineWithWedge(this.lines[1].End,this.lines[1].Start);break;default:l.default.error("Placement for GraphicalContinuousDynamicExpression is unknown")}},i.createCrescendoLines=function(t,e,i,n,r){void 0===n&&(n=this.rules.WedgeOpeningLength),void 0===r&&(r=this.rules.WedgeLineWidth);var o=new s.PointF2D(t,i),a=new s.PointF2D(e,i-n/2),u=new s.PointF2D(e,i+n/2);this.addWedgeLines(o,a,u,r)},i.createFirstHalfCrescendoLines=function(t,e,i,n,r){void 0===n&&(n=this.rules.WedgeMeasureEndOpeningLength),void 0===r&&(r=this.rules.WedgeLineWidth);var o=new s.PointF2D(t,i),a=new s.PointF2D(e,i-n/2),u=new s.PointF2D(e,i+n/2);this.addWedgeLines(o,a,u,r)},i.createSecondHalfCrescendoLines=function(t,e,i,n,r,o){void 0===n&&(n=this.rules.WedgeMeasureBeginOpeningLength),void 0===r&&(r=this.rules.WedgeOpeningLength),void 0===o&&(o=this.rules.WedgeLineWidth);var a=new s.PointF2D(t,i-n/2),u=new s.PointF2D(t,i+n/2),l=new s.PointF2D(e,i-r/2),c=new s.PointF2D(e,i+r/2);this.addDoubleLines(a,l,u,c,o)},i.recalculateCrescendoLines=function(t,e,i){var n=Math.abs(this.lines[0].Start.y-this.lines[1].Start.y)>1e-4;this.lines.clear(),n?this.createSecondHalfCrescendoLines(t,e,i):this.isSplittedPart?this.createFirstHalfCrescendoLines(t,e,i):this.createCrescendoLines(t,e,i)},i.createDiminuendoLines=function(t,e,i,n,r){void 0===n&&(n=this.rules.WedgeOpeningLength),void 0===r&&(r=this.rules.WedgeLineWidth);var o=new s.PointF2D(t,i-n/2),a=new s.PointF2D(t,i+n/2),u=new s.PointF2D(e,i);this.addWedgeLines(u,o,a,r)},i.createFirstHalfDiminuendoLines=function(t,e,i,n,r,o){void 0===n&&(n=this.rules.WedgeOpeningLength),void 0===r&&(r=this.rules.WedgeMeasureEndOpeningLength),void 0===o&&(o=this.rules.WedgeLineWidth);var a=new s.PointF2D(t,i-n/2),u=new s.PointF2D(t,i+n/2),l=new s.PointF2D(e,i-r/2),c=new s.PointF2D(e,i+r/2);this.addDoubleLines(a,l,u,c,o)},i.createSecondHalfDiminuendoLines=function(t,e,i,n,r){void 0===n&&(n=this.rules.WedgeMeasureBeginOpeningLength),void 0===r&&(r=this.rules.WedgeLineWidth);var o=new s.PointF2D(t,i-n/2),a=new s.PointF2D(t,i+n/2),u=new s.PointF2D(e,i);this.addWedgeLines(u,o,a,r)},i.recalculateDiminuendoLines=function(t,e,i){var n=Math.abs(this.lines[0].End.y-this.lines[1].End.y)>1e-4;this.lines.clear(),n?this.createFirstHalfDiminuendoLines(t,e,i):this.isSplittedPart?this.createSecondHalfDiminuendoLines(t,e,i):this.createDiminuendoLines(t,e,i)},i.calcPsi=function(){this.IsVerbal?this.PositionAndShape.calculateBoundingBox():(this.PositionAndShape.RelativePosition=this.lines[0].Start,this.PositionAndShape.BorderMarginTop=this.lines[0].End.y-this.lines[0].Start.y,this.PositionAndShape.BorderMarginBottom=this.lines[1].End.y-this.lines[1].Start.y,this.PositionAndShape.Center.y=(this.PositionAndShape.BorderMarginTop+this.PositionAndShape.BorderMarginBottom)/2,this.ContinuousDynamic.DynamicType===o.ContDynamicEnum.crescendo?(this.PositionAndShape.BorderMarginLeft=0,this.PositionAndShape.BorderMarginRight=this.lines[0].End.x-this.lines[0].Start.x):(this.PositionAndShape.BorderMarginLeft=this.lines[0].End.x-this.lines[0].Start.x,this.PositionAndShape.BorderMarginRight=0))},i.cleanUp=function(){this.lines.clear()},i.shiftYPosition=function(t){this.IsVerbal?(this.PositionAndShape.RelativePosition.y+=t,this.PositionAndShape.calculateBoundingBox()):(this.lines[0].Start.y+=t,this.lines[0].End.y+=t,this.lines[1].End.y+=t)},i.squeeze=function(t){this.IsVerbal||Math.abs(this.lines[0].End.x-this.lines[0].Start.x)0?this.lines[0].Start.x+=t:(this.lines[0].End.x+=t,this.lines[1].End.x+=t):t<0?this.lines[0].Start.x+=t:(this.lines[0].End.x+=t,this.lines[1].End.x+=t),this.calcPsi())},i.addWedgeLines=function(t,e,i,n){var o=new r.GraphicalLine(t,e,n),s=new r.GraphicalLine(t,i,n);this.lines.push(o),this.lines.push(s)},i.addDoubleLines=function(t,e,i,n,o){var s=new r.GraphicalLine(t,e,o),a=new r.GraphicalLine(i,n,o);this.lines.push(s),this.lines.push(a)},_createClass2(e,[{key:"StartMeasure",get:function(){return this.startMeasure},set:function(t){this.startMeasure=t}},{key:"EndMeasure",get:function(){return this.endMeasure},set:function(t){this.endMeasure=t}},{key:"EndStaffLine",get:function(){return this.endMeasure?this.endMeasure.ParentStaffLine:void 0}},{key:"IsSplittedPart",get:function(){return this.isSplittedPart},set:function(t){this.isSplittedPart=t}},{key:"IsVerbal",get:function(){return this.ContinuousDynamic.Label&&this.ContinuousDynamic.Label.length>0}},{key:"NotToBeRemoved",get:function(){return this.notToBeRemoved},set:function(t){this.notToBeRemoved=t}},{key:"Lines",get:function(){return this.lines}},{key:"ContinuousDynamic",get:function(){return this.SourceExpression}}]),e}(a.AbstractGraphicalExpression);e.GraphicalContinuousDynamicExpression=c},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var n=i(10),r=i(35),o=function(){function t(){this.firstNode=null,this.lastNode=null,this.nElements=0}return t.prototype.add=function(t,e){if(n.isUndefined(e)&&(e=this.nElements),e<0||e>this.nElements||n.isUndefined(t))return!1;var i=this.createNode(t);if(0===this.nElements||null===this.lastNode)this.firstNode=i,this.lastNode=i;else if(e===this.nElements)this.lastNode.next=i,this.lastNode=i;else if(0===e)i.next=this.firstNode,this.firstNode=i;else{var r=this.nodeAtIndex(e-1);if(null===r)return!1;i.next=r.next,r.next=i}return this.nElements++,!0},t.prototype.first=function(){if(null!==this.firstNode)return this.firstNode.element},t.prototype.last=function(){if(null!==this.lastNode)return this.lastNode.element},t.prototype.elementAtIndex=function(t){var e=this.nodeAtIndex(t);if(null!==e)return e.element},t.prototype.indexOf=function(t,e){var i=e||n.defaultEquals;if(n.isUndefined(t))return-1;for(var r=this.firstNode,o=0;null!==r;){if(i(r.element,t))return o;o++,r=r.next}return-1},t.prototype.contains=function(t,e){return this.indexOf(t,e)>=0},t.prototype.remove=function(t,e){var i=e||n.defaultEquals;if(this.nElements<1||n.isUndefined(t))return!1;for(var r=null,o=this.firstNode;null!==o;){if(i(o.element,t))return null===r?(this.firstNode=o.next,o===this.lastNode&&(this.lastNode=null)):o===this.lastNode?(this.lastNode=r,r.next=o.next,o.next=null):(r.next=o.next,o.next=null),this.nElements--,!0;r=o,o=o.next}return!1},t.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},t.prototype.equals=function(e,i){var r=i||n.defaultEquals;return e instanceof t&&this.size()===e.size()&&this.equalsAux(this.firstNode,e.firstNode,r)},t.prototype.equalsAux=function(t,e,i){for(;null!==t&&null!==e;){if(!i(t.element,e.element))return!1;t=t.next,e=e.next}return!0},t.prototype.removeElementAtIndex=function(t){if(!(t<0||t>=this.nElements||null===this.firstNode||null===this.lastNode)){var e;if(1===this.nElements)e=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var i=this.nodeAtIndex(t-1);null===i?(e=this.firstNode.element,this.firstNode=this.firstNode.next):i.next===this.lastNode&&(e=this.lastNode.element,this.lastNode=i),null!==i&&null!==i.next&&(e=i.next.element,i.next=i.next.next)}return this.nElements--,e}},t.prototype.forEach=function(t){for(var e=this.firstNode;null!==e&&!1!==t(e.element);)e=e.next},t.prototype.reverse=function(){for(var t=null,e=this.firstNode,i=null;null!==e;)i=e.next,e.next=t,t=e,e=i;i=this.firstNode,this.firstNode=this.lastNode,this.lastNode=i},t.prototype.toArray=function(){for(var t=[],e=this.firstNode;null!==e;)t.push(e.element),e=e.next;return t},t.prototype.size=function(){return this.nElements},t.prototype.isEmpty=function(){return this.nElements<=0},t.prototype.toString=function(){return r.toString(this.toArray())},t.prototype.nodeAtIndex=function(t){if(t<0||t>=this.nElements)return null;if(t===this.nElements-1)return this.lastNode;for(var e=this.firstNode,i=0;i=n.allargando&&t<=n.ritenuto};var i=e.prototype;return i.getAbsoluteFloatTimestamp=function(){return this.ParentMultiTempoExpression.AbsoluteTimestamp.RealValue},i.getInterpolatedTempo=function(t){var e=r.Fraction.plus(this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.parentMultiTempoExpression.Timestamp);if(t.lt(e))return-1;if(this.absoluteEndTimestamp.lt(t))return-2;var i=r.Fraction.minus(t,e).RealValue/r.Fraction.minus(this.absoluteEndTimestamp,e).RealValue;return Math.max(0,Math.min(250,this.startTempo+(this.endTempo-this.startTempo)*i))},i.setTempoType=function(){e.isStringInStringList(e.listContinuousTempoFaster,this.label)?this.tempoType=n.accelerando:e.isStringInStringList(e.listContinuousTempoSlower,this.label)&&(this.tempoType=n.ritardando)},_createClass2(e,[{key:"TempoType",get:function(){return this.tempoType},set:function(t){this.tempoType=t}},{key:"StartTempo",get:function(){return this.startTempo},set:function(t){this.startTempo=t}},{key:"EndTempo",get:function(){return this.endTempo},set:function(t){this.endTempo=t}},{key:"AbsoluteEndTimestamp",get:function(){return this.absoluteEndTimestamp},set:function(t){this.absoluteEndTimestamp=t}},{key:"AbsoluteTimestamp",get:function(){return this.ParentMultiTempoExpression.AbsoluteTimestamp}}]),e}(i(55).AbstractTempoExpression);e.ContinuousTempoExpression=o,o.listContinuousTempoFaster=["accelerando","piu mosso","poco piu","stretto"],o.listContinuousTempoSlower=["poco meno","meno mosso","piu lento","calando","allargando","rallentando","ritardando","ritenuto","ritard.","ritard","rit.","rit","riten.","riten"],function(t){t[t.accelerando=0]="accelerando",t[t.stretto=1]="stretto",t[t.stringendo=2]="stringendo",t[t.mosso=3]="mosso",t[t.piuMosso=4]="piuMosso",t[t.allargando=5]="allargando",t[t.calando=6]="calando",t[t.menoMosso=7]="menoMosso",t[t.rallentando=8]="rallentando",t[t.ritardando=9]="ritardando",t[t.ritard=10]="ritard",t[t.rit=11]="rit",t[t.ritenuto=12]="ritenuto",t[t.rubato=13]="rubato",t[t.precipitando=14]="precipitando"}(n=e.ContinuousTempoType||(e.ContinuousTempoType={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowContinuousDynamicExpression=void 0;var n=i(52),r=i(24),o=i(12),s=i(9),a=i(21),u=function(t){function e(e,i,n,u){var l;if((l=t.call(this,e,i,n)||this).IsVerbal){var c=new o.Label(e.Label);l.label=new r.GraphicalLabel(c,u||l.rules.ContinuousDynamicTextHeight,s.TextAlignmentEnum.LeftCenter,l.rules,l.PositionAndShape),l.label.Label.fontStyle=a.FontStyles.Italic,l.label.setLabelPositionAndShapeBorders(),l.PositionAndShape.calculateBoundingBox()}return _assertThisInitialized2(l)}return _inheritsLoose(e,t),e}(n.GraphicalContinuousDynamicExpression);e.VexFlowContinuousDynamicExpression=u},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.CanvasVexFlowBackend=void 0;var r=n(i(8)),o=i(59),s=i(13),a=i(25),u=i(45),l=function(t){function e(e){var i;return(i=t.call(this)||this).rules=e,i}_inheritsLoose(e,t);var i=e.prototype;return i.getVexflowBackendType=function(){return r.default.Flow.Renderer.Backends.CANVAS},i.getOSMDBackendType=function(){return a.BackendType.Canvas},i.getCanvasSize=function(){var t;return null===(t=document.getElementById("osmdCanvasPage"+this.graphicalMusicPage.PageNumber))||void 0===t?void 0:t.offsetHeight},i.initialize=function(t,e){this.zoom=e,this.canvas=document.createElement("canvas"),this.graphicalMusicPage||(this.graphicalMusicPage=new u.GraphicalMusicPage(void 0),this.graphicalMusicPage.PageNumber=1),this.canvas.id="osmdCanvasVexFlowBackendCanvas"+this.graphicalMusicPage.PageNumber,this.inner=document.createElement("div"),this.inner.id="osmdCanvasPage"+this.graphicalMusicPage.PageNumber,this.inner.style.position="relative",this.canvas.style.zIndex="0",this.inner.appendChild(this.canvas),t.appendChild(this.inner),this.renderer=new r.default.Flow.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext()},i.initializeHeadless=function(t,e){void 0===t&&(t=300),void 0===e&&(e=300),this.graphicalMusicPage||(this.graphicalMusicPage=new u.GraphicalMusicPage(void 0),this.graphicalMusicPage.PageNumber=1),this.canvas=document.createElement("canvas"),this.canvas.width=t,this.canvas.height=e,this.renderer=new r.default.Flow.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext()},i.getContext=function(){return this.ctx},i.clear=function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.rules.PageBackgroundColor&&(this.ctx.save(),this.ctx.setFillStyle(this.rules.PageBackgroundColor),this.zoom=1,this.ctx.fillRect(0,0,this.canvas.width/this.zoom,this.canvas.height/this.zoom),this.ctx.restore())},i.scale=function(t){this.ctx.scale(t,t)},i.translate=function(t,e){this.CanvasRenderingCtx.translate(t,e)},i.renderText=function(t,e,i,n,r,o,a,u){var l=this.CanvasRenderingCtx.font;this.CanvasRenderingCtx.save(),this.CanvasRenderingCtx.font=s.VexFlowConverter.font(t,e,i,this.rules,u),this.CanvasRenderingCtx.fillStyle=a,this.CanvasRenderingCtx.strokeStyle=a,this.CanvasRenderingCtx.fillText(n,o.x,o.y+r),this.CanvasRenderingCtx.restore(),this.CanvasRenderingCtx.font=l},i.renderRectangle=function(t,e,i,n){void 0===n&&(n=1);var r=this.CanvasRenderingCtx.fillStyle;this.CanvasRenderingCtx.fillStyle=i||s.VexFlowConverter.style(e),this.CanvasRenderingCtx.globalAlpha=n,this.ctx.fillRect(t.x,t.y,t.width,t.height),this.CanvasRenderingCtx.fillStyle=r,this.CanvasRenderingCtx.globalAlpha=1},i.renderLine=function(t,e,i,n){void 0===i&&(i="#FF0000FF"),void 0===n&&(n=2);var r=this.CanvasRenderingCtx.strokeStyle;this.CanvasRenderingCtx.strokeStyle=i,this.CanvasRenderingCtx.beginPath(),this.CanvasRenderingCtx.moveTo(t.x,t.y),this.CanvasRenderingCtx.lineTo(e.x,e.y),this.CanvasRenderingCtx.stroke(),this.CanvasRenderingCtx.strokeStyle=r},i.renderCurve=function(t){this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y),this.ctx.lineTo(t[7].x,t[7].y),this.ctx.bezierCurveTo(t[6].x,t[6].y,t[5].x,t[5].y,t[4].x,t[4].y),this.ctx.lineTo(t[0].x,t[0].y),this.ctx.closePath(),this.ctx.fill()},_createClass2(e,[{key:"CanvasRenderingCtx",get:function(){return this.ctx.vexFlowCanvasContext}}]),e}(o.VexFlowBackend);e.CanvasVexFlowBackend=l},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowBackend=e.VexFlowBackends=void 0;var r=n(i(8));e.VexFlowBackends=function(){function t(){}return t}(),e.VexFlowBackend=function(){function t(){}var e=t.prototype;return e.getInnerElement=function(){return this.inner},e.getCanvas=function(){return this.canvas},e.getRenderElement=function(){var t=this.canvas;return this.getVexflowBackendType()===r.default.Flow.Renderer.Backends.CANVAS&&(t=this.inner),t},e.getRenderer=function(){return this.renderer},e.removeAllChildrenFromContainer=function(t){for(;0!==t.children.length;)t.removeChild(t.children.item(0))},e.removeFromContainer=function(t){for(var e=this.getRenderElement(),i=0;ithis.vfnoteIndex&&i[this.vfnoteIndex]?e.note_heads[this.vfnoteIndex]:{line:0}},i.Clef=function(){return this.clef},i.getSVGId=function(){return this.vfnote[0].getAttribute("id")},i.getSVGGElement=function(){return this.vfnote[0].getAttribute("el")},e}(n.GraphicalNote);e.VexFlowGraphicalNote=s},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowInstrumentBracket=void 0;var r=n(i(8)),o=i(6),s=i(5),a=i(16),u=function(t){function e(e,i,n){var o;void 0===n&&(n=0),(o=t.call(this)||this).PositionAndShape=new s.BoundingBox(_assertThisInitialized2(o),e.ParentMusicSystem.PositionAndShape);var a=e.Measures[0],u=i.Measures[0];return o.addConnector(a.getVFStave(),u.getVFStave(),r.default.Flow.StaveConnector.type.BRACKET,n),o}_inheritsLoose(e,t);var i=e.prototype;return i.draw=function(t){this.vexflowConnector.setContext(t).draw();var e=this.vexflowConnector,i=e.top_stave.getYForLine(0),n=e.bottom_stave.getYForLine(e.bottom_stave.getNumLines()-1)+e.thickness;this.PositionAndShape.AbsolutePosition.x=(e.top_stave.getX()-2+e.x_shift)/a.unitInPixels,this.PositionAndShape.AbsolutePosition.y=i/a.unitInPixels,this.PositionAndShape.Size.height=(n-i)/a.unitInPixels,this.PositionAndShape.Size.width=12/a.unitInPixels},i.addConnector=function(t,e,i,n){this.vexflowConnector=new r.default.Flow.StaveConnector(t,e).setType(i).setXShift(-5*n)},e}(o.GraphicalObject);e.VexFlowInstrumentBracket=u},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowVoiceEntry=void 0;var n=i(69),r=i(16),o=i(33),s=function(t){function e(e,i){return t.call(this,e,i)||this}_inheritsLoose(e,t);var i=e.prototype;return i.applyBordersFromVexflow=function(){var t=this.vfStaveNote;if(t.getNoteHeadBeginX){var e=t.getBoundingBox(),i=t.getNoteHeadBeginX()-e.x;this.PositionAndShape.RelativePosition.y=e.y/r.unitInPixels,this.PositionAndShape.BorderTop=0,this.PositionAndShape.BorderBottom=e.h/r.unitInPixels,this.PositionAndShape.BorderLeft=-(i+t.width/2)/r.unitInPixels,this.PositionAndShape.BorderRight=(e.w-i)/r.unitInPixels}},i.color=function(){for(var t,e,i,n=this.rules.DefaultColorNotehead,r=this.rules.DefaultColorRest,s=this.rules.DefaultColorStem,a=this.vfStaveNote,u=0;u=0;i--){var n=this.measureList[i][e];if(n)return n}},i.findGraphicalStaffEntryFromMeasureList=function(t,e,i){for(var n=e;n0)return o.staffEntries[0]}},i.getFirstVisibleMeasuresListFromIndices=function(t,e){for(var i=[],n=this.measureList[0].length,r=t;r<=e;r++)for(var o=0;o=0;i--){if(this.verticalGraphicalStaffEntryContainers[i].AbsoluteTimestamp.lt(t)){var n=new r.VerticalGraphicalStaffEntryContainer(this.numberOfStaves,t);return this.verticalGraphicalStaffEntryContainers.splice(i+1,0,n),n}if(this.verticalGraphicalStaffEntryContainers[i].AbsoluteTimestamp.Equals(t))return this.verticalGraphicalStaffEntryContainers[i]}},i.GetVerticalContainerFromTimestamp=function(t,e){void 0===e&&(e=0);var i=f.CollectionUtil.binarySearch(this.verticalGraphicalStaffEntryContainers,new r.VerticalGraphicalStaffEntryContainer(0,t),r.VerticalGraphicalStaffEntryContainer.compareByTimestamp,e);if(i>=0)return this.verticalGraphicalStaffEntryContainers[i]},i.GetInterpolatedIndexInVerticalContainers=function(t){var e=this.verticalGraphicalStaffEntryContainers,i=0,n=e.length-1,r=void 0,o=void 0;if(t.lte(e[e.length-1].AbsoluteTimestamp)){for(;n-i>1;){var s=Math.floor((n+i)/2);if(e[i].AbsoluteTimestamp.Equals(t)){n=i;break}if(e[n].AbsoluteTimestamp.Equals(t)){i=n;break}if(e[s].AbsoluteTimestamp.Equals(t))return this.verticalGraphicalStaffEntryContainers.indexOf(e[s]);t.lt(e[s].AbsoluteTimestamp)?n=s:i=s}if(i===n)return this.verticalGraphicalStaffEntryContainers.indexOf(e[i]);r=e[i].AbsoluteTimestamp,o=e[n].AbsoluteTimestamp}else r=e[e.length-1].AbsoluteTimestamp,o=l.Fraction.plus(this.getLongestStaffEntryDuration(e.length-1),r),n=e.length;var a=o.RealValue-r.RealValue,u=n-(o.RealValue-t.RealValue)/a;return Math.min(u,this.verticalGraphicalStaffEntryContainers.length)},i.getVisibleStavesIndicesFromSourceMeasure=function(t){for(var e=[],i=[],n=0,r=t.length;no.PositionAndShape.RelativePosition.x&&(i=o):i=o)}}catch(t){h.default.info("GraphicalMusicSheet.getStaffEntry",t)}return i},i.GetPreviousVisibleContainerIndex=function(t){for(var e=t-1;e>=0;e--)for(var i=this.verticalGraphicalStaffEntryContainers[e].StaffEntries,n=0,r=i.length;n=0;r--)if(i=this.getStaffEntry(r)){if(!e)return i;if(i.sourceStaffEntry.ParentStaff.ParentInstrument.Visible)return i}},i.findClosestRightStaffEntry=function(t,e){for(var i=void 0,n=Math.max(0,Math.ceil(t));n0&&this.Voices[0].Visible},set:function(t){for(var e=0,i=this.Voices.length;e2:(o.default.warn("notehead: sourceNote and filledXmlAttribute undefined."),n=!0)),this.filled=n},t.ShapeTypeXmlToShape=function(t){switch(t.toLowerCase()){case"normal":return r.NORMAL;case"x":return r.X;case"slash":return r.SLASH;case"diamond":return r.DIAMOND;case"square":case"la":return r.SQUARE;case"do":case"triangle":return r.TRIANGLE;case"rectangle":return r.RECTANGLE;case"circle-x":return r.CIRCLEX;default:return o.default.info("unsupported/unhandled xml notehead '"+t+"'. Using normal notehead."),r.NORMAL}},_createClass2(t,[{key:"SourceNote",get:function(){return this.sourceNote}},{key:"Shape",get:function(){return this.shape}},{key:"Filled",get:function(){return this.filled}}]),t}();e.Notehead=s,function(t){t[t.CIRCLEX=0]="CIRCLEX",t[t.DIAMOND=1]="DIAMOND",t[t.NORMAL=2]="NORMAL",t[t.RECTANGLE=3]="RECTANGLE",t[t.SLASH=4]="SLASH",t[t.SQUARE=5]="SQUARE",t[t.TRIANGLE=6]="TRIANGLE",t[t.X=7]="X"}(r=e.NoteHeadShape||(e.NoteHeadShape={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.MusicSymbol=void 0,function(t){t[t.Unused_first_Symbol=0]="Unused_first_Symbol",t[t.BLACK_HEAD=1]="BLACK_HEAD",t[t.UPWARDS_TAIL=2]="UPWARDS_TAIL",t[t.DOWNWARDS_TAIL=3]="DOWNWARDS_TAIL",t[t.UPWARDS_DOUBLE_TAIL=4]="UPWARDS_DOUBLE_TAIL",t[t.DOWNWARDS_DOUBLE_TAIL=5]="DOWNWARDS_DOUBLE_TAIL",t[t.UPWARDS_TRIPLE_TAIL=6]="UPWARDS_TRIPLE_TAIL",t[t.DOWNWARDS_TRIPLE_TAIL=7]="DOWNWARDS_TRIPLE_TAIL",t[t.UPWARDS_QUAD_TAIL=8]="UPWARDS_QUAD_TAIL",t[t.DOWNWARDS_QUAD_TAIL=9]="DOWNWARDS_QUAD_TAIL",t[t.ROUND_HEAD=10]="ROUND_HEAD",t[t.WHITE_HEAD=11]="WHITE_HEAD",t[t.G_CLEF=12]="G_CLEF",t[t.F_CLEF=13]="F_CLEF",t[t.C_CLEF=14]="C_CLEF",t[t.BREVE=15]="BREVE",t[t.BREVE_REST=16]="BREVE_REST",t[t.COMMON_TIME=17]="COMMON_TIME",t[t.CUT_TIME=18]="CUT_TIME",t[t.WHOLE_REST=19]="WHOLE_REST",t[t.HALF_REST=20]="HALF_REST",t[t.QUARTER_REST=21]="QUARTER_REST",t[t.EIGHTH_REST=22]="EIGHTH_REST",t[t.SIXTEENTH_REST=23]="SIXTEENTH_REST",t[t.THIRTYSECOND_REST=24]="THIRTYSECOND_REST",t[t.SIXTYFOURTH_REST=25]="SIXTYFOURTH_REST",t[t.FLAT=26]="FLAT",t[t.SHARP=27]="SHARP",t[t.NATURAL=28]="NATURAL",t[t.DOUBLE_FLAT=29]="DOUBLE_FLAT",t[t.DOUBLE_SHARP=30]="DOUBLE_SHARP",t[t.ZERO=31]="ZERO",t[t.ONE=32]="ONE",t[t.TWO=33]="TWO",t[t.THREE=34]="THREE",t[t.FOUR=35]="FOUR",t[t.FIVE=36]="FIVE",t[t.SIX=37]="SIX",t[t.SEVEN=38]="SEVEN",t[t.EIGHT=39]="EIGHT",t[t.NINE=40]="NINE",t[t.DOT=41]="DOT",t[t.FERMATA=42]="FERMATA",t[t.INVERTED_FERMATA=43]="INVERTED_FERMATA",t[t.SPICCATO=44]="SPICCATO",t[t.TENUTO=45]="TENUTO",t[t.MARCATO=46]="MARCATO",t[t.MARCATISSIMO=47]="MARCATISSIMO",t[t.INVERTED_MARCATISSIMO=48]="INVERTED_MARCATISSIMO",t[t.P=49]="P",t[t.F=50]="F",t[t.S=51]="S",t[t.Z=52]="Z",t[t.M=53]="M",t[t.R=54]="R",t[t.SEGNO=55]="SEGNO",t[t.CODA=56]="CODA",t[t.DRUM_CLEF=57]="DRUM_CLEF",t[t.G_CLEF_SUB8=58]="G_CLEF_SUB8",t[t.G_CLEF_SUPER8=59]="G_CLEF_SUPER8",t[t.G_CLEF_SUB15=60]="G_CLEF_SUB15",t[t.G_CLEF_SUPER15=61]="G_CLEF_SUPER15",t[t.F_CLEF_SUB8=62]="F_CLEF_SUB8",t[t.F_CLEF_SUPER8=63]="F_CLEF_SUPER8",t[t.F_CLEF_SUB15=64]="F_CLEF_SUB15",t[t.F_CLEF_SUPER15=65]="F_CLEF_SUPER15",t[t.DOWN_BOW=66]="DOWN_BOW",t[t.MORDENT=67]="MORDENT",t[t.INVERTED_MORDENT=68]="INVERTED_MORDENT",t[t.TURN=69]="TURN",t[t.INVERTED_TURN=70]="INVERTED_TURN",t[t.LEFTHAND_PIZZICATO=71]="LEFTHAND_PIZZICATO",t[t.RELEASE_PED=72]="RELEASE_PED",t[t.ENGAGE_PED=73]="ENGAGE_PED",t[t.VA8=74]="VA8",t[t.VB8=75]="VB8",t[t.TRILL=76]="TRILL",t[t.MA15=77]="MA15",t[t.MB15=78]="MB15",t[t.HIGH=79]="HIGH",t[t.PLAY=80]="PLAY",t[t.MIC=81]="MIC",t[t.SNAP_PIZZICATO=82]="SNAP_PIZZICATO",t[t.NATURAL_HARMONIC=83]="NATURAL_HARMONIC",t[t.EditPen=84]="EditPen"}(e.MusicSymbol||(e.MusicSymbol={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AlignmentManager=void 0;var n=i(57),r=i(4);e.AlignmentManager=function(){function t(t){this.parentStaffline=t,this.rules=this.parentStaffline.ParentMusicSystem.rules}var e=t.prototype;return e.alignDynamicExpressions=function(){for(var t,e,i=[],r=new Array,o=0;o0)for(var f=h.map((function(t){return t.PositionAndShape.Center.y})),d=Math.max.apply(Math,f),p=0;p0?h[p-1]:void 0;if(b){var y=this.getOverlap(m.PositionAndShape,b.PositionAndShape);m.squeeze(-(y.x+this.rules.DynamicExpressionSpacer))}if(g){var S=this.getOverlap(g.PositionAndShape,m.PositionAndShape);m.squeeze(S.x+this.rules.DynamicExpressionSpacer)}}}}},e.getDistance=function(t,e){var i=t.RelativePosition.x+t.BorderMarginRight,n=e.RelativePosition.x+e.BorderMarginLeft,o=t.RelativePosition.y+t.BorderMarginBottom,s=e.RelativePosition.y+e.BorderMarginTop;return new r.PointF2D(n-i,s-o)},e.getOverlap=function(t,e){return new r.PointF2D(t.RelativePosition.x+t.BorderMarginRight-(e.RelativePosition.x+e.BorderMarginLeft),t.RelativePosition.y+t.BorderMarginBottom-(e.RelativePosition.y+e.BorderMarginTop))},t}()},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalInstantaneousDynamicExpression=void 0;var r=i(42),o=i(3),s=n(i(1)),a=function(t){function e(e,i,n){var r;return(r=t.call(this,i,e,n.parentSourceMeasure)||this).mInstantaneousDynamicExpression=e,r.mMeasure=n,r}return _inheritsLoose(e,t),e.prototype.updateSkyBottomLine=function(){var t=this.parentStaffLine.SkyBottomLineCalculator,e=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginLeft,i=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginRight,n=0;switch(this.Placement){case o.PlacementEnum.Above:n=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginTop,t.updateSkyLineInRange(e,i,n);break;case o.PlacementEnum.Below:n=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginBottom,t.updateBottomLineInRange(e,i,n);break;default:s.default.error("Placement for GraphicalInstantaneousDynamicExpression is unknown")}},e}(r.AbstractGraphicalExpression);e.GraphicalInstantaneousDynamicExpression=a},function(t,e,i){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.ArpeggioType=e.Arpeggio=void 0,e.Arpeggio=function(){function t(t,e){void 0===e&&(e=n.ARPEGGIO_DIRECTIONLESS),this.parentVoiceEntry=t,this.type=e,this.notes=[]}return t.prototype.addNote=function(t){this.notes.push(t),t.Arpeggio=this},t}(),function(t){t[t.BRUSH_DOWN=1]="BRUSH_DOWN",t[t.BRUSH_UP=2]="BRUSH_UP",t[t.ROLL_DOWN=3]="ROLL_DOWN",t[t.ROLL_UP=4]="ROLL_UP",t[t.RASQUEDO_DOWN=5]="RASQUEDO_DOWN",t[t.RASQUEDO_UP=6]="RASQUEDO_UP",t[t.ARPEGGIO_DIRECTIONLESS=7]="ARPEGGIO_DIRECTIONLESS"}(n=e.ArpeggioType||(e.ArpeggioType={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.PartListEntry=void 0,e.PartListEntry=function(){function t(t){this.enrolledTimestamps=[],this.visible=!0,this.musicSheet=t}var e=t.prototype;return e.getFirstSourceMeasure=function(){return this.musicSheet.SourceMeasures[this.startIndex]},e.getLastSourceMeasure=function(){return this.musicSheet.SourceMeasures[this.endIndex]},_createClass2(t,[{key:"Visible",get:function(){return this.visible},set:function(t){this.visible=t}}]),t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var n=i(10),r=i(35),o=i(29),s=function(){function t(t){this.dictionary=new o.default(t)}return t.prototype.contains=function(t){return this.dictionary.containsKey(t)},t.prototype.add=function(t){return!this.contains(t)&&!n.isUndefined(t)&&(this.dictionary.setValue(t,t),!0)},t.prototype.intersection=function(t){var e=this;this.forEach((function(i){return t.contains(i)||e.remove(i),!0}))},t.prototype.union=function(t){var e=this;t.forEach((function(t){return e.add(t),!0}))},t.prototype.difference=function(t){var e=this;t.forEach((function(t){return e.remove(t),!0}))},t.prototype.isSubsetOf=function(t){if(this.size()>t.size())return!1;var e=!0;return this.forEach((function(i){return!!t.contains(i)||(e=!1,!1)})),e},t.prototype.remove=function(t){return!!this.contains(t)&&(this.dictionary.remove(t),!0)},t.prototype.forEach=function(t){this.dictionary.forEach((function(e,i){return t(i)}))},t.prototype.toArray=function(){return this.dictionary.values()},t.prototype.isEmpty=function(){return this.dictionary.isEmpty()},t.prototype.size=function(){return this.dictionary.size()},t.prototype.clear=function(){this.dictionary.clear()},t.prototype.toString=function(){return r.toString(this.toArray())},t}();e.default=s},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var n=i(10),r=i(84),o=function(){function t(t){this.root=null,this.compare=t||n.defaultCompare,this.nElements=0}return t.prototype.add=function(t){return!n.isUndefined(t)&&null!==this.insertNode(this.createNode(t))&&(this.nElements++,!0)},t.prototype.clear=function(){this.root=null,this.nElements=0},t.prototype.isEmpty=function(){return 0===this.nElements},t.prototype.size=function(){return this.nElements},t.prototype.contains=function(t){return!n.isUndefined(t)&&null!==this.searchNode(this.root,t)},t.prototype.search=function(t){var e=this.searchNode(this.root,t);if(null!==e)return e.element},t.prototype.remove=function(t){var e=this.searchNode(this.root,t);return null!==e&&(this.removeNode(e),this.nElements--,!0)},t.prototype.inorderTraversal=function(t){this.inorderTraversalAux(this.root,t,{stop:!1})},t.prototype.preorderTraversal=function(t){this.preorderTraversalAux(this.root,t,{stop:!1})},t.prototype.postorderTraversal=function(t){this.postorderTraversalAux(this.root,t,{stop:!1})},t.prototype.levelTraversal=function(t){this.levelTraversalAux(this.root,t)},t.prototype.minimum=function(){if(!this.isEmpty()&&null!==this.root)return this.minimumAux(this.root).element},t.prototype.maximum=function(){if(!this.isEmpty()&&null!==this.root)return this.maximumAux(this.root).element},t.prototype.forEach=function(t){this.inorderTraversal(t)},t.prototype.toArray=function(){var t=[];return this.inorderTraversal((function(e){return t.push(e),!0})),t},t.prototype.height=function(){return this.heightAux(this.root)},t.prototype.searchNode=function(t,e){for(var i=1;null!==t&&0!==i;)(i=this.compare(e,t.element))<0?t=t.leftCh:i>0&&(t=t.rightCh);return t},t.prototype.transplant=function(t,e){null===t.parent?this.root=e:t===t.parent.leftCh?t.parent.leftCh=e:t.parent.rightCh=e,null!==e&&(e.parent=t.parent)},t.prototype.removeNode=function(t){if(null===t.leftCh)this.transplant(t,t.rightCh);else if(null===t.rightCh)this.transplant(t,t.leftCh);else{var e=this.minimumAux(t.rightCh);e.parent!==t&&(this.transplant(e,e.rightCh),e.rightCh=t.rightCh,e.rightCh.parent=e),this.transplant(t,e),e.leftCh=t.leftCh,e.leftCh.parent=e}},t.prototype.inorderTraversalAux=function(t,e,i){null===t||i.stop||(this.inorderTraversalAux(t.leftCh,e,i),i.stop||(i.stop=!1===e(t.element),i.stop||this.inorderTraversalAux(t.rightCh,e,i)))},t.prototype.levelTraversalAux=function(t,e){var i=new r.default;for(null!==t&&i.enqueue(t),t=i.dequeue()||null;null!=t;){if(!1===e(t.element))return;null!==t.leftCh&&i.enqueue(t.leftCh),null!==t.rightCh&&i.enqueue(t.rightCh),t=i.dequeue()||null}},t.prototype.preorderTraversalAux=function(t,e,i){null===t||i.stop||(i.stop=!1===e(t.element),i.stop||(this.preorderTraversalAux(t.leftCh,e,i),i.stop||this.preorderTraversalAux(t.rightCh,e,i)))},t.prototype.postorderTraversalAux=function(t,e,i){null===t||i.stop||(this.postorderTraversalAux(t.leftCh,e,i),i.stop||(this.postorderTraversalAux(t.rightCh,e,i),i.stop||(i.stop=!1===e(t.element))))},t.prototype.minimumAux=function(t){for(;null!=t&&null!==t.leftCh;)t=t.leftCh;return t},t.prototype.maximumAux=function(t){for(;null!=t&&null!==t.rightCh;)t=t.rightCh;return t},t.prototype.heightAux=function(t){return null===t?-1:Math.max(this.heightAux(t.leftCh),this.heightAux(t.rightCh))+1},t.prototype.insertNode=function(t){for(var e=null,i=this.root;null!==i;){var n=this.compare(t.element,i.element);if(0===n)return null;n<0?(e=i,i=i.leftCh):(e=i,i=i.rightCh)}return t.parent=e,null===e?this.root=t:this.compare(t.element,e.element)<0?e.leftCh=t:e.rightCh=t,t},t.prototype.createNode=function(t){return{element:t,leftCh:null,rightCh:null,parent:null}},t}();e.default=o},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var n=i(53),r=function(){function t(){this.list=new n.default}return t.prototype.enqueue=function(t){return this.list.add(t)},t.prototype.add=function(t){return this.list.add(t)},t.prototype.dequeue=function(){if(0!==this.list.size()){var t=this.list.first();return this.list.removeElementAtIndex(0),t}},t.prototype.peek=function(){if(0!==this.list.size())return this.list.first()},t.prototype.size=function(){return this.list.size()},t.prototype.contains=function(t,e){return this.list.contains(t,e)},t.prototype.isEmpty=function(){return this.list.size()<=0},t.prototype.clear=function(){this.list.clear()},t.prototype.forEach=function(t){this.list.forEach(t)},t}();e.default=r},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var n=i(10),r=i(35),o=function(){function t(t){this.data=[],this.compare=t||n.defaultCompare}return t.prototype.leftChildIndex=function(t){return 2*t+1},t.prototype.rightChildIndex=function(t){return 2*t+2},t.prototype.parentIndex=function(t){return Math.floor((t-1)/2)},t.prototype.minIndex=function(t,e){return e>=this.data.length?t>=this.data.length?-1:t:this.compare(this.data[t],this.data[e])<=0?t:e},t.prototype.siftUp=function(t){for(var e=this.parentIndex(t);t>0&&this.compare(this.data[e],this.data[t])>0;)r.swap(this.data,e,t),t=e,e=this.parentIndex(t)},t.prototype.siftDown=function(t){for(var e=this.minIndex(this.leftChildIndex(t),this.rightChildIndex(t));e>=0&&this.compare(this.data[t],this.data[e])>0;)r.swap(this.data,e,t),t=e,e=this.minIndex(this.leftChildIndex(t),this.rightChildIndex(t))},t.prototype.peek=function(){return this.data.length>0?this.data[0]:void 0},t.prototype.add=function(t){return!n.isUndefined(t)&&(this.data.push(t),this.siftUp(this.data.length-1),!0)},t.prototype.removeRoot=function(){if(this.data.length>0){var t=this.data[0];return this.data[0]=this.data[this.data.length-1],this.data.splice(this.data.length-1,1),this.data.length>0&&this.siftDown(0),t}},t.prototype.contains=function(t){var e=n.compareToEquals(this.compare);return r.contains(this.data,t,e)},t.prototype.size=function(){return this.data.length},t.prototype.isEmpty=function(){return this.data.length<=0},t.prototype.clear=function(){this.data.length=0},t.prototype.forEach=function(t){r.forEach(this.data,t)},t}();e.default=o},function(t,e,i){var n,r=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var o=i(29),s=i(10),a=function(t){function e(e,i){var n=t.call(this,i)||this;return n.defaultFactoryFunction=e,n}return r(e,t),e.prototype.setDefault=function(e,i){var n=t.prototype.getValue.call(this,e);return s.isUndefined(n)?(this.setValue(e,i),i):n},e.prototype.getValue=function(t){return this.setDefault(t,this.defaultFactoryFunction())},e}(o.default);e.default=a},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Fonts=void 0,function(t){t[t.TimesNewRoman=0]="TimesNewRoman",t[t.Kokila=1]="Kokila"}(e.Fonts||(e.Fonts={}))},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalUnknownExpression=void 0;var r=i(42),o=i(3),s=n(i(1)),a=function(t){function e(e,i,n,r,s){var a;return(a=t.call(this,e,new o.AbstractExpression(n),r)||this).label=i,a.sourceMultiExpression=s,a}return _inheritsLoose(e,t),e.prototype.updateSkyBottomLine=function(){var t=this.parentStaffLine.SkyBottomLineCalculator,e=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft,i=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight;switch(this.Placement){case o.PlacementEnum.Above:var n=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;t.updateSkyLineInRange(e,i,n);break;case o.PlacementEnum.Below:var r=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;t.updateBottomLineInRange(e,i,r);break;default:s.default.error("Placement for GraphicalUnknownExpression is unknown")}},e}(r.AbstractGraphicalExpression);e.GraphicalUnknownExpression=a},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowMusicSheetCalculator=void 0;var r=i(17),o=i(90),s=i(128),a=i(63),u=n(i(8)),l=n(i(1)),c=i(16),h=i(129),f=i(130),d=i(97),p=i(93),m=i(9),v=i(131),b=i(57),g=i(37),y=i(25),S=i(100),_=i(39),x=i(13),E=i(102),w=function(e){function i(t){var i,n,s,l,c,h,f,d,p;return(i=e.call(this)||this).beamsNeedUpdate=!1,i.rules=t,r.MusicSheetCalculator.symbolFactory=new o.VexFlowGraphicalSymbolFactory,r.MusicSheetCalculator.TextMeasurer=new a.VexFlowTextMeasurer(i.rules),r.MusicSheetCalculator.stafflineNoteCalculator=new S.VexflowStafflineNoteCalculator(i.rules),"gonville"===(null===(n=i.rules.DefaultVexFlowNoteFont)||void 0===n?void 0:n.toLowerCase())?u.default.Flow.DEFAULT_FONT_STACK=[null===(s=u.default.Flow.Fonts)||void 0===s?void 0:s.Gonville,null===(l=u.default.Flow.Fonts)||void 0===l?void 0:l.Bravura,null===(c=u.default.Flow.Fonts)||void 0===c?void 0:c.Custom]:"petaluma"===(null===(h=i.rules.DefaultVexFlowNoteFont)||void 0===h?void 0:h.toLowerCase())&&(u.default.Flow.DEFAULT_FONT_STACK=[null===(f=u.default.Flow.Fonts)||void 0===f?void 0:f.Petaluma,null===(d=u.default.Flow.Fonts)||void 0===d?void 0:d.Gonville,null===(p=u.default.Flow.Fonts)||void 0===p?void 0:p.Bravura]),i}_inheritsLoose(i,e);var n=i.prototype;return n.clearRecreatedObjects=function(){var t;e.prototype.clearRecreatedObjects.call(this),r.MusicSheetCalculator.stafflineNoteCalculator=new S.VexflowStafflineNoteCalculator(this.rules);for(var i,n=_createForOfIteratorHelperLoose(this.graphicalMusicSheet.MeasureList);!(i=n()).done;)for(var o,s=_createForOfIteratorHelperLoose(i.value);!(o=s()).done;)null===(t=o.value)||void 0===t||t.clean()},n.formatMeasures=function(){for(var t,e=_createForOfIteratorHelperLoose(this.graphicalMusicSheet.MeasureList);!(t=e()).done;){var i=t.value;if(i&&i[0]){i[0].format();for(var n,r=_createForOfIteratorHelperLoose(i);!(n=r()).done;){for(var o,s=n.value,a=_createForOfIteratorHelperLoose(s.staffEntries);!(o=a()).done;)o.value.calculateXPosition();s.finalizeBeams()}}}this.beamsNeedUpdate=!1},n.calculateMeasureXLayout=function(t){for(var e,i=[],n=_createForOfIteratorHelperLoose(t);!(e=n()).done;){var o=e.value;o&&i.push(o)}if(0===i.length)return 0;t=i;for(var s,a=[],h=new u.default.Flow.Formatter({softmaxFactor:this.rules.SoftmaxFactorVexFlow}),f=t[0].staffEntries.length,d=1,p=_createForOfIteratorHelperLoose(t);!(s=p()).done;){var m=s.value;if(m){for(var v,b=0,g=_createForOfIteratorHelperLoose(m.staffEntries);!(v=g()).done;)b+=v.value.setMaxAccidentals();m.parentSourceMeasure.ImplicitMeasure&&(f=Math.max(m.staffEntries.length,f),d=Math.max(m.staffEntries.length+b,d));var S=m.vfVoices,_=[];for(var x in S)S.hasOwnProperty(x)&&(_.push(S[x]),a.push(S[x]));0!==_.length?h.joinVoices(_):l.default.debug("Found a measure with no voices. Continuing anyway.",S)}}var E=12,w=t[0].parentSourceMeasure;if(a.length>0){var T=.3;E=h.preCalculateMinTotalWidth(a)/c.unitInPixels*this.rules.VoiceSpacingMultiplierVexflow+this.rules.VoiceSpacingAddendVexflow+f*T,(null==w?void 0:w.ImplicitMeasure)&&(E=w.Duration.RealValue/w.ActiveTimeSignature.RealValue*E,f>1&&(E+=d*T*1.5),E*=this.rules.PickupMeasureWidthMultiplier),r.MusicSheetCalculator.setMeasuresMinStaffEntriesWidth(t,E);for(var M,P=function(t,e){h.formatToStave(a,e.getVFStave())},L=function(t,e){h.formatToStave(a,e.getVFStave(),{align_rests:!0,context:void 0})},I=_createForOfIteratorHelperLoose(t);!(M=I()).done;){var A=M.value;if(this.rules.AlignRests===y.AlignRestOption.Never)A.formatVoices=P;else if(this.rules.AlignRests===y.AlignRestOption.Always)A.formatVoices=L;else if(this.rules.AlignRests===y.AlignRestOption.Auto){for(var C,R=!1,N=_createForOfIteratorHelperLoose(A.staffEntries);!(C=N()).done;){for(var k,F=0,O=0,B=_createForOfIteratorHelperLoose(C.value.graphicalVoiceEntries);!(k=B()).done;){var D=k.value;if(D.parentVoiceEntry.IsGrace||D&&D.notes&&D.notes[0]&&D.notes[0].sourceNote&&D.notes[0].sourceNote.PrintObject&&F++,D&&D.notes&&D.notes[0]&&D.notes[0].sourceNote&&D.notes[0].sourceNote.isRest()&&D.notes[0].sourceNote.PrintObject&&O++,F>1&&O>=1){R=!0;break}}if(R)break}A.formatVoices=R?L:P}if(A===t[0]){var V=A;V.formatVoices(E*c.unitInPixels,V)}}}for(var G,W=_createForOfIteratorHelperLoose(t);!(G=W()).done;){var H=G.value;if(H)for(var U,z=_createForOfIteratorHelperLoose(H.staffEntries);!(U=z()).done;)U.value.calculateXPosition()}return E},n.calculateElongationFactor=function(t,e,i,n,r,o,s,a){for(var u,l=r,c=0,f=_createForOfIteratorHelperLoose(t);!(u=f()).done;){var d=u.value,p=d.GraphicalLabel.Label.textAlignment,v=s,b=a;if(d instanceof h.GraphicalLyricEntry&&d.ParentLyricWord){d.LyricsEntry.SyllableIndex>0&&(v=this.rules.BetweenSyllableMinimumDistance,m.TextAlignment.IsCenterAligned(p)&&(v+=1));var g=d.ParentLyricWord.GetLyricWord.Syllables;g.length>1&&d.LyricsEntry.SyllableIndex4&&(I*=1.1)):i[c]&&(I=x/E),P=Math.max(L,I),l=Math.max(l,P);var A=Math.max(x-E||0,0);i[c]&&(A+=i[c].cumulativeOverlap),i[c]={cumulativeOverlap:A,extend:d instanceof h.GraphicalLyricEntry&&d.LyricsEntry.extend,labelWidth:S,measureNumber:o,sourceNoteDuration:d instanceof h.GraphicalLyricEntry&&d.LyricsEntry&&d.LyricsEntry.Parent.Notes[0].Length,text:d instanceof h.GraphicalLyricEntry?d.LyricsEntry.Text:d.GraphicalLabel.Label.text,xPosition:_},c++}return l},n.calculateElongationFactorFromStaffEntries=function(t,e,i,n){for(var r,o=i,s={},a={},u=_createForOfIteratorHelperLoose(t);!(r=u()).done;){var l=r.value;l.LyricsEntries.length>0&&(o=this.calculateElongationFactor(l.LyricsEntries,l,s,e,o,n,this.rules.HorizontalBetweenLyricsDistance,this.rules.LyricOverlapAllowedIntoNextMeasure)),l.graphicalChordContainers.length>0&&(o=this.calculateElongationFactor(l.graphicalChordContainers,l,a,e,o,n,this.rules.ChordSymbolXSpacing,this.rules.ChordOverlapAllowedIntoNextMeasure))}return o},n.calculateMeasureWidthFromStaffEntries=function(t,e){for(var i,n=1,r=_createForOfIteratorHelperLoose(t);!(i=r()).done;){var o=i.value;o&&0!==o.staffEntries.length&&(n=this.calculateElongationFactorFromStaffEntries(o.staffEntries,e,n,o.MeasureNumber))}return e*(n=Math.min(n,this.rules.MaximumLyricsElongationFactor))},n.createGraphicalTie=function(t,e,i,n,r){return new s.GraphicalTie(t,n,r)},n.updateStaffLineBorders=function(t){t.SkyBottomLineCalculator.updateStaffLineBorders()},n.graphicalMeasureCreatedCalculations=function(t){t.rules=this.rules,t.graphicalMeasureCreatedCalculations()},n.layoutVoiceEntry=function(t,e,i,n){for(var o=0;o=2&&(o=n.vfnote[0],s=n.vfnote[1]);var a=void 0,l=0;if(r&&r.vfnote&&r.vfnote.length>=2&&(a=r.vfnote[0],l=r.vfnote[1]),e){if(o){var c=new u.default.Flow.StaveTie({first_indices:[s],first_note:o});n.parentVoiceEntry.parentStaffEntry.parentMeasure.vfTies.push(c)}if(a){var h=new u.default.Flow.StaveTie({last_indices:[l],last_note:a});r.parentVoiceEntry.parentStaffEntry.parentMeasure.vfTies.push(h)}}else if(o||a){var f;if(i)if("S"===t.Tie.Type){var d=t.StartNote.sourceNote,p=t.EndNote.sourceNote,m=1;d.FretNumber>p.FretNumber&&(m=-1),f=new u.default.Flow.TabSlide({first_indices:[s],first_note:o,last_indices:[l],last_note:a},m)}else f=new u.default.Flow.TabTie({first_indices:[s],first_note:o,last_indices:[l],last_note:a},t.Tie.Type);else f=new u.default.Flow.StaveTie({first_indices:[s],first_note:o,last_indices:[l],last_note:a});r.parentVoiceEntry.parentStaffEntry.parentMeasure.vfTies.push(f)}},n.calculateDynamicExpressionsForMultiExpression=function(t,e,i){if(!(ethis.rules.MaxMeasureToDrawIndex)){var n=t.AbsoluteTimestamp,r=this.graphicalMusicSheet.MeasureList[e],o=r[i].ParentStaffLine,s=r[i],a=this.getRelativePositionInStaffLineFromTimestamp(n,i,o,null==o?void 0:o.isPartOfMultiStaffInstrument()),u=a;if(a.x<=0&&(u.x=s.beginInstructionsWidth+this.rules.RhythmRightMargin),t.InstantaneousDynamic){var c=new p.VexFlowInstantaneousDynamicExpression(t.InstantaneousDynamic,o,s);this.calculateGraphicalInstantaneousDynamicExpression(c,u)}if(t.StartingContinuousDynamic){var h=t.StartingContinuousDynamic,f=new b.VexFlowContinuousDynamicExpression(t.StartingContinuousDynamic,o,s.parentSourceMeasure);if(f.StartMeasure=s,!f.IsVerbal&&h.EndMultiExpression)try{this.calculateGraphicalContinuousDynamic(f,u)}catch(t){}else f.IsVerbal?this.calculateGraphicalVerbalContinuousDynamic(f,u):l.default.warn("This continuous dynamic is not covered")}}},n.createMetronomeMark=function(t){var e,i=Math.max(t.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber-1,0),n=Math.max(t.StaffNumber-1,0),r=0===i&&0===n,o=this.graphicalMusicSheet.MeasureList[i][n].getVFStave(),s="q";if(t.beatUnit){var a=_.NoteTypeHandler.getNoteDurationFromType(t.beatUnit);s=x.VexFlowConverter.duration(a,!1)}for(var u,l=this.rules.MetronomeMarkYShift,h=!1,f=_createForOfIteratorHelperLoose(t.parentMeasure.TempoExpressions);!(u=f()).done;){var d=u.value,p=(null===(e=d.InstantaneousTempo)||void 0===e?void 0:e.Enum)===g.TempoEnum.metronomeMark;if(d.getPlacementOfFirstEntry()===E.PlacementEnum.Above&&!p){h=!0;break}}h&&(l-=1.4);var m=this.graphicalMusicSheet.MeasureList[0][0].ParentStaffLine.SkyLine;o.setTempo({bpm:t.TempoInBpm,dots:t.dotted,duration:s},l*c.unitInPixels);var v=r?this.rules.MetronomeMarkXShift*c.unitInPixels:0;o.getModifiers()[o.getModifiers().length-1].setShiftX(v),m[0]=Math.min(m[0],-4.5+l)},n.calculateRehearsalMark=function(t){var e=t.rehearsalExpression;if(e){var i=Math.max(t.MeasureNumber-1,0),n=this.graphicalMusicSheet.MeasureList[i][0].getVFStave(),r=-this.rules.RehearsalMarkYOffsetDefault-this.rules.RehearsalMarkYOffset,o=this.rules.RehearsalMarkXOffsetDefault+this.rules.RehearsalMarkXOffset;t.IsSystemStartMeasure&&(o+=this.rules.RehearsalMarkXOffsetSystemStartMeasure);var s=this.rules.RehearsalMarkFontSize;n.setSection(e.label,r,o,s)}},n.calculateSingleOctaveShift=function(t,e,i,n){var r,o=e.OctaveShiftStart,s=o.ParentStartMultiExpression.Timestamp,a=null===(r=o.ParentEndMultiExpression)||void 0===r?void 0:r.Timestamp,u=this.rules.MinMeasureToDrawIndex,c=this.rules.MaxMeasureToDrawIndex,h=this.graphicalMusicSheet.MeasureList[i][n].ParentStaffLine;h||(h=this.graphicalMusicSheet.MeasureList[u][n].ParentStaffLine);var f=void 0;(f=o.ParentEndMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentEndMultiExpression.SourceMeasureParent,n):this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(n,!0)).MeasureNumber>c+1&&(f=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(n,!0));var p=void 0;if((p=o.ParentEndMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentStartMultiExpression.SourceMeasureParent,n):this.graphicalMusicSheet.MeasureList[u][n]).MeasureNumberc+1||f.MeasureNumberc+1)){var m=f.ParentStaffLine;if(m||(m=h),f&&h&&m){var v=new d.VexFlowOctaveShift(o,h.PositionAndShape);if(!v.startNote){for(var b,g,y=_createForOfIteratorHelperLoose(p.staffEntries);!(g=y()).done;){var S=g.value;if(S){b=S;break}}if(!b)return;if(v.setStartNote(b),!v.startNote)return}if(!v.endNote){for(var _,x=f.staffEntries.length-1;x>=0;x++)if(f.staffEntries[x]){_=f.staffEntries[x];break}if(v.setEndNote(_),!v.endNote)return}var E=p.findGraphicalStaffEntryFromTimestamp(s);E||(E=p.staffEntries[0]);var w=f.findGraphicalStaffEntryFromTimestamp(a);if(w||(w=f.staffEntries[f.staffEntries.length-1]),v.setStartNote(E),m!==h){v.endsOnDifferentStaffLine=!0;var T=h.Measures[h.Measures.length-1];void 0===T&&(T=f);var M=T.staffEntries[T.staffEntries.length-1];v.setEndNote(M);var P=m.ParentMusicSystem.Id-h.ParentMusicSystem.Id;if(P>0)for(var L=h.ParentMusicSystem.Id;Ln.graphicalLyricWords.length-1){var u=new f.GraphicalLyricWord(r.Word);o.ParentLyricWord=u,u.GraphicalLyricsEntries[s]=o,n.graphicalLyricWords.push(u)}else{var l=n.graphicalLyricWords[a];o.ParentLyricWord=l,l.GraphicalLyricsEntries[s]=o,l.isFilled()&&(i.splice(a,1),n.graphicalLyricWords.splice(n.graphicalLyricWords.indexOf(l),1))}}}))},n.handleVoiceEntryOrnaments=function(t,e,i){},n.handleVoiceEntryArticulations=function(t,e,i){},n.handleVoiceEntryTechnicalInstructions=function(t,e,i){},n.handleTuplet=function(t,e,i){t.parentVoiceEntry.parentStaffEntry.parentMeasure.handleTuplet(t,e)},n.findIndexGraphicalSlurFromSlur=function(t,e){for(var i=0;i=0){var L=u[P];-1===L.staffEntries.indexOf(g)&&L.staffEntries.push(g),u.splice(P,1)}}}}for(var I,A=_createForOfIteratorHelperLoose(u);!(I=A()).done;){var C=I.value;-1===C.staffEntries.indexOf(g)&&C.staffEntries.push(g)}}}for(var R,N=_createForOfIteratorHelperLoose(this.musicSystems);!(R=N()).done;)for(var k,F=_createForOfIteratorHelperLoose(R.value.StaffLines);!(k=F()).done;)for(var O,B=_createForOfIteratorHelperLoose(k.value.GraphicalSlurs.sort(v.GraphicalSlur.Compare));!(O=B()).done;){var D=O.value;D.slur.isCrossed()||D.calculateCurve(this.rules)}},i}(r.MusicSheetCalculator);e.VexFlowMusicSheetCalculator=w},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowGraphicalSymbolFactory=void 0;var r=n(i(8)),o=i(91),s=i(44),a=i(98),u=i(30),l=i(60),c=i(127),h=i(62),f=i(13),d=i(101),p=i(99),m=i(96);e.VexFlowGraphicalSymbolFactory=function(){function t(){}var e=t.prototype;return e.createMusicSystem=function(t,e){return new o.VexFlowMusicSystem(t,e)},e.createStaffLine=function(t,e){return new p.VexFlowStaffLine(t,e)},e.createGraphicalMeasure=function(t,e,i){return void 0===i&&(i=!1),new s.VexFlowMeasure(e,t,void 0)},e.createMultiRestMeasure=function(t,e,i){return new m.VexFlowMultiRestMeasure(e,t,i)},e.createTabStaffMeasure=function(t,e){return new d.VexFlowTabMeasure(e,t)},e.createExtraGraphicalMeasure=function(t){return new s.VexFlowMeasure(t.ParentStaff,void 0,t)},e.createStaffEntry=function(t,e){return new a.VexFlowStaffEntry(e,t,void 0)},e.createVoiceEntry=function(t,e){return new h.VexFlowVoiceEntry(t,e)},e.createNote=function(t,e,i,n,r,o){return void 0===n&&(n=u.OctaveEnum.NONE),new l.VexFlowGraphicalNote(t,e,i,n,r,o)},e.createGraceNote=function(t,e,i,n,r){return void 0===r&&(r=u.OctaveEnum.NONE),new l.VexFlowGraphicalNote(t,e,i,r,n)},e.addGraphicalAccidental=function(t,e){t.setAccidental(e)},e.addFermataAtTiedEndNote=function(t,e){},e.createInStaffClef=function(t,e){var i=t,n=f.VexFlowConverter.Clef(e,"small");i.vfClefBefore=new r.default.Flow.ClefNote(n.type,n.size,n.annotation)},e.createChordSymbols=function(t,e,i,n){for(var r,o=e.parentMeasure.parentSourceMeasure.Rules,s=0,a=o.ChordSymbolXSpacing,u=_createForOfIteratorHelperLoose(t.ChordContainers);!(r=u()).done;){var l=r.value,h=new c.GraphicalChordSymbolContainer(l,e.PositionAndShape,o.ChordSymbolTextHeight,i,n,e.parentMeasure.parentSourceMeasure.Rules),f=h.GraphicalLabel;f.PositionAndShape.RelativePosition.y-=o.ChordSymbolYOffset,f.PositionAndShape.RelativePosition.x+=s,f.setLabelPositionAndShapeBorders(),h.PositionAndShape.calculateBoundingBox(),e.graphicalChordContainers.push(h),s+=f.PositionAndShape.Size.width+a}},e.createGraphicalTechnicalInstruction=function(t,e){},t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowMusicSystem=void 0;var n=i(117),r=i(75),o=i(13),s=i(61),a=i(95),u=function(t){function e(e,i){var n;return(n=t.call(this,e)||this).rules=i,n}_inheritsLoose(e,t);var i=e.prototype;return i.calculateBorders=function(t){if(0!==this.staffLines.length){var e=this.calcBracketsWidth();this.boundingBox.BorderLeft=-e,this.boundingBox.BorderMarginLeft=-e,this.boundingBox.XBordersHaveBeenSet=!0;var i=this.staffLines[0].SkyBottomLineCalculator.getSkyLineMin();this.boundingBox.BorderTop=i,this.boundingBox.BorderMarginTop=i;var n=this.staffLines[this.staffLines.length-1],r=n.SkyBottomLineCalculator.getBottomLineMax()+n.PositionAndShape.RelativePosition.y;this.boundingBox.BorderBottom=r,this.boundingBox.BorderMarginBottom=r,this.boundingBox.XBordersHaveBeenSet=!0,this.boundingBox.YBordersHaveBeenSet=!0}},i.createSystemLine=function(t,e,i,n,s,a,u){var l=a,c=!1;return u&&(c=!0,u.lineTo(a,o.VexFlowConverter.line(i,n)),u.addMeasureLine(i,n)),l&&l.addMeasureLine(i,n,c),new r.SystemLine(i,n,this,a,u)},i.createInstrumentBracket=function(t,e){var i=t,n=e,r=new a.VexFlowInstrumentBrace(i,n);this.InstrumentBrackets.push(r)},i.createGroupBracket=function(t,e,i){var n=t,r=e;if(0===i){var o=new s.VexFlowInstrumentBracket(n,r,i);this.GroupBrackets.push(o)}else{var u=new a.VexFlowInstrumentBrace(n,r,i);this.GroupBrackets.push(u)}},e}(n.MusicSystem);e.VexFlowMusicSystem=u},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.SvgVexFlowBackend=void 0;var r=n(i(8)),o=i(59),s=i(13),a=i(21),u=i(25),l=n(i(1)),c=function(t){function e(e){var i;return(i=t.call(this)||this).rules=e,i}_inheritsLoose(e,t);var i=e.prototype;return i.getVexflowBackendType=function(){return r.default.Flow.Renderer.Backends.SVG},i.getOSMDBackendType=function(){return u.BackendType.SVG},i.getCanvasSize=function(){var t;return null===(t=document.getElementById("osmdCanvasPage"+this.graphicalMusicPage.PageNumber))||void 0===t?void 0:t.offsetHeight},i.initialize=function(t,e){this.zoom=e,this.canvas=document.createElement("div"),this.canvas.id="osmdCanvasPage"+this.graphicalMusicPage.PageNumber,this.inner=this.canvas,this.inner.style.position="relative",this.canvas.style.zIndex="0",t.appendChild(this.inner),this.renderer=new r.default.Flow.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext(),this.ctx.svg.id="osmdSvgPage"+this.graphicalMusicPage.PageNumber},i.getContext=function(){return this.ctx},i.getSvgElement=function(){return this.ctx.svg},i.removeNode=function(t){var e,i=null===(e=this.ctx)||void 0===e?void 0:e.svg;if(!i)return!1;try{i.removeChild(t)}catch(t){return l.default.error(t),!1}return!0},i.clear=function(){if(this.ctx){for(var t=this.ctx.svg;t.lastChild;)t.removeChild(t.lastChild);this.rules.PageBackgroundColor&&(this.ctx.save(),this.ctx.setFillStyle(this.rules.PageBackgroundColor),this.ctx.setStrokeStyle("#12345600"),this.ctx.fillRect(0,0,this.canvas.offsetWidth/this.zoom,this.canvas.offsetHeight/this.zoom),this.ctx.restore())}},i.scale=function(t){this.ctx.scale(t,t)},i.translate=function(t,e){},i.renderText=function(t,e,i,n,r,o,u,l){this.ctx.save();var c=this.ctx.openGroup();u&&(this.ctx.attributes.fill=u,this.ctx.attributes.stroke=u);var h=l;l&&"default"!==l||(h=this.rules.DefaultFontFamily),this.ctx.setFont(h,t,s.VexFlowConverter.fontStyle(e)),this.ctx.attributes["font-size"]=t+"px",this.ctx.state["font-size"]=t+"px";var f="normal",d="normal";switch(e){case a.FontStyles.Bold:f="bold";break;case a.FontStyles.Italic:d="italic";break;case a.FontStyles.BoldItalic:f="bold",d="italic";break;default:f="normal"}return this.ctx.attributes["font-weight"]=f,this.ctx.state["font-weight"]=f,this.ctx.attributes["font-style"]=d,this.ctx.state["font-style"]=d,this.ctx.fillText(n,o.x,o.y+r),this.ctx.closeGroup(),this.ctx.restore(),c},i.renderRectangle=function(t,e,i,n){void 0===n&&(n=1),this.ctx.save();var r=this.ctx.openGroup();return this.ctx.attributes.fill=i||s.VexFlowConverter.style(e),this.ctx.attributes["fill-opacity"]=n,this.ctx.fillRect(t.x,t.y,t.width,t.height),this.ctx.restore(),this.ctx.attributes["fill-opacity"]=1,this.ctx.closeGroup(),r},i.renderLine=function(t,e,i,n){void 0===i&&(i="#FF0000FF"),void 0===n&&(n=2),this.ctx.save();var r=this.ctx.openGroup();return this.ctx.beginPath(),this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(e.x,e.y),this.ctx.attributes.stroke=i,this.ctx.lineWidth=n,this.ctx.stroke(),this.ctx.closeGroup(),this.ctx.restore(),r},i.renderCurve=function(t){this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y),this.ctx.lineTo(t[7].x,t[7].y),this.ctx.bezierCurveTo(t[6].x,t[6].y,t[5].x,t[5].y,t[4].x,t[4].y),this.ctx.lineTo(t[0].x,t[0].y),this.ctx.closePath(),this.ctx.fill()},i.export=function(){var t=this.ctx.svg.cloneNode(!0),e=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),i=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",e);i.replaceChild(t,i.documentElement);var n=(new XMLSerializer).serializeToString(i),r=document.createElement("a");r.href="data:image/svg+xml; charset=utf8, "+encodeURIComponent(n.replace(/>\n\r<")),r.download="opensheetmusicdisplay_download.svg",r.innerHTML=window.location.href+"/download",document.body.appendChild(r)},e}(o.VexFlowBackend);e.SvgVexFlowBackend=c},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowInstantaneousDynamicExpression=void 0;var n=i(79),r=i(38),o=i(24),s=i(12),a=i(9),u=i(21),l=function(t){function e(e,i,n){var r;r=t.call(this,e,i,n)||this;var l=new s.Label(r.Expression);return r.label=new o.GraphicalLabel(l,r.rules.ContinuousDynamicTextHeight,a.TextAlignmentEnum.CenterCenter,r.rules,r.PositionAndShape),r.label.Label.fontStyle=u.FontStyles.BoldItalic,r.label.setLabelPositionAndShapeBorders(),r.PositionAndShape.calculateBoundingBox(),r}return _inheritsLoose(e,t),_createClass2(e,[{key:"InstantaneousDynamic",get:function(){return this.mInstantaneousDynamicExpression}},{key:"Expression",get:function(){return r.DynamicEnum[this.mInstantaneousDynamicExpression.DynEnum]}}]),e}(n.GraphicalInstantaneousDynamicExpression);e.VexFlowInstantaneousDynamicExpression=l},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.DynamicExpressionSymbolEnum=void 0,function(t){t[t.p=0]="p",t[t.f=1]="f",t[t.s=2]="s",t[t.z=3]="z",t[t.m=4]="m",t[t.r=5]="r"}(e.DynamicExpressionSymbolEnum||(e.DynamicExpressionSymbolEnum={}))},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowInstrumentBrace=void 0;var r=n(i(8)),o=function(t){function e(e,i,n){var o;return void 0===n&&(n=0),(o=t.call(this,e,i,n)||this).vexflowConnector.setType(r.default.Flow.StaveConnector.type.BRACE),o}return _inheritsLoose(e,t),e}(i(61).VexFlowInstrumentBracket);e.VexFlowInstrumentBrace=o},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowMultiRestMeasure=void 0;var r=n(i(8)),o=function(t){function e(e,i,n){var o;return(o=t.call(this,e,i,n)||this).minimumStaffEntriesWidth=-1,n?o.rules=n.ParentMusicSystem.rules:i&&(o.rules=i.Rules),o.resetLayout(),o.multiRestElement=new r.default.Flow.MultiMeasureRest(i.multipleRestMeasures,{}),o}_inheritsLoose(e,t);var i=e.prototype;return i.draw=function(t){this.stave.setContext(t).draw(),this.multiRestElement.setStave(this.stave),this.multiRestElement.setContext(t),this.multiRestElement.draw();for(var e,i=_createForOfIteratorHelperLoose(this.connectors);!(e=i()).done;)e.value.setContext(t).draw()},i.format=function(){},i.getVoicesWithinMeasure=function(){return[]},i.getGraphicalVoiceEntriesPerVoice=function(t){return[]},i.getRestFilledVexFlowStaveNotesPerVoice=function(t){return[]},i.handleBeam=function(t,e){},i.handleTuplet=function(t,e){},i.finalizeBeams=function(){},i.finalizeTuplets=function(){},i.layoutStaffEntry=function(t){},i.graphicalMeasureCreatedCalculations=function(){},i.createArticulations=function(){},i.createOrnaments=function(){},i.createFingerings=function(t){},i.getVFStave=function(){return this.stave},e}(i(44).VexFlowMeasure);e.VexFlowMultiRestMeasure=o},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowOctaveShift=void 0;var r=n(i(8)),o=i(123),s=i(30),a=n(i(1)),u=function(t){function e(e,i){var n;switch(n=t.call(this,e,i)||this,e.Type){case s.OctaveEnum.VA8:n.position=r.default.Flow.TextBracket.Positions.TOP,n.supscript="va",n.text="8";break;case s.OctaveEnum.MA15:n.position=r.default.Flow.TextBracket.Positions.TOP,n.supscript="ma",n.text="15";break;case s.OctaveEnum.VB8:n.position=r.default.Flow.TextBracket.Positions.BOTTOM,n.supscript="vb",n.text="8";break;case s.OctaveEnum.MB15:n.position=r.default.Flow.TextBracket.Positions.BOTTOM,n.supscript="mb",n.text="15";break;default:a.default.error("Unknown or NONE octaveshift. This should not be called!")}return n}_inheritsLoose(e,t);var i=e.prototype;return i.setStartNote=function(t){for(var e,i=_createForOfIteratorHelperLoose(t.graphicalVoiceEntries);!(e=i()).done;){var n=e.value;if(null==n?void 0:n.vfStaveNote)return this.startNote=n.vfStaveNote,!0}return!1},i.setEndNote=function(t){for(var e,i=_createForOfIteratorHelperLoose(t.graphicalVoiceEntries);!(e=i()).done;){var n=e.value;if(null==n?void 0:n.vfStaveNote)return this.endNote=n.vfStaveNote,!0}return!1},i.getTextBracket=function(){return new r.default.Flow.TextBracket({position:this.position,start:this.startNote,stop:this.endNote,superscript:this.supscript,text:this.text})},e}(o.GraphicalOctaveShift);e.VexFlowOctaveShift=u},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowStaffEntry=void 0;var n=i(124),r=i(16),o=i(2),s=function(t){function e(e,i,n){return t.call(this,e,i,n)||this}_inheritsLoose(e,t);var i=e.prototype;return i.calculateXPosition=function(){for(var t,e=this.parentMeasure.getVFStave(),i=0,n=_createForOfIteratorHelperLoose(this.graphicalVoiceEntries);!(t=n()).done;){var o=t.value;if(o.vfStaveNote){if(o.vfStaveNote.setStave(e),!o.vfStaveNote.preFormatted)continue;o.applyBordersFromVexflow(),this.parentMeasure.ParentStaff.isTab?this.PositionAndShape.RelativePosition.x=(o.vfStaveNote.getAbsoluteX()+o.vfStaveNote.glyph.getWidth())/r.unitInPixels:this.PositionAndShape.RelativePosition.x=o.vfStaveNote.getBoundingBox().getX()/r.unitInPixels;var s=o.notes[0].sourceNote;s.isRest()&&s.Length.RealValue===this.parentMeasure.parentSourceMeasure.ActiveTimeSignature.RealValue&&(this.PositionAndShape.RelativePosition.x+=this.parentMeasure.parentSourceMeasure.Rules.WholeRestXShiftVexflow-.1,o.PositionAndShape.BorderLeft=-.7,o.PositionAndShape.BorderRight=.7),o.PositionAndShape.BorderLeft=0;s--){if(Math.abs(t[n]-t[s])<=e&&r===i[s]){r++,o=!0;break}o=!1}i.push(r)}return i},e}(n.GraphicalStaffEntry);e.VexFlowStaffEntry=s},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowStaffLine=void 0;var n=i(125),r=i(78),o=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).slursInVFStaffLine=[],n.alignmentManager=new r.AlignmentManager(_assertThisInitialized2(n)),n}return _inheritsLoose(e,t),e.prototype.addVFSlurToVFStaffline=function(t){this.slursInVFStaffLine.push(t)},_createClass2(e,[{key:"SlursInVFStaffLine",get:function(){return this.slursInVFStaffLine}},{key:"AlignmentManager",get:function(){return this.alignmentManager}}]),e}(n.StaffLine);e.VexFlowStaffLine=o},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexflowStafflineNoteCalculator=void 0;var n=i(2),r=i(60),o=i(15),s=i(7),a=i(14),u=function(){function t(t){this.staffPitchListMapping=new o.Dictionary,this.baseLineNote=n.NoteEnum.B,this.baseLineOctave=1,this.rules=t}var e=t.prototype;return e.trackNote=function(e){if(e instanceof r.VexFlowGraphicalNote&&e.Clef().ClefType===s.ClefEnum.percussion&&!e.sourceNote.isRest()&&0!==this.rules.PercussionOneLineCutoff&&-1!==this.rules.PercussionForceVoicesOneLineCutoff){var i=e.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet,n=void 0;this.staffPitchListMapping.containsKey(i)||this.staffPitchListMapping.setValue(i,new Array),n=this.staffPitchListMapping.getValue(i);var o=e.sourceNote.Pitch;t.findOrInsert(n,o)}},t.PitchIndexOf=function(t,e,i){if(void 0===i&&(i=0),i>t.length-1)return-1;for(var n=i;nthis.rules.PercussionOneLineCutoff&&!u)return e;var l=e,c=e.sourceNote.Pitch,h=this.baseLineNote,f=this.baseLineOctave;if(this.rules.PercussionOneLineUseXMLDisplayStep&&void 0!==e.sourceNote.displayStepUnpitched&&s&&(h=e.sourceNote.displayStepUnpitched,f=e.sourceNote.displayOctaveUnpitched+this.rules.PercussionOneLineXMLDisplayStepOctaveOffset),o.length<=this.rules.PercussionForceVoicesOneLineCutoff)l.setAccidental(new n.Pitch(h,f,c.Accidental));else{var d=t.PitchIndexOf(o,c);if(d>-1){var p=Math.ceil(o.length/2);if(!this.rules.PercussionOneLineUseXMLDisplayStep)if(d>=p)switch(f=2,(d-p)%5){case 1:h=n.NoteEnum.E;break;case 2:h=n.NoteEnum.G;break;case 3:h=n.NoteEnum.B;break;case 4:h=n.NoteEnum.D,f=3;break;default:h=n.NoteEnum.C}else switch(d%5){case 1:h=n.NoteEnum.F;break;case 2:h=n.NoteEnum.D;break;case 3:h=n.NoteEnum.B,f=0;break;case 4:h=n.NoteEnum.G,f=0;break;default:h=n.NoteEnum.A}var m=new n.Pitch(h,f,c.Accidental);l.setAccidental(m);var v=l.parentVoiceEntry.parentVoiceEntry;!this.rules.SetWantedStemDirectionByXml&&v.Notes.length<2&&(m.Octave>this.baseLineOctave||m.FundamentalNote===this.baseLineNote&&m.Octave===this.baseLineOctave?l.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=a.StemDirectionType.Up:l.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=a.StemDirectionType.Down)}}return l},e.getStafflineUniquePositionCount=function(t){return this.staffPitchListMapping.containsKey(t)?this.staffPitchListMapping.getValue(t).length:0},t}();e.VexflowStafflineNoteCalculator=u},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowTabMeasure=void 0;var r=n(i(8)),o=i(44),s=i(13),a=n(i(1)),u=function(t){function e(e,i,n){var r;return(r=t.call(this,e,i,n)||this).isTabMeasure=!0,r}_inheritsLoose(e,t);var i=e.prototype;return i.resetLayout=function(){this.stave=new r.default.Flow.TabStave(0,0,0,{space_above_staff_ln:0,space_below_staff_ln:0}),this.updateInstructionWidth()},i.graphicalMeasureCreatedCalculations=function(){for(var t=0,e=this.staffEntries.length;t1){var v=s.VexFlowConverter.StrokeTypeFromArpeggioType(m.type),b=new r.default.Flow.Stroke(v,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&p.vfStaveNote.addStroke(0,b)}else a.default.debug("[OSMD] arpeggio in measure "+this.MeasureNumber+" could not be drawn.\n voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.")}this.vfVoices[c.VoiceId].addTickable(p.vfStaveNote)}else this.vfVoices[c.VoiceId].addTickable(p.vfStaveNote)}}}}},e}(o.VexFlowMeasure);e.VexFlowTabMeasure=u},function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),r=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||e.hasOwnProperty(i)||n(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(i(3),e),r(i(55),e),r(i(94),e),r(i(38),e),r(i(37),e),r(i(64),e),r(i(103),e),r(i(104),e),r(i(105),e),r(i(65),e)},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.MultiExpressionEntry=e.MultiExpression=void 0;var n=i(0),r=i(38),o=i(32),s=i(64),a=i(65),u=i(3),l=i(21);e.MultiExpression=function(){function t(t,e){this.unknownList=[],this.moodList=[],this.expressions=[],this.sourceMeasure=t,this.timestamp=e}var e=t.prototype;return e.getPlacementOfFirstEntry=function(){var t=u.PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].expression instanceof r.InstantaneousDynamicExpression||this.expressions[0].expression instanceof o.ContinuousDynamicExpression||this.expressions[0].expression instanceof s.MoodExpression||this.expressions[0].expression instanceof a.UnknownExpression)&&(t=this.expressions[0].expression.Placement),t},e.getFontstyleOfFirstEntry=function(){var t,e=l.FontStyles.Regular;return this.expressions.length>0&&(this.expressions[0].expression instanceof o.ContinuousDynamicExpression||this.expressions[0].expression instanceof s.MoodExpression?e=l.FontStyles.Italic:this.expressions[0].expression instanceof a.UnknownExpression&&(e=null!==(t=this.expressions[0].expression.fontStyle)&&void 0!==t?t:l.FontStyles.Regular)),e},e.addExpression=function(t,e){t instanceof r.InstantaneousDynamicExpression?(this.instantaneousDynamic&&this.removeExpressionFromEntryList(this.InstantaneousDynamic),this.instantaneousDynamic=t,this.instantaneousDynamic.ParentMultiExpression=this):t instanceof o.ContinuousDynamicExpression?this.startingContinuousDynamic=t:t instanceof s.MoodExpression?this.moodList.push(t):t instanceof a.UnknownExpression&&this.unknownList.push(t),this.addExpressionToEntryList(t,e)},e.CompareTo=function(t){return this.Timestamp.RealValue>t.Timestamp.RealValue?1:this.Timestamp.RealValue0&&(this.expressions[0].Expression instanceof r.InstantaneousTempoExpression||this.expressions[0].Expression instanceof a.ContinuousTempoExpression)&&(t=this.expressions[0].Expression.Placement),t},e.getFontstyleOfFirstEntry=function(){var t=s.FontStyles.Regular;return this.expressions[0].Expression instanceof r.InstantaneousTempoExpression?t=s.FontStyles.Bold:this.expressions[0].Expression instanceof a.ContinuousTempoExpression&&(t=s.FontStyles.Italic),t},e.addExpression=function(t,e){if(!this.checkIfAlreadyExists(t)){t instanceof r.InstantaneousTempoExpression?this.instantaneousTempo=t:t instanceof a.ContinuousTempoExpression&&(this.continuousTempo=t);var i=new u;i.prefix=e,i.Expression=t,i.label=t.Label,this.expressions.push(i)}},e.CompareTo=function(t){return this.Timestamp.RealValue>t.Timestamp.RealValue?1:this.Timestamp.RealValue1)return t[this.measureListIndex-1]},e.findOrCreateStaffEntry=function(t,e,i){for(var n,s,a=void 0,u=_createForOfIteratorHelperLoose(this.verticalSourceStaffEntryContainers);!(s=u()).done;){var l=s.value;if(l.Timestamp.Equals(t)){n=l;break}}if(n)return n.StaffEntries[e]?a=n.StaffEntries[e]:(a=new o.SourceStaffEntry(n,i),n.StaffEntries[e]=a),{createdNewContainer:!1,staffEntry:a};var c=this.verticalSourceStaffEntryContainers[this.verticalSourceStaffEntryContainers.length-1];if(0===this.verticalSourceStaffEntryContainers.length||c.Timestamp.lt(t)){var h=new r.VerticalSourceStaffEntryContainer(this,t.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.push(h),a=new o.SourceStaffEntry(h,i),h.StaffEntries[e]=a}else for(var f=this.verticalSourceStaffEntryContainers.length-1;f>=0;f--){if(this.verticalSourceStaffEntryContainers[f].Timestamp.lt(t)){var d=new r.VerticalSourceStaffEntryContainer(this,t.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(f+1,0,d),a=new o.SourceStaffEntry(d,i),d.StaffEntries[e]=a;break}if(0===f){var p=new r.VerticalSourceStaffEntryContainer(this,t.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(f,0,p),a=new o.SourceStaffEntry(p,i),p.StaffEntries[e]=a;break}}return{createdNewContainer:!0,staffEntry:a}},e.findOrCreateVoiceEntry=function(t,e){for(var i,n=void 0,r=!1,o=_createForOfIteratorHelperLoose(t.VoiceEntries);!(i=o()).done;){var s=i.value;if(s.ParentVoice===e){n=s;break}}return n||(n=new a.VoiceEntry(t.Timestamp,e,t),r=!0),{createdVoiceEntry:r,voiceEntry:n}},e.getPreviousSourceStaffEntryFromIndex=function(t,e){for(var i=e-1;i>=0;i--)if(this.verticalSourceStaffEntryContainers[i][t])return this.verticalSourceStaffEntryContainers[i][t]},e.getVerticalContainerIndexByTimestamp=function(t){for(var e=0,i=this.VerticalSourceStaffEntryContainers.length;e=0;c--){var h=this.verticalSourceStaffEntryContainers[c][a+u];if(void 0!==h&&h.hasTie()&&s.lt(n.Fraction.plus(h.Timestamp,h.calculateMaxNoteLength()))){s=n.Fraction.plus(h.Timestamp,h.calculateMaxNoteLength());break}}}r.push(s)}for(var f=0,d=r.length;f0)return!0}return!1},e.beginsWithLineRepetition=function(){for(var t=0,e=this.FirstRepetitionInstructions.length;t=0&&!(e=this.verticalSourceStaffEntryContainers[i].StaffEntries[t]);i--);return e},e.canBeReducedToMultiRest=function(){var t,e;if(!this.allRests||this.hasLyrics||this.hasMoodExpressions||this.tempoExpressions.length>0)return!1;for(var i,n=_createForOfIteratorHelperLoose(this.staffLinkedExpressions);!(i=n()).done;)if(i.value.length>0)return!1;for(var r,o=_createForOfIteratorHelperLoose(this.lastInstructionsStaffEntries);!(r=o()).done;)for(var s=r.value,a=0,l=null==s?void 0:s.Instructions.length;athis.rules.MaxPageToDrawNumber)break;var o=this.createBackend(this.backendType,r),s=" exceeds CanvasBackend limit of 32767. Cutting off score.";o.getOSMDBackendType()===b.BackendType.Canvas&&e>32767&&(m.default.warn("[OSMD] Warning: width of "+e+s),e=32767),this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?t=e/this.rules.PageFormat.aspectRatio:(t=r.PositionAndShape.Size.height,t+=this.rules.PageBottomMargin,t+=this.rules.CompactMode?this.rules.PageTopMarginNarrow:this.rules.PageTopMargin,this.rules.RenderTitle&&(t+=this.rules.TitleTopDistance),t*=10*this.zoom),o.getOSMDBackendType()===b.BackendType.Canvas&&t>32767&&(m.default.warn("[OSMD] Warning: height of "+t+s),t=Math.min(t,32767)),o.resize(e,t),o.clear(),this.drawer.Backends.push(o),this.graphic.drawer=this.drawer}},e.exportSVG=function(){for(var t,e,i=_createForOfIteratorHelperLoose(null===(t=this.drawer)||void 0===t?void 0:t.Backends);!(e=i()).done;){var n=e.value;n instanceof c.SvgVexFlowBackend&&n.export()}},e.IsReadyToRender=function(){return void 0!==this.graphic},e.clear=function(){this.drawer.clear(),this.reset()},e.setOptions=function(t){if(this.rules||(this.rules=new g.EngravingRules),this.drawingParameters||(this.drawingParameters=new v.DrawingParameters,this.drawingParameters.Rules=this.rules),null!=t){t.drawingParameters&&(this.drawingParameters.DrawingParametersEnum=v.DrawingParametersEnum[t.drawingParameters.toLowerCase()]);var e=!this.drawer||!this.drawer.Backends||this.drawer.Backends.length<1;if(void 0!==t.backend){var i=b.OSMDOptions.BackendTypeFromString(t.backend);e=e||this.backendType!==i,this.backendType=i}this.needBackendUpdate=e,void 0!==t.autoBeam&&(this.rules.AutoBeamNotes=t.autoBeam);var n=t.autoBeamOptions;if(n&&(void 0===n.maintain_stem_directions&&(n.maintain_stem_directions=!1),this.rules.AutoBeamOptions=n,n.groups&&n.groups.length))for(var r,o=_createForOfIteratorHelperLoose(n.groups);!(r=o()).done;)if(2!==r.value.length)throw new Error("Each fraction in autoBeamOptions.groups must be of length 2, e.g. [3,4] for beaming three fourths");void 0!==t.percussionOneLineCutoff&&(this.rules.PercussionOneLineCutoff=t.percussionOneLineCutoff),0!==this.rules.PercussionOneLineCutoff&&void 0!==t.percussionForceVoicesOneLineCutoff&&(this.rules.PercussionForceVoicesOneLineCutoff=t.percussionForceVoicesOneLineCutoff),void 0!==t.alignRests&&(this.rules.AlignRests=t.alignRests),void 0!==t.coloringMode&&this.setColoringMode(t),void 0!==t.coloringEnabled&&(this.rules.ColoringEnabled=t.coloringEnabled),void 0!==t.colorStemsLikeNoteheads&&(this.rules.ColorStemsLikeNoteheads=t.colorStemsLikeNoteheads),t.disableCursor&&(this.drawingParameters.drawCursors=!1),t.drawHiddenNotes&&(this.drawingParameters.drawHiddenNotes=!0),void 0!==t.drawCredits&&(this.drawingParameters.DrawCredits=t.drawCredits),void 0!==t.drawComposer&&(this.drawingParameters.DrawComposer=t.drawComposer),void 0!==t.drawTitle&&(this.drawingParameters.DrawTitle=t.drawTitle),void 0!==t.drawSubtitle&&(this.drawingParameters.DrawSubtitle=t.drawSubtitle),void 0!==t.drawLyricist&&(this.drawingParameters.DrawLyricist=t.drawLyricist),void 0!==t.drawMetronomeMarks&&(this.rules.MetronomeMarksDrawn=t.drawMetronomeMarks),void 0!==t.drawPartNames&&(this.drawingParameters.DrawPartNames=t.drawPartNames,t.drawPartAbbreviations||(this.rules.RenderPartAbbreviations=t.drawPartNames)),void 0!==t.drawPartAbbreviations&&(this.rules.RenderPartAbbreviations=t.drawPartAbbreviations),!1===t.drawFingerings&&(this.rules.RenderFingerings=!1),void 0!==t.drawMeasureNumbers&&(this.rules.RenderMeasureNumbers=t.drawMeasureNumbers),t.drawMeasureNumbersOnlyAtSystemStart&&(this.rules.RenderMeasureNumbersOnlyAtSystemStart=t.drawMeasureNumbersOnlyAtSystemStart),void 0!==t.drawLyrics&&(this.rules.RenderLyrics=t.drawLyrics),void 0!==t.drawTimeSignatures&&(this.rules.RenderTimeSignatures=t.drawTimeSignatures),void 0!==t.drawSlurs&&(this.rules.RenderSlurs=t.drawSlurs),void 0!==t.measureNumberInterval&&(this.rules.MeasureNumberLabelOffset=t.measureNumberInterval),void 0!==t.useXMLMeasureNumbers&&(this.rules.UseXMLMeasureNumbers=t.useXMLMeasureNumbers),void 0!==t.fingeringPosition&&(this.rules.FingeringPosition=y.AbstractExpression.PlacementEnumFromString(t.fingeringPosition)),void 0!==t.fingeringInsideStafflines&&(this.rules.FingeringInsideStafflines=t.fingeringInsideStafflines),void 0!==t.newSystemFromXML&&(this.rules.NewSystemAtXMLNewSystemAttribute=t.newSystemFromXML),void 0!==t.newPageFromXML&&(this.rules.NewPageAtXMLNewPageAttribute=t.newPageFromXML),void 0!==t.fillEmptyMeasuresWithWholeRest&&(this.rules.FillEmptyMeasuresWithWholeRest=t.fillEmptyMeasuresWithWholeRest),void 0!==t.followCursor&&(this.FollowCursor=t.followCursor),void 0!==t.setWantedStemDirectionByXml&&(this.rules.SetWantedStemDirectionByXml=t.setWantedStemDirectionByXml),t.defaultColorNotehead&&(this.rules.DefaultColorNotehead=t.defaultColorNotehead),t.defaultColorRest&&(this.rules.DefaultColorRest=t.defaultColorRest),t.defaultColorStem&&(this.rules.DefaultColorStem=t.defaultColorStem),t.defaultColorLabel&&(this.rules.DefaultColorLabel=t.defaultColorLabel),t.defaultColorTitle&&(this.rules.DefaultColorTitle=t.defaultColorTitle),t.defaultFontFamily&&(this.rules.DefaultFontFamily=t.defaultFontFamily),t.defaultFontStyle&&(this.rules.DefaultFontStyle=t.defaultFontStyle),t.drawUpToMeasureNumber&&(this.rules.MaxMeasureToDrawIndex=t.drawUpToMeasureNumber-1),t.drawFromMeasureNumber&&(this.rules.MinMeasureToDrawIndex=t.drawFromMeasureNumber-1),t.drawUpToPageNumber&&(this.rules.MaxPageToDrawNumber=t.drawUpToPageNumber),t.drawUpToSystemNumber&&(this.rules.MaxSystemToDrawNumber=t.drawUpToSystemNumber),t.tupletsRatioed&&(this.rules.TupletsRatioed=!0),t.tupletsBracketed&&(this.rules.TupletsBracketed=!0),t.tripletsBracketed&&(this.rules.TripletsBracketed=!0),t.autoResize?(this.resizeHandlerAttached||this.autoResize(),this.autoResizeEnabled=!0):!1===t.autoResize&&(this.autoResizeEnabled=!1),void 0!==t.pageFormat&&this.setPageFormat(t.pageFormat),void 0!==t.pageBackgroundColor&&(this.rules.PageBackgroundColor=t.pageBackgroundColor),void 0!==t.renderSingleHorizontalStaffline&&(this.rules.RenderSingleHorizontalStaffline=t.renderSingleHorizontalStaffline),void 0!==t.spacingFactorSoftmax&&(this.rules.SoftmaxFactorVexFlow=t.spacingFactorSoftmax),void 0!==t.spacingBetweenTextLines&&(this.rules.SpacingBetweenTextLines=t.spacingBetweenTextLines),void 0!==t.stretchLastSystemLine&&(this.rules.StretchLastSystemLine=t.stretchLastSystemLine),void 0!==t.autoGenerateMutipleRestMeasuresFromRestMeasures&&(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures=t.autoGenerateMutipleRestMeasuresFromRestMeasures)}else m.default.warn("warning: osmd.setOptions() called without an options parameter, has no effect.\nexample usage: osmd.setOptions({drawCredits: false, drawPartNames: false})")},e.setColoringMode=function(t){if(t.coloringMode!==v.ColoringModes.XML){var e,i=[x.NoteEnum.C,x.NoteEnum.D,x.NoteEnum.E,x.NoteEnum.F,x.NoteEnum.G,x.NoteEnum.A,x.NoteEnum.B,-1];if(t.coloringMode===v.ColoringModes.CustomColorSet){if(!t.coloringSetCustom||8!==t.coloringSetCustom.length)throw new Error("Invalid amount of colors: With coloringModes.customColorSet, you have to provide a coloringSetCustom parameter with 8 strings (C to B, rest note).");for(var n,r=_createForOfIteratorHelperLoose(t.coloringSetCustom);!(n=r()).done;){var o=n.value;if(!/^\#[0-9a-fA-F]{6}$/.test(o))throw new Error("One of the color strings in options.coloringSetCustom was not a valid HTML Hex color:\n"+o)}e=t.coloringSetCustom}else if(t.coloringMode===v.ColoringModes.AutoColoring){e=[];for(var s=Object.keys(_.AutoColorSet),a=0;a0&&r<32768&&o>0&&o<32768&&(i=new g.PageFormat(r,o,"customPageFormat"+e))}return e=(e=(e=e.replace(" ","_")).replace("Landscape","L")).replace("Portrait","P"),t.PageFormatStandards.hasOwnProperty(e)?i=t.PageFormatStandards[e]:i},e.setPageFormat=function(e){var i=t.StringToPageFormat(e);this.needBackendUpdate=!i.Equals(this.rules.PageFormat),this.rules.PageFormat=i},e.setCustomPageFormat=function(t,e){if(t>0&&e>0){var i=new g.PageFormat(t,e);this.rules.PageFormat=i}},e.setDrawBoundingBox=function(t,e){void 0===e&&(e=!1),this.drawBoundingBox=t,this.drawer&&(this.drawer.drawableBoundingBoxElement=t),e&&this.render()},_createClass2(t,[{key:"DrawSkyLine",get:function(){return this.drawer.skyLineVisible},set:function(t){this.drawSkyLine=t,this.drawer&&(this.drawer.skyLineVisible=t)}},{key:"DrawBottomLine",get:function(){return this.drawer.bottomLineVisible},set:function(t){this.drawBottomLine=t,this.drawer&&(this.drawer.bottomLineVisible=t)}},{key:"DrawBoundingBox",get:function(){return this.drawBoundingBox},set:function(t){this.setDrawBoundingBox(t,!0)}},{key:"AutoResizeEnabled",get:function(){return this.autoResizeEnabled},set:function(t){this.autoResizeEnabled=t}},{key:"Zoom",get:function(){return this.zoom},set:function(t){var e;this.zoom=t,this.zoomUpdated=!0,(null===(e=this.graphic)||void 0===e?void 0:e.GetCalculator)instanceof o.VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=this.zoomUpdated)}},{key:"FollowCursor",get:function(){return this.followCursor},set:function(t){this.followCursor=t}},{key:"TransposeCalculator",get:function(){return u.MusicSheetCalculator.transposeCalculator},set:function(t){u.MusicSheetCalculator.transposeCalculator=t}},{key:"Sheet",get:function(){return this.sheet}},{key:"Drawer",get:function(){return this.drawer}},{key:"GraphicSheet",get:function(){return this.graphic}},{key:"DrawingParameters",get:function(){return this.drawingParameters}},{key:"EngravingRules",get:function(){return this.rules}},{key:"Version",get:function(){return this.version}}]),t}();e.OpenSheetMusicDisplay=E,E.PageFormatStandards={A3_L:new g.PageFormat(420,297,"A3_L"),A3_P:new g.PageFormat(297,420,"A3_P"),A4_L:new g.PageFormat(297,210,"A4_L"),A4_P:new g.PageFormat(210,297,"A4_P"),A5_L:new g.PageFormat(210,148,"A5_L"),A5_P:new g.PageFormat(148,210,"A5_P"),A6_L:new g.PageFormat(148,105,"A6_L"),A6_P:new g.PageFormat(105,148,"A6_P"),Endless:g.PageFormat.UndefinedPageFormat,Letter_L:new g.PageFormat(279.4,215.9,"Letter_L"),Letter_P:new g.PageFormat(215.9,279.4,"Letter_P")}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AJAX=void 0,e.AJAX=function(){function t(){}return t.ajax=function(t,e){var i;void 0===e&&(e=9e3);var n=t.indexOf(".mxl")>-1?"text/plain; charset=x-user-defined":"application/xml";if(XMLHttpRequest)i=new XMLHttpRequest;else{if(!ActiveXObject)return Promise.reject(new Error("XMLHttp not supported."));i=new ActiveXObject("Microsoft.XMLHTTP")}return i.timeout=e,new Promise((function(e,r){i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&(200===i.status||0===i.status&&i.responseText?e(i.responseText):r(new Error("Could not retrieve requested URL "+i.status)))},i.ontimeout=function(t){r(new Error("Server request Timeout"))},i.overrideMimeType(n),i.open("GET",t,!0),i.send()}))},t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Cursor=void 0;var n=i(0);e.Cursor=function(){function t(t,e){this.hidden=!0,this.currentPageNumber=1,this.container=t,this.openSheetMusicDisplay=e,this.rules=this.openSheetMusicDisplay.EngravingRules;var i=0;for(this.cursorElementId="cursorImg-0";document.getElementById(this.cursorElementId);)i++,this.cursorElementId="cursorImg-"+i;var n=document.createElement("img");n.id=this.cursorElementId,n.style.position="absolute",n.style.zIndex="-1",this.cursorElement=n,this.container.appendChild(n)}var e=t.prototype;return e.init=function(t,e){this.manager=t,this.graphic=e,this.reset(),this.hidden=!0,this.hide()},e.show=function(){this.hidden=!1,this.resetIterator(),this.update()},e.resetIterator=function(){if(this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures){var t=this.openSheetMusicDisplay.Sheet.SourceMeasures.length-1,e=this.rules.MinMeasureToDrawIndex;e=Math.min(e,t);var i=this.rules.MaxMeasureToDrawIndex;if(i=Math.min(i,t),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>e&&(this.openSheetMusicDisplay.Sheet.SelectionStart=this.openSheetMusicDisplay.Sheet.SourceMeasures[e].AbsoluteTimestamp),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>i){var r=this.openSheetMusicDisplay.Sheet.SourceMeasures[i];this.openSheetMusicDisplay.Sheet.SelectionEnd=n.Fraction.plus(r.AbsoluteTimestamp,r.Duration)}this.iterator=this.manager.getIterator()}else ("OSMD.Cursor.resetIterator(): sheet or measures were null/undefined.")},e.getStaffEntryFromVoiceEntry=function(t){var e=t.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.measureListIndex,i=t.ParentSourceStaffEntry.ParentStaff.idInMusicSheet;return this.graphic.findGraphicalStaffEntryFromMeasureList(i,e,t.ParentSourceStaffEntry)},e.update=function(){var t=this;if(!this.hidden&&void 0!==this.hidden&&null!==this.hidden){this.updateCurrentPage();var e=this.iterator,i=e.CurrentVisibleVoiceEntries();if(!e.EndReached&&e.CurrentVoiceEntries&&0!==i.length){var n,r=0,o=0,s=0;if(e.CurrentMeasure.isReducedToMultiRest){var a=this.graphic.findGraphicalMeasure(e.CurrentMeasureIndex,0),u=a.parentSourceMeasure.multipleRestMeasures,l=e.CurrentMeasure.multipleRestMeasureNumber/(u+1),c=a.PositionAndShape.Size.width-a.beginInstructionsWidth;r=a.PositionAndShape.AbsolutePosition.x+a.beginInstructionsWidth+l*c,n=a.ParentMusicSystem}else{var h=i.map((function(e){return t.getStaffEntryFromVoiceEntry(e)})).sort((function(t,e){var i,n,r,o;return(null===(n=null===(i=null==t?void 0:t.PositionAndShape)||void 0===i?void 0:i.AbsolutePosition)||void 0===n?void 0:n.x)<=(null===(o=null===(r=null==e?void 0:e.PositionAndShape)||void 0===r?void 0:r.AbsolutePosition)||void 0===o?void 0:o.x)?-1:1}))[0];r=h.PositionAndShape.AbsolutePosition.x,n=h.parentMeasure.ParentMusicSystem}if(n){o=n.PositionAndShape.AbsolutePosition.y+n.StaffLines[0].PositionAndShape.RelativePosition.y;var f=n.StaffLines[n.StaffLines.length-1];s=n.PositionAndShape.AbsolutePosition.y+f.PositionAndShape.RelativePosition.y+f.StaffHeight-o;var d=this.cursorElement;d.style.top=10*o*this.openSheetMusicDisplay.zoom+"px",d.style.left=10*(r-1.5)*this.openSheetMusicDisplay.zoom+"px",d.height=10*s*this.openSheetMusicDisplay.zoom;var p=30*this.openSheetMusicDisplay.zoom;if(p!==d.width&&(d.width=p,this.updateStyle(p)),this.openSheetMusicDisplay.FollowCursor){var m=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:m<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}}}},e.hide=function(){this.cursorElement.style.display="none",this.hidden=!0},e.next=function(){this.iterator.moveToNextVisibleVoiceEntry(!1),this.update()},e.reset=function(){this.resetIterator(),this.update()},e.updateStyle=function(t,e){e||(e=this.rules.DefaultColorCursor);var i=document.createElement("canvas");i.width=this.cursorElement.width,i.height=1;var n=i.getContext("2d");n.globalAlpha=.5;var r=n.createLinearGradient(0,0,this.cursorElement.width,0);r.addColorStop(0,"white"),r.addColorStop(.2,e),r.addColorStop(.8,e),r.addColorStop(1,"white"),n.fillStyle=r,n.fillRect(0,0,t,1),this.cursorElement.src=i.toDataURL("image/png")},e.VoicesUnderCursor=function(t){return this.iterator.CurrentVisibleVoiceEntries(t)},e.NotesUnderCursor=function(t){var e=this.VoicesUnderCursor(t),i=[];return e.forEach((function(t){i.push.apply(i,t.Notes)})),i},e.updateCurrentPage=function(){for(var t,e=this.iterator.currentTimeStamp,i=_createForOfIteratorHelperLoose(this.graphic.MusicPages);!(t=i()).done;){var n=t.value;if(n.MusicSystems.last().GetSystemsLastTimeStamp().gt(e)){var r=n.PageNumber;return r!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById("osmdCanvasPage"+r),this.container.appendChild(this.cursorElement)),this.currentPageNumber=r}}return 1},_createClass2(t,[{key:"Iterator",get:function(){return this.iterator}},{key:"Hidden",get:function(){return this.hidden}}]),t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AClassHierarchyTrackable=void 0,e.AClassHierarchyTrackable=function(){function t(){}return t.prototype.isInstanceOfClass=function(t){for(var e=this.constructor.prototype;e;){if(t===e.constructor.name)return!0;e=e.__proto__}return!1},t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VerticalGraphicalStaffEntryContainer=void 0,e.VerticalGraphicalStaffEntryContainer=function(){function t(t,e){this.staffEntries=[],this.absoluteTimestamp=e,this.staffEntries=new Array(t)}return t.compareByTimestamp=function(t,e){var i=t.absoluteTimestamp.RealValue,n=e.absoluteTimestamp.RealValue;return in?1:0},t.prototype.getFirstNonNullStaffEntry=function(){for(var t=0,e=this.staffEntries.length;t0){if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1)}return this.musicSystems},e.calculateSystemYLayout=function(){for(var t,e=_createForOfIteratorHelperLoose(this.musicSystems);!(t=e()).done;){var i=t.value;this.optimizeDistanceBetweenStaffLines(i)}this.calculateMusicSystemsRelativePositions()},e.setMeasureWidth=function(t,e,i,n){for(var r=0,o=t.length;r0&&(s.beginInstructionsWidth=i),n>0&&(s.endInstructionsWidth=n)}},e.finalizeCurrentAndCreateNewSystem=function(t,e,i,n){void 0===e&&(e=!1),void 0===i&&(i=!0),void 0===n&&(n=!1),this.finalizeCurrentSystem(t,e,i,n),this.currentSystemParams=new p,void 0!==t&&this.measureListIndex=1){var e=this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length-1],i=t[t.length-1],n=0;i.endLine===l.SystemLinesEnum.DotsBoldBoldDots&&(i.endLine=l.SystemLinesEnum.DotsThinBold,n=e[0].getLineWidth(l.SystemLinesEnum.DotsBoldBoldDots)/2-e[0].getLineWidth(l.SystemLinesEnum.DotsThinBold)),this.currentSystemParams.currentSystemFixWidth-=n;for(var r=0,o=e.length;r1){h=!0;break}for(var p=0,m=0;m=0){var x=null===(u=this.measureList[_][0])||void 0===u?void 0:u.parentSourceMeasure;(null==x?void 0:x.ImplicitMeasure)&&(null==x?void 0:x.RhythmPrinted)&&(S=!1)}S&&(e.addRhythmAtBegin(f),e.parentSourceMeasure.RhythmPrinted=!0,g=!0)}return(v||b||g)&&(l+=e.beginInstructionsWidth,g&&(l+=this.rules.RhythmRightMargin)),l},e.addInstructionsAtMeasureEnd=function(t,e,i){if(!t||!t.Instructions||0===t.Instructions.length)return 0;for(var n=0,r=t.Instructions.length;n0&&(this.currentSystemParams.systemMeasures.push({beginLine:l.SystemLinesEnum.None,endLine:l.SystemLinesEnum.None}),this.currentSystemParams.currentWidth+=u,this.currentSystemParams.currentSystemFixWidth+=u)},e.addExtraInstructionMeasure=function(t,e,i){var n=this.currentSystemParams.currentSystem,r=c.MusicSheetCalculator.symbolFactory.createExtraGraphicalMeasure(n.StaffLines[t]);e&&r.addKeyAtBegin(e,this.activeKeys[t],this.activeClefs[t]),void 0!==i&&i.PrintObject&&r.addRhythmAtBegin(i),r.PositionAndShape.BorderLeft=0,r.PositionAndShape.BorderTop=0,r.PositionAndShape.BorderBottom=this.rules.StaffHeight;var o=this.rules.MeasureLeftMargin+r.beginInstructionsWidth+this.rules.MeasureRightMargin;return r.PositionAndShape.BorderRight=o,n.StaffLines[t].Measures.push(r),o},e.addStaveMeasuresToSystem=function(t){if(t[0]){for(var e=[],i=0;i1){var e=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,t.measureListIndex+t.multipleRestMeasures-1);t=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[e]}}finally{}return this.nextMeasureBeginsLineRepetition()&&this.thisMeasureEndsLineRepetition()?l.SystemLinesEnum.DotsBoldBoldDots:this.thisMeasureEndsLineRepetition()?l.SystemLinesEnum.DotsThinBold:this.nextMeasureHasKeyInstructionChange()||this.thisMeasureEndsWordRepetition()||this.nextMeasureBeginsWordRepetition()?l.SystemLinesEnum.DoubleThin:t&&void 0!==t.endingBarStyleEnum?t.endingBarStyleEnum:l.SystemLinesEnum.SingleThin},e.getLineWidth=function(t,e,i){var n=t.getLineWidth(e);return e===l.SystemLinesEnum.DotsBoldBoldDots&&(n/=2),i&&e===l.SystemLinesEnum.BoldThinDots&&(n+=this.rules.DistanceBetweenLastInstructionAndRepetitionBarline),n},e.previousMeasureEndsLineRepetition=function(){if(0===this.measureListIndex)return!1;for(var t=0,e=this.measureList[this.measureListIndex-1].length;t=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||!this.measureList[t])return!1;for(var e=0,i=this.measureList[t].length;e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||t>this.measureList.length-1)return!1;for(var e=0,i=this.measureList[t].length;ethis.rules.PageHeight-this.rules.PageBottomMargin&&++n<=4&& ("warning: could not fit a single system on page "+t.PageNumber+" and measure number "+i.GraphicalMeasures[0][0].MeasureNumber+'.\n The PageFormat may be too small for this sheet."\n Will not give further warnings for all pages, only total.')}else{var s=this.musicSystems[r-1],u=s.StaffLines[s.StaffLines.length-1],l=u.PositionAndShape,c=this.findRequiredDistanceWithSkyBottomLine(s,i);c+=this.rules.MinSkyBottomDistBetweenSystems,c=Math.max(c,this.rules.MinimumDistanceBetweenSystems+u.StaffHeight);var h=e+l.RelativePosition.y+c,f=h+i.PositionAndShape.BorderMarginBottom;if(this.rules.NewPageAtXMLNewPageAttribute&&s.breaksPage||!(f0&& ("total amount of pages that couldn't fit a single music system: "+n+" of "+t.PageNumber)},e.findRequiredDistanceWithSkyBottomLine=function(t,e){for(var i=t.StaffLines[t.StaffLines.length-1],n=e.StaffLines[0],r=i.BottomLine,o=n.SkyLine,s=i.PositionAndShape,a=n.PositionAndShape,u=1/this.rules.SamplingUnit,l=0,c=0;c=o.length)break;for(var d=Math.max(0,f-6),p=Math.min(o.length-1,f+6),m=0,v=d;v<=p;v++)m=Math.min(m,o[v]);var b=h-m;l=Math.max(b,l)}}return 0===l&&(l=s.BorderBottom-a.BorderTop),l},t}();var p=function(){function t(){this.systemMeasures=[],this.systemMeasureIndex=0,this.currentWidth=0,this.currentSystemFixWidth=0,this.currentSystemVarWidth=0,this.maxLabelLength=0}return t.prototype.IsSystemStartMeasure=function(){return 0===this.systemMeasureIndex},t}();e.SystemBuildParameters=p,e.MeasureBuildParameters=function(){function t(){}return t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Clickable=void 0;var n=function(t){function e(){return t.apply(this,arguments)||this}return _inheritsLoose(e,t),e}(i(6).GraphicalObject);e.Clickable=n},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.OctaveShiftParams=void 0,e.OctaveShiftParams=function(){function t(t,e,i){this.getOpenOctaveShift=t,this.getAbsoluteStartTimestamp=e,this.getAbsoluteEndTimestamp=i}return t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AccidentalCalculator=void 0;var n=i(2),r=i(2),o=i(15),s=i(17);e.AccidentalCalculator=function(){function t(){this.keySignatureNoteAlterationsDict=new o.Dictionary,this.currentAlterationsComparedToKeyInstructionList=[],this.currentInMeasureNoteAlterationsDict=new o.Dictionary}var e=t.prototype;return e.doCalculationsAtEndOfMeasure=function(){this.currentInMeasureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.clear();for(var t,e=_createForOfIteratorHelperLoose(this.keySignatureNoteAlterationsDict.keys());!(t=e()).done;){var i=t.value;this.currentInMeasureNoteAlterationsDict.setValue(i,this.keySignatureNoteAlterationsDict.getValue(i))}},e.checkAccidental=function(t,e){if(e){var i=e.FundamentalNote+12*e.Octave,o=this.currentAlterationsComparedToKeyInstructionList.indexOf(i)>=0;if(this.currentInMeasureNoteAlterationsDict.containsKey(i)){if(o&&this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(i),1),this.currentInMeasureNoteAlterationsDict.getValue(i)!==e.AccidentalHalfTones){this.keySignatureNoteAlterationsDict.containsKey(i)&&this.keySignatureNoteAlterationsDict.getValue(i)!==e.AccidentalHalfTones?(this.currentAlterationsComparedToKeyInstructionList.push(i),this.currentInMeasureNoteAlterationsDict.setValue(i,e.AccidentalHalfTones)):e.Accidental!==n.AccidentalEnum.NONE&&this.currentInMeasureNoteAlterationsDict.remove(i);var a=this.currentInMeasureNoteAlterationsDict.getValue(i);e.Accidental===n.AccidentalEnum.NONE&&(e=.5===Math.abs(a)?new r.Pitch(e.FundamentalNote,e.Octave,n.AccidentalEnum.NONE):new r.Pitch(e.FundamentalNote,e.Octave,n.AccidentalEnum.NATURAL)),s.MusicSheetCalculator.symbolFactory.addGraphicalAccidental(t,e)}}else e.Accidental!==n.AccidentalEnum.NONE?(o||this.currentAlterationsComparedToKeyInstructionList.push(i),this.currentInMeasureNoteAlterationsDict.setValue(i,e.AccidentalHalfTones),s.MusicSheetCalculator.symbolFactory.addGraphicalAccidental(t,e)):o&&(e=new r.Pitch(e.FundamentalNote,e.Octave,n.AccidentalEnum.NATURAL),this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(i),1),s.MusicSheetCalculator.symbolFactory.addGraphicalAccidental(t,e))}},e.reactOnKeyInstructionChange=function(){var t,e=this.activeKeyInstruction.AlteratedNotes;t=this.activeKeyInstruction.Key>0?n.AccidentalEnum.SHARP:n.AccidentalEnum.FLAT,this.keySignatureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.length=0;for(var i=-9;i<9;i++)for(var o=0;o1&&(o=this.staffLines[this.staffLines.length-1].Measures[0]);var s=this.createSystemLine(n,t,c.SystemLinesEnum.SingleThin,f.SystemLinePosition.MeasureBegin,this,r,o);this.SystemLines.push(s),s.PositionAndShape.RelativePosition=new l.PointF2D(n,0),s.PositionAndShape.BorderLeft=0,s.PositionAndShape.BorderRight=t,s.PositionAndShape.BorderTop=0,s.PositionAndShape.BorderBottom=this.boundingBox.Size.height,this.createLinesForSystemLine(s)},i.createVerticalLineForMeasure=function(t,e,i,n,r,o){var s=o.ParentStaffLine,a=new l.PointF2D(s.PositionAndShape.RelativePosition.x,s.PositionAndShape.RelativePosition.y),u=s.ParentStaff.ParentInstrument.Staves;if(s.ParentStaff===u[0]){var c=void 0;u.length>1&&(c=this.getBottomStaffLine(s).Measures[r]);var h=this.createSystemLine(t,e,i,n,this,o,c),f=a.x+t;h.PositionAndShape.RelativePosition=new l.PointF2D(f,0),h.PositionAndShape.BorderLeft=0,h.PositionAndShape.BorderRight=e,this.SystemLines.push(h)}},i.setYPositionsToVerticalLineObjectsAndCreateLines=function(t){},i.calculateBorders=function(t){},i.alignBeginInstructions=function(){},i.GetLeftBorderAbsoluteXPosition=function(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].Measures[0].beginInstructionsWidth},i.GetRightBorderAbsoluteXPosition=function(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].StaffLines[0].End.x},i.AddGraphicalMeasures=function(t){for(var e=0,i=t.length;e1){for(var o=void 0,s=void 0,a=0,u=this.staffLines.length;athis.maxLabelLength&&(this.maxLabelLength=g.PositionAndShape.Size.width,e=o)}this.updateMusicSystemStaffLineXPosition(e)},i.setMusicSystemLabelsYPosition=function(){var t=this;this.labels.forEach((function(e,i){for(var n=0,r=0,o=0;o0&&(i.PositionAndShape.RelativePosition=new l.PointF2D(0,n/r+2))}))},i.checkStaffEntriesForStaffEntryLink=function(){for(var t=!1,e=!1,i=0;i=0;i--){if(!((e=t.InstrumentalGroups[i])instanceof n.Instrument))return this.findLastVisibleInstrumentInInstrumentalGroup(e);if(!0===e.Visible)return e}},i.updateMusicSystemStaffLineXPosition=function(t){for(var e=0,i=this.StaffLines.length;e-1&&this.parent.MusicSystems.splice(e,1)}this.parent=t,this.boundingBox.Parent=t.PositionAndShape}},{key:"NextSystem",get:function(){var t=this.Parent.MusicSystems.indexOf(this);return t!==this.Parent.MusicSystems.length?this.Parent.MusicSystems[t+1]:void 0}},{key:"StaffLines",get:function(){return this.staffLines}},{key:"GraphicalMeasures",get:function(){return this.graphicalMeasures}},{key:"MeasureNumberLabels",get:function(){return this.measureNumberLabels}},{key:"Labels",get:function(){return this.labels.values()}},{key:"ObjectsToRedraw",get:function(){return this.objectsToRedraw}},{key:"InstrumentBrackets",get:function(){return this.instrumentBrackets}},{key:"GroupBrackets",get:function(){return this.groupBrackets}},{key:"GraphicalMarkedAreas",get:function(){return this.graphicalMarkedAreas}},{key:"GraphicalComments",get:function(){return this.graphicalComments}},{key:"SystemLines",get:function(){return this.systemLines}},{key:"Id",get:function(){return this.id}}]),e}(u.GraphicalObject);e.MusicSystem=p},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Staff=void 0,e.Staff=function(){function t(t,e){this.isTab=!1,this.voices=[],this.volume=1,this.stafflineCount=5,this.parentInstrument=t,this.id=e,this.audible=!0,this.following=!0}return _createClass2(t,[{key:"ParentInstrument",get:function(){return this.parentInstrument},set:function(t){this.parentInstrument=t}},{key:"Voices",get:function(){return this.voices}},{key:"Id",get:function(){return this.id}},{key:"Volume",get:function(){return this.volume},set:function(t){this.volume=t}},{key:"StafflineCount",get:function(){return this.stafflineCount},set:function(t){this.stafflineCount=t}}]),t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.MusicSheetDrawer=void 0;var n=i(5),r=i(22),o=i(27),s=i(46),a=i(4),u=i(24),l=i(12),c=i(9),h=i(11),f=i(75),d=i(77),p=i(120),m=i(121),v=i(47);e.MusicSheetDrawer=function(){function t(t,e){this.drawableBoundingBoxElement=!1,this.skyLineVisible=!1,this.bottomLineVisible=!1,this.phonicScoreMode=p.PhonicScoreModes.Manual,this.textMeasurer=t,this.splitScreenLineColor=-1,this.drawingParameters=e,this.rules=e.Rules}var e=t.prototype;return e.drawSheet=function(t){if(this.graphicalMusicSheet=t,this.rules=t.ParentMusicSheet.Rules,this.drawSplitScreenLine(),this.drawingParameters.drawCursors)for(var e,i=_createForOfIteratorHelperLoose(t.Cursors);!(e=i()).done;){var o=e.value;if(o){var s=new n.BoundingBox(o);s.AbsolutePosition=o.Start,s.BorderBottom=o.End.y-o.Start.y,s.BorderRight=o.Width/2,s.BorderLeft=-o.Width/2,this.isVisible(s)&&this.drawLineAsVerticalRectangle(o,r.GraphicalLayers.Cursor)}}this.drawingParameters.drawScrollIndicator&&this.drawScrollIndicator();for(var a=Math.min(this.graphicalMusicSheet.MusicPages.length,this.rules.MaxPageToDrawNumber),u=0;u0&&this.drawDashes(u.LyricsDashes),u.LyricLines.length>0&&this.drawLyricLines(u.LyricLines,u))}for(var l,c=_createForOfIteratorHelperLoose(t.SystemLines);!(l=c()).done;){var h=l.value;this.drawSystemLineObject(h)}if(t.Parent===t.Parent.Parent.MusicPages[0])for(var f,d=_createForOfIteratorHelperLoose(t.Labels);!(f=d()).done;){var p=f.value;this.drawLabel(p,r.GraphicalLayers.Notes)}for(var m,v=_createForOfIteratorHelperLoose(t.InstrumentBrackets);!(m=v()).done;){var b=m.value;this.drawInstrumentBrace(b,t)}for(var g,y=_createForOfIteratorHelperLoose(t.GroupBrackets);!(g=y()).done;){var S=g.value;this.drawGroupBracket(S,t)}if(!this.leadSheet)for(var _,x=_createForOfIteratorHelperLoose(t.MeasureNumberLabels);!(_=x()).done;){var E=_.value;this.drawLabel(E,r.GraphicalLayers.Notes)}for(var w,T=_createForOfIteratorHelperLoose(t.StaffLines);!(w=T()).done;){var M=w.value;this.drawStaffLineSymbols(M)}this.drawingParameters.drawMarkedAreas&&this.drawMarkedAreas(t),this.drawingParameters.drawComments&&this.drawComment(t)},e.activateSystemRendering=function(t,e,i,n){return!0},e.drawSystemLineObject=function(t){},e.drawStaffLine=function(t){for(var e,i=_createForOfIteratorHelperLoose(t.Measures);!(e=i()).done;){var n=e.value;this.drawMeasure(n)}this.rules.RenderLyrics&&t.LyricsDashes.length>0&&this.drawDashes(t.LyricsDashes),this.drawOctaveShifts(t),this.drawExpressions(t),this.skyLineVisible&&this.drawSkyLine(t),this.bottomLineVisible&&this.drawBottomLine(t)},e.drawLyricLines=function(t,e){var i=this;e.LyricLines.forEach((function(t){t.Start.y+=e.PositionAndShape.AbsolutePosition.y,t.End.y+=e.PositionAndShape.AbsolutePosition.y,t.Start.x+=e.PositionAndShape.AbsolutePosition.x,t.End.x+=e.PositionAndShape.AbsolutePosition.x,i.drawGraphicalLine(t,i.rules.LyricUnderscoreLineWidth)}))},e.drawExpressions=function(t){},e.drawGraphicalLine=function(t,e,i){return void 0===i&&(i="black"),this.drawLine(t.Start,t.End,i,e)},e.drawLine=function(t,e,i,n){void 0===i&&(i="#FF0000FF")},e.drawDashes=function(t){var e=this;t.forEach((function(t){return e.drawLabel(t,r.GraphicalLayers.Notes)}))},e.drawOctaveShifts=function(t){},e.drawStaffLines=function(t){if(t.StaffLines)for(var e=t.PositionAndShape.AbsolutePosition,i=0;i<5;i++)this.drawLineAsHorizontalRectangleWithOffset(t.StaffLines[i],e,r.GraphicalLayers.Notes)},e.drawInstantaneousDynamic=function(t){throw new Error("not implemented")},e.drawContinuousDynamic=function(t){throw new Error("not implemented")},e.drawSymbol=function(t,e,i,n,o){void 0===n&&(n=1),void 0===o&&(o=r.GraphicalLayers.Notes)},e.drawPage=function(t){if(this.isVisible(t.PositionAndShape)){for(var e,i=_createForOfIteratorHelperLoose(t.MusicSystems);!(e=i()).done;){var n=e.value;this.isVisible(n.PositionAndShape)&&this.drawMusicSystem(n)}if(t===t.Parent.MusicPages[0])for(var o,s=_createForOfIteratorHelperLoose(t.Labels);!(o=s()).done;){var a=o.value;this.drawLabel(a,r.GraphicalLayers.Notes)}this.drawableBoundingBoxElement&&this.drawBoundingBoxes(t.PositionAndShape,0,this.drawableBoundingBoxElement)}},e.drawBoundingBoxes=function(t,e,i){var n=this;void 0===e&&(e=0),void 0===i&&(i="all");var r=t.DataObject.constructor.name,o=!1;"all"===i?o=!0:"VexFlowStaffEntry"===i?o=t.DataObject instanceof m.VexFlowStaffEntry:"VexFlowMeasure"===i?o=t.DataObject instanceof m.VexFlowMeasure:"VexFlowGraphicalNote"===i?o=t.DataObject instanceof m.VexFlowGraphicalNote:"VexFlowVoiceEntry"===i?o=t.DataObject instanceof m.VexFlowVoiceEntry:"GraphicalLabel"===i?o=t.DataObject instanceof u.GraphicalLabel:"VexFlowStaffLine"===i?o=t.DataObject instanceof m.VexFlowStaffLine:"SystemLine"===i?o=t.DataObject instanceof f.SystemLine:"StaffLineActivitySymbol"===i?o=t.DataObject instanceof v.StaffLineActivitySymbol:"VexFlowContinuousDynamicExpression"===i&&(o=t.DataObject instanceof m.VexFlowContinuousDynamicExpression),(o||r===i)&&this.drawBoundingBox(t,void 0,!0,r,e),e++,t.ChildElements.forEach((function(t){return n.drawBoundingBoxes(t,e,i)}))},e.drawBoundingBox=function(t,e,i,n,h){void 0===i&&(i=!1),void 0===h&&(h=0);var f=new s.RectangleF2D(t.AbsolutePosition.x+t.BorderMarginLeft,t.AbsolutePosition.y+t.BorderMarginTop,t.BorderMarginRight-t.BorderMarginLeft,t.BorderMarginBottom-t.BorderMarginTop);i&&(this.drawLineAsHorizontalRectangle(new o.GraphicalLine(new a.PointF2D(t.AbsolutePosition.x-1,t.AbsolutePosition.y),new a.PointF2D(t.AbsolutePosition.x+1,t.AbsolutePosition.y),.1,r.OutlineAndFillStyleEnum.BaseWritingColor,e),h-1),this.drawLineAsVerticalRectangle(new o.GraphicalLine(new a.PointF2D(t.AbsolutePosition.x,t.AbsolutePosition.y-1),new a.PointF2D(t.AbsolutePosition.x,t.AbsolutePosition.y+1),.1,r.OutlineAndFillStyleEnum.BaseWritingColor,e),h-1)),f=this.applyScreenTransformationForRect(f);var d=this.renderRectangle(f,r.GraphicalLayers.Background,h,e,.5);if(n){var p=new l.Label(n);this.renderLabel(new u.GraphicalLabel(p,.8,c.TextAlignmentEnum.CenterCenter,this.rules),h,f.width,f.height,f.height,new a.PointF2D(f.x,f.y+12))}return d},e.drawMarkedAreas=function(t){for(var e,i=_createForOfIteratorHelperLoose(t.GraphicalMarkedAreas);!(e=i()).done;){var n=e.value;n&&(n.systemRectangle&&this.drawRectangle(n.systemRectangle,r.GraphicalLayers.Background),n.settings&&this.drawLabel(n.settings,r.GraphicalLayers.Comment),n.labelRectangle&&this.drawRectangle(n.labelRectangle,r.GraphicalLayers.Background),n.label&&this.drawLabel(n.label,r.GraphicalLayers.Comment))}},e.drawComment=function(t){for(var e,i=_createForOfIteratorHelperLoose(t.GraphicalComments);!(e=i()).done;){var n=e.value;n&&(n.settings&&this.drawLabel(n.settings,r.GraphicalLayers.Comment),n.label&&this.drawLabel(n.label,r.GraphicalLayers.Comment))}},e.drawStaffLineSymbols=function(t){var e=t.ParentStaff.ParentInstrument,i=t.PositionAndShape.AbsolutePosition.x,n=t.PositionAndShape.AbsolutePosition.y+2,s=t.PositionAndShape.BorderRight;e.highlight&&this.drawingParameters.drawHighlights&&this.drawLineAsHorizontalRectangle(new o.GraphicalLine(new a.PointF2D(i,n),new a.PointF2D(i+s,n),4,r.OutlineAndFillStyleEnum.Highlighted),r.GraphicalLayers.Highlight);var u=p.MusicSymbolDrawingStyle.Disabled,l=d.MusicSymbol.PLAY,c=this.drawingParameters.drawActivitySymbols;switch(this.phonicScoreMode){case p.PhonicScoreModes.Midi:l=d.MusicSymbol.PLAY,this.midiPlaybackAvailable&&t.ParentStaff.audible&&(u=p.MusicSymbolDrawingStyle.PlaybackSymbols);break;case p.PhonicScoreModes.Following:l=d.MusicSymbol.MIC,t.ParentStaff.following&&(u=p.MusicSymbolDrawingStyle.FollowSymbols);break;default:c=!1}if(c){var h=new a.PointF2D(i+s+2,n);this.drawSymbol(l,u,h)}if(this.drawingParameters.drawErrors)for(var f,m=_createForOfIteratorHelperLoose(t.Measures);!(f=m()).done;){var v=f.value,b=v.PositionAndShape,g=b.AbsolutePosition.x,y=b.AbsolutePosition.y+2;v.hasError&&this.graphicalMusicSheet.ParentMusicSheet.DrawErroneousMeasures&&this.drawLineAsHorizontalRectangle(new o.GraphicalLine(new a.PointF2D(g,y),new a.PointF2D(g+b.BorderRight,y),4,r.OutlineAndFillStyleEnum.ErrorUnderlay),r.GraphicalLayers.MeasureError)}},_createClass2(t,[{key:"Mode",set:function(t){this.phonicScoreMode=t}},{key:"leadSheet",get:function(){return this.graphicalMusicSheet.LeadSheet},set:function(t){this.graphicalMusicSheet.LeadSheet=t}}]),t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.PhonicScoreModes=e.MusicSymbolDrawingStyle=e.DrawingMode=void 0,function(t){t[t.All=0]="All",t[t.NoOverlays=1]="NoOverlays",t[t.Leadsheet=2]="Leadsheet"}(e.DrawingMode||(e.DrawingMode={})),function(t){t[t.Normal=0]="Normal",t[t.Disabled=1]="Disabled",t[t.Selected=2]="Selected",t[t.Clickable=3]="Clickable",t[t.PlaybackSymbols=4]="PlaybackSymbols",t[t.FollowSymbols=5]="FollowSymbols",t[t.QFeedbackNotFound=6]="QFeedbackNotFound",t[t.QFeedbackOk=7]="QFeedbackOk",t[t.QFeedbackPerfect=8]="QFeedbackPerfect",t[t.Debug1=9]="Debug1",t[t.Debug2=10]="Debug2",t[t.Debug3=11]="Debug3"}(e.MusicSymbolDrawingStyle||(e.MusicSymbolDrawingStyle={})),function(t){t[t.Following=0]="Following",t[t.Midi=1]="Midi",t[t.Manual=2]="Manual"}(e.PhonicScoreModes||(e.PhonicScoreModes={}))},function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),r=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||e.hasOwnProperty(i)||n(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(i(78),e),r(i(58),e),r(i(92),e),r(i(59),e),r(i(57),e),r(i(13),e),r(i(60),e),r(i(90),e),r(i(93),e),r(i(95),e),r(i(61),e),r(i(44),e),r(i(96),e),r(i(89),e),r(i(16),e),r(i(91),e),r(i(97),e),r(i(165),e),r(i(98),e),r(i(99),e),r(i(100),e),r(i(101),e),r(i(63),e),r(i(62),e)},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalMeasure=void 0;var n=i(6),r=i(0),o=i(5),s=i(4),a=function(t){function e(e,i,n){var r;return(r=t.call(this)||this).hasOnlyRests=!1,r.measureNumber=-1,r.parentStaff=e,r.parentSourceMeasure=i,r.parentStaffLine=n,n?(r.parentStaff=n.ParentStaff,r.PositionAndShape=new o.BoundingBox(_assertThisInitialized2(r),n.PositionAndShape)):r.PositionAndShape=new o.BoundingBox(_assertThisInitialized2(r)),r.PositionAndShape.BorderBottom=4,r.parentSourceMeasure&&(r.measureNumber=r.parentSourceMeasure.MeasureNumber),r.staffEntries=[],r}_inheritsLoose(e,t);var i=e.prototype;return i.resetLayout=function(){throw new Error("not implemented")},i.getLineWidth=function(t){throw new Error("not implemented")},i.addClefAtBegin=function(t){throw new Error("not implemented")},i.addKeyAtBegin=function(t,e,i){throw new Error("not implemented")},i.addRhythmAtBegin=function(t){throw new Error("not implemented")},i.addClefAtEnd=function(t,e){throw void 0===e&&(e=!0),new Error("not implemented")},i.setPositionInStaffline=function(t){this.PositionAndShape.RelativePosition=new s.PointF2D(t,0)},i.setWidth=function(t){this.PositionAndShape.BorderRight=t},i.layoutSymbols=function(){throw new Error("not implemented")},i.findGraphicalStaffEntryFromTimestamp=function(t){for(var e,i=0,n=this.staffEntries.length;i1},i.isVisible=function(){return this.ParentStaff.ParentInstrument.Visible},i.getGraphicalMeasureDurationFromStaffEntries=function(){for(var t=new r.Fraction(0,1),e=[],i=0,n=this.staffEntries.length;i0&&d.Add(b.notes[0].graphicalNoteLength)}t.lt(d)&&(t=r.Fraction.createFromFraction(d))}return t},i.addGraphicalStaffEntry=function(t){this.staffEntries.push(t)},i.addGraphicalStaffEntryAtTimestamp=function(t){if(t)if(0===this.staffEntries.length||this.staffEntries[this.staffEntries.length-1].relInMeasureTimestamp.lt(t.relInMeasureTimestamp))this.staffEntries.push(t);else for(var e=this.staffEntries.length-1;e>=0;e--){if(this.staffEntries[e].relInMeasureTimestamp.lt(t.relInMeasureTimestamp)){this.staffEntries.splice(e+1,0,t);break}0===e&&this.staffEntries.splice(e,0,t)}},i.beginsWithLineRepetition=function(){var t=this.parentSourceMeasure;return!!t&&t.beginsWithLineRepetition()},i.endsWithLineRepetition=function(){var t=this.parentSourceMeasure;return!!t&&t.endsWithLineRepetition()},i.beginsWithWordRepetition=function(){var t=this.parentSourceMeasure;return!!t&&t.beginsWithWordRepetition()},i.endsWithWordRepetition=function(){var t=this.parentSourceMeasure;return!!t&&t.endsWithWordRepetition()},_createClass2(e,[{key:"ParentStaff",get:function(){return this.parentStaff}},{key:"ParentMusicSystem",get:function(){return this.parentMusicSystem},set:function(t){this.parentMusicSystem=t}},{key:"MeasureNumber",get:function(){return this.measureNumber}},{key:"FirstInstructionStaffEntry",get:function(){return this.firstInstructionStaffEntry},set:function(t){this.firstInstructionStaffEntry=t}},{key:"LastInstructionStaffEntry",get:function(){return this.lastInstructionStaffEntry},set:function(t){this.lastInstructionStaffEntry=t}},{key:"ParentStaffLine",get:function(){return this.parentStaffLine},set:function(t){this.parentStaffLine=t,this.parentStaffLine&&(this.PositionAndShape.Parent=this.parentStaffLine.PositionAndShape)}}]),e}(n.GraphicalObject);e.GraphicalMeasure=a},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalOctaveShift=void 0;var n=i(6),r=i(30),o=i(5),s=i(77),a=i(11),u=function(t){function e(e,i){var n;return(n=t.call(this)||this).getOctaveShift=e,n.setSymbol(),n.PositionAndShape=new o.BoundingBox(_assertThisInitialized2(n),i),n}return _inheritsLoose(e,t),e.prototype.setSymbol=function(){switch(this.getOctaveShift.Type){case r.OctaveEnum.VA8:this.octaveSymbol=s.MusicSymbol.VA8;break;case r.OctaveEnum.VB8:this.octaveSymbol=s.MusicSymbol.VB8;break;case r.OctaveEnum.MA15:this.octaveSymbol=s.MusicSymbol.MA15;break;case r.OctaveEnum.MB15:this.octaveSymbol=s.MusicSymbol.MB15;break;default:throw new a.ArgumentOutOfRangeException("")}},e}(n.GraphicalObject);e.GraphicalOctaveShift=u},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalStaffEntry=void 0;var n=i(5),r=i(0),o=i(6),s=i(34),a=i(17),u=function(t){function e(e,i,r){var o;return(o=t.call(this)||this).graphicalChordContainers=[],o.tabStaffEntry=void 0,o.MaxAccidentals=0,o.graphicalInstructions=[],o.graphicalTies=[],o.lyricsEntries=[],o.parentMeasure=e,o.graphicalVoiceEntries=[],o.sourceStaffEntry=i,r?(o.staffEntryParent=r,o.parentVerticalContainer=r.parentVerticalContainer,o.PositionAndShape=new n.BoundingBox(_assertThisInitialized2(o),r.PositionAndShape)):o.PositionAndShape=new n.BoundingBox(_assertThisInitialized2(o),e.PositionAndShape),i&&(o.relInMeasureTimestamp=i.Timestamp),o}_inheritsLoose(e,t);var i=e.prototype;return i.getAbsoluteTimestamp=function(){var t=this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.clone();return this.relInMeasureTimestamp&&t.Add(this.relInMeasureTimestamp),t},i.findTieGraphicalNoteFromNote=function(t){for(var e,i=_createForOfIteratorHelperLoose(this.graphicalVoiceEntries);!(e=i()).done;)for(var n,r=_createForOfIteratorHelperLoose(e.value.notes);!(n=r()).done;){var o=n.value,s=o.sourceNote;if(!s.isRest()&&s.Pitch.FundamentalNote===t.Pitch.FundamentalNote&&s.Pitch.Octave===t.Pitch.Octave&&s.getAbsoluteTimestamp().Equals(t.getAbsoluteTimestamp()))return o}},i.findEndTieGraphicalNoteFromNoteWithStartingSlur=function(t,e){if(t)for(var i,n=_createForOfIteratorHelperLoose(this.graphicalVoiceEntries);!(i=n()).done;){var r=i.value;if(r.parentVoiceEntry===t.ParentVoiceEntry)for(var o,s=_createForOfIteratorHelperLoose(r.notes);!(o=s()).done;){var a=o.value,u=a.sourceNote;if(u.NoteTie&&-1!==u.NoteSlurs.indexOf(e))return a}}},i.findGraphicalNoteFromGraceNote=function(t){if(t)for(var e,i=_createForOfIteratorHelperLoose(this.graphicalVoiceEntries);!(e=i()).done;){var n=e.value;if(n.parentVoiceEntry===t.ParentVoiceEntry)for(var r,o=_createForOfIteratorHelperLoose(n.notes);!(r=o()).done;){var s=r.value;if(s.sourceNote===t)return s}}},i.findGraphicalNoteFromNote=function(t){if(t)for(var e,i=_createForOfIteratorHelperLoose(this.graphicalVoiceEntries);!(e=i()).done;){var n=e.value;if(n.parentVoiceEntry===t.ParentVoiceEntry)for(var r,o=_createForOfIteratorHelperLoose(n.notes);!(r=o()).done;){var s=r.value;if(s.sourceNote===t&&this.getAbsoluteTimestamp().Equals(t.getAbsoluteTimestamp()))return s}}},i.getGraphicalNoteDurationFromVoice=function(t){for(var e,i=_createForOfIteratorHelperLoose(this.graphicalVoiceEntries);!(e=i()).done;){var n=e.value;if(n.parentVoiceEntry.ParentVoice===t)return n.notes[0].graphicalNoteLength}return new r.Fraction(0,1)},i.findVoiceEntryGraphicalNotes=function(t){for(var e,i=_createForOfIteratorHelperLoose(this.graphicalVoiceEntries);!(e=i()).done;){var n=e.value;if(n.parentVoiceEntry===t)return n.notes}},i.isVoiceEntryPartOfLinkedVoiceEntry=function(t){if(this.sourceStaffEntry.Link)for(var e=0,i=this.sourceStaffEntry.Link.LinkStaffEntries.length;e0&&(e=s)}return e},i.findStaffEntryMaxNoteLength=function(){for(var t,e=new r.Fraction(0,1),i=_createForOfIteratorHelperLoose(this.graphicalVoiceEntries);!(t=i()).done;)for(var n,o=_createForOfIteratorHelperLoose(t.value.notes);!(n=o()).done;){var s=n.value.graphicalNoteLength;e.lt(s)&&s.GetExpandedNumerator()>0&&(e=s)}return e},i.findOrCreateGraphicalVoiceEntry=function(t){for(var e,i=_createForOfIteratorHelperLoose(this.graphicalVoiceEntries);!(e=i()).done;){var n=e.value;if(n.parentVoiceEntry===t)return n}var r=a.MusicSheetCalculator.symbolFactory.createVoiceEntry(t,this);return this.graphicalVoiceEntries.push(r),r},i.findOrCreateGraphicalVoiceEntryFromGraphicalNote=function(t){for(var e,i=_createForOfIteratorHelperLoose(this.graphicalVoiceEntries);!(e=i()).done;){var n=e.value;if(n===t.parentVoiceEntry)return n}var r=a.MusicSheetCalculator.symbolFactory.createVoiceEntry(t.sourceNote.ParentVoiceEntry,this);return this.graphicalVoiceEntries.push(r),r},i.addGraphicalNoteToListAtCorrectYPosition=function(t,e){var i=t.notes;if(0===i.length||e.PositionAndShape.RelativePosition.y=0;n--){if(i[n].PositionAndShape.RelativePosition.y>e.PositionAndShape.RelativePosition.y){i.splice(n+1,0,e);break}if(0===n){i.splice(0,0,e);break}}},i.hasOnlyRests=function(){for(var t,e=_createForOfIteratorHelperLoose(this.graphicalVoiceEntries);!(t=e()).done;)for(var i,n=_createForOfIteratorHelperLoose(t.value.notes);!(i=n()).done;)if(!i.value.sourceNote.isRest())return!1;return!0},_createClass2(e,[{key:"GraphicalInstructions",get:function(){return this.graphicalInstructions}},{key:"GraphicalTies",get:function(){return this.graphicalTies}},{key:"LyricsEntries",get:function(){return this.lyricsEntries},set:function(t){this.lyricsEntries=t}}]),e}(o.GraphicalObject);e.GraphicalStaffEntry=u},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.StaffLine=void 0;var n=i(5),r=i(6),o=i(47),s=i(4),a=i(126),u=function(t){function e(e,i){var r;return(r=t.call(this)||this).measures=[],r.staffLines=new Array(5),r.octaveShifts=[],r.lyricLines=[],r.lyricsDashes=[],r.abstractExpressions=[],r.graphicalSlurs=[],r.parentMusicSystem=e,r.parentStaff=i,r.boundingBox=new n.BoundingBox(_assertThisInitialized2(r),e.PositionAndShape),r.skyBottomLine=new a.SkyBottomLineCalculator(_assertThisInitialized2(r)),r.staffHeight=r.parentMusicSystem.rules.StaffHeight,r.topLineOffset=0,r.bottomLineOffset=4,r.calculateStaffLineOffsets(),r}_inheritsLoose(e,t);var i=e.prototype;return i.calculateStaffLineOffsets=function(){if(this.ParentStaff.isTab)switch(this.ParentStaff.StafflineCount){case 5:this.staffHeight=this.bottomLineOffset=6*this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight;break;default:this.staffHeight=this.bottomLineOffset=this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight*this.ParentStaff.StafflineCount}else switch(this.ParentStaff.StafflineCount){case 4:this.bottomLineOffset=1;break;case 3:this.topLineOffset=1,this.bottomLineOffset=1;break;case 2:this.topLineOffset=2,this.bottomLineOffset=1;break;case 1:this.topLineOffset=2,this.bottomLineOffset=2}},i.addSlurToStaffline=function(t){this.graphicalSlurs.push(t)},i.addActivitySymbolClickArea=function(){var t=new o.StaffLineActivitySymbol(this),e=this.PositionAndShape;t.PositionAndShape.RelativePosition=new s.PointF2D(e.RelativePosition.x+e.BorderRight+.5,e.RelativePosition.y+.5),t.PositionAndShape.Parent=this.parentMusicSystem.PositionAndShape},i.isPartOfMultiStaffInstrument=function(){return this.parentStaff.ParentInstrument.Staves.length>1},i.findClosestStaffEntry=function(t){for(var e=void 0,i=0,n=this.Measures.length;i0||(s.default.warn("SkyBottomLineCalculator: width not > 0 in measure "+c.MeasureNumber),f=50),n.initializeHeadless(f);var d=n.getContext(),p=n.getCanvas();f=p.width;var m=p.height;h.setY(h.y+100);var v=h.getWidth();h.setWidth(f),c.format(),h.setWidth(v);try{c.draw(d)}catch(e){s.default.warn("SkyBottomLineCalculator.calculateLines.draw",e)}for(var b=d.getImageData(0,0,f,m),g=4,y=Math.max(Math.ceil(c.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),S=new Array(y),_=new Array(y),x=0;x0){S[x]=E;break}}for(var T=m;T>0;T--){var M=T*f*g+x*g;if(b.data[M+3]>0){_[x]=T;break}}}for(var P=0;P=0;i--)if(!isNaN(e[i]))return e[i];return 0},e.findNextValidNumber=function(t,e){if(t>=e.length)return e[t-1];for(var i=t;i=this.BottomLine.length&&(i=this.BottomLine.length-1),n<0&&(n=0),n>=this.BottomLine.length&&(n=this.BottomLine.length),this.SkyLine[i]=t.y;for(var o=i+1;o=this.BottomLine.length&&(i=this.BottomLine.length-1),n<0&&(n=0),n>=this.BottomLine.length&&(n=this.BottomLine.length),this.BottomLine[i]=t.y;for(var o=i+1;o=e?e-1:i},e.getRightIndexForPointX=function(t,e){var i=Math.ceil(t*this.SamplingUnit);return i<0?0:i>=e?e-1:i},e.updateStaffLineBorders=function(){this.mStaffLineParent.PositionAndShape.BorderTop=this.getSkyLineMin(),this.mStaffLineParent.PositionAndShape.BorderMarginTop=this.getSkyLineMin(),this.mStaffLineParent.PositionAndShape.BorderBottom=this.getBottomLineMax(),this.mStaffLineParent.PositionAndShape.BorderMarginBottom=this.getBottomLineMax()},e.getSkyLineMin=function(){return Math.min.apply(Math,this.SkyLine.filter((function(t){return!isNaN(t)})))},e.getSkyLineMinAtPoint=function(t){var e=Math.round(t*this.SamplingUnit);return this.mSkyLine[e]},e.getSkyLineMinInRange=function(t,e){return this.getMinInRange(this.SkyLine,t,e)},e.getBottomLineMax=function(){return Math.max.apply(Math,this.BottomLine.filter((function(t){return!isNaN(t)})))},e.getBottomLineMaxAtPoint=function(t){var e=Math.round(t*this.SamplingUnit);return this.mBottomLine[e]},e.getBottomLineMaxInRange=function(t,e){return this.getMaxInRange(this.BottomLine,t,e)},e.getBottomLineMaxInBoundingBox=function(t){var e=Math.floor(t.AbsolutePosition.x+t.BorderLeft),i=Math.ceil(t.AbsolutePosition.x+t.BorderRight);return this.getMaxInRange(this.mBottomLine,e,i)},e.updateWithBoundingBoxRecursively=function(t){if(t.ChildElements&&t.ChildElements.length>0)this.updateWithBoundingBoxRecursively(t);else{var e=t.BorderTop+t.AbsolutePosition.y,i=t.BorderBottom+t.AbsolutePosition.y;if(e<0){var n=Math.floor(t.AbsolutePosition.x+t.BorderLeft),r=Math.ceil(t.AbsolutePosition.x+t.BorderRight);this.updateInRange(this.mSkyLine,n,r,e)}else if(i>this.StaffLineParent.StaffHeight){var o=Math.floor(t.AbsolutePosition.x+t.BorderLeft),s=Math.ceil(t.AbsolutePosition.x+t.BorderRight);this.updateInRange(this.mBottomLine,o,s,i)}}},e.updateInRange=function(t,e,i,n){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===n&&(n=0),e=Math.floor(e*this.SamplingUnit),(i=Math.ceil(i*this.SamplingUnit))t.length&&(i=t.length);for(var r=e;rMath.abs(t[r])?n:t[r]},e.setInRange=function(t,e,i,n){if(void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===n&&(n=0),e=Math.floor(e*this.SamplingUnit),(i=Math.ceil(i*this.SamplingUnit))t.length&&(i=t.length);for(var r=e;r=t.length&&(e=t.length-1),i<0&&(i=0),i>=t.length&&(i=t.length),e>=0&&i<=t.length?Math.min.apply(Math,t.slice(e,i+1)):void 0):Number.MAX_VALUE},e.getMaxInRange=function(t,e,i){return e=Math.floor(e*this.SamplingUnit),i=Math.ceil(i*this.SamplingUnit),t?(e<0&&(e=0),e>=t.length&&(e=t.length-1),i<0&&(i=0),i>=t.length&&(i=t.length),e>=0&&i<=t.length?Math.max.apply(Math,t.slice(e,i+1)):void 0):Number.MIN_VALUE},_createClass2(t,[{key:"SamplingUnit",get:function(){return this.mRules.SamplingUnit}},{key:"StaffLineParent",get:function(){return this.mStaffLineParent}},{key:"SkyLine",get:function(){return this.mSkyLine}},{key:"BottomLine",get:function(){return this.mBottomLine}}]),t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalChordSymbolContainer=void 0;var n=i(12),r=i(24),o=i(48),s=i(5),a=i(6),u=i(4),l=function(t){function e(e,i,n,r,o,a){var u;return(u=t.call(this)||this).chordSymbolContainer=e,u.boundingBox=new s.BoundingBox(_assertThisInitialized2(u),i),u.rules=a,u.calculateLabel(n,o,r),u}return _inheritsLoose(e,t),e.prototype.calculateLabel=function(t,e,i){var s=o.ChordSymbolContainer.calculateChordText(this.chordSymbolContainer,e,i);this.graphicalLabel=new r.GraphicalLabel(new n.Label(s),t,this.rules.ChordSymbolTextAlignment,this.rules,this.boundingBox),this.graphicalLabel.PositionAndShape.RelativePosition=new u.PointF2D(this.rules.ChordSymbolRelativeXOffset,0)},_createClass2(e,[{key:"GetChordSymbolContainer",get:function(){return this.chordSymbolContainer}},{key:"GraphicalLabel",get:function(){return this.graphicalLabel}}]),e}(a.GraphicalObject);e.GraphicalChordSymbolContainer=l},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalTie=void 0,e.GraphicalTie=function(){function t(t,e,i){this.tie=t,this.startNote=e,this.endNote=i}return _createClass2(t,[{key:"GetTie",get:function(){return this.tie}},{key:"StartNote",get:function(){return this.startNote},set:function(t){this.startNote=t}},{key:"Tie",get:function(){return this.tie}},{key:"EndNote",get:function(){return this.endNote},set:function(t){this.endNote=t}}]),t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalLyricEntry=void 0;var n=i(24),r=i(12),o=i(4),s=i(9);e.GraphicalLyricEntry=function(){function t(t,e,i,a){this.lyricsEntry=t,this.graphicalStaffEntry=e;var u=e.parentMeasure.parentSourceMeasure.Rules.LyricsAlignmentStandard;t.Text.length>=4&&t.Parent.Notes[0].Length.Denominator>4&&s.TextAlignmentEnum.LeftBottom;var l=new r.Label(t.Text);this.graphicalLabel=new n.GraphicalLabel(l,i,u,this.graphicalStaffEntry.parentMeasure.parentSourceMeasure.Rules,e.PositionAndShape),this.graphicalLabel.PositionAndShape.RelativePosition=new o.PointF2D(0,a),u===s.TextAlignmentEnum.LeftBottom&&(this.graphicalLabel.PositionAndShape.RelativePosition.x-=1)}return _createClass2(t,[{key:"LyricsEntry",get:function(){return this.lyricsEntry}},{key:"ParentLyricWord",get:function(){return this.graphicalLyricWord},set:function(t){this.graphicalLyricWord=t}},{key:"GraphicalLabel",get:function(){return this.graphicalLabel},set:function(t){this.graphicalLabel=t}},{key:"StaffEntryParent",get:function(){return this.graphicalStaffEntry},set:function(t){this.graphicalStaffEntry=t}}]),t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalLyricWord=void 0,e.GraphicalLyricWord=function(){function t(t){this.graphicalLyricsEntries=[],this.lyricWord=t,this.initialize()}var e=t.prototype;return e.isFilled=function(){for(var t=0;tn.RealValue?1:n.RealValue>i.RealValue?-1:0};var i=e.prototype;return i.calculateCurve=function(t){var e=this.staffEntries[0],i=this.staffEntries[this.staffEntries.length-1],r=e.findGraphicalNoteFromNote(this.slur.StartNote);!r&&this.graceStart&&(r=e.findGraphicalNoteFromGraceNote(this.slur.StartNote)),r||(r=e.findEndTieGraphicalNoteFromNoteWithStartingSlur(this.slur.StartNote,this.slur));var a=i.findGraphicalNoteFromNote(this.slur.EndNote);!a&&this.graceEnd&&(a=i.findGraphicalNoteFromGraceNote(this.slur.EndNote));var u=e.parentMeasure.ParentStaffLine,l=u.SkyBottomLineCalculator;this.calculatePlacement(l,u);var c,h=this.calculateStartAndEnd(r,a,u,t,l),f=h.startX,d=h.endX,p=h.startY,m=h.endY,v=t.SlurTangentMinAngle,b=t.SlurTangentMaxAngle;if(this.placement===o.PlacementEnum.Above){p-=t.SlurNoteHeadYOffset,m-=t.SlurNoteHeadYOffset;var g=new n.PointF2D(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,p);r?g.x+=this.staffEntries[0].PositionAndShape.BorderRight:g.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(g.x+=i.PositionAndShape.RelativePosition.x);var y=new n.PointF2D(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,m);if(a?y.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:y.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(y.x+=i.staffEntryParent.PositionAndShape.RelativePosition.x),0===(c=this.calculateTopPoints(g,y,u,l)).length){var S=new n.PointF2D((y.x-g.x)/2+g.x,(y.y-g.y)/2+g.y);c.push(S)}var _=Math.atan((m-p)/(d-f)),x=new n.PointF2D(0,0),E=new n.PointF2D(d-f,-(m-p)),w=s.Matrix2D.getRotationMatrix(_),T=w.getTransposeMatrix();E=w.vectorMultiplication(E);var M=this.calculateTranslatedAndRotatedPointListAbove(c,f,p,w),P=this.calculateMaxLeftSlope(M,x,E),L=this.calculateMaxRightSlope(M,x,E),I=x.y-x.x*P,A=E.y-E.x*L,C=new n.PointF2D,R=!1;Math.abs(Math.abs(P)-Math.abs(L))<1e-4?(C.x=E.x/2,C.y=0,R=!0):(C.x=(A-I)/(P-L),C.y=P*C.x+I);var N=this.calculateHeightWidthRatio(E.x,M),k=0,F=0,O=v,B=-v;if(!R){var D=this.calculateAngles(v,P,L,b);O=D.startAngle,B=D.endAngle}var V=this.calculateControlPoints(E.x,O,B,M,N),G=V.startControlPoint,W=V.endControlPoint;(G=T.vectorMultiplication(G)).x+=f,G.y=-G.y+p,(W=T.vectorMultiplication(W)).x+=f,W.y=-W.y+p,this.bezierStartPt=new n.PointF2D(f,p-k),this.bezierStartControlPt=new n.PointF2D(G.x,G.y-k),this.bezierEndControlPt=new n.PointF2D(W.x,W.y-F),this.bezierEndPt=new n.PointF2D(d,m-F);for(var H=u.SkyLine.length,U=l.getLeftIndexForPointX(this.bezierStartPt.x,H),z=l.getLeftIndexForPointX(this.bezierEndPt.x,H),j=this.bezierEndPt.x-this.bezierStartPt.x,X=l.SamplingUnit,Y=U;Y=U&&(u.SkyLine[J]=Math.min(u.SkyLine[J],q.y)),++J=xt&&(u.BottomLine[It]=Math.max(u.BottomLine[It],Lt.y)),++It<_t&&(u.BottomLine[It]=Math.max(u.BottomLine[It],Lt.y))}}},i.calculateStartAndEnd=function(t,e,i,n,r){var s=0,a=0,u=0,c=0;if(t){s=t.PositionAndShape.RelativePosition.x+t.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+t.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x,this.graceStart&&(s+=t.parentVoiceEntry.parentStaffEntry.staffEntryParent.PositionAndShape.RelativePosition.x);var h=t.parentVoiceEntry;a=this.placement===o.PlacementEnum.Above?h.PositionAndShape.RelativePosition.y+h.PositionAndShape.BorderTop:h.PositionAndShape.RelativePosition.y+h.PositionAndShape.BorderBottom,h.parentVoiceEntry.StemDirection===l.StemDirectionType.Down&&this.placement===o.PlacementEnum.Below&&(s-=.5),h.parentVoiceEntry.StemDirection===l.StemDirectionType.Up&&this.placement===o.PlacementEnum.Above&&(s+=.5)}else s=i.Measures[0].beginInstructionsWidth;if(e){u=e.PositionAndShape.RelativePosition.x+e.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+e.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x,this.graceEnd&&(u+=e.parentVoiceEntry.parentStaffEntry.staffEntryParent.PositionAndShape.RelativePosition.x);var f=e.parentVoiceEntry;c=this.placement===o.PlacementEnum.Above?f.PositionAndShape.RelativePosition.y+f.PositionAndShape.BorderTop:f.PositionAndShape.RelativePosition.y+f.PositionAndShape.BorderBottom,f.parentVoiceEntry.StemDirection===l.StemDirectionType.Down&&this.placement===o.PlacementEnum.Below&&(u-=.5),f.parentVoiceEntry.StemDirection===l.StemDirectionType.Up&&this.placement===o.PlacementEnum.Above&&(u+=.5)}else u=i.PositionAndShape.Size.width;return t||e||(a=0,c=0),t||(a=c),e||(c=a),this.slur.startNoteHasMoreStartingSlurs()&&this.slur.isSlurLonger()&&(this.placement===o.PlacementEnum.Above?a-=n.SlursStartingAtSameStaffEntryYOffset:a+=n.SlursStartingAtSameStaffEntryYOffset),this.slur.endNoteHasMoreEndingSlurs()&&this.slur.isSlurLonger()&&(this.placement===o.PlacementEnum.Above?c-=n.SlursStartingAtSameStaffEntryYOffset:c+=n.SlursStartingAtSameStaffEntryYOffset),this.placement===o.PlacementEnum.Above?(a=Math.min(a,1.5),c=Math.min(c,1.5)):(a=Math.max(a,i.StaffHeight-1.5),c=Math.max(c,i.StaffHeight-1.5)),{startX:s,startY:a,endX:u,endY:c}},i.calculatePlacement=function(t,e){if(this.rules.SlurPlacementFromXML)this.placement=this.slur.PlacementXml;else{for(var i=0,n=this.staffEntries.length;i0)return void(this.placement=o.PlacementEnum.Above);var u=this.staffEntries[0],c=this.staffEntries[this.staffEntries.length-1],h=u.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection;if(h===c.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection)this.placement=h===l.StemDirectionType.Up?o.PlacementEnum.Below:o.PlacementEnum.Above;else{var f=u.PositionAndShape.BorderLeft+u.PositionAndShape.RelativePosition.x+u.parentMeasure.PositionAndShape.RelativePosition.x,d=c.PositionAndShape.BorderRight+c.PositionAndShape.RelativePosition.x+c.parentMeasure.PositionAndShape.RelativePosition.x;this.graceStart&&(f+=c.PositionAndShape.RelativePosition.x),this.graceEnd&&(d+=c.staffEntryParent.PositionAndShape.RelativePosition.x);var p=-1*t.getSkyLineMinInRange(f,d),m=t.getBottomLineMaxInRange(f,d)-e.StaffHeight;this.placement=m>p?o.PlacementEnum.Above:o.PlacementEnum.Below}}},i.calculateTopPoints=function(t,e,i,r){var o=[],s=r.getRightIndexForPointX(t.x,i.SkyLine.length),a=r.getLeftIndexForPointX(e.x,i.SkyLine.length);s<0&&(s=0),a>=i.SkyLine.length&&(a=i.SkyLine.length-1);for(var u=s;u=i.BottomLine.length&&(a=i.BottomLine.length-1);for(var u=s;ul&&t>c&&(u+=t/70*this.rules.SlurHeightFlattenLongSlursFactorByWidth,a/=u*=1+i/30*this.rules.SlurHeightFlattenLongSlursFactorByAngle);var h=Math.min(.5,Math.max(.1,1.7*i/80*a*Math.pow(Math.max(s,.05),.4))),f=Math.min(.5,Math.max(.1,1.7*-r/80*a*Math.pow(Math.max(s,.05),.4))),d=new n.PointF2D;d.x=t*h*Math.cos(i*e.degreesToRadiansFactor),d.y=t*h*Math.sin(i*e.degreesToRadiansFactor);var p=new n.PointF2D;return p.x=t-t*f*Math.cos(r*e.degreesToRadiansFactor),p.y=-t*f*Math.sin(r*e.degreesToRadiansFactor),{startControlPoint:d,endControlPoint:p}},i.calculateAngles=function(t,i,n,r){var o=Math.atan(i)/e.degreesToRadiansFactor;i>0?o+=20:o-=20;var s=Math.atan(n)/e.degreesToRadiansFactor;return n<0?s-=20:s+=20,{startAngle:Math.min(Math.max(t,o),r),endAngle:Math.max(Math.min(-t,s),-r)}},e}(r.GraphicalCurve);e.GraphicalSlur=c,c.degreesToRadiansFactor=Math.PI/180},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalCurve=void 0;var n=i(4),r=function(){function t(){t.tPow3=new Array(t.bezierCurveStepSize),t.oneMinusTPow3=new Array(t.bezierCurveStepSize),t.bezierFactorOne=new Array(t.bezierCurveStepSize),t.bezierFactorTwo=new Array(t.bezierCurveStepSize);for(var e=0;e=t.bezierCurveStepSize?new n.PointF2D:new n.PointF2D(t.oneMinusTPow3[i]*this.bezierStartPt.x+t.bezierFactorOne[i]*this.bezierStartControlPt.x+t.bezierFactorTwo[i]*this.bezierEndControlPt.x+t.tPow3[i]*this.bezierEndPt.x,t.oneMinusTPow3[i]*this.bezierStartPt.y+t.bezierFactorOne[i]*this.bezierStartControlPt.y+t.bezierFactorTwo[i]*this.bezierEndControlPt.y+t.tPow3[i]*this.bezierEndPt.y)},t}();e.GraphicalCurve=r,r.bezierCurveStepSize=1e3},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Matrix2D=void 0;var n=i(4),r=function(){function t(){this.matrix=[];for(var t=0;t<2;t++){this.matrix[t]=[];for(var e=0;e<2;e++)this.matrix[t][e]=0}}t.getRotationMatrix=function(e){var i=new t,n=Math.cos(e),r=Math.sin(e);return i.matrix[0][0]=n,i.matrix[0][1]=-r,i.matrix[1][0]=r,i.matrix[1][1]=n,i};var e=t.prototype;return e.scalarMultiplication=function(t){for(var e=0;e<2;e++)for(var i=0;i<2;i++)this.matrix[e][i]*=t},e.getTransposeMatrix=function(){for(var e=new t,i=0;i<2;i++)for(var n=0;n<2;n++)e.matrix[i][n]=this.matrix[n][i];return e},e.vectorMultiplication=function(t){var e=new n.PointF2D;return e.x=t.x*this.matrix[0][0]+t.y*this.matrix[0][1],e.y=t.x*this.matrix[1][0]+t.y*this.matrix[1][1],e},t}();e.Matrix2D=r},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MusicSheetReader=void 0;var r=i(135),o=i(106),s=i(0),a=i(139),u=i(73),l=i(20),c=i(11),h=n(i(1)),f=i(19),d=i(19),p=i(31),m=i(74),v=i(150),b=i(7),g=i(12),y=i(151),S=i(26),_=i(154),x=function(){function t(t,e){void 0===e&&(e=new S.EngravingRules),this.completeNumberOfStaves=0,this.pluginManager=new _.ReaderPluginManager,this.afterSheetReadingModules=t||[],this.repetitionInstructionReader=y.MusicSymbolModuleFactory.createRepetitionInstructionReader(),this.repetitionCalculator=y.MusicSymbolModuleFactory.createRepetitionCalculator(),this.rules=e}t.doCalculationsAfterDurationHasBeenSet=function(t){for(var e,i=_createForOfIteratorHelperLoose(t);!(e=i()).done;)e.value.doCalculationsAfterDurationHasBeenSet()};var e=t.prototype;return e.createMusicSheet=function(t,e){try{return this._createMusicSheet(t,e)}catch(t){return void h.default.error("MusicSheetReader.CreateMusicSheet",t)}},e._removeFromArray=function(t,e){var i=t.indexOf(e);-1!==i&&t.splice(i,1)},e.trimString=function(t){return t.replace(/^\s+|\s+$/g,"")},e._lastElement=function(t){return t[t.length-1]},e._createMusicSheet=function(e,i){var n=[],a=0;if(this.musicSheet=new r.MusicSheet,this.musicSheet.Path=i,this.musicSheet.Rules=this.rules,!e)throw new c.MusicSheetReadingException("Undefined root element");this.pushSheetLabels(e,i);var u=e.element("part-list");if(!u)throw new c.MusicSheetReadingException("Undefined partListNode");var h=e.elements("part"),f=u.elements();this.initializeReading(f,h,n);var d=!0;this.currentFraction=new s.Fraction(0,1);var p=!1,m=e.element("identification");for(m&&(m=m.element("encoding")),m&&(m=m.element("software")),void 0!==m&&"Guitar Pro 5"===m.value&&(p=!0);d;){void 0!==this.currentMeasure&&this.currentMeasure.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(a=0),this.currentMeasure=new o.SourceMeasure(this.completeNumberOfStaves,this.musicSheet.Rules);for(var v,b=_createForOfIteratorHelperLoose(n);!(v=b()).done;){var g=v.value;try{d=d&&g.readNextXmlMeasure(this.currentMeasure,this.currentFraction,p)}catch(e){var y=l.ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading instruments.");throw new c.MusicSheetReadingException(y,e)}}d&&(this.musicSheet.addMeasure(this.currentMeasure),this.checkIfRhythmInstructionsAreSetAndEqual(n),this.checkSourceMeasureForNullEntries(),a=this.setSourceMeasureDuration(n,a),t.doCalculationsAfterDurationHasBeenSet(n),this.currentMeasure.AbsoluteTimestamp=this.currentFraction.clone(),this.musicSheet.SheetErrors.finalizeMeasure(this.currentMeasure.MeasureNumber),this.currentFraction.Add(this.currentMeasure.Duration),this.previousMeasure=this.currentMeasure)}this.repetitionInstructionReader&&(this.repetitionInstructionReader.removeRedundantInstructions(),this.repetitionCalculator&&this.repetitionCalculator.calculateRepetitions(this.musicSheet,this.repetitionInstructionReader.repetitionInstructions)),this.musicSheet.checkForInstrumentWithNoVoice(),this.musicSheet.fillStaffList();for(var S=0,_=this.afterSheetReadingModules.length;S<_;++S)this.afterSheetReadingModules[S].calculate(this.musicSheet);return this.musicSheet.userStartTempoInBPM=this.musicSheet.userStartTempoInBPM||this.musicSheet.DefaultStartTempoInBpm,this.musicSheet},e.initializeReading=function(t,e,i){var n=this.createInstrumentGroups(t);this.completeNumberOfStaves=this.getCompleteNumberOfStavesFromXml(e),0!==e.length&&(this.repetitionInstructionReader.MusicSheet=this.musicSheet,this.currentFraction=new s.Fraction(0,1),this.currentMeasure=void 0,this.previousMeasure=void 0);for(var r,o=0,u=_createForOfIteratorHelperLoose(e);!(r=u()).done;){var c=r.value,h=c.attribute("id");if(h){var f=n[h.value],d=c.elements("measure"),p=1;try{p=this.getInstrumentNumberOfStavesFromXml(c)}catch(t){var m=l.ITextTranslation.translateText("ReaderErrorMessages/InstrumentStavesNumberError","Invalid number of staves at instrument: ");this.musicSheet.SheetErrors.push(m+f.Name);continue}f.createStaves(p),i.push(new a.InstrumentReader(this.pluginManager,this.repetitionInstructionReader,d,f)),this.repetitionInstructionReader&&(this.repetitionInstructionReader.xmlMeasureList[o]=d),o++}}},e.checkIfRhythmInstructionsAreSetAndEqual=function(t){for(var e=[],i=0;ir){if(this.areRhythmInstructionsMixed(e)&&l.SymbolEnum!==d.RhythmSymbolEnum.NONE)continue;r=l.Rhythm.RealValue,o=e.indexOf(l)}}if(e.length>0&&e.lengtht.Denominator){var i=e.Denominator/t.Denominator;t.expand(i)}},e.checkIfMeasureIsImplicit=function(t,e){return!(this.previousMeasure||!t.lt(e))||!!this.previousMeasure&&s.Fraction.plus(this.previousMeasure.Duration,t).Equals(e)},e.allInstrumentsHaveSameDuration=function(t,e){for(var i=0,n=0,r=t.length;n=0;t--)for(var e=this.currentMeasure.VerticalSourceStaffEntryContainers[t].StaffEntries.length-1;e>=0;e--){var i=this.currentMeasure.VerticalSourceStaffEntryContainers[t].StaffEntries[e];if(i)for(var n=i.VoiceEntries.length-1;n>=0;n--){var r=i.VoiceEntries[n];0===r.Notes.length&&(this._removeFromArray(r.ParentVoice.VoiceEntries,r),this._removeFromArray(i.VoiceEntries,r))}void 0!==i&&0===i.VoiceEntries.length&&(this.currentMeasure.VerticalSourceStaffEntryContainers[t].StaffEntries[e]=void 0)}for(var o=this.currentMeasure.VerticalSourceStaffEntryContainers.length-1;o>=0;o--){for(var s=0,a=0,u=this.currentMeasure.VerticalSourceStaffEntryContainers[o].StaffEntries.length;an){if(!this.musicSheet.Title){var y=d.attribute("font-size").value,S=parseFloat(y);r0&&d.MidiInstrumentId!==b.MidiInstrument.Percussion&&(E.midiInstrumentID=Math.max(0,parseInt(A.value,10)-1));else if("midi-unpitched"===A.name)E.fixedKey=Math.max(0,parseInt(A.value,10));else if("volume"===A.name)try{var C=parseFloat(A.value);E.volume=C/127}catch(t){h.default.debug("ExpressionReader.readExpressionParameters","read volume",t)}else if("pan"===A.name)try{var R=parseFloat(A.value);E.pan=R/64}catch(t){h.default.debug("ExpressionReader.readExpressionParameters","read pan",t)}}catch(t){h.default.info("MusicSheetReader.createInstrumentGroups midi settings: ",t)}}}}catch(t){h.default.info("MusicSheetReader.createInstrumentGroups: ",t)}}if(0===d.SubInstruments.length){var N=new v.SubInstrument(d);d.SubInstruments.push(N)}n[f]=d,e?(e.InstrumentalGroups.push(d),this.musicSheet.Instruments.push(d)):(this.musicSheet.InstrumentalGroups.push(d),this.musicSheet.Instruments.push(d))}else if("part-group"===a.name&&"start"===a.attribute("type").value){var k=new m.InstrumentalGroup("group",this.musicSheet,e);e?e.InstrumentalGroups.push(k):this.musicSheet.InstrumentalGroups.push(k),e=k}else if("part-group"===a.name&&"stop"===a.attribute("type").value&&e){if(1===e.InstrumentalGroups.length){var F=e.InstrumentalGroups[0];e.Parent?(e.Parent.InstrumentalGroups.push(F),this._removeFromArray(e.Parent.InstrumentalGroups,e)):(this.musicSheet.InstrumentalGroups.push(F),this._removeFromArray(this.musicSheet.InstrumentalGroups,e))}e=e.Parent}}}catch(t){var O=l.ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading Instruments");throw new c.MusicSheetReadingException(O,t)}for(var B=0,D=this.musicSheet.Instruments.length;B0){var o=r[0];if(o){var s=o.element("attributes");s&&(s=s.element("staves")),s?i+=parseInt(s.value,10):i++}}}if(isNaN(i)||i<=0){var a=l.ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of staves.");throw new c.MusicSheetReadingException(a)}return i},e.getInstrumentNumberOfStavesFromXml=function(t){var e=0,i=t.element("measure");if(i){var n=i.element("attributes"),r=void 0;n&&(r=n.element("staves")),e=n&&r?parseInt(r.value,10):1}if(isNaN(e)||e<=0){var o=l.ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of Staves.");throw new c.MusicSheetReadingException(o)}return e},_createClass2(t,[{key:"PluginManager",get:function(){return this.pluginManager}},{key:"CompleteNumberOfStaves",get:function(){return this.completeNumberOfStaves}}]),t}();e.MusicSheetReader=x},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MusicSheet=e.PlaybackSettings=void 0;var r=i(0),o=i(166),s=i(136),a=i(12),u=i(51),l=i(138),c=i(26),h=i(22),f=n(i(1)),d=function(){};e.PlaybackSettings=d;var p=function(){function e(){this.idString="random idString, not initialized",this.sourceMeasures=[],this.repetitions=[],this.dynListStaves=[],this.timestampSortedDynamicExpressionsList=[],this.timestampSortedTempoExpressionsList=[],this.instrumentalGroups=[],this.instruments=[],this.musicPartManager=void 0,this.musicSheetErrors=new l.MusicSheetErrors,this.staves=[],this.transpose=0,this.defaultStartTempoInBpm=0,this.drawErroneousMeasures=!1,this.hasBeenOpenedForTheFirstTime=!1,this.currentEnrolledPosition=new r.Fraction(0,1),this.playbackSettings=new d,this.playbackSettings.rhythm=new r.Fraction(4,4,0,!1),this.userStartTempoInBPM=100,this.pageWidth=120,this.MusicPartManager=new o.MusicPartManager(this),this.hasBPMInfo=!1}e.getIndexFromStaff=function(t){return t.idInMusicSheet};var i=e.prototype;return i.InitializeStartTempoInBPM=function(t){this.userStartTempoInBPM=t},i.addMeasure=function(t){this.sourceMeasures.push(t),t.measureListIndex=this.sourceMeasures.length-1},i.checkForInstrumentWithNoVoice=function(){for(var t=0,e=this.instruments.length;t0){var t=this.TimestampSortedTempoExpressionsList[0];if(t.InstantaneousTempo)return t.InstantaneousTempo.TempoInBpm;if(t.ContinuousTempo)return t.ContinuousTempo.StartTempo}return this.userStartTempoInBPM},i.getEnrolledSelectionStartTimeStampWorkaround=function(){var t=this.MusicPartManager.getIterator(this.SelectionStart);return r.Fraction.createFromFraction(t.CurrentEnrolledTimestamp)},i.getSourceMeasureFromTimeStamp=function(t){for(var e=0,i=this.sourceMeasures.length;e0&&n.Voices[0].Visible&&t.push(n)}return t},_createClass2(e,[{key:"SourceMeasures",get:function(){return this.sourceMeasures},set:function(t){this.sourceMeasures=t}},{key:"Repetitions",get:function(){return this.repetitions},set:function(t){this.repetitions=t}},{key:"DynListStaves",get:function(){return this.dynListStaves}},{key:"TimestampSortedTempoExpressionsList",get:function(){return this.timestampSortedTempoExpressionsList}},{key:"TimestampSortedDynamicExpressionsList",get:function(){return this.timestampSortedDynamicExpressionsList}},{key:"InstrumentalGroups",get:function(){return this.instrumentalGroups}},{key:"Parts",get:function(){return this.instruments}},{key:"Instruments",get:function(){return this.instruments}},{key:"SheetPlaybackSetting",get:function(){return this.playbackSettings},set:function(t){this.playbackSettings=t}},{key:"DrawErroneousMeasures",get:function(){return this.drawErroneousMeasures},set:function(t){this.drawErroneousMeasures=t}},{key:"HasBeenOpenedForTheFirstTime",get:function(){return this.hasBeenOpenedForTheFirstTime},set:function(t){this.hasBeenOpenedForTheFirstTime=t}},{key:"DefaultStartTempoInBpm",get:function(){return this.defaultStartTempoInBpm},set:function(t){this.defaultStartTempoInBpm=t,this.InitializeStartTempoInBPM(t)}},{key:"Path",get:function(){return this.path},set:function(t){this.path=t}},{key:"Staves",get:function(){return this.staves}},{key:"TitleString",get:function(){return this.title?this.title.text:""},set:function(t){this.Title=new a.Label(t)}},{key:"SubtitleString",get:function(){return this.subtitle?this.subtitle.text:""},set:function(t){this.Subtitle=new a.Label(t)}},{key:"ComposerString",get:function(){return this.composer?this.composer.text:""},set:function(t){this.Composer=new a.Label(t)}},{key:"LyricistString",get:function(){return this.lyricist?this.lyricist.text:""},set:function(t){this.Lyricist=new a.Label(t)}},{key:"Title",get:function(){return this.title},set:function(t){this.title=t}},{key:"Subtitle",get:function(){return this.subtitle},set:function(t){this.subtitle=t}},{key:"Composer",get:function(){return this.composer},set:function(t){this.composer=t}},{key:"Lyricist",get:function(){return this.lyricist},set:function(t){this.lyricist=t}},{key:"Rules",get:function(){return this.rules||(f.default.debug("warning: sheet.Rules was undefined. Creating new EngravingRules."),this.rules=new c.EngravingRules),this.rules},set:function(t){this.rules=t}},{key:"SheetErrors",get:function(){return this.musicSheetErrors}},{key:"SelectionStart",get:function(){return this.selectionStart},set:function(t){this.selectionStart=t.clone(),this.currentEnrolledPosition=t.clone()}},{key:"SelectionEnd",get:function(){return this.selectionEnd},set:function(t){this.selectionEnd=t}},{key:"HasBPMInfo",get:function(){return this.hasBPMInfo},set:function(t){this.hasBPMInfo=t}},{key:"MusicPartManager",get:function(){return this.musicPartManager},set:function(t){this.musicPartManager=t}},{key:"Errors",get:function(){return this.musicSheetErrors.measureErrors}},{key:"FirstMeasureNumber",get:function(){try{return this.getFirstSourceMeasure().MeasureNumber}catch(t){return f.default.info("MusicSheet.FirstMeasureNumber: ",t),0}}},{key:"LastMeasureNumber",get:function(){try{return this.getLastSourceMeasure().MeasureNumber}catch(t){return f.default.info("MusicSheet.LastMeasureNumber: ",t),0}}},{key:"CurrentEnrolledPosition",get:function(){return this.currentEnrolledPosition.clone()},set:function(t){this.currentEnrolledPosition=t.clone()}},{key:"Transpose",get:function(){return this.transpose},set:function(t){this.transpose=t}},{key:"FullNameString",get:function(){return this.ComposerString+" "+this.TitleString}},{key:"IdString",get:function(){return this.idString},set:function(t){this.idString=t}},{key:"SheetEndTimestamp",get:function(){var t=this.getLastSourceMeasure();return r.Fraction.plus(t.AbsoluteTimestamp,t.Duration)}}]),e}();e.MusicSheet=p,p.defaultTitle="[no title given]"},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.RepetitionEndingPart=e.Repetition=void 0;var r=i(137),o=i(0),s=i(81),a=n(i(1)),u=function(t){function e(e,i){var n;return(n=t.call(this,e)||this).backwardJumpInstructions=[],n.endingParts=[],n.endingIndexDict={},n.userNumberOfRepetitions=0,n.visibles=[],n.fromWords=!1,n.repetitonIterationOrder=[],n.numberOfEndings=1,n.musicSheet2=e,n.virtualOverallRepetition=i,n}_inheritsLoose(e,t);var i=e.prototype;return i.getForwardJumpTargetForIteration=function(t){var e=this.repetitonIterationOrder[t-1];return this.endingIndexDict[e]?this.endingIndexDict[e].part.StartIndex:-1},i.getBackwardJumpTarget=function(){return this.startMarker.measureIndex},i.SetEndingStartIndex=function(t,e){var i=new l(new r.SourceMusicPart(this.musicSheet2,e,e));this.endingParts.push(i);for(var n,o=_createForOfIteratorHelperLoose(t);!(n=o()).done;){var s=n.value;try{this.endingIndexDict[s]=i,i.endingIndices.push(s),this.numberOfEndings=this.xmlMeasureList.length)return!1;this.currentMeasure=t,this.inSourceMeasureInstrumentIndex=this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument),this.repetitionInstructionReader&&this.repetitionInstructionReader.prepareReadingMeasure(t,this.currentXmlMeasureIndex);var s=new l.Fraction(0,1),a=new l.Fraction(0,1),u=!1;this.maxTieNoteFraction=new l.Fraction(0,1);var f=!1;try{var d,p=this.xmlMeasureList[this.currentXmlMeasureIndex],v=p.elements();if(t.Rules.UseXMLMeasureNumbers&&!Number.isInteger(t.MeasureNumberXML)){var g=parseInt(null===(n=p.attribute("number"))||void 0===n?void 0:n.value,10);Number.isInteger(g)&&(t.MeasureNumberXML=g)}for(var y=0;y0&&(d=v[y-1]),"print"===E.name){var w=E.attribute("new-system");"yes"===(null==w?void 0:w.value)&&(t.printNewSystemXml=!0);var T=E.attribute("new-page");"yes"===(null==T?void 0:T.value)&&(t.printNewPageXml=!0)}else if("note"===E.name){var M=!0;"no"===(null===(r=E.attribute("print-object"))||void 0===r?void 0:r.value)&&(M=!1);var P=1;this.instrument.Staves.length>1&&E.element("staff")&&(P=parseInt(E.element("staff").value,10),isNaN(P)&&(m.default.debug("InstrumentReader.readNextXmlMeasure.get staff number"),P=1)),this.currentStaff=this.instrument.Staves[P-1];var L=void 0!==E.element("chord");if(E.element("voice")){var I=parseInt(E.element("voice").value,10);this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(I,P-1)}else L&&this.currentVoiceGenerator||(this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(1,P-1));var A=0,C=new l.Fraction(0,1),R=2,N=void 0,k=!1;if(E.element("duration")){if(A=parseInt(E.element("duration").value,10),isNaN(A)){var F=c.ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid Note Duration.");this.musicSheet.SheetErrors.pushMeasureError(F),m.default.debug("InstrumentReader.readNextXmlMeasure",F);continue}if(C=new l.Fraction(A,4*this.divisions),0===A?C=this.getNoteDurationFromTypeNode(E):N=this.getNoteDurationFromTypeNode(E),E.element("time-modification")){C=this.getNoteDurationForTuplet(E);var O=E.element("time-modification");(null==O?void 0:O.element("normal-notes"))&&(R=parseInt(O.element("normal-notes").value,10)),k=!0}}var B=void 0!==E.element("rest"),D=E.element("notations"),V=void 0!==E.element("grace")||0===A||L&&f,G=!1,W=!1;if(V){var H=E.element("grace");H&&H.attributes()&&H.attribute("slash")&&"yes"===H.attribute("slash").value&&(G=!0),C=this.getNoteDurationFromTypeNode(E);var U=E.element("notations");U&&U.element("slur")&&(W=!0)}var z=!1;E.element("cue")&&(z=!0);var j=E.element("type"),X=_.NoteType.UNDEFINED;if(j){var Y=j.attribute("size");"cue"===(null==Y?void 0:Y.value)&&(z=!0),X=_.NoteTypeHandler.StringToNoteType(j.value)}var K=void 0,q=S.StemDirectionType.Undefined,J=E.element("stem");if(J){switch(J.value){case"down":q=S.StemDirectionType.Down;break;case"up":q=S.StemDirectionType.Up;break;case"double":q=S.StemDirectionType.Double;break;case"none":q=S.StemDirectionType.None;break;default:q=S.StemDirectionType.Undefined}var Z=J.attribute("color");Z&&(K=this.parseXmlColor(Z.value))}var Q=void 0,$=0,tt=!1;if(D){var et=D.element("ornaments");if(et){var it=et.element("tremolo");if(it){var nt=it.attribute("type");if(nt&&"single"===nt.value){var rt=parseInt(it.value,10);rt>0&&($=rt)}}var ot=et.element("wavy-line");if(void 0!==ot){var st=ot.attribute("type");st&&"start"===st.value&&(tt=!0)}}}var at=E.element("notehead");if(at){var ut=at.attribute("color");ut&&(Q=this.parseXmlColor(ut.value))}var lt=void 0,ct=E.attribute("color");ct&&(lt=this.parseXmlColor(ct.value),Q||(Q=lt),K||(K=lt));var ht=s.clone();L&&(ht=a.clone()),this.currentStaffEntry=this.currentMeasure.findOrCreateStaffEntry(ht,this.inSourceMeasureInstrumentIndex+P-1,this.currentStaff).staffEntry,(!this.currentVoiceGenerator.hasVoiceEntry()||!L&&!V&&!f||V&&!f||V&&!L||!V&&f)&&this.currentVoiceGenerator.createVoiceEntry(ht,this.currentStaffEntry,!B&&!V,V,G,W),V||L||(a=s.clone(),s.Add(C)),L&&void 0!==this.currentStaffEntry&&this.currentStaffEntry.ParentStaff!==this.currentStaff&&(this.currentStaffEntry=this.currentVoiceGenerator.checkForStaffEntryLink(this.inSourceMeasureInstrumentIndex+P-1,this.currentStaff,this.currentStaffEntry,this.currentMeasure));var ft=void 0!==this.currentStaffEntry&&void 0!==this.currentStaffEntry.Timestamp&&this.currentStaffEntry.Timestamp.Equals(new l.Fraction(0,1))&&!this.currentStaffEntry.hasNotes();if(this.saveAbstractInstructionList(this.instrument.Staves.length,ft),0!==this.openChordSymbolContainers.length&&(this.currentStaffEntry.ChordContainers=this.openChordSymbolContainers,this.openChordSymbolContainers=[]),this.activeRhythm,k||V||(C=new l.Fraction(A,4*this.divisions)),this.currentVoiceGenerator.read(E,C,N,X,R,B,this.currentStaffEntry,this.currentMeasure,e,this.maxTieNoteFraction,L,i,M,z,V,q,$,K,Q,tt),void 0!==D&&D.element("dynamics")){var dt=this.expressionReaders[this.readExpressionStaffNumber(E)-1];dt&&(dt.readExpressionParameters(E,this.instrument,this.divisions,s,a,this.currentMeasure.MeasureNumber,!1),dt.read(E,this.currentMeasure,a))}f=V}else if("attributes"===E.name){var pt=E.element("divisions");if(pt&&(this.divisions=parseInt(pt.value,10),isNaN(this.divisions))){var mt=c.ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(m.default.debug("InstrumentReader.readNextXmlMeasure",mt),this.divisions=this.readDivisionsFromNotes(),!(this.divisions>0))throw u=!0,new h.MusicSheetReadingException(mt+this.instrument.Name);this.musicSheet.SheetErrors.push(mt+this.instrument.Name)}if(!E.element("divisions")&&0===this.divisions&&0===this.currentXmlMeasureIndex){var vt=c.ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(this.divisions=this.readDivisionsFromNotes(),!(this.divisions>0))throw u=!0,new h.MusicSheetReadingException(vt+this.instrument.Name);this.musicSheet.SheetErrors.push(vt+this.instrument.Name)}this.addAbstractInstruction(E,i,d),s.Equals(new l.Fraction(0,1))&&this.isAttributesNodeAtBeginOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],E)&&this.saveAbstractInstructionList(this.instrument.Staves.length,!0),this.isAttributesNodeAtEndOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],E)&&this.saveClefInstructionAtEndOfMeasure();var bt=E.element("staff-details");if(bt){var gt=bt.element("staff-lines");if(gt){var yt=1,St=bt.attribute("number");St&&(yt=parseInt(St.value,10)),this.instrument.Staves[yt-1].StafflineCount=parseInt(gt.value,10)}}var _t=E.element("measure-style");if(_t){var xt=_t.element("multiple-rest");if(xt){var Et=xt.value,wt=0;try{wt=Number.parseInt(Et,10),void 0!==t.multipleRestMeasures&&wt!==t.multipleRestMeasures?t.multipleRestMeasures=0:t.multipleRestMeasures=wt}catch(t){ ("multirest parse error: "+t)}}}}else if("forward"===E.name){var Tt=parseInt(E.element("duration").value,10);s.Add(new l.Fraction(Tt,4*this.divisions))}else if("backup"===E.name){var Mt=parseInt(E.element("duration").value,10);s.Sub(new l.Fraction(Mt,4*this.divisions)),s.IsNegative()&&(s=new l.Fraction(0,1)),a.Sub(new l.Fraction(Mt,4*this.divisions)),a.IsNegative()&&(a=new l.Fraction(0,1))}else if("direction"===E.name){var Pt=E.element("direction-type"),Lt=Math.min(1,s.RealValue);void 0!==this.activeRhythm&&this.activeRhythm.Rhythm&&(Lt/=this.activeRhythm.Rhythm.RealValue);var It=!1;if(this.repetitionInstructionReader&&(It=this.repetitionInstructionReader.handleRepetitionInstructionsFromWordsOrSymbols(Pt,Lt)),!It){var At=this.expressionReaders[0],Ct=this.readExpressionStaffNumber(E)-1;Ct0?this.musicSheet.SourceMeasures[0]:this.currentMeasure;var i,n=new s.ClefInstruction(f.ClefEnum.G,0,2);e.FirstInstructionsStaffEntries[t]?(i=e.FirstInstructionsStaffEntries[t]).removeFirstInstructionOfTypeClefInstruction():(i=new o.SourceStaffEntry(void 0,void 0),e.FirstInstructionsStaffEntries[t]=i),n.Parent=i,i.Instructions.splice(0,0,n)},e.createDefaultKeyInstruction=function(){var t;t=this.musicSheet.SourceMeasures.length>0?this.musicSheet.SourceMeasures[0]:this.currentMeasure;for(var e=new a.KeyInstruction(void 0,0,p.KeyEnum.major),i=this.inSourceMeasureInstrumentIndex;i0&&"backup"===i[n-1].name)return!0;for(var r=-1,o=0;o0||r<0},e.isAttributesNodeAtEndOfMeasure=function(t,e){for(var i=t.elements().slice(),n=0,r=0;ro},e.getNoteDurationFromTypeNode=function(t){var e=t.element("type");if(e){var i=e.value;return _.NoteTypeHandler.getNoteDurationFromType(i)}return new l.Fraction(0,4*this.divisions)},e.addAbstractInstruction=function(t,e,i){if(!t.element("divisions")||1!==t.elements().length){var n=t.element("transpose");if(n){var r=n.element("chromatic");r&&(this.instrument.PlaybackTranspose=parseInt(r.value,10))}var o,h=t.elements("clef");if(h.length>0)for(var b=0,g=h.length;b using default clef line."),this.musicSheet.SheetErrors.pushMeasureError(o),_=2,m.default.debug("InstrumentReader.addAbstractInstruction",o,t)}var T=y.element("sign");if(T)try{S=f.ClefEnum[T.value],s.ClefInstruction.isSupportedClef(S)||(o=c.ITextTranslation.translateText("ReaderErrorMessages/ClefError","Unsupported clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(o),S=f.ClefEnum.G,_=2),S===f.ClefEnum.TAB&&(E=-1)}catch(t){o=c.ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(o),S=f.ClefEnum.G,_=2,m.default.debug("InstrumentReader.addAbstractInstruction",o,t)}var M=y.element("clef-octave-change");if(M)try{E=parseInt(M.value,10)}catch(t){o=c.ITextTranslation.translateText("ReaderErrorMessages/ClefOctaveError","Invalid clef octave found -> using default clef octave."),this.musicSheet.SheetErrors.pushMeasureError(o),E=0}if(y.hasAttributes&&"number"===y.attributes()[0].name)try{(x=parseInt(y.attributes()[0].value,10))>this.currentClefNumber&&(x=this.currentClefNumber),this.currentClefNumber=x+1}catch(t){o=c.ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(o),x=1,this.currentClefNumber=x+1}if("forward"!==(null==i?void 0:i.name)){var P=new s.ClefInstruction(S,E,_);this.abstractInstructions.push([x,P])}}if(void 0!==t.element("key")&&this.instrument.MidiInstrumentId!==v.MidiInstrument.Percussion){var L=0,I=t.element("key").element("fifths");if(I)try{L=parseInt(I.value,10)}catch(t){o=c.ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(o),L=0,m.default.debug("InstrumentReader.addAbstractInstruction",o,t)}var A=p.KeyEnum.none,C=t.element("key");if(C&&(C=C.element("mode")),C)try{A=p.KeyEnum[C.value]}catch(t){o=c.ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(o),A=p.KeyEnum.major,m.default.debug("InstrumentReader.addAbstractInstruction",o,t)}var R=new a.KeyInstruction(void 0,L,A);this.abstractInstructions.push([1,R])}if(t.element("time")){var N=t.element("time"),k=d.RhythmSymbolEnum.NONE,F=!0;if(void 0!==N&&N.hasAttributes){var O=N.attribute("symbol");O&&("common"===O.value?k=d.RhythmSymbolEnum.COMMON:"cut"===O.value&&(k=d.RhythmSymbolEnum.CUT));var B=N.attribute("print-object");B&&"no"===B.value&&(F=!1)}for(var D=0,V=0,G=N&&void 0!==N.element("senza-misura"),W=t.elements("time"),H=[],U=[],z=0,j=W.length;z0&&void 0!==U&&H.length===U.length){for(var Y=H.length,K=new Array(Y),q=0,J=0;J set to default."),this.musicSheet.SheetErrors.pushMeasureError(o),D=4,V=4,m.default.debug("InstrumentReader.addAbstractInstruction",o,t)}var rt=new u.RhythmInstruction(new l.Fraction(D,V,0,!1),k);rt.PrintObject=F,this.abstractInstructions.push([1,rt])}}}},e.saveAbstractInstructionList=function(t,e){for(var i=this.abstractInstructions.length-1;i>=0;i--){var n=this.abstractInstructions[i],r=n[0],l=n[1];if(l instanceof s.ClefInstruction){var c=l;if(0===this.currentXmlMeasureIndex||r<=this.activeClefs.length&&c!==this.activeClefs[r-1])if(e||void 0===this.currentStaffEntry||this.currentStaffEntry.hasNotes()||r-1!==this.instrument.Staves.indexOf(this.currentStaffEntry.ParentStaff)){if(e){var h=void 0;if(this.currentMeasure){var f=c,d=this.inSourceMeasureInstrumentIndex+r-1,p=this.currentMeasure.FirstInstructionsStaffEntries[d];if(0===this.currentXmlMeasureIndex)if(p)if(void 0===this.currentMeasure.FirstInstructionsStaffEntries[d]||p.Instructions[0]instanceof s.ClefInstruction){var m=new o.SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[d]=m,f.Parent=m,m.Instructions.push(f)}else h=p,f.Parent=h,h.removeFirstInstructionOfTypeClefInstruction(),h.Instructions.splice(0,0,f),this.activeClefsHaveBeenInitialized[r-1]=!0;else h=new o.SourceStaffEntry(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[d]=h,f.Parent=h,h.Instructions.push(f),this.activeClefsHaveBeenInitialized[r-1]=!0;else if(this.activeClefsHaveBeenInitialized[r-1]){var v=new o.SourceStaffEntry(void 0,void 0);this.previousMeasure.LastInstructionsStaffEntries[d]=v,f.Parent=v,v.Instructions.push(f)}else{var b=this.musicSheet.SourceMeasures[0];b.FirstInstructionsStaffEntries[d]?(h=b.FirstInstructionsStaffEntries[d]).removeFirstInstructionOfTypeClefInstruction():h=new o.SourceStaffEntry(void 0,void 0),f.Parent=h,h.Instructions.splice(0,0,f),this.activeClefsHaveBeenInitialized[r-1]=!0}this.activeClefs[r-1]=c,this.abstractInstructions.splice(i,1)}}}else{var g=c;g.Parent=this.currentStaffEntry,this.currentStaffEntry.removeFirstInstructionOfTypeClefInstruction(),this.currentStaffEntry.Instructions.push(g),this.activeClefs[r-1]=c,this.abstractInstructions.splice(i,1)}else r<=this.activeClefs.length&&c===this.activeClefs[r-1]&&this.abstractInstructions.splice(i,1)}if(l instanceof a.KeyInstruction){var y=l;if(this.activeKey&&this.activeKey.Key===y.Key)this.abstractInstructions.splice(i,1);else{var S=void 0;if(this.activeKey=y,this.abstractInstructions.splice(i,1),this.activeKeyHasBeenInitialized?S=this.currentMeasure:(this.activeKeyHasBeenInitialized=!0,S=this.currentXmlMeasureIndex>0?this.musicSheet.SourceMeasures[0]:this.currentMeasure),S)for(var _=this.inSourceMeasureInstrumentIndex;_=0;t--){var e=this.abstractInstructions[t][0],i=this.abstractInstructions[t][1];if(i instanceof s.ClefInstruction){var n=i;if(!this.activeClefs[e-1]||n.ClefType!==this.activeClefs[e-1].ClefType||n.ClefType===this.activeClefs[e-1].ClefType&&n.Line!==this.activeClefs[e-1].Line){var r=new o.SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[this.inSourceMeasureInstrumentIndex+e-1]=r;var a=n;a.Parent=r,r.Instructions.push(a),this.activeClefs[e-1]=n,this.abstractInstructions.splice(t,1)}}}},e.getNoteDurationForTuplet=function(t){var e=new l.Fraction(0,1),i=this.getNoteDurationFromTypeNode(t);if(t.element("time-modification")){var n=t.element("time-modification");if(n&&void 0!==n.element("actual-notes")&&n.element("normal-notes")){var r=n.element("actual-notes"),o=n.element("normal-notes");if(void 0!==r&&o){var s=parseInt(r.value,10),a=parseInt(o.value,10);e=new l.Fraction(a*i.Numerator,s*i.Denominator)}}}return e},e.readExpressionStaffNumber=function(t){var e=1;if(t.element("staff")){var i=t.element("staff");if(i)try{e=parseInt(i.value,10)}catch(t){var n=c.ITextTranslation.translateText("ReaderErrorMessages/ExpressionStaffError","Invalid Expression staff number -> set to default.");this.musicSheet.SheetErrors.pushMeasureError(n),e=1,m.default.debug("InstrumentReader.readExpressionStaffNumber",n,t)}}return e},e.readDivisionsFromNotes=function(){for(var t=0,e=this.currentXmlMeasureIndex,i=!1;!i;){for(var n=this.xmlMeasureList[e].elements(),r=0,o=n.length;r0){i=!0;break}}if(0===t&&++e===this.xmlMeasureList.length){var d=c.ITextTranslation.translateText("ReaderErrorMEssages/DivisionsError","Invalid divisions value at Instrument: ");throw new h.MusicSheetReadingException(d+this.instrument.Name)}}return t},_createClass2(t,[{key:"ActiveKey",get:function(){return this.activeKey}},{key:"MaxTieNoteFraction",get:function(){return this.maxTieNoteFraction}},{key:"ActiveRhythm",get:function(){return this.activeRhythm},set:function(t){this.activeRhythm=t}}]),t}()},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VoiceGenerator=void 0;var r=i(41),o=i(51),s=i(14),a=i(36),u=i(31),l=i(141),c=i(107),h=i(67),f=i(142),d=i(0),p=i(20),m=i(143),v=i(11),b=i(2),g=i(2),y=i(144),S=n(i(1)),_=i(2),x=i(34),E=i(145),w=i(76),T=i(80),M=i(39),P=i(172),L=i(3);e.VoiceGenerator=function(){function t(t,e,i,n,s){this.openBeams=[],this.beamNumberOffset=0,this.openTieDict={},this.currentOctaveShift=0,this.tupletDict={},this.openTupletNumber=0,this.staff=e,this.instrument=e.ParentInstrument,this.musicSheet=this.instrument.GetMusicSheet,this.slurReader=n,this.pluginManager=t,this.voice=s?new r.LinkedVoice(this.instrument,i,s):new o.Voice(this.instrument,i),this.instrument.Voices.push(this.voice),this.staff.Voices.push(this.voice),this.lyricsReader=new m.LyricsReader(this.musicSheet),this.articulationReader=new E.ArticulationReader}var e=t.prototype;return e.createVoiceEntry=function(t,e,i,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=!1),this.currentVoiceEntry=new s.VoiceEntry(t.clone(),this.voice,e,n,r,o),i&&this.voice.VoiceEntries.push(this.currentVoiceEntry)},e.read=function(t,e,i,n,r,o,s,a,u,l,c,f,m,v,b,g,y,S,_,x){this.currentStaffEntry=s,this.currentMeasure=a;try{this.currentNote=o?this.addRestNote(t.element("rest"),e,n,r,m,v,_):this.addSingleNote(t,e,n,i,r,c,f,m,v,b,g,y,S,_,x);var E=t.elements("lyric");void 0!==this.lyricsReader&&E&&(this.lyricsReader.addLyricEntry(E,this.currentVoiceEntry),this.voice.Parent.HasLyrics=!0);var w=!1,M=t.element("notations");if(M){this.articulationReader&&this.readArticulations(M,this.currentVoiceEntry,this.currentNote);var P=M.elements("slur");void 0!==this.slurReader&&P.length>0&&!this.currentNote.ParentVoiceEntry.IsGrace&&this.slurReader.addSlur(P,this.currentNote);var L=M.elements("tuplet");L.length>0&&(this.openTupletNumber=this.addTuplet(t,L),w=!0);var I=M.element("arpeggiate");if(void 0!==I){var A;if(this.currentVoiceEntry.Arpeggio)A=this.currentVoiceEntry.Arpeggio;else{for(var C,R=!1,N=_createForOfIteratorHelperLoose(this.currentStaffEntry.VoiceEntries);!(C=N()).done;){var k=C.value;if(k.Arpeggio){R=!0,A=k.Arpeggio;break}}if(!R){var F=T.ArpeggioType.ARPEGGIO_DIRECTIONLESS,O=I.attribute("direction");if(O)switch(O.value){case"up":F=T.ArpeggioType.ROLL_UP;break;case"down":F=T.ArpeggioType.ROLL_DOWN;break;default:F=T.ArpeggioType.ARPEGGIO_DIRECTIONLESS}A=new T.Arpeggio(this.currentVoiceEntry,F),this.currentVoiceEntry.Arpeggio=A}}A.addNote(this.currentNote)}var B=M.elements("tied");B.length>0&&this.addTie(B,u,l,h.TieTypes.SIMPLE);var D=M.elements("slide");D.length>0&&this.addTie(D,u,l,h.TieTypes.SLIDE);var V=M.element("technical");if(V){var G=V.elements("hammer-on");G.length>0&&this.addTie(G,u,l,h.TieTypes.HAMMERON);var W=V.elements("pull-off");W.length>0&&this.addTie(W,u,l,h.TieTypes.PULLOFF)}var H=this.openTieDict;for(var U in H)if(H.hasOwnProperty(U)){var z=H[U];d.Fraction.plus(z.StartNote.ParentStaffEntry.Timestamp,z.Duration).lt(this.currentStaffEntry.Timestamp)&&delete H[U]}}void 0===t.element("time-modification")||w||this.handleTimeModificationNode(t)}catch(t){var j=p.ITextTranslation.translateText("ReaderErrorMessages/NoteError","Ignored erroneous Note.");this.musicSheet.SheetErrors.pushMeasureError(j)}return this.currentNote},e.checkForStaffEntryLink=function(t,e,i,n){var r=new y.StaffEntryLink(this.currentVoiceEntry);r.LinkStaffEntries.push(i),i.Link=r;var o=this.currentVoiceEntry.Timestamp.clone(),s=n.getVerticalContainerByTimestamp(o);return(i=s.StaffEntries[t])||(i=new u.SourceStaffEntry(s,e),s.StaffEntries[t]=i),i.VoiceEntries.push(this.currentVoiceEntry),r.LinkStaffEntries.push(i),i.Link=r,i},e.checkForOpenBeam=function(){this.openBeams.length>0&&this.currentNote&&this.handleOpenBeam()},e.checkOpenTies=function(){var t=this.openTieDict;for(var e in t)if(t.hasOwnProperty(e)){var i=t[e];d.Fraction.plus(i.StartNote.ParentStaffEntry.Timestamp,i.Duration).lt(i.StartNote.SourceMeasure.Duration)&&delete t[e]}},e.hasVoiceEntry=function(){return void 0!==this.currentVoiceEntry},e.readArticulations=function(t,e,i){var n=t.element("articulations");n&&this.articulationReader.addArticulationExpression(n,e);var r=t.element("fermata");r&&this.articulationReader.addFermata(r,e);var o=t.element("technical");o&&this.articulationReader.addTechnicalArticulations(o,e,i);var s=t.element("ornaments");s&&this.articulationReader.addOrnament(s,e)},e.addSingleNote=function(t,e,i,n,r,o,u,l,c,h,f,m,y,x,E){for(var T=0,M=b.AccidentalEnum.NONE,L=g.NoteEnum.C,I=g.NoteEnum.C,A=0,C=0,R=void 0,N=void 0,k=void 0,F=t.elements(),O=0,B=F.length;O0&&this.openBeams.last().ExtendedNoteList.push(m),m},e.addNoteInfo=function(t,e,i,n,r,o,s,a,u){t.NoteTypeXml=e,t.PrintObject=i,t.IsCueNote=n,t.NormalNotes=r,t.displayStepUnpitched=o,t.displayOctaveUnpitched=s,t.NoteheadColorXml=a,t.NoteheadColor=a},e.createBeam=function(t,e){var i;try{var n=t.element("beam"),r=void 0;if(void 0!==n&&n.hasAttributes&&(r=n.attribute("number")),r){var o=parseInt(r.value,10),s=t.elements("beam"),a=s[0].value;s&&("begin"===a?(o===(null===(i=this.openBeams.last())||void 0===i?void 0:i.BeamNumber)?(this.beamNumberOffset++,o+=this.beamNumberOffset):this.openBeams.last()&&this.handleOpenBeam(),this.openBeams.push(new l.Beam(o,this.beamNumberOffset))):o+=this.beamNumberOffset);var u=!1;if(!(o>0&&o<=this.openBeams.length&&this.openBeams[o-1]))return void S.default.debug("[OSMD] invalid beamnumber");for(var c=0,h=this.openBeams[o-1].Notes.length;c1){var n=t.element("time-modification");n&&(n=n.element("actual-notes"));for(var r=e,o=0,s=r.length;o1&&this.openTupletNumber--),this.tupletDict[d]=g;var y=[];y.push(this.currentNote),g.Notes.push(y),g.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=g,this.openTupletNumber=d}else if("stop"===h.value){var S=1;a.attribute("number")&&(S=parseInt(a.attribute("number").value,10));var _=this.tupletDict[S];if(_){var x=[];x.push(this.currentNote),_.Notes.push(x),_.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=_,delete this.tupletDict[S],0===Object.keys(this.tupletDict).length?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--}}}}}else if(e[0]){var E=e[0];if(E.hasAttributes){var w=E.attribute("type").value,T=1;E.attribute("number")&&(T=parseInt(E.attribute("number").value,10));var M=isNaN(T),P=E.attribute("bracket");P&&"yes"===P.value&&(i=!0);var I=E.attribute("placement"),A=I&&"below"===I.value;if("start"===w){var C=0,R=t.element("time-modification");if(R&&(R=R.element("actual-notes")),R&&(C=parseInt(R.value,10),isNaN(C))){var N=p.ITextTranslation.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(N),new v.MusicSheetReadingException(N)}M&&(this.openTupletNumber++,T=this.openTupletNumber);var k=this.tupletDict[T];k||((k=this.tupletDict[T]=new f.Tuplet(C,i)).tupletLabelNumberPlacement=A?L.PlacementEnum.Below:L.PlacementEnum.Above);var F=[];F.push(this.currentNote),k.Notes.push(F),k.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=k,this.openTupletNumber=T}else if("stop"===w){M&&(T=this.openTupletNumber);var O=this.tupletDict[this.openTupletNumber];if(O){var B=[];B.push(this.currentNote),O.Notes.push(B),O.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=O,0===Object.keys(this.tupletDict).length?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--,delete this.tupletDict[T]}}}}return this.openTupletNumber},e.handleTimeModificationNode=function(t){if(this.tupletDict[this.openTupletNumber])try{var e,i=this.tupletDict[this.openTupletNumber],n=x.CollectionUtil.last(i.Notes);n[0].ParentVoiceEntry.Timestamp.Equals(this.currentVoiceEntry.Timestamp)?e=n:(e=[],i.Notes.push(e),i.Fractions.push(this.getTupletNoteDurationFromType(t))),e.push(this.currentNote),this.currentNote.NoteTuplet=i}catch(t){var r=p.ITextTranslation.translateText("ReaderErrorMessages/TupletNumberError","Invalid tuplet number.");throw this.musicSheet.SheetErrors.pushMeasureError(r),t}else if(this.currentVoiceEntry.Notes.length>0){var o=this.currentVoiceEntry.Notes[0];if(o.NoteTuplet){var s=o.NoteTuplet;x.CollectionUtil.last(s.Notes).push(this.currentNote),this.currentNote.NoteTuplet=s}}},e.addTie=function(t,e,i,n){if(t)if(1===t.length){var r=t[0];if(void 0!==r&&r.attributes()){var o=r.attribute("type").value;try{if("start"===o){var s=this.findCurrentNoteInTieDict(this.currentNote);s<0&&delete this.openTieDict[s];var a=this.getNextAvailableNumberForTie(),u=new c.Tie(this.currentNote,n);this.openTieDict[a]=u}else if("stop"===o){var l=this.findCurrentNoteInTieDict(this.currentNote),h=this.openTieDict[l];h&&(h.AddNote(this.currentNote),delete this.openTieDict[l])}}catch(t){var f=p.ITextTranslation.translateText("ReaderErrorMessages/TieError","Error while reading tie.");this.musicSheet.SheetErrors.pushMeasureError(f)}}}else if(2===t.length){var d=this.findCurrentNoteInTieDict(this.currentNote);d>=0&&this.openTieDict[d].AddNote(this.currentNote)}},e.getNextAvailableNumberForTie=function(){var t=Object.keys(this.openTieDict);if(0===t.length)return 1;t.sort((function(t,e){return+t-+e}));for(var e=0;e=0;e--)for(var i=0;i0)for(var x=g;x1&&(w=parseInt(M[1],10))}catch(t){var P=o.ITextTranslation.translateText("ReaderErrorMessages/LyricVerseNumberError","Invalid lyric verse number");this.musicSheet.SheetErrors.pushMeasureError(P);continue}}var L=void 0;if("single"===h||"end"===h){if(this.openLyricWords[w]){this.currentLyricWord=this.openLyricWords[w];var I=this.currentLyricWord.Syllables.length;L=new r.LyricsEntry(p,w,this.currentLyricWord,e,I),this.currentLyricWord.Syllables.push(L),delete this.openLyricWords[w],this.currentLyricWord=void 0}else L=new r.LyricsEntry(p,w,void 0,e);L.extend=void 0!==c.element("extend")}else if("begin"===h)this.openLyricWords[w]&&(delete this.openLyricWords[w],this.currentLyricWord=void 0),this.currentLyricWord=new n.LyricWord,this.openLyricWords[w]=this.currentLyricWord,L=new r.LyricsEntry(p,w,this.currentLyricWord,e,0),this.currentLyricWord.Syllables.push(L);else if("middle"===h)if(this.openLyricWords[w]){this.currentLyricWord=this.openLyricWords[w];var A=this.currentLyricWord.Syllables.length;L=new r.LyricsEntry(p,w,this.currentLyricWord,e,A),this.currentLyricWord.Syllables.push(L)}else L=new r.LyricsEntry(p,w,void 0,e);L&&(e.LyricsEntries[w]||(e.LyricsEntries.setValue(w,L),(null===(s=null===(i=e.ParentSourceStaffEntry)||void 0===i?void 0:i.VerticalContainerParent)||void 0===s?void 0:s.ParentMeasure)&&(e.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.hasLyrics=!0)),e.ParentVoice.Parent.LyricVersesNumbers[w]||e.ParentVoice.Parent.LyricVersesNumbers.push(w))}}}catch(t){var C=o.ITextTranslation.translateText("ReaderErrorMessages/LyricError","Error while reading lyric entry.");this.musicSheet.SheetErrors.pushMeasureError(C);continue}}e.ParentVoice.Parent.LyricVersesNumbers=e.ParentVoice.Parent.LyricVersesNumbers.filter((function(t,e,i){return i.indexOf(t)===e}))}},t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.StaffEntryLink=void 0,e.StaffEntryLink=function(){function t(t){this.linkStaffEntries=[],this.voiceEntry=t}return _createClass2(t,[{key:"GetVoiceEntry",get:function(){return this.voiceEntry}},{key:"LinkStaffEntries",get:function(){return this.linkStaffEntries},set:function(t){this.linkStaffEntries=t}}]),t}()},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ArticulationReader=void 0;var r=i(14),o=n(i(1)),s=i(146),a=i(50),u=i(3),l=i(2),c=i(171);e.ArticulationReader=function(){function t(){}var e=t.prototype;return e.getAccEnumFromString=function(t){switch(t){case"sharp":return l.AccidentalEnum.SHARP;case"flat":return l.AccidentalEnum.FLAT;case"natural":return l.AccidentalEnum.NATURAL;case"double-sharp":case"sharp-sharp":return l.AccidentalEnum.DOUBLESHARP;case"double-flat":case"flat-flat":return l.AccidentalEnum.DOUBLEFLAT;case"quarter-sharp":return l.AccidentalEnum.QUARTERTONESHARP;case"quarter-flat":return l.AccidentalEnum.QUARTERTONEFLAT;case"triple-sharp":return l.AccidentalEnum.TRIPLESHARP;case"triple-flat":return l.AccidentalEnum.TRIPLEFLAT;default:return l.AccidentalEnum.NONE}},e.addArticulationExpression=function(t,e){var i,n;if(void 0!==t&&t.elements().length>0)for(var s=t.elements(),a=0,l=s.length;a0&&e.Articulations[0].articulationEnum!==r.ArticulationEnum.staccato&&e.Articulations.splice(0,0,v),"strongaccent"===f){var b=null===(n=null==h?void 0:h.attribute("type"))||void 0===n?void 0:n.value;"up"===b?v.articulationEnum=r.ArticulationEnum.marcatoup:"down"===b&&(v.articulationEnum=r.ArticulationEnum.marcatodown)}e.hasArticulation(v)||e.Articulations.push(v)}}catch(t){var g="Invalid note articulation.";return void o.default.debug("addArticulationExpression",g,t)}}},e.addFermata=function(t,e){var i,n=r.ArticulationEnum.fermata;t.attributes().length>0&&t.attribute("type")&&"inverted"===t.attribute("type").value&&(n=r.ArticulationEnum.invertedfermata);var o=u.PlacementEnum.Above;"below"===(null===(i=t.attribute("placement"))||void 0===i?void 0:i.value)&&(o=u.PlacementEnum.Below),e.Articulations.push(new c.Articulation(n,o))},e.addTechnicalArticulations=function(t,e,i){var n,o,a={bend:r.ArticulationEnum.bend,"down-bow":r.ArticulationEnum.downbow,"open-string":r.ArticulationEnum.naturalharmonic,"snap-pizzicato":r.ArticulationEnum.snappizzicato,stopped:r.ArticulationEnum.lefthandpizzicato,"up-bow":r.ArticulationEnum.upbow};for(var l in a)if(a.hasOwnProperty(l)){var h=a[l],f=t.element(l);if(f){var d=void 0;"above"===(null===(n=f.attribute("placement"))||void 0===n?void 0:n.value)&&(d=u.PlacementEnum.Above),"below"===(null===(o=f.attribute("placement"))||void 0===o?void 0:o.value)&&(d=u.PlacementEnum.Below);var p=new c.Articulation(h,d);e.hasArticulation(p)||e.Articulations.push(p)}}var m=t.element("fingering");if(m){var v=this.createTechnicalInstruction(m,i);v.type=s.TechnicalInstructionType.Fingering,i.Fingering=v,e.TechnicalInstructions.push(v)}var b=t.element("string");if(b){var g=this.createTechnicalInstruction(b,i);g.type=s.TechnicalInstructionType.String,i.StringInstruction=g,e.TechnicalInstructions.push(g)}},e.createTechnicalInstruction=function(t,e){var i=new s.TechnicalInstruction;i.sourceNote=e,i.value=t.value;var n=t.attribute("placement");return i.placement=this.getPlacement(n),i},e.getPlacement=function(t,e){if(void 0===e&&(e=u.PlacementEnum.NotYetDefined),e!==u.PlacementEnum.NotYetDefined)return e;if(!t)return u.PlacementEnum.NotYetDefined;switch(t.value){case"above":return u.PlacementEnum.Above;case"below":return u.PlacementEnum.Below;case"left":return u.PlacementEnum.Left;case"right":return u.PlacementEnum.Right;default:return u.PlacementEnum.NotYetDefined}},e.addOrnament=function(t,e){if(t){var i=void 0,n={"delayed-inverted-turn":a.OrnamentEnum.DelayedInvertedTurn,"delayed-turn":a.OrnamentEnum.DelayedTurn,"inverted-mordent":a.OrnamentEnum.InvertedMordent,"inverted-turn":a.OrnamentEnum.InvertedTurn,mordent:a.OrnamentEnum.Mordent,"trill-mark":a.OrnamentEnum.Trill,turn:a.OrnamentEnum.Turn};for(var r in n)if(n.hasOwnProperty(r)){var o=t.element(r);if(o){i=new a.OrnamentContainer(n[r]);var s=o.attribute("placement");s&&"below"===s.value&&(i.placement=u.PlacementEnum.Below)}}if(i){var c=t.elements("accidental-mark");if(c)for(var h=u.PlacementEnum.Below,f=l.AccidentalEnum.NONE,d=c,p=0,m=d.length;p0?n.RealValue>0?(c=r.Fraction.multiply(r.Fraction.minus(n,o),c),this.directionTimestamp=r.Fraction.plus(c,n)):this.directionTimestamp=r.Fraction.createFromFraction(c):this.offsetDivisions<0&&(n.RealValue>0?(c=r.Fraction.multiply(r.Fraction.minus(n,o),c),this.directionTimestamp=r.Fraction.minus(n,c)):this.directionTimestamp=r.Fraction.createFromFraction(c));var h=t.attribute("placement");if(h)try{var f=h.value;"below"===f?this.placement=p.PlacementEnum.Below:"above"===f&&(this.placement=p.PlacementEnum.Above)}catch(t){var d=v.ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");b.default.debug("ExpressionReader.readExpressionParameters",d,t),this.musicSheet.SheetErrors.pushMeasureError(d),this.placement=p.PlacementEnum.Below}if(this.placement===p.PlacementEnum.NotYetDefined)try{var m=t.element("direction-type");if(m){var g=m.element("dynamics");if(g){var y=g.attribute("default-y");y&&this.readExpressionPlacement(y,"read dynamics y pos")}var S=m.element("wedge");if(S){var _=S.attribute("default-y");_&&this.readExpressionPlacement(_,"read wedge y pos")}var x=m.element("words");if(x){var E=x.attribute("default-y");E&&this.readExpressionPlacement(E,"read words y pos")}var w=m.element("rehearsal");if(w){var T=w.attribute("default-y");T&&this.readExpressionPlacement(T,"read rehearsal pos")}}}catch(t){var M=v.ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");b.default.debug("ExpressionReader.readExpressionParameters",M,t),this.musicSheet.SheetErrors.pushMeasureError(M),this.placement=p.PlacementEnum.Below}this.placement===p.PlacementEnum.NotYetDefined&&(e.Staves.length>1?this.placement=p.PlacementEnum.Below:e.HasLyrics?this.placement=p.PlacementEnum.Above:this.placement=p.PlacementEnum.Below)},e.read=function(t,e,i){var n=!1,o=!1,s=t.element("sound");if(s){var a=s.attribute("tempo"),u=s.attribute("dynamics");if(a){var l=a.value.match(/\d+/);this.soundTempo=void 0!==l?parseInt(l[0],10):100,e.TempoInBPM=this.soundTempo,0===this.musicSheet.DefaultStartTempoInBpm&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,n=!0}if(u){var c=u.value.match(/\d+/);this.soundDynamic=void 0!==c?parseInt(c[0],10):100,o=!0}}var f=t.element("direction-type");if(f){var d=f.element("metronome");if(d){var p=d.element("beat-unit"),m=void 0!==d.element("beat-unit-dot"),v=d.element("per-minute");if(void 0!==p&&v){d.hasAttributes&&void 0!==d.attribute("default-x")&&(this.directionTimestamp=r.Fraction.createFromFraction(i));var b=parseInt(v.value,10);this.createNewTempoExpressionIfNeeded(e);var g=new h.InstantaneousTempoExpression(void 0,this.placement,this.staffNumber,b,this.currentMultiTempoExpression,!0);g.parentMeasure=e,this.soundTempo=b,e.TempoInBPM=this.soundTempo,0===this.musicSheet.DefaultStartTempoInBpm&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,g.dotted=m,g.beatUnit=p.value,this.currentMultiTempoExpression.addExpression(g,""),this.currentMultiTempoExpression.CombinedExpressionsText="test"}}else if(d=f.element("dynamics")){var y=void 0!==t.element("notations");this.interpretInstantaneousDynamics(d,e,i,y)}else if(d=f.element("words"))if(n){this.createNewTempoExpressionIfNeeded(e),this.currentMultiTempoExpression.CombinedExpressionsText=d.value;var S=new h.InstantaneousTempoExpression(d.value,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);this.currentMultiTempoExpression.addExpression(S,"")}else o||this.interpretWords(d,e,i);else(d=f.element("wedge"))?this.interpretWedge(d,e,i,e.MeasureNumber):(d=f.element("rehearsal"))&&this.interpretRehearsalMark(d,e,i,e.MeasureNumber)}},e.checkForOpenExpressions=function(t,e){this.openContinuousDynamicExpression&&(this.createNewMultiExpressionIfNeeded(t,e),this.closeOpenContinuousDynamic()),this.openContinuousTempoExpression&&this.closeOpenContinuousTempo(r.Fraction.plus(t.AbsoluteTimestamp,e))},e.addOctaveShift=function(t,e,i){var n=1,r=t.element("staff");if(r)try{n=parseInt(r.value,10)}catch(t){var o=v.ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftStaffError","Invalid octave shift staff number -> set to default");this.musicSheet.SheetErrors.pushMeasureError(o),n=1,b.default.debug("ExpressionReader.addOctaveShift",o,t)}var s=t.element("direction-type");if(s){var a=s.element("octave-shift");if(void 0!==a&&a.hasAttributes)try{if(a.attribute("size")){var u=parseInt(a.attribute("size").value,10),c=0;if(8===u?c=1:15===u&&(c=2),a.attribute("type")){var h=a.attribute("type").value;if("up"===h||"down"===h){var f=new l.OctaveShift(h,c);f.StaffNumber=n,this.createNewMultiExpressionIfNeeded(e),this.getMultiExpression.OctaveShiftStart=f,f.ParentStartMultiExpression=this.getMultiExpression,this.openOctaveShift=f}else"stop"===h&&this.openOctaveShift&&(this.createNewMultiExpressionIfNeeded(e,i),this.getMultiExpression.OctaveShiftEnd=this.openOctaveShift,this.openOctaveShift.ParentEndMultiExpression=this.getMultiExpression,this.openOctaveShift=void 0)}}}catch(t){var d=v.ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftError","Error while reading octave shift.");this.musicSheet.SheetErrors.pushMeasureError(d),b.default.debug("ExpressionReader.addOctaveShift",d,t)}}},e.initialize=function(){this.placement=p.PlacementEnum.NotYetDefined,this.soundTempo=0,this.soundDynamic=0,this.offsetDivisions=0},e.readExpressionPlacement=function(t,e){try{var i=parseInt(t.value,10);i<0?this.placement=p.PlacementEnum.Below:i>0&&(this.placement=p.PlacementEnum.Above)}catch(t){b.default.debug("ExpressionReader.readExpressionParameters",e,t)}},e.interpretInstantaneousDynamics=function(t,e,i,n){if(t.hasElements){t.hasAttributes&&t.attribute("default-x")&&(this.directionTimestamp=r.Fraction.createFromFraction(i));var o=t.elements()[0].name;if("other-dynamics"===o&&(o=t.elements()[0].value),o){n?this.createNewMultiExpressionIfNeeded(e,r.Fraction.createFromFraction(i)):this.createNewMultiExpressionIfNeeded(e),void 0!==this.openContinuousDynamicExpression&&this.openContinuousDynamicExpression.StartMultiExpression!==this.getMultiExpression&&this.closeOpenContinuousDynamic();var s=new u.InstantaneousDynamicExpression(o,this.soundDynamic,this.placement,this.staffNumber,e);this.getMultiExpression.addExpression(s,""),this.initialize(),this.activeInstantaneousDynamic?this.activeInstantaneousDynamic.DynEnum=s.DynEnum:this.activeInstantaneousDynamic=new u.InstantaneousDynamicExpression(o,0,p.PlacementEnum.NotYetDefined,1,e)}}},e.interpretWords=function(t,e,i){var n,o=t.value,s=t.attribute("font-style");if(s&&"italic"===s.value&&(n=g.FontStyles.Italic),o.length>0){if(t.hasAttributes&&t.attribute("default-x")&&(this.directionTimestamp=r.Fraction.createFromFraction(i)),this.checkIfWordsNodeIsRepetitionInstruction(o))return;this.fillMultiOrTempoExpression(o,e,n),this.initialize()}},e.interpretWedge=function(t,e,i,n){void 0!==t&&t.hasAttributes&&t.attribute("default-x")&&(this.directionTimestamp=r.Fraction.createFromFraction(i)),this.createNewMultiExpressionIfNeeded(e),this.addWedge(t,e),this.initialize()},e.interpretRehearsalMark=function(t,e,i,n){e.rehearsalExpression=new y.RehearsalExpression(t.value,this.placement)},e.createNewMultiExpressionIfNeeded=function(t,e){e||(e=this.directionTimestamp),(!this.getMultiExpression||this.getMultiExpression&&(this.getMultiExpression.SourceMeasureParent!==t||this.getMultiExpression.SourceMeasureParent===t&&this.getMultiExpression.Timestamp!==e))&&(this.getMultiExpression=new c.MultiExpression(t,r.Fraction.createFromFraction(e)),t.StaffLinkedExpressions[this.globalStaffIndex].push(this.getMultiExpression))},e.createNewTempoExpressionIfNeeded=function(t){this.currentMultiTempoExpression&&this.currentMultiTempoExpression.SourceMeasureParent===t&&this.currentMultiTempoExpression.Timestamp===this.directionTimestamp||(this.currentMultiTempoExpression=new o.MultiTempoExpression(t,r.Fraction.createFromFraction(this.directionTimestamp)),t.TempoExpressions.push(this.currentMultiTempoExpression))},e.addWedge=function(t,e){if(void 0!==t&&t.hasAttributes){var i=t.attribute("type").value.toLowerCase();try{if("crescendo"===i||"diminuendo"===i){var n=new s.ContinuousDynamicExpression(s.ContDynamicEnum[i],this.placement,this.staffNumber,e);this.openContinuousDynamicExpression&&this.closeOpenContinuousDynamic(),this.openContinuousDynamicExpression=n,this.getMultiExpression.StartingContinuousDynamic=n,n.StartMultiExpression=this.getMultiExpression,void 0!==this.activeInstantaneousDynamic&&this.activeInstantaneousDynamic.StaffNumber===n.StaffNumber&&(this.activeInstantaneousDynamic=void 0)}else"stop"===i&&this.openContinuousDynamicExpression&&this.closeOpenContinuousDynamic()}catch(t){var r="ReaderErrorMessages/WedgeError, Error while reading Crescendo / Diminuendo.";this.musicSheet.SheetErrors.pushMeasureError(r),b.default.debug("ExpressionReader.addWedge",r,t)}}},e.fillMultiOrTempoExpression=function(t,e,i){if(t){var n=t.trim();this.createExpressionFromString("",n,e,t,i)}},e.createExpressionFromString=function(t,e,i,n,r){if(h.InstantaneousTempoExpression.isInputStringInstantaneousTempo(e)||a.ContinuousTempoExpression.isInputStringContinuousTempo(e)){if(i.TempoExpressions.length>0)for(var o=0,l=i.TempoExpressions.length;o0)for(var S=0,_=i.TempoExpressions.length;S<_;++S){var x=i.TempoExpressions[S];if(x.Timestamp===this.directionTimestamp&&void 0!==x.InstantaneousTempo&&x.EntriesList.length>0&&!this.hasDigit(e)&&this.globalStaffIndex>0){if(x.EntriesList[0].label.indexOf(e)>=0)return!1;break}}var E=m.TextAlignmentEnum.CenterBottom;this.musicSheet.Rules.CompactMode&&(E=m.TextAlignmentEnum.LeftBottom);var w=new d.UnknownExpression(e,this.placement,E,this.staffNumber);return w.fontStyle=r,this.getMultiExpression.addExpression(w,t),!1},e.closeOpenContinuousDynamic=function(){this.openContinuousDynamicExpression.EndMultiExpression=this.getMultiExpression,this.getMultiExpression.EndingContinuousDynamic=this.openContinuousDynamicExpression,this.openContinuousDynamicExpression=void 0},e.closeOpenContinuousTempo=function(t){this.openContinuousTempoExpression.AbsoluteEndTimestamp=t,this.openContinuousTempoExpression=void 0},e.checkIfWordsNodeIsRepetitionInstruction=function(t){return"coda"===(t=t.trim().toLowerCase())||"tocoda"===t||"to coda"===t||"fine"===t||"d.c."===t||"dacapo"===t||"da capo"===t||"d.s."===t||"dalsegno"===t||"dal segno"===t||"d.c. al fine"===t||"d.s. al fine"===t||"d.c. al coda"===t||"d.s. al coda"===t},e.hasDigit=function(t){return/\d/.test(t)},t}()},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.SlurReader=void 0;var r=i(173),o=n(i(1)),s=i(20),a=i(102);e.SlurReader=function(){function t(t){this.openSlurDict={},this.musicSheet=t}return t.prototype.addSlur=function(t,e){try{if(t)for(var i,n=_createForOfIteratorHelperLoose(t);!(i=n()).done;){var u=i.value;if(u.attributes().length>0){var l=u.attribute("type").value,c=1;try{u.attribute("number")&&(c=parseInt(u.attribute("number").value,10))}catch(t){o.default.debug("VoiceGenerator.addSlur number: ",t)}var h=a.PlacementEnum.NotYetDefined,f=u.attribute("placement");f&&f.value&&("above"===f.value?h=a.PlacementEnum.Above:"below"===f.value&&(h=a.PlacementEnum.Below));var d=u.attribute("orientation");if(d&&d.value&&("over"===d.value?h=a.PlacementEnum.Above:"under"===d.value&&(h=a.PlacementEnum.Below)),"start"===l){var p=this.openSlurDict[c];p||(p=new r.Slur,this.openSlurDict[c]=p),p.StartNote=e,p.PlacementXml=h}else if("stop"===l){var m=this.openSlurDict[c];m&&(m.EndNote=e,e.checkForDoubleSlur(m)||(e.NoteSlurs.push(m),m.StartNote.NoteSlurs.push(m)),delete this.openSlurDict[c])}}}}catch(t){var v=s.ITextTranslation.translateText("ReaderErrorMessages/SlurError","Error while reading slur.");this.musicSheet.SheetErrors.pushMeasureError(v)}},t}()},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.SubInstrument=void 0;var r=i(7),o=n(i(1)),s=function(){function t(e){this.parentInstrument=e,this.fixedKey=-1,this.name=this.parseMidiInstrument(this.parentInstrument.Name),this.midiInstrumentID=t.midiInstrument[this.name],this.volume=1}t.isPianoInstrument=function(t){return t===r.MidiInstrument.Acoustic_Grand_Piano||t===r.MidiInstrument.Bright_Acoustic_Piano||t===r.MidiInstrument.Electric_Grand_Piano||t===r.MidiInstrument.Electric_Piano_1||t===r.MidiInstrument.Electric_Piano_2};var e=t.prototype;return e.setMidiInstrument=function(e){this.midiInstrumentID=t.midiInstrument[this.parseMidiInstrument(e)]},e.parseMidiInstrument=function(e){try{if(e){var i=e.toLowerCase().trim();for(var n in t.midiInstrument)if(-1!==i.indexOf(n))return n}if(this.parentInstrument.Name){var r=this.parentInstrument.Name.toLowerCase().trim();for(var s in t.midiInstrument)if(-1!==r.indexOf(s))return s}}catch(e){o.default.error("Error parsing MIDI Instrument. Default to Grand Piano.")}return"unnamed"},_createClass2(t,[{key:"ParentInstrument",get:function(){return this.parentInstrument}}]),t}();e.SubInstrument=s,s.midiInstrument={alt:r.MidiInstrument.Synth_Voice,alto:r.MidiInstrument.Synth_Voice,banjo:r.MidiInstrument.Banjo,bariton:r.MidiInstrument.Synth_Voice,baritone:r.MidiInstrument.Synth_Voice,bass:r.MidiInstrument.Synth_Voice,"blockflöte":r.MidiInstrument.Recorder,brass:r.MidiInstrument.Trombone,bratsche:r.MidiInstrument.Viola,cello:r.MidiInstrument.Cello,clarinet:r.MidiInstrument.Clarinet,contrabass:r.MidiInstrument.Contrabass,drums:r.MidiInstrument.Percussion,flute:r.MidiInstrument.Flute,"flöte":r.MidiInstrument.Flute,frenchhorn:r.MidiInstrument.French_Horn,gitarre:r.MidiInstrument.Acoustic_Guitar_nylon,guitar:r.MidiInstrument.Acoustic_Guitar_nylon,harfe:r.MidiInstrument.Orchestral_Harp,harp:r.MidiInstrument.Orchestral_Harp,klarinette:r.MidiInstrument.Clarinet,klavier:r.MidiInstrument.Acoustic_Grand_Piano,kontrabass:r.MidiInstrument.Contrabass,oboe:r.MidiInstrument.Oboe,organ:r.MidiInstrument.Church_Organ,orgel:r.MidiInstrument.Church_Organ,orgue:r.MidiInstrument.Church_Organ,percussion:r.MidiInstrument.Percussion,piano:r.MidiInstrument.Acoustic_Grand_Piano,piccolo:r.MidiInstrument.Piccolo,posaune:r.MidiInstrument.Trombone,recorder:r.MidiInstrument.Recorder,sax:r.MidiInstrument.Tenor_Sax,schlagwerk:r.MidiInstrument.Percussion,schlagzeug:r.MidiInstrument.Percussion,sopran:r.MidiInstrument.Synth_Voice,steeldrum:r.MidiInstrument.Steel_Drums,streicher:r.MidiInstrument.String_Ensemble_1,strings:r.MidiInstrument.String_Ensemble_1,tenor:r.MidiInstrument.Synth_Voice,tpt:r.MidiInstrument.Trumpet,trombone:r.MidiInstrument.Trombone,trompete:r.MidiInstrument.Trumpet,trumpet:r.MidiInstrument.Trumpet,tuba:r.MidiInstrument.Tuba,unnamed:r.MidiInstrument.Acoustic_Grand_Piano,viola:r.MidiInstrument.Viola,violin:r.MidiInstrument.Violin,"violon-c":r.MidiInstrument.Cello,"violon.":r.MidiInstrument.Violin,voice:r.MidiInstrument.Synth_Voice,woodblock:r.MidiInstrument.Woodblock}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.MusicSymbolModuleFactory=void 0;var n=i(152),r=i(153);e.MusicSymbolModuleFactory=function(){function t(){}return t.createRepetitionInstructionReader=function(){return new n.RepetitionInstructionReader},t.createRepetitionCalculator=function(){return new r.RepetitionCalculator},t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.RepetitionInstructionReader=void 0;var n=i(28),r=i(28),o=i(174);e.RepetitionInstructionReader=function(){function t(){}var e=t.prototype;return e.prepareReadingMeasure=function(t,e){this.currentMeasureIndex=e},e.handleLineRepetitionInstructions=function(t){var e=!1;if(t.elements().length>0){var i="",r=!1,o="",s="",a="",u=[],l=t.element("bar-style");l&&(a=l.value),i=t.attributes().length>0&&t.attribute("location")?t.attribute("location").value:"right";for(var c=t.elements(),h=0,f=c.length;h0)if("left"===i){if("start"===s){var T=new n.RepetitionInstruction(this.currentMeasureIndex,n.RepetitionInstructionEnum.Ending,n.AlignmentType.Begin,void 0,u);this.addInstruction(this.repetitionInstructions,T)}if("forward"===o){var M=new n.RepetitionInstruction(this.currentMeasureIndex,n.RepetitionInstructionEnum.StartLine);this.addInstruction(this.repetitionInstructions,M)}}else{if("stop"===s){var P=new n.RepetitionInstruction(this.currentMeasureIndex,n.RepetitionInstructionEnum.Ending,n.AlignmentType.End,void 0,u);this.addInstruction(this.repetitionInstructions,P)}if("backward"===o){var L=new n.RepetitionInstruction(this.currentMeasureIndex,n.RepetitionInstructionEnum.BackJumpLine);this.addInstruction(this.repetitionInstructions,L)}}}return e},e.handleRepetitionInstructionsFromWordsOrSymbols=function(t,e){var i=t.element("words"),r=this.currentMeasureIndex;if(i){var s="d\\s?\\.s\\.",a=i.value.trim().toLowerCase();if(o.StringUtil.StringContainsSeparatedWord(a,s+" al fine",!0)){var u=new n.RepetitionInstruction(r,n.RepetitionInstructionEnum.DalSegnoAlFine);return this.addInstruction(this.repetitionInstructions,u),!0}var l,c="d\\.\\s?c\\.";if(o.StringUtil.StringContainsSeparatedWord(a,c+" al coda",!0)){var h=new n.RepetitionInstruction(r,n.RepetitionInstructionEnum.DalSegnoAlCoda);return this.addInstruction(this.repetitionInstructions,h),!0}if(o.StringUtil.StringContainsSeparatedWord(a,c+" al fine",!0)){var f=new n.RepetitionInstruction(r,n.RepetitionInstructionEnum.DaCapoAlFine);return this.addInstruction(this.repetitionInstructions,f),!0}if(o.StringUtil.StringContainsSeparatedWord(a,c+" al coda",!0)){var d=new n.RepetitionInstruction(r,n.RepetitionInstructionEnum.DaCapoAlCoda);return this.addInstruction(this.repetitionInstructions,d),!0}if(o.StringUtil.StringContainsSeparatedWord(a,c)||o.StringUtil.StringContainsSeparatedWord(a,"da\\s?capo",!0)){var p=new n.RepetitionInstruction(r,n.RepetitionInstructionEnum.DaCapo);return this.addInstruction(this.repetitionInstructions,p),!0}if(o.StringUtil.StringContainsSeparatedWord(a,s,!0)||o.StringUtil.StringContainsSeparatedWord(a,"dal\\s?segno",!0))return l=o.StringUtil.StringContainsSeparatedWord(a,"al\\s?coda",!0)?new n.RepetitionInstruction(r,n.RepetitionInstructionEnum.DalSegnoAlCoda):new n.RepetitionInstruction(r,n.RepetitionInstructionEnum.DalSegno),this.addInstruction(this.repetitionInstructions,l),!0;if(o.StringUtil.StringContainsSeparatedWord(a,"to\\s?coda",!0)||o.StringUtil.StringContainsSeparatedWord(a,"a (la )?coda",!0)){var m=new n.RepetitionInstruction(r,n.RepetitionInstructionEnum.ToCoda);return this.addInstruction(this.repetitionInstructions,m),!0}if(o.StringUtil.StringContainsSeparatedWord(a,"fine",!0)){var v=new n.RepetitionInstruction(r,n.RepetitionInstructionEnum.Fine);return this.addInstruction(this.repetitionInstructions,v),!0}if(o.StringUtil.StringContainsSeparatedWord(a,"coda",!0)){var b=new n.RepetitionInstruction(r,n.RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,b),!0}if(o.StringUtil.StringContainsSeparatedWord(a,"segno",!0)){var g=new n.RepetitionInstruction(r,n.RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,g),!0}}else{if(t.element("segno")){var y=new n.RepetitionInstruction(r,n.RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,y),!0}if(t.element("coda")){var S=new n.RepetitionInstruction(r,n.RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,S),!0}}return!1},e.removeRedundantInstructions=function(){for(var t=0,e=0,i=0,o=0,s=0;s0&&this.findInstructionInPreviousMeasure(s,a.measureIndex,n.RepetitionInstructionEnum.ToCoda)&&(a.type=n.RepetitionInstructionEnum.None),0===e&&0===i&&(a.type=n.RepetitionInstructionEnum.ToCoda,a.alignment=n.AlignmentType.End,a.measureIndex--);break;case n.RepetitionInstructionEnum.Segno:if(t-o>0){for(var u=!1,l=0,c=this.repetitionInstructions.length;l0?n.RepetitionInstructionEnum.DalSegnoAlCoda:n.RepetitionInstructionEnum.DalSegno,a.type=n.RepetitionInstructionEnum.None,u=!0;break;case n.RepetitionInstructionEnum.DalSegno:case n.RepetitionInstructionEnum.DalSegnoAlFine:case n.RepetitionInstructionEnum.DalSegnoAlCoda:a.type=n.RepetitionInstructionEnum.None,u=!0}if(u)break}if(u)break;a.type=i-e>0?n.RepetitionInstructionEnum.DalSegnoAlCoda:n.RepetitionInstructionEnum.DalSegno,a.alignment=n.AlignmentType.End,a.measureIndex--}}if(this.backwardSearchForPreviousIdenticalInstruction(s,a)||a.type===n.RepetitionInstructionEnum.None)this.repetitionInstructions.splice(s,1),s--;else switch(a.type){case n.RepetitionInstructionEnum.Fine:break;case n.RepetitionInstructionEnum.ToCoda:i++;break;case n.RepetitionInstructionEnum.Coda:e++;break;case n.RepetitionInstructionEnum.Segno:t++;break;case n.RepetitionInstructionEnum.DalSegnoAlFine:case n.RepetitionInstructionEnum.DalSegnoAlCoda:o++}}this.repetitionInstructions.sort(r.RepetitionInstructionComparer.Compare)},e.findInstructionInPreviousMeasure=function(t,e,i){for(var n=t-1;n>=0;n--){var r=this.repetitionInstructions[n];if(e-r.measureIndex==1&&r.type===i)return!0}return!1},e.backwardSearchForPreviousIdenticalInstruction=function(t,e){for(var i=t-1;i>=0;i--)if(this.repetitionInstructions[i].equals(e))return!0;return!1},e.addInstruction=function(t,e){for(var i=!0,n=0,r=t.length;n1&&l.FirstRepetitionInstructions.sort(r.RepetitionInstructionComparer.Compare),l.LastRepetitionInstructions.length>1&&l.LastRepetitionInstructions.sort(r.RepetitionInstructionComparer.Compare)}},e.handleRepetitionInstructions=function(t){if(!this.currentMeasure)return!1;switch(t.type){case n.RepetitionInstructionEnum.StartLine:this.currentMeasure.FirstRepetitionInstructions.push(t);break;case n.RepetitionInstructionEnum.BackJumpLine:this.currentMeasure.LastRepetitionInstructions.push(t);break;case n.RepetitionInstructionEnum.Ending:if(t.alignment===n.AlignmentType.Begin)this.currentMeasure.FirstRepetitionInstructions.push(t);else for(var e=0,i=t.endingIndices.length;e1)for(var i=1;ii.copies?this.nElements-=i.copies:this.nElements-=e,i.copies-=e,i.copies<=0&&this.dictionary.remove(t),!0}return!1},t.prototype.toArray=function(){for(var t=[],e=0,i=this.dictionary.values();e-1&&this.insertIdIntoRoot(e,i),this.nodes)if(this.nodes.hasOwnProperty(n)){var r=this.findNodeId(n,t);r>-1&&this.insertIdIntoNode(n,e,r)}},t.prototype.insertIdAfterId=function(t,e){var i=this.findRootId(t);for(var n in i>-1&&this.insertIdIntoRoot(e,i+1),this.nodes)if(this.nodes.hasOwnProperty(n)){var r=this.findNodeId(n,t);r>-1&&this.insertIdIntoNode(n,e,r+1)}},t.prototype.insertIdIntoId=function(t,e){this.nodeInsertAtEnd(t,e),this.nodes[e]=[]},t.prototype.insertIdIntoRoot=function(t,e){if(void 0===e)this.rootInsertAtEnd(t);else if(e<0){var i=this.rootIds.length;this.rootIds.splice(e+i+1,0,t)}else this.rootIds.splice(e,0,t);this.nodes[t]=this.nodes[t]||[]},t.prototype.insertIdIntoNode=function(t,e,i){if(this.nodes[t]=this.nodes[t]||[],this.nodes[e]=this.nodes[e]||[],void 0===i)this.nodeInsertAtEnd(t,e);else if(i<0){var n=this.nodes[t].length;this.nodes[t].splice(i+n+1,0,e)}else this.nodes[t].splice(i,0,e)},t.prototype.moveId=function(t,e,i){var r=t,o=this.findRootId(r);for(var s in this.nodes[e],this.nodes)if(this.nodes.hasOwnProperty(s)){this.findNodeId(s,e);break}var a=e,u=this.findRootId(a);for(var s in this.nodes[e],this.nodes)if(this.nodes.hasOwnProperty(s)){this.findNodeId(s,e);break}if(o>-1){if(u>-1)switch(this.rootDelete(o),u>o&&u--,i){case n.BEFORE:this.insertIdIntoRoot(r,u);break;case n.AFTER:this.insertIdIntoRoot(r,u+1);break;case n.INSIDE_AT_START:this.nodeInsertAtStart(a,r);break;case n.INSIDE_AT_END:this.nodeInsertAtEnd(a,r)}else for(var s in this.rootDelete(o),this.nodes)if(this.nodes.hasOwnProperty(s)&&(l=this.findNodeId(s,a))>-1){switch(i){case n.BEFORE:this.insertIdIntoNode(s,r,l);break;case n.AFTER:this.insertIdIntoNode(s,r,l+1);break;case n.INSIDE_AT_START:this.nodeInsertAtStart(a,r);break;case n.INSIDE_AT_END:this.nodeInsertAtEnd(a,r)}break}}else if(u>-1){for(var s in this.nodes)if(this.nodes.hasOwnProperty(s)&&(l=this.findNodeId(s,r))>-1){this.nodeDeleteAtIndex(s,l);break}switch(i){case n.BEFORE:this.insertIdIntoRoot(r,u);break;case n.AFTER:this.insertIdIntoRoot(r,u+1);break;case n.INSIDE_AT_START:this.nodeInsertAtStart(a,r);break;case n.INSIDE_AT_END:this.nodeInsertAtEnd(a,r)}}else{for(var s in this.nodes)if(this.nodes.hasOwnProperty(s)&&(l=this.findNodeId(s,r))>-1){this.nodeDeleteAtIndex(s,l);break}for(var s in this.nodes){var l;if(this.nodes.hasOwnProperty(s)&&(l=this.findNodeId(s,a))>-1){switch(i){case n.BEFORE:this.insertIdIntoNode(s,r,l);break;case n.AFTER:this.insertIdIntoNode(s,r,l+1);break;case n.INSIDE_AT_START:this.nodeInsertAtStart(a,r);break;case n.INSIDE_AT_END:this.nodeInsertAtEnd(a,r)}break}}}},t.prototype.swapArrayElements=function(t,e,i){var n=t[e];return t[e]=t[i],t[i]=n,t},t.prototype.rootDeleteId=function(t){var e=this.findRootId(t);e>-1&&this.rootDelete(e)},t.prototype.nodeAndSubNodesDelete=function(t){for(var e=[],i=0;i=0;i--)if(e=this.timestamps[i],t.gte(e.$from))return e;return this.timestamps[0]},e.absoluteEnrolledToSheetTimestamp=function(t){if(0===this.timestamps.length)return t;var e=this.getCurrentRepetitionTimestampTransform(t);return n.Fraction.plus(t,n.Fraction.minus(e.to,e.$from))},e.getIterator=function(t){return t?new r.MusicPartManagerIterator(this.musicSheet,t,void 0):new r.MusicPartManagerIterator(this.musicSheet,this.musicSheet.SelectionStart,this.musicSheet.SelectionEnd)},e.setSelectionStart=function(t){this.musicSheet.SelectionStart=t,this.musicSheet.SelectionEnd=void 0},e.setSelectionRange=function(t,e){this.musicSheet.SelectionStart=null!=t?t:this.sheetStart,this.musicSheet.SelectionEnd=null!=e?e:this.sheetEnd},e.calcMapping=function(){var t=[],e=this.getIterator(),i=e.CurrentRepetition,n=new o(e.CurrentEnrolledTimestamp.clone(),e.CurrentSourceTimestamp.clone(),void 0,0);for(t.push(n);!e.EndReached;){if(e.JumpOccurred||i!==e.CurrentRepetition){if(i=e.CurrentRepetition,e.backJumpOccurred){var r=e.JumpResponsibleRepetition;n.nextBackJump=e.CurrentEnrolledTimestamp,n.curRepetition=r,n.curRepetitionIteration=e.CurrentJumpResponsibleRepetitionIterationBeforeJump;for(var s=this.timestamps.length-2;s>=0&&!t[s].to.lt(r.AbsoluteTimestamp)&&!t[s].curRepetition;s--)t[s].nextBackJump=n.nextBackJump,t[s].curRepetition=r,t[s].curRepetitionIteration=n.curRepetitionIteration}n=new o(e.CurrentEnrolledTimestamp.clone(),e.CurrentSourceTimestamp.clone(),void 0,0),t.push(n)}e.moveToNext()}this.timestamps=t},_createClass2(t,[{key:"Parts",get:function(){return this.parts}},{key:"MusicSheet",get:function(){return this.musicSheet}}]),t}();var o=function(t,e,i,n){this.$from=t,this.to=e,this.curRepetition=i,this.curRepetitionIteration=n,this.nextBackJump=void 0,this.nextForwardJump=void 0};e.TimestampTransform=o},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MusicPartManagerIterator=void 0;var r=i(0),o=i(168),s=i(19),a=i(32),u=n(i(1)),l=function(){function t(t,e,i){this.currentMeasureIndex=0,this.currentPartIndex=0,this.currentVoiceEntryIndex=-1,this.currentDynamicEntryIndex=0,this.currentTempoEntryIndex=0,this.currentDynamicChangingExpressions=[],this.currentRepetition=void 0,this.endReached=!1,this.frontReached=!1,this.currentTimeStamp=new r.Fraction(0,1),this.currentEnrolledMeasureTimestamp=new r.Fraction(0,1),this.currentRelativeInMeasureTimestamp=new r.Fraction(0,1),this.currentVerticalContainerInMeasureTimestamp=new r.Fraction(0,1),this.jumpResponsibleRepetition=void 0,this.activeDynamicExpressions=[];try{this.frontReached=!0,this.musicSheet=t,this.currentVoiceEntries=void 0,this.frontReached=!1;for(var n,s=_createForOfIteratorHelperLoose(this.musicSheet.Repetitions);!(n=s()).done;){var l=n.value;this.setRepetitionIterationCount(l,1)}if(this.activeDynamicExpressions=new Array(this.musicSheet.getCompleteNumberOfStaves()),this.currentMeasure=this.musicSheet.SourceMeasures[0],!e)return;do{this.moveToNext()}while((!this.currentVoiceEntries||this.currentTimeStamp.lt(e))&&!this.endReached);for(var c=0;c=this.JumpResponsibleRepetition.StartIndex&&n.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(n)}}},e.handleRepetitionsAtMeasureEnd=function(){for(var t=0,e=this.currentMeasure.LastRepetitionInstructions.length;t-1&&this.getRepetitionIterationCount(n)=this.JumpResponsibleRepetition.StartIndex&&n.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(n);var r=n.getForwardJumpTargetForIteration(this.getRepetitionIterationCount(n));if(r>=0)return this.currentMeasureIndex=r,this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.jumpResponsibleRepetition=n,void(this.forwardJumpOccurred=!0);-2===r&&(this.endReached=!0)}}}this.currentMeasureIndex++,void 0!==this.JumpResponsibleRepetition&&this.currentMeasureIndex>this.JumpResponsibleRepetition.EndIndex&&(this.jumpResponsibleRepetition=void 0)},e.doBackJump=function(t){this.currentMeasureIndex=t.getBackwardJumpTarget(),this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.incrementRepetitionIterationCount(t),this.jumpResponsibleRepetition=t},e.activateCurrentRhythmInstructions=function(){if(void 0!==this.currentMeasure&&this.currentMeasure.FirstInstructionsStaffEntries.length>0&&void 0!==this.currentMeasure.FirstInstructionsStaffEntries[0])for(var t=this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions,e=0,i=t.length;e0&&(this.currentDynamicEntryIndex>=t.length||this.CurrentSourceTimestamp.lte(t[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp));)this.currentDynamicEntryIndex--;for(;this.currentDynamicEntryIndex0&&(this.currentTempoEntryIndex>=c.length||this.CurrentSourceTimestamp.lte(c[this.currentTempoEntryIndex].AbsoluteTimestamp));)this.currentTempoEntryIndex--;for(;this.currentTempoEntryIndex=0&&this.currentVoiceEntryIndex=0&&this.currentMeasureIndex0){if(!t)return!0;for(var i=0,n=e.length;i=0&&(this.syllableIndex=r)}return _createClass2(t,[{key:"Text",get:function(){return this.text},set:function(t){this.text=t}},{key:"Word",get:function(){return this.word}},{key:"Parent",get:function(){return this.parent},set:function(t){this.parent=t}},{key:"VerseNumber",get:function(){return this.verseNumber}},{key:"SyllableIndex",get:function(){return this.syllableIndex}}]),t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Articulation=void 0,e.Articulation=function(){function t(t,e){this.articulationEnum=t,this.placement=e}return t.prototype.Equals=function(t){return t.articulationEnum===this.articulationEnum&&t.placement===this.placement},t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.TabNote=void 0;var n=function(t){function e(e,i,n,r,o,s,a,u,l){var c;return(c=t.call(this,e,i,n,r,o)||this).stringNumberTab=s,c.fretNumber=a,c.bendArray=u,c.vibratoStroke=l,c}return _inheritsLoose(e,t),_createClass2(e,[{key:"StringNumberTab",get:function(){return this.stringNumberTab}},{key:"FretNumber",get:function(){return this.fretNumber}},{key:"BendArray",get:function(){return this.bendArray}},{key:"VibratoStroke",get:function(){return this.vibratoStroke}}]),e}(i(36).Note);e.TabNote=n},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Slur=void 0;var n=i(0);e.Slur=function(){function t(){}var e=t.prototype;return e.startNoteHasMoreStartingSlurs=function(){if(!this.startNote)return!1;for(var t=0,e=this.startNote.NoteSlurs.length;t>2,a=(3&e)<<4|i>>4,u=1>6:64,l=2>4,i=(15&s)<<4|(a=o.indexOf(t.charAt(l++)))>>2,n=(3&a)<<6|(u=o.indexOf(t.charAt(l++))),f[c++]=e,64!==a&&(f[c++]=i),64!==u&&(f[c++]=n);return f}},{"./support":30,"./utils":32}],2:[function(t,e,i){var n=t("./external"),r=t("./stream/DataWorker"),o=t("./stream/DataLengthProbe"),s=t("./stream/Crc32Probe");function a(t,e,i,n,r){this.compressedSize=t,this.uncompressedSize=e,this.crc32=i,this.compression=n,this.compressedContent=r}o=t("./stream/DataLengthProbe"),a.prototype={getContentWorker:function(){var t=new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),e=this;return t.on("end",(function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),t},getCompressedWorker:function(){return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(t,e,i){return t.pipe(new s).pipe(new o("uncompressedSize")).pipe(e.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",e)},e.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,i){var n=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(t){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,i){var n=t("./utils"),r=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();e.exports=function(t,e){return void 0!==t&&t.length?"string"!==n.getTypeOf(t)?function(t,e,i,n){var o=r,s=0+i;t^=-1;for(var a=0;a>>8^o[255&(t^e[a])];return-1^t}(0|e,t,t.length):function(t,e,i,n){var o=r,s=0+i;t^=-1;for(var a=0;a>>8^o[255&(t^e.charCodeAt(a))];return-1^t}(0|e,t,t.length):0}},{"./utils":32}],5:[function(t,e,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,e,i){var n;n="undefined"!=typeof Promise?Promise:t("lie"),e.exports={Promise:n}},{lie:37}],7:[function(t,e,i){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,r=t("pako"),o=t("./utils"),s=t("./stream/GenericWorker"),a=n?"uint8array":"array";function u(t,e){s.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}i.magic="\b\0",o.inherits(u,s),u.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(a,t.data),!1)},u.prototype.flush=function(){s.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},i.compressWorker=function(t){return new u("Deflate",t)},i.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,i){function n(t,e){var i,n="";for(i=0;i>>=8;return n}function r(t,e,i,r,s,c){var h,f,d=t.file,p=t.compression,m=c!==a.utf8encode,v=o.transformTo("string",c(d.name)),b=o.transformTo("string",a.utf8encode(d.name)),g=d.comment,y=o.transformTo("string",c(g)),S=o.transformTo("string",a.utf8encode(g)),_=b.length!==d.name.length,x=S.length!==g.length,E="",w="",T="",M=d.dir,P=d.date,L={crc32:0,compressedSize:0,uncompressedSize:0};e&&!i||(L.crc32=t.crc32,L.compressedSize=t.compressedSize,L.uncompressedSize=t.uncompressedSize);var I=0;e&&(I|=8),m||!_&&!x||(I|=2048);var A=0,C=0;M&&(A|=16),"UNIX"===s?(C=798,A|=function(t,e){var i=t;return t||(i=e?16893:33204),(65535&i)<<16}(d.unixPermissions,M)):(C=20,A|=function(t){return 63&(t||0)}(d.dosPermissions)),h=P.getUTCHours(),h<<=6,h|=P.getUTCMinutes(),h<<=5,h|=P.getUTCSeconds()/2,f=P.getUTCFullYear()-1980,f<<=4,f|=P.getUTCMonth()+1,f<<=5,f|=P.getUTCDate(),_&&(w=n(1,1)+n(u(v),4)+b,E+="up"+n(w.length,2)+w),x&&(T=n(1,1)+n(u(y),4)+S,E+="uc"+n(T.length,2)+T);var R="";return R+="\n\0",R+=n(I,2),R+=p.magic,R+=n(h,2),R+=n(f,2),R+=n(L.crc32,4),R+=n(L.compressedSize,4),R+=n(L.uncompressedSize,4),R+=n(v.length,2),R+=n(E.length,2),{fileRecord:l.LOCAL_FILE_HEADER+R+v+E,dirRecord:l.CENTRAL_FILE_HEADER+n(C,2)+R+n(y.length,2)+"\0\0\0\0"+n(A,4)+n(r,4)+v+E+y}}var o=t("../utils"),s=t("../stream/GenericWorker"),a=t("../utf8"),u=t("../crc32"),l=t("../signature");function c(t,e,i,n){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=i,this.encodeFileName=n,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(c,s),c.prototype.push=function(t){var e=t.meta.percent||0,i=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,s.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:i?(e+100*(i-n-1))/i:100}}))},c.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var i=r(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(t){this.accumulate=!1;var e=this.streamFiles&&!t.file.dir,i=r(t,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),e)this.push({data:function(t){return l.DATA_DESCRIPTOR+n(t.crc32,4)+n(t.compressedSize,4)+n(t.uncompressedSize,4)}(t),meta:{percent:100}});else for(this.push({data:i.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e=this.index;e--)i=(i<<8)+this.byteAt(e);return this.index+=t,i},readString:function(t){return n.transformTo("string",this.readData(t))},readData:function(t){},lastIndexOfSignature:function(t){},readAndCheckSignature:function(t){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=r},{"../utils":32}],19:[function(t,e,i){var n=t("./Uint8ArrayReader");function r(t){n.call(this,t)}t("../utils").inherits(r,n),r.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,i){var n=t("./DataReader");function r(t){n.call(this,t)}t("../utils").inherits(r,n),r.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},r.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},r.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},r.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=r},{"../utils":32,"./DataReader":18}],21:[function(t,e,i){var n=t("./ArrayReader");function r(t){n.call(this,t)}t("../utils").inherits(r,n),r.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,i){var n=t("../utils"),r=t("../support"),o=t("./ArrayReader"),s=t("./StringReader"),a=t("./NodeBufferReader"),u=t("./Uint8ArrayReader");e.exports=function(t){var e=n.getTypeOf(t);return n.checkSupport(e),"string"!==e||r.uint8array?"nodebuffer"===e?new a(t):r.uint8array?new u(n.transformTo("uint8array",t)):new o(n.transformTo("array",t)):new s(t)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(t,e,i){var n=t("./GenericWorker"),r=t("../utils");function o(t){n.call(this,"ConvertWorker to "+t),this.destType=t}r.inherits(o,n),o.prototype.processChunk=function(t){this.push({data:r.transformTo(this.destType,t.data),meta:t.meta})},e.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,i){var n=t("./GenericWorker"),r=t("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,n),o.prototype.processChunk=function(t){this.streamInfo.crc32=r(t.data,this.streamInfo.crc32||0),this.push(t)},e.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,i){var n=t("../utils"),r=t("./GenericWorker");function o(t){r.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}n.inherits(o,r),o.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}r.prototype.processChunk.call(this,t)},e.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,i){var n=t("../utils"),r=t("./GenericWorker");function o(t){r.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then((function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=n.getTypeOf(t),e.isPaused||e._tickAndRepeat()}),(function(t){e.error(t)}))}n.inherits(o,r),o.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,i){function n(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var i=0;i "+t:t}},e.exports=n},{}],29:[function(t,i,n){var r=t("../utils"),o=t("./ConvertWorker"),s=t("./GenericWorker"),a=t("../base64"),u=t("../support"),l=t("../external"),c=null;if(u.nodestream)try{c=t("../nodejs/NodejsStreamOutputAdapter")}catch(t){}function h(t,e,i){var n=e;switch(e){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=e,this._mimeType=i,r.checkSupport(n),this._worker=t.pipe(new o(n)),t.lock()}catch(t){this._worker=new s("error"),this._worker.error(t)}}h.prototype={accumulate:function(t){return function(t,i){return new l.Promise((function(n,o){var s=[],u=t._internalType,l=t._outputType,c=t._mimeType;t.on("data",(function(t,e){s.push(t),i&&i(e)})).on("error",(function(t){s=[],o(t)})).on("end",(function(){try{var t=function(t,e,i){switch(t){case"blob":return r.newBlob(r.transformTo("arraybuffer",e),i);case"base64":return a.encode(e);default:return r.transformTo(t,e)}}(l,function(t,i){var n,r=0,o=null,s=0;for(n=0;n>>6:(i<65536?e[s++]=224|i>>>12:(e[s++]=240|i>>>18,e[s++]=128|i>>>12&63),e[s++]=128|i>>>6&63),e[s++]=128|63&i);return e}(t)},i.utf8decode=function(t){return r.nodebuffer?n.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,i,r,o,s=t.length,u=new Array(2*s);for(e=i=0;e>10&1023,u[i++]=56320|1023&r)}return u.length!==i&&(u.subarray?u=u.subarray(0,i):u.length=i),n.applyFromCharCode(u)}(t=n.transformTo(r.uint8array?"uint8array":"array",t))},n.inherits(l,s),l.prototype.processChunk=function(t){var e=n.transformTo(r.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var o=e;(e=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),e.set(o,this.leftOver.length)}else e=this.leftOver.concat(e);this.leftOver=null}var s=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;0<=i&&128==(192&t[i]);)i--;return i<0||0===i?e:i+a[t[i]]>e?i:e}(e),u=e;s!==e.length&&(r.uint8array?(u=e.subarray(0,s),this.leftOver=e.subarray(s,e.length)):(u=e.slice(0,s),this.leftOver=e.slice(s,e.length))),this.push({data:i.utf8decode(u),meta:t.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=l,n.inherits(c,s),c.prototype.processChunk=function(t){this.push({data:i.utf8encode(t.data),meta:t.meta})},i.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,i){var n=t("./support"),r=t("./base64"),o=t("./nodejsUtils"),s=t("set-immediate-shim"),a=t("./external");function u(t){return t}function l(t,e){for(var i=0;i>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(t){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(t){var e,i,n,r=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index>>6:(i<65536?e[s++]=224|i>>>12:(e[s++]=240|i>>>18,e[s++]=128|i>>>12&63),e[s++]=128|i>>>6&63),e[s++]=128|63&i);return e},i.buf2binstring=function(t){return u(t,t.length)},i.binstring2buf=function(t){for(var e=new n.Buf8(t.length),i=0,r=e.length;i>10&1023,l[n++]=56320|1023&r)}return u(l,n)},i.utf8border=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;0<=i&&128==(192&t[i]);)i--;return i<0||0===i?e:i+s[t[i]]>e?i:e}},{"./common":41}],43:[function(t,e,i){e.exports=function(t,e,i,n){for(var r=65535&t|0,o=t>>>16&65535|0,s=0;0!==i;){for(i-=s=2e3>>1:t>>>1;e[i]=t}return e}();e.exports=function(t,e,i,r){var o=n,s=r+i;t^=-1;for(var a=r;a>>8^o[255&(t^e[a])];return-1^t}},{}],46:[function(t,e,i){var n,r=t("../utils/common"),o=t("./trees"),s=t("./adler32"),a=t("./crc32"),u=t("./messages"),l=-2,c=258,h=262,f=113;function d(t,e){return t.msg=u[e],e}function p(t){return(t<<1)-(4t.avail_out&&(i=t.avail_out),0!==i&&(r.arraySet(t.output,e.pending_buf,e.pending_out,i,t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))}function b(t,e){o._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,v(t.strm)}function g(t,e){t.pending_buf[t.pending++]=e}function y(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function S(t,e){var i,n,r=t.max_chain_length,o=t.strstart,s=t.prev_length,a=t.nice_match,u=t.strstart>t.w_size-h?t.strstart-(t.w_size-h):0,l=t.window,f=t.w_mask,d=t.prev,p=t.strstart+c,m=l[o+s-1],v=l[o+s];t.prev_length>=t.good_match&&(r>>=2),a>t.lookahead&&(a=t.lookahead);do{if(l[(i=e)+s]===v&&l[i+s-1]===m&&l[i]===l[o]&&l[++i]===l[o+1]){o+=2,i++;do{}while(l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&ou&&0!=--r);return s<=t.lookahead?s:t.lookahead}function _(t){var e,i,n,o,u,l,c,f,d,p,m=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=m+(m-h)){for(r.arraySet(t.window,t.window,m,m,0),t.match_start-=m,t.strstart-=m,t.block_start-=m,e=i=t.hash_size;n=t.head[--e],t.head[e]=m<=n?n-m:0,--i;);for(e=i=m;n=t.prev[--e],t.prev[e]=m<=n?n-m:0,--i;);o+=m}if(0===t.strm.avail_in)break;if(l=t.strm,c=t.window,f=t.strstart+t.lookahead,p=void 0,(d=o)<(p=l.avail_in)&&(p=d),i=0===p?0:(l.avail_in-=p,r.arraySet(c,l.input,l.next_in,p,f),1===l.state.wrap?l.adler=s(l.adler,c,p,f):2===l.state.wrap&&(l.adler=a(l.adler,c,p,f)),l.next_in+=p,l.total_in+=p,p),t.lookahead+=i,t.lookahead+t.insert>=3)for(u=t.strstart-t.insert,t.ins_h=t.window[u],t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<=3)if(n=o._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<=3&&t.match_length<=t.prev_length){for(r=t.strstart+t.lookahead-3,n=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=r&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if(_(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+i;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,b(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-h&&(b(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(b(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(b(t,!1),t.strm.avail_out),1)})),new w(4,4,8,4,x),new w(4,5,16,8,x),new w(4,6,32,32,x),new w(4,4,16,16,E),new w(8,16,32,32,E),new w(8,16,128,128,E),new w(8,32,128,256,E),new w(32,128,258,1024,E),new w(32,258,258,4096,E)],i.deflateInit=function(t,e){return L(t,e,8,15,8,0)},i.deflateInit2=L,i.deflateReset=P,i.deflateResetKeep=M,i.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?l:(t.state.gzhead=e,0):l},i.deflate=function(t,e){var i,r,s,u;if(!t||!t.state||5>8&255),g(r,r.gzhead.time>>16&255),g(r,r.gzhead.time>>24&255),g(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),g(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(g(r,255&r.gzhead.extra.length),g(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=a(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(g(r,0),g(r,0),g(r,0),g(r,0),g(r,0),g(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),g(r,3),r.status=f);else{var h=8+(r.w_bits-8<<4)<<8;h|=(2<=r.strategy||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(h|=32),h+=31-h%31,r.status=f,y(r,h),0!==r.strstart&&(y(r,t.adler>>>16),y(r,65535&t.adler)),t.adler=1}if(69===r.status)if(r.gzhead.extra){for(s=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>s&&(t.adler=a(t.adler,r.pending_buf,r.pending-s,s)),v(t),s=r.pending,r.pending!==r.pending_buf_size));)g(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>s&&(t.adler=a(t.adler,r.pending_buf,r.pending-s,s)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){s=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>s&&(t.adler=a(t.adler,r.pending_buf,r.pending-s,s)),v(t),s=r.pending,r.pending===r.pending_buf_size)){u=1;break}u=r.gzindexs&&(t.adler=a(t.adler,r.pending_buf,r.pending-s,s)),0===u&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){s=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>s&&(t.adler=a(t.adler,r.pending_buf,r.pending-s,s)),v(t),s=r.pending,r.pending===r.pending_buf_size)){u=1;break}u=r.gzindexs&&(t.adler=a(t.adler,r.pending_buf,r.pending-s,s)),0===u&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&v(t),r.pending+2<=r.pending_buf_size&&(g(r,255&t.adler),g(r,t.adler>>8&255),t.adler=0,r.status=f)):r.status=f),0!==r.pending){if(v(t),0===t.avail_out)return r.last_flush=-1,0}else if(0===t.avail_in&&p(e)<=p(i)&&4!==e)return d(t,-5);if(666===r.status&&0!==t.avail_in)return d(t,-5);if(0!==t.avail_in||0!==r.lookahead||0!==e&&666!==r.status){var S=2===r.strategy?function(t,e){for(var i;;){if(0===t.lookahead&&(_(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,i=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(b(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(b(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(b(t,!1),0===t.strm.avail_out)?1:2}(r,e):3===r.strategy?function(t,e){for(var i,n,r,s,a=t.window;;){if(t.lookahead<=c){if(_(t),t.lookahead<=c&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&0t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=o._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(b(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(b(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(b(t,!1),0===t.strm.avail_out)?1:2}(r,e):n[r.level].func(r,e);if(3!==S&&4!==S||(r.status=666),1===S||3===S)return 0===t.avail_out&&(r.last_flush=-1),0;if(2===S&&(1===e?o._tr_align(r):5!==e&&(o._tr_stored_block(r,0,0,!1),3===e&&(m(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),v(t),0===t.avail_out))return r.last_flush=-1,0}return 4!==e?0:r.wrap<=0?1:(2===r.wrap?(g(r,255&t.adler),g(r,t.adler>>8&255),g(r,t.adler>>16&255),g(r,t.adler>>24&255),g(r,255&t.total_in),g(r,t.total_in>>8&255),g(r,t.total_in>>16&255),g(r,t.total_in>>24&255)):(y(r,t.adler>>>16),y(r,65535&t.adler)),v(t),0=i.w_size&&(0===a&&(m(i.head),i.strstart=0,i.block_start=0,i.insert=0),f=new r.Buf8(i.w_size),r.arraySet(f,e,d-i.w_size,i.w_size,0),e=f,d=i.w_size),u=t.avail_in,c=t.next_in,h=t.input,t.avail_in=d,t.next_in=0,t.input=e,_(i);i.lookahead>=3;){for(n=i.strstart,o=i.lookahead-2;i.ins_h=(i.ins_h<>>=S=y>>>24,p-=S,0==(S=y>>>16&255))M[o++]=65535&y;else{if(!(16&S)){if(0==(64&S)){y=m[(65535&y)+(d&(1<>>=S,p-=S),p<15&&(d+=T[n++]<>>=S=y>>>24,p-=S,!(16&(S=y>>>16&255))){if(0==(64&S)){y=v[(65535&y)+(d&(1<>>=S,p-=S,(S=o-s)>3,d&=(1<<(p-=_<<3))-1,t.next_in=n,t.next_out=o,t.avail_in=n>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function h(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new n.Buf32(852),e.distcode=e.distdyn=new n.Buf32(592),e.sane=1,e.back=-1,0):u}function f(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,h(t)):u}function d(t,e){var i,n;return t&&t.state?(n=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15=s.wsize?(n.arraySet(s.window,e,i-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(r<(o=s.wsize-s.wnext)&&(o=r),n.arraySet(s.window,e,i-r,o,s.wnext),(r-=o)?(n.arraySet(s.window,e,i-r,r,0),s.wnext=r,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,i.check=o(i.check,O,2,0),b=v=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&v)<<8)+(v>>8))%31){t.msg="incorrect header check",i.mode=30;break}if(8!=(15&v)){t.msg="unknown compression method",i.mode=30;break}if(b-=4,C=8+(15&(v>>>=4)),0===i.wbits)i.wbits=C;else if(C>i.wbits){t.msg="invalid window size",i.mode=30;break}i.dmax=1<>8&1),512&i.flags&&(O[0]=255&v,O[1]=v>>>8&255,i.check=o(i.check,O,2,0)),b=v=0,i.mode=3;case 3:for(;b<32;){if(0===p)break t;p--,v+=c[f++]<>>8&255,O[2]=v>>>16&255,O[3]=v>>>24&255,i.check=o(i.check,O,4,0)),b=v=0,i.mode=4;case 4:for(;b<16;){if(0===p)break t;p--,v+=c[f++]<>8),512&i.flags&&(O[0]=255&v,O[1]=v>>>8&255,i.check=o(i.check,O,2,0)),b=v=0,i.mode=5;case 5:if(1024&i.flags){for(;b<16;){if(0===p)break t;p--,v+=c[f++]<>>8&255,i.check=o(i.check,O,2,0)),b=v=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(p<(x=i.length)&&(x=p),x&&(i.head&&(C=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),n.arraySet(i.head.extra,c,f,x,C)),512&i.flags&&(i.check=o(i.check,c,x,f)),p-=x,f+=x,i.length-=x),i.length))break t;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===p)break t;for(x=0;C=c[f+x++],i.head&&C&&i.length<65536&&(i.head.name+=String.fromCharCode(C)),C&&x>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=12;break;case 10:for(;b<32;){if(0===p)break t;p--,v+=c[f++]<>>=7&b,b-=7&b,i.mode=27;break}for(;b<3;){if(0===p)break t;p--,v+=c[f++]<>>=1)){case 0:i.mode=14;break;case 1:if(g(i),i.mode=20,6!==e)break;v>>>=2,b-=2;break t;case 2:i.mode=17;break;case 3:t.msg="invalid block type",i.mode=30}v>>>=2,b-=2;break;case 14:for(v>>>=7&b,b-=7&b;b<32;){if(0===p)break t;p--,v+=c[f++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&v,b=v=0,i.mode=15,6===e)break t;case 15:i.mode=16;case 16:if(x=i.length){if(p>>=5,b-=5,i.ndist=1+(31&v),v>>>=5,b-=5,i.ncode=4+(15&v),v>>>=4,b-=4,286>>=3,b-=3}for(;i.have<19;)i.lens[B[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,N={bits:i.lenbits},R=a(0,i.lens,0,19,i.lencode,0,i.work,N),i.lenbits=N.bits,R){t.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have>>16&255,P=65535&F,!((T=F>>>24)<=b);){if(0===p)break t;p--,v+=c[f++]<>>=T,b-=T,i.lens[i.have++]=P;else{if(16===P){for(k=T+2;b>>=T,b-=T,0===i.have){t.msg="invalid bit length repeat",i.mode=30;break}C=i.lens[i.have-1],x=3+(3&v),v>>>=2,b-=2}else if(17===P){for(k=T+3;b>>=T)),v>>>=3,b-=3}else{for(k=T+7;b>>=T)),v>>>=7,b-=7}if(i.have+x>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=30;break}for(;x--;)i.lens[i.have++]=C}}if(30===i.mode)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,N={bits:i.lenbits},R=a(1,i.lens,0,i.nlen,i.lencode,0,i.work,N),i.lenbits=N.bits,R){t.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,N={bits:i.distbits},R=a(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,N),i.distbits=N.bits,R){t.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===e)break t;case 20:i.mode=21;case 21:if(6<=p&&258<=m){t.next_out=d,t.avail_out=m,t.next_in=f,t.avail_in=p,i.hold=v,i.bits=b,s(t,_),d=t.next_out,h=t.output,m=t.avail_out,f=t.next_in,c=t.input,p=t.avail_in,v=i.hold,b=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;M=(F=i.lencode[v&(1<>>16&255,P=65535&F,!((T=F>>>24)<=b);){if(0===p)break t;p--,v+=c[f++]<>L)])>>>16&255,P=65535&F,!(L+(T=F>>>24)<=b);){if(0===p)break t;p--,v+=c[f++]<>>=L,b-=L,i.back+=L}if(v>>>=T,b-=T,i.back+=T,i.length=P,0===M){i.mode=26;break}if(32&M){i.back=-1,i.mode=12;break}if(64&M){t.msg="invalid literal/length code",i.mode=30;break}i.extra=15&M,i.mode=22;case 22:if(i.extra){for(k=i.extra;b>>=i.extra,b-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;M=(F=i.distcode[v&(1<>>16&255,P=65535&F,!((T=F>>>24)<=b);){if(0===p)break t;p--,v+=c[f++]<>L)])>>>16&255,P=65535&F,!(L+(T=F>>>24)<=b);){if(0===p)break t;p--,v+=c[f++]<>>=L,b-=L,i.back+=L}if(v>>>=T,b-=T,i.back+=T,64&M){t.msg="invalid distance code",i.mode=30;break}i.offset=P,i.extra=15&M,i.mode=24;case 24:if(i.extra){for(k=i.extra;b>>=i.extra,b-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===m)break t;if(x=_-m,i.offset>x){if((x=i.offset-x)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=30;break}E=x>i.wnext?(x-=i.wnext,i.wsize-x):i.wnext-x,x>i.length&&(x=i.length),w=i.window}else w=h,E=d-i.offset,x=i.length;for(mg?(S=B[D+h[w]],N[k+h[w]]):(S=96,0),d=1<>I)+(p-=d)]=y<<24|S<<16|_|0,0!==p;);for(d=1<>=1;if(0!==d?(R&=d-1,R+=d):R=0,w++,0==--F[E]){if(E===M)break;E=e[i+h[w]]}if(P>>7)]}function T(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function M(t,e,i){t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<>>=1,i<<=1,0<--e;);return i>>>1}function I(t,e,i){var n,r,o=new Array(16),s=0;for(n=1;n<=u;n++)o[n]=s=s+i[n-1]<<1;for(r=0;r<=e;r++){var a=t[2*r+1];0!==a&&(t[2*r]=L(o[a]++,a))}}function A(t){var e;for(e=0;e>1;1<=i;i--)N(t,o,i);for(r=l;i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],N(t,o,1),n=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=n,o[2*r]=o[2*i]+o[2*n],t.depth[r]=(t.depth[i]>=t.depth[n]?t.depth[i]:t.depth[n])+1,o[2*i+1]=o[2*n+1]=r,t.heap[1]=r++,N(t,o,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var i,n,r,o,s,a,l=e.dyn_tree,c=e.max_code,h=e.stat_desc.static_tree,f=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,m=e.stat_desc.max_length,v=0;for(o=0;o<=u;o++)t.bl_count[o]=0;for(l[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;i<573;i++)m<(o=l[2*l[2*(n=t.heap[i])+1]+1]+1)&&(o=m,v++),l[2*n+1]=o,c>=7;n>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e>>3,(s=t.static_len+3+7>>>3)<=r&&(r=s)):r=s=i+5,i+4<=r&&-1!==e?V(t,e,i,n):4===t.strategy||s===r?(M(t,2+(n?1:0),3),k(t,d,p)):(M(t,4+(n?1:0),3),function(t,e,i,n){var r;for(M(t,e-257,5),M(t,i-1,5),M(t,n-4,4),r=0;r>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(v[i]+o+1)]++,t.dyn_dtree[2*w(e)]++),t.last_lit===t.lit_bufsize-1},i._tr_align=function(t){M(t,2,3),P(t,256,d),function(t){16===t.bi_valid?(T(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},{"../utils/common":41}],53:[function(t,e,i){e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,i){e.exports="function"==typeof n?n:function(){var t=[].slice.apply(arguments);t.splice(1,0,0),setTimeout.apply(null,t)}},{}]},{},[10])(10)}).call(this,i(176).Buffer,i(43),i(180).setImmediate)},function(t,e,i){(function(t){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var n=i(177),r=i(178),o=i(179);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return W(t).length;default:if(n)return G(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,i){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,i);case"utf8":case"utf-8":return M(this,e,i);case"ascii":return P(this,e,i);case"latin1":case"binary":return L(this,e,i);case"base64":return T(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,i);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function b(t,e,i,n,r){if(0===t.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=r?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(r)return-1;i=t.length-1}else if(i<0){if(!r)return-1;i=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:g(t,e,i,n,r);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):g(t,[e],i,n,r);throw new TypeError("val must be string, number or Buffer")}function g(t,e,i,n,r){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,i/=2}function l(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(r){var c=-1;for(o=i;oa&&(i=a-u),o=i;o>=0;o--){for(var h=!0,f=0;fr&&(n=r):n=r;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s>8,r=i%256,o.push(r),o.push(n);return o}(e,t.length-i),t,i,n)}function T(t,e,i){return 0===e&&i===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,i))}function M(t,e,i){i=Math.min(t.length,i);for(var n=[],r=e;r239?4:l>223?3:l>191?2:1;if(r+h<=i)switch(h){case 1:l<128&&(c=l);break;case 2:128==(192&(o=t[r+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=t[r+1],s=t[r+2],128==(192&o)&&128==(192&s)&&(u=(15&l)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=t[r+1],s=t[r+2],a=t[r+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),r+=h}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);for(var i="",n=0;nn)&&(i=n);for(var r="",o=e;oi)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,i,n,r,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||et.length)throw new RangeError("Index out of range")}function N(t,e,i,n){e<0&&(e=65535+e+1);for(var r=0,o=Math.min(t.length-i,2);r>>8*(n?r:1-r)}function k(t,e,i,n){e<0&&(e=4294967295+e+1);for(var r=0,o=Math.min(t.length-i,4);r>>8*(n?r:3-r)&255}function F(t,e,i,n,r,o){if(i+n>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function O(t,e,i,n,o){return o||F(t,0,i,4),r.write(t,e,i,n,23,4),i+4}function B(t,e,i,n,o){return o||F(t,0,i,8),r.write(t,e,i,n,52,8),i+8}e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,i){return l(null,t,e,i)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,i){return function(t,e,i,n){return c(e),e<=0?a(t,e):void 0!==i?"string"==typeof n?a(t,e).fill(i,n):a(t,e).fill(i):a(t,e)}(null,t,e,i)},u.allocUnsafe=function(t){return h(null,t)},u.allocUnsafeSlow=function(t){return h(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,n=e.length,r=0,o=Math.min(i,n);r0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),""},u.prototype.compare=function(t,e,i,n,r){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===n&&(n=0),void 0===r&&(r=this.length),e<0||i>t.length||n<0||r>this.length)throw new RangeError("out of range index");if(n>=r&&e>=i)return 0;if(n>=r)return-1;if(e>=i)return 1;if(this===t)return 0;for(var o=(r>>>=0)-(n>>>=0),s=(i>>>=0)-(e>>>=0),a=Math.min(o,s),l=this.slice(n,r),c=t.slice(e,i),h=0;hr)&&(i=r),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return y(this,t,e,i);case"utf8":case"utf-8":return S(this,t,e,i);case"ascii":return _(this,t,e,i);case"latin1":case"binary":return x(this,t,e,i);case"base64":return E(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},u.prototype.slice=function(t,e){var i,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e0&&(r*=256);)n+=this[t+--e]*r;return n},u.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||C(t,e,this.length);for(var n=this[t],r=1,o=0;++o=(r*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||C(t,e,this.length);for(var n=e,r=1,o=this[t+--n];n>0&&(r*=256);)o+=this[t+--n]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},u.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},u.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),r.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),r.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),r.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||C(t,8,this.length),r.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,i,n){t=+t,e|=0,i|=0,n||R(this,t,e,i,Math.pow(2,8*i)-1,0);var r=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+r]=t/o&255;return e+i},u.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):k(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):k(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,i,n){if(t=+t,e|=0,!n){var r=Math.pow(2,8*i-1);R(this,t,e,i,r-1,-r)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+i},u.prototype.writeIntBE=function(t,e,i,n){if(t=+t,e|=0,!n){var r=Math.pow(2,8*i-1);R(this,t,e,i,r-1,-r)}var o=i-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+i},u.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):k(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):k(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,i){return O(this,t,e,!0,i)},u.prototype.writeFloatBE=function(t,e,i){return O(this,t,e,!1,i)},u.prototype.writeDoubleLE=function(t,e,i){return B(this,t,e,!0,i)},u.prototype.writeDoubleBE=function(t,e,i){return B(this,t,e,!1,i)},u.prototype.copy=function(t,e,i,n){if(i||(i=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--r)t[r+e]=this[r+i];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(r=0;r>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&i<57344){if(!r){if(i>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}r=i;continue}if(i<56320){(e-=3)>-1&&o.push(239,191,189),r=i;continue}i=65536+(r-55296<<10|i-56320)}else r&&(e-=3)>-1&&o.push(239,191,189);if(r=null,i<128){if((e-=1)<0)break;o.push(i)}else if(i<2048){if((e-=2)<0)break;o.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;o.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return o}function W(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,i,n){for(var r=0;r=e.length||r>=t.length);++r)e[r+i]=t[r];return r}}).call(this,i(43))},function(t,e,i){e.byteLength=function(t){var e=l(t),i=e[0],n=e[1];return 3*(i+n)/4-n},e.toByteArray=function(t){var e,i,n=l(t),s=n[0],a=n[1],u=new o(function(t,e,i){return 3*(e+i)/4-i}(0,s,a)),c=0,h=a>0?s-4:s;for(i=0;i>16&255,u[c++]=e>>8&255,u[c++]=255&e;return 2===a&&(e=r[t.charCodeAt(i)]<<2|r[t.charCodeAt(i+1)]>>4,u[c++]=255&e),1===a&&(e=r[t.charCodeAt(i)]<<10|r[t.charCodeAt(i+1)]<<4|r[t.charCodeAt(i+2)]>>2,u[c++]=e>>8&255,u[c++]=255&e),u},e.fromByteArray=function(t){for(var e,i=t.length,r=i%3,o=[],s=0,a=i-r;sa?a:s+16383));return 1===r?(e=t[i-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===r&&(e=(t[i-2]<<8)+t[i-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");return-1===i&&(i=e),[i,i===e?0:4-i%4]}function c(t,e,i){for(var r,o,s=[],a=e;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,i,n,r){var o,s,a=8*r-n-1,u=(1<>1,c=-7,h=i?r-1:0,f=i?-1:1,d=t[e+h];for(h+=f,o=d&(1<<-c)-1,d>>=-c,c+=a;c>0;o=256*o+t[e+h],h+=f,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+t[e+h],h+=f,c-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=l}return(d?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,i,n,r,o){var s,a,u,l=8*o-r-1,c=(1<>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(e*u-1)*Math.pow(2,r),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;t[i+d]=255&a,d+=p,a/=256,r-=8);for(s=s<0;t[i+d]=255&s,d+=p,s/=256,l-=8);t[i+d-p]|=128*m}},function(t,e){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,e,i){(function(t){var n=void 0!==t&&t||"undefined"!=typeof self&&self||window,r=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(r.call(setTimeout,n,arguments),clearTimeout)},e.setInterval=function(){return new o(r.call(setInterval,n,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(n,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},i(181),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,i(43))},function(t,e,i){(function(t,e){!function(t,i){if(!t.setImmediate){var n,r,o,s,a,u=1,l={},c=!1,h=t.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(t);f=f&&f.setTimeout?f:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick((function(){p(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,i=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=i,e}}()?(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),n=function(e){t.postMessage(s+e,"*")}):t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){p(t.data)},n=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(r=h.documentElement,n=function(t){var e=h.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,r.removeChild(e),e=null},r.appendChild(e)}):n=function(t){setTimeout(p,0,t)},f.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),i=0;i1?r-1:0),s=1;sr?r+"+":o},o=function(){if(n()||t.dot){var e={background:t.color};if(t.offset){var o=t.offset,s=o[0],a=o[1];i.default?(e.top=a+"px",e.right=-s+"px"):(e.marginTop=a+"px",e.marginLeft=s+"px")}return Yn("div",{class:$o({dot:t.dot,fixed:!!i.default}),style:e},[r()])}};return function(){if(i.default){var e=t.tag;return Yn(e,{class:$o("wrapper")},{default:function(){return[i.default(),o()]}})}return o()}}}),es=ko("icon"),is=es[0],ns=es[1];for(var rs=is({props:{dot:Boolean,name:String,size:[Number,String],badge:[Number,String],color:String,tag:{type:String,default:"i"},classPrefix:{type:String,default:ns()}},setup:function(t,e){var i=e.slots;return function(){var e=t.tag,n=t.dot,r=t.name,o=t.size,s=t.badge,a=t.color,u=t.classPrefix,l=function(t){return!!t&&-1!==t.indexOf("/")}(r);return Yn(ts,{dot:n,tag:e,content:s,class:[u,l?"":u+"-"+r],style:{color:a,fontSize:Oo(o)}},{default:function(){return[null==i.default?void 0:i.default(),l&&Yn("img",{class:ns("image"),src:r},null)]}})}}}),os=ko("loading"),ss=os[0],as=os[1],us=[],ls=0;ls<12;ls++)us.push(Yn("i",null,null));var cs=Yn("svg",{class:as("circular"),viewBox:"25 25 50 50"},[Yn("circle",{cx:"50",cy:"50",r:"20",fill:"none"},null)]),hs=ss({props:{size:[Number,String],color:String,vertical:Boolean,textSize:[Number,String],textColor:String,type:{type:String,default:"circular"}},setup:function(t,e){var i=e.slots,n=Rr((function(){return Uo({color:t.color},Bo(t.size))})),r=function(){var e;if(i.default)return Yn("span",{class:as("text"),style:{fontSize:Oo(t.textSize),color:null!=(e=t.textColor)?e:t.color}},[i.default()])};return function(){var e=t.type,i=t.vertical;return Yn("div",{class:as([e,{vertical:i}])},[Yn("span",{class:as("spinner",e),style:n.value},["spinner"===e?us:cs]),r()])}}});function fs(t){return"function"==typeof t||"[object Object]"===Object.prototype.toString.call(t)&&!Hn(t)}var ds=ko("button"),ps=ds[0],ms=ds[1];t("B",ps({props:Uo({},qo,{text:String,icon:String,color:String,block:Boolean,plain:Boolean,round:Boolean,square:Boolean,loading:Boolean,hairline:Boolean,disabled:Boolean,iconPrefix:String,loadingText:String,loadingType:String,tag:{type:String,default:"button"},type:{type:String,default:"default"},size:{type:String,default:"normal"},nativeType:{type:String,default:"button"},loadingSize:{type:String,default:"20px"},iconPosition:{type:String,default:"left"}}),emits:["click"],setup:function(t,e){var i=e.emit,n=e.slots,r=Jo(),o=function(){return t.loading?n.loading?n.loading():Yn(hs,{class:ms("loading"),size:t.loadingSize,type:t.loadingType,color:"currentColor"},null):t.icon?Yn(rs,{name:t.icon,class:ms("icon"),classPrefix:t.iconPrefix},null):void 0},s=function(){var e;if(e=t.loading?t.loadingText:n.default?n.default():t.text)return Yn("span",{class:ms("text")},fs(e)?e:{default:function(){return[e]}})},a=function(){var e=t.color,i=t.plain;if(e){var n={};return n.color=i?e:"white",i||(n.background=e),-1!==e.indexOf("gradient")?n.border=0:n.borderColor=e,n}},u=function(e){t.loading&&e.preventDefault(),t.loading||t.disabled||(i("click",e),r())};return function(){var e,i,n=t.tag,r=t.type,l=t.size,c=t.block,h=t.round,f=t.plain,d=t.square,p=t.loading,m=t.disabled,v=t.hairline,b=t.nativeType,g=t.iconPosition,y=[ms([r,l,{plain:f,block:c,round:h,square:d,loading:p,disabled:m,hairline:v}]),(i={},i["van-hairline--surround"]=v,i)];return Yn(n,{type:b,class:y,style:a(),disabled:m,onClick:u},fs(e=Yn("div",{class:ms("content")},["left"===g&&o(),s(),"right"===g&&o()]))?e:{default:function(){return[e]}})}}}));function vs(){var t=ee(0),e=ee(0),i=ee(0),n=ee(0),r=ee(0),o=ee(0),s=ee(""),a=function(){i.value=0,n.value=0,r.value=0,o.value=0,s.value=""};return{move:function(a){var u,l,c=a.touches[0];i.value=c.clientX-t.value,n.value=c.clientY-e.value,r.value=Math.abs(i.value),o.value=Math.abs(n.value),s.value||(s.value=(u=r.value,l=o.value,u>l&&u>10?"horizontal":l>u&&l>10?"vertical":""))},start:function(i){a(),t.value=i.touches[0].clientX,e.value=i.touches[0].clientY},reset:a,startX:t,startY:e,deltaX:i,deltaY:n,offsetX:r,offsetY:o,direction:s,isVertical:function(){return"vertical"===s.value},isHorizontal:function(){return"horizontal"===s.value}}}var bs=0,gs="van-overflow-hidden";function ys(t,e){var i=vs(),n=function(e){i.move(e);var n=i.deltaY.value>0?"10":"01",r=function(t,e){void 0===e&&(e=window);for(var i=t;i&&i!==e&&Ko(i);){var n=window.getComputedStyle(i).overflowY;if(Yo.test(n))return i;i=i.parentNode}return e}(e.target,t.value),o=r.scrollHeight,s=r.offsetHeight,a=r.scrollTop,u="11";0===a?u=s>=o?"00":"01":a+s>=o&&(u="10"),"11"===u||!i.isVertical()||parseInt(u,2)&parseInt(n,2)||Vo(e,!0)};return[function(){e()&&(document.addEventListener("touchstart",i.start),document.addEventListener("touchmove",n,!!zo&&{passive:!1}),bs||document.body.classList.add(gs),bs++)},function(){e()&&bs&&(document.removeEventListener("touchstart",i.start),document.removeEventListener("touchmove",n),--bs||document.body.classList.remove(gs))}]}function Ss(t){var e=ee(!1);return Wi(t,(function(t){t&&(e.value=t)}),{immediate:!0}),function(t){return function(){return e.value?t():null}}}var _s=ko("overlay"),xs=_s[0],Es=_s[1],ws=xs({props:{show:Boolean,zIndex:[Number,String],duration:[Number,String],className:null,customStyle:Object,lockScroll:{type:Boolean,default:!0}},setup:function(t,e){var i=e.slots,n=Ss((function(){return t.show})),r=function(t){Vo(t,!0)},o=n((function(){var e=Uo({zIndex:void 0!==t.zIndex?+t.zIndex:void 0},t.customStyle);return xo(t.duration)&&(e.animationDuration=t.duration+"s"),fn(Yn("div",{style:e,class:[Es(),t.className],onTouchmove:t.lockScroll?r:_o},[null==i.default?void 0:i.default()]),[[co,t.show]])}));return function(){var t,e;return Yn(to,{name:"van-fade"},"function"==typeof(e=t=o())||"[object Object]"===Object.prototype.toString.call(e)&&!Hn(e)?t:{default:function(){return[t]}})}}});var Ts=ko("popup"),Ms=Ts[0],Ps=Ts[1],Ls={zIndex:2e3,lockCount:0,stack:[],find:function(t){return this.stack.filter((function(e){return e.vm===t}))[0]}},Is={show:Boolean,zIndex:[Number,String],duration:[Number,String],teleport:[String,Object],overlayStyle:Object,overlayClass:null,transitionAppear:Boolean,overlay:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},lazyRender:{type:Boolean,default:!0},closeOnClickOverlay:{type:Boolean,default:!0}};t("P",Ms({inheritAttrs:!1,props:Uo({},Is,{round:Boolean,closeable:Boolean,transition:String,closeOnPopstate:Boolean,safeAreaInsetBottom:Boolean,position:{type:String,default:"center"},closeIcon:{type:String,default:"cross"},closeIconPosition:{type:String,default:"top-right"}}),emits:["open","close","click","opened","closed","update:show","click-overlay","click-close-icon"],setup:function(t,e){var i,n,r,o,s=e.emit,a=e.attrs,u=e.slots,l=ee(),c=ee(),h=ys(c,(function(){return t.lockScroll})),f=h[0],d=h[1],p=Ss((function(){return t.show||!t.lazyRender})),m=Rr((function(){var e={zIndex:l.value};xo(t.duration)&&(e["center"===t.position?"animationDuration":"transitionDuration"]=t.duration+"s");return e})),v=function(){i||(void 0!==t.zIndex&&(Ls.zIndex=t.zIndex),i=!0,f(),l.value=++Ls.zIndex)},b=function(){i&&(i=!1,d(),s("update:show",!1))},g=function(){s("click-overlay"),t.closeOnClickOverlay&&b()},y=function(){if(t.overlay)return Yn(ws,{show:t.show,class:t.overlayClass,zIndex:l.value,duration:t.duration,customStyle:t.overlayStyle,onClick:g},null)},S=function(t){s("click-close-icon",t),b()},_=function(){if(t.closeable)return Yn(rs,{role:"button",tabindex:"0",name:t.closeIcon,class:Ps("close-icon",t.closeIconPosition),onClick:S},null)},x=function(t){return s("click",t)},E=function(){return s("opened")},w=function(){return s("closed")},T=p((function(){var e,i=t.round,n=t.position,r=t.safeAreaInsetBottom;return fn(Yn("div",er({ref:c,style:m.value,class:Ps((e={round:i},e[n]=n,e["safe-area-inset-bottom"]=r,e)),onClick:x},a),[null==u.default?void 0:u.default(),_()]),[[co,t.show]])})),M=function(){var e,i,n=t.position,r=t.transition,o=t.transitionAppear;return Yn(to,{name:r||("center"===n?"van-fade":"van-popup-slide-"+n),appear:o,onAfterEnter:E,onAfterLeave:w},"function"==typeof(i=e=T())||"[object Object]"===Object.prototype.toString.call(i)&&!Hn(i)?e:{default:function(){return[e]}})};return Wi((function(){return t.show}),(function(t){t?(v(),s("open")):(b(),s("close"))})),r={popupRef:c},(o=yr())&&Uo(o.proxy,r),Xo("popstate",(function(){t.closeOnPopstate&&(b(),n=!1)})),Ni((function(){t.show&&v()})),tn((function(){n&&(s("update:show",!0),n=!1)})),en((function(){t.show&&(b(),n=!0)})),Oi((function(){i&&d()})),function(){return t.teleport?Yn(Rn,{to:t.teleport},{default:function(){return[y(),M()]}}):Yn(kn,null,[y(),M()])}}}));var As=ko("skeleton"),Cs=As[0],Rs=As[1],Ns="100%",ks=(t("f",Cs({props:{title:Boolean,round:Boolean,avatar:Boolean,avatarSize:[Number,String],titleWidth:[Number,String],row:{type:[Number,String],default:0},loading:{type:Boolean,default:!0},animate:{type:Boolean,default:!0},avatarShape:{type:String,default:"round"},rowWidth:{type:[Number,String,Array],default:Ns}},setup:function(t,e){var i=e.slots,n=function(){if(t.avatar)return Yn("div",{class:Rs("avatar",t.avatarShape),style:Bo(t.avatarSize)},null)},r=function(){if(t.title)return Yn("h3",{class:Rs("title"),style:{width:Oo(t.titleWidth)}},null)},o=function(){for(var e,i,n=[],r=0;rt[1]?t.slice(0).reverse():t}(e).map(b):b(e),g(e,t.modelValue)||a("update:modelValue",e),i&&!g(e,n)&&a("change",e)},S=function(e){if(e.stopPropagation(),!t.disabled&&!t.readonly){var i=t.min,n=t.vertical,r=t.modelValue,o=Ho(l),s=n?e.clientY-o.top:e.clientX-o.left,a=n?o.height:o.width,u=Number(i)+s/a*f.value;if(p(r)){var c=r[0],h=r[1];y(u<=(c+h)/2?[u,h]:[c,u],!0)}else y(u,!0)}},_=function(e){t.disabled||t.readonly||(h.start(e),r=t.modelValue,n=p(r)?r.map(b):b(r),c.value="start")},x=function(e){if(!t.disabled&&!t.readonly){"start"===c.value&&a("drag-start"),Vo(e,!0),h.move(e),c.value="draging";var o=Ho(l),s=(t.vertical?h.deltaY.value:h.deltaX.value)/(t.vertical?o.height:o.width)*f.value;p(n)?r[i]=n[i]+s:r=n+s,y(r)}},E=function(){t.disabled||t.readonly||("draging"===c.value&&(y(r,!0),a("drag-end")),c.value="")},w=function(e){var n="number"==typeof e?t.modelValue[e]:t.modelValue;return Yn("div",{role:"slider",class:Os(function(){if("number"==typeof e){return"button-wrapper-"+["left","right"][e]}return"button-wrapper"}()),tabindex:t.disabled||t.readonly?-1:0,"aria-valuemin":+t.min,"aria-valuenow":n,"aria-valuemax":+t.max,"aria-orientation":t.vertical?"vertical":"horizontal",onTouchstart:function(t){"number"==typeof e&&(i=e),_(t)},onTouchmove:x,onTouchend:E,onTouchcancel:E,onClick:Do},[u.button?u.button():Yn("div",{class:Os("button"),style:Bo(t.buttonSize)},null)])};return y(t.modelValue),o=function(){return t.modelValue},(s=ir("vanField",null))&&!s.childFieldValue.value&&(s.childFieldValue.value=o,Wi(o,(function(){s.resetValidation(),s.validateWithTrigger("onChange")}))),function(){return Yn("div",{ref:l,style:d.value,class:Os({vertical:t.vertical,disabled:t.disabled}),onClick:S},[Yn("div",{class:Os("bar"),style:v.value},[t.range?[w(0),w(1)]:w()])])}}})),String.prototype.replace),Ds=/%20/g,Vs="RFC3986",Gs={default:Vs,formatters:{RFC1738:function(t){return Bs.call(t,Ds,"+")},RFC3986:function(t){return String(t)}},RFC1738:"RFC1738",RFC3986:Vs},Ws=Object.prototype.hasOwnProperty,Hs=Array.isArray,Us=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),zs=function(t,e){for(var i=e&&e.plainObjects?Object.create(null):{},n=0;n1;){var e=t.pop(),i=e.obj[e.prop];if(Hs(i)){for(var n=[],r=0;r=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||r===Gs.RFC1738&&(40===u||41===u)?s+=o.charAt(a):u<128?s+=Us[u]:u<2048?s+=Us[192|u>>6]+Us[128|63&u]:u<55296||u>=57344?s+=Us[224|u>>12]+Us[128|u>>6&63]+Us[128|63&u]:(a+=1,u=65536+((1023&u)<<10|1023&o.charCodeAt(a)),s+=Us[240|u>>18]+Us[128|u>>12&63]+Us[128|u>>6&63]+Us[128|63&u])}return s},isBuffer:function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(Hs(t)){for(var i=[],n=0;n0?v.join(",")||null:void 0}];else if(Ks(a))b=a;else{var y=Object.keys(v);b=u?y.sort(u):y}for(var S=0;S-1?t.split(","):t},sa=function(t,e,i,n){if(t){var r=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/g,s=i.depth>0&&/(\[[^[\]]*])/.exec(r),a=s?r.slice(0,s.index):r,u=[];if(a){if(!i.plainObjects&&ea.call(Object.prototype,a)&&!i.allowPrototypes)return;u.push(a)}for(var l=0;i.depth>0&&null!==(s=o.exec(r))&&l=0;--o){var s,a=t[o];if("[]"===a&&i.parseArrays)s=[].concat(r);else{s=i.plainObjects?Object.create(null):{};var u="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,l=parseInt(u,10);i.parseArrays||""!==u?!isNaN(l)&&a!==u&&String(l)===u&&l>=0&&i.parseArrays&&l<=i.arrayLimit?(s=[])[l]=r:s[u]=r:s={0:r}}r=s}return r}(u,e,i,n)}},aa=function(t,e){var i=function(t){if(!t)return na;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?na.charset:t.charset;return{allowDots:void 0===t.allowDots?na.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:na.allowPrototypes,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:na.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:na.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:na.comma,decoder:"function"==typeof t.decoder?t.decoder:na.decoder,delimiter:"string"==typeof t.delimiter||js.isRegExp(t.delimiter)?t.delimiter:na.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:na.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:na.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:na.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:na.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:na.strictNullHandling}}(e);if(""===t||null==t)return i.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,e){var i,n={},r=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,o=e.parameterLimit===1/0?void 0:e.parameterLimit,s=r.split(e.delimiter,o),a=-1,u=e.charset;if(e.charsetSentinel)for(i=0;i-1&&(c=ia(c)?[c]:c),ea.call(n,l)?n[l]=js.combine(n[l],c):n[l]=c}return n}(t,i):t,r=i.plainObjects?Object.create(null):{},o=Object.keys(n),s=0;s0?h+c:""},la="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==la&&la,ca="URLSearchParams"in la,ha="Symbol"in la&&"iterator"in Symbol,fa="FileReader"in la&&"Blob"in la&&function(){try{return new Blob,!0}catch(Iu){return!1}}(),da="FormData"in la,pa="ArrayBuffer"in la;if(pa)var ma=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],va=ArrayBuffer.isView||function(t){return t&&ma.indexOf(Object.prototype.toString.call(t))>-1};function ba(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function ga(t){return"string"!=typeof t&&(t=String(t)),t}function ya(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return ha&&(e[Symbol.iterator]=function(){return e}),e}function Sa(t){this.map={},t instanceof Sa?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function _a(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function xa(t){return new Promise((function(e,i){t.onload=function(){e(t.result)},t.onerror=function(){i(t.error)}}))}function Ea(t){var e=new FileReader,i=xa(e);return e.readAsArrayBuffer(t),i}function wa(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function Ta(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:fa&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:da&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:ca&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():pa&&fa&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=wa(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):pa&&(ArrayBuffer.prototype.isPrototypeOf(t)||va(t))?this._bodyArrayBuffer=wa(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="";var i=this.headers.get("content-type");i?i.indexOf("json")>=0&&"string"!=typeof this._bodyInit&&(this._bodyInit=this._bodyText):"string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):ca&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8")},fa&&(this.blob=function(){var t=_a(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=_a(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(Ea)}),this.text=function(){var t,e,i,n=_a(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,i=xa(e),e.readAsText(t),i;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),i=new Array(e.length),n=0;n-1?n:i),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function La(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var i=t.split("="),n=i.shift().replace(/\+/g," "),r=i.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(r))}})),e}function Ia(t,e){if(!(this instanceof Ia))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new Sa(e.headers),this.url=e.url||"",this._initBody(t)}Pa.prototype.clone=function(){return new Pa(this,{body:this._bodyInit})},Ta.call(Pa.prototype),Ta.call(Ia.prototype),Ia.prototype.clone=function(){return new Ia(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Sa(this.headers),url:this.url})},Ia.error=function(){var t=new Ia(null,{status:0,statusText:""});return t.type="error",t};var Aa=[301,302,303,307,308];Ia.redirect=function(t,e){if(-1===Aa.indexOf(e))throw new RangeError("Invalid status code");return new Ia(null,{status:e,headers:{location:t}})};var Ca=la.DOMException;try{new Ca}catch(Au){(Ca=function(t,e){this.message=t,this.name=e;var i=Error(t);this.stack=i.stack}).prototype=Object.create(Error.prototype),Ca.prototype.constructor=Ca}function Ra(t,e){return new Promise((function(i,n){var r=new Pa(t,e);if(r.signal&&r.signal.aborted)return n(new Ca("Aborted","AbortError"));var o=new XMLHttpRequest;function s(){o.abort()}o.onload=function(){var t,e,n={status:o.status,statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new Sa,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var i=t.split(":"),n=i.shift().trim();if(n){var r=i.join(":").trim();e.append(n,r)}})),e)};n.url="responseURL"in o?o.responseURL:n.headers.get("X-Request-URL");var r="response"in o?o.response:o.responseText;setTimeout((function(){i(new Ia(r,n))}),0)},o.onerror=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},o.ontimeout=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},o.onabort=function(){setTimeout((function(){n(new Ca("Aborted","AbortError"))}),0)},o.open(r.method,function(t){try{return""===t&&la.location.href?la.location.href:t}catch(Iu){return t}}(r.url),!0),"include"===r.credentials?o.withCredentials=!0:"omit"===r.credentials&&(o.withCredentials=!1),"responseType"in o&&(fa?o.responseType="blob":pa&&r.headers.get("Content-Type")&&-1!==r.headers.get("Content-Type").indexOf("application/octet-stream")&&(o.responseType="arraybuffer")),!e||"object"!=typeof e.headers||e.headers instanceof Sa?r.headers.forEach((function(t,e){o.setRequestHeader(e,t)})):Object.getOwnPropertyNames(e.headers).forEach((function(t){o.setRequestHeader(t,ga(e.headers[t]))})),r.signal&&(r.signal.addEventListener("abort",s),o.onreadystatechange=function(){4===o.readyState&&r.signal.removeEventListener("abort",s)}),o.send(void 0===r._bodyInit?null:r._bodyInit)}))}Ra.polyfill=!0,la.fetch||(la.fetch=Ra,la.Headers=Sa,la.Request=Pa,la.Response=Ia),self.fetch.bind(self);var Na=function(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t};var ka=function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{global:!1,core:!1,defaultInstance:!1},n=!1,r=!1,o=!1;"number"==typeof i?(process&&process.env&&console.warn('use() options should be object, number property would be deprecated in future,please update use() options to "{ core: true }".'),n=!0,r=!1):"object"===Ua(i)&&i&&(r=i.global||!1,n=i.core||!1,o=i.defaultInstance||!1),r?t.globalMiddlewares.splice(t.globalMiddlewares.length-t.defaultGlobalMiddlewaresLength,0,e):n?t.coreMiddlewares.splice(t.coreMiddlewares.length-t.defaultCoreMiddlewaresLength,0,e):o?this.defaultMiddlewares.push(e):this.middlewares.push(e)}},{key:"execute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=za([].concat(Da(this.middlewares),Da(this.defaultMiddlewares),Da(t.globalMiddlewares),Da(t.coreMiddlewares)));return i(e)}}]),t}();ja.globalMiddlewares=[],ja.defaultGlobalMiddlewaresLength=0,ja.coreMiddlewares=[],ja.defaultCoreMiddlewaresLength=0;var Xa=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var Ya=function(t,e){return!e||"object"!==Ua(e)&&"function"!=typeof e?Xa(t):e},Ka=Ha((function(t){function e(i){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(i)}t.exports=e})),qa=Ha((function(t){function e(i,n){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(i,n)}t.exports=e}));var Ja=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&qa(t,e)};var Za=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},Qa=Ha((function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(Iu){return!1}}function i(n,r,o){return e()?t.exports=i=Reflect.construct:t.exports=i=function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&qa(r,i.prototype),r},i.apply(null,arguments)}t.exports=i})),$a=Ha((function(t){function e(i){var n="function"==typeof Map?new Map:void 0;return t.exports=e=function(t){if(null===t||!Za(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return Qa(t,arguments,Ka(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),qa(e,t)},e(i)}t.exports=e})),tu=function(){function t(e){Va(this,t),this.cache=new Map,this.timer={},this.extendOptions(e)}return Wa(t,[{key:"extendOptions",value:function(t){this.maxCache=t.maxCache||0}},{key:"get",value:function(t){return this.cache.get(JSON.stringify(t))}},{key:"set",value:function(t,e){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:6e4;if(this.maxCache>0&&this.cache.size>=this.maxCache){var r=Da(this.cache.keys())[0];this.cache.delete(r),this.timer[r]&&clearTimeout(this.timer[r])}var o=JSON.stringify(t);this.cache.set(o,e),n>0&&(this.timer[o]=setTimeout((function(){i.cache.delete(o),delete i.timer[o]}),n))}},{key:"delete",value:function(t){var e=JSON.stringify(t);return delete this.timer[e],this.cache.delete(e)}},{key:"clear",value:function(){return this.timer={},this.cache.clear()}}]),t}(),eu=function(t){function e(t,i){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"RequestError";return Va(this,e),(n=Ya(this,Ka(e).call(this,t))).name="RequestError",n.request=i,n.type=r,n}return Ja(e,t),e}($a(Error)),iu=function(t){function e(t,i,n,r){var o,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"ResponseError";return Va(this,e),(o=Ya(this,Ka(e).call(this,i||t.statusText))).name="ResponseError",o.data=n,o.response=t,o.request=r,o.type=s,o}return Ja(e,t),e}($a(Error));function nu(t){return new Promise((function(e,i){var n=new FileReader;n.onload=function(){e(n.result)},n.onerror=i,n.readAsText(t,"GBK")}))}function ru(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;try{return JSON.parse(t)}catch(Iu){if(e)throw new iu(i,"JSON.parse fail",t,n,"ParseError")}return t}function ou(t,e){return new Promise((function(i,n){setTimeout((function(){n(new eu("timeout of ".concat(t,"ms exceeded"),e,"Timeout"))}),t)}))}function su(t){return new Promise((function(e,i){t.cancelToken&&t.cancelToken.promise.then((function(t){i(t)}))}))}var au=Object.prototype.toString;function uu(){var t;return"undefined"!=typeof process&&"[object process]"===au.call(process)&&(t="NODE"),"undefined"!=typeof XMLHttpRequest&&(t="BROWSER"),t}function lu(t){return"object"===Ua(t)&&"[object Array]"===Object.prototype.toString.call(t)}function cu(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams}function hu(t){return null!==t&&"object"===Ua(t)}function fu(t,e){if(t)if("object"!==Ua(t)&&(t=[t]),lu(t))for(var i=0;i=200&&i.status<300)return a?void(t.res={data:e,response:i}):void(t.res=e);throw new iu(i,"http error",e,r,"HttpError")}}})).catch((function(e){if(e instanceof eu||e instanceof iu)throw e;var i=t.req,n=t.res;throw e.request=e.request||i,e.response=e.response||n,e.type=e.type||e.name,e.data=e.data||void 0,e}))}],Su=[function(t,e){if(!t)return e();var i=t.req,n=(i=void 0===i?{}:i).options,r=void 0===n?{}:n,o=i.url,s=void 0===o?"":o,a=t.cache,u=t.responseInterceptors,l=r.timeout,c=void 0===l?0:l,h=r.__umiRequestCoreType__,f=void 0===h?"normal":h,d=r.useCache,p=void 0!==d&&d,m=r.method,v=void 0===m?"get":m,b=r.params,g=r.ttl,y=r.validateCache,S=void 0===y?bu:y;if("normal"!==f)return process&&process.env&&!1===vu&&(vu=!0,console.warn("__umiRequestCoreType__ is a internal property that use in umi-request, change its value would affect the behavior of request! It only use when you want to extend or use request core.")),e();var _=fetch;if(!_)throw new Error("Global fetch not exist!");var x,E="BROWSER"===uu(),w=S(s,r)&&p&&E;if(w){var T=a.get({url:s,params:b,method:v});if(T)return(T=T.clone()).useCache=!0,t.res=T,e()}return x=c>0?Promise.race([su(r),_(s,r),ou(c,t.req)]):Promise.race([su(r),_(s,r)]),u.forEach((function(t){x=x.then((function(e){var i="function"==typeof e.clone?e.clone():e;return t(i,r)}))})),x.then((function(i){if(w&&200===i.status){var n=i.clone();n.useCache=!0,a.set({url:s,params:b,method:v},n,g)}return t.res=i,e()}))}];ja.globalMiddlewares=yu,ja.defaultGlobalMiddlewaresLength=yu.length,ja.coreMiddlewares=Su,ja.defaultCoreMiddlewaresLength=Su.length;var _u=function(){function t(e){Va(this,t),this.onion=new ja([]),this.fetchIndex=0,this.mapCache=new tu(e),this.initOptions=e,this.instanceRequestInterceptors=[],this.instanceResponseInterceptors=[]}return Wa(t,[{key:"use",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{global:!1,core:!1};return this.onion.use(t,e),this}},{key:"extendOptions",value:function(t){this.initOptions=mu(this.initOptions,t),this.mapCache.extendOptions(t)}},{key:"dealRequestInterceptors",value:function(e){return[].concat(Da(t.requestInterceptors),Da(this.instanceRequestInterceptors)).reduce((function(t,i){return t.then((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.req.url=t.url||e.req.url,e.req.options=t.options||e.req.options,i(e.req.url,e.req.options)}))}),Promise.resolve()).then((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.req.url=t.url||e.req.url,e.req.options=t.options||e.req.options,Promise.resolve()}))}},{key:"request",value:function(e,i){var n=this,r=this.onion,o={req:{url:e,options:i},res:null,cache:this.mapCache,responseInterceptors:[].concat(Da(t.responseInterceptors),Da(this.instanceResponseInterceptors))};if("string"!=typeof e)throw new Error("url MUST be a string");return new Promise((function(t,e){n.dealRequestInterceptors(o).then((function(){return r.execute(o)})).then((function(){t(o.res)})).catch((function(i){var n=o.req.options.errorHandler;if(n)try{var r=n(i);t(r)}catch(Iu){e(Iu)}else e(i)}))}))}}],[{key:"requestUse",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{global:!0};if("function"!=typeof e)throw new TypeError("Interceptor must be function!");i.global?t.requestInterceptors.push(e):this.instanceRequestInterceptors.push(e)}},{key:"responseUse",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{global:!0};if("function"!=typeof e)throw new TypeError("Interceptor must be function!");i.global?t.responseInterceptors.push(e):this.instanceResponseInterceptors.push(e)}}]),t}();function xu(t){this.message=t}function Eu(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var i=this;t((function(t){i.reason||(i.reason=new xu(t),e(i.reason))}))}function wu(t){return!(!t||!t.__CANCEL__)}_u.requestInterceptors=[function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.prefix,n=e.suffix;return i&&(t="".concat(i).concat(t)),n&&(t="".concat(t).concat(n)),{url:t,options:e}}],_u.responseInterceptors=[],xu.prototype.toString=function(){return this.message?"Cancel: ".concat(this.message):"Cancel"},xu.prototype.__CANCEL__=!0,Eu.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Eu.source=function(){var t;return{token:new Eu((function(e){t=e})),cancel:t}};var Tu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=new _u(t),i=function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=mu(e.initOptions,i);return e.request(t,n)};i.use=e.use.bind(e),i.fetchIndex=e.fetchIndex,i.interceptors={request:{use:_u.requestUse.bind(e)},response:{use:_u.responseUse.bind(e)}};var n=["get","post","delete","put","patch","head","options","rpc"];return n.forEach((function(t){i[t]=function(e,n){return i(e,ka({},n,{method:t}))}})),i.Cancel=xu,i.CancelToken=Eu,i.isCancel=wu,i.extendOptions=e.extendOptions.bind(e),i.middlewares={instance:e.onion.middlewares,defaultInstance:e.onion.defaultMiddlewares,global:ja.globalMiddlewares,core:ja.coreMiddlewares},i};Tu({parseResponse:!1});t("g",Tu({})),t("e",So((function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function o(t,e,n,o,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,o||t,s),u=i?i+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],a]:t._events[u].push(a):(t._events[u]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,s=new Array(o);r