(function(){function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=_superPropBase(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},_get.apply(this,arguments)}function _wrapNativeSuper2(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper2=function(e){if(null===e||!_isNativeFunction2(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return _construct2(e,arguments,_getPrototypeOf2(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf2(n,e)},_wrapNativeSuper2(e)}function _construct2(e,t,n){return _construct2=_isNativeReflectConstruct2()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&_setPrototypeOf2(i,n.prototype),i},_construct2.apply(null,arguments)}function _isNativeFunction2(e){return-1!==Function.toString.call(e).indexOf("[native code]")}function _inherits2(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf2(e,t)}function _setPrototypeOf2(e,t){return _setPrototypeOf2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf2(e,t)}function _createSuper2(e){var t=_isNativeReflectConstruct2();return function(){var n,r=_getPrototypeOf2(e);if(t){var i=_getPrototypeOf2(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return _possibleConstructorReturn2(this,n)}}function _possibleConstructorReturn2(e,t){if(t&&("object"===_typeof2(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized2(e)}function _assertThisInitialized2(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct2(){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(e){return!1}}function set(e,t,n,r){return set="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(e,t,n,r){var i,a=_superPropBase(e,t);if(a){if((i=Object.getOwnPropertyDescriptor(a,t)).set)return i.set.call(r,n),!0;if(!i.writable)return!1}if(i=Object.getOwnPropertyDescriptor(r,t)){if(!i.writable)return!1;i.value=n,Object.defineProperty(r,t,i)}else _defineProperty2(r,t,n);return!0},set(e,t,n,r)}function _set(e,t,n,r,i){if(!set(e,t,n,r||e)&&i)throw new TypeError("failed to set property");return n}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf2(e)););return e}function _getPrototypeOf2(e){return _getPrototypeOf2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf2(e)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(M){l=function(e,t,n){return e[t]=n}}function u(e,t,n,i){var a=t&&t.prototype instanceof d?t:d,o=Object.create(a.prototype),s=new E(i||[]);return r(o,"_invoke",{value:S(e,n,s)}),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(M){return{type:"throw",arg:M}}}e.wrap=u;var h={};function d(){}function f(){}function p(){}var v={};l(v,a,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(k([])));g&&g!==t&&n.call(g,a)&&(v=g);var y=p.prototype=d.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function i(r,a,o,s){var l=c(e[r],e,a);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"==_typeof2(h)&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(h).then((function(e){u.value=e,o(u)}),(function(e){return i("throw",e,o,s)}))}s(l.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function S(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return C()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=x(o,n);if(s){if(s===h)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=c(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function x(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var i=c(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function k(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(s&&l){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),_(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:k(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},e}function asyncGeneratorStep(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(u){return void n(u)}s.done?t(l):Promise.resolve(l).then(r,i)}function _asyncToGenerator2(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){asyncGeneratorStep(a,r,i,o,s,"next",e)}function s(e){asyncGeneratorStep(a,r,i,o,s,"throw",e)}o(void 0)}))}}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function _unsupportedIterableToArray2(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray2(e,t):void 0}}function _arrayLikeToArray2(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&(t[n[0].trim()]=n[1].trim())}})),t}function normalizeClass(e){var t="";if(isString$2(e))t=e;else if(isArray$8(e))for(var n=0;n")]=i,e}),{})):isSet$1(n)?_defineProperty2({},"Set(".concat(n.size,")"),_toConsumableArray2(n.values())):!isObject$4(n)||isArray$8(n)||isPlainObject$3(n)?n:String(n)},EMPTY_OBJ={},EMPTY_ARR=[],NOOP=function(){},NO=function(){return!1},onRE=/^on[^a-z]/,isOn=function(e){return onRE.test(e)},isModelListener=function(e){return e.startsWith("onUpdate:")},extend$3=Object.assign,remove$7=function(e,t){var n=e.indexOf(t);n>-1&&e.splice(n,1)},hasOwnProperty$3=Object.prototype.hasOwnProperty,hasOwn$2=function(e,t){return hasOwnProperty$3.call(e,t)},isArray$8=Array.isArray,isMap$1=function(e){return"[object Map]"===toTypeString(e)},isSet$1=function(e){return"[object Set]"===toTypeString(e)},isFunction$4=function(e){return"function"==typeof e},isString$2=function(e){return"string"==typeof e},isSymbol$1=function(e){return"symbol"===_typeof2(e)},isObject$4=function(e){return null!==e&&"object"===_typeof2(e)},isPromise$1=function(e){return isObject$4(e)&&isFunction$4(e.then)&&isFunction$4(e.catch)},objectToString$2=Object.prototype.toString,toTypeString=function(e){return objectToString$2.call(e)},toRawType=function(e){return toTypeString(e).slice(8,-1)},isPlainObject$3=function(e){return"[object Object]"===toTypeString(e)},isIntegerKey=function(e){return isString$2(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e},isReservedProp=makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),cacheStringFunction=function(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}},camelizeRE$1=/-(\w)/g,camelize$1=cacheStringFunction((function(e){return e.replace(camelizeRE$1,(function(e,t){return t?t.toUpperCase():""}))})),hyphenateRE=/\B([A-Z])/g,hyphenate=cacheStringFunction((function(e){return e.replace(hyphenateRE,"-$1").toLowerCase()})),capitalize=cacheStringFunction((function(e){return e.charAt(0).toUpperCase()+e.slice(1)})),toHandlerKey=cacheStringFunction((function(e){return e?"on".concat(capitalize(e)):""})),hasChanged=function(e,t){return!Object.is(e,t)},invokeArrayFns=function(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0];_classCallCheck2(this,e),this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=activeEffectScope,!t&&activeEffectScope&&(this.index=(activeEffectScope.scopes||(activeEffectScope.scopes=[])).push(this)-1)}return _createClass2(e,[{key:"active",get:function(){return this._active}},{key:"run",value:function(e){if(this._active){var t=activeEffectScope;try{return activeEffectScope=this,e()}finally{activeEffectScope=t}}}},{key:"on",value:function(){activeEffectScope=this}},{key:"off",value:function(){activeEffectScope=this.parent}},{key:"stop",value:function(e){if(this._active){var t,n;for(t=0,n=this.effects.length;t1&&void 0!==arguments[1]?arguments[1]:activeEffectScope;t&&t.active&&t.effects.push(e)}function getCurrentScope(){return activeEffectScope}var createDep=function(e){var t=new Set(e);return t.w=0,t.n=0,t},wasTracked=function(e){return(e.w&trackOpBit)>0},newTracked=function(e){return(e.n&trackOpBit)>0},initDepMarkers=function(e){var t=e.deps;if(t.length)for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2?arguments[2]:void 0;_classCallCheck2(this,e),this.fn=t,this.scheduler=n,this.active=!0,this.deps=[],this.parent=void 0,recordEffectScope(this,r)}return _createClass2(e,[{key:"run",value:function(){if(!this.active)return this.fn();for(var e=activeEffect,t=shouldTrack;e;){if(e===this)return;e=e.parent}try{return this.parent=activeEffect,activeEffect=this,shouldTrack=!0,trackOpBit=1<<++effectTrackDepth,effectTrackDepth<=maxMarkerBits?initDepMarkers(this):cleanupEffect(this),this.fn()}finally{effectTrackDepth<=maxMarkerBits&&finalizeDepMarkers(this),trackOpBit=1<<--effectTrackDepth,activeEffect=this.parent,shouldTrack=t,this.parent=void 0,this.deferStop&&this.stop()}}},{key:"stop",value:function(){activeEffect===this?this.deferStop=!0:this.active&&(cleanupEffect(this),this.onStop&&this.onStop(),this.active=!1)}}]),e}();function cleanupEffect(e){var t=e.deps;if(t.length){for(var n=0;n=l)&&s.push(e)}))}else switch(void 0!==n&&s.push(o.get(n)),t){case"add":isArray$8(e)?isIntegerKey(n)&&s.push(o.get("length")):(s.push(o.get(ITERATE_KEY)),isMap$1(e)&&s.push(o.get(MAP_KEY_ITERATE_KEY)));break;case"delete":isArray$8(e)||(s.push(o.get(ITERATE_KEY)),isMap$1(e)&&s.push(o.get(MAP_KEY_ITERATE_KEY)));break;case"set":isMap$1(e)&&s.push(o.get(ITERATE_KEY))}if(1===s.length)s[0]&&triggerEffects(s[0]);else{var u,c=[],h=_createForOfIteratorHelper(s);try{for(h.s();!(u=h.n()).done;){var d=u.value;d&&c.push.apply(c,_toConsumableArray2(d))}}catch(f){h.e(f)}finally{h.f()}triggerEffects(createDep(c))}}}function triggerEffects(e,t){var n,r=isArray$8(e)?e:_toConsumableArray2(e),i=_createForOfIteratorHelper(r);try{for(i.s();!(n=i.n()).done;){var a=n.value;a.computed&&triggerEffect(a)}}catch(u){i.e(u)}finally{i.f()}var o,s=_createForOfIteratorHelper(r);try{for(s.s();!(o=s.n()).done;){var l=o.value;l.computed||triggerEffect(l)}}catch(u){s.e(u)}finally{s.f()}}function triggerEffect(e,t){(e!==activeEffect||e.allowRecurse)&&(e.scheduler?e.scheduler():e.run())}function getDepFromReactive(e,t){var n;return null===(n=targetMap.get(e))||void 0===n?void 0:n.get(t)}var isNonTrackableKeys=makeMap("__proto__,__v_isRef,__isVue"),builtInSymbols=new Set(Object.getOwnPropertyNames(Symbol).filter((function(e){return"arguments"!==e&&"caller"!==e})).map((function(e){return Symbol[e]})).filter(isSymbol$1)),get$1=createGetter(),shallowGet=createGetter(!1,!0),readonlyGet=createGetter(!0),arrayInstrumentations=createArrayInstrumentations();function createArrayInstrumentations(){var e={};return["includes","indexOf","lastIndexOf"].forEach((function(t){e[t]=function(){for(var e=toRaw(this),n=0,r=this.length;n0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(n,r,i){if("__v_isReactive"===r)return!e;if("__v_isReadonly"===r)return e;if("__v_isShallow"===r)return t;if("__v_raw"===r&&i===(e?t?shallowReadonlyMap:readonlyMap:t?shallowReactiveMap:reactiveMap).get(n))return n;var a=isArray$8(n);if(!e){if(a&&hasOwn$2(arrayInstrumentations,r))return Reflect.get(arrayInstrumentations,r,i);if("hasOwnProperty"===r)return hasOwnProperty$2}var o=Reflect.get(n,r,i);return(isSymbol$1(r)?builtInSymbols.has(r):isNonTrackableKeys(r))?o:(e||track(n,"get",r),t?o:isRef(o)?a&&isIntegerKey(r)?o:o.value:isObject$4(o)?e?readonly(o):reactive(o):o)}}var set$1=createSetter(),shallowSet=createSetter(!0);function createSetter(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t,n,r,i){var a=t[n];if(isReadonly(a)&&isRef(a)&&!isRef(r))return!1;if(!e&&(isShallow(r)||isReadonly(r)||(a=toRaw(a),r=toRaw(r)),!isArray$8(t)&&isRef(a)&&!isRef(r)))return a.value=r,!0;var o=isArray$8(t)&&isIntegerKey(n)?Number(n)2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=toRaw(e=e.__v_raw),a=toRaw(t);n||(t!==a&&track(i,"get",t),track(i,"get",a));var o=getProto$1(i).has,s=r?toShallow:n?toReadonly:toReactive;return o.call(i,t)?s(e.get(t)):o.call(i,a)?s(e.get(a)):void(e!==i&&e.get(t))}function has$4(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.__v_raw,r=toRaw(n),i=toRaw(e);return t||(e!==i&&track(r,"has",e),track(r,"has",i)),e===i?n.has(e):n.has(e)||n.has(i)}function size(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e=e.__v_raw,!t&&track(toRaw(e),"iterate",ITERATE_KEY),Reflect.get(e,"size",e)}function add(e){e=toRaw(e);var t=toRaw(this);return getProto$1(t).has.call(t,e)||(t.add(e),trigger(t,"add",e,e)),this}function set(e,t){t=toRaw(t);var n=toRaw(this),r=getProto$1(n),i=r.has,a=r.get,o=i.call(n,e);o||(e=toRaw(e),o=i.call(n,e));var s=a.call(n,e);return n.set(e,t),o?hasChanged(t,s)&&trigger(n,"set",e,t):trigger(n,"add",e,t),this}function deleteEntry(e){var t=toRaw(this),n=getProto$1(t),r=n.has,i=n.get,a=r.call(t,e);a||(e=toRaw(e),a=r.call(t,e)),i&&i.call(t,e);var o=t.delete(e);return a&&trigger(t,"delete",e,void 0),o}function clear(){var e=toRaw(this),t=0!==e.size,n=e.clear();return t&&trigger(e,"clear",void 0,void 0),n}function createForEach(e,t){return function(n,r){var i=this,a=i.__v_raw,o=toRaw(a),s=t?toShallow:e?toReadonly:toReactive;return!e&&track(o,"iterate",ITERATE_KEY),a.forEach((function(e,t){return n.call(r,s(e),s(t),i)}))}}function createIterableMethod(e,t,n){return function(){var r=this.__v_raw,i=toRaw(r),a=isMap$1(i),o="entries"===e||e===Symbol.iterator&&a,s="keys"===e&&a,l=r[e].apply(r,arguments),u=n?toShallow:t?toReadonly:toReactive;return!t&&track(i,"iterate",s?MAP_KEY_ITERATE_KEY:ITERATE_KEY),_defineProperty2({next:function(){var e=l.next(),t=e.value,n=e.done;return n?{value:t,done:n}:{value:o?[u(t[0]),u(t[1])]:u(t),done:n}}},Symbol.iterator,(function(){return this}))}}function createReadonlyMethod(e){return function(){return"delete"!==e&&this}}function createInstrumentations(){var e={get:function(e){return get$2(this,e)},get size(){return size(this)},has:has$4,add:add,set:set,delete:deleteEntry,clear:clear,forEach:createForEach(!1,!1)},t={get:function(e){return get$2(this,e,!1,!0)},get size(){return size(this)},has:has$4,add:add,set:set,delete:deleteEntry,clear:clear,forEach:createForEach(!1,!0)},n={get:function(e){return get$2(this,e,!0)},get size(){return size(this,!0)},has:function(e){return has$4.call(this,e,!0)},add:createReadonlyMethod("add"),set:createReadonlyMethod("set"),delete:createReadonlyMethod("delete"),clear:createReadonlyMethod("clear"),forEach:createForEach(!0,!1)},r={get:function(e){return get$2(this,e,!0,!0)},get size(){return size(this,!0)},has:function(e){return has$4.call(this,e,!0)},add:createReadonlyMethod("add"),set:createReadonlyMethod("set"),delete:createReadonlyMethod("delete"),clear:createReadonlyMethod("clear"),forEach:createForEach(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((function(i){e[i]=createIterableMethod(i,!1,!1),n[i]=createIterableMethod(i,!0,!1),t[i]=createIterableMethod(i,!1,!0),r[i]=createIterableMethod(i,!0,!0)})),[e,n,t,r]}var _createInstrumentatio=createInstrumentations(),_createInstrumentatio2=_slicedToArray(_createInstrumentatio,4),mutableInstrumentations=_createInstrumentatio2[0],readonlyInstrumentations=_createInstrumentatio2[1],shallowInstrumentations=_createInstrumentatio2[2],shallowReadonlyInstrumentations=_createInstrumentatio2[3];function createInstrumentationGetter(e,t){var n=t?e?shallowReadonlyInstrumentations:shallowInstrumentations:e?readonlyInstrumentations:mutableInstrumentations;return function(t,r,i){return"__v_isReactive"===r?!e:"__v_isReadonly"===r?e:"__v_raw"===r?t:Reflect.get(hasOwn$2(n,r)&&r in t?n:t,r,i)}}var mutableCollectionHandlers={get:createInstrumentationGetter(!1,!1)},shallowCollectionHandlers={get:createInstrumentationGetter(!1,!0)},readonlyCollectionHandlers={get:createInstrumentationGetter(!0,!1)},reactiveMap=new WeakMap,shallowReactiveMap=new WeakMap,readonlyMap=new WeakMap,shallowReadonlyMap=new WeakMap;function targetTypeMap(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function getTargetType(e){return e.__v_skip||!Object.isExtensible(e)?0:targetTypeMap(toRawType(e))}function reactive(e){return isReadonly(e)?e:createReactiveObject(e,!1,mutableHandlers,mutableCollectionHandlers,reactiveMap)}function shallowReactive(e){return createReactiveObject(e,!1,shallowReactiveHandlers,shallowCollectionHandlers,shallowReactiveMap)}function readonly(e){return createReactiveObject(e,!0,readonlyHandlers,readonlyCollectionHandlers,readonlyMap)}function createReactiveObject(e,t,n,r,i){if(!isObject$4(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;var a=i.get(e);if(a)return a;var o=getTargetType(e);if(0===o)return e;var s=new Proxy(e,2===o?r:n);return i.set(e,s),s}function isReactive(e){return isReadonly(e)?isReactive(e.__v_raw):!(!e||!e.__v_isReactive)}function isReadonly(e){return!(!e||!e.__v_isReadonly)}function isShallow(e){return!(!e||!e.__v_isShallow)}function isProxy(e){return isReactive(e)||isReadonly(e)}function toRaw(e){var t=e&&e.__v_raw;return t?toRaw(t):e}function markRaw(e){return def(e,"__v_skip",!0),e}var toReactive=function(e){return isObject$4(e)?reactive(e):e},toReadonly=function(e){return isObject$4(e)?readonly(e):e};function trackRefValue(e){shouldTrack&&activeEffect&&trackEffects((e=toRaw(e)).dep||(e.dep=createDep()))}function triggerRefValue(e,t){var n=(e=toRaw(e)).dep;n&&triggerEffects(n)}function isRef(e){return!(!e||!0!==e.__v_isRef)}function ref(e){return createRef(e,!1)}function shallowRef(e){return createRef(e,!0)}function createRef(e,t){return isRef(e)?e:new RefImpl(e,t)}var RefImpl=function(){function e(t,n){_classCallCheck2(this,e),this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?t:toRaw(t),this._value=n?t:toReactive(t)}return _createClass2(e,[{key:"value",get:function(){return trackRefValue(this),this._value},set:function(e){var t=this.__v_isShallow||isShallow(e)||isReadonly(e);e=t?e:toRaw(e),hasChanged(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:toReactive(e),triggerRefValue(this))}}]),e}();function unref(e){return isRef(e)?e.value:e}var shallowUnwrapHandlers={get:function(e,t,n){return unref(Reflect.get(e,t,n))},set:function(e,t,n,r){var i=e[t];return isRef(i)&&!isRef(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function proxyRefs(e){return isReactive(e)?e:new Proxy(e,shallowUnwrapHandlers)}function toRefs(e){var t=isArray$8(e)?new Array(e.length):{};for(var n in e)t[n]=toRef(e,n);return t}var ObjectRefImpl=function(){function e(t,n,r){_classCallCheck2(this,e),this._object=t,this._key=n,this._defaultValue=r,this.__v_isRef=!0}return _createClass2(e,[{key:"value",get:function(){var e=this._object[this._key];return void 0===e?this._defaultValue:e},set:function(e){this._object[this._key]=e}},{key:"dep",get:function(){return getDepFromReactive(toRaw(this._object),this._key)}}]),e}(),_a$1;function toRef(e,t,n){var r=e[t];return isRef(r)?r:new ObjectRefImpl(e,t,n)}var ComputedRefImpl=function(){function e(t,n,r,i){var a=this;_classCallCheck2(this,e),this._setter=n,this.dep=void 0,this.__v_isRef=!0,this[_a$1]=!1,this._dirty=!0,this.effect=new ReactiveEffect(t,(function(){a._dirty||(a._dirty=!0,triggerRefValue(a))})),this.effect.computed=this,this.effect.active=this._cacheable=!i,this.__v_isReadonly=r}return _createClass2(e,[{key:"value",get:function(){var e=toRaw(this);return trackRefValue(e),!e._dirty&&e._cacheable||(e._dirty=!1,e._value=e.effect.run()),e._value},set:function(e){this._setter(e)}}]),e}();function computed$1(e,t){var n,r,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=isFunction$4(e);return a?(n=e,r=NOOP):(n=e.get,r=e.set),new ComputedRefImpl(n,r,a||!r,i)}function warn(e){}function callWithErrorHandling(e,t,n,r){var i;try{i=r?e.apply(void 0,_toConsumableArray2(r)):e()}catch(a){handleError(a,t,n)}return i}function callWithAsyncErrorHandling(e,t,n,r){if(isFunction$4(e)){var i=callWithErrorHandling(e,t,n,r);return i&&isPromise$1(i)&&i.catch((function(e){handleError(e,t,n)})),i}for(var a=[],o=0;o3&&void 0!==arguments[3])||arguments[3],i=t?t.vnode:null;if(t){for(var a=t.parent,o=t.proxy,s=n;a;){var l=a.ec;if(l)for(var u=0;u>>1;getId(queue$1[r])flushIndex&&queue$1.splice(t,1)}function queuePostFlushCb(e){isArray$8(e)?pendingPostFlushCbs.push.apply(pendingPostFlushCbs,_toConsumableArray2(e)):activePostFlushCbs&&activePostFlushCbs.includes(e,e.allowRecurse?postFlushIndex+1:postFlushIndex)||pendingPostFlushCbs.push(e),queueFlush()}function flushPreFlushCbs(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:isFlushing?flushIndex+1:0;t2?r-2:0),a=2;a2&&void 0!==arguments[2]&&arguments[2],r=t.emitsCache,i=r.get(e);if(void 0!==i)return i;var a=e.emits,o={},s=!1;if(!isFunction$4(e)){var l=function(e){var n=normalizeEmitsOptions(e,t,!0);n&&(s=!0,extend$3(o,n))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return a||s?(isArray$8(a)?a.forEach((function(e){return o[e]=null})):extend$3(o,a),isObject$4(e)&&r.set(e,o),o):(isObject$4(e)&&r.set(e,null),null)}function isEmitListener(e,t){return!(!e||!isOn(t))&&(t=t.slice(2).replace(/Once$/,""),hasOwn$2(e,t[0].toLowerCase()+t.slice(1))||hasOwn$2(e,hyphenate(t))||hasOwn$2(e,t))}var currentRenderingInstance=null,currentScopeId=null;function setCurrentRenderingInstance(e){var t=currentRenderingInstance;return currentRenderingInstance=e,currentScopeId=e&&e.type.__scopeId||null,t}function pushScopeId(e){currentScopeId=e}function popScopeId(){currentScopeId=null}function withCtx(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:currentRenderingInstance;if(!t)return e;if(e._n)return e;var n=function n(){n._d&&setBlockTracking(-1);var r,i=setCurrentRenderingInstance(t);try{r=e.apply(void 0,arguments)}finally{setCurrentRenderingInstance(i),n._d&&setBlockTracking(1)}return r};return n._n=!0,n._c=!0,n._d=!0,n}function markAttrsAccessed(){}function renderComponentRoot(e){var t,n,r=e.type,i=e.vnode,a=e.proxy,o=e.withProxy,s=e.props,l=_slicedToArray(e.propsOptions,1)[0],u=e.slots,c=e.attrs,h=e.emit,d=e.render,f=e.renderCache,p=e.data,v=e.setupState,m=e.ctx,g=e.inheritAttrs,y=setCurrentRenderingInstance(e);try{if(4&i.shapeFlag){var b=o||a;t=normalizeVNode(d.call(b,b,f,s,v,p,m)),n=c}else{var A=r;0,t=normalizeVNode(A.length>1?A(s,{attrs:c,slots:u,emit:h}):A(s,null)),n=r.props?c:getFunctionalFallthrough(c)}}catch(_){blockStack.length=0,handleError(_,e,1),t=createVNode(Comment)}var S=t;if(n&&!1!==g){var x=Object.keys(n),w=S.shapeFlag;x.length&&7&w&&(l&&x.some(isModelListener)&&(n=filterModelListeners(n,l)),S=cloneVNode(S,n))}return i.dirs&&((S=cloneVNode(S)).dirs=S.dirs?S.dirs.concat(i.dirs):i.dirs),i.transition&&(S.transition=i.transition),t=S,setCurrentRenderingInstance(y),t}var getFunctionalFallthrough=function(e){var t;for(var n in e)("class"===n||"style"===n||isOn(n))&&((t||(t={}))[n]=e[n]);return t},filterModelListeners=function(e,t){var n={};for(var r in e)isModelListener(r)&&r.slice(9)in t||(n[r]=e[r]);return n};function shouldUpdateComponent(e,t,n){var r=e.props,i=e.children,a=e.component,o=t.props,s=t.children,l=t.patchFlag,u=a.emitsOptions;if(t.dirs||t.transition)return!0;if(!(n&&l>=0))return!(!i&&!s||s&&s.$stable)||r!==o&&(r?!o||hasPropsChanged(r,o,u):!!o);if(1024&l)return!0;if(16&l)return r?hasPropsChanged(r,o,u):!!o;if(8&l)for(var c=t.dynamicProps,h=0;h2&&void 0!==arguments[2]&&arguments[2],r=currentInstance||currentRenderingInstance;if(r){var i=null==r.parent?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides;if(i&&e in i)return i[e];if(arguments.length>1)return n&&isFunction$4(t)?t.call(r.proxy):t}}function watchEffect(e,t){return doWatch(e,null,t)}var INITIAL_WATCHER_VALUE={};function watch(e,t,n){return doWatch(e,t,n)}function doWatch(e,t){var n,r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:EMPTY_OBJ,a=i.immediate,o=i.deep,s=i.flush,l=(i.onTrack,i.onTrigger,getCurrentScope()===(null==currentInstance?void 0:currentInstance.scope)?currentInstance:null),u=!1,c=!1;if(isRef(e)?(n=function(){return e.value},u=isShallow(e)):isReactive(e)?(n=function(){return e},o=!0):isArray$8(e)?(c=!0,u=e.some((function(e){return isReactive(e)||isShallow(e)})),n=function(){return e.map((function(e){return isRef(e)?e.value:isReactive(e)?traverse(e):isFunction$4(e)?callWithErrorHandling(e,l,2):void 0}))}):n=isFunction$4(e)?t?function(){return callWithErrorHandling(e,l,2)}:function(){if(!l||!l.isUnmounted)return r&&r(),callWithAsyncErrorHandling(e,l,3,[f])}:NOOP,t&&o){var h=n;n=function(){return traverse(h())}}var d,f=function(e){r=y.onStop=function(){callWithErrorHandling(e,l,4)}};if(isInSSRComponentSetup){if(f=NOOP,t?a&&callWithAsyncErrorHandling(t,l,3,[n(),c?[]:void 0,f]):n(),"sync"!==s)return NOOP;var p=useSSRContext();d=p.__watcherHandles||(p.__watcherHandles=[])}var v,m=c?new Array(e.length).fill(INITIAL_WATCHER_VALUE):INITIAL_WATCHER_VALUE,g=function(){if(y.active)if(t){var e=y.run();(o||u||(c?e.some((function(e,t){return hasChanged(e,m[t])})):hasChanged(e,m)))&&(r&&r(),callWithAsyncErrorHandling(t,l,3,[e,m===INITIAL_WATCHER_VALUE?void 0:c&&m[0]===INITIAL_WATCHER_VALUE?[]:m,f]),m=e)}else y.run()};g.allowRecurse=!!t,"sync"===s?v=g:"post"===s?v=function(){return queuePostRenderEffect(g,l&&l.suspense)}:(g.pre=!0,l&&(g.id=l.uid),v=function(){return queueJob(g)});var y=new ReactiveEffect(n,v);t?a?g():m=y.run():"post"===s?queuePostRenderEffect(y.run.bind(y),l&&l.suspense):y.run();var b=function(){y.stop(),l&&l.scope&&remove$7(l.scope.effects,y)};return d&&d.push(b),b}function instanceWatch(e,t,n){var r,i=this.proxy,a=isString$2(e)?e.includes(".")?createPathGetter(i,e):function(){return i[e]}:e.bind(i,i);isFunction$4(t)?r=t:(r=t.handler,n=t);var o=currentInstance;setCurrentInstance(this);var s=doWatch(a,r.bind(i),n);return o?setCurrentInstance(o):unsetCurrentInstance(),s}function createPathGetter(e,t){var n=t.split(".");return function(){for(var t=e,r=0;r1){var s,l=_createForOfIteratorHelper(t);try{for(l.s();!(s=l.n()).done;){var u=s.value;if(u.type!==Comment){o=u;break}}}catch(A){l.e(A)}finally{l.f()}}var c=toRaw(e),h=c.mode;if(a.isLeaving)return emptyPlaceholder(o);var d=getKeepAliveChild(o);if(!d)return emptyPlaceholder(o);var f=resolveTransitionHooks(d,c,a,i);setTransitionHooks(d,f);var p=i.subTree,v=p&&getKeepAliveChild(p),m=!1,g=d.type.getTransitionKey;if(g){var y=g();void 0===n?n=y:y!==n&&(n=y,m=!0)}if(v&&v.type!==Comment&&(!isSameVNodeType(d,v)||m)){var b=resolveTransitionHooks(v,c,a,i);if(setTransitionHooks(v,b),"out-in"===h)return a.isLeaving=!0,b.afterLeave=function(){a.isLeaving=!1,!1!==i.update.active&&i.update()},emptyPlaceholder(o);"in-out"===h&&d.type!==Comment&&(b.delayLeave=function(e,t,n){getLeavingNodesForType(a,v)[String(v.key)]=v,e._leaveCb=function(){t(),e._leaveCb=void 0,delete f.delayedLeave},f.delayedLeave=n})}return o}}}},BaseTransition=BaseTransitionImpl;function getLeavingNodesForType(e,t){var n=e.leavingVNodes,r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function resolveTransitionHooks(e,t,n,r){var i=t.appear,a=t.mode,o=t.persisted,s=void 0!==o&&o,l=t.onBeforeEnter,u=t.onEnter,c=t.onAfterEnter,h=t.onEnterCancelled,d=t.onBeforeLeave,f=t.onLeave,p=t.onAfterLeave,v=t.onLeaveCancelled,m=t.onBeforeAppear,g=t.onAppear,y=t.onAfterAppear,b=t.onAppearCancelled,A=String(e.key),S=getLeavingNodesForType(n,e),x=function(e,t){e&&callWithAsyncErrorHandling(e,r,9,t)},w=function(e,t){var n=t[1];x(e,t),isArray$8(e)?e.every((function(e){return e.length<=1}))&&n():e.length<=1&&n()},_={mode:a,persisted:s,beforeEnter:function(t){var r=l;if(!n.isMounted){if(!i)return;r=m||l}t._leaveCb&&t._leaveCb(!0);var a=S[A];a&&isSameVNodeType(e,a)&&a.el._leaveCb&&a.el._leaveCb(),x(r,[t])},enter:function(e){var t=u,r=c,a=h;if(!n.isMounted){if(!i)return;t=g||u,r=y||c,a=b||h}var o=!1,s=e._enterCb=function(t){o||(o=!0,x(t?a:r,[e]),_.delayedLeave&&_.delayedLeave(),e._enterCb=void 0)};t?w(t,[e,s]):s()},leave:function(t,r){var i=String(e.key);if(t._enterCb&&t._enterCb(!0),n.isUnmounting)return r();x(d,[t]);var a=!1,o=t._leaveCb=function(n){a||(a=!0,r(),x(n?v:p,[t]),t._leaveCb=void 0,S[i]===e&&delete S[i])};S[i]=e,f?w(f,[t,o]):o()},clone:function(e){return resolveTransitionHooks(e,t,n,r)}};return _}function emptyPlaceholder(e){if(isKeepAlive(e))return(e=cloneVNode(e)).children=null,e}function getKeepAliveChild(e){return isKeepAlive(e)?e.children?e.children[0]:void 0:e}function setTransitionHooks(e,t){6&e.shapeFlag&&e.component?setTransitionHooks(e.component.subTree,t):128&e.shapeFlag?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function getTransitionRawChildren(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0,r=[],i=0,a=0;a1)for(var l=0;l2&&void 0!==arguments[2]?arguments[2]:currentInstance,r=e.__wdc||(e.__wdc=function(){for(var t=n;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(injectHook(t,r,n),n)for(var i=n.parent;i&&i.parent;)isKeepAlive(i.parent.vnode)&&injectToKeepAliveRoot(r,t,n,i),i=i.parent}function injectToKeepAliveRoot(e,t,n,r){var i=injectHook(t,e,r,!0);onUnmounted((function(){remove$7(r[t],i)}),n)}function injectHook(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:currentInstance,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(n){var i=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=function(){if(!n.isUnmounted){pauseTracking(),setCurrentInstance(n);for(var r=arguments.length,i=new Array(r),a=0;a1&&void 0!==arguments[1]?arguments[1]:currentInstance)}},onBeforeMount=exports("G",createHook("bm")),onMounted=exports("M",createHook("m")),onBeforeUpdate=exports("bO",createHook("bu")),onUpdated=exports("bp",createHook("u")),onBeforeUnmount=exports("aG",createHook("bum")),onUnmounted=exports("at",createHook("um")),onServerPrefetch=createHook("sp"),onRenderTriggered=createHook("rtg"),onRenderTracked=createHook("rtc");function onErrorCaptured(e){injectHook("ec",e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:currentInstance)}function withDirectives(e,t){var n=currentRenderingInstance;if(null===n)return e;for(var r=getExposeProxy(n)||n.proxy,i=e.dirs||(e.dirs=[]),a=0;a3&&void 0!==arguments[3]&&arguments[3],r=currentRenderingInstance||currentInstance;if(r){var i=r.type;if(e===COMPONENTS){var a=getComponentName(i,!1);if(a&&(a===t||a===camelize$1(t)||a===capitalize(camelize$1(t))))return i}var o=resolve(r[e]||i[e],t)||resolve(r.appContext[e],t);return!o&&n?i:o}}function resolve(e,t){return e&&(e[t]||e[camelize$1(t)]||e[capitalize(camelize$1(t))])}function renderList(e,t,n,r){var i,a=n&&n[r];if(isArray$8(e)||isString$2(e)){i=new Array(e.length);for(var o=0,s=e.length;o2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(currentRenderingInstance.isCE||currentRenderingInstance.parent&&isAsyncWrapper(currentRenderingInstance.parent)&¤tRenderingInstance.parent.isCE)return"default"!==t&&(n.name=t),createVNode("slot",n,r&&r());var a=e[t];a&&a._c&&(a._d=!1),openBlock();var o=a&&ensureValidVNode(a(n)),s=createBlock(Fragment,{key:n.key||o&&o.key||"_".concat(t)},o||(r?r():[]),o&&1===e._?64:-2);return!i&&s.scopeId&&(s.slotScopeIds=[s.scopeId+"-s"]),a&&a._c&&(a._d=!0),s}function ensureValidVNode(e){return e.some((function(e){return!isVNode(e)||e.type!==Comment&&!(e.type===Fragment&&!ensureValidVNode(e.children))}))?e:null}var getPublicInstance=function e(t){return t?isStatefulComponent(t)?getExposeProxy(t)||t.proxy:e(t.parent):null},publicPropertiesMap=extend$3(Object.create(null),{$:function(e){return e},$el:function(e){return e.vnode.el},$data:function(e){return e.data},$props:function(e){return e.props},$attrs:function(e){return e.attrs},$slots:function(e){return e.slots},$refs:function(e){return e.refs},$parent:function(e){return getPublicInstance(e.parent)},$root:function(e){return getPublicInstance(e.root)},$emit:function(e){return e.emit},$options:function(e){return resolveMergedOptions(e)},$forceUpdate:function(e){return e.f||(e.f=function(){return queueJob(e.update)})},$nextTick:function(e){return e.n||(e.n=nextTick.bind(e.proxy))},$watch:function(e){return instanceWatch.bind(e)}}),hasSetupBinding=function(e,t){return e!==EMPTY_OBJ&&!e.__isScriptSetup&&hasOwn$2(e,t)},PublicInstanceProxyHandlers={get:function(e,t){var n,r=e._,i=r.ctx,a=r.setupState,o=r.data,s=r.props,l=r.accessCache,u=r.type,c=r.appContext;if("$"!==t[0]){var h=l[t];if(void 0!==h)switch(h){case 1:return a[t];case 2:return o[t];case 4:return i[t];case 3:return s[t]}else{if(hasSetupBinding(a,t))return l[t]=1,a[t];if(o!==EMPTY_OBJ&&hasOwn$2(o,t))return l[t]=2,o[t];if((n=r.propsOptions[0])&&hasOwn$2(n,t))return l[t]=3,s[t];if(i!==EMPTY_OBJ&&hasOwn$2(i,t))return l[t]=4,i[t];shouldCacheAccess&&(l[t]=0)}}var d,f,p=publicPropertiesMap[t];return p?("$attrs"===t&&track(r,"get",t),p(r)):(d=u.__cssModules)&&(d=d[t])?d:i!==EMPTY_OBJ&&hasOwn$2(i,t)?(l[t]=4,i[t]):(f=c.config.globalProperties,hasOwn$2(f,t)?f[t]:void 0)},set:function(e,t,n){var r=e._,i=r.data,a=r.setupState,o=r.ctx;return hasSetupBinding(a,t)?(a[t]=n,!0):i!==EMPTY_OBJ&&hasOwn$2(i,t)?(i[t]=n,!0):!hasOwn$2(r.props,t)&&(("$"!==t[0]||!(t.slice(1)in r))&&(o[t]=n,!0))},has:function(e,t){var n,r=e._,i=r.data,a=r.setupState,o=r.accessCache,s=r.ctx,l=r.appContext,u=r.propsOptions;return!!o[t]||i!==EMPTY_OBJ&&hasOwn$2(i,t)||hasSetupBinding(a,t)||(n=u[0])&&hasOwn$2(n,t)||hasOwn$2(s,t)||hasOwn$2(publicPropertiesMap,t)||hasOwn$2(l.config.globalProperties,t)},defineProperty:function(e,t,n){return null!=n.get?e._.accessCache[t]=0:hasOwn$2(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},shouldCacheAccess=!0;function applyOptions(e){var t=resolveMergedOptions(e),n=e.proxy,r=e.ctx;shouldCacheAccess=!1,t.beforeCreate&&callHook$1(t.beforeCreate,e,"bc");var i=t.data,a=t.computed,o=t.methods,s=t.watch,l=t.provide,u=t.inject,c=t.created,h=t.beforeMount,d=t.mounted,f=t.beforeUpdate,p=t.updated,v=t.activated,m=t.deactivated,g=(t.beforeDestroy,t.beforeUnmount),y=(t.destroyed,t.unmounted),b=t.render,A=t.renderTracked,S=t.renderTriggered,x=t.errorCaptured,w=t.serverPrefetch,_=t.expose,E=t.inheritAttrs,k=t.components,C=t.directives;t.filters;if(u&&resolveInjections(u,r,null,e.appContext.config.unwrapInjectedRef),o)for(var M in o){var P=o[M];isFunction$4(P)&&(r[M]=P.bind(n))}if(i){var I=i.call(n,n);isObject$4(I)&&(e.data=reactive(I))}if(shouldCacheAccess=!0,a){var T=function(){var e=a[B],t=isFunction$4(e)?e.bind(n,n):isFunction$4(e.get)?e.get.bind(n,n):NOOP,i=!isFunction$4(e)&&isFunction$4(e.set)?e.set.bind(n):NOOP,o=computed({get:t,set:i});Object.defineProperty(r,B,{enumerable:!0,configurable:!0,get:function(){return o.value},set:function(e){return o.value=e}})};for(var B in a)T()}if(s)for(var R in s)createWatcher(s[R],r,n,R);if(l){var L=isFunction$4(l)?l.call(n):l;Reflect.ownKeys(L).forEach((function(e){provide(e,L[e])}))}function N(e,t){isArray$8(t)?t.forEach((function(t){return e(t.bind(n))})):t&&e(t.bind(n))}if(c&&callHook$1(c,e,"c"),N(onBeforeMount,h),N(onMounted,d),N(onBeforeUpdate,f),N(onUpdated,p),N(onActivated,v),N(onDeactivated,m),N(onErrorCaptured,x),N(onRenderTracked,A),N(onRenderTriggered,S),N(onBeforeUnmount,g),N(onUnmounted,y),N(onServerPrefetch,w),isArray$8(_))if(_.length){var F=e.exposed||(e.exposed={});_.forEach((function(e){Object.defineProperty(F,e,{get:function(){return n[e]},set:function(t){return n[e]=t}})}))}else e.exposed||(e.exposed={});b&&e.render===NOOP&&(e.render=b),null!=E&&(e.inheritAttrs=E),k&&(e.components=k),C&&(e.directives=C)}function resolveInjections(e,t){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];isArray$8(e)&&(e=normalizeInject(e));var r=function(){var r,a=e[i];isRef(r=isObject$4(a)?"default"in a?inject(a.from||i,a.default,!0):inject(a.from||i):inject(a))&&n?Object.defineProperty(t,i,{enumerable:!0,configurable:!0,get:function(){return r.value},set:function(e){return r.value=e}}):t[i]=r};for(var i in e)r()}function callHook$1(e,t,n){callWithAsyncErrorHandling(isArray$8(e)?e.map((function(e){return e.bind(t.proxy)})):e.bind(t.proxy),t,n)}function createWatcher(e,t,n,r){var i=r.includes(".")?createPathGetter(n,r):function(){return n[r]};if(isString$2(e)){var a=t[e];isFunction$4(a)&&watch(i,a)}else if(isFunction$4(e))watch(i,e.bind(n));else if(isObject$4(e))if(isArray$8(e))e.forEach((function(e){return createWatcher(e,t,n,r)}));else{var o=isFunction$4(e.handler)?e.handler.bind(n):t[e.handler];isFunction$4(o)&&watch(i,o,e)}}function resolveMergedOptions(e){var t,n=e.type,r=n.mixins,i=n.extends,a=e.appContext,o=a.mixins,s=a.optionsCache,l=a.config.optionMergeStrategies,u=s.get(n);return u?t=u:o.length||r||i?(t={},o.length&&o.forEach((function(e){return mergeOptions$1(t,e,l,!0)})),mergeOptions$1(t,n,l)):t=n,isObject$4(n)&&s.set(n,t),t}function mergeOptions$1(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=t.mixins,a=t.extends;for(var o in a&&mergeOptions$1(e,a,n,!0),i&&i.forEach((function(t){return mergeOptions$1(e,t,n,!0)})),t)if(r&&"expose"===o);else{var s=internalOptionMergeStrats[o]||n&&n[o];e[o]=s?s(e[o],t[o]):t[o]}return e}var internalOptionMergeStrats={data:mergeDataFn,props:mergeObjectOptions,emits:mergeObjectOptions,methods:mergeObjectOptions,computed:mergeObjectOptions,beforeCreate:mergeAsArray,created:mergeAsArray,beforeMount:mergeAsArray,mounted:mergeAsArray,beforeUpdate:mergeAsArray,updated:mergeAsArray,beforeDestroy:mergeAsArray,beforeUnmount:mergeAsArray,destroyed:mergeAsArray,unmounted:mergeAsArray,activated:mergeAsArray,deactivated:mergeAsArray,errorCaptured:mergeAsArray,serverPrefetch:mergeAsArray,components:mergeObjectOptions,directives:mergeObjectOptions,watch:mergeWatchOptions,provide:mergeDataFn,inject:mergeInject};function mergeDataFn(e,t){return t?e?function(){return extend$3(isFunction$4(e)?e.call(this,this):e,isFunction$4(t)?t.call(this,this):t)}:t:e}function mergeInject(e,t){return mergeObjectOptions(normalizeInject(e),normalizeInject(t))}function normalizeInject(e){if(isArray$8(e)){for(var t={},n=0;n3&&void 0!==arguments[3]&&arguments[3],i={},a={};for(var o in def(a,InternalObjectKey,1),e.propsDefaults=Object.create(null),setFullProps(e,t,i,a),e.propsOptions[0])o in i||(i[o]=void 0);n?e.props=r?i:shallowReactive(i):e.type.props?e.props=i:e.props=a,e.attrs=a}function updateProps(e,t,n,r){var i=e.props,a=e.attrs,o=e.vnode.patchFlag,s=toRaw(i),l=_slicedToArray(e.propsOptions,1)[0],u=!1;if(!(r||o>0)||16&o){var c;for(var h in setFullProps(e,t,i,a)&&(u=!0),s)t&&(hasOwn$2(t,h)||(c=hyphenate(h))!==h&&hasOwn$2(t,c))||(l?!n||void 0===n[h]&&void 0===n[c]||(i[h]=resolvePropValue(l,s,h,void 0,e,!0)):delete i[h]);if(a!==s)for(var d in a)t&&hasOwn$2(t,d)||(delete a[d],u=!0)}else if(8&o)for(var f=e.vnode.dynamicProps,p=0;p2&&void 0!==arguments[2]&&arguments[2],r=t.propsCache,i=r.get(e);if(i)return i;var a=e.props,o={},s=[],l=!1;if(!isFunction$4(e)){var u=function(e){l=!0;var n=_slicedToArray(normalizePropsOptions(e,t,!0),2),r=n[0],i=n[1];extend$3(o,r),i&&s.push.apply(s,_toConsumableArray2(i))};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!a&&!l)return isObject$4(e)&&r.set(e,EMPTY_ARR),EMPTY_ARR;if(isArray$8(a))for(var c=0;c-1,v[1]=g<0||m-1||hasOwn$2(v,"default"))&&s.push(f)}}}var y=[o,s];return isObject$4(e)&&r.set(e,y),y}function validatePropName(e){return"$"!==e[0]}function getType(e){var t=e&&e.toString().match(/^\s*(function|class) (\w+)/);return t?t[2]:null===e?"null":""}function isSameType(e,t){return getType(e)===getType(t)}function getTypeIndex(e,t){return isArray$8(t)?t.findIndex((function(t){return isSameType(t,e)})):isFunction$4(t)&&isSameType(t,e)?0:-1}var isInternalKey=function(e){return"_"===e[0]||"$stable"===e},normalizeSlotValue=function(e){return isArray$8(e)?e.map(normalizeVNode):[normalizeVNode(e)]},normalizeSlot$1=function(e,t,n){if(t._n)return t;var r=withCtx((function(){return normalizeSlotValue(t.apply(void 0,arguments))}),n);return r._c=!1,r},normalizeObjectSlots=function(e,t,n){var r=e._ctx,i=function(){if(isInternalKey(a))return"continue";var n=e[a];if(isFunction$4(n))t[a]=normalizeSlot$1(a,n,r);else if(null!=n){var i=normalizeSlotValue(n);t[a]=function(){return i}}};for(var a in e)i()},normalizeVNodeSlots=function(e,t){var n=normalizeSlotValue(t);e.slots.default=function(){return n}},initSlots=function(e,t){if(32&e.vnode.shapeFlag){var n=t._;n?(e.slots=toRaw(t),def(t,"_",n)):normalizeObjectSlots(t,e.slots={})}else e.slots={},t&&normalizeVNodeSlots(e,t);def(e.slots,InternalObjectKey,1)},updateSlots=function(e,t,n){var r=e.vnode,i=e.slots,a=!0,o=EMPTY_OBJ;if(32&r.shapeFlag){var s=t._;s?n&&1===s?a=!1:(extend$3(i,t),n||1!==s||delete i._):(a=!t.$stable,normalizeObjectSlots(t,i)),o=t}else t&&(normalizeVNodeSlots(e,t),o={default:1});if(a)for(var l in i)isInternalKey(l)||l in o||delete i[l]};function createAppContext(){return{app:null,config:{isNativeTag:NO,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var uid$1=0;function createAppAPI(e,t){return function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;isFunction$4(n)||(n=Object.assign({},n)),null==r||isObject$4(r)||(r=null);var i=createAppContext(),a=new Set,o=!1,s=i.app={_uid:uid$1++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:version,get config(){return i.config},set config(e){},use:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r4&&void 0!==arguments[4]&&arguments[4];if(isArray$8(e))e.forEach((function(e,a){return setRef(e,t&&(isArray$8(t)?t[a]:t),n,r,i)}));else if(!isAsyncWrapper(r)||i){var a=4&r.shapeFlag?getExposeProxy(r.component)||r.component.proxy:r.el,o=i?null:a,s=e.i,l=e.r,u=t&&t.r,c=s.refs===EMPTY_OBJ?s.refs={}:s.refs,h=s.setupState;if(null!=u&&u!==l&&(isString$2(u)?(c[u]=null,hasOwn$2(h,u)&&(h[u]=null)):isRef(u)&&(u.value=null)),isFunction$4(l))callWithErrorHandling(l,s,12,[o,c]);else{var d=isString$2(l),f=isRef(l);if(d||f){var p=function(){if(e.f){var t=d?hasOwn$2(h,l)?h[l]:c[l]:l.value;i?isArray$8(t)&&remove$7(t,a):isArray$8(t)?t.includes(a)||t.push(a):d?(c[l]=[a],hasOwn$2(h,l)&&(h[l]=c[l])):(l.value=[a],e.k&&(c[e.k]=l.value))}else d?(c[l]=o,hasOwn$2(h,l)&&(h[l]=o)):f&&(l.value=o,e.k&&(c[e.k]=o))};o?(p.id=-1,queuePostRenderEffect(p,n)):p()}}}}var queuePostRenderEffect=queueEffectWithSuspense;function createRenderer(e){return baseCreateRenderer(e)}function baseCreateRenderer(e,t){getGlobalThis().__VUE__=!0;var n,r,i=e.insert,a=e.remove,o=e.patchProp,s=e.createElement,l=e.createText,u=e.createComment,c=e.setText,h=e.setElementText,d=e.parentNode,f=e.nextSibling,p=e.setScopeId,v=void 0===p?NOOP:p,m=e.insertStaticContent,g=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]&&arguments[6],s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:!!t.dynamicChildren;if(e!==t){e&&!isSameVNodeType(e,t)&&(r=U(e),O(e,i,a,!0),e=null),-2===t.patchFlag&&(l=!1,t.dynamicChildren=null);var u=t.type,c=t.ref,h=t.shapeFlag;switch(u){case Text:y(e,t,n,r);break;case Comment:b(e,t,n,r);break;case Static:null==e&&A(t,n,r,o);break;case Fragment:M(e,t,n,r,i,a,o,s,l);break;default:1&h?S(e,t,n,r,i,a,o,s,l):6&h?P(e,t,n,r,i,a,o,s,l):(64&h||128&h)&&u.process(e,t,n,r,i,a,o,s,l,Q)}null!=c&&i&&setRef(c,e&&e.ref,a,t||e,!t)}},y=function(e,t,n,r){if(null==e)i(t.el=l(t.children),n,r);else{var a=t.el=e.el;t.children!==e.children&&c(a,t.children)}},b=function(e,t,n,r){null==e?i(t.el=u(t.children||""),n,r):t.el=e.el},A=function(e,t,n,r){var i=_slicedToArray(m(e.children,t,n,r,e.el,e.anchor),2);e.el=i[0],e.anchor=i[1]},S=function(e,t,n,r,i,a,o,s,l){o=o||"svg"===t.type,null==e?x(t,n,r,i,a,o,s,l):E(e,t,i,a,o,s,l)},x=function(e,t,n,r,a,l,u,c){var d,f,p=e.type,v=e.props,m=e.shapeFlag,g=e.transition,y=e.dirs;if(d=e.el=s(e.type,l,v&&v.is,v),8&m?h(d,e.children):16&m&&_(e.children,d,null,r,a,l&&"foreignObject"!==p,u,c),y&&invokeDirectiveHook(e,null,r,"created"),w(d,e,e.scopeId,u,r),v){for(var b in v)"value"===b||isReservedProp(b)||o(d,b,null,v[b],l,e.children,r,a,H);"value"in v&&o(d,"value",null,v.value),(f=v.onVnodeBeforeMount)&&invokeVNodeHook(f,r,e)}y&&invokeDirectiveHook(e,null,r,"beforeMount");var A=(!a||a&&!a.pendingBranch)&&g&&!g.persisted;A&&g.beforeEnter(d),i(d,t,n),((f=v&&v.onVnodeMounted)||A||y)&&queuePostRenderEffect((function(){f&&invokeVNodeHook(f,r,e),A&&g.enter(d),y&&invokeDirectiveHook(e,null,r,"mounted")}),a)},w=function e(t,n,r,i,a){if(r&&v(t,r),i)for(var o=0;o8&&void 0!==arguments[8]?arguments[8]:0;l0){if(16&u)C(l,t,p,v,n,r,i);else if(2&u&&p.class!==v.class&&o(l,"class",null,v.class,i),4&u&&o(l,"style",p.style,v.style,i),8&u)for(var g=t.dynamicProps,y=0;y0&&64&f&&p&&e.dynamicChildren?(k(e.dynamicChildren,p,n,a,o,s,u),(null!=t.key||a&&t===a.subTree)&&traverseStaticChildren(e,t,!0)):L(e,t,n,d,a,o,s,u,c)},P=function(e,t,n,r,i,a,o,s,l){t.slotScopeIds=s,null==e?512&t.shapeFlag?i.ctx.activate(t,n,r,o,l):I(t,n,r,i,a,o,l):T(e,t,l)},I=function(e,t,n,r,i,a,o){var s=e.component=createComponentInstance(e,r,i);if(isKeepAlive(e)&&(s.ctx.renderer=Q),setupComponent(s),s.asyncDep){if(i&&i.registerDep(s,B),!e.el){var l=s.subTree=createVNode(Comment);b(null,l,t,n)}}else B(s,e,t,n,i,a,o)},T=function(e,t,n){var r=t.component=e.component;if(shouldUpdateComponent(e,t,n)){if(r.asyncDep&&!r.asyncResolved)return void R(r,t,n);r.next=t,invalidateJob(r.update),r.update()}else t.el=e.el,r.vnode=t},B=function(e,t,n,i,a,o,s){var l=e.effect=new ReactiveEffect((function(){if(e.isMounted){var l,u=e.next,c=e.bu,h=e.u,f=e.parent,p=e.vnode,v=u;toggleRecurse(e,!1),u?(u.el=p.el,R(e,u,s)):u=p,c&&invokeArrayFns(c),(l=u.props&&u.props.onVnodeBeforeUpdate)&&invokeVNodeHook(l,f,u,p),toggleRecurse(e,!0);var m=renderComponentRoot(e),y=e.subTree;e.subTree=m,g(y,m,d(y.el),U(y),e,a,o),u.el=m.el,null===v&&updateHOCHostEl(e,m.el),h&&queuePostRenderEffect(h,a),(l=u.props&&u.props.onVnodeUpdated)&&queuePostRenderEffect((function(){return invokeVNodeHook(l,f,u,p)}),a)}else{var b,A=t,S=A.el,x=A.props,w=e.bm,_=e.m,E=e.parent,k=isAsyncWrapper(t);if(toggleRecurse(e,!1),w&&invokeArrayFns(w),!k&&(b=x&&x.onVnodeBeforeMount)&&invokeVNodeHook(b,E,t),toggleRecurse(e,!0),S&&r){var C=function(){e.subTree=renderComponentRoot(e),r(S,e.subTree,e,a,null)};k?t.type.__asyncLoader().then((function(){return!e.isUnmounted&&C()})):C()}else{var M=e.subTree=renderComponentRoot(e);g(null,M,n,i,e,a,o),t.el=M.el}if(_&&queuePostRenderEffect(_,a),!k&&(b=x&&x.onVnodeMounted)){var P=t;queuePostRenderEffect((function(){return invokeVNodeHook(b,E,P)}),a)}(256&t.shapeFlag||E&&isAsyncWrapper(E.vnode)&&256&E.vnode.shapeFlag)&&e.a&&queuePostRenderEffect(e.a,a),e.isMounted=!0,t=n=i=null}}),(function(){return queueJob(u)}),e.scope),u=e.update=function(){return l.run()};u.id=e.uid,toggleRecurse(e,!0),u()},R=function(e,t,n){t.component=e;var r=e.vnode.props;e.vnode=t,e.next=null,updateProps(e,t.props,r,n),updateSlots(e,t.children,n),pauseTracking(),flushPreFlushCbs(),resetTracking()},L=function(e,t,n,r,i,a,o,s){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8],u=e&&e.children,c=e?e.shapeFlag:0,d=t.children,f=t.patchFlag,p=t.shapeFlag;if(f>0){if(128&f)return void F(u,d,n,r,i,a,o,s,l);if(256&f)return void N(u,d,n,r,i,a,o,s,l)}8&p?(16&c&&H(u,i,a),d!==u&&h(n,d)):16&c?16&p?F(u,d,n,r,i,a,o,s,l):H(u,i,a,!0):(8&c&&h(n,""),16&p&&_(d,n,r,i,a,o,s,l))},N=function(e,t,n,r,i,a,o,s,l){t=t||EMPTY_ARR;var u,c=(e=e||EMPTY_ARR).length,h=t.length,d=Math.min(c,h);for(u=0;uh?H(e,i,a,!0,!1,d):_(t,n,r,i,a,o,s,l,d)},F=function(e,t,n,r,i,a,o,s,l){for(var u=0,c=t.length,h=e.length-1,d=c-1;u<=h&&u<=d;){var f=e[u],p=t[u]=l?cloneIfMounted(t[u]):normalizeVNode(t[u]);if(!isSameVNodeType(f,p))break;g(f,p,n,null,i,a,o,s,l),u++}for(;u<=h&&u<=d;){var v=e[h],m=t[d]=l?cloneIfMounted(t[d]):normalizeVNode(t[d]);if(!isSameVNodeType(v,m))break;g(v,m,n,null,i,a,o,s,l),h--,d--}if(u>h){if(u<=d)for(var y=d+1,b=yd)for(;u<=h;)O(e[u],i,a,!0),u++;else{var A,S=u,x=u,w=new Map;for(u=x;u<=d;u++){var _=t[u]=l?cloneIfMounted(t[u]):normalizeVNode(t[u]);null!=_.key&&w.set(_.key,u)}var E=0,k=d-x+1,C=!1,M=0,P=new Array(k);for(u=0;u=k)O(I,i,a,!0);else{var T=void 0;if(null!=I.key)T=w.get(I.key);else for(A=x;A<=d;A++)if(0===P[A-x]&&isSameVNodeType(I,t[A])){T=A;break}void 0===T?O(I,i,a,!0):(P[T-x]=u+1,T>=M?M=T:C=!0,g(I,t[T],n,null,i,a,o,s,l),E++)}}var B=C?getSequence(P):EMPTY_ARR;for(A=B.length-1,u=k-1;u>=0;u--){var R=x+u,L=t[R],N=R+14&&void 0!==arguments[4]?arguments[4]:null,s=t.el,l=t.type,u=t.transition,c=t.children,h=t.shapeFlag;if(6&h)e(t.component.subTree,n,r,a);else if(128&h)t.suspense.move(n,r,a);else if(64&h)l.move(t,n,r,Q);else if(l!==Fragment){if(l!==Static)if(2!==a&&1&h&&u)if(0===a)u.beforeEnter(s),i(s,n,r),queuePostRenderEffect((function(){return u.enter(s)}),o);else{var d=u.leave,p=u.delayLeave,v=u.afterLeave,m=function(){return i(s,n,r)},g=function(){d(s,(function(){m(),v&&v()}))};p?p(s,m,g):g()}else i(s,n,r);else!function(e,t,n){for(var r,a=e.el,o=e.anchor;a&&a!==o;)r=f(a),i(a,t,n),a=r;i(o,t,n)}(t,n,r)}else{i(s,n,r);for(var y=0;y3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=e.type,o=e.props,s=e.ref,l=e.children,u=e.dynamicChildren,c=e.shapeFlag,h=e.patchFlag,d=e.dirs;if(null!=s&&setRef(s,null,n,e,!0),256&c)t.ctx.deactivate(e);else{var f,p=1&c&&d,v=!isAsyncWrapper(e);if(v&&(f=o&&o.onVnodeBeforeUnmount)&&invokeVNodeHook(f,t,e),6&c)G(e.component,n,r);else{if(128&c)return void e.suspense.unmount(n,r);p&&invokeDirectiveHook(e,null,t,"beforeUnmount"),64&c?e.type.remove(e,t,n,i,Q,r):u&&(a!==Fragment||h>0&&64&h)?H(u,t,n,!1,!0):(a===Fragment&&384&h||!i&&16&c)&&H(l,t,n),r&&V(e)}(v&&(f=o&&o.onVnodeUnmounted)||p)&&queuePostRenderEffect((function(){f&&invokeVNodeHook(f,t,e),p&&invokeDirectiveHook(e,null,t,"unmounted")}),n)}},V=function(e){var t=e.type,n=e.el,r=e.anchor,i=e.transition;if(t!==Fragment)if(t!==Static){var o=function(){a(n),i&&!i.persisted&&i.afterLeave&&i.afterLeave()};if(1&e.shapeFlag&&i&&!i.persisted){var s=i.leave,l=i.delayLeave,u=function(){return s(n,o)};l?l(e.el,o,u):u()}else o()}else!function(e){for(var t,n=e.el,r=e.anchor;n&&n!==r;)t=f(n),a(n),n=t;a(r)}(e);else z(n,r)},z=function(e,t){for(var n;e!==t;)n=f(e),a(e),e=n;a(t)},G=function(e,t,n){var r=e.bum,i=e.scope,a=e.update,o=e.subTree,s=e.um;r&&invokeArrayFns(r),i.stop(),a&&(a.active=!1,O(o,e,t,n)),s&&queuePostRenderEffect(s,t),queuePostRenderEffect((function(){e.isUnmounted=!0}),t),t&&t.pendingBranch&&!t.isUnmounted&&e.asyncDep&&!e.asyncResolved&&e.suspenseId===t.pendingId&&(t.deps--,0===t.deps&&t.resolve())},H=function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;a2&&void 0!==arguments[2]&&arguments[2],r=e.children,i=t.children;if(isArray$8(r)&&isArray$8(i))for(var a=0;a>1]]0&&(o[t]=s[r-1]),s[r]=t)}}for(i=s[(r=s.length)-1];r-- >0;)s[r]=i,i=o[i];return s}var isTeleport=function(e){return e.__isTeleport},isTeleportDisabled=function(e){return e&&(e.disabled||""===e.disabled)},isTargetSVG=function(e){return"undefined"!=typeof SVGElement&&e instanceof SVGElement},resolveTarget=function(e,t){var n=e&&e.to;return isString$2(n)?t?t(n):null:n},TeleportImpl={__isTeleport:!0,process:function(e,t,n,r,i,a,o,s,l,u){var c=u.mc,h=u.pc,d=u.pbc,f=u.o,p=f.insert,v=f.querySelector,m=f.createText,g=(f.createComment,isTeleportDisabled(t.props)),y=t.shapeFlag,b=t.children,A=t.dynamicChildren;if(null==e){var S=t.el=m(""),x=t.anchor=m("");p(S,n,r),p(x,n,r);var w=t.target=resolveTarget(t.props,v),_=t.targetAnchor=m("");w&&(p(_,w),o=o||isTargetSVG(w));var E=function(e,t){16&y&&c(b,e,t,i,a,o,s,l)};g?E(n,x):w&&E(w,_)}else{t.el=e.el;var k=t.anchor=e.anchor,C=t.target=e.target,M=t.targetAnchor=e.targetAnchor,P=isTeleportDisabled(e.props),I=P?n:C,T=P?k:M;if(o=o||isTargetSVG(C),A?(d(e.dynamicChildren,A,I,i,a,o,s),traverseStaticChildren(e,t,!0)):l||h(e,t,I,T,i,a,o,s,!1),g)P||moveTeleport(t,n,k,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){var B=t.target=resolveTarget(t.props,v);B&&moveTeleport(t,B,null,u,0)}else P&&moveTeleport(t,C,M,u,1)}updateCssVars(t)},remove:function(e,t,n,r,i,a){var o=i.um,s=i.o.remove,l=e.shapeFlag,u=e.children,c=e.anchor,h=e.targetAnchor,d=e.target,f=e.props;if(d&&s(h),(a||!isTeleportDisabled(f))&&(s(c),16&l))for(var p=0;p4&&void 0!==arguments[4]?arguments[4]:2;0===o&&i(e.targetAnchor,t,n);var s=e.el,l=e.anchor,u=e.shapeFlag,c=e.children,h=e.props,d=2===o;if(d&&i(s,t,n),(!d||isTeleportDisabled(h))&&16&u)for(var f=0;f0&&void 0!==arguments[0]&&arguments[0];blockStack.push(currentBlock=e?null:[])}function closeBlock(){blockStack.pop(),currentBlock=blockStack[blockStack.length-1]||null}var isBlockTreeEnabled=1;function setBlockTracking(e){isBlockTreeEnabled+=e}function setupBlock(e){return e.dynamicChildren=isBlockTreeEnabled>0?currentBlock||EMPTY_ARR:null,closeBlock(),isBlockTreeEnabled>0&¤tBlock&¤tBlock.push(e),e}function createElementBlock(e,t,n,r,i,a){return setupBlock(createBaseVNode(e,t,n,r,i,a,!0))}function createBlock(e,t,n,r,i){return setupBlock(createVNode(e,t,n,r,i,!0))}function isVNode(e){return!!e&&!0===e.__v_isVNode}function isSameVNodeType(e,t){return e.type===t.type&&e.key===t.key}var InternalObjectKey="__vInternal",normalizeKey=function(e){var t=e.key;return null!=t?t:null},normalizeRef=function(e){var t=e.ref,n=e.ref_key,r=e.ref_for;return null!=t?isString$2(t)||isRef(t)||isFunction$4(t)?{i:currentRenderingInstance,r:t,k:n,f:!!r}:t:null};function createBaseVNode(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e===Fragment?0:1,o=arguments.length>6&&void 0!==arguments[6]&&arguments[6],s=arguments.length>7&&void 0!==arguments[7]&&arguments[7],l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&normalizeKey(t),ref:t&&normalizeRef(t),scopeId:currentScopeId,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:currentRenderingInstance};return s?(normalizeChildren(l,n),128&a&&e.normalize(l)):n&&(l.shapeFlag|=isString$2(n)?8:16),isBlockTreeEnabled>0&&!o&¤tBlock&&(l.patchFlag>0||6&a)&&32!==l.patchFlag&¤tBlock.push(l),l}var createVNode=exports("j",_createVNode);function _createVNode(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(e&&e!==NULL_DYNAMIC_COMPONENT||(e=Comment),isVNode(e)){var o=cloneVNode(e,t,!0);return n&&normalizeChildren(o,n),isBlockTreeEnabled>0&&!a&¤tBlock&&(6&o.shapeFlag?currentBlock[currentBlock.indexOf(e)]=o:currentBlock.push(o)),o.patchFlag|=-2,o}if(isClassComponent(e)&&(e=e.__vccOpts),t){var s=t=guardReactiveProps(t),l=s.class,u=s.style;l&&!isString$2(l)&&(t.class=normalizeClass(l)),isObject$4(u)&&(isProxy(u)&&!isArray$8(u)&&(u=extend$3({},u)),t.style=normalizeStyle(u))}return createBaseVNode(e,t,n,r,i,isString$2(e)?1:isSuspense(e)?128:isTeleport(e)?64:isObject$4(e)?4:isFunction$4(e)?2:0,a,!0)}function guardReactiveProps(e){return e?isProxy(e)||InternalObjectKey in e?extend$3({},e):e:null}function cloneVNode(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.props,i=e.ref,a=e.patchFlag,o=e.children,s=t?mergeProps(r||{},t):r;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:s,key:s&&normalizeKey(s),ref:t&&t.ref?n&&i?isArray$8(i)?i.concat(normalizeRef(t)):[i,normalizeRef(t)]:normalizeRef(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:o,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Fragment?-1===a?16:16|a:a,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&cloneVNode(e.ssContent),ssFallback:e.ssFallback&&cloneVNode(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce}}function createTextVNode(){return createVNode(Text,null,arguments.length>0&&void 0!==arguments[0]?arguments[0]:" ",arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}function createCommentVNode(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?(openBlock(),createBlock(Comment,null,e)):createVNode(Comment,null,e)}function normalizeVNode(e){return null==e||"boolean"==typeof e?createVNode(Comment):isArray$8(e)?createVNode(Fragment,null,e.slice()):"object"===_typeof2(e)?cloneIfMounted(e):createVNode(Text,null,String(e))}function cloneIfMounted(e){return null===e.el&&-1!==e.patchFlag||e.memo?e:cloneVNode(e)}function normalizeChildren(e,t){var n=0,r=e.shapeFlag;if(null==t)t=null;else if(isArray$8(t))n=16;else if("object"===_typeof2(t)){if(65&r){var i=t.default;return void(i&&(i._c&&(i._d=!1),normalizeChildren(e,i()),i._c&&(i._d=!0)))}n=32;var a=t._;a||InternalObjectKey in t?3===a&¤tRenderingInstance&&(1===currentRenderingInstance.slots._?t._=1:(t._=2,e.patchFlag|=1024)):t._ctx=currentRenderingInstance}else isFunction$4(t)?(t={default:t,_ctx:currentRenderingInstance},n=32):(t=String(t),64&r?(n=16,t=[createTextVNode(t)]):n=8);e.children=t,e.shapeFlag|=n}function mergeProps(){for(var e={},t=0;t3&&void 0!==arguments[3]?arguments[3]:null])}var emptyAppContext=createAppContext(),uid=0;function createComponentInstance(e,t,n){var r=e.type,i=(t?t.appContext:e.appContext)||emptyAppContext,a={uid:uid++,vnode:e,type:r,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,scope:new EffectScope(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:normalizePropsOptions(r,i),emitsOptions:normalizeEmitsOptions(r,i),emit:null,emitted:null,propsDefaults:EMPTY_OBJ,inheritAttrs:r.inheritAttrs,ctx:EMPTY_OBJ,data:EMPTY_OBJ,props:EMPTY_OBJ,attrs:EMPTY_OBJ,slots:EMPTY_OBJ,refs:EMPTY_OBJ,setupState:EMPTY_OBJ,setupContext:null,suspense:n,suspenseId:n?n.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,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=emit.bind(null,a),e.ce&&e.ce(a),a}var currentInstance=null,getCurrentInstance=function(){return currentInstance||currentRenderingInstance},setCurrentInstance=function(e){currentInstance=e,e.scope.on()},unsetCurrentInstance=function(){currentInstance&¤tInstance.scope.off(),currentInstance=null};function isStatefulComponent(e){return 4&e.vnode.shapeFlag}var isInSSRComponentSetup=!1,compile$1;function setupComponent(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];isInSSRComponentSetup=t;var n=e.vnode,r=n.props,i=n.children,a=isStatefulComponent(e);initProps(e,r,a,t),initSlots(e,i);var o=a?setupStatefulComponent(e,t):void 0;return isInSSRComponentSetup=!1,o}function setupStatefulComponent(e,t){var n=e.type;e.accessCache=Object.create(null),e.proxy=markRaw(new Proxy(e.ctx,PublicInstanceProxyHandlers));var r=n.setup;if(r){var i=e.setupContext=r.length>1?createSetupContext(e):null;setCurrentInstance(e),pauseTracking();var a=callWithErrorHandling(r,e,0,[e.props,i]);if(resetTracking(),unsetCurrentInstance(),isPromise$1(a)){if(a.then(unsetCurrentInstance,unsetCurrentInstance),t)return a.then((function(n){handleSetupResult(e,n,t)})).catch((function(t){handleError(t,e,0)}));e.asyncDep=a}else handleSetupResult(e,a,t)}else finishComponentSetup(e,t)}function handleSetupResult(e,t,n){isFunction$4(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:isObject$4(t)&&(e.setupState=proxyRefs(t)),finishComponentSetup(e,n)}function finishComponentSetup(e,t,n){var r=e.type;if(!e.render){if(!t&&compile$1&&!r.render){var i=r.template||resolveMergedOptions(e).template;if(i){var a=e.appContext.config,o=a.isCustomElement,s=a.compilerOptions,l=r.delimiters,u=r.compilerOptions,c=extend$3(extend$3({isCustomElement:o,delimiters:l},s),u);r.render=compile$1(i,c)}}e.render=r.render||NOOP}setCurrentInstance(e),pauseTracking(),applyOptions(e),resetTracking(),unsetCurrentInstance()}function createAttrsProxy(e){return new Proxy(e.attrs,{get:function(t,n){return track(e,"get","$attrs"),t[n]}})}function createSetupContext(e){var t;return{get attrs(){return t||(t=createAttrsProxy(e))},slots:e.slots,emit:e.emit,expose:function(t){e.exposed=t||{}}}}function getExposeProxy(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(proxyRefs(markRaw(e.exposed)),{get:function(t,n){return n in t?t[n]:n in publicPropertiesMap?publicPropertiesMap[n](e):void 0},has:function(e,t){return t in e||t in publicPropertiesMap}}))}function getComponentName(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return isFunction$4(e)?e.displayName||e.name:e.name||t&&e.__name}function isClassComponent(e){return isFunction$4(e)&&"__vccOpts"in e}var computed=exports("s",(function(e,t){return computed$1(e,t,isInSSRComponentSetup)}));function h(e,t,n){var r=arguments.length;return 2===r?isObject$4(t)&&!isArray$8(t)?isVNode(t)?createVNode(e,null,[t]):createVNode(e,t):createVNode(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):3===r&&isVNode(n)&&(n=[n]),createVNode(e,t,n))}var ssrContextKey=Symbol(""),useSSRContext=function(){return inject(ssrContextKey)},version="3.2.47",svgNS="http://www.w3.org/2000/svg",doc$2="undefined"!=typeof document?document:null,templateContainer=doc$2&&doc$2.createElement("template"),nodeOps={insert:function(e,t,n){t.insertBefore(e,n||null)},remove:function(e){var t=e.parentNode;t&&t.removeChild(e)},createElement:function(e,t,n,r){var i=t?doc$2.createElementNS(svgNS,e):doc$2.createElement(e,n?{is:n}:void 0);return"select"===e&&r&&null!=r.multiple&&i.setAttribute("multiple",r.multiple),i},createText:function(e){return doc$2.createTextNode(e)},createComment:function(e){return doc$2.createComment(e)},setText:function(e,t){e.nodeValue=t},setElementText:function(e,t){e.textContent=t},parentNode:function(e){return e.parentNode},nextSibling:function(e){return e.nextSibling},querySelector:function(e){return doc$2.querySelector(e)},setScopeId:function(e,t){e.setAttribute(t,"")},insertStaticContent:function(e,t,n,r,i,a){var o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==a&&(i=i.nextSibling););else{templateContainer.innerHTML=r?"".concat(e,""):e;var s=templateContainer.content;if(r){for(var l=s.firstChild;l.firstChild;)s.appendChild(l.firstChild);s.removeChild(l)}t.insertBefore(s,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}};function patchClass(e,t,n){var r=e._vtc;r&&(t=(t?[t].concat(_toConsumableArray2(r)):_toConsumableArray2(r)).join(" ")),null==t?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function patchStyle(e,t,n){var r=e.style,i=isString$2(n);if(n&&!i){if(t&&!isString$2(t))for(var a in t)null==n[a]&&setStyle(r,a,"");for(var o in n)setStyle(r,o,n[o])}else{var s=r.display;i?t!==n&&(r.cssText=n):t&&e.removeAttribute("style"),"_vod"in e&&(r.display=s)}}var importantRE=/\s*!important$/;function setStyle(e,t,n){if(isArray$8(n))n.forEach((function(n){return setStyle(e,t,n)}));else if(null==n&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{var r=autoPrefix(e,t);importantRE.test(n)?e.setProperty(hyphenate(r),n.replace(importantRE,""),"important"):e[r]=n}}var prefixes=["Webkit","Moz","ms"],prefixCache={};function autoPrefix(e,t){var n=prefixCache[t];if(n)return n;var r=camelize$1(t);if("filter"!==r&&r in e)return prefixCache[t]=r;r=capitalize(r);for(var i=0;i4&&void 0!==arguments[4]?arguments[4]:null,a=e._vei||(e._vei={}),o=a[t];if(r&&o)o.value=r;else{var s=_slicedToArray(parseName(t),2),l=s[0],u=s[1];if(r)addEventListener(e,l,a[t]=createInvoker(r,i),u);else o&&(removeEventListener(e,l,o,u),a[t]=void 0)}}var optionsModifierRE=/(?:Once|Passive|Capture)$/;function parseName(e){var t,n;if(optionsModifierRE.test(e))for(t={};n=e.match(optionsModifierRE);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0;return[":"===e[2]?e.slice(3):hyphenate(e.slice(2)),t]}var cachedNow=0,p=Promise.resolve(),getNow=function(){return cachedNow||(p.then((function(){return cachedNow=0})),cachedNow=Date.now())};function createInvoker(e,t){var n=function e(n){if(n._vts){if(n._vts<=e.attached)return}else n._vts=Date.now();callWithAsyncErrorHandling(patchStopImmediatePropagation(n,e.value),t,5,[n])};return n.value=e,n.attached=getNow(),n}function patchStopImmediatePropagation(e,t){if(isArray$8(t)){var n=e.stopImmediatePropagation;return e.stopImmediatePropagation=function(){n.call(e),e._stopped=!0},t.map((function(e){return function(t){return!t._stopped&&e&&e(t)}}))}return t}var nativeOnRE=/^on[a-z]/,patchProp=function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0,s=arguments.length>7?arguments[7]:void 0,l=arguments.length>8?arguments[8]:void 0;"class"===t?patchClass(e,r,i):"style"===t?patchStyle(e,n,r):isOn(t)?isModelListener(t)||patchEvent(e,t,n,r,o):("."===t[0]?(t=t.slice(1),1):"^"===t[0]?(t=t.slice(1),0):shouldSetAsProp(e,t,r,i))?patchDOMProp(e,t,r,a,o,s,l):("true-value"===t?e._trueValue=r:"false-value"===t&&(e._falseValue=r),patchAttr(e,t,r,i))};function shouldSetAsProp(e,t,n,r){return r?"innerHTML"===t||"textContent"===t||!!(t in e&&nativeOnRE.test(t)&&isFunction$4(n)):"spellcheck"!==t&&"draggable"!==t&&"translate"!==t&&("form"!==t&&(("list"!==t||"INPUT"!==e.tagName)&&(("type"!==t||"TEXTAREA"!==e.tagName)&&((!nativeOnRE.test(t)||!isString$2(n))&&t in e))))}var TRANSITION="transition",ANIMATION="animation",Transition=exports("aI",(function(e,t){var n=t.slots;return h(BaseTransition,resolveTransitionProps(e),n)}));Transition.displayName="Transition";var DOMTransitionPropsValidators={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},TransitionPropsValidators=Transition.props=extend$3({},BaseTransition.props,DOMTransitionPropsValidators),callHook=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];isArray$8(e)?e.forEach((function(e){return e.apply(void 0,_toConsumableArray2(t))})):e&&e.apply(void 0,_toConsumableArray2(t))},hasExplicitCallback=function(e){return!!e&&(isArray$8(e)?e.some((function(e){return e.length>1})):e.length>1)};function resolveTransitionProps(e){var t={};for(var n in e)n in DOMTransitionPropsValidators||(t[n]=e[n]);if(!1===e.css)return t;var r=e.name,i=void 0===r?"v":r,a=e.type,o=e.duration,s=e.enterFromClass,l=void 0===s?"".concat(i,"-enter-from"):s,u=e.enterActiveClass,c=void 0===u?"".concat(i,"-enter-active"):u,h=e.enterToClass,d=void 0===h?"".concat(i,"-enter-to"):h,f=e.appearFromClass,p=void 0===f?l:f,v=e.appearActiveClass,m=void 0===v?c:v,g=e.appearToClass,y=void 0===g?d:g,b=e.leaveFromClass,A=void 0===b?"".concat(i,"-leave-from"):b,S=e.leaveActiveClass,x=void 0===S?"".concat(i,"-leave-active"):S,w=e.leaveToClass,_=void 0===w?"".concat(i,"-leave-to"):w,E=normalizeDuration(o),k=E&&E[0],C=E&&E[1],M=t.onBeforeEnter,P=t.onEnter,I=t.onEnterCancelled,T=t.onLeave,B=t.onLeaveCancelled,R=t.onBeforeAppear,L=void 0===R?M:R,N=t.onAppear,F=void 0===N?P:N,D=t.onAppearCancelled,O=void 0===D?I:D,V=function(e,t,n){removeTransitionClass(e,t?y:d),removeTransitionClass(e,t?m:c),n&&n()},z=function(e,t){e._isLeaving=!1,removeTransitionClass(e,A),removeTransitionClass(e,_),removeTransitionClass(e,x),t&&t()},G=function(e){return function(t,n){var r=e?F:P,i=function(){return V(t,e,n)};callHook(r,[t,i]),nextFrame((function(){removeTransitionClass(t,e?p:l),addTransitionClass(t,e?y:d),hasExplicitCallback(r)||whenTransitionEnds(t,a,k,i)}))}};return extend$3(t,{onBeforeEnter:function(e){callHook(M,[e]),addTransitionClass(e,l),addTransitionClass(e,c)},onBeforeAppear:function(e){callHook(L,[e]),addTransitionClass(e,p),addTransitionClass(e,m)},onEnter:G(!1),onAppear:G(!0),onLeave:function(e,t){e._isLeaving=!0;var n=function(){return z(e,t)};addTransitionClass(e,A),forceReflow(),addTransitionClass(e,x),nextFrame((function(){e._isLeaving&&(removeTransitionClass(e,A),addTransitionClass(e,_),hasExplicitCallback(T)||whenTransitionEnds(e,a,C,n))})),callHook(T,[e,n])},onEnterCancelled:function(e){V(e,!1),callHook(I,[e])},onAppearCancelled:function(e){V(e,!0),callHook(O,[e])},onLeaveCancelled:function(e){z(e),callHook(B,[e])}})}function normalizeDuration(e){if(null==e)return null;if(isObject$4(e))return[NumberOf(e.enter),NumberOf(e.leave)];var t=NumberOf(e);return[t,t]}function NumberOf(e){return toNumber$1(e)}function addTransitionClass(e,t){t.split(/\s+/).forEach((function(t){return t&&e.classList.add(t)})),(e._vtc||(e._vtc=new Set)).add(t)}function removeTransitionClass(e,t){t.split(/\s+/).forEach((function(t){return t&&e.classList.remove(t)}));var n=e._vtc;n&&(n.delete(t),n.size||(e._vtc=void 0))}function nextFrame(e){requestAnimationFrame((function(){requestAnimationFrame(e)}))}var endId=0;function whenTransitionEnds(e,t,n,r){var i=e._endId=++endId,a=function(){i===e._endId&&r()};if(n)return setTimeout(a,n);var o=getTransitionInfo(e,t),s=o.type,l=o.timeout,u=o.propCount;if(!s)return r();var c=s+"end",h=0,d=function(){e.removeEventListener(c,f),a()},f=function(t){t.target===e&&++h>=u&&d()};setTimeout((function(){h0&&(c=TRANSITION,h=o,d=a.length):t===ANIMATION?u>0&&(c=ANIMATION,h=u,d=l.length):d=(c=(h=Math.max(o,u))>0?o>u?TRANSITION:ANIMATION:null)?c===TRANSITION?a.length:l.length:0,{type:c,timeout:h,propCount:d,hasTransform:c===TRANSITION&&/\b(transform|all)(,|$)/.test(r("".concat(TRANSITION,"Property")).toString())}}function getTimeout(e,t){for(;e.length2&&void 0!==arguments[2]?arguments[2]:"/",i={},a="",o="",s=t.indexOf("#"),l=t.indexOf("?");return s=0&&(l=-1),l>-1&&(n=t.slice(0,l),i=e(a=t.slice(l+1,s>-1?s:t.length))),s>-1&&(n=n||t.slice(0,s),o=t.slice(s,t.length)),{fullPath:(n=resolveRelativePath(null!=n?n:t,r))+(a&&"?")+a+o,path:n,query:i,hash:o}}function stringifyURL(e,t){var n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function stripBase(e,t){return t&&e.toLowerCase().startsWith(t.toLowerCase())?e.slice(t.length)||"/":e}function isSameRouteLocation(e,t,n){var r=t.matched.length-1,i=n.matched.length-1;return r>-1&&r===i&&isSameRouteRecord(t.matched[r],n.matched[i])&&isSameRouteLocationParams(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function isSameRouteRecord(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function isSameRouteLocationParams(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!isSameRouteLocationParamsValue(e[n],t[n]))return!1;return!0}function isSameRouteLocationParamsValue(e,t){return isArray$7(e)?isEquivalentArray(e,t):isArray$7(t)?isEquivalentArray(t,e):e===t}function isEquivalentArray(e,t){return isArray$7(t)?e.length===t.length&&e.every((function(e,n){return e===t[n]})):1===e.length&&e[0]===t}function resolveRelativePath(e,t){if(e.startsWith("/"))return e;if(!e)return t;var n,r,i=t.split("/"),a=e.split("/"),o=i.length-1;for(n=0;n1&&o--}return i.slice(0,o).join("/")+"/"+a.slice(n-(n===a.length?1:0)).join("/")}function normalizeBase(e){if(!e)if(isBrowser){var t=document.querySelector("base");e=(e=t&&t.getAttribute("href")||"/").replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return"/"!==e[0]&&"#"!==e[0]&&(e="/"+e),removeTrailingSlash(e)}!function(e){e.pop="pop",e.push="push"}(NavigationType||(NavigationType={})),function(e){e.back="back",e.forward="forward",e.unknown=""}(NavigationDirection||(NavigationDirection={}));var BEFORE_HASH_RE=/^[^#]+#/;function createHref(e,t){return e.replace(BEFORE_HASH_RE,"#")+t}function getElementPosition(e,t){var n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}var computeScrollPosition=function(){return{left:window.pageXOffset,top:window.pageYOffset}};function scrollToPosition(e){var t;if("el"in e){var n=e.el,r="string"==typeof n&&n.startsWith("#"),i="string"==typeof n?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!i)return;t=getElementPosition(i,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(null!=t.left?t.left:window.pageXOffset,null!=t.top?t.top:window.pageYOffset)}function getScrollKey(e,t){return(history.state?history.state.position-t:-1)+e}var scrollPositions=new Map;function saveScrollPosition(e,t){scrollPositions.set(e,t)}function getSavedScrollPosition(e){var t=scrollPositions.get(e);return scrollPositions.delete(e),t}var createBaseLocation=function(){return location.protocol+"//"+location.host};function createCurrentLocation(e,t){var n=t.pathname,r=t.search,i=t.hash,a=e.indexOf("#");if(a>-1){var o=i.includes(e.slice(a))?e.slice(a).length:1,s=i.slice(o);return"/"!==s[0]&&(s="/"+s),stripBase(s,"")}return stripBase(n,e)+r+i}function useHistoryListeners(e,t,n,r){var i=[],a=[],o=null,s=function(a){var s=a.state,l=createCurrentLocation(e,location),u=n.value,c=t.value,h=0;if(s){if(n.value=l,t.value=s,o&&o===u)return void(o=null);h=c?s.position-c.position:0}else r(l);i.forEach((function(e){e(n.value,u,{delta:h,type:NavigationType.pop,direction:h?h>0?NavigationDirection.forward:NavigationDirection.back:NavigationDirection.unknown})}))};function l(){var e=window.history;e.state&&e.replaceState(assign$2({},e.state,{scroll:computeScrollPosition()}),"")}return window.addEventListener("popstate",s),window.addEventListener("beforeunload",l),{pauseListeners:function(){o=n.value},listen:function(e){i.push(e);var t=function(){var t=i.indexOf(e);t>-1&&i.splice(t,1)};return a.push(t),t},destroy:function(){var e,t=_createForOfIteratorHelper(a);try{for(t.s();!(e=t.n()).done;){(0,e.value)()}}catch(n){t.e(n)}finally{t.f()}a=[],window.removeEventListener("popstate",s),window.removeEventListener("beforeunload",l)}}}function buildState(e,t,n){var r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return{back:e,current:t,forward:n,replaced:arguments.length>3&&void 0!==arguments[3]&&arguments[3],position:window.history.length,scroll:r?computeScrollPosition():null}}function useHistoryStateNavigation(e){var t=window,n=t.history,r=t.location,i={value:createCurrentLocation(e,r)},a={value:n.state};function o(t,i,o){var s=e.indexOf("#"),l=s>-1?(r.host&&document.querySelector("base")?e:e.slice(s))+t:createBaseLocation()+e+t;try{n[o?"replaceState":"pushState"](i,"",l),a.value=i}catch(u){console.error(u),r[o?"replace":"assign"](l)}}return a.value||o(i.value,{back:null,current:i.value,forward:null,position:n.length-1,replaced:!0,scroll:null},!0),{location:i,state:a,push:function(e,t){var r=assign$2({},a.value,n.state,{forward:e,scroll:computeScrollPosition()});o(r.current,r,!0),o(e,assign$2({},buildState(i.value,e,null),{position:r.position+1},t),!1),i.value=e},replace:function(e,t){o(e,assign$2({},n.state,buildState(a.value.back,e,a.value.forward,!0),t,{position:a.value.position}),!0),i.value=e}}}function createWebHistory(e){var t=useHistoryStateNavigation(e=normalizeBase(e)),n=useHistoryListeners(e,t.state,t.location,t.replace);var r=assign$2({location:"",base:e,go:function(e){!(arguments.length>1&&void 0!==arguments[1])||arguments[1]||n.pauseListeners(),history.go(e)},createHref:createHref.bind(null,e)},t,n);return Object.defineProperty(r,"location",{enumerable:!0,get:function(){return t.location.value}}),Object.defineProperty(r,"state",{enumerable:!0,get:function(){return t.state.value}}),r}function createWebHashHistory(e){return(e=location.host?e||location.pathname+location.search:"").includes("#")||(e+="#"),createWebHistory(e)}function isRouteLocation(e){return"string"==typeof e||e&&"object"===_typeof2(e)}function isRouteName(e){return"string"==typeof e||"symbol"===_typeof2(e)}var START_LOCATION_NORMALIZED={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},NavigationFailureSymbol=Symbol(""),NavigationFailureType;function createRouterError(e,t){return assign$2(new Error,_defineProperty2({type:e},NavigationFailureSymbol,!0),t)}function isNavigationFailure(e,t){return e instanceof Error&&NavigationFailureSymbol in e&&(null==t||!!(e.type&t))}!function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"}(NavigationFailureType||(NavigationFailureType={}));var BASE_PARAM_PATTERN="[^/]+?",BASE_PATH_PARSER_OPTIONS={sensitive:!1,strict:!1,start:!0,end:!0},REGEX_CHARS_RE=/[.+*?^${}()[\]/\\]/g;function tokensToParser(e,t){var n,r=assign$2({},BASE_PATH_PARSER_OPTIONS,t),i=[],a=r.start?"^":"",o=[],s=_createForOfIteratorHelper(e);try{for(s.s();!(n=s.n()).done;){var l=n.value,u=l.length?[]:[90];r.strict&&!l.length&&(a+="/");for(var c=0;ct.length?1===t.length&&80===t[0]?1:-1:0}function comparePathParserScore(e,t){for(var n=0,r=e.score,i=t.score;n0&&t[t.length-1]<0}var ROOT_TOKEN={type:0,value:""},VALID_PARAM_RE=/[a-zA-Z0-9_]/;function tokenizePath(e){if(!e)return[[]];if("/"===e)return[[ROOT_TOKEN]];if(!e.startsWith("/"))throw new Error('Invalid path "'.concat(e,'"'));function t(e){throw new Error("ERR (".concat(r,')/"').concat(u,'": ').concat(e))}var n,r=0,i=r,a=[];function o(){n&&a.push(n),n=[]}var s,l=0,u="",c="";function h(){u&&(0===r?n.push({type:0,value:u}):1===r||2===r||3===r?(n.length>1&&("*"===s||"+"===s)&&t("A repeatable param (".concat(u,") must be alone in its segment. eg: '/:ids+.")),n.push({type:1,value:u,regexp:c,repeatable:"*"===s||"+"===s,optional:"*"===s||"?"===s})):t("Invalid state to consume buffer"),u="")}function d(){u+=s}for(;l-1&&(n.splice(i,1),e.record.name&&r.delete(e.record.name),e.children.forEach(a),e.alias.forEach(a))}}function o(e){for(var t=0;t=0&&(e.record.path!==n[t].record.path||!isRecordChildOf(e,n[t]));)t++;n.splice(t,0,e),e.record.name&&!isAliasRecord(e)&&r.set(e.record.name,e)}return t=mergeOptions({strict:!1,end:!0,sensitive:!1},t),e.forEach((function(e){return i(e)})),{addRoute:i,resolve:function(e,t){var i,a,o,s={};if("name"in e&&e.name){if(!(i=r.get(e.name)))throw createRouterError(1,{location:e});o=i.record.name,s=assign$2(paramsFromLocation(t.params,i.keys.filter((function(e){return!e.optional})).map((function(e){return e.name}))),e.params&¶msFromLocation(e.params,i.keys.map((function(e){return e.name})))),a=i.stringify(s)}else if("path"in e)a=e.path,(i=n.find((function(e){return e.re.test(a)})))&&(s=i.parse(a),o=i.record.name);else{if(!(i=t.name?r.get(t.name):n.find((function(e){return e.re.test(t.path)}))))throw createRouterError(1,{location:e,currentLocation:t});o=i.record.name,s=assign$2({},t.params,e.params),a=i.stringify(s)}for(var l=[],u=i;u;)l.unshift(u.record),u=u.parent;return{name:o,path:a,params:s,matched:l,meta:mergeMetaFields(l)}},removeRoute:a,getRoutes:function(){return n},getRecordMatcher:function(e){return r.get(e)}}}function paramsFromLocation(e,t){var n,r={},i=_createForOfIteratorHelper(t);try{for(i.s();!(n=i.n()).done;){var a=n.value;a in e&&(r[a]=e[a])}}catch(o){i.e(o)}finally{i.f()}return r}function normalizeRouteRecord(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:normalizeRecordProps(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}}}function normalizeRecordProps(e){var t={},n=e.props||!1;if("component"in e)t.default=n;else for(var r in e.components)t[r]="boolean"==typeof n?n:n[r];return t}function isAliasRecord(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function mergeMetaFields(e){return e.reduce((function(e,t){return assign$2(e,t.meta)}),{})}function mergeOptions(e,t){var n={};for(var r in e)n[r]=r in t?t[r]:e[r];return n}function isRecordChildOf(e,t){return t.children.some((function(t){return t===e||isRecordChildOf(e,t)}))}var HASH_RE=/#/g,AMPERSAND_RE=/&/g,SLASH_RE=/\//g,EQUAL_RE=/=/g,IM_RE=/\?/g,PLUS_RE=/\+/g,ENC_BRACKET_OPEN_RE=/%5B/g,ENC_BRACKET_CLOSE_RE=/%5D/g,ENC_CARET_RE=/%5E/g,ENC_BACKTICK_RE=/%60/g,ENC_CURLY_OPEN_RE=/%7B/g,ENC_PIPE_RE=/%7C/g,ENC_CURLY_CLOSE_RE=/%7D/g,ENC_SPACE_RE=/%20/g;function commonEncode(e){return encodeURI(""+e).replace(ENC_PIPE_RE,"|").replace(ENC_BRACKET_OPEN_RE,"[").replace(ENC_BRACKET_CLOSE_RE,"]")}function encodeHash(e){return commonEncode(e).replace(ENC_CURLY_OPEN_RE,"{").replace(ENC_CURLY_CLOSE_RE,"}").replace(ENC_CARET_RE,"^")}function encodeQueryValue(e){return commonEncode(e).replace(PLUS_RE,"%2B").replace(ENC_SPACE_RE,"+").replace(HASH_RE,"%23").replace(AMPERSAND_RE,"%26").replace(ENC_BACKTICK_RE,"`").replace(ENC_CURLY_OPEN_RE,"{").replace(ENC_CURLY_CLOSE_RE,"}").replace(ENC_CARET_RE,"^")}function encodeQueryKey(e){return encodeQueryValue(e).replace(EQUAL_RE,"%3D")}function encodePath(e){return commonEncode(e).replace(HASH_RE,"%23").replace(IM_RE,"%3F")}function encodeParam(e){return null==e?"":encodePath(e).replace(SLASH_RE,"%2F")}function decode$5(e){try{return decodeURIComponent(""+e)}catch(t){}return""+e}function parseQuery(e){var t={};if(""===e||"?"===e)return t;for(var n=("?"===e[0]?e.slice(1):e).split("&"),r=0;r-1&&e.splice(n,1)}},list:function(){return e},reset:function(){e=[]}}}function guardToPromiseFn(e,t,n,r,i){var a=r&&(r.enterCallbacks[i]=r.enterCallbacks[i]||[]);return function(){return new Promise((function(o,s){var l=function(e){!1===e?s(createRouterError(4,{from:n,to:t})):e instanceof Error?s(e):isRouteLocation(e)?s(createRouterError(2,{from:t,to:e})):(a&&r.enterCallbacks[i]===a&&"function"==typeof e&&a.push(e),o())},u=e.call(r&&r.instances[i],t,n,l),c=Promise.resolve(u);e.length<3&&(c=c.then(l)),c.catch((function(e){return s(e)}))}))}}function extractComponentsGuards(e,t,n,r){var i,a=[],o=_createForOfIteratorHelper(e);try{var s=function(){var e=i.value,o=function(i){var o=e.components[i];if("beforeRouteEnter"!==t&&!e.instances[i])return"continue";if(isRouteComponent(o)){var s=(o.__vccOpts||o)[t];s&&a.push(guardToPromiseFn(s,n,r,e,i))}else{var l=o();a.push((function(){return l.then((function(a){if(!a)return Promise.reject(new Error("Couldn't resolve component \"".concat(i,'" at "').concat(e.path,'"')));var o=isESModule(a)?a.default:a;e.components[i]=o;var s=(o.__vccOpts||o)[t];return s&&guardToPromiseFn(s,n,r,e,i)()}))}))}};for(var s in e.components)o(s)};for(o.s();!(i=o.n()).done;)s()}catch(l){o.e(l)}finally{o.f()}return a}function isRouteComponent(e){return"object"===_typeof2(e)||"displayName"in e||"props"in e||"__vccOpts"in e}function useLink(e){var t=inject(routerKey),n=inject(routeLocationKey),r=computed((function(){return t.resolve(unref(e.to))})),i=computed((function(){var e=r.value.matched,t=e.length,i=e[t-1],a=n.matched;if(!i||!a.length)return-1;var o=a.findIndex(isSameRouteRecord.bind(null,i));if(o>-1)return o;var s=getOriginalPath(e[t-2]);return t>1&&getOriginalPath(i)===s&&a[a.length-1].path!==s?a.findIndex(isSameRouteRecord.bind(null,e[t-2])):o})),a=computed((function(){return i.value>-1&&includesParams(n.params,r.value.params)})),o=computed((function(){return i.value>-1&&i.value===n.matched.length-1&&isSameRouteLocationParams(n.params,r.value.params)}));return{route:r,href:computed((function(){return r.value.href})),isActive:a,isExactActive:o,navigate:function(){return guardEvent(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})?t[unref(e.replace)?"replace":"push"](unref(e.to)).catch(noop$2):Promise.resolve()}}}var RouterLinkImpl=defineComponent({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:useLink,setup:function(e,t){var n=t.slots,r=reactive(useLink(e)),i=inject(routerKey).options,a=computed((function(){var t;return _defineProperty2(t={},getLinkClass(e.activeClass,i.linkActiveClass,"router-link-active"),r.isActive),_defineProperty2(t,getLinkClass(e.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active"),r.isExactActive),t}));return function(){var t=n.default&&n.default(r);return e.custom?t:h("a",{"aria-current":r.isExactActive?e.ariaCurrentValue:null,href:r.href,onClick:r.navigate,class:a.value},t)}}}),RouterLink=RouterLinkImpl;function guardEvent(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey||e.defaultPrevented||void 0!==e.button&&0!==e.button)){if(e.currentTarget&&e.currentTarget.getAttribute){var t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function includesParams(e,t){var n=function(){var n=t[r],i=e[r];if("string"==typeof n){if(n!==i)return{v:!1}}else if(!isArray$7(i)||i.length!==n.length||n.some((function(e,t){return e!==i[t]})))return{v:!1}};for(var r in t){var i=n();if("object"===_typeof2(i))return i.v}return!0}function getOriginalPath(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}var getLinkClass=function(e,t,n){return null!=e?e:null!=t?t:n},RouterViewImpl=defineComponent({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup:function(e,t){var n=t.attrs,r=t.slots,i=inject(routerViewLocationKey),a=computed((function(){return e.route||i.value})),o=inject(viewDepthKey,0),s=computed((function(){for(var e,t=unref(o),n=a.value.matched;(e=n[t])&&!e.components;)t++;return t})),l=computed((function(){return a.value.matched[s.value]}));provide(viewDepthKey,computed((function(){return s.value+1}))),provide(matchedRouteKey,l),provide(routerViewLocationKey,a);var u=ref();return watch((function(){return[u.value,l.value,e.name]}),(function(e,t){var n=_slicedToArray(e,3),r=n[0],i=n[1],a=n[2],o=_slicedToArray(t,3),s=o[0],l=o[1];o[2];i&&(i.instances[a]=r,l&&l!==i&&r&&r===s&&(i.leaveGuards.size||(i.leaveGuards=l.leaveGuards),i.updateGuards.size||(i.updateGuards=l.updateGuards))),!r||!i||l&&isSameRouteRecord(i,l)&&s||(i.enterCallbacks[a]||[]).forEach((function(e){return e(r)}))}),{flush:"post"}),function(){var t=a.value,i=e.name,o=l.value,s=o&&o.components[i];if(!s)return normalizeSlot(r.default,{Component:s,route:t});var c=o.props[i],d=c?!0===c?t.params:"function"==typeof c?c(t):c:null,f=h(s,assign$2({},d,n,{onVnodeUnmounted:function(e){e.component.isUnmounted&&(o.instances[i]=null)},ref:u}));return normalizeSlot(r.default,{Component:f,route:t})||f}}});function normalizeSlot(e,t){if(!e)return null;var n=e(t);return 1===n.length?n[0]:n}var RouterView=exports("R",RouterViewImpl);function createRouter(e){var t=createRouterMatcher(e.routes,e),n=e.parseQuery||parseQuery,r=e.stringifyQuery||stringifyQuery,i=e.history,a=useCallbacks(),o=useCallbacks(),s=useCallbacks(),l=shallowRef(START_LOCATION_NORMALIZED),u=START_LOCATION_NORMALIZED;isBrowser&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");var c,h=applyToParams.bind(null,(function(e){return""+e})),d=applyToParams.bind(null,encodeParam),f=applyToParams.bind(null,decode$5);function p(e,a){if(a=assign$2({},a||l.value),"string"==typeof e){var o=parseURL(n,e,a.path),s=t.resolve({path:o.path},a),u=i.createHref(o.fullPath);return assign$2(o,s,{params:f(s.params),hash:decode$5(o.hash),redirectedFrom:void 0,href:u})}var c;if("path"in e)c=assign$2({},e,{path:parseURL(n,e.path,a.path).path});else{var p=assign$2({},e.params);for(var v in p)null==p[v]&&delete p[v];c=assign$2({},e,{params:d(e.params)}),a.params=d(a.params)}var m=t.resolve(c,a),g=e.hash||"";m.params=h(f(m.params));var y=stringifyURL(r,assign$2({},e,{hash:encodeHash(g),path:m.path})),b=i.createHref(y);return assign$2({fullPath:y,hash:g,query:r===stringifyQuery?normalizeQuery(e.query):e.query||{}},m,{redirectedFrom:void 0,href:b})}function v(e){return"string"==typeof e?parseURL(n,e,l.value.path):assign$2({},e)}function m(e,t){if(u!==e)return createRouterError(8,{from:t,to:e})}function g(e){return b(e)}function y(e){var t=e.matched[e.matched.length-1];if(t&&t.redirect){var n=t.redirect,r="function"==typeof n?n(e):n;return"string"==typeof r&&((r=r.includes("?")||r.includes("#")?r=v(r):{path:r}).params={}),assign$2({query:e.query,hash:e.hash,params:"path"in r?{}:e.params},r)}}function b(e,t){var n=u=p(e),i=l.value,a=e.state,o=e.force,s=!0===e.replace,c=y(n);if(c)return b(assign$2(v(c),{state:"object"===_typeof2(c)?assign$2({},a,c.state):a,force:o,replace:s}),t||n);var h,d=n;return d.redirectedFrom=t,!o&&isSameRouteLocation(r,i,n)&&(h=createRouterError(16,{to:d,from:i}),P(i,i,!0,!1)),(h?Promise.resolve(h):S(d,i)).catch((function(e){return isNavigationFailure(e)?isNavigationFailure(e,2)?e:M(e):C(e,d,i)})).then((function(e){if(e){if(isNavigationFailure(e,2))return b(assign$2({replace:s},v(e.to),{state:"object"===_typeof2(e.to)?assign$2({},a,e.to.state):a,force:o}),t||d)}else e=w(d,i,!0,s,a);return x(d,i,e),e}))}function A(e,t){var n=m(e,t);return n?Promise.reject(n):Promise.resolve()}function S(e,t){var n,r=_slicedToArray(extractChangingRecords(e,t),3),i=r[0],s=r[1],l=r[2];n=extractComponentsGuards(i.reverse(),"beforeRouteLeave",e,t);var u,c=_createForOfIteratorHelper(i);try{for(c.s();!(u=c.n()).done;){u.value.leaveGuards.forEach((function(r){n.push(guardToPromiseFn(r,e,t))}))}}catch(d){c.e(d)}finally{c.f()}var h=A.bind(null,e,t);return n.push(h),runGuardQueue(n).then((function(){n=[];var r,i=_createForOfIteratorHelper(a.list());try{for(i.s();!(r=i.n()).done;){var o=r.value;n.push(guardToPromiseFn(o,e,t))}}catch(d){i.e(d)}finally{i.f()}return n.push(h),runGuardQueue(n)})).then((function(){n=extractComponentsGuards(s,"beforeRouteUpdate",e,t);var r,i=_createForOfIteratorHelper(s);try{for(i.s();!(r=i.n()).done;){r.value.updateGuards.forEach((function(r){n.push(guardToPromiseFn(r,e,t))}))}}catch(d){i.e(d)}finally{i.f()}return n.push(h),runGuardQueue(n)})).then((function(){n=[];var r,i=_createForOfIteratorHelper(e.matched);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(a.beforeEnter&&!t.matched.includes(a))if(isArray$7(a.beforeEnter)){var o,s=_createForOfIteratorHelper(a.beforeEnter);try{for(s.s();!(o=s.n()).done;){var l=o.value;n.push(guardToPromiseFn(l,e,t))}}catch(d){s.e(d)}finally{s.f()}}else n.push(guardToPromiseFn(a.beforeEnter,e,t))}}catch(d){i.e(d)}finally{i.f()}return n.push(h),runGuardQueue(n)})).then((function(){return e.matched.forEach((function(e){return e.enterCallbacks={}})),(n=extractComponentsGuards(l,"beforeRouteEnter",e,t)).push(h),runGuardQueue(n)})).then((function(){n=[];var r,i=_createForOfIteratorHelper(o.list());try{for(i.s();!(r=i.n()).done;){var a=r.value;n.push(guardToPromiseFn(a,e,t))}}catch(d){i.e(d)}finally{i.f()}return n.push(h),runGuardQueue(n)})).catch((function(e){return isNavigationFailure(e,8)?e:Promise.reject(e)}))}function x(e,t,n){var r,i=_createForOfIteratorHelper(s.list());try{for(i.s();!(r=i.n()).done;){(0,r.value)(e,t,n)}}catch(a){i.e(a)}finally{i.f()}}function w(e,t,n,r,a){var o=m(e,t);if(o)return o;var s=t===START_LOCATION_NORMALIZED,u=isBrowser?history.state:{};n&&(r||s?i.replace(e.fullPath,assign$2({scroll:s&&u&&u.scroll},a)):i.push(e.fullPath,a)),l.value=e,P(e,t,n,s),M()}var _,E=useCallbacks(),k=useCallbacks();function C(e,t,n){M(e);var r=k.list();return r.length?r.forEach((function(r){return r(e,t,n)})):console.error(e),Promise.reject(e)}function M(e){return _||(_=!e,c||(c=i.listen((function(e,t,n){if(R.listening){var r=p(e),a=y(r);if(a)b(assign$2(a,{replace:!0}),r).catch(noop$2);else{u=r;var o=l.value;isBrowser&&saveScrollPosition(getScrollKey(o.fullPath,n.delta),computeScrollPosition()),S(r,o).catch((function(e){return isNavigationFailure(e,12)?e:isNavigationFailure(e,2)?(b(e.to,r).then((function(e){isNavigationFailure(e,20)&&!n.delta&&n.type===NavigationType.pop&&i.go(-1,!1)})).catch(noop$2),Promise.reject()):(n.delta&&i.go(-n.delta,!1),C(e,r,o))})).then((function(e){(e=e||w(r,o,!1))&&(n.delta&&!isNavigationFailure(e,8)?i.go(-n.delta,!1):n.type===NavigationType.pop&&isNavigationFailure(e,20)&&i.go(-1,!1)),x(r,o,e)})).catch(noop$2)}}}))),E.list().forEach((function(t){var n=_slicedToArray(t,2),r=n[0],i=n[1];return e?i(e):r()})),E.reset()),e}function P(t,n,r,i){var a=e.scrollBehavior;if(!isBrowser||!a)return Promise.resolve();var o=!r&&getSavedScrollPosition(getScrollKey(t.fullPath,0))||(i||!r)&&history.state&&history.state.scroll||null;return nextTick().then((function(){return a(t,n,o)})).then((function(e){return e&&scrollToPosition(e)})).catch((function(e){return C(e,t,n)}))}var I,T=function(e){return i.go(e)},B=new Set,R={currentRoute:l,listening:!0,addRoute:function(e,n){var r,i;return isRouteName(e)?(r=t.getRecordMatcher(e),i=n):i=e,t.addRoute(i,r)},removeRoute:function(e){var n=t.getRecordMatcher(e);n&&t.removeRoute(n)},hasRoute:function(e){return!!t.getRecordMatcher(e)},getRoutes:function(){return t.getRoutes().map((function(e){return e.record}))},resolve:p,options:e,push:g,replace:function(e){return g(assign$2(v(e),{replace:!0}))},go:T,back:function(){return T(-1)},forward:function(){return T(1)},beforeEach:a.add,beforeResolve:o.add,afterEach:s.add,onError:k.add,isReady:function(){return _&&l.value!==START_LOCATION_NORMALIZED?Promise.resolve():new Promise((function(e,t){E.add([e,t])}))},install:function(e){e.component("RouterLink",RouterLink),e.component("RouterView",RouterView),e.config.globalProperties.$router=this,Object.defineProperty(e.config.globalProperties,"$route",{enumerable:!0,get:function(){return unref(l)}}),isBrowser&&!I&&l.value===START_LOCATION_NORMALIZED&&(I=!0,g(i.location).catch((function(e){})));var t={},n=function(e){t[e]=computed((function(){return l.value[e]}))};for(var r in START_LOCATION_NORMALIZED)n(r);e.provide(routerKey,this),e.provide(routeLocationKey,reactive(t)),e.provide(routerViewLocationKey,l);var a=e.unmount;B.add(e),e.unmount=function(){B.delete(e),B.size<1&&(u=START_LOCATION_NORMALIZED,c&&c(),c=null,l.value=START_LOCATION_NORMALIZED,I=!1,_=!1),a()}}};return R}function runGuardQueue(e){return e.reduce((function(e,t){return e.then((function(){return t()}))}),Promise.resolve())}function extractChangingRecords(e,t){for(var n=[],r=[],i=[],a=Math.max(t.matched.length,e.matched.length),o=function(){var a=t.matched[s];a&&(e.matched.find((function(e){return isSameRouteRecord(e,a)}))?r.push(a):n.push(a));var o=e.matched[s];o&&(t.matched.find((function(e){return isSameRouteRecord(e,o)}))||i.push(o))},s=0;s2&&void 0!==arguments[2]?arguments[2]:{};if(inBrowser$1){var r,i,a=n.target,o=void 0===a?window:a,s=n.passive,l=void 0!==s&&s,u=n.capture,c=void 0!==u&&u,h=!1,d=function(n){if(!h){var i=unref(n);i&&!r&&(i.addEventListener(e,t,{capture:c,passive:l}),r=!0)}},f=function(n){if(!h){var i=unref(n);i&&r&&(i.removeEventListener(e,t,c),r=!1)}};return onUnmounted((function(){return f(o)})),onDeactivated((function(){return f(o)})),onMountedOrActivated((function(){return d(o)})),isRef(o)&&(i=watch(o,(function(e,t){f(t),d(e)}))),function(){null==i||i(),f(o),h=!0}}}function useClickAway(e,t){if(inBrowser$1){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).eventName;useEventListener$1(void 0===n?"click":n,(function(n){(Array.isArray(e)?e:[e]).every((function(e){var t=unref(e);return t&&!t.contains(n.target)}))&&t(n)}),{target:document})}}function useWindowSize(){if(!width&&(width=ref(0),height=ref(0),inBrowser$1)){var e=function(){width.value=window.innerWidth,height.value=window.innerHeight};e(),window.addEventListener("resize",e,{passive:!0}),window.addEventListener("orientationchange",e,{passive:!0})}return{width:width,height:height}}var overflowScrollReg=/scroll|auto|overlay/i,defaultRoot=inBrowser$1?window:void 0,visibility;function isElement$1(e){return"HTML"!==e.tagName&&"BODY"!==e.tagName&&1===e.nodeType}function getScrollParent(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:defaultRoot,n=e;n&&n!==t&&isElement$1(n);){var r=window.getComputedStyle(n).overflowY;if(overflowScrollReg.test(r))return n;n=n.parentNode}return t}function useScrollParent(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:defaultRoot,n=ref();return onMounted((function(){e.value&&(n.value=getScrollParent(e.value,t))})),n}function usePageVisibility(){if(!visibility&&(visibility=ref("visible"),inBrowser$1)){var e=function(){visibility.value=document.hidden?"hidden":"visible"};e(),window.addEventListener("visibilitychange",e)}return visibility}var CUSTOM_FIELD_INJECTION_KEY=exports("cb",Symbol("van-field"));function useCustomFieldValue(e){var t=inject(CUSTOM_FIELD_INJECTION_KEY,null);t&&!t.customValue.value&&(t.customValue.value=e,watch(e,(function(){t.resetValidation(),t.validateWithTrigger("onChange")})))}function getScrollTop(e){var t="scrollTop"in e?e.scrollTop:e.pageYOffset;return Math.max(t,0)}function setScrollTop(e,t){"scrollTop"in e?e.scrollTop=t:e.scrollTo(e.scrollX,t)}function getRootScrollTop(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}function setRootScrollTop(e){setScrollTop(window,e),setScrollTop(document.body,e)}function getElementTop(e,t){if(e===window)return 0;var n=t?getScrollTop(t):getRootScrollTop();return useRect(e).top+n}var isIOS=isIOS$1();function resetScroll(){isIOS&&setRootScrollTop(getRootScrollTop())}var stopPropagation=exports("ch",(function(e){return e.stopPropagation()}));function preventDefault(e,t){("boolean"!=typeof e.cancelable||e.cancelable)&&e.preventDefault(),t&&stopPropagation(e)}function isHidden(e){var t=unref(e);if(!t)return!1;var n=window.getComputedStyle(t),r="none"===n.display,i=null===t.offsetParent&&"fixed"!==n.position;return r||i}var _useWindowSize=useWindowSize(),windowWidth=_useWindowSize.width,windowHeight=_useWindowSize.height,rootFontSize;function addUnit(e){if(isDef$1(e))return isNumeric(e)?"".concat(e,"px"):String(e)}function getSizeStyle(e){if(isDef$1(e)){if(Array.isArray(e))return{width:addUnit(e[0]),height:addUnit(e[1])};var t=addUnit(e);return{width:t,height:t}}}function getZIndexStyle(e){var t={};return void 0!==e&&(t.zIndex=+e),t}function getRootFontSize(){if(!rootFontSize){var e=document.documentElement,t=e.style.fontSize||window.getComputedStyle(e).fontSize;rootFontSize=parseFloat(t)}return rootFontSize}function convertRem(e){return+(e=e.replace(/rem/g,""))*getRootFontSize()}function convertVw(e){return+(e=e.replace(/vw/g,""))*windowWidth.value/100}function convertVh(e){return+(e=e.replace(/vh/g,""))*windowHeight.value/100}function unitToPx(e){if("number"==typeof e)return e;if(inBrowser$2){if(e.includes("rem"))return convertRem(e);if(e.includes("vw"))return convertVw(e);if(e.includes("vh"))return convertVh(e)}return parseFloat(e)}exports({bS:windowWidth,bT:windowHeight});var camelizeRE=/-(\w)/g,camelize=function(e){return e.replace(camelizeRE,(function(e,t){return t.toUpperCase()}))},kebabCase=function(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,"")},clamp=exports("a",(function(e,t,n){return Math.min(Math.max(e,t),n)}));function trimExtraChar(e,t,n){var r=e.indexOf(t);return-1===r?e:"-"===t&&0!==r?e.slice(0,r):e.slice(0,r+1)+e.slice(r).replace(n,"")}function formatNumber(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e=t?trimExtraChar(e,".",/\./g):e.split(".")[0];var r=t?/[^-0-9.]/g:/[^-0-9]/g;return(e=n?trimExtraChar(e,"-",/-/g):e.replace(/-/,"")).replace(r,"")}function addNumber(e,t){var n=Math.pow(10,10);return Math.round((e+t)*n)/n}var hasOwnProperty$1=Object.prototype.hasOwnProperty;function assignKey(e,t,n){var r=t[n];isDef$1(r)&&(hasOwnProperty$1.call(e,n)&&isObject$3(r)?e[n]=deepAssign(Object(e[n]),r):e[n]=r)}function deepAssign(e,t){return Object.keys(t).forEach((function(n){assignKey(e,t,n)})),e}var stdin_default$i={name:"姓名",tel:"电话",save:"保存",confirm:"确认",cancel:"取消",delete:"删除",loading:"加载中...",noCoupon:"暂无优惠券",nameEmpty:"请填写姓名",addContact:"添加联系人",telInvalid:"请填写正确的电话",vanCalendar:{end:"结束",start:"开始",title:"日期选择",weekdays:["日","一","二","三","四","五","六"],monthTitle:function(e,t){return"".concat(e,"年").concat(t,"月")},rangePrompt:function(e){return"最多选择 ".concat(e," 天")}},vanCascader:{select:"请选择"},vanPagination:{prev:"上一页",next:"下一页"},vanPullRefresh:{pulling:"下拉即可刷新...",loosing:"释放即可刷新..."},vanSubmitBar:{label:"合计:"},vanCoupon:{unlimited:"无门槛",discount:function(e){return"".concat(e,"折")},condition:function(e){return"满".concat(e,"元可用")}},vanCouponCell:{title:"优惠券",count:function(e){return"".concat(e,"张可用")}},vanCouponList:{exchange:"兑换",close:"不使用",enable:"可用",disabled:"不可用",placeholder:"输入优惠码"},vanAddressEdit:{area:"地区",areaEmpty:"请选择地区",addressEmpty:"请填写详细地址",addressDetail:"详细地址",defaultAddress:"设为默认收货地址"},vanAddressList:{add:"新增地址"}},lang=ref("zh-CN"),_messages=reactive({"zh-CN":stdin_default$i}),Locale={messages:function(){return _messages[lang.value]},use:function(e,t){lang.value=e,this.add(_defineProperty2({},e,t))},add:function(){deepAssign(_messages,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}},stdin_default$h=Locale;function createTranslate(e){var t=camelize(e)+".";return function(e){for(var n=stdin_default$h.messages(),r=get(n,t+e)||get(n,e),i=arguments.length,a=new Array(i>1?i-1:0),o=1;o+i?"".concat(i,"+"):a},a=function(e){return e.startsWith("-")?e.replace("-",""):"-".concat(e)},o=computed((function(){var t={background:e.color};if(e.offset){var r=_slicedToArray(e.offset,2),i=r[0],o=r[1],s=_slicedToArray(e.position.split("-"),2),l=s[0],u=s[1];n.default?(t[l]="number"==typeof o?addUnit("top"===l?o:-o):"top"===l?addUnit(o):a(o),t[u]="number"==typeof i?addUnit("left"===u?i:-i):"left"===u?addUnit(i):a(i)):(t.marginTop=addUnit(o),t.marginLeft=addUnit(i))}return t})),s=function(){if(r()||e.dot)return createVNode("div",{class:bem$e([e.position,{dot:e.dot,fixed:!!n.default}]),style:o.value},[i()])};return function(){if(n.default){var t=e.tag;return createVNode(t,{class:bem$e("wrapper")},{default:function(){return[n.default(),s()]}})}return s()}}}),Badge=exports("ay",withInstall(stdin_default$g)),globalZIndex=2e3,useGlobalZIndex=function(){return++globalZIndex},setGlobalZIndex=function(e){globalZIndex=e},_createNamespace$3=createNamespace$1("config-provider"),_createNamespace$4=_slicedToArray(_createNamespace$3,2),name$d=_createNamespace$4[0],bem$d=_createNamespace$4[1],CONFIG_PROVIDER_KEY=Symbol(name$d),configProviderProps={tag:makeStringProp("div"),theme:makeStringProp("light"),zIndex:Number,themeVars:Object,themeVarsDark:Object,themeVarsLight:Object,iconPrefix:String};function mapThemeVarsToCSSVars(e){var t={};return Object.keys(e).forEach((function(n){t["--van-".concat(kebabCase(n))]=e[n]})),t}defineComponent({name:name$d,props:configProviderProps,setup:function(e,t){var n=t.slots,r=computed((function(){return mapThemeVarsToCSSVars(extend$2({},e.themeVars,"dark"===e.theme?e.themeVarsDark:e.themeVarsLight))}));if(inBrowser$2){var i=function(){document.documentElement.classList.add("van-theme-".concat(e.theme))},a=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.theme;document.documentElement.classList.remove("van-theme-".concat(t))};watch((function(){return e.theme}),(function(e,t){t&&a(t),i()}),{immediate:!0}),onActivated(i),onDeactivated(a),onBeforeUnmount(a)}return provide(CONFIG_PROVIDER_KEY,e),watchEffect((function(){void 0!==e.zIndex&&setGlobalZIndex(e.zIndex)})),function(){return createVNode(e.tag,{class:bem$d(),style:r.value},{default:function(){var e;return[null==(e=n.default)?void 0:e.call(n)]}})}}});var _createNamespace$5=createNamespace$1("icon"),_createNamespace$6=_slicedToArray(_createNamespace$5,2),name$c=_createNamespace$6[0],bem$c=_createNamespace$6[1],isImage=function(e){return null==e?void 0:e.includes("/")},iconProps={dot:Boolean,tag:makeStringProp("i"),name:String,size:numericProp,badge:numericProp,color:String,badgeProps:Object,classPrefix:String},stdin_default$f=defineComponent({name:name$c,props:iconProps,setup:function(e,t){var n=t.slots,r=inject(CONFIG_PROVIDER_KEY,null),i=computed((function(){return e.classPrefix||(null==r?void 0:r.iconPrefix)||bem$c()}));return function(){var t=e.tag,r=e.dot,a=e.name,o=e.size,s=e.badge,l=e.color,u=isImage(a);return createVNode(Badge,mergeProps({dot:r,tag:t,class:[i.value,u?"":"".concat(i.value,"-").concat(a)],style:{color:l,fontSize:addUnit(o)},content:s},e.badgeProps),{default:function(){var e;return[null==(e=n.default)?void 0:e.call(n),u&&createVNode("img",{class:bem$c("image"),src:a},null)]}})}}}),Icon$1=exports("W",withInstall(stdin_default$f)),_createNamespace$7=createNamespace$1("loading"),_createNamespace$8=_slicedToArray(_createNamespace$7,2),name$b=_createNamespace$8[0],bem$b=_createNamespace$8[1],SpinIcon=Array(12).fill(null).map((function(e,t){return createVNode("i",{class:bem$b("line",String(t+1))},null)})),CircularIcon=createVNode("svg",{class:bem$b("circular"),viewBox:"25 25 50 50"},[createVNode("circle",{cx:"50",cy:"50",r:"20",fill:"none"},null)]),loadingProps={size:numericProp,type:makeStringProp("circular"),color:String,vertical:Boolean,textSize:numericProp,textColor:String},stdin_default$e=defineComponent({name:name$b,props:loadingProps,setup:function(e,t){var n=t.slots,r=computed((function(){return extend$2({color:e.color},getSizeStyle(e.size))})),i=function(){var t;if(n.default)return createVNode("span",{class:bem$b("text"),style:{fontSize:addUnit(e.textSize),color:null!=(t=e.textColor)?t:e.color}},[n.default()])};return function(){var t,a=e.type,o=e.vertical;return createVNode("div",{class:bem$b([a,{vertical:o}]),"aria-live":"polite","aria-busy":!0},[(t="spinner"===e.type?SpinIcon:CircularIcon,createVNode("span",{class:bem$b("spinner",e.type),style:r.value},[n.icon?n.icon():t])),i()])}}}),Loading$1=exports("L",withInstall(stdin_default$e)),_createNamespace$9=createNamespace$1("button"),_createNamespace$10=_slicedToArray(_createNamespace$9,2),name$a=_createNamespace$10[0],bem$a=_createNamespace$10[1],buttonProps=extend$2({},routeProps,{tag:makeStringProp("button"),text:String,icon:String,type:makeStringProp("default"),size:makeStringProp("normal"),color:String,block:Boolean,plain:Boolean,round:Boolean,square:Boolean,loading:Boolean,hairline:Boolean,disabled:Boolean,iconPrefix:String,nativeType:makeStringProp("button"),loadingSize:numericProp,loadingText:String,loadingType:String,iconPosition:makeStringProp("left")}),stdin_default$d=defineComponent({name:name$a,props:buttonProps,emits:["click"],setup:function(e,t){var n=t.emit,r=t.slots,i=useRoute(),a=function(){return e.loading?r.loading?r.loading():createVNode(Loading$1,{size:e.loadingSize,type:e.loadingType,class:bem$a("loading")},null):r.icon?createVNode("div",{class:bem$a("icon")},[r.icon()]):e.icon?createVNode(Icon$1,{name:e.icon,class:bem$a("icon"),classPrefix:e.iconPrefix},null):void 0},o=function(){var t;if(t=e.loading?e.loadingText:r.default?r.default():e.text)return createVNode("span",{class:bem$a("text")},[t])},s=function(){var t=e.color,n=e.plain;if(t){var r={color:n?t:"white"};return n||(r.background=t),t.includes("gradient")?r.border=0:r.borderColor=t,r}},l=function(t){e.loading?preventDefault(t):e.disabled||(n("click",t),i())};return function(){var t=e.tag,n=e.type,r=e.size,i=e.block,u=e.round,c=e.plain,h=e.square,d=e.loading,f=e.disabled,p=e.hairline,v=e.nativeType,m=e.iconPosition,g=[bem$a([n,r,{plain:c,block:i,round:u,square:h,loading:d,disabled:f,hairline:p}]),_defineProperty2({},BORDER_SURROUND,p)];return createVNode(t,{type:v,class:g,style:s(),disabled:f,onClick:l},{default:function(){return[createVNode("div",{class:bem$a("content")},["left"===m&&a(),o(),"right"===m&&a()])]}})}}}),Button=exports("ae",withInstall(stdin_default$d)),popupSharedProps=exports("bv",{show:Boolean,zIndex:numericProp,overlay:truthProp,duration:numericProp,teleport:[String,Object],lockScroll:truthProp,lazyRender:truthProp,beforeClose:Function,overlayStyle:Object,overlayClass:unknownProp,transitionAppear:Boolean,closeOnClickOverlay:truthProp}),popupSharedPropKeys=exports("bx",Object.keys(popupSharedProps));function getDirection(e,t){return e>t?"horizontal":t>e?"vertical":""}function useTouch(){var e=ref(0),t=ref(0),n=ref(0),r=ref(0),i=ref(0),a=ref(0),o=ref(""),s=function(){n.value=0,r.value=0,i.value=0,a.value=0,o.value=""};return{move:function(s){var l=s.touches[0];n.value=(l.clientX<0?0:l.clientX)-e.value,r.value=l.clientY-t.value,i.value=Math.abs(n.value),a.value=Math.abs(r.value);(!o.value||i.value<10&&a.value<10)&&(o.value=getDirection(i.value,a.value))},start:function(n){s(),e.value=n.touches[0].clientX,t.value=n.touches[0].clientY},reset:s,startX:e,startY:t,deltaX:n,deltaY:r,offsetX:i,offsetY:a,direction:o,isVertical:function(){return"vertical"===o.value},isHorizontal:function(){return"horizontal"===o.value}}}var totalLockCount=0,BODY_LOCK_CLASS="van-overflow-hidden";function useLockScroll(e,t){var n=useTouch(),r=function(t){n.move(t);var r=n.deltaY.value>0?"10":"01",i=getScrollParent(t.target,e.value),a=i.scrollHeight,o=i.offsetHeight,s=i.scrollTop,l="11";0===s?l=o>=a?"00":"01":s+o>=a&&(l="10"),"11"===l||!n.isVertical()||parseInt(l,2)&parseInt(r,2)||preventDefault(t,!0)},i=function(){document.addEventListener("touchstart",n.start),document.addEventListener("touchmove",r,{passive:!1}),totalLockCount||document.body.classList.add(BODY_LOCK_CLASS),totalLockCount++},a=function(){totalLockCount&&(document.removeEventListener("touchstart",n.start),document.removeEventListener("touchmove",r),--totalLockCount||document.body.classList.remove(BODY_LOCK_CLASS))},o=function(){return t()&&a()};onMountedOrActivated((function(){return t()&&i()})),onDeactivated(o),onBeforeUnmount(o),watch(t,(function(e){e?i():a()}))}function useLazyRender(e){var t=ref(!1);return watch(e,(function(e){e&&(t.value=e)}),{immediate:!0}),function(e){return function(){return t.value?e():null}}}var _createNamespace$11=createNamespace$1("overlay"),_createNamespace$12=_slicedToArray(_createNamespace$11,2),name$9=_createNamespace$12[0],bem$9=_createNamespace$12[1],overlayProps={show:Boolean,zIndex:numericProp,duration:numericProp,className:unknownProp,lockScroll:truthProp,lazyRender:truthProp,customStyle:Object},stdin_default$c=defineComponent({name:name$9,props:overlayProps,setup:function(e,t){var n=t.slots,r=ref(),i=useLazyRender((function(){return e.show||!e.lazyRender}))((function(){var t,i=extend$2(getZIndexStyle(e.zIndex),e.customStyle);return isDef$1(e.duration)&&(i.animationDuration="".concat(e.duration,"s")),withDirectives(createVNode("div",{ref:r,style:i,class:[bem$9(),e.className]},[null==(t=n.default)?void 0:t.call(n)]),[[vShow,e.show]])}));return useEventListener$1("touchmove",(function(t){e.lockScroll&&preventDefault(t,!0)}),{target:r}),function(){return createVNode(Transition,{name:"van-fade",appear:!0},{default:i})}}}),Overlay=withInstall(stdin_default$c),popupProps=extend$2({},popupSharedProps,{round:Boolean,position:makeStringProp("center"),closeIcon:makeStringProp("cross"),closeable:Boolean,transition:String,iconPrefix:String,closeOnPopstate:Boolean,closeIconPosition:makeStringProp("top-right"),safeAreaInsetTop:Boolean,safeAreaInsetBottom:Boolean}),_createNamespace$13=createNamespace$1("popup"),_createNamespace$14=_slicedToArray(_createNamespace$13,2),name$8=_createNamespace$14[0],bem$8=_createNamespace$14[1],stdin_default$b=defineComponent({name:name$8,inheritAttrs:!1,props:popupProps,emits:["open","close","opened","closed","keydown","update:show","clickOverlay","clickCloseIcon"],setup:function(e,t){var n,r,i=t.emit,a=t.attrs,o=t.slots,s=ref(),l=ref(),u=useLazyRender((function(){return e.show||!e.lazyRender})),c=computed((function(){var t={zIndex:s.value};isDef$1(e.duration)&&(t["center"===e.position?"animationDuration":"transitionDuration"]="".concat(e.duration,"s"));return t})),h=function(){n||(n=!0,s.value=void 0!==e.zIndex?+e.zIndex:useGlobalZIndex(),i("open"))},d=function(){n&&callInterceptor(e.beforeClose,{done:function(){n=!1,i("close"),i("update:show",!1)}})},f=function(t){i("clickOverlay",t),e.closeOnClickOverlay&&d()},p=function(){if(e.overlay)return createVNode(Overlay,{show:e.show,class:e.overlayClass,zIndex:s.value,duration:e.duration,customStyle:e.overlayStyle,role:e.closeOnClickOverlay?"button":void 0,tabindex:e.closeOnClickOverlay?0:void 0,onClick:f},{default:o["overlay-content"]})},v=function(e){i("clickCloseIcon",e),d()},m=function(){if(e.closeable)return createVNode(Icon$1,{role:"button",tabindex:0,name:e.closeIcon,class:[bem$8("close-icon",e.closeIconPosition),HAPTICS_FEEDBACK],classPrefix:e.iconPrefix,onClick:v},null)},g=function(){return i("opened")},y=function(){return i("closed")},b=function(e){return i("keydown",e)},A=u((function(){var t,n=e.round,r=e.position,i=e.safeAreaInsetTop,s=e.safeAreaInsetBottom;return withDirectives(createVNode("div",mergeProps({ref:l,style:c.value,role:"dialog",tabindex:0,class:[bem$8(_defineProperty2({round:n},r,r)),{"van-safe-area-top":i,"van-safe-area-bottom":s}],onKeydown:b},a),[null==(t=o.default)?void 0:t.call(o),m()]),[[vShow,e.show]])})),S=function(){var t=e.position,n=e.transition,r=e.transitionAppear,i="center"===t?"van-fade":"van-popup-slide-".concat(t);return createVNode(Transition,{name:n||i,appear:r,onAfterEnter:g,onAfterLeave:y},{default:A})};return watch((function(){return e.show}),(function(e){e&&!n&&(h(),0===a.tabindex&&nextTick((function(){var e;null==(e=l.value)||e.focus()}))),!e&&n&&(n=!1,i("close"))})),useExpose({popupRef:l}),useLockScroll(l,(function(){return e.show&&e.lockScroll})),useEventListener$1("popstate",(function(){e.closeOnPopstate&&(d(),r=!1)})),onMounted((function(){e.show&&h()})),onActivated((function(){r&&(i("update:show",!0),r=!1)})),onDeactivated((function(){e.show&&e.teleport&&(d(),r=!0)})),provide(POPUP_TOGGLE_KEY,(function(){return e.show})),function(){return e.teleport?createVNode(Teleport,{to:e.teleport},{default:function(){return[p(),S()]}}):createVNode(Fragment,null,[p(),S()])}}}),Popup=exports("a5",withInstall(stdin_default$b)),current=0;function useId(){var e=getCurrentInstance(),t=((null==e?void 0:e.type)||{}).name;return"".concat(void 0===t?"unknown":t,"-").concat(++current)}var lockCount=0;function lockClick(e){e?(lockCount||document.body.classList.add("van-toast--unclickable"),lockCount++):lockCount&&(--lockCount||document.body.classList.remove("van-toast--unclickable"))}var _createNamespace$15=createNamespace$1("toast"),_createNamespace$16=_slicedToArray(_createNamespace$15,2),name$7=_createNamespace$16[0],bem$7=_createNamespace$16[1],popupInheritProps=["show","overlay","teleport","transition","overlayClass","overlayStyle","closeOnClickOverlay"],toastProps={icon:String,show:Boolean,type:makeStringProp("text"),overlay:Boolean,message:numericProp,iconSize:numericProp,duration:makeNumberProp(2e3),position:makeStringProp("middle"),teleport:[String,Object],wordBreak:String,className:unknownProp,iconPrefix:String,transition:makeStringProp("van-fade"),loadingType:String,forbidClick:Boolean,overlayClass:unknownProp,overlayStyle:Object,closeOnClick:Boolean,closeOnClickOverlay:Boolean},stdin_default$a=defineComponent({name:name$7,props:toastProps,emits:["update:show"],setup:function(e,t){var n,r=t.emit,i=t.slots,a=!1,o=function(){var t=e.show&&e.forbidClick;a!==t&&lockClick(a=t)},s=function(e){return r("update:show",e)},l=function(){e.closeOnClick&&s(!1)},u=function(){return clearTimeout(n)},c=function(){var t=e.icon,n=e.type,r=e.iconSize,i=e.iconPrefix,a=e.loadingType;return t||"success"===n||"fail"===n?createVNode(Icon$1,{name:t||n,size:r,class:bem$7("icon"),classPrefix:i},null):"loading"===n?createVNode(Loading$1,{class:bem$7("loading"),size:r,type:a},null):void 0};return watch((function(){return[e.show,e.forbidClick]}),o),watch((function(){return[e.show,e.type,e.message,e.duration]}),(function(){u(),e.show&&e.duration>0&&(n=setTimeout((function(){s(!1)}),e.duration))})),onMounted(o),onUnmounted(o),function(){return createVNode(Popup,mergeProps({class:[bem$7([e.position,"normal"===e.wordBreak?"break-normal":e.wordBreak,_defineProperty2({},e.type,!e.icon)]),e.className],lockScroll:!1,onClick:l,onClosed:u,"onUpdate:show":s},pick$1(e,popupInheritProps)),{default:function(){return[c(),(t=e.type,n=e.message,i.message?createVNode("div",{class:bem$7("text")},[i.message()]):isDef$1(n)&&""!==n?"html"===t?createVNode("div",{key:0,class:bem$7("text"),innerHTML:String(n)},null):createVNode("div",{class:bem$7("text")},[n]):void 0)];var t,n}})}}});function usePopupState(){var e=reactive({show:!1}),t=function(t){e.show=t},n=function(n){extend$2(e,n,{transitionAppear:!0}),t(!0)},r=function(){return t(!1)};return useExpose({open:n,close:r,toggle:t}),{open:n,close:r,state:e,toggle:t}}function mountComponent(e){var t=createApp(e),n=document.createElement("div");return document.body.appendChild(n),{instance:t.mount(n),unmount:function(){t.unmount(),document.body.removeChild(n)}}}var defaultOptions$1={icon:"",type:"text",message:"",className:"",overlay:!1,onClose:void 0,onOpened:void 0,duration:2e3,teleport:"body",iconSize:void 0,iconPrefix:void 0,position:"middle",transition:"van-fade",forbidClick:!1,loadingType:void 0,overlayClass:"",overlayStyle:void 0,closeOnClick:!1,closeOnClickOverlay:!1},queue=[],allowMultiple=!1,currentOptions=extend$2({},defaultOptions$1),defaultOptionsMap=new Map;function parseOptions(e){return isObject$3(e)?e:{message:e}}function createInstance(){var e=mountComponent({setup:function(){var e=ref(""),t=usePopupState(),n=t.open,r=t.state,i=t.close,a=t.toggle,o=function(){};return watch(e,(function(e){r.message=e})),getCurrentInstance().render=function(){return createVNode(stdin_default$a,mergeProps(r,{onClosed:o,"onUpdate:show":a}),null)},{open:n,close:i,message:e}}}),t=e.instance;e.unmount;return t}function getInstance(){if(!queue.length||allowMultiple){var e=createInstance();queue.push(e)}return queue[queue.length-1]}function showToast(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!inBrowser$2)return{};var t=getInstance(),n=parseOptions(e);return t.open(extend$2({},currentOptions,defaultOptionsMap.get(n.type||currentOptions.type),n)),t}var createMethod=function(e){return function(t){return showToast(extend$2({type:e},parseOptions(t)))}},showLoadingToast=exports("ao",createMethod("loading")),closeToast=exports("aq",(function(e){queue.length&&(e?(queue.forEach((function(e){e.close()})),queue=[]):queue[0].close())}));withInstall(stdin_default$a);var _createNamespace$17=createNamespace$1("empty"),_createNamespace$18=_slicedToArray(_createNamespace$17,2),name$6=_createNamespace$18[0],bem$6=_createNamespace$18[1],emptyProps={image:makeStringProp("default"),imageSize:[Number,String,Array],description:String},stdin_default$9=defineComponent({name:name$6,props:emptyProps,setup:function(e,t){var n=t.slots,r=function(){var t=n.description?n.description():e.description;if(t)return createVNode("p",{class:bem$6("description")},[t])},i=function(){if(n.default)return createVNode("div",{class:bem$6("bottom")},[n.default()])},a=useId(),o=function(e){return"".concat(a,"-").concat(e)},s=function(e){return"url(#".concat(o(e),")")},l=function(e,t,n){return createVNode("stop",{"stop-color":e,offset:"".concat(t,"%"),"stop-opacity":n},null)},u=function(e,t){return[l(e,0),l(t,100)]},c=function(e){return[createVNode("defs",null,[createVNode("radialGradient",{id:o(e),cx:"50%",cy:"54%",fx:"50%",fy:"54%",r:"297%",gradientTransform:"matrix(-.16 0 0 -.33 .58 .72)"},[l("#EBEDF0",0),l("#F2F3F5",100,.3)])]),createVNode("ellipse",{fill:s(e),opacity:".8",cx:"80",cy:"140",rx:"46",ry:"8"},null)]},h=function(){return[createVNode("defs",null,[createVNode("linearGradient",{id:o("a"),x1:"64%",y1:"100%",x2:"64%"},[l("#FFF",0,.5),l("#F2F3F5",100)])]),createVNode("g",{opacity:".8"},[createVNode("path",{d:"M36 131V53H16v20H2v58h34z",fill:s("a")},null),createVNode("path",{d:"M123 15h22v14h9v77h-31V15z",fill:s("a")},null)])]},d=function(){return[createVNode("defs",null,[createVNode("linearGradient",{id:o("b"),x1:"64%",y1:"97%",x2:"64%",y2:"0%"},[l("#F2F3F5",0,.3),l("#F2F3F5",100)])]),createVNode("g",{opacity:".8"},[createVNode("path",{d:"M87 6c3 0 7 3 8 6a8 8 0 1 1-1 16H80a7 7 0 0 1-8-6c0-4 3-7 6-7 0-5 4-9 9-9Z",fill:s("b")},null),createVNode("path",{d:"M19 23c2 0 3 1 4 3 2 0 4 2 4 4a4 4 0 0 1-4 3v1h-7v-1l-1 1c-2 0-3-2-3-4 0-1 1-3 3-3 0-2 2-4 4-4Z",fill:s("b")},null)])]},f=function(){return createVNode("svg",{viewBox:"0 0 160 160"},[createVNode("defs",null,[createVNode("linearGradient",{id:o(1),x1:"64%",y1:"100%",x2:"64%"},[l("#FFF",0,.5),l("#F2F3F5",100)]),createVNode("linearGradient",{id:o(2),x1:"50%",x2:"50%",y2:"84%"},[l("#EBEDF0",0),l("#DCDEE0",100,0)]),createVNode("linearGradient",{id:o(3),x1:"100%",x2:"100%",y2:"100%"},[u("#EAEDF0","#DCDEE0")]),createVNode("radialGradient",{id:o(4),cx:"50%",cy:"0%",fx:"50%",fy:"0%",r:"100%",gradientTransform:"matrix(0 1 -.54 0 .5 -.5)"},[l("#EBEDF0",0),l("#FFF",100,0)])]),createVNode("g",{fill:"none"},[h(),createVNode("path",{fill:s(4),d:"M0 139h160v21H0z"},null),createVNode("path",{d:"M80 54a7 7 0 0 1 3 13v27l-2 2h-2a2 2 0 0 1-2-2V67a7 7 0 0 1 3-13z",fill:s(2)},null),createVNode("g",{opacity:".6","stroke-linecap":"round","stroke-width":"7"},[createVNode("path",{d:"M64 47a19 19 0 0 0-5 13c0 5 2 10 5 13",stroke:s(3)},null),createVNode("path",{d:"M53 36a34 34 0 0 0 0 48",stroke:s(3)},null),createVNode("path",{d:"M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",stroke:s(3)},null),createVNode("path",{d:"M106 84a34 34 0 0 0 0-48",stroke:s(3)},null)]),createVNode("g",{transform:"translate(31 105)"},[createVNode("rect",{fill:"#EBEDF0",width:"98",height:"34",rx:"2"},null),createVNode("rect",{fill:"#FFF",x:"9",y:"8",width:"80",height:"18",rx:"1.1"},null),createVNode("rect",{fill:"#EBEDF0",x:"15",y:"12",width:"18",height:"6",rx:"1.1"},null)])])])},p=function(){return createVNode("svg",{viewBox:"0 0 160 160"},[createVNode("defs",null,[createVNode("linearGradient",{x1:"50%",x2:"50%",y2:"100%",id:o(5)},[u("#F2F3F5","#DCDEE0")]),createVNode("linearGradient",{x1:"95%",y1:"48%",x2:"5.5%",y2:"51%",id:o(6)},[u("#EAEDF1","#DCDEE0")]),createVNode("linearGradient",{y1:"45%",x2:"100%",y2:"54%",id:o(7)},[u("#EAEDF1","#DCDEE0")])]),h(),d(),createVNode("g",{transform:"translate(36 50)",fill:"none"},[createVNode("g",{transform:"translate(8)"},[createVNode("rect",{fill:"#EBEDF0",opacity:".6",x:"38",y:"13",width:"36",height:"53",rx:"2"},null),createVNode("rect",{fill:s(5),width:"64",height:"66",rx:"2"},null),createVNode("rect",{fill:"#FFF",x:"6",y:"6",width:"52",height:"55",rx:"1"},null),createVNode("g",{transform:"translate(15 17)",fill:s(6)},[createVNode("rect",{width:"34",height:"6",rx:"1"},null),createVNode("path",{d:"M0 14h34v6H0z"},null),createVNode("rect",{y:"28",width:"34",height:"6",rx:"1"},null)])]),createVNode("rect",{fill:s(7),y:"61",width:"88",height:"28",rx:"1"},null),createVNode("rect",{fill:"#F7F8FA",x:"29",y:"72",width:"30",height:"6",rx:"1"},null)])])},v=function(){return createVNode("svg",{viewBox:"0 0 160 160"},[createVNode("defs",null,[createVNode("linearGradient",{x1:"50%",x2:"50%",y2:"100%",id:o(8)},[u("#EAEDF1","#DCDEE0")])]),h(),d(),c("c"),createVNode("path",{d:"m59 60 21 21 21-21h3l9 9v3L92 93l21 21v3l-9 9h-3l-21-21-21 21h-3l-9-9v-3l21-21-21-21v-3l9-9h3Z",fill:s(8)},null)])},m=function(){return createVNode("svg",{viewBox:"0 0 160 160"},[createVNode("defs",null,[createVNode("linearGradient",{x1:"50%",y1:"100%",x2:"50%",id:o(9)},[u("#EEE","#D8D8D8")]),createVNode("linearGradient",{x1:"100%",y1:"50%",y2:"50%",id:o(10)},[u("#F2F3F5","#DCDEE0")]),createVNode("linearGradient",{x1:"50%",x2:"50%",y2:"100%",id:o(11)},[u("#F2F3F5","#DCDEE0")]),createVNode("linearGradient",{x1:"50%",x2:"50%",y2:"100%",id:o(12)},[u("#FFF","#F7F8FA")])]),h(),d(),c("d"),createVNode("g",{transform:"rotate(-45 113 -4)",fill:"none"},[createVNode("rect",{fill:s(9),x:"24",y:"52.8",width:"5.8",height:"19",rx:"1"},null),createVNode("rect",{fill:s(10),x:"22.1",y:"67.3",width:"9.9",height:"28",rx:"1"},null),createVNode("circle",{stroke:s(11),"stroke-width":"8",cx:"27",cy:"27",r:"27"},null),createVNode("circle",{fill:s(12),cx:"27",cy:"27",r:"16"},null),createVNode("path",{d:"M37 7c-8 0-15 5-16 12",stroke:s(11),"stroke-width":"3",opacity:".5","stroke-linecap":"round",transform:"rotate(45 29 13)"},null)])])},g=function(){var t;if(n.image)return n.image();var r={error:v,search:m,network:f,default:p};return(null==(t=r[e.image])?void 0:t.call(r))||createVNode("img",{src:e.image},null)};return function(){return createVNode("div",{class:bem$6()},[createVNode("div",{class:bem$6("image"),style:getSizeStyle(e.imageSize)},[g()]),r(),i()])}}}),Empty=withInstall(stdin_default$9),_createNamespace$19=createNamespace$1("nav-bar"),_createNamespace$20=_slicedToArray(_createNamespace$19,2),name$5=_createNamespace$20[0],bem$5=_createNamespace$20[1],navBarProps={title:String,fixed:Boolean,zIndex:numericProp,border:truthProp,leftText:String,rightText:String,leftArrow:Boolean,placeholder:Boolean,safeAreaInsetTop:Boolean,clickable:truthProp},stdin_default$8=defineComponent({name:name$5,props:navBarProps,emits:["clickLeft","clickRight"],setup:function(e,t){var n=t.emit,r=t.slots,i=ref(),a=usePlaceholder(i,bem$5),o=function(e){return n("clickLeft",e)},s=function(e){return n("clickRight",e)},l=function(){var t,n=e.title,a=e.fixed,l=e.border,u=getZIndexStyle(e.zIndex),c=e.leftArrow||e.leftText||r.left,h=e.rightText||r.right;return createVNode("div",{ref:i,style:u,class:[bem$5({fixed:a}),(t={},_defineProperty2(t,BORDER_BOTTOM,l),_defineProperty2(t,"van-safe-area-top",e.safeAreaInsetTop),t)]},[createVNode("div",{class:bem$5("content")},[c&&createVNode("div",{class:[bem$5("left"),e.clickable?HAPTICS_FEEDBACK:""],onClick:o},[r.left?r.left():[e.leftArrow&&createVNode(Icon$1,{class:bem$5("arrow"),name:"arrow-left"},null),e.leftText&&createVNode("span",{class:bem$5("text")},[e.leftText])]]),createVNode("div",{class:[bem$5("title"),"van-ellipsis"]},[r.title?r.title():n]),h&&createVNode("div",{class:[bem$5("right"),e.clickable?HAPTICS_FEEDBACK:""],onClick:s},[r.right?r.right():createVNode("span",{class:bem$5("text")},[e.rightText])])])])};return function(){return e.fixed&&e.placeholder?a(l):l()}}}),NavBar=withInstall(stdin_default$8),_createNamespace$21=createNamespace$1("notice-bar"),_createNamespace$22=_slicedToArray(_createNamespace$21,2),name$4=_createNamespace$22[0],bem$4=_createNamespace$22[1],noticeBarProps={text:String,mode:String,color:String,delay:makeNumericProp(1),speed:makeNumericProp(60),leftIcon:String,wrapable:Boolean,background:String,scrollable:{type:Boolean,default:null}},stdin_default$7=defineComponent({name:name$4,props:noticeBarProps,emits:["close","replay"],setup:function(e,t){var n,r=t.emit,i=t.slots,a=0,o=0,s=ref(),l=ref(),u=reactive({show:!0,offset:0,duration:0}),c=function(t){"closeable"===e.mode&&(u.show=!1,r("close",t))},h=function(){if(i["right-icon"])return i["right-icon"]();var t="closeable"===e.mode?"cross":"link"===e.mode?"arrow":void 0;return t?createVNode(Icon$1,{name:t,class:bem$4("right-icon"),onClick:c},null):void 0},d=function(){u.offset=a,u.duration=0,raf((function(){doubleRaf((function(){u.offset=-o,u.duration=(o+a)/+e.speed,r("replay")}))}))},f=function(){var t=!1===e.scrollable&&!e.wrapable,n={transform:u.offset?"translateX(".concat(u.offset,"px)"):"",transitionDuration:"".concat(u.duration,"s")};return createVNode("div",{ref:s,role:"marquee",class:bem$4("wrap")},[createVNode("div",{ref:l,style:n,class:[bem$4("content"),{"van-ellipsis":t}],onTransitionend:d},[i.default?i.default():e.text])])},p=function(){var t=e.delay,r=e.speed,i=e.scrollable,c=isDef$1(t)?1e3*+t:0;a=0,o=0,u.offset=0,u.duration=0,clearTimeout(n),n=setTimeout((function(){if(s.value&&l.value&&!1!==i){var e=useRect(s).width,t=useRect(l).width;(i||t>e)&&doubleRaf((function(){a=e,o=t,u.offset=-o,u.duration=o/+r}))}}),c)};return onPopupReopen(p),onMountedOrActivated(p),useEventListener$1("pageshow",p),useExpose({reset:p}),watch((function(){return[e.text,e.scrollable]}),p),function(){var t=e.color,n=e.wrapable,r=e.background;return withDirectives(createVNode("div",{role:"alert",class:bem$4({wrapable:n}),style:{color:t,background:r}},[i["left-icon"]?i["left-icon"]():e.leftIcon?createVNode(Icon$1,{class:bem$4("left-icon"),name:e.leftIcon},null):void 0,f(),h()]),[[vShow,u.show]])}}}),NoticeBar=exports("a4",withInstall(stdin_default$7)),_createNamespace$23=createNamespace$1("skeleton-title"),_createNamespace$24=_slicedToArray(_createNamespace$23,2),name$3=_createNamespace$24[0],bem$3=_createNamespace$24[1],skeletonTitleProps={round:Boolean,titleWidth:numericProp},stdin_default$6=defineComponent({name:name$3,props:skeletonTitleProps,setup:function(e){return function(){return createVNode("h3",{class:bem$3([{round:e.round}]),style:{width:addUnit(e.titleWidth)}},null)}}}),SkeletonTitle=withInstall(stdin_default$6),stdin_default$5=SkeletonTitle,_createNamespace$25=createNamespace$1("skeleton-avatar"),_createNamespace$26=_slicedToArray(_createNamespace$25,2),name$2=_createNamespace$26[0],bem$2=_createNamespace$26[1],skeletonAvatarProps={avatarSize:numericProp,avatarShape:makeStringProp("round")},stdin_default$4=defineComponent({name:name$2,props:skeletonAvatarProps,setup:function(e){return function(){return createVNode("div",{class:bem$2([e.avatarShape]),style:getSizeStyle(e.avatarSize)},null)}}}),SkeletonAvatar=withInstall(stdin_default$4),stdin_default$3=SkeletonAvatar,DEFAULT_ROW_WIDTH="100%",skeletonParagraphProps={round:Boolean,rowWidth:{type:numericProp,default:DEFAULT_ROW_WIDTH}},_createNamespace$27=createNamespace$1("skeleton-paragraph"),_createNamespace$28=_slicedToArray(_createNamespace$27,2),name$1=_createNamespace$28[0],bem$1=_createNamespace$28[1],stdin_default$2=defineComponent({name:name$1,props:skeletonParagraphProps,setup:function(e){return function(){return createVNode("div",{class:bem$1([{round:e.round}]),style:{width:e.rowWidth}},null)}}}),SkeletonParagraph=withInstall(stdin_default$2),stdin_default$1=SkeletonParagraph,_createNamespace$29=createNamespace$1("skeleton"),_createNamespace$30=_slicedToArray(_createNamespace$29,2),name=_createNamespace$30[0],bem=_createNamespace$30[1],DEFAULT_LAST_ROW_WIDTH="60%",skeletonProps={row:makeNumericProp(0),round:Boolean,title:Boolean,titleWidth:numericProp,avatar:Boolean,avatarSize:numericProp,avatarShape:makeStringProp("round"),loading:truthProp,animate:truthProp,rowWidth:{type:[Number,String,Array],default:DEFAULT_ROW_WIDTH}},stdin_default=defineComponent({name:name,inheritAttrs:!1,props:skeletonProps,setup:function(e,t){var n=t.slots,r=t.attrs,i=function(){if(e.avatar)return createVNode(stdin_default$3,{avatarShape:e.avatarShape,avatarSize:e.avatarSize},null)},a=function(){if(e.title)return createVNode(stdin_default$5,{round:e.round,titleWidth:e.titleWidth},null)},o=function(t){var n=e.rowWidth;return n===DEFAULT_ROW_WIDTH&&t===+e.row-1?DEFAULT_LAST_ROW_WIDTH:Array.isArray(n)?n[t]:n};return function(){var t;return e.loading?createVNode("div",mergeProps({class:bem({animate:e.animate,round:e.round})},r),[n.template?n.template():createVNode(Fragment,null,[i(),createVNode("div",{class:bem("content")},[a(),Array(+e.row).fill("").map((function(t,n){return createVNode(stdin_default$1,{key:n,round:e.round,rowWidth:addUnit(o(n))},null)}))])])]):null==(t=n.default)?void 0:t.call(n)}}}),Skeleton=exports("aH",withInstall(stdin_default)),storeData=exports("N",reactive({status:"init",user:{},platformType:"STUDENT",platformApi:"/api-student",proxy:"",isApp:!1})),setStoreData=exports("aY",(function(e){Object.assign(storeData,e)})),setUserInfo=exports("P",(function(e){storeData.status="login",storeData.user=e||{}})),commonjsGlobal=exports("bk","undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{});function getAugmentedNamespace(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){if(this instanceof e){var n=[null];return n.push.apply(n,arguments),new(Function.bind.apply(t,n))}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var assign$1=make_assign(),create$1=make_create(),trim$1=make_trim(),Global$5="undefined"!=typeof window?window:commonjsGlobal,util$i={assign:assign$1,create:create$1,trim:trim$1,bind:bind$3,slice:slice$3,each:each$8,map:map,pluck:pluck$1,isList:isList$1,isFunction:isFunction$2,isObject:isObject$2,Global:Global$5};function make_assign(){return Object.assign?Object.assign:function(e,t,n,r){for(var i=1;i=0;t--){var n=localStorage$1().key(t);e(read$5(n),n)}}function remove$6(e){return localStorage$1().removeItem(e)}function clearAll$5(){return localStorage$1().clear()}var util$f=util$i,Global$3=util$f.Global,oldFFGlobalStorage={name:"oldFF-globalStorage",read:read$4,write:write$4,each:each$5,remove:remove$5,clearAll:clearAll$4},globalStorage=Global$3.globalStorage;function read$4(e){return globalStorage[e]}function write$4(e,t){globalStorage[e]=t}function each$5(e){for(var t=globalStorage.length-1;t>=0;t--){var n=globalStorage.key(t);e(globalStorage[n],n)}}function remove$5(e){return globalStorage.removeItem(e)}function clearAll$4(){each$5((function(e,t){delete globalStorage[e]}))}var util$e=util$i,Global$2=util$e.Global,oldIEUserDataStorage={name:"oldIE-userDataStorage",write:write$3,read:read$3,each:each$4,remove:remove$4,clearAll:clearAll$3},storageName="storejs",doc$1=Global$2.document,_withStorageEl=_makeIEStorageElFunction(),disable$1=(Global$2.navigator?Global$2.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function write$3(e,t){if(!disable$1){var n=fixKey(e);_withStorageEl((function(e){e.setAttribute(n,t),e.save(storageName)}))}}function read$3(e){if(!disable$1){var t=fixKey(e),n=null;return _withStorageEl((function(e){n=e.getAttribute(t)})),n}}function each$4(e){_withStorageEl((function(t){for(var n=t.XMLDocument.documentElement.attributes,r=n.length-1;r>=0;r--){var i=n[r];e(t.getAttribute(i.name),i.name)}}))}function remove$4(e){var t=fixKey(e);_withStorageEl((function(e){e.removeAttribute(t),e.save(storageName)}))}function clearAll$3(){_withStorageEl((function(e){var t=e.XMLDocument.documentElement.attributes;e.load(storageName);for(var n=t.length-1;n>=0;n--)e.removeAttribute(t[n].name);e.save(storageName)}))}var forbiddenCharsRegex=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function fixKey(e){return e.replace(/^\d/,"___$&").replace(forbiddenCharsRegex,"___")}function _makeIEStorageElFunction(){if(!doc$1||!doc$1.documentElement||!doc$1.documentElement.addBehavior)return null;var e,t,n,r="script";try{(t=new ActiveXObject("htmlfile")).open(),t.write("<"+r+">document.w=window'),t.close(),e=t.w.frames[0].document,n=e.createElement("div")}catch(i){n=doc$1.createElement("div"),e=doc$1.body}return function(t){var r=[].slice.call(arguments,0);r.unshift(n),e.appendChild(n),n.addBehavior("#default#userData"),n.load(storageName),t.apply(this,r),e.removeChild(n)}}var util$d=util$i,Global$1=util$d.Global,trim=util$d.trim,cookieStorage={name:"cookieStorage",read:read$2,write:write$2,each:each$3,remove:remove$3,clearAll:clearAll$2},doc=Global$1.document;function read$2(e){if(!e||!_has(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(doc.cookie.replace(new RegExp(t),"$1"))}function each$3(e){for(var t=doc.cookie.split(/; ?/g),n=t.length-1;n>=0;n--)if(trim(t[n])){var r=t[n].split("="),i=unescape(r[0]);e(unescape(r[1]),i)}}function write$2(e,t){e&&(doc.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function remove$3(e){e&&_has(e)&&(doc.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function clearAll$2(){each$3((function(e,t){remove$3(t)}))}function _has(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(doc.cookie)}var util$c=util$i,Global=util$c.Global,sessionStorage_1={name:"sessionStorage",read:read$1,write:write$1,each:each$2,remove:remove$2,clearAll:clearAll$1};function sessionStorage$1(){return Global.sessionStorage}function read$1(e){return sessionStorage$1().getItem(e)}function write$1(e,t){return sessionStorage$1().setItem(e,t)}function each$2(e){for(var t=sessionStorage$1().length-1;t>=0;t--){var n=sessionStorage$1().key(t);e(read$1(n),n)}}function remove$2(e){return sessionStorage$1().removeItem(e)}function clearAll$1(){return sessionStorage$1().clear()}var memoryStorage_1={name:"memoryStorage",read:read,write:write,each:each$1,remove:remove$1,clearAll:clearAll},memoryStorage={};function read(e){return memoryStorage[e]}function write(e,t){memoryStorage[e]=t}function each$1(e){for(var t in memoryStorage)memoryStorage.hasOwnProperty(t)&&e(memoryStorage[t],t)}function remove$1(e){delete memoryStorage[e]}function clearAll(e){memoryStorage={}}var all=[localStorage_1,oldFFGlobalStorage,oldIEUserDataStorage,cookieStorage,sessionStorage_1,memoryStorage_1],json2$1={},hasRequiredJson2;function requireJson2(){return hasRequiredJson2||(hasRequiredJson2=1,"object"!==("undefined"==typeof JSON?"undefined":_typeof2(JSON))&&(JSON={}),function(){var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta,rep;function f(e){return e<10?"0"+e:e}function this_value(){return this.valueOf()}function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,(function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}function str(e,t){var n,r,i,a,o,s=gap,l=t[e];switch(l&&"object"===_typeof2(l)&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),"function"==typeof rep&&(l=rep.call(t,e,l)),_typeof2(l)){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(gap+=indent,o=[],"[object Array]"===Object.prototype.toString.apply(l)){for(a=l.length,n=0;n-1,presto:e.indexOf("Presto")>-1,webKit:e.indexOf("AppleWebKit")>-1,gecko:e.indexOf("Gecko")>-1&&-1==e.indexOf("KHTML"),mobile:!!e.match(/AppleWebKit.*Mobile.*/),ios:!!e.match(/Mac OS X/)||/(iPhone|iPad|iPod|iOS)/i.test(e),android:e.indexOf("Android")>-1||e.indexOf("Adr")>-1,iPhone:e.indexOf("ORCHESTRAAPPI")>-1,isApp:e.includes("DAYAAPPA")||e.includes("DAYAAPPI")||e.includes("COLEXIUAPPA")||e.includes("COLEXIUAPPI")||e.includes("ORCHESTRAAPPI")||e.includes("ORCHESTRAAPPA"),isTeacher:e.indexOf("ORCHESTRATEACHER")>-1||e.includes("COLEXIUTEACHER"),isStudent:e.indexOf("ORCHESTRASTUDENT")>-1||e.includes("COLEXIUSTUDENT"),isSchool:e.indexOf("ORCHESTRASCHOOL")>-1,iPad:e.indexOf("iPad")>-1,webApp:-1==e.indexOf("Safari"),weixin:e.indexOf("MicroMessenger")>-1,alipay:e.indexOf("AlipayClient")>-1,huawei:!!e.match(/huawei/i)||!!e.match(/honor/i),xiaomi:!!e.match(/mi\s/i)||!!e.match(/redmi/i)||!!e.match(/mix/i)}})),getRandomKey=exports("Q",(function(){return""+Date.now()+Math.floor(1e6*Math.random())})),AuthorizationKey="AUTHORIZATION",setToken=exports("I",(function(e){sessionStorage.setItem(AuthorizationKey,e)})),getToken=exports("bc",(function(){return sessionStorage.getItem(AuthorizationKey)||""})),setGlobalData=exports("aD",(function(e,t){if(e&&t){var n=window.GYM||{};n[e]=t,window.GYM=n}})),BEHAVIORIDKEY="BEHAVIORID",setBehaviorId=exports("J",(function(e){localStorage.setItem(BEHAVIORIDKEY,e)})),getBehaviorId=exports("ar",(function(){return localStorage.getItem(BEHAVIORIDKEY)})),campIdKey="CAMPID",setCampId=exports("K",(function(e){sessionStorage.setItem(campIdKey,e)})),getCampId=exports("as",(function(){return sessionStorage.getItem(campIdKey)||""})),getSecondRPM=exports("aB",(function(e,t){if(isNaN(e))return"00:00";var n=Math.floor(e/60/60%24),r=Math.floor(e/60%60),i=Math.floor(e%60);return"cn"===t?"".concat(n>0?n.toString().padStart(2,"0")+"时":"").concat(r.toString().padStart(2,"0"),"分").concat(i.toString().padStart(2,"0"),"秒"):"".concat(n>0?n.toString().padStart(2,"0")+":":"").concat(r.toString().padStart(2,"0"),":").concat(i.toString().padStart(2,"0"))})),SPEEDKEY="speeds",setStorageSpeed=function(e,t){var n=store_legacy.get(SPEEDKEY)||{};n[e]=t,store_legacy.set(SPEEDKEY,n)},getStorageSpeed=exports("aS",(function(e){return(store_legacy.get(SPEEDKEY)||{})[e]||0})),originalPostMessage=window.postMessage;window.postMessage=function(e){originalPostMessage(e,"*")};var loop=function(){},calls={},instance=window.DAYA||(null===(_window$webkit=window.webkit)||void 0===_window$webkit||null===(_window$webkit$messag=_window$webkit.messageHandlers)||void 0===_window$webkit$messag?void 0:_window$webkit$messag.DAYA)||window.COLEXIU||(null===(_window$webkit2=window.webkit)||void 0===_window$webkit2||null===(_window$webkit2$messa=_window$webkit2.messageHandlers)||void 0===_window$webkit2$messa?void 0:_window$webkit2$messa.COLEXIU)||window.ORCHESTRA||(null===(_window$webkit3=window.webkit)||void 0===_window$webkit3||null===(_window$webkit3$messa=_window$webkit3.messageHandlers)||void 0===_window$webkit3$messa?void 0:_window$webkit3$messa.ORCHESTRA);instance&&window.addEventListener("message",(function(e){try{var t,n,r=e.data?"object"===_typeof2(e.data)?e.data:JSON.parse(e.data):{},i=(null===(t=r.content)||void 0===t?void 0:t.uuid)||r.uuid;try{r.content&&(r.content=JSON.parse(r.content))}catch(d){}if(console.log("h5_接受_api:",null==r?void 0:r.api,r.content),!i){var a,o=Object.keys(calls).filter((function(e){return 0===e.indexOf(r.api)})),s=_createForOfIteratorHelper(o);try{for(s.s();!(a=s.n()).done;){var l=a.value,u=calls[l]||loop;"function"==typeof u&&u(r),Array.isArray(u)&&u.forEach((function(e){"function"==typeof e&&e(r)}))}}catch(f){s.e(f)}finally{s.f()}return}var c=(null===(n=r.content)||void 0===n?void 0:n.uuid)||r.uuid||r.api+r.uuid,h=calls[c]||loop;"function"==typeof h&&h(r)}catch(d){console.error("通信消息解析错误",d)}}));var postMessage=exports("am",(function(e,t){if(instance){var n=getRandomKey();calls[n]=t||loop,e.content=e.content?_objectSpread(_objectSpread({},e.content),{},{uuid:n}):{uuid:n},instance.postMessage(JSON.stringify(e)),console.log("h5_请求_api:",e)}})),listenerMessage=function(e,t){var n=e;calls[n]||(calls[n]=[]),calls[n].push(t||loop)},removeListenerMessage=function(e,t){var n=e;if(Array.isArray(calls[n])){var r=calls[n].indexOf(t);calls[n].splice(r,1)}},promisefiyPostMessage=exports("ba",(function(e){return new Promise((function(t){postMessage(e,(function(e){return t(e)}))}))})),api_getToken=exports("bi",(function(){return storeData.isApp?promisefiyPostMessage({api:"getToken"}):Promise.resolve({})})),getEarphone=function(){return storeData.isApp?promisefiyPostMessage({api:"isWiredHeadsetOn"}):Promise.resolve({})},isSpecialShapedScreen=exports("aM",(function(){return storeData.isApp?promisefiyPostMessage({api:"isSpecialShapedScreen"}):Promise.resolve({})})),startSoundCheck=function(){postMessage({api:"startSoundCheck"})},sendResult=function(e){listenerMessage("sendResult",e)},removeResult=function(e){removeListenerMessage("sendResult",e)},endSoundCheck=function(){postMessage({api:"endSoundCheck"})},startEvaluating=function(e){return storeData.isApp?promisefiyPostMessage({api:"startEvaluating",content:e}):Promise.resolve({})},endEvaluating=function(e){return storeData.isApp?promisefiyPostMessage({api:"endEvaluating",content:e}):Promise.resolve({})},cancelEvaluating=function(){postMessage({api:"cancelEvaluating"})},api_startRecording=function(){return storeData.isApp?promisefiyPostMessage({api:"startRecording"}):Promise.resolve({})},api_stopRecording=function(){return storeData.isApp?promisefiyPostMessage({api:"stopRecording"}):Promise.resolve({})},api_proxyServiceMessage=exports("aa",(function(e){return storeData.isApp?promisefiyPostMessage({api:"proxyServiceMessage",content:e}):Promise.resolve({})})),api_recordStartTime=function(e){listenerMessage("recordStartTime",e)},api_remove_recordStartTime=function(e){removeListenerMessage("recordStartTime",e)},api_videoUpdate=exports("a9",(function(e){postMessage({api:"videoUpdate"},e)})),api_shareAchievements=exports("_",(function(e){return storeData.isApp?promisefiyPostMessage({api:"shareAchievements",content:e}):Promise.resolve({})})),api_openWebView=exports("bg",(function(e){return storeData.isApp?promisefiyPostMessage({api:"openWebView",content:e}):Promise.resolve({})})),api_openCamera=exports("ag",(function(){return storeData.isApp?promisefiyPostMessage({api:"openCamera"}):Promise.resolve({})})),api_closeCamera=exports("ah",(function(){return storeData.isApp?promisefiyPostMessage({api:"closeCamera"}):Promise.resolve({})})),api_setStatusBarVisibility=exports("aE",(function(){postMessage({api:"setStatusBarVisibility",content:{isVisibility:0}})})),api_cloudToggleFollow=function(e){return storeData.isApp?promisefiyPostMessage({api:"cloudToggleFollow",content:{state:e}}):Promise.resolve({})},api_cloudFollowTime=function(e){!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?listenerMessage("cloudFollowTime",e):removeListenerMessage("cloudFollowTime",e)},api_back=exports("az",(function(){postMessage({api:"back"})})),api_cloudLoading=exports("aT",(function(){postMessage({api:"cloudLoading",content:{show:arguments.length>0&&void 0!==arguments[0]&&arguments[0],type:"fullscreen"}})})),api_cloudDestroy=exports("al",(function(){postMessage({api:"cloudDestroy"})})),api_setEventTracking=exports("b6",(function(){postMessage({api:"setEventTracking",content:{type:"klx_xiaokuAI"}})})),api_savePicture=exports("a_",(function(e){return storeData.isApp?promisefiyPostMessage({api:"savePicture",content:e}):Promise.resolve({})})),api_setCache=exports("bb",(function(e){postMessage({api:"setCache",content:e})})),api_suspendPlay=exports("bd",(function(e){listenerMessage("suspendPlay",e)})),api_startCapture=function(){postMessage({api:"startCapture"})},api_endCapture=function(){postMessage({api:"endCapture"})},TheError=exports("T",defineComponent({name:"The-error",setup:function(e,t){return function(){return createVNode("div",null,[createVNode(NavBar,{leftArrow:!0,onClickLeft:function(){api_back()}},null),createVNode(Empty,{image:"error",description:"网络开小差,请稍后重试"},{default:function(){return[createVNode(Button,{type:"primary",size:"small",onClick:function(){return history.go(0)}},{default:function(){return[createTextVNode("重新加载")]}})]}})])}}})),token="%[a-f0-9]{2}",singleMatcher=new RegExp("("+token+")|([^%]+?)","gi"),multiMatcher=new RegExp("("+token+")+","gi");function decodeComponents(e,t){try{return[decodeURIComponent(e.join(""))]}catch(i){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],decodeComponents(n),decodeComponents(r))}function decode$4(e){try{return decodeURIComponent(e)}catch(r){for(var t=e.match(singleMatcher)||[],n=1;n0})).join("&")}function parseUrl(e,t){var n,r,i;t=_objectSpread({decode:!0},t);var a=_slicedToArray(splitOnFirst(e,"#"),2),o=a[0],s=a[1];return void 0===o&&(o=e),_objectSpread({url:null!==(n=null===(r=o)||void 0===r||null===(i=r.split("?"))||void 0===i?void 0:i[0])&&void 0!==n?n:"",query:parse$5(extract(e),t)},t&&t.parseFragmentIdentifier&&s?{fragmentIdentifier:decode$3(s,t)}:{})}function stringifyUrl(e,t){t=_objectSpread(_defineProperty2({encode:!0,strict:!0},encodeFragmentIdentifier,!0),t);var n=removeHash(e.url).split("?")[0]||"",r=stringify$2(_objectSpread(_objectSpread({},parse$5(extract(e.url),{sort:!1})),e.query),t);r&&(r="?".concat(r));var i=getHash(e.url);if(e.fragmentIdentifier){var a=new URL(n);a.hash=e.fragmentIdentifier,i=t[encodeFragmentIdentifier]?a.hash:"#".concat(e.fragmentIdentifier)}return"".concat(n).concat(r).concat(i)}function pick(e,t,n){var r=parseUrl(e,n=_objectSpread(_defineProperty2({parseFragmentIdentifier:!0},encodeFragmentIdentifier,!1),n)),i=r.url,a=r.query,o=r.fragmentIdentifier;return stringifyUrl({url:i,query:includeKeys(a,t),fragmentIdentifier:o},n)}function exclude(e,t,n){return pick(e,Array.isArray(t)?function(e){return!t.includes(e)}:function(e,n){return!t(e,n)},n)}var queryString=Object.freeze(Object.defineProperty({__proto__:null,exclude:exclude,extract:extract,parse:parse$5,parseUrl:parseUrl,pick:pick,stringify:stringify$2,stringifyUrl:stringifyUrl},Symbol.toStringTag,{value:"Module"}));exports("Z",queryString);var getQuery=exports("F",(function(){var e={};try{e=_objectSpread(_objectSpread({},queryString.parse(location.search)),queryString.parse(location.hash.split("?")[1]))}catch(t){}return _objectSpread({},e)})),shams=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"===_typeof2(Symbol.iterator))return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0},origSymbol="undefined"!=typeof Symbol&&Symbol,hasSymbolSham=shams,hasSymbols$1=function(){return"function"==typeof origSymbol&&("function"==typeof Symbol&&("symbol"===_typeof2(origSymbol("foo"))&&("symbol"===_typeof2(Symbol("bar"))&&hasSymbolSham())))},ERROR_MESSAGE="Function.prototype.bind called on incompatible ",slice$1=Array.prototype.slice,toStr$1=Object.prototype.toString,funcType="[object Function]",implementation$1=function(e){var t=this;if("function"!=typeof t||toStr$1.call(t)!==funcType)throw new TypeError(ERROR_MESSAGE+t);for(var n,r=slice$1.call(arguments,1),i=Math.max(0,t.length-r.length),a=[],o=0;o1&&"boolean"!=typeof t)throw new $TypeError$1('"allowMissing" argument must be a boolean');if(null===$exec(/^%?[^%]*%?$/,e))throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=stringToPath(e),r=n.length>0?n[0]:"",i=getBaseIntrinsic("%"+r+"%",t),a=i.name,o=i.value,s=!1,l=i.alias;l&&(r=l[0],$spliceApply(n,$concat$1([0,1],l)));for(var u=1,c=!0;u=n.length){var p=$gOPD(o,h);o=(c=!!p)&&"get"in p&&!("originalValue"in p.get)?p.get:o[h]}else c=hasOwn$1(o,h),o=o[h];c&&!s&&(INTRINSICS[a]=o)}}return o},callBindExports={},callBind$1={get exports(){return callBindExports},set exports(e){callBindExports=e}};!function(t){var n=functionBind,r=getIntrinsic,i=r("%Function.prototype.apply%"),a=r("%Function.prototype.call%"),o=r("%Reflect.apply%",!0)||n.call(a,i),s=r("%Object.getOwnPropertyDescriptor%",!0),l=r("%Object.defineProperty%",!0),u=r("%Math.max%");if(l)try{l({},"a",{value:1})}catch(e){l=null}t.exports=function(e){var t=o(n,a,arguments);s&&l&&(s(t,"length").configurable&&l(t,"length",{value:1+u(0,e.length-(arguments.length-1))}));return t};var c=function(){return o(n,i,arguments)};l?l(t.exports,"apply",{value:c}):t.exports.apply=c}(callBind$1);var GetIntrinsic$1=getIntrinsic,callBind=callBindExports,$indexOf=callBind(GetIntrinsic$1("String.prototype.indexOf")),callBound$1=function(e,t){var n=GetIntrinsic$1(e,!!t);return"function"==typeof n&&$indexOf(e,".prototype.")>-1?callBind(n):n},__viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$0$1=getAugmentedNamespace(__viteBrowserExternal$1),hasMap="function"==typeof Map&&Map.prototype,mapSizeDescriptor=Object.getOwnPropertyDescriptor&&hasMap?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,mapSize=hasMap&&mapSizeDescriptor&&"function"==typeof mapSizeDescriptor.get?mapSizeDescriptor.get:null,mapForEach=hasMap&&Map.prototype.forEach,hasSet="function"==typeof Set&&Set.prototype,setSizeDescriptor=Object.getOwnPropertyDescriptor&&hasSet?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,setSize=hasSet&&setSizeDescriptor&&"function"==typeof setSizeDescriptor.get?setSizeDescriptor.get:null,setForEach=hasSet&&Set.prototype.forEach,hasWeakMap="function"==typeof WeakMap&&WeakMap.prototype,weakMapHas=hasWeakMap?WeakMap.prototype.has:null,hasWeakSet="function"==typeof WeakSet&&WeakSet.prototype,weakSetHas=hasWeakSet?WeakSet.prototype.has:null,hasWeakRef="function"==typeof WeakRef&&WeakRef.prototype,weakRefDeref=hasWeakRef?WeakRef.prototype.deref:null,booleanValueOf=Boolean.prototype.valueOf,objectToString$1=Object.prototype.toString,functionToString=Function.prototype.toString,$match=String.prototype.match,$slice=String.prototype.slice,$replace=String.prototype.replace,$toUpperCase=String.prototype.toUpperCase,$toLowerCase=String.prototype.toLowerCase,$test=RegExp.prototype.test,$concat=Array.prototype.concat,$join=Array.prototype.join,$arrSlice=Array.prototype.slice,$floor=Math.floor,bigIntValueOf="function"==typeof BigInt?BigInt.prototype.valueOf:null,gOPS=Object.getOwnPropertySymbols,symToString="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?Symbol.prototype.toString:null,hasShammedSymbols="function"==typeof Symbol&&"object"===_typeof2(Symbol.iterator),toStringTag="function"==typeof Symbol&&Symbol.toStringTag&&(_typeof2(Symbol.toStringTag)===hasShammedSymbols||"symbol")?Symbol.toStringTag:null,isEnumerable=Object.prototype.propertyIsEnumerable,gPO=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function addNumericSeparator(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||$test.call(/e/,t))return t;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var r=e<0?-$floor(-e):$floor(e);if(r!==e){var i=String(r),a=$slice.call(t,i.length+1);return $replace.call(i,n,"$&_")+"."+$replace.call($replace.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return $replace.call(t,n,"$&_")}var utilInspect=require$$0$1,inspectCustom=utilInspect.custom,inspectSymbol=isSymbol(inspectCustom)?inspectCustom:null,objectInspect=function e(t,n,r,i){var a=n||{};if(has$3(a,"quoteStyle")&&"single"!==a.quoteStyle&&"double"!==a.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(has$3(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=!has$3(a,"customInspect")||a.customInspect;if("boolean"!=typeof o&&"symbol"!==o)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(has$3(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(has$3(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var s=a.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return inspectString(t,a);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var l=String(t);return s?addNumericSeparator(t,l):l}if("bigint"==typeof t){var u=String(t)+"n";return s?addNumericSeparator(t,u):u}var c=void 0===a.depth?5:a.depth;if(void 0===r&&(r=0),r>=c&&c>0&&"object"===_typeof2(t))return isArray$6(t)?"[Array]":"[Object]";var h=getIndent(a,r);if(void 0===i)i=[];else if(indexOf$2(i,t)>=0)return"[Circular]";function d(t,n,o){if(n&&(i=$arrSlice.call(i)).push(n),o){var s={depth:a.depth};return has$3(a,"quoteStyle")&&(s.quoteStyle=a.quoteStyle),e(t,s,r+1,i)}return e(t,a,r+1,i)}if("function"==typeof t&&!isRegExp$1(t)){var f=nameOf(t),p=arrObjKeys(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+$join.call(p,", ")+" }":"")}if(isSymbol(t)){var v=hasShammedSymbols?$replace.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):symToString.call(t);return"object"!==_typeof2(t)||hasShammedSymbols?v:markBoxed(v)}if(isElement(t)){for(var m="<"+$toLowerCase.call(String(t.nodeName)),g=t.attributes||[],y=0;y"}if(isArray$6(t)){if(0===t.length)return"[]";var b=arrObjKeys(t,d);return h&&!singleLineValues(b)?"["+indentedJoin(b,h)+"]":"[ "+$join.call(b,", ")+" ]"}if(isError(t)){var A=arrObjKeys(t,d);return"cause"in Error.prototype||!("cause"in t)||isEnumerable.call(t,"cause")?0===A.length?"["+String(t)+"]":"{ ["+String(t)+"] "+$join.call(A,", ")+" }":"{ ["+String(t)+"] "+$join.call($concat.call("[cause]: "+d(t.cause),A),", ")+" }"}if("object"===_typeof2(t)&&o){if(inspectSymbol&&"function"==typeof t[inspectSymbol]&&utilInspect)return utilInspect(t,{depth:c-r});if("symbol"!==o&&"function"==typeof t.inspect)return t.inspect()}if(isMap(t)){var S=[];return mapForEach&&mapForEach.call(t,(function(e,n){S.push(d(n,t,!0)+" => "+d(e,t))})),collectionOf("Map",mapSize.call(t),S,h)}if(isSet(t)){var x=[];return setForEach&&setForEach.call(t,(function(e){x.push(d(e,t))})),collectionOf("Set",setSize.call(t),x,h)}if(isWeakMap(t))return weakCollectionOf("WeakMap");if(isWeakSet(t))return weakCollectionOf("WeakSet");if(isWeakRef(t))return weakCollectionOf("WeakRef");if(isNumber$1(t))return markBoxed(d(Number(t)));if(isBigInt(t))return markBoxed(d(bigIntValueOf.call(t)));if(isBoolean$1(t))return markBoxed(booleanValueOf.call(t));if(isString$1(t))return markBoxed(d(String(t)));if(!isDate$1(t)&&!isRegExp$1(t)){var w=arrObjKeys(t,d),_=gPO?gPO(t)===Object.prototype:t instanceof Object||t.constructor===Object,E=t instanceof Object?"":"null prototype",k=!_&&toStringTag&&Object(t)===t&&toStringTag in t?$slice.call(toStr(t),8,-1):E?"Object":"",C=(_||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(k||E?"["+$join.call($concat.call([],k||[],E||[]),": ")+"] ":"");return 0===w.length?C+"{}":h?C+"{"+indentedJoin(w,h)+"}":C+"{ "+$join.call(w,", ")+" }"}return String(t)};function wrapQuotes(e,t,n){var r="double"===(n.quoteStyle||t)?'"':"'";return r+e+r}function quote(e){return $replace.call(String(e),/"/g,""")}function isArray$6(e){return!("[object Array]"!==toStr(e)||toStringTag&&"object"===_typeof2(e)&&toStringTag in e)}function isDate$1(e){return!("[object Date]"!==toStr(e)||toStringTag&&"object"===_typeof2(e)&&toStringTag in e)}function isRegExp$1(e){return!("[object RegExp]"!==toStr(e)||toStringTag&&"object"===_typeof2(e)&&toStringTag in e)}function isError(e){return!("[object Error]"!==toStr(e)||toStringTag&&"object"===_typeof2(e)&&toStringTag in e)}function isString$1(e){return!("[object String]"!==toStr(e)||toStringTag&&"object"===_typeof2(e)&&toStringTag in e)}function isNumber$1(e){return!("[object Number]"!==toStr(e)||toStringTag&&"object"===_typeof2(e)&&toStringTag in e)}function isBoolean$1(e){return!("[object Boolean]"!==toStr(e)||toStringTag&&"object"===_typeof2(e)&&toStringTag in e)}function isSymbol(t){if(hasShammedSymbols)return t&&"object"===_typeof2(t)&&t instanceof Symbol;if("symbol"===_typeof2(t))return!0;if(!t||"object"!==_typeof2(t)||!symToString)return!1;try{return symToString.call(t),!0}catch(e){}return!1}function isBigInt(t){if(!t||"object"!==_typeof2(t)||!bigIntValueOf)return!1;try{return bigIntValueOf.call(t),!0}catch(e){}return!1}var hasOwn=Object.prototype.hasOwnProperty||function(e){return e in this};function has$3(e,t){return hasOwn.call(e,t)}function toStr(e){return objectToString$1.call(e)}function nameOf(e){if(e.name)return e.name;var t=$match.call(functionToString.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}function indexOf$2(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;nt.maxStringLength){var n=e.length-t.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return inspectString($slice.call(e,0,t.maxStringLength),t)+r}return wrapQuotes($replace.call($replace.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lowbyte),"single",t)}function lowbyte(e){var t=e.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return n?"\\"+n:"\\x"+(t<16?"0":"")+$toUpperCase.call(t.toString(16))}function markBoxed(e){return"Object("+e+")"}function weakCollectionOf(e){return e+" { ? }"}function collectionOf(e,t,n,r){return e+" ("+t+") {"+(r?indentedJoin(n,r):$join.call(n,", "))+"}"}function singleLineValues(e){for(var t=0;t=0)return!1;return!0}function getIndent(e,t){var n;if("\t"===e.indent)n="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;n=$join.call(Array(e.indent+1)," ")}return{base:n,prev:$join.call(Array(t+1),n)}}function indentedJoin(e,t){if(0===e.length)return"";var n="\n"+t.prev+t.base;return n+$join.call(e,","+n)+"\n"+t.prev}function arrObjKeys(e,t){var n=isArray$6(e),r=[];if(n){r.length=e.length;for(var i=0;i1;){var t=e.pop(),n=t.obj[t.prop];if(isArray$5(n)){for(var r=[],i=0;i=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===formats$2.RFC1738&&(40===l||41===l)?o+=a.charAt(s):l<128?o+=hexTable[l]:l<2048?o+=hexTable[192|l>>6]+hexTable[128|63&l]:l<55296||l>=57344?o+=hexTable[224|l>>12]+hexTable[128|l>>6&63]+hexTable[128|63&l]:(s+=1,l=65536+((1023&l)<<10|1023&a.charCodeAt(s)),o+=hexTable[240|l>>18]+hexTable[128|l>>12&63]+hexTable[128|l>>6&63]+hexTable[128|63&l])}return o},compact=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],r=0;r0?g.join(",")||null:void 0}];else if(isArray$4(l))x=l;else{var _=Object.keys(g);x=u?_.sort(u):_}for(var E=i&&isArray$4(g)&&1===g.length?n+"[]":n,k=0;k0?f+d:""},utils$1=utils$3,has=Object.prototype.hasOwnProperty,isArray$3=Array.isArray,defaults={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:utils$1.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},parseArrayValue=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function(e,t){var n,r={},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,a=t.parameterLimit===1/0?void 0:t.parameterLimit,o=i.split(t.delimiter,a),s=-1,l=t.charset;if(t.charsetSentinel)for(n=0;n-1&&(c=isArray$3(c)?[c]:c),has.call(r,u)?r[u]=utils$1.combine(r[u],c):r[u]=c}return r},parseObject=function(e,t,n,r){for(var i=r?t:parseArrayValue(t,n),a=e.length-1;a>=0;--a){var o,s=e[a];if("[]"===s&&n.parseArrays)o=[].concat(i);else{o=n.plainObjects?Object.create(null):{};var l="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,u=parseInt(l,10);n.parseArrays||""!==l?!isNaN(u)&&s!==l&&String(u)===l&&u>=0&&n.parseArrays&&u<=n.arrayLimit?(o=[])[u]=i:"__proto__"!==l&&(o[l]=i):o={0:i}}i=o}return i},parseKeys=function(e,t,n,r){if(e){var i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/g,o=n.depth>0&&/(\[[^[\]]*])/.exec(i),s=o?i.slice(0,o.index):i,l=[];if(s){if(!n.plainObjects&&has.call(Object.prototype,s)&&!n.allowPrototypes)return;l.push(s)}for(var u=0;n.depth>0&&null!==(o=a.exec(i))&&u-1};function normalizeName(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function normalizeValue(e){return"string"!=typeof e&&(e=String(e)),e}function iteratorFor(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return support.iterable&&(t[Symbol.iterator]=function(){return t}),t}function Headers(e){this.map={},e instanceof Headers?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function consumed(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function fileReaderReady(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function readBlobAsArrayBuffer(e){var t=new FileReader,n=fileReaderReady(t);return t.readAsArrayBuffer(e),n}function readBlobAsText(e){var t=new FileReader,n=fileReaderReady(t);return t.readAsText(e),n}function readArrayBufferAsText(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}function Request(e,t){if(!(this instanceof Request))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n=(t=t||{}).body;if(e instanceof Request){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new Headers(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new Headers(t.headers)),this.method=normalizeMethod(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var r=/([?&])_=[^&]*/;if(r.test(this.url))this.url=this.url.replace(r,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function decode$1(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function parseHeaders(e){var t=new Headers;return e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t}function Response(e,t){if(!(this instanceof Response))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new Headers(t.headers),this.url=t.url||"",this._initBody(e)}Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})},Body.call(Request.prototype),Body.call(Response.prototype),Response.prototype.clone=function(){return new Response(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers(this.headers),url:this.url})},Response.error=function(){var e=new Response(null,{status:0,statusText:""});return e.type="error",e};var redirectStatuses=[301,302,303,307,308];Response.redirect=function(e,t){if(-1===redirectStatuses.indexOf(t))throw new RangeError("Invalid status code");return new Response(null,{status:t,headers:{location:e}})};var DOMException=global$1.DOMException;try{new DOMException}catch(err){DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},DOMException.prototype=Object.create(Error.prototype),DOMException.prototype.constructor=DOMException}function fetch$2(t,n){return new Promise((function(r,i){var a=new Request(t,n);if(a.signal&&a.signal.aborted)return i(new DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function s(){o.abort()}o.onload=function(){var e={status:o.status,statusText:o.statusText,headers:parseHeaders(o.getAllResponseHeaders()||"")};e.url="responseURL"in o?o.responseURL:e.headers.get("X-Request-URL");var t="response"in o?o.response:o.responseText;setTimeout((function(){r(new Response(t,e))}),0)},o.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},o.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},o.onabort=function(){setTimeout((function(){i(new DOMException("Aborted","AbortError"))}),0)},o.open(a.method,function(t){try{return""===t&&global$1.location.href?global$1.location.href:t}catch(e){return t}}(a.url),!0),"include"===a.credentials?o.withCredentials=!0:"omit"===a.credentials&&(o.withCredentials=!1),"responseType"in o&&(support.blob?o.responseType="blob":support.arrayBuffer&&a.headers.get("Content-Type")&&-1!==a.headers.get("Content-Type").indexOf("application/octet-stream")&&(o.responseType="arraybuffer")),!n||"object"!==_typeof2(n.headers)||n.headers instanceof Headers?a.headers.forEach((function(e,t){o.setRequestHeader(t,e)})):Object.getOwnPropertyNames(n.headers).forEach((function(e){o.setRequestHeader(e,normalizeValue(n.headers[e]))})),a.signal&&(a.signal.addEventListener("abort",s),o.onreadystatechange=function(){4===o.readyState&&a.signal.removeEventListener("abort",s)}),o.send(void 0===a._bodyInit?null:a._bodyInit)}))}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread2(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:{global:!1,core:!1,defaultInstance:!1},r=!1,i=!1,a=!1;"number"==typeof n?(process&&process.env,r=!0,i=!1):"object"===_typeof(n)&&n&&(i=n.global||!1,r=n.core||!1,a=n.defaultInstance||!1),i?e.globalMiddlewares.splice(e.globalMiddlewares.length-e.defaultGlobalMiddlewaresLength,0,t):r?e.coreMiddlewares.splice(e.coreMiddlewares.length-e.defaultCoreMiddlewaresLength,0,t):a?this.defaultMiddlewares.push(t):this.middlewares.push(t)}},{key:"execute",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return compose([].concat(_toConsumableArray(this.middlewares),_toConsumableArray(this.defaultMiddlewares),_toConsumableArray(e.globalMiddlewares),_toConsumableArray(e.coreMiddlewares)))(t)}}]),e}();Onion.globalMiddlewares=[],Onion.defaultGlobalMiddlewaresLength=0,Onion.coreMiddlewares=[],Onion.defaultCoreMiddlewaresLength=0;var MapCache=function(){function e(t){_classCallCheck(this,e),this.cache=new Map,this.timer={},this.extendOptions(t)}return _createClass(e,[{key:"extendOptions",value:function(e){this.maxCache=e.maxCache||0}},{key:"get",value:function(e){return this.cache.get(JSON.stringify(e))}},{key:"set",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:6e4;if(this.maxCache>0&&this.cache.size>=this.maxCache){var i=_toConsumableArray(this.cache.keys())[0];this.cache.delete(i),this.timer[i]&&clearTimeout(this.timer[i])}var a=JSON.stringify(e);this.cache.set(a,t),r>0&&(this.timer[a]=setTimeout((function(){n.cache.delete(a),delete n.timer[a]}),r))}},{key:"delete",value:function(e){var t=JSON.stringify(e);return delete this.timer[t],this.cache.delete(t)}},{key:"clear",value:function(){return this.timer={},this.cache.clear()}}]),e}(),RequestError=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"RequestError";return _classCallCheck(this,n),(i=t.call(this,e)).name="RequestError",i.request=r,i.type=a,i}return n}(_wrapNativeSuper(Error)),ResponseError=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,r,i,a){var o,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"ResponseError";return _classCallCheck(this,n),(o=t.call(this,r||e.statusText)).name="ResponseError",o.data=i,o.response=e,o.request=a,o.type=s,o}return n}(_wrapNativeSuper(Error));function readerGBK(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t(r.result)},r.onerror=n,r.readAsText(e,"GBK")}))}function safeJsonParse(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;try{return JSON.parse(t)}catch(e){if(n)throw new ResponseError(r,"JSON.parse fail",t,i,"ParseError")}return t}function timeout2Throw(e,t,n){return new Promise((function(r,i){setTimeout((function(){i(new RequestError(t||"timeout of ".concat(e,"ms exceeded"),n,"Timeout"))}),e)}))}function cancel2Throw(e){return new Promise((function(t,n){e.cancelToken&&e.cancelToken.promise.then((function(e){n(e)}))}))}var toString$2=Object.prototype.toString;function getEnv(){var e;return"undefined"!=typeof process&&"[object process]"===toString$2.call(process)&&(e="NODE"),"undefined"!=typeof XMLHttpRequest&&(e="BROWSER"),e}function isArray$2(e){return"object"===_typeof(e)&&"[object Array]"===Object.prototype.toString.call(e)}function isURLSearchParams(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function isDate(e){return"object"===_typeof(e)&&"[object Date]"===Object.prototype.toString.call(e)}function isObject(e){return null!==e&&"object"===_typeof(e)}function forEach2ObjArr(e,t){if(e)if("object"!==_typeof(e)&&(e=[e]),isArray$2(e))for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=t.prefix,r=t.suffix;return n&&(e="".concat(n).concat(e)),r&&(e="".concat(e).concat(r)),{url:e,options:t}},warnedCoreType=!1;function __defaultValidateCache(e,t){var n=t.method;return"get"===(void 0===n?"get":n).toLowerCase()}function fetchMiddleware(e,t){if(!e)return t();var n=e.req,r=(n=void 0===n?{}:n).options,i=void 0===r?{}:r,a=n.url,o=void 0===a?"":a,s=e.cache,l=e.responseInterceptors,u=i.timeout,c=void 0===u?0:u,h=i.timeoutMessage,d=i.__umiRequestCoreType__,f=void 0===d?"normal":d,p=i.useCache,v=void 0!==p&&p,m=i.method,g=void 0===m?"get":m,y=i.params,b=i.ttl,A=i.validateCache,S=void 0===A?__defaultValidateCache:A;if("normal"!==f)return process&&process.env,t();var x=fetch;if(!x)throw new Error("Global fetch not exist!");var w,_="BROWSER"===getEnv(),E=S(o,i)&&v&&_;if(E){var k=s.get({url:o,params:y,method:g});if(k)return(k=k.clone()).useCache=!0,e.res=k,t()}return w=c>0?Promise.race([cancel2Throw(i),x(o,i),timeout2Throw(c,h,e.req)]):Promise.race([cancel2Throw(i),x(o,i)]),l.forEach((function(e){w=w.then((function(t){var n="function"==typeof t.clone?t.clone():t;return e(n,i)}))})),w.then((function(n){if(E&&200===n.status){var r=n.clone();r.useCache=!0,s.set({url:o,params:y,method:g},r,b)}return e.res=n,t()}))}function parseResponseMiddleware(t,n){var r;return n().then((function(){if(t){var n=t.res,i=void 0===n?{}:n,a=t.req,o=void 0===a?{}:a,s=(o||{}).options,l=(s=void 0===s?{}:s).responseType,u=void 0===l?"json":l,c=s.charset,h=void 0===c?"utf8":c;s.getResponse;var d=s.throwErrIfParseFail,f=void 0!==d&&d,p=s.parseResponse;if((void 0===p||p)&&i&&i.clone){if((r="BROWSER"===getEnv()?i.clone():i).useCache=i.useCache||!1,"gbk"===h)try{return i.blob().then(readerGBK).then((function(e){return safeJsonParse(e,!1,r,o)}))}catch(e){throw new ResponseError(r,e.message,null,o,"ParseError")}else if("json"===u)return i.text().then((function(e){return safeJsonParse(e,f,r,o)}));try{return i[u]()}catch(e){throw new ResponseError(r,"responseType not support",null,o,"ParseError")}}}})).then((function(e){if(t){t.res;var n=t.req,i=void 0===n?{}:n,a=(i||{}).options,o=(a=void 0===a?{}:a).getResponse,s=void 0!==o&&o;if(r){if(r.status>=200&&r.status<300)return s?void(t.res={data:e,response:r}):void(t.res=e);throw new ResponseError(r,"http error",e,i,"HttpError")}}})).catch((function(e){if(e instanceof RequestError||e instanceof ResponseError)throw e;var n=t.req,r=t.res;throw e.request=e.request||n,e.response=e.response||r,e.type=e.type||e.name,e.data=e.data||void 0,e}))}function simplePostMiddleware(e,t){if(!e)return t();var n=e.req,r=(n=void 0===n?{}:n).options,i=void 0===r?{}:r,a=i.method;if(-1===["post","put","patch","delete"].indexOf((void 0===a?"get":a).toLowerCase()))return t();var o=i.requestType,s=void 0===o?"json":o,l=i.data;if(l){var u=Object.prototype.toString.call(l);"[object Object]"===u||"[object Array]"===u?"json"===s?(i.headers=_objectSpread2({Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},i.headers),i.body=JSON.stringify(l)):"form"===s&&(i.headers=_objectSpread2({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},i.headers),i.body=reqStringify(l)):(i.headers=_objectSpread2({Accept:"application/json"},i.headers),i.body=l)}return e.req.options=i,t()}function paramsSerialize(e,t){var n,r;if(e)if(t)n=t(e);else if(isURLSearchParams(e))n=e.toString();else{if(isArray$2(e))r=[],forEach2ObjArr(e,(function(e){null==e?r.push(e):r.push(isObject(e)?JSON.stringify(e):e)})),n=reqStringify(r);else r={},forEach2ObjArr(e,(function(e,t){var n=e;null==e?r[t]=e:isDate(e)?n=e.toISOString():isArray$2(e)?n=e:isObject(e)&&(n=JSON.stringify(e)),r[t]=n})),n=reqStringify(r)}return n}function simpleGetMiddleware(e,t){if(!e)return t();var n=e.req,r=(n=void 0===n?{}:n).options,i=void 0===r?{}:r,a=i.paramsSerializer,o=i.params,s=e.req,l=(s=void 0===s?{}:s).url,u=void 0===l?"":l;i.method=i.method?i.method.toUpperCase():"GET",i.credentials=i.credentials||"same-origin";var c=paramsSerialize(o,a);if(e.req.originUrl=u,c){var h=-1!==u.indexOf("?")?"&":"?";e.req.url="".concat(u).concat(h).concat(c)}return e.req.options=i,t()}var globalMiddlewares=[simplePostMiddleware,simpleGetMiddleware,parseResponseMiddleware],coreMiddlewares=[fetchMiddleware];Onion.globalMiddlewares=globalMiddlewares,Onion.defaultGlobalMiddlewaresLength=globalMiddlewares.length,Onion.coreMiddlewares=coreMiddlewares,Onion.defaultCoreMiddlewaresLength=coreMiddlewares.length;var Core=function(){function t(e){_classCallCheck(this,t),this.onion=new Onion([]),this.fetchIndex=0,this.mapCache=new MapCache(e),this.initOptions=e,this.instanceRequestInterceptors=[],this.instanceResponseInterceptors=[]}return _createClass(t,[{key:"use",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{global:!1,core:!1};return this.onion.use(e,t),this}},{key:"extendOptions",value:function(e){this.initOptions=mergeRequestOptions(this.initOptions,e),this.mapCache.extendOptions(e)}},{key:"dealRequestInterceptors",value:function(e){return[].concat(_toConsumableArray(t.requestInterceptors),_toConsumableArray(this.instanceRequestInterceptors)).reduce((function(t,n){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,n(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(n,r){var i=this,a=this.onion,o={req:{url:n,options:_objectSpread2(_objectSpread2({},r),{},{url:n})},res:null,cache:this.mapCache,responseInterceptors:[].concat(_toConsumableArray(t.responseInterceptors),_toConsumableArray(this.instanceResponseInterceptors))};if("string"!=typeof n)throw new Error("url MUST be a string");return new Promise((function(t,n){i.dealRequestInterceptors(o).then((function(){return a.execute(o)})).then((function(){t(o.res)})).catch((function(r){var i=o.req.options.errorHandler;if(i)try{var a=i(r);t(a)}catch(e){n(e)}else n(r)}))}))}}],[{key:"requestUse",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{global:!0};if("function"!=typeof e)throw new TypeError("Interceptor must be function!");n.global?t.requestInterceptors.push(e):this.instanceRequestInterceptors.push(e)}},{key:"responseUse",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{global:!0};if("function"!=typeof e)throw new TypeError("Interceptor must be function!");n.global?t.responseInterceptors.push(e):this.instanceResponseInterceptors.push(e)}}]),t}();function Cancel(e){this.message=e}function CancelToken(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new Cancel(e),t(n.reason))}))}function isCancel(e){return!(!e||!e.__CANCEL__)}Core.requestInterceptors=[addfix],Core.responseInterceptors=[],Cancel.prototype.toString=function(){return this.message?"Cancel: ".concat(this.message):"Cancel"},Cancel.prototype.__CANCEL__=!0,CancelToken.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},CancelToken.source=function(){var e;return{token:new CancelToken((function(t){e=t})),cancel:e}};var request$1=function(){var e=new Core(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),t=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=mergeRequestOptions(e.initOptions,n);return e.request(t,r)};t.use=e.use.bind(e),t.fetchIndex=e.fetchIndex,t.interceptors={request:{use:Core.requestUse.bind(e)},response:{use:Core.responseUse.bind(e)}};return["get","post","delete","put","patch","head","options","rpc"].forEach((function(e){t[e]=function(n,r){return t(n,_objectSpread2(_objectSpread2({},r),{},{method:e}))}})),t.Cancel=Cancel,t.CancelToken=CancelToken,t.isCancel=isCancel,t.extendOptions=e.extendOptions.bind(e),t.middlewares={instance:e.onion.middlewares,defaultInstance:e.onion.defaultMiddlewares,global:Onion.globalMiddlewares,core:Onion.coreMiddlewares},t},extend$1=function(e){return request$1(e)};request$1({parseResponse:!1});var request$1$1=exports("ap",request$1({})),lodash_isemptyExports={},lodash_isempty={get exports(){return lodash_isemptyExports},set exports(e){lodash_isemptyExports=e}};!function(t,n){var r=9007199254740991,i="[object Arguments]",a="[object Function]",o="[object GeneratorFunction]",s="[object Map]",l="[object Promise]",u="[object Set]",c="[object WeakMap]",h="[object DataView]",d=/^\[object .+?Constructor\]$/,f="object"==_typeof2(commonjsGlobal)&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,p="object"==("undefined"==typeof self?"undefined":_typeof2(self))&&self&&self.Object===Object&&self,v=f||p||Function("return this")(),m=n&&!n.nodeType&&n,g=m&&t&&!t.nodeType&&t,y=g&&g.exports===m;var b=Function.prototype,A=Object.prototype,S=v["__core-js_shared__"],x=function(){var e=/[^.]+$/.exec(S&&S.keys&&S.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),w=b.toString,_=A.hasOwnProperty,E=A.toString,k=RegExp("^"+w.call(_).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),C=y?v.Buffer:void 0,M=A.propertyIsEnumerable,P=C?C.isBuffer:void 0,I=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),T=U(v,"DataView"),B=U(v,"Map"),R=U(v,"Promise"),L=U(v,"Set"),N=U(v,"WeakMap"),F=!M.call({valueOf:1},"valueOf"),D=Q(T),O=Q(B),V=Q(R),z=Q(L),G=Q(N);function H(t){if(!$(t)||(n=t,x&&x in n))return!1;var n,r=J(t)||function(t){var n=!1;if(null!=t&&"function"!=typeof t.toString)try{n=!!(t+"")}catch(e){}return n}(t)?k:d;return r.test(Q(t))}function U(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return H(n)?n:void 0}var j=function(e){return E.call(e)};function Q(t){if(null!=t){try{return w.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Y(e){return function(e){return function(e){return!!e&&"object"==_typeof2(e)}(e)&&X(e)}(e)&&_.call(e,"callee")&&(!M.call(e,"callee")||E.call(e)==i)}(T&&j(new T(new ArrayBuffer(1)))!=h||B&&j(new B)!=s||R&&j(R.resolve())!=l||L&&j(new L)!=u||N&&j(new N)!=c)&&(j=function(e){var t=E.call(e),n="[object Object]"==t?e.constructor:void 0,r=n?Q(n):void 0;if(r)switch(r){case D:return h;case O:return s;case V:return l;case z:return u;case G:return c}return t});var W=Array.isArray;function X(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!J(e)}var K=P||function(){return!1};function J(e){var t=$(e)?E.call(e):"";return t==a||t==o}function $(e){var t=_typeof2(e);return!!e&&("object"==t||"function"==t)}t.exports=function(e){if(X(e)&&(W(e)||"string"==typeof e||"function"==typeof e.splice||K(e)||Y(e)))return!e.length;var t=j(e);if(t==s||t==u)return!e.size;if(F||function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||A)}(e))return!I(e).length;for(var n in e)if(_.call(e,n))return!1;return!0}}(lodash_isempty,lodash_isemptyExports);var objectTag="[object Object]";function isHostObject(t){var n=!1;if(null!=t&&"function"!=typeof t.toString)try{n=!!(t+"")}catch(e){}return n}function overArg(e,t){return function(n){return e(t(n))}}var funcProto=Function.prototype,objectProto=Object.prototype,funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectCtorString=funcToString.call(Object),objectToString=objectProto.toString,getPrototype=overArg(Object.getPrototypeOf,Object);function isObjectLike(e){return!!e&&"object"==_typeof2(e)}function isPlainObject$2(e){if(!isObjectLike(e)||objectToString.call(e)!=objectTag||isHostObject(e))return!1;var t=getPrototype(e);if(null===t)return!0;var n=hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&funcToString.call(n)==objectCtorString}var lodash_isplainobject=isPlainObject$2,lodash_transformExports={},lodash_transform={get exports(){return lodash_transformExports},set exports(e){lodash_transformExports=e}};!function(t,n){var r="__lodash_hash_undefined__",i=1,a=2,o=1/0,s=9007199254740991,l="[object Arguments]",u="[object Array]",c="[object Boolean]",h="[object Date]",d="[object Error]",f="[object Function]",p="[object GeneratorFunction]",v="[object Map]",m="[object Number]",g="[object Object]",y="[object Promise]",b="[object RegExp]",A="[object Set]",S="[object String]",x="[object Symbol]",w="[object WeakMap]",_="[object ArrayBuffer]",E="[object DataView]",k=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,C=/^\w*$/,M=/^\./,P=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,I=/\\(\\)?/g,T=/^\[object .+?Constructor\]$/,B=/^(?:0|[1-9]\d*)$/,R={};R["[object Float32Array]"]=R["[object Float64Array]"]=R["[object Int8Array]"]=R["[object Int16Array]"]=R["[object Int32Array]"]=R["[object Uint8Array]"]=R["[object Uint8ClampedArray]"]=R["[object Uint16Array]"]=R["[object Uint32Array]"]=!0,R[l]=R[u]=R[_]=R[c]=R[E]=R[h]=R[d]=R[f]=R[v]=R[m]=R[g]=R[b]=R[A]=R[S]=R[w]=!1;var L="object"==_typeof2(commonjsGlobal)&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,N="object"==("undefined"==typeof self?"undefined":_typeof2(self))&&self&&self.Object===Object&&self,F=L||N||Function("return this")(),D=n&&!n.nodeType&&n,O=D&&t&&!t.nodeType&&t,V=O&&O.exports===D&&L.process,z=function(){try{return V&&V.binding("util")}catch(e){}}(),G=z&&z.isTypedArray;function H(e,t){for(var n=-1,r=e?e.length:0;++n-1},Ee.prototype.set=function(e,t){var n=this.__data__,r=Ie(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},ke.prototype.clear=function(){this.__data__={hash:new _e,map:new(he||Ee),string:new _e}},ke.prototype.delete=function(e){return He(this,e).delete(e)},ke.prototype.get=function(e){return He(this,e).get(e)},ke.prototype.has=function(e){return He(this,e).has(e)},ke.prototype.set=function(e,t){return He(this,e).set(e,t),this},Ce.prototype.add=Ce.prototype.push=function(e){return this.__data__.set(e,r),this},Ce.prototype.has=function(e){return this.__data__.has(e)},Me.prototype.clear=function(){this.__data__=new Ee},Me.prototype.delete=function(e){return this.__data__.delete(e)},Me.prototype.get=function(e){return this.__data__.get(e)},Me.prototype.has=function(e){return this.__data__.has(e)},Me.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ee){var r=n.__data__;if(!he||r.length<199)return r.push([e,t]),this;n=this.__data__=new ke(r)}return n.set(e,t),this};var Te,Be=function(e,t,n){for(var r=-1,i=Object(e),a=n(e),o=a.length;o--;){var s=a[Te?o:++r];if(!1===t(i[s],s,i))break}return e};function Re(e,t){return e&&Be(e,t,ct)}function Le(e,t){for(var n=0,r=(t=Ye(t,e)?[t]:ze(t)).length;null!=e&&nu))return!1;var h=s.get(e);if(h&&s.get(t))return h==t;var d=-1,f=!0,p=o&i?new Ce:void 0;for(s.set(e,t),s.set(t,e);++d-1&&e%1==0&&e-1&&e%1==0&&e<=s}function at(e){var t=_typeof2(e);return!!e&&("object"==t||"function"==t)}function ot(e){return!!e&&"object"==_typeof2(e)}function st(e){return"symbol"==_typeof2(e)||ot(e)&&te.call(e)==x}var lt,ut=G?(lt=G,function(e){return lt(e)}):function(e){return ot(e)&&it(e.length)&&!!R[te.call(e)]};function ct(e){return nt(e)?Pe(e):Ve(e)}function ht(e){return e}t.exports=function(e,t,n){var r,i=tt(e)||ut(e);if(t=Oe(t),null==n)if(i||at(e)){var a=e.constructor;n=i?tt(e)?new a:[]:rt(a)?at(r=ae(e))?oe(r):{}:{}}else n={};return(i?H:Re)(e,(function(e,r,i){return t(n,e,r,i)})),n}}(lodash_transform,lodash_transformExports);var isEmpty$1=lodash_isemptyExports,isPlainObject$1=lodash_isplainobject,transform=lodash_transformExports,src=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.cleanKeys,i=void 0===r?[]:r,a=n.cleanValues,o=void 0===a?[]:a,s=n.emptyArrays,l=void 0===s||s,u=n.emptyObjects,c=void 0===u||u,h=n.emptyStrings,d=void 0===h||h,f=n.NaNValues,p=void 0!==f&&f,v=n.nullValues,m=void 0===v||v,g=n.undefinedValues,y=void 0===g||g;return transform(t,(function(t,n,r){if(!i.includes(r)&&((Array.isArray(n)||isPlainObject$1(n))&&(n=e(n,{NaNValues:p,cleanKeys:i,cleanValues:o,emptyArrays:l,emptyObjects:c,emptyStrings:d,nullValues:m,undefinedValues:y})),!o.includes(n)&&!(c&&isPlainObject$1(n)&&isEmpty$1(n))&&(!l||!Array.isArray(n)||n.length)&&!(d&&""===n||p&&Number.isNaN(n)||m&&null===n||y&&void 0===n)))return Array.isArray(t)?t.push(n):void(t[r]=n)}))},whiteUrl=function(){return{"/sysMusicScoreCategories/queryTree":"/eduMusicScore/queryTree","/sysMusicScoreAccompaniment/queryPage":queryString.parse(location.search).platform?"/sysMusicScoreAccompaniment/queryPage":"/eduMusicScore/queryPage","/sysMusicScoreAccompaniment/queryPageLimit":"/eduMusicScore/queryPageLimit","/sysMusicScoreAccompaniment/querySubjectIds":"/eduMusicScore/querySubjectIds"}},apiRouter=whiteUrl();browser();var request=exports("E",extend$1({requestType:"form",timeout:1e4}));request.interceptors.request.use((function(e,t){var n=storeData.proxy+storeData.platformApi;"WEB"===storeData.platformType&&apiRouter[e]&&(e=apiRouter[e]);var r=getToken(),i={};return r&&(i.Authorization=r),{url:n+e,options:_objectSpread(_objectSpread({},t),{},{params:src(t.params),data:src(t.data),headers:_objectSpread(_objectSpread({},t.headers),i)})}}),{global:!1}),request.interceptors.response.use(function(){var e=_asyncToGenerator2(_regeneratorRuntime().mark((function e(t,n){var r,i,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t.status>299||t.status<200)){e.next=4;break}throw showToast(r=t.statusText+", 状态码"+t.status),new Error(r);case 4:return e.next=6,t.clone().json();case 6:if(200===(i=e.sent).code||0===i.errCode){e.next=11;break}throw a=i.msg||i.message||"处理失败,请重试",403!==i.code&&401!==i.code&&showToast(a),new Error(a);case 11:return e.abrupt("return",i);case 12:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),{global:!1});var dayjs_minExports={},dayjs_min={get exports(){return dayjs_minExports},set exports(e){dayjs_minExports=e}};!function(e,t){e.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",i="second",a="minute",o="hour",s="day",l="week",u="month",c="quarter",h="year",d="date",f="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},g=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},y={s:g,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?"+":"-")+g(r,2,"0")+":"+g(i,2,"0")},m:function e(t,n){if(t.date()1)return e(o[0])}else{var s=t.name;A[s]=t,i=s}return!r&&i&&(b=i),i||!r&&b},w=function(e,t){if(S(e))return e.clone();var n="object"==_typeof2(t)?t:{};return n.date=e,n.args=arguments,new E(n)},_=y;_.l=x,_.i=S,_.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function m(e){this.$L=x(e.locale,null,!0),this.parse(e)}var g=m.prototype;return g.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(_.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(p);if(r){var i=r[2]-1||0,a=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},g.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},g.$utils=function(){return _},g.isValid=function(){return!(this.$d.toString()===f)},g.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},g.isAfter=function(e,t){return w(e)=0&&e<=1){if(t._volume=e,t._muted)return t;t.usingWebAudio&&t.masterGain.gain.setValueAtTime(e,n.ctx.currentTime);for(var r=0;r=0;t--)e._howls[t].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,c()),e},codecs:function(e){return(this||n)._codecs[e.replace(/^x-/,"")]},_setup:function(){var t=this||n;if(t.state=t.ctx&&t.ctx.state||"suspended",t._autoSuspend(),!t.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(t._canPlayEvent="canplay")}catch(e){t.noAudio=!0}else t.noAudio=!0;try{(new Audio).muted&&(t.noAudio=!0)}catch(e){}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var e=this||n,t=null;try{t="undefined"!=typeof Audio?new Audio:null}catch(err){return e}if(!t||"function"!=typeof t.canPlayType)return e;var r=t.canPlayType("audio/mpeg;").replace(/^no$/,""),i=e._navigator?e._navigator.userAgent:"",a=i.match(/OPR\/([0-6].)/g),o=a&&parseInt(a[0].split("/")[1],10)<33,s=-1!==i.indexOf("Safari")&&-1===i.indexOf("Chrome"),l=i.match(/Version\/(.*?) /),u=s&&l&&parseInt(l[1],10)<15;return e._codecs={mp3:!(o||!r&&!t.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!r,opus:!!t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(t.canPlayType('audio/wav; codecs="1"')||t.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!t.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!t.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(t.canPlayType("audio/x-m4a;")||t.canPlayType("audio/m4a;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(t.canPlayType("audio/x-m4b;")||t.canPlayType("audio/m4b;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(t.canPlayType("audio/x-mp4;")||t.canPlayType("audio/mp4;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(u||!t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(u||!t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!t.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(t.canPlayType("audio/x-flac;")||t.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||n;if(!e._audioUnlocked&&e.ctx){e._audioUnlocked=!1,e.autoUnlock=!1,e._mobileUnloaded||44100===e.ctx.sampleRate||(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var t=function t(n){for(;e._html5AudioPool.length0?s._seek:r._sprite[e][0]/1e3),c=Math.max(0,(r._sprite[e][0]+r._sprite[e][1])/1e3-u),h=1e3*c/Math.abs(s._rate),d=r._sprite[e][0]/1e3,f=(r._sprite[e][0]+r._sprite[e][1])/1e3;s._sprite=e,s._ended=!1;var p=function(){s._paused=!1,s._seek=u,s._start=d,s._stop=f,s._loop=!(!s._loop&&!r._sprite[e][2])};if(!(u>=f)){var v=s._node;if(r._webAudio){var m=function(){r._playLock=!1,p(),r._refreshBuffer(s);var e=s._muted||r._muted?0:s._volume;v.gain.setValueAtTime(e,n.ctx.currentTime),s._playStart=n.ctx.currentTime,void 0===v.bufferSource.start?s._loop?v.bufferSource.noteGrainOn(0,u,86400):v.bufferSource.noteGrainOn(0,u,c):s._loop?v.bufferSource.start(0,u,86400):v.bufferSource.start(0,u,c),h!==1/0&&(r._endTimers[s._id]=setTimeout(r._ended.bind(r,s),h)),t||setTimeout((function(){r._emit("play",s._id),r._loadQueue()}),0)};"running"===n.state&&"interrupted"!==n.ctx.state?m():(r._playLock=!0,r.once("resume",m),r._clearTimer(s._id))}else{var g=function(){v.currentTime=u,v.muted=s._muted||r._muted||n._muted||v.muted,v.volume=s._volume*n.volume(),v.playbackRate=s._rate;try{var i=v.play();if(i&&"undefined"!=typeof Promise&&(i instanceof Promise||"function"==typeof i.then)?(r._playLock=!0,p(),i.then((function(){r._playLock=!1,v._unlocked=!0,t?r._loadQueue():r._emit("play",s._id)})).catch((function(){r._playLock=!1,r._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),s._ended=!0,s._paused=!0}))):t||(r._playLock=!1,p(),r._emit("play",s._id)),v.playbackRate=s._rate,v.paused)return void r._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||s._loop?r._endTimers[s._id]=setTimeout(r._ended.bind(r,s),h):(r._endTimers[s._id]=function(){r._ended(s),v.removeEventListener("ended",r._endTimers[s._id],!1)},v.addEventListener("ended",r._endTimers[s._id],!1))}catch(err){r._emit("playerror",s._id,err)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===v.src&&(v.src=r._src,v.load());var y=window&&window.ejecta||!v.readyState&&n._navigator.isCocoonJS;v.readyState>=3||y?g():(r._playLock=!0,r._state="loading",v.addEventListener(n._canPlayEvent,(function e(){r._state="loaded",g(),v.removeEventListener(n._canPlayEvent,e,!1)}),!1),r._clearTimer(s._id))}return s._id}r._ended(s)},pause:function(e){var t=this;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"pause",action:function(){t.pause(e)}}),t;for(var n=t._getSoundIds(e),r=0;r=0?t=parseInt(a[0],10):e=parseFloat(a[0]):a.length>=2&&(e=parseFloat(a[0]),t=parseInt(a[1],10)),!(void 0!==e&&e>=0&&e<=1))return(r=t?i._soundById(t):i._sounds[0])?r._volume:0;if("loaded"!==i._state||i._playLock)return i._queue.push({event:"volume",action:function(){i.volume.apply(i,a)}}),i;void 0===t&&(i._volume=e),t=i._getSoundIds(t);for(var o=0;o0?r/u:r),h=Date.now();e._fadeTo=n,e._interval=setInterval((function(){var i=(Date.now()-h)/r;h=Date.now(),s+=l*i,s=Math.round(100*s)/100,s=l<0?Math.max(n,s):Math.min(n,s),o._webAudio?e._volume=s:o.volume(s,e._id,!0),a&&(o._volume=s),(nt&&s>=n)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,o.volume(n,e._id),o._emit("fade",e._id))}),c)},_stopFade:function(e){var t=this,r=t._soundById(e);return r&&r._interval&&(t._webAudio&&r._node.gain.cancelScheduledValues(n.ctx.currentTime),clearInterval(r._interval),r._interval=null,t.volume(r._fadeTo,e),r._fadeTo=null,t._emit("fade",e)),t},loop:function(){var e,t,n,r=this,i=arguments;if(0===i.length)return r._loop;if(1===i.length){if("boolean"!=typeof i[0])return!!(n=r._soundById(parseInt(i[0],10)))&&n._loop;e=i[0],r._loop=e}else 2===i.length&&(e=i[0],t=parseInt(i[1],10));for(var a=r._getSoundIds(t),o=0;o=0?t=parseInt(a[0],10):e=parseFloat(a[0]):2===a.length&&(e=parseFloat(a[0]),t=parseInt(a[1],10)),"number"!=typeof e)return(r=i._soundById(t))?r._rate:i._rate;if("loaded"!==i._state||i._playLock)return i._queue.push({event:"rate",action:function(){i.rate.apply(i,a)}}),i;void 0===t&&(i._rate=e),t=i._getSoundIds(t);for(var o=0;o=0?t=parseInt(i[0],10):r._sounds.length&&(t=r._sounds[0]._id,e=parseFloat(i[0])):2===i.length&&(e=parseFloat(i[0]),t=parseInt(i[1],10)),void 0===t)return 0;if("number"==typeof e&&("loaded"!==r._state||r._playLock))return r._queue.push({event:"seek",action:function(){r.seek.apply(r,i)}}),r;var a=r._soundById(t);if(a){if(!("number"==typeof e&&e>=0)){if(r._webAudio){var o=r.playing(t)?n.ctx.currentTime-a._playStart:0,s=a._rateSeek?a._rateSeek-a._seek:0;return a._seek+(s+o*Math.abs(a._rate))}return a._node.currentTime}var l=r.playing(t);l&&r.pause(t,!0),a._seek=e,a._ended=!1,r._clearTimer(t),r._webAudio||!a._node||isNaN(a._node.duration)||(a._node.currentTime=e);var u=function(){l&&r.play(t,!0),r._emit("seek",t)};l&&!r._webAudio?setTimeout((function e(){r._playLock?setTimeout(e,0):u()}),0):u()}return r},playing:function(e){var t=this;if("number"==typeof e){var n=t._soundById(e);return!!n&&!n._paused}for(var r=0;r=0&&n._howls.splice(i,1);var o=!0;for(r=0;r=0){o=!1;break}return a&&o&&delete a[e._src],n.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,t,n,r){var i=this["_on"+e];return"function"==typeof t&&i.push(r?{id:n,fn:t,once:r}:{id:n,fn:t}),this},off:function(e,t,n){var r=this,i=r["_on"+e],a=0;if("number"==typeof t&&(n=t,t=null),t||n)for(a=0;a=0;a--)i[a].id&&i[a].id!==t&&"load"!==e||(setTimeout(function(e){e.call(this,t,n)}.bind(r,i[a].fn),0),i[a].once&&r.off(e,i[a].fn,i[a].id));return r._loadQueue(e),r},_loadQueue:function(e){var t=this;if(t._queue.length>0){var n=t._queue[0];n.event===e&&(t._queue.shift(),t._loadQueue()),e||n.action()}return t},_ended:function(e){var t=this,r=e._sprite;if(!t._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime=0;r--){if(n<=t)return;e._sounds[r]._ended&&(e._webAudio&&e._sounds[r]._node&&e._sounds[r]._node.disconnect(0),e._sounds.splice(r,1),n--)}}},_getSoundIds:function(e){if(void 0===e){for(var t=[],n=0;n=0;if(n._scratchBuffer&&t.bufferSource&&(t.bufferSource.onended=null,t.bufferSource.disconnect(0),r))try{t.bufferSource.buffer=n._scratchBuffer}catch(e){}return t.bufferSource=null,this},_clearSound:function(e){/MSIE |Trident\//.test(n._navigator&&n._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var i=function(e){this._parent=e,this.init()};i.prototype={init:function(){var e=this,t=e._parent;return e._muted=t._muted,e._loop=t._loop,e._volume=t._volume,e._rate=t._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,t._sounds.push(e),e.create(),e},create:function(){var e=this,t=e._parent,r=n._muted||e._muted||e._parent._muted?0:e._volume;return t._webAudio?(e._node=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),e._node.gain.setValueAtTime(r,n.ctx.currentTime),e._node.paused=!0,e._node.connect(n.masterGain)):n.noAudio||(e._node=n._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(n._canPlayEvent,e._loadFn,!1),e._endFn=e._endListener.bind(e),e._node.addEventListener("ended",e._endFn,!1),e._node.src=t._src,e._node.preload=!0===t._preload?"auto":t._preload,e._node.volume=r*n.volume(),e._node.load()),e},reset:function(){var e=this,t=e._parent;return e._muted=t._muted,e._loop=t._loop,e._volume=t._volume,e._rate=t._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,t=e._parent;t._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue()),e._node.removeEventListener(n._canPlayEvent,e._loadFn,!1)},_endListener:function(){var e=this,t=e._parent;t._duration===1/0&&(t._duration=Math.ceil(10*e._node.duration)/10,t._sprite.__default[1]===1/0&&(t._sprite.__default[1]=1e3*t._duration),t._ended(e)),e._node.removeEventListener("ended",e._endFn,!1)}};var a={},o=function(e){var t=e._src;if(a[t])return e._duration=a[t].duration,void u(e);if(/^data:[^;]+;base64,/.test(t)){for(var n=atob(t.split(",")[1]),r=new Uint8Array(n.length),i=0;i0?(a[t._src]=e,u(t,e)):r()};"undefined"!=typeof Promise&&1===n.ctx.decodeAudioData.length?n.ctx.decodeAudioData(e).then(i).catch(r):n.ctx.decodeAudioData(e,i,r)},u=function(e,t){t&&!e._duration&&(e._duration=t.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},c=function(){if(n.usingWebAudio){try{"undefined"!=typeof AudioContext?n.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?n.ctx=new webkitAudioContext:n.usingWebAudio=!1}catch(e){n.usingWebAudio=!1}n.ctx||(n.usingWebAudio=!1);var t=/iP(hone|od|ad)/.test(n._navigator&&n._navigator.platform),r=n._navigator&&n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),i=r?parseInt(r[1],10):null;if(t&&i&&i<9){var a=/safari/.test(n._navigator&&n._navigator.userAgent.toLowerCase());n._navigator&&!a&&(n.usingWebAudio=!1)}n.usingWebAudio&&(n.masterGain=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),n.masterGain.gain.setValueAtTime(n._muted?0:n._volume,n.ctx.currentTime),n.masterGain.connect(n.ctx.destination)),n._setup()}};exports$1.Howler=n,exports$1.Howl=r,void 0!==commonjsGlobal?(commonjsGlobal.HowlerGlobal=t,commonjsGlobal.Howler=n,commonjsGlobal.Howl=r,commonjsGlobal.Sound=i):"undefined"!=typeof window&&(window.HowlerGlobal=t,window.Howler=n,window.Howl=r,window.Sound=i)}(), /*! * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported. * * howler.js v2.2.3 * howlerjs.com * * (c) 2013-2020, James Simpson of GoldFire Studios * goldfirestudios.com * * MIT License */ function(){var e;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var t=this;if(!t.ctx||!t.ctx.listener)return t;for(var n=t._howls.length-1;n>=0;n--)t._howls[n].stereo(e);return t},HowlerGlobal.prototype.pos=function(e,t,n){var r=this;return r.ctx&&r.ctx.listener?(t="number"!=typeof t?r._pos[1]:t,n="number"!=typeof n?r._pos[2]:n,"number"!=typeof e?r._pos:(r._pos=[e,t,n],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(e,t,n,r,i,a){var o=this;if(!o.ctx||!o.ctx.listener)return o;var s=o._orientation;return t="number"!=typeof t?s[1]:t,n="number"!=typeof n?s[2]:n,r="number"!=typeof r?s[3]:r,i="number"!=typeof i?s[4]:i,a="number"!=typeof a?s[5]:a,"number"!=typeof e?s:(o._orientation=[e,t,n,r,i,a],void 0!==o.ctx.listener.forwardX?(o.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),o.ctx.listener.forwardY.setTargetAtTime(t,Howler.ctx.currentTime,.1),o.ctx.listener.forwardZ.setTargetAtTime(n,Howler.ctx.currentTime,.1),o.ctx.listener.upX.setTargetAtTime(r,Howler.ctx.currentTime,.1),o.ctx.listener.upY.setTargetAtTime(i,Howler.ctx.currentTime,.1),o.ctx.listener.upZ.setTargetAtTime(a,Howler.ctx.currentTime,.1)):o.ctx.listener.setOrientation(e,t,n,r,i,a),o)},Howl.prototype.init=(e=Howl.prototype.init,function(t){var n=this;return n._orientation=t.orientation||[1,0,0],n._stereo=t.stereo||null,n._pos=t.pos||null,n._pannerAttr={coneInnerAngle:void 0!==t.coneInnerAngle?t.coneInnerAngle:360,coneOuterAngle:void 0!==t.coneOuterAngle?t.coneOuterAngle:360,coneOuterGain:void 0!==t.coneOuterGain?t.coneOuterGain:0,distanceModel:void 0!==t.distanceModel?t.distanceModel:"inverse",maxDistance:void 0!==t.maxDistance?t.maxDistance:1e4,panningModel:void 0!==t.panningModel?t.panningModel:"HRTF",refDistance:void 0!==t.refDistance?t.refDistance:1,rolloffFactor:void 0!==t.rolloffFactor?t.rolloffFactor:1},n._onstereo=t.onstereo?[{fn:t.onstereo}]:[],n._onpos=t.onpos?[{fn:t.onpos}]:[],n._onorientation=t.onorientation?[{fn:t.onorientation}]:[],e.call(this,t)}),Howl.prototype.stereo=function(e,n){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(e,n)}}),r;var i=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===n){if("number"!=typeof e)return r._stereo;r._stereo=e,r._pos=[e,0,0]}for(var a=r._getSoundIds(n),o=0;o=a))break;t=i,r=a}if(t>-1&&metronomeData.activeIndex!==t)return metronomeData.activeIndex=t,metronomeData.activeMetro=n.getStep(r),n.playAudio(),void(metronomeData.isClick=!1);toggleLine(),metronomeData.isClick=!1})),_defineProperty2(this,"playAudio",(function(){var e;metronomeData.initPlayerState&&(n.source=0===(null===(e=metronomeData.activeMetro)||void 0===e?void 0:e.index)?n.source1:n.source2,n.source.volume(metronomeData.disable||"paused"===state$1.playState?0:.4),n.source.play())})),_defineProperty2(this,"loadAudio1",(function(){return new howler.Howl({src:tockAndTick.tick})})),_defineProperty2(this,"loadAudio2",(function(){return new howler.Howl({src:tockAndTick.tock})}))}return _createClass2(e,[{key:"init",value:function(e){this.calculation(e),metronomeData.activeList=[]}},{key:"initPlayer",value:function(){this.source1||(this.source1=this.loadAudio1()),this.source2||(this.source2=this.loadAudio2()),metronomeData.initPlayerState=!0}},{key:"selectPlay",value:function(){}},{key:"getStep",value:function(e){for(var t=0;t-1&&u!=r){var h,d,f,p,v,m,g,y,b,A={measureNumberXML:u,measureNumberIndex:c,numerator:(null==l||null===(h=l.noteElement)||void 0===h||null===(d=h.sourceMeasure)||void 0===d||null===(f=d.ActiveTimeSignature)||void 0===f?void 0:f.numerator)||0,start:l.measures[0].time,end:l.measures[l.measures.length-1].endtime,time:l.measures[l.measures.length-1].endtime-l.measures[0].time,stave_x:(null==l||null===(p=l.noteElement)||void 0===p||null===(v=p.sourceMeasure)||void 0===v||null===(m=v.verticalMeasureList)||void 0===m||null===(g=m[0])||void 0===g||null===(y=g.stave)||void 0===y?void 0:y.x)||0,end_x:(null==l||null===(b=l.stave)||void 0===b?void 0:b.end_x)||0,stepList:[],svgs:[],isRestFlag:l.isRestFlag};if([121].includes(state$1.subjectId)){var S=e.filter((function(e){var t,n;return(null==e||null===(t=e.noteElement)||void 0===t||null===(n=t.sourceMeasure)||void 0===n?void 0:n.measureListIndex)==c}));l.measures=S,A.start=l.measures[0].time,A.end=l.measures[l.measures.length-1].endtime,A.time=l.measures[l.measures.length-1].endtime-l.measures[0].time;try{var x=l.noteElement.sourceMeasure.verticalMeasureList.reduce((function(e,t){return e.push.apply(e,_toConsumableArray2(t.vfVoices[1].tickables)),e}),[]),w=[];A.svgs=x.map((function(e){var t=e.getBoundingBox().x;if(!w.includes(t)&&"w"!==e.duration)return w.push(t),e._start_x=t,e})).filter(Boolean).sort((function(e,t){return e._start_x-t._start_x}))}catch(_){console.log(_)}A.stepList=calculateMutilpleMetroStep(l.measures,A)}else A.stepList=calculateMetroStep(l.measures,A);n.push(A),r=u}},a=0;a-1?"".concat(m," + ").concat(h,"%"):"".concat(m,"px + ").concat(h,"%"):"".concat(h,"%"),u.stepList[d]=v}s[l].push({index:d,time:p,left:(null===(f=v)||void 0===f?void 0:f.indexOf("%"))>-1?"calc(".concat(v,")"):v,measureNumberXML:u.measureNumberXML,isRestFlag:u.isRestFlag})}}}catch(g){console.log(g)}metronomeData.metroList=o,metronomeData.metroMeasure=s,metronomeData.activeMetro=(null===(t=s[0])||void 0===t?void 0:t[0])||{}}}]),e}();function calculateMetroStep(e,t){var n=e.reduce((function(e,t){return e+=t._noteLength}),0),r=n/t.numerator;if(1===e.length){var i=e[0].svgElement;if(i&&!i.isRest()){for(var a,o,s,l,u,c,h,d,f=(null==i||null===(a=i.attrs)||void 0===a||null===(o=a.el)||void 0===o||null===(s=o.parentElement)||void 0===s||null===(l=s.parentElement)||void 0===l||null===(u=l.getBoundingClientRect)||void 0===u?void 0:u.call(l))||{x:0,right:0},p=(null==i||null===(c=i.attrs)||void 0===c||null===(h=c.el)||void 0===h||null===(d=h.getBoundingClientRect)||void 0===d?void 0:d.call(h))||{x:0},v=Math.abs(f.right-p.x)/t.numerator,m=[],g=0;g=1){var D,O,V,z,G,H,U,j,Q,Y,W,X;T-=r;var K=(null==N||null===(D=N.svgElement)||void 0===D||null===(O=D.attrs)||void 0===O||null===(V=O.el)||void 0===V||null===(z=V.parentElement)||void 0===z||null===(G=z.parentElement)||void 0===G||null===(H=(U=G).getBoundingClientRect)||void 0===H?void 0:H.call(U))||{x:0};if(B.length>0){var J,$,q,Z,ee,te,ne=(null===(J=B[0])||void 0===J||null===($=J.svgElement)||void 0===$||null===(q=$.attrs)||void 0===q||null===(Z=q.el)||void 0===Z||null===(ee=(te=Z).getBoundingClientRect)||void 0===ee?void 0:ee.call(te))||{x:0},re=ne.x-K.x;if(B[0]._noteLength/r>=1){var ie,ae,oe,se,le,ue,ce=(null===(ie=e[B[0].index+1])||void 0===ie||null===(ae=ie.svgElement)||void 0===ae||null===(oe=ae.attrs)||void 0===oe||null===(se=oe.el)||void 0===se||null===(le=(ue=se).getBoundingClientRect)||void 0===le?void 0:le.call(ue))||{x:K.right},he=Math.abs(ne.x-ce.x)/2;re=ne.x-K.x+he}R.push(re)}else{var de,fe,pe,ve,me,ge=((null==N||null===(de=N.svgElement)||void 0===de||null===(fe=de.attrs)||void 0===fe||null===(pe=fe.el)||void 0===pe||null===(ve=(me=pe).getBoundingClientRect)||void 0===ve?void 0:ve.call(me))||{x:0}).x-K.x;R.push(ge)}B=[];var ye=(null==N||null===(j=N.svgElement)||void 0===j||null===(Q=j.attrs)||void 0===Q||null===(Y=Q.el)||void 0===Y||null===(W=(X=Y).getBoundingClientRect)||void 0===W?void 0:W.call(X))||{x:0},be=ye.x-K.x,Ae=0;if(F>1){var Se,xe,we,_e,Ee,ke,Ce=(null===(Se=e[L+1])||void 0===Se||null===(xe=Se.svgElement)||void 0===xe||null===(we=xe.attrs)||void 0===we||null===(_e=we.el)||void 0===_e||null===(Ee=(ke=_e).getBoundingClientRect)||void 0===Ee?void 0:Ee.call(ke))||{x:K.right};Ae=Math.abs(ye.x-Ce.x)/F}for(var Me=1;MeNumber.EPSILON&&T>0&&B.push(N)}return R=R.reduce((function(e,t){return e.includes(t)?e.push(void 0):e.push(t),e}),[]),R}function calculateMutilpleMetroStep(e,t){var n,r,i,a,o,s,l,u=t.time/t.numerator,c=(null===(n=e[0])||void 0===n||null===(r=n.svgElement)||void 0===r||null===(i=r.attrs)||void 0===i||null===(a=i.el)||void 0===a||null===(o=a.parentElement)||void 0===o||null===(s=o.parentElement)||void 0===s||null===(l=s.getBoundingClientRect)||void 0===l?void 0:l.call(s))||{x:0};if(1===e.length){var h,d,f,p=t.svgs[0],v=(null==p||null===(h=p.attrs)||void 0===h||null===(d=h.el)||void 0===d||null===(f=d.getBoundingClientRect)||void 0===f?void 0:f.call(d))||{x:0};return p&&!p.isRest()?[v.x-c.x]:[]}for(var m=0,g=[],y=[],b=0;bu){m-=u;var P,I,T,B,R,L=M.x-c.x;if(g.length>0)L=(M=(null===(T=C=null===(P=t.svgs[g[0]._index])||void 0===P||null===(I=P.attrs)||void 0===I?void 0:I.el)||void 0===T||null===(B=(R=T).getBoundingClientRect)||void 0===B?void 0:B.call(R))||{x:0}).x-c.x;y.push(L),g=[]}else g.push(E);if(Math.abs(m-u)<.001){var N,F,D,O,V,z=M.x-c.x;if(g.length>0)z=(M=(null===(D=C=null===(N=t.svgs[g[0]._index])||void 0===N||null===(F=N.attrs)||void 0===F?void 0:F.el)||void 0===D||null===(O=(V=D).getBoundingClientRect)||void 0===O?void 0:O.call(V))||{x:0}).x-c.x;y.push(z),m=0,g=[]}}return y=y.reduce((function(e,t){return e.includes(t)?e.push(void 0):e.push(t),e}),[]),y}function setCurrentTime(e){return browserInfo$3.huawei||browserInfo$3.xiaomi?e+=.125:browserInfo$3.android?e+=.11:browserInfo$3.ios&&(e+=.01),e}exports("aR",Metronome);var GradualVersion=function(e){return e[e.BASE=0]="BASE",e[e.ENSEMBLE=1]="ENSEMBLE",e}(GradualVersion||{}),scoreMode="_scoreMode_11hmk_1",styles$4={scoreMode:scoreMode},context={locks:{},zIndex:2e3,enableRipple:!0};reactive(context);var Context=reactive(context),isString=function(e){return"string"==typeof e},isBoolean=function(e){return"boolean"==typeof e},isNumber=function(e){return"number"==typeof e},isPlainObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},isArray$1=function(e){return Array.isArray(e)},isURL=function(e){return!!e&&/^(http)|(\.*\/)/.test(e)},toNumber=function(e){return null==e?0:isString(e)?(e=parseFloat(e),e=Number.isNaN(e)?0:e):isBoolean(e)?Number(e):e},inBrowser=function(){return"undefined"!=typeof window};function getViewportSize(){var e=window,t=e.innerWidth,n=e.innerHeight;return t>n?{vMin:n,vMax:t}:{vMin:t,vMax:n}}var isRem=function(e){return isString(e)&&e.endsWith("rem")},isPx=function(e){return isString(e)&&e.endsWith("px")||isNumber(e)},isPercent=function(e){return isString(e)&&e.endsWith("%")},isVw=function(e){return isString(e)&&e.endsWith("vw")},isVh=function(e){return isString(e)&&e.endsWith("vh")},isVMin=function(e){return isString(e)&&e.endsWith("vmin")},isVMax=function(e){return isString(e)&&e.endsWith("vmax")},isCalc=function(e){return isString(e)&&e.startsWith("calc(")},isVar=function(e){return isString(e)&&e.startsWith("var(")},toPxNum=function(e){if(isNumber(e))return e;if(isPx(e))return+e.replace("px","");if(isVw(e))return+e.replace("vw","")*window.innerWidth/100;if(isVh(e))return+e.replace("vh","")*window.innerHeight/100;if(isRem(e)){var t=+e.replace("rem",""),n=window.getComputedStyle(document.documentElement).fontSize;return t*parseFloat(n)}return isVMin(e)?getViewportSize().vMin:isVMax(e)?getViewportSize().vMax:isString(e)?toNumber(e):0},toSizeUnit=function(e){if(null!=e)return isPercent(e)||isVw(e)||isVh(e)||isRem(e)||isCalc(e)||isVar(e)||isVMin(e)||isVMax(e)?e:toPxNum(e)+"px"},multiplySizeUnit=function(e,t){if(void 0===t&&(t=1),null!=e){var n=toSizeUnit(e),r=n.match(/(vh|%|rem|px|vw)$/)[0];return""+parseFloat(n)*t+r}};function useMounted(e){var t=!1;onMounted((function(){e(),nextTick((function(){t=!0}))})),onActivated((function(){t&&e()}))}function useEventListener(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(inBrowser()){var i,a=r.passive,o=void 0!==a&&a,s=r.capture,l=void 0!==s&&s,u=!1,c=!1,h=function(e){if(!u&&!c){var r=unref(e);r&&(r.addEventListener(t,n,{passive:o,capture:l}),u=!0)}},d=function(e){if(u&&!c){var r=unref(e);r&&(r.removeEventListener(t,n,{capture:l}),u=!1)}};isRef(e)&&(i=watch((function(){return e.value}),(function(e,t){d(t),h(e)})));return useMounted((function(){h(e)})),onBeforeUnmount((function(){d(e)})),onDeactivated((function(){d(e)})),function(){null==i||i(),d(e),c=!0}}}function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),r=1;r20&&e<=40?t=1:e>40&&e<=60?t=2:e>60&&e<=80?t=3:e>80&&(t=4),_objectSpread(_objectSpread({},icons[t]),{},{leve:t})},getLeveByScoreMeasure=function(e){if(!e&&"number"!=typeof e)return{};var t=0;return e>=40&&e<70?t=1:e>=70&&e<90?t=2:e>=90&&(t=3),t},audioList="_audioList_1j0z3_1",styles$3={audioList:audioList},timer=null,midiData=reactive({iframeRef:null,playing:!1,index:0,rate:1}),playNote=function e(){var t,n;if(midiData.playing){var r=state$1.times[midiData.index];if(r){midiData.index++;var i=r.endtime-r.time;null===(t=midiData.iframeRef)||void 0===t||null===(n=t.contentWindow)||void 0===n||n.playNote(r.realKey,i),timer=setTimeout((function(){e()}),i/midiData.rate*1e3)}else onEnded()}},stopPlay=function(){midiData.playing=!1},hanldeInitMidiData=function(e){midiData.iframeRef=e},handleTogglePlayMidi=function(e){"play"===e?(midiData.playing=!0,playNote(),onPlay()):stopPlay()},hanldeSetMidiPlaybackRate=function(e){midiData.rate=e},getMidiCurrentTime=function(){var e=midiData.index-1;return e=e<0?0:e,state$1.times[e].time},getMidiDuration=function(){return state$1.times[state$1.times.length-1].endtime},setMidiCurrentTime=function(e){clearTimeout(timer),midiData.index=e,playNote()},audioData=reactive({songEle:null,backgroundEle:null,midiRender:!1}),midiRef=ref(),audioListStart=function(e){var t,n;if("play"===e&&0!==state$1.originSpeed&&setAudioPlaybackRate(state$1.speed/state$1.originSpeed),audioData.midiRender)handleTogglePlayMidi(e);else if("play"===e)null===(t=audioData.songEle)||void 0===t||t.play(),null===(n=audioData.backgroundEle)||void 0===n||n.play();else if("paused"===e){var r,i;null===(r=audioData.songEle)||void 0===r||r.pause(),null===(i=audioData.backgroundEle)||void 0===i||i.pause()}},setAudioPlaybackRate=function(e){audioData.midiRender?hanldeSetMidiPlaybackRate(e):(audioData.songEle&&(audioData.songEle.playbackRate=e),audioData.backgroundEle&&(audioData.backgroundEle.playbackRate=e))},getAudioCurrentTime=exports("b3",(function(){var e,t,n;return audioData.midiRender?getMidiCurrentTime():"music"===state$1.playSource?null===(e=audioData.songEle)||void 0===e?void 0:e.currentTime:"background"===state$1.playSource?null===(t=audioData.backgroundEle)||void 0===t?void 0:t.currentTime:null===(n=audioData.songEle)||void 0===n?void 0:n.currentTime})),getAudioDuration=exports("bj",(function(){var e,t;return audioData.midiRender?getMidiDuration():(null===(e=audioData.songEle)||void 0===e?void 0:e.duration)||(null===(t=audioData.backgroundEle)||void 0===t?void 0:t.duration)||0})),setAudioCurrentTime=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;audioData.midiRender?setMidiCurrentTime(t):(audioData.songEle&&(audioData.songEle.currentTime=e),audioData.backgroundEle&&(audioData.backgroundEle.currentTime=e))},toggleMutePlayAudio=function(e,t){"music"===e?audioData.songEle&&(audioData.songEle.muted=t):"background"===e&&audioData.backgroundEle&&(audioData.backgroundEle.muted=t)},AudioList=exports("aK",defineComponent({name:"audio-list",setup:function(){var e=function(){midiRef.value.contentWindow.handleRendered=function(){audioData.midiRender=!0},hanldeInitMidiData(midiRef.value)};watch((function(){return state$1.playSource}),(function(){"evaluating"!==state$1.modeType||state$1.setting.enableAccompaniment?"music"===state$1.playSource?(audioData.songEle&&(audioData.songEle.muted=!1),audioData.backgroundEle&&(audioData.backgroundEle.muted=!0)):(audioData.songEle&&(audioData.songEle.muted=!0),audioData.backgroundEle&&(audioData.backgroundEle.muted=!1)):console.log("评测模式设置了关闭伴奏,不切换原音伴奏")}));var t=function(e){return new Promise((function(t){var n=new Audio(e);n.load(),n.onloadedmetadata=function(){t(n)},n.onerror=function(){t(null)}}))};return onMounted((function(){"MIDI"!==state$1.playMode&&Promise.all([t(state$1.music),t(state$1.accompany)]).then((function(e){var t=_slicedToArray(e,2),n=t[0],r=t[1];n&&(audioData.songEle=n),r&&(audioData.backgroundEle=r),audioData.songEle?(audioData.songEle.addEventListener("play",onPlay),audioData.songEle.addEventListener("ended",onEnded),r&&(r.muted=!0)):audioData.backgroundEle&&(audioData.backgroundEle.addEventListener("play",onPlay),audioData.backgroundEle.addEventListener("ended",onEnded))}))})),function(){return createVNode("div",{class:styles$3.audioList},["MIDI"===state$1.playMode&&0!=state$1.speed&&createVNode("iframe",{style:{display:"none"},ref:midiRef,src:"/midi/index.html",onLoad:e},null)])}}})),browserInfo$2=browser(),evaluatingData=exports("X",reactive({contentData:{},rendered:!1,earphone:!1,soundEffect:!1,soundEffectFrequency:0,checkStep:0,checkEnd:!1,earphoneMode:!1,soundEffectMode:!1,websocketState:!1,startBegin:!1,backtime:0,evaluatings:{},resultData:{},resulstMode:!1,isComplete:!1})),handleStartEvaluat=exports("a8",(function(){"evaluating"===state$1.modeType?handleCancelEvaluat():handleStopPlay(),state$1.modeType="evaluating"===state$1.modeType?"practise":"evaluating","evaluating"!==state$1.modeType&&(evaluatingData.rendered=!1),evaluatingData.checkEnd=!1})),check_currentTime=function e(){var t=0;state$1.isSelectMeasureMode&&(t=1e3*state$1.section[0].time),1e3*getAudioCurrentTime()-t>=500?sendEvaluatingOffsetTime(500):setTimeout((function(){e()}),10)},sendEvaluatingOffsetTime=function(){var e=_asyncToGenerator2(_regeneratorRuntime().mark((function e(t){var n,r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(evaluatingData.backtime){e.next=2;break}return e.abrupt("return");case 2:return n=Date.now(),r=n-evaluatingData.backtime-t,console.error("真正播放延迟",r,"currentTime:",t),e.next=7,api_proxyServiceMessage({header:{commond:"audioPlayStart",type:"SOUND_COMPARE"},body:{offsetTime:r<0?0:r,micDelay:0}});case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),checkUseEarphone=function(){var e=_asyncToGenerator2(_regeneratorRuntime().mark((function e(){var t,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,getEarphone();case 2:return n=e.sent,e.abrupt("return",(null==n||null===(t=n.content)||void 0===t?void 0:t.checkIsWired)||!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),handleStartSoundCheck=function(){startSoundCheck()},handleEndSoundCheck=exports("a6",(function(){endSoundCheck()})),connectWebsocket=exports("ab",function(){var e=_asyncToGenerator2(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:evaluatingData.contentData=t,evaluatingData.websocketState=!0;case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),handlePerformDetection=exports("a1",_asyncToGenerator2(_regeneratorRuntime().mark((function e(){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!evaluatingData.checkEnd){e.next=2;break}return e.abrupt("return");case 2:if(0!==evaluatingData.checkStep){e.next=9;break}return e.next=5,checkUseEarphone();case 5:return t=e.sent,evaluatingData.checkStep=1,t?handlePerformDetection():evaluatingData.earphoneMode=!0,e.abrupt("return");case 9:if(1!==evaluatingData.checkStep){e.next=13;break}return evaluatingData.checkStep=10,state$1.setting.soundEffect&&!state$1.isPercussion?(evaluatingData.soundEffectMode=!0,handleStartSoundCheck()):handlePerformDetection(),e.abrupt("return");case 13:10===evaluatingData.checkStep&&(evaluatingData.checkEnd=!0);case 14:case"end":return e.stop()}}),e)})))),addMeasureScore=exports("aU",(function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];evaluatingData.evaluatings[e.measureRenderIndex]=_objectSpread(_objectSpread({},e),{},{leve:getLeveByScoreMeasure(e.score),show:t})})),handleScoreResult=function(e){if(console.log("🚀 ~ 评测返回:",e),null!=e&&e.content){var t=e.content,n=t.header,r=t.body;"checking"===n.commond&&(evaluatingData.soundEffectFrequency=r.frequency),"measureScore"===(null==n?void 0:n.commond)&&addMeasureScore(r),"overall"===(null==n?void 0:n.commond)&&(evaluatingData.resulstMode=!0,evaluatingData.resultData=_objectSpread(_objectSpread({},r),getLeveByScore(r.score)),closeToast())}},handleStartBegin=exports("a2",_asyncToGenerator2(_regeneratorRuntime().mark((function e(){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return evaluatingData.isComplete=!1,evaluatingData.startBegin=!0,evaluatingData.evaluatings={},evaluatingData.resultData={},evaluatingData.backtime=0,resetPlaybackToStart(),e.next=8,startEvaluating(evaluatingData.contentData);case 8:if("startEvaluating"===(null==(t=e.sent)?void 0:t.api)){e.next=13;break}return Snackbar$1.error("请在APP端进行评测"),evaluatingData.startBegin=!1,e.abrupt("return");case 13:api_startRecording();case 14:case"end":return e.stop()}}),e)})))),playMusic=function(){var e=_asyncToGenerator2(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,togglePlay("play");case 2:if(e.sent){e.next=7;break}return evaluatingData.startBegin=!1,handleCancelEvaluat(),e.abrupt("return");case 7:check_currentTime(),state$1.setting.camera&&state$1.setting.saveToAlbum&&(console.log("开始录制视频"),api_startCapture());case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),recordStartTimePoint=function(){var e=_asyncToGenerator2(_regeneratorRuntime().mark((function e(t){var n,r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(evaluatingData.startBegin){e.next=2;break}return e.abrupt("return");case 2:r=(null==t||null===(n=t.content)||void 0===n?void 0:n.inteveral)||0,browserInfo$2.ios&&(r*=1e3),evaluatingData.backtime=r||Date.now(),console.log("🚀 ~ 开始时间点:",evaluatingData.backtime,"已经录的时间:",Date.now()-r,"记录时间点:",Date.now()),playMusic();case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),handleEndEvaluat=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];evaluatingData.startBegin&&"evaluating"===state$1.modeType&&(evaluatingData.startBegin=!1,api_stopRecording(),endEvaluating({musicScoreId:state$1.examSongId}),showLoadingToast({message:"评分中",duration:0,overlay:!0,overlayClass:styles$4.scoreMode}),evaluatingData.isComplete=e,state$1.setting.camera&&state$1.setting.saveToAlbum&&(console.log("结束录制视频"),api_endCapture()))},handleEndBegin=exports("a3",(function(){handleEndEvaluat(),handleStopPlay()})),handleCancelEvaluat=function(){evaluatingData.evaluatings={},evaluatingData.startBegin=!1,closeToast(),api_proxyServiceMessage({header:{commond:"recordCancel",type:"SOUND_COMPARE",status:200}}),cancelEvaluating(),handleStopPlay()},handleViewReport=exports("a7",(function(e,t){var n,r=(null===(n=evaluatingData.resultData)||void 0===n?void 0:n[e])||"",i="";switch(t){case"gym":i=location.origin+location.pathname+"#/report/"+r;break;case"orchestra":default:i=location.origin+location.pathname+"report-share.html?id="+r;break;case"instrument":i=location.origin+location.pathname+"#/evaluat-report?id="+r}api_openWebView({url:i,orientation:0,isHideTitle:!0,statusBarTextColor:!1,isOpenLight:!0})})),Evaluating=exports("aL",defineComponent({name:"evaluating",setup:function(){var e=usePageVisibility(),t=reactive({finger:!1,play_mode:"",enableAccompaniment:!0});return watch(e,(function(e){"hidden"==e&&evaluatingData.startBegin&&handleEndBegin()})),onMounted((function(){t.finger=state$1.setting.displayFingering,state$1.setting.displayFingering=!1,t.play_mode=state$1.playSource,t.enableAccompaniment=state$1.setting.enableAccompaniment,t.enableAccompaniment||(console.log("关闭伴奏"),toggleMutePlayAudio("music"===t.play_mode?"music":"background",!0)),evaluatingData.resultData={},evaluatingData.evaluatings={},evaluatingData.soundEffectFrequency=0,evaluatingData.checkStep=0,evaluatingData.rendered=!0,sendResult(handleScoreResult),api_recordStartTime(recordStartTimePoint),state$1.isSelectMeasureMode||clearSelection(),console.log("加载评测模块成功")})),onUnmounted((function(){resetPlaybackToStart(),removeResult(handleScoreResult),api_remove_recordStartTime(recordStartTimePoint),state$1.setting.displayFingering=t.finger,state$1.playSource=t.play_mode,t.enableAccompaniment||toggleMutePlayAudio("music"===t.play_mode?"music":"background",!1),console.log("卸载评测模块成功")})),function(){return createVNode("div",null,null)}}})),popup="_popup_1838h_1",dots="_dots_1838h_6",dot="_dot_1838h_6",active="_active_1838h_20",one="_one_1838h_23",styles$2={popup:popup,dots:dots,dot:dot,active:active,one:one},tickData=reactive({list:[],len:0,tickEnd:!1,beatLengthInMilliseconds:0,state:"",source1:"",source2:"",index:0,show:!1}),handlePlay=function(e,t){return new Promise((function(n){setTimeout((function(){tickData.tickEnd||(tickData.index++,t&&t.play()),n(e)}),tickData.beatLengthInMilliseconds)}))},handleInitTick=exports("b9",(function(e,t){tickData.state="",tickData.beatLengthInMilliseconds=e,tickData.len=t<4?4:t})),handleStartTick=function(){var e=_asyncToGenerator2(_regeneratorRuntime().mark((function e(){var t,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:tickData.show=!0,tickData.tickEnd=!1,"ok"!==tickData.state&&(tickData.source1=new howler.Howl({src:tockAndTick.tick}),tickData.source2=new howler.Howl({src:tockAndTick.tock}),tickData.state="ok"),tickData.index=0,tickData.beatLengthInMilliseconds=60/state$1.speed*1e3,t=0;case 6:if(!(t<=tickData.len)){e.next=15;break}if(!tickData.tickEnd){e.next=9;break}return e.abrupt("return",!1);case 9:return n=0===t?tickData.source1:t===tickData.len?null:tickData.source2,e.next=12,handlePlay(t,n);case 12:t++,e.next=6;break;case 15:return tickData.show=!1,e.abrupt("return",!0);case 17:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Tick=exports("b7",defineComponent({name:"metronome",setup:function(){var e=function(){tickData.tickEnd=!0};return function(){return createVNode(Popup,{class:styles$2.popup,show:tickData.show,"onUpdate:show":function(e){return tickData.show=e},closeable:!0,onClickCloseIcon:e},{default:function(){return[createVNode("div",{class:styles$2.dots},[Array(tickData.len).fill(0).map((function(e,t){return createVNode("div",{class:[styles$2.dot,tickData.index>t&&styles$2.active,tickData.index>t&&0===t&&styles$2.one]},null)}))])]}})}}}));function autoCorrelate(e,t){for(var n=e.length,r=0,i=0;il[c+1];)c++;var h=-1,d=-1;for(i=c;ih&&(h=l[i],d=i);var f=d,p=l[f-1],v=l[f],m=l[f+1],g=(p+m-2*v)/2;return g&&(f-=(m-p)/2/(2*g)),t/f}var audioRecorder={audioContext:null,mediaRecorder:null,recordeState:!1,progress:function(e){},init:function(){this.audioContext=new(window.AudioContext||window.webkitAudioContext)},toggleRecord:function(e){var t=this;return new Promise((function(n,r){e?navigator.mediaDevices.getUserMedia({audio:!0}).then((function(e){audioRecorder.mediaRecorder=e.getAudioTracks()[0],audioRecorder.recordeState=!0;var r=t.audioContext.createMediaStreamSource(e),i=t.audioContext.createAnalyser();i.fftSize=2048,r.connect(i);var a=new Float32Array(i.fftSize),o=t.audioContext.sampleRate;!function e(){if(audioRecorder.recordeState){i.getFloatTimeDomainData(a);var t=autoCorrelate(a,o);audioRecorder.progress(t),setTimeout((function(){e()}),10)}}(),n(!0)})).catch((function(e){n(!1),console.error("Error accessing media devices:",e)})):audioRecorder.mediaRecorder.stop()}))},checkSupport:function(){return new Promise((function(e,t){if(navigator.mediaDevices.getUserMedia){navigator.mediaDevices.getUserMedia({audio:!0}).then((function(t){e(!0),console.log("授权成功!")}),(function(){e(!1),console.error("授权失败!")}))}else e(!1),console.error("浏览器不支持 getUserMedia")}))}},followData=exports("be",reactive({list:[],index:0,start:!1,rendered:!1,earphone:!1})),toggleFollow=exports("b2",(function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];state$1.modeType="follow"===state$1.modeType?"practise":"follow",e||(followData.start=!1,openToggleRecord(!1))})),noteFrequency=ref(0),audioFrequency=ref(0),followTime=ref(0),openToggleRecord=function(){var e=_asyncToGenerator2(_regeneratorRuntime().mark((function e(){var t,n,r=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(api_cloudToggleFollow((t=!(r.length>0&&void 0!==r[0])||r[0])?"start":"end"),t?followTime.value=Date.now():(n=Date.now()-followTime.value,0!==followTime.value&&n>0&&(followTime.value=0)),storeData.isApp){e.next=8;break}return e.next=6,null==audioRecorder?void 0:audioRecorder.toggleRecord(t);case 6:!e.sent&&followData.start&&(followData.earphone=!0,followData.start=!1);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),onClear=function(){state$1.times.forEach((function(e){var t=document.querySelector("div[data-vf=vf".concat(e.id,"]"));t&&t.classList.remove("follow-up","follow-down","follow-error","follow-success");var n=document.getElementById("vf-".concat(e.id));n&&n.classList.remove("follow-up","follow-down")}))},handleFollowStart=exports("b4",(function(){onClear(),followData.start=!0,followData.index=0,followData.list=[],resetPlaybackToStart(),openToggleRecord(!0),getNoteIndex()})),handleFollowEnd=exports("b5",(function(){followData.start=!1,openToggleRecord(!1),followData.index=0,console.log("结束")})),next=function(){gotoNext(state$1.times[followData.index])},getNoteIndex=function e(){var t=state$1.times[followData.index];return t.frequency<=0?(followData.index=followData.index+1,next(),e()):(noteFrequency.value=t.frequency,{id:t.id,min:t.frequency-.5*(t.frequency-t.prevFrequency),max:t.frequency+.5*(t.nextFrequency-t.frequency),duration:t.duration,baseFrequency:t.frequency})},checking=!1,onFollowTime=function(e){var t,n=null==e||null===(t=e.content)||void 0===t?void 0:t.frequency;followData.start&&n>0&&(audioFrequency.value=n,checked())},startTime=0,checked=function(){if(!checking){checking=!0;var e=getNoteIndex();if(audioFrequency.value<.5*e.baseFrequency)checking=!1;else{if(audioFrequency.value>=e.min&&audioFrequency.value<=e.max)if(0===startTime)startTime=Date.now();else if((Date.now()-startTime)/1e3>=.6*e.duration)return startTime=0,followData.index=followData.index+1,setColor(e,"",!0),next(),void(checking=!1);setColor(e,audioFrequency.value>e.baseFrequency?"follow-up":"follow-down"),checking=!1}}},setColor=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=document.querySelector("div[data-vf=vf".concat(e.id,"]"));r&&(r.classList.remove("follow-up","follow-down","follow-error","follow-success"),n?r.classList.add("follow-success"):r.classList.add("follow-error",t));var i=document.getElementById("vf-".concat(e.id));i&&(i.classList.remove("follow-up","follow-down"),t&&i.classList.add(t))},FollowPractice=exports("b8",defineComponent({name:"follow",setup:function(){return onMounted(_asyncToGenerator2(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(storeData.isApp){e.next=7;break}return e.next=3,audioRecorder.checkSupport();case 3:e.sent?(audioRecorder.init(),audioRecorder.progress=function(e){onFollowTime({api:"",content:{frequency:e}})}):followData.earphone=!0,e.next=8;break;case 7:api_cloudFollowTime(onFollowTime);case 8:console.log("进入跟练模式");case 9:case"end":return e.stop()}}),e)})))),onUnmounted((function(){api_cloudFollowTime(onFollowTime,!1),resetPlaybackToStart(),onClear(),openToggleRecord(!1),console.log("退出跟练模式")})),function(){return createVNode("div",null,null)}}})),EnumMusicRenderType=exports("bm",function(e){return e.staff="staff",e.firstTone="firstTone",e.fixedTone="fixedTone",e}(EnumMusicRenderType||{})),musicscoresettingKey=exports("bh","musicscoresetting"),IPlatform=exports("bl",function(e){return e.APP="APP",e.PC="PC",e}(IPlatform||{})),state=reactive({platform:"",appName:"",musicRenderType:"staff",musicRendered:!1,detailId:"",xmlUrl:"",subjectId:0,categoriesId:0,categoriesName:"",enableEvaluation:!0,enableNotation:!1,examSongId:"",examSongName:"",extConfigJson:{},extStyleConfigJson:{},isOpenMetronome:!1,isShowFingering:!1,music:"",accompany:"",midiUrl:"",parentCategoriesId:0,musicSheetCategoriesId:0,playMode:"MP3",speed:0,originSpeed:0,track:"",partIndex:0,needTick:!1,osmd:null,isSpecialBookCategory:!1,playState:"paused",playEnd:!1,playSource:"music",playProgress:0,activeNoteIndex:0,activeMeasureIndex:0,sectionStatus:!1,section:[],sectionBoundingBoxs:[],isOpenPrepare:!1,sectionFirst:null,times:[],modeType:"practise",setting:{soundEffect:!0,eyeProtection:!1,camera:!1,cameraOpacity:70,repeatAutoPlay:!0,displayFingering:!0,displayCursor:!0,frequency:442,evaluationDifficulty:"ADVANCED",saveToAlbum:!1,enableAccompaniment:!0,reactionTimeMs:0},fixtime:0,fingeringInfo:{},scrollContainer:"musicAndSelection",isPercussion:!1,repeatedBeats:0,partListNames:[],gradual:[],gradualVersion:GradualVersion.BASE,gradualTimes:null,multitrack:0,zoom:.8,musicZoom:1,isSelectMeasureMode:!1,isReport:!1}),browserInfo$1=browser(),offset_duration=0,customData=exports("aC",reactive({customNoteRealValue:[],customNoteCurrentTime:!1})),setStep=function e(){if("play"===state.playState){var t=Date.now();requestAnimationFrame((function(){Date.now()-t<16.7?(handlePlaying(),e()):setTimeout((function(){handlePlaying(),e()}),16.7)}))}else console.log("暂停播放")},onPlay=function(){console.log("开始播放"),state.playEnd=!1,offset_duration=browserInfo$1.xiaomi?.2:.08,setStep()},autoResetPlay=function(){"practise"===state.modeType&&(skipNotePlay(0,!0),state.setting.repeatAutoPlay&&(scrollViewNote(),setTimeout((function(){togglePlay("play")}),1e3)))},onEnded=function(){console.log("音频播放结束"),state.playEnd=!0,state.playState="paused",audioListStart(state.playState),handleEndEvaluat(!0),autoResetPlay()},handlePlaying=function(){var e,t=getAudioCurrentTime(),n=getAudioDuration();state.playProgress=t/n*100;var r=getNote(t);if(r){if(state.sectionStatus&&2===state.section.length){var i=state.sectionFirst?state.sectionFirst:state.section[0],a=state.section[1];if(Math.abs(a.endtime-t)1&&void 0!==arguments[1]&&arguments[1],r=state.times[e],i=r.time;(n&&(i=0),r)&&(setAudioCurrentTime(i,e),gotoNext(r),null===(t=metronomeData.metro)||void 0===t||t.sound(i))},togglePlay=exports("av",function(){var e=_asyncToGenerator2(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(state.playState=t||("paused"===state.playState?"play":"paused"),"play"!==state.playState||!state.needTick){e.next=8;break}return e.next=4,handleStartTick();case 4:if(e.sent){e.next=8;break}return state.playState="paused",e.abrupt("return",!1);case 8:return"play"==state.playState&&state.sectionStatus&&state.section.length<2&&clearSelection(),audioListStart(state.playState),e.abrupt("return",!0);case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),handleStopPlay=function(){state.playState="paused",audioListStart(state.playState)},resetPlaybackToStart=function(){state.sectionStatus&&2===state.section.length?state.section=formateSelectMearure(state.section):skipNotePlay(0,!0)},gotoCustomNote=function(e){try{state.osmd.cursor.reset()}catch(n){}for(var t=0;t0)for(;t-r>0;)r++,n.cursor.next();else gotoCustomNote(t);scrollViewNote()}},getNote=function(e){var t=state.times,n=state.times.length;if(!(e>t[n-1].endtime+2)){for(var r=null,i=state.activeNoteIndex;i=a.time))break;o&&a.time==o.time||(r=a)}return r}onEnded()},handleResetPlay=exports("ax",(function(){resetPlaybackToStart(),togglePlay("play")})),handleSetSpeed=exports("af",(function(e){setStorageSpeed(state.examSongId,e),state.speed=e})),clearSelection=function(){state.sectionStatus=!1,state.section=[],closeToast()},handleChangeSection=exports("au",(function(){if(state.sectionStatus)return togglePlay("paused"),skipNotePlay(0,!0),void clearSelection();state.sectionStatus=!0,state.sectionStatus&&togglePlay("paused"),showToast({message:"请选择开始小节",duration:0,position:"top",className:"selectionToast"})})),formateSelectMearure=function(e){var t,n;if(!e.length)return[];var r=e.sort((function(e,t){return e.time-t.time})),i=null===(t=r[0])||void 0===t?void 0:t.measureOpenIndex,a=null===(n=r.last())||void 0===n?void 0:n.measureOpenIndex,o=state.times.filter((function(e){return i===e.measureOpenIndex}))||[],s=state.times.filter((function(e){return a===e.measureOpenIndex}))||[];if(!o.length||!s.length)return clearSelection(),[];r[0]=o[0],r[1]=s.last();var l=r[0].i;if(state.isOpenPrepare){var u=r[0].MeasureNumberXML;state.sectionFirst=state.times.find((function(e){return u-e.MeasureNumberXML==1})),l=state.sectionFirst?state.sectionFirst.i:l}return skipNotePlay(l,0===l),r},handleSelection=function(e){!state.sectionStatus||state.section.length>1||(2!==state.section.length&&e&&(state.section.push(e),2===state.section.length&&(state.section=formateSelectMearure(state.section),closeToast())),1===state.section.length&&showToast({message:"请选择结束小节",duration:0,position:"top",className:"selectionToast"}))},hanldeDirectSelection=exports("bf",(function(e){Array.isArray(e)&&2===e.length&&(state.sectionStatus=!0,state.section=formateSelectMearure(e))})),offsetTop=0,scrollViewNote=function(){var e=document.getElementById("cursorImg-0"),t=document.getElementById(state.scrollContainer);e&&t&&offsetTop!==e.offsetTop&&((offsetTop=e.offsetTop)>50?t.scrollTo({top:(offsetTop-50)*state.musicZoom,behavior:"smooth"}):t.scrollTo({top:0,behavior:"smooth"}))},isRhythmicExercises=exports("aO",(function(){return state.examSongName.indexOf("节奏练习")>-1})),handleRessetState=exports("b1",(function(){"evaluating"===state.modeType?handleStartEvaluat():"practise"===state.modeType?togglePlay("paused"):"follow"===state.modeType&&toggleFollow(!1)})),state$1=exports("U",state),AJAX=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,null,[{key:"ajax",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e3,r=e.indexOf(".mxl")>-1?"text/plain; charset=x-user-defined":"application/xml";if(XMLHttpRequest)t=new XMLHttpRequest;else{if(!ActiveXObject)return Promise.reject(new Error("XMLHttp not supported."));t=new ActiveXObject("Microsoft.XMLHTTP")}return t.timeout=n,new Promise((function(n,i){t.onreadystatechange=function(){t.readyState===XMLHttpRequest.DONE&&(200===t.status||0===t.status&&t.responseText?n(t.responseText):i(new Error("Could not retrieve requested URL "+t.status)))},t.ontimeout=function(e){i(new Error("Server request Timeout"))},t.overrideMimeType(r),t.open("GET",e,!0),t.send()}))}}]),e}(),_Fraction=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];_classCallCheck2(this,e),this.numerator=0,this.denominator=1,this.wholeValue=0,this.numerator=t,this.denominator=n,this.wholeValue=r,i&&this.simplify(),this.setRealValue()}return _createClass2(e,[{key:"toString",value:function(){var e=this.numerator+"/"+this.denominator;return 0!==this.wholeValue&&(e=this.wholeValue+" "+e),e}},{key:"clone",value:function(){return new e(this.numerator,this.denominator,this.wholeValue,!1)}},{key:"Numerator",get:function(){return this.numerator},set:function(e){this.numerator!==e&&(this.numerator=e,this.simplify(),this.setRealValue())}},{key:"Denominator",get:function(){return this.denominator},set:function(e){this.denominator!==e&&(this.denominator=e,0!==this.numerator&&this.simplify(),this.setRealValue())}},{key:"WholeValue",get:function(){return this.wholeValue},set:function(e){this.wholeValue!==e&&(this.wholeValue=e,this.setRealValue())}},{key:"GetExpandedNumerator",value:function(){return this.wholeValue*this.denominator+this.numerator}},{key:"calculateNumberOfNeededDots",value:function(){for(var e=1,t=2,n=this.GetExpandedNumerator();tt;)n.Numerator++;if(this.numerator>this.denominator){for(var r=new e(this.numerator-1,this.denominator,this.wholeValue);r.Denominator>t;)r.Numerator--;if(r.Denominatore.maximumAllowedNumber){var r=this.denominator/e.maximumAllowedNumber;this.numerator=Math.round(this.numerator/r),this.denominator=Math.round(this.denominator/r)}if(this.numerator>e.maximumAllowedNumber){var i=this.numerator/e.maximumAllowedNumber;this.numerator=Math.round(this.numerator/i),this.denominator=Math.round(this.denominator/i)}}else this.denominator=1}},{key:"isOnBeat",value:function(t){var n=this.distanceFromBeat(t);return Math.abs(n)t.RealValue?e:t}},{key:"Equal",value:function(e,t){return e.wholeValue===t.wholeValue&&e.Denominator===t.Denominator&&e.Numerator===t.Numerator}},{key:"createFromFraction",value:function(t){return new e(t.numerator,t.denominator,t.wholeValue,!1)}},{key:"plus",value:function(e,t){var n=e.clone();return n.Add(t),n}},{key:"minus",value:function(e,t){var n=e.clone();return n.Sub(t),n}},{key:"multiply",value:function(t,n){return new e((t.wholeValue*t.denominator+t.numerator)*(n.wholeValue*n.denominator+n.numerator),t.denominator*n.denominator)}},{key:"greatestCommonDenominator",value:function(e,t){if(0===e)return t;if(1===t)return 1;for(;Math.abs(t)>1e-8;)e>t?e-=t:t-=e;return Math.round(e)}}]),e}(),Fraction$1=_Fraction;Fraction$1.maximumAllowedNumber=46340,Fraction$1.FloatInaccuracyTolerance=1e-4;var AbstractExpression=function(){function e(t){_classCallCheck2(this,e),this.placement=t}return _createClass2(e,[{key:"Placement",get:function(){return this.placement}}],[{key:"isStringInStringList",value:function(e,t){for(var n=0,r=e.length;n6&&void 0!==arguments[6]?arguments[6]:"";return _classCallCheck2(this,n),_set((l=_assertThisInitialized2(u=t.call(this,r)),_getPrototypeOf2(n.prototype)),"parentMeasure",a,l,!0),u.NumberXml=s,u.dynamicType=e,u.label=c,u.staffNumber=i,u.activeInstantaneousDynamic=o,u.startVolume=1,u.endVolume=1,u.setStartAndEndVolume(),""!==c&&u.setType(),u}return _createClass2(n,[{key:"setStartAndEndVolume",value:function(){this.activeInstantaneousDynamic&&(0===this.dynamicType&&(this.startVolume=this.activeInstantaneousDynamic.Volume,this.endVolume=1.2*this.activeInstantaneousDynamic.Volume),1===this.dynamicType&&(this.startVolume=this.activeInstantaneousDynamic.Volume,this.endVolume=.8*this.activeInstantaneousDynamic.Volume))}},{key:"DynamicType",get:function(){return this.dynamicType},set:function(e){this.dynamicType=e}},{key:"StartMultiExpression",get:function(){return this.startMultiExpression},set:function(e){this.startMultiExpression=e}},{key:"EndMultiExpression",get:function(){return this.endMultiExpression},set:function(e){this.endMultiExpression=e}},{key:"Placement",get:function(){return this.placement},set:function(e){this.placement=e}},{key:"StartVolume",get:function(){return this.startVolume},set:function(e){this.startVolume=e}},{key:"EndVolume",get:function(){return this.endVolume},set:function(e){this.endVolume=e}},{key:"StaffNumber",get:function(){return this.staffNumber},set:function(e){this.staffNumber=e}},{key:"Label",get:function(){return this.label},set:function(e){this.label=e,this.setType()}},{key:"getInterpolatedDynamic",value:function(e){var t,n=this.StartMultiExpression.AbsoluteTimestamp;if(t=this.EndMultiExpression?this.EndMultiExpression.AbsoluteTimestamp:Fraction$1.plus(this.startMultiExpression.SourceMeasureParent.AbsoluteTimestamp,this.startMultiExpression.SourceMeasureParent.Duration),e.lt(n))return-1;if(t.lt(e))return-2;var r=Fraction$1.minus(e,n).RealValue/Fraction$1.minus(t,n).RealValue;return Math.max(0,Math.min(99.9,this.startVolume+(this.endVolume-this.startVolume)*r))}},{key:"isWedge",value:function(){return!this.label}},{key:"setType",value:function(){n.isStringInStringList(n.listContinuousDynamicIncreasing,this.label)?this.dynamicType=0:n.isStringInStringList(n.listContinuousDynamicDecreasing,this.label)&&(this.dynamicType=1)}}],[{key:"isInputStringContinuousDynamic",value:function(e){return!!e&&(n.isStringInStringList(n.listContinuousDynamicIncreasing,e)||n.isStringInStringList(n.listContinuousDynamicDecreasing,e))}}]),n}(AbstractExpression),ContinuousDynamicExpression=_ContinuousDynamicExpression;ContinuousDynamicExpression.listContinuousDynamicIncreasing=["crescendo","cresc","cresc.","cres."],ContinuousDynamicExpression.listContinuousDynamicDecreasing=["decrescendo","decresc","decr.","diminuendo","dim.","dim"];var ContDynamicEnum=function(e){return e[e.crescendo=0]="crescendo",e[e.diminuendo=1]="diminuendo",e}(ContDynamicEnum||{}),DynamicExpressionSymbolEnum=function(e){return e[e.p=0]="p",e[e.f=1]="f",e[e.s=2]="s",e[e.z=3]="z",e[e.m=4]="m",e[e.r=5]="r",e}(DynamicExpressionSymbolEnum||{}),MusicSheetReadingException=_createClass2((function e(t,n){_classCallCheck2(this,e),this.message=t,n&&(this.message+=" "+n.toString())})),ArgumentOutOfRangeException=_createClass2((function e(t){_classCallCheck2(this,e),this.message=t})),InvalidEnumArgumentException=_createClass2((function e(t){_classCallCheck2(this,e),this.message=t})),loglevelExports={},loglevel={get exports(){return loglevelExports},set exports(e){loglevelExports=e}};!function(t){var n,r;n=commonjsGlobal,r=function(){var t=function(){},n="undefined",r=("undefined"==typeof window?"undefined":_typeof2(window))!==n&&_typeof2(window.navigator)!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"];function a(t,n){var r=t[n];if("function"==typeof r.bind)return r.bind(t);try{return Function.prototype.bind.call(r,t)}catch(e){return function(){return Function.prototype.apply.apply(r,[t,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function s(e,n){for(var r=0;r=0&&t<=o.levels.SILENT))throw"log.setLevel() called with invalid level: "+t;if(a=t,!1!==r&&function(e){var t=(i[e]||"silent").toUpperCase();if(("undefined"==typeof window?"undefined":_typeof2(window))!==n&&l){try{return void(window.localStorage[l]=t)}catch(r){}try{window.document.cookie=encodeURIComponent(l)+"="+t+";"}catch(r){}}}(t),s.call(o,t,e),("undefined"==typeof console?"undefined":_typeof2(console))===n&&t=0;i--)if(r(e[i],t))return i;return-1}function contains(e,t,n){return indexOf$1(e,t,n)>=0}function remove(e,t,n){var r=indexOf$1(e,t,n);return!(r<0)&&(e.splice(r,1),!0)}function frequency(e,t,n){for(var r=n||util$a.defaultEquals,i=e.length,a=0,o=0;o=e.length||n<0||n>=e.length)return!1;var r=e[t];return e[t]=e[n],e[n]=r,!0}function toString$1(e){return"["+e.toString()+"]"}function forEach(e,t){for(var n=0,r=e;ne.size())return!1;var t=!0;return this.forEach((function(n){return!!e.contains(n)||(t=!1,!1)})),t},e.prototype.remove=function(e){return!!this.contains(e)&&(this.dictionary.remove(e),!0)},e.prototype.forEach=function(e){this.dictionary.forEach((function(t,n){return e(n)}))},e.prototype.toArray=function(){return this.dictionary.values()},e.prototype.isEmpty=function(){return this.dictionary.isEmpty()},e.prototype.size=function(){return this.dictionary.size()},e.prototype.clear=function(){this.dictionary.clear()},e.prototype.toString=function(){return arrays$3.toString(this.toArray())},e}();_Set.default=Set$1,Object.defineProperty(Bag$1,"__esModule",{value:!0});var util$7=util$b,Dictionary_1$4=Dictionary$2,Set_1$1=_Set,Bag=function(){function e(e){this.toStrF=e||util$7.defaultToString,this.dictionary=new Dictionary_1$4.default(this.toStrF),this.nElements=0}return e.prototype.add=function(e,t){if(void 0===t&&(t=1),util$7.isUndefined(e)||t<=0)return!1;if(this.contains(e))this.dictionary.getValue(e).copies+=t;else{var n={value:e,copies:t};this.dictionary.setValue(e,n)}return this.nElements+=t,!0},e.prototype.count=function(e){return this.contains(e)?this.dictionary.getValue(e).copies:0},e.prototype.contains=function(e){return this.dictionary.containsKey(e)},e.prototype.remove=function(e,t){if(void 0===t&&(t=1),util$7.isUndefined(e)||t<=0)return!1;if(this.contains(e)){var n=this.dictionary.getValue(e);return t>n.copies?this.nElements-=n.copies:this.nElements-=t,n.copies-=t,n.copies<=0&&this.dictionary.remove(e),!0}return!1},e.prototype.toArray=function(){for(var e=[],t=0,n=this.dictionary.values();tthis.nElements||util$6.isUndefined(e))return!1;var n=this.createNode(e);if(0===this.nElements||null===this.lastNode)this.firstNode=n,this.lastNode=n;else if(t===this.nElements)this.lastNode.next=n,this.lastNode=n;else if(0===t)n.next=this.firstNode,this.firstNode=n;else{var r=this.nodeAtIndex(t-1);if(null===r)return!1;n.next=r.next,r.next=n}return this.nElements++,!0},e.prototype.first=function(){if(null!==this.firstNode)return this.firstNode.element},e.prototype.last=function(){if(null!==this.lastNode)return this.lastNode.element},e.prototype.elementAtIndex=function(e){var t=this.nodeAtIndex(e);if(null!==t)return t.element},e.prototype.indexOf=function(e,t){var n=t||util$6.defaultEquals;if(util$6.isUndefined(e))return-1;for(var r=this.firstNode,i=0;null!==r;){if(n(r.element,e))return i;i++,r=r.next}return-1},e.prototype.contains=function(e,t){return this.indexOf(e,t)>=0},e.prototype.remove=function(e,t){var n=t||util$6.defaultEquals;if(this.nElements<1||util$6.isUndefined(e))return!1;for(var r=null,i=this.firstNode;null!==i;){if(n(i.element,e))return null===r?(this.firstNode=i.next,i===this.lastNode&&(this.lastNode=null)):i===this.lastNode?(this.lastNode=r,r.next=i.next,i.next=null):(r.next=i.next,i.next=null),this.nElements--,!0;r=i,i=i.next}return!1},e.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},e.prototype.equals=function(t,n){var r=n||util$6.defaultEquals;return t instanceof e&&(this.size()===t.size()&&this.equalsAux(this.firstNode,t.firstNode,r))},e.prototype.equalsAux=function(e,t,n){for(;null!==e&&null!==t;){if(!n(e.element,t.element))return!1;e=e.next,t=t.next}return!0},e.prototype.removeElementAtIndex=function(e){if(!(e<0||e>=this.nElements||null===this.firstNode||null===this.lastNode)){var t;if(1===this.nElements)t=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var n=this.nodeAtIndex(e-1);null===n?(t=this.firstNode.element,this.firstNode=this.firstNode.next):n.next===this.lastNode&&(t=this.lastNode.element,this.lastNode=n),null!==n&&null!==n.next&&(t=n.next.element,n.next=n.next.next)}return this.nElements--,t}},e.prototype.forEach=function(e){for(var t=this.firstNode;null!==t&&!1!==e(t.element);)t=t.next},e.prototype.reverse=function(){for(var e=null,t=this.firstNode,n=null;null!==t;)n=t.next,t.next=e,e=t,t=n;n=this.firstNode,this.firstNode=this.lastNode,this.lastNode=n},e.prototype.toArray=function(){for(var e=[],t=this.firstNode;null!==t;)e.push(t.element),t=t.next;return e},e.prototype.size=function(){return this.nElements},e.prototype.isEmpty=function(){return this.nElements<=0},e.prototype.toString=function(){return arrays$2.toString(this.toArray())},e.prototype.nodeAtIndex=function(e){if(e<0||e>=this.nElements)return null;if(e===this.nElements-1)return this.lastNode;for(var t=this.firstNode,n=0;n0&&(e=e.rightCh);return e},e.prototype.transplant=function(e,t){null===e.parent?this.root=t:e===e.parent.leftCh?e.parent.leftCh=t:e.parent.rightCh=t,null!==t&&(t.parent=e.parent)},e.prototype.removeNode=function(e){if(null===e.leftCh)this.transplant(e,e.rightCh);else if(null===e.rightCh)this.transplant(e,e.leftCh);else{var t=this.minimumAux(e.rightCh);t.parent!==e&&(this.transplant(t,t.rightCh),t.rightCh=e.rightCh,t.rightCh.parent=t),this.transplant(e,t),t.leftCh=e.leftCh,t.leftCh.parent=t}},e.prototype.inorderTraversalAux=function(e,t,n){null===e||n.stop||(this.inorderTraversalAux(e.leftCh,t,n),n.stop||(n.stop=!1===t(e.element),n.stop||this.inorderTraversalAux(e.rightCh,t,n)))},e.prototype.levelTraversalAux=function(e,t){var n=new Queue_1$1.default;for(null!==e&&n.enqueue(e),e=n.dequeue()||null;null!=e;){if(!1===t(e.element))return;null!==e.leftCh&&n.enqueue(e.leftCh),null!==e.rightCh&&n.enqueue(e.rightCh),e=n.dequeue()||null}},e.prototype.preorderTraversalAux=function(e,t,n){null===e||n.stop||(n.stop=!1===t(e.element),n.stop||(this.preorderTraversalAux(e.leftCh,t,n),n.stop||this.preorderTraversalAux(e.rightCh,t,n)))},e.prototype.postorderTraversalAux=function(e,t,n){null===e||n.stop||(this.postorderTraversalAux(e.leftCh,t,n),n.stop||(this.postorderTraversalAux(e.rightCh,t,n),n.stop||(n.stop=!1===t(e.element))))},e.prototype.minimumAux=function(e){for(;null!=e&&null!==e.leftCh;)e=e.leftCh;return e},e.prototype.maximumAux=function(e){for(;null!=e&&null!==e.rightCh;)e=e.rightCh;return e},e.prototype.heightAux=function(e){return null===e?-1:Math.max(this.heightAux(e.leftCh),this.heightAux(e.rightCh))+1},e.prototype.insertNode=function(e){for(var t=null,n=this.root;null!==n;){var r=this.compare(e.element,n.element);if(0===r)return null;r<0?(t=n,n=n.leftCh):(t=n,n=n.rightCh)}return e.parent=t,null===t?this.root=e:this.compare(e.element,t.element)<0?t.leftCh=e:t.rightCh=e,e},e.prototype.createNode=function(e){return{element:e,leftCh:null,rightCh:null,parent:null}},e}();BSTreeKV$1.default=BSTreeKV;var __extends$2=commonjsGlobal&&commonjsGlobal.__extends||(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),extendStatics;Object.defineProperty(BSTree$1,"__esModule",{value:!0});var BSTreeKV_1$1=BSTreeKV$1,BSTree=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends$2(t,e),t}(BSTreeKV_1$1.default);BSTree$1.default=BSTree;var Heap$1={};Object.defineProperty(Heap$1,"__esModule",{value:!0});var collections=util$b,arrays$1=arrays$4,Heap=function(){function e(e){this.data=[],this.compare=e||collections.defaultCompare}return e.prototype.leftChildIndex=function(e){return 2*e+1},e.prototype.rightChildIndex=function(e){return 2*e+2},e.prototype.parentIndex=function(e){return Math.floor((e-1)/2)},e.prototype.minIndex=function(e,t){return t>=this.data.length?e>=this.data.length?-1:e:this.compare(this.data[e],this.data[t])<=0?e:t},e.prototype.siftUp=function(e){for(var t=this.parentIndex(e);e>0&&this.compare(this.data[t],this.data[e])>0;)arrays$1.swap(this.data,t,e),e=t,t=this.parentIndex(e)},e.prototype.siftDown=function(e){for(var t=this.minIndex(this.leftChildIndex(e),this.rightChildIndex(e));t>=0&&this.compare(this.data[e],this.data[t])>0;)arrays$1.swap(this.data,t,e),e=t,t=this.minIndex(this.leftChildIndex(e),this.rightChildIndex(e))},e.prototype.peek=function(){return this.data.length>0?this.data[0]:void 0},e.prototype.add=function(e){return!collections.isUndefined(e)&&(this.data.push(e),this.siftUp(this.data.length-1),!0)},e.prototype.removeRoot=function(){if(this.data.length>0){var e=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),e}},e.prototype.contains=function(e){var t=collections.compareToEquals(this.compare);return arrays$1.contains(this.data,e,t)},e.prototype.size=function(){return this.data.length},e.prototype.isEmpty=function(){return this.data.length<=0},e.prototype.clear=function(){this.data.length=0},e.prototype.forEach=function(e){arrays$1.forEach(this.data,e)},e}();Heap$1.default=Heap;var LinkedDictionary$1={},__extends$1=commonjsGlobal&&commonjsGlobal.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(LinkedDictionary$1,"__esModule",{value:!0});var Dictionary_1$3=Dictionary$2,util$4=util$b,LinkedDictionaryPair=function(){function e(e,t){this.key=e,this.value=t}return e.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},e}(),HeadOrTailLinkedDictionaryPair=function(){function e(){this.key=null,this.value=null}return e.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},e}();function isHeadOrTailLinkedDictionaryPair(e){return!e.next}var LinkedDictionary=function(e){function t(t){var n=e.call(this,t)||this;return n.head=new HeadOrTailLinkedDictionaryPair,n.tail=new HeadOrTailLinkedDictionaryPair,n.head.next=n.tail,n.tail.prev=n.head,n}return __extends$1(t,e),t.prototype.appendToTail=function(e){var t=this.tail.prev;t.next=e,e.prev=t,e.next=this.tail,this.tail.prev=e},t.prototype.getLinkedDictionaryPair=function(e){if(!util$4.isUndefined(e)){var t="$"+this.toStr(e);return this.table[t]}},t.prototype.getValue=function(e){var t=this.getLinkedDictionaryPair(e);if(!util$4.isUndefined(t))return t.value},t.prototype.remove=function(t){var n=this.getLinkedDictionaryPair(t);if(!util$4.isUndefined(n))return e.prototype.remove.call(this,t),n.unlink(),n.value},t.prototype.clear=function(){e.prototype.clear.call(this),this.head.next=this.tail,this.tail.prev=this.head},t.prototype.replace=function(e,t){var n="$"+this.toStr(t.key);t.next=e.next,t.prev=e.prev,this.remove(e.key),t.prev.next=t,t.next.prev=t,this.table[n]=t,++this.nElements},t.prototype.setValue=function(e,t){if(!util$4.isUndefined(e)&&!util$4.isUndefined(t)){var n=this.getLinkedDictionaryPair(e),r=new LinkedDictionaryPair(e,t),i="$"+this.toStr(e);return util$4.isUndefined(n)?(this.appendToTail(r),this.table[i]=r,void++this.nElements):(this.replace(n,r),n.value)}},t.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(t)})),e},t.prototype.values=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),e},t.prototype.forEach=function(e){for(var t=this.head.next;!isHeadOrTailLinkedDictionaryPair(t);){if(!1===e(t.key,t.value))return;t=t.next}},t}(Dictionary_1$3.default);LinkedDictionary$1.default=LinkedDictionary;var MultiDictionary$1={};Object.defineProperty(MultiDictionary$1,"__esModule",{value:!0});var util$3=util$b,Dictionary_1$2=Dictionary$2,arrays=arrays$4,MultiDictionary=function(){function e(e,t,n){void 0===n&&(n=!1),this.dict=new Dictionary_1$2.default(e),this.equalsF=t||util$3.defaultEquals,this.allowDuplicate=n}return e.prototype.getValue=function(e){var t=this.dict.getValue(e);return util$3.isUndefined(t)?[]:arrays.copy(t)},e.prototype.setValue=function(e,t){if(util$3.isUndefined(e)||util$3.isUndefined(t))return!1;var n=this.dict.getValue(e);return util$3.isUndefined(n)?(this.dict.setValue(e,[t]),!0):!(!this.allowDuplicate&&arrays.contains(n,t,this.equalsF))&&(n.push(t),!0)},e.prototype.remove=function(e,t){if(util$3.isUndefined(t)){var n=this.dict.remove(e);return!util$3.isUndefined(n)}var r=this.dict.getValue(e);return!(util$3.isUndefined(r)||!arrays.remove(r,t,this.equalsF))&&(0===r.length&&this.dict.remove(e),!0)},e.prototype.keys=function(){return this.dict.keys()},e.prototype.values=function(){for(var e=[],t=0,n=this.dict.values();t-1&&this.insertIdIntoRoot(t,n),this.nodes)if(this.nodes.hasOwnProperty(r)){var i=this.findNodeId(r,e);i>-1&&this.insertIdIntoNode(r,t,i)}},e.prototype.insertIdAfterId=function(e,t){var n=this.findRootId(e);for(var r in n>-1&&this.insertIdIntoRoot(t,n+1),this.nodes)if(this.nodes.hasOwnProperty(r)){var i=this.findNodeId(r,e);i>-1&&this.insertIdIntoNode(r,t,i+1)}},e.prototype.insertIdIntoId=function(e,t){this.nodeInsertAtEnd(e,t),this.nodes[t]=[]},e.prototype.insertIdIntoRoot=function(e,t){if(void 0===t)this.rootInsertAtEnd(e);else if(t<0){var n=this.rootIds.length;this.rootIds.splice(t+n+1,0,e)}else this.rootIds.splice(t,0,e);this.nodes[e]=this.nodes[e]||[]},e.prototype.insertIdIntoNode=function(e,t,n){if(this.nodes[e]=this.nodes[e]||[],this.nodes[t]=this.nodes[t]||[],void 0===n)this.nodeInsertAtEnd(e,t);else if(n<0){var r=this.nodes[e].length;this.nodes[e].splice(n+r+1,0,t)}else this.nodes[e].splice(n,0,t)},e.prototype.moveId=function(e,t,n){var r=e,i=this.findRootId(r);for(var a in this.nodes[t],this.nodes)if(this.nodes.hasOwnProperty(a)){this.findNodeId(a,t);break}var o=t,s=this.findRootId(o);for(var a in this.nodes[t],this.nodes)if(this.nodes.hasOwnProperty(a)){this.findNodeId(a,t);break}if(i>-1)if(s>-1)switch(this.rootDelete(i),s>i&&s--,n){case Direction.BEFORE:this.insertIdIntoRoot(r,s);break;case Direction.AFTER:this.insertIdIntoRoot(r,s+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(o,r);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(o,r)}else for(var a in this.rootDelete(i),this.nodes){if(this.nodes.hasOwnProperty(a))if((l=this.findNodeId(a,o))>-1){switch(n){case Direction.BEFORE:this.insertIdIntoNode(a,r,l);break;case Direction.AFTER:this.insertIdIntoNode(a,r,l+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(o,r);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(o,r)}break}}else if(s>-1){for(var a in this.nodes){if(this.nodes.hasOwnProperty(a))if((l=this.findNodeId(a,r))>-1){this.nodeDeleteAtIndex(a,l);break}}switch(n){case Direction.BEFORE:this.insertIdIntoRoot(r,s);break;case Direction.AFTER:this.insertIdIntoRoot(r,s+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(o,r);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(o,r)}}else{for(var a in this.nodes){if(this.nodes.hasOwnProperty(a))if((l=this.findNodeId(a,r))>-1){this.nodeDeleteAtIndex(a,l);break}}for(var a in this.nodes){var l;if(this.nodes.hasOwnProperty(a))if((l=this.findNodeId(a,o))>-1){switch(n){case Direction.BEFORE:this.insertIdIntoNode(a,r,l);break;case Direction.AFTER:this.insertIdIntoNode(a,r,l+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(o,r);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(o,r)}break}}}},e.prototype.swapArrayElements=function(e,t,n){var r=e[t];return e[t]=e[n],e[n]=r,e},e.prototype.rootDeleteId=function(e){var t=this.findRootId(e);t>-1&&this.rootDelete(t)},e.prototype.nodeAndSubNodesDelete=function(e){for(var t=[],n=0;n0&&void 0!==arguments[0]?arguments[0]:void 0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=new e(this.musicSheet,null!=t?t:this.currentTimeStamp,n);return r.currentVoiceEntryIndex=this.currentVoiceEntryIndex,r.currentMappingPart=this.currentMappingPart,r.currentPartIndex=this.currentPartIndex,r.currentVoiceEntries=this.currentVoiceEntries,r.endReached=this.endReached,r.frontReached=this.frontReached,r}},{key:"CurrentVisibleVoiceEntries",value:function(e){var t=[];if(!this.currentVoiceEntries)return t;if(e){var n,r=_createForOfIteratorHelper(this.currentVoiceEntries);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.ParentVoice.Parent.IdString===e.IdString)return this.getVisibleEntries(i,t),t}}catch(err){r.e(err)}finally{r.f()}}else{var a,o=_createForOfIteratorHelper(this.currentVoiceEntries);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.getVisibleEntries(s,t)}}catch(err){o.e(err)}finally{o.f()}}return t}},{key:"CurrentAudibleVoiceEntries",value:function(e){var t=[];if(this.currentVoiceEntries)if(e){var n,r=_createForOfIteratorHelper(this.currentVoiceEntries);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.ParentVoice.Parent.IdString===e.IdString)return this.getAudibleEntries(i,t),t}}catch(err){r.e(err)}finally{r.f()}}else{var a,o=_createForOfIteratorHelper(this.currentVoiceEntries);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.getAudibleEntries(s,t)}}catch(err){o.e(err)}finally{o.f()}}return t}},{key:"getCurrentDynamicChangingExpressions",value:function(){return this.currentDynamicChangingExpressions}},{key:"CurrentScoreFollowingVoiceEntries",value:function(e){var t=[];if(!this.currentVoiceEntries)return t;if(e){var n,r=_createForOfIteratorHelper(this.currentVoiceEntries);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.ParentVoice.Parent.IdString===e.IdString)return this.getScoreFollowingEntries(i,t),t}}catch(err){r.e(err)}finally{r.f()}}else{var a,o=_createForOfIteratorHelper(this.currentVoiceEntries);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.getScoreFollowingEntries(s,t)}}catch(err){o.e(err)}finally{o.f()}}return t}},{key:"currentPlaybackSettings",value:function(){return this.musicSheet.SheetPlaybackSetting}},{key:"moveToNext",value:function(){this.forwardJumpOccurred=this.backJumpOccurred=!1,this.endReached||(this.currentVoiceEntries&&(this.currentVoiceEntries.length=0),this.recursiveMove(),this.currentMeasure||(this.currentTimeStamp=new Fraction$1(99999,1)),void 0!==this.CurrentTempoChangingExpression&&(void 0!==this.CurrentTempoChangingExpression.ContinuousTempo?this.currentBpm=this.CurrentTempoChangingExpression.ContinuousTempo.getInterpolatedTempo(this.CurrentSourceTimestamp):this.currentBpm=this.CurrentTempoChangingExpression.InstantaneousTempo.TempoInBpm))}},{key:"moveToNextVisibleVoiceEntry",value:function(e){for(;!this.endReached;)if(this.moveToNext(),this.checkEntries(e))return}},{key:"resetRepetitionIterationCount",value:function(e){return 1}},{key:"incrementRepetitionIterationCount",value:function(e){return-1===this.repetitionIterationCountDictKeys.indexOf(e)?this.setRepetitionIterationCount(e,1):this.setRepetitionIterationCount(e,this.getRepetitionIterationCount(e)+1)}},{key:"setRepetitionIterationCount",value:function(e,t){var n=this.repetitionIterationCountDictKeys.indexOf(e);return-1===n?(this.repetitionIterationCountDictKeys.push(e),this.repetitionIterationCountDictValues.push(t)):this.repetitionIterationCountDictValues[n]=t,t}},{key:"getRepetitionIterationCount",value:function(e){var t=this.repetitionIterationCountDictKeys.indexOf(e);if(-1!==t)return this.repetitionIterationCountDictValues[t]}},{key:"handleRepetitionsAtMeasureBegin",value:function(){for(var e=0,t=this.currentMeasure.FirstRepetitionInstructions.length;e=this.JumpResponsibleRepetition.StartIndex&&r.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(r)}}}},{key:"handleRepetitionsAtMeasureEnd",value:function(){for(var e=0,t=this.currentMeasure.LastRepetitionInstructions.length;e-1&&this.getRepetitionIterationCount(r)=this.JumpResponsibleRepetition.StartIndex&&r.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(r),this.repetitionIterationCountDictKeys.contains(r))){var i=r.getForwardJumpTargetForIteration(this.getRepetitionIterationCount(r));if(i>=0)return this.currentMeasureIndex=i,this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.jumpResponsibleRepetition=r,void(this.forwardJumpOccurred=!0);-2===i&&(this.endReached=!0)}}}this.currentMeasureIndex++,void 0!==this.JumpResponsibleRepetition&&this.currentMeasureIndex>this.JumpResponsibleRepetition.EndIndex&&(this.jumpResponsibleRepetition=void 0)}},{key:"doBackJump",value:function(e){this.currentMeasureIndex=e.getBackwardJumpTarget(),this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.incrementRepetitionIterationCount(e),this.jumpResponsibleRepetition=e,this.backJumpOccurred=!0}},{key:"activateCurrentRhythmInstructions",value:function(){if(void 0!==this.currentMeasure&&this.currentMeasure.FirstInstructionsStaffEntries.length>0&&void 0!==this.currentMeasure.FirstInstructionsStaffEntries[0])for(var e=this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions,t=0,n=e.length;t0&&(this.currentDynamicEntryIndex>=e.length||e[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentDynamicEntryIndex--;for(;this.currentDynamicEntryIndex0&&(this.currentTempoEntryIndex>=l.length||l[this.currentTempoEntryIndex].AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentTempoEntryIndex--;for(;this.currentTempoEntryIndex=0&&this.currentVoiceEntryIndex=0&&this.currentMeasureIndex0){if(!e)return!0;for(var n=0,r=t.length;nt&&(this.openSheetMusicDisplay.Sheet.SelectionStart=this.openSheetMusicDisplay.Sheet.SourceMeasures[t].AbsoluteTimestamp),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>n){var r=this.openSheetMusicDisplay.Sheet.SourceMeasures[n];this.openSheetMusicDisplay.Sheet.SelectionEnd=Fraction$1.plus(r.AbsoluteTimestamp,r.Duration)}this.iterator=this.manager.getIterator()}else console.log("OSMD.Cursor.resetIterator(): sheet or measures were null/undefined.")}},{key:"getStaffEntryFromVoiceEntry",value:function(e){var t=e.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.measureListIndex,n=e.ParentSourceStaffEntry.ParentStaff.idInMusicSheet;return this.graphic.findGraphicalStaffEntryFromMeasureList(n,t,e.ParentSourceStaffEntry)}},{key:"updateWithTimestamp",value:function(e){var t=this.manager.absoluteEnrolledToSheetTimestamp(e),n=this.graphic.calculateXPositionFromTimestamp(t),r=n[0],i=n[1];this.updateCurrentPageFromSystem(i);var a=n[2];if(a){var o,s,l=Math.max(a.parentMeasure.MeasureNumber,1),u=_createForOfIteratorHelper(this.graphic.MeasureList[l-1]);try{for(u.s();!(s=u.n()).done;){var c=s.value;if(c){o=c;break}}}catch(err){u.e(err)}finally{u.f()}var h=this.graphic.calculateCursorPoints(r,i),d=h[0].y,f=h[1].y-d;if(o){if(this.updateWidthAndStyle(o.PositionAndShape,r,d,f),this.openSheetMusicDisplay.FollowCursor){var p=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:p<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}}}},{key:"update",value:function(){var e=this;if(!this.hidden&&void 0!==this.hidden&&null!==this.hidden){this.updateCurrentPage();var t=this.Iterator,n=t.CurrentVisibleVoiceEntries();if(!t.EndReached&&t.CurrentVoiceEntries&&0!==n.length){var r,i,a,o=0;if(t.CurrentMeasure.isReducedToMultiRest){var s=this.graphic.findGraphicalMeasure(t.CurrentMeasureIndex,0),l=s.parentSourceMeasure.multipleRestMeasures,u=t.CurrentMeasure.multipleRestMeasureNumber/(l+1),c=s.PositionAndShape.Size.width-s.beginInstructionsWidth;o=s.PositionAndShape.AbsolutePosition.x+s.beginInstructionsWidth+u*c,a=s.ParentMusicSystem}else{var h=n.map((function(t){return e.getStaffEntryFromVoiceEntry(t)})).sort((function(e,t){var n,r,i,a;return(null==e||null===(n=e.PositionAndShape)||void 0===n||null===(r=n.AbsolutePosition)||void 0===r?void 0:r.x)<=(null==t||null===(i=t.PositionAndShape)||void 0===i||null===(a=i.AbsolutePosition)||void 0===a?void 0:a.x)?-1:1}))[0];h&&(o=h.PositionAndShape.AbsolutePosition.x,a=h.parentMeasure.ParentMusicSystem)}if(a){r=a.PositionAndShape.AbsolutePosition.y+a.StaffLines[0].PositionAndShape.RelativePosition.y;var d=a.StaffLines[a.StaffLines.length-1];i=a.PositionAndShape.AbsolutePosition.y+d.PositionAndShape.RelativePosition.y+d.StaffHeight-r;var f=this.graphic.findGraphicalMeasure(t.CurrentMeasureIndex,0).PositionAndShape;if(this.updateWidthAndStyle(f,o,r,i),this.openSheetMusicDisplay.FollowCursor&&this.cursorOptions.follow)if(this.openSheetMusicDisplay.EngravingRules.RenderSingleHorizontalStaffline)this.cursorElement.scrollIntoView({behavior:"smooth",inline:"center"});else{var p=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:p<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}}}}},{key:"updateWidthAndStyle",value:function(e,t,n,r){var i,a=this.cursorElement,o=0,s=r;switch(this.cursorOptions.type){case 1:a.style.top=10*n*this.openSheetMusicDisplay.zoom+"px",a.style.left=10*(t-1.5)*this.openSheetMusicDisplay.zoom+"px",s=10*r*this.openSheetMusicDisplay.zoom,a.height=s,a.style.height=s+"px",o=5*this.openSheetMusicDisplay.zoom;break;case 2:a.style.top=10*(n-2.5)*this.openSheetMusicDisplay.zoom+"px",a.style.left=10*t*this.openSheetMusicDisplay.zoom+"px",s=15*this.openSheetMusicDisplay.zoom,a.height=s,a.style.height=s+"px",o=5*this.openSheetMusicDisplay.zoom;break;case 3:a.style.top=10*e.AbsolutePosition.y*this.openSheetMusicDisplay.zoom+"px",a.style.left=10*e.AbsolutePosition.x*this.openSheetMusicDisplay.zoom+"px",s=10*r*this.openSheetMusicDisplay.zoom,a.height=s,a.style.height=s+"px",o=10*e.Size.width*this.openSheetMusicDisplay.zoom;break;case 4:a.style.top=10*e.AbsolutePosition.y*this.openSheetMusicDisplay.zoom+"px",a.style.left=10*e.AbsolutePosition.x*this.openSheetMusicDisplay.zoom+"px",s=10*r*this.openSheetMusicDisplay.zoom,a.height=s,a.style.height=s+"px",o=10*(t-e.AbsolutePosition.x)*this.openSheetMusicDisplay.zoom;break;default:a.style.top=10*n*this.openSheetMusicDisplay.zoom+"px",a.style.left=10*(t-1.5)*this.openSheetMusicDisplay.zoom+"px",s=10*r*this.openSheetMusicDisplay.zoom,a.height=s,a.style.height=s+"px",o=30*this.openSheetMusicDisplay.zoom}null!==(i=window.GYM)&&void 0!==i&&i.multitrack&&(a.height=s+24,a.style.height=s+24+"px"),o!==a.width&&(a.width=o,this.updateStyle(o,this.cursorOptions))}},{key:"hide",value:function(){this.cursorElement.style.display="none",this.hidden=!0}},{key:"next",value:function(){this.Iterator.moveToNextVisibleVoiceEntry(!1),this.update()}},{key:"reset",value:function(){this.resetIterator();var e=this.manager.getIterator(this.graphic.ParentMusicSheet.SelectionStart);this.updateWithTimestamp(e.CurrentEnrolledTimestamp)}},{key:"updateStyle",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;void 0!==t&&(this.cursorOptions=t);var n=document.createElement("canvas");n.width=this.cursorElement.width,n.height=1;var r=n.getContext("2d");r.globalAlpha=this.cursorOptions.alpha;var i=r.createLinearGradient(0,0,this.cursorElement.width,0);switch(this.cursorOptions.type){case 1:case 2:case 3:case 4:i.addColorStop(1,this.cursorOptions.color);break;default:i.addColorStop(0,"white"),i.addColorStop(.2,this.cursorOptions.color),i.addColorStop(.8,this.cursorOptions.color),i.addColorStop(1,"white")}r.fillStyle=i,r.fillRect(0,0,e,1),this.cursorElement.src=n.toDataURL("image/png")}},{key:"Iterator",get:function(){return this.iterator}},{key:"Hidden",get:function(){return this.hidden}},{key:"VoicesUnderCursor",value:function(e){return this.Iterator.CurrentVisibleVoiceEntries(e)}},{key:"NotesUnderCursor",value:function(e){var t=this.VoicesUnderCursor(e),n=[];return t.forEach((function(e){n.push.apply(n,e.Notes)})),n}},{key:"GNotesUnderCursor",value:function(e){var t=this,n=this.VoicesUnderCursor(e),r=[];return n.forEach((function(e){r.push.apply(r,_toConsumableArray2(e.Notes.map((function(e){return t.rules.GNote(e)}))))})),r}},{key:"updateCurrentPage",value:function(){var e,t=this.Iterator.currentTimeStamp,n=_createForOfIteratorHelper(this.graphic.MusicPages);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.MusicSystems.last().GetSystemsLastTimeStamp().gt(t)){var i=r.PageNumber;return i!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById(this.rules.DYContainerId+i),this.container.appendChild(this.cursorElement)),this.currentPageNumber=i}}}catch(err){n.e(err)}finally{n.f()}return 1}},{key:"updateCurrentPageFromSystem",value:function(e){if(null!=e&&e.Parent){var t=e.Parent.PageNumber;return t!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById(this.rules.DYContainerId+t),this.container.appendChild(this.cursorElement)),this.currentPageNumber=t}return 1}}]),e}(),PointF2D=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;_classCallCheck2(this,e),this.x=0,this.y=0,this.x=t,this.y=n}return _createClass2(e,[{key:"ToString",value:function(){return"["+this.x+", "+this.y+"]"}}],[{key:"Empty",get:function(){return new e}},{key:"pointsAreEqual",value:function(e,t){return e.x===t.x&&e.y===t.y}}]),e}(),SizeF2D=_createClass2((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;_classCallCheck2(this,e),this.width=t,this.height=n})),RectangleF2D=function(){function e(t,n,r,i){_classCallCheck2(this,e),this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=n,this.width=r,this.height=i}return _createClass2(e,[{key:"Location",get:function(){return new PointF2D(this.x,this.y)}},{key:"Size",get:function(){return new SizeF2D(this.width,this.height)}}],[{key:"createFromLocationAndSize",value:function(t,n){return new e(t.x,t.y,n.width,n.height)}}]),e}(),AClassHierarchyTrackable=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,[{key:"isInstanceOfClass",value:function(e){for(var t=this.constructor.prototype;t;){if(e===t.constructor.name)return!0;t=t.__proto__}return!1}}]),e}(),GraphicalObject=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(){return _classCallCheck2(this,n),t.apply(this,arguments)}return _createClass2(n,[{key:"PositionAndShape",get:function(){return this.boundingBox},set:function(e){this.boundingBox=e}}]),n}(AClassHierarchyTrackable),StaffLineActivitySymbol=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e){var r;_classCallCheck2(this,n),(r=t.call(this)).parentStaffLine=e;var i=e.PositionAndShape;return r.boundingBox=new BoundingBox$1(_assertThisInitialized2(r),i),r.boundingBox.BorderRight=6,r.boundingBox.BorderBottom=4.5,r.boundingBox.BorderLeft=-1.5,r.boundingBox.BorderTop=-1.5,r}return _createClass2(n)}(GraphicalObject),Clickable=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(){return _classCallCheck2(this,n),t.apply(this,arguments)}return _createClass2(n)}(GraphicalObject),BoundingBox$1=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];_classCallCheck2(this,e),this.isSymbol=!1,this.relativePositionHasBeenSet=!1,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,this.absolutePosition=new PointF2D,this.relativePosition=new PointF2D,this.size=new SizeF2D,this.marginSize=new SizeF2D,this.upperLeftCorner=new PointF2D,this.upperLeftMarginCorner=new PointF2D,this.borderLeft=0,this.borderRight=0,this.borderTop=0,this.borderBottom=0,this.borderMarginLeft=0,this.borderMarginRight=0,this.borderMarginTop=0,this.borderMarginBottom=0,this.childElements=[],this.parent=n,this.dataObject=t,this.isSymbol=r,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,n&&(this.Parent=n)}return _createClass2(e,[{key:"RelativePositionHasBeenSet",get:function(){return this.relativePositionHasBeenSet}},{key:"XBordersHaveBeenSet",get:function(){return this.xBordersHaveBeenSet},set:function(e){this.xBordersHaveBeenSet=e}},{key:"YBordersHaveBeenSet",get:function(){return this.yBordersHaveBeenSet},set:function(e){this.yBordersHaveBeenSet=e}},{key:"AbsolutePosition",get:function(){return this.absolutePosition},set:function(e){this.absolutePosition=e}},{key:"RelativePosition",get:function(){return this.relativePosition},set:function(e){this.relativePosition=e,this.relativePositionHasBeenSet=!0}},{key:"Size",get:function(){return this.size},set:function(e){this.size=e}},{key:"MarginSize",get:function(){return this.marginSize}},{key:"UpperLeftCorner",get:function(){return this.upperLeftCorner}},{key:"UpperLeftMarginCorner",get:function(){return this.upperLeftMarginCorner}},{key:"BorderLeft",get:function(){return this.borderLeft},set:function(e){this.borderLeft=e,this.calculateRectangle()}},{key:"BorderRight",get:function(){return this.borderRight},set:function(e){this.borderRight=e,this.calculateRectangle()}},{key:"BorderTop",get:function(){return this.borderTop},set:function(e){this.borderTop=e,this.calculateRectangle()}},{key:"BorderBottom",get:function(){return this.borderBottom},set:function(e){this.borderBottom=e,this.calculateRectangle()}},{key:"BorderMarginLeft",get:function(){return this.borderMarginLeft>this.borderLeft?this.borderLeft:this.borderMarginLeft},set:function(e){this.borderMarginLeft=e,this.calculateMarginRectangle()}},{key:"BorderMarginRight",get:function(){return this.borderMarginRightthis.borderTop?this.borderTop:this.borderMarginTop},set:function(e){this.borderMarginTop=e,this.calculateMarginRectangle()}},{key:"BorderMarginBottom",get:function(){return this.borderMarginBottom-1&&this.parent.ChildElements.splice(a,1)}(this.parent=e,(null===(t=this.parent)||void 0===t||null===(n=t.ChildElements)||void 0===n?void 0:n.indexOf(this))>-1)?loglevelExports.error("BoundingBox of "+this.dataObject.constructor.name+" already in children list of "+this.parent.dataObject.constructor.name+"'s BoundingBox"):null===(r=this.parent)||void 0===r||null===(i=r.ChildElements)||void 0===i||i.push(this)}},{key:"DataObject",get:function(){return this.dataObject}},{key:"Center",get:function(){return new PointF2D(this.RelativePosition.x+(this.BorderMarginRight+this.BorderMarginLeft),this.RelativePosition.y+(this.BorderMarginBottom+this.BorderMarginTop))}},{key:"setAbsolutePositionFromParent",value:function(){this.parent?(this.absolutePosition.x=this.parent.AbsolutePosition.x+this.relativePosition.x,this.absolutePosition.y=this.parent.AbsolutePosition.y+this.relativePosition.y):this.absolutePosition=this.relativePosition}},{key:"calculateAbsolutePosition",value:function(){this.absolutePosition.x=this.relativePosition.x,this.absolutePosition.y=this.relativePosition.y;for(var e=this.parent;e;)this.absolutePosition.x+=e.relativePosition.x,this.absolutePosition.y+=e.relativePosition.y,e=e.parent}},{key:"calculateAbsolutePositionsRecursiveWithoutTopelement",value:function(){this.absolutePosition.x=0,this.absolutePosition.y=0;for(var e=0,t=this.ChildElements.length;e.001;break;case 2:case 3:r=this.relativePosition.y,e.calculateMarginPositionAlongDirection(this,t),i=Math.abs(r-this.relativePosition.y)>.001;break;default:throw new ArgumentOutOfRangeException("direction")}}while(i)}},{key:"collisionDetection",value:function(e){var t=Math.min(this.AbsolutePosition.x+this.borderRight,e.absolutePosition.x+e.borderRight)-Math.max(this.AbsolutePosition.x+this.borderLeft,e.absolutePosition.x+e.borderLeft),n=Math.min(this.AbsolutePosition.y+this.borderBottom,e.absolutePosition.y+e.borderBottom)-Math.max(this.AbsolutePosition.y+this.borderTop,e.absolutePosition.y+e.borderTop);return t>0&&n>0}},{key:"liesInsideBorders",value:function(e){var t=this.AbsolutePosition.x+this.borderLeft<=e.absolutePosition.x+e.borderLeft&&e.absolutePosition.x+e.borderLeft<=this.AbsolutePosition.x+this.borderRight,n=this.AbsolutePosition.x+this.borderLeft<=e.absolutePosition.x+e.borderRight&&e.absolutePosition.x+e.borderRight<=this.AbsolutePosition.x+this.borderRight;if(t&&n){var r=this.AbsolutePosition.y+this.borderTop<=e.absolutePosition.y+e.borderTop&&e.absolutePosition.y+e.borderTop<=this.AbsolutePosition.y+this.borderBottom,i=this.AbsolutePosition.y+this.borderTop<=e.absolutePosition.y+e.borderBottom&&e.absolutePosition.y+e.borderBottom<=this.AbsolutePosition.y+this.borderBottom;if(r&&i)return!0}return!1}},{key:"pointLiesInsideBorders",value:function(e){if(this.AbsolutePosition.x+this.borderLeft<=e.x&&e.x<=this.AbsolutePosition.x+this.borderRight&&(this.AbsolutePosition.y+this.borderTop<=e.y&&e.y<=this.AbsolutePosition.y+this.borderBottom))return!0;return!1}},{key:"marginCollisionDetection",value:function(e){var t=Math.min(this.AbsolutePosition.x+this.borderMarginRight,e.absolutePosition.x+e.borderMarginRight)-Math.max(this.AbsolutePosition.x+this.borderMarginLeft,e.absolutePosition.x+e.borderMarginLeft),n=Math.min(this.AbsolutePosition.y+this.borderMarginBottom,e.absolutePosition.y+e.borderMarginBottom)-Math.max(this.AbsolutePosition.y+this.borderMarginTop,e.absolutePosition.y+e.borderMarginTop);return t>0&&n>0}},{key:"liesInsideMargins",value:function(e){var t=this.AbsolutePosition.x+this.borderMarginLeft<=e.absolutePosition.x+e.borderMarginLeft&&e.absolutePosition.x+e.borderMarginLeft<=this.AbsolutePosition.x+this.borderMarginRight,n=this.AbsolutePosition.x+this.borderMarginLeft<=e.absolutePosition.x+e.borderMarginRight&&e.absolutePosition.x+e.borderMarginRight<=this.AbsolutePosition.x+this.borderMarginRight;if(t&&n){var r=this.AbsolutePosition.y+this.borderMarginTop<=e.absolutePosition.y+e.borderMarginTop&&e.absolutePosition.y+e.borderMarginTop<=this.AbsolutePosition.y+this.borderMarginBottom,i=this.AbsolutePosition.y+this.borderMarginTop<=e.absolutePosition.y+e.borderMarginBottom&&e.absolutePosition.y+e.borderMarginBottom<=this.AbsolutePosition.y+this.borderMarginBottom;if(r&&i)return!0}return!1}},{key:"pointLiesInsideMargins",value:function(e){if(this.AbsolutePosition.x+this.borderMarginLeft<=e.x&&e.x<=this.AbsolutePosition.x+this.borderMarginRight&&(this.AbsolutePosition.y+this.borderMarginTop<=e.y&&e.y<=this.AbsolutePosition.y+this.borderMarginBottom))return!0;return!1}},{key:"computeNonOverlappingPosition",value:function(e,t,n){this.RelativePosition=new PointF2D(n.x,n.y),this.setAbsolutePositionFromParent();var r=0,i=!1;do{switch(t){case 0:case 1:r=this.relativePosition.x,e.calculatePositionAlongDirection(this,t),i=Math.abs(r-this.relativePosition.x)>1e-4;break;case 2:case 3:r=this.relativePosition.y,e.calculatePositionAlongDirection(this,t),i=Math.abs(r-this.relativePosition.y)>1e-4;break;default:throw new ArgumentOutOfRangeException("direction")}}while(i)}},{key:"getClickedObjectOfType",value:function(e){var t=this.dataObject;if(this.pointLiesInsideBorders(e)&&t)return t;for(var n=0,r=this.childElements.length;n1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:GraphicalObject.name,i=[],a=_createForOfIteratorHelper(this.childElements);try{for(a.s();!(t=a.n()).done;){var o=t.value;i=i.concat(o.getObjectsInRegion(e,n,r))}}catch(err){a.e(err)}finally{a.f()}return this.dataObject&&this.dataObject.isInstanceOfClass(r)&&(n?e.liesInsideBorders(this)&&i.push(this.dataObject):e.collisionDetection(this)&&i.push(this.dataObject)),i}},{key:"calculateRectangle",value:function(){this.upperLeftCorner=new PointF2D(this.BorderLeft,this.BorderTop),this.size=new SizeF2D(this.BorderRight-this.BorderLeft,this.BorderBottom-this.BorderTop),this.boundingRectangle=RectangleF2D.createFromLocationAndSize(this.upperLeftCorner,this.size)}},{key:"calculateMarginRectangle",value:function(){this.upperLeftMarginCorner=new PointF2D(this.BorderMarginLeft,this.BorderMarginTop),this.marginSize=new SizeF2D(this.BorderMarginRight-this.BorderMarginLeft,this.BorderMarginBottom-this.BorderMarginTop),this.boundingMarginRectangle=RectangleF2D.createFromLocationAndSize(this.upperLeftMarginCorner,this.marginSize)}},{key:"calculateMarginPositionAlongDirection",value:function(e,t){if(this!==e){if(this.isSymbol&&this.marginCollisionDetection(e)){var n=0;switch(t){case 0:return n=this.absolutePosition.x+this.borderMarginLeft-(e.absolutePosition.x+e.borderMarginRight),e.relativePosition.x+=n,void(e.absolutePosition.x+=n);case 1:return n=this.absolutePosition.x+this.borderMarginRight-(e.absolutePosition.x+e.borderMarginLeft),e.relativePosition.x+=n,void(e.absolutePosition.x+=n);case 2:return n=this.absolutePosition.y+this.borderMarginTop-(e.absolutePosition.y+e.borderMarginBottom),e.relativePosition.y+=n,void(e.absolutePosition.y+=n);case 3:return n=this.absolutePosition.y+this.borderMarginBottom-(e.absolutePosition.y+e.borderMarginTop),e.relativePosition.y+=n,void(e.absolutePosition.y+=n);default:throw new ArgumentOutOfRangeException("direction")}}for(var r=0,i=this.ChildElements.length;r3&&void 0!==arguments[3]?arguments[3]:void 0;_classCallCheck2(this,e),this.accidental=2,this.fundamentalNote=t,this.octave=n,this.accidental=r,this.accidentalXml=i,this.halfTone=t+12*(n+e.octXmlDiff)+e.HalfTonesFromAccidental(r),this.frequency=e.calcFrequency(this),this.nextFrequency=e.calcFrequency(this,"next"),this.prevFrequency=e.calcFrequency(this,"prev")}return _createClass2(e,[{key:"AccidentalHalfTones",get:function(){return e.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:"AccidentalXml",get:function(){return this.accidentalXml}},{key:"Frequency",get:function(){return this.frequency}},{key:"getHalfTone",value:function(){return this.halfTone}},{key:"getTransposedPitch",value:function(e){if(e>12)throw new Error("rewrite this method to handle bigger octave changes or don't use is with bigger octave changes!");return e>0?this.getHigherPitchByTransposeFactor(e):e<0?this.getLowerPitchByTransposeFactor(-e):this}},{key:"DoEnharmonicChange",value:function(){switch(this.accidental){case 1:case 5:this.fundamentalNote=this.getPreviousFundamentalNote(this.fundamentalNote),this.accidental=e.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+12*(this.octave+e.octXmlDiff)));break;case 0:case 4:this.fundamentalNote=this.getNextFundamentalNote(this.fundamentalNote),this.accidental=e.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+12*(this.octave+e.octXmlDiff)));break;default:return}}},{key:"ToString",value:function(){var t=e.accidentalVexflow(this.accidental);return t||(t=""),"Key: "+e.getNoteEnumString(this.fundamentalNote)+t+", Note: "+this.fundamentalNote+", octave: "+this.octave.toString()}},{key:"OperatorEquals",value:function(e){var t=this;return!(!t||!e)&&(t.FundamentalNote===e.FundamentalNote&&t.Octave===e.Octave&&t.Accidental===e.Accidental)}},{key:"OperatorNotEqual",value:function(e){return!(this===e)}},{key:"OperatorFundamentalGreaterThan",value:function(e){var t=this;return t.Octave===e.Octave?t.FundamentalNote>e.FundamentalNote:t.Octave>e.Octave}},{key:"OperatorFundamentalLessThan",value:function(e){var t=this;return t.Octave===e.Octave?t.FundamentalNotee.pitchEnumValues.length-1?(n=e.pitchEnumValues[r+t-e.pitchEnumValues.length],i++):n=e.pitchEnumValues[r+t],new e(n,i,2)}},{key:"getLowerPitchByTransposeFactor",value:function(t){var n,r=e.pitchEnumValues.indexOf(this.fundamentalNote),i=this.octave;return r-t<0?(n=e.pitchEnumValues[e.pitchEnumValues.length+r-t],i--):n=e.pitchEnumValues[r-t],new e(n,i,2)}},{key:"getNextFundamentalNote",value:function(t){var n=e.pitchEnumValues.indexOf(t);return n=(n+1)%e.pitchEnumValues.length,e.pitchEnumValues[n]}},{key:"getPreviousFundamentalNote",value:function(t){var n=e.pitchEnumValues.indexOf(t);return n>0?e.pitchEnumValues[n-1]:e.pitchEnumValues[e.pitchEnumValues.length-1]}}],[{key:"getNoteEnumString",value:function(e){switch(e){case 0:return"C";case 2:return"D";case 4:return"E";case 5:return"F";case 7:return"G";case 9:return"A";case 11:return"B";default:return""}}},{key:"lineShiftFromNoteEnum",value:function(t,n){if(0===n)return[t,0];var r=e.pitchEnumValues,i=r.indexOf(t),a=0,o=(i+n)%r.length;return i+n>r.length-1&&(a=1),o<0&&(o=r.length+o,a=-1),[r[o],a]}},{key:"CalculateTransposedHalfTone",value:function(t,n){var r=t.fundamentalNote+t.AccidentalHalfTones+n;return e.WrapAroundCheck(r,12)}},{key:"WrapAroundCheck",value:function(e,t){for(var n=0;e<0;)e+=t,n--;for(;e>=t;)e-=t,n++;return{overflow:n,halftone:e}}},{key:"calcFrequency",value:function(t,n){var r,i=0;if(t instanceof e){var a=t;i=a.octave-1,r=a.fundamentalNote-9+a.AccidentalHalfTones}else if("number"==typeof t){r=t-57}var o=window.DYSubjectId,s=0;for(var l in"COLEXIU"===window.DYEnvironment&&(Additional[12]=[120]),Additional){if(Object.prototype.hasOwnProperty.call(Additional,l))if(Additional[l].includes(o)){s=parseFloat(l);break}}var u=r+s;return"next"===n&&u++,"prev"===n&&u--,442*Math.pow(2,i)*Math.pow(2,u/12)}},{key:"calcFractionalKey",value:function(t){return Math.log(t/440)/Math.LN10*e.halftoneFactor+57}},{key:"fromFrequency",value:function(t){var n=e.calcFractionalKey(t)+.5,r=Math.floor(n/12)-e.octXmlDiff,i=Math.floor(n)%12,a=i,o=2;return-1===this.pitchEnumValues.indexOf(a)&&(a=i-1,o=0),new e(a,r,o)}},{key:"fromHalftone",value:function(t){var n=Math.floor(t/12)-e.octXmlDiff,r=t%12,i=r,a=2;return-1===this.pitchEnumValues.indexOf(i)&&(i=r-1,a=0),new e(i,n,a)}},{key:"ceiling",value:function(e){var t=e%=12;return-1===this.pitchEnumValues.indexOf(t)&&(t=e+1),t}},{key:"floor",value:function(e){var t=e%=12;return-1===this.pitchEnumValues.indexOf(t)&&(t=e-1),t}},{key:"HalfTonesFromAccidental",value:function(e){switch(e){case 2:case 3:return 0;case 0:return 1;case 1:return-1;case 4:return 2;case 5:return-2;case 6:return 3;case 7:return-3;case 8:return.5;case 9:return-.5;case 10:return-.51;case 11:return 1.5;case 12:return-1.5;case 13:return.0013;case 14:return.0014;case 15:return-.0015;case 16:return.0016;case 17:return.0017;default:throw new Error("Unhandled AccidentalEnum value")}}},{key:"AccidentalFromHalfTones",value:function(e){switch(e){case 0:return 2;case 1:return 0;case-1:return 1;case 2:return 4;case-2:return 5;case 3:return 6;case-3:return 7;case.5:return 8;case-.5:return 9;case 1.5:return 11;case-1.5:return 12;default:return e>0&&e<1?8:e<0&&e>-1?9:8}}},{key:"accidentalVexflow",value:function(e){var t;switch(e){case 3:t="n";break;case 1:t="b";break;case 0:t="#";break;case 4:t="##";break;case 6:t="###";break;case 5:t="bb";break;case 7:t="bbs";break;case 8:t="+";break;case 9:t="d";break;case 10:t="bs";break;case 11:t="++";break;case 12:t="db";break;case 13:t="+-";break;case 14:t="++-";break;case 15:t="bss";break;case 16:t="o";break;case 17:t="k"}return t}},{key:"OctaveXmlDifference",get:function(){return e.octXmlDiff}}]),e}(),Pitch=_Pitch;Pitch.pitchEnumValues=[0,2,4,5,7,9,11],Pitch.halftoneFactor=12/(Math.LN2/Math.LN10),Pitch.octXmlDiff=3;var VerticalGraphicalStaffEntryContainer=function(){function e(t,n){_classCallCheck2(this,e),this.staffEntries=[],this.absoluteTimestamp=n,this.staffEntries=new Array(t)}return _createClass2(e,[{key:"Index",get:function(){return this.index},set:function(e){this.index=e}},{key:"AbsoluteTimestamp",get:function(){return this.absoluteTimestamp}},{key:"StaffEntries",get:function(){return this.staffEntries},set:function(e){this.staffEntries=e}},{key:"getFirstNonNullStaffEntry",value:function(){for(var e=0,t=this.staffEntries.length;er?1:0}}]),e}(),OutlineAndFillStyleEnum=function(e){return e[e.BaseWritingColor=0]="BaseWritingColor",e[e.FollowingCursor=1]="FollowingCursor",e[e.AlternativeFollowingCursor=2]="AlternativeFollowingCursor",e[e.PlaybackCursor=3]="PlaybackCursor",e[e.Highlighted=4]="Highlighted",e[e.ErrorUnderlay=5]="ErrorUnderlay",e[e.Selected=6]="Selected",e[e.SelectionSymbol=7]="SelectionSymbol",e[e.DebugColor1=8]="DebugColor1",e[e.DebugColor2=9]="DebugColor2",e[e.DebugColor3=10]="DebugColor3",e[e.SplitScreenDivision=11]="SplitScreenDivision",e[e.GreyTransparentOverlay=12]="GreyTransparentOverlay",e[e.MarkedArea1=13]="MarkedArea1",e[e.MarkedArea2=14]="MarkedArea2",e[e.MarkedArea3=15]="MarkedArea3",e[e.MarkedArea4=16]="MarkedArea4",e[e.MarkedArea5=17]="MarkedArea5",e[e.MarkedArea6=18]="MarkedArea6",e[e.MarkedArea7=19]="MarkedArea7",e[e.MarkedArea8=20]="MarkedArea8",e[e.MarkedArea9=21]="MarkedArea9",e[e.MarkedArea10=22]="MarkedArea10",e[e.Comment1=23]="Comment1",e[e.Comment2=24]="Comment2",e[e.Comment3=25]="Comment3",e[e.Comment4=26]="Comment4",e[e.Comment5=27]="Comment5",e[e.Comment6=28]="Comment6",e[e.Comment7=29]="Comment7",e[e.Comment8=30]="Comment8",e[e.Comment9=31]="Comment9",e[e.Comment10=32]="Comment10",e}(OutlineAndFillStyleEnum||{}),OUTLINE_AND_FILL_STYLE_DICT=new Dictionary;OUTLINE_AND_FILL_STYLE_DICT.setValue(0,"Thistle"),OUTLINE_AND_FILL_STYLE_DICT.setValue(1,"Aqua"),OUTLINE_AND_FILL_STYLE_DICT.setValue(2,"Azure"),OUTLINE_AND_FILL_STYLE_DICT.setValue(3,"Bisque"),OUTLINE_AND_FILL_STYLE_DICT.setValue(4,"CadetBlue"),OUTLINE_AND_FILL_STYLE_DICT.setValue(5,"DarkBlue"),OUTLINE_AND_FILL_STYLE_DICT.setValue(6,"DarkGoldenRod"),OUTLINE_AND_FILL_STYLE_DICT.setValue(7,"BlanchedAlmond"),OUTLINE_AND_FILL_STYLE_DICT.setValue(8,"Chartreuse"),OUTLINE_AND_FILL_STYLE_DICT.setValue(9,"DarkGreen"),OUTLINE_AND_FILL_STYLE_DICT.setValue(10,"DarkOrange"),OUTLINE_AND_FILL_STYLE_DICT.setValue(11,"FireBrick"),OUTLINE_AND_FILL_STYLE_DICT.setValue(12,"DarkSalmon"),OUTLINE_AND_FILL_STYLE_DICT.setValue(13,"DarkSeaGreen"),OUTLINE_AND_FILL_STYLE_DICT.setValue(14,"DarkOrchid"),OUTLINE_AND_FILL_STYLE_DICT.setValue(15,"Aquamarine"),OUTLINE_AND_FILL_STYLE_DICT.setValue(16,"DarkKhaki"),OUTLINE_AND_FILL_STYLE_DICT.setValue(17,"ForestGreen"),OUTLINE_AND_FILL_STYLE_DICT.setValue(18,"AliceBlue"),OUTLINE_AND_FILL_STYLE_DICT.setValue(19,"DeepPink"),OUTLINE_AND_FILL_STYLE_DICT.setValue(20,"Coral"),OUTLINE_AND_FILL_STYLE_DICT.setValue(21,"DarkOliveGreen"),OUTLINE_AND_FILL_STYLE_DICT.setValue(22,"Chocolate"),OUTLINE_AND_FILL_STYLE_DICT.setValue(23,"DodgerBlue"),OUTLINE_AND_FILL_STYLE_DICT.setValue(24,"Blue"),OUTLINE_AND_FILL_STYLE_DICT.setValue(25,"Beige"),OUTLINE_AND_FILL_STYLE_DICT.setValue(26,"Crimson"),OUTLINE_AND_FILL_STYLE_DICT.setValue(27,"Fuchsia"),OUTLINE_AND_FILL_STYLE_DICT.setValue(28,"Brown"),OUTLINE_AND_FILL_STYLE_DICT.setValue(29,"BlanchedAlmond"),OUTLINE_AND_FILL_STYLE_DICT.setValue(30,"CornflowerBlue"),OUTLINE_AND_FILL_STYLE_DICT.setValue(31,"Cornsilk"),OUTLINE_AND_FILL_STYLE_DICT.setValue(32,"DarkGrey");var GraphicalLayers=function(e){return e[e.Background=0]="Background",e[e.Highlight=1]="Highlight",e[e.MeasureError=2]="MeasureError",e[e.SelectionSymbol=3]="SelectionSymbol",e[e.Cursor=4]="Cursor",e[e.PSI_Debug=5]="PSI_Debug",e[e.Notes=6]="Notes",e[e.Comment=7]="Comment",e[e.Debug_above=8]="Debug_above",e}(GraphicalLayers||{}),NoteState=function(e){return e[e.Normal=0]="Normal",e[e.Selected=1]="Selected",e[e.Follow_Confirmed=2]="Follow_Confirmed",e[e.QFeedback_NotFound=3]="QFeedback_NotFound",e[e.QFeedback_OK=4]="QFeedback_OK",e[e.QFeedback_Perfect=5]="QFeedback_Perfect",e[e.Debug1=6]="Debug1",e[e.Debug2=7]="Debug2",e[e.Debug3=8]="Debug3",e}(NoteState||{}),AutoColorSet=function(e){return e.C="#d82c6b",e.D="#F89D15",e.E="#FFE21A",e.F="#4dbd5c",e.G="#009D96",e.A="#43469d",e.B="#76429c",e.Rest="#000000",e}(AutoColorSet||{}),GraphicalLine=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:OutlineAndFillStyleEnum.BaseWritingColor,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;_classCallCheck2(this,e),this.start=t,this.end=n,this.width=r,this.styleId=i,this.colorHex=a}return _createClass2(e,[{key:"Start",get:function(){return this.start},set:function(e){this.start=e}},{key:"End",get:function(){return this.end},set:function(e){this.end=e}},{key:"Width",get:function(){return this.width},set:function(e){this.width=e}}]),e}(),ClefInstruction=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;return _classCallCheck2(this,n),(e=t.call(this,void 0)).clefType=0,e.line=2,e.octaveOffset=0,e.line=a,e.clefType=r,e.octaveOffset=i,e.calcParameters(),e}return _createClass2(n,[{key:"ClefType",get:function(){return this.clefType},set:function(e){this.clefType=e}},{key:"Line",get:function(){return this.line},set:function(e){this.line=e}},{key:"OctaveOffset",get:function(){return this.octaveOffset},set:function(e){this.octaveOffset=e}},{key:"ClefPitch",get:function(){return this.clefPitch},set:function(e){this.clefPitch=e}},{key:"ReferenceCyPosition",get:function(){return this.referenceCyPosition},set:function(e){this.referenceCyPosition=e}},{key:"Equals",value:function(e){return this===e||!(!this||!e)&&(this.clefPitch===e.clefPitch&&this.Line===e.Line)}},{key:"NotEqual",value:function(e){return!this.Equals(e)}},{key:"ToString",value:function(){return"ClefType: "+this.clefType}},{key:"calcParameters",value:function(){switch(this.clefType){case 0:this.clefPitch=new Pitch(NoteEnum.G,1+this.octaveOffset,AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+2;break;case 1:this.clefPitch=new Pitch(NoteEnum.F,0+this.octaveOffset,AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+1.5;break;case 2:this.clefPitch=new Pitch(NoteEnum.C,1+this.octaveOffset,AccidentalEnum.NONE),this.referenceCyPosition=5-this.line;break;case 3:this.clefPitch=new Pitch(NoteEnum.C,2,AccidentalEnum.NONE),this.referenceCyPosition=2;break;case 4:this.clefPitch=new Pitch(NoteEnum.G,0,AccidentalEnum.NONE),this.referenceCyPosition=0;break;default:throw new ArgumentOutOfRangeException("clefType")}}}],[{key:"getDefaultClefFromMidiInstrument",value:function(e){switch(e){case 0:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 43:return new n(1,0,4);default:return new n(0,0,2)}}},{key:"getAllPossibleClefs",value:function(){for(var e=[],t=0;t<=2;t++){var r=new n(0,t,2);e.push(r)}for(var i=-2;i<=0;i++){var a=new n(1,i,4);e.push(a)}return e}},{key:"isSupportedClef",value:function(e){switch(e){case 0:case 1:case 2:case 3:case 4:return!0;default:return!1}}}]),n}(AbstractNotationInstruction),ClefEnum=function(e){return e[e.G=0]="G",e[e.F=1]="F",e[e.C=2]="C",e[e.percussion=3]="percussion",e[e.TAB=4]="TAB",e}(ClefEnum||{}),MidiInstrument=function(e){return e[e.None=-1]="None",e[e.Acoustic_Grand_Piano=0]="Acoustic_Grand_Piano",e[e.Bright_Acoustic_Piano=1]="Bright_Acoustic_Piano",e[e.Electric_Grand_Piano=2]="Electric_Grand_Piano",e[e.Honky_tonk_Piano=3]="Honky_tonk_Piano",e[e.Electric_Piano_1=4]="Electric_Piano_1",e[e.Electric_Piano_2=5]="Electric_Piano_2",e[e.Harpsichord=6]="Harpsichord",e[e.Clavinet=7]="Clavinet",e[e.Celesta=8]="Celesta",e[e.Glockenspiel=9]="Glockenspiel",e[e.Music_Box=10]="Music_Box",e[e.Vibraphone=11]="Vibraphone",e[e.Marimba=12]="Marimba",e[e.Xylophone=13]="Xylophone",e[e.Tubular_Bells=14]="Tubular_Bells",e[e.Dulcimer=15]="Dulcimer",e[e.Drawbar_Organ=16]="Drawbar_Organ",e[e.Percussive_Organ=17]="Percussive_Organ",e[e.Rock_Organ=18]="Rock_Organ",e[e.Church_Organ=19]="Church_Organ",e[e.Reed_Organ=20]="Reed_Organ",e[e.Accordion=21]="Accordion",e[e.Harmonica=22]="Harmonica",e[e.Tango_Accordion=23]="Tango_Accordion",e[e.Acoustic_Guitar_nylon=24]="Acoustic_Guitar_nylon",e[e.Acoustic_Guitar_steel=25]="Acoustic_Guitar_steel",e[e.Electric_Guitar_jazz=26]="Electric_Guitar_jazz",e[e.Electric_Guitar_clean=27]="Electric_Guitar_clean",e[e.Electric_Guitar_muted=28]="Electric_Guitar_muted",e[e.Overdriven_Guitar=29]="Overdriven_Guitar",e[e.Distortion_Guitar=30]="Distortion_Guitar",e[e.Guitar_harmonics=31]="Guitar_harmonics",e[e.Acoustic_Bass=32]="Acoustic_Bass",e[e.Electric_Bass_finger=33]="Electric_Bass_finger",e[e.Electric_Bass_pick=34]="Electric_Bass_pick",e[e.Fretless_Bass=35]="Fretless_Bass",e[e.Slap_Bass_1=36]="Slap_Bass_1",e[e.Slap_Bass_2=37]="Slap_Bass_2",e[e.Synth_Bass_1=38]="Synth_Bass_1",e[e.Synth_Bass_2=39]="Synth_Bass_2",e[e.Violin=40]="Violin",e[e.Viola=41]="Viola",e[e.Cello=42]="Cello",e[e.Contrabass=43]="Contrabass",e[e.Tremolo_Strings=44]="Tremolo_Strings",e[e.Pizzicato_Strings=45]="Pizzicato_Strings",e[e.Orchestral_Harp=46]="Orchestral_Harp",e[e.Timpani=47]="Timpani",e[e.String_Ensemble_1=48]="String_Ensemble_1",e[e.String_Ensemble_2=49]="String_Ensemble_2",e[e.Synth_Strings_1=50]="Synth_Strings_1",e[e.Synth_Strings_2=51]="Synth_Strings_2",e[e.Choir_Aahs=52]="Choir_Aahs",e[e.Voice_Oohs=53]="Voice_Oohs",e[e.Synth_Voice=54]="Synth_Voice",e[e.Orchestra_Hit=55]="Orchestra_Hit",e[e.Trumpet=56]="Trumpet",e[e.Trombone=57]="Trombone",e[e.Tuba=58]="Tuba",e[e.Muted_Trumpet=59]="Muted_Trumpet",e[e.French_Horn=60]="French_Horn",e[e.Brass_Section=61]="Brass_Section",e[e.Synth_Brass_1=62]="Synth_Brass_1",e[e.Synth_Brass_2=63]="Synth_Brass_2",e[e.Soprano_Sax=64]="Soprano_Sax",e[e.Alto_Sax=65]="Alto_Sax",e[e.Tenor_Sax=66]="Tenor_Sax",e[e.Baritone_Sax=67]="Baritone_Sax",e[e.Oboe=68]="Oboe",e[e.English_Horn=69]="English_Horn",e[e.Bassoon=70]="Bassoon",e[e.Clarinet=71]="Clarinet",e[e.Piccolo=72]="Piccolo",e[e.Flute=73]="Flute",e[e.Recorder=74]="Recorder",e[e.Pan_Flute=75]="Pan_Flute",e[e.Blown_Bottle=76]="Blown_Bottle",e[e.Shakuhachi=77]="Shakuhachi",e[e.Whistle=78]="Whistle",e[e.Ocarina=79]="Ocarina",e[e.Lead_1_square=80]="Lead_1_square",e[e.Lead_2_sawtooth=81]="Lead_2_sawtooth",e[e.Lead_3_calliope=82]="Lead_3_calliope",e[e.Lead_4_chiff=83]="Lead_4_chiff",e[e.Lead_5_charang=84]="Lead_5_charang",e[e.Lead_6_voice=85]="Lead_6_voice",e[e.Lead_7_fifths=86]="Lead_7_fifths",e[e.Lead_8_bass_lead=87]="Lead_8_bass_lead",e[e.Pad_1_new_age=88]="Pad_1_new_age",e[e.Pad_2_warm=89]="Pad_2_warm",e[e.Pad_3_polysynth=90]="Pad_3_polysynth",e[e.Pad_4_choir=91]="Pad_4_choir",e[e.Pad_5_bowed=92]="Pad_5_bowed",e[e.Pad_6_metallic=93]="Pad_6_metallic",e[e.Pad_7_halo=94]="Pad_7_halo",e[e.Pad_8_sweep=95]="Pad_8_sweep",e[e.FX_1_rain=96]="FX_1_rain",e[e.FX_2_soundtrack=97]="FX_2_soundtrack",e[e.FX_3_crystal=98]="FX_3_crystal",e[e.FX_4_atmosphere=99]="FX_4_atmosphere",e[e.FX_5_brightness=100]="FX_5_brightness",e[e.FX_6_goblins=101]="FX_6_goblins",e[e.FX_7_echoes=102]="FX_7_echoes",e[e.FX_8_scifi=103]="FX_8_scifi",e[e.Sitar=104]="Sitar",e[e.Banjo=105]="Banjo",e[e.Shamisen=106]="Shamisen",e[e.Koto=107]="Koto",e[e.Kalimba=108]="Kalimba",e[e.Bag_pipe=109]="Bag_pipe",e[e.Fiddle=110]="Fiddle",e[e.Shanai=111]="Shanai",e[e.Tinkle_Bell=112]="Tinkle_Bell",e[e.Agogo=113]="Agogo",e[e.Steel_Drums=114]="Steel_Drums",e[e.Woodblock=115]="Woodblock",e[e.Taiko_Drum=116]="Taiko_Drum",e[e.Melodic_Tom=117]="Melodic_Tom",e[e.Synth_Drum=118]="Synth_Drum",e[e.Reverse_Cymbal=119]="Reverse_Cymbal",e[e.Guitar_Fret_Noise=120]="Guitar_Fret_Noise",e[e.Breath_Noise=121]="Breath_Noise",e[e.Seashore=122]="Seashore",e[e.Bird_Tweet=123]="Bird_Tweet",e[e.Telephone_Ring=124]="Telephone_Ring",e[e.Helicopter=125]="Helicopter",e[e.Applause=126]="Applause",e[e.Gunshot=127]="Gunshot",e[e.euphonium=128]="euphonium",e[e.AltoClarinetInEb=200]="AltoClarinetInEb",e[e.TrumpetInBb=201]="TrumpetInBb",e[e.BaritoneSaxophone=202]="BaritoneSaxophone",e[e.TenorSaxophone=203]="TenorSaxophone",e[e.ClarinetInEb=204]="ClarinetInEb",e[e.Euphonium=205]="Euphonium",e[e.Alto_Clarinet=206]="Alto_Clarinet",e[e.Bass_Clarinet=207]="Bass_Clarinet",e[e.Bass_Trombone=208]="Bass_Trombone",e[e.clarinet_in_bb=209]="clarinet_in_bb",e[e.clarinet_in_eb=210]="clarinet_in_eb",e[e.Percussion=135]="Percussion",e}(MidiInstrument||{}),_KeyInstruction=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return _classCallCheck2(this,n),(e=t.call(this,r)).isTransposedBy=0,e.Key=i,e.keyTypeOriginal=i,e.mode=a,e.alteratedNotes=e.calcAlteratedNotes(),e}return _createClass2(n,[{key:"Key",get:function(){return this.keyType},set:function(e){this.keyType=e,this.alteratedNotes=this.calcAlteratedNotes()}},{key:"Mode",get:function(){return this.mode},set:function(e){this.mode=e}},{key:"AlteratedNotes",get:function(){return this.alteratedNotes}},{key:"calcAlteratedNotes",value:function(){var e=[];if(this.keyType>0)for(var t=0;t=0}},{key:"getAlterationForPitch",value:function(e){return this.keyType>0&&this.alteratedNotes.indexOf(e.FundamentalNote)<=this.keyType?AccidentalEnum.SHARP:this.keyType<0&&this.alteratedNotes.indexOf(e.FundamentalNote)<=Math.abs(this.keyType)?AccidentalEnum.FLAT:AccidentalEnum.NONE}},{key:"ToString",value:function(){return"Key: "+this.keyType+this.mode}},{key:"OperatorEquals",value:function(e){var t=this;return t===e||!(!t||!e)&&(t.Key===e.Key&&t.Mode===e.Mode)}},{key:"OperatorNotEqual",value:function(e){return!this.OperatorEquals(e)}}],[{key:"copy",value:function(e){var t=new n(e.parent,e.Key,e.Mode);return t.keyTypeOriginal=e.keyTypeOriginal,t}},{key:"getAllPossibleMajorKeyInstructions",value:function(){for(var e=[],t=-7;t<7;t++){var r=new n(void 0,t,0);e.push(r)}return e}}]),n}(AbstractNotationInstruction),KeyInstruction=_KeyInstruction;KeyInstruction.sharpPositionList=[NoteEnum.F,NoteEnum.C,NoteEnum.G,NoteEnum.D,NoteEnum.A,NoteEnum.E,NoteEnum.B],KeyInstruction.flatPositionList=[NoteEnum.B,NoteEnum.E,NoteEnum.A,NoteEnum.D,NoteEnum.G,NoteEnum.C,NoteEnum.F];var KeyEnum=function(e){return e[e.major=0]="major",e[e.minor=1]="minor",e[e.none=2]="none",e[e.dorian=3]="dorian",e[e.phrygian=4]="phrygian",e[e.lydian=5]="lydian",e[e.mixolydian=6]="mixolydian",e[e.aeolian=7]="aeolian",e[e.ionian=8]="ionian",e[e.locrian=9]="locrian",e}(KeyEnum||{});Array.prototype.last||Object.defineProperty(Array.prototype,"last",{enumerable:!1,value:function(){return this[this.length-1]}}),Array.prototype.clear||Object.defineProperty(Array.prototype,"clear",{enumerable:!1,value:function(){this.length=0}}),Array.prototype.contains||Object.defineProperty(Array.prototype,"contains",{enumerable:!1,value:function(e){return-1!==this.indexOf(e)}});var CollectionUtil=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,null,[{key:"contains2",value:function(e,t){for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e.length-1,a=1;r<=i;){var o=n(e[a=Math.floor((r+i)/2)],t);if(0===o)return a;o<0&&(r=a+1),0=0;n--){var r=this.measureList[n][t];if(r)return r}}},{key:"findGraphicalStaffEntryFromMeasureList",value:function(e,t,n){for(var r=t;r0)return a.staffEntries[0]}}},{key:"getFirstVisibleMeasuresListFromIndices",value:function(e,t){for(var n=[],r=this.measureList[0].length,i=e;i<=t;i++)for(var a=0;a=0;n--){if(this.verticalGraphicalStaffEntryContainers[n].AbsoluteTimestamp.lt(e)){var r=new VerticalGraphicalStaffEntryContainer(this.numberOfStaves,e);return this.verticalGraphicalStaffEntryContainers.splice(n+1,0,r),r}if(this.verticalGraphicalStaffEntryContainers[n].AbsoluteTimestamp.Equals(e))return this.verticalGraphicalStaffEntryContainers[n]}}},{key:"GetVerticalContainerFromTimestamp",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=CollectionUtil.binarySearch(this.verticalGraphicalStaffEntryContainers,new VerticalGraphicalStaffEntryContainer(0,e),VerticalGraphicalStaffEntryContainer.compareByTimestamp,t);if(n>=0)return this.verticalGraphicalStaffEntryContainers[n]}},{key:"GetInterpolatedIndexInVerticalContainers",value:function(e){var t=this.verticalGraphicalStaffEntryContainers,n=0,r=t.length-1,i=void 0,a=void 0;if(e.lte(t[t.length-1].AbsoluteTimestamp)){for(;r-n>1;){var o=Math.floor((r+n)/2);if(t[n].AbsoluteTimestamp.Equals(e)){r=n;break}if(t[r].AbsoluteTimestamp.Equals(e)){n=r;break}if(t[o].AbsoluteTimestamp.Equals(e))return this.verticalGraphicalStaffEntryContainers.indexOf(t[o]);e.lt(t[o].AbsoluteTimestamp)?r=o:n=o}if(n===r)return this.verticalGraphicalStaffEntryContainers.indexOf(t[n]);i=t[n].AbsoluteTimestamp,a=t[r].AbsoluteTimestamp}else i=t[t.length-1].AbsoluteTimestamp,a=Fraction$1.plus(this.getLongestStaffEntryDuration(t.length-1),i),r=t.length;var s=a.RealValue-i.RealValue,l=r-(a.RealValue-e.RealValue)/s;return Math.min(l,this.verticalGraphicalStaffEntryContainers.length)}},{key:"getVisibleStavesIndicesFromSourceMeasure",value:function(e){for(var t=[],n=[],r=0,i=e.length;r1&&void 0!==arguments[1])||arguments[1],n=this.measureList.length-1;return t&&(n=Math.min(n,this.musicSheet.Rules.MaxMeasureToDrawIndex)),this.measureList[n][e]}},{key:"getMeasureIndex",value:function(e,t,n){for(t=0;t1&&void 0!==arguments[1]?arguments[1]:GraphicalObject.name,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:20,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0,o=[];0===o.length&&n<=r;){var s=new BoundingBox$1(void 0);s.BorderLeft=e.x-n,s.BorderTop=e.y-n,s.BorderRight=e.x+n,s.BorderBottom=e.y+n,s.AbsolutePosition=new PointF2D(e.x,e.y),s.calculateAbsolutePosition();for(var l=0,u=this.MusicPages.length;la.PositionAndShape.RelativePosition.x&&(n=a):n=a)}}catch(o){loglevelExports.info("GraphicalMusicSheet.getStaffEntry",o)}return n}},{key:"GetPreviousVisibleContainerIndex",value:function(e){for(var t=e-1;t>=0;t--)for(var n=this.verticalGraphicalStaffEntryContainers[t].StaffEntries,r=0,i=n.length;r=0;i--)if(n=this.getStaffEntry(i)){if(!t)return n;if(n.sourceStaffEntry.ParentStaff.ParentInstrument.Visible)return n}}},{key:"findClosestRightStaffEntry",value:function(e,t){for(var n=void 0,r=Math.max(0,Math.ceil(e));r=t/2?parseInt(e/t,10)*t+t:parseInt(e/t,10)*t},Vex.MidLine=function(e,t){var n=t+(e-t)/2;return n%2>0&&(n=Vex.RoundN(10*n,5)/10),n},Vex.SortAndUnique=function(e,t,n){if(e.length>1){var r,i=[];e.sort(t);for(var a=0;a3&&void 0!==arguments[3]?arguments[3]:"#55";e.save(),e.setFillStyle(r),e.beginPath(),e.arc(t,n,3,0,2*Math.PI,!0),e.closePath(),e.fill(),e.restore()},Vex.BM=function(e,t){var n=(new Date).getTime();t();var r=(new Date).getTime()-n;Vex.L(e+r+"ms")},Vex.StackTrace=function(){return(new Error).stack},Vex.W=function(){for(var e=arguments.length,t=new Array(e),n=0;n0}},{key:"greaterThanEquals",value:function(t){var n=e.__compareB.copy(this);return n.subtract(t),n.numerator>=0}},{key:"lessThan",value:function(e){return!this.greaterThanEquals(e)}},{key:"lessThanEquals",value:function(e){return!this.greaterThan(e)}},{key:"clone",value:function(){return new e(this.numerator,this.denominator)}},{key:"copy",value:function(e){return"number"==typeof e?this.set(e||0,1):this.set(e.numerator,e.denominator)}},{key:"quotient",value:function(){return Math.floor(this.numerator/this.denominator)}},{key:"fraction",value:function(){return this.numerator%this.denominator}},{key:"abs",value:function(){return this.denominator=Math.abs(this.denominator),this.numerator=Math.abs(this.numerator),this}},{key:"toString",value:function(){return this.numerator+"/"+this.denominator}},{key:"toSimplifiedString",value:function(){return e.__tmp.copy(this).simplify().toString()}},{key:"toMixedString",value:function(){var t="",n=this.quotient(),r=e.__tmp.copy(this);return n<0?r.abs().fraction():r.fraction(),0!==n?(t+=n,0!==r.numerator&&(t+=" "+r.toSimplifiedString())):t=0===r.numerator?"0":r.toSimplifiedString(),t}},{key:"parse",value:function(e){var t=e.split("/"),n=parseInt(t[0],10),r=t[1]?parseInt(t[1],10):1;return this.set(n,r)}}],[{key:"GCD",value:function(e,t){if("number"!=typeof e||"number"!=typeof t)throw new Vex.RERR("BadArgument","Invalid numbers: ".concat(e,", ").concat(t));for(var n;0!==t;)n=t,t=e%t,e=n;return e}},{key:"LCM",value:function(t,n){return t*n/e.GCD(t,n)}},{key:"LCMM",value:function(t){if(0===t.length)return 0;if(1===t.length)return t[0];if(2===t.length)return e.LCM(t[0],t[1]);var n=t[0];return t.shift(),e.LCM(n,e.LCMM(t))}}]),e}();Fraction.__compareA=new Fraction,Fraction.__compareB=new Fraction,Fraction.__tmp=new Fraction;var X$3=Vex.MakeException("RegistryError");function setIndexValue(e,t,n,r,i){e[t][n]||(e[t][n]={}),e[t][n][r]=i}var Registry=function(){function e(){_classCallCheck2(this,e),this.clear()}return _createClass2(e,[{key:"clear",value:function(){return this.index={id:{},type:{},class:{}},this}},{key:"updateIndex",value:function(e){var t=e.id,n=e.name,r=e.value,i=e.oldValue,a=this.getElementById(t);null!==i&&this.index[n][i]&&delete this.index[n][i][t],null!==r&&setIndexValue(this.index,n,r,a.getAttribute("id"),a)}},{key:"register",value:function(t,n){var r=this;if(!(n=n||t.getAttribute("id")))throw new X$3("Can't add element without `id` attribute to registry",t);return t.setAttribute("id",n),setIndexValue(this.index,"id",n,n,t),e.INDEXES.forEach((function(e){r.updateIndex({id:n,name:e,value:t.getAttribute(e),oldValue:null})})),t.onRegister(this),this}},{key:"getElementById",value:function(e){return this.index.id[e]?this.index.id[e][e]:null}},{key:"getElementsByAttribute",value:function(e,t){var n=this.index[e];return n&&n[t]?Object.keys(n[t]).map((function(e){return n[t][e]})):[]}},{key:"getElementsByType",value:function(e){return this.getElementsByAttribute("type",e)}},{key:"getElementsByClass",value:function(e){return this.getElementsByAttribute("class",e)}},{key:"onUpdate",value:function(t){var n=t.id,r=t.name,i=t.value,a=t.oldValue;return function(e,t){return e.filter((function(e){return e===t})).length>0}(e.INDEXES.concat(["id","class"]),r)?(this.updateIndex({id:n,name:r,value:i,oldValue:a}),this):this}}],[{key:"INDEXES",get:function(){return["type"]}},{key:"enableDefaultRegistry",value:function(t){e.defaultRegistry=t}},{key:"getDefaultRegistry",value:function(){return e.defaultRegistry}},{key:"disableDefaultRegistry",value:function(){e.defaultRegistry=null}}]),e}();Registry.defaultRegistry=null;var Element$1=function(){function e(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).type;_classCallCheck2(this,e),this.attrs={id:e.newID(),el:null,type:t||"Base",classes:{}},this.boundingBox=null,this.context=null,this.rendered=!1,Registry.getDefaultRegistry()&&Registry.getDefaultRegistry().register(this)}return _createClass2(e,[{key:"setStyle",value:function(e){return this.style=e,this}},{key:"getStyle",value:function(){return this.style}},{key:"applyStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.context,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getStyle();return t?(e.save(),t.shadowColor&&e.setShadowColor(t.shadowColor),t.shadowBlur&&e.setShadowBlur(t.shadowBlur),t.fillStyle&&e.setFillStyle(t.fillStyle),t.strokeStyle&&e.setStrokeStyle(t.strokeStyle),t.lineWidth&&e.setLineWidth(t.lineWidth),this):this}},{key:"restoreStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.context;return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getStyle())?(e.restore(),this):this}},{key:"drawWithStyle",value:function(){this.checkContext(),this.applyStyle(),this.draw(),this.restoreStyle()}},{key:"hasClass",value:function(e){return!0===this.attrs.classes[e]}},{key:"addClass",value:function(e){return this.attrs.classes[e]=!0,this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:e,oldValue:null}),this}},{key:"removeClass",value:function(e){return delete this.attrs.classes[e],this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:null,oldValue:e}),this}},{key:"onRegister",value:function(e){return this.registry=e,this}},{key:"isRendered",value:function(){return this.rendered}},{key:"setRendered",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.rendered=e,this}},{key:"getAttributes",value:function(){return this.attrs}},{key:"getAttribute",value:function(e){return this.attrs[e]}},{key:"setAttribute",value:function(e,t){var n=this.attrs.id,r=this.attrs[e];return this.attrs[e]=t,this.registry&&this.registry.onUpdate({id:n,name:e,value:t,oldValue:r}),this}},{key:"getContext",value:function(){return this.context}},{key:"setContext",value:function(e){return this.context=e,this}},{key:"getBoundingBox",value:function(){return this.boundingBox}},{key:"checkContext",value:function(){if(!this.context)throw new Vex.RERR("NoContext","No rendering context attached to instance");return this.context}}],[{key:"newID",value:function(){return"auto"+e.ID++}}]),e}();Element$1.ID=1e3;var BoundingBoxComputation=function(){function e(t,n,r,i){_classCallCheck2(this,e),this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.addPoint(t,n),this.addPoint(r,i)}return _createClass2(e,[{key:"width",value:function(){return this.x2-this.x1}},{key:"height",value:function(){return this.y2-this.y1}},{key:"addPoint",value:function(e,t){null!=e&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),ethis.x2&&(this.x2=e)),null!=t&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),tthis.y2&&(this.y2=t))}},{key:"addX",value:function(e){this.addPoint(e,null)}},{key:"addY",value:function(e){this.addPoint(null,e)}},{key:"addQuadraticCurve",value:function(e,t,n,r,i,a){var o=e+2/3*(n-e),s=t+2/3*(r-t),l=o+1/3*(i-e),u=s+1/3*(a-t);this.addBezierCurve(e,t,o,s,l,u,i,a)}},{key:"addBezierCurve",value:function(e,t,n,r,i,a,o,s){var l,u=[e,t],c=[n,r],h=[i,a],d=[o,s];this.addPoint(u[0],u[1]),this.addPoint(d[0],d[1]);var f=function(e,t){return Math.pow(1-e,3)*u[t]+3*Math.pow(1-e,2)*e*c[t]+3*(1-e)*Math.pow(e,2)*h[t]+Math.pow(e,3)*d[t]};for(l=0;l<=1;l++){var p=6*u[l]-12*c[l]+6*h[l],v=-3*u[l]+9*c[l]-9*h[l]+3*d[l],m=3*c[l]-3*u[l];if(0!==v){var g=Math.pow(p,2)-4*m*v;if(!(g<0)){var y=(-p+Math.sqrt(g))/(2*v);0=6&&2*l%2==0&&(u=-1);var c=void 0!==o.int_val?12*s+o.int_val:null,h=o.code,d=o.shift_right,f={};if(i.length>2&&i[2]){var p=i[2].toUpperCase();f=Flow.keyProperties.customNoteHeads[p]||{}}return _objectSpread({key:a,octave:s,line:l,int_value:c,accidental:o.accidental,code:h,stroke:u,shift_right:d,displaced:!1},f)},Flow.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}},Flow.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}},Flow.integerToNote=function(e){if(void 0===e)throw new Vex.RERR("BadArguments","Undefined integer for integerToNote");if(e<-2)throw new Vex.RERR("BadArguments","integerToNote requires integer > -2: ".concat(e));var t=Flow.integerToNote.table[e];if(!t)throw new Vex.RERR("BadArguments","Unknown note value for integer: ".concat(e));return t},Flow.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"},Flow.tabToGlyph=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=null,r=0,i=0;if("X"===e.toString().toUpperCase()){var a=new Glyph("v7f",Flow.DEFAULT_TABLATURE_FONT_SCALE).getMetrics();n="v7f",r=a.width,i=-a.height/2}else r=Flow.textWidth(e.toString());return{text:e,code:n,getWidth:function(){return r*t},shift_y:i}},Flow.textWidth=function(e){return 7*e.toString().length},Flow.articulationCodes=function(e){return Flow.articulationCodes.articulations[e]},Flow.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}},Flow.accidentalCodes=function(e){return Flow.accidentalCodes.accidentals[e]},Flow.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}},Flow.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]}},Flow.ornamentCodes=function(e){return Flow.ornamentCodes.ornaments[e]},Flow.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"}},Flow.keySignature=function(e){var t=Flow.keySignature.keySpecs[e];if(!t)throw new Vex.RERR("BadKeySignature","Bad key signature spec: '".concat(e,"'"));if(!t.acc)return[];for(var n=Flow.keySignature.accidentalList(t.acc),r=[],i=0;i0&&void 0!==arguments[0]?arguments[0]:Flow.DEFAULT_NOTATION_FONT_SCALE;return new Glyph(this.code_head||"v53",e).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-Flow.STEM_HEIGHT,stem_down_extension:-Flow.STEM_HEIGHT,tabnote_stem_up_extension:-Flow.STEM_HEIGHT,tabnote_stem_down_extension:-Flow.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v53"},h:{code_head:"v59"},m:{code_head:"vf",stem_offset:0},r:{code_head:"v31",rest:!0,position:"B/5",dot_shiftY:.5},s:{getWidth:function(){return Flow.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},1:{common:{getWidth:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Flow.DEFAULT_NOTATION_FONT_SCALE;return new Glyph(this.code_head||"v1d",e).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-Flow.STEM_HEIGHT,stem_down_extension:-Flow.STEM_HEIGHT,tabnote_stem_up_extension:-Flow.STEM_HEIGHT,tabnote_stem_down_extension:-Flow.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v1d"},h:{code_head:"v46"},m:{code_head:"v92",stem_offset:-3},r:{code_head:"v5c",rest:!0,position:"D/5",dot_shiftY:.5},s:{getWidth:function(){return Flow.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},2:{common:{getWidth:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Flow.DEFAULT_NOTATION_FONT_SCALE;return new Glyph(this.code_head||"v81",e).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v81"},h:{code_head:"v2d"},m:{code_head:"v95",stem_offset:-3},r:{code_head:"vc",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5},s:{getWidth:function(){return Flow.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},4:{common:{getWidth:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Flow.DEFAULT_NOTATION_FONT_SCALE;return new Glyph(this.code_head||"vb",e).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e",stem_offset:-3},r:{code_head:"v7c",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1.5,line_below:1.5},s:{getWidth:function(){return Flow.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},8:{common:{getWidth:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Flow.DEFAULT_NOTATION_FONT_SCALE;return new Glyph(this.code_head||"vb",e).getMetrics().width},stem:!0,stem_offset:0,flag:!0,beam_count:1,code_flag_upstem:"v54",code_flag_downstem:"v9a",stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"va5",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:1},s:{getWidth:function(){return Flow.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},16:{common:{beam_count:2,getWidth:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Flow.DEFAULT_NOTATION_FONT_SCALE;return new Glyph(this.code_head||"vb",e).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v3f",code_flag_downstem:"v8f",stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v3c",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:2},s:{getWidth:function(){return Flow.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},32:{common:{beam_count:3,getWidth:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Flow.DEFAULT_NOTATION_FONT_SCALE;return new Glyph(this.code_head||"vb",e).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v47",code_flag_downstem:"v2a",stem_up_extension:9,stem_down_extension:9,tabnote_stem_up_extension:8,tabnote_stem_down_extension:5,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v55",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:2},s:{getWidth:function(){return Flow.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},64:{common:{beam_count:4,getWidth:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Flow.DEFAULT_NOTATION_FONT_SCALE;return new Glyph(this.code_head||"vb",e).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"va9",code_flag_downstem:"v58",stem_up_extension:13,stem_down_extension:13,tabnote_stem_up_extension:12,tabnote_stem_down_extension:9,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v38",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:3},s:{getWidth:function(){return Flow.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},128:{common:{beam_count:5,getWidth:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Flow.DEFAULT_NOTATION_FONT_SCALE;return new Glyph(this.code_head||"vb",e).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v9b",code_flag_downstem:"v30",stem_up_extension:22,stem_down_extension:22,tabnote_stem_up_extension:21,tabnote_stem_down_extension:18,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"vaa",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:1.5,line_above:3,line_below:3},s:{getWidth:function(){return Flow.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}}},Flow.smufl={},Flow.smufl.to_code_points={bracketTop:"v1b",bracketBottom:"v10",barlineTick:"v6f",segno:"v8c",coda:"v4d",gClef:"v83",cClef:"vad",fClef:"v79",unpitchedPercussionClef1:"v59","6stringTabClef":"v2f",timeSig0:"v0",timeSig1:"v1",timeSig2:"v2",timeSig3:"v3",timeSig4:"v4",timeSig5:"v5",timeSig6:"v6",timeSig7:"v7",timeSig8:"v8",timeSig9:"v9",timeSigCommon:"v41",timeSigCutCommon:"vb6",noteheadDoubleWhole:"v53",noteheadWhole:"v1d",noteheadHalf:"v81",noteheadBlack:"vb",noteheadXWhole:"v92",noteheadXHalf:"v95",noteheadXBlack:"v3e",noteheadCircleX:"v3b",noteheadTriangleUpWhole:"v49",noteheadTriangleUpHalf:"v93",noteheadTriangleUpBlack:"v40",noteheadDiamondWhole:"v46",noteheadDiamondHalf:"v2d",noteheadDiamondBlack:"v22",augmentationDot:"v23",tremolo1:"v74",flag8thUp:"v54",flag8thDown:"v9a",flag16thUp:"v3f",flag16thDown:"v8f",flag32ndUp:"v47",flag32ndDown:"v2a",flag64thUp:"va9",flag64thDown:"v58",flag128thUp:"v9b",flag128thDown:"v30",accidentalFlat:"v44",accidentalNatural:"v4e",accidentalSharp:"v18",accidentalDoubleSharp:"v7f",accidentalDoubleFlat:"v26",accidentalParensLeft:"v9c",accidentalParensRight:"v84",accidentalQuarterToneFlatStein:"vab",accidentalThreeQuarterTonesFlatZimmermann:"v9e",accidentalQuarterToneSharpStein:"v78",accidentalThreeQuarterTonesSharpStein:"v51",accidentalBuyukMucennebFlat:"v39",accidentalBakiyeFlat:"vb7",accidentalKomaSharp:"v51",accidentalKucukMucennebSharp:"v8d",accidentalKoron:"vd1",accidentalSori:"vd0",articAccentAbove:"v42",articAccentBelow:"v42",articTenutoAbove:"v25",articTenutoBelow:"v25",articStaccatoAbove:"v23",articStaccatoBelow:"v23",articStaccatissimoAbove:"v28",articMarcatoAbove:"va",fermataAbove:"v43",fermataBelow:"v5b",breathMarkComma:"v6c",breathMarkUpbow:"v8a",caesura:"v34",caesuraCurved:"v4b",restMaxima:"v59",restDoubleWhole:"v31",restWhole:"v5c",restHalf:"vc",restQuarter:"v7c",rest8th:"va5",rest16th:"v3c",rest32nd:"v55",rest64th:"v38",rest128th:"vaa",dynamicPiano:"vbf",dynamicMezzo:"v62",dynamicForte:"vba",dynamicRinforzando:"vba",dynamicSforzando:"v4a",dynamicZ:"v80",ornamentTrill:"v1f",ornamentTurn:"v72",ornamentTurnSlash:"v33",ornamentMordent:"v45",ornamentMordentInverted:"v1e",ornamentTremblement:"v86",ornamentPrecompAppoggTrill:"v20",ornamentPrecompSlideTrillDAnglebert:"v60",ornamentPrecompSlideTrillBach:"v29",ornamentPrecompTrillSuffixDandrieu:"v6d",ornamentPrecompDoubleCadenceUpperPrefix:"vb4",ornamentPrecompDoubleCadenceUpperPrefixTurn:"v68",ornamentPrecompTrillLowerSuffix:"v2c",stringsDownBow:"v94",stringsUpBow:"v75",stringsHarmonic:"vb9",pluckedSnapPizzicatoAbove:"v94",pluckedLeftHandPizzicato:"v8b",keyboardPedalPed:"v36",keyboardPedalUp:"v5d",pictChokeCymbal:"vb3",wiggleArpeggiatoUp:"va3",arrowheadBlackUp:"vc3",arrowheadBlackDown:"v52"},Flow.TIME4_4={num_beats:4,beat_value:4,resolution:Flow.RESOLUTION};var CanvasContext=function(){function e(t){_classCallCheck2(this,e),this.vexFlowCanvasContext=t,t.canvas?this.canvas=t.canvas:this.canvas={width:e.WIDTH,height:e.HEIGHT}}return _createClass2(e,[{key:"clear",value:function(){this.vexFlowCanvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}},{key:"openGroup",value:function(){}},{key:"closeGroup",value:function(){}},{key:"add",value:function(){}},{key:"setFont",value:function(e,t,n){return this.vexFlowCanvasContext.font=(n||"")+" "+t+"pt "+e,this}},{key:"setRawFont",value:function(e){return this.vexFlowCanvasContext.font=e,this}},{key:"setFillStyle",value:function(e){return this.vexFlowCanvasContext.fillStyle=e,this}},{key:"setBackgroundFillStyle",value:function(e){return this.background_fillStyle=e,this}},{key:"setStrokeStyle",value:function(e){return this.vexFlowCanvasContext.strokeStyle=e,this}},{key:"setShadowColor",value:function(e){return this.vexFlowCanvasContext.shadowColor=e,this}},{key:"setShadowBlur",value:function(e){return this.vexFlowCanvasContext.shadowBlur=e,this}},{key:"setLineWidth",value:function(e){return this.vexFlowCanvasContext.lineWidth=e,this}},{key:"setLineCap",value:function(e){return this.vexFlowCanvasContext.lineCap=e,this}},{key:"setLineDash",value:function(e){return this.vexFlowCanvasContext.lineDash=e,this}},{key:"scale",value:function(e,t){return this.vexFlowCanvasContext.scale(parseFloat(e),parseFloat(t))}},{key:"resize",value:function(e,t){var n=_slicedToArray(this.SanitizeCanvasDims(parseInt(e,10),parseInt(t,10)),2);return e=n[0],t=n[1],this.vexFlowCanvasContext.resize(e,t)}},{key:"rect",value:function(e,t,n,r){return this.vexFlowCanvasContext.rect(e,t,n,r)}},{key:"fillRect",value:function(e,t,n,r){return this.vexFlowCanvasContext.fillRect(e,t,n,r)}},{key:"clearRect",value:function(e,t,n,r){return this.vexFlowCanvasContext.clearRect(e,t,n,r)}},{key:"beginPath",value:function(){return this.vexFlowCanvasContext.beginPath()}},{key:"moveTo",value:function(e,t){return this.vexFlowCanvasContext.moveTo(e,t)}},{key:"lineTo",value:function(e,t){return this.vexFlowCanvasContext.lineTo(e,t)}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){return this.vexFlowCanvasContext.bezierCurveTo(e,t,n,r,i,a)}},{key:"quadraticCurveTo",value:function(e,t,n,r){return this.vexFlowCanvasContext.quadraticCurveTo(e,t,n,r)}},{key:"arc",value:function(e,t,n,r,i,a){return this.vexFlowCanvasContext.arc(e,t,n,r,i,a)}},{key:"glow",value:function(){return this.vexFlowCanvasContext.glow()}},{key:"fill",value:function(){return this.vexFlowCanvasContext.fill()}},{key:"stroke",value:function(){return this.vexFlowCanvasContext.stroke()}},{key:"closePath",value:function(){return this.vexFlowCanvasContext.closePath()}},{key:"measureText",value:function(e){return this.vexFlowCanvasContext.measureText(e)}},{key:"fillText",value:function(e,t,n){return this.vexFlowCanvasContext.fillText(e,t,n)}},{key:"save",value:function(){return this.vexFlowCanvasContext.save()}},{key:"restore",value:function(){return this.vexFlowCanvasContext.restore()}}],[{key:"WIDTH",get:function(){return 600}},{key:"HEIGHT",get:function(){return 400}},{key:"CANVAS_BROWSER_SIZE_LIMIT",get:function(){return 32767}},{key:"SanitizeCanvasDims",value:function(e,t){return Math.max(e,t)>this.CANVAS_BROWSER_SIZE_LIMIT&&(Vex.W("Canvas dimensions exceed browser limit. Cropping to "+this.CANVAS_BROWSER_SIZE_LIMIT),e>this.CANVAS_BROWSER_SIZE_LIMIT&&(e=this.CANVAS_BROWSER_SIZE_LIMIT),t>this.CANVAS_BROWSER_SIZE_LIMIT&&(t=this.CANVAS_BROWSER_SIZE_LIMIT)),[e,t]}}]),e}(),RaphaelContext=function(){function e(t){_classCallCheck2(this,e),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=[]}return _createClass2(e,[{key:"openGroup",value:function(){}},{key:"closeGroup",value:function(){}},{key:"add",value:function(){}},{key:"setFont",value:function(e,t,n){return this.state.font_family=e,this.state.font_size=t,this.state.font_weight=n,this.attributes.font=(this.state.font_weight||"")+" "+this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}},{key:"setRawFont",value:function(e){return this.attributes.font=e,this}},{key:"setFillStyle",value:function(e){return this.attributes.fill=e,this}},{key:"setBackgroundFillStyle",value:function(e){return this.background_attributes.fill=e,this.background_attributes.stroke=e,this}},{key:"setStrokeStyle",value:function(e){return this.attributes.stroke=e,this}},{key:"setShadowColor",value:function(e){return this.shadow_attributes.color=e,this}},{key:"setShadowBlur",value:function(e){return this.shadow_attributes.width=e,this}},{key:"setLineWidth",value:function(e){this.attributes["stroke-width"]=e,this.lineWidth=e}},{key:"setLineDash",value:function(){return this}},{key:"setLineCap",value:function(){return this}},{key:"scale",value:function(e,t){return this.state.scale={x:e,y:t},this.attributes.transform="S"+e+","+t+",0,0",this.attributes.scale=e+","+t+",0,0",this.attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this.background_attributes.transform="S"+e+","+t+",0,0",this.background_attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}},{key:"clear",value:function(){this.paper.clear()}},{key:"resize",value:function(e,t){return this.element.style.width=e,this.paper.setSize(e,t),this}},{key:"setViewBox",value:function(e){this.paper.canvas.setAttribute("viewBox",e)}},{key:"rect",value:function(e,t,n,r){return r<0&&(t+=r,r=-r),this.paper.rect(e,t,n-.5,r-.5).attr(this.attributes).attr("fill","none").attr("stroke-width",this.lineWidth),this}},{key:"fillRect",value:function(e,t,n,r){return r<0&&(t+=r,r=-r),this.paper.rect(e,t,n-.5,r-.5).attr(this.attributes),this}},{key:"clearRect",value:function(e,t,n,r){return r<0&&(t+=r,r=-r),this.paper.rect(e,t,n-.5,r-.5).attr(this.background_attributes),this}},{key:"beginPath",value:function(){return this.path="",this.pen.x=0,this.pen.y=0,this}},{key:"moveTo",value:function(e,t){return this.path+="M"+e+","+t,this.pen.x=e,this.pen.y=t,this}},{key:"lineTo",value:function(e,t){return this.path+="L"+e+","+t,this.pen.x=e,this.pen.y=t,this}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){return this.path+="C"+e+","+t+","+n+","+r+","+i+","+a,this.pen.x=i,this.pen.y=a,this}},{key:"quadraticCurveTo",value:function(e,t,n,r){return this.path+="Q"+e+","+t+","+n+","+r,this.pen.x=n,this.pen.y=r,this}},{key:"arc",value:function(e,t,n,r,i,a){function o(e){for(;e<0;)e+=2*Math.PI;for(;e>2*Math.PI;)e-=2*Math.PI;return e}if((r=o(r))>(i=o(i))){var s=r;r=i,i=s,a=!a}var l=i-r;return l>Math.PI?(this.arcHelper(e,t,n,r,r+l/2,a),this.arcHelper(e,t,n,r+l/2,i,a)):this.arcHelper(e,t,n,r,i,a),this}},{key:"arcHelper",value:function(e,t,n,r,i,a){var o=e+n*Math.cos(r),s=t+n*Math.sin(r),l=e+n*Math.cos(i),u=t+n*Math.sin(i),c=0,h=0;a?(h=1,i-rMath.PI&&(c=1),this.path+="M"+o+","+s+",A"+n+","+n+",0,"+c+","+h+","+l+","+u+"M"+this.pen.x+","+this.pen.y}},{key:"glow",value:function(){var e=this.paper.set();if(this.shadow_attributes.width>0)for(var t=this.shadow_attributes,n=t.width/2,r=1;r<=n;r++)e.push(this.paper.path(this.path).attr({stroke:t.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(t.width/n*r).toFixed(3),opacity:+((t.opacity||.3)/n).toFixed(3),transform:this.attributes.transform,scale:this.attributes.scale}));return e}},{key:"fill",value:function(){var e=this.paper.path(this.path).attr(this.attributes).attr("stroke-width",0);return this.glow(e),this}},{key:"stroke",value:function(){var e=this.lineWidth*(this.state.scale.x+this.state.scale.y)/2,t=this.paper.path(this.path).attr(this.attributes).attr("fill","none").attr("stroke-width",e);return this.glow(t),this}},{key:"closePath",value:function(){return this.path+="Z",this}},{key:"measureText",value:function(e){var t=this.paper.text(0,0,e).attr(this.attributes).attr("fill","none").attr("stroke","none"),n=t.getBBox();return t.remove(),{width:n.width,height:n.height}}},{key:"fillText",value:function(e,t,n){return this.paper.text(t+this.measureText(e).width/2,n-this.state.font_size/(2.25*this.state.scale.y),e).attr(this.attributes),this}},{key:"save",value: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}},{key:"restore",value:function(){var e=this.state_stack.pop();return this.state.font_family=e.state.font_family,this.attributes.font=e.attributes.font,this.attributes.fill=e.attributes.fill,this.attributes.stroke=e.attributes.stroke,this.attributes["stroke-width"]=e.attributes["stroke-width"],this.shadow_attributes.width=e.shadow_attributes.width,this.shadow_attributes.color=e.shadow_attributes.color,this}}]),e}(),attrNamesToIgnoreMap={path:{x:!0,y:!0,width:!0,height:!0},rect:{},text:{width:!0,height:!0}},fontAttrNamesToIgnore={"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0};Vex.Merge(attrNamesToIgnoreMap.rect,fontAttrNamesToIgnore),Vex.Merge(attrNamesToIgnoreMap.path,fontAttrNamesToIgnore);var SVGContext=function(){function e(t){_classCallCheck2(this,e),this.element=t,this.svgNS="http://www.w3.org/2000/svg";var n=this.create("svg");this.element.appendChild(n),this.svg=n,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()}return _createClass2(e,[{key:"create",value:function(e){return document.createElementNS(this.svgNS,e)}},{key:"openGroup",value:function(e,t,n){var r=this.create("g");return this.groups.push(r),this.parent.appendChild(r),this.parent=r,e&&r.setAttribute("class",Vex.Prefix(e)),t&&r.setAttribute("id",Vex.Prefix(t)),n&&n.pointerBBox&&r.setAttribute("pointer-events","bounding-box"),r}},{key:"closeGroup",value:function(){this.groups.pop(),this.parent=this.groups[this.groups.length-1]}},{key:"add",value:function(e){this.parent.appendChild(e)}},{key:"iePolyfill",value: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))}},{key:"setFont",value:function(e,t,n){var r=!1,i=!1,a="normal";"string"==typeof n&&(-1!==n.indexOf("italic")&&(n=n.replace(/italic/g,""),i=!0),-1!==n.indexOf("bold")&&(n=n.replace(/bold/g,""),r=!0),n=n.replace(/ /g,""));var o={"font-family":e,"font-size":t+"pt","font-weight":n=void 0===(n=r?"bold":n)||""===n?"normal":n,"font-style":a=i?"italic":a};return this.fontSize=Number(t),Vex.Merge(this.attributes,o),Vex.Merge(this.state,o),this}},{key:"setRawFont",value:function(e){var t=(e=e.trim()).split(" ");return this.attributes["font-family"]=t[1],this.state["font-family"]=t[1],this.attributes["font-size"]=t[0],this.state["font-size"]=t[0],this.fontSize=Number(t[0].match(/\d+/)),this}},{key:"setFillStyle",value:function(e){return this.attributes.fill=e,this}},{key:"setBackgroundFillStyle",value:function(e){return this.background_attributes.fill=e,this.background_attributes.stroke=e,this}},{key:"setStrokeStyle",value:function(e){return this.attributes.stroke=e,this}},{key:"setShadowColor",value:function(e){return this.shadow_attributes.color=e,this}},{key:"setShadowBlur",value:function(e){return this.shadow_attributes.width=e,this}},{key:"setLineWidth",value:function(e){this.attributes["stroke-width"]=e,this.lineWidth=e}},{key:"setLineDash",value:function(e){if("[object Array]"===Object.prototype.toString.call(e))return e=e.join(", "),this.attributes["stroke-dasharray"]=e,this;throw new Vex.RERR("ArgumentError","lineDash must be an array of integers.")}},{key:"setLineCap",value:function(e){return this.attributes["stroke-linecap"]=e,this}},{key:"resize",value:function(e,t){this.width=e,this.height=t,this.element.style.width=e;var n={width:e,height:t};return this.applyAttributes(this.svg,n),this.scale(this.state.scale.x,this.state.scale.y),this}},{key:"scale",value:function(e,t){this.state.scale={x:e,y:t};var n=this.width/e,r=this.height/t;return this.setViewBox(0,0,n,r),this}},{key:"setViewBox",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n-1||e.setAttributeNS(null,r,t[r])})),e}},{key:"clear",value:function(){for(;this.svg.lastChild;)this.svg.removeChild(this.svg.lastChild);this.scale(this.state.scale.x,this.state.scale.y)}},{key:"rect",value:function(e,t,n,r,i){r<0&&(t+=r,r*=-1);var a=this.create("rect");return void 0===i&&(i={fill:"none","stroke-width":this.lineWidth,stroke:"black"}),Vex.Merge(i,{x:e,y:t,width:n,height:r}),this.applyAttributes(a,i),this.add(a),this}},{key:"fillRect",value:function(e,t,n,r){return r<0&&(t+=r,r*=-1),this.rect(e,t,n,r,this.attributes),this}},{key:"clearRect",value:function(e,t,n,r){return this.rect(e,t,n,r,this.background_attributes),this}},{key:"beginPath",value:function(){return this.path="",this.pen.x=NaN,this.pen.y=NaN,this}},{key:"moveTo",value:function(e,t){return this.path+="M"+e+" "+t,this.pen.x=e,this.pen.y=t,this}},{key:"lineTo",value:function(e,t){return this.path+="L"+e+" "+t,this.pen.x=e,this.pen.y=t,this}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){return this.path+="C"+e+" "+t+","+n+" "+r+","+i+" "+a,this.pen.x=i,this.pen.y=a,this}},{key:"quadraticCurveTo",value:function(e,t,n,r){return this.path+="Q"+e+" "+t+","+n+" "+r,this.pen.x=n,this.pen.y=r,this}},{key:"arc",value:function(e,t,n,r,i,a){function o(e){for(;e<0;)e+=2*Math.PI;for(;e>2*Math.PI;)e-=2*Math.PI;return e}if((r=o(r))>(i=o(i))){var s=r;r=i,i=s,a=!a}var l=i-r;return l>Math.PI?(this.arcHelper(e,t,n,r,r+l/2,a),this.arcHelper(e,t,n,r+l/2,i,a)):this.arcHelper(e,t,n,r,i,a),this}},{key:"arcHelper",value:function(e,t,n,r,i,a){var o=e+n*Math.cos(r),s=t+n*Math.sin(r),l=e+n*Math.cos(i),u=t+n*Math.sin(i),c=0,h=0;a?(h=1,i-rMath.PI&&(c=1),this.path+="M"+o+" "+s+" A"+n+" "+n+" 0 "+c+" "+h+" "+l+" "+u,isNaN(this.pen.x)||isNaN(this.pen.y)||(this.peth+="M"+this.pen.x+" "+this.pen.y)}},{key:"closePath",value:function(){return this.path+="Z",this}},{key:"glow",value:function(){if(this.shadow_attributes.width>0)for(var e=this.shadow_attributes,t=e.width/2,n=1;n<=t;n++){var r={stroke:e.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(.4*e.width/t*n).toFixed(3),opacity:+((e.opacity||.3)/t).toFixed(3)},i=this.create("path");r.d=this.path,this.applyAttributes(i,r),this.add(i)}return this}},{key:"fill",value:function(e){this.glow();var t=this.create("path"),n=e;return void 0===e?(e={},Vex.Merge(e,this.attributes),e.stroke="none",n=e):(n=e,Vex.Merge(n,this.attributes),e.class&&(n.class=e.class),e.id&&(n.id=e.id)),e.d=this.path,this.applyAttributes(t,e),this.add(t),this}},{key:"stroke",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;this.glow();var t=this.create("path"),n={};return Vex.Merge(n,this.attributes),e&&Vex.Merge(n,e),n.fill="none",n["stroke-width"]=this.lineWidth,n.d=this.path,this.applyAttributes(t,n),this.add(t),this}},{key:"measureText",value:function(e){var t=this.create("text");if("function"!=typeof t.getBBox)return{x:0,y:0,width:0,height:0};t.textContent=e,this.applyAttributes(t,this.attributes),this.svg.appendChild(t);var n=t.getBBox();return this.ie&&""!==e&&"italic"===this.attributes["font-style"]&&(n=this.ieMeasureTextFix(n,e)),this.svg.removeChild(t),n}},{key:"ieMeasureTextFix",value:function(e){var t=1.196*Number(this.fontSize)+1.9598,n=e.width-t,r=e.height-1.5;return{x:e.x,y:e.y,width:n,height:r}}},{key:"fillText",value:function(e,t,n){if(e&&!(e.length<=0)){var r={};Vex.Merge(r,this.attributes),r.stroke="none",r.x=t,r.y=n;var i=this.create("text");i.textContent=e,this.applyAttributes(i,r),this.add(i)}}},{key:"save",value: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}},{key:"restore",value:function(){var e=this.state_stack.pop();return this.state["font-family"]=e.state["font-family"],this.state["font-weight"]=e.state["font-weight"],this.state["font-style"]=e.state["font-style"],this.state["font-size"]=e.state["font-size"],this.state.scale=e.state.scale,this.attributes["font-family"]=e.attributes["font-family"],this.attributes["font-weight"]=e.attributes["font-weight"],this.attributes["font-style"]=e.attributes["font-style"],this.attributes["font-size"]=e.attributes["font-size"],this.attributes.fill=e.attributes.fill,this.attributes.stroke=e.attributes.stroke,this.attributes["stroke-width"]=e.attributes["stroke-width"],this.attributes["stroke-dasharray"]=e.attributes["stroke-dasharray"],this.shadow_attributes.width=e.shadow_attributes.width,this.shadow_attributes.color=e.shadow_attributes.color,this.lineWidth=e.lineWidth,this}}]),e}(),lastContext=null,Renderer=function(){function e(t,n){if(_classCallCheck2(this,e),this.elementId=t,!this.elementId)throw new Vex.RERR("BadArgument","Invalid id for renderer.");if(this.element=document.getElementById(t),this.element||(this.element=t),this.ctx=null,this.paper=null,this.backend=n,this.backend===e.Backends.CANVAS){if(!this.element.getContext)throw new Vex.RERR("BadElement","Can't get canvas context from element: ".concat(t));this.ctx=e.bolsterCanvasContext(this.element.getContext("2d"))}else if(this.backend===e.Backends.RAPHAEL)this.ctx=new RaphaelContext(this.element);else{if(this.backend!==e.Backends.SVG)throw new Vex.RERR("InvalidBackend","No support for backend: ".concat(this.backend));this.ctx=new SVGContext(this.element)}}return _createClass2(e,[{key:"resize",value:function(t,n){if(this.backend===e.Backends.CANVAS){if(!this.element.getContext)throw new Vex.RERR("BadElement","Can't get canvas context from element: ".concat(this.elementId));var r=_slicedToArray(CanvasContext.SanitizeCanvasDims(t,n),2);t=r[0],n=r[1];var i=window.devicePixelRatio||1;this.element.width=t*i,this.element.height=n*i,this.element.style.width=t+"px",this.element.style.height=n+"px",this.ctx=e.bolsterCanvasContext(this.element.getContext("2d")),this.ctx.scale(i,i)}else this.ctx.resize(t,n);return this}},{key:"getContext",value:function(){return this.ctx}}],[{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 lastContext},set:function(e){lastContext=e}},{key:"buildContext",value:function(t,n,r,i,a){var o=new e(t,n);r&&i&&o.resize(r,i),a||(a="#FFF");var s=o.getContext();return s.setBackgroundFillStyle(a),e.lastContext=s,s}},{key:"getCanvasContext",value:function(t,n,r,i){return e.buildContext(t,e.Backends.CANVAS,n,r,i)}},{key:"getRaphaelContext",value:function(t,n,r,i){return e.buildContext(t,e.Backends.RAPHAEL,n,r,i)}},{key:"getSVGContext",value:function(t,n,r,i){return e.buildContext(t,e.Backends.SVG,n,r,i)}},{key:"bolsterCanvasContext",value:function(t){if(e.USE_CANVAS_PROXY)return new CanvasContext(t);return t.vexFlowCanvasContext=t,["clear","setFont","setRawFont","setFillStyle","setBackgroundFillStyle","setStrokeStyle","setShadowColor","setShadowBlur","setLineWidth","setLineCap","setLineDash","openGroup","closeGroup","getGroup"].forEach((function(e){t[e]=t[e]||CanvasContext.prototype[e]})),t}},{key:"drawDashedLine",value:function(e,t,n,r,i,a){e.beginPath();var o=r-t,s=i-n,l=Math.atan2(s,o),u=t,c=n;e.moveTo(t,n);for(var h=0,d=!0;!(o<0?u<=r:u>=r)||!(s<0?c<=i:c>=i);){var f=a[h++%a.length],p=u+Math.cos(l)*f;u=o<0?Math.max(r,p):Math.min(r,p);var v=c+Math.sin(l)*f;c=s<0?Math.max(i,v):Math.min(i,v),d?e.lineTo(u,c):e.moveTo(u,c),d=!d}e.closePath(),e.stroke()}}]),e}();function L$j(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck2(this,n),(e=t.call(this)).setAttribute("type","Stem"),e.x_begin=r.x_begin||0,e.x_end=r.x_end||0,e.y_top=r.y_top||0,e.y_bottom=r.y_bottom||0,e.stem_extension=r.stem_extension||0,e.stem_direction=r.stem_direction||0,e.hide=r.hide||!1,e.isStemlet=r.isStemlet||!1,e.stemletHeight=r.stemletHeight||0,e.resetHeight=0,e.renderHeightAdjustment=0,e.setOptions(r),e}return _createClass2(n,[{key:"setResetHeight",value:function(e){this.resetHeight=e}},{key:"setOptions",value:function(e){this.stem_up_y_offset=e.stem_up_y_offset||0,this.stem_down_y_offset=e.stem_down_y_offset||0}},{key:"setNoteHeadXBounds",value:function(e,t){return this.x_begin=e,this.x_end=t,this}},{key:"setDirection",value:function(e){this.stem_direction=e}},{key:"setExtension",value:function(e){this.stem_extension=e}},{key:"getExtension",value:function(){return this.stem_extension}},{key:"setYBounds",value:function(e,t){this.y_top=e,this.y_bottom=t}},{key:"getCategory",value:function(){return n.CATEGORY}},{key:"getHeight",value:function(){var e=this.stem_direction===n.UP?this.stem_up_y_offset:this.stem_down_y_offset;return(this.y_bottom-this.y_top)*this.stem_direction+(n.HEIGHT-e+this.stem_extension)*this.stem_direction}},{key:"getBoundingBox",value:function(){throw new Vex.RERR("NotImplemented","getBoundingBox() not implemented.")}},{key:"getExtents",value:function(){var e=this.stem_direction===n.UP,t=[this.y_top,this.y_bottom],r=n.HEIGHT+this.stem_extension,i=(e?Math.min:Math.max).apply(void 0,t),a=(e?Math.max:Math.min).apply(void 0,t);return{topY:i+r*-this.stem_direction+this.resetHeight*-this.stem_direction,baseY:a}}},{key:"setVisibility",value:function(e){return this.hide=!e,this}},{key:"setStemlet",value:function(e,t){return this.isStemlet=e,this.stemletHeight=t,this}},{key:"draw",value:function(){if(this.setRendered(),!this.hide){var e,t,r=this.checkContext(),i=this.stem_direction;i===n.DOWN?(e=this.x_begin,t=this.y_top+this.stem_down_y_offset):(e=this.x_end,t=this.y_bottom-this.stem_up_y_offset);var a=this.getHeight();L$j("Rendering stem - ","Top Y: ",this.y_top,"Bottom Y: ",this.y_bottom);var o=this.isStemlet?a-this.stemletHeight*this.stem_direction:0;if(r.save(),this.applyStyle(r),r.beginPath(),r.setLineWidth(n.WIDTH),r.moveTo(e,t-o),r.lineTo(e,t-a-this.renderHeightAdjustment*i-this.resetHeight*i),r.svg){var s={class:Vex.Prefix("stem")};this.id&&(s.id=this.id),r.stroke(s)}else r.stroke();this.restoreStyle(r),r.restore()}}}],[{key:"CATEGORY",get:function(){return"stem"}},{key:"UP",get:function(){return 1}},{key:"DOWN",get:function(){return-1}},{key:"WIDTH",get:function(){return Flow.STEM_WIDTH}},{key:"HEIGHT",get:function(){return Flow.STEM_HEIGHT}}]),n}(Element$1),Tuplet$1=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i;if(_classCallCheck2(this,n),(i=t.call(this)).setAttribute("type","Tuplet"),!e||!e.length)throw new Vex.RuntimeError("BadArguments","No notes provided for tuplet.");return i.options=Vex.Merge({},r),i.notes=e,i.num_notes="num_notes"in i.options?i.options.num_notes:e.length,i.options.beats_occupied&&i.beatsOccupiedDeprecationWarning(),i.notes_occupied=i.options.notes_occupied||i.options.beats_occupied||2,"bracketed"in i.options?i.bracketed=i.options.bracketed:i.bracketed=e.some((function(e){return null===e.beam})),i.ratioed="ratioed"in i.options?i.options.ratioed:Math.abs(i.notes_occupied-i.num_notes)>1,i.point=28,i.y_pos=16,i.x_pos=100,i.width=200,i.location=i.options.location||n.LOCATION_TOP,_Formatter.AlignRestsToNotes(e,!0,!0),i.resolveGlyphs(),i.attach(),i}return _createClass2(n,[{key:"attach",value:function(){for(var e=0;e=1;)this.numerator_glyphs.unshift(new Glyph("v"+e%10,this.point)),e=parseInt(e/10,10);for(this.denom_glyphs=[],e=this.notes_occupied;e>=1;)this.denom_glyphs.unshift(new Glyph("v"+e%10,this.point)),e=parseInt(e/10,10)}},{key:"getNestedTupletCount",value:function(){var e=this.location,t=this.notes[0],n=i(t,e),r=i(t,e);function i(e,t){return e.tupletStack.filter((function(e){return e.location===t})).length}return this.notes.forEach((function(t){var a=i(t,e);n=a>n?a:n,r=ae&&(e=l)}}return e+t+r}},{key:"draw",value:function(){var e=this;this.checkContext(),this.setRendered();var t=this.notes[0],r=this.notes[this.notes.length-1];this.bracketed?(this.x_pos=t.getTieLeftX()-5,this.width=r.getTieRightX()-this.x_pos+5):(this.x_pos=t.getStemX(),this.width=r.getStemX()-this.x_pos),this.y_pos=this.getYPosition();var i=function(e,t){return e+t.getMetrics().width},a=this.numerator_glyphs.reduce(i,0);this.ratioed&&(a=this.denom_glyphs.reduce(i,a),a+=.32*this.point);var o=this.x_pos+this.width/2-a/2;if(this.bracketed){var s=this.width/2-a/2-5;s>0&&(this.context.fillRect(this.x_pos,this.y_pos,s,1),this.context.fillRect(this.x_pos+this.width/2+a/2+5,this.y_pos,s,1),this.context.fillRect(this.x_pos,this.y_pos+(this.location===n.LOCATION_BOTTOM),1,10*this.location),this.context.fillRect(this.x_pos+this.width,this.y_pos+(this.location===n.LOCATION_BOTTOM),1,10*this.location))}var l=0;if(this.numerator_glyphs.forEach((function(t){t.render(e.context,o+l,e.y_pos+e.point/3-2),l+=t.getMetrics().width})),this.ratioed){var u=o+l+.16*this.point,c=.06*this.point;this.context.beginPath(),this.context.arc(u,this.y_pos-.08*this.point,c,0,2*Math.PI,!0),this.context.closePath(),this.context.fill(),this.context.beginPath(),this.context.arc(u,this.y_pos+.12*this.point,c,0,2*Math.PI,!0),this.context.closePath(),this.context.fill(),l+=.32*this.point,this.denom_glyphs.forEach((function(t){t.render(e.context,o+l,e.y_pos+e.point/3-2),l+=t.getMetrics().width}))}}}],[{key:"LOCATION_TOP",get:function(){return 1}},{key:"LOCATION_BOTTOM",get:function(){return-1}},{key:"NESTING_OFFSET",get:function(){return 15}}]),n}(Element$1);function calculateStemDirection(e){var t=0;return e.forEach((function(e){e.keyProps&&e.keyProps.forEach((function(e){t+=e.line-3}))})),t>=0?Stem.DOWN:Stem.UP}var getStemSlope=function(e,t){var n=e.getStemExtents().topY,r=e.getStemX();return(t.getStemExtents().topY-n)/(t.getStemX()-r)},BEAM_LEFT="L",BEAM_RIGHT="R",BEAM_BOTH="B",Beam$1=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i,a,o;if(_classCallCheck2(this,n),(i=t.call(this)).setAttribute("type","Beam"),!e||e===[])throw new Vex.RuntimeError("BadArguments","No notes provided for beam.");if(1===e.length)throw new Vex.RuntimeError("BadArguments","Too few notes for beam.");if(i.ticks=e[0].getIntrinsicTicks(),i.ticks>=Flow.durationToTicks("4"))throw new Vex.RuntimeError("BadArguments","Beams can only be applied to notes shorter than a quarter note.");for(i.stem_direction=Stem.UP,a=0;a-1?Stem.UP:Stem.DOWN}for(a=0;ae?t:e}))}},{key:"breakSecondaryAt",value:function(e){return this.break_on_indices=e,this}},{key:"getSlopeY",value:function(e,t,n,r){return n+(e-t)*r}},{key:"calculateSlope",value:function(){for(var e=this.notes,t=this.stem_direction,n=this.render_options,r=n.max_slope,i=n.min_slope,a=n.slope_iterations,o=n.slope_cost,s=e[0],l=getStemSlope(s,e[e.length-1]),u=(r-i)/a,c=Number.MAX_VALUE,h=0,d=0,f=i;f<=r;f+=u){for(var p=0,v=0,m=1;md)&&(u=d,s=Math.min.apply(Math,_toConsumableArray2(h.getYs())),l=h.getBeamCount())}var f=o/e.length,p=i+l*(1.5*r),v=s+p*-t;t===Stem.DOWN&&fv&&(f=s-p),a+this.render_options.flat_beam_offset_per_beam>0?(t===Stem.DOWN&&f>a&&!this.render_options.flat_beams||t===Stem.UP&&f0){var t=this.render_options.flat_beam_offset;this.render_options.flat_beam_offset_per_beam&&(t+=this.render_options.flat_beam_offset_per_beam*this.getBeamCount());var n,r=this.notes[0].note_heads[0].y,i=this.stem_direction>0?Math.min:Math.max,a=_createForOfIteratorHelper(this.notes);try{for(a.s();!(n=a.n()).done;){var o,s=_createForOfIteratorHelper(n.value.note_heads);try{for(s.s();!(o=s.n()).done;){r=i(r,o.value.y)}}catch(err){s.e(err)}finally{s.f()}}}catch(err){a.e(err)}finally{a.f()}e=r+t*-this.stem_direction}return e}},{key:"applyStemExtensions",value:function(){for(var e=this.notes,t=this.slope,n=this.y_shift,r=this.stem_direction,i=this.beam_count,a=this.render_options,o=a.show_stemlets,s=a.stemlet_extension,l=a.beam_width,u=e[0],c=this.getBeamYToDraw(),h=u.getStemX(),d=0;d=8&&(c=-1!==this.break_on_indices.indexOf(l),this.render_options.secondary_break_ticks&&s>=this.render_options.secondary_break_ticks&&(s=0,c=!0));var h=u.getIntrinsicTicks()4?[new Fraction(2,r)]:r<=4?[new Fraction(1,r)]:[new Fraction(1,4)]}},{key:"applyAndGetBeams",value:function(e,t,r){return n.generateBeams(e.getTickables(),{groups:r,stem_direction:t})}},{key:"generateBeams",value:function(e,t){t||(t={}),t.groups&&t.groups.length||(t.groups=[new Fraction(2,8)]);var r,i,a=t.groups.map((function(e){if(!e.multiply)throw new Vex.RuntimeError("InvalidBeamGroups","The beam groups must be an array of Vex.Flow.Fractions");return e.clone().multiply(Flow.RESOLUTION,1)})),o=0,s=[],l=[];function u(){a.length-1>o?o+=1:o=0}r=[],e.forEach((function(e){if(r=[],e.shouldIgnoreTicks())return s.push(l),void(l=r);l.push(e);var t=a[o].clone(),n=l.reduce((function(e,t){return t.getTicks().clone().add(e)}),new Fraction(0,1)),i=Flow.durationToNumber(e.duration)<8;i&&e.tuplet&&(t.numerator*=2),n.greaterThan(t)?(i||r.push(l.pop()),s.push(l),l=r,u()):n.equals(t)&&(s.push(l),l=r,u())})),l.length>0&&s.push(l),i=[],s.forEach((function(e){var n=[];e.forEach((function(e,r,a){var o=0===r||r===a.length-1,s=a[r-1],l=!t.beam_rests&&e.isRest(),u=t.beam_rests&&t.beam_middle_only&&e.isRest()&&o,c=!1;if(t.maintain_stem_directions&&s&&!e.isRest()&&!s.isRest()){var h=s.getStemDirection();c=e.getStemDirection()!==h}var d=parseInt(e.duration,10)<8;l||u||c||d?(n.length>0&&i.push(n),n=c?[e]:[]):n.push(e)})),n.length>0&&i.push(n)})),(s=i).forEach((function(e){var n;if(t.maintain_stem_directions){var r=function(e){for(var t=0;t1){var t=!0;return e.forEach((function(e){e.getIntrinsicTicks()>=Flow.durationToTicks("4")&&(t=!1)})),t}return!1})),d=(c=[],s.forEach((function(e){var t=null;e.forEach((function(e){e.tuplet&&t!==e.tuplet&&(t=e.tuplet,c.push(t))}))})),c),f=[];return h.forEach((function(e){var r=new n(e);t.show_stemlets&&(r.render_options.show_stemlets=!0),t.secondary_breaks&&(r.render_options.secondary_break_ticks=Flow.durationToTicks(t.secondary_breaks)),!0===t.flat_beams&&(r.render_options.flat_beams=!0,r.render_options.flat_beam_offset=t.flat_beam_offset),f.push(r)})),d.forEach((function(e){var t=e.notes[0].stem_direction===Stem.DOWN?Tuplet$1.LOCATION_BOTTOM:Tuplet$1.LOCATION_TOP;e.setTupletLocation(t);for(var n=!1,r=0;r0&&void 0!==arguments[0]?arguments[0]:this.context,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.stave;this.setRendered();for(var n=null,r=0;r0&&n){var a=i.getBoundingBox();a&&n.mergeWith(a)}i.setContext(e),i.drawWithStyle()}this.boundingBox=n}}],[{key:"Mode",get:function(){return{STRICT:1,SOFT:2,FULL:3}}}]),n}(Element$1);function drawBoldDoubleLine(e,t,n,r,i){if(t!==_StaveConnector.type.BOLD_DOUBLE_LEFT&&t!==_StaveConnector.type.BOLD_DOUBLE_RIGHT)throw new Vex.RERR("InvalidConnector","A REPEAT_BEGIN or REPEAT_END type must be provided.");var a=3,o=3.5;t===_StaveConnector.type.BOLD_DOUBLE_RIGHT&&(a=-5,o=3),e.fillRect(n+a,r,1,i-r),e.fillRect(n-2,r,o,i-r)}var _StaveConnector=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i;return _classCallCheck2(this,n),(i=t.call(this)).setAttribute("type","StaveConnector"),i.thickness=Flow.STAVE_LINE_THICKNESS,i.width=3,i.top_stave=e,i.bottom_stave=r,i.type=n.type.DOUBLE,i.font={family:"times",size:16,weight:"normal"},i.x_shift=0,i.texts=[],i}return _createClass2(n,[{key:"setType",value:function(e){return(e="string"==typeof e?n.typeString[e]:e)>=n.type.SINGLE_RIGHT&&e<=n.type.NONE&&(this.type=e),this}},{key:"setText",value:function(e,t){return this.texts.push({content:e,options:Vex.Merge({shift_x:0,shift_y:0},t)}),this}},{key:"setFont",value:function(e){Vex.Merge(this.font,e)}},{key:"setXShift",value:function(e){if("number"!=typeof e)throw Vex.RERR("InvalidType","x_shift must be a Number");return this.x_shift=e,this}},{key:"draw",value:function(){var e=this.checkContext();this.setRendered();var t=this.top_stave.getYForLine(0),r=this.bottom_stave.getYForLine(this.bottom_stave.getNumLines()-1)+this.thickness,i=this.width,a=this.top_stave.getX();(this.type===n.type.SINGLE_RIGHT||this.type===n.type.BOLD_DOUBLE_RIGHT||this.type===n.type.THIN_DOUBLE)&&(a=this.top_stave.getX()+this.top_stave.width);var o=r-t;switch(this.type){case n.type.SINGLE:case n.type.SINGLE_LEFT:case n.type.SINGLE_RIGHT:i=1;break;case n.type.DOUBLE:a-=this.width+2;break;case n.type.BRACE:i=12;var s=this.top_stave.getX()-2+this.x_shift,l=t,u=s,c=r,h=s-i,d=l+o/2,f=h-.9*i,p=l+.2*o,v=s+1.1*i,m=d-.135*o,g=v,y=d+.135*o,b=f,A=c-.2*o,S=h-i,x=A,w=s+.4*i,_=d+.135*o,E=w,k=d-.135*o,C=S,M=p;e.beginPath(),e.moveTo(s,l),e.bezierCurveTo(f,p,v,m,h,d),e.bezierCurveTo(g,y,b,A,u,c),e.bezierCurveTo(S,x,w,_,h,d),e.bezierCurveTo(E,k,C,M,s,l),e.fill(),e.stroke();break;case n.type.BRACKET:o=(r+=4)-(t-=4),Glyph.renderGlyph(e,a-5,t-3,40,"v1b",!0),Glyph.renderGlyph(e,a-5,r+3,40,"v10",!0),a-=this.width+2;break;case n.type.BOLD_DOUBLE_LEFT:drawBoldDoubleLine(e,this.type,a+this.x_shift,t,r);break;case n.type.BOLD_DOUBLE_RIGHT:drawBoldDoubleLine(e,this.type,a,t,r);break;case n.type.THIN_DOUBLE:i=1;break;case n.type.NONE:break;default:throw new Vex.RERR("InvalidType","The provided StaveConnector.type (".concat(this.type,") is invalid"))}this.type!==n.type.BRACE&&this.type!==n.type.BOLD_DOUBLE_LEFT&&this.type!==n.type.BOLD_DOUBLE_RIGHT&&this.type!==n.type.NONE&&e.fillRect(a,t,i,o),this.type===n.type.THIN_DOUBLE&&e.fillRect(a-3,t,i,o),e.save(),e.lineWidth=2,e.setFont(this.font.family,this.font.size,this.font.weight);for(var P=0;P0}},{key:"hasStem",value:function(){return!1}},{key:"getDots",value:function(){return this.dots}},{key:"getNoteType",value:function(){return this.noteType}},{key:"setBeam",value:function(){return this}},{key:"setModifierContext",value:function(e){return this.modifierContext=e,this}},{key:"addModifier",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.setNote(this),e.setIndex(t),this.modifiers.push(e),this.setPreFormatted(!1),this}},{key:"getModifierStartXY",value:function(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");return{x:this.getAbsoluteX(),y:this.ys[0]}}},{key:"getMetrics",value:function(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call getMetrics on an unformatted note.");var e=0,t=0;null!=this.modifierContext&&(e=this.modifierContext.state.left_shift,t=this.modifierContext.state.right_shift);var n=this.getWidth();return{width:n,noteWidth:n-e-t-this.extraLeftPx-this.extraRightPx,left_shift:this.x_shift,modLeftPx:e,modRightPx:t,extraLeftPx:this.extraLeftPx,extraRightPx:this.extraRightPx}}},{key:"setWidth",value:function(e){this.width=e}},{key:"getWidth",value:function(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call GetWidth on an unformatted note.");return this.width+(this.modifierContext?this.modifierContext.getWidth():0)}},{key:"setXShift",value:function(e){return this.x_shift=e,this}},{key:"getXShift",value:function(){return this.x_shift}},{key:"getX",value:function(){if(!this.tickContext)throw new Vex.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");return this.tickContext.getX()+this.x_shift}},{key:"getAbsoluteX",value:function(){if(!this.tickContext)throw new Vex.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");var e=this.tickContext.getX();return this.stave&&(e+=this.stave.getNoteStartX()+this.render_options.stave_padding),this.isCenterAligned()&&("jianpu"===this.DYMusicScoreType||(e+=this.getCenterXShift())),e}},{key:"setPreFormatted",value:function(e){if(this.preFormatted=e,this.preFormatted){var t=this.tickContext.getExtraPx();this.left_modPx=Math.max(this.left_modPx,t.left),this.right_modPx=Math.max(this.right_modPx,t.right)}}}],[{key:"CATEGORY",get:function(){return"note"}},{key:"STAVEPADDING",get:function(){return 12}},{key:"plotMetrics",value:function(e,t,n){var r=t.getMetrics(),i=t.getAbsoluteX()-r.modLeftPx-r.extraLeftPx,a=t.getAbsoluteX()-r.extraLeftPx,o=t.getAbsoluteX(),s=t.getAbsoluteX()+r.noteWidth,l=t.getAbsoluteX()+r.noteWidth+r.extraRightPx,u=t.getAbsoluteX()+r.noteWidth+r.extraRightPx+r.modRightPx,c=u+t.getFormatterMetrics().freedom.right,h=u-i;e.save(),e.setFont("Arial",8,""),e.fillText(Math.round(h)+"px",i+t.getXShift(),n);var d=n+7;function f(n,r,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:d;e.beginPath(),e.setStrokeStyle(i),e.setFillStyle(i),e.setLineWidth(3),e.moveTo(n+t.getXShift(),a),e.lineTo(r+t.getXShift(),a),e.stroke()}f(i,a,"red"),f(a,o,"#999"),f(o,s,"green"),f(s,l,"#999"),f(l,u,"red"),f(u,c,"#DD0"),f(i-t.getXShift(),i,"#BBB"),Vex.drawDot(e,o+t.getXShift(),d,"blue");var p=t.getFormatterMetrics();if(p.iterations>0){var v=p.space.deviation,m=v>=0?"+":"";e.setFillStyle("red"),e.fillText(m+Math.round(v),o+t.getXShift(),n-10)}e.restore()}}]),n}(Tickable);function L$i(){for(var e=arguments.length,t=new Array(e),n=0;n2&&(s=!0),s||(n-=Flow.STEM_WIDTH/2*i),e.beginPath(),e.moveTo(n,r+a),e.lineTo(n,r+1),e.lineTo(n+o,r-a),e.lineTo(n+o,r),e.lineTo(n,r+a),e.closePath(),s?e.fill():e.stroke(),Flow.durationToFraction(t).equals(.5))for(var l=[-3,-1,o+1,o+3],u=0;ud?h:d,f=x,p=A}return t.right_shift+=d,!0}}]),n}(Modifier);function L$h(){for(var e=arguments.length,t=new Array(e),n=0;n0&&(this.keyProps[t-1].displaced=!0)),e=a,this.keyProps.push(i)}e=-1/0,this.keyProps.forEach((function(t){t.linet&&(t=r):r1}},{key:"hasStem",value:function(){return this.glyph.stem}},{key:"hasFlag",value:function(){return _get(_getPrototypeOf2(n.prototype),"hasFlag",this).call(this)&&!this.isRest()&&this.renderFlag}},{key:"getStemX",value:function(){return"r"===this.noteType?this.getCenterGlyphX():_get(_getPrototypeOf2(n.prototype),"getStemX",this).call(this)+getStemAdjustment(this)}},{key:"getYForTopText",value:function(e){var t=this.getStemExtents();return Math.min(this.stave.getYForTopText(e),t.topY-this.render_options.annotation_spacing*(e+1))}},{key:"getYForBottomText",value:function(e){var t=this.getStemExtents();return Math.max(this.stave.getYForTopText(e),t.baseY+this.render_options.annotation_spacing*e)}},{key:"setStave",value:function(e){_get(_getPrototypeOf2(n.prototype),"setStave",this).call(this,e);var t=this.note_heads.map((function(t){return t.setStave(e),t.getY()}));if(this.setYs(t),this.stem){var r=this.getNoteHeadBounds(),i=r.y_top,a=r.y_bottom;this.stem.setYBounds(i,a)}return this}},{key:"getKeys",value:function(){return this.keys}},{key:"getKeyProps",value:function(){return this.keyProps}},{key:"isDisplaced",value:function(){return this.displaced}},{key:"setNoteDisplaced",value:function(e){return this.displaced=e,this}},{key:"getTieRightX",value:function(){var e=this.getAbsoluteX();return e+=this.getGlyphWidth()+this.x_shift+this.extraRightPx,this.modifierContext&&(e+=this.modifierContext.getExtraRightPx()),e}},{key:"getTieLeftX",value:function(){var e=this.getAbsoluteX();return e+=this.x_shift-this.extraLeftPx}},{key:"getLineForRest",value:function(){var e=this.keyProps[0].line;if(this.keyProps.length>1){var t=this.keyProps[this.keyProps.length-1].line,n=Math.max(e,t),r=Math.min(e,t);e=Vex.MidLine(n,r)}return e}},{key:"getModifierStartXY",value:function(e,t,n){if(n=n||{},!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(0===this.ys.length)throw new Vex.RERR("NoYValues","No Y-Values calculated for this note.");var r=Modifier.Position,i=r.ABOVE,a=r.BELOW,o=r.LEFT,s=r.RIGHT,l=0;return e===o?l=-2:e===s?(l=this.getGlyphWidth()+this.x_shift+2,this.stem_direction===Stem.UP&&this.hasFlag()&&(n.forceFlagRight||isInnerNoteIndex(this,t))&&(l+=this.flag.getMetrics().width)):e!==a&&e!==i||(l=this.getGlyphWidth()/2),{x:this.getAbsoluteX()+l,y:this.ys[t]}}},{key:"setStyle",value:function(e){_get(_getPrototypeOf2(n.prototype),"setStyle",this).call(this,e),this.note_heads.forEach((function(t){return t.setStyle(e)})),this.stem&&this.stem.setStyle(e)}},{key:"setStemStyle",value:function(e){this.stem&&this.getStem().setStyle(e)}},{key:"getStemStyle",value:function(){return this.stem.getStyle()}},{key:"setLedgerLineStyle",value:function(e){this.ledgerLineStyle=e}},{key:"getLedgerLineStyle",value:function(){return this.ledgerLineStyle}},{key:"setFlagStyle",value:function(e){this.flagStyle=e}},{key:"getFlagStyle",value:function(){return this.flagStyle}},{key:"setKeyStyle",value:function(e,t){return this.note_heads[e].setStyle(t),this}},{key:"setKeyLine",value:function(e,t){return this.keyProps[e].line=t,this.reset(),this}},{key:"getKeyLine",value:function(e){return this.keyProps[e].line}},{key:"addToModifierContext",value:function(e){this.setModifierContext(e);for(var t=0;tt)&&(t=d),null===r&&c.isDisplaced()&&(r=c.getAbsoluteX()),null!==n||c.isDisplaced()||(n=c.getAbsoluteX()),i=h>i?h:i,a=h=l;--S){var x=null!==p&&S>=d,w=null!==f&&S>=h;m(e.getYForNote(S),x,w)}this.restoreStyle(r,g)}}},{key:"drawVibrato",value:function(){if(this.vibrato){var e=this.context,t=this.vibrato.getNoteHeadEndX()+2,r=this.vibrato.getNoteHeadBounds().y_bottom,i=this.getNoteHeadBounds().y_top,a=r6.5||c<-.5)&&(u+=c>6.5?10*(c-6.5):10*(c+.5))}n.openGroup("flag",null,{pointerBBox:!0}),this.applyStyle(n,this.getFlagStyle()||!1),this.flag.render(n,l,u),this.restoreStyle(n,this.getFlagStyle()||!1),n.closeGroup()}}},{key:"drawNoteHeads",value:function(){var e=this;this.note_heads.forEach((function(t){e.context.openGroup("notehead",null,{pointerBBox:!0});try{if(e.isRest()&&"w"===e.duration){var n=e.stave.options.line_config.filter((function(e){return e.visible})).length;4===e.keyProps[0].line&&n<5&&t.setY(t.getY()+10),1===n&&t.setLine(3)}}catch(r){}t.setContext(e.context).draw(),e.context.closeGroup()}))}},{key:"drawStem",value:function(e){if(!this.context)throw new Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");e&&this.setStem(new Stem(e)),this.stem.id=Vex.Prefix("".concat(this.getAttribute("id"),"-stem")),this.stem&&(this.context.openGroup("stem",null,{pointerBBox:!0}),this.stem.setContext(this.context).draw(),this.context.closeGroup())}},{key:"draw",value:function(){if(!this.context)throw new Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");if(!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");if(0===this.ys.length)throw new Vex.RERR("NoYValues","Can't draw note without Y values.");var e=this.stave.getLines();if(2===e||3===e||4===e)for(var t=0;t6.5||s<-.5)&&(this.beam||(this.stem.renderHeightAdjustment=s>6.5?10*(s-6.5):10*Math.abs(s+.5))),this.stem.setNoteHeadXBounds(o,o)}L$h("Rendering ",this.isChord()?"chord :":"note :",this.keys),this.drawLedgerLines(),this.applyStyle(),this.setAttribute("el",this.context.openGroup("stavenote",this.getAttribute("id"))),this.context.openGroup("note",null,{pointerBBox:!0}),a&&this.drawStem(),this.drawNoteHeads(),this.drawFlag(),this.context.closeGroup(),this.drawModifiers(),this.context.closeGroup(),this.restoreStyle(),this.setRendered()}}],[{key:"CATEGORY",get:function(){return"stavenotes"}},{key:"STEM_UP",get:function(){return Stem.UP}},{key:"STEM_DOWN",get:function(){return Stem.DOWN}},{key:"DEFAULT_LEDGER_LINE_OFFSET",get:function(){return 3}},{key:"renderVibrato",value:function(e,t,n,r){var i=r.width,a=r.height,o=r.wave_width,s=r.wave_girth,l=r.wave_height,u=r.stem_direction,c=Math.floor(i/o),h=a/(c/2)*u;0==h&&(u=1,h=.3),e.beginPath(),e.moveTo(t,n+s);for(var d=0;d2?n[1]:null,v=d>2?n[2]:n[1];2===d&&-1===f.stemDirection&&1===v.stemDirection&&(f=n[1],v=n[0]);var m,g=Math.max(f.voice_shift,v.voice_shift),y=0;if(2===d){var b=f.stemDirection===v.stemDirection?0:.5;if(f.stemDirection===v.stemDirection&&f.minLine<=v.maxLine&&(f.isrest||(m=Math.abs(f.line-(v.maxLine+.5)),m=Math.max(m,f.stemMin),f.minLine=f.line-m,f.note.setStemLength(10*m))),f.minLine<=v.maxLine+b)if(f.isrest)shiftRestVertical(f,v,1);else if(v.isrest)shiftRestVertical(v,f,-1);else{y=g;var A=Math.abs(f.line-v.line),S=0,x=0;"h"===f.note.duration?S++:"w"===f.note.duration&&x++,"h"===v.note.duration?S++:"w"===v.note.duration&&x++;var w=1===S||1===x||f.note.dots!==v.note.dots;if(r&&(w=w||2===x),0===A&&w){if(v.note.setXShift(y),f.note.dots>0){var _,E=0,k=_createForOfIteratorHelper(f.note.modifiers);try{for(k.s();!(_=k.n()).done;){var C=_.value;if(C instanceof Dot&&(E++,C.setYShift(-10*(v.maxLine-f.line+1)),E===f.note.dots))break}}catch(err){k.e(err)}finally{k.f()}}}else A<1&&A>0?v.note.setXShift(y):f.note.voice!==v.note.voice&&f.stemDirection===v.stemDirection&&(f.line>v.line?1===f.stemDirection?v.note.renderFlag=!1:f.note.renderFlag=!1:v.line>f.line?1===v.stemDirection?f.note.renderFlag=!1:v.note.renderFlag=!1:1===v.stemDirection&&(v.stemDirection=-1,v.note.setStemDirection(-1)))}return!0}if((null!==p&&p.minLineg?x:g):E===Modifier.Position.RIGHT&&(k.setXShift(m),y=(x=s+I)>y?x:y),b=C,A=_}return t.left_shift+=g,t.right_shift+=y,!0}}]),n}(Modifier),Music=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,[{key:"isValidNoteValue",value:function(t){return!(null==t||t<0||t>=e.NUM_TONES)}},{key:"isValidIntervalValue",value:function(e){return this.isValidNoteValue(e)}},{key:"getNoteParts",value:function(e){if(!e||e.length<1)throw new Vex.RERR("BadArguments","Invalid note name: "+e);if(e.length>3)throw new Vex.RERR("BadArguments","Invalid note name: "+e);var t=e.toLowerCase(),n=/^([cdefgab])(b|bb|n|#|##)?$/.exec(t);if(null!=n)return{root:n[1],accidental:n[2]};throw new Vex.RERR("BadArguments","Invalid note name: "+e)}},{key:"getKeyParts",value:function(e){if(!e||e.length<1)throw new Vex.RERR("BadArguments","Invalid key: "+e);var t=e.toLowerCase(),n=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(t);if(null!=n){var r=n[1],i=n[2],a=n[3];return a||(a="M"),{root:r,accidental:i,type:a}}throw new Vex.RERR("BadArguments","Invalid key: ".concat(e))}},{key:"getNoteValue",value:function(t){var n=e.noteValues[t];if(null==n)throw new Vex.RERR("BadArguments","Invalid note name: ".concat(t));return n.int_val}},{key:"getIntervalValue",value:function(t){var n=e.intervals[t];if(null==n)throw new Vex.RERR("BadArguments","Invalid interval name: ".concat(t));return n}},{key:"getCanonicalNoteName",value:function(t){if(!this.isValidNoteValue(t))throw new Vex.RERR("BadArguments","Invalid note value: ".concat(t));return e.canonical_notes[t]}},{key:"getCanonicalIntervalName",value:function(t){if(!this.isValidIntervalValue(t))throw new Vex.RERR("BadArguments","Invalid interval value: ".concat(t));return e.diatonic_intervals[t]}},{key:"getRelativeNoteValue",value:function(t,n,r){if(null==r&&(r=1),1!==r&&-1!==r)throw new Vex.RERR("BadArguments","Invalid direction: ".concat(r));var i=(t+r*n)%e.NUM_TONES;return i<0&&(i+=e.NUM_TONES),i}},{key:"getRelativeNoteName",value:function(t,n){var r=this.getNoteParts(t),i=this.getNoteValue(r.root),a=n-i;if(Math.abs(a)>e.NUM_TONES-3){var o=1;a>0&&(o=-1);var s=(n+1+(i+1))%e.NUM_TONES*o;if(Math.abs(s)>2)throw new Vex.RERR("BadArguments","Notes not related: ".concat(t,", ").concat(n,")"));a=s}if(Math.abs(a)>2)throw new Vex.RERR("BadArguments","Notes not related: ".concat(t,", ").concat(n,")"));var l=r.root;if(a>0)for(var u=1;u<=a;++u)l+="#";else if(a<0)for(var c=-1;c>=a;--c)l+="b";return l}},{key:"getScaleTones",value:function(e,t){for(var n=[e],r=e,i=0;i0&&void 0!==arguments[0]?arguments[0]:null;if(_classCallCheck2(this,n),(e=t.call(this)).setAttribute("type","Accidental"),L$g("New accidental: ",r),e.note=null,e.index=null,e.type=r,e.position=Modifier.Position.LEFT,e.render_options={font_scale:38,stroke_px:3,parenLeftPadding:2,parenRightPadding:2},e.accidental=Flow.accidentalCodes(e.type),!e.accidental)throw new Vex.RERR("ArgumentError","Unknown accidental type: ".concat(r));return e.cautionary=!1,e.parenLeft=null,e.parenRight=null,e.reset(),e}return _createClass2(n,[{key:"reset",value:function(){var e=this.render_options.font_scale;this.glyph=new Glyph(this.accidental.code,e),this.glyph.setOriginX(1),this.cautionary&&(this.parenLeft=new Glyph(Flow.accidentalCodes("{").code,e),this.parenRight=new Glyph(Flow.accidentalCodes("}").code,e),this.parenLeft.setOriginX(1),this.parenRight.setOriginX(1))}},{key:"getCategory",value:function(){return n.CATEGORY}},{key:"getWidth",value:function(){var e=this.cautionary?getGlyphWidth(this.parenLeft)+getGlyphWidth(this.parenRight)+this.render_options.parenLeftPadding+this.render_options.parenRightPadding:0;return getGlyphWidth(this.glyph)+e}},{key:"setNote",value:function(e){if(!e)throw new Vex.RERR("ArgumentError","Bad note value: ".concat(e));this.note=e,"gracenotes"===this.note.getCategory()&&(this.render_options.font_scale=25,this.reset())}},{key:"setAsCautionary",value:function(){return this.cautionary=!0,this.render_options.font_scale=28,this.reset(),this}},{key:"draw",value:function(){var e=this.context,t=this.type,n=this.position,r=this.note,i=this.index,a=this.cautionary,o=this.x_shift,s=this.y_shift,l=this.glyph,u=this.parenLeft,c=this.parenRight,h=this.render_options,d=h.parenLeftPadding,f=h.parenRightPadding;if(this.checkContext(),!r||null==i)throw new Vex.RERR("NoAttachedNote","Can't draw accidental without a note and index.");var p=r.getModifierStartXY(n,i),v=p.x+o,m=p.y+s;L$g("Rendering: ",t,v,m),a?(c.render(e,v,m),v-=getGlyphWidth(c),v-=f,v-=this.accidental.parenRightPaddingAdjustment,l.render(e,v,m),v-=getGlyphWidth(l),v-=d,u.render(e,v,m)):l.render(e,v,m),this.setRendered()}}],[{key:"CATEGORY",get:function(){return"accidentals"}},{key:"format",value:function(e,t){var n=this,r=t.left_shift+1;if(e&&0!==e.length){for(var i=[],a=null,o=0,s=0;sg?A.shift:g,y=A.line}for(var S=0,x=function(e){for(var t=!1,r=e,i=e;i+1=7){for(var f=2,p=!0;!0===p;){p=!1;for(var v=0;v+fo?S:o}else for(a=e;a<=i;a++)o=Flow.accidentalColumnsTable[h][d][a-e],m[a].column=o,S=S>o?S:o;w=e=i},w=0;w_[e.column]&&(_[e.column]=e.width)}));for(var C=1;C<_.length;C++)E[C]=_[C]+E[C-1];var M=E[E.length-1],P=0;m.forEach((function(e){for(var t=0,n=P+e.numAcc;P0?(r=t.flatLine||t.dblSharpLine?2.5:3,e.dblSharpLine&&(n-=.5)):(r=e.flatLine||e.dblSharpLine?2.5:3,t.dblSharpLine&&(n-=.5));var i=Math.abs(n)-1;if(!c||c&&h){o[s.root]=u;var d=new n(l);t.addAccidental(i,d),r.push(u)}})),t.getModifiers().forEach((function(t){"gracenotegroups"===t.getCategory()&&t.getGraceNotes().forEach(e)})))}))}))}}]),n}(Modifier),NoteSubGroup$1=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e){var r;return _classCallCheck2(this,n),(r=t.call(this)).setAttribute("type","NoteSubGroup"),r.note=null,r.index=null,r.position=Modifier.Position.LEFT,r.subNotes=e,r.subNotes.forEach((function(e){e.ignore_ticks=!1})),r.width=0,r.preFormatted=!1,r.formatter=new _Formatter,r.voice=new Voice$1({num_beats:4,beat_value:4,resolution:Flow.RESOLUTION}).setStrict(!1),r.voice.addTickables(r.subNotes),_possibleConstructorReturn2(r,_assertThisInitialized2(r))}return _createClass2(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"preFormat",value:function(){this.preFormatted||(this.formatter.joinVoices([this.voice]).format([this.voice],0),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}},{key:"setNote",value:function(e){this.note=e}},{key:"setWidth",value:function(e){this.width=e}},{key:"getWidth",value:function(){return this.width}},{key:"draw",value:function(){var e=this;this.checkContext();var t=this.getNote();if(!t||null===this.index)throw new Vex.RuntimeError("NoAttachedNote","Can't draw notes without a parent note and parent note index.");this.setRendered(),this.alignSubNotesWithNote(this.subNotes,t),this.subNotes.forEach((function(t){return t.setContext(e.context).drawWithStyle()}))}}],[{key:"CATEGORY",get:function(){return"notesubgroup"}},{key:"format",value:function(e,t){if(!e||0===e.length)return!1;for(var n=0,r=0;rh&&Math.abs(u-h)<10?-6:0;if(this.first_note&&"jianpu"===this.first_note.DYMusicScoreType){if("TabTie"===this.getAttribute("type"))continue;u1){var t=new Beam$1(e);t.render_options.beam_width=3,t.render_options.partial_beam_length=4,this.beams.push(t)}return this}},{key:"setNote",value:function(e){this.note=e}},{key:"setWidth",value:function(e){this.width=e}},{key:"getWidth",value:function(){return this.width}},{key:"getGraceNotes",value:function(){return this.grace_notes}},{key:"draw",value:function(){var e=this;this.checkContext();var t=this.getNote();if(L$f("Drawing grace note group for:",t),!t||null===this.index)throw new Vex.RuntimeError("NoAttachedNote","Can't draw grace note without a parent note and parent note index.");if(this.setRendered(),this.alignSubNotesWithNote(this.getGraceNotes(),t),this.grace_notes.forEach((function(t){t.setContext(e.context).draw()})),this.beams.forEach((function(t){t.setContext(e.context).draw()})),this.show_slur){var n=this.getNote().getCategory()===_StaveNote3.CATEGORY,r=n?_StaveTie2:TabTie;this.slur=new r({last_note:this.grace_notes[0],first_note:t,first_indices:[0],last_indices:[0]}),this.slur.render_options.cp2=12,this.slur.render_options.y_shift=(n?7:5)+this.render_options.slur_y_shift,this.slur.setContext(this.context).draw()}}}],[{key:"CATEGORY",get:function(){return"gracenotegroups"}},{key:"format",value:function(e,t){if(!e||0===e.length)return!1;for(var n=[],r=null,i=0,a=0;a=Renderer.LineEndType.NONE&&e<=Renderer.LineEndType.DOWN&&(this.leg=e),this}},{key:"setStringNumber",value:function(e){return this.string_number=e,this}},{key:"setOffsetX",value:function(e){return this.x_offset=e,this}},{key:"setOffsetY",value:function(e){return this.y_offset=e,this}},{key:"setLastNote",value:function(e){return this.last_note=e,this}},{key:"setDashed",value:function(e){return this.dashed=e,this}},{key:"draw",value:function(){var e=this.checkContext();if(!this.note||null==this.index)throw new Vex.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();var t=this.note.stave.options.spacing_between_lines_px,n=this.note.getModifierStartXY(this.position,this.index),r=n.x+this.x_shift+this.x_offset,i=n.y+this.y_shift+this.y_offset;switch(this.position){case Modifier.Position.ABOVE:case Modifier.Position.BELOW:var a=this.note.getStemExtents(),o=a.topY,s=a.baseY+2;this.note.stem_direction===_StaveNote3.STEM_DOWN&&(o=a.baseY,s=a.topY-2),i=this.position===Modifier.Position.ABOVE?this.note.hasStem()?o-1.75*t:n.y-1.75*t:this.note.hasStem()?s+1.5*t:n.y+1.75*t,i+=this.y_shift+this.y_offset;break;case Modifier.Position.LEFT:r-=this.radius/2+5;break;case Modifier.Position.RIGHT:r+=this.radius/2+6;break;default:throw new Vex.RERR("InvalidPosition","The position ".concat(this.position," is invalid"))}e.save(),e.beginPath(),e.arc(r,i,this.radius,0,2*Math.PI,!1),e.lineWidth=1.5,e.stroke(),e.setFont(this.font.family,this.font.size,this.font.weight);var l=r-e.measureText(this.string_number).width/2;if(e.fillText(""+this.string_number,l,i+4.5),null!=this.last_note){var u,c,h=this.last_note.getStemX()-this.note.getX()+5;switch(e.strokeStyle="#000000",e.lineCap="round",e.lineWidth=.6,this.dashed?Renderer.drawDashedLine(e,r+10,i,r+h,i,[3,3]):Renderer.drawDashedLine(e,r+10,i,r+h,i,[3,0]),this.leg){case Renderer.LineEndType.UP:u=-10,c=this.dashed?[3,3]:[3,0],Renderer.drawDashedLine(e,r+h,i,r+h,i+u,c);break;case Renderer.LineEndType.DOWN:u=10,c=this.dashed?[3,3]:[3,0],Renderer.drawDashedLine(e,r+h,i,r+h,i+u,c)}}e.restore()}}],[{key:"CATEGORY",get:function(){return"stringnumber"}},{key:"format",value:function(e,t){var n=t.left_shift,r=t.right_shift;if(!e||0===e.length)return this;var i,a,o,s,l,u=[],c=null,h=0,d=0;for(i=0;im?A:m):s===Modifier.Position.RIGHT&&(a.setXShift(v),g=(A+=w)>g?A:g),y=S,b=o}return t.left_shift+=m,t.right_shift+=g,!0}}]),n}(Modifier);function L$e(){for(var e=arguments.length,t=new Array(e),n=0;n=1},getRoundingFunction=function(e,t){return isWithinLines(e,t)?t===ABOVE?Math.ceil:Math.floor:Math.round},snapLineToStaff=function(e,t,n,r){var i=roundToNearestHalf(getRoundingFunction(t,n),t);if(e&&isWithinLines(i,n)&&i%1==0){return i+.5*-r}return i},isStaveNote=function(e){var t=e.getCategory();return"stavenotes"===t||"gracenotes"===t},isTabNote=function(e){var t=e.getCategory();return"tabnotes"===t||"numberednotes"===t},getTopY=function(e,t){var n=e.getStave(),r=e.getStemDirection(),i=e.getStemExtents(),a=i.topY,o=i.baseY;if(isStaveNote(e))return e.hasStem()?r===Stem.UP?a:o:Math.min.apply(Math,_toConsumableArray2(e.getYs()));if(isTabNote(e))return e.hasStem()&&r===Stem.UP?a:n.getYForTopText(t);throw new Vex.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},getBottomY=function(e,t){var n=e.getStave(),r=e.getStemDirection(),i=e.getStemExtents(),a=i.topY,o=i.baseY;if(isStaveNote(e))return e.hasStem()?r===Stem.UP?o:a:Math.max.apply(Math,_toConsumableArray2(e.getYs()));if(isTabNote(e))return e.hasStem()?r===Stem.UP?n.getYForBottomText(t):a:n.getYForBottomText(t);throw new Vex.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},getInitialOffset=function(e,t){var n=t===ABOVE&&e.getStemDirection()===Stem.UP||t===BELOW&&e.getStemDirection()===Stem.DOWN;return isStaveNote(e)?e.hasStem()&&n?.5:1:e.hasStem()&&n?1:0},Articulation$1=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e){var r;if(_classCallCheck2(this,n),(r=t.call(this)).setAttribute("type","Articulation"),r.note=null,r.index=null,r.type=e,r.position=BELOW,r.render_options={font_scale:38},r.articulation=Flow.articulationCodes(r.type),!r.articulation)throw new Vex.RERR("ArgumentError","Articulation not found: ".concat(r.type));return r.glyph=new Glyph(r.articulation.code,r.render_options.font_scale),r.setWidth(r.glyph.getMetrics().width),r}return _createClass2(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"draw",value:function(){var e,t=this,r=this.note,i=this.index,a=this.position,o=this.glyph,s=this.articulation.between_lines,l=this.text_line,u=this.context;if(this.checkContext(),!r||null==i)throw new Vex.RERR("NoAttachedNote","Can't draw Articulation without a note and index.");this.setRendered();var c=r.getStave(),h=c.getSpacingBetweenLines(),d="tabnotes"===r.getCategory(),f=r.getModifierStartXY(a,i).x,p=!s||d,v=getInitialOffset(r,a),m=(e={},_defineProperty2(e,ABOVE,(function(){o.setOrigin(.5,1);var e=getTopY(r,l)-(l+v)*h+(t.y_shift||0);return p?Math.min(c.getYForTopText(n.INITIAL_OFFSET),e):e})),_defineProperty2(e,BELOW,(function(){o.setOrigin(.5,0);var e=getBottomY(r,l)+(l+v)*h;return p?Math.max(c.getYForBottomText(n.INITIAL_OFFSET),e):e})),e)[a]();if(!d){var g=a===ABOVE?-1:1,y=d?r.positions[i].str:r.getKeyProps()[i].line,b=(r.getYs()[i]-m)/h+y,A=snapLineToStaff(s,b,a,g);isWithinLines(A,a)&&o.setOrigin(.5,.5),m+=Math.abs(A-b)*h*g}L$e("Rendering articulation at (x: ".concat(f,", y: ").concat(m,")")),o.render(u,f,m)}}],[{key:"CATEGORY",get:function(){return"articulations"}},{key:"INITIAL_OFFSET",get:function(){return-.5}},{key:"format",value:function(e,t){if(!e||0===e.length)return!1;var n=function(e,t,n){return roundToNearestHalf(getRoundingFunction(t,n),e.glyph.getMetrics().height/10+.5)};e.filter((function(e){return e.getPosition()===ABOVE})).forEach((function(e){e.setTextLine(t.top_text_line),t.top_text_line+=n(e,t.top_text_line,ABOVE)})),e.filter((function(e){return e.getPosition()===BELOW})).forEach((function(e){e.setTextLine(t.text_line),t.text_line+=n(e,t.text_line,BELOW)}));var r=e.map((function(e){return e.getWidth()})).reduce((function(e,t){return Math.max(t,e)}));return t.left_shift+=r/2,t.right_shift+=r/2,!0}},{key:"easyScoreHook",value:function(e,t,n){var r=e.articulations;if(r){var i={staccato:"a.",tenuto:"a-"};r.split(",").map((function(e){return e.trim().split(".")})).map((function(e){var t=_slicedToArray(e,2),r=t[0],a=t[1],o={type:i[r]};return a&&(o.position=Modifier.PositionString[a]),n.getFactory().Articulation(o)})).map((function(e){return t.addModifier(0,e)}))}}}]),n}(Modifier),_TickContext=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(){var e;return _classCallCheck2(this,n),(e=t.call(this)).setAttribute("type","TickContext"),e.currentTick=new Fraction(0,1),e.maxTicks=new Fraction(0,1),e.minTicks=null,e.padding=3,e.x=0,e.xBase=0,e.xOffset=0,e.tickables=[],e.notePx=0,e.extraLeftPx=0,e.extraRightPx=0,e.tContexts=[],e}return _createClass2(n,[{key:"getX",value:function(){return this.x}},{key:"setX",value:function(e){return this.x=e,this.xBase=e,this.xOffset=0,this}},{key:"getXBase",value:function(){return this.xBase}},{key:"setXBase",value:function(e){this.xBase=e,this.x=e+this.xOffset}},{key:"getXOffset",value:function(){return this.xOffset}},{key:"setXOffset",value:function(e){this.xOffset=e,this.x=this.xBase+e}},{key:"getWidth",value:function(){return this.width+2*this.padding}},{key:"setPadding",value:function(e){return this.padding=e,this}},{key:"getMaxTicks",value:function(){return this.maxTicks}},{key:"getMinTicks",value:function(){return this.minTicks}},{key:"getTickables",value:function(){return this.tickables}},{key:"getCenterAlignedTickables",value:function(){return this.tickables.filter((function(e){return e.isCenterAligned()}))}},{key:"getMetrics",value:function(){return{width:this.width,notePx:this.notePx,extraLeftPx:this.extraLeftPx,extraRightPx:this.extraRightPx}}},{key:"getCurrentTick",value:function(){return this.currentTick}},{key:"setCurrentTick",value:function(e){this.currentTick=e,this.preFormatted=!1}},{key:"getExtraPx",value:function(){for(var e=0,t=0,n=0,r=0,i=0;i0&&r--;for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=this.tickContexts,o=a.list,s=a.map,l=a.resolutionMultiplier;r&&i&&r.forEach((function(e){return e.setStave(i).preFormat()}));var u=0,c=0,h=t/2;if(this.minTotalWidth=0,o.forEach((function(t){var r=s[t];n&&r.setContext(n),r.preFormat();var i=r.getWidth();e.minTotalWidth+=i;var a=r.getMetrics();u=u+c+a.extraLeftPx,r.setX(u),c=i-a.extraLeftPx})),this.minTotalWidth=u+c,this.hasMinTotalWidth=!0,!(t<=0)){var d=(t-this.minTotalWidth)/(this.totalTicks.value()*l),f=0;o.forEach((function(e,t){var n=o[t-1]||0,r=s[e];f+=(e-n)*d,r.setX(r.getX()+f),r.getCenterAlignedTickables().forEach((function(e){e.center_x_shift=h-r.getX()}))})),1!==o.length&&(this.justifyWidth=t,this.lossHistory=[],this.evaluate())}}},{key:"evaluate",value:function(){var e=this,t=this.justifyWidth;this.contextGaps={total:0,gaps:[]},this.tickContexts.list.forEach((function(t,n){if(0!==n){var r=e.tickContexts.list[n-1],i=e.tickContexts.map[r],a=e.tickContexts.map[t],o=i.getMetrics(),s=i.getX()+o.width,l=a.getX(),u=l-s;e.contextGaps.total+=u,e.contextGaps.gaps.push({x1:s,x2:l}),a.getFormatterMetrics().freedom.left=u,i.getFormatterMetrics().freedom.right=u}}));var n=this.durationStats={};this.voices.forEach((function(e){e.getTickables().forEach((function(e,r,i){var a=e.getTicks().clone().simplify().toString(),o=e.getMetrics(),s=e.getFormatterMetrics(),l=e.getX()+o.noteWidth+o.modRightPx+o.extraRightPx,u=0;if(r0?e.tickContexts.map[i[r-1]]:null,s=r0?t=-Math.min(a.getFormatterMetrics().freedom.right,Math.abs(l)):l<0&&(t=s?Math.min(s.getFormatterMetrics().freedom.right,Math.abs(l)):0);var u=Math.min(5,Math.abs(t));t=t>0?u:-u})),this.evaluate()}},{key:"postFormat",value:function(){var e=function(e){return e.list.forEach((function(t){return e.map[t].postFormat()}))};return e(this.modiferContexts),e(this.tickContexts),this}},{key:"joinVoices",value:function(e){return this.createModifierContexts(e),this.hasMinTotalWidth=!1,this}},{key:"format",value:function(e,t,n){var r={align_rests:!1,context:null,stave:null};return Vex.Merge(r,n),this.voices=e,this.alignRests(e,r.align_rests),this.createTickContexts(e),this.preFormat(t,r.context,e,r.stave),this}},{key:"formatToStave",value:function(e,t,n){var r=t.getNoteEndX()-t.getNoteStartX()-10;L$a("Formatting voices to width: ",r);var i={context:t.getContext()};return Vex.Merge(i,n),this.format(e,r,i)}}],[{key:"SimpleFormat",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).paddingBetween,r=void 0===n?10:n;e.reduce((function(e,t){t.addToModifierContext(new _ModifierContext);var n=(new _TickContext).addTickable(t).preFormat(),i=n.getExtraPx();return n.setX(e+i.left),e+n.getWidth()+i.right+r}),t)}},{key:"plotDebugging",value:function(e,t,n,r,i){var a=n+Note.STAVEPADDING,o=t.contextGaps;e.save(),e.setFont("Arial",8,""),o.gaps.forEach((function(t){var n,o,s;n=a+t.x1,o=a+t.x2,s="#aaa",e.beginPath(),e.setStrokeStyle(s),e.setFillStyle(s),e.setLineWidth(1),e.fillRect(n,r,o-n,i-r),e.fillText(Math.round(t.x2-t.x1),a+t.x1,i+12)})),e.fillText(Math.round(o.total)+"px",a-20,i+12),e.setFillStyle("red"),e.fillText("Loss: "+t.lossHistory.map((function(e){return Math.round(e)})),a-20,i+22),e.restore()}},{key:"FormatAndDraw",value:function(t,n,r,i){var a={auto_beam:!1,align_rests:!1};"object"===_typeof2(i)?Vex.Merge(a,i):"boolean"==typeof i&&(a.auto_beam=i);var o=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(r),s=a.auto_beam?Beam$1.applyAndGetBeams(o):[];return(new e).joinVoices([o],{align_rests:a.align_rests}).formatToStave([o],n,{align_rests:a.align_rests,stave:n}),o.setStave(n).draw(t,n),s.forEach((function(e){return e.setContext(t).draw()})),o.getBoundingBox()}},{key:"FormatAndDrawTab",value:function(t,n,r,i,a,o,s){var l={auto_beam:o,align_rests:!1};"object"===_typeof2(s)?Vex.Merge(l,s):"boolean"==typeof s&&(l.auto_beam=s);var u=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(a),c=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(i),h=l.auto_beam?Beam$1.applyAndGetBeams(u):[];(new e).joinVoices([u],{align_rests:l.align_rests}).joinVoices([c]).formatToStave([u,c],r,{align_rests:l.align_rests}),u.draw(t,r),c.draw(t,n),h.forEach((function(e){return e.setContext(t).draw()})),new _StaveConnector(r,n).setContext(t).draw()}},{key:"AlignRestsToNotes",value:function(e,t,n){return e.forEach((function(t,r){if(t instanceof _StaveNote3&&t.isRest()){if(t.tuplet&&!n)return;if(["va5","v3c"].includes(t.glyph.code_head)){var i="va5"===t.glyph.code_head?10:14,a=e[r-1],o=getNext(e,r),s=!1;if(a&&o&&a.beam&&o.beam&&(s=a.beam.notes.includes(o)),s){t.setKeyLine(0,3);var l,u=[].concat(_toConsumableArray2(a.beam.notes),_toConsumableArray2(o.beam.notes));if(t.beam&&t.beam.notes)(l=u).push.apply(l,_toConsumableArray2(t.beam.notes));u=Array.from(new Set(u));for(var c=0;c0){var f=h<1.5?Math.abs(h-1.5)*i:0;d.setResetHeight(f)}else{var p=h>4.5?Math.abs(h-4.5)*i:0;d.setResetHeight(p)}}}}}})),this}}]),e}(),StaveModifier=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(){var e;return _classCallCheck2(this,n),(e=t.call(this)).setAttribute("type","StaveModifier"),e.padding=10,e.position=n.Position.ABOVE,e.layoutMetrics=null,e}return _createClass2(n,[{key:"getPosition",value:function(){return this.position}},{key:"setPosition",value:function(e){return this.position=e,this}},{key:"getStave",value:function(){return this.stave}},{key:"setStave",value:function(e){return this.stave=e,this}},{key:"getWidth",value:function(){return this.width}},{key:"setWidth",value:function(e){return this.width=e,this}},{key:"getX",value:function(){return this.x}},{key:"setX",value:function(e){return this.x=e,this}},{key:"getCategory",value:function(){return""}},{key:"makeSpacer",value:function(e){return{getContext:function(){return!0},setStave:function(){},renderToStave:function(){},getMetrics:function(){return{width:e}}}}},{key:"placeGlyphOnLine",value:function(e,t,n){e.setYShift(t.getYForLine(n)-t.getYForGlyphs())}},{key:"getPadding",value:function(e){return void 0!==e&&e<2?0:this.padding}},{key:"setPadding",value:function(e){return this.padding=e,this}},{key:"setLayoutMetrics",value:function(e){return this.layoutMetrics=e,this}},{key:"getLayoutMetrics",value:function(){return this.layoutMetrics}}],[{key:"Position",get:function(){return{LEFT:1,RIGHT:2,ABOVE:3,BELOW:4,BEGIN:5,END:6}}}]),n}(Element$1),Barline=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e){var r;_classCallCheck2(this,n),(r=t.call(this)).setAttribute("type","Barline"),r.thickness=Flow.STAVE_LINE_THICKNESS;var i=n.type;return r.widths={},r.widths[i.SINGLE]=5,r.widths[i.DOUBLE]=5,r.widths[i.END]=5,r.widths[i.REPEAT_BEGIN]=5,r.widths[i.REPEAT_END]=5,r.widths[i.REPEAT_BOTH]=5,r.widths[i.NONE]=5,r.paddings={},r.paddings[i.SINGLE]=0,r.paddings[i.DOUBLE]=0,r.paddings[i.END]=0,r.paddings[i.REPEAT_BEGIN]=15,r.paddings[i.REPEAT_END]=15,r.paddings[i.REPEAT_BOTH]=15,r.paddings[i.NONE]=0,r.layoutMetricsMap={},r.layoutMetricsMap[i.SINGLE]={xMin:0,xMax:1,paddingLeft:5,paddingRight:5},r.layoutMetricsMap[i.DOUBLE]={xMin:-3,xMax:1,paddingLeft:5,paddingRight:5},r.layoutMetricsMap[i.END]={xMin:-5,xMax:1,paddingLeft:5,paddingRight:5},r.layoutMetricsMap[i.REPEAT_END]={xMin:-10,xMax:1,paddingLeft:5,paddingRight:5},r.layoutMetricsMap[i.REPEAT_BEGIN]={xMin:-2,xMax:10,paddingLeft:5,paddingRight:5},r.layoutMetricsMap[i.REPEAT_BOTH]={xMin:-10,xMax:10,paddingLeft:5,paddingRight:5},r.layoutMetricsMap[i.NONE]={xMin:0,xMax:0,paddingLeft:5,paddingRight:5},r.setPosition(StaveModifier.Position.BEGIN),r.setType(e),r}return _createClass2(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"getType",value:function(){return this.type}},{key:"setType",value:function(e){return this.type="string"==typeof e?n.typeString[e]:e,this.setWidth(this.widths[this.type]),this.setPadding(this.paddings[this.type]),this.setLayoutMetrics(this.layoutMetricsMap[this.type]),this}},{key:"draw",value:function(e){switch(e.checkContext(),this.setRendered(),this.type){case n.type.SINGLE:this.drawVerticalBar(e,this.x,!1);break;case n.type.DOUBLE:this.drawVerticalBar(e,this.x,!0);break;case n.type.END:this.drawVerticalEndBar(e,this.x);break;case n.type.REPEAT_BEGIN:this.drawRepeatBar(e,this.x,!0),e.getX()!==this.x&&this.drawVerticalBar(e,e.getX());break;case n.type.REPEAT_END:this.drawRepeatBar(e,this.x,!1);break;case n.type.REPEAT_BOTH:this.drawRepeatBar(e,this.x,!1),this.drawRepeatBar(e,this.x,!0)}}},{key:"drawVerticalBar",value:function(e,t,n){e.checkContext();var r=e.getTopLineTopY(),i=e.getBottomLineBottomY();n&&e.context.fillRect(t-3,r,1,i-r),e.context.fillRect(t,r,1,i-r)}},{key:"drawVerticalEndBar",value:function(e,t){e.checkContext();var n=e.getTopLineTopY(),r=e.getBottomLineBottomY();e.context.fillRect(t-5,n,1,r-n),e.context.fillRect(t-2,n,3,r-n)}},{key:"drawRepeatBar",value:function(e,t,n){e.checkContext();var r=e.getTopLineTopY(),i=e.getBottomLineBottomY(),a=3;n||(a=-5),e.context.fillRect(t+a,r,1,i-r),e.context.fillRect(t-2,r,3,i-r);n?a+=4:a-=4;var o=t+a+1,s=(e.getNumLines()-1)*e.getSpacingBetweenLines(),l=r+(s=s/2-e.getSpacingBetweenLines()/2)+1;e.context.beginPath(),e.context.arc(o,l,2,0,2*Math.PI,!1),e.context.fill(),l+=e.getSpacingBetweenLines(),e.context.beginPath(),e.context.arc(o,l,2,0,2*Math.PI,!1),e.context.fill()}}],[{key:"CATEGORY",get:function(){return"barlines"}},{key:"type",get:function(){return{SINGLE:1,DOUBLE:2,END:3,REPEAT_BEGIN:4,REPEAT_END:5,REPEAT_BOTH:6,NONE:7}}},{key:"typeString",get:function(){return{single:n.type.SINGLE,double:n.type.DOUBLE,end:n.type.END,repeatBegin:n.type.REPEAT_BEGIN,repeatEnd:n.type.REPEAT_END,repeatBoth:n.type.REPEAT_BOTH,none:n.type.NONE}}}]),n}(StaveModifier),Repetition$1=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i){var a;return _classCallCheck2(this,n),(a=t.call(this)).setAttribute("type","Repetition"),a.symbol_type=e,a.x=r,a.x_shift=0,a.y_shift=i,a.font={family:"times",size:12,weight:"bold italic"},a}return _createClass2(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"setShiftX",value:function(e){return this.x_shift=e,this}},{key:"setShiftY",value:function(e){return this.y_shift=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"draw",value:function(e,t){switch(this.setRendered(),this.symbol_type){case n.type.CODA_RIGHT:this.drawCodaFixed(e,t+e.width);break;case n.type.CODA_LEFT:this.drawSymbolText(e,t,"Coda",!1);break;case n.type.SEGNO_LEFT:this.drawSignoFixed(e,t);break;case n.type.SEGNO_RIGHT:this.drawSignoFixed(e,t+e.width);break;case n.type.DC:this.drawSymbolText(e,t,"D.C.",!1);break;case n.type.DC_AL_CODA:this.drawSymbolText(e,t,"D.C. al Coda",!0);break;case n.type.DC_AL_FINE:this.drawSymbolText(e,t,"D.C. al Fine",!1);break;case n.type.DS:this.drawSymbolText(e,t,"D.S.",!1);break;case n.type.DS_AL_CODA:this.drawSymbolText(e,t,"D.S. al Coda",!0);break;case n.type.DS_AL_FINE:this.drawSymbolText(e,t,"D.S. al Fine",!1);break;case n.type.FINE:this.drawSymbolText(e,t,"Fine",!1);break;case n.type.TO_CODA:this.drawSymbolText(e,t,"To Coda",!0)}return this}},{key:"drawCodaFixed",value:function(e,t){var n=e.getYForTopText(e.options.num_lines)+this.y_shift;return Glyph.renderGlyph(e.context,this.x+t+this.x_shift,n+25,40,"v4d",!0),this}},{key:"drawSignoFixed",value:function(e,t){var n=e.getYForTopText(e.options.num_lines)+this.y_shift;return Glyph.renderGlyph(e.context,this.x+t+this.x_shift,n+25,30,"v8c",!0),this}},{key:"drawSymbolText",value:function(e,t,r,i){var a=e.checkContext();a.save(),a.setFont(this.font.family,this.font.size,this.font.weight);var o=0+this.x_shift,s=t+this.x_shift;this.symbol_type===n.type.CODA_LEFT?s=(o=this.x+e.options.vertical_bar_width)+a.measureText(r).width+12:(this.x_shift=-(o+a.measureText(r).width+12+e.options.vertical_bar_width+12),s=(o=this.x+this.x_shift+e.options.vertical_bar_width)+a.measureText(r).width+12);var l=e.getYForTopText(e.options.num_lines)+this.y_shift+25;return i&&Glyph.renderGlyph(a,s,l,40,"v4d",!0),a.fillText(r,o,l+5),a.restore(),this}}],[{key:"CATEGORY",get:function(){return"repetitions"}},{key:"type",get:function(){return{NONE:1,CODA_LEFT:2,CODA_RIGHT:3,SEGNO_LEFT:4,SEGNO_RIGHT:5,DC:6,DC_AL_CODA:7,DC_AL_FINE:8,DS:9,DS_AL_CODA:10,DS_AL_FINE:11,FINE:12,TO_CODA:13}}}]),n}(StaveModifier),StaveSection=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i){var a;return _classCallCheck2(this,n),(a=t.call(this)).setAttribute("type","StaveSection"),a.setWidth(16),a.section=e,a.x=r,a.shift_x=0,a.shift_y=i,a.font={family:"sans-serif",size:12,weight:"bold"},a}return _createClass2(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"setStaveSection",value:function(e){return this.section=e,this}},{key:"setShiftX",value:function(e){return this.shift_x=e,this}},{key:"setShiftY",value:function(e){return this.shift_y=e,this}},{key:"draw",value:function(e,t){var n=e.checkContext();this.setRendered(),n.save(),n.lineWidth=2,n.setFont(this.font.family,this.font.size,this.font.weight);var r=n.measureText(""+this.section),i=r.width,a=r.height,o=i+6;o<18&&(o=18);var s=a,l=e.getYForTopText(3)+this.shift_y,u=this.x+t;return n.beginPath(),n.lineWidth=2,n.rect(u,l+a/4,o,s),n.stroke(),u+=(o-i)/2,n.fillText(""+this.section,u,l+16),n.restore(),this}}],[{key:"CATEGORY",get:function(){return"stavesection"}}]),n}(StaveModifier),StaveTempo=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i){var a;return _classCallCheck2(this,n),(a=t.call(this)).setAttribute("type","StaveTempo"),a.tempo=e,a.position=Modifier.Position.ABOVE,a.x=r,a.shift_x=10,a.shift_y=i,a.font={family:"times",size:14,weight:"bold"},a.render_options={glyph_font_scale:30},a}return _createClass2(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"setTempo",value:function(e){return this.tempo=e,this}},{key:"setShiftX",value:function(e){return this.shift_x=e,this}},{key:"setShiftY",value:function(e){return this.shift_y=e,this}},{key:"draw",value:function(e,t){var n=e.checkContext();this.setRendered();var r=this.render_options,i=r.glyph_font_scale/38,a=this.tempo.name,o=this.tempo.duration,s=this.tempo.dots,l=this.tempo.bpm,u=this.font,c=this.x+this.shift_x+t,h=e.getYForTopText(1)+this.shift_y;if(n.save(),n.openGroup("stavetempo",null,{}),a&&(n.setFont(u.family,u.size,u.weight),n.fillText(a,c,h),c+=n.measureText(a).width),o&&l){n.setFont(u.family,u.size,"normal"),a&&(c+=n.measureText(" ").width,n.fillText("(",c,h),c+=n.measureText("(").width);var d=Flow.getGlyphProps(o);if(c+=3*i,Glyph.renderGlyph(n,c,h,r.glyph_font_scale,d.code_head),c+=d.getWidth()*i,d.stem){var f=30;d.beam_count&&(f+=3*(d.beam_count-1));var p=h-(f*=i);n.fillRect(c-i,p,i,f),d.flag&&(Glyph.renderGlyph(n,c,p,r.glyph_font_scale,d.code_flag_upstem),s||(c+=6*i))}for(var v=0;v=e.line?o.above:o.below}this.placeGlyphOnLine(i,this.stave,e.line),this.glyphs.push(i);var s=this.xPositions[this.xPositions.length-1],l=i.getMetrics().width+a;this.xPositions.push(s+l),this.width+=l}},{key:"cancelKey",value:function(e){return this.formatted=!1,this.cancelKeySpec=e,this}},{key:"convertToCancelAccList",value:function(e){var t=Flow.keySignature(e),n=this.accList.length>0&&t.length>0&&t[0].type!==this.accList[0].type,r=n?t.length:t.length-this.accList.length;if(!(r<1)){for(var i=[],a=0;a2&&void 0!==arguments[2]?arguments[2]:this.accList,a=0;switch(e){case"soprano":"#"===t?n=[2.5,.5,2,0,1.5,-.5,1]:a=-1;break;case"mezzo-soprano":"b"===t?n=[0,2,.5,2.5,1,3,1.5]:a=1.5;break;case"alto":a=.5;break;case"tenor":"#"===t?n=[3,1,2.5,.5,2,0,1.5]:a=-.5;break;case"baritone-f":case"baritone-c":"b"===t?n=[.5,2.5,1,3,1.5,3.5,2]:a=2;break;case"bass":case"french":a=1}if(void 0!==n)for(r=0;r0?t[0].type:null;if(this.cancelKeySpec&&(e=this.convertToCancelAccList(this.cancelKeySpec)),this.alterKeySpec&&this.convertToAlterAccList(this.alterKeySpec),this.accList.length>0){var r=(this.position===StaveModifier.Position.END?this.stave.endClef:this.stave.clef)||this.stave.clef;e&&this.convertAccLines(r,e.type,e.accList),this.convertAccLines(r,n,t);for(var i=0;i0){this.stave.context.openGroup("keysignature");for(var e=0;e/"'));t.forEach((function(t){if(isNaN(Number(t)))throw new Vex.RERR("BadTimeSignature","Invalid time spec: ".concat(e,". Must contain two valid numbers."))}))},TimeSignature=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(_classCallCheck2(this,n),(e=t.call(this)).setAttribute("type","TimeSignature"),e.validate_args=a,null===r)return _possibleConstructorReturn2(e);var o=i;return e.point=40,e.topLine=2,e.bottomLine=4,e.setPosition(StaveModifier.Position.BEGIN),e.setTimeSig(r),e.setWidth(e.timeSig.glyph.getMetrics().width),e.setPadding(o),e}return _createClass2(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"parseTimeSpec",value:function(e){if("C"===e||"C|"===e){var t=n.glyphs[e],r=t.line,i=t.code,a=t.point;return{line:r,num:!1,glyph:new Glyph(i,a)}}this.validate_args&&assertIsValidFraction(e);var o=_slicedToArray(e.split("/").map((function(e){return e.split("")})),2),s=o[0],l=o[1];return{num:!0,glyph:this.makeTimeSignatureGlyph(s,l)}}},{key:"makeTimeSignatureGlyph",value:function(e,t){var n=new Glyph("v0",this.point);n.topGlyphs=[],n.botGlyphs=[];for(var r=0,i=0;is?r:s,d=n.getMetrics().x_min;n.getMetrics=function(){return{x_min:d,x_max:d+h,width:h}};var f=(h-r)/2,p=(h-s)/2,v=this;return n.renderToStave=function(e){for(var t=e+f,n=0;n0&&void 0!==arguments[0]?arguments[0]:0))throw new Vex.RERR("InvalidIndex","Must be of number type");if(this.formatted||this.format(),1===this.getModifiers(StaveModifier.Position.BEGIN).length)return 0;var e=this.start_x-this.x,t=this.modifiers[0];return t.getType()===Barline.type.REPEAT_BEGIN&&e>t.getWidth()&&(e-=t.getWidth()),e}},{key:"setRepetitionTypeLeft",value:function(e,t){return this.modifiers.push(new Repetition$1(e,this.x,t)),this}},{key:"setRepetitionTypeRight",value:function(e,t){return this.modifiers.push(new Repetition$1(e,this.x,t)),this}},{key:"setVoltaType",value:function(e,t,n){if(2===e)2===volta.type&&volta.stave.modifiers.push(new Volta(volta.type,volta.number_t,volta.x,volta.y)),volta={stave:this,type:e,number_t:t,MeasureNumber:this.MeasureNumber,y:n,x:this.x};else if(4===e){for(var r=this.MeasureNumber-volta.MeasureNumber,i=Math.max(volta.y,n),a=0;a<=r;a++)voltaMeasureNumber[volta.MeasureNumber+a]={type:0===a?2:a===r?4:0,number_t:t,y:i};volta={}}else this.modifiers.push(new Volta(e,t,this.x,n));return this}},{key:"drawVolta",value:function(){var e=voltaMeasureNumber[this.MeasureNumber];e&&(this.modifiers.push(new Volta(e.type,e.number_t,this.x,e.y)),delete voltaMeasureNumber[this.MeasureNumber]),volta.type&&volta.MeasureNumber==this.MeasureNumber&&(this.modifiers.push(new Volta(volta.type,volta.number_t,this.x,volta.y)),volta={})}},{key:"setSection",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:12,i=new StaveSection(e,this.x+n,t);return i.font.size=r,this.modifiers.push(i),this}},{key:"setTempo",value:function(e,t){return this.modifiers.push(new StaveTempo(e,this.x,t)),this}},{key:"setText",value:function(e,t,n){var r=new StaveText(e,t,n);return r.setFont({family:"Arial",size:14,weight:"normal"}),this.modifiers.push(r),this}},{key:"getHeight",value:function(){return this.height}},{key:"getSpacingBetweenLines",value:function(){return this.options.spacing_between_lines_px}},{key:"getBoundingBox",value:function(){return new BoundingBox(this.x,this.y,this.width,this.getBottomY()-this.y)}},{key:"getBottomY",value:function(){var e=this.options,t=e.spacing_between_lines_px;return this.getYForLine(e.num_lines)+e.space_below_staff_ln*t}},{key:"getBottomLineY",value:function(){return this.getYForLine(this.options.num_lines)}},{key:"getYForLine",value:function(e){var t=this.options,n=t.spacing_between_lines_px,r=t.space_above_staff_ln;return this.y+e*n+r*n}},{key:"getLineForY",value:function(e){var t=this.options,n=t.spacing_between_lines_px,r=t.space_above_staff_ln;return(e-this.y)/n-r}},{key:"getYForTopText",value:function(e){var t=e||0;return this.getYForLine(-t-this.options.top_text_position)}},{key:"getYForBottomText",value:function(e){var t=e||0;return this.getYForLine(this.options.bottom_text_position+t)}},{key:"getYForNote",value:function(e){var t=this.options,n=t.spacing_between_lines_px,r=t.space_above_staff_ln;return this.y+r*n+5*n-e*n}},{key:"getYForGlyphs",value:function(){return this.getYForLine(3)}},{key:"addModifier",value:function(e,t,n){return void 0!==t&&e.setPosition(t),n&&(this.timeSignature.numerator=n.numerator,this.timeSignature.denominator=n.denominator),e.setStave(this),this.formatted=!1,this.modifiers.push(e),this}},{key:"addEndModifier",value:function(e){return this.addModifier(e,StaveModifier.Position.END),this}},{key:"setBegBarType",value:function(e){var t=Barline.type,n=t.SINGLE,r=t.REPEAT_BEGIN,i=t.NONE;return e!==n&&e!==r&&e!==i||(this.modifiers[0].setType(e),this.formatted=!1),this}},{key:"setEndBarType",value:function(e){return e!==Barline.type.REPEAT_BEGIN&&(this.modifiers[1].setType(e),this.formatted=!1),this}},{key:"setClef",value:function(e,t,n,r){void 0===r&&(r=StaveModifier.Position.BEGIN),r===StaveModifier.Position.END?this.endClef=e:this.clef=e;var i=this.getModifiers(r,Clef.CATEGORY);return 0===i.length?this.addClef(e,t,n,r):i[0].setType(e,t,n),this}},{key:"setEndClef",value:function(e,t,n){return this.setClef(e,t,n,StaveModifier.Position.END),this}},{key:"setKeySignature",value:function(e,t,n){this.options.keySignature=e,void 0===n&&(n=StaveModifier.Position.BEGIN);var r=this.getModifiers(n,KeySignature.CATEGORY);return 0===r.length?"jianpu"!==this.options.DYMusicScoreType&&this.addKeySignature(e,t,n):r[0].setKeySig(e,t),this}},{key:"setEndKeySignature",value:function(e,t){return this.setKeySignature(e,t,StaveModifier.Position.END),this}},{key:"setTimeSignature",value:function(e,t,n){void 0===n&&(n=StaveModifier.Position.BEGIN);var r=this.getModifiers(n,TimeSignature.CATEGORY);return 0===r.length?this.addTimeSignature(e,t,n):r[0].setTimeSig(e),this}},{key:"setEndTimeSignature",value:function(e,t){return this.setTimeSignature(e,t,StaveModifier.Position.END),this}},{key:"addKeySignature",value:function(e,t,n){return void 0===n&&(n=StaveModifier.Position.BEGIN),this.addModifier(new KeySignature(e,t).setPosition(n),n),this}},{key:"addClef",value:function(e,t,n,r){return void 0===r||r===StaveModifier.Position.BEGIN?this.clef=e:r===StaveModifier.Position.END&&(this.endClef=e),this.addModifier(new Clef(e,t,n),r),this}},{key:"addEndClef",value:function(e,t,n){return this.addClef(e,t,n,StaveModifier.Position.END),this}},{key:"addTimeSignature",value:function(e,t,n){return this.addModifier(new TimeSignature(e,t),n),this}},{key:"addEndTimeSignature",value:function(e,t){return this.addTimeSignature(e,t,StaveModifier.Position.END),this}},{key:"addTrebleGlyph",value:function(){return this.addClef("treble"),this}},{key:"getModifiers",value:function(e,t){return void 0===e&&void 0===t?this.modifiers:this.modifiers.filter((function(n){return!(void 0!==e&&e!==n.getPosition()||void 0!==t&&t!==n.getCategory())}))}},{key:"sortByCategory",value:function(e,t){for(var n=e.length-1;n>=0;n--)for(var r=0;rt[e[r+1].getCategory()]){var i=e[r];e[r]=e[r+1],e[r+1]=i}}},{key:"format",value:function(){var e,t,n,r=this.modifiers[0],i=this.modifiers[1],a=this.getModifiers(StaveModifier.Position.BEGIN),o=this.getModifiers(StaveModifier.Position.END);this.sortByCategory(a,{barlines:0,clefs:1,keysignatures:2,timesignatures:3}),this.sortByCategory(o,{timesignatures:0,keysignatures:1,barlines:2,clefs:3}),a.length>1&&r.getType()===Barline.type.REPEAT_BEGIN&&(a.push(a.splice(0,1)[0]),a.splice(0,0,new Barline(Barline.type.SINGLE))),o.indexOf(i)>0&&o.splice(0,0,new Barline(Barline.type.NONE));for(var s=0,l=this.x,u=0;u0){this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);var h=this.context.measureText(""+this.measure).width;t=this.getYForTopText(0)+3,this.context.fillText(""+this.measure,this.x-h/2,t),this.context.restore()}return this}},{key:"drawStaveTempo",value:function(){if(this.staveTempos.length){var e=document.querySelector("#".concat(this.attrs.id));if(e){var t=e.parentElement.getBBox(),n=this.getYForLine(0),r=e.parentElement.parentElement.querySelectorAll(".vf-curve");if(r.length){var i=this.x+this.staveTempos[0].shift_x+this.getModifierXShift(0),a=this.getYForTopText(1)+t.y-n+5;r.forEach((function(e){var n=e.getBBox();n.x-10i&&n.y-10a&&(t.y=n.y+5)}))}for(var o=0;o=0&&this.timeSignature.numerator){var t=40,r=0;this.MeasureNumber<2&&(t=70,r=-72),this.setText("".concat(this.timeSignature.numerator),1,{justification:1,shift_x:t,shift_y:r-13}),this.setText("ᅳ",1,{justification:1,shift_x:t+3,shift_y:r-2}),this.setText("".concat(this.timeSignature.denominator),1,{justification:1,shift_x:t,shift_y:r+8})}}},{key:"drawVertical",value:function(e,t){this.drawVerticalFixed(this.x+e,t)}},{key:"drawVerticalFixed",value:function(e,t){this.checkContext();var n=this.getYForLine(0),r=this.getYForLine(this.options.num_lines-1);t&&this.context.fillRect(e-3,n,1,r-n+1),this.context.fillRect(e,n,1,r-n+1)}},{key:"drawVerticalBar",value:function(e){this.drawVerticalBarFixed(this.x+e,!1)}},{key:"drawVerticalBarFixed",value:function(e){this.checkContext();var t=this.getYForLine(0),n=this.getYForLine(this.options.num_lines-1);this.context.fillRect(e,t,1,n-t+1)}},{key:"getConfigForLines",value:function(){return this.options.line_config}},{key:"setConfigForLine",value:function(e,t){if(e>=this.options.num_lines||e<0)throw new Vex.RERR("StaveConfigError","The line number must be within the range of the number of lines in the Stave.");if(void 0===t.visible)throw new Vex.RERR("StaveConfigError","The line configuration object is missing the 'visible' property.");if("boolean"!=typeof t.visible)throw new Vex.RERR("StaveConfigError","The line configuration objects 'visible' property must be true or false.");return this.options.line_config[e]=t,this}},{key:"setConfigForLines",value:function(e){if(e.length!==this.options.num_lines)throw new Vex.RERR("StaveConfigError","The length of the lines configuration array must match the number of lines in the Stave");for(var t in e)e[t]||(e[t]=this.options.line_config[t]),Vex.Merge(this.options.line_config[t],e[t]);return this.options.line_config=e,this}}],[{key:"saxophoneMap",value:function(e){var t={C:"bE","#C":"E","C#":"E",Db:"E",D:"F",Eb:"bG",E:"G",F:"bA","#F":"A","F#":"A",Gb:"A",G:"bB",Ab:"B",A:"C",Bb:"bD",B:"D"};return t[e]?t[e]:e}}]),n}(Element$1),_TabStave=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i,a){var o;_classCallCheck2(this,n);var s={spacing_between_lines_px:13,num_lines:6,top_text_position:1};return Vex.Merge(s,a),(o=t.call(this,e,r,i,s)).setAttribute("type","TabStave"),o}return _createClass2(n,[{key:"getYForGlyphs",value:function(){return this.getYForLine(2.5)}},{key:"addTabGlyph",value:function(){return this.addClef("tab"),this}}]),n}(_Stave2);function getUnusedStringGroups(e,t){for(var n=[],r=[],i=1;i<=e;i++){t.indexOf(i)>-1?(n.push(r),r=[]):r.push(i)}return r.length>0&&n.push(r),n}function getPartialStemLines(e,t,n,r){var i=1!==r,a=-1!==r,o=n.getSpacingBetweenLines(),s=n.getNumLines(),l=[];return t.forEach((function(t){var u=t.indexOf(s)>-1,c=t.indexOf(1)>-1;if(!(i&&c||a&&u)){1===t.length&&t.push(t[0]);var h=[];t.forEach((function(t,i,a){var l=1===t,u=t===s,c=n.getYForLine(t-1);0!==i||l?i!==a.length-1||u||(c+=o/2-1):c-=o/2-1,h.push(c),1===r&&l?h.push(e-2):-1===r&&u&&h.push(e+2)})),l.push(h.sort((function(e,t){return e-t})))}})),l}var TabNote$1=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i;if(_classCallCheck2(this,n),(i=t.call(this,e)).setAttribute("type","TabNote"),i.ghost=!1,i.positions=e.positions,Vex.Merge(i.render_options,{glyph_font_scale:Flow.DEFAULT_TABLATURE_FONT_SCALE,draw_stem:r,draw_dots:r,draw_stem_through_stave:!1,y_shift:0,scale:1,font:"10pt Arial"}),i.glyph=Flow.getGlyphProps(i.duration,i.noteType),!i.glyph)throw new Vex.RuntimeError("BadArguments","Invalid note initialization data (No glyph found): ".concat(JSON.stringify(e)));return i.buildStem(),e.stem_direction?i.setStemDirection(e.stem_direction):i.setStemDirection(Stem.UP),i.ghost=!1,i.updateWidth(),i}return _createClass2(n,[{key:"reset",value:function(){this.stave&&this.setStave(this.stave)}},{key:"getCategory",value:function(){return n.CATEGORY}},{key:"setGhost",value:function(e){return this.ghost=e,this.updateWidth(),this}},{key:"hasStem",value:function(){return this.render_options.draw_stem}},{key:"getStemExtension",value:function(){var e=this.getGlyph();return null!=this.stem_extension_override?this.stem_extension_override:e?1===this.getStemDirection()?e.tabnote_stem_up_extension:e.tabnote_stem_down_extension:0}},{key:"addDot",value:function(){var e=new Dot;return this.dots+=1,this.addModifier(e,0)}},{key:"updateWidth",value:function(){var e=this;this.glyphs=[],this.width=0;for(var t=0;tparseInt(o,10)?n.SLIDE_DOWN:n.SLIDE_UP}return i.slide_direction=r,i.render_options.cp1=11,i.render_options.cp2=14,i.render_options.y_shift=.5,i.setFont({font:"Times",size:10,style:"bold italic"}),i.setNotes(e),i}return _createClass2(n,[{key:"renderTie",value:function(e){if(0===e.first_ys.length||0===e.last_ys.length)throw new Vex.RERR("BadArguments","No Y-values to render");var t=this.context,r=e.first_x_px,i=e.first_ys,a=e.last_x_px,o=this.slide_direction;if(o!==n.SLIDE_UP&&o!==n.SLIDE_DOWN)throw new Vex.RERR("BadSlide","Invalid slide direction");for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:"E/5,B/4,G/4,D/4,A/3,E/3,B/2,E/2";_classCallCheck2(this,e),this.setTuning(t)}return _createClass2(e,[{key:"noteToInteger",value:function(e){return Flow.keyProperties(e).int_value}},{key:"setTuning",value:function(t){e.names[t]&&(t=e.names[t]),this.tuningString=t,this.tuningValues=[],this.numStrings=0;var n=t.split(/\s*,\s*/);if(0===n.length)throw new Vex.RERR("BadArguments","Invalid tuning string: "+t);this.numStrings=n.length;for(var r=0;rthis.numStrings)throw new Vex.RERR("BadArguments","String number must be between 1 and ".concat(this.numStrings,":").concat(e));return this.tuningValues[t-1]}},{key:"getValueForFret",value:function(e,t){var n=this.getValueForString(t),r=parseInt(e,10);if(r<0)throw new Vex.RERR("BadArguments","Fret number must be 0 or higher: "+e);return n+r}},{key:"getNoteForFret",value:function(e,t){var n=this.getValueForFret(e,t),r=Math.floor(n/12),i=n%12;return Flow.integerToNote(i)+"/"+r}}],[{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"}}}]),e}(),KeyManager=function(){function e(t){_classCallCheck2(this,e),this.music=new Music,this.setKey(t)}return _createClass2(e,[{key:"setKey",value:function(e){return this.key=e,this.reset(),this}},{key:"getKey",value:function(){return this.key}},{key:"reset",value:function(){if(this.keyParts=this.music.getKeyParts(this.key),this.keyString=this.keyParts.root,this.keyParts.accidental&&(this.keyString+=this.keyParts.accidental),!Music.scaleTypes[this.keyParts.type])throw new Vex.RERR("BadArguments","Unsupported key type: ".concat(this.key));this.scale=this.music.getScaleTones(this.music.getNoteValue(this.keyString),Music.scaleTypes[this.keyParts.type]),this.scaleMap={},this.scaleMapByValue={},this.originalScaleMapByValue={};for(var e=Music.root_indices[this.keyParts.root],t=0;ti.y;r.x+=a.getMetrics().modRightPx+s.padding_left,i.x-=o.getMetrics().modLeftPx+s.padding_right;var h=a.getGlyph().getWidth();a.getKeyProps()[n].displaced&&1===a.getStemDirection()&&(r.x+=h+s.padding_left),o.getKeyProps()[u].displaced&&-1===o.getStemDirection()&&(i.x-=h+s.padding_right),r.y+=c?-3:1,i.y+=c?2:0,drawArrowLine(t,r,i,e.render_options)})),t.restore();var l,u=t.measureText(this.text).width,c=s.text_justification,h=0;if(c===n.TextJustification.LEFT)h=r.x;else if(c===n.TextJustification.CENTER){h=(i.x-r.x)/2+r.x-u/2}else c===n.TextJustification.RIGHT&&(h=i.x-u);var d=s.text_position_vertical;return d===n.TextVerticalPosition.TOP?l=a.getStave().getYForTopText():d===n.TextVerticalPosition.BOTTOM&&(l=a.getStave().getYForBottomText(Flow.TEXT_HEIGHT_OFFSET_HACK)),t.save(),this.applyFontStyle(),t.fillText(this.text,h,l),t.restore(),this}}],[{key:"TextVerticalPosition",get:function(){return{TOP:1,BOTTOM:2}}},{key:"TextJustification",get:function(){return{LEFT:1,CENTER:2,RIGHT:3}}}]),n}(Element$1);function L$6(){for(var e=arguments.length,t=new Array(e),n=0;n3)throw new Vex.RERR("InvalidParameter","The style must be one found in PedalMarking.Styles");return this.style=e,this}},{key:"setLine",value:function(e){return this.line=e,this}},{key:"drawBracketed",value:function(){var e,t,r=this,i=this.context,a=!1,o=this;this.notes.forEach((function(s,l,u){a=!a;var c=0;if(c=s?s.getNoteHeadBeginX():r.endStave.end_x+r.endStaveAddedWidth,r.EndsStave)a?r.ChangeBegin&&(c=s.getAbsoluteX()):(c=s?r.ChangeEnd?s.getAbsoluteX():s.getStave().end_x+r.endStaveAddedWidth-o.render_options.text_margin_right:r.endStave.end_x+r.endStaveAddedWidth-o.render_options.text_margin_right,r.endMargin=-o.render_options.text_margin_right);else if(s)if(a)r.ChangeBegin&&(c=s.getAbsoluteX());else switch(o.style){case n.Styles.BRACKET_OPEN_END:case n.Styles.BRACKET_OPEN_BOTH:case n.Styles.MIXED_OPEN_END:c=s.getNoteHeadEndX();break;default:r.ChangeEnd?c=s.getAbsoluteX():(c=s.getNoteHeadBeginX()-o.render_options.text_margin_right,r.startMargin=-o.render_options.text_margin_right)}var h=r.endStave;s&&(h=s.getStave());var d=h.getYForBottomText(o.line+3);t&&t>d&&(d=t);var f=u[l+1]===s,p=u[l-1]===s,v=0;if(a)if(v=p?5:0,o.style!==n.Styles.MIXED&&o.style!==n.Styles.MIXED_OPEN_END||p)i.beginPath(),o.style===n.Styles.BRACKET_OPEN_BEGIN||o.style===n.Styles.BRACKET_OPEN_BOTH?i.moveTo(c+v,d):(r.ChangeBegin&&(c+=5),i.moveTo(c,d-o.render_options.bracket_height),r.ChangeBegin&&(c+=5),i.lineTo(c+v,d)),i.stroke(),i.closePath();else if(o.custom_depress_text){var m=i.measureText(o.custom_depress_text).width;i.fillText(o.custom_depress_text,c-m/2,d),v=m/2+o.render_options.text_margin_right}else drawPedalGlyph("pedal_depress",i,c,d,o.render_options.glyph_point_size),v=20+o.render_options.text_margin_right;else v=f&&!r.EndsStave?-5:0,i.beginPath(),i.moveTo(e,t),i.lineTo(c+v,d),o.style!==n.Styles.BRACKET_OPEN_END&&o.style!==n.Styles.MIXED_OPEN_END&&o.style!==n.Styles.BRACKET_OPEN_BOTH&&(r.ChangeEnd&&(c+=5),i.lineTo(c,d-o.render_options.bracket_height)),i.stroke(),i.closePath();e=c+v,t=d}))}},{key:"drawText",value:function(){var e=this.context,t=!1,n=this,r=n.render_options.glyph_point_size;this.notes.forEach((function(i){t=!t;var a=i.getStave(),o=i.getAbsoluteX(),s=a.getYForBottomText(n.line+3),l=0;t?n.custom_depress_text?(l=e.measureText(n.custom_depress_text).width,e.fillText(n.custom_depress_text,o-l/2,s)):drawPedalGlyph("pedal_depress",e,o,s,r):n.custom_release_text?(l=e.measureText(n.custom_release_text).width,e.fillText(n.custom_release_text,o-l/2,s)):drawPedalGlyph("pedal_release",e,o,s,r)}))}},{key:"draw",value:function(){var e=this.checkContext();this.setRendered(),e.save(),e.setStrokeStyle(this.render_options.color),e.setFillStyle(this.render_options.color),e.setFont(this.font.family,this.font.size,this.font.weight),L$6("Rendering Pedal Marking"),this.style===n.Styles.BRACKET||this.style===n.Styles.MIXED||this.style===n.Styles.MIXED_OPEN_END||this.style===n.Styles.BRACKET_OPEN_BEGIN||this.style===n.Styles.BRACKET_OPEN_END||this.style===n.Styles.BRACKET_OPEN_BOTH?(e.setLineWidth(this.render_options.bracket_line_width),this.drawBracketed()):this.style===n.Styles.TEXT&&this.drawText(),e.restore()}}],[{key:"GLYPHS",get:function(){return{pedal_depress:{code:"v36",x_shift:-10,y_shift:0},pedal_release:{code:"v5d",x_shift:-2,y_shift:3}}}},{key:"Styles",get:function(){return{TEXT:1,BRACKET:2,MIXED:3,MIXED_OPEN_END:4,BRACKET_OPEN_BEGIN:5,BRACKET_OPEN_END:6,BRACKET_OPEN_BOTH:7}}},{key:"StylesString",get:function(){return{text:n.Styles.TEXT,bracket:n.Styles.BRACKET,mixed:n.Styles.MIXED,mixed_open_end:n.Styles.MIXED_OPEN_END,bracket_open_begin:n.Styles.BRACKET_OPEN_BEGIN,bracket_open_end:n.Styles.BRACKET_OPEN_END,bracket_open_both:n.Styles.BRACKET_OPEN_BOTH}}},{key:"createSustain",value:function(e){return new n(e)}},{key:"createSostenuto",value:function(e){var t=new n(e);return t.setStyle(n.Styles.MIXED),t.setCustomText("Sost. Ped."),t}},{key:"createUnaCorda",value:function(e){var t=new n(e);return t.setStyle(n.Styles.TEXT),t.setCustomText("una corda","tre corda"),t}}]),n}(Element$1);function L$5(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:Barline.type.SINGLE;_classCallCheck2(this,n),(r=t.call(this,{duration:"b"})).setAttribute("type","BarNote"),r.metrics={widths:{}};var a=Barline.type;return r.metrics.widths=(_defineProperty2(e={},a.SINGLE,8),_defineProperty2(e,a.DOUBLE,12),_defineProperty2(e,a.END,15),_defineProperty2(e,a.REPEAT_BEGIN,14),_defineProperty2(e,a.REPEAT_END,14),_defineProperty2(e,a.REPEAT_BOTH,18),_defineProperty2(e,a.NONE,0),e),r.ignore_ticks=!0,r.setType(i),r}return _createClass2(n,[{key:"getType",value:function(){return this.type}},{key:"setType",value:function(e){return this.type="string"==typeof e?Barline.typeString[e]:e,this.setWidth(this.metrics.widths[this.type]),this}},{key:"getBoundingBox",value:function(){return _get(_getPrototypeOf2(n.prototype),"getBoundingBox",this).call(this)}},{key:"addToModifierContext",value:function(){return this}},{key:"preFormat",value:function(){return this.setPreFormatted(!0),this}},{key:"draw",value:function(){if(this.checkContext(),!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");L$4("Rendering bar line at: ",this.getAbsoluteX());var e=new Barline(this.type);e.setX(this.getAbsoluteX()),e.draw(this.stave),this.setRendered()}}]),n}(Note),_GhostNote=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e){var r,i;if(_classCallCheck2(this,n),!e)throw new Vex.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");if("string"==typeof e)i={duration:e};else{if("object"!==_typeof2(e))throw new Vex.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");i=e}return(r=t.call(this,i)).setAttribute("type","GhostNote"),r.setWidth(0),r}return _createClass2(n,[{key:"isRest",value:function(){return!0}},{key:"setStave",value:function(e){_get(_getPrototypeOf2(n.prototype),"setStave",this).call(this,e)}},{key:"addToModifierContext",value:function(){return this}},{key:"preFormat",value:function(){return this.setPreFormatted(!0),this}},{key:"draw",value:function(){if(!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");this.setRendered();for(var e=0;e1&&void 0!==arguments[1]&&arguments[1]?new RegExp("^(("+e+"))"):new RegExp("^(("+e+")\\s*)"),n=this.line.slice(this.pos).match(t);return null!==n?{success:!0,matchedString:n[2],incrementPos:n[1].length,pos:this.pos}:{success:!1,pos:this.pos}}},{key:"expectOne",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],r=this.pos,i=!0,a=!1;t=!0===t||!0===e.maybe;for(var o=0;o1&&void 0!==arguments[1]&&arguments[1],n=[],r=this.pos,i=0,a=!0;do{var o=this.expectOne(e);o.success?(i++,n.push(o.results)):a=!1}while(a);var s=i>0||!0===t;return!t||i>0||(this.pos=r),s?this.matchSuccess():this.matchFail(r),{success:s,results:n,numMatches:i}}},{key:"expectZeroOrMore",value:function(e){return this.expectOneOrMore(e,!0)}},{key:"expect",value:function(e){var t;if(L$2("Evaluating rules:",e),!e)throw new X$2("Invalid Rule: "+e,e);var n=e.bind(this.grammar)();if(n.token)(t=this.matchToken(n.token,!0===n.noSpace)).success&&(this.pos+=t.incrementPos);else{if(!n.expect)throw new X$2("Bad grammar! No `token` or `expect` property",n);t=n.oneOrMore?this.expectOneOrMore(n):n.zeroOrMore?this.expectZeroOrMore(n):this.expectOne(n)}return t.matches=[],t.results&&t.results.forEach((function(e){return t.matches.push(flattenMatches(e))})),n.run&&t.success&&n.run(t),t}}]),e}();function L$1(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.options={stem:"auto",clef:"treble"},this.elements={notes:[],accidentals:[]},this.rollingDuration="8",this.resetPiece(),Object.assign(this.options,e)}},{key:"getFactory",value:function(){return this.factory}},{key:"getElements",value:function(){return this.elements}},{key:"addCommitHook",value:function(e){this.commitHooks.push(e)}},{key:"resetPiece",value:function(){L$1("resetPiece"),this.piece={chord:[],duration:this.rollingDuration,dots:0,type:void 0,options:{}}}},{key:"setNoteDots",value:function(e){L$1("setNoteDots:",e),e&&(this.piece.dots=e.length)}},{key:"setNoteDuration",value:function(e){L$1("setNoteDuration:",e),this.rollingDuration=this.piece.duration=e||this.rollingDuration}},{key:"setNoteType",value:function(e){L$1("setNoteType:",e),e&&(this.piece.type=e)}},{key:"addNoteOption",value:function(e,t){L$1("addNoteOption: key:",e,"value:",t),this.piece.options[e]=t}},{key:"addNote",value:function(e,t,n){L$1("addNote:",e,t,n),this.piece.chord.push({key:e,accid:t,octave:n})}},{key:"addSingleNote",value:function(e,t,n){L$1("addSingleNote:",e,t,n),this.addNote(e,t,n)}},{key:"addChord",value:function(e){var t=this;L$1("startChord"),"object"!==_typeof2(e[0])?this.addSingleNote(e[0]):e.forEach((function(e){e&&t.addNote.apply(t,_toConsumableArray2(e))})),L$1("endChord")}},{key:"commitPiece",value:function(){var e=this;L$1("commitPiece");var t=this.factory;if(t){var n=_objectSpread(_objectSpread({},this.options),this.piece.options),r=n.stem,i=n.clef,a="auto"===r.toLowerCase(),o=a||"up"!==r.toLowerCase()?_StaveNote3.STEM_DOWN:_StaveNote3.STEM_UP,s=this.piece,l=s.chord,u=s.duration,c=s.dots,h=s.type,d=l.map((function(e){return e.key+"/"+e.octave})),f=t.StaveNote({keys:d,duration:u,dots:c,type:h,clef:i,auto_stem:a});a||f.setStemDirection(o);var p=l.map((function(e){return e.accid||null}));p.forEach((function(e,n){e&&f.addAccidental(n,t.Accidental({type:e}))}));for(var v=0;v0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck2(this,e),this.setOptions(t),this.defaults={clef:"treble",time:"4/4",stem:"auto"}}return _createClass2(e,[{key:"set",value:function(e){return Object.assign(this.defaults,e),this}},{key:"setOptions",value:function(e){var t=this;return this.options=_objectSpread({factory:null,builder:null,commitHooks:[setId,setClass,Articulation$1.easyScoreHook],throwOnError:!1},e),this.factory=this.options.factory,this.builder=this.options.builder||new Builder(this.factory),this.grammar=new Grammar(this.builder),this.parser=new Parser(this.grammar),this.options.commitHooks.forEach((function(e){return t.addCommitHook(e)})),this}},{key:"setContext",value:function(e){return this.factory&&this.factory.setContext(e),this}},{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.builder.reset(t);var n=this.parser.parse(e);if(!n.success&&this.options.throwOnError)throw new X$1("Error parsing line: "+e,n);return n}},{key:"beam",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.factory.Beam({notes:e,options:t}),e}},{key:"tuplet",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.factory.Tuplet({notes:e,options:t}),e}},{key:"notes",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t=_objectSpread({clef:this.defaults.clef,stem:this.defaults.stem},t),this.parse(e,t),this.builder.getElements().notes}},{key:"voice",value:function(e,t){return t=_objectSpread({time:this.defaults.time},t),this.factory.Voice(t).addTickables(e)}},{key:"addCommitHook",value:function(e){return this.builder.addCommitHook(e)}}]),e}();function initGroup(){return{notes:[],finish:!1,total:0,staveId:""}}var _text_width=null,tone="C",group=initGroup(),_denominator="",_numerator="",ornamentGroup="",_NumberedNote=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e){var r;_classCallCheck2(this,n),(r=t.call(this,e)).setAttribute("type","NumberedNote"),tone=e.keyString,r.ornament=!!e.ornament,r.line=0,r.keys=e.keys||[],r.fontSize=20,r.offset_x=0,r.offset_y=0,r.note_tones=[],r.duration_lines=0,r.long_duration_lines=0,r.note_size=e.note_size||16;var i=Flow.sanitizeDuration(r.duration),a=n.numberedDurationLine[i.toString()];if(a&&(r.duration_lines=a),(a=n.longDurationLine[i.toString()])&&(r.long_duration_lines=a),!_text_width){var o="__$text_wraper$$__",s=document.createElement("canvas");s.id=o,document.body.append(s);var l=document.getElementById(o),u=l.getContext("2d");u.font="Arial 22px";var c=u.measureText("5");_text_width=c.width+2,document.body.removeChild(l)}return r}return _createClass2(n,[{key:"getCategory",value:function(){return n.CATEGORY}},{key:"setKeySignature",value:function(e){this.keySignature=e}},{key:"preFormat",value:function(){this.preFormatted||(this.modifierContext&&this.modifierContext.preFormat(),this.setWidth(this.full_width),this.setPreFormatted(!0))}},{key:"filterNote",value:function(){if(!(window&&window.sett&&window.sett.keySignature)&&this.keys&&this.keys.length){var e=n.accidentalMap(tone);if(e){var t=n.noteLift;if(t){var r=this.keys[0].split("/")[0];"b"===r&&(r="R"),(r=(r=r.replace(new RegExp("#","g"),"")).replace(new RegExp("n","g"),"")).length>1&&(r=r.replace(new RegExp("b","g"),""));var i=NumberedNoteHead.numberedNotationMapping[r.toUpperCase()];if(t.includes(i))for(var a=0;a=_numerator&&(this.long_duration_lines=_numerator-1),8==_denominator)if(this.long_duration_lines=0,3==_numerator&&this.draw_dot(this.context,this.bottom_x+25,this.bottom_y-30,this.dot_width),6==_numerator)this.draw_dot(this.context,this.bottom_x+25,this.bottom_y-30,this.dot_width),new Glyph("v0",40).render(this.context,this.bottom_x+40,this.top_y),this.draw_dot(this.context,this.bottom_x+65,this.bottom_y-30,this.dot_width);return group=initGroup()}var i={lines:this.duration_lines,duration:r,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,y:this.y,width:this.full_width};r>2*e&&(this.long_duration_lines=parseInt(r/e)-1,this.handleDeleteDot()),ornamentGroup&&(i.x+=this.note_width),group.notes.push(i);var a=group.notes.reduce((function(e,t){return e+t.duration}),0);if((a=parseInt(a))>e&&(a-=e),a>e-10&&ar)i.push(s),a++;else{if(i.length>1){var l=i.length-1;n=i[0].y+this.duration_line_space,e.rect(i[0].x,n+3*r,i[l].x-i[0].x+i[l].width,.5)}i=[],a=o+1}}if(i.length>1){var u=i.length-1;n=i[0].y+this.duration_line_space,e.rect(i[0].x,n+3*r,i[u].x-i[0].x+i[u].width,.5)}}}},{key:"draw_dot",value:function(e,t,n,r){e.openGroup("numbered-note-dot"),e.beginPath(),e.arc(t,n,r,0,2*Math.PI),e.closePath(),e.fill(),e.closeGroup()}},{key:"drawDurationLine",value:function(e,t){var n,r,i=this.attrs.id+"-lines";if(e.openGroup("numbered_note_lines",i),this.duration_lines>0){var a=this.duration_line_space,o=this.full_width;if(t&&t.width&&(o=t.width),o<0&&(o=this.note_width),n=t&&void 0!==t.startX?t.startX:this.x-a/2-this.left_width,r=t&&void 0!==t.startY?t.startY:this.y+this.duration_line_space,group.finish&&(this.drawDurationLoneLine(e,r),group=initGroup()),this.ornament?(n+=12,r-=22,o=15,ornamentGroup&&(n-=10,o+=10)):ornamentGroup&&(n+=this.note_width,o-=this.note_width),o>0){for(var s=0;s-1?this.modifiers[a].accidental.code="#"===i?"v18":"v44":this.modifiers.splice(a,1)}}catch(o){console.log("🚀 ~ error",o)}}this.setYs(e)}},{key:"getFullWidth",value:function(){return this.full_width}},{key:"getFullHeight",value:function(){return this.full_height}},{key:"getLine",value:function(){return this.keyProps[0].line}},{key:"full_width",get:function(){return this.note_width+this.left_width+this.right_width+this.long_duration_line_width}},{key:"long_duration_line_width",get:function(){return(this.long_duration_width+this.long_duration_space)*this.long_duration_lines}},{key:"full_height",get:function(){return this.bottom_y-this.top_y}},{key:"note_width",get:function(){return this.note_size||0}},{key:"note_dot_width",get:function(){return 6}},{key:"note_height",get:function(){return this.unit_height}},{key:"unit_height",get:function(){return this.note_size||0}},{key:"note_x",get:function(){return this.x||0}},{key:"top_x",get:function(){return this.x||0}},{key:"top_y",get:function(){var e=this;return(this.y||0)-(e.note_tones.map((function(t){return(t.td+t.bd)*(e.dot_space+e.dot_width)})).reduce((function(e,t){return e+t}),0)+this.note_height*this.note_tones.length-this.unit_height-this.note_tones[0].bd*(e.dot_space+e.dot_width)+(this.note_tones.length-1)*this.head_space)}},{key:"bottom_x",get:function(){return this.x||0}},{key:"bottom_y",get:function(){return(this.y||0)+this.unit_height+this.duration_lines*(this.duration_line_height+this.duration_line_space)+this.note_tones[0].meta.bd*(this.dot_width+this.dot_space)}},{key:"left_width",get:function(){return this.modifiers_width}},{key:"right_width",get:function(){return this.full_duration_dot_width}},{key:"duration_dot_width",get:function(){return 6}},{key:"full_duration_dot_width",get:function(){return this.duration_dot_width*this.getModifiersByCategory(Dot.CATEGORY).length}},{key:"getModifiersByCategory",value:function(e){var t=[];return this.modifiers.forEach((function(n){n.getCategory()===e&&t.push(n)})),t}},{key:"head_space",get:function(){return 6}},{key:"duration_line_height",get:function(){return 2}},{key:"duration_line_space",get:function(){return 4}},{key:"dot_width",get:function(){return 2}},{key:"dot_space",get:function(){return 2}},{key:"long_duration_space",get:function(){return 10}},{key:"long_duration_width",get:function(){return 20}},{key:"getWidth",value:function(){return this.full_width}},{key:"modifiers_width",get:function(){var e=0;return this.modifiers.forEach((function(t){e+=t.getWidth()})),e}}],[{key:"CATEGORY",get:function(){return"numberednotes"}},{key:"accidentalAndKey",value:function(e){switch(e){case"G":return{4:"#"};case"D":return{1:"#",4:"#"};case"A":return{1:"#",4:"#",5:"#"};case"E":return{1:"#",2:"#",4:"#",5:"#"};case"B":return{1:"#",2:"#",4:"#",5:"#",6:"#"};case"F#":return{1:"#",2:"#",3:"#",4:"#",5:"#",6:"#"};case"C#":return{1:"#",2:"#",3:"#",4:"#",5:"#",6:"#",7:"#"};case"F":return{7:"b"};case"Bb":return{7:"b",3:"b"};case"Eb":return{7:"b",3:"b",6:"b"};case"Ab":return{7:"b",2:"b",3:"b",6:"b"};case"Db":return{7:"b",2:"b",3:"b",5:"b",6:"b"};case"Gb":return{7:"b",1:"b",2:"b",3:"b",5:"b",6:"b"};case"Cb":return{7:"b",1:"b",2:"b",3:"b",4:"b",5:"b",6:"b"};default:return{}}}},{key:"accidentalMap",value:function(e){switch(e){case"C":return"";case"F":case"Bb":case"Eb":case"Ab":case"Db":case"Gb":case"Cb":return{bb:"b",b:"",n:"#","#":"##"};default:return{b:"bb",n:"b","#":"","##":"#"}}}},{key:"noteLift",get:function(){switch(tone){case"G":return["7"];case"D":return["7","3"];case"A":return["7","3","6"];case"E":return["2","6","3","7"];case"B":return["5","2","6","3","7"];case"F#":return["1","5","2","6","3","7"];case"C#":return["4","1","5","2","6","3","7"];case"F":return["4"];case"Bb":return["1","4"];case"Eb":return["5","1","4"];case"Ab":return["2","5","1","4"];case"Db":return["6","2","5","1","4"];case"Gb":return["3","6","2","5","1","4"];case"Cb":return["7","3","6","2","5","1","4"]}}},{key:"longDurationLine",get:function(){return{1:3,2:1,6:2}}},{key:"numberedDurationLine",get:function(){return{8:1,16:2,32:3,64:4,128:5}}},{key:"durationTime",get:function(){return{8:6144,4:4096}}}]),n}(_StaveNote3),NumberedNoteHead=function(){function e(t){_classCallCheck2(this,e),this.key=t.key,this.x=t.x||0,this.y=t.y||0,this.idx=t.idx||0,this.note=t.note||0,this.meta=this.tone_to_numbered_key(),this.noteSize=t.noteSize||16,this.td=this.meta.td,this.bd=this.meta.bd}return _createClass2(e,[{key:"tone_to_numbered_key",value:function(){var t=this.key.split("/")[0];"b"===t&&(t="R"),(t=(t=t.replace(new RegExp("#","g"),"")).replace(new RegExp("n","g"),"")).length>1&&(t=t.replace(new RegExp("b","g"),""));var n=0,r=0;this.note.stave&&this.note.stave.options&&this.note.stave.options.keySignature&&(tone=this.note.stave.options.keySignature);var i=this.note.getLine();return ie.numberedNotationMapping.max&&(r=Math.ceil((i-e.numberedNotationMapping.max)/3.5)),"R"===t.toUpperCase()&&(n=0,r=0),{key:e.numberedNotationMapping[t.toUpperCase()],td:r,bd:n}}},{key:"draw",value:function(e){var t=this.y;e.openGroup("numbered-note-head");for(var n=this.x+(this.note.ornament?-2:0),r=t-this.note.unit_height-this.note.dot_space-(this.note.ornament?-4:2),i=0;i1&&(o-=this.note.duration_line_space),t+=o}this.draw_dot(e,n+_text_width,t,this.note.dot_width),t+=this.note.dot_width+this.note.dot_space}e.closeGroup()}},{key:"height",get:function(){return this.note.note_height+(this.meta.bd+this.meta.td)*(this.note.dot_width+this.note.dot_space)}},{key:"draw_dot",value:function(e,t,n,r){e.openGroup("numbered-note-dot"),e.beginPath(),e.arc(t,n,r,0,2*Math.PI),e.closePath(),e.fill(),e.closeGroup()}}],[{key:"numberedNotationMapping",get:function(){var e=tone;switch(window&&window.sett&&window.sett.keySignature&&(e="C"),e){case"A":return{C:"3",D:"4",E:"5",F:"6",G:"7",A:"1",B:"2",R:"0",min:2.5,max:5.5};case"B":case"Bb":case"A#":return{C:"2",D:"3",E:"4",F:"5",G:"6",A:"7",B:"1",R:"0",min:-.5,max:2.5};case"D":case"D#":case"Db":return{C:"7",D:"1",E:"2",F:"3",G:"4",A:"5",B:"6",R:"0",min:.5,max:3.5};case"E":case"Eb":return{C:"6",D:"7",E:"1",F:"2",G:"3",A:"4",B:"5",R:"0",min:1,max:4};case"F":case"F#":return{C:"5",D:"6",E:"7",F:"1",G:"2",A:"3",B:"4",R:"0",min:1.5,max:4.5};case"G":case"Gb":return{C:"4",D:"5",E:"6",F:"7",G:"1",A:"2",B:"3",R:"0",min:2,max:5};case"Ab":case"G#":return{C:"3",D:"4",E:"5",F:"6",G:"7",A:"1",B:"2",R:"0",min:-1,max:2};default:return{C:"1",D:"2",E:"3",F:"4",G:"5",A:"6",B:"7",R:"0",min:0,max:3}}}}]),e}();function L(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=t.options;return(e=Object.assign(t,e)).options=Object.assign(n,e.options),e}var Factory=function(){function e(t){_classCallCheck2(this,e),L("New factory: ",t);var n={stave:{space:10},renderer:{context:null,elementId:"",backend:Renderer.Backends.SVG,width:500,height:200,background:"#FFF"},font:{face:"Arial",point:10,style:""}};this.options=n,this.setOptions(t)}return _createClass2(e,[{key:"reset",value:function(){this.renderQ=[],this.systems=[],this.staves=[],this.voices=[],this.stave=null}},{key:"getOptions",value:function(){return this.options}},{key:"setOptions",value:function(e){for(var t=0,n=["stave","renderer","font"];t0&&void 0!==arguments[0]?arguments[0]:{};e.factory=this;var t=new System(e).setContext(this.context);return this.systems.push(t),t}))},{key:"EasyScore",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.factory=this,new _EasyScore(e)}},{key:"PedalMarking",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=setDefaults$1(e,{notes:[],options:{style:"mixed"}});var t=new _PedalMarking(e.notes);return t.setStyle(_PedalMarking.StylesString[e.options.style]),t.setContext(this.context),this.renderQ.push(t),t}},{key:"NoteSubGroup",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=setDefaults$1(e,{notes:[],options:{}});var t=new NoteSubGroup$1(e.notes);return t.setContext(this.context),t}},{key:"draw",value:function(){var e=this;this.systems.forEach((function(t){return t.setContext(e.context).format()})),this.staves.forEach((function(t){return t.setContext(e.context).draw()})),this.voices.forEach((function(t){return t.setContext(e.context).draw()})),this.renderQ.forEach((function(t){t.isRendered()||t.setContext(e.context).draw()})),this.systems.forEach((function(t){return t.setContext(e.context).draw()})),this.reset()}}],[{key:"newFromElementId",value:function(t){return new e({renderer:{elementId:t,width:arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,height:arguments.length>2&&void 0!==arguments[2]?arguments[2]:200}})}}]),e}();function setDefaults(e,t){var n=t.options;return(e=Object.assign(t,e)).options=Object.assign(n,e.options),e}var System=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck2(this,n),(e=t.call(this)).setAttribute("type","System"),e.setOptions(r),e.parts=[],e}return _createClass2(n,[{key:"setOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=setDefaults(e,{x:10,y:10,width:500,connector:null,spaceBetweenStaves:12,factory:null,debugFormatter:!1,formatIterations:0,options:{}}),this.factory=this.options.factory||new Factory({renderer:{el:null}})}},{key:"setContext",value:function(e){return _get(_getPrototypeOf2(n.prototype),"setContext",this).call(this,e),this.factory.setContext(e),this}},{key:"addConnector",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"double";return this.connector=this.factory.StaveConnector({top_stave:this.parts[0].stave,bottom_stave:this.parts[this.parts.length-1].stave,type:e}),this.connector}},{key:"addStave",value:function(e){var t=this;return(e=setDefaults(e,{stave:null,voices:[],spaceAbove:0,spaceBelow:0,debugNoteMetrics:!1,options:{left_bar:!1}})).stave||(e.stave=this.factory.Stave({x:this.options.x,y:this.options.y,width:this.options.width,options:e.options})),e.voices.forEach((function(n){return n.setContext(t.context).setStave(e.stave).getTickables().forEach((function(t){return t.setStave(e.stave)}))})),this.parts.push(e),e.stave}},{key:"format",value:function(){var e=this,t=new _Formatter;this.formatter=t;var n=this.options.y,r=0,i=[],a=[];this.parts.forEach((function(o){n+=o.stave.space(o.spaceAbove),o.stave.setY(n),t.joinVoices(o.voices),n+=o.stave.space(o.spaceBelow),n+=o.stave.space(e.options.spaceBetweenStaves),o.debugNoteMetrics&&(a.push({y:n,voice:o.voices[0]}),n+=15),i=i.concat(o.voices),r=Math.max(r,o.stave.getNoteStartX())})),this.parts.forEach((function(e){return e.stave.setNoteStartX(r)}));var o=this.options.width-(r-this.options.x)-Note.STAVEPADDING;t.format(i,o);for(var s=0;s1&&void 0!==arguments[1]?arguments[1]:7;_classCallCheck2(this,e),this.parentVoiceEntry=t,this.type=n,this.notes=[]}return _createClass2(e,[{key:"addNote",value:function(e){this.notes.push(e),e.Arpeggio=this}}]),e}(),ArpeggioType=function(e){return e[e.BRUSH_DOWN=1]="BRUSH_DOWN",e[e.BRUSH_UP=2]="BRUSH_UP",e[e.ROLL_DOWN=3]="ROLL_DOWN",e[e.ROLL_UP=4]="ROLL_UP",e[e.RASQUEDO_DOWN=5]="RASQUEDO_DOWN",e[e.RASQUEDO_UP=6]="RASQUEDO_UP",e[e.ARPEGGIO_DIRECTIONLESS=7]="ARPEGGIO_DIRECTIONLESS",e}(ArpeggioType||{}),Beam=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;_classCallCheck2(this,e),this.notes=[],this.extendedNoteList=[],this.BeamNumberOffsetToXML=0,this.BeamNumber=t,this.BeamNumberOffsetToXML=n}return _createClass2(e,[{key:"Notes",get:function(){return this.notes},set:function(e){this.notes=e}},{key:"ExtendedNoteList",get:function(){return this.extendedNoteList},set:function(e){this.extendedNoteList=e}},{key:"addNoteToBeam",value:function(e){e&&(e.NoteBeam=this,this.notes.push(e),this.extendedNoteList.push(e))}}]),e}(),Voice=function(){function e(t,n){_classCallCheck2(this,e),this.voiceEntries=[],this.volume=1,this.parent=t,this.visible=!0,this.audible=!0,this.following=!0,this.voiceId=n,this.uniqueVoiceId="I:"+this.parent.Id+" V: "+this.voiceId}return _createClass2(e,[{key:"VoiceEntries",get:function(){return this.voiceEntries}},{key:"Parent",get:function(){return this.parent}},{key:"Visible",get:function(){return this.visible},set:function(e){this.visible=e}},{key:"Audible",get:function(){return this.audible},set:function(e){this.audible=e}},{key:"Following",get:function(){return this.following},set:function(e){this.following=e}},{key:"Solo",get:function(){return this.solo},set:function(e){this.solo=e}},{key:"VoiceId",get:function(){return this.voiceId}},{key:"Volume",get:function(){return this.volume},set:function(e){this.volume=e}},{key:"toString",value:function(){return this.uniqueVoiceId}}]),e}(),LinkedVoice=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i){var a;return _classCallCheck2(this,n),(a=t.call(this,e,r)).master=i,a}return _createClass2(n,[{key:"Master",get:function(){return this.master}}]),n}(Voice),Notehead=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;_classCallCheck2(this,e),this.sourceNote=t,this.setShapeFromXml(n,r)}return _createClass2(e,[{key:"setShapeFromXml",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;this.shape=e.ShapeTypeXmlToShape(t);var r=n;void 0===r&&(this.sourceNote?r=this.sourceNote.Length.Denominator>2:(loglevelExports.warn("notehead: sourceNote and filledXmlAttribute undefined."),r=!0)),this.filled=r}},{key:"SourceNote",get:function(){return this.sourceNote}},{key:"Shape",get:function(){return this.shape}},{key:"Filled",get:function(){return this.filled}}],[{key:"ShapeTypeXmlToShape",value:function(e){switch(e.toLowerCase()){case"normal":return 2;case"x":return 7;case"slash":return 4;case"diamond":return 1;case"square":case"la":return 5;case"do":case"triangle":return 6;case"rectangle":return 3;case"circle-x":return 0;default:return loglevelExports.info("unsupported/unhandled xml notehead '"+e+"'. Using normal notehead."),2}}}]),e}(),NoteHeadShape=function(e){return e[e.CIRCLEX=0]="CIRCLEX",e[e.DIAMOND=1]="DIAMOND",e[e.NORMAL=2]="NORMAL",e[e.RECTANGLE=3]="RECTANGLE",e[e.SLASH=4]="SLASH",e[e.SQUARE=5]="SQUARE",e[e.TRIANGLE=6]="TRIANGLE",e[e.X=7]="X",e}(NoteHeadShape||{}),ITextTranslation=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,null,[{key:"translateText",value:function(e,t){if(!this.defaultTextTranslation)return t}}]),e}(),NoteType=function(e){return e[e.UNDEFINED=0]="UNDEFINED",e[e._1024th=1]="_1024th",e[e._512th=2]="_512th",e[e._256th=3]="_256th",e[e._128th=4]="_128th",e[e._64th=5]="_64th",e[e._32nd=6]="_32nd",e[e._16th=7]="_16th",e[e.EIGTH=8]="EIGTH",e[e.QUARTER=9]="QUARTER",e[e.HALF=10]="HALF",e[e.WHOLE=11]="WHOLE",e[e.BREVE=12]="BREVE",e[e.LONG=13]="LONG",e[e.MAXIMA=14]="MAXIMA",e}(NoteType||{}),NoteTypeHandler=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,null,[{key:"NoteTypeToString",value:function(e){return this.NoteTypeXmlValues[e]}},{key:"StringToNoteType",value:function(e){var t=this.NoteTypeXmlValues.indexOf(e);return-1!==t?t:0}},{key:"getNoteDurationFromType",value:function(e){switch(e){case"1024th":return new Fraction$1(1,1024);case"512th":return new Fraction$1(1,512);case"256th":return new Fraction$1(1,256);case"128th":return new Fraction$1(1,128);case"64th":return new Fraction$1(1,64);case"32th":case"32nd":return new Fraction$1(1,32);case"16th":return new Fraction$1(1,16);case"eighth":return new Fraction$1(1,8);case"quarter":return new Fraction$1(1,4);case"half":return new Fraction$1(1,2);case"whole":return new Fraction$1(1,1);case"breve":return new Fraction$1(2,1);case"long":return new Fraction$1(4,1);case"maxima":return new Fraction$1(8,1);default:var t=ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid note duration.");throw new MusicSheetReadingException(t)}}}]),e}();NoteTypeHandler.NoteTypeXmlValues=["","1024th","512th","256th","128th","64th","32nd","16th","eigth","quarter","half","whole","breve","long","maxima"];var OrnamentContainer=function(){function e(t){_classCallCheck2(this,e),this.placement=PlacementEnum.Above,this.accidentalAbove=AccidentalEnum.NONE,this.accidentalBelow=AccidentalEnum.NONE,this.ornament=t}return _createClass2(e,[{key:"GetOrnament",get:function(){return this.ornament}},{key:"AccidentalAbove",get:function(){return this.accidentalAbove},set:function(e){this.accidentalAbove=e}},{key:"AccidentalBelow",get:function(){return this.accidentalBelow},set:function(e){this.accidentalBelow=e}}]),e}(),OrnamentEnum=function(e){return e[e.Trill=0]="Trill",e[e.Turn=1]="Turn",e[e.InvertedTurn=2]="InvertedTurn",e[e.DelayedTurn=3]="DelayedTurn",e[e.DelayedInvertedTurn=4]="DelayedInvertedTurn",e[e.Mordent=5]="Mordent",e[e.InvertedMordent=6]="InvertedMordent",e}(OrnamentEnum||{}),VerticalSourceStaffEntryContainer=function(){function e(t,n,r){_classCallCheck2(this,e),this.staffEntries=[],this.comments=[],this.timestamp=n,this.staffEntries=new Array(r),this.parentMeasure=t}return _createClass2(e,[{key:"$get$",value:function(e){return this.staffEntries[e]}},{key:"$set$",value:function(e,t){this.staffEntries[e]=t}},{key:"Timestamp",get:function(){return this.timestamp},set:function(e){this.timestamp=e}},{key:"StaffEntries",get:function(){return this.staffEntries},set:function(e){this.staffEntries=e}},{key:"Comments",get:function(){return this.comments},set:function(e){this.comments=e}},{key:"ParentMeasure",get:function(){return this.parentMeasure},set:function(e){this.parentMeasure=e}},{key:"getAbsoluteTimestamp",value:function(){return Fraction$1.plus(this.timestamp,this.parentMeasure.AbsoluteTimestamp)}}]),e}(),SourceStaffEntry=function(){function e(t,n){_classCallCheck2(this,e),this.voiceEntries=[],this.instructions=[],this.chordSymbolContainers=[],this.verticalContainerParent=t,this.parentStaff=n}return _createClass2(e,[{key:"ParentStaff",get:function(){return this.parentStaff}},{key:"VerticalContainerParent",get:function(){return this.verticalContainerParent}},{key:"Timestamp",get:function(){if(this.VerticalContainerParent)return this.VerticalContainerParent.Timestamp}},{key:"AbsoluteTimestamp",get:function(){if(this.VerticalContainerParent)return Fraction$1.plus(this.VerticalContainerParent.ParentMeasure.AbsoluteTimestamp,this.VerticalContainerParent.Timestamp)}},{key:"VoiceEntries",get:function(){return this.voiceEntries},set:function(e){this.voiceEntries=e}},{key:"Link",get:function(){return this.staffEntryLink},set:function(e){this.staffEntryLink=e}},{key:"Instructions",get:function(){return this.instructions},set:function(e){this.instructions=e}},{key:"ChordContainers",get:function(){return this.chordSymbolContainers},set:function(e){this.chordSymbolContainers=e}},{key:"removeAllInstructionsOfTypeClefInstruction",value:function(){for(var e=0,t=0;e0)return!0}return!1}},{key:"hasTie",value:function(){for(var e=0,t=this.VoiceEntries.length;et.parentRepetition.StartIndex)return-1}if(0===e.alignment&&0===t.alignment){if(e.parentRepetition.EndIndext.parentRepetition.EndIndex)return-1}}return 0}}]),e}(),RepetitionInstruction=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;_classCallCheck2(this,e),this.endingIndices=void 0,this.measureIndex=t,a&&(this.endingIndices=a.slice()),this.type=n,this.alignment=r,this.parentRepetition=i}return _createClass2(e,[{key:"CompareTo",value:function(e){var t=e;if(this.measureIndex>t.measureIndex)return 1;if(this.measureIndex1)return e[this.measureListIndex-1]}},{key:"Rules",get:function(){return this.rules}},{key:"VerticalMeasureList",get:function(){return this.verticalMeasureList},set:function(e){this.verticalMeasureList=e}},{key:"TempoInBPM",get:function(){return this.tempoInBPM},set:function(e){this.tempoInBPM=e}},{key:"findOrCreateStaffEntry",value:function(e,t,n){var r,i,a=void 0,o=_createForOfIteratorHelper(this.verticalSourceStaffEntryContainers);try{for(o.s();!(i=o.n()).done;){var s=i.value;if(s.Timestamp.Equals(e)){r=s;break}}}catch(err){o.e(err)}finally{o.f()}if(r)return r.StaffEntries[t]?a=r.StaffEntries[t]:(a=new SourceStaffEntry(r,n),r.StaffEntries[t]=a),{createdNewContainer:!1,staffEntry:a};var l=this.verticalSourceStaffEntryContainers[this.verticalSourceStaffEntryContainers.length-1];if(0===this.verticalSourceStaffEntryContainers.length||l.Timestamp.lt(e)){var u=new VerticalSourceStaffEntryContainer(this,e.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.push(u),a=new SourceStaffEntry(u,n),u.StaffEntries[t]=a}else for(var c=this.verticalSourceStaffEntryContainers.length-1;c>=0;c--){if(this.verticalSourceStaffEntryContainers[c].Timestamp.lt(e)){var h=new VerticalSourceStaffEntryContainer(this,e.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(c+1,0,h),a=new SourceStaffEntry(h,n),h.StaffEntries[t]=a;break}if(0===c){var d=new VerticalSourceStaffEntryContainer(this,e.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(c,0,d),a=new SourceStaffEntry(d,n),d.StaffEntries[t]=a;break}}return{createdNewContainer:!0,staffEntry:a}}},{key:"findOrCreateVoiceEntry",value:function(e,t){var n,r=void 0,i=!1,a=_createForOfIteratorHelper(e.VoiceEntries);try{for(a.s();!(n=a.n()).done;){var o=n.value;if(o.ParentVoice===t){r=o;break}}}catch(err){a.e(err)}finally{a.f()}return r||(r=new VoiceEntry(e.Timestamp,t,e),i=!0),{createdVoiceEntry:i,voiceEntry:r}}},{key:"getPreviousSourceStaffEntryFromIndex",value:function(e,t){for(var n=t-1;n>=0;n--)if(this.verticalSourceStaffEntryContainers[n][e])return this.verticalSourceStaffEntryContainers[n][e]}},{key:"getVerticalContainerIndexByTimestamp",value:function(e){for(var t=0,n=this.VerticalSourceStaffEntryContainers.length;t=0;u--){var c=this.verticalSourceStaffEntryContainers[u][o+s];if(void 0!==c&&c.hasTie()&&a.lt(Fraction$1.plus(c.Timestamp,c.calculateMaxNoteLength()))){a=Fraction$1.plus(c.Timestamp,c.calculateMaxNoteLength());break}}}r.push(a)}for(var h=0,d=r.length;h0)return!0}return!1}},{key:"beginsWithLineRepetition",value:function(){for(var e=0,t=this.FirstRepetitionInstructions.length;e=0&&!(t=this.verticalSourceStaffEntryContainers[n].StaffEntries[e]);n--);return t}},{key:"canBeReducedToMultiRest",value:function(){var e,t,n,r,i,a,o,s,l,u=!0,c=!1,h=_createForOfIteratorHelper(this.verticalSourceStaffEntryContainers);try{for(h.s();!(l=h.n()).done;){var d=l.value;if(d){var f,p=_createForOfIteratorHelper(d.StaffEntries);try{for(p.s();!(f=p.n()).done;){var v=f.value;if(v&&v.ParentStaff.ParentInstrument.Visible){if(v.ChordContainers.length>0)return!1;if(v.ParentStaff.hasLyrics&&(c=!0),this.firstRepetitionInstructions.length>0||this.lastRepetitionInstructions.length>0)return!1;var m,g=_createForOfIteratorHelper(v.VoiceEntries);try{for(g.s();!(m=g.n()).done;){var y,b=_createForOfIteratorHelper(m.value.Notes);try{for(b.s();!(y=b.n()).done;){if(!y.value.isRest()){u=!1;break}}}catch(err){b.e(err)}finally{b.f()}if(!u)break}}catch(err){g.e(err)}finally{g.f()}}}}catch(err){p.e(err)}finally{p.f()}}}}catch(err){h.e(err)}finally{h.f()}if(!u||c||this.hasMoodExpressions||this.tempoExpressions.length>0)return!1;var A,S=_createForOfIteratorHelper(this.staffLinkedExpressions);try{for(S.s();!(A=S.n()).done;){if(A.value.length>0)return!1}}catch(err){S.e(err)}finally{S.f()}var x,w=_createForOfIteratorHelper(this.lastInstructionsStaffEntries);try{for(w.s();!(x=w.n()).done;)for(var _=x.value,E=0,k=null==_?void 0:_.Instructions.length;E1&&void 0!==arguments[1]&&arguments[1];_classCallCheck2(this,e),this.PlacementFromXml=!1,this.notes=[],this.fractions=[],this.tupletLabelNumber=t,this.bracket=n}return _createClass2(e,[{key:"TupletLabelNumber",get:function(){return this.tupletLabelNumber},set:function(e){this.tupletLabelNumber=e}},{key:"Notes",get:function(){return this.notes},set:function(e){this.notes=e}},{key:"Fractions",get:function(){return this.fractions},set:function(e){this.fractions=e}},{key:"Bracket",get:function(){return this.bracket},set:function(e){this.bracket=e}},{key:"getNoteIndex",value:function(e){for(var t=this.notes.length-1;t>=0;t--)for(var n=0;n0)return this.Notes[0].Length},set:function(e){var t,n=_createForOfIteratorHelper(this.Notes);try{for(n.s();!(t=n.n()).done;){t.value.Length=e}}catch(err){n.e(err)}finally{n.f()}}},{key:"HasNotes",get:function(){return this.Notes.length>0}}]),e}(),VoiceEntry=function(){function e(t,n,r){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(_classCallCheck2(this,e),this.notes=[],this.graceVoiceEntriesBefore=[],this.graceVoiceEntriesAfter=[],this.articulations=[],this.playbackEntries=[],this.technicalInstructions=[],this.lyricsEntries=new Dictionary,this.wantedStemDirection=-1,this.stemDirectionXml=-1,this.stemDirection=-1,this.timestamp=t,this.parentVoice=n,this.parentSourceStaffEntry=r,this.isGrace=a,this.graceAfterMainNote=!1,this.graceNoteSlash=o,this.graceSlur=s,a||n.VoiceEntries.push(this),i&&void 0!==r){var l=r.VoiceEntries;-1===l.indexOf(this)&&l.push(this)}this.mainPlaybackEntry=new PlaybackEntry(this),this.PlaybackEntries.push(this.mainPlaybackEntry)}return _createClass2(e,[{key:"ParentSourceStaffEntry",get:function(){return this.parentSourceStaffEntry}},{key:"ParentVoice",get:function(){return this.parentVoice}},{key:"Timestamp",get:function(){return this.timestamp},set:function(e){this.timestamp=e}},{key:"Notes",get:function(){return this.notes}},{key:"addNote",value:function(e){this.notes.push(e),e.isRest()||void 0!==e.NoteTie&&e.NoteTie.StartNote!==e||this.MainPlaybackEntry.Notes.push(new PlaybackNote(this.MainPlaybackEntry,e))}},{key:"GraceVoiceEntriesBefore",get:function(){return this.graceVoiceEntriesBefore},set:function(e){this.graceVoiceEntriesBefore=e;var t,n=_createForOfIteratorHelper(this.graceVoiceEntriesBefore);try{for(n.s();!(t=n.n()).done;){t.value.parentSourceStaffEntry=this.ParentSourceStaffEntry}}catch(err){n.e(err)}finally{n.f()}}},{key:"GraceVoiceEntriesAfter",get:function(){return this.graceVoiceEntriesAfter},set:function(e){this.graceVoiceEntriesAfter=e;var t,n=_createForOfIteratorHelper(this.graceVoiceEntriesAfter);try{for(n.s();!(t=n.n()).done;){t.value.parentSourceStaffEntry=this.ParentSourceStaffEntry}}catch(err){n.e(err)}finally{n.f()}}},{key:"IsGrace",get:function(){return this.isGrace},set:function(e){this.isGrace=e}},{key:"GraceAfterMainNote",get:function(){return this.graceAfterMainNote},set:function(e){this.graceAfterMainNote=e}},{key:"GraceNoteSlash",get:function(){return this.graceNoteSlash},set:function(e){this.graceNoteSlash=e}},{key:"GraceSlur",get:function(){return this.graceSlur},set:function(e){this.graceSlur=e}},{key:"Articulations",get:function(){return this.articulations}},{key:"PlaybackEntries",get:function(){return this.playbackEntries}},{key:"Fermata",get:function(){return this.fermata}},{key:"MainPlaybackEntry",get:function(){return this.mainPlaybackEntry},set:function(e){this.mainPlaybackEntry=e}},{key:"removeMainPlaybackEntry",value:function(){void 0!==this.mainPlaybackEntry&&this.removePlaybackEntry(this.mainPlaybackEntry)}},{key:"removePlaybackEntry",value:function(e){this.mainPlaybackEntry===e&&(this.mainPlaybackEntry=void 0);var t=this.playbackEntries.indexOf(e);t>-1&&this.playbackEntries.splice(t,1)}},{key:"TechnicalInstructions",get:function(){return this.technicalInstructions}},{key:"LyricsEntries",get:function(){return this.lyricsEntries}},{key:"Arpeggio",get:function(){return this.arpeggio},set:function(e){this.arpeggio=e}},{key:"OrnamentContainer",get:function(){return this.ornamentContainer},set:function(e){this.ornamentContainer=e}},{key:"WantedStemDirection",get:function(){return this.wantedStemDirection},set:function(e){this.wantedStemDirection=e}},{key:"StemDirectionXml",get:function(){return this.stemDirectionXml},set:function(e){this.stemDirectionXml=e}},{key:"StemDirection",get:function(){return this.stemDirection},set:function(e){this.stemDirection=e}},{key:"StemColorXml",get:function(){return this.stemColorXml},set:function(e){this.stemColorXml=e}},{key:"StemColor",get:function(){return this.stemColor},set:function(e){this.stemColor=e}},{key:"VolumeModifier",get:function(){return this.volumeModifier},set:function(e){this.volumeModifier=e}},{key:"DurationModifier",get:function(){return this.durationModifier},set:function(e){this.durationModifier=e}},{key:"hasArticulation",value:function(e){var t,n=_createForOfIteratorHelper(this.articulations);try{for(n.s();!(t=n.n()).done;){if(t.value.Equals(e))return!0}}catch(err){n.e(err)}finally{n.f()}return!1}},{key:"hasTie",value:function(){for(var e=0,t=this.Notes.length;e0)return!0}return!1}},{key:"isStaccato",value:function(){var e,t=_createForOfIteratorHelper(this.Articulations);try{for(t.s();!(e=t.n()).done;){if(5===e.value.articulationEnum)return!0}}catch(err){t.e(err)}finally{t.f()}return!1}},{key:"isAccent",value:function(){var e,t=_createForOfIteratorHelper(this.Articulations);try{for(t.s();!(e=t.n()).done;){var n=e.value;if(0===n.articulationEnum||1===n.articulationEnum)return!0}}catch(err){t.e(err)}finally{t.f()}return!1}},{key:"getVerseNumberForLyricEntry",value:function(e){var t=1;return this.lyricsEntries.forEach((function(n,r){e===r&&(t=n)})),t}}],[{key:"isSupportedArticulation",value:function(e){switch(e){case 0:case 1:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 26:case 24:return!0;default:return!1}}}]),e}(),ArticulationEnum=function(e){return e[e.accent=0]="accent",e[e.strongaccent=1]="strongaccent",e[e.marcatoup=2]="marcatoup",e[e.marcatodown=3]="marcatodown",e[e.invertedstrongaccent=4]="invertedstrongaccent",e[e.staccato=5]="staccato",e[e.staccatissimo=6]="staccatissimo",e[e.spiccato=7]="spiccato",e[e.tenuto=8]="tenuto",e[e.fermata=9]="fermata",e[e.invertedfermata=10]="invertedfermata",e[e.breathmark=11]="breathmark",e[e.caesura=12]="caesura",e[e.lefthandpizzicato=13]="lefthandpizzicato",e[e.naturalharmonic=14]="naturalharmonic",e[e.snappizzicato=15]="snappizzicato",e[e.upbow=16]="upbow",e[e.downbow=17]="downbow",e[e.scoop=18]="scoop",e[e.plop=19]="plop",e[e.doit=20]="doit",e[e.falloff=21]="falloff",e[e.stress=22]="stress",e[e.unstress=23]="unstress",e[e.detachedlegato=24]="detachedlegato",e[e.otherarticulation=25]="otherarticulation",e[e.bend=26]="bend",e}(ArticulationEnum||{}),StemDirectionType=function(e){return e[e.Undefined=-1]="Undefined",e[e.Up=0]="Up",e[e.Down=1]="Down",e[e.None=2]="None",e[e.Double=3]="Double",e}(StemDirectionType||{}),SystemLinePosition=function(e){return e[e.MeasureBegin=0]="MeasureBegin",e[e.MeasureEnd=1]="MeasureEnd",e}(SystemLinePosition||{}),GraphicalLabel=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i,a){var o,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;return _classCallCheck2(this,n),(o=t.call(this)).label=e,o.boundingBox=new BoundingBox$1(_assertThisInitialized2(o),s),o.label.fontHeight=r,o.label.textAlignment=i,o.rules=a,o.rules.MpatMode&&"TRIO"===o.label.text&&(o.label.fontFamily="Arial"),o}return _createClass2(n,[{key:"Label",get:function(){return this.label}},{key:"toString",value:function(){return"".concat(this.label.text," (").concat(this.boundingBox.RelativePosition.x,",").concat(this.boundingBox.RelativePosition.y,")")}},{key:"setLabelPositionAndShapeBorders",value:function(){var e,t;if(""!==this.Label.text.trim()){this.TextLines=[];for(var n=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),i=r.length,a=0,o=0;o0&&this.TextLines.length>1&&(p+=this.rules.SpacingBetweenTextLines*i/10);var v=this.PositionAndShape;switch(this.Label.textAlignment){case TextAlignmentEnum.CenterBottom:v.BorderTop=-p,v.BorderLeft=-a/2,v.BorderBottom=0,v.BorderRight=a/2;break;case TextAlignmentEnum.CenterCenter:v.BorderTop=-p/2,v.BorderLeft=-a/2,v.BorderBottom=p/2,v.BorderRight=a/2;break;case TextAlignmentEnum.CenterTop:v.BorderTop=0,v.BorderLeft=-a/2,v.BorderBottom=p,v.BorderRight=a/2;break;case TextAlignmentEnum.LeftBottom:v.BorderTop=-p,v.BorderLeft=0,v.BorderBottom=0,v.BorderRight=a;break;case TextAlignmentEnum.LeftCenter:v.BorderTop=-p/2,v.BorderLeft=0,v.BorderBottom=p/2,v.BorderRight=a;break;case TextAlignmentEnum.LeftTop:v.BorderTop=0,v.BorderLeft=0,v.BorderBottom=p,v.BorderRight=a;break;case TextAlignmentEnum.RightBottom:v.BorderTop=-p,v.BorderLeft=-a,v.BorderBottom=0,v.BorderRight=0;break;case TextAlignmentEnum.RightCenter:v.BorderTop=-p/2,v.BorderLeft=-a,v.BorderBottom=p/2,v.BorderRight=0;break;case TextAlignmentEnum.RightTop:v.BorderTop=0,v.BorderLeft=-a,v.BorderBottom=p,v.BorderRight=0}v.BorderMarginTop=v.BorderTop-p*n,v.BorderMarginLeft=v.BorderLeft-p*n,v.BorderMarginBottom=v.BorderBottom+p*n,v.BorderMarginRight=v.BorderRight+p*n}}}]),n}(Clickable),Label=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:TextAlignmentEnum.CenterBottom,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];_classCallCheck2(this,e),this.IsCreditLabel=!1,this.text=t,this.print=i,this.textAlignment=n,this.font=r,this.fontFamily=void 0}return _createClass2(e,[{key:"font",get:function(){return this.fontEnumValue},set:function(e){this.fontEnumValue=e,this.fontFamily=FontStringNames[e]}},{key:"ToString",value:function(){return this.text}}]),e}(),SpeedTag={Grava:40,Largo:46,Lento:52,Adagio:56,Larghetto:60,Andante:66,Anderato:69,Andantino:69,Moderato:88,Allegretto:108,"Allegro Moderato":108,Allegro:132,Vivace:152,Vivo:160,Vivacissimo:168,Presto:184,Prestissimo:208},SpecialMarks=["纯律","纯律结束"],HideWords=["跳过下一个","b","#","§","º","X"],GradientWords=["poco rit.","rall.","rit.","accel.","molto rit.","molto rall","lentando","poco accel.","calando"],GRADIENT_SPEED_CLOSE_TAG="结束范围速度",GRADIENT_SPEED_RESET_TAG="a tempo",SpecialWords=[GRADIENT_SPEED_CLOSE_TAG],SpeedKeyword="速度 ",SpeedHiddenKeyword="仅文本速度 ";function isSpeedKeyword(e){return 0===e.indexOf(SpeedKeyword)}function isSpeedHiddenKeyword(e){return 0===e.indexOf(SpeedHiddenKeyword)}function formatSpeedKeyword(e){return e.replace(SpeedHiddenKeyword,"").replace(SpeedKeyword,"")}function isGradientWords(e){return GradientWords.includes(e)}function isSpecialMark(e){return[].concat(_toConsumableArray2(Object.keys(SpeedTag)),SpecialMarks,SpecialWords,HideWords).map((function(e){return e.trim().toLocaleUpperCase()})).includes(e.toLocaleUpperCase().trim())}function isTopFont(e){return[TextAlignmentEnum.CenterTop,TextAlignmentEnum.RightTop].includes(e)}var MusicSymbol=function(e){return e[e.Unused_first_Symbol=0]="Unused_first_Symbol",e[e.BLACK_HEAD=1]="BLACK_HEAD",e[e.UPWARDS_TAIL=2]="UPWARDS_TAIL",e[e.DOWNWARDS_TAIL=3]="DOWNWARDS_TAIL",e[e.UPWARDS_DOUBLE_TAIL=4]="UPWARDS_DOUBLE_TAIL",e[e.DOWNWARDS_DOUBLE_TAIL=5]="DOWNWARDS_DOUBLE_TAIL",e[e.UPWARDS_TRIPLE_TAIL=6]="UPWARDS_TRIPLE_TAIL",e[e.DOWNWARDS_TRIPLE_TAIL=7]="DOWNWARDS_TRIPLE_TAIL",e[e.UPWARDS_QUAD_TAIL=8]="UPWARDS_QUAD_TAIL",e[e.DOWNWARDS_QUAD_TAIL=9]="DOWNWARDS_QUAD_TAIL",e[e.ROUND_HEAD=10]="ROUND_HEAD",e[e.WHITE_HEAD=11]="WHITE_HEAD",e[e.G_CLEF=12]="G_CLEF",e[e.F_CLEF=13]="F_CLEF",e[e.C_CLEF=14]="C_CLEF",e[e.BREVE=15]="BREVE",e[e.BREVE_REST=16]="BREVE_REST",e[e.COMMON_TIME=17]="COMMON_TIME",e[e.CUT_TIME=18]="CUT_TIME",e[e.WHOLE_REST=19]="WHOLE_REST",e[e.HALF_REST=20]="HALF_REST",e[e.QUARTER_REST=21]="QUARTER_REST",e[e.EIGHTH_REST=22]="EIGHTH_REST",e[e.SIXTEENTH_REST=23]="SIXTEENTH_REST",e[e.THIRTYSECOND_REST=24]="THIRTYSECOND_REST",e[e.SIXTYFOURTH_REST=25]="SIXTYFOURTH_REST",e[e.FLAT=26]="FLAT",e[e.SHARP=27]="SHARP",e[e.NATURAL=28]="NATURAL",e[e.DOUBLE_FLAT=29]="DOUBLE_FLAT",e[e.DOUBLE_SHARP=30]="DOUBLE_SHARP",e[e.ZERO=31]="ZERO",e[e.ONE=32]="ONE",e[e.TWO=33]="TWO",e[e.THREE=34]="THREE",e[e.FOUR=35]="FOUR",e[e.FIVE=36]="FIVE",e[e.SIX=37]="SIX",e[e.SEVEN=38]="SEVEN",e[e.EIGHT=39]="EIGHT",e[e.NINE=40]="NINE",e[e.DOT=41]="DOT",e[e.FERMATA=42]="FERMATA",e[e.INVERTED_FERMATA=43]="INVERTED_FERMATA",e[e.SPICCATO=44]="SPICCATO",e[e.TENUTO=45]="TENUTO",e[e.MARCATO=46]="MARCATO",e[e.MARCATISSIMO=47]="MARCATISSIMO",e[e.INVERTED_MARCATISSIMO=48]="INVERTED_MARCATISSIMO",e[e.P=49]="P",e[e.F=50]="F",e[e.S=51]="S",e[e.Z=52]="Z",e[e.M=53]="M",e[e.R=54]="R",e[e.SEGNO=55]="SEGNO",e[e.CODA=56]="CODA",e[e.DRUM_CLEF=57]="DRUM_CLEF",e[e.G_CLEF_SUB8=58]="G_CLEF_SUB8",e[e.G_CLEF_SUPER8=59]="G_CLEF_SUPER8",e[e.G_CLEF_SUB15=60]="G_CLEF_SUB15",e[e.G_CLEF_SUPER15=61]="G_CLEF_SUPER15",e[e.F_CLEF_SUB8=62]="F_CLEF_SUB8",e[e.F_CLEF_SUPER8=63]="F_CLEF_SUPER8",e[e.F_CLEF_SUB15=64]="F_CLEF_SUB15",e[e.F_CLEF_SUPER15=65]="F_CLEF_SUPER15",e[e.DOWN_BOW=66]="DOWN_BOW",e[e.MORDENT=67]="MORDENT",e[e.INVERTED_MORDENT=68]="INVERTED_MORDENT",e[e.TURN=69]="TURN",e[e.INVERTED_TURN=70]="INVERTED_TURN",e[e.LEFTHAND_PIZZICATO=71]="LEFTHAND_PIZZICATO",e[e.RELEASE_PED=72]="RELEASE_PED",e[e.ENGAGE_PED=73]="ENGAGE_PED",e[e.VA8=74]="VA8",e[e.VB8=75]="VB8",e[e.TRILL=76]="TRILL",e[e.MA15=77]="MA15",e[e.MB15=78]="MB15",e[e.HIGH=79]="HIGH",e[e.PLAY=80]="PLAY",e[e.MIC=81]="MIC",e[e.SNAP_PIZZICATO=82]="SNAP_PIZZICATO",e[e.NATURAL_HARMONIC=83]="NATURAL_HARMONIC",e[e.EditPen=84]="EditPen",e[e.PEDAL_BRACKET=85]="PEDAL_BRACKET",e[e.PEDAL_MIXED=86]="PEDAL_MIXED",e[e.PEDAL_SYMBOL=87]="PEDAL_SYMBOL",e}(MusicSymbol||{}),MusicSymbolDrawingStyle=function(e){return e[e.Normal=0]="Normal",e[e.Disabled=1]="Disabled",e[e.Selected=2]="Selected",e[e.Clickable=3]="Clickable",e[e.PlaybackSymbols=4]="PlaybackSymbols",e[e.FollowSymbols=5]="FollowSymbols",e[e.QFeedbackNotFound=6]="QFeedbackNotFound",e[e.QFeedbackOk=7]="QFeedbackOk",e[e.QFeedbackPerfect=8]="QFeedbackPerfect",e[e.Debug1=9]="Debug1",e[e.Debug2=10]="Debug2",e[e.Debug3=11]="Debug3",e}(MusicSymbolDrawingStyle||{}),PhonicScoreModes=function(e){return e[e.Following=0]="Following",e[e.Midi=1]="Midi",e[e.Manual=2]="Manual",e}(PhonicScoreModes||{}),LabelRenderSpecs=_createClass2((function e(){_classCallCheck2(this,e)})),MusicSheetDrawer=function(){function e(t,n){_classCallCheck2(this,e),this.drawableBoundingBoxElement="None",this.skyLineVisible=!1,this.bottomLineVisible=!1,this.phonicScoreMode=PhonicScoreModes.Manual,this.textMeasurer=t,this.splitScreenLineColor=-1,this.drawingParameters=n,this.rules=n.Rules}return _createClass2(e,[{key:"Mode",set:function(e){this.phonicScoreMode=e}},{key:"drawSheet",value:function(e){if(this.graphicalMusicSheet=e,this.rules=e.ParentMusicSheet.Rules,this.drawSplitScreenLine(),this.drawingParameters.drawCursors){var t,n=_createForOfIteratorHelper(e.Cursors);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r){var i=new BoundingBox$1(r);i.AbsolutePosition=r.Start,i.BorderBottom=r.End.y-r.Start.y,i.BorderRight=r.Width/2,i.BorderLeft=-r.Width/2,this.isVisible(i)&&this.drawLineAsVerticalRectangle(r,GraphicalLayers.Cursor)}}}catch(err){n.e(err)}finally{n.f()}}this.drawingParameters.drawScrollIndicator&&this.drawScrollIndicator();for(var a=Math.min(this.graphicalMusicSheet.MusicPages.length,this.rules.MaxPageToDrawNumber),o=0;o0&&(isTopFont(e.Label.textAlignment)||[TextAlignmentEnum.CenterBottom].includes(e.Label.textAlignment))){var z,G=-1,H=!1,U=_createForOfIteratorHelper((null==u?void 0:u.AbstractExpressions)||[]);try{for(U.s();!(z=U.n()).done;){var j,Q,Y=z.value;if(Y.Label===e)G=null==Y||null===(Q=Y.parentMeasure)||void 0===Q?void 0:Q.measureListIndex;else null!==(j=Y.expression)&&void 0!==j&&j.TempoInBpm&&(H=Y.expression.TempoInBpm>0);if(H&&G>-1){s.ScreenPosition.y-=40;break}}}catch(err){U.e(err)}finally{U.f()}}"jianpu"===this.rules.DYMusicScoreType?isNaN(parseInt(e.Label.text,10))&&this.renderLabel(e,t,s):this.renderLabel(e,t,s)}}}},{key:"calculateLabel",value:function(e){var t=new LabelRenderSpecs,n=e.Label,r=new BoundingBox$1(this);r.AbsolutePosition.x=e.PositionAndShape.AbsolutePosition.x,r.AbsolutePosition.y=e.PositionAndShape.AbsolutePosition.y||e.PositionAndShape.Parent.AbsolutePosition.y,t.ScreenPosition=this.applyScreenTransformation(r.AbsolutePosition),t.FontHeightInPixel=this.calculatePixelDistance(n.fontHeight);var i=this.calculatePixelDistance(e.PositionAndShape.Size.width);switch(t.BitmapWidth=Math.ceil(i),t.BitmapHeight=e.TextLines?Math.ceil(t.FontHeightInPixel*(.2+e.TextLines.length)):10,n.textAlignment){case TextAlignmentEnum.LeftTop:t.ScreenPosition.x-=t.BitmapWidth/2,t.ScreenPosition.y+=1.5*t.BitmapHeight;break;case TextAlignmentEnum.LeftCenter:t.ScreenPosition.y-=t.BitmapHeight/2;break;case TextAlignmentEnum.LeftBottom:t.ScreenPosition.y-=t.BitmapHeight;break;case TextAlignmentEnum.CenterTop:t.ScreenPosition.x-=t.BitmapWidth/2;break;case TextAlignmentEnum.CenterCenter:t.ScreenPosition.x-=t.BitmapWidth/2,t.ScreenPosition.y-=t.BitmapHeight/2;break;case TextAlignmentEnum.CenterBottom:t.ScreenPosition.x-=t.BitmapWidth/2,t.ScreenPosition.y-=t.BitmapHeight;break;case TextAlignmentEnum.RightTop:t.ScreenPosition.x-=t.BitmapWidth;break;case TextAlignmentEnum.RightCenter:t.ScreenPosition.x-=t.BitmapWidth,t.ScreenPosition.y-=t.BitmapHeight/2;break;case TextAlignmentEnum.RightBottom:t.ScreenPosition.x-=t.BitmapWidth,t.ScreenPosition.y-=t.BitmapHeight;break;default:throw new ArgumentOutOfRangeException("")}return t}},{key:"applyScreenTransformations",value:function(e){var t,n=[],r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){var i=t.value;n.push(this.applyScreenTransformation(i))}}catch(err){r.e(err)}finally{r.f()}return n}},{key:"drawSplitScreenLine",value:function(){}},{key:"renderRectangle",value:function(e,t,n){throw new Error("not implemented")}},{key:"drawScrollIndicator",value:function(){}},{key:"drawSelectionStartSymbol",value:function(e){}},{key:"drawSelectionEndSymbol",value:function(e){}},{key:"renderLabel",value:function(e,t,n){throw new Error("not implemented")}},{key:"renderSystemToScreen",value:function(e,t,n){}},{key:"drawSkyLine",value:function(e){}},{key:"drawBottomLine",value:function(e){}},{key:"drawInstrumentBrace",value:function(e,t){}},{key:"drawGroupBracket",value:function(e,t){}},{key:"isVisible",value:function(e){return!0}},{key:"drawMusicSystem",value:function(e){var t=this.getSystemAbsBoundingRect(e),n=this.getSytemBoundingBoxInPixels(t);this.drawMusicSystemComponents(e,n,t)}},{key:"getSytemBoundingBoxInPixels",value:function(e){var t=this.applyScreenTransformationForRect(e);return t.x=Math.round(t.x),t.y=Math.round(t.y),t}},{key:"getSystemAbsBoundingRect",value:function(e){var t=e.PositionAndShape.BoundingRectangle;return new RectangleF2D(e.PositionAndShape.AbsolutePosition.x+e.PositionAndShape.BorderLeft-1,e.PositionAndShape.AbsolutePosition.y+e.PositionAndShape.BorderTop-1,t.width+6,t.height+2)}},{key:"drawMusicSystemComponents",value:function(e,t,n){var r=this.graphicalMusicSheet.SelectionStartSymbol,i=this.graphicalMusicSheet.SelectionEndSymbol;this.drawingParameters.drawSelectionStartSymbol&&void 0!==r&&this.isVisible(r.PositionAndShape)&&this.drawSelectionStartSymbol(r),this.drawingParameters.drawSelectionEndSymbol&&void 0!==i&&this.isVisible(i.PositionAndShape)&&this.drawSelectionEndSymbol(i);var a,o=_createForOfIteratorHelper(e.StaffLines);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.drawStaffLine(s),this.rules.RenderLyrics&&(s.LyricsDashes.length>0&&this.drawDashes(s.LyricsDashes),s.LyricLines.length>0&&this.drawLyricLines(s.LyricLines,s))}}catch(err){o.e(err)}finally{o.f()}var l,u=_createForOfIteratorHelper(e.SystemLines);try{for(u.s();!(l=u.n()).done;){var c=l.value;this.drawSystemLineObject(c)}}catch(err){u.e(err)}finally{u.f()}if(e.Parent===e.Parent.Parent.MusicPages[0]){var h,d=_createForOfIteratorHelper(e.Labels);try{for(d.s();!(h=d.n()).done;){var f=h.value;f.SVGNode=this.drawLabel(f,GraphicalLayers.Notes)}}catch(err){d.e(err)}finally{d.f()}}var p,v=this.graphicalMusicSheet.ParentMusicSheet.Instruments,m=v.filter((function(e){return e.Visible})).length,g=_createForOfIteratorHelper(e.InstrumentBrackets);try{for(g.s();!(p=g.n()).done;){var y=p.value;this.drawInstrumentBrace(y,e)}}catch(err){g.e(err)}finally{g.f()}if(v.length>0)if(m>1){var b,A=_createForOfIteratorHelper(e.GroupBrackets);try{for(A.s();!(b=A.n()).done;){var S=b.value;this.drawGroupBracket(S,e)}}catch(err){A.e(err)}finally{A.f()}}else{var x,w=_createForOfIteratorHelper(e.GroupBrackets);try{for(w.s();!(x=w.n()).done;){x.value.Visible=!1}}catch(err){w.e(err)}finally{w.f()}}if(!this.leadSheet){var _,E=_createForOfIteratorHelper(e.MeasureNumberLabels);try{for(E.s();!(_=E.n()).done;){var k=_.value;k.SVGNode=this.drawLabel(k,GraphicalLayers.Notes)}}catch(err){E.e(err)}finally{E.f()}}var C,M=_createForOfIteratorHelper(e.StaffLines);try{for(M.s();!(C=M.n()).done;){var P=C.value;this.drawStaffLineSymbols(P)}}catch(err){M.e(err)}finally{M.f()}this.drawingParameters.drawMarkedAreas&&this.drawMarkedAreas(e)}},{key:"activateSystemRendering",value:function(e,t,n,r){return!0}},{key:"drawSystemLineObject",value:function(e){}},{key:"drawStaffLine",value:function(e){var t,n=_createForOfIteratorHelper(e.Measures);try{for(n.s();!(t=n.n()).done;){var r=t.value;this.drawMeasure(r)}}catch(err){n.e(err)}finally{n.f()}this.rules.RenderLyrics&&e.LyricsDashes.length>0&&this.drawDashes(e.LyricsDashes),this.drawOctaveShifts(e),this.drawPedals(e),this.drawWavyLines(e),this.drawExpressions(e),this.skyLineVisible&&this.drawSkyLine(e),this.bottomLineVisible&&this.drawBottomLine(e)}},{key:"drawLyricLines",value:function(e,t){var n=this;t.LyricLines.forEach((function(e){e.Start.y+=t.PositionAndShape.AbsolutePosition.y,e.End.y+=t.PositionAndShape.AbsolutePosition.y,e.Start.x+=t.PositionAndShape.AbsolutePosition.x,e.End.x+=t.PositionAndShape.AbsolutePosition.x,n.drawGraphicalLine(e,n.rules.LyricUnderscoreLineWidth)}))}},{key:"drawExpressions",value:function(e){}},{key:"drawGraphicalLine",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"black";return this.drawLine(e.Start,e.End,n,t)}},{key:"drawLine",value:function(e,t){}},{key:"drawDashes",value:function(e){var t=this;e.forEach((function(e){return e.SVGNode=t.drawLabel(e,GraphicalLayers.Notes)}))}},{key:"drawOctaveShifts",value:function(e){}},{key:"drawStaffLines",value:function(e){if(e.StaffLines)for(var t=e.PositionAndShape.AbsolutePosition,n=0;n<5;n++)this.drawLineAsHorizontalRectangleWithOffset(e.StaffLines[n],t,GraphicalLayers.Notes)}},{key:"drawSymbol",value:function(e,t,n){arguments.length>4&&void 0!==arguments[4]||GraphicalLayers.Notes}},{key:"leadSheet",get:function(){return this.graphicalMusicSheet.LeadSheet},set:function(e){this.graphicalMusicSheet.LeadSheet=e}},{key:"drawPage",value:function(e){if(this.isVisible(e.PositionAndShape)){var t,n=_createForOfIteratorHelper(e.MusicSystems);try{for(n.s();!(t=n.n()).done;){var r=t.value;this.isVisible(r.PositionAndShape)&&this.drawMusicSystem(r)}}catch(err){n.e(err)}finally{n.f()}if(e===e.Parent.MusicPages[0]){var i,a=_createForOfIteratorHelper(e.Labels);try{for(a.s();!(i=a.n()).done;){var o=i.value;o.SVGNode=this.drawLabel(o,GraphicalLayers.Notes)}}catch(err){a.e(err)}finally{a.f()}}this.drawableBoundingBoxElement&&this.drawBoundingBoxes(e.PositionAndShape,0,this.drawableBoundingBoxElement)}}},{key:"drawBoundingBoxes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"all",i=e.DataObject.constructor.name,a=!1;"all"===r&&(a=!0),(a||i===r)&&this.drawBoundingBox(e,void 0,!0,i,n),n++,e.ChildElements.forEach((function(e){return t.drawBoundingBoxes(e,n,r)}))}},{key:"drawBoundingBox",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=new RectangleF2D(e.AbsolutePosition.x+e.BorderMarginLeft,e.AbsolutePosition.y+e.BorderMarginTop,e.BorderMarginRight-e.BorderMarginLeft,e.BorderMarginBottom-e.BorderMarginTop);n&&(this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(e.AbsolutePosition.x-1,e.AbsolutePosition.y),new PointF2D(e.AbsolutePosition.x+1,e.AbsolutePosition.y),.1,OutlineAndFillStyleEnum.BaseWritingColor,t),i-1),this.drawLineAsVerticalRectangle(new GraphicalLine(new PointF2D(e.AbsolutePosition.x,e.AbsolutePosition.y-1),new PointF2D(e.AbsolutePosition.x,e.AbsolutePosition.y+1),.1,OutlineAndFillStyleEnum.BaseWritingColor,t),i-1)),a=this.applyScreenTransformationForRect(a);var o=this.renderRectangle(a,GraphicalLayers.Background,i,t,.5);if(r){var s=new Label(r),l=new LabelRenderSpecs;l.BitmapWidth=a.width,l.BitmapHeight=a.height,l.FontHeightInPixel=a.height,l.ScreenPosition=new PointF2D(a.x,a.y+12),this.renderLabel(new GraphicalLabel(s,.8,TextAlignmentEnum.CenterCenter,this.rules),i,l)}return o}},{key:"drawMarkedAreas",value:function(e){var t,n=_createForOfIteratorHelper(e.GraphicalMarkedAreas);try{for(n.s();!(t=n.n()).done;){var r=t.value;r&&(r.systemRectangle&&this.drawRectangle(r.systemRectangle,GraphicalLayers.Background),r.settings&&(r.settings.SVGNode=this.drawLabel(r.settings,GraphicalLayers.Comment)),r.labelRectangle&&this.drawRectangle(r.labelRectangle,GraphicalLayers.Background),r.label&&(r.label.SVGNode=this.drawLabel(r.label,GraphicalLayers.Comment)))}}catch(err){n.e(err)}finally{n.f()}}},{key:"drawStaffLineSymbols",value:function(e){var t=e.ParentStaff.ParentInstrument,n=e.PositionAndShape.AbsolutePosition.x,r=e.PositionAndShape.AbsolutePosition.y+2,i=e.PositionAndShape.BorderRight;t.highlight&&this.drawingParameters.drawHighlights&&this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(n,r),new PointF2D(n+i,r),4,OutlineAndFillStyleEnum.Highlighted),GraphicalLayers.Highlight);var a=MusicSymbolDrawingStyle.Disabled,o=MusicSymbol.PLAY,s=this.drawingParameters.drawActivitySymbols;switch(this.phonicScoreMode){case PhonicScoreModes.Midi:o=MusicSymbol.PLAY,this.midiPlaybackAvailable&&e.ParentStaff.audible&&(a=MusicSymbolDrawingStyle.PlaybackSymbols);break;case PhonicScoreModes.Following:o=MusicSymbol.MIC,e.ParentStaff.following&&(a=MusicSymbolDrawingStyle.FollowSymbols);break;default:s=!1}if(s){var l=new PointF2D(n+i+2,r);this.drawSymbol(o,a,l)}if(this.drawingParameters.drawErrors){var u,c=_createForOfIteratorHelper(e.Measures);try{for(c.s();!(u=c.n()).done;){var h=u.value,d=h.PositionAndShape,f=d.AbsolutePosition.x,p=d.AbsolutePosition.y+2;h.hasError&&this.graphicalMusicSheet.ParentMusicSheet.DrawErroneousMeasures&&this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(f,p),new PointF2D(f+d.BorderRight,p),4,OutlineAndFillStyleEnum.ErrorUnderlay),GraphicalLayers.MeasureError)}}catch(err){c.e(err)}finally{c.f()}}}}]),e}(),VexFlowTextMeasurer=function(){function e(t){_classCallCheck2(this,e),this.fontSize=20,this.fontSizeStandard=this.fontSize;var n=document.createElement("canvas");this.context=n.getContext("2d"),this.rules=t}return _createClass2(e,[{key:"computeTextWidthToHeightRatio",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.fontSize;return this.context.font=VexFlowConverter.font(i,n,t,this.rules,r),this.context.measureText(e).width/i}},{key:"setFontSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.fontSizeStandard;return this.fontSize=e,e}}]),e}(),AbstractGraphicalExpression=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i){var a;return _classCallCheck2(this,n),(a=t.call(this)).expression=r,a.parentMeasure=i,a.boundingBox=new BoundingBox$1(_assertThisInitialized2(a),e.PositionAndShape),a.parentStaffLine=e,a.parentStaffLine.AbstractExpressions.push(_assertThisInitialized2(a)),a.rules=e.ParentMusicSystem.rules,a}return _createClass2(n,[{key:"Label",get:function(){return this.label}},{key:"ParentStaffLine",get:function(){return this.parentStaffLine}},{key:"SourceExpression",get:function(){return this.expression}},{key:"Placement",get:function(){return this.expression.Placement}}]),n}(GraphicalObject),GraphicalInstantaneousTempoExpression=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i;return _classCallCheck2(this,n),(i=t.call(this,r.PositionAndShape.Parent.DataObject,e,e.parentMeasure)).label=r,i}return _createClass2(n,[{key:"GraphicalLabel",get:function(){return this.label}},{key:"updateSkyBottomLine",value:function(){}}]),n}(AbstractGraphicalExpression),GraphicalInstantaneousDynamicExpression=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i){var a;return _classCallCheck2(this,n),(a=t.call(this,r,e,i.parentSourceMeasure)).mInstantaneousDynamicExpression=e,a.mMeasure=i,a}return _createClass2(n,[{key:"updateSkyBottomLine",value:function(){var e=this.parentStaffLine.SkyBottomLineCalculator,t=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginLeft,n=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginRight,r=0;switch(this.Placement){case PlacementEnum.Above:r=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginTop,e.updateSkyLineInRange(t,n,r);break;case PlacementEnum.Below:r=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginBottom,e.updateBottomLineInRange(t,n,r);break;default:loglevelExports.error("Placement for GraphicalInstantaneousDynamicExpression is unknown")}}}]),n}(AbstractGraphicalExpression),GraphicalContinuousDynamicExpression=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i){var a;return _classCallCheck2(this,n),(a=t.call(this,r,e,i)).lines=[],a.isSplittedPart=!1,a.notToBeRemoved=!1,a}return _createClass2(n,[{key:"StartMeasure",get:function(){return this.startMeasure},set:function(e){this.startMeasure=e}},{key:"EndMeasure",get:function(){return this.endMeasure},set:function(e){this.endMeasure=e}},{key:"EndStaffLine",get:function(){return this.endMeasure?this.endMeasure.ParentStaffLine:void 0}},{key:"IsSplittedPart",get:function(){return this.isSplittedPart},set:function(e){this.isSplittedPart=e}},{key:"IsVerbal",get:function(){return this.ContinuousDynamic.Label&&this.ContinuousDynamic.Label.length>0}},{key:"NotToBeRemoved",get:function(){return this.notToBeRemoved},set:function(e){this.notToBeRemoved=e}},{key:"Lines",get:function(){return this.lines}},{key:"ContinuousDynamic",get:function(){return this.SourceExpression}},{key:"updateSkyBottomLine",value:function(){var e,t=this.parentStaffLine.SkyBottomLineCalculator,n=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft:0,r=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight:0;(!this.IsVerbal&&this.lines.length<2&&loglevelExports.warn("Not enough lines for SkyBottomLine calculation"),this.IsVerbal)||this.ContinuousDynamic.DynamicType!==ContDynamicEnum.crescendo&&this.ContinuousDynamic.DynamicType!==ContDynamicEnum.diminuendo&&loglevelExports.warn("GraphicalContinuousDynamicExpression.updateSkyBottomLine(): unhandled continuous dynamic type. start measure: "+(null===(e=this.startMeasure)||void 0===e?void 0:e.MeasureNumber));switch(this.Placement){case PlacementEnum.Above:if(this.IsVerbal){var i=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;t.updateSkyLineInRange(n,r,i)}else this.ContinuousDynamic.DynamicType===ContDynamicEnum.crescendo?t.updateSkyLineWithWedge(this.lines[0].Start,this.lines[0].End):this.ContinuousDynamic.DynamicType===ContDynamicEnum.diminuendo&&t.updateSkyLineWithWedge(this.lines[0].End,this.lines[0].Start);break;case PlacementEnum.Below:if(this.IsVerbal){var a=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;t.updateBottomLineInRange(n,r,a)}else this.ContinuousDynamic.DynamicType===ContDynamicEnum.crescendo?t.updateBottomLineWithWedge(this.lines[1].Start,this.lines[1].End):this.ContinuousDynamic.DynamicType===ContDynamicEnum.diminuendo&&t.updateBottomLineWithWedge(this.lines[1].End,this.lines[1].Start);break;default:loglevelExports.error("Placement for GraphicalContinuousDynamicExpression is unknown")}}},{key:"createCrescendoLines",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.rules.WedgeOpeningLength,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.rules.WedgeLineWidth,a=new PointF2D(e,n),o=new PointF2D(t,n-r/2),s=new PointF2D(t,n+r/2);this.addWedgeLines(a,o,s,i)}},{key:"createFirstHalfCrescendoLines",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.rules.WedgeMeasureEndOpeningLength,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.rules.WedgeLineWidth,a=new PointF2D(e,n),o=new PointF2D(t,n-r/2),s=new PointF2D(t,n+r/2);this.addWedgeLines(a,o,s,i)}},{key:"createSecondHalfCrescendoLines",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.rules.WedgeMeasureBeginOpeningLength,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.rules.WedgeOpeningLength,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:this.rules.WedgeLineWidth,o=new PointF2D(e,n-r/2),s=new PointF2D(e,n+r/2),l=new PointF2D(t,n-i/2),u=new PointF2D(t,n+i/2);this.addDoubleLines(o,l,s,u,a)}},{key:"recalculateCrescendoLines",value:function(e,t,n){var r=Math.abs(this.lines[0].Start.y-this.lines[1].Start.y)>1e-4;this.lines.clear(),r?this.createSecondHalfCrescendoLines(e,t,n):this.isSplittedPart?this.createFirstHalfCrescendoLines(e,t,n):this.createCrescendoLines(e,t,n)}},{key:"createDiminuendoLines",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.rules.WedgeOpeningLength,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.rules.WedgeLineWidth,a=new PointF2D(e,n-r/2),o=new PointF2D(e,n+r/2),s=new PointF2D(t,n);this.addWedgeLines(s,a,o,i)}},{key:"createFirstHalfDiminuendoLines",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.rules.WedgeOpeningLength,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.rules.WedgeMeasureEndOpeningLength,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:this.rules.WedgeLineWidth,o=new PointF2D(e,n-r/2),s=new PointF2D(e,n+r/2),l=new PointF2D(t,n-i/2),u=new PointF2D(t,n+i/2);this.addDoubleLines(o,l,s,u,a)}},{key:"createSecondHalfDiminuendoLines",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.rules.WedgeMeasureBeginOpeningLength,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.rules.WedgeLineWidth,a=new PointF2D(e,n-r/2),o=new PointF2D(e,n+r/2),s=new PointF2D(t,n);this.addWedgeLines(s,a,o,i)}},{key:"recalculateDiminuendoLines",value:function(e,t,n){var r=Math.abs(this.lines[0].End.y-this.lines[1].End.y)>1e-4;this.lines.clear(),r?this.createFirstHalfDiminuendoLines(e,t,n):this.isSplittedPart?this.createSecondHalfDiminuendoLines(e,t,n):this.createDiminuendoLines(e,t,n)}},{key:"calcPsi",value: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===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))}},{key:"cleanUp",value:function(){this.lines.clear()}},{key:"shiftYPosition",value:function(e){this.IsVerbal?(this.PositionAndShape.RelativePosition.y+=e,this.PositionAndShape.calculateBoundingBox()):(this.lines[0].Start.y+=e,this.lines[0].End.y+=e,this.lines[1].End.y+=e)}},{key:"squeeze",value:function(e){this.IsVerbal||(Math.abs(this.lines[0].End.x-this.lines[0].Start.x)0?this.lines[0].Start.x+=e:(this.lines[0].End.x+=e,this.lines[1].End.x+=e):e<0?this.lines[0].Start.x+=e:(this.lines[0].End.x+=e,this.lines[1].End.x+=e),this.calcPsi()))}},{key:"addWedgeLines",value:function(e,t,n,r){var i=new GraphicalLine(e,t,r),a=new GraphicalLine(e,n,r);this.lines.push(i),this.lines.push(a)}},{key:"addDoubleLines",value:function(e,t,n,r,i){var a=new GraphicalLine(e,t,i),o=new GraphicalLine(n,r,i);this.lines.push(a),this.lines.push(o)}}]),n}(AbstractGraphicalExpression),GraphicalUnknownExpression=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i,a){var o,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;return _classCallCheck2(this,n),(o=t.call(this,e,new AbstractExpression(i),a)).label=r,o.sourceMultiExpression=s,o}return _createClass2(n,[{key:"updateSkyBottomLine",value:function(){var e=this.parentStaffLine.SkyBottomLineCalculator,t=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft,n=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight;switch(this.Placement){case PlacementEnum.Above:var r=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;e.updateSkyLineInRange(t,n,r);break;case PlacementEnum.Below:var i=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;e.updateBottomLineInRange(t,n,i);break;default:loglevelExports.error("Placement for GraphicalUnknownExpression is unknown")}}}]),n}(AbstractGraphicalExpression),unitInPixels=10,VexFlowMusicSheetDrawer=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new DrawingParameters;return _classCallCheck2(this,n),(e=t.call(this,new VexFlowTextMeasurer(r.Rules),r)).backends=[],e.zoom=1,e.pageIdx=0,e.getDotId=function(e,t){return t?String(e.Label.PositionAndShape.RelativePosition[t]):String(e.Label.PositionAndShape.RelativePosition.x)+String(e.Label.PositionAndShape.RelativePosition.y)},e.hasDot=function(e,t,n,r){var i,a=_createForOfIteratorHelper(t||Object.values(r));try{for(a.s();!(i=a.n()).done;){var o=i.value;if(n)return e.x===o.x&&e.y===o.y;if(e.x===o.x)return!0}}catch(err){a.e(err)}finally{a.f()}return!1},e}return _createClass2(n,[{key:"Zoom",get:function(){return this.zoom}},{key:"Backends",get:function(){return this.backends}},{key:"initializeBackendForPage",value:function(e){this.backend=this.backends[e.PageNumber-1]}},{key:"drawSheet",value:function(e){var t,r,i;"gonville"===this.rules.DefaultVexFlowNoteFont&&(Vex.Flow.DEFAULT_FONT_STACK=[null===(t=Vex.Flow.Fonts)||void 0===t?void 0:t.Gonville,null===(r=Vex.Flow.Fonts)||void 0===r?void 0:r.Bravura,null===(i=Vex.Flow.Fonts)||void 0===i?void 0:i.Custom]);Vex.Flow.STAVE_LINE_THICKNESS=this.rules.StaffLineWidth*unitInPixels,Vex.Flow.STEM_WIDTH=this.rules.StemWidth*unitInPixels,Vex.Flow.DEFAULT_NOTATION_FONT_SCALE=this.rules.VexFlowDefaultNotationFontScale,Vex.Flow.DEFAULT_TAB_FONT_SCALE=this.rules.VexFlowDefaultTabFontScale,this.pageIdx=0;var a,o=_createForOfIteratorHelper(e.MusicPages);try{for(o.s();!(a=o.n()).done;){var s=a.value;if(s.PageNumber>this.rules.MaxPageToDrawNumber)break;var l=this.backends[this.pageIdx];l.graphicalMusicPage=s,l.scale(this.zoom),this.pageIdx+=1}}catch(err){o.e(err)}finally{o.f()}this.pageIdx=0,this.backend=this.backends[0],_get(_getPrototypeOf2(n.prototype),"drawSheet",this).call(this,e)}},{key:"drawPage",value:function(e){e&&(this.backend=this.backends[e.PageNumber-1],_get(_getPrototypeOf2(n.prototype),"drawPage",this).call(this,e),this.pageIdx+=1)}},{key:"clear",value:function(){var e,t=_createForOfIteratorHelper(this.backends);try{for(t.s();!(e=t.n()).done;){e.value.clear()}}catch(err){t.e(err)}finally{t.f()}}},{key:"setZoom",value:function(e){this.zoom=e}},{key:"calculatePixelDistance",value:function(e){return e*unitInPixels}},{key:"drawStaffLine",value:function(e){var t=this.backend.getContext().openGroup();t&&t.classList.add("staffline"),_get(_getPrototypeOf2(n.prototype),"drawStaffLine",this).call(this,e);var r=e.PositionAndShape.AbsolutePosition;this.rules.RenderSlurs&&this.drawSlurs(e,r),this.backend.getContext().closeGroup()}},{key:"drawSlurs",value:function(e,t){for(var n,r=this,i=null===(n=window.GYM)||void 0===n?void 0:n.vfcurveItem,a=function(n){var a=e.GraphicalSlurs[n];if(a.slur.isCrossed())return"continue";if(i&&i.length)try{var o,s,l,u=i.find((function(e,t){return(!e.index||e.index===n)&&e.MeasureNumberXML==a.staffEntries[a.staffEntries.length-1].parentMeasure.MeasureNumber}));if(u)a.bezierEndControlPt.y+=null!=u&&null!==(o=u.bezierEndControlPt)&&void 0!==o&&o.y?u.bezierEndControlPt.y:0,a.bezierEndPt.y+=null!=u&&null!==(s=u.bezierEndPt)&&void 0!==s&&s.y?u.bezierEndPt.y:0,a.bezierStartControlPt.y+=null!=u&&null!==(l=u.bezierStartControlPt)&&void 0!==l&&l.y?u.bezierStartControlPt.y:0}catch(c){console.log(c)}r.drawSlur(a,t)},o=0;o0||e.bezierStartPt.y>0)&&(e.bezierStartPt.y=-.8,e.bezierStartControlPt.y=-2.5),n=new PointF2D(e.bezierStartPt.x+t.x,e.bezierStartPt.y+t.y),r=new PointF2D(e.bezierStartControlPt.x+t.x,e.bezierStartControlPt.y+t.y),i=new PointF2D(e.bezierEndControlPt.x+t.x,e.bezierStartControlPt.y+t.y),a=new PointF2D(e.bezierEndPt.x+t.x,e.bezierStartPt.y+t.y)):(n=new PointF2D(e.bezierStartPt.x+t.x,e.bezierStartPt.y+t.y),r=new PointF2D(e.bezierStartControlPt.x+t.x,e.bezierStartControlPt.y+t.y),i=new PointF2D(e.bezierEndControlPt.x+t.x,e.bezierEndControlPt.y+t.y),a=new PointF2D(e.bezierEndPt.x+t.x,e.bezierEndPt.y+t.y)),o.push(this.applyScreenTransformation(n)),o.push(this.applyScreenTransformation(r)),o.push(this.applyScreenTransformation(i)),o.push(this.applyScreenTransformation(a)),e.placement===PlacementEnum.Above?(n.y-=.05,r.y-=.3,i.y-=.3,a.y-=.05):(n.y+=.05,r.y+=.3,i.y+=.3,a.y+=.05),o.push(this.applyScreenTransformation(n)),o.push(this.applyScreenTransformation(r)),o.push(this.applyScreenTransformation(i)),o.push(this.applyScreenTransformation(a)),e.SVGElement=this.backend.renderCurve(o)}},{key:"drawMeasure",value:function(e){e.setAbsoluteCoordinates(e.PositionAndShape.AbsolutePosition.x*unitInPixels,e.PositionAndShape.AbsolutePosition.y*unitInPixels);var t=this.backend.getContext();try{e.draw(t)}catch(a){loglevelExports.warn("VexFlowMusicSheetDrawer.drawMeasure",a)}var n,r=_createForOfIteratorHelper(e.staffEntries);try{for(r.s();!(n=r.n()).done;){var i=n.value;this.drawStaffEntry(i)}}catch(err){r.e(err)}finally{r.f()}}},{key:"drawLine",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"#FF0000FF",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.2;return e=this.applyScreenTransformation(e),t=this.applyScreenTransformation(t),this.backend.renderLine(e,t,n,r*unitInPixels)}},{key:"DrawOverlayLine",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#FF0000FF",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2;if(!(!n.PageNumber||n.PageNumber>this.backends.length||n.PageNumber<1)){var a=n.PageNumber-1,o=this.backends[a];return e=this.applyScreenTransformation(e),t=this.applyScreenTransformation(t),o.renderLine(e,t,r,i*unitInPixels)}console.log("VexFlowMusicSheetDrawer.drawOverlayLine: invalid page number / music page number doesn't correspond to an existing backend.")}},{key:"drawSkyLine",value:function(e){var t=e.PositionAndShape.AbsolutePosition,n=e.PositionAndShape.Size.width;this.drawSampledLine(e.SkyLine,t,n)}},{key:"drawBottomLine",value:function(e){var t=new PointF2D(e.PositionAndShape.AbsolutePosition.x,e.PositionAndShape.AbsolutePosition.y),n=e.PositionAndShape.Size.width;this.drawSampledLine(e.BottomLine,t,n,"#0000FFFF")}},{key:"drawSampledLine",value:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#FF0000FF",i=[],a=0,o=0;o0){var l,u,c=this.rules.SamplingUnit,h=new PointF2D(s.x,s.y),d=new PointF2D(i[0]/c+s.x,s.y);this.drawLine(h,d,r),e[0]>=0&&(l=new PointF2D(i[0]/c+s.x,s.y),u=new PointF2D(i[0]/c+s.x,s.y+e[i[0]]),this.drawLine(l,u,r));for(var f=1;f0){var t,n=_createForOfIteratorHelper(e.FingeringEntries);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.SVGNode=this.drawLabel(r,GraphicalLayers.Notes)}}catch(err){n.e(err)}finally{n.f()}}if(void 0!==e.graphicalChordContainers&&e.graphicalChordContainers.length>0){var i,a=_createForOfIteratorHelper(e.graphicalChordContainers);try{for(a.s();!(i=a.n()).done;){var o=i.value.GraphicalLabel;o.SVGNode=this.drawLabel(o,GraphicalLayers.Notes)}}catch(err){a.e(err)}finally{a.f()}}this.rules.RenderLyrics&&e.LyricsEntries.length>0&&this.drawLyrics(e.LyricsEntries,GraphicalLayers.Notes)}},{key:"drawLyrics",value:function(e,t){var n=this;e.forEach((function(e){var r=e.GraphicalLabel;r.SVGNode=n.drawLabel(r,t)}))}},{key:"drawInstrumentBrace",value:function(e,t){e.draw(this.backend.getContext())}},{key:"drawGroupBracket",value:function(e,t){e.draw(this.backend.getContext())}},{key:"drawOctaveShifts",value:function(e){var t,n=_createForOfIteratorHelper(e.OctaveShifts);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r){var i=r,a=this.backend.getContext(),o=i.getTextBracket();o.setContext(a);try{o.draw()}catch(s){loglevelExports.warn(s)}}}}catch(err){n.e(err)}finally{n.f()}}},{key:"drawPedals",value:function(e){var t,n=_createForOfIteratorHelper(e.Pedals);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r){var i=r,a=this.backend.getContext(),o=i.getPedalMarking();o.setContext(a),o.draw()}}}catch(err){n.e(err)}finally{n.f()}}},{key:"drawWavyLines",value:function(e){var t,n=_createForOfIteratorHelper(e.WavyLines);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r){var i=r,a=this.backend.getContext(),o=i.getVibratoBracket();o.setContext(a),o.draw()}}}catch(err){n.e(err)}finally{n.f()}}},{key:"getMaxExpressionsYAndDots",value:function(e){var t,n=[],r=0,i=_createForOfIteratorHelper(e.measures);try{for(i.s();!(t=i.n()).done;){var a=t.value;n.push(a.measureNumber)}}catch(err){i.e(err)}finally{i.f()}var o,s={},l={},u={},c=_createForOfIteratorHelper(e.AbstractExpressions);try{for(c.s();!(o=c.n()).done;){var h=o.value;if(h instanceof GraphicalUnknownExpression&&n.includes(h.parentMeasure.MeasureNumber)){var d=this.getDotId(h),f=this.getDotId(h,"x");l[d]||(l[d]=[]),u[f]||(u[f]=[]),this.hasDot(h.Label.PositionAndShape.RelativePosition,l[d],!0)||(l[d].push(h.Label.PositionAndShape.RelativePosition),u[f].push(h.Label.PositionAndShape.RelativePosition)),s[d]=h.Label.PositionAndShape.RelativePosition}}}catch(err){c.e(err)}finally{c.f()}var p,v=0,m=_createForOfIteratorHelper(e.AbstractExpressions);try{for(m.s();!(p=m.n()).done;){var g,y=p.value,b=null===(g=y.parentMeasure)||void 0===g?void 0:g.MeasureNumber;if(y instanceof GraphicalUnknownExpression&&n.includes(b)){var A,S=null===(A=y.parentMeasure.verticalMeasureList[0])||void 0===A?void 0:A.stave,x=(null==S?void 0:S.end_x)-(null==S?void 0:S.x),w=this.getDotId(y,"x");if(1===(u[w]||[]).length&&v!==b){var _=y.Label.PositionAndShape.AbsolutePosition.y;r=0===r?_:Math.min(r,_)}1!==(u[w]||[]).length&&x/10Number.EPSILON){var n=Math.min.apply(Math,_toConsumableArray2(e.Lines.map((function(e){return e.Start.x})))),r=Math.min.apply(Math,_toConsumableArray2(e.Lines.map((function(e){return e.Start.y}))));e.Lines[0].Start.x=n,e.Lines[1].Start.x=n,e.Lines[0].Start.y=r+this.rules.WedgeOpeningLength/2,e.Lines[1].Start.y=r+2*this.rules.WedgeOpeningLength,e.Lines[0].End.y+=this.rules.WedgeOpeningLength/2,e.Lines[1].End.y+=this.rules.WedgeOpeningLength}}catch(c){}var i=this.backend.getContext();i.openGroup("lineGroup");var a,o=_createForOfIteratorHelper(e.Lines);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=new PointF2D(e.ParentStaffLine.PositionAndShape.AbsolutePosition.x+s.Start.x,e.ParentStaffLine.PositionAndShape.AbsolutePosition.y+s.Start.y),u=new PointF2D(e.ParentStaffLine.PositionAndShape.AbsolutePosition.x+s.End.x,e.ParentStaffLine.PositionAndShape.AbsolutePosition.y+s.End.y);this.drawLine(l,u,"black",s.Width)}}catch(err){o.e(err)}finally{o.f()}i.closeGroup()}}},{key:"renderLabel",value:function(e,t,n){return this._renderLabel(e,n)}},{key:"_renderLabel",value:function(e,t){if(e.Label.print){var n,r=e.Label.fontHeight*unitInPixels,i=e.Label.font;this.rules.ColoringEnabled&&(n=e.Label.colorDefault,e.Label.color&&(n=e.Label.color.toString()),n||(n=this.rules.DefaultColorLabel));var a,o=e.Label,s=o.fontStyle,l=o.fontFamily;s||(s=this.rules.DefaultFontStyle),l||(l=this.rules.DefaultFontFamily);for(var u=0;u<(null===(c=e.TextLines)||void 0===c?void 0:c.length);u++){var c,h=e.TextLines[u],d=this.calculatePixelDistance(h.xOffset),f=new PointF2D(t.ScreenPosition.x+d,t.ScreenPosition.y),p=this.backend.renderText(r,s,i,h.text,t.FontHeightInPixel,f,n,e.Label.fontFamily);a?a.appendChild(p):a=p,t.ScreenPosition.y=t.ScreenPosition.y+t.FontHeightInPixel,e.TextLines.length>1&&(t.ScreenPosition.y+=this.rules.SpacingBetweenTextLines)}return a}}},{key:"renderRectangle",value:function(e,t,n,r,i){return this.backend.renderRectangle(e,n,r,i)}},{key:"applyScreenTransformation",value:function(e){return new PointF2D(e.x*unitInPixels,e.y*unitInPixels)}},{key:"applyScreenTransformationForRect",value:function(e){return new RectangleF2D(e.x*unitInPixels,e.y*unitInPixels,e.width*unitInPixels,e.height*unitInPixels)}}]),n}(MusicSheetDrawer),VF$c=Vex.Flow,_VexFlowConverter=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,null,[{key:"durations",value:function(e,t){for(var n=[],r=e.clone();r.RealValue>0;){var i=r.RealValue;if(i>=2)n.push("1/2"),r.Sub(new Fraction$1(2,1));else if(i>=1)n.push("w"),r.Sub(new Fraction$1(1,1));else if(i<1&&i>=.5){if(t&&i>.5)return["w"];n.push("h"),r.Sub(new Fraction$1(1,2))}else if(i<.5&&i>=.25){if(t&&i>.25)return["h"];n.push("q"),r.Sub(new Fraction$1(1,4))}else if(i<.25&&i>=.125){if(t&&i>.125)return["q"];n.push("8"),r.Sub(new Fraction$1(1,8))}else if(i<.125&&i>=.0625){if(t&&i>.0625)return["8"];n.push("16"),r.Sub(new Fraction$1(1,16))}else if(i<.0625&&i>=.03125){if(t&&i>.03125)return["16"];n.push("32"),r.Sub(new Fraction$1(1,32))}else if(i<.03125&&i>=.015625){if(t&&i>.015625)return["32"];n.push("64"),r.Sub(new Fraction$1(1,64))}else{if(t)return["64"];n.push("128"),r.Sub(new Fraction$1(1,128))}}return n}},{key:"pitch",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,a=i;void 0===i&&(a=3),t&&void 0===i&&(a=0,n.ClefType===ClefEnum.F&&(a=2),n.ClefType===ClefEnum.C&&(a=2));var o=NoteEnum[e.FundamentalNote].toLowerCase(),s=Pitch.accidentalVexflow(e.Accidental),l=e.Octave-n.OctaveOffset+a,u="";return r&&(u=this.NoteHeadCode(r)),[o+"n/"+l+u,s,n]}},{key:"restToNotePitch",value:function(e,t){var n=e.Octave;switch(t){case ClefEnum.C:case ClefEnum.F:n+=2;case ClefEnum.G:}return new Pitch(e.FundamentalNote,n,AccidentalEnum.NONE)}},{key:"NoteHeadCode",value:function(e){var t=e.Filled?"2":"1";switch(e.Shape){case NoteHeadShape.NORMAL:return"";case NoteHeadShape.DIAMOND:return"/D"+t;case NoteHeadShape.TRIANGLE:return"/T"+t;case NoteHeadShape.X:return"/X"+t;case NoteHeadShape.CIRCLEX:return"/X3";case NoteHeadShape.RECTANGLE:return"/R"+t;case NoteHeadShape.SQUARE:return"/S"+t;case NoteHeadShape.SLASH:default:return""}}},{key:"GhostNotes",value:function(t){var n,r=[],i=_createForOfIteratorHelper(e.durations(t,!1));try{for(i.s();!(n=i.n()).done;){var a=n.value;r.push(new VF$c.GhostNote({duration:a}))}}catch(err){i.e(err)}finally{i.f()}return r}},{key:"StaveNote",value:function(t){var n,r;t.sortForVexflow();var i,a=t.notes,o=t.parentStaffEntry.parentMeasure.parentSourceMeasure.Rules,s=a[0],l=[],u=[],c=s.graphicalNoteLength,h=void 0!==s.sourceNote.NoteTuplet,d=e.durations(c,h)[0];void 0!==s.sourceNote.TypeLength&&s.sourceNote.TypeLength!==c&&0!==s.sourceNote.TypeLength.RealValue&&(d=e.durations(s.sourceNote.TypeLength,h)[0],s.numberOfDots=s.sourceNote.DotsXml);var f,p,v,m=void 0,g=s.numberOfDots,y=!1,b=0,A=!1,S=!1,x=_createForOfIteratorHelper(a);try{for(x.s();!(p=x.n()).done;){var w,_,E=p.value;if(g=1&&R.length-1>=F+1)if(L=null===(P=R[F-1])||void 0===P||null===(I=P.graphicalVoiceEntries[0])||void 0===I?void 0:I.parentVoiceEntry,N=null===(T=R[F+1])||void 0===T||null===(B=T.graphicalVoiceEntries[0])||void 0===B?void 0:B.parentVoiceEntry,L&&N){var V,z=L.Notes[0],G=N.Notes[0];if(null!==(V=z.NoteBeam)&&void 0!==V&&V.Notes.includes(G)&&1!==G.ParentStaffEntry.ParentStaff.StafflineCount){var H=L.Notes.last().Pitch,U=E.Clef(),j=e.pitch(e.restToNotePitch(H.getTransposedPitch(-2),U.ClefType),!1,U);4===H.FundamentalNote&&(l=[j[0]])}}}c.RealValue===E.sourceNote.SourceMeasure.ActiveTimeSignature.RealValue&&(l="staff"===o.DYMusicScoreType?["d/5"]:["R/5"],d="w",g=0,y=!0,b=o.WholeRestXShiftVexflow*unitInPixels);var Q=_toConsumableArray2(E.sourceNote.ParentStaff.Voices).filter((function(e){return 1!=(null==e?void 0:e.VoiceId)}));if(Q.length){var Y,W=E.parentVoiceEntry.parentStaffEntry.graphicalVoiceEntries,X=E.parentVoiceEntry.parentVoiceEntry.ParentVoice.VoiceId,K=void 0,J=void 0,$=_createForOfIteratorHelper(W);try{for($.s();!(Y=$.n()).done;){var q,Z=_createForOfIteratorHelper(Y.value.notes);try{for(Z.s();!(q=Z.n()).done;){var ee=q.value;if(ee!==E&&!ee.sourceNote.isRest()&&ee.sourceNote.PrintObject){var te=ee.parentVoiceEntry.parentVoiceEntry.WantedStemDirection,ne=1===X||5===X,re=ne?1:-1,ie=ee.sourceNote.Pitch.getHalfTone();(!K||1===re&&ie>K||-1===re&&ie0){var ae=3,oe=E.Clef();switch(oe.ClefType){case ClefEnum.F:ae=5;break;case ClefEnum.C:ae=4}f=Pitch.fromHalftone(K),l=[e.pitch(f,!0,oe,void 0,ae)[0]]}}break}E.sourceNote.Notehead&&E.sourceNote.Notehead.Shape===NoteHeadShape.SLASH&&(A=!0);var se=E.vfpitch;if(null!==(w=se[2])&&void 0!==w&&null!==(_=w.Parent)&&void 0!==_&&_.Instructions)for(var le=0,ue=se[2].Parent.Instructions.length;le1&&1==t.notes[0].sourceNote.ParentVoiceEntry.ParentVoice.VoiceId&&(v.getKeyProps()[0].line=4.5));var be=null===(r=window.GYM)||void 0===r?void 0:r.customBassDrum;if(be&&v.isRest()&&("q"===v.getDuration()&&(v.getKeyProps()[0].line=be),"h"===v.getDuration()&&(v.getKeyProps()[0].line=be-1)),v.getKeyProps().forEach((function(e,n){var r=e.line;return t.notes[n].staffLine=r})),(o.LedgerLineWidth||o.LedgerLineStrokeStyle)&&(v.ledgerLineStyle||(v.ledgerLineStyle={}),o.LedgerLineWidth&&(v.ledgerLineStyle.lineWidth=o.LedgerLineWidth),o.LedgerLineStrokeStyle&&(v.ledgerLineStyle.strokeStyle=o.LedgerLineStrokeStyle)),o.ColoringEnabled){var Ae=o.DefaultColorStem,Se=t.parentVoiceEntry.StemColor;!Se&&Ae&&(Se=Ae);var xe={fillStyle:Se,strokeStyle:Se};Se&&(v.setStemStyle(xe),v.flag&&o.ColorFlags&&v.setFlagStyle(xe))}if(v.x_shift=b,t.parentVoiceEntry.IsGrace&&t.notes[0].sourceNote.NoteBeam&&(t.parentVoiceEntry.WantedStemDirection=t.notes[0].sourceNote.NoteBeam.Notes[0].ParentVoiceEntry.WantedStemDirection),t.parentVoiceEntry){var we,_e=t.parentVoiceEntry.WantedStemDirection,Ee=(null===(we=window.GYM)||void 0===we?void 0:we.stemDirectionNote)||[],ke=null==Ee?void 0:Ee.find((function(e){return e.id===t.notes[0].sourceNote.NoteToGraphicalNoteObjectId}));switch(ke&&"number"==typeof(null==ke?void 0:ke.direction)&&(_e=ke.direction),_e){case StemDirectionType.Up:v.setStemDirection(VF$c.Stem.UP),t.parentVoiceEntry.StemDirection=StemDirectionType.Up;break;case StemDirectionType.Down:v.setStemDirection(VF$c.Stem.DOWN),t.parentVoiceEntry.StemDirection=StemDirectionType.Down}}for(var Ce=0,Me=a.length;Ce0&&"single"===Ie){var Te=new VF$c.Tremolo(Pe);Te.extra_stroke_scale=o.TremoloStrokeScale,Te.y_spacing_scale=o.TremoloYSpacingScale,v&&"w"===v.duration&&v.stem.setExtension(-9),v.addModifier(Ce,Te)}if(Pe>0&&"start"===Ie&&this.noteTremoloList.push(v),Pe>0&&"stop"===Ie){this.noteTremoloList.push(v);var Be=this.noteTremoloList.filter((function(e){return"w"===e.duration})).length===this.noteTremoloList.length;if(Be)try{var Re;if(this.noteTremoloList[0].keyProps&&this.noteTremoloList[1].keyProps)null===(Re=(this.noteTremoloList[0].keyProps[0].line>this.noteTremoloList[1].keyProps[0].line?this.noteTremoloList[1]:this.noteTremoloList[0]).stem)||void 0===Re||Re.setResetHeight(30)}catch(it){console.error("设置都是全音符,stem的高度失败")}var Le=new VF$c.Tremolo(Pe,_toConsumableArray2(this.noteTremoloList));Le.extra_stroke_scale=1.2,Le.y_spacing_scale=1.2,Le.x_shift=-30,v.addModifier(Ce,Le),this.noteTremoloList=[]}this.glissandoList.length&&(v.setVibrato(this.glissandoList[0].vfnote[0]),this.glissandoList=[]),"start"===a[Ce].sourceNote.glissandoType&&this.glissandoList.push(a[Ce])}if(this.slideNote){try{v.setSlideNote(this.slideNote)}catch(it){console.error(it)}this.slideNote=null}if("start"===t.notes[0].sourceNote.slideType&&(this.slideNote=v),.25===ve.Length.RealValue&&ve.Notehead&&!1===ve.Notehead.Filled)for(var Ne=v.getKeyProps(),Fe=0;Fe1){var Ve,ze=v.getKeyProps().filter((function(e){return!e.code&&e.line>3}));(null===(Ve=window.GYM)||void 0===Ve?void 0:Ve.stemDirectionNote)||ze.length!==l.length||v.setStemDirection(-1)}"jianpu"===o.DYMusicScoreType&&window&&window.sett&&window.sett.keySignature&&v.addAccidental(0,new VF$c.Accidental("#"));try{var Ge,He=["b","#","§","º","X"],Ue={b:"b","#":"#","§":"n","º":"bb",X:"##"},je=_createForOfIteratorHelper(a);try{for(je.s();!(Ge=je.n()).done;){var Qe,Ye=Ge.value,We=Ye.sourceNote.voiceEntry.Timestamp,Xe=_createForOfIteratorHelper(Ye.sourceNote.SourceMeasure.StaffLinkedExpressions);try{for(Xe.s();!(Qe=Xe.n()).done;){var Ke,Je=_createForOfIteratorHelper(Qe.value);try{for(Je.s();!(Ke=Je.n()).done;){var $e=Ke.value,qe=Fraction$1.Equal(We,$e.Timestamp),Ze=$e.EntriesList.map((function(e){return e.label})).filter((function(e){return He.includes(e)})),et=Ze.map((function(e){return Ue[e]}));if(qe){var tt,nt=_createForOfIteratorHelper(et);try{for(nt.s();!(tt=nt.n()).done;){var rt=tt.value;rt&&v.addAnnotation(0,new VF$c.Annotation(rt))}}catch(err){nt.e(err)}finally{nt.f()}break}}}catch(err){Je.e(err)}finally{Je.f()}}}catch(err){Xe.e(err)}finally{Xe.f()}}}catch(err){je.e(err)}finally{je.f()}}catch(it){}return v}},{key:"generateArticulations",value:function(e,t,n){if(e&&"GhostNote"!==e.getAttribute("type")){var r,i=_createForOfIteratorHelper(t);try{for(i.s();!(r=i.n()).done;){var a=r.value,o=VF$c.Modifier.Position.ABOVE;e.getStemDirection()===VF$c.Stem.UP&&(o=VF$c.Modifier.Position.BELOW);var s=void 0,l=a.articulationEnum;switch(n.ArticulationPlacementFromXML&&(a.placement===PlacementEnum.Above?o=VF$c.Modifier.Position.ABOVE:a.placement===PlacementEnum.Below&&(o=VF$c.Modifier.Position.BELOW)),l){case ArticulationEnum.accent:s=new VF$c.Articulation("a>");break;case ArticulationEnum.downbow:s=new VF$c.Articulation("am"),void 0===a.placement&&(o=VF$c.Modifier.Position.ABOVE);break;case ArticulationEnum.fermata:s=new VF$c.Articulation("a@a"),o=VF$c.Modifier.Position.ABOVE;break;case ArticulationEnum.marcatodown:s=new VF$c.Articulation("a|");break;case ArticulationEnum.marcatoup:s=new VF$c.Articulation("a^");break;case ArticulationEnum.invertedfermata:s=new VF$c.Articulation("a@u"),o=VF$c.Modifier.Position.BELOW;break;case ArticulationEnum.lefthandpizzicato:s=new VF$c.Articulation("a+");break;case ArticulationEnum.naturalharmonic:s=new VF$c.Articulation("ah");break;case ArticulationEnum.snappizzicato:s=new VF$c.Articulation("ao");break;case ArticulationEnum.staccatissimo:s=new VF$c.Articulation("av");break;case ArticulationEnum.staccato:s=new VF$c.Articulation("a.");break;case ArticulationEnum.tenuto:s=new VF$c.Articulation("a-");break;case ArticulationEnum.upbow:s=new VF$c.Articulation("a|"),void 0===a.placement&&(o=VF$c.Modifier.Position.ABOVE);break;case ArticulationEnum.strongaccent:s=new VF$c.Articulation("a^")}if(s){var u,c,h,d,f,p;if(!e.hasStem()&&!e.isRest()&&l==ArticulationEnum.accent&&e.getLineNumber()>=3)o=VF$c.Modifier.Position.ABOVE,null!=e&&null!==(h=e.modifiers)&&void 0!==h&&null!==(d=h.filter((function(e){return["TREMOLO"].includes(e.getCategory().toLocaleUpperCase())})))&&void 0!==d&&d.length&&s.setYShift(-16);if(l===ArticulationEnum.strongaccent)o=VF$c.Modifier.Position.ABOVE,(null===(f=window.GYM)||void 0===f?void 0:f.customArtPosition)&&(1===e.getStemDirection()?o=VF$c.Modifier.Position.ABOVE:(o=VF$c.Modifier.Position.BELOW,s=new VF$c.Articulation("a|")));if((null===(u=window.GYM)||void 0===u?void 0:u.customAccentItem)&&l===ArticulationEnum.accent&&(o=VF$c.Modifier.Position.ABOVE),!(null===(c=window.GYM)||void 0===c?void 0:c.customLefthandpizzicatoItem)||l!==ArticulationEnum.lefthandpizzicato&&l!==ArticulationEnum.naturalharmonic||(o=VF$c.Modifier.Position.ABOVE),l===ArticulationEnum.tenuto&&"w"===e.getDuration())(null===(p=window.GYM)||void 0===p?void 0:p.customTenutoItem)&&(o=VF$c.Modifier.Position.ABOVE);s.setPosition(o),e.addModifier(0,s)}}}catch(err){i.e(err)}finally{i.f()}}}},{key:"generateOrnaments",value:function(e,t){var n=VF$c.Modifier.Position.ABOVE;t.placement===PlacementEnum.Below&&(n=VF$c.Modifier.Position.BELOW);var r=void 0;switch(t.GetOrnament){case OrnamentEnum.DelayedInvertedTurn:(r=new VF$c.Ornament("turn_inverted")).setDelayed(!0);break;case OrnamentEnum.DelayedTurn:(r=new VF$c.Ornament("turn")).setDelayed(!0);break;case OrnamentEnum.InvertedMordent:(r=new VF$c.Ornament("mordent")).setDelayed(!1);break;case OrnamentEnum.InvertedTurn:(r=new VF$c.Ornament("turn_inverted")).setDelayed(!1);break;case OrnamentEnum.Mordent:(r=new VF$c.Ornament("mordent_inverted")).setDelayed(!1);break;case OrnamentEnum.Trill:(r=new VF$c.Ornament("tr")).setDelayed(!1);break;case OrnamentEnum.Turn:(r=new VF$c.Ornament("turn")).setDelayed(!1);break;default:return void loglevelExports.warn("unhandled OrnamentEnum type: "+t.GetOrnament)}r&&(t.AccidentalBelow!==AccidentalEnum.NONE&&r.setLowerAccidental(Pitch.accidentalVexflow(t.AccidentalBelow)),t.AccidentalAbove!==AccidentalEnum.NONE&&r.setUpperAccidental(Pitch.accidentalVexflow(t.AccidentalAbove)),r.setPosition(n),e.addModifier(0,r))}},{key:"StrokeTypeFromArpeggioType",value:function(e){switch(e){case ArpeggioType.ARPEGGIO_DIRECTIONLESS:return VF$c.Stroke.Type.ARPEGGIO_DIRECTIONLESS;case ArpeggioType.BRUSH_DOWN:return VF$c.Stroke.Type.BRUSH_UP;case ArpeggioType.BRUSH_UP:return VF$c.Stroke.Type.BRUSH_DOWN;case ArpeggioType.RASQUEDO_DOWN:return VF$c.Stroke.Type.RASQUEDO_UP;case ArpeggioType.RASQUEDO_UP:return VF$c.Stroke.Type.RASQUEDO_DOWN;case ArpeggioType.ROLL_DOWN:return VF$c.Stroke.Type.ROLL_UP;case ArpeggioType.ROLL_UP:return VF$c.Stroke.Type.ROLL_DOWN;default:return VF$c.Stroke.Type.ARPEGGIO_DIRECTIONLESS}}},{key:"CreateTabNote",value:function(t){var n,r=[],i=t.notes.reverse(),a=[],o=t.notes[0].graphicalNoteLength,s=void 0!==t.notes[0].sourceNote.NoteTuplet,l=e.durations(o,s)[0],u=0,c=_createForOfIteratorHelper(t.notes);try{var h=function(){var e=n.value,t=e.sourceNote,i={str:t.StringNumberTab,fret:t.FretNumber};r.push(i),t.BendArray&&t.BendArray.forEach((function(e){var t,n=e.bendalter-i.fret;t=n>1?"Full":1===n?"1/2":"1/4","up"===e.direction?a.push({type:VF$c.Bend.UP,text:t,width:10}):a.push({type:VF$c.Bend.DOWN,text:t,width:10})})),u1&&void 0!==arguments[1]?arguments[1]:"default";switch("default"!==r&&"small"!==r&&(loglevelExports.warn('Invalid VexFlow clef size "'.concat(r,'" specified. Using "default".')),r="default"),e.ClefType){case ClefEnum.G:switch(e.Line){case 1:t="french";break;case 2:t="treble";break;default:t="treble",loglevelExports.error("Clef ".concat(ClefEnum[e.ClefType]," on line ").concat(e.Line,' not supported by VexFlow. Using default value "').concat(t,'".'))}break;case ClefEnum.F:switch(e.Line){case 4:t="bass";break;case 3:t="baritone-f";break;case 5:t="subbass";break;default:t="bass",loglevelExports.error("Clef ".concat(ClefEnum[e.ClefType]," on line ").concat(e.Line,' not supported by VexFlow. Using default value "').concat(t,'".'))}break;case ClefEnum.C:switch(e.Line){case 3:t="alto";break;case 4:t="tenor";break;case 1:t="soprano";break;case 2:t="mezzo-soprano";break;default:t="alto",loglevelExports.error("Clef ".concat(ClefEnum[e.ClefType]," on line ").concat(e.Line,' not supported by VexFlow. Using default value "').concat(t,'".'))}break;case ClefEnum.percussion:t="percussion";break;case ClefEnum.TAB:t="treble";break;default:loglevelExports.info("bad clef type: "+e.ClefType),t="treble"}return 1===e.OctaveOffset&&"bass"!==t?n="8va":-1===e.OctaveOffset&&(n="8vb"),{type:t,size:r,annotation:n}}},{key:"TimeSignature",value:function(e){var t;switch(e.SymbolEnum){case RhythmSymbolEnum.NONE:t=e.Rhythm.Numerator+"/"+e.Rhythm.Denominator;break;case RhythmSymbolEnum.COMMON:t="C";break;case RhythmSymbolEnum.CUT:t="C|"}return new VF$c.TimeSignature(t)}},{key:"keySignature",value:function(t){if(t){var n;switch(t.Mode){case KeyEnum.minor:n=e.minorMap[t.Key]+"m";break;case KeyEnum.major:case KeyEnum.none:n=e.majorMap[t.Key];break;default:n="C"}return n}}},{key:"line",value:function(e,t){switch(e){case SystemLinesEnum.SingleThin:return t===SystemLinePosition.MeasureBegin?VF$c.StaveConnector.type.SINGLE:VF$c.StaveConnector.type.SINGLE_RIGHT;case SystemLinesEnum.DoubleThin:return VF$c.StaveConnector.type.THIN_DOUBLE;case SystemLinesEnum.ThinBold:return VF$c.StaveConnector.type.BOLD_DOUBLE_RIGHT;case SystemLinesEnum.BoldThinDots:return VF$c.StaveConnector.type.BOLD_DOUBLE_LEFT;case SystemLinesEnum.DotsThinBold:case SystemLinesEnum.DotsBoldBoldDots:return VF$c.StaveConnector.type.BOLD_DOUBLE_RIGHT;case SystemLinesEnum.None:return VF$c.StaveConnector.type.NONE}}},{key:"font",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:FontStyles.Regular,n=(arguments.length>2&&void 0!==arguments[2]||Fonts.TimesNewRoman,arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0),r="normal",i="normal",a="'".concat((arguments.length>3?arguments[3]:void 0).DefaultFontFamily,"'");switch(t){case FontStyles.Bold:i="bold";break;case FontStyles.Italic:r="italic";break;case FontStyles.BoldItalic:r="italic",i="bold";case FontStyles.Underlined:}return Fonts.Kokila,n&&"default"!==n&&(a="'".concat(n,"'")),r+" "+i+" "+Math.floor(e)+"px "+a}},{key:"fontStyle",value:function(e){switch(e){case FontStyles.Bold:return"bold";case FontStyles.Italic:return"italic";case FontStyles.BoldItalic:return"italic bold";default:return"normal"}}},{key:"style",value:function(e){return OUTLINE_AND_FILL_STYLE_DICT.getValue(e)}}]),e}(),VexFlowConverter=_VexFlowConverter;VexFlowConverter.majorMap={"-1":"F","-2":"Bb","-3":"Eb","-4":"Ab","-5":"Db","-6":"Gb","-7":"Cb","-8":"Fb",0:"C",1:"G",2:"D",3:"A",4:"E",5:"B",6:"F#",7:"C#",8:"G#"},VexFlowConverter.minorMap={"-1":"D","-2":"G","-3":"C","-4":"F","-5":"Bb","-6":"Eb","-7":"Ab","-8":"Db",0:"A",1:"E",2:"B",3:"F#",4:"C#",5:"G#",6:"D#",7:"A#",8:"E#"},VexFlowConverter.noteTremoloList=[],VexFlowConverter.glissandoList=[],VexFlowConverter.slideNote=null;var OctaveShift=function(){function e(t,n){_classCallCheck2(this,e),this.numberXml=1,this.setOctaveShiftValue(t,n)}return _createClass2(e,[{key:"Type",get:function(){return this.octaveValue},set:function(e){this.octaveValue=e}},{key:"StaffNumber",get:function(){return this.staffNumber},set:function(e){this.staffNumber=e}},{key:"ParentStartMultiExpression",get:function(){return this.startMultiExpression},set:function(e){this.startMultiExpression=e}},{key:"ParentEndMultiExpression",get:function(){return this.endMultiExpression},set:function(e){this.endMultiExpression=e}},{key:"setOctaveShiftValue",value:function(e,t){this.octaveValue=1===t&&"down"===e?0:1===t&&"up"===e?1:2===t&&"down"===e?2:2===t&&"up"===e?3:4}}],[{key:"getPitchFromOctaveShift",value:function(e,t){if(e){var n=e.Octave;switch(t){case 0:n-=1;break;case 1:n+=1;break;case 2:n-=2;break;case 3:n+=2;break;default:n+=0}return new Pitch(e.FundamentalNote,n,e.Accidental)}}}]),e}(),OctaveEnum=function(e){return e[e.VA8=0]="VA8",e[e.VB8=1]="VB8",e[e.MA15=2]="MA15",e[e.MB15=3]="MB15",e[e.NONE=4]="NONE",e}(OctaveEnum||{}),AbstractTempoExpression=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i,a){var o;return _classCallCheck2(this,n),(o=t.call(this,r)).label=e,o.staffNumber=i,o.parentMultiTempoExpression=a,o}return _createClass2(n,[{key:"Label",get:function(){return this.label},set:function(e){this.label=e}},{key:"Placement",get:function(){return this.placement},set:function(e){this.placement=e}},{key:"StaffNumber",get:function(){return this.staffNumber},set:function(e){this.staffNumber=e}},{key:"ParentMultiTempoExpression",get:function(){return this.parentMultiTempoExpression}}],[{key:"isStringInStringList",value:function(e,t){var r,i=_createForOfIteratorHelper(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(n.stringContainsSeparatedWord(t.toLowerCase().trim(),a.toLowerCase().trim()))return!0}}catch(err){i.e(err)}finally{i.f()}return!1}},{key:"stringContainsSeparatedWord",value:function(e,t){return e===t||-1!==e.indexOf(" "+t)||-1!==e.indexOf(t+" ")}}]),n}(AbstractExpression),_InstantaneousTempoExpression=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i,a,o){var s;return _classCallCheck2(this,n),(s=t.call(this,e,r,i,o)).setTempoAndTempoType(a),s}return _createClass2(n,[{key:"Label",get:function(){return this.label},set:function(e){this.label=e}},{key:"Placement",get:function(){return this.placement},set:function(e){this.placement=e}},{key:"StaffNumber",get:function(){return this.staffNumber},set:function(e){this.staffNumber=e}},{key:"Enum",get:function(){return this.tempoEnum}},{key:"TempoInBpm",get:function(){return this.tempoInBpm},set:function(e){this.tempoInBpm=e}},{key:"ParentMultiTempoExpression",get:function(){return this.parentMultiTempoExpression}},{key:"getAbsoluteTimestamp",value:function(){return Fraction$1.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp)}},{key:"getAbsoluteFloatTimestamp",value:function(){return Fraction$1.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp).RealValue}},{key:"setTempoAndTempoType",value:function(e){return this.label?n.isStringInStringList(n.listInstantaneousTempoLarghissimo,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(1)),this.tempoInBpm=e,void(this.tempoEnum=1)):n.isStringInStringList(n.listInstantaneousTempoGrave,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(2)),this.tempoInBpm=e,void(this.tempoEnum=2)):n.isStringInStringList(n.listInstantaneousTempoLento,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(3)),this.tempoInBpm=e,void(this.tempoEnum=3)):n.isStringInStringList(n.listInstantaneousTempoLargo,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(4)),this.tempoInBpm=e,void(this.tempoEnum=4)):n.isStringInStringList(n.listInstantaneousTempoLarghetto,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(5)),this.tempoInBpm=e,void(this.tempoEnum=5)):n.isStringInStringList(n.listInstantaneousTempoAdagio,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(6)),this.tempoInBpm=e,void(this.tempoEnum=6)):n.isStringInStringList(n.listInstantaneousTempoAdagietto,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(7)),this.tempoInBpm=e,void(this.tempoEnum=7)):n.isStringInStringList(n.listInstantaneousTempoAndanteModerato,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(8)),this.tempoInBpm=e,void(this.tempoEnum=8)):n.isStringInStringList(n.listInstantaneousTempoAndante,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(9)),this.tempoInBpm=e,void(this.tempoEnum=9)):n.isStringInStringList(n.listInstantaneousTempoAndantino,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(10)),this.tempoInBpm=e,void(this.tempoEnum=10)):n.isStringInStringList(n.listInstantaneousTempoModerato,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(11)),this.tempoInBpm=e,void(this.tempoEnum=11)):n.isStringInStringList(n.listInstantaneousTempoAllegretto,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(12)),this.tempoInBpm=e,void(this.tempoEnum=12)):n.isStringInStringList(n.listInstantaneousTempoAllegroModerato,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(13)),this.tempoInBpm=e,void(this.tempoEnum=13)):n.isStringInStringList(n.listInstantaneousTempoAllegro,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(14)),this.tempoInBpm=e,void(this.tempoEnum=14)):n.isStringInStringList(n.listInstantaneousTempoVivace,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(15)),this.tempoInBpm=e,void(this.tempoEnum=15)):n.isStringInStringList(n.listInstantaneousTempoVivacissimo,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(16)),this.tempoInBpm=e,void(this.tempoEnum=16)):n.isStringInStringList(n.listInstantaneousTempoAllegrissimo,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(17)),this.tempoInBpm=e,void(this.tempoEnum=17)):n.isStringInStringList(n.listInstantaneousTempoPresto,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(18)),this.tempoInBpm=e,void(this.tempoEnum=18)):n.isStringInStringList(n.listInstantaneousTempoPrestissimo,this.label)?(0===e&&(e=n.getDefaultValueForTempoType(19)),this.tempoInBpm=e,void(this.tempoEnum=19)):n.isStringInStringList(n.listInstantaneousTempoAddons,this.label)?(this.tempoInBpm=0,void(this.tempoEnum=21)):n.isStringInStringList(n.listInstantaneousTempoChangesGeneral,this.label)?(this.tempoInBpm=0,void(this.tempoEnum=22)):void 0:(this.tempoInBpm=e,void(this.tempoEnum=23))}}],[{key:"getDefaultValueForTempoType",value:function(e){switch(e){case 1:return 20;case 2:return 30;case 3:return 48;case 4:return 52;case 5:return 63;case 6:return 70;case 7:return 75;case 8:return 88;case 9:return 92;case 10:return 96;case 11:return 106;case 12:return 112;case 13:return 118;case 14:return 130;case 15:return 140;case 16:return 155;case 17:return 170;case 18:return 184;case 19:return 200;default:throw new ArgumentOutOfRangeException("tempoEnum")}}},{key:"isInputStringInstantaneousTempo",value:function(e){return!!e&&(n.isStringInStringList(n.listInstantaneousTempoLarghissimo,e)||n.isStringInStringList(n.listInstantaneousTempoGrave,e)||n.isStringInStringList(n.listInstantaneousTempoLento,e)||n.isStringInStringList(n.listInstantaneousTempoLargo,e)||n.isStringInStringList(n.listInstantaneousTempoLarghetto,e)||n.isStringInStringList(n.listInstantaneousTempoAdagio,e)||n.isStringInStringList(n.listInstantaneousTempoAdagietto,e)||n.isStringInStringList(n.listInstantaneousTempoAndanteModerato,e)||n.isStringInStringList(n.listInstantaneousTempoAndante,e)||n.isStringInStringList(n.listInstantaneousTempoAndantino,e)||n.isStringInStringList(n.listInstantaneousTempoModerato,e)||n.isStringInStringList(n.listInstantaneousTempoAllegretto,e)||n.isStringInStringList(n.listInstantaneousTempoAllegroModerato,e)||n.isStringInStringList(n.listInstantaneousTempoAllegro,e)||n.isStringInStringList(n.listInstantaneousTempoVivace,e)||n.isStringInStringList(n.listInstantaneousTempoVivacissimo,e)||n.isStringInStringList(n.listInstantaneousTempoAllegrissimo,e)||n.isStringInStringList(n.listInstantaneousTempoPresto,e)||n.isStringInStringList(n.listInstantaneousTempoPrestissimo,e)||n.isStringInStringList(n.listInstantaneousTempoChangesGeneral,e))}}]),n}(AbstractTempoExpression),InstantaneousTempoExpression=_InstantaneousTempoExpression;InstantaneousTempoExpression.listInstantaneousTempoLarghissimo=["Larghissimo","Sehr breit","very, very slow"],InstantaneousTempoExpression.listInstantaneousTempoGrave=["Grave","Schwer","slow and solemn"],InstantaneousTempoExpression.listInstantaneousTempoLento=["Lento","Lent","Langsam","slowly"],InstantaneousTempoExpression.listInstantaneousTempoLargo=["Largo","Breit","broadly"],InstantaneousTempoExpression.listInstantaneousTempoLarghetto=["Larghetto","Etwas breit","rather broadly"],InstantaneousTempoExpression.listInstantaneousTempoAdagio=["Adagio","Langsam","Ruhig","slow and stately"],InstantaneousTempoExpression.listInstantaneousTempoAdagietto=["Adagietto","Ziemlich ruhig","Ziemlich langsam","rather slow"],InstantaneousTempoExpression.listInstantaneousTempoAndanteModerato=["Andante moderato"],InstantaneousTempoExpression.listInstantaneousTempoAndante=["Andante","Gehend","Schreitend","at a walking pace"],InstantaneousTempoExpression.listInstantaneousTempoAndantino=["Andantino"],InstantaneousTempoExpression.listInstantaneousTempoModerato=["Moderato","Mäßig","Mod�r�","moderately"],InstantaneousTempoExpression.listInstantaneousTempoAllegretto=["Allegretto","fast"],InstantaneousTempoExpression.listInstantaneousTempoAllegroModerato=["Allegro moderato"],InstantaneousTempoExpression.listInstantaneousTempoAllegro=["Allegro","Rapide","Vite","Rasch","Schnell","Fr�hlich"],InstantaneousTempoExpression.listInstantaneousTempoVivace=["Vivace","Lebhaft","Lebendig","lively and fast"],InstantaneousTempoExpression.listInstantaneousTempoVivacissimo=["Vivacissimo","Sehr lebhaft","Sehr lebendig"],InstantaneousTempoExpression.listInstantaneousTempoAllegrissimo=["Allegrissimo","very fast"],InstantaneousTempoExpression.listInstantaneousTempoPresto=["Presto","Sehr schnell","Geschwind"],InstantaneousTempoExpression.listInstantaneousTempoPrestissimo=["Prestissimo","äußerst schnell"],InstantaneousTempoExpression.listInstantaneousTempoChangesGeneral=["tempo primo","a tempo","tempo i","rubato","doppio movimento"],InstantaneousTempoExpression.listInstantaneousTempoAddons=["assai","amoroso","cantabile","con brio","con dolore","con espressione","con fuoco","con moto","con spirito","spiritoso","espressivo","giocoso","giusto","grazioso","lesto","lugubre","maestoso","ma non troppo","marcato","molto","morendo","mosso","non tanto","piu","un poco","poco","quasi","risoluto","scherzando","sostenuto","teneramente","tempo giusto","tranquillo","sehr","lieblich","liebevoll","mit Leidenschaft","mit Liebe","amourös","gesanglich","mit Schwung","mit Feuer","mit Schmerz","mit Ausdruck","mit Bewegung","geistvoll","ausdrucksvoll","freudig","verspielt","angemessen","graziös","mit Grazie","flink","behände","traurig","klagend","majestätisch","aber nicht zu sehr","markant","gemäßigt","viel","sehr","ersterbend","bewegt","nicht zu sehr","mehr","ein wenig","gleichsam","entschlossen","zupackend","heiter","nachdrücklich","getragen","gewichtig","zart","zärtlich","im angemessenen Zeitmaß","ruhig","ein wenig","alla marcia","ad libitum","alla breve"];var TempoEnum=function(e){return e[e.none=0]="none",e[e.larghissimo=1]="larghissimo",e[e.grave=2]="grave",e[e.lento=3]="lento",e[e.largo=4]="largo",e[e.larghetto=5]="larghetto",e[e.adagio=6]="adagio",e[e.adagietto=7]="adagietto",e[e.andanteModerato=8]="andanteModerato",e[e.andante=9]="andante",e[e.andantino=10]="andantino",e[e.moderato=11]="moderato",e[e.allegretto=12]="allegretto",e[e.allegroModerato=13]="allegroModerato",e[e.allegro=14]="allegro",e[e.vivace=15]="vivace",e[e.vivacissimo=16]="vivacissimo",e[e.allegrissimo=17]="allegrissimo",e[e.presto=18]="presto",e[e.prestissimo=19]="prestissimo",e[e.lastRealTempo=20]="lastRealTempo",e[e.addon=21]="addon",e[e.changes=22]="changes",e[e.metronomeMark=23]="metronomeMark",e}(TempoEnum||{}),_MoodExpression=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i){var a;return _classCallCheck2(this,n),(a=t.call(this,r)).label=e,a.staffNumber=i,a.setMoodType(),a}return _createClass2(n,[{key:"Label",get:function(){return this.label},set:function(e){this.label=e}},{key:"Mood",get:function(){return this.moodType},set:function(e){this.moodType=e}},{key:"StaffNumber",get:function(){return this.staffNumber},set:function(e){this.staffNumber=e}},{key:"Placement",get:function(){return this.placement},set:function(e){this.placement=e}},{key:"setMoodType",value:function(){n.isStringInStringList(n.listMoodAffettuoso,this.label)?this.moodType=0:n.isStringInStringList(n.listMoodAgitato,this.label)?this.moodType=1:n.isStringInStringList(n.listMoodAnimato,this.label)?this.moodType=3:n.isStringInStringList(n.listMoodAppassionato,this.label)?this.moodType=2:n.isStringInStringList(n.listMoodBrillante,this.label)?this.moodType=4:n.isStringInStringList(n.listMoodCantabile,this.label)?this.moodType=5:n.isStringInStringList(n.listMoodDolce,this.label)?this.moodType=6:n.isStringInStringList(n.listMoodEnergico,this.label)?this.moodType=7:n.isStringInStringList(n.listMoodEroico,this.label)?this.moodType=8:n.isStringInStringList(n.listMoodEspressivo,this.label)?this.moodType=9:n.isStringInStringList(n.listMoodFurioso,this.label)?this.moodType=10:n.isStringInStringList(n.listMoodGiocoso,this.label)?this.moodType=11:n.isStringInStringList(n.listMoodGioioso,this.label)?this.moodType=12:n.isStringInStringList(n.listMoodGrandioso,this.label)?this.moodType=14:n.isStringInStringList(n.listMoodGrazioso,this.label)?this.moodType=15:n.isStringInStringList(n.listMoodLacrimoso,this.label)?this.moodType=13:n.isStringInStringList(n.listMoodLeggiero,this.label)?this.moodType=16:n.isStringInStringList(n.listMoodMaestoso,this.label)?this.moodType=17:n.isStringInStringList(n.listMoodMalinconico,this.label)?this.moodType=18:n.isStringInStringList(n.listMoodMarcato,this.label)?this.moodType=19:n.isStringInStringList(n.listMoodMarziale,this.label)?this.moodType=20:n.isStringInStringList(n.listMoodMesto,this.label)?this.moodType=21:n.isStringInStringList(n.listMoodMorendo,this.label)?this.moodType=22:n.isStringInStringList(n.listMoodNobilmente,this.label)?this.moodType=23:n.isStringInStringList(n.listMoodPatetico,this.label)?this.moodType=24:n.isStringInStringList(n.listMoodPesante,this.label)?this.moodType=25:n.isStringInStringList(n.listMoodSaltando,this.label)?this.moodType=27:n.isStringInStringList(n.listMoodSautille,this.label)?this.moodType=26:n.isStringInStringList(n.listMoodScherzando,this.label)?this.moodType=28:n.isStringInStringList(n.listMoodSostenuto,this.label)?this.moodType=29:n.isStringInStringList(n.listMoodSpiccato,this.label)?this.moodType=30:n.isStringInStringList(n.listMoodTenerezza,this.label)?this.moodType=31:n.isStringInStringList(n.listMoodTranquillamente,this.label)?this.moodType=32:n.isStringInStringList(n.listMoodTrionfante,this.label)&&(this.moodType=33)}}],[{key:"isInputStringMood",value:function(e){return!!e&&(n.isStringInStringList(n.listMoodAffettuoso,e)||n.isStringInStringList(n.listMoodAgitato,e)||n.isStringInStringList(n.listMoodAnimato,e)||n.isStringInStringList(n.listMoodAppassionato,e)||n.isStringInStringList(n.listMoodBrillante,e)||n.isStringInStringList(n.listMoodCantabile,e)||n.isStringInStringList(n.listMoodDolce,e)||n.isStringInStringList(n.listMoodEnergico,e)||n.isStringInStringList(n.listMoodEroico,e)||n.isStringInStringList(n.listMoodEspressivo,e)||n.isStringInStringList(n.listMoodFurioso,e)||n.isStringInStringList(n.listMoodGiocoso,e)||n.isStringInStringList(n.listMoodGioioso,e)||n.isStringInStringList(n.listMoodGrandioso,e)||n.isStringInStringList(n.listMoodGrazioso,e)||n.isStringInStringList(n.listMoodLacrimoso,e)||n.isStringInStringList(n.listMoodLeggiero,e)||n.isStringInStringList(n.listMoodMaestoso,e)||n.isStringInStringList(n.listMoodMalinconico,e)||n.isStringInStringList(n.listMoodMarcato,e)||n.isStringInStringList(n.listMoodMarziale,e)||n.isStringInStringList(n.listMoodMesto,e)||n.isStringInStringList(n.listMoodMorendo,e)||n.isStringInStringList(n.listMoodNobilmente,e)||n.isStringInStringList(n.listMoodPatetico,e)||n.isStringInStringList(n.listMoodPesante,e)||n.isStringInStringList(n.listMoodSaltando,e)||n.isStringInStringList(n.listMoodSautille,e)||n.isStringInStringList(n.listMoodScherzando,e)||n.isStringInStringList(n.listMoodSostenuto,e)||n.isStringInStringList(n.listMoodSpiccato,e)||n.isStringInStringList(n.listMoodTenerezza,e)||n.isStringInStringList(n.listMoodTranquillamente,e)||n.isStringInStringList(n.listMoodTrionfante,e))}}]),n}(AbstractExpression),MoodExpression=_MoodExpression;MoodExpression.listMoodAffettuoso=["affettuoso"],MoodExpression.listMoodAgitato=["agitato"],MoodExpression.listMoodAppassionato=["appassionato"],MoodExpression.listMoodAnimato=["animato","lively"],MoodExpression.listMoodBrillante=["brillante"],MoodExpression.listMoodCantabile=["cantabile"],MoodExpression.listMoodDolce=["dolce"],MoodExpression.listMoodEnergico=["energico"],MoodExpression.listMoodEroico=["eroico"],MoodExpression.listMoodEspressivo=["espressivo"],MoodExpression.listMoodFurioso=["furioso"],MoodExpression.listMoodGiocoso=["giocoso"],MoodExpression.listMoodGioioso=["gioioso"],MoodExpression.listMoodLacrimoso=["lacrimoso"],MoodExpression.listMoodGrandioso=["grandioso"],MoodExpression.listMoodGrazioso=["grazioso"],MoodExpression.listMoodLeggiero=["leggiero"],MoodExpression.listMoodMaestoso=["maestoso"],MoodExpression.listMoodMalinconico=["malinconico"],MoodExpression.listMoodMarcato=["marcato"],MoodExpression.listMoodMarziale=["marziale"],MoodExpression.listMoodMesto=["mesto"],MoodExpression.listMoodMorendo=["morendo"],MoodExpression.listMoodNobilmente=["nobilmente"],MoodExpression.listMoodPatetico=["patetico"],MoodExpression.listMoodPesante=["pesante"],MoodExpression.listMoodSautille=["sautille"],MoodExpression.listMoodSaltando=["saltando"],MoodExpression.listMoodScherzando=["scherzando"],MoodExpression.listMoodSostenuto=["sostenuto"],MoodExpression.listMoodSpiccato=["spiccato"],MoodExpression.listMoodTenerezza=["tenerezza"],MoodExpression.listMoodTranquillamente=["tranquillamente"],MoodExpression.listMoodTrionfante=["trionfante"];var UnknownExpression=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i,a){var o;return _classCallCheck2(this,n),(o=t.call(this,r)).label=e,o.staffNumber=a,void 0===i&&(i=TextAlignmentEnum.LeftBottom),o.textAlignment=i,o}return _createClass2(n,[{key:"Label",get:function(){return this.label}},{key:"Placement",get:function(){return this.placement},set:function(e){this.placement=e}},{key:"StaffNumber",get:function(){return this.staffNumber},set:function(e){this.staffNumber=e}},{key:"TextAlignment",get:function(){return this.textAlignment}}]),n}(AbstractExpression),MultiExpression=function(){function e(t,n){_classCallCheck2(this,e),this.unknownList=[],this.moodList=[],this.expressions=[],this.sourceMeasure=t,this.timestamp=n}return _createClass2(e,[{key:"SourceMeasureParent",get:function(){return this.sourceMeasure},set:function(e){this.sourceMeasure=e}},{key:"StaffNumber",get:function(){return this.staffNumber},set:function(e){this.staffNumber=e}},{key:"Timestamp",get:function(){return this.timestamp},set:function(e){this.timestamp=e}},{key:"AbsoluteTimestamp",get:function(){return Fraction$1.plus(this.timestamp,this.sourceMeasure.AbsoluteTimestamp)}},{key:"InstantaneousDynamic",get:function(){return this.instantaneousDynamic},set:function(e){this.instantaneousDynamic=e}},{key:"EndingContinuousDynamic",get:function(){return this.endingContinuousDynamic},set:function(e){this.endingContinuousDynamic=e}},{key:"StartingContinuousDynamic",get:function(){return this.startingContinuousDynamic},set:function(e){this.startingContinuousDynamic=e}},{key:"MoodList",get:function(){return this.moodList}},{key:"UnknownList",get:function(){return this.unknownList}},{key:"EntriesList",get:function(){return this.expressions}},{key:"OctaveShiftStart",get:function(){return this.octaveShiftStart},set:function(e){this.octaveShiftStart=e}},{key:"OctaveShiftEnd",get:function(){return this.octaveShiftEnd},set:function(e){this.octaveShiftEnd=e}},{key:"CombinedExpressionsText",get:function(){return this.combinedExpressionsText},set:function(e){this.combinedExpressionsText=e}},{key:"getPlacementOfFirstEntry",value:function(){var e=PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].expression instanceof InstantaneousDynamicExpression||this.expressions[0].expression instanceof ContinuousDynamicExpression||this.expressions[0].expression instanceof MoodExpression||this.expressions[0].expression instanceof UnknownExpression)&&(e=this.expressions[0].expression.Placement),e}},{key:"getFontstyleOfFirstEntry",value:function(){var e=FontStyles.Regular;if(this.expressions.length>0)if(this.expressions[0].expression instanceof ContinuousDynamicExpression)e=FontStyles.Italic;else if(this.expressions[0].expression instanceof MoodExpression)e=FontStyles.Italic;else if(this.expressions[0].expression instanceof UnknownExpression){var t;e=null!==(t=this.expressions[0].expression.fontStyle)&&void 0!==t?t:FontStyles.Regular}return e}},{key:"addExpression",value:function(e,t){e instanceof InstantaneousDynamicExpression?(this.instantaneousDynamic&&this.removeExpressionFromEntryList(this.InstantaneousDynamic),this.instantaneousDynamic=e,this.instantaneousDynamic.ParentMultiExpression=this):e instanceof ContinuousDynamicExpression?this.startingContinuousDynamic=e:e instanceof MoodExpression?this.moodList.push(e):e instanceof UnknownExpression&&this.unknownList.push(e),this.addExpressionToEntryList(e,t)}},{key:"CompareTo",value:function(e){return this.Timestamp.RealValue>e.Timestamp.RealValue?1:this.Timestamp.RealValue=5&&e<=12}}]),n}(AbstractTempoExpression),ContinuousTempoExpression=_ContinuousTempoExpression;ContinuousTempoExpression.listContinuousTempoFaster=["accelerando","piu mosso","poco piu","stretto"],ContinuousTempoExpression.listContinuousTempoSlower=["poco meno","meno mosso","piu lento","rallentando","ritardando","ritenuto","ritard.","ritard","riten.","riten"];var MultiTempoExpression=function(){function e(t,n){_classCallCheck2(this,e),this.expressions=[],this.sourceMeasure=t,this.timestamp=n}return _createClass2(e,[{key:"Timestamp",get:function(){return this.timestamp}},{key:"AbsoluteTimestamp",get:function(){return Fraction$1.plus(this.sourceMeasure.AbsoluteTimestamp,this.timestamp)}},{key:"SourceMeasureParent",get:function(){return this.sourceMeasure},set:function(e){this.sourceMeasure=e}},{key:"InstantaneousTempo",get:function(){return this.instantaneousTempo}},{key:"ContinuousTempo",get:function(){return this.continuousTempo}},{key:"EntriesList",get:function(){return this.expressions}},{key:"CombinedExpressionsText",get:function(){return this.combinedExpressionsText},set:function(e){this.combinedExpressionsText=e}},{key:"getPlacementOfFirstEntry",value:function(){var e=PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].Expression instanceof InstantaneousTempoExpression||this.expressions[0].Expression instanceof ContinuousTempoExpression)&&(e=this.expressions[0].Expression.Placement),e}},{key:"getFontstyleOfFirstEntry",value:function(){var e=FontStyles.Regular;return this.expressions[0].Expression instanceof InstantaneousTempoExpression?e=FontStyles.Bold:this.expressions[0].Expression instanceof ContinuousTempoExpression&&(e=FontStyles.Italic),e}},{key:"addExpression",value:function(e,t){if(!this.checkIfAlreadyExists(e)){e instanceof InstantaneousTempoExpression?this.instantaneousTempo=e:e instanceof ContinuousTempoExpression&&(this.continuousTempo=e);var n=new TempoExpressionEntry;n.prefix=t,n.Expression=e,n.label=e.Label,this.expressions.push(n)}}},{key:"CompareTo",value:function(e){return this.Timestamp.RealValue>e.Timestamp.RealValue?1:this.Timestamp.RealValue0){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}},{key:"calculateSystemYLayout",value:function(){var e,t=_createForOfIteratorHelper(this.musicSystems);try{for(t.s();!(e=t.n()).done;){var n=e.value;this.optimizeDistanceBetweenStaffLines(n)}}catch(err){t.e(err)}finally{t.f()}this.calculateMusicSystemsRelativePositions()}},{key:"setMeasureWidth",value:function(e,t,n,r){for(var i=0,a=e.length;i0&&(o.beginInstructionsWidth=n),r>0&&(o.endInstructionsWidth=r)}}},{key:"finalizeCurrentAndCreateNewSystem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.finalizeCurrentSystem(e,t,n,r),this.currentSystemParams=new SystemBuildParameters,void 0!==e&&this.measureListIndex1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.currentSystemParams.currentSystem.breaksPage=r,this.adaptRepetitionLineWithIfNeeded(),void 0!==e&&n&&this.checkAndCreateExtraInstructionMeasure(e),this.stretchMusicSystem(t)}},{key:"adaptRepetitionLineWithIfNeeded",value:function(){var e=this.currentSystemParams.systemMeasures;if(e.length>=1){var t=this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length-1],n=0,r=e[e.length-1];r.endLine===SystemLinesEnum.DotsBoldBoldDots&&(r.endLine=SystemLinesEnum.DotsThinBold,n=t[0].getLineWidth(SystemLinesEnum.DotsBoldBoldDots)/2-t[0].getLineWidth(SystemLinesEnum.DotsThinBold)),this.currentSystemParams.currentSystemFixWidth-=n;for(var i=0,a=t.length;i1){h=!0;break}}for(var p=0,v=0;v=0&&this.measureList[w]){var _,E=null===(_=this.measureList[w][0])||void 0===_?void 0:_.parentSourceMeasure;null!=E&&E.ImplicitMeasure&&null!=E&&E.RhythmPrinted&&(x=!1)}x&&(t.addRhythmAtBegin(u),t.parentSourceMeasure.RhythmPrinted=u,g=!0)}return(v||m||g)&&(o+=t.beginInstructionsWidth,g&&(o+=this.rules.RhythmRightMargin)),o}},{key:"addInstructionsAtMeasureEnd",value:function(e,t,n){if(!e||!e.Instructions||0===e.Instructions.length)return 0;for(var r=0,i=e.Instructions.length;r0&&(this.currentSystemParams.systemMeasures.push({beginLine:SystemLinesEnum.None,endLine:SystemLinesEnum.None}),this.currentSystemParams.currentWidth+=o,this.currentSystemParams.currentSystemFixWidth+=o)}},{key:"addExtraInstructionMeasure",value:function(e,t,n){var r=this.currentSystemParams.currentSystem,i=MusicSheetCalculator.symbolFactory.createExtraGraphicalMeasure(r.StaffLines[e]);t&&i.addKeyAtBegin(t,this.activeKeys[e],this.activeClefs[e]),void 0!==n&&n.PrintObject&&i.addRhythmAtBegin(n),i.PositionAndShape.BorderLeft=0,i.PositionAndShape.BorderTop=0,i.PositionAndShape.BorderBottom=this.rules.StaffHeight;var a=this.rules.MeasureLeftMargin+i.beginInstructionsWidth+this.rules.MeasureRightMargin;return i.PositionAndShape.BorderRight=a,r.StaffLines[e].Measures.push(i),a}},{key:"addStaveMeasuresToSystem",value:function(e){if(e[0]){for(var t=[],n=0;n1){var t=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,e.measureListIndex+e.multipleRestMeasures-1);e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[t]}}finally{}var n,r,i=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures,a=i[this.measureListIndex],o=!1;a.allRests&&(o=null===(n=i[this.measureListIndex+a.multipleRestMeasures-1])||void 0===n||null===(r=n.endsWithLineRepetition)||void 0===r?void 0:r.call(n));return this.nextMeasureBeginsLineRepetition()&&this.thisMeasureEndsLineRepetition()?SystemLinesEnum.DotsBoldBoldDots:this.thisMeasureEndsLineRepetition()||o?SystemLinesEnum.DotsThinBold:this.nextMeasureHasKeyInstructionChange()||this.thisMeasureEndsWordRepetition()||this.nextMeasureBeginsWordRepetition()?SystemLinesEnum.DoubleThin:e&&void 0!==e.endingBarStyleEnum?e.endingBarStyleEnum:SystemLinesEnum.SingleThin}},{key:"getLineWidth",value:function(e,t,n){var r=e.getLineWidth(t);return t===SystemLinesEnum.DotsBoldBoldDots&&(r/=2),n&&t===SystemLinesEnum.BoldThinDots&&(r+=this.rules.DistanceBetweenLastInstructionAndRepetitionBarline),r}},{key:"previousMeasureEndsLineRepetition",value:function(){if(0===this.measureListIndex)return!1;for(var e=0,t=this.measureList[this.measureListIndex-1].length;e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||!this.measureList[e])return!1;for(var t=0,n=this.measureList[e].length;t=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||e>this.measureList.length-1)return!1;for(var t=0,n=this.measureList[e].length;t1)for(var a=1;ai&&(i=l)}for(var u=0;uthis.rules.PageHeight-this.rules.PageBottomMargin&&++r<=4&&console.log("warning: could not fit a single system on page ".concat(e.PageNumber," and measure number ").concat(n.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 h,d,f=this.musicSystems[u-1],p=f.StaffLines[f.StaffLines.length-1],v=p.PositionAndShape,m=this.findRequiredDistanceWithSkyBottomLine(f,n);m=Math.max(i,m),m+=this.rules.MinSkyBottomDistBetweenSystems,"GYM"===(null===(h=window)||void 0===h||null===(d=h.appName)||void 0===d?void 0:d.toLocaleUpperCase())&&(m=m<16?16:m);var g=this.hasExpressionCounts(n);g.TempoCount>0&&this.rules.MetronomeMarksDrawn&&(m+=2),g.OtherCount>0&&this.rules.MetronomeMarksDrawn&&(m+=2),m=Math.max(m,this.rules.MinimumDistanceBetweenSystems+p.StaffHeight);var y=t+v.RelativePosition.y+m,b=y+n.PositionAndShape.BorderMarginBottom;if(this.rules.NewPageAtXMLNewPageAttribute&&f.breaksPage||!(b0&&console.log("total amount of pages that couldn't fit a single music system: ".concat(r," of ").concat(e.PageNumber))}},{key:"findRequiredDistanceWithSkyBottomLine",value:function(e,t){for(var n=e.StaffLines[e.StaffLines.length-1],r=t.StaffLines[0],i=n.BottomLine,a=r.SkyLine,o=n.PositionAndShape,s=r.PositionAndShape,l=1/this.rules.SamplingUnit,u=0,c=0;c=a.length)break;for(var f=Math.max(0,d-6),p=Math.min(a.length-1,d+6),v=0,m=f;m<=p;m++)v=Math.min(v,a[m]);var g=h-v;u=Math.max(g,u)}}return 0===u&&(u=o.BorderBottom-s.BorderTop),u}}]),e}(),SystemBuildParameters=function(){function e(){_classCallCheck2(this,e),this.systemMeasures=[],this.systemMeasureIndex=0,this.currentWidth=0,this.currentSystemFixWidth=0,this.currentSystemVarWidth=0,this.maxLabelLength=0}return _createClass2(e,[{key:"IsSystemStartMeasure",value:function(){return 0===this.systemMeasureIndex}}]),e}(),OctaveShiftParams=_createClass2((function e(t,n,r){_classCallCheck2(this,e),this.getOpenOctaveShift=t,this.getAbsoluteStartTimestamp=n,this.getAbsoluteEndTimestamp=r})),AccidentalCalculator=function(){function e(){_classCallCheck2(this,e),this.keySignatureNoteAlterationsDict=new Dictionary,this.currentAlterationsComparedToKeyInstructionList=[],this.currentInMeasureNoteAlterationsDict=new Dictionary}return _createClass2(e,[{key:"ActiveKeyInstruction",get:function(){return this.activeKeyInstruction},set:function(e){this.activeKeyInstruction=e,this.reactOnKeyInstructionChange()}},{key:"doCalculationsAtEndOfMeasure",value:function(){this.currentInMeasureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.clear();var e,t=_createForOfIteratorHelper(this.keySignatureNoteAlterationsDict.keys());try{for(t.s();!(e=t.n()).done;){var n=e.value;this.currentInMeasureNoteAlterationsDict.setValue(n,this.keySignatureNoteAlterationsDict.getValue(n))}}catch(err){t.e(err)}finally{t.f()}}},{key:"checkAccidental",value:function(e,t){if(t){var n=t.FundamentalNote+12*t.Octave,r=this.currentAlterationsComparedToKeyInstructionList.indexOf(n)>=0;if(this.currentInMeasureNoteAlterationsDict.containsKey(n)){if(r&&this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(n),1),this.currentInMeasureNoteAlterationsDict.getValue(n)!==t.AccidentalHalfTones){this.keySignatureNoteAlterationsDict.containsKey(n)&&this.keySignatureNoteAlterationsDict.getValue(n)!==t.AccidentalHalfTones?(this.currentAlterationsComparedToKeyInstructionList.push(n),this.currentInMeasureNoteAlterationsDict.setValue(n,t.AccidentalHalfTones)):t.Accidental!==AccidentalEnum.NONE&&this.currentInMeasureNoteAlterationsDict.remove(n);var i=this.currentInMeasureNoteAlterationsDict.getValue(n);if(t.Accidental===AccidentalEnum.NONE&&(t=.5===Math.abs(i)?new Pitch(t.FundamentalNote,t.Octave,AccidentalEnum.NONE):new Pitch(t.FundamentalNote,t.Octave,AccidentalEnum.NATURAL)),this.isAlterAmbiguousAccidental(t.Accidental)&&!t.AccidentalXml)return;MusicSheetCalculator.symbolFactory.addGraphicalAccidental(e,t)}}else if(t.Accidental!==AccidentalEnum.NONE){if(r||this.currentAlterationsComparedToKeyInstructionList.push(n),this.currentInMeasureNoteAlterationsDict.setValue(n,t.AccidentalHalfTones),this.isAlterAmbiguousAccidental(t.Accidental)&&!t.AccidentalXml)return;MusicSheetCalculator.symbolFactory.addGraphicalAccidental(e,t)}else r&&(t=new Pitch(t.FundamentalNote,t.Octave,AccidentalEnum.NATURAL),this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(n),1),MusicSheetCalculator.symbolFactory.addGraphicalAccidental(e,t))}}},{key:"isAlterAmbiguousAccidental",value:function(e){return e===AccidentalEnum.SLASHFLAT||e===AccidentalEnum.QUARTERTONEFLAT}},{key:"reactOnKeyInstructionChange",value:function(){var e,t=this.activeKeyInstruction.AlteratedNotes;e=this.activeKeyInstruction.Key>0?AccidentalEnum.SHARP:AccidentalEnum.FLAT,this.keySignatureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.length=0;for(var n=-9;n<9;n++)for(var r=0;r0)n=r-1,e.push({startIndex:t,endIndex:n}),t=r;else l.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(n=r,e.push({startIndex:t,endIndex:n}),t=r+1)}}t0?Number(W):6)||D+U>R&&O%2==0?(h.push(O),D=H,O=1):O++}else D>R?(h.push(O),D=H,O=1):O++;N===(j=H>R?V+1:Math.ceil(j))?F+=1:(c.push(F),N=j,F=1)}}c.push(F),h.push(O),h=h.filter(Boolean)}return h.length>1&&1===h[h.length-1]&&(h[h.length-2]=h[h.length-2]-1,h[h.length-1]=h[h.length-1]+1),console.log(h,c),this.buildPreparedMusicSystems(h)}},{key:"buildPreparedMusicSystems",value:function(e){var t=!1;this.currentSystemParams=new SystemBuildParameters,this.currentSystemParams.currentSystem=this.initMusicSystem();for(var n=0,r=this.measureList.length;n0&&this.rules.RenderMultipleRestMeasures){c.isReducedToMultiRest=!0,c.multipleRestMeasureNumber=1;var d=c.multipleRestMeasures-1;l+=d;for(var f=1;f<=d;f++){var p=e.SourceMeasures[c.MeasureNumber-1+f];p.multipleRestMeasureNumber=f+1,p.isReducedToMultiRest=!0,t.push([void 0])}}}if(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures&&this.rules.RenderMultipleRestMeasures){for(var v=void 0,m=0,g=0,y=e.SourceMeasures.length;g0){v.isReducedToMultiRest=!0,v.multipleRestMeasureNumber=1,m++,b.multipleRestMeasureNumber=m,b.isReducedToMultiRest=!0;for(var A=0;A1){v.multipleRestMeasures=m;var S=this.createGraphicalMeasuresForSourceMeasure(v,n,i,o,r);t[v.measureListIndex]=S,m=0,v=void 0}else m=0,v=void 0}if(m>1){v.multipleRestMeasures=m,v.isReducedToMultiRest=!0;var x=this.createGraphicalMeasuresForSourceMeasure(v,n,i,o,r);t[v.measureListIndex]=x,m=0,v=void 0}}var w=r.map((function(e){return e.ClefType===ClefEnum.percussion}));this.handleStaffEntries(w),this.calculateVerticalContainersList(),this.setIndicesToVerticalGraphicalContainers()}},{key:"calculate",value:function(){this.musicSystems=[],this.clearSystemsAndMeasures(),this.clearRecreatedObjects(),this.createGraphicalTies(),this.calculateSheetLabelBoundingBoxes(),this.calculateXLayout(this.graphicalMusicSheet,this.maxInstrNameLabelLength()),this.graphicalMusicSheet.MusicPages.length=0,this.calculateMusicSystems(),GraphicalMusicSheet.transformRelativeToAbsolutePosition(this.graphicalMusicSheet)}},{key:"calculateXLayout",value:function(t,n){var r=0,i=this.rules.MaxInstructionsConstValue;if(this.graphicalMusicSheet.MeasureList.length>0){var a=this.graphicalMusicSheet.MeasureList[0],o=this.calculateMeasureXLayout(a);o=this.calculateMeasureWidthFromStaffEntries(a,o),e.setMeasuresMinStaffEntriesWidth(a,o),r=1.2*o+n+i;for(var s=1;s0)return;var a=t.Measures[i];0!==a.MeasureNumber&&1!==a.MeasureNumber||(n=a.MeasureNumber),r=a!==t.Measures[0]&&this.rules.MeasureNumberLabelXOffset?this.rules.MeasureNumberLabelXOffset:0;var o=this.rules.UseXMLMeasureNumbers&&1===a.MeasureNumber&&1!==a.parentSourceMeasure.getPrintedMeasureNumber();((a.MeasureNumber===n||a.MeasureNumber>=n+this.rules.MeasureNumberLabelOffset)&&!a.parentSourceMeasure.ImplicitMeasure||o)&&((1!==a.MeasureNumber||1===a.MeasureNumber&&a!==t.Measures[0]||o)&&this.calculateSingleMeasureNumberPlacement(a,t,e,r),n=a.MeasureNumber)}else loglevelExports.warn("calculateMeasureNumberPlacement: measure undefined for system.Id "+e.Id)}},{key:"calculateSingleMeasureNumberPlacement",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=e.parentSourceMeasure.getPrintedMeasureNumber().toString(),a=new Label(i),o=new GraphicalLabel(a,this.rules.MeasureNumberLabelHeight,TextAlignmentEnum.LeftBottom,this.rules),s=t.SkyBottomLineCalculator;o.setLabelPositionAndShapeBorders(),o.PositionAndShape.Parent=n.PositionAndShape;var l,u=t.PositionAndShape.RelativePosition.x+e.PositionAndShape.RelativePosition.x-o.PositionAndShape.BorderMarginLeft+r,c=u,h=u-o.PositionAndShape.BorderLeft+o.PositionAndShape.BorderRight,d=(c-=t.PositionAndShape.RelativePosition.x)+.5,f=(h-=t.PositionAndShape.RelativePosition.x)-.5,p=s.getSkyLineMinInRange(d,f);if(e===t.Measures[0]){var v=0;if(n.GroupBrackets.length>0){var m,g=_createForOfIteratorHelper(n.GroupBrackets);try{for(g.s();!(m=g.n()).done;){var y=m.value;v=Math.min(v,y.PositionAndShape.BorderTop)}}catch(err){g.e(err)}finally{g.f()}}l=Math.min(p,v)}else l=p;l=Math.min(0,l),o.PositionAndShape.RelativePosition=new PointF2D(u,l),n.MeasureNumberLabels.push(o)}},{key:"calculateMeasureNumberSkyline",value:function(e){var t,n=e.StaffLines[0],r=_createForOfIteratorHelper(e.MeasureNumberLabels);try{for(r.s();!(t=r.n()).done;){var i=t.value,a=i.PositionAndShape.RelativePosition.x,o=a-i.PositionAndShape.BorderLeft+i.PositionAndShape.BorderRight;a-=n.PositionAndShape.RelativePosition.x,o-=n.PositionAndShape.RelativePosition.x,n.SkyBottomLineCalculator.updateSkyLineInRange(a,o,i.PositionAndShape.RelativePosition.y+i.PositionAndShape.BorderMarginTop)}}catch(err){r.e(err)}finally{r.f()}}},{key:"layoutGraphicalTie",value:function(e,t,n){throw new Error(this.abstractNotImplementedErrorMessage)}},{key:"calculateSingleStaffLineLyricsPosition",value:function(e,t){for(var n=0,r=this.rules.StaffHeight,i=[],a=e.SkyBottomLineCalculator,o=e.Measures.length,s=0;s0){i.push(d),n=Math.max(n,d.LyricsEntries.length);for(var f=d.PositionAndShape.RelativePosition.x+u.x,p=Number.MAX_VALUE,v=Number.MIN_VALUE,m=0;m0){var I=e.PositionAndShape.Size.width,T=i[0].PositionAndShape.RelativePosition.x+i[0].PositionAndShape.BorderMarginLeft+i[0].parentMeasure.PositionAndShape.RelativePosition.x;T=T>I?I:T,a.updateBottomLineInRange(T,I,b)}return i}},{key:"calculateLyricsExtendsAndDashes",value:function(e){for(var t=0,n=e.length;t0||e.UnknownList.length>0){for(var o,s="",l=0,u=e.EntriesList.length;le.length-1&&(loglevelExports.debug("minimum measure to draw index out of range. resetting min measure index to limit."),this.rules.MinMeasureToDrawIndex=e.length-1);for(var t=[],n=this.rules.MinMeasureToDrawIndex,r=e.length;n0)&&(o=a.getSkyLineMinInRange(S,x));var w=0;0===g?(w+=this.rules.ChordSymbolYOffset,w+=.1):w+=this.rules.ChordSymbolYPadding,w*=-1;var _=y.GraphicalLabel;_.PositionAndShape.RelativePosition.y=o+w,_.setLabelPositionAndShapeBorders(),_.PositionAndShape.calculateBoundingBox(),a.updateSkyLineInRange(S,x,o+_.PositionAndShape.BorderMarginTop)}}}catch(err){v.e(err)}finally{v.f()}}}catch(err){d.e(err)}finally{d.f()}}}catch(err){r.e(err)}finally{r.f()}}}catch(err){t.e(err)}finally{t.f()}}},{key:"calculateAlignedChordSymbolsOffset",value:function(e,t){var n,r=Number.MAX_SAFE_INTEGER,i=_createForOfIteratorHelper(e);try{for(i.s();!(n=i.n()).done;){var a,o=n.value,s=_createForOfIteratorHelper(o.graphicalChordContainers);try{for(s.s();!(a=s.n()).done;){var l=a.value,u=o.PositionAndShape,c=l.PositionAndShape,h=c.BorderMarginLeft+u.AbsolutePosition.x,d=c.BorderMarginRight+u.AbsolutePosition.x;r=Math.min(r,t.getSkyLineMinInRange(h,d))}}catch(err){s.e(err)}finally{s.f()}}}catch(err){i.e(err)}finally{i.f()}return r}},{key:"layoutMeasureWithWholeRest",value:function(e,t,n){}},{key:"layoutBeams",value:function(e){}},{key:"layoutArticulationMarks",value:function(e,t,n){}},{key:"layoutOrnament",value:function(e,t,n){}},{key:"calculateRestNotePlacementWithinGraphicalBeam",value:function(e,t,n,r,i){}},{key:"calculateTupletNumbers",value:function(){}},{key:"calculateSlurs",value:function(){}},{key:"calculateDynamicExpressionsForMultiExpression",value:function(e,t,n){}},{key:"calculateGraphicalVerbalContinuousDynamic",value:function(e,t){var n,r=e.Label,i=t.x+r.PositionAndShape.BorderMarginLeft,a=t.x+r.PositionAndShape.BorderMarginRight,o=e.ContinuousDynamic.Placement,s=e.ParentStaffLine.SkyBottomLineCalculator;o===PlacementEnum.Below?(n=s.getBottomLineMaxInRange(i,a),r.PositionAndShape.RelativePosition=new PointF2D(t.x,n-r.PositionAndShape.BorderMarginTop)):(n=s.getSkyLineMinInRange(i,a),r.PositionAndShape.RelativePosition=new PointF2D(t.x,n-r.PositionAndShape.BorderMarginBottom))}},{key:"calculateGraphicalContinuousDynamic",value:function(e,t){var n,r,i=e.ParentStaffLine.ParentStaff.idInMusicSheet,a=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(e.ContinuousDynamic.EndMultiExpression.SourceMeasureParent,i);if(a){e.EndMeasure=a;var o=e.ParentStaffLine,s=a.ParentStaffLine,l=s&&o===s,u=!1;s?u=null==s?void 0:s.isPartOfMultiStaffInstrument():o&&(u=null==o?void 0:o.isPartOfMultiStaffInstrument());var c,h=Fraction$1.createFromFraction(e.ContinuousDynamic.EndMultiExpression.AbsoluteTimestamp),d=this.graphicalMusicSheet.GetVerticalContainerFromTimestamp(h),f=d.getFirstNonNullStaffEntry().parentMeasure,p=f.PositionAndShape.AbsolutePosition.x+f.PositionAndShape.BorderRight,v=new Fraction$1(0,0,0),m=_createForOfIteratorHelper(d.StaffEntries);try{for(m.s();!(c=m.n()).done;){var g,y=c.value,b=null==y||null===(g=y.sourceStaffEntry)||void 0===g?void 0:g.calculateMaxNoteLength();null!=b&&b.gt(v)&&(v=b)}}catch(err){m.e(err)}finally{m.f()}var A=this.getRelativePositionInStaffLineFromTimestamp(h,i,s,u,0),S=Fraction$1.plus(h,v),x=this.getRelativePositionInStaffLineFromTimestamp(S,i,s,u,0);x.x>A.x&&x.xE){var D=_.StaffLines[F].PositionAndShape.RelativePosition.y-o.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;L=this.rules.StaffHeight+D/2}else L=this.rules.WedgePlacementBelowY;L-=this.rules.WedgeOpeningLength/2,l||(N=L);var O=k.getBottomLineMaxInRange(I,B);if(O>L&&(L=O),E<_.StaffLines.length-1){var V=o.findClosestStaffEntry(B),z=o.findClosestStaffEntry(I);z&&V&&z.parentVerticalContainer}l||((O=s.SkyBottomLineCalculator.getBottomLineMaxInRange(T,R))>N&&(N=O),N+=this.rules.WedgeOpeningLength/2,N+=this.rules.WedgeVerticalMargin),L+=this.rules.WedgeOpeningLength/2,L+=this.rules.WedgeVerticalMargin}else if(C===PlacementEnum.Above){if(1===o.ParentStaff.ParentInstrument.Staves.length)L=this.rules.WedgePlacementAboveY;else{var G=0;E>0&&(G=E-1);var H=_.StaffLines[G];L=-(o.PositionAndShape.RelativePosition.y-H.PositionAndShape.RelativePosition.y-this.rules.StaffHeight)/2}L+=this.rules.WedgeOpeningLength/2,l||(N=L);var U=k.getSkyLineMinInRange(I,B);if(U1&&E>0){var j=o.findClosestStaffEntry(I),Q=o.findClosestStaffEntry(B);j&&Q&&j.parentVerticalContainer}l||((U=s.SkyBottomLineCalculator.getSkyLineMinInRange(T,R))-c/2?-c/2:l-e.PositionAndShape.BorderMarginBottom}else s=l-e.PositionAndShape.BorderMarginBottom;e.PositionAndShape.RelativePosition=new PointF2D(t.x,s)}else if(e.Placement===PlacementEnum.Below){var h=o.getBottomLineMaxInRange(i,a),d=r.ParentStaff.ParentInstrument.Staves[r.ParentStaff.ParentInstrument.Staves.length-1];if(r.isPartOfMultiStaffInstrument()&&r.ParentStaff!==d){var f=r.ParentMusicSystem.StaffLines[r.ParentMusicSystem.StaffLines.indexOf(r)+1].PositionAndShape.RelativePosition.y-r.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;s=h+e.PositionAndShape.BorderMarginBottom6&&void 0!==arguments[6]?arguments[6]:TextAlignmentEnum.CenterBottom,s=new Label(n,o);s.fontStyle=r,s.fontHeight=a;var l=new GraphicalLabel(s,a,s.textAlignment,this.rules,e.PositionAndShape),u=1.1;i===PlacementEnum.Below&&(l.Label.textAlignment=TextAlignmentEnum.LeftTop),l.setLabelPositionAndShapeBorders(),l.PositionAndShape.BorderMarginBottom*=u,l.PositionAndShape.BorderMarginTop*=u,l.PositionAndShape.BorderMarginLeft*=u,l.PositionAndShape.BorderMarginRight*=u;var c,h=t.x+l.PositionAndShape.BorderMarginLeft,d=t.x+l.PositionAndShape.BorderMarginRight;d>e.PositionAndShape.Size.width&&(h=(d=e.PositionAndShape.Size.width-this.rules.MeasureRightMargin)-l.PositionAndShape.MarginSize.width,t.x=h-l.PositionAndShape.BorderMarginLeft);var f=e.SkyBottomLineCalculator;return c=i===PlacementEnum.Below?f.getBottomLineMaxInRange(h,d):f.getSkyLineMinInRange(h,d),l.PositionAndShape.RelativePosition=new PointF2D(t.x,c),i===PlacementEnum.Below?f.updateBottomLineInRange(h,d,l.PositionAndShape.BorderMarginBottom+c):f.updateSkyLineInRange(h,d,l.PositionAndShape.BorderMarginTop+c),l}},{key:"calculateTempoExpressionsForMultiTempoExpression",value:function(e,t,n,r){metronomeMarks={};var i=Fraction$1.plus(e.AbsoluteTimestamp,t.Timestamp),a=this.graphicalMusicSheet.MeasureList[n],o=new PointF2D;if(t.ContinuousTempo||t.InstantaneousTempo){if(this.rules.MinMeasureToDrawIndex>0)return;if(!a[0])return;for(var s=a[0].ParentStaffLine,l=a[0].PositionAndShape.RelativePosition.x,u=0,c=0;c0){s=a[c].ParentStaffLine,l=a[c].PositionAndShape.RelativePosition.x,u=c;break}if(o=this.getRelativePositionInStaffLineFromTimestamp(i,u,s,s.isPartOfMultiStaffInstrument(),l),t.EntriesList.length>0&&t.EntriesList[0].Expression instanceof InstantaneousTempoExpression)if(t.EntriesList[0].Expression.Placement=PlacementEnum.Above,s.Measures[0].staffEntries.length>0&&0===Math.abs(o.x-s.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x)&&s.ParentMusicSystem===this.musicSystems[0]){var h=s.Measures[0].FirstInstructionStaffEntry;if(h){var d=h.GraphicalInstructions.last();o.x=d.PositionAndShape.RelativePosition.x}this.rules.CompactMode&&(o.x=s.PositionAndShape.RelativePosition.x+s.Measures[0].PositionAndShape.RelativePosition.x)}var f,p=_createForOfIteratorHelper(t.EntriesList);try{for(p.s();!(f=p.n()).done;){var v=f.value,m=TextAlignmentEnum.CenterBottom;this.rules.CompactMode&&(m=TextAlignmentEnum.LeftBottom);var g=this.calculateLabel(s,o,v.label,t.getFontstyleOfFirstEntry(),v.Expression.Placement,this.rules.UnknownTextHeight,m);if(v.Expression instanceof InstantaneousTempoExpression){var y,b=_createForOfIteratorHelper(s.AbstractExpressions);try{for(b.s();!(y=b.n()).done;){var A=y.value;A instanceof GraphicalInstantaneousTempoExpression&&(A.SourceExpression.Label,v.Expression.Label)}}catch(err){b.e(err)}finally{b.f()}new GraphicalInstantaneousTempoExpression(v.Expression,g).ParentStaffLine||loglevelExports.warn("Adding staffline didn't work"),v.Expression.Enum===TempoEnum.metronomeMark&&(metronomeMarks[n]=v.Expression)}else v.Expression;if(r===e.TempoExpressions.length-1)for(var S=0,x=Object.values(metronomeMarks);S-1&&h.PositionAndShape.ChildElements.splice(d,1),h.FirstInstructionStaffEntry=void 0,h.beginInstructionsWidth=0}if(h.LastInstructionStaffEntry){var f=h.PositionAndShape.ChildElements.indexOf(h.LastInstructionStaffEntry.PositionAndShape);f>-1&&h.PositionAndShape.ChildElements.splice(f,1),h.LastInstructionStaffEntry=void 0,h.endInstructionsWidth=0}}l.Measures=[],l.PositionAndShape.ChildElements=[]}a.StaffLines.length=0,a.PositionAndShape.ChildElements=[]}n.MusicSystems=[],n.PositionAndShape.ChildElements=[]}this.graphicalMusicSheet.MusicPages=[]}},{key:"handleVoiceEntry",value:function(t,n,r,i,a,o,s,l,u){var c=arguments.length>9&&void 0!==arguments[9]?arguments[9]:void 0,h=arguments.length>10&&void 0!==arguments[10]?arguments[10]:void 0;t.StemDirectionXml!==StemDirectionType.Undefined&&this.rules.SetWantedStemDirectionByXml&&void 0!==t.StemDirectionXml?t.WantedStemDirection=t.StemDirectionXml:this.calculateStemDirectionFromVoices(t);var d=n.findOrCreateGraphicalVoiceEntry(t);d.octaveShiftValue=l;var f,p=n.tabStaffEntry;p&&(f=p.findOrCreateGraphicalVoiceEntry(t));for(var v=0,m=t.Notes.length;v-1)){var y=void 0;if(t.IsGrace?y=e.symbolFactory.createGraceNote(g,d,a,this.rules,l):(y=e.symbolFactory.createNote(g,d,a,l,this.rules,void 0),e.stafflineNoteCalculator.trackNote(y)),g.Pitch&&this.checkNoteForAccidental(y,r,a,l),this.resetYPositionForLeadSheet(y.PositionAndShape),n.addGraphicalNoteToListAtCorrectYPosition(d,y),y.PositionAndShape.calculateBoundingBox(),this.leadSheet||(void 0!==g.NoteBeam&&g.PrintObject&&this.handleBeam(y,g.NoteBeam,s),void 0!==g.NoteTuplet&&g.PrintObject&&this.handleTuplet(y,g.NoteTuplet,o)),f){var b=e.symbolFactory.createNote(g,f,a,l,this.rules,void 0);p.addGraphicalNoteToListAtCorrectYPosition(f,b),b.PositionAndShape.calculateBoundingBox(),this.leadSheet||g.NoteTuplet&&this.handleTuplet(b,g.NoteTuplet,o)}}}return t.Articulations.length>0&&this.handleVoiceEntryArticulations(t.Articulations,t,n),t.TechnicalInstructions.length>0&&this.handleVoiceEntryTechnicalInstructions(t.TechnicalInstructions,t,n),t.LyricsEntries.size()>0&&this.handleVoiceEntryLyrics(t,n,i),t.OrnamentContainer&&this.handleVoiceEntryOrnaments(t.OrnamentContainer,t,n),l}},{key:"resetYPositionForLeadSheet",value:function(e){this.leadSheet&&(e.RelativePosition=new PointF2D(e.RelativePosition.x,0))}},{key:"layoutVoiceEntries",value:function(e,t){if(e.PositionAndShape.RelativePosition=new PointF2D(0,0),!this.leadSheet){var n,r=_createForOfIteratorHelper(e.graphicalVoiceEntries);try{for(r.s();!(n=r.n()).done;){var i=n.value.notes;if(0!==i.length){var a=i[0].sourceNote.ParentVoiceEntry,o=void 0!==i[0].sourceNote.Pitch;this.layoutVoiceEntry(a,i,e,o)}}}catch(err){r.e(err)}finally{r.f()}}}},{key:"maxInstrNameLabelLength",value:function(){var e,t=0,n=_createForOfIteratorHelper(this.graphicalMusicSheet.ParentMusicSheet.Instruments);try{for(n.s();!(e=n.n()).done;){var r,i=e.value;if(null!==(r=i.NameLabel)&&void 0!==r&&r.print&&i.Voices.length>0&&i.Voices[0].Visible){var a=i.NameLabel;this.rules.RenderPartNames||(a=new Label("",a.textAlignment,a.font));var o=new GraphicalLabel(a,this.rules.InstrumentLabelTextHeight,TextAlignmentEnum.LeftCenter,this.rules);o.setLabelPositionAndShapeBorders(),t=Math.max(t,o.PositionAndShape.MarginSize.width)}}}catch(err){n.e(err)}finally{n.f()}return this.rules.RenderPartNames?t:0}},{key:"calculateSheetLabelBoundingBoxes",value:function(){var e,t=this.graphicalMusicSheet.ParentMusicSheet,n=this.rules.DefaultColorTitle;if(void 0!==t.Title&&this.rules.RenderTitle){var r=new GraphicalLabel(t.Title,this.rules.SheetTitleHeight,TextAlignmentEnum.CenterBottom,this.rules);r.Label.IsCreditLabel=!0,r.Label.colorDefault=n,this.graphicalMusicSheet.Title=r,r.setLabelPositionAndShapeBorders()}else this.rules.RenderTitle||(this.graphicalMusicSheet.Title=void 0);if(void 0!==t.Subtitle&&this.rules.RenderSubtitle){var i=new GraphicalLabel(t.Subtitle,this.rules.SheetSubtitleHeight,TextAlignmentEnum.CenterCenter,this.rules);i.Label.IsCreditLabel=!0,i.Label.colorDefault=n,this.graphicalMusicSheet.Subtitle=i,i.setLabelPositionAndShapeBorders()}else this.rules.RenderSubtitle||(this.graphicalMusicSheet.Subtitle=void 0);if(void 0!==t.Composer&&this.rules.RenderComposer){var a=new GraphicalLabel(t.Composer,this.rules.SheetComposerHeight,TextAlignmentEnum.RightCenter,this.rules);a.Label.IsCreditLabel=!0,a.Label.colorDefault=n,this.graphicalMusicSheet.Composer=a,a.setLabelPositionAndShapeBorders()}else this.rules.RenderComposer||(this.graphicalMusicSheet.Composer=void 0);if(void 0!==t.Lyricist&&this.rules.RenderLyricist){var o=new GraphicalLabel(t.Lyricist,this.rules.SheetAuthorHeight,TextAlignmentEnum.LeftCenter,this.rules);o.Label.IsCreditLabel=!0,o.Label.colorDefault=n,this.graphicalMusicSheet.Lyricist=o,o.setLabelPositionAndShapeBorders()}else this.rules.RenderLyricist||(this.graphicalMusicSheet.Lyricist=void 0);var s=null===(e=this.graphicalMusicSheet.musicSheet.sourceMeasures)||void 0===e?void 0:e[0];if(s&&s.FirstInstructionsStaffEntries.length>0){for(var l,u,c=s.FirstInstructionsStaffEntries[0],h=0,d=c.Instructions.length;h0&&1===u.graphicalVoiceEntries[0].notes.length){var c=u.graphicalVoiceEntries[0].notes[0];!c.sourceNote.Pitch&&new Fraction$1(1,2).lt(c.sourceNote.Length)&&this.layoutMeasureWithWholeRest(c,u,l)}}}}},{key:"optimizeRestNotePlacement",value:function(e,t){if(0!==e.graphicalVoiceEntries.length){var n=e.graphicalVoiceEntries[0].notes;if(0!==n.length){var r=n[0],i=r.sourceNote.isRest();if(2===e.graphicalVoiceEntries.length){var a=!1,o=e.graphicalVoiceEntries[1].notes;if(o.length>0)a=o[0].sourceNote.isRest();i&&a?this.calculateTwoRestNotesPlacementWithCollisionDetection(e):(i||a)&&this.calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(e)}else if(i&&e!==t.staffEntries[0]&&e!==t.staffEntries[t.staffEntries.length-1]){var s=t.staffEntries.indexOf(e),l=t.staffEntries[s-1],u=t.staffEntries[s+1];if(1===l.graphicalVoiceEntries.length){var c=l.graphicalVoiceEntries[0].notes[0];if(void 0!==c.sourceNote.NoteBeam&&1===u.graphicalVoiceEntries.length){var h=u.graphicalVoiceEntries[0].notes[0];void 0!==h.sourceNote.NoteBeam&&c.sourceNote.NoteBeam===h.sourceNote.NoteBeam&&(this.calculateRestNotePlacementWithinGraphicalBeam(e,r,c,u,h),e.PositionAndShape.calculateBoundingBox())}}}}}}},{key:"getRelativePositionInStaffLineFromTimestamp",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=new PointF2D,o=void 0,s=void 0,l=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,u=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(e),c=Math.min(Math.floor(u),l-1),h=Math.min(Math.ceil(u),l-1);if(c<0||t<0)return a;if(o=this.getFirstLeftNotNullStaffEntryFromContainer(c,t,r),s=this.getFirstRightNotNullStaffEntryFromContainer(h,t,r),o&&s){var d=o.parentMeasure.PositionAndShape.RelativePosition.x;i>0&&(d=i);var f=o.PositionAndShape.RelativePosition.x+d,p=s.PositionAndShape.RelativePosition.x+s.parentMeasure.PositionAndShape.RelativePosition.x;i>0&&(p=s.PositionAndShape.RelativePosition.x+d);var v=0;if(o!==s){var m=o.getAbsoluteTimestamp(),g=s.getAbsoluteTimestamp();v=Fraction$1.minus(e,m).RealValue/Fraction$1.minus(g,m).RealValue}o.parentMeasure.ParentStaffLine!==s.parentMeasure.ParentStaffLine&&(o.parentMeasure.ParentStaffLine===n?p=n.PositionAndShape.Size.width:f=n.PositionAndShape.RelativePosition.x),a=new PointF2D(f+(p-f)*v,0)}return a}},{key:"getRelativeXPositionFromTimestamp",value:function(e){var t=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,n=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(e),r=Math.max(0,Math.min(Math.round(n),t-1)),i=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[r].getFirstNonNullStaffEntry();return i.PositionAndShape.RelativePosition.x+i.parentMeasure.PositionAndShape.RelativePosition.x}},{key:"calculatePageLabels",value:function(e){this.rules.RenderSingleHorizontalStaffline&&(e.PositionAndShape.BorderRight=e.PositionAndShape.Size.width,e.PositionAndShape.calculateBoundingBox(),this.graphicalMusicSheet.ParentMusicSheet.pageWidth=e.PositionAndShape.Size.width);var t=10;if(e.MusicSystems.length>0){var n=e.MusicSystems[0];t=n.PositionAndShape.RelativePosition.y+n.PositionAndShape.BorderTop}if(this.graphicalMusicSheet.Title){var r=this.graphicalMusicSheet.Title;r.PositionAndShape.Parent=e.PositionAndShape;var i=new PointF2D;i.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,i.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight,r.PositionAndShape.RelativePosition=i,e.Labels.push(r)}if(this.graphicalMusicSheet.Subtitle){var a=this.graphicalMusicSheet.Subtitle;a.PositionAndShape.Parent=e.PositionAndShape;var o=new PointF2D;o.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,o.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight+this.rules.SheetMinimumDistanceBetweenTitleAndSubtitle,a.PositionAndShape.RelativePosition=o,e.Labels.push(a)}var s,l=this.graphicalMusicSheet.Composer;if(l){var u;l.PositionAndShape.Parent=e.PositionAndShape,l.setLabelPositionAndShapeBorders();var c=new PointF2D;c.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageRightMargin,c.y=t,c.y-=this.rules.SystemComposerDistance;var h=null===(u=l.TextLines)||void 0===u?void 0:u.length;h>1&&(c.y-=l.PositionAndShape.BorderBottom*(h-1)/h),s=c.y,l.PositionAndShape.RelativePosition=c,e.Labels.push(l)}var d=this.graphicalMusicSheet.Lyricist;if(d){var f;d.PositionAndShape.Parent=e.PositionAndShape,d.setLabelPositionAndShapeBorders();var p=new PointF2D;p.x=this.rules.PageLeftMargin,p.y=t,p.y+=d.PositionAndShape.BorderBottom,p.y=Math.min(p.y,null!==(f=s)&&void 0!==f?f:Number.MAX_SAFE_INTEGER),d.PositionAndShape.RelativePosition=p,e.Labels.push(d)}}},{key:"createGraphicalTies",value:function(){for(var e=0;e=0&&this.staffEntriesWithGraphicalTies.push(i)}i=o}}}},{key:"setTieDirections",value:function(e){if(e){var t=e.ties;if(t.length>1){var n,r=void 0,i=_createForOfIteratorHelper(t);try{for(i.s();!(n=i.n()).done;){var a=n.value.Notes[0];(!r||a.Pitch.getHalfTone()>r.Pitch.getHalfTone())&&(r=a)}}catch(err){i.e(err)}finally{i.f()}var o,s=_createForOfIteratorHelper(t);try{for(s.s();!(o=s.n()).done;){var l=o.value;l.TieDirection===PlacementEnum.NotYetDefined&&(l.Notes[0]===r?l.TieDirection=PlacementEnum.Above:l.TieDirection=PlacementEnum.Below)}}catch(err){s.e(err)}finally{s.f()}}}}},{key:"createAccidentalCalculators",value:function(){var e=[],t=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(t)for(var n=0;n1)return;h=e.symbolFactory.createGraphicalMeasure(t,c)}if(h.hasError=t.getErrorInMeasure(l),t.FirstInstructionsStaffEntries[l])for(var d=0,f=t.FirstInstructionsStaffEntries[l].Instructions.length;d0){var U=E.Instructions[0];e.symbolFactory.createInStaffClef(I,U)}this.rules.RenderChordSymbols&&(null===(k=E.ChordContainers)||void 0===k?void 0:k.length)>0&&(E.ParentStaff.ParentInstrument.HasChordSymbols=!0,e.symbolFactory.createChordSymbols(E,I,i.ActiveKeyInstruction,this.graphicalMusicSheet.ParentMusicSheet.Transpose))}}if(i.doCalculationsAtEndOfMeasure(),t.LastInstructionsStaffEntries[l])for(var j=t.LastInstructionsStaffEntries[l],Q=0,Y=j.Instructions.length;Q=1&&0===h.staffEntries.length){var ne=new SourceStaffEntry(new VerticalSourceStaffEntryContainer(h.parentSourceMeasure,h.parentSourceMeasure.AbsoluteTimestamp,h.parentSourceMeasure.CompleteNumberOfStaves),c),re=new VoiceEntry(new Fraction$1(0,1),c.Voices[0],ne),ie=new Note$1(re,ne,Fraction$1.createFromFraction(t.Duration),void 0,t);ie.PrintObject=this.rules.FillEmptyMeasuresWithWholeRest===FillEmptyMeasuresWithWholeRests.YesVisible,re.addNote(ie);var ae=e.symbolFactory.createStaffEntry(ne,h);h.addGraphicalStaffEntry(ae),ae.relInMeasureTimestamp=re.Timestamp;var oe=e.symbolFactory.createVoiceEntry(re,ae);ae.graphicalVoiceEntries.push(oe);var se=e.symbolFactory.createNote(ie,oe,new ClefInstruction,OctaveEnum.NONE,void 0);e.stafflineNoteCalculator.trackNote(se),oe.notes.push(se)}h.hasOnlyRests=!0;var le,ue=_createForOfIteratorHelper(h.staffEntries);try{for(ue.s();!(le=ue.n()).done;){var ce=le.value;if(h.hasOnlyRests=ce.hasOnlyRests(),!h.hasOnlyRests)break}}catch(err){ue.e(err)}finally{ue.f()}return h}},{key:"checkNoteForAccidental",value:function(e,t,n,r){var i=e.sourceNote.Pitch,a=e.parentVoiceEntry.parentStaffEntry.parentMeasure.getTransposedHalftones();0!==a&&e.sourceNote.ParentStaffEntry.ParentStaff.ParentInstrument.MidiInstrumentId!==MidiInstrument.Percussion&&(i=e.Transpose(t.ActiveKeyInstruction,n,a,r),e.sourceNote.TransposedPitch=i),e.sourceNote.halfTone=i.getHalfTone(),t.checkAccidental(e,i)}},{key:"handleStaffEntries",value:function(t){for(var n=0,r=this.graphicalMusicSheet.MeasureList.length;n0&&c.graphicalVoiceEntries[0].notes.length>0&&(this.layoutVoiceEntries(c,a),this.layoutStaffEntry(c))}}catch(err){u.e(err)}finally{u.f()}this.graphicalMeasureCreatedCalculations(s)}}}},{key:"calculateSkyBottomLines",value:function(){var e,t=_createForOfIteratorHelper(this.musicSystems);try{for(t.s();!(e=t.n()).done;){var n,r=_createForOfIteratorHelper(e.value.StaffLines);try{for(r.s();!(n=r.n()).done;){n.value.SkyBottomLineCalculator.calculateLines()}}catch(err){r.e(err)}finally{r.f()}}}catch(err){t.e(err)}finally{t.f()}}},{key:"calculateExpressionAlignements",value:function(){}},{key:"calculateStaffEntryArticulationMarks",value:function(){for(var e=0,t=this.musicSystems.length;e0&&this.layoutArticulationMarks(p.Articulations,p,h)}}},{key:"calculateOrnaments",value:function(){for(var e=0,t=this.musicSystems.length;e0&&r.LyricVersesNumbers.sort()}for(var i=0,a=this.musicSystems.length;i=0&&(r=t.GraphicalLyricsEntries[n+1]),r){var i=e.StaffEntryParent.parentMeasure.ParentStaffLine,a=r.StaffEntryParent.parentMeasure.ParentStaffLine,o=e.StaffEntryParent,s=r.StaffEntryParent;if(e.StaffEntryParent.parentMeasure.ParentStaffLine===r.StaffEntryParent.parentMeasure.ParentStaffLine){var l=o.parentMeasure.PositionAndShape.RelativePosition.x+o.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,u=s.parentMeasure.PositionAndShape.RelativePosition.x+s.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.RelativePosition.x+r.GraphicalLabel.PositionAndShape.BorderMarginLeft,c=e.GraphicalLabel.PositionAndShape.RelativePosition.y,h=1;u-l>3*this.rules.MinimumDistanceBetweenDashes&&(h=Math.floor((u-l)/this.rules.MinimumDistanceBetweenDashes)-1),1===h?this.calculateSingleDashForLyricWord(i,l,u,c):this.calculateDashes(i,l,u,c)}else{var d=o.parentMeasure.PositionAndShape.RelativePosition.x+o.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,f=i.Measures[i.Measures.length-1],p=f.PositionAndShape.RelativePosition.x+f.PositionAndShape.Size.width,v=e.GraphicalLabel.PositionAndShape.RelativePosition.y;if(this.calculateDashes(i,d,p,v),a&&a.Measures[0]&&s.parentMeasure.ParentStaffLine&&(s!==s.parentMeasure.staffEntries[0]||s.parentMeasure!==s.parentMeasure.ParentStaffLine.Measures[0])){var m=a.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,g=s.parentMeasure.PositionAndShape.RelativePosition.x+s.PositionAndShape.RelativePosition.x+r.GraphicalLabel.PositionAndShape.BorderMarginLeft;v=r.GraphicalLabel.PositionAndShape.RelativePosition.y,this.calculateDashes(a,m,g,v)}}}}},{key:"calculateDashes",value:function(e,t,n,r){var i=n-t;if(i<3*this.rules.MinimumDistanceBetweenDashes)this.calculateSingleDashForLyricWord(e,t,n,r);else{var a=Math.floor(i/this.rules.MinimumDistanceBetweenDashes)-1,o=i/(a+1),s=0;for(t+=o,n-=o;s<=Math.floor(a/2)&&n>t;)i=this.calculateRightAndLeftDashesForLyricWord(e,t,n,r),t+=o,n-=o,s++;i>2*o&&this.calculateSingleDashForLyricWord(e,t,n,r)}}},{key:"calculateSingleDashForLyricWord",value:function(e,t,n,r){var i=new Label("-"),a=new GraphicalLabel(i,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);a.setLabelPositionAndShapeBorders(),e.LyricsDashes.push(a),-1===this.staffLinesWithLyricWords.indexOf(e)&&this.staffLinesWithLyricWords.push(e),a.PositionAndShape.Parent=e.PositionAndShape;var o=new PointF2D(t+(n-t)/2,r);a.PositionAndShape.RelativePosition=o}},{key:"calculateLyricExtend",value:function(e){for(var t=e.GraphicalLabel.PositionAndShape.RelativePosition.y,n=e.StaffEntryParent,r=n.parentMeasure.ParentStaffLine,i=void 0,a=void 0,o=n.parentMeasure.ParentStaff.idInMusicSheet,s=n.parentVerticalContainer.Index+1;s0)break;(a=(i=l).parentMeasure.ParentStaffLine)||(a=n.parentMeasure.ParentStaffLine)}}if(i&&a)if(r===a&&i.parentMeasure.ParentStaffLine){var u=n.parentMeasure.PositionAndShape.RelativePosition.x+n.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,c=i.parentMeasure.PositionAndShape.RelativePosition.x+i.PositionAndShape.RelativePosition.x+i.PositionAndShape.BorderMarginRight;t-=e.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(r,u,c,t)}else{var h=r.Measures[r.Measures.length-1].PositionAndShape,d=n.parentMeasure.PositionAndShape.RelativePosition.x+n.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,f=h.RelativePosition.x+h.Size.width;if(t-=e.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(r,d,f,t),!i)return;if(i.parentMeasure.ParentStaffLine&&i.parentMeasure.staffEntries&&(i!==i.parentMeasure.staffEntries[0]||i.parentMeasure!==i.parentMeasure.ParentStaffLine.Measures[0])){var p=a.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,v=i.parentMeasure.PositionAndShape.RelativePosition.x+i.PositionAndShape.RelativePosition.x+i.PositionAndShape.BorderMarginRight;this.calculateSingleLyricWordWithUnderscore(a,p,v,t)}}}},{key:"calculateSingleLyricWordWithUnderscore",value:function(e,t,n,r){var i=new PointF2D(t,r),a=new PointF2D(n,r),o=new GraphicalLine(i,a,this.rules.LyricUnderscoreLineWidth);e.LyricLines.push(o),-1===this.staffLinesWithLyricWords.indexOf(e)&&this.staffLinesWithLyricWords.push(e)}},{key:"calculateRightAndLeftDashesForLyricWord",value:function(e,t,n,r){var i=new Label("-"),a=new GraphicalLabel(i,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);a.setLabelPositionAndShapeBorders(),e.LyricsDashes.push(a),-1===this.staffLinesWithLyricWords.indexOf(e)&&this.staffLinesWithLyricWords.push(e),a.PositionAndShape.Parent=e.PositionAndShape;var o=new PointF2D(t,r);a.PositionAndShape.RelativePosition=o;var s=new Label("-"),l=new GraphicalLabel(s,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);l.setLabelPositionAndShapeBorders(),e.LyricsDashes.push(l),l.PositionAndShape.Parent=e.PositionAndShape;var u=new PointF2D(n,r);return l.PositionAndShape.RelativePosition=u,l.PositionAndShape.RelativePosition.x-a.PositionAndShape.RelativePosition.x}},{key:"calculateDynamicExpressions",value:function(){for(var e=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex),t=Math.min(this.rules.MinMeasureToDrawIndex,this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length);t<=e;t++){var n=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[t];this.dynamicExpressionMap.clear();for(var r=0;r=0;i--){var a;if(null!==(a=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[i])&&void 0!==a&&a.StaffEntries[t])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[i].StaffEntries[t]}}},{key:"getFirstRightNotNullStaffEntryFromContainer",value:function(e,t,n){var r;if(null!==(r=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[e])&&void 0!==r&&r.StaffEntries[t])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[e].StaffEntries[t];for(var i=e+1;i0||t.StaffLinkedExpressions[n][r].UnknownList.length>0)&&this.calculateMoodAndUnknownExpression(t.StaffLinkedExpressions[n][r],e,n)}},{key:"calculateStemDirectionFromVoices",value:function(e){if(void 0!==e.ParentSourceStaffEntry.Link)return e===e.ParentSourceStaffEntry.VoiceEntries[0]?void(e.WantedStemDirection=StemDirectionType.Up):void(e.WantedStemDirection=StemDirectionType.Down);e.ParentVoice instanceof LinkedVoice?e.WantedStemDirection=StemDirectionType.Down:e.ParentSourceStaffEntry.VoiceEntries.length>1&&(e.WantedStemDirection=StemDirectionType.Up)}},{key:"setBeamNotesWantedStemDirections",value:function(e){if(e.Notes.length>0){var t=e.Notes[0].NoteBeam;if(t){var n,r=_createForOfIteratorHelper(t.Notes);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.ParentVoiceEntry.WantedStemDirection!==StemDirectionType.Undefined&&i.ParentVoiceEntry.ParentSourceStaffEntry.ParentStaff.Id===e.ParentSourceStaffEntry.ParentStaff.Id){e.WantedStemDirection=i.ParentVoiceEntry.WantedStemDirection;break}}}catch(err){r.e(err)}finally{r.f()}}}}}],[{key:"TextMeasurer",get:function(){return e.textMeasurer},set:function(t){e.textMeasurer=t}},{key:"setMeasuresMinStaffEntriesWidth",value:function(e,t){for(var n=0,r=e.length;n0&&(i+="("+o.adds.join(",")+")"),o.alts.length>0&&(i+="(alt "+o.alts.join(",")+")"),o.subs.length>0&&(i+="(omit "+o.subs.join(",")+")"),e.BassPitch){var M=e.BassPitch;MusicSheetCalculator.transposeCalculator&&(M=MusicSheetCalculator.transposeCalculator.transposePitch(e.BassPitch,n,t)),i+="/",i+=Pitch.getNoteEnumString(M.FundamentalNote),i+=this.getTextForAccidental(M.Accidental)}return i}},{key:"getTextForAccidental",value:function(e){var t="";switch(e){case AccidentalEnum.DOUBLEFLAT:t+="bb";break;case AccidentalEnum.FLAT:t+="b";break;case AccidentalEnum.SHARP:t+="#";break;case AccidentalEnum.DOUBLESHARP:t+="x"}return t}}]),e}(),Degree=_createClass2((function e(t,n,r){_classCallCheck2(this,e),this.value=t,this.alteration=n,this.text=r})),CustomChord=function(){function e(t,n,r){_classCallCheck2(this,e),this.alternateName=t,this.chordKind=n,this.degrees=r}return _createClass2(e,null,[{key:"createCustomChord",value:function(t,n,r){return new e(t,n,r)}},{key:"renameCustomChord",value:function(e,t,n){var r,i=_createForOfIteratorHelper(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;a.alternateName===e&&(a.alternateName=t)}}catch(err){i.e(err)}finally{i.f()}}}]),e}(),ChordDegreeText=function(e){return e[e.add=0]="add",e[e.alter=1]="alter",e[e.subtract=2]="subtract",e}(ChordDegreeText||{}),ChordSymbolEnum=function(e){return e[e.major=0]="major",e[e.minor=1]="minor",e[e.augmented=2]="augmented",e[e.diminished=3]="diminished",e[e.dominant=4]="dominant",e[e.majorseventh=5]="majorseventh",e[e.minorseventh=6]="minorseventh",e[e.diminishedseventh=7]="diminishedseventh",e[e.augmentedseventh=8]="augmentedseventh",e[e.halfdiminished=9]="halfdiminished",e[e.majorminor=10]="majorminor",e[e.majorsixth=11]="majorsixth",e[e.minorsixth=12]="minorsixth",e[e.dominantninth=13]="dominantninth",e[e.majorninth=14]="majorninth",e[e.minorninth=15]="minorninth",e[e.dominant11th=16]="dominant11th",e[e.major11th=17]="major11th",e[e.minor11th=18]="minor11th",e[e.dominant13th=19]="dominant13th",e[e.major13th=20]="major13th",e[e.minor13th=21]="minor13th",e[e.suspendedsecond=22]="suspendedsecond",e[e.suspendedfourth=23]="suspendedfourth",e[e.Neapolitan=24]="Neapolitan",e[e.Italian=25]="Italian",e[e.French=26]="French",e[e.German=27]="German",e[e.pedal=28]="pedal",e[e.power=29]="power",e[e.Tristan=30]="Tristan",e[e.none=31]="none",e}(ChordSymbolEnum||{}),GraphicalNote=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i){var a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;return _classCallCheck2(this,n),(a=t.call(this)).DrawnAccidental=AccidentalEnum.NONE,a.lineShift=0,a.sourceNote=e,a.parentVoiceEntry=r,a.PositionAndShape=new BoundingBox$1(_assertThisInitialized2(a),r.PositionAndShape),a.graphicalNoteLength=o||e.Length,a.numberOfDots=a.calculateNumberOfNeededDots(a.graphicalNoteLength),a.rules=i,a.rules.addGraphicalNoteToNoteMap(e,_assertThisInitialized2(a)),a}return _createClass2(n,[{key:"Transpose",value:function(e,t,n,r){var i=this.sourceNote.Pitch;return MusicSheetCalculator.transposeCalculator&&(i=MusicSheetCalculator.transposeCalculator.transposePitch(this.sourceNote.Pitch,e,n)),i}},{key:"calculateNumberOfNeededDots",value:function(e){return this.sourceNote&&this.sourceNote.NoteTuplet?0:e.calculateNumberOfNeededDots()}},{key:"ParentMusicPage",get:function(){return this.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentMusicSystem.Parent}}],[{key:"FromNote",value:function(e,t){return t.NoteToGraphicalNoteMap.getValue(e.NoteToGraphicalNoteObjectId)}}]),n}(GraphicalObject),_EngravingRules=function(){function e(){_classCallCheck2(this,e),this.DYSlursStartingAtSameStaffEntryYOffset=0,this.DYMinNoteWidth=0,this.DYWorkId=0,this.DYWorkSpecial=!1,this.DYContainerId="osmdCanvasPage",this.DYSVGContainerId="osmdSvgPage",this.DYMusicScoreType="staff",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.PlayAlreadyStartedNotesFromCursorPosition=!1,this.PlaybackSkipNotesSafetyInterval=.02,this.UseDefaultVoiceInteractionListener=!0,this.loadDefaultValues()}return _createClass2(e,[{key:"loadDefaultValues",value:function(){this.SamplingUnit=3*e.unit,this.MpatMode=!0,this.SheetTitleHeight=4,this.SheetSubtitleHeight=2,this.SheetMinimumDistanceBetweenTitleAndSubtitle=1,this.SheetComposerHeight=2,this.SheetAuthorHeight=2,this.CompactMode=!1,this.PagePlacementEnum=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.AutoBeamTabs=!1,this.BeamWidth=e.unit/2,this.BeamSpaceWidth=e.unit/3,this.BeamForwardLength=1.25*e.unit,this.FlatBeams=!1,this.FlatBeamOffset=20,this.FlatBeamOffsetPerBeam=10,this.ClefLeftMargin=.5,this.ClefRightMargin=.75,this.PercussionOneLineCutoff=3,this.PercussionForceVoicesOneLineCutoff=1,this.PercussionUseXMLDisplayStep=!0,this.PercussionXMLDisplayStepNoteValueShift=0,this.PercussionOneLineXMLDisplayStepOctaveOffset=0,this.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.WedgeEndDistanceBetweenTimestampsFactor=1.75,this.DistanceBetweenAdjacentDynamics=.75,this.TempoChangeMeasureValidity=4,this.TempoContinousFactor=.7,this.StaccatoScalingFactor=.8,this.BetweenDotsDistance=.8,this.OrnamentAccidentalScalingFactor=.65,this.ChordSymbolTextHeight=2,this.ChordSymbolTextAlignment=TextAlignmentEnum.LeftBottom,this.ChordSymbolRelativeXOffset=-1,this.ChordSymbolXSpacing=1,this.ChordOverlapAllowedIntoNextMeasure=0,this.ChordSymbolYOffset=.1,this.ChordSymbolYPadding=0,this.ChordSymbolYAlignment=!0,this.ChordSymbolYAlignmentScope="staffline",this.ChordSymbolLabelTexts=new 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.SlurMaximumYControlPointDistance=void 0,this.RepetitionEndingLabelHeight=2,this.RepetitionEndingLabelXOffset=.5,this.RepetitionEndingLabelYOffset=.3,this.RepetitionEndingLineYLowerOffset=.5,this.RepetitionEndingLineYUpperOffset=.3,this.VoltaOffset=2.5,this.LyricsAlignmentStandard=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/2,this.DistanceBetweenVerticalSystemLines=.35,this.DistanceBetweenDotAndLine=.7,this.RepeatEndStartPadding=2,this.OctaveShiftLineWidth=.12,this.OctaveShiftVerticalLineLength=e.unit,this.GraceLineWidth=this.StaffLineWidth*this.GraceNoteScalingFactor,this.MultipleRestMeasureDefaultWidth=4,this.MinimumCrossedBeamDifferenceMargin=1e-4,this.SheetMaximumWidth=32767,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.StaggerSameWholeNotes=!0,this.AlignRests=AlignRestOption.Never,this.RestCollisionYPadding=0,this.FillEmptyMeasuresWithWholeRest=FillEmptyMeasuresWithWholeRests.No,this.ArpeggiosGoAcrossVoices=!1,this.RenderArpeggios=!0,this.RenderSlurs=!0,this.ColoringMode=ColoringModes.XML,this.ColoringEnabled=!0,this.ColorStemsLikeNoteheads=!1,this.ColorBeams=!0,this.ColorFlags=!0,this.applyDefaultColorMusic("#000000"),this.DefaultColorCursor="#33e02f",this.DefaultFontFamily="Times New Roman",this.DefaultFontStyle=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.RenderClefsAtBeginningOfStaffline=!0,this.RenderKeySignatures=!0,this.RenderTimeSignatures=!0,this.ArticulationPlacementFromXML=!0,this.FingeringPosition=PlacementEnum.AboveOrBelow,this.FingeringPositionFromXML=!0,this.FingeringPositionGrace=PlacementEnum.Left,this.FingeringInsideStafflines=!1,this.FingeringLabelFontHeight=1.7,this.FingeringOffsetX=0,this.FingeringOffsetY=0,this.FingeringPaddingY=-.2,this.FingeringTextSize=1.5,this.RenderStringNumbersClassical=!0,this.StringNumberOffsetY=0,this.NewSystemAtXMLNewSystemAttribute=!1,this.NewPageAtXMLNewPageAttribute=!1,this.RestoreCursorAfterRerender=!0,this.StretchLastSystemLine=!1,e.FixStafflineBoundingBox=!1,this.PageFormat=PageFormat.UndefinedPageFormat,this.PageBackgroundColor=void 0,this.PerformanceMode=!1,this.RenderSingleHorizontalStaffline=!1,this.SpacingBetweenTextLines=0,this.NoteToGraphicalNoteMap=new Dictionary,this.NoteToGraphicalNoteMapObjectCount=0;try{this.MaxInstructionsConstValue=this.ClefLeftMargin+this.ClefRightMargin+this.KeyRightMargin+this.RhythmRightMargin+11}catch(t){loglevelExports.info("EngravingRules()",t)}this.MpatMode&&(this.NewPartAndSystemAfterFinalBarline=!0)}},{key:"applyDefaultColorMusic",value:function(e){this.DefaultColorMusic=e,this.DefaultColorNotehead=this.DefaultColorMusic,this.DefaultColorRest=this.DefaultColorNotehead,this.DefaultColorStem=this.DefaultColorNotehead,this.DefaultColorLabel=this.DefaultColorNotehead,this.DefaultColorTitle=this.DefaultColorNotehead,this.LedgerLineColorDefault=this.DefaultColorNotehead}},{key:"addGraphicalNoteToNoteMap",value:function(e,t){e.NoteToGraphicalNoteObjectId=this.NoteToGraphicalNoteMapObjectCount,this.NoteToGraphicalNoteMap.setValue(e.NoteToGraphicalNoteObjectId,t),this.NoteToGraphicalNoteMapObjectCount++}},{key:"GNote",value:function(e){return GraphicalNote.FromNote(e,this)}},{key:"clearMusicSheetObjects",value:function(){this.NoteToGraphicalNoteMap=new Dictionary,this.NoteToGraphicalNoteMapObjectCount=0}},{key:"setChordSymbolLabelText",value:function(e,t){this.ChordSymbolLabelTexts.setValue(e,t)}},{key:"resetChordSymbolLabelTexts",value:function(e){return e.setValue(ChordSymbolEnum.minor,"m"),e.setValue(ChordSymbolEnum.augmented,"aug"),e.setValue(ChordSymbolEnum.diminished,"dim"),e.setValue(ChordSymbolEnum.dominant,"7"),e.setValue(ChordSymbolEnum.majorseventh,"maj7"),e.setValue(ChordSymbolEnum.minorseventh,"m7"),e.setValue(ChordSymbolEnum.diminishedseventh,"dim7"),e.setValue(ChordSymbolEnum.augmentedseventh,"aug7"),e.setValue(ChordSymbolEnum.halfdiminished,"m7b5"),e.setValue(ChordSymbolEnum.majorminor,"m(maj7)"),e.setValue(ChordSymbolEnum.majorsixth,"maj6"),e.setValue(ChordSymbolEnum.minorsixth,"m6"),e.setValue(ChordSymbolEnum.dominantninth,"9"),e.setValue(ChordSymbolEnum.majorninth,"maj9"),e.setValue(ChordSymbolEnum.minorninth,"m9"),e.setValue(ChordSymbolEnum.dominant11th,"11"),e.setValue(ChordSymbolEnum.major11th,"maj11"),e.setValue(ChordSymbolEnum.minor11th,"m11"),e.setValue(ChordSymbolEnum.dominant13th,"13"),e.setValue(ChordSymbolEnum.major13th,"maj13"),e.setValue(ChordSymbolEnum.minor13th,"m13"),e.setValue(ChordSymbolEnum.suspendedsecond,"sus2"),e.setValue(ChordSymbolEnum.suspendedfourth,"sus4"),e.setValue(ChordSymbolEnum.power,"5"),e.setValue(ChordSymbolEnum.none,"N.C."),e}},{key:"addChordName",value:function(e,t,n,r,i){if(void 0!==ChordSymbolEnum[t]){var a={adds:n,alts:r,subs:i};this.CustomChords.push(CustomChord.createCustomChord(e,ChordSymbolEnum[t],a))}}},{key:"renameChord",value:function(e,t){CustomChord.renameCustomChord(e,t,this.CustomChords)}},{key:"resetChordNames",value: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"],[],[])}},{key:"calculateCurveParametersArrays",value: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 e=0;e2&&void 0!==arguments[2]?arguments[2]:"noIdStringGiven";_classCallCheck2(this,e),this.width=t,this.height=n,this.idString=r}return _createClass2(e,[{key:"aspectRatio",get:function(){return this.IsUndefined?0:this.width/this.height}},{key:"IsUndefined",get:function(){return void 0===this.width||void 0===this.height||0===this.height||0===this.width}},{key:"Equals",value:function(e){return!!e&&(e.width===this.width&&e.height===this.height)}}],[{key:"UndefinedPageFormat",get:function(){return new e(0,0)}}]),e}(),ColoringModes=function(e){return e[e.XML=0]="XML",e[e.AutoColoring=1]="AutoColoring",e[e.CustomColorSet=2]="CustomColorSet",e}(ColoringModes||{}),DrawingParametersEnum=function(e){return e.allon="allon",e.compact="compact",e.compacttight="compacttight",e.default="default",e.leadsheet="leadsheet",e.preview="preview",e.thumbnail="thumbnail",e}(DrawingParametersEnum||{}),DrawingParameters=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";_classCallCheck2(this,e),this.rules=new EngravingRules,this.drawCursors=!0,this.drawTitle=!0,this.drawSubtitle=!0,this.drawLyricist=!0,this.drawComposer=!0,this.drawCredits=!0,this.drawPartNames=!0,this.fingeringPosition=PlacementEnum.Left,this.drawHiddenNotes=!1,this.DrawingParametersEnum=t}return _createClass2(e,[{key:"DrawingParametersEnum",get:function(){return this.drawingParametersEnum},set:function(e){switch(this.drawingParametersEnum=e,e){case"allon":this.setForAllOn();break;case"thumbnail":this.setForThumbnail();break;case"leadsheet":this.setForLeadsheet();break;case"compact":this.setForCompactMode();break;case"compacttight":this.setForCompactTightMode();break;default:this.setForDefault()}}},{key:"setForAllOn",value:function(){this.drawHighlights=!0,this.drawErrors=!0,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!0,this.drawScrollIndicator=!0,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0,this.DrawTitle=!0,this.DrawSubtitle=!0,this.DrawComposer=!0,this.DrawLyricist=!0,this.drawCredits=!0,this.DrawPartNames=!0,this.drawHiddenNotes=!0,this.rules.CompactMode=!1}},{key:"setForDefault",value:function(){this.rules.loadDefaultValues(),this.setForAllOn(),this.drawHiddenNotes=!1}},{key:"setForThumbnail",value:function(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!1,this.drawSelectionStartSymbol=!1,this.drawCursors=!1,this.drawActivitySymbols=!1,this.drawScrollIndicator=!1,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0,this.drawHiddenNotes=!1}},{key:"setForCompactMode",value:function(){this.rules.CompactMode=!0,this.DrawCredits=!1,this.drawHiddenNotes=!1}},{key:"setForCompactTightMode",value:function(){this.setForCompactMode(),this.DrawPartNames=!1,this.rules.VoiceSpacingMultiplierVexflow=.65,this.rules.VoiceSpacingAddendVexflow=2,this.rules.MinSkyBottomDistBetweenStaves=1,this.rules.MinSkyBottomDistBetweenSystems=1,this.rules.BetweenStaffDistance=2.5,this.rules.StaffDistance=3.5,this.rules.MinimumDistanceBetweenSystems=1,this.rules.PageBottomMargin=0,this.rules.PageLeftMargin=2,this.rules.PageRightMargin=2}},{key:"setForLeadsheet",value:function(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!1,this.drawScrollIndicator=!0,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0}},{key:"DrawCredits",get:function(){return this.drawCredits},set:function(e){this.drawCredits=e,this.DrawComposer=e,this.DrawTitle=e,this.DrawSubtitle=e,this.DrawLyricist=e}},{key:"DrawTitle",get:function(){return this.drawTitle},set:function(e){this.drawTitle=e,this.rules.RenderTitle=e,e||(this.DrawSubtitle=!1)}},{key:"DrawSubtitle",get:function(){return this.drawSubtitle},set:function(e){this.drawSubtitle=e,this.rules.RenderSubtitle=e,e&&(this.DrawTitle=!0)}},{key:"DrawComposer",get:function(){return this.drawComposer},set:function(e){this.drawComposer=e,this.rules.RenderComposer=e}},{key:"DrawLyricist",get:function(){return this.drawLyricist},set:function(e){this.drawLyricist=e,this.rules.RenderLyricist=e}},{key:"DrawPartNames",get:function(){return this.drawPartNames},set:function(e){this.drawPartNames=e,this.rules.RenderPartNames=e,this.rules.RenderPartNames||(this.rules.RenderPartAbbreviations=!1)}},{key:"FingeringPosition",get:function(){return this.fingeringPosition},set:function(e){this.fingeringPosition=e,this.rules.FingeringPosition=e}},{key:"Rules",get:function(){return this.rules},set:function(e){this.rules=e}}]),e}(),AlignRestOption=function(e){return e[e.Never=0]="Never",e[e.Always=1]="Always",e[e.Auto=2]="Auto",e}(AlignRestOption||{}),FillEmptyMeasuresWithWholeRests=function(e){return e[e.No=0]="No",e[e.YesVisible=1]="YesVisible",e[e.YesInvisible=2]="YesInvisible",e}(FillEmptyMeasuresWithWholeRests||{}),BackendType=function(e){return e[e.SVG=0]="SVG",e[e.Canvas=1]="Canvas",e}(BackendType||{}),OSMDOptions=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,null,[{key:"OSMDOptionsStandard",value:function(){return{autoResize:!0,backend:"svg",drawingParameters:DrawingParametersEnum.default}}},{key:"BackendTypeFromString",value:function(e){return e&&"canvas"===e.toLowerCase()?1:0}}]),e}(),IXmlElement=function(){function e(t){if(_classCallCheck2(this,e),this.hasAttributes=!1,!t)throw new Error("IXmlElement: expected Element, got undefined");this.elem=t,this.name=t.nodeName.toLowerCase(),t.hasAttributes()&&(this.hasAttributes=!0,this.firstAttribute=t.attributes[0]),this.hasElements=t.hasChildNodes(),1===t.childNodes.length&&t.childNodes[0].nodeType===Node.TEXT_NODE?this.value=t.childNodes[0].nodeValue:this.value=""}return _createClass2(e,[{key:"attribute",value:function(e){return this.elem.attributes.getNamedItem(e)}},{key:"attributes",value:function(){if(!this.attrs){for(var e=this.elem.attributes,t=[],n=0;n0&&this.Voices[0].Visible},set:function(e){for(var t=0,n=this.Voices.length;t-1&&this.parent.MusicSystems.splice(t,1)}this.parent=e,this.boundingBox.Parent=e.PositionAndShape}},{key:"NextSystem",get:function(){var e=this.Parent.MusicSystems.indexOf(this);return e!==this.Parent.MusicSystems.length?this.Parent.MusicSystems[e+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:"SystemLines",get:function(){return this.systemLines}},{key:"Id",get:function(){return this.id}},{key:"createSystemLeftLine",value:function(e,t,n){var r=-e/2;n&&(r=this.maxLabelLength+t-e/2);var i=this.staffLines[0].Measures[0],a=void 0;this.staffLines.length>1&&(a=this.staffLines[this.staffLines.length-1].Measures[0]);var o=this.createSystemLine(r,e,SystemLinesEnum.SingleThin,SystemLinePosition.MeasureBegin,this,i,a);this.SystemLines.push(o),o.PositionAndShape.RelativePosition=new PointF2D(r,0),o.PositionAndShape.BorderLeft=0,o.PositionAndShape.BorderRight=e,o.PositionAndShape.BorderTop=0,o.PositionAndShape.BorderBottom=this.boundingBox.Size.height,this.createLinesForSystemLine(o)}},{key:"createVerticalLineForMeasure",value:function(e,t,n,r,i,a){var o=a.ParentStaffLine,s=new PointF2D(o.PositionAndShape.RelativePosition.x,o.PositionAndShape.RelativePosition.y),l=o.ParentStaff.ParentInstrument.Staves;if(o.ParentStaff===l[0]){var u=void 0;l.length>1&&(u=this.getBottomStaffLine(o).Measures[i]);var c=this.createSystemLine(e,t,n,r,this,a,u),h=s.x+e;c.PositionAndShape.RelativePosition=new PointF2D(h,0),c.PositionAndShape.BorderLeft=0,c.PositionAndShape.BorderRight=t,this.SystemLines.push(c)}}},{key:"setYPositionsToVerticalLineObjectsAndCreateLines",value:function(e){}},{key:"calculateBorders",value:function(e){}},{key:"alignBeginInstructions",value:function(){}},{key:"GetLeftBorderAbsoluteXPosition",value:function(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].Measures[0].beginInstructionsWidth}},{key:"GetRightBorderAbsoluteXPosition",value:function(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].StaffLines[0].End.x}},{key:"AddGraphicalMeasures",value:function(e){for(var t=0,n=e.length;t1){for(var a=void 0,o=void 0,s=0,l=this.staffLines.length;s3&&void 0!==arguments[3]&&arguments[3],i=t,a=0,o=this.staffLines.length;athis.maxLabelLength&&(this.maxLabelLength=m.PositionAndShape.Size.width,t=i))}this.updateMusicSystemStaffLineXPosition(t)}},{key:"setMusicSystemLabelsYPosition",value:function(){var e=this;this.labels.forEach((function(t,n){for(var r=0,i=0,a=0;a0&&(n.PositionAndShape.RelativePosition=new PointF2D(0,r/i+2))}))}},{key:"checkStaffEntriesForStaffEntryLink",value:function(){for(var e=!1,t=!1,n=0;n=0;n--){if(!((t=e.InstrumentalGroups[n])instanceof Instrument))return this.findLastVisibleInstrumentInInstrumentalGroup(t);if(!0===t.Visible)return t}}},{key:"updateMusicSystemStaffLineXPosition",value:function(e){for(var t=0,n=this.StaffLines.length;t4&&void 0!==arguments[4]?arguments[4]:void 0;return _classCallCheck2(this,n),(o=t.call(this)).lineType=e,o.linePosition=r,o.parentMusicSystem=i,o.topMeasure=a,o.bottomMeasure=s,o.parentTopStaffLine=null==a?void 0:a.ParentStaffLine,o.boundingBox=new BoundingBox$1(_assertThisInitialized2(o),i.PositionAndShape),o}return _createClass2(n,null,[{key:"getObjectWidthForLineType",value:function(e,t){switch(t){case SystemLinesEnum.SingleThin:return e.SystemThinLineWidth;case SystemLinesEnum.DoubleThin:return 2*e.SystemThinLineWidth+e.DistanceBetweenVerticalSystemLines;case SystemLinesEnum.ThinBold:return e.SystemThinLineWidth+e.SystemBoldLineWidth+e.DistanceBetweenVerticalSystemLines;case SystemLinesEnum.BoldThinDots:case SystemLinesEnum.DotsThinBold:return e.SystemThinLineWidth+e.SystemBoldLineWidth+e.DistanceBetweenVerticalSystemLines+e.SystemDotWidth+e.DistanceBetweenDotAndLine;case SystemLinesEnum.DotsBoldBoldDots:return 2*e.SystemBoldLineWidth+2*e.SystemDotWidth+2*e.DistanceBetweenDotAndLine+e.DistanceBetweenVerticalSystemLines;default:return 0}}}]),n}(GraphicalObject),VF$b=Vex.Flow,VexFlowInstrumentBracket=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;_classCallCheck2(this,n),(i=t.call(this)).Visible=!0,i.PositionAndShape=new BoundingBox$1(_assertThisInitialized2(i),e.ParentMusicSystem.PositionAndShape);var o=e.Measures[0],s=r.Measures[0];return i.addConnector(o.getVFStave(),s.getVFStave(),VF$b.StaveConnector.type.BRACKET,a),i}return _createClass2(n,[{key:"draw",value:function(e){this.Visible&&this.vexflowConnector.setContext(e).draw();var t=this.vexflowConnector,n=t.top_stave.getYForLine(0),r=t.bottom_stave.getYForLine(t.bottom_stave.getNumLines()-1)+t.thickness;this.PositionAndShape.AbsolutePosition.x=(t.top_stave.getX()-2+t.x_shift)/unitInPixels,this.PositionAndShape.AbsolutePosition.y=n/unitInPixels,this.PositionAndShape.Size.height=(r-n)/unitInPixels,this.PositionAndShape.Size.width=12/unitInPixels}},{key:"addConnector",value:function(e,t,n,r){this.vexflowConnector=new VF$b.StaveConnector(e,t).setType(n).setXShift(-5*r)}}]),n}(GraphicalObject),VF$a=Vex.Flow,VexFlowInstrumentBrace=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return _classCallCheck2(this,n),(i=t.call(this,e,r,a)).vexflowConnector.setType(VF$a.StaveConnector.type.BRACE),i}return _createClass2(n)}(VexFlowInstrumentBracket),VexFlowMusicSystem=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i;return _classCallCheck2(this,n),(i=t.call(this,e)).rules=r,i}return _createClass2(n,[{key:"calculateBorders",value:function(e){if(0!==this.staffLines.length){var t=this.calcBracketsWidth();this.boundingBox.BorderLeft=-t,this.boundingBox.BorderMarginLeft=-t,this.boundingBox.XBordersHaveBeenSet=!0;var n=this.staffLines[0].SkyBottomLineCalculator.getSkyLineMin();this.boundingBox.BorderTop=n,this.boundingBox.BorderMarginTop=n;var r=this.staffLines[this.staffLines.length-1],i=r.SkyBottomLineCalculator.getBottomLineMax()+r.PositionAndShape.RelativePosition.y;this.boundingBox.BorderBottom=i,this.boundingBox.BorderMarginBottom=i,this.boundingBox.XBordersHaveBeenSet=!0,this.boundingBox.YBordersHaveBeenSet=!0}}},{key:"createSystemLine",value:function(e,t,n,r,i,a){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:void 0,s=a,l=!1;if(o&&(l=!0,o.lineTo(a,VexFlowConverter.line(n,r)),o.addMeasureLine(n,r),n===SystemLinesEnum.DotsBoldBoldDots)){var u=o.ParentStaffLine.Measures.indexOf(o)+1,c=o.ParentStaffLine.Measures[u],h=a.ParentStaffLine.Measures[u];c&&h&&(c.lineTo(h,VexFlowConverter.line(SystemLinesEnum.BoldThinDots,r)),c.addMeasureLine(SystemLinesEnum.BoldThinDots,r))}return s&&s.addMeasureLine(n,r,l),new SystemLine(n,r,this,a,o)}},{key:"createInstrumentBracket",value:function(e,t){var n=new VexFlowInstrumentBrace(e,t);this.InstrumentBrackets.push(n)}},{key:"createGroupBracket",value:function(e,t,n){var r=e,i=t;if(0===n){var a=new VexFlowInstrumentBracket(r,i,n);this.GroupBrackets.push(a)}else{var o=new VexFlowInstrumentBrace(r,i,n);this.GroupBrackets.push(o)}}}]),n}(MusicSystem),GraphicalMeasure=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return _classCallCheck2(this,n),(e=t.call(this)).hasOnlyRests=!1,e.measureNumber=-1,e.ShowTimeSignature=!0,e.parentStaff=r,e.parentSourceMeasure=i,e.parentStaffLine=a,a?(e.parentStaff=a.ParentStaff,e.PositionAndShape=new BoundingBox$1(_assertThisInitialized2(e),a.PositionAndShape)):e.PositionAndShape=new BoundingBox$1(_assertThisInitialized2(e)),e.PositionAndShape.BorderBottom=4,e.parentSourceMeasure&&(e.measureNumber=e.parentSourceMeasure.MeasureNumber),e.staffEntries=[],e}return _createClass2(n,[{key:"ParentStaff",get:function(){return this.parentStaff}},{key:"ParentMusicSystem",get:function(){return this.parentMusicSystem},set:function(e){this.parentMusicSystem=e}},{key:"MeasureNumber",get:function(){return this.measureNumber}},{key:"FirstInstructionStaffEntry",get:function(){return this.firstInstructionStaffEntry},set:function(e){this.firstInstructionStaffEntry=e}},{key:"LastInstructionStaffEntry",get:function(){return this.lastInstructionStaffEntry},set:function(e){this.lastInstructionStaffEntry=e}},{key:"ParentStaffLine",get:function(){return this.parentStaffLine},set:function(e){this.parentStaffLine=e,this.parentStaffLine&&(this.PositionAndShape.Parent=this.parentStaffLine.PositionAndShape)}},{key:"resetLayout",value:function(){throw new Error("not implemented")}},{key:"getLineWidth",value:function(e){throw new Error("not implemented")}},{key:"addClefAtBegin",value:function(e){throw new Error("not implemented")}},{key:"addKeyAtBegin",value:function(e,t,n){throw new Error("not implemented")}},{key:"addRhythmAtBegin",value:function(e){throw new Error("not implemented")}},{key:"addClefAtEnd",value:function(e){throw new Error("not implemented")}},{key:"setPositionInStaffline",value:function(e){this.PositionAndShape.RelativePosition=new PointF2D(e,0)}},{key:"setWidth",value:function(e){this.PositionAndShape.BorderRight=e}},{key:"layoutSymbols",value:function(){throw new Error("not implemented")}},{key:"findGraphicalStaffEntryFromTimestamp",value:function(e){for(var t=0,n=this.staffEntries.length;t1}},{key:"isVisible",value:function(){return this.ParentStaff.ParentInstrument.Visible}},{key:"getGraphicalMeasureDurationFromStaffEntries",value:function(){for(var e=new Fraction$1(0,1),t=[],n=0,r=this.staffEntries.length;n0&&d.Add(m.notes[0].graphicalNoteLength)}}catch(err){v.e(err)}finally{v.f()}}}catch(err){f.e(err)}finally{f.f()}e.lt(d)&&(e=Fraction$1.createFromFraction(d))}return e}},{key:"addGraphicalStaffEntry",value:function(e){this.staffEntries.push(e)}},{key:"addGraphicalStaffEntryAtTimestamp",value:function(e){if(e)if(0===this.staffEntries.length||this.staffEntries[this.staffEntries.length-1].relInMeasureTimestamp.lt(e.relInMeasureTimestamp))this.staffEntries.push(e);else for(var t=this.staffEntries.length-1;t>=0;t--){if(this.staffEntries[t].relInMeasureTimestamp.lt(e.relInMeasureTimestamp)){this.staffEntries.splice(t+1,0,e);break}0===t&&this.staffEntries.splice(t,0,e)}}},{key:"isPianoRightHand",value:function(){return this.isUpperStaffOfInstrument()}},{key:"isPianoLeftHand",value:function(){return this.isLowerStaffOfInstrument()}},{key:"isUpperStaffOfInstrument",value:function(){return 1===this.parentStaff.ParentInstrument.Staves.length||this.ParentStaff===this.parentStaff.ParentInstrument.Staves[0]}},{key:"isLowerStaffOfInstrument",value:function(){return 1!==this.parentStaff.ParentInstrument.Staves.length&&this.ParentStaff===this.ParentStaff.ParentInstrument.Staves.last()}},{key:"beginsWithLineRepetition",value:function(){var e=this.parentSourceMeasure;return!!e&&e.beginsWithLineRepetition()}},{key:"endsWithLineRepetition",value:function(){var e=this.parentSourceMeasure;return!!e&&e.endsWithLineRepetition()}},{key:"beginsWithWordRepetition",value:function(){var e=this.parentSourceMeasure;return!!e&&e.beginsWithWordRepetition()}},{key:"endsWithWordRepetition",value:function(){var e=this.parentSourceMeasure;return!!e&&e.endsWithWordRepetition()}},{key:"getTransposedHalftones",value:function(){return this.parentStaff.ParentInstrument.GetMusicSheet.Transpose+this.parentStaff.ParentInstrument.Transpose}}]),n}(GraphicalObject),VexFlowVoiceEntry=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){return _classCallCheck2(this,n),t.call(this,e,r)}return _createClass2(n,[{key:"applyBordersFromVexflow",value:function(){var e=this.vfStaveNote;if(e.getNoteHeadBeginX){var t=e.getBoundingBox(),n=e.getNoteHeadBeginX()-t.x;this.PositionAndShape.RelativePosition.y=t.y/unitInPixels,this.PositionAndShape.BorderTop=0,this.PositionAndShape.BorderBottom=t.h/unitInPixels,this.PositionAndShape.BorderLeft=-(n+e.width/2)/unitInPixels,this.PositionAndShape.BorderRight=(t.w-n)/unitInPixels}}},{key:"vfStaveNote",get:function(){return this.mVexFlowStaveNote},set:function(e){this.mVexFlowStaveNote=e}},{key:"color",value:function(){for(var e,t,n=this.rules.DefaultColorNotehead,r=this.rules.DefaultColorRest,i=this.rules.DefaultColorStem,a="#00000000",o=this.vfStaveNote,s=0;s1&&void 0!==arguments[1]?arguments[1]:void 0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return _classCallCheck2(this,n),(r=t.call(this,e,i,a)).isTabMeasure=!1,r.octaveOffset=3,r.vfVoices={},r.vfTies=[],r.vfRepetitionWords=[],r.connectors=[],r.beams={},r.tuplets={},r.vftuplets={},r.minimumStaffEntriesWidth=-1,a?r.rules=a.ParentMusicSystem.rules:i&&(r.rules=i.Rules),r.resetLayout(),r}return _createClass2(n,[{key:"setAbsoluteCoordinates",value:function(e,t){this.stave.setX(e).setY(t)}},{key:"resetLayout",value:function(){this.stave=new VF$9.Stave(0,0,0,{fill_style:this.rules.StaffLineColor,space_above_staff_ln:0,space_below_staff_ln:0,DYMusicScoreType:this.rules.DYMusicScoreType}),this.stave.MeasureNumber=this.MeasureNumber,this.ParentStaff&&this.setLineNumber(this.ParentStaff.StafflineCount),this.stave.setBegBarType(VF$9.Barline.type.NONE),this.parentSourceMeasure&&this.parentSourceMeasure.endingBarStyleEnum===SystemLinesEnum.None&&this.stave.setEndBarType(VF$9.Barline.type.NONE),this.updateInstructionWidth()}},{key:"clean",value:function(){this.vfTies.length=0,this.connectors=[],this.resetLayout()}},{key:"getLineWidth",value:function(e){switch(e){case SystemLinesEnum.SingleThin:case SystemLinesEnum.DoubleThin:case SystemLinesEnum.ThinBold:return 5/unitInPixels;case SystemLinesEnum.BoldThinDots:case SystemLinesEnum.DotsThinBold:return 10/unitInPixels;case SystemLinesEnum.DotsBoldBoldDots:return 10/unitInPixels+this.rules.RepeatEndStartPadding;default:return 0}}},{key:"addClefAtBegin",value:function(e){if(this.rules.RenderClefsAtBeginningOfStaffline){if(this.octaveOffset=e.OctaveOffset,"jianpu"!==this.rules.DYMusicScoreType)if(e.ClefType===ClefEnum.TAB)this.stave.addClef("tab",void 0,void 0,void 0);else{var t=VexFlowConverter.Clef(e,"default");this.stave.addClef(t.type,t.size,t.annotation,VF$9.StaveModifier.Position.BEGIN)}this.updateInstructionWidth()}}},{key:"setLineNumber",value:function(e){5!==e&&(0===e?(this.stave.setNumLines(0),this.stave.getBottomLineY=function(){return this.getYForLine(this.options.num_lines)}):1===e?(this.stave.options.line_config=[{visible:!1},{visible:!1},{visible:!0},{visible:!1},{visible:!1}],this.stave.getBottomLineY=function(){return this.getYForLine(2)}):2===e?(this.stave.options.line_config=[{visible:!1},{visible:!1},{visible:!0},{visible:!0},{visible:!1}],this.stave.getBottomLineY=function(){return this.getYForLine(3)}):3===e?(this.stave.options.line_config=[{visible:!1},{visible:!0},{visible:!0},{visible:!0},{visible:!1}],this.stave.getBottomLineY=function(){return this.getYForLine(2)}):(this.stave.setNumLines(e),this.stave.getBottomLineY=function(){return this.getYForLine(this.options.num_lines)}))}},{key:"addKeyAtBegin",value:function(e,t,n){this.rules.RenderKeySignatures&&(this.stave.setKeySignature(VexFlowConverter.keySignature(e),VexFlowConverter.keySignature(t),void 0),this.updateInstructionWidth())}},{key:"addRhythmAtBegin",value:function(e){var t=VexFlowConverter.TimeSignature(e);this.stave.addModifier(t,VF$9.StaveModifier.Position.BEGIN,{numerator:e.Rhythm.Numerator,denominator:e.Rhythm.Denominator}),this.ShowTimeSignature||t.setStyle({fillStyle:"#00000000"}),this.updateInstructionWidth()}},{key:"addClefAtEnd",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=VexFlowConverter.Clef(e,"small");if(t||!this.stave.endClef){this.stave.setEndClef(n.type,n.size,n.annotation);var r,i=_createForOfIteratorHelper(this.stave.getModifiers());try{for(i.s();!(r=i.n()).done;){var a=r.value;if(t){var o=a.originalStrokeStyle,s=a.originalFillStyle;a.getStyle()&&(o&&s?(a.getStyle().strokeStyle=o,a.getStyle().fillStyle=s):(a.getStyle().strokeStyle=null,a.getStyle().fillStyle=null))}else if("clefs"===a.getCategory()&&a.getPosition()===VF$9.StaveModifier.Position.END&&a.type===n.type){var l="#12345600",u=a.getStyle();u&&(a.originalStrokeStyle=u.strokeStyle,a.originalFillStyle=u.fillStyle),a.setStyle({strokeStyle:l,fillStyle:l})}}}catch(err){i.e(err)}finally{i.f()}return this.parentSourceMeasure.hasEndClef=!0,this.updateInstructionWidth()}}},{key:"addMeasureLine",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];switch(t){case SystemLinePosition.MeasureBegin:if(e===SystemLinesEnum.BoldThinDots)n||(this.stave.modifiers[0].draw=function(e){switch(e.checkContext(),this.setRendered(),this.type){case VF$9.Barline.type.SINGLE:this.drawVerticalBar(e,this.x,!1);break;case VF$9.Barline.type.DOUBLE:this.drawVerticalBar(e,this.x,!0);break;case VF$9.Barline.type.END:this.drawVerticalEndBar(e,this.x);break;case VF$9.Barline.type.REPEAT_BEGIN:this.drawRepeatBar(e,this.x,!0);break;case VF$9.Barline.type.REPEAT_END:this.drawRepeatBar(e,this.x,!1);break;case VF$9.Barline.type.REPEAT_BOTH:this.drawRepeatBar(e,this.x,!1),this.drawRepeatBar(e,this.x,!0)}}),this.stave.setBegBarType(VF$9.Barline.type.REPEAT_BEGIN);break;case SystemLinePosition.MeasureEnd:switch(e){case SystemLinesEnum.DotsBoldBoldDots:this.stave.setEndBarType(VF$9.Barline.type.REPEAT_BOTH);break;case SystemLinesEnum.DotsThinBold:this.stave.setEndBarType(VF$9.Barline.type.REPEAT_END);break;case SystemLinesEnum.DoubleThin:this.stave.setEndBarType(VF$9.Barline.type.DOUBLE);break;case SystemLinesEnum.ThinBold:this.stave.setEndBarType(VF$9.Barline.type.END);break;case SystemLinesEnum.None:this.stave.setEndBarType(VF$9.Barline.type.NONE)}}}},{key:"addMeasureNumber",value:function(){var e=this.MeasureNumber.toString();this.stave.setText(e,3,{justification:1,shift_x:0,shift_y:0})}},{key:"addWordRepetition",value:function(e){var t=void 0,n=VF$9.StaveModifier.Position.END,r=this.beginInstructionsWidth;switch(e.type){case RepetitionInstructionEnum.Segno:t=VF$9.Repetition.type.SEGNO_LEFT,n=VF$9.StaveModifier.Position.LEFT;break;case RepetitionInstructionEnum.Coda:t=VF$9.Repetition.type.CODA_LEFT,n=VF$9.StaveModifier.Position.LEFT;break;case RepetitionInstructionEnum.DaCapo:t=VF$9.Repetition.type.DC;break;case RepetitionInstructionEnum.DalSegno:t=VF$9.Repetition.type.DS;break;case RepetitionInstructionEnum.Fine:t=VF$9.Repetition.type.FINE;break;case RepetitionInstructionEnum.ToCoda:t=VF$9.Repetition.type.TO_CODA;break;case RepetitionInstructionEnum.DaCapoAlFine:t=VF$9.Repetition.type.DC_AL_FINE;break;case RepetitionInstructionEnum.DaCapoAlCoda:t=VF$9.Repetition.type.DC_AL_CODA;break;case RepetitionInstructionEnum.DalSegnoAlFine:t=VF$9.Repetition.type.DS_AL_FINE;break;case RepetitionInstructionEnum.DalSegnoAlCoda:t=VF$9.Repetition.type.DS_AL_CODA}if(t){if(this.stave.getModifiers().find((function(e){return e.symbol_type===t})))return;var i=new VF$9.Repetition(t,r,-this.rules.RepetitionSymbolsYOffset);this.stave.addModifier(i,n)}else this.addVolta(e)}},{key:"addVolta",value:function(e){var t=VF$9.Volta.type.BEGIN;if(e.type===RepetitionInstructionEnum.Ending){switch(e.alignment){case AlignmentType.Begin:t=this.parentSourceMeasure.endsRepetitionEnding()?VF$9.Volta.type.BEGIN_END:VF$9.Volta.type.BEGIN;break;case AlignmentType.End:if(this.parentSourceMeasure.beginsRepetitionEnding())return;t=VF$9.Volta.type.END}var r=this.ParentStaffLine.SkyBottomLineCalculator,i=this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginLeft+.4,a=Math.max(this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginRight,i+.4),o=r.getSkyLineMinInRange(i,a)-2,s=-6.1+this.rules.VoltaOffset,l=this.rules.VoltaOffset;if(o0){var d;loglevelExports.trace("Ghost Found in between (measure ".concat(this.MeasureNumber,")"));var f=this.createGhostGves(h);(d=n).splice.apply(d,[r,0].concat(_toConsumableArray2(f))),r+=f.length}}else{var p=Fraction$1.minus(o,this.parentSourceMeasure.AbsoluteTimestamp);if(p.RealValue>0){var v;loglevelExports.trace("Ghost Found at start (measure ".concat(this.MeasureNumber,")"));var m=this.createGhostGves(p);(v=n).splice.apply(v,[0,0].concat(_toConsumableArray2(m))),r+=m.length}}t=s}var g=Fraction$1.plus(this.parentSourceMeasure.AbsoluteTimestamp,this.parentSourceMeasure.Duration),y=Fraction$1.minus(g,t);if(y.RealValue>0){loglevelExports.trace("Ghost Found at end (measure ".concat(this.MeasureNumber,")"));var b=this.createGhostGves(y);n=n.concat(b)}return n}},{key:"createGhostGves",value:function(e){var t,n=[],r=_createForOfIteratorHelper(VexFlowConverter.GhostNotes(e));try{for(r.s();!(t=r.n()).done;){var i=t.value,a=new VexFlowVoiceEntry(void 0,void 0);a.vfStaveNote=i,n.push(a)}}catch(err){r.e(err)}finally{r.f()}return n}},{key:"handleBeam",value:function(e,t){var n,r=e.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId,i=this.beams[r];i||(i=this.beams[r]=[]);var a,o=_createForOfIteratorHelper(i);try{for(o.s();!(a=o.n()).done;){var s=a.value;s[0]===t&&(n=s)}}catch(err){o.e(err)}finally{o.f()}n||(n=[t,[]],i.push(n));var l=e.parentVoiceEntry;n[1].indexOf(l)<0&&n[1].push(l)}},{key:"handleTuplet",value:function(e,t){var n=e.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;t=e.sourceNote.NoteTuplet;var r,i=this.tuplets[n];i||(i=this.tuplets[n]=[]);var a,o=_createForOfIteratorHelper(i);try{for(o.s();!(a=o.n()).done;){var s=a.value;s[0]===t&&(r=s)}}catch(err){o.e(err)}finally{o.f()}r||(r=[t,[]],i.push(r));var l=e.parentVoiceEntry;r[1].indexOf(l)<0&&r[1].push(l)}},{key:"finalizeBeams",value:function(){this.vfbeams={};var e=[];for(var t in this.beams)if(this.beams.hasOwnProperty(t)){var n=this.vfbeams[t];n||(n=this.vfbeams[t]=[]);var r,i=_createForOfIteratorHelper(this.beams[t]);try{for(i.s();!(r=i.n()).done;){var a,o=r.value,s=!1,l=_createForOfIteratorHelper(o[0].Notes);try{for(l.s();!(a=l.n()).done;){var u=a.value;if(u.Length.RealValue>=new Fraction$1(1,4).RealValue&&(!u.TypeLength||u.TypeLength.RealValue>.125)){s=!0;break}}}catch(err){l.e(err)}finally{l.f()}if(s)loglevelExports.debug("Beam between note >= quarter, likely tremolo, currently unsupported. continuing.");else{var c,h=[],d=o[0],f=o[1],p=!0,v=_createForOfIteratorHelper(f);try{for(v.s();!(c=v.n()).done;){var m=c.value;m.parentVoiceEntry.ParentVoice===d.Notes[0].ParentVoiceEntry.ParentVoice&&(p=m.parentVoiceEntry.WantedStemDirection===StemDirectionType.Undefined)}}catch(err){v.e(err)}finally{v.f()}var g,y=!1,b=void 0,A=[],S=_createForOfIteratorHelper(f);try{for(S.s();!(g=S.n()).done;){var x=g.value,w=x.vfStaveNote;w&&(h.push(w),e.push(w)),x.parentVoiceEntry.IsGrace&&(y=!0),x.parentVoiceEntry.StemColor&&this.rules.ColoringEnabled&&A.push(x.parentVoiceEntry.StemColor)}}catch(err){S.e(err)}finally{S.f()}if(h.length>1){var _=new VF$9.Beam(h,p);if(y&&(_.render_options.beam_width=3,_.render_options.partial_beam_length=4),A.length>=2&&this.rules.ColorBeams){b=A[0];var E,k=_createForOfIteratorHelper(A);try{for(k.s();!(E=k.n()).done;){if(E.value!==b){b=void 0;break}}}catch(err){k.e(err)}finally{k.f()}_.setStyle({fillStyle:b,strokeStyle:b})}this.rules.FlatBeams&&(_.render_options.flat_beams=!0,_.render_options.flat_beam_offset=this.rules.FlatBeamOffset,_.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),n.push(_)}else loglevelExports.debug("Warning! Beam with no notes!")}}}catch(err){i.e(err)}finally{i.f()}}this.rules.AutoBeamNotes&&this.autoBeamNotes(e)}},{key:"autoBeamNotes",value:function(e){if(this.rules.AutoBeamTabs||!this.isTabMeasure){var t,n=[],r=[],i=[];this.autoTupletVfBeams=[];var a=[];this.autoVfBeams=[];var o=this.parentSourceMeasure.ActiveTimeSignature;o||(o=this.parentSourceMeasure.Duration);var s,l=_createForOfIteratorHelper(this.staffEntries);try{for(l.s();!(s=l.n()).done;){var u,c=s.value,h=_createForOfIteratorHelper(c.graphicalVoiceEntries);try{for(h.s();!(u=h.n()).done;){var d=u.value,f=d.vfStaveNote,p=d.notes[0],v=c.relInMeasureTimestamp.isOnBeat(o),m=r.length>=2,g=p.sourceNote.Length.RealValue-new Fraction$1(1,4).RealValue>-Fraction$1.FloatInaccuracyTolerance,y=d.parentVoiceEntry.IsGrace||g||e.contains(f);if(y||v){if(m){var b,A=_createForOfIteratorHelper(r);try{for(A.s();!(b=A.n()).done;){var S=b.value;n.push(S)}}catch(err){A.e(err)}finally{A.f()}a.push(n.slice()),n=[]}if(r=[],y)continue}var x=d.notes[0].sourceNote.NoteTuplet;if(x){var w,_=!1,E=_createForOfIteratorHelper(x.Notes);try{for(E.s();!(w=E.n()).done;){var k,C=_createForOfIteratorHelper(w.value);try{for(C.s();!(k=C.n()).done;){var M=k.value;if(M.NoteTypeXml>=NoteType.QUARTER||M.ParentVoiceEntry.IsGrace||M.isRest()&&!this.rules.AutoBeamOptions.beam_rests){_=!0;break}}}catch(err){C.e(err)}finally{C.f()}if(_)break}}catch(err){E.e(err)}finally{E.f()}if(t){if(t!==x){if(i.length>1){var P=new VF$9.Beam(i,!0);this.rules.FlatBeams&&(P.render_options.flat_beams=!0,P.render_options.flat_beam_offset=this.rules.FlatBeamOffset,P.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(P)}i=[],t=x}}else t=x;_||i.push(f)}else t=void 0,r.push(f)}}catch(err){h.e(err)}finally{h.f()}}}catch(err){l.e(err)}finally{l.f()}if(i.length>=2){var I=new VF$9.Beam(i,!0);this.rules.FlatBeams&&(I.render_options.flat_beams=!0,I.render_options.flat_beam_offset=this.rules.FlatBeamOffset,I.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(I)}if(r.length>=2){var T,B=_createForOfIteratorHelper(r);try{for(B.s();!(T=B.n()).done;){var R=T.value;n.push(R)}}catch(err){B.e(err)}finally{B.f()}a.push(n)}var L=this.rules.AutoBeamOptions,N={beam_middle_only:L.beam_middle_rests_only,beam_rests:L.beam_rests,maintain_stem_directions:L.maintain_stem_directions};if(L.groups&&L.groups.length){var F,D=[],O=_createForOfIteratorHelper(L.groups);try{for(O.s();!(F=O.n()).done;){var V=F.value;D.push(new VF$9.Fraction(V[0],V[1]))}}catch(err){O.e(err)}finally{O.f()}N.groups=D}for(var z=0,G=a;z1){var u=a[0],c=u.Notes[0][0].NormalNotes,h=u.Bracket||3===u.TupletLabelNumber&&this.rules.TripletsBracketed||3!==u.TupletLabelNumber&&this.rules.TupletsBracketed,d=VF$9.Tuplet.LOCATION_TOP;u.tupletLabelNumberPlacement===PlacementEnum.Below&&(d=VF$9.Tuplet.LOCATION_BOTTOM),t.push(new VF$9.Tuplet(o,{bracketed:h,location:d,notes_occupied:c,num_notes:u.TupletLabelNumber,ratioed:this.rules.TupletsRatioed}))}else loglevelExports.debug("Warning! Tuplet with no notes! Trying to ignore, but this is a serious problem.")}}catch(err){r.e(err)}finally{r.f()}}}},{key:"layoutStaffEntry",value:function(e){}},{key:"graphicalMeasureCreatedCalculations",value:function(){var e,t,n=[],r=[],i=_createForOfIteratorHelper(this.staffEntries);try{for(i.s();!(t=i.n()).done;){var a=t.value;e=!1,n=[];var o,s=_createForOfIteratorHelper(a.graphicalVoiceEntries);try{for(s.s();!(o=s.n()).done;){var l=o.value;if(l.parentVoiceEntry.IsGrace)n.push(l),r.push(l),e||(e=l.parentVoiceEntry.GraceSlur);else if(l.vfStaveNote=VexFlowConverter.StaveNote(l),n.length>0){for(var u=[],c=0;c0&&(h.GraceSlash=!1);var d=VexFlowConverter.StaveNote(h);h.vfStaveNote=d,u.push(d)}var f=new VF$9.GraceNoteGroup(u,e);l.vfStaveNote.addModifier(0,f),n=[]}}}catch(err){s.e(err)}finally{s.f()}}}catch(err){i.e(err)}finally{i.f()}if(n.length>0){var p,v=_createForOfIteratorHelper(n);try{for(v.s();!(p=v.n()).done;){var m=p.value;m.vfStaveNote=VexFlowConverter.StaveNote(m),m.parentVoiceEntry.GraceAfterMainNote=!0}}catch(err){v.e(err)}finally{v.f()}}this.finalizeBeams(),this.finalizeTuplets();var g=this.getVoicesWithinMeasure();if(this.rules.RenderFingerings){var y,b=_createForOfIteratorHelper(this.staffEntries);try{for(b.s();!(y=b.n()).done;){y.value.setModifierXOffsets()}}catch(err){b.e(err)}finally{b.f()}}var A,S=_createForOfIteratorHelper(g);try{for(S.s();!(A=S.n()).done;){var x=A.value;if(x){this.vfVoices[x.VoiceId]=new VF$9.Voice({beat_value:this.parentSourceMeasure.Duration.Denominator,num_beats:this.parentSourceMeasure.Duration.Numerator,resolution:VF$9.RESOLUTION}).setMode(VF$9.Voice.Mode.SOFT);var w,_=_createForOfIteratorHelper(this.getRestFilledVexFlowStaveNotesPerVoice(x));try{for(_.s();!(w=_.n()).done;){var E=w.value;if(!E.parentVoiceEntry||!E.parentVoiceEntry.IsGrace||E.parentVoiceEntry.GraceAfterMainNote){var k=E;if(0!==k.vfStaveNote.ticks.denominator)if(0!==E.notes.length&&E.notes[0]&&E.notes[0].sourceNote.PrintObject){var C=k.parentStaffEntry;if(C&&C.vfClefBefore){var M=new NoteSubGroup([C.vfClefBefore]);k.vfStaveNote.getCategory&&"stavenotes"===k.vfStaveNote.getCategory()&&k.vfStaveNote.addModifier(0,M)}E.parentVoiceEntry&&this.rules.RenderFingerings&&(this.rules.FingeringPosition!==PlacementEnum.Left&&this.rules.FingeringPosition!==PlacementEnum.Right||this.createFingerings(E),this.createStringNumber(E)),this.createArpeggio(E),this.vfVoices[x.VoiceId].addTickable(k.vfStaveNote)}else this.vfVoices[x.VoiceId].addTickable(k.vfStaveNote)}}}catch(err){_.e(err)}finally{_.f()}}}}catch(err){S.e(err)}finally{S.f()}this.setStemDirectionFromVexFlow();for(var P=0,I=r;P1){var n=VexFlowConverter.StrokeTypeFromArpeggioType(t.type),r=new VF$9.Stroke(n,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&e.vfStaveNote.addStroke(0,r)}else loglevelExports.debug("[OSMD] arpeggio in measure ".concat(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."))}}},{key:"setStemDirectionFromVexFlow",value:function(){var e,t=_createForOfIteratorHelper(this.staffEntries);try{for(t.s();!(e=t.n()).done;){var n,r=_createForOfIteratorHelper(e.value.graphicalVoiceEntries);try{for(r.s();!(n=r.n()).done;){var i,a=n.value,o=_createForOfIteratorHelper(a.notes);try{for(o.s();!(i=o.n()).done;){var s=i.value.vfnote;if(s&&s[0])switch(s[0].getStemDirection()){case VF$9.Stem.UP:a.parentVoiceEntry.StemDirection=StemDirectionType.Up;break;case VF$9.Stem.DOWN:a.parentVoiceEntry.StemDirection=StemDirectionType.Down}}}catch(err){o.e(err)}finally{o.f()}}}catch(err){r.e(err)}finally{r.f()}}}catch(err){t.e(err)}finally{t.f()}}},{key:"createArticulations",value:function(){for(var e=0,t=this.staffEntries.length;e1||e.parentStaffEntry.graphicalVoiceEntries.length>1?d=VF$9.StaveModifier.Position.LEFT:0===f.idInMusicSheet?(d=VF$9.StaveModifier.Position.ABOVE,c=PlacementEnum.Above):(d=VF$9.StaveModifier.Position.BELOW,c=PlacementEnum.Below)}var p=new VF$9.FretHandFinger(u.value);if(p.setPosition(d),p.setOffsetX(h),c===PlacementEnum.Above||c===PlacementEnum.Below){var v=c===PlacementEnum.Above?-1:1,m=c===PlacementEnum.Above?o:r-1-o;if(this.rules.FingeringInsideStafflines&&r>1){var g=p.getWidth()/2,y=2.5*r;p.setOffsetY(v*(m+y)*g)}else if(!this.rules.FingeringInsideStafflines){var b=new VF$9.StringNumber(u.value);b.radius=0,b.setPosition(d),b.setOffsetY(v*m*b.getWidth()*2/3),n.vfStaveNote.addModifier(o,b);continue}}n.vfStaveNote.addModifier(o,p)}else o++}}catch(err){s.e(err)}finally{s.f()}}},{key:"createStringNumber",value:function(e){var t=this;if(this.rules.RenderStringNumbersClassical){var n=e;e.notes.forEach((function(r,i){var a=r.sourceNote.StringInstruction;if(a){var o=a.value;switch(o){case"1":o="I";break;case"2":o="II";break;case"3":o="III";break;case"4":o="IV";break;case"5":o="V";break;case"6":o="VI"}var s=new VF$9.StringNumber(o);s.radius=0;var l=-t.rules.StringNumberOffsetY;e.notes.length>1||e.parentStaffEntry.graphicalVoiceEntries.length>1?(s.setOffsetX(13*r.baseStringNumberXOffset),s.setPosition(VF$9.Modifier.Position.RIGHT)):s.setPosition(VF$9.Modifier.Position.ABOVE),s.setOffsetY(l),n.vfStaveNote.addModifier(i,s)}}))}}},{key:"lineTo",value:function(e,t){var n=new VF$9.StaveConnector(e.getVFStave(),this.stave);n.setType(t),this.connectors.push(n)}},{key:"getVFStave",value:function(){return this.stave}},{key:"updateInstructionWidth",value:function(){var e,t,n,r=0,i=0,a=_createForOfIteratorHelper(this.stave.getModifiers());try{for(a.s();!(n=a.n()).done;){var o=n.value;5===o.getPosition()?r+=o.getWidth()+o.getPadding(void 0):6===o.getPosition()&&(i+=o.getWidth()+o.getPadding(void 0))}}catch(err){a.e(err)}finally{a.f()}this.beginInstructionsWidth=(null!==(e=r)&&void 0!==e?e:0)/unitInPixels,this.endInstructionsWidth=(null!==(t=i)&&void 0!==t?t:0)/unitInPixels}},{key:"addStaveTie",value:function(e,t){this.vfTies.push(e),t.vfTie=e}}]),n}(GraphicalMeasure),GraphicalStaffEntry=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return _classCallCheck2(this,n),(r=t.call(this)).graphicalChordContainers=[],r.tabStaffEntry=void 0,r.MaxAccidentals=0,r.graphicalInstructions=[],r.ties=[],r.graphicalTies=[],r.lyricsEntries=[],r.parentMeasure=e,r.graphicalVoiceEntries=[],r.sourceStaffEntry=i,a?(r.staffEntryParent=a,r.parentVerticalContainer=a.parentVerticalContainer,r.PositionAndShape=new BoundingBox$1(_assertThisInitialized2(r),a.PositionAndShape)):r.PositionAndShape=new BoundingBox$1(_assertThisInitialized2(r),e.PositionAndShape),i&&(r.relInMeasureTimestamp=i.Timestamp),r.FingeringEntries=[],r}return _createClass2(n,[{key:"GraphicalInstructions",get:function(){return this.graphicalInstructions}},{key:"GraphicalTies",get:function(){return this.graphicalTies}},{key:"LyricsEntries",get:function(){return this.lyricsEntries},set:function(e){this.lyricsEntries=e}},{key:"getAbsoluteTimestamp",value:function(){var e=this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.clone();return this.relInMeasureTimestamp&&e.Add(this.relInMeasureTimestamp),e}},{key:"findTieGraphicalNoteFromNote",value:function(e){var t,n,r=(null===(t=window.GYM)||void 0===t?void 0:t.graceCustom)||!1,i=_createForOfIteratorHelper(this.graphicalVoiceEntries);try{for(i.s();!(n=i.n()).done;){var a,o=_createForOfIteratorHelper(n.value.notes);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=s.sourceNote;if(r){if(e.NoteToGraphicalNoteObjectId==l.NoteToGraphicalNoteObjectId)return s}else if(!l.isRest()&&l.Pitch.FundamentalNote===e.Pitch.FundamentalNote&&l.Pitch.Octave===e.Pitch.Octave&&l.getAbsoluteTimestamp().Equals(e.getAbsoluteTimestamp()))return s}}catch(err){o.e(err)}finally{o.f()}}}catch(err){i.e(err)}finally{i.f()}}},{key:"findEndTieGraphicalNoteFromNoteWithStartingSlur",value:function(e,t){if(e){var n,r=_createForOfIteratorHelper(this.graphicalVoiceEntries);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.parentVoiceEntry===e.ParentVoiceEntry){var a,o=_createForOfIteratorHelper(i.notes);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=s.sourceNote;if(l.NoteTie&&-1!==l.NoteSlurs.indexOf(t))return s}}catch(err){o.e(err)}finally{o.f()}}}}catch(err){r.e(err)}finally{r.f()}}}},{key:"findGraphicalNoteFromGraceNote",value:function(e){if(e){var t,n=_createForOfIteratorHelper(this.graphicalVoiceEntries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.parentVoiceEntry===e.ParentVoiceEntry){var i,a=_createForOfIteratorHelper(r.notes);try{for(a.s();!(i=a.n()).done;){var o=i.value;if(o.sourceNote===e)return o}}catch(err){a.e(err)}finally{a.f()}}}}catch(err){n.e(err)}finally{n.f()}}}},{key:"findGraphicalNoteFromNote",value:function(e){if(e){var t,n=_createForOfIteratorHelper(this.graphicalVoiceEntries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.parentVoiceEntry===e.ParentVoiceEntry){var i,a=_createForOfIteratorHelper(r.notes);try{for(a.s();!(i=a.n()).done;){var o=i.value;if(o.sourceNote===e&&this.getAbsoluteTimestamp().Equals(e.getAbsoluteTimestamp()))return o}}catch(err){a.e(err)}finally{a.f()}}}}catch(err){n.e(err)}finally{n.f()}}}},{key:"getGraphicalNoteDurationFromVoice",value:function(e){var t,n=_createForOfIteratorHelper(this.graphicalVoiceEntries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.parentVoiceEntry.ParentVoice===e)return r.notes[0].graphicalNoteLength}}catch(err){n.e(err)}finally{n.f()}return new Fraction$1(0,1)}},{key:"findVoiceEntryGraphicalNotes",value:function(e){var t,n=_createForOfIteratorHelper(this.graphicalVoiceEntries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.parentVoiceEntry===e)return r.notes}}catch(err){n.e(err)}finally{n.f()}}},{key:"isVoiceEntryPartOfLinkedVoiceEntry",value:function(e){if(this.sourceStaffEntry.Link)for(var t=0,n=this.sourceStaffEntry.Link.LinkStaffEntries.length;t0&&(t=a)}}catch(err){i.e(err)}finally{i.f()}}}catch(err){n.e(err)}finally{n.f()}return t}},{key:"findStaffEntryMaxNoteLength",value:function(){var e,t=new Fraction$1(0,1),n=_createForOfIteratorHelper(this.graphicalVoiceEntries);try{for(n.s();!(e=n.n()).done;){var r,i=_createForOfIteratorHelper(e.value.notes);try{for(i.s();!(r=i.n()).done;){var a=r.value.graphicalNoteLength;t.lt(a)&&a.GetExpandedNumerator()>0&&(t=a)}}catch(err){i.e(err)}finally{i.f()}}}catch(err){n.e(err)}finally{n.f()}return t}},{key:"findOrCreateGraphicalVoiceEntry",value:function(e){var t,n=_createForOfIteratorHelper(this.graphicalVoiceEntries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.parentVoiceEntry===e)return r}}catch(err){n.e(err)}finally{n.f()}var i=MusicSheetCalculator.symbolFactory.createVoiceEntry(e,this);return this.graphicalVoiceEntries.push(i),i}},{key:"findOrCreateGraphicalVoiceEntryFromGraphicalNote",value:function(e){var t,n=_createForOfIteratorHelper(this.graphicalVoiceEntries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r===e.parentVoiceEntry)return r}}catch(err){n.e(err)}finally{n.f()}var i=MusicSheetCalculator.symbolFactory.createVoiceEntry(e.sourceNote.ParentVoiceEntry,this);return this.graphicalVoiceEntries.push(i),i}},{key:"addGraphicalNoteToListAtCorrectYPosition",value:function(e,t){var n=e.notes;if(0===n.length||t.PositionAndShape.RelativePosition.y=0;r--){if(n[r].PositionAndShape.RelativePosition.y>t.PositionAndShape.RelativePosition.y){n.splice(r+1,0,t);break}if(0===r){n.splice(0,0,t);break}}}},{key:"hasOnlyRests",value:function(){var e,t=_createForOfIteratorHelper(this.graphicalVoiceEntries);try{for(t.s();!(e=t.n()).done;){var n,r=_createForOfIteratorHelper(e.value.notes);try{for(r.s();!(n=r.n()).done;){if(!n.value.sourceNote.isRest())return!1}}catch(err){r.e(err)}finally{r.f()}}}catch(err){t.e(err)}finally{t.f()}return!0}},{key:"getSkylineMin",value:function(){var e,t=null===(e=this.parentMeasure)||void 0===e?void 0:e.ParentStaffLine.SkyBottomLineCalculator;if(t){var n=_slicedToArray(this.getAbsoluteStartAndEnd(),2),r=n[0],i=n[1];return t.getSkyLineMinInRange(r,i)}}},{key:"getHighestYAtEntry",value:function(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getSkylineMin()}},{key:"getLowestYAtEntry",value:function(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getBottomlineMax()}},{key:"getBottomlineMax",value:function(){var e,t=null===(e=this.parentMeasure)||void 0===e?void 0:e.ParentStaffLine.SkyBottomLineCalculator;if(t){var n=_slicedToArray(this.getAbsoluteStartAndEnd(),2),r=n[0],i=n[1];return t.getBottomLineMaxInRange(r,i)}}},{key:"getAbsoluteStartAndEnd",value:function(){var e=this.PositionAndShape.AbsolutePosition.x;return[e-=this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.x,e+this.PositionAndShape.Size.width]}}]),n}(GraphicalObject),VF$8=Vex.Flow,VexFlowStaffEntry=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i){return _classCallCheck2(this,n),t.call(this,e,r,i)}return _createClass2(n,[{key:"calculateXPosition",value:function(){var e,t=this.parentMeasure.getVFStave(),n=0,r=_createForOfIteratorHelper(this.graphicalVoiceEntries);try{for(r.s();!(e=r.n()).done;){var i=e.value;if(i.vfStaveNote){if(i.vfStaveNote.setStave(t),t&&t.getLines&&1===t.getLines()&&i.vfStaveNote.getStemDirection()<0&&(i.vfStaveNote.setStemDirection(VF$8.Stem.UP),i.parentVoiceEntry.StemDirection=StemDirectionType.Up),!i.vfStaveNote.preFormatted)continue;i.applyBordersFromVexflow(),this.parentMeasure.ParentStaff.isTab?this.PositionAndShape.RelativePosition.x=(i.vfStaveNote.getAbsoluteX()+i.vfStaveNote.glyph.getWidth())/unitInPixels:this.PositionAndShape.RelativePosition.x=i.vfStaveNote.getBoundingBox().getX()/unitInPixels;var a=i.notes[0].sourceNote;a.isRest()&&a.Length.RealValue===this.parentMeasure.parentSourceMeasure.ActiveTimeSignature.RealValue&&(this.PositionAndShape.RelativePosition.x+=this.parentMeasure.parentSourceMeasure.Rules.WholeRestXShiftVexflow-.1,i.PositionAndShape.BorderLeft=-.7,i.PositionAndShape.BorderRight=.7),i.PositionAndShape.BorderLeft=0;o--){if(Math.abs(e[r]-e[o])<=t&&i===n[o]){i++,a=!0;break}a=!1}n.push(i)}return n}}]),n}(GraphicalStaffEntry),VexFlowGraphicalNote=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i){var a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:OctaveEnum.NONE,s=arguments.length>4?arguments[4]:void 0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0;if(_classCallCheck2(this,n),(a=t.call(this,e,r,s,l)).clef=i,a.octaveShift=o,e.Pitch){var u=e.isRest()?e.Pitch:OctaveShift.getPitchFromOctaveShift(e.Pitch,o);a.vfpitch=VexFlowConverter.pitch(u,e.isRest(),a.clef,a.sourceNote.Notehead),a.vfpitch[1]=void 0}return a}return _createClass2(n,[{key:"setAccidental",value:function(e){var t=this.drawPitch(e);this.vfpitch=VexFlowConverter.pitch(t,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.DrawnAccidental=t.Accidental}},{key:"drawPitch",value:function(e){return OctaveShift.getPitchFromOctaveShift(e,this.octaveShift)}},{key:"Transpose",value:function(e,t,r,i){var a=_get(_getPrototypeOf2(n.prototype),"Transpose",this).call(this,e,t,r,i),o=OctaveShift.getPitchFromOctaveShift(a,this.octaveShift);return this.vfpitch=VexFlowConverter.pitch(o,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0,o}},{key:"setIndex",value:function(e,t){this.vfnote=[e,t],this.vfnoteIndex=t}},{key:"notehead",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;e||(e=this.vfnote[0]);var t=e.note_heads;return t&&t.length>this.vfnoteIndex&&t[this.vfnoteIndex]?e.note_heads[this.vfnoteIndex]:{line:0}}},{key:"Clef",value:function(){return this.clef}},{key:"getSVGId",value:function(){if(this.vfnote)return this.vfnote[0].getAttribute("id")}},{key:"getSVGGElement",value:function(){if(this.vfnote)return this.vfnote[0].getAttribute("el")}},{key:"getStemSVG",value:function(){return document.getElementById("vf-"+this.getSVGId()+"-stem")}},{key:"getBeamSVGs",value:function(){for(var e=[],t=0;;t++){var n=document.getElementById("vf-".concat(this.getSVGId(),"-beam").concat(t));if(!n)break;e.push(n)}return e}}]),n}(GraphicalNote),GraphicalChordSymbolContainer=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i,a,o,s){var l;return _classCallCheck2(this,n),(l=t.call(this)).chordSymbolContainer=e,l.boundingBox=new BoundingBox$1(_assertThisInitialized2(l),r),l.rules=s,l.calculateLabel(i,o,a),l}return _createClass2(n,[{key:"GetChordSymbolContainer",get:function(){return this.chordSymbolContainer}},{key:"GraphicalLabel",get:function(){return this.graphicalLabel}},{key:"calculateLabel",value:function(e,t,n){var r=ChordSymbolContainer.calculateChordText(this.chordSymbolContainer,t,n);this.graphicalLabel=new GraphicalLabel(new Label(r),e,this.rules.ChordSymbolTextAlignment,this.rules,this.boundingBox),this.graphicalLabel.PositionAndShape.RelativePosition=new PointF2D(this.rules.ChordSymbolRelativeXOffset,0),this.graphicalLabel.Label.colorDefault=this.rules.DefaultColorChordSymbol}}]),n}(GraphicalObject),VF$7=Vex.Flow,VexFlowTabMeasure=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return _classCallCheck2(this,n),(r=t.call(this,e,i,a)).isTabMeasure=!0,r}return _createClass2(n,[{key:"resetLayout",value:function(){var e,t=null!==(e=this.ParentStaff.StafflineCount)&&void 0!==e?e:6;this.stave=new VF$7.TabStave(0,0,0,{space_above_staff_ln:0,space_below_staff_ln:0,num_lines:t}),this.updateInstructionWidth()}},{key:"graphicalMeasureCreatedCalculations",value:function(){for(var e=0,t=this.staffEntries.length;e1){var f=VexFlowConverter.StrokeTypeFromArpeggioType(d.type),p=new VF$7.Stroke(f,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&h.vfStaveNote.addStroke(0,p)}else loglevelExports.debug("[OSMD] arpeggio in measure ".concat(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[s.VoiceId].addTickable(h.vfStaveNote)}else this.vfVoices[s.VoiceId].addTickable(h.vfStaveNote)}}}catch(err){u.e(err)}finally{u.f()}}}}catch(err){o.e(err)}finally{o.f()}}}]),n}(VexFlowMeasure),StaffLine=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i;return _classCallCheck2(this,n),(i=t.call(this)).measures=[],i.staffLines=new Array(5),i.octaveShifts=[],i.lyricLines=[],i.lyricsDashes=[],i.abstractExpressions=[],i.graphicalSlurs=[],i.Pedals=[],i.WavyLines=[],i.parentMusicSystem=e,i.parentStaff=r,i.boundingBox=new BoundingBox$1(_assertThisInitialized2(i),e.PositionAndShape),i.skyBottomLine=MusicSheetCalculator.symbolFactory.createSkyBottomLineCalculator(_assertThisInitialized2(i)),i.staffHeight=i.parentMusicSystem.rules.StaffHeight,i.topLineOffset=0,i.bottomLineOffset=4,i.calculateStaffLineOffsets(),i}return _createClass2(n,[{key:"calculateStaffLineOffsets",value:function(){if(this.ParentStaff.isTab)if(5===this.ParentStaff.StafflineCount)this.staffHeight=this.bottomLineOffset=6*this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight;else 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}}},{key:"Measures",get:function(){return this.measures},set:function(e){this.measures=e}},{key:"StaffLines",get:function(){return this.staffLines},set:function(e){this.staffLines=e}},{key:"Index",get:function(){return this.parentMusicSystem.StaffLines.indexOf(this)}},{key:"NextStaffLine",get:function(){var e=this.Index;return e!==this.parentMusicSystem.StaffLines.length?this.parentMusicSystem.StaffLines[e+1]:void 0}},{key:"LyricLines",get:function(){return this.lyricLines},set:function(e){this.lyricLines=e}},{key:"AbstractExpressions",get:function(){return this.abstractExpressions},set:function(e){this.abstractExpressions=e}},{key:"LyricsDashes",get:function(){return this.lyricsDashes},set:function(e){this.lyricsDashes=e}},{key:"ParentMusicSystem",get:function(){return this.parentMusicSystem},set:function(e){this.parentMusicSystem=e}},{key:"ParentStaff",get:function(){return this.parentStaff},set:function(e){this.parentStaff=e}},{key:"SkyBottomLineCalculator",get:function(){return this.skyBottomLine}},{key:"SkyLine",get:function(){return this.skyBottomLine.SkyLine}},{key:"BottomLine",get:function(){return this.skyBottomLine.BottomLine}},{key:"OctaveShifts",get:function(){return this.octaveShifts},set:function(e){this.octaveShifts=e}},{key:"StaffHeight",get:function(){return this.staffHeight}},{key:"TopLineOffset",get:function(){return this.topLineOffset}},{key:"BottomLineOffset",get:function(){return this.bottomLineOffset}},{key:"GraphicalSlurs",get:function(){return this.graphicalSlurs}},{key:"addSlurToStaffline",value:function(e){this.graphicalSlurs.push(e)}},{key:"addActivitySymbolClickArea",value:function(){var e=new StaffLineActivitySymbol(this),t=this.PositionAndShape;e.PositionAndShape.RelativePosition=new PointF2D(t.RelativePosition.x+t.BorderRight+.5,t.RelativePosition.y+.5),e.PositionAndShape.Parent=this.parentMusicSystem.PositionAndShape}},{key:"isPartOfMultiStaffInstrument",value:function(){return this.parentStaff.ParentInstrument.Staves.length>1}},{key:"findClosestStaffEntry",value:function(e){for(var t=void 0,n=0,r=this.Measures.length;n0)for(var h,d,f=c.map((function(e){return e.PositionAndShape.Center.y})),p=Math.max.apply(Math,_toConsumableArray2(f)),v=(null===(h=window.GYM)||void 0===h?void 0:h.noNeedContinuousDynamic)||!1,m=(null===(d=window.GYM)||void 0===d?void 0:d.noNeedGraphicalContinuousDynamic)||!1,g=0;g0?c[g-1]:void 0;if(A){var x=this.getOverlap(y.PositionAndShape,A.PositionAndShape);y.squeeze(-(x.x+this.rules.DynamicExpressionSpacer))}if(S){var w=this.getOverlap(S.PositionAndShape,y.PositionAndShape);y.squeeze(w.x+this.rules.DynamicExpressionSpacer)}}}}}},{key:"getDistance",value:function(e,t){var n=e.RelativePosition.x+e.BorderMarginRight,r=t.RelativePosition.x+t.BorderMarginLeft,i=e.RelativePosition.y+e.BorderMarginBottom,a=t.RelativePosition.y+t.BorderMarginTop;return new PointF2D(r-n,a-i)}},{key:"getOverlap",value:function(e,t){return new PointF2D(e.RelativePosition.x+e.BorderMarginRight-(t.RelativePosition.x+t.BorderMarginLeft),e.RelativePosition.y+e.BorderMarginBottom-(t.RelativePosition.y+t.BorderMarginTop))}}]),e}(),VexFlowStaffLine=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i;return _classCallCheck2(this,n),(i=t.call(this,e,r)).slursInVFStaffLine=[],i.alignmentManager=new AlignmentManager(_assertThisInitialized2(i)),i}return _createClass2(n,[{key:"SlursInVFStaffLine",get:function(){return this.slursInVFStaffLine}},{key:"addVFSlurToVFStaffline",value:function(e){this.slursInVFStaffLine.push(e)}},{key:"AlignmentManager",get:function(){return this.alignmentManager}}]),n}(StaffLine),VF$6=Vex.Flow,VexFlowMultiRestMeasure=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return _classCallCheck2(this,n),(r=t.call(this,e,i,a)).minimumStaffEntriesWidth=-1,a?r.rules=a.ParentMusicSystem.rules:i&&(r.rules=i.Rules),r.resetLayout(),r.multiRestElement=new VF$6.MultiMeasureRest(i.multipleRestMeasures,{}),r}return _createClass2(n,[{key:"draw",value:function(e){var t,n,r,i,a,o=e.openGroup();null==o||null===(t=o.classList)||void 0===t||t.add("vf-measure");var s=e.openGroup();null==s||null===(n=s.classList)||void 0===n||n.add("vf-stave"),null==s||s.setAttribute("id",null===(r=this.stave)||void 0===r||null===(i=r.attrs)||void 0===i?void 0:i.id),this.stave.setContext(e).draw(),e.closeGroup();var l=e.openGroup();null==l||null===(a=l.classList)||void 0===a||a.add("vf-voices"),this.multiRestElement.setStave(this.stave),this.multiRestElement.setContext(e),this.multiRestElement.draw(),e.closeGroup();var u,c=_createForOfIteratorHelper(this.connectors);try{for(c.s();!(u=c.n()).done;){u.value.setContext(e).draw()}}catch(err){c.e(err)}finally{c.f()}return e.closeGroup(),o}},{key:"format",value:function(){}},{key:"getVoicesWithinMeasure",value:function(){return[]}},{key:"getGraphicalVoiceEntriesPerVoice",value:function(e){return[]}},{key:"getRestFilledVexFlowStaveNotesPerVoice",value:function(e){return[]}},{key:"handleBeam",value:function(e,t){}},{key:"handleTuplet",value:function(e,t){}},{key:"finalizeBeams",value:function(){}},{key:"finalizeTuplets",value:function(){}},{key:"layoutStaffEntry",value:function(e){}},{key:"graphicalMeasureCreatedCalculations",value:function(){}},{key:"createArticulations",value:function(){}},{key:"createOrnaments",value:function(){}},{key:"createFingerings",value:function(e){}},{key:"getVFStave",value:function(){return this.stave}}]),n}(VexFlowMeasure),VF$5=Vex.Flow,VexFlowBackend=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,[{key:"getInnerElement",value:function(){return this.inner}},{key:"getCanvas",value:function(){return this.canvas}},{key:"getRenderElement",value:function(){var e=this.canvas;return this.getVexflowBackendType()===VF$5.Renderer.Backends.CANVAS&&(e=this.inner),e}},{key:"getRenderer",value:function(){return this.renderer}},{key:"removeAllChildrenFromContainer",value:function(e){for(;0!==e.children.length;)e.removeChild(e.children.item(0))}},{key:"removeFromContainer",value:function(e){for(var t=this.getRenderElement(),n=0;n0&&void 0!==arguments[0]?arguments[0]:300,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300;this.graphicalMusicPage||(this.graphicalMusicPage=new GraphicalMusicPage(void 0),this.graphicalMusicPage.PageNumber=1),this.canvas=document.createElement("canvas"),this.canvas.width=e,this.canvas.height=t,this.renderer=new VF$4.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext()}},{key:"getContext",value:function(){return this.ctx}},{key:"clear",value: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())}},{key:"scale",value:function(e){this.ctx.scale(e,e)}},{key:"translate",value:function(e,t){this.CanvasRenderingCtx.translate(e,t)}},{key:"renderText",value:function(e,t,n,r,i,a){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:void 0,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:void 0,l=this.CanvasRenderingCtx.font;this.CanvasRenderingCtx.save(),this.CanvasRenderingCtx.font=VexFlowConverter.font(e,t,n,this.rules,s),this.CanvasRenderingCtx.fillStyle=o,this.CanvasRenderingCtx.strokeStyle=o,this.CanvasRenderingCtx.fillText(r,a.x,a.y+i),this.CanvasRenderingCtx.restore(),this.CanvasRenderingCtx.font=l}},{key:"renderRectangle",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=this.CanvasRenderingCtx.fillStyle;this.CanvasRenderingCtx.fillStyle=n||VexFlowConverter.style(t),this.CanvasRenderingCtx.globalAlpha=r,this.ctx.fillRect(e.x,e.y,e.width,e.height),this.CanvasRenderingCtx.fillStyle=i,this.CanvasRenderingCtx.globalAlpha=1}},{key:"renderLine",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"#FF0000FF",r=this.CanvasRenderingCtx.strokeStyle;this.CanvasRenderingCtx.strokeStyle=n,this.CanvasRenderingCtx.beginPath(),this.CanvasRenderingCtx.moveTo(e.x,e.y),this.CanvasRenderingCtx.lineTo(t.x,t.y),this.CanvasRenderingCtx.stroke(),this.CanvasRenderingCtx.strokeStyle=r}},{key:"renderCurve",value:function(e){this.ctx.beginPath(),this.ctx.moveTo(e[0].x,e[0].y),this.ctx.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y),this.ctx.lineTo(e[7].x,e[7].y),this.ctx.bezierCurveTo(e[6].x,e[6].y,e[5].x,e[5].y,e[4].x,e[4].y),this.ctx.lineTo(e[0].x,e[0].y),this.ctx.closePath(),this.ctx.fill()}},{key:"CanvasRenderingCtx",get:function(){return this.ctx.vexFlowCanvasContext}}]),n}(VexFlowBackend),VF$3=Vex.Flow,SvgVexFlowBackend=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e){var r;return _classCallCheck2(this,n),(r=t.call(this)).rules=e,r}return _createClass2(n,[{key:"getVexflowBackendType",value:function(){return VF$3.Renderer.Backends.SVG}},{key:"getOSMDBackendType",value:function(){return BackendType.SVG}},{key:"getCanvasSize",value:function(){var e;return null===(e=document.getElementById(this.rules.DYContainerId+this.graphicalMusicPage.PageNumber))||void 0===e?void 0:e.offsetHeight}},{key:"initialize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;this.zoom=t,this.canvas=document.createElement("div"),n||(n=this.graphicalMusicPage?this.graphicalMusicPage.PageNumber.toString():"1"),this.canvas.id=this.rules.DYContainerId+n,this.inner=this.canvas,this.inner.style.position="relative",this.canvas.style.zIndex="0",e.appendChild(this.inner),this.renderer=new Vex.Flow.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext(),this.ctx.svg.id=this.rules.DYSVGContainerId+n}},{key:"getContext",value:function(){return this.ctx}},{key:"getSvgElement",value:function(){return this.ctx.svg}},{key:"removeNode",value:function(e){var t,n=null===(t=this.ctx)||void 0===t?void 0:t.svg;if(!n)return!1;try{n.removeChild(e)}catch(r){return loglevelExports.error(r),!1}return!0}},{key:"clear",value:function(){if(this.ctx){for(var e=this.ctx.svg;e.lastChild;)e.removeChild(e.lastChild);this.rules.PageBackgroundColor&&(this.ctx.svg.style["background-color"]=this.rules.PageBackgroundColor)}}},{key:"scale",value:function(e){this.ctx.scale(e,e)}},{key:"translate",value:function(e,t){}},{key:"renderText",value:function(e,t,n,r,i,a){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:void 0,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:void 0;this.ctx.save();var l=this.ctx.openGroup("text");o&&(this.ctx.attributes.fill=o,this.ctx.attributes.stroke=o);var u=s;s&&"default"!==s||(u=this.rules.DefaultFontFamily),this.ctx.setFont(u,e,VexFlowConverter.fontStyle(t)),this.ctx.attributes["font-size"]="".concat(e,"px"),this.ctx.state["font-size"]="".concat(e,"px");var c="normal",h="normal";switch(t){case FontStyles.Bold:c="bold";break;case FontStyles.Italic:h="italic";break;case FontStyles.BoldItalic:c="bold",h="italic";break;default:c="normal"}return this.ctx.attributes["font-weight"]=c,this.ctx.state["font-weight"]=c,this.ctx.attributes["font-style"]=h,this.ctx.state["font-style"]=h,this.ctx.fillText(r,a.x,a.y+i),this.ctx.closeGroup(),this.ctx.restore(),l}},{key:"renderRectangle",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.ctx.save();var i=this.ctx.openGroup("rect");return this.ctx.attributes.fill=n||VexFlowConverter.style(t),this.ctx.attributes["fill-opacity"]=r,this.ctx.fillRect(e.x,e.y,e.width,e.height),this.ctx.restore(),this.ctx.attributes["fill-opacity"]=1,this.ctx.closeGroup(),i}},{key:"renderLine",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"#FF0000FF",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;this.ctx.save();var i=this.ctx.openGroup("line");return this.ctx.beginPath(),this.ctx.moveTo(e.x,e.y),this.ctx.lineTo(t.x,t.y),this.ctx.attributes.stroke=n,this.ctx.lineWidth=r,this.ctx.stroke(),this.ctx.closeGroup(),this.ctx.restore(),i}},{key:"renderCurve",value:function(e){var t=this.ctx.openGroup("curve");return this.ctx.beginPath(),this.ctx.moveTo(e[0].x,e[0].y),this.ctx.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y),this.ctx.lineTo(e[7].x,e[7].y),this.ctx.bezierCurveTo(e[6].x,e[6].y,e[5].x,e[5].y,e[4].x,e[4].y),this.ctx.lineTo(e[0].x,e[0].y),this.ctx.closePath(),this.ctx.fill(),this.ctx.closeGroup(),t}},{key:"export",value:function(){var e=this.ctx.svg.cloneNode(!0),t=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),n=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",t);n.replaceChild(e,n.documentElement);var r=(new XMLSerializer).serializeToString(n),i=document.createElement("a");i.href="data:image/svg+xml; charset=utf8, "+encodeURIComponent(r.replace(/>\n\r<")),i.download="opensheetmusicdisplay_download.svg",i.innerHTML=window.location.href+"/download",document.body.appendChild(i)}}]),n}(VexFlowBackend),VexFlowInstantaneousDynamicExpression=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i){var a;_classCallCheck2(this,n),a=t.call(this,e,r,i);var o=new Label(a.Expression);return a.label=new GraphicalLabel(o,a.rules.ContinuousDynamicTextHeight,TextAlignmentEnum.CenterCenter,a.rules,a.PositionAndShape),a.label.Label.fontStyle=FontStyles.BoldItalic,a.label.setLabelPositionAndShapeBorders(),a.PositionAndShape.calculateBoundingBox(),a}return _createClass2(n,[{key:"InstantaneousDynamic",get:function(){return this.mInstantaneousDynamicExpression}},{key:"Expression",get:function(){return DynamicEnum[this.mInstantaneousDynamicExpression.DynEnum]}}]),n}(GraphicalInstantaneousDynamicExpression),GraphicalOctaveShift=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i;return _classCallCheck2(this,n),(i=t.call(this)).getOctaveShift=e,i.setSymbol(),i.PositionAndShape=new BoundingBox$1(_assertThisInitialized2(i),r),i}return _createClass2(n,[{key:"setSymbol",value:function(){switch(this.getOctaveShift.Type){case OctaveEnum.VA8:this.octaveSymbol=MusicSymbol.VA8;break;case OctaveEnum.VB8:this.octaveSymbol=MusicSymbol.VB8;break;case OctaveEnum.MA15:this.octaveSymbol=MusicSymbol.MA15;break;case OctaveEnum.MB15:this.octaveSymbol=MusicSymbol.MB15;break;default:throw new ArgumentOutOfRangeException("")}}}]),n}(GraphicalObject),VF$2=Vex.Flow,VexFlowOctaveShift=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i;switch(_classCallCheck2(this,n),i=t.call(this,e,r),e.Type){case OctaveEnum.VA8:i.position=VF$2.TextBracket.Positions.TOP,i.supscript="va",i.text="8";break;case OctaveEnum.MA15:i.position=VF$2.TextBracket.Positions.TOP,i.supscript="ma",i.text="15";break;case OctaveEnum.VB8:i.position=VF$2.TextBracket.Positions.BOTTOM,i.supscript="vb",i.text="8";break;case OctaveEnum.MB15:i.position=VF$2.TextBracket.Positions.BOTTOM,i.supscript="mb",i.text="15";break;default:loglevelExports.error("Unknown or NONE octaveshift. This should not be called!")}return i}return _createClass2(n,[{key:"setStartNote",value:function(e){var t,n=_createForOfIteratorHelper(e.graphicalVoiceEntries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(null!=r&&r.vfStaveNote)return this.startNote=r.vfStaveNote,!0}}catch(err){n.e(err)}finally{n.f()}return!1}},{key:"setEndNote",value:function(e){var t,n=_createForOfIteratorHelper(e.graphicalVoiceEntries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(null!=r&&r.vfStaveNote)return this.endNote=r.vfStaveNote,!0}}catch(err){n.e(err)}finally{n.f()}return!1}},{key:"getTextBracket",value:function(){return new VF$2.TextBracket({position:this.position,start:this.startNote,stop:this.endNote,superscript:this.supscript,text:this.text})}}]),n}(GraphicalOctaveShift),VexflowStafflineNoteCalculator=function(){function e(t){_classCallCheck2(this,e),this.staffPitchListMapping=new Dictionary,this.baseLineNote=NoteEnum.B,this.baseLineOctave=1,this.rules=t}return _createClass2(e,[{key:"trackNote",value:function(t){if(t instanceof VexFlowGraphicalNote&&t.Clef().ClefType===ClefEnum.percussion&&!t.sourceNote.isRest()&&0!==this.rules.PercussionOneLineCutoff&&-1!==this.rules.PercussionForceVoicesOneLineCutoff){var n,r=t.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet;this.staffPitchListMapping.containsKey(r)||this.staffPitchListMapping.setValue(r,new Array),n=this.staffPitchListMapping.getValue(r);var i=t.sourceNote.Pitch;e.findOrInsert(n,i)}}},{key:"positionNote",value:function(t){var n=t.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet;if(!(t instanceof VexFlowGraphicalNote)||t.sourceNote.isRest()||!this.staffPitchListMapping.containsKey(n))return t;var r=this.staffPitchListMapping.getValue(n),i=this.rules.PercussionUseXMLDisplayStep&&void 0!==t.sourceNote.displayStepUnpitched;if(r.length>this.rules.PercussionOneLineCutoff&&!i)return t;var a=t,o=t.sourceNote.Pitch,s=this.baseLineNote,l=this.baseLineOctave;if(this.rules.PercussionUseXMLDisplayStep&&void 0!==t.sourceNote.displayStepUnpitched&&(s=t.sourceNote.displayStepUnpitched,l=t.sourceNote.displayOctaveUnpitched+this.rules.PercussionOneLineXMLDisplayStepOctaveOffset),r.length<=this.rules.PercussionForceVoicesOneLineCutoff)a.setAccidental(new Pitch(s,l,o.Accidental));else{var u=e.PitchIndexOf(r,o);if(u>-1){var c=Math.ceil(r.length/2);if(!this.rules.PercussionUseXMLDisplayStep)if(u>=c)switch(l=2,(u-c)%5){case 1:s=NoteEnum.E;break;case 2:s=NoteEnum.G;break;case 3:s=NoteEnum.B;break;case 4:s=NoteEnum.D,l=3;break;default:s=NoteEnum.C}else switch(u%5){case 1:s=NoteEnum.F;break;case 2:s=NoteEnum.D;break;case 3:s=NoteEnum.B,l=0;break;case 4:s=NoteEnum.G,l=0;break;default:s=NoteEnum.A}var h=new Pitch(s,l,o.Accidental);a.setAccidental(h);var d=a.parentVoiceEntry.parentVoiceEntry;!this.rules.SetWantedStemDirectionByXml&&d.Notes.length<2&&(h.Octave>this.baseLineOctave||h.FundamentalNote===this.baseLineNote&&h.Octave===this.baseLineOctave?a.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=StemDirectionType.Up:a.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=StemDirectionType.Down)}}return a}},{key:"getStafflineUniquePositionCount",value:function(e){return this.staffPitchListMapping.containsKey(e)?this.staffPitchListMapping.getValue(e).length:0}}],[{key:"PitchIndexOf",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(n>e.length-1)return-1;for(var r=n;r0||s.IsExtraGraphicalMeasure||(loglevelExports.warn("SkyBottomLineCalculator: width not > 0 in measure "+s.MeasureNumber),u=50),u>=50||!s.IsExtraGraphicalMeasure){r.initializeHeadless(u);var c=r.getContext(),h=r.getCanvas();u=h.width;var d=h.height;"jianpu"===this.mRules.DYMusicScoreType?l.setY(l.y-50):l.setY(l.y+100);var f=l.getWidth();l.setWidth(u),s.format(),l.setWidth(f);try{s.draw(c)}catch(T){loglevelExports.warn("SkyBottomLineCalculator.calculateLines.draw",T)}for(var p=c.getImageData(0,0,u,d),v=Math.max(Math.ceil(s.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),m=new Array(v),g=new Array(v),y=0;y0){m[y]=b;break}}for(var S=d;S>0;S--){var x=S*u*4+4*y;if(p.data[x+3]>0){g[y]=S;break}}}for(var w=0;w=0;n--)if(!isNaN(t[n]))return t[n];return 0}},{key:"findNextValidNumber",value:function(e,t){if(e>=t.length)return t[e-1];for(var n=e;n2&&void 0!==arguments[2]?arguments[2]:"#FF0000FF",r=t.getContext(),i=r.fillStyle;r.fillStyle=n,r.fillRect(e.x,e.y,2,2),r.fillStyle=i}},{key:"updateSkyLineWithWedge",value:function(e,t){var n=Math.floor(e.x*this.SamplingUnit),r=Math.ceil(t.x*this.SamplingUnit),i=(t.y-e.y)/(t.x-e.x);r-n<=1&&(r++,i=0),n<0&&(n=0),n>=this.BottomLine.length&&(n=this.BottomLine.length-1),r<0&&(r=0),r>=this.BottomLine.length&&(r=this.BottomLine.length),this.SkyLine[n]=e.y;for(var a=n+1;a=this.BottomLine.length&&(n=this.BottomLine.length-1),r<0&&(r=0),r>=this.BottomLine.length&&(r=this.BottomLine.length),this.BottomLine[n]=e.y;for(var a=n+1;a=t?t-1:n}},{key:"getRightIndexForPointX",value:function(e,t){var n=Math.ceil(e*this.SamplingUnit);return n<0?0:n>=t?t-1:n}},{key:"updateStaffLineBorders",value: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()}},{key:"getSkyLineMin",value:function(){return Math.min.apply(Math,_toConsumableArray2(this.SkyLine.filter((function(e){return!isNaN(e)}))))}},{key:"getSkyLineMinAtPoint",value:function(e){var t=Math.round(e*this.SamplingUnit);return this.mSkyLine[t]}},{key:"getSkyLineMinInRange",value:function(e,t){return this.getMinInRange(this.SkyLine,e,t)}},{key:"getBottomLineMax",value:function(){return Math.max.apply(Math,_toConsumableArray2(this.BottomLine.filter((function(e){return!isNaN(e)}))))}},{key:"getBottomLineMaxAtPoint",value:function(e){var t=Math.round(e*this.SamplingUnit);return this.mBottomLine[t]}},{key:"getBottomLineMaxInRange",value:function(e,t){return this.getMaxInRange(this.BottomLine,e,t)}},{key:"getBottomLineMaxInBoundingBox",value:function(e){var t=Math.floor(e.AbsolutePosition.x+e.BorderLeft),n=Math.ceil(e.AbsolutePosition.x+e.BorderRight);return this.getMaxInRange(this.mBottomLine,t,n)}},{key:"updateWithBoundingBoxRecursively",value:function(e){if(e.ChildElements&&e.ChildElements.length>0){var t,n=_createForOfIteratorHelper(e.ChildElements);try{for(n.s();!(t=n.n()).done;){var r=t.value;this.updateWithBoundingBoxRecursively(r)}}catch(err){n.e(err)}finally{n.f()}}else{var i=e.BorderTop+e.AbsolutePosition.y,a=e.BorderBottom+e.AbsolutePosition.y;if(i<0){var o=Math.floor(e.AbsolutePosition.x+e.BorderLeft),s=Math.ceil(e.AbsolutePosition.x+e.BorderRight);this.updateInRange(this.mSkyLine,o,s,i)}else if(a>this.StaffLineParent.StaffHeight){var l=Math.floor(e.AbsolutePosition.x+e.BorderLeft),u=Math.ceil(e.AbsolutePosition.x+e.BorderRight);this.updateInRange(this.mBottomLine,l,u,a)}}}},{key:"updateInRange",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(t=Math.floor(t*this.SamplingUnit),(n=Math.ceil(n*this.SamplingUnit))e.length&&(n=e.length);for(var i=t;iMath.abs(e[i])?r:e[i]}},{key:"setInRange",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(t=Math.floor(t*this.SamplingUnit),(n=Math.ceil(n*this.SamplingUnit))e.length&&(n=e.length);for(var i=t;i=e.length&&(t=e.length-1),n<0&&(n=0),n>=e.length&&(n=e.length),t>=0&&n<=e.length?Math.min.apply(Math,_toConsumableArray2(e.slice(t,n+1))):void 0):Number.MAX_VALUE}},{key:"getMaxInRange",value:function(e,t,n){return t=Math.floor(t*this.SamplingUnit),n=Math.ceil(n*this.SamplingUnit),e?(t<0&&(t=0),t>=e.length&&(t=e.length-1),n<0&&(n=0),n>=e.length&&(n=e.length),t>=0&&n<=e.length?Math.max.apply(Math,_toConsumableArray2(e.slice(t,n+1))):void 0):Number.MIN_VALUE}},{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}}]),e}(),parserExports$1={},parser$2={get exports(){return parserExports$1},set exports(e){parserExports$1=e}}; /*! * d-path-parser - v1.0.0 * by Massimo Artizzu (MaxArt2501) * * https://github.com/MaxArt2501/d-path-parser * * Licensed under the MIT License * See LICENSE for details */ !function(e,t){e.exports=function(e){for(var t={command:/\s*([achlmqstvz])/gi,number:/\s*([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/gi,comma:/\s*(?:(,)|\s)/g,flag:/\s*([01])/g},n={number:function(e){return+c("number",e)},"coordinate pair":function(e){var t=c("number",e);return null!==t||e?(c("comma"),{x:+t,y:+c("number",!0)}):null},"arc definition":function(e){var t=n["coordinate pair"](e);if(!t&&!e)return null;c("comma");var r=+c("number",!0);c("comma",!0);var i=!!+c("flag",!0);c("comma");var a=!!+c("flag",!0);return c("comma"),{radii:t,rotation:r,large:i,clockwise:a,end:n["coordinate pair"](!0)}}},r=0,i=[];rt.bottom)switch(e.tagName.toLowerCase()){case"g":var c,h=_createForOfIteratorHelper(e.children);try{for(h.s();!(c=h.n()).done;){var d=c.value;this.recursiveUpdate(d,t,n,r)}}catch(err){h.e(err)}finally{h.f()}break;case"circle":case"rect":case"line":case"path":var f=Math.floor((i.x-n.x)/unitInPixels*this.mRules.SamplingUnit),p=f+Math.ceil(i.width/unitInPixels*this.mRules.SamplingUnit);if(e.parentElement.classList.contains("vf-beams")&&e.hasAttribute("d")){var v=parserExports$1(e.getAttribute("d"));if(5===v.length)for(var m=v[0],g=v[3],y=(g.end.y-m.end.y)/(g.end.x-m.end.x),b=m.end.y/unitInPixels;f<=p;f++)bu[f]&&(u[f]=b),b+=y/this.mRules.SamplingUnit}else for(;f<=p;f++)au[f]&&(u[f]=o)}}},{key:"calculateLinesForMeasure",value:function(e,t){var n,r,i,a,o=t.getBBox(),s=Math.max(Math.round(e.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),l=o.height/unitInPixels,u=t.getElementsByClassName("vf-stave")[0].getBBox(),c=(null==u?void 0:u.height)/unitInPixels,h=(null==u?void 0:u.y)/unitInPixels,d=e.getVFStave(),f=(null!==(n=d.options)&&void 0!==n&&n.num_lines?d.options.num_lines:5)-1,p=-1,v=0,m=[f],g=_createForOfIteratorHelper(null===(i=d.options)||void 0===i?void 0:i.line_config);try{for(g.s();!(a=g.n()).done;){a.value.visible?(-1===p&&(p=v),m.push(v)):f--,v++}}catch(err){g.e(err)}finally{g.f()}-1===p&&(p=0),f=m.pop()-p;var y=null===(r=d.options)||void 0===r?void 0:r.spacing_between_lines_px,b=f*y/unitInPixels;c-b>.2&&(c=b,h=p*y/unitInPixels);var A=h+c,S=new Array(s).fill(h),x=new Array(s).fill(A),w=[S,x];if(l>c){var _,E=_createForOfIteratorHelper(t.children);try{for(E.s();!(_=E.n()).done;){var k=_.value;this.recursiveUpdate(k,{top:h,bottom:A},o,[S,x])}}catch(err){E.e(err)}finally{E.f()}}return w}},{key:"calculateLines",value:function(){this.mSkyLine=[],this.mBottomLine=[];var e=document.createElement("div");document.body.append(e);var t=new SvgVexFlowBackend(this.mRules);t.initialize(e,1,"0");var n=t.getContext(),r=n.openGroup();r.classList.add("staffline");var i,a=_createForOfIteratorHelper(this.StaffLineParent.Measures);try{for(a.s();!(i=a.n()).done;){var o,s,l=i.value;l.PositionAndShape.calculateAbsolutePositionsRecursive(0,0),l.setAbsoluteCoordinates(l.PositionAndShape.AbsolutePosition.x*unitInPixels,l.PositionAndShape.AbsolutePosition.y*unitInPixels);var u=l.draw(n),c=_slicedToArray(this.calculateLinesForMeasure(l,u),2),h=c[0],d=c[1];(o=this.mSkyLine).push.apply(o,_toConsumableArray2(h)),(s=this.mBottomLine).push.apply(s,_toConsumableArray2(d))}}catch(err){a.e(err)}finally{a.f()}n.closeGroup();var f,p=_createForOfIteratorHelper(r.getElementsByClassName("vf-ties"));try{for(p.s();!(f=p.n()).done;){var v,m=_createForOfIteratorHelper(f.value.childNodes);try{for(m.s();!(v=m.n()).done;){var g=v.value;if("path"===g.nodeName.toLowerCase())for(var y=g.getBBox(),b=Math.floor(y.x/unitInPixels*this.mRules.SamplingUnit),A=b+Math.ceil(y.width/unitInPixels*this.mRules.SamplingUnit),S=y.y/unitInPixels,x=y.height/unitInPixels+S;b<=A;b++)Sthis.mBottomLine[b]&&(this.mBottomLine[b]=x)}}catch(err){m.e(err)}finally{m.f()}}}catch(err){p.e(err)}finally{p.f()}t.clear(),e.remove()}}]),n}(SkyBottomLineCalculator),VF$1=Vex.Flow,VexFlowGraphicalSymbolFactory=function(){function e(){_classCallCheck2(this,e),this.hasBBox=!1,void 0!==document.createElementNS("http://www.w3.org/2000/svg","g").getBBox&&(this.hasBBox=!0)}return _createClass2(e,[{key:"createMusicSystem",value:function(e,t){return new VexFlowMusicSystem(e,t)}},{key:"createStaffLine",value:function(e,t){return new VexFlowStaffLine(e,t)}},{key:"createSkyBottomLineCalculator",value:function(e){return e.ParentMusicSystem.rules.PerformanceMode&&this.hasBBox?new SkyBottomLineCalculatorSVG(e):new SkyBottomLineCalculator(e)}},{key:"createGraphicalMeasure",value:function(e,t){return new VexFlowMeasure(t,e,void 0)}},{key:"createMultiRestMeasure",value:function(e,t,n){return new VexFlowMultiRestMeasure(t,e,n)}},{key:"createTabStaffMeasure",value:function(e,t){return new VexFlowTabMeasure(t,e)}},{key:"createExtraGraphicalMeasure",value:function(e){var t=new VexFlowMeasure(e.ParentStaff,void 0,e);return t.IsExtraGraphicalMeasure=!0,t.ExtraGraphicalMeasurePreviousMeasure=e.Measures.last(),t}},{key:"createStaffEntry",value:function(e,t){return new VexFlowStaffEntry(t,e,void 0)}},{key:"createVoiceEntry",value:function(e,t){return new VexFlowVoiceEntry(e,t)}},{key:"createNote",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:OctaveEnum.NONE;return new VexFlowGraphicalNote(e,t,n,r,arguments.length>4?arguments[4]:void 0,arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0)}},{key:"createGraceNote",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:OctaveEnum.NONE;return new VexFlowGraphicalNote(e,t,n,i,r)}},{key:"addGraphicalAccidental",value:function(e,t){e.setAccidental(t)}},{key:"addFermataAtTiedEndNote",value:function(e,t){}},{key:"createInStaffClef",value:function(e,t){var n=e,r=VexFlowConverter.Clef(t,"small");n.vfClefBefore=new VF$1.ClefNote(r.type,r.size,r.annotation)}},{key:"createChordSymbols",value:function(e,t,n,r){var i,a=t.parentMeasure.parentSourceMeasure.Rules,o=0,s=a.ChordSymbolXSpacing,l=_createForOfIteratorHelper(e.ChordContainers);try{for(l.s();!(i=l.n()).done;){var u=i.value,c=new GraphicalChordSymbolContainer(u,t.PositionAndShape,a.ChordSymbolTextHeight,n,r,t.parentMeasure.parentSourceMeasure.Rules),h=c.GraphicalLabel;h.PositionAndShape.RelativePosition.y-=a.ChordSymbolYOffset,h.PositionAndShape.RelativePosition.x+=o,h.setLabelPositionAndShapeBorders(),c.PositionAndShape.calculateBoundingBox(),t.graphicalChordContainers.push(c),o+=h.PositionAndShape.Size.width+s}}catch(err){l.e(err)}finally{l.f()}}},{key:"createGraphicalTechnicalInstruction",value:function(e,t){}}]),e}(),GraphicalTie=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;_classCallCheck2(this,e),this.tie=t,this.startNote=n,this.endNote=r}return _createClass2(e,[{key:"SVGElement",get:function(){return this.vfTie.getAttribute("el")}},{key:"GetTie",get:function(){return this.tie}},{key:"StartNote",get:function(){return this.startNote},set:function(e){this.startNote=e}},{key:"Tie",get:function(){return this.tie}},{key:"EndNote",get:function(){return this.endNote},set:function(e){this.endNote=e}}]),e}(),GraphicalLyricEntry=function(){function e(t,n,r,i){_classCallCheck2(this,e),this.lyricsEntry=t,this.graphicalStaffEntry=n;var a=n.parentMeasure.parentSourceMeasure.Rules.LyricsAlignmentStandard;t.Text.length>=4&&t.Parent.Notes[0].Length.Denominator>4&&TextAlignmentEnum.LeftBottom;var o=new Label(t.Text);this.graphicalLabel=new GraphicalLabel(o,r,a,this.graphicalStaffEntry.parentMeasure.parentSourceMeasure.Rules,n.PositionAndShape),this.graphicalLabel.PositionAndShape.RelativePosition=new PointF2D(0,i),a===TextAlignmentEnum.LeftBottom&&(this.graphicalLabel.PositionAndShape.RelativePosition.x-=1)}return _createClass2(e,[{key:"LyricsEntry",get:function(){return this.lyricsEntry}},{key:"ParentLyricWord",get:function(){return this.graphicalLyricWord},set:function(e){this.graphicalLyricWord=e}},{key:"GraphicalLabel",get:function(){return this.graphicalLabel},set:function(e){this.graphicalLabel=e}},{key:"StaffEntryParent",get:function(){return this.graphicalStaffEntry},set:function(e){this.graphicalStaffEntry=e}}]),e}(),GraphicalLyricWord=function(){function e(t){_classCallCheck2(this,e),this.graphicalLyricsEntries=[],this.lyricWord=t,this.initialize()}return _createClass2(e,[{key:"GetLyricWord",get:function(){return this.lyricWord}},{key:"GraphicalLyricsEntries",get:function(){return this.graphicalLyricsEntries},set:function(e){this.graphicalLyricsEntries=e}},{key:"isFilled",value:function(){for(var e=0;e=e.bezierCurveStepSize?new PointF2D:new PointF2D(e.oneMinusTPow3[n]*this.bezierStartPt.x+e.bezierFactorOne[n]*this.bezierStartControlPt.x+e.bezierFactorTwo[n]*this.bezierEndControlPt.x+e.tPow3[n]*this.bezierEndPt.x,e.oneMinusTPow3[n]*this.bezierStartPt.y+e.bezierFactorOne[n]*this.bezierStartControlPt.y+e.bezierFactorTwo[n]*this.bezierEndControlPt.y+e.tPow3[n]*this.bezierEndPt.y)}}]),e}(),GraphicalCurve=_GraphicalCurve;GraphicalCurve.bezierCurveStepSize=1e3;var _GraphicalSlur=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i;return _classCallCheck2(this,n),(i=t.call(this)).staffEntries=[],i.slur=e,i.rules=r,i}return _createClass2(n,[{key:"calculateCurve",value:function(e){var t=this.staffEntries[0],n=this.staffEntries[this.staffEntries.length-1],r=t.findGraphicalNoteFromNote(this.slur.StartNote);!r&&this.graceStart&&(r=t.findGraphicalNoteFromGraceNote(this.slur.StartNote)),r||(r=t.findEndTieGraphicalNoteFromNoteWithStartingSlur(this.slur.StartNote,this.slur));var i=n.findGraphicalNoteFromNote(this.slur.EndNote);!i&&this.graceEnd&&(i=n.findGraphicalNoteFromGraceNote(this.slur.EndNote));var a=t.parentMeasure.ParentStaffLine,o=a.SkyBottomLineCalculator;this.calculatePlacement(o,a);var s,l=this.calculateStartAndEnd(r,i,a,e,o),u=l.startX,c=l.endX,h=l.startY,d=l.endY,f=e.SlurTangentMinAngle,p=e.SlurTangentMaxAngle;if(this.placement===PlacementEnum.Above){h-=e.SlurNoteHeadYOffset,d-=e.SlurNoteHeadYOffset;var v=new PointF2D(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,h);r?v.x+=this.staffEntries[0].PositionAndShape.BorderRight:v.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(v.x+=n.PositionAndShape.RelativePosition.x);var m=new PointF2D(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,d);if(i?m.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:m.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(m.x+=n.staffEntryParent.PositionAndShape.RelativePosition.x),0===(s=this.calculateTopPoints(v,m,a,o)).length){var g=new PointF2D((m.x-v.x)/2+v.x,(m.y-v.y)/2+v.y);s.push(g)}var y=Math.atan((d-h)/(c-u)),b=new PointF2D(0,0),A=new PointF2D(c-u,-(d-h)),S=Matrix2D.getRotationMatrix(y),x=S.getTransposeMatrix();A=S.vectorMultiplication(A);var w=this.calculateTranslatedAndRotatedPointListAbove(s,u,h,S),_=this.calculateMaxLeftSlope(w,b,A),E=this.calculateMaxRightSlope(w,b,A),k=b.y-b.x*_,C=A.y-A.x*E,M=new PointF2D,P=!1;Math.abs(Math.abs(_)-Math.abs(E))<1e-4?(M.x=A.x/2,M.y=0,P=!0):(M.x=(C-k)/(_-E),M.y=_*M.x+k);var I=this.calculateHeightWidthRatio(A.x,w),T=0,B=0;if(Math.abs(I)>.001){var R=Math.abs(_/(2*I)),L=Math.abs(_);_-=T=Math.max(0,L*(Math.min(10,R-1)/10));var N=Math.abs(E/(2*I)),F=Math.abs(E);E+=B=Math.max(0,F*(Math.min(10,N-1)/10))}var D=f,O=-f;if(!P){var V=this.calculateAngles(f,_,E,p);D=V.startAngle,O=V.endAngle}var z=this.calculateControlPoints(A.x,D,O,w,I,h,d),G=z.startControlPoint,H=z.endControlPoint;(G=x.vectorMultiplication(G)).x+=u,G.y=-G.y+h,(H=x.vectorMultiplication(H)).x+=u,H.y=-H.y+h,this.bezierStartPt=new PointF2D(u,h-T),this.bezierStartControlPt=new PointF2D(G.x,G.y-T),this.bezierEndControlPt=new PointF2D(H.x,H.y-B),this.bezierEndPt=new PointF2D(c,d-B);for(var U=a.SkyLine.length,j=o.getLeftIndexForPointX(this.bezierStartPt.x,U),Q=o.getLeftIndexForPointX(this.bezierEndPt.x,U),Y=this.bezierEndPt.x-this.bezierStartPt.x,W=o.SamplingUnit,X=j;X=j&&(a.SkyLine[$]=Math.min(a.SkyLine[$],J.y)),++$.001){var me=Math.abs(se/(2*fe)),ge=Math.abs(se);se-=pe=Math.max(0,ge*(Math.min(10,me-1)/10));var ye=Math.abs(le/(2*fe)),be=Math.abs(le);le+=ve=Math.max(0,be*(Math.min(10,ye-1)/10))}var Ae=f,Se=-f;if(!de){var xe=this.calculateAngles(f,se,le,p);Ae=xe.startAngle,Se=xe.endAngle}var we=this.calculateControlPoints(re.x,Ae,Se,oe,fe,h,d),_e=we.startControlPoint,Ee=we.endControlPoint;(_e=ae.vectorMultiplication(_e)).x+=u,_e.y+=h,(Ee=ae.vectorMultiplication(Ee)).x+=u,Ee.y+=h,this.bezierStartPt=new PointF2D(u,h+pe),this.bezierStartControlPt=new PointF2D(_e.x,_e.y+pe),this.bezierEndControlPt=new PointF2D(Ee.x,Ee.y+ve),this.bezierEndPt=new PointF2D(c,d+ve);for(var ke=a.BottomLine.length,Ce=o.getLeftIndexForPointX(this.bezierStartPt.x,ke),Me=o.getLeftIndexForPointX(this.bezierEndPt.x,ke),Pe=this.bezierEndPt.x-this.bezierStartPt.x,Ie=o.SamplingUnit,Te=Ce;Te=Ce&&(a.BottomLine[Le]=Math.max(a.BottomLine[Le],Re.y)),++Le0)return void(this.placement=PlacementEnum.Above)}var o=this.staffEntries[0],s=this.staffEntries[this.staffEntries.length-1],l=o.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection;if(l===s.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection)this.placement=l===StemDirectionType.Up?PlacementEnum.Below:PlacementEnum.Above;else{var u=o.PositionAndShape.BorderLeft+o.PositionAndShape.RelativePosition.x+o.parentMeasure.PositionAndShape.RelativePosition.x,c=s.PositionAndShape.BorderRight+s.PositionAndShape.RelativePosition.x+s.parentMeasure.PositionAndShape.RelativePosition.x;this.graceStart&&(u+=s.PositionAndShape.RelativePosition.x),this.graceEnd&&(c+=s.staffEntryParent.PositionAndShape.RelativePosition.x);var h=-1*e.getSkyLineMinInRange(u,c),d=e.getBottomLineMaxInRange(u,c)-t.StaffHeight;this.placement=d>h?PlacementEnum.Above:PlacementEnum.Below}}}},{key:"calculateTopPoints",value:function(e,t,n,r){var i=[],a=r.getRightIndexForPointX(e.x,n.SkyLine.length),o=r.getLeftIndexForPointX(t.x,n.SkyLine.length);a<0&&(a=0),o>=n.SkyLine.length&&(o=n.SkyLine.length-1);for(var s=a;s=n.BottomLine.length&&(o=n.BottomLine.length-1);for(var s=a;sc&&e>h&&(u+=e/70*this.rules.SlurHeightFlattenLongSlursFactorByWidth,l/=u*=1+t/30*this.rules.SlurHeightFlattenLongSlursFactorByAngle);var d=Math.min(.5,Math.max(.1,1.7*t/80*l*Math.pow(Math.max(a,.05),.4))),f=Math.min(.5,Math.max(.1,1.7*-r/80*l*Math.pow(Math.max(a,.05),.4))),p=new PointF2D;p.x=e*d*Math.cos(t*n.degreesToRadiansFactor),p.y=e*d*Math.sin(t*n.degreesToRadiansFactor);var v=new PointF2D;v.x=e-e*f*Math.cos(r*n.degreesToRadiansFactor),v.y=-e*f*Math.sin(r*n.degreesToRadiansFactor);for(var m=p.y-v.y;this.rules.SlurMaximumYControlPointDistance&&Math.abs(m)>this.rules.SlurMaximumYControlPointDistance;)m<0?(p.y+=1,v.y-=1):(p.y-=1,v.y+=1),m=p.y-v.y;return{startControlPoint:p,endControlPoint:v}}},{key:"calculateAngles",value:function(e,t,r,i){var a=Math.atan(t)/n.degreesToRadiansFactor;t>0?a+=20:a-=20;var o=Math.atan(r)/n.degreesToRadiansFactor;return r<0?o-=20:o+=20,{startAngle:Math.min(Math.max(e,a),i),endAngle:Math.max(Math.min(-e,o),-i)}}}],[{key:"Compare",value:function(e,t){if(e.staffEntries.length<1)return-1;if(t.staffEntries.length<1)return 1;var n=Fraction$1.minus(e.staffEntries[e.staffEntries.length-1].getAbsoluteTimestamp(),e.staffEntries[0].getAbsoluteTimestamp()),r=Fraction$1.minus(t.staffEntries[t.staffEntries.length-1].getAbsoluteTimestamp(),t.staffEntries[0].getAbsoluteTimestamp());return n.RealValue>r.RealValue?1:r.RealValue>n.RealValue?-1:0}}]),n}(GraphicalCurve),GraphicalSlur=_GraphicalSlur;GraphicalSlur.degreesToRadiansFactor=Math.PI/180;var GraphicalPedal=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i;return _classCallCheck2(this,n),(i=t.call(this)).getPedal=e,i.setSymbol(),i.PositionAndShape=new BoundingBox$1(_assertThisInitialized2(i),r),i}return _createClass2(n,[{key:"setSymbol",value:function(){!this.getPedal.IsLine&&this.getPedal.IsSign?this.pedalSymbol=MusicSymbol.PEDAL_SYMBOL:this.getPedal.IsLine&&this.getPedal.IsSign?this.pedalSymbol=MusicSymbol.PEDAL_MIXED:this.pedalSymbol=MusicSymbol.PEDAL_BRACKET}}]),n}(GraphicalObject),VexFlowPedal=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];switch(_classCallCheck2(this,n),(i=t.call(this,e,r)).vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET,i.ChangeBegin=!1,i.ChangeEnd=!1,i.line=-3,i.EndSymbolPositionAndShape=void 0,i.ChangeBegin=e.ChangeBegin,i.ChangeEnd=e.ChangeEnd,i.pedalSymbol){case MusicSymbol.PEDAL_SYMBOL:i.vfStyle=Vex.Flow.PedalMarking.Styles.TEXT,i.EndSymbolPositionAndShape=new BoundingBox$1(_assertThisInitialized2(i),r);break;case MusicSymbol.PEDAL_MIXED:i.vfStyle=a&&o?Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:a?Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:o?Vex.Flow.PedalMarking.Styles.MIXED_OPEN_END:Vex.Flow.PedalMarking.Styles.MIXED;break;case MusicSymbol.PEDAL_BRACKET:default:i.vfStyle=a&&o?Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:a?Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:o?Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_END:Vex.Flow.PedalMarking.Styles.BRACKET}return i}return _createClass2(n,[{key:"setStartNote",value:function(e){if(!e)return!1;var t,n=_createForOfIteratorHelper(e.graphicalVoiceEntries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(null!=r&&r.vfStaveNote)return this.startNote=r.vfStaveNote,this.startVfVoiceEntry=r,!0}}catch(err){n.e(err)}finally{n.f()}return!1}},{key:"setEndNote",value:function(e){if(!e)return!1;var t,n=_createForOfIteratorHelper(e.graphicalVoiceEntries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(null!=r&&r.vfStaveNote)return this.endNote=r.vfStaveNote,this.endVfVoiceEntry=r,!0}}catch(err){n.e(err)}finally{n.f()}return!1}},{key:"setEndMeasure",value:function(e){this.endMeasure=e}},{key:"CalculateBoundingBox",value:function(){}},{key:"setLine",value:function(e){this.line=e}},{key:"getPedalMarking",value:function(){var e,t,n,r,i=new Vex.Flow.PedalMarking([this.startNote,this.endNote]);return this.endMeasure&&i.setEndStave(this.endMeasure.getVFStave()),i.setStyle(this.vfStyle),i.setLine(this.line),i.setCustomText(this.DepressText,this.ReleaseText),(null===(e=this.endVfVoiceEntry)||void 0===e?void 0:e.parentStaffEntry)!==(null===(t=this.endVfVoiceEntry)||void 0===t||null===(n=t.parentStaffEntry)||void 0===n||null===(r=n.parentMeasure)||void 0===r?void 0:r.staffEntries.last())&&this.endVfVoiceEntry||(i.EndsStave=!0),i.ChangeBegin=this.ChangeBegin,i.ChangeEnd=this.ChangeEnd,i}}]),n}(GraphicalPedal),GraphicalWavyLine=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i;return _classCallCheck2(this,n),(i=t.call(this)).getWavyLine=e,i.PositionAndShape=new BoundingBox$1(_assertThisInitialized2(i),r),i}return _createClass2(n)}(GraphicalObject),VexflowVibratoBracket=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return _classCallCheck2(this,n),(i=t.call(this,e,r)).line=1,i.isVibrato=!1,i.toEndOfStopStave=!1,i.isVibrato=a,i}return _createClass2(n,[{key:"ToEndOfStopStave",get:function(){return this.toEndOfStopStave}},{key:"setStartNote",value:function(e){var t,n=_createForOfIteratorHelper(e.graphicalVoiceEntries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(null!=r&&r.vfStaveNote)return this.startNote=r.vfStaveNote,this.startVfVoiceEntry=r,!0}}catch(err){n.e(err)}finally{n.f()}return!1}},{key:"setEndNote",value:function(e){var t,n=_createForOfIteratorHelper(e.graphicalVoiceEntries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(null!=r&&r.vfStaveNote){this.endNote=r.vfStaveNote,this.endVfVoiceEntry=r;var i=this.endVfVoiceEntry.parentStaffEntry.parentMeasure.staffEntries,a=i[i.length-1];return this.toEndOfStopStave=a===this.endVfVoiceEntry.parentStaffEntry,!0}}}catch(err){n.e(err)}finally{n.f()}return!1}},{key:"CalculateBoundingBox",value:function(){var e=this.getVibratoBracket();this.boundingBox.Size.height=.2*e.render_options.wave_height}},{key:"getVibratoBracket",value:function(){var e=new Vex.Flow.VibratoBracket({start:this.startNote,stop:this.endNote,toEndOfStopStave:this.toEndOfStopStave});return e.setLine(this.line),this.isVibrato?e.render_options.vibrato_width=20:e.render_options.wave_girth=4,e}}]),n}(GraphicalWavyLine),VF=Vex.Flow,VexFlowMusicSheetCalculator=function(t){_inherits2(r,t);var n=_createSuper2(r);function r(e){var t,i,a,o,s,l;if(_classCallCheck2(this,r),(a=n.call(this)).beamsNeedUpdate=!1,a.rules=e,MusicSheetCalculator.symbolFactory=new VexFlowGraphicalSymbolFactory,MusicSheetCalculator.TextMeasurer=new VexFlowTextMeasurer(a.rules),MusicSheetCalculator.stafflineNoteCalculator=new VexflowStafflineNoteCalculator(a.rules),"gonville"===(null===(t=a.rules.DefaultVexFlowNoteFont)||void 0===t?void 0:t.toLowerCase()))Vex.Flow.DEFAULT_FONT_STACK=[null===(o=Vex.Flow.Fonts)||void 0===o?void 0:o.Gonville,null===(s=Vex.Flow.Fonts)||void 0===s?void 0:s.Bravura,null===(l=Vex.Flow.Fonts)||void 0===l?void 0:l.Custom];else if("petaluma"===(null===(i=a.rules.DefaultVexFlowNoteFont)||void 0===i?void 0:i.toLowerCase())){var u,c,h;Vex.Flow.DEFAULT_FONT_STACK=[null===(u=Vex.Flow.Fonts)||void 0===u?void 0:u.Petaluma,null===(c=Vex.Flow.Fonts)||void 0===c?void 0:c.Gonville,null===(h=Vex.Flow.Fonts)||void 0===h?void 0:h.Bravura]}return a}return _createClass2(r,[{key:"clearRecreatedObjects",value:function(){_get(_getPrototypeOf2(r.prototype),"clearRecreatedObjects",this).call(this),MusicSheetCalculator.stafflineNoteCalculator=new VexflowStafflineNoteCalculator(this.rules);var e,t=_createForOfIteratorHelper(this.graphicalMusicSheet.MeasureList);try{for(t.s();!(e=t.n()).done;){var n,i=_createForOfIteratorHelper(e.value);try{for(i.s();!(n=i.n()).done;){var a=n.value;null==a||a.clean()}}catch(err){i.e(err)}finally{i.f()}}}catch(err){t.e(err)}finally{t.f()}}},{key:"formatMeasures",value:function(){var e,t=_createForOfIteratorHelper(this.graphicalMusicSheet.MeasureList);try{for(t.s();!(e=t.n()).done;){var n=e.value;if(n&&n[0]){n[0].format();var r,i=_createForOfIteratorHelper(n);try{for(i.s();!(r=i.n()).done;){var a,o=r.value,s=_createForOfIteratorHelper(o.staffEntries);try{for(s.s();!(a=s.n()).done;){a.value.calculateXPosition()}}catch(err){s.e(err)}finally{s.f()}o.finalizeBeams()}}catch(err){i.e(err)}finally{i.f()}}}}catch(err){t.e(err)}finally{t.f()}this.beamsNeedUpdate=!1}},{key:"calculateMeasureXLayout",value:function(e){var t,n=[],r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){var i=t.value;i&&n.push(i)}}catch(err){r.e(err)}finally{r.f()}if(0===n.length)return 0;e=n;var a,o=[],s=new VF.Formatter({softmaxFactor:this.rules.SoftmaxFactorVexFlow}),l=e[0].staffEntries.length,u=1,c=_createForOfIteratorHelper(e);try{for(c.s();!(a=c.n()).done;){var h=a.value;if(h){var d,f=0,p=_createForOfIteratorHelper(h.staffEntries);try{for(p.s();!(d=p.n()).done;){f+=d.value.setMaxAccidentals()}}catch(err){p.e(err)}finally{p.f()}h.parentSourceMeasure.ImplicitMeasure&&(l=Math.max(h.staffEntries.length,l),u=Math.max(h.staffEntries.length+f,u));var v=h.vfVoices,m=[];for(var g in v)v.hasOwnProperty(g)&&(m.push(v[g]),o.push(v[g]));0!==m.length?s.joinVoices(m):loglevelExports.debug("Found a measure with no voices. Continuing anyway.",v)}}}catch(err){c.e(err)}finally{c.f()}var y=12,b=e[0].parentSourceMeasure;if(o.length>0){y=s.preCalculateMinTotalWidth(o)/unitInPixels*this.rules.VoiceSpacingMultiplierVexflow+this.rules.VoiceSpacingAddendVexflow+.3*l,null!=b&&b.ImplicitMeasure&&(y=b.Duration.RealValue/b.ActiveTimeSignature.RealValue*y,l>1&&(y+=.3*u*1.5),y*=this.rules.PickupMeasureWidthMultiplier),MusicSheetCalculator.setMeasuresMinStaffEntriesWidth(e,y);var A,S=function(e,t){s.formatToStave(o,t.getVFStave())},x=function(e,t){s.formatToStave(o,t.getVFStave(),{align_rests:!0,context:void 0})},w=_createForOfIteratorHelper(e);try{for(w.s();!(A=w.n()).done;){var _=A.value;if(this.rules.AlignRests===AlignRestOption.Never)_.formatVoices=S;else if(this.rules.AlignRests===AlignRestOption.Always)_.formatVoices=x;else if(this.rules.AlignRests===AlignRestOption.Auto){var E,k=!1,C=_createForOfIteratorHelper(_.staffEntries);try{for(C.s();!(E=C.n()).done;){var M,P=E.value,I=0,T=0,B=_createForOfIteratorHelper(P.graphicalVoiceEntries);try{for(B.s();!(M=B.n()).done;){var R=M.value;if(R.parentVoiceEntry.IsGrace||R&&R.notes&&R.notes[0]&&R.notes[0].sourceNote&&R.notes[0].sourceNote.PrintObject&&I++,R&&R.notes&&R.notes[0]&&R.notes[0].sourceNote&&R.notes[0].sourceNote.isRest()&&R.notes[0].sourceNote.PrintObject&&T++,I>1&&T>=1){k=!0;break}}}catch(err){B.e(err)}finally{B.f()}if(k)break}}catch(err){C.e(err)}finally{C.f()}_.formatVoices=k?x:S}if(_===e[0]){var L=_;L.formatVoices(y*unitInPixels,L)}}}catch(err){w.e(err)}finally{w.f()}}var N,F=_createForOfIteratorHelper(e);try{for(F.s();!(N=F.n()).done;){var D=N.value;if(D){var O,V=_createForOfIteratorHelper(D.staffEntries);try{for(V.s();!(O=V.n()).done;){O.value.calculateXPosition()}}catch(err){V.e(err)}finally{V.f()}}}}catch(err){F.e(err)}finally{F.f()}var z,G=_createForOfIteratorHelper(e);try{for(G.s();!(z=G.n()).done;){var H=z.value;if(H){var U=H.vfVoices,j=[];for(var Q in U)U.hasOwnProperty(Q)&&j.push(U[Q]);0!==j.length?s.joinVoices(j):loglevelExports.debug("Found a measure with no voices. Continuing anyway.",U)}}}catch(err){G.e(err)}finally{G.f()}return y}},{key:"calculateElongationFactor",value:function(e,t,n,r,i,a,o,s){var l,u=i,c=0,h=_createForOfIteratorHelper(e);try{for(h.s();!(l=h.n()).done;){var d=l.value,f=d.GraphicalLabel.Label.textAlignment,p=o,v=s;if(d instanceof GraphicalLyricEntry&&d.ParentLyricWord){d.LyricsEntry.SyllableIndex>0&&(p=this.rules.BetweenSyllableMinimumDistance,TextAlignment.IsCenterAligned(f)&&(p+=1));var m=d.ParentLyricWord.GetLyricWord.Syllables;m.length>1&&d.LyricsEntry.SyllableIndex4&&(C*=1.1)}}else n[c]&&(C=A/S);E=Math.max(k,C),u=Math.max(u,E);var P=Math.max(A-S||0,0);n[c]&&(P+=n[c].cumulativeOverlap),n[c]={cumulativeOverlap:P,extend:d instanceof GraphicalLyricEntry&&d.LyricsEntry.extend,labelWidth:y,measureNumber:a,sourceNoteDuration:d instanceof GraphicalLyricEntry&&(d.LyricsEntry&&d.LyricsEntry.Parent.Notes[0].Length),text:d instanceof GraphicalLyricEntry?d.LyricsEntry.Text:d.GraphicalLabel.Label.text,xPosition:b},c++}}catch(err){h.e(err)}finally{h.f()}return u}},{key:"calculateElongationFactorFromStaffEntries",value:function(e,t,n,r){var i,a=n,o={},s={},l=_createForOfIteratorHelper(e);try{for(l.s();!(i=l.n()).done;){var u=i.value;u.LyricsEntries.length>0&&(a=this.calculateElongationFactor(u.LyricsEntries,u,o,t,a,r,this.rules.HorizontalBetweenLyricsDistance,this.rules.LyricOverlapAllowedIntoNextMeasure)),u.graphicalChordContainers.length>0&&(a=this.calculateElongationFactor(u.graphicalChordContainers,u,s,t,a,r,this.rules.ChordSymbolXSpacing,this.rules.ChordOverlapAllowedIntoNextMeasure))}}catch(err){l.e(err)}finally{l.f()}return a}},{key:"calculateMeasureWidthFromStaffEntries",value:function(e,t){var n,r=1;if(!(null===(n=window.GYM)||void 0===n?void 0:n.multitrack)){var i,a=_createForOfIteratorHelper(e);try{for(a.s();!(i=a.n()).done;){var o=i.value;o&&0!==o.staffEntries.length&&(r=this.calculateElongationFactorFromStaffEntries(o.staffEntries,t,r,o.MeasureNumber),r=1)}}catch(err){a.e(err)}finally{a.f()}}return t*(r=Math.min(r,this.rules.MaximumLyricsElongationFactor))}},{key:"createGraphicalTie",value:function(e,t,n,r,i){return new GraphicalTie(e,r,i)}},{key:"updateStaffLineBorders",value:function(e){e.SkyBottomLineCalculator.updateStaffLineBorders()}},{key:"graphicalMeasureCreatedCalculations",value:function(e){e.rules=this.rules,e.graphicalMeasureCreatedCalculations()}},{key:"layoutVoiceEntry",value:function(e,t,n,r){for(var i=0;i=2&&(a=r.vfnote[0],o=r.vfnote[1]);var s=void 0,l=0;if(i&&i.vfnote&&i.vfnote.length>=2&&(s=i.vfnote[0],l=i.vfnote[1]),t){if(a){var u=new VF.StaveTie({first_indices:[o],first_note:a}),c=r.parentVoiceEntry.parentStaffEntry.parentMeasure;if(s){var h,d,f;"w"===s.getDuration()&&(null===(h=s.keyProps)||void 0===h||null===(d=h[0])||void 0===d?void 0:d.line)>=3&&s.setStemDirection(-1);var p,v,m=(null===(f=window.GYM)||void 0===f?void 0:f.tieDirection)||0;if(1===Math.abs(m))(null===(p=s.keyProps)||void 0===p||null===(v=p[0])||void 0===v?void 0:v.line)>=3?s.setStemDirection(-m):s.setStemDirection(m);null==u||u.setDirection(s.getStemDirection())}if(c.vfTies.length>0){var g=c.vfTies[0].direction;null==u||u.setDirection(g?-g:1)}c.addStaveTie(u,e)}if(s){var y=new VF.StaveTie({last_indices:[l],last_note:s}),b=i.parentVoiceEntry.parentStaffEntry.parentMeasure;if(b.vfTies.length>0){var A=b.vfTies[0].direction;null==y||y.setDirection(A?-A:1)}b.addStaveTie(y,e)}}else if(a||s){var S,x;if(n)if("S"===e.Tie.Type){var w=e.StartNote.sourceNote,_=e.EndNote.sourceNote,E=1;w.FretNumber>_.FretNumber&&(E=-1),x=new VF.TabSlide({first_indices:[o],first_note:a,last_indices:[l],last_note:s},E)}else x=new VF.TabTie({first_indices:[o],first_note:a,last_indices:[l],last_note:s},e.Tie.Type);else{x=new VF.StaveTie({first_indices:[o],first_note:a,last_indices:[l],last_note:s});var k=e.Tie.getTieDirection(r.sourceNote);k===PlacementEnum.Below?x.setDirection(1):k===PlacementEnum.Above&&x.setDirection(-1);try{var C,M;Math.abs((null===(C=a)||void 0===C?void 0:C.getTieRightX())-(null===(M=s)||void 0===M?void 0:M.getTieLeftX()))<10&&(x.render_options.first_x_shift=-3,x.render_options.last_x_shift=3)}catch(T){console.log(T)}}var P=i.parentVoiceEntry.parentStaffEntry.parentMeasure,I=(null===(S=window.GYM)||void 0===S?void 0:S.graceCustom)||!1;I&&x.setDirection(I.direction),P.addStaveTie(x,e)}}},{key:"calculateDynamicExpressionsForMultiExpression",value:function(t,n,r){if(!(nthis.rules.MaxMeasureToDrawIndex)){var i=t.AbsoluteTimestamp,a=this.graphicalMusicSheet.MeasureList[n],o=a[r].ParentStaffLine,s=a[r];if(o){var l=this.getRelativePositionInStaffLineFromTimestamp(i,r,o,null==o?void 0:o.isPartOfMultiStaffInstrument());if(l.x<=0&&(l.x=s.beginInstructionsWidth+this.rules.RhythmRightMargin),t.InstantaneousDynamic){var u=new VexFlowInstantaneousDynamicExpression(t.InstantaneousDynamic,o,s);this.calculateGraphicalInstantaneousDynamicExpression(u,l,i),this.dynamicExpressionMap.set(i.RealValue,u.PositionAndShape)}if(t.StartingContinuousDynamic){var c=t.StartingContinuousDynamic,h=new VexFlowContinuousDynamicExpression(t.StartingContinuousDynamic,o,s.parentSourceMeasure);if(h.StartMeasure=s,!h.IsVerbal&&c.EndMultiExpression)try{this.calculateGraphicalContinuousDynamic(h,l),h.updateSkyBottomLine()}catch(e){}else h.IsVerbal?this.calculateGraphicalVerbalContinuousDynamic(h,l):loglevelExports.warn("This continuous dynamic is not covered. measure"+t.SourceMeasureParent.MeasureNumber)}}}}},{key:"createMetronomeMark",value:function(e,t){var n,r,i,a=Math.max(e.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber-1,0),o=t||a,s=Math.max(e.StaffNumber-1,0),l=this.graphicalMusicSheet.MeasureList[o][s].getVFStave(),u="q";if(e.beatUnit){var c=NoteTypeHandler.getNoteDurationFromType(e.beatUnit);u=VexFlowConverter.durations(c,!1)[0]}var h=this.rules.MetronomeMarkYShift,d=!1,f=[];if(e.parentMeasure){var p,v=_createForOfIteratorHelper(e.parentMeasure.StaffLinkedExpressions);try{for(v.s();!(p=v.n()).done;){var m,g=_createForOfIteratorHelper(p.value);try{for(g.s();!(m=g.n()).done;){var y=m.value;y&&y instanceof UnknownExpression&&f.push(y)}}catch(err){g.e(err)}finally{g.f()}}}catch(err){v.e(err)}finally{v.f()}var b,A=_createForOfIteratorHelper(e.parentMeasure.TempoExpressions);try{for(A.s();!(b=A.n()).done;){var S,x=b.value,w=(null===(S=x.InstantaneousTempo)||void 0===S?void 0:S.Enum)===TempoEnum.metronomeMark;if(!e.beatUnit&&x.InstantaneousTempo.beatUnit){var _=NoteTypeHandler.getNoteDurationFromType(e.beatUnit);u=VexFlowConverter.durations(_,!1)[0]}if(x.getPlacementOfFirstEntry()===PlacementEnum.Above&&!w){d=!0;break}}}catch(err){A.e(err)}finally{A.f()}}d&&(h-=1.4);var E,k=null===(n=this.graphicalMusicSheet.MeasureList[0][0].ParentStaffLine)||void 0===n?void 0:n.SkyLine,C=e.TempoInBpm,M="",P="",I="",T=_createForOfIteratorHelper(this.graphicalMusicSheet.MeasureList[o][s].parentSourceMeasure.TempoExpressions);try{for(T.s();!(E=T.n()).done;){var B=E.value;if(P=B.CombinedExpressionsText,isSpecialMark(B.CombinedExpressionsText)){M=B.CombinedExpressionsText;break}if(isSpeedKeyword(B.CombinedExpressionsText)||isSpeedHiddenKeyword(B.CombinedExpressionsText)){M=formatSpeedKeyword(B.CombinedExpressionsText),C=B.sourceMeasure.TempoInBPM,isSpeedKeyword(B.CombinedExpressionsText)&&(I=u);break}}}catch(err){T.e(err)}finally{T.f()}var R={bpm:e.TempoInBpm,dots:e.dotted,duration:u,name:M};M&&(R.bpm=C/(R.dots?1.5:1),isSpeedKeyword(P)?R.duration=I:C!==SpeedTag[M]&&SpeedTag[M]||(R.duration=""));var L=(null===(r=this.graphicalMusicSheet.MeasureList[o][s].vfVoices)||void 0===r||null===(i=r[1])||void 0===i?void 0:i.boundingBox.y)||0;if(this.rules.MetronomeMarksDrawn){if(k){var N,F,D=(null===(N=this.graphicalMusicSheet.MeasureList[0])||void 0===N||null===(F=N[s])||void 0===F?void 0:F.ParentStaffLine).Measures.map((function(e){return e.MeasureNumber-1}));if(L&&D.includes(o)&&(isSpeedKeyword(P)||isSpeedHiddenKeyword(P))){var O=k.slice(0,9),V=Math.min.apply(Math,_toConsumableArray2(O));h+=V=V<0?V-1:V}D.includes(o)&&f.length?k[0]=Math.min(k[0],-4.5+h-4):k[0]=Math.min(k[0],-4.5+h)}l.options.line_config.reduce((function(e,t){return t.visible&&e++,e}),0)<5&&(h-=2),l.setTempo(R,h*unitInPixels);var z=0;try{var G,H,U;z+=(null===(G=this.graphicalMusicSheet.MeasureList[o][s])||void 0===G||null===(H=G.vfVoices)||void 0===H||null===(U=H[1])||void 0===U?void 0:U.getTickables())[e.parentMeasure.metronomeNoteIndex].getBoundingBox().getX()-l.getNoteStartX()}catch(j){}l.getModifiers()[l.getModifiers().length-1].setShiftX(z)}}},{key:"calculateRehearsalMark",value:function(e){var t,n,r,i,a,o=e.rehearsalExpression;if(o){var s=null===(t=e.VerticalMeasureList)||void 0===t||null===(n=t[0])||void 0===n||null===(r=n.getVFStave)||void 0===r?void 0:r.call(n);if(s){var l=-this.rules.RehearsalMarkYOffsetDefault-this.rules.RehearsalMarkYOffset,u=this.rules.RehearsalMarkXOffsetDefault+this.rules.RehearsalMarkXOffset;e.IsSystemStartMeasure&&(u+=this.rules.RehearsalMarkXOffsetSystemStartMeasure);var c=this.rules.RehearsalMarkFontSize,h=s.getModifiers(),d=h.find((function(e){return"repetitions"===e.getCategory().toLocaleLowerCase()}));if(d&&d.setShiftY(d.y_shift-10),s.setSection(o.label,l,u,c),null!==(i=e.VerticalMeasureList)&&void 0!==i&&null!==(a=i[0])&&void 0!==a&&a.ParentStaffLine.AbstractExpressions){var f,p,v,m,g=h.find((function(e){return"stavesection"===e.getCategory().toLocaleLowerCase()})),y=_createForOfIteratorHelper((null==e||null===(f=e.VerticalMeasureList)||void 0===f||null===(p=f[0])||void 0===p||null===(v=p.ParentStaffLine)||void 0===v?void 0:v.AbstractExpressions)||[]);try{for(y.s();!(m=y.n()).done;){var b=m.value;b instanceof GraphicalUnknownExpression&&(g&&(b.Label.PositionAndShape.RelativePosition.y-=.5),d&&(b.Label.PositionAndShape.RelativePosition.y-=1.7))}}catch(err){y.e(err)}finally{y.f()}}}}}},{key:"calculateSingleOctaveShift",value:function(e,t,n,r){var i,a=t.OctaveShiftStart,o=a.ParentStartMultiExpression.Timestamp,s=null===(i=a.ParentEndMultiExpression)||void 0===i?void 0:i.Timestamp,l=this.rules.MinMeasureToDrawIndex,u=this.rules.MaxMeasureToDrawIndex,c=this.graphicalMusicSheet.MeasureList[n][r].ParentStaffLine;c||(c=this.graphicalMusicSheet.MeasureList[l][r].ParentStaffLine);var h=void 0;(h=a.ParentEndMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(a.ParentEndMultiExpression.SourceMeasureParent,r):this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(r,!0)).MeasureNumber>u+1&&(h=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(r,!0));var d=void 0;if((d=a.ParentEndMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(a.ParentStartMultiExpression.SourceMeasureParent,r):this.graphicalMusicSheet.MeasureList[l][r]).MeasureNumberu||h.parentSourceMeasure.measureListIndexu)){var f=h.ParentStaffLine;if(f||(f=c),h&&c&&f){var p=new VexFlowOctaveShift(a,c.PositionAndShape);if(!p.startNote){var v,m,g=_createForOfIteratorHelper(d.staffEntries);try{for(g.s();!(m=g.n()).done;){var y=m.value;if(y){v=y;break}}}catch(err){g.e(err)}finally{g.f()}if(!v)return;if(p.setStartNote(v),!p.startNote)return}if(!p.endNote){for(var b,A=h.staffEntries.length-1;A>=0;A++)if(h.staffEntries[A]){b=h.staffEntries[A];break}if(p.setEndNote(b),!p.endNote)return}var S=d.findGraphicalStaffEntryFromTimestamp(o);S||(S=d.staffEntries[0]);var x=h.findGraphicalStaffEntryFromTimestamp(s);if(x||(x=h.staffEntries[h.staffEntries.length-1]),p.setStartNote(S),f!==c){p.endsOnDifferentStaffLine=!0;var w=c.Measures[c.Measures.length-1];void 0===w&&(w=h);var _=w.staffEntries[w.staffEntries.length-1];p.setEndNote(_);var E=f.ParentMusicSystem.Id-c.ParentMusicSystem.Id;if(E>0)for(var k=c.ParentMusicSystem.Id;ku+1&&(h=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(r,!0));var d=void 0;if(a.ParentEndMultiExpression?d=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(a.ParentStartMultiExpression.SourceMeasureParent,r):(d=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(a.ParentStartMultiExpression.SourceMeasureParent,r))||(d=this.graphicalMusicSheet.MeasureList[l][r]),d.MeasureNumberu||h.parentSourceMeasure.measureListIndexu)){var f=h.ParentStaffLine;if(f||(f=c),h&&c&&f){var p=!1;c!==f&&(p=!0);var v=new VexFlowPedal(a,c.PositionAndShape,!1,p),m=d.findGraphicalStaffEntryFromTimestamp(o);m||(m=d.staffEntries[0]);var g=h.findGraphicalStaffEntryFromTimestamp(s);if(g||(g=h.staffEntries[h.staffEntries.length-1]),!v.setStartNote(m))return;if(f!==c)if(v.pedalSymbol===MusicSymbol.PEDAL_SYMBOL){v.setEndNote(g),v.setEndMeasure(h),v.ReleaseText=" ",v.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(v.startVfVoiceEntry,v.endVfVoiceEntry,v,c);var y=f.Measures[0],b=new VexFlowPedal(a,y.PositionAndShape),A=y.staffEntries[0];if(!b.setStartNote(A))return;b.setEndNote(g),v.setEndMeasure(h),f.Pedals.push(b),b.CalculateBoundingBox(),b.DepressText=" ",this.calculatePedalSkyBottomLine(b.startVfVoiceEntry,b.endVfVoiceEntry,b,f)}else{var S=c.Measures[c.Measures.length-1];void 0===S&&(S=h);var x=S.staffEntries[S.staffEntries.length-1];v.setEndNote(x),v.setEndMeasure(h),v.ChangeEnd=!1;var w=f.ParentMusicSystem.Id-c.ParentMusicSystem.Id;if(w>0)for(var _=1,E=c.ParentMusicSystem.Id;Eu+1&&(h=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(r,!0));var d=void 0;if((d=a.ParentEndMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(a.ParentStartMultiExpression.SourceMeasureParent,r):this.graphicalMusicSheet.MeasureList[l][r]).MeasureNumberu||h.parentSourceMeasure.measureListIndexu)){var f=h.ParentStaffLine;if(f||(f=c),h&&c&&f){var p=new VexflowVibratoBracket(a,c.PositionAndShape,d.ParentStaff.isTab),v=d.findGraphicalStaffEntryFromTimestamp(o);v||(v=d.staffEntries[0]);var m=h.findGraphicalStaffEntryFromTimestamp(s);if(m||(m=h.staffEntries[h.staffEntries.length-1]),p.setStartNote(v),f!==c){var g=c.Measures[c.Measures.length-1];void 0===g&&(g=h);var y=g.staffEntries[g.staffEntries.length-1];if(p.setEndNote(y),f.ParentMusicSystem.Id-c.ParentMusicSystem.Id>0)for(var b=c.ParentMusicSystem.Id;bh){var x=h;h=u,u=x}r.SkyBottomLineCalculator.updateBottomLineInRange(u,h,d+A)}var w,_=_createForOfIteratorHelper(r.Pedals);try{for(_.s();!(w=_.n()).done;){var E=w.value,k=E.getPedalMarking();if(d>k.line+3+(r.StaffLines.length-1)){var C,M=k.render_options.text_margin_right/10,P=E.startVfVoiceEntry.PositionAndShape.AbsolutePosition.x-M,I=void 0;E.setLine(d-3-(r.StaffLines.length-1));var T=null===(C=E.endVfVoiceEntry)||void 0===C?void 0:C.PositionAndShape;if(T||(T=E.endMeasure.PositionAndShape),E.EndSymbolPositionAndShape){var B=o.render_options.glyph_point_size/20;I=P+3.4;var R=T.AbsolutePosition.x-M,L=R+1.5;r.SkyBottomLineCalculator.updateBottomLineInRange(P,I,d+B),r.SkyBottomLineCalculator.updateBottomLineInRange(R,L,d+B)}else{var N,F,D=k.render_options.bracket_height/10;if(k.EndsStave)I=T.AbsolutePosition.x+T.Size.width-M;else switch(o.style){case a.BRACKET_OPEN_END:case a.BRACKET_OPEN_BOTH:case a.MIXED_OPEN_END:I=T.AbsolutePosition.x+T.BorderRight-M;break;default:I=T.AbsolutePosition.x+T.BorderLeft-M}var O=null===(N=E.endVfVoiceEntry)||void 0===N||null===(F=N.parentStaffEntry)||void 0===F?void 0:F.vfClefBefore;if(O)I+=O.getWidth()/10;if(P>I){var V=P;P=I,I=V}r.SkyBottomLineCalculator.updateBottomLineInRange(P,I,d+D)}}}}catch(err){_.e(err)}finally{_.f()}}},{key:"calculateOctaveShiftSkyBottomLine",value:function(e,t,n,r){if(t){var i=e.PositionAndShape.Size.width,a=t.PositionAndShape.Size.width;e.hasOnlyRests()?i=-i:i/=2,t.hasOnlyRests()?a*=2:a/=2,e===t&&(a*=2);var o=e.PositionAndShape.AbsolutePosition.x-i,s=t.PositionAndShape.AbsolutePosition.x+a;n.PositionAndShape.Size.width=o-s;var l=n.getTextBracket(),u=l.font.size/10;if(l.position===VF.TextBracket.Positions.TOP){var c=Math.ceil(r.SkyBottomLineCalculator.getSkyLineMinInRange(o,s));if(c===1/0)return;l.start.getStave().options.top_text_position=Math.abs(c),r.SkyBottomLineCalculator.updateSkyLineInRange(o,s,c-2*u)}else{var h=r.SkyBottomLineCalculator.getBottomLineMaxInRange(o,s);if(h===1/0)return;l.start.getStave().options.bottom_text_position=h,e.parentMeasure!==t.parentMeasure&&(l.stop.getStave().options.bottom_text_position=h),r.SkyBottomLineCalculator.updateBottomLineInRange(o,s,h+1.5*u)}}else loglevelExports.warn("octaveshift: no endStaffEntry")}},{key:"calculateWordRepetitionInstruction",value:function(e,t){for(var n=void 0,r=this.graphicalMusicSheet.MeasureList[t],i=0,a=r.length;ir.graphicalLyricWords.length-1){var l=new GraphicalLyricWord(i.Word);a.ParentLyricWord=l,l.GraphicalLyricsEntries[o]=a,r.graphicalLyricWords.push(l)}else{var u=r.graphicalLyricWords[s];a.ParentLyricWord=u,u.GraphicalLyricsEntries[o]=a,u.isFilled()&&(n.splice(s,1),r.graphicalLyricWords.splice(r.graphicalLyricWords.indexOf(u),1))}}}))}},{key:"handleVoiceEntryOrnaments",value:function(e,t,n){}},{key:"handleVoiceEntryArticulations",value:function(e,t,n){}},{key:"handleVoiceEntryTechnicalInstructions",value:function(e,t,n){}},{key:"handleTuplet",value:function(e,t,n){e.parentVoiceEntry.parentStaffEntry.parentMeasure.handleTuplet(e,t)}},{key:"findIndexGraphicalSlurFromSlur",value:function(e,t){for(var n=0;n=0){var C=l[k];-1===C.staffEntries.indexOf(g)&&C.staffEntries.push(g),l.splice(k,1)}}}}}catch(err){w.e(err)}finally{w.f()}}}catch(err){A.e(err)}finally{A.f()}}}catch(err){y.e(err)}finally{y.f()}var M,P=_createForOfIteratorHelper(l);try{for(P.s();!(M=P.n()).done;){var I=M.value;-1===I.staffEntries.indexOf(g)&&I.staffEntries.push(g)}}catch(err){P.e(err)}finally{P.f()}}}catch(err){v.e(err)}finally{v.f()}}}catch(err){f.e(err)}finally{f.f()}}}catch(err){o.e(err)}finally{o.f()}}}catch(err){i.e(err)}finally{i.f()}var T,B=_createForOfIteratorHelper(this.musicSystems);try{for(B.s();!(T=B.n()).done;){var R,L=_createForOfIteratorHelper(T.value.StaffLines);try{for(L.s();!(R=L.n()).done;){var N,F=_createForOfIteratorHelper(R.value.GraphicalSlurs.sort(GraphicalSlur.Compare));try{for(F.s();!(N=F.n()).done;){var D=N.value;D.slur.isCrossed()||D.calculateCurve(this.rules)}}catch(err){F.e(err)}finally{F.f()}}}catch(err){L.e(err)}finally{L.f()}}}catch(err){B.e(err)}finally{B.f()}}}]),r}(MusicSheetCalculator),MusicPartManager=function(){function e(t){_classCallCheck2(this,e),this.musicSheet=t}return _createClass2(e,[{key:"reInit",value:function(){this.init()}},{key:"init",value:function(){this.parts=this.musicSheet.Repetitions.slice(),this.sheetStart=this.musicSheet.SelectionStart=new Fraction$1(0,1),this.sheetEnd=this.musicSheet.SelectionEnd=this.musicSheet.SheetEndTimestamp,this.calcMapping()}},{key:"getCurrentRepetitionTimestampTransform",value:function(e){for(var t=void 0,n=this.timestamps.length-1;n>=0;n--)if(t=this.timestamps[n],e.gte(t.from))return t;return this.timestamps[0]}},{key:"absoluteEnrolledToSheetTimestamp",value:function(e){if(0===this.timestamps.length)return e;var t=this.getCurrentRepetitionTimestampTransform(e);return Fraction$1.plus(e,Fraction$1.minus(t.to,t.from))}},{key:"Parts",get:function(){return this.parts}},{key:"MusicSheet",get:function(){return this.musicSheet}},{key:"getIterator",value:function(e){return e?new MusicPartManagerIterator(this.musicSheet,e,void 0):new MusicPartManagerIterator(this.musicSheet,this.musicSheet.SelectionStart,this.musicSheet.SelectionEnd)}},{key:"setSelectionStart",value:function(e){this.musicSheet.SelectionStart=e,this.musicSheet.SelectionEnd=void 0}},{key:"setSelectionRange",value:function(e,t){this.musicSheet.SelectionStart=null!=e?e:this.sheetStart,this.musicSheet.SelectionEnd=null!=t?t:this.sheetEnd}},{key:"calcMapping",value:function(){this.timestamps=[];var e=this.getIterator(),t=e.CurrentRepetition,n=new TimestampTransform(e.CurrentEnrolledTimestamp.clone(),e.CurrentSourceTimestamp.clone(),void 0,0);for(this.timestamps.push(n);!e.EndReached;){if(e.JumpOccurred||t!==e.CurrentRepetition){if(t=e.CurrentRepetition,e.backJumpOccurred){var r=e.JumpResponsibleRepetition;n.nextBackJump=e.CurrentEnrolledTimestamp,n.curRepetition=r,n.curRepetitionIteration=e.CurrentJumpResponsibleRepetitionIterationBeforeJump;for(var i=this.timestamps.length-2;i>=0&&(!r.AbsoluteTimestamp.gt(this.timestamps[i].to)&&!this.timestamps[i].curRepetition);i--)this.timestamps[i].nextBackJump=n.nextBackJump,this.timestamps[i].curRepetition=r,this.timestamps[i].curRepetitionIteration=n.curRepetitionIteration}n=new TimestampTransform(e.CurrentEnrolledTimestamp.clone(),e.CurrentSourceTimestamp.clone(),void 0,0),this.timestamps.push(n)}e.moveToNext()}}}]),e}(),TimestampTransform=_createClass2((function e(t,n,r,i){_classCallCheck2(this,e),this.from=t,this.to=n,this.curRepetition=r,this.curRepetitionIteration=i,this.nextBackJump=void 0,this.nextForwardJump=void 0})),PartListEntry=function(){function e(t){_classCallCheck2(this,e),this.enrolledTimestamps=[],this.visible=!0,this.musicSheet=t}return _createClass2(e,[{key:"Visible",get:function(){return this.visible},set:function(e){this.visible=e}},{key:"getFirstSourceMeasure",value:function(){return this.musicSheet.SourceMeasures[this.startIndex]}},{key:"getLastSourceMeasure",value:function(){return this.musicSheet.SourceMeasures[this.endIndex]}}]),e}(),SourceMusicPart=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e,r,i){var a;return _classCallCheck2(this,n),(a=t.call(this,e)).musicSheet=e,a.startIndex=r,a.endIndex=i,a}return _createClass2(n,[{key:"MeasuresCount",get:function(){return this.endIndex-this.startIndex+1}},{key:"StartIndex",get:function(){return this.startIndex}},{key:"EndIndex",get:function(){return this.endIndex}},{key:"ParentRepetition",get:function(){return this.parentRepetition},set:function(e){this.parentRepetition=e}},{key:"AbsoluteTimestamp",get:function(){return Fraction$1.createFromFraction(this.musicSheet.SourceMeasures[this.startIndex].AbsoluteTimestamp)}},{key:"setStartIndex",value:function(e){this.startIndex=e}},{key:"setEndIndex",value:function(e){this.endIndex=e}}]),n}(PartListEntry),Repetition=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return _classCallCheck2(this,n),(r=t.call(this,e)).backwardJumpInstructions=[],r.endingParts=[],r.endingIndexDict={},r.userNumberOfRepetitions=0,r.visibles=[],r.fromWords=!1,r.repetitonIterationOrder=[],r.numberOfEndings=1,r.musicSheet2=e,r.virtualOverallRepetition=i,r}return _createClass2(n,[{key:"BackwardJumpInstructions",get:function(){return this.backwardJumpInstructions}},{key:"EndingIndexDict",get:function(){return this.endingIndexDict}},{key:"EndingParts",get:function(){return this.endingParts}},{key:"Visibles",get:function(){return this.visibles},set:function(e){this.visibles=e}},{key:"DefaultNumberOfRepetitions",get:function(){var e=2;return this.virtualOverallRepetition&&(e=1),Math.max(e,Object.keys(this.endingIndexDict).length,this.checkRepetitionForMultipleLyricVerses())}},{key:"UserNumberOfRepetitions",get:function(){return this.userNumberOfRepetitions},set:function(e){this.userNumberOfRepetitions=e,this.repetitonIterationOrder=[];for(var t=this.userNumberOfRepetitions-this.NumberOfEndings,n=1;n<=this.userNumberOfRepetitions;n++)n<=t?this.repetitonIterationOrder.push(1):this.repetitonIterationOrder.push(n-t)}},{key:"getForwardJumpTargetForIteration",value:function(e){var t=this.repetitonIterationOrder[e-1];return this.endingIndexDict[t]?this.endingIndexDict[t].part.StartIndex:-1}},{key:"getBackwardJumpTarget",value:function(){return this.startMarker.measureIndex}},{key:"setEndingsStartIndex",value:function(e,t){var n=new RepetitionEndingPart(new SourceMusicPart(this.musicSheet2,t,t));this.endingParts.push(n);var r,i=_createForOfIteratorHelper(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;try{this.endingIndexDict[a]=n,n.endingIndices.push(a),this.numberOfEndings0&&void 0!==arguments[0]?arguments[0]:new Fraction$1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;_classCallCheck2(this,e),this.rhythm=t,this.beatsPerMinute=n,this.beatLengthInMilliseconds=6e4/n,this.beatRealValue=1/4}return _createClass2(e,[{key:"BeatsPerMinute",get:function(){return this.beatsPerMinute},set:function(e){this.beatsPerMinute=e,this.beatLengthInMilliseconds=6e4/this.beatsPerMinute}},{key:"Rhythm",get:function(){return this.rhythm},set:function(e){this.rhythm=e}},{key:"BeatRealValue",get:function(){return this.beatRealValue}},{key:"BeatLengthInMilliseconds",get:function(){return this.beatLengthInMilliseconds}},{key:"getDurationInMilliseconds",value:function(e){return("number"==typeof e?e:e.RealValue)*this.BeatLengthInMilliseconds/this.beatRealValue}},{key:"getDurationAsNoteDuration",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024,n=e/this.BeatLengthInMilliseconds,r=Math.floor(n),i=new Fraction$1(r,4),a=n-r;return 0===(r=Math.round(a/(1/t)/4))&&e>0&&(r=1),i.Add(new Fraction$1(r,t)),i}}],[{key:"createFrom",value:function(t){return new e(t.Rhythm,t.BeatsPerMinute)}}]),e}(),MusicSheet=function(){function e(){_classCallCheck2(this,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 MusicSheetErrors,this.staves=[],this.playbackDataDict=new Dictionary,this.transpose=0,this.defaultStartTempoInBpm=0,this.drawErroneousMeasures=!1,this.hasBeenOpenedForTheFirstTime=!1,this.currentEnrolledPosition=new Fraction$1(0,1),this.soundTempos=new Map,this.playbackSettings=new PlaybackSettings,this.playbackSettings.rhythm=new Fraction$1(4,4,0,!1),this.userStartTempoInBPM=100,this.pageWidth=120,this.MusicPartManager=new MusicPartManager(this),this.hasBPMInfo=!1}return _createClass2(e,[{key:"SoundTempos",get:function(){return this.soundTempos},set:function(e){this.soundTempos=e}},{key:"CurrentKeyInstruction",get:function(){return this.currentKeyInstruction},set:function(e){this.currentKeyInstruction=e}},{key:"SourceMeasures",get:function(){return this.sourceMeasures},set:function(e){this.sourceMeasures=e}},{key:"Repetitions",get:function(){return this.repetitions},set:function(e){this.repetitions=e}},{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(e){this.playbackSettings=e}},{key:"DrawErroneousMeasures",get:function(){return this.drawErroneousMeasures},set:function(e){this.drawErroneousMeasures=e}},{key:"HasBeenOpenedForTheFirstTime",get:function(){return this.hasBeenOpenedForTheFirstTime},set:function(e){this.hasBeenOpenedForTheFirstTime=e}},{key:"InitializeStartTempoInBPM",value:function(e){this.playbackSettings.BeatsPerMinute=e,this.userStartTempoInBPM=e}},{key:"DefaultStartTempoInBpm",get:function(){return this.defaultStartTempoInBpm},set:function(e){this.defaultStartTempoInBpm=e,this.InitializeStartTempoInBPM(e)}},{key:"Path",get:function(){return this.path},set:function(e){this.path=e}},{key:"Staves",get:function(){return this.staves}},{key:"TitleString",get:function(){return this.title?this.title.text:""},set:function(e){this.Title=new Label(e)}},{key:"SubtitleString",get:function(){return this.subtitle?this.subtitle.text:""},set:function(e){this.Subtitle=new Label(e)}},{key:"ComposerString",get:function(){return this.composer?this.composer.text:""},set:function(e){this.Composer=new Label(e)}},{key:"LyricistString",get:function(){return this.lyricist?this.lyricist.text:""},set:function(e){this.Lyricist=new Label(e)}},{key:"Title",get:function(){return this.title},set:function(e){this.title=e}},{key:"Subtitle",get:function(){return this.subtitle},set:function(e){this.subtitle=e}},{key:"Composer",get:function(){return this.composer},set:function(e){this.composer=e}},{key:"Lyricist",get:function(){return this.lyricist},set:function(e){this.lyricist=e}},{key:"Rules",get:function(){return this.rules||(loglevelExports.debug("warning: sheet.Rules was undefined. Creating new EngravingRules."),this.rules=new EngravingRules),this.rules},set:function(e){this.rules=e}},{key:"SheetErrors",get:function(){return this.musicSheetErrors}},{key:"PlaybackDataDict",get:function(){return this.playbackDataDict}},{key:"SelectionStart",get:function(){return this.selectionStart},set:function(e){this.selectionStart=e.clone(),this.currentEnrolledPosition=e.clone()}},{key:"SelectionEnd",get:function(){return this.selectionEnd},set:function(e){this.selectionEnd=e}},{key:"HasBPMInfo",get:function(){return this.hasBPMInfo},set:function(e){this.hasBPMInfo=e}},{key:"addMeasure",value:function(e){this.sourceMeasures.push(e),e.measureListIndex=this.sourceMeasures.length-1}},{key:"checkForInstrumentWithNoVoice",value:function(){for(var e=0,t=this.instruments.length;e0){var e=this.TimestampSortedTempoExpressionsList[0];if(e.InstantaneousTempo)return e.InstantaneousTempo.TempoInBpm;if(e.ContinuousTempo)return e.ContinuousTempo.StartTempo}return this.userStartTempoInBPM}},{key:"Errors",get:function(){return this.musicSheetErrors.measureErrors}},{key:"FirstMeasureNumber",get:function(){try{return this.getFirstSourceMeasure().MeasureNumber}catch(e){return loglevelExports.info("MusicSheet.FirstMeasureNumber: ",e),0}}},{key:"LastMeasureNumber",get:function(){try{return this.getLastSourceMeasure().MeasureNumber}catch(e){return loglevelExports.info("MusicSheet.LastMeasureNumber: ",e),0}}},{key:"CurrentEnrolledPosition",get:function(){return this.currentEnrolledPosition.clone()},set:function(e){this.currentEnrolledPosition=e.clone()}},{key:"Transpose",get:function(){return this.transpose},set:function(e){this.transpose=e}},{key:"FullNameString",get:function(){return this.ComposerString+" "+this.TitleString}},{key:"IdString",get:function(){return this.idString},set:function(e){this.idString=e}},{key:"getEnrolledSelectionStartTimeStampWorkaround",value:function(){var e=this.MusicPartManager.getIterator(this.SelectionStart);return Fraction$1.createFromFraction(e.CurrentEnrolledTimestamp)}},{key:"SheetEndTimestamp",get:function(){var e=this.getLastSourceMeasure();return Fraction$1.plus(e.AbsoluteTimestamp,e.Duration)}},{key:"getSourceMeasureFromTimeStamp",value:function(e){for(var t=0,n=this.sourceMeasures.length;t0&&r.Voices[0].Visible&&e.push(r)}return e}}],[{key:"getIndexFromStaff",value:function(e){return e.idInMusicSheet}}]),e}();MusicSheet.defaultTitle="[no title given]";var LyricWord=function(){function e(){_classCallCheck2(this,e),this.syllables=[]}return _createClass2(e,[{key:"Syllables",get:function(){return this.syllables}},{key:"containsVoiceEntry",value:function(e){for(var t=0,n=this.Syllables.length;t4&&void 0!==arguments[4]?arguments[4]:-1;_classCallCheck2(this,e),this.text=t,this.word=r,this.parent=i,this.verseNumber=n,a>=0&&(this.syllableIndex=a)}return _createClass2(e,[{key:"Text",get:function(){return this.text},set:function(e){this.text=e}},{key:"Word",get:function(){return this.word}},{key:"Parent",get:function(){return this.parent},set:function(e){this.parent=e}},{key:"VerseNumber",get:function(){return this.verseNumber}},{key:"SyllableIndex",get:function(){return this.syllableIndex}}]),e}(),LyricsReader=function(){function e(t){_classCallCheck2(this,e),this.openLyricWords={},this.musicSheet=t}return _createClass2(e,[{key:"addLyricEntry",value:function(e,t){if(e){for(var n=e,r=0,i=n.length;r0)for(var g=f;g1&&(b=parseInt(S[1],10))}catch(err){var x=ITextTranslation.translateText("ReaderErrorMessages/LyricVerseNumberError","Invalid lyric verse number");this.musicSheet.SheetErrors.pushMeasureError(x);continue}}var w=void 0;if("single"===o||"end"===o){if(this.openLyricWords[b]){this.currentLyricWord=this.openLyricWords[b];var _=this.currentLyricWord.Syllables.length;w=new LyricsEntry(u,b,this.currentLyricWord,t,_),this.currentLyricWord.Syllables.push(w),delete this.openLyricWords[b],this.currentLyricWord=void 0}else w=new LyricsEntry(u,b,void 0,t);w.extend=void 0!==a.element("extend")}else if("begin"===o)this.openLyricWords[b]&&(delete this.openLyricWords[b],this.currentLyricWord=void 0),this.currentLyricWord=new LyricWord,this.openLyricWords[b]=this.currentLyricWord,w=new LyricsEntry(u,b,this.currentLyricWord,t,0),this.currentLyricWord.Syllables.push(w);else if("middle"===o)if(this.openLyricWords[b]){this.currentLyricWord=this.openLyricWords[b];var E=this.currentLyricWord.Syllables.length;w=new LyricsEntry(u,b,this.currentLyricWord,t,E),this.currentLyricWord.Syllables.push(w)}else w=new LyricsEntry(u,b,void 0,t);if(w){var k,C;if(!t.LyricsEntries[b])t.LyricsEntries.setValue(b,w),null!==(k=t.ParentSourceStaffEntry)&&void 0!==k&&null!==(C=k.VerticalContainerParent)&&void 0!==C&&C.ParentMeasure&&(t.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.hasLyrics=!0);t.ParentVoice.Parent.LyricVersesNumbers[b]||t.ParentVoice.Parent.LyricVersesNumbers.push(b)}}}}catch(err){var M=ITextTranslation.translateText("ReaderErrorMessages/LyricError","Error while reading lyric entry.");this.musicSheet.SheetErrors.pushMeasureError(M);continue}}t.ParentVoice.Parent.LyricVersesNumbers=t.ParentVoice.Parent.LyricVersesNumbers.filter((function(e,t,n){return n.indexOf(e)===t}))}}}]),e}(),Articulation=function(){function e(t,n){_classCallCheck2(this,e),this.articulationEnum=t,this.placement=n}return _createClass2(e,[{key:"Equals",value:function(e){return e.articulationEnum===this.articulationEnum&&e.placement===this.placement}}]),e}(),ArticulationReader=function(){function e(t){_classCallCheck2(this,e),this.rules=t}return _createClass2(e,[{key:"getAccEnumFromString",value:function(e){switch(e){case"sharp":return AccidentalEnum.SHARP;case"flat":return AccidentalEnum.FLAT;case"natural":return AccidentalEnum.NATURAL;case"double-sharp":case"sharp-sharp":return AccidentalEnum.DOUBLESHARP;case"double-flat":case"flat-flat":return AccidentalEnum.DOUBLEFLAT;case"triple-sharp":return AccidentalEnum.TRIPLESHARP;case"triple-flat":return AccidentalEnum.TRIPLEFLAT;case"quarter-sharp":return AccidentalEnum.QUARTERTONESHARP;case"quarter-flat":return AccidentalEnum.QUARTERTONEFLAT;case"three-quarters-sharp":return AccidentalEnum.THREEQUARTERSSHARP;case"three-quarters-flat":return AccidentalEnum.THREEQUARTERSFLAT;case"slash-quarter-sharp":return AccidentalEnum.SLASHQUARTERSHARP;case"slash-sharp":return AccidentalEnum.SLASHSHARP;case"double-slash-flat":return AccidentalEnum.DOUBLESLASHFLAT;case"sori":return AccidentalEnum.SORI;case"koron":return AccidentalEnum.KORON;default:return AccidentalEnum.NONE}}},{key:"addArticulationExpression",value:function(e,t){if(void 0!==e&&e.elements().length>0)for(var n=e.elements(),r=0,i=n.length;r0&&t.Articulations[0].articulationEnum!==ArticulationEnum.staccato&&t.Articulations.splice(0,0,h),"strongaccent"===o){var d,f=null==a||null===(d=a.attribute("type"))||void 0===d?void 0:d.value;"up"===f?h.articulationEnum=ArticulationEnum.marcatoup:"down"===f&&(h.articulationEnum=ArticulationEnum.marcatodown)}if("detachedlegato"===o){var p,v=new Articulation(ArticulationEnum.staccato,u),m=new Articulation(ArticulationEnum.tenuto,u);(p=t.Articulations).push.apply(p,[v,m])}if(!t.hasArticulation(h))switch(t.Articulations.push(h),h.articulationEnum){case ArticulationEnum.staccato:case ArticulationEnum.staccatissimo:t.DurationModifier=h;break;case ArticulationEnum.accent:case ArticulationEnum.strongaccent:t.VolumeModifier=h}}}catch(g){return void loglevelExports.debug("addArticulationExpression","Invalid note articulation.",g)}}}},{key:"addFermata",value:function(e,t){var n,r=ArticulationEnum.fermata;e.attributes().length>0&&e.attribute("type")&&"inverted"===e.attribute("type").value&&(r=ArticulationEnum.invertedfermata);var i=PlacementEnum.Above;"below"===(null===(n=e.attribute("placement"))||void 0===n?void 0:n.value)&&(i=PlacementEnum.Below),t.Articulations.push(new Articulation(r,i))}},{key:"addTechnicalArticulations",value:function(e,t,n){var r={bend:ArticulationEnum.bend,"down-bow":ArticulationEnum.downbow,"open-string":ArticulationEnum.naturalharmonic,"snap-pizzicato":ArticulationEnum.snappizzicato,stopped:ArticulationEnum.lefthandpizzicato,"up-bow":ArticulationEnum.upbow};for(var i in r)if(r.hasOwnProperty(i)){var a=r[i],o=e.element(i);if(o){var s,l,u=void 0;"above"===(null===(s=o.attribute("placement"))||void 0===s?void 0:s.value)&&(u=PlacementEnum.Above),"below"===(null===(l=o.attribute("placement"))||void 0===l?void 0:l.value)&&(u=PlacementEnum.Below);var c=new Articulation(a,u);t.hasArticulation(c)||t.Articulations.push(c)}}var h=e.element("fingering");if(h){var d=this.createTechnicalInstruction(h,n);d.type=TechnicalInstructionType.Fingering,n.Fingering=d,t.TechnicalInstructions.push(d)}var f=e.element("string");if(f){var p=this.createTechnicalInstruction(f,n);p.type=TechnicalInstructionType.String,n.StringInstruction=p,t.TechnicalInstructions.push(p)}}},{key:"createTechnicalInstruction",value:function(e,t){var n=new TechnicalInstruction;n.sourceNote=t,n.value=e.value;var r=e.attribute("placement");return this.rules.FingeringPositionFromXML&&(n.placement=this.getPlacement(r)),n}},{key:"getPlacement",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:PlacementEnum.NotYetDefined;if(t!==PlacementEnum.NotYetDefined)return t;if(!e)return PlacementEnum.NotYetDefined;switch(e.value){case"above":return PlacementEnum.Above;case"below":return PlacementEnum.Below;case"left":return PlacementEnum.Left;case"right":return PlacementEnum.Right;default:return PlacementEnum.NotYetDefined}}},{key:"addOrnament",value:function(e,t){if(e){var n=void 0,r={"delayed-inverted-turn":OrnamentEnum.DelayedInvertedTurn,"delayed-turn":OrnamentEnum.DelayedTurn,"inverted-mordent":OrnamentEnum.InvertedMordent,"inverted-turn":OrnamentEnum.InvertedTurn,mordent:OrnamentEnum.Mordent,"trill-mark":OrnamentEnum.Trill,turn:OrnamentEnum.Turn};for(var i in r)if(r.hasOwnProperty(i)){var a=e.element(i);if(a){n=new OrnamentContainer(r[i]);var o=a.attribute("placement");if(o)"below"===o.value&&(n.placement=PlacementEnum.Below)}}if(n){var s=e.elements("accidental-mark");if(s)for(var l=PlacementEnum.Below,u=AccidentalEnum.NONE,c=s,h=0,d=c.length;h4&&void 0!==arguments[4]?arguments[4]:void 0;_classCallCheck2(this,t),this.openBeams=[],this.beamNumberOffset=0,this.currentOctaveShift=0,this.tupletDict={},this.openTupletNumber=0,this.currMeasureVoiceEntries=[],this.graceVoiceEntriesTempList=[],this.staff=n,this.instrument=n.ParentInstrument,this.musicSheet=this.instrument.GetMusicSheet,this.slurReader=i,this.pluginManager=e,this.voice=a?new LinkedVoice(this.instrument,r,a):new Voice(this.instrument,r),this.instrument.Voices.push(this.voice),this.staff.Voices.push(this.voice),this.lyricsReader=new LyricsReader(this.musicSheet),this.articulationReader=new ArticulationReader(this.musicSheet.Rules)}return _createClass2(t,[{key:"openTieDict",get:function(){return this.staff.openTieDict}},{key:"GetVoice",get:function(){return this.voice}},{key:"OctaveShift",get:function(){return this.currentOctaveShift},set:function(e){this.currentOctaveShift=e}},{key:"createVoiceEntry",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=arguments.length>6&&void 0!==arguments[6]&&arguments[6];this.activeKey=n,this.activeRhythm=r,this.currentVoiceEntry=new VoiceEntry(Fraction$1.createFromFraction(e),this.voice,t,!0,i,a,o),i?this.graceVoiceEntriesTempList.push(this.currentVoiceEntry):(this.currentNormalVoiceEntry=this.currentVoiceEntry,this.currMeasureVoiceEntries.push(this.currentNormalVoiceEntry),this.graceVoiceEntriesTempList.length>0&&(this.currentVoiceEntry.GraceVoiceEntriesBefore=this.graceVoiceEntriesTempList,this.graceVoiceEntriesTempList=[]))}},{key:"finalizeReadingMeasure",value:function(){this.graceVoiceEntriesTempList.length>0&&void 0!==this.currentNormalVoiceEntry&&this.currentNormalVoiceEntry.GraceVoiceEntriesAfter.concat(this.graceVoiceEntriesTempList),this.graceVoiceEntriesTempList=[],this.pluginManager.processVoiceMeasureReadPlugins(this.currMeasureVoiceEntries,this.activeKey,this.activeRhythm),this.currMeasureVoiceEntries.length=0,this.openBeams.length>1&&this.handleOpenBeam()}},{key:"read",value:function(e,t,n,r,i,a,o,s,l,u,c,h,d,f,p,v,m,g,y,b,A,S,x){this.currentStaffEntry=o,this.currentMeasure=s;try{this.currentNote=a?this.addRestNote(e.element("rest"),t,r,i,d,f,y):this.addSingleNote(e,t,r,n,i,c,h,d,f,p,v,m,g,y,A,S,x),this.currentNote.DotsXml=b;var w=e.elements("lyric");void 0!==this.lyricsReader&&w&&(this.lyricsReader.addLyricEntry(w,this.currentVoiceEntry),this.voice.Parent.HasLyrics=!0);var _=!1,E=e.element("notations");if(E){this.articulationReader&&this.readArticulations(E,this.currentVoiceEntry,this.currentNote);var k=E.elements("slur");void 0!==this.slurReader&&k.length>0&&!this.currentNote.ParentVoiceEntry.IsGrace&&this.slurReader.addSlur(k,this.currentNote);var C=E.elements("tuplet");C.length>0&&(this.openTupletNumber=this.addTuplet(e,C),_=!0);var M=E.element("arpeggiate");if(void 0!==M){var P;if(this.currentVoiceEntry.Arpeggio)P=this.currentVoiceEntry.Arpeggio;else{var I,T=!1,B=_createForOfIteratorHelper(this.currentStaffEntry.VoiceEntries);try{for(B.s();!(I=B.n()).done;){var R=I.value;if(R.Arpeggio){T=!0,P=R.Arpeggio;break}}}catch(err){B.e(err)}finally{B.f()}if(!T){var L=ArpeggioType.ARPEGGIO_DIRECTIONLESS,N=M.attribute("direction");if(N)switch(N.value){case"up":L=ArpeggioType.ROLL_UP;break;case"down":L=ArpeggioType.ROLL_DOWN;break;default:L=ArpeggioType.ARPEGGIO_DIRECTIONLESS}P=new Arpeggio(this.currentVoiceEntry,L),this.currentVoiceEntry.Arpeggio=P}}P.addNote(this.currentNote)}var F=E.elements("tied");F.length>0&&this.addTie(F,l,u,TieTypes.SIMPLE);var D=E.elements("slide");D.length>0&&this.addTie(D,l,u,TieTypes.SLIDE);var O=E.element("technical");if(O){var V=O.elements("hammer-on");V.length>0&&this.addTie(V,l,u,TieTypes.HAMMERON);var z=O.elements("pull-off");z.length>0&&this.addTie(z,l,u,TieTypes.PULLOFF)}}void 0===e.element("time-modification")||_||this.handleTimeModificationNode(e)}catch(err){loglevelExports.warn(err);var G=ITextTranslation.translateText("ReaderErrorMessages/NoteError","Ignored erroneous Note.");this.musicSheet.SheetErrors.pushMeasureError(G),this.musicSheet.SheetErrors.pushMeasureError(err)}return this.currentNote}},{key:"checkForStaffEntryLink",value:function(e,t,n,r){var i=new StaffEntryLink(this.currentVoiceEntry);i.LinkStaffEntries.push(n),n.Link=i;var a=this.currentVoiceEntry.Timestamp.clone(),o=r.getVerticalContainerByTimestamp(a);return(n=o.StaffEntries[e])||(n=new SourceStaffEntry(o,t),o.StaffEntries[e]=n),n.VoiceEntries.push(this.currentVoiceEntry),i.LinkStaffEntries.push(n),n.Link=i,n}},{key:"checkForOpenBeam",value:function(){this.openBeams.length>0&&this.currentNote&&this.handleOpenBeam()}},{key:"checkOpenTies",value:function(){var e=this.openTieDict;for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];Fraction$1.plus(n.StartNote.ParentStaffEntry.Timestamp,n.Duration).lt(n.StartNote.SourceMeasure.Duration)&&delete e[t]}}},{key:"hasVoiceEntry",value:function(){return void 0!==this.currentVoiceEntry}},{key:"readArticulations",value:function(e,t,n){var r=e.element("articulations");r&&this.articulationReader.addArticulationExpression(r,t);var i=e.element("fermata");i&&this.articulationReader.addFermata(i,t);var a=e.element("technical");a&&this.articulationReader.addTechnicalArticulations(a,t,n);var o=e.element("ornaments");o&&this.articulationReader.addOrnament(o,t)}},{key:"addSingleNote",value:function(e,t,n,r,i,a,o,s,l,u,c,h,d,f,p,v,m){for(var g,y=0,b=AccidentalEnum.NONE,A=NoteEnum.C,S=NoteEnum.C,x=0,w=0,_=void 0,E=void 0,k=void 0,C=e.elements(),M=0,P=C.length;M0&&this.openBeams.last().ExtendedNoteList.push(f),f}},{key:"addNoteInfo",value:function(e,t,n,r,i,a,o,s,l){e.NoteTypeXml=t,e.PrintObject=n,e.IsCueNote=r,e.NormalNotes=i,e.displayStepUnpitched=a,e.displayOctaveUnpitched=o,e.NoteheadColorXml=s,e.NoteheadColor=s}},{key:"createBeam",value:function(t,n){try{var r=t.element("beam"),i=void 0;if(void 0!==r&&r.hasAttributes&&(i=r.attribute("number")),i){var a,o=parseInt(i.value,10),s=t.elements("beam"),l=s[0].value;if(s)if("begin"===l)o===(null===(a=this.openBeams.last())||void 0===a?void 0:a.BeamNumber)?(this.beamNumberOffset++,o+=this.beamNumberOffset):this.openBeams.last()&&this.handleOpenBeam(),this.openBeams.push(new Beam(o,this.beamNumberOffset));else o+=this.beamNumberOffset;var u=!1;if(!(o>0&&o<=this.openBeams.length&&this.openBeams[o-1]))return void loglevelExports.debug("[OSMD] invalid beamnumber");for(var c=0,h=this.openBeams[o-1].Notes.length;c1){var r=e.element("time-modification");r&&(r=r.element("actual-notes"));for(var i=t,a=0,o=i.length;a1&&this.openTupletNumber--),this.tupletDict[c]=f;var v=[];v.push(this.currentNote),f.Notes.push(v),f.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=f,this.openTupletNumber=c}else if("stop"===u.value){var m=1;s.attribute("number")&&(m=parseInt(s.attribute("number").value,10));var g=this.tupletDict[m];if(g){var y=s.attribute("placement");y&&("below"===y.value?g.tupletLabelNumberPlacement=PlacementEnum.Below:g.tupletLabelNumberPlacement=PlacementEnum.Above,g.PlacementFromXml=!0);var b=[];if(b.push(this.currentNote),g.Notes.push(b),!g.PlacementFromXml){var A,S=!1,x=_createForOfIteratorHelper(g.Notes);try{for(x.s();!(A=x.n()).done;){var w,_=_createForOfIteratorHelper(A.value);try{for(_.s();!(w=_.n()).done;){var E=w.value;if(!E.isRest()){E.StemDirectionXml===StemDirectionType.Down?g.tupletLabelNumberPlacement=PlacementEnum.Below:g.tupletLabelNumberPlacement=PlacementEnum.Above,S=!0;break}}}catch(err){_.e(err)}finally{_.f()}if(S)break}}catch(err){x.e(err)}finally{x.f()}}g.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=g,delete this.tupletDict[m],0===Object.keys(this.tupletDict).length?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--}}}}}else if(t[0]){var k=t[0];if(k.hasAttributes){var C=k.attribute("type").value,M=1;k.attribute("number")&&(M=parseInt(k.attribute("number").value,10));var P=isNaN(M),I=k.attribute("bracket");if(I&&"yes"===I.value&&(n=!0),"start"===C){var T=0,B=e.element("time-modification");if(B&&(B=B.element("actual-notes")),B&&(T=parseInt(B.value,10),isNaN(T))){var R=ITextTranslation.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(R),new MusicSheetReadingException(R)}P&&(this.openTupletNumber++,M=this.openTupletNumber);var L=this.tupletDict[M];L||((L=this.tupletDict[M]=new Tuplet(T,n)).tupletLabelNumberPlacement=PlacementEnum.Above);var N=k.attribute("placement");N&&("below"===N.value?L.tupletLabelNumberPlacement=PlacementEnum.Below:L.tupletLabelNumberPlacement=PlacementEnum.Above,L.PlacementFromXml=!0);var F=[];F.push(this.currentNote),L.Notes.push(F),L.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=L,this.openTupletNumber=M}else if("stop"===C){P&&(M=this.openTupletNumber);var D=this.tupletDict[this.openTupletNumber];if(D){var O=k.attribute("placement");O&&("below"===O.value?D.tupletLabelNumberPlacement=PlacementEnum.Below:D.tupletLabelNumberPlacement=PlacementEnum.Above,D.PlacementFromXml=!0);var V=[];if(V.push(this.currentNote),D.Notes.push(V),!D.PlacementFromXml){var z,G=!1,H=_createForOfIteratorHelper(D.Notes);try{for(H.s();!(z=H.n()).done;){var U,j=_createForOfIteratorHelper(z.value);try{for(j.s();!(U=j.n()).done;){var Q=U.value;if(!Q.isRest()){Q.StemDirectionXml===StemDirectionType.Down?D.tupletLabelNumberPlacement=PlacementEnum.Below:D.tupletLabelNumberPlacement=PlacementEnum.Above,G=!0;break}}}catch(err){j.e(err)}finally{j.f()}if(G)break}}catch(err){H.e(err)}finally{H.f()}}D.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=D,0===Object.keys(this.tupletDict).length?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--,delete this.tupletDict[M]}}}}return this.openTupletNumber}},{key:"handleTimeModificationNode",value:function(e){if(this.tupletDict[this.openTupletNumber])try{var t,n=this.tupletDict[this.openTupletNumber],r=CollectionUtil.last(n.Notes);r[0].ParentVoiceEntry.Timestamp.Equals(this.currentVoiceEntry.Timestamp)?t=r:(t=[],n.Notes.push(t),n.Fractions.push(this.getTupletNoteDurationFromType(e))),t.push(this.currentNote),this.currentNote.NoteTuplet=n}catch(s){var i=ITextTranslation.translateText("ReaderErrorMessages/TupletNumberError","Invalid tuplet number.");throw this.musicSheet.SheetErrors.pushMeasureError(i),s}else if(this.currentVoiceEntry.Notes.length>0){var a=this.currentVoiceEntry.Notes[0];if(a.NoteTuplet){var o=a.NoteTuplet;CollectionUtil.last(o.Notes).push(this.currentNote),this.currentNote.NoteTuplet=o}}}},{key:"addTie",value:function(e,t,n,r){if(e)if(1===e.length){var i=e[0];if(void 0!==i&&i.attributes()){var a=this.getTieDirection(i),o=i.attribute("type").value;try{if("start"===o){var s=this.findCurrentNoteInTieDict(this.currentNote);s<0&&delete this.openTieDict[s];var l=this.getNextAvailableNumberForTie(),u=new Tie(this.currentNote,r);this.openTieDict[l]=u,u.TieNumber=l,u.TieDirection=a}else if("stop"===o){var c=this.findCurrentNoteInTieDict(this.currentNote),h=this.openTieDict[c];h&&(h.AddNote(this.currentNote),delete this.openTieDict[c])}}catch(err){var d=ITextTranslation.translateText("ReaderErrorMessages/TieError","Error while reading tie.");this.musicSheet.SheetErrors.pushMeasureError(d)}}}else if(2===e.length){var f=this.findCurrentNoteInTieDict(this.currentNote);if(f>=0){var p=this.openTieDict[f];p.AddNote(this.currentNote);var v,m=_createForOfIteratorHelper(e);try{for(m.s();!(v=m.n()).done;){var g=v.value;if("start"===g.attribute("type").value){var y=this.getTieDirection(g);p.NoteIndexToTieDirection[p.Notes.length-1]=y}}}catch(err){m.e(err)}finally{m.f()}}}}},{key:"getTieDirection",value:function(e){var t=PlacementEnum.NotYetDefined,n=e.attribute("placement");n&&("above"===n.value?t=PlacementEnum.Above:"below"===n.value&&(t=PlacementEnum.Below));var r=e.attribute("orientation");return r&&("over"===r.value?t=PlacementEnum.Above:"under"===r.value&&(t=PlacementEnum.Below)),t}},{key:"getNextAvailableNumberForTie",value:function(){var e=Object.keys(this.openTieDict);if(0===e.length)return 1;e.sort((function(e,t){return+e-+t}));for(var t=0;t0&&void 0!==arguments[0]&&arguments[0],n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];_classCallCheck2(this,e),this.ChangeEnd=!1,this.ChangeBegin=!1,this.line=t,this.sign=n}return _createClass2(e,[{key:"IsLine",get:function(){return this.line}},{key:"IsSign",get:function(){return this.sign}}]),e}(),WavyLine=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e){return _classCallCheck2(this,n),t.call(this,e)}return _createClass2(n)}(AbstractExpression),ExpressionReader=function(){function e(t,n,r){_classCallCheck2(this,e),this.openContinuousDynamicExpressions=[],this.musicSheet=t,this.staffNumber=r,this.globalStaffIndex=t.getGlobalStaffIndexOfFirstStaff(n)+(r-1),this.initialize()}return _createClass2(e,[{key:"readExpressionParameters",value:function(e,t,n,r,i,a,o){this.initialize();var s=e.element("offset");if(void 0!==s&&!o)try{this.offsetDivisions=parseInt(s.value,10)}catch(w){var l="ReaderErrorMessages/ExpressionOffsetError, Invalid expression offset -> set to default.";loglevelExports.debug("ExpressionReader.readExpressionParameters",l,w),this.musicSheet.SheetErrors.pushMeasureError(l),this.offsetDivisions=0}this.directionTimestamp=Fraction$1.createFromFraction(r);var u=new Fraction$1(Math.abs(this.offsetDivisions),4*n);this.offsetDivisions>0?r.RealValue>0?(u=Fraction$1.multiply(Fraction$1.minus(r,i),u),this.directionTimestamp=Fraction$1.plus(u,r)):this.directionTimestamp=Fraction$1.createFromFraction(u):this.offsetDivisions<0&&(r.RealValue>0?(u=Fraction$1.multiply(Fraction$1.minus(r,i),u),this.directionTimestamp=Fraction$1.minus(r,u)):this.directionTimestamp=Fraction$1.createFromFraction(u));var c=e.attribute("placement");if(c)try{var h=c.value;"below"===h?this.placement=PlacementEnum.Below:"above"===h&&(this.placement=PlacementEnum.Above)}catch(w){var d=ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");loglevelExports.debug("ExpressionReader.readExpressionParameters",d,w),this.musicSheet.SheetErrors.pushMeasureError(d),this.placement=PlacementEnum.Below}if(this.placement===PlacementEnum.NotYetDefined)try{var f=e.element("direction-type");if(f){var p=f.element("dynamics");if(p){var v=p.attribute("default-y");v&&this.readExpressionPlacement(v,"read dynamics y pos")}var m=f.element("wedge");if(m){var g=m.attribute("default-y");g&&this.readExpressionPlacement(g,"read wedge y pos")}var y=f.element("words");if(y){var b=y.attribute("default-y");b&&this.readExpressionPlacement(b,"read words y pos")}var A=f.element("rehearsal");if(A){var S=A.attribute("default-y");S&&this.readExpressionPlacement(S,"read rehearsal pos")}}}catch(w){var x=ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");loglevelExports.debug("ExpressionReader.readExpressionParameters",x,w),this.musicSheet.SheetErrors.pushMeasureError(x),this.placement=PlacementEnum.Below}this.placement===PlacementEnum.NotYetDefined&&(t.Staves.length>1?this.placement=PlacementEnum.Below:t.HasLyrics?this.placement=PlacementEnum.Above:this.placement=PlacementEnum.Below)}},{key:"read",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=!1,o=!1,s=e.element("sound");if(s){var l=s.attribute("tempo"),u=s.attribute("dynamics");if(l){var c=l.value.match(/^(\d+)(\.\d+)?$/);(null==c?void 0:c.length)>0?this.soundTempo=Math.round(Number.parseFloat(l.value)):(loglevelExports.info("invalid xml tempo: "+l.value),this.soundTempo=100),t.TempoInBPM=this.soundTempo,0===this.musicSheet.DefaultStartTempoInBpm&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,a=!0}if(u){var h=u.value.match(/\d+/);this.soundDynamic=void 0!==h?parseInt(h[0],10):100,o=!0}}var d=e.element("direction-type");if(d){var f=d.element("metronome");if(f){t.metronomeNoteIndex=i;var p=f.element("beat-unit"),v=void 0!==f.element("beat-unit-dot"),m=f.element("per-minute");if(void 0!==p&&m){f.hasAttributes&&void 0!==f.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(n));var g=parseFloat(m.value);this.createNewTempoExpressionIfNeeded(t);var y=new InstantaneousTempoExpression(void 0,this.placement,this.staffNumber,g,this.currentMultiTempoExpression,!0);y.parentMeasure=t,this.soundTempo=g,t.TempoInBPM=this.soundTempo*(v?1.5:1),0===this.musicSheet.DefaultStartTempoInBpm&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),1===t.MeasureNumberXML&&0===this.musicSheet.SourceMeasures.length&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,y.dotted=v,y.beatUnit=p.value,this.currentMultiTempoExpression.addExpression(y,""),this.currentMultiTempoExpression.CombinedExpressionsText="test"}}else if(f=d.element("dynamics")){var b=void 0!==e.element("notations");this.interpretInstantaneousDynamics(f,t,n,b)}else if(f=d.element("words")){var A,S="",x=_createForOfIteratorHelper(d.elements("words"));try{for(x.s();!(A=x.n()).done;){S+=A.value.value}}catch(err){x.e(err)}finally{x.f()}if(f.value=S,a||isSpeedKeyword(f.value)||isSpeedHiddenKeyword(f.value)){this.createNewTempoExpressionIfNeeded(t),this.currentMultiTempoExpression.CombinedExpressionsText=f.value,(isSpeedKeyword(f.value)||isSpeedHiddenKeyword(f.value))&&(f.value=void 0);var w=new InstantaneousTempoExpression(f.value,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);this.currentMultiTempoExpression.addExpression(w,"")}else o||this.interpretWords(f,t,n)}else(f=d.element("wedge"))?this.interpretWedge(f,t,r,t.MeasureNumber):(f=d.element("rehearsal"))&&this.interpretRehearsalMark(f,t,n,t.MeasureNumber)}}},{key:"closeOpenExpressions",value:function(e,t){var n,r=_createForOfIteratorHelper(this.openContinuousDynamicExpressions);try{for(r.s();!(n=r.n()).done;){var i=n.value;this.createNewMultiExpressionIfNeeded(e,i.NumberXml,t),this.closeOpenContinuousDynamic(i,e,t)}}catch(err){r.e(err)}finally{r.f()}this.openContinuousTempoExpression&&this.closeOpenContinuousTempo(Fraction$1.plus(e.AbsoluteTimestamp,t))}},{key:"addOctaveShift",value:function(e,t,n){var r=1,i=e.element("staff");if(i)try{r=parseInt(i.value,10)}catch(m){var a=ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftStaffError","Invalid octave shift staff number -> set to default");this.musicSheet.SheetErrors.pushMeasureError(a),r=1,loglevelExports.debug("ExpressionReader.addOctaveShift",a,m)}var o=e.element("direction-type");if(o){var s=o.element("octave-shift"),l=this.readPlacement(e);if(void 0!==s&&s.hasAttributes)try{var u=this.readNumber(s);if(s.attribute("size")){var c,h=parseInt(s.attribute("size").value,10),d=0;8===h?d=1:15===h&&(d=2);var f=null===(c=s.attribute("type"))||void 0===c?void 0:c.value;if(f||(l===PlacementEnum.Above?f="down":l===PlacementEnum.Below&&(f="up")),"up"===f||"down"===f){var p=new OctaveShift(f,d);p.StaffNumber=r,this.getMultiExpression=this.createNewMultiExpressionIfNeeded(t,u),this.getMultiExpression.OctaveShiftStart=p,p.ParentStartMultiExpression=this.getMultiExpression,this.openOctaveShift=p}else if("stop"===f){if(this.openOctaveShift)this.getMultiExpression=this.createNewMultiExpressionIfNeeded(t,this.openOctaveShift.numberXml,n),this.getMultiExpression.OctaveShiftEnd=this.openOctaveShift,this.openOctaveShift.ParentEndMultiExpression=this.getMultiExpression,this.openOctaveShift=void 0}else f||loglevelExports.debug("octave-shift missing type in xml")}}catch(m){var v=ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftError","Error while reading octave shift.");this.musicSheet.SheetErrors.pushMeasureError(v),loglevelExports.debug("ExpressionReader.addOctaveShift",v,m)}}}},{key:"addPedalMarking",value:function(e,t,n){var r=e.element("direction-type");if(r){var i=r.element("pedal");if(void 0!==i&&i.hasAttributes){var a=!1,o=!1;try{var s,l,u,c;switch("yes"===(null===(s=i.attribute("line"))||void 0===s?void 0:s.value)?o=!0:"no"===(null===(l=i.attribute("line"))||void 0===l?void 0:l.value)&&(o=!1,a=!0),"yes"===(null===(u=i.attribute("sign"))||void 0===u?void 0:u.value)?a=!0:"no"===(null===(c=i.attribute("sign"))||void 0===c?void 0:c.value)&&(a=!1,o=!0),i.attribute("type").value){case"start":this.openPedal&&this.openPedal.IsLine&&this.endOpenPedal(t),this.createNewMultiExpressionIfNeeded(t,-1),this.openPedal=new Pedal(o,a),this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openPedal&&this.endOpenPedal(t);break;case"change":this.openPedal&&this.openPedal.IsLine&&(this.openPedal.ChangeEnd=!0,this.createNewMultiExpressionIfNeeded(t,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.createNewMultiExpressionIfNeeded(t,-1),this.openPedal=new Pedal(o,a),this.openPedal.ChangeBegin=!0,this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression)}}catch(d){var h=ITextTranslation.translateText("ReaderErrorMessages/PedalError","Error while reading pedal.");this.musicSheet.SheetErrors.pushMeasureError(h),loglevelExports.debug("ExpressionReader.addPedalMarking",h,d)}}}}},{key:"endOpenPedal",value:function(e){this.createNewMultiExpressionIfNeeded(e,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.openPedal=void 0}},{key:"addWavyLine",value:function(e,t,n,r){if(e&&e.hasAttributes)try{switch(e.attribute("type").value){case"start":this.createNewMultiExpressionIfNeeded(t,-1),this.openWavyLine=new WavyLine(this.placement),this.getMultiExpression.WavyLineStart=this.openWavyLine,this.openWavyLine.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openWavyLine&&(this.createNewMultiExpressionIfNeeded(t,-1,n),this.getMultiExpression.WavyLineEnd=this.openWavyLine,this.openWavyLine.ParentEndMultiExpression=this.getMultiExpression,this.openWavyLine=void 0)}}catch(a){var i=ITextTranslation.translateText("ReaderErrorMessages/WavyLineError","Error while reading wavy-line.");this.musicSheet.SheetErrors.pushMeasureError(i),loglevelExports.debug("ExpressionReader.addWavyLine",i,a)}}},{key:"initialize",value:function(){this.placement=PlacementEnum.NotYetDefined,this.soundTempo=0,this.soundDynamic=0,this.offsetDivisions=0}},{key:"readPlacement",value:function(e){var t,n=null===(t=e.attribute("placement"))||void 0===t?void 0:t.value;return"above"===n?PlacementEnum.Above:"below"===n?PlacementEnum.Below:PlacementEnum.NotYetDefined}},{key:"readExpressionPlacement",value:function(e,t){try{var n=parseInt(e.value,10);n<0?this.placement=PlacementEnum.Below:n>0&&(this.placement=PlacementEnum.Above)}catch(r){loglevelExports.debug("ExpressionReader.readExpressionParameters",t,r)}}},{key:"interpretInstantaneousDynamics",value:function(e,t,n,r){if(e.hasElements){e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(n));var i=this.readNumber(e),a=e.elements()[0].name;if("other-dynamics"===a&&(a=e.elements()[0].value),a){r?this.createNewMultiExpressionIfNeeded(t,i,Fraction$1.createFromFraction(n)):this.createNewMultiExpressionIfNeeded(t,i);var o=new InstantaneousDynamicExpression(a,this.soundDynamic,this.placement,this.staffNumber,t);o.InMeasureTimestamp=n.clone(),this.getMultiExpression.addExpression(o,""),this.initialize(),this.activeInstantaneousDynamic?this.activeInstantaneousDynamic.DynEnum=o.DynEnum:this.activeInstantaneousDynamic=new InstantaneousDynamicExpression(a,0,PlacementEnum.NotYetDefined,1,t)}}}},{key:"interpretWords",value:function(e,t,n){var r,i=e.value,a=e.attribute("font-style");a&&("italic"===a.value&&(r=FontStyles.Italic));if(i.length>0){if(e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(n)),this.checkIfWordsNodeIsRepetitionInstruction(i))return;this.fillMultiOrTempoExpression(i,t,n,r),this.initialize()}}},{key:"readNumber",value:function(e){var t,n=1,r=null===(t=e.attribute("number"))||void 0===t?void 0:t.value;return r&&(n=Number.parseInt(r,10)),n}},{key:"interpretWedge",value:function(e,t,n,r){var i,a;void 0!==e&&e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(n));var o=this.readNumber(e);"stop"===(null===(i=e.attribute("type"))||void 0===i||null===(a=i.value)||void 0===a?void 0:a.toLowerCase())?this.createNewMultiExpressionIfNeeded(t,o,n):this.createNewMultiExpressionIfNeeded(t,o),this.addWedge(e,t,n),this.initialize()}},{key:"interpretRehearsalMark",value:function(e,t,n,r){t.rehearsalExpression=new RehearsalExpression(e.value,this.placement)}},{key:"createNewMultiExpressionIfNeeded",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;n||(n=this.directionTimestamp);var r=this.getMultiExpression;return(!r||r&&(r.SourceMeasureParent!==e||r.numberXml!==t||r.SourceMeasureParent===e&&r.Timestamp!==n))&&(this.getMultiExpression=r=new MultiExpression(e,Fraction$1.createFromFraction(n)),e.StaffLinkedExpressions[this.globalStaffIndex].push(r)),r}},{key:"createNewTempoExpressionIfNeeded",value:function(e){this.currentMultiTempoExpression&&this.currentMultiTempoExpression.SourceMeasureParent===e&&this.currentMultiTempoExpression.Timestamp===this.directionTimestamp||(this.currentMultiTempoExpression=new MultiTempoExpression(e,Fraction$1.createFromFraction(this.directionTimestamp)),e.TempoExpressions.push(this.currentMultiTempoExpression))}},{key:"addWedge",value:function(e,t,n){if(void 0!==e&&e.hasAttributes){var r=this.readNumber(e),i=e.attribute("type").value.toLowerCase();try{if("crescendo"===i||"diminuendo"===i){var a=new ContinuousDynamicExpression(ContDynamicEnum[i],this.placement,this.staffNumber,t,this.activeInstantaneousDynamic,r);this.openContinuousDynamicExpressions.push(a);var o=this.getMultiExpression;o||(o=this.createNewMultiExpressionIfNeeded(t,r)),o.StartingContinuousDynamic=a,a.StartMultiExpression=o,void 0!==this.activeInstantaneousDynamic&&this.activeInstantaneousDynamic.StaffNumber===a.StaffNumber&&(this.activeInstantaneousDynamic=void 0)}else if("stop"===i){var s,l=_createForOfIteratorHelper(this.openContinuousDynamicExpressions);try{for(l.s();!(s=l.n()).done;){var u=s.value;u.NumberXml===r&&u.NumberXml===r&&this.closeOpenContinuousDynamic(u,t,n)}}catch(err){l.e(err)}finally{l.f()}}}catch(h){var c="ReaderErrorMessages/WedgeError, Error while reading Crescendo / Diminuendo.";this.musicSheet.SheetErrors.pushMeasureError(c),loglevelExports.debug("ExpressionReader.addWedge",c,h)}}}},{key:"fillMultiOrTempoExpression",value:function(e,t,n,r){if(e){var i=e.trim();this.createExpressionFromString("",i,t,n,e,r)}}},{key:"createExpressionFromString",value:function(e,t,n,r,i,a){if(InstantaneousTempoExpression.isInputStringInstantaneousTempo(t)||ContinuousTempoExpression.isInputStringContinuousTempo(t)){if(n.TempoExpressions.length>0)for(var o=0,s=n.TempoExpressions.length;o0)for(var m=0,g=n.TempoExpressions.length;m0&&!this.hasDigit(t)&&this.globalStaffIndex>0){if(y.EntriesList[0].label.indexOf(t)>=0)return!1;break}}var b=TextAlignmentEnum.CenterBottom;this.musicSheet.Rules.CompactMode&&(b=TextAlignmentEnum.LeftBottom);var A=new UnknownExpression(t,this.placement,b,this.staffNumber);return A.fontStyle=a,v.addExpression(A,e),!1}},{key:"closeOpenContinuousDynamic",value:function(e,t,n){if(e){var r=e.NumberXml;e.EndMultiExpression=this.createNewMultiExpressionIfNeeded(t,r,n),e.StartMultiExpression.EndingContinuousDynamic=e,this.openContinuousDynamicExpressions=this.openContinuousDynamicExpressions.filter((function(t){return t!==e}))}}},{key:"closeOpenContinuousTempo",value:function(e){this.openContinuousTempoExpression.AbsoluteEndTimestamp=e,this.openContinuousTempoExpression=void 0}},{key:"checkIfWordsNodeIsRepetitionInstruction",value:function(e){return"coda"===(e=e.trim().toLowerCase())||"tocoda"===e||"to coda"===e||"fine"===e||"d.c."===e||"dacapo"===e||"da capo"===e||"d.s."===e||"dalsegno"===e||"dal segno"===e||"d.c. al fine"===e||"d.s. al fine"===e||"d.c. al coda"===e||"d.s. al coda"===e}},{key:"hasDigit",value:function(e){return/\d/.test(e)}}]),e}(),Slur=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,[{key:"StartNote",get:function(){return this.startNote},set:function(e){this.startNote=e}},{key:"EndNote",get:function(){return this.endNote},set:function(e){this.endNote=e}},{key:"startNoteHasMoreStartingSlurs",value:function(){if(!this.startNote)return!1;for(var e=0,t=this.startNote.NoteSlurs.length;e0){var a=i.attribute("type").value,o=1;try{i.attribute("number")&&(o=parseInt(i.attribute("number").value,10))}catch(f){loglevelExports.debug("VoiceGenerator.addSlur number: ",f)}var s=PlacementEnum.NotYetDefined,l=i.attribute("placement");l&&l.value&&("above"===l.value?s=PlacementEnum.Above:"below"===l.value&&(s=PlacementEnum.Below));var u=i.attribute("orientation");if(u&&u.value&&("over"===u.value?s=PlacementEnum.Above:"under"===u.value&&(s=PlacementEnum.Below)),"start"===a){var c=this.openSlurDict[o];c||(c=new Slur,this.openSlurDict[o]=c),c.StartNote=t,c.PlacementXml=s}else if("stop"===a){var h=this.openSlurDict[o];if(h){if(h.EndNote=t,!t.checkForDoubleSlur(h))t.NoteSlurs.push(h),h.StartNote.NoteSlurs.push(h);delete this.openSlurDict[o]}}}}}catch(err){r.e(err)}finally{r.f()}}}catch(err){var d=ITextTranslation.translateText("ReaderErrorMessages/SlurError","Error while reading slur.");this.musicSheet.SheetErrors.pushMeasureError(d)}}}]),e}(),InstrumentReader=function(){function t(e,n,r,i){_classCallCheck2(this,t),this.voiceGeneratorsDict={},this.staffMainVoiceGeneratorDict={},this.divisions=0,this.currentClefNumber=1,this.currentXmlMeasureIndex=0,this.activeKeyHasBeenInitialized=!1,this.abstractInstructions=[],this.openChordSymbolContainers=[],this.soundTempos=new Map,this.xmlNotes=[],this.repetitionInstructionReader=n,this.xmlMeasureList=r,this.musicSheet=i.GetMusicSheet,this.instrument=i,this.activeClefs=new Array(i.Staves.length),this.activeClefsHaveBeenInitialized=new Array(i.Staves.length);for(var a=0;a=this.xmlMeasureList.length)return!1;this.currentMeasure=t,this.followingMultirestMeasures=Math.max(this.followingMultirestMeasures-1,0),this.inSourceMeasureInstrumentIndex=this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument),this.repetitionInstructionReader&&this.repetitionInstructionReader.prepareReadingMeasure(t,this.currentXmlMeasureIndex);var a=new Fraction$1(0,1),o=new Fraction$1(0,1),s=!1;this.maxTieNoteFraction=new Fraction$1(0,1);var l=!1,u=[];try{var c,h=this.xmlMeasureList[this.currentXmlMeasureIndex],d=h.elements();if(t.Rules.UseXMLMeasureNumbers&&!Number.isInteger(t.MeasureNumberXML)){var f,p=parseInt(null===(f=h.attribute("number"))||void 0===f?void 0:f.value,10);Number.isInteger(p)&&(t.MeasureNumberXML=p)}for(var v=0;v0&&(c=d[v-1]),"print"===m.name){var g=m.attribute("new-system");"yes"===(null==g?void 0:g.value)&&(t.printNewSystemXml=!0);var y=m.attribute("new-page");"yes"===(null==y?void 0:y.value)&&(t.printNewPageXml=!0)}else if("note"===m.name){var b;m.element("grace")||(this.xmlNotes.push(m),u.push(m));var A=!0;"no"===(null===(b=m.attribute("print-object"))||void 0===b?void 0:b.value)&&(A=!1);var S=1;this.instrument.Staves.length>1&&m.element("staff")&&(S=parseInt(m.element("staff").value,10),isNaN(S)&&(loglevelExports.debug("InstrumentReader.readNextXmlMeasure.get staff number"),S=1)),this.currentStaff=this.instrument.Staves[S-1];var x=void 0!==m.element("chord");if(m.element("voice")){var w=parseInt(m.element("voice").value,10);this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(w,S-1)}else x&&this.currentVoiceGenerator||(this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(1,S-1));var _=0,E=new Fraction$1(0,1),k=2,C=void 0,M=!1;if(m.element("duration")){if(_=parseInt(m.element("duration").value,10),isNaN(_)){var P=ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid Note Duration.");this.musicSheet.SheetErrors.pushMeasureError(P),loglevelExports.debug("InstrumentReader.readNextXmlMeasure",P);continue}if(E=new Fraction$1(_,4*this.divisions),0===_?E=this.getNoteDurationFromTypeNode(m):C=this.getNoteDurationFromTypeNode(m),m.element("time-modification")){E=this.getNoteDurationForTuplet(m);var I=m.element("time-modification");null!=I&&I.element("normal-notes")&&(k=parseInt(I.element("normal-notes").value,10)),M=!0}}var T=void 0!==m.element("rest"),B=m.element("notations"),R=void 0!==m.element("grace")||0===_||x&&l,L=!1,N=!1;if(R){var F=m.element("duration"),D=m.element("grace");if(D&&D.attributes())if(D.attribute("slash"))"yes"===D.attribute("slash").value&&(L=!0);F||(E=this.getNoteDurationFromTypeNode(m));var O=m.element("notations");O&&O.element("slur")&&(N=!0)}var V=!1;m.element("cue")&&(V=!0);var z=m.element("type"),G=NoteType.UNDEFINED;if(z){var H=z.attribute("size");"cue"===(null==H?void 0:H.value)&&(V=!0),G=NoteTypeHandler.StringToNoteType(z.value)}var U=StemDirectionType.Undefined,j=void 0,Q=m.element("stem");if(Q){switch(Q.value){case"down":U=StemDirectionType.Down;break;case"up":U=StemDirectionType.Up;break;case"double":U=StemDirectionType.Double;break;case"none":U=StemDirectionType.None;break;default:U=StemDirectionType.Undefined}var Y=Q.attribute("color");Y&&(j=this.parseXmlColor(Y.value))}var W=0,X="",K="",J="";if(B){var $=B.element("ornaments");if($){var q=$.element("tremolo");if(q){var Z=q.attribute("type");if(X=Z.value,Z){var ee=parseInt(q.value,10);ee>0&&(W=ee),"start"!==Z.value&&"stop"!==Z.value||(E=new Fraction$1(parseInt(m.element("duration").value,10),4*this.divisions))}}var te=$.elements("wavy-line");if(void 0!==te){var ne,re=_createForOfIteratorHelper(te);try{for(re.s();!(ne=re.n()).done;){var ie=ne.value,ae=this.expressionReaders[this.readExpressionStaffNumber(m)-1];ae&&(ae.readExpressionParameters(ie,this.instrument,this.divisions,a,o,this.currentMeasure.MeasureNumber,!1),ae.addWavyLine(ie,this.currentMeasure,a,o))}}catch(err){re.e(err)}finally{re.f()}}}B.elements("glissando").find((function(e){return"start"===e.attribute("type").value}))&&(K="start"),B.elements("slide").find((function(e){return"start"===e.attribute("type").value}))&&(J="start")}var oe=void 0,se=m.element("notehead");if(se){var le=se.attribute("color");le&&(oe=this.parseXmlColor(le.value))}var ue=void 0,ce=m.attribute("color");ce&&(ue=this.parseXmlColor(ce.value),oe||(oe=ue),j||(j=ue));var he=a.clone();x&&(he=o.clone()),this.currentStaffEntry=this.currentMeasure.findOrCreateStaffEntry(he,this.inSourceMeasureInstrumentIndex+S-1,this.currentStaff).staffEntry,(!this.currentVoiceGenerator.hasVoiceEntry()||!x&&!R&&!l||R&&!l||R&&!x||!R&&l)&&this.currentVoiceGenerator.createVoiceEntry(he,this.currentStaffEntry,this.activeKey,this.ActiveRhythm,R,L,N),R||x||(o=a.clone(),a.Add(E)),x&&void 0!==this.currentStaffEntry&&this.currentStaffEntry.ParentStaff!==this.currentStaff&&(this.currentStaffEntry=this.currentVoiceGenerator.checkForStaffEntryLink(this.inSourceMeasureInstrumentIndex+S-1,this.currentStaff,this.currentStaffEntry,this.currentMeasure));var de=void 0!==this.currentStaffEntry&&void 0!==this.currentStaffEntry.Timestamp&&this.currentStaffEntry.Timestamp.Equals(new Fraction$1(0,1))&&!this.currentStaffEntry.hasNotes();this.saveAbstractInstructionList(this.instrument.Staves.length,de),0!==this.openChordSymbolContainers.length&&(this.currentStaffEntry.ChordContainers=this.openChordSymbolContainers,this.openChordSymbolContainers=[]),this.activeRhythm,M||R||(E=new Fraction$1(_,4*this.divisions));var fe=m.elements("dot").length;if(this.currentVoiceGenerator.read(m,E,C,G,k,T,this.currentStaffEntry,this.currentMeasure,n,this.maxTieNoteFraction,x,r,A,V,R,U,W,j,oe,fe,X,K,J),void 0!==B&&B.element("dynamics")){var pe=this.expressionReaders[this.readExpressionStaffNumber(m)-1];pe&&(pe.readExpressionParameters(m,this.instrument,this.divisions,a,o,this.currentMeasure.MeasureNumber,!1),pe.read(m,this.currentMeasure,o,void 0,u.length))}l=R}else if("attributes"===m.name){var ve=m.element("divisions");if(ve&&(this.divisions=parseInt(ve.value,10),isNaN(this.divisions))){var me=ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(loglevelExports.debug("InstrumentReader.readNextXmlMeasure",me),this.divisions=this.readDivisionsFromNotes(),!(this.divisions>0))throw s=!0,new MusicSheetReadingException(me+this.instrument.Name);this.musicSheet.SheetErrors.push(me+this.instrument.Name)}if(!m.element("divisions")&&0===this.divisions&&0===this.currentXmlMeasureIndex){var ge=ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(this.divisions=this.readDivisionsFromNotes(),!(this.divisions>0))throw s=!0,new MusicSheetReadingException(ge+this.instrument.Name);this.musicSheet.SheetErrors.push(ge+this.instrument.Name)}this.addAbstractInstruction(m,r,c,a.clone()),a.Equals(new Fraction$1(0,1))&&this.isAttributesNodeAtBeginOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],m)&&this.saveAbstractInstructionList(this.instrument.Staves.length,!0),this.isAttributesNodeAtEndOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],m)&&this.saveClefInstructionAtEndOfMeasure();var ye,be=_createForOfIteratorHelper(m.elements("staff-details"));try{for(be.s();!(ye=be.n()).done;){var Ae=ye.value,Se=Ae.element("staff-lines");if(Se){var xe=1,we=Ae.attribute("number");we&&(xe=parseInt(we.value,10)),this.instrument.Staves[xe-1].StafflineCount=parseInt(Se.value,10)}}}catch(err){be.e(err)}finally{be.f()}var _e=m.element("measure-style");if(_e){var Ee=_e.element("multiple-rest");if(Ee){var ke=Ee.value,Ce=0;try{Ce=Number.parseInt(ke,10),void 0!==t.multipleRestMeasures&&Ce!==t.multipleRestMeasures?t.multipleRestMeasures=0:(t.multipleRestMeasures=Ce,this.currentMultirestStartMeasure=t,this.followingMultirestMeasures=Ce+1)}catch(e){console.log("multirest parse error: "+e)}}}}else if("forward"===m.name){var Me=parseInt(m.element("duration").value,10);a.Add(new Fraction$1(Me,4*this.divisions))}else if("backup"===m.name){var Pe=parseInt(m.element("duration").value,10);a.Sub(new Fraction$1(Pe,4*this.divisions)),a.IsNegative()&&(a=new Fraction$1(0,1)),o.Sub(new Fraction$1(Pe,4*this.divisions)),o.IsNegative()&&(o=new Fraction$1(0,1))}else if("direction"===m.name){var Ie=m.elements("direction-type"),Te=m.element("direction-type"),Be=Math.min(1,a.RealValue);void 0!==this.activeRhythm&&this.activeRhythm.Rhythm&&(Be/=this.activeRhythm.Rhythm.RealValue);var Re=!1;if(this.repetitionInstructionReader&&(Re=this.repetitionInstructionReader.handleRepetitionInstructionsFromWordsOrSymbols(Te,Be)),!Re){var Le=this.expressionReaders[0],Ne=this.readExpressionStaffNumber(m)-1;if(Ne0?this.musicSheet.SourceMeasures[0]:this.currentMeasure;var n,r=new ClefInstruction(ClefEnum.G,0,2);t.FirstInstructionsStaffEntries[e]?(n=t.FirstInstructionsStaffEntries[e]).removeFirstInstructionOfTypeClefInstruction():(n=new SourceStaffEntry(void 0,void 0),t.FirstInstructionsStaffEntries[e]=n),r.Parent=n,n.Instructions.splice(0,0,r)}},{key:"createDefaultKeyInstruction",value:function(){var e;e=this.musicSheet.SourceMeasures.length>0?this.musicSheet.SourceMeasures[0]:this.currentMeasure;for(var t=new KeyInstruction(void 0,0,KeyEnum.major),n=this.inSourceMeasureInstrumentIndex;n0&&"backup"===n[r-1].name)return!0;for(var i=-1,a=0;a0||i<0}},{key:"isAttributesNodeAtEndOfMeasure",value:function(e,t){for(var n=e.elements().slice(),r=0,i=0;ia}},{key:"getNoteDurationFromTypeNode",value:function(e){var t=e.element("type");if(t){var n=t.value;return NoteTypeHandler.getNoteDurationFromType(n)}return new Fraction$1(0,4*this.divisions)}},{key:"addAbstractInstruction",value:function(t,n,r,i){if(!t.element("divisions")||1!==t.elements().length){var a=t.element("transpose");if(a){var o=a.element("chromatic");o&&(this.instrument.PlaybackTranspose=parseInt(o.value,10))}var s,l=t.elements("clef");if(l.length>0)for(var u=0,c=l.length;u using default clef line."),this.musicSheet.SheetErrors.pushMeasureError(s),f=2,loglevelExports.debug("InstrumentReader.addAbstractInstruction",s,$)}var g=h.element("sign");if(g)try{d=ClefEnum[g.value],ClefInstruction.isSupportedClef(d)||(s=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Unsupported clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(s),d=ClefEnum.G,f=2),d===ClefEnum.TAB&&(v=-1)}catch(e){s=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(s),d=ClefEnum.G,f=2,loglevelExports.debug("InstrumentReader.addAbstractInstruction",s,e)}var y=h.element("clef-octave-change");if(y)try{v=parseInt(y.value,10)}catch(e){s=ITextTranslation.translateText("ReaderErrorMessages/ClefOctaveError","Invalid clef octave found -> using default clef octave."),this.musicSheet.SheetErrors.pushMeasureError(s),v=0}if(h.hasAttributes&&h.attribute("number"))try{(p=parseInt(h.attribute("number").value,10))>this.currentClefNumber&&(p=this.currentClefNumber),this.currentClefNumber=p+1}catch(err){s=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(s),p=1,this.currentClefNumber=p+1}var b=new ClefInstruction(d,v,f);this.abstractInstructions.push([p,b,i])}if(void 0!==t.element("key")&&this.instrument.MidiInstrumentId!==MidiInstrument.Percussion){var A=0,S=t.element("key").element("fifths");if(S)try{A=parseInt(S.value,10)}catch($){s=ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(s),A=0,loglevelExports.debug("InstrumentReader.addAbstractInstruction",s,$)}var x=KeyEnum.none,w=t.element("key");if(w&&(w=w.element("mode")),w)try{x=KeyEnum[w.value]}catch($){s=ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(s),x=KeyEnum.major,loglevelExports.debug("InstrumentReader.addAbstractInstruction",s,$)}var _=new KeyInstruction(void 0,A,x);this.abstractInstructions.push([1,_,i])}if(t.element("time")){var E=t.element("time"),k=RhythmSymbolEnum.NONE,C=!0;if(void 0!==E&&E.hasAttributes){var M=E.attribute("symbol");M&&("common"===M.value?k=RhythmSymbolEnum.COMMON:"cut"===M.value&&(k=RhythmSymbolEnum.CUT));var P=E.attribute("print-object");P&&"no"===P.value&&(C=!1)}for(var I=0,T=0,B=E&&void 0!==E.element("senza-misura"),R=t.elements("time"),L=[],N=[],F=0,D=R.length;F0&&void 0!==N&&L.length===N.length){for(var V=L.length,z=new Array(V),G=0,H=0;H set to default."),this.musicSheet.SheetErrors.pushMeasureError(s),I=4,T=4,loglevelExports.debug("InstrumentReader.addAbstractInstruction",s,$)}var J=new RhythmInstruction(new Fraction$1(I,T,0,!1),k);J.PrintObject=C,this.abstractInstructions.push([1,J,i])}}}}},{key:"saveAbstractInstructionList",value:function(e,t){for(var n=this.abstractInstructions.length-1;n>=0;n--){var r=this.abstractInstructions[n],i=r[0],a=r[1],o=r[2];if(a instanceof ClefInstruction){var s=a;if(0===this.currentXmlMeasureIndex||i<=this.activeClefs.length&&s!==this.activeClefs[i-1])if(t||void 0===this.currentStaffEntry||this.currentStaffEntry.hasNotes()||i-1!==this.instrument.Staves.indexOf(this.currentStaffEntry.ParentStaff))if(t){if(0!==o.RealValue)continue;var l=void 0;if(this.currentMeasure){var u=s,c=this.inSourceMeasureInstrumentIndex+i-1,h=this.currentMeasure.FirstInstructionsStaffEntries[c];if(0===this.currentXmlMeasureIndex)if(h)if(void 0===this.currentMeasure.FirstInstructionsStaffEntries[c]||h.Instructions[0]instanceof ClefInstruction){var d=new SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[c]=d,u.Parent=d,d.Instructions.push(u)}else l=h,u.Parent=l,l.removeFirstInstructionOfTypeClefInstruction(),l.Instructions.splice(0,0,u),this.activeClefsHaveBeenInitialized[i-1]=!0;else l=new SourceStaffEntry(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[c]=l,u.Parent=l,l.Instructions.push(u),this.activeClefsHaveBeenInitialized[i-1]=!0;else if(this.activeClefsHaveBeenInitialized[i-1]){var f=this.previousMeasure;this.followingMultirestMeasures>0&&this.currentMeasure.Rules.RenderMultipleRestMeasures&&(f=this.currentMultirestStartMeasure);var p=new SourceStaffEntry(void 0,void 0);f.LastInstructionsStaffEntries[c]=p,u.Parent=p,p.Instructions.push(u)}else{var v=this.musicSheet.SourceMeasures[0];v.FirstInstructionsStaffEntries[c]?(l=v.FirstInstructionsStaffEntries[c]).removeFirstInstructionOfTypeClefInstruction():l=new SourceStaffEntry(void 0,void 0),u.Parent=l,l.Instructions.splice(0,0,u),this.activeClefsHaveBeenInitialized[i-1]=!0}this.activeClefs[i-1]=s,this.abstractInstructions.splice(n,1)}}else{var m=void 0,g=this.activeRhythm.Rhythm;g.RealValue>0&&o.RealValue/g.RealValue>.9&&(this.currentMeasure.LastInstructionsStaffEntries[i-1]||(this.currentMeasure.LastInstructionsStaffEntries[i-1]=new SourceStaffEntry(void 0,this.instrument.Staves[i-1])),m=this.currentMeasure.LastInstructionsStaffEntries[i-1]),m&&(s.Parent=m,m.Instructions.push(s),this.activeClefs[i-1]=s,this.abstractInstructions.splice(n,1))}else{var y=s,b=this.currentStaffEntry;if(o&&Math.abs(o.RealValue-b.Timestamp.RealValue)>.01)continue;y.Parent=b,b.removeFirstInstructionOfTypeClefInstruction(),b.Instructions.push(y),this.activeClefs[i-1]=s,this.abstractInstructions.splice(n,1)}else i<=this.activeClefs.length&&s===this.activeClefs[i-1]&&this.abstractInstructions.splice(n,1)}if(a instanceof KeyInstruction){var A=a;if(this.activeKey&&this.activeKey.Key===A.Key)this.abstractInstructions.splice(n,1);else{this.activeKey=A,this.abstractInstructions.splice(n,1);var S=void 0;if(this.activeKeyHasBeenInitialized?S=this.currentMeasure:(this.activeKeyHasBeenInitialized=!0,S=this.currentXmlMeasureIndex>0?this.musicSheet.SourceMeasures[0]:this.currentMeasure),S)for(var x=this.inSourceMeasureInstrumentIndex;x=0;e--){var t=this.abstractInstructions[e][0],n=this.abstractInstructions[e][1];if(n instanceof ClefInstruction){var r=n;if(!this.activeClefs[t-1]||r.ClefType!==this.activeClefs[t-1].ClefType||r.ClefType===this.activeClefs[t-1].ClefType&&r.Line!==this.activeClefs[t-1].Line){var i=new SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[this.inSourceMeasureInstrumentIndex+t-1]=i;var a=r;a.Parent=i,i.Instructions.push(a),this.activeClefs[t-1]=r,this.abstractInstructions.splice(e,1)}}}}},{key:"getNoteDurationForTuplet",value:function(e){var t=new Fraction$1(0,1),n=this.getNoteDurationFromTypeNode(e);if(e.element("time-modification")){var r=e.element("time-modification");if(r&&void 0!==r.element("actual-notes")&&r.element("normal-notes")){var i=r.element("actual-notes"),a=r.element("normal-notes");if(void 0!==i&&a){var o=parseInt(i.value,10),s=parseInt(a.value,10);t=new Fraction$1(s*n.Numerator,o*n.Denominator)}}}return t}},{key:"readExpressionStaffNumber",value:function(e){var t=1;if(e.element("staff")){var n=e.element("staff");if(n)try{t=parseInt(n.value,10)}catch(i){var r=ITextTranslation.translateText("ReaderErrorMessages/ExpressionStaffError","Invalid Expression staff number -> set to default.");this.musicSheet.SheetErrors.pushMeasureError(r),t=1,loglevelExports.debug("InstrumentReader.readExpressionStaffNumber",r,i)}}return t}},{key:"readDivisionsFromNotes",value:function(){for(var e=0,t=this.currentXmlMeasureIndex,n=!1;!n;){for(var r=this.xmlMeasureList[t].elements(),i=0,a=r.length;i0){n=!0;break}}if(0===e&&++t===this.xmlMeasureList.length){var h=ITextTranslation.translateText("ReaderErrorMEssages/DivisionsError","Invalid divisions value at Instrument: ");throw new MusicSheetReadingException(h+this.instrument.Name)}}return e}}]),t}(),_SubInstrument=function(){function t(e){_classCallCheck2(this,t),this.parentInstrument=e,this.fixedKey=-1,this.name=this.parseMidiInstrument(this.parentInstrument.Name),this.midiInstrumentID=t.midiInstrument[this.name],this.volume=1}return _createClass2(t,[{key:"ParentInstrument",get:function(){return this.parentInstrument}},{key:"setMidiInstrument",value:function(e){this.midiInstrumentID=t.midiInstrument[this.parseMidiInstrument(e)]}},{key:"parseMidiInstrument",value:function(n){try{if(n){var r=n.toLowerCase().trim();for(var i in r=r.replace(/\s+/g,"_"),t.midiInstrument)if(-1!==r.indexOf(i))return i}if(this.parentInstrument.Name){var a=this.parentInstrument.Name.toLowerCase().trim();for(var o in a=a.replace(/\s+/g,"_"),t.midiInstrument)if(-1!==a.indexOf(o))return o}}catch(e){loglevelExports.error("Error parsing MIDI Instrument. Default to Grand Piano.")}return"unnamed"}}],[{key:"isPianoInstrument",value:function(e){return e===MidiInstrument.Acoustic_Grand_Piano||e===MidiInstrument.Bright_Acoustic_Piano||e===MidiInstrument.Electric_Grand_Piano||e===MidiInstrument.Electric_Piano_1||e===MidiInstrument.Electric_Piano_2}}]),t}(),SubInstrument=_SubInstrument;SubInstrument.midiInstrument={alto_saxophone:MidiInstrument.Alto_Sax,baritone_saxophone:MidiInstrument.Baritone_Sax,horn_in_f:MidiInstrument.French_Horn,english_horn:MidiInstrument.English_Horn,euphonium:MidiInstrument.Euphonium,clarinet_in_bb:MidiInstrument.clarinet_in_bb,clarinet_in_eb:MidiInstrument.clarinet_in_eb,clarinet:MidiInstrument.Clarinet,alto_clarinet:MidiInstrument.Alto_Clarinet,bass_clarinet:MidiInstrument.Bass_Clarinet,bassoon:MidiInstrument.Bassoon,bass_trombone:MidiInstrument.Bass_Trombone,alt:MidiInstrument.Synth_Voice,alto:MidiInstrument.Synth_Voice,banjo:MidiInstrument.Banjo,bariton:MidiInstrument.Synth_Voice,baritone:MidiInstrument.Synth_Voice,bass:MidiInstrument.Synth_Voice,"blockflöte":MidiInstrument.Recorder,brass:MidiInstrument.Trombone,bratsche:MidiInstrument.Viola,cello:MidiInstrument.Cello,contrabass:MidiInstrument.Contrabass,drums:MidiInstrument.Percussion,flute:MidiInstrument.Flute,"flöte":MidiInstrument.Flute,frenchhorn:MidiInstrument.French_Horn,gitarre:MidiInstrument.Acoustic_Guitar_nylon,guitar:MidiInstrument.Acoustic_Guitar_nylon,harfe:MidiInstrument.Orchestral_Harp,harp:MidiInstrument.Orchestral_Harp,klarinette:MidiInstrument.Clarinet,klavier:MidiInstrument.Acoustic_Grand_Piano,kontrabass:MidiInstrument.Contrabass,oboe:MidiInstrument.Oboe,organ:MidiInstrument.Church_Organ,orgel:MidiInstrument.Church_Organ,orgue:MidiInstrument.Church_Organ,percussion:MidiInstrument.Synth_Drum,"小军鼓":MidiInstrument.Synth_Drum,snare_drum:MidiInstrument.Synth_Drum,bass_drum:MidiInstrument.Synth_Drum,side_drum:MidiInstrument.Synth_Drum,piano:MidiInstrument.Acoustic_Grand_Piano,piccolo:MidiInstrument.Piccolo,posaune:MidiInstrument.Trombone,recorder:MidiInstrument.Recorder,sax:MidiInstrument.Tenor_Sax,schlagwerk:MidiInstrument.Percussion,schlagzeug:MidiInstrument.Percussion,sopran:MidiInstrument.Synth_Voice,steeldrum:MidiInstrument.Steel_Drums,streicher:MidiInstrument.String_Ensemble_1,strings:MidiInstrument.String_Ensemble_1,tenor:MidiInstrument.Synth_Voice,tpt:MidiInstrument.Trumpet,trombone:MidiInstrument.Trombone,trompete:MidiInstrument.Trumpet,trumpet:MidiInstrument.Trumpet,tuba:MidiInstrument.Tuba,unnamed:MidiInstrument.Acoustic_Grand_Piano,viola:MidiInstrument.Viola,violin:MidiInstrument.Violin,"violon-c":MidiInstrument.Cello,"violon.":MidiInstrument.Violin,voice:MidiInstrument.Synth_Voice,woodblock:MidiInstrument.Woodblock,alto_clarinet_in_eb:MidiInstrument.AltoClarinetInEb,trumpet_in_bb:MidiInstrument.TrumpetInBb,tenor_saxophone:MidiInstrument.TenorSaxophone};var StringUtil=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,null,[{key:"StringContainsSeparatedWord",value:function(e,t){return new RegExp("( |^)"+t+"([ .]|$)",arguments.length>2&&void 0!==arguments[2]&&arguments[2]?"i":void 0).test(e)}}]),e}(),RepetitionInstructionReader=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,[{key:"MusicSheet",set:function(e){this.musicSheet=e,this.xmlMeasureList=new Array(this.musicSheet.Instruments.length),this.repetitionInstructions=[]}},{key:"prepareReadingMeasure",value:function(e,t){this.currentMeasureIndex=t}},{key:"handleLineRepetitionInstructions",value:function(e){var t=!1;if(e.elements().length>0){var n="",r=!1,i="",a="",o="",s=[],l=e.element("bar-style");l&&(o=l.value),n=e.attributes().length>0&&e.attribute("location")?e.attribute("location").value:"right";for(var u=e.elements(),c=0,h=u.length;c0)if("left"===n){if("start"===a){var _=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Ending,AlignmentType.Begin,void 0,s);this.addInstruction(this.repetitionInstructions,_)}if("forward"===i){var E=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.StartLine);this.addInstruction(this.repetitionInstructions,E)}}else{if("stop"===a){var k=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Ending,AlignmentType.End,void 0,s);this.addInstruction(this.repetitionInstructions,k)}if("backward"===i){var C=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.BackJumpLine);this.addInstruction(this.repetitionInstructions,C)}}}return t}},{key:"handleRepetitionInstructionsFromWordsOrSymbols",value:function(e,t){var n=e.element("words"),r=this.currentMeasureIndex;if(n){var i="d\\s?\\.s\\.",a=n.value.trim().toLowerCase();if(StringUtil.StringContainsSeparatedWord(a,i+" al fine",!0)){var o=new RepetitionInstruction(r,RepetitionInstructionEnum.DalSegnoAlFine);return this.addInstruction(this.repetitionInstructions,o),!0}if(StringUtil.StringContainsSeparatedWord(a,i+" al coda",!0)){var s=new RepetitionInstruction(r,RepetitionInstructionEnum.DalSegnoAlCoda);return this.addInstruction(this.repetitionInstructions,s),!0}var l,u="d\\.\\s?c\\.";if(StringUtil.StringContainsSeparatedWord(a,u+" al fine",!0)){var c=new RepetitionInstruction(r,RepetitionInstructionEnum.DaCapoAlFine);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,u+" al coda",!0)){var h=new RepetitionInstruction(r,RepetitionInstructionEnum.DaCapoAlCoda);return this.addInstruction(this.repetitionInstructions,h),!0}if(StringUtil.StringContainsSeparatedWord(a,u)||StringUtil.StringContainsSeparatedWord(a,"da\\s?capo",!0)){var d=new RepetitionInstruction(r,RepetitionInstructionEnum.DaCapo);return this.addInstruction(this.repetitionInstructions,d),!0}if(StringUtil.StringContainsSeparatedWord(a,i,!0)||StringUtil.StringContainsSeparatedWord(a,"dal\\s?segno",!0))return l=StringUtil.StringContainsSeparatedWord(a,"al\\s?coda",!0)?new RepetitionInstruction(r,RepetitionInstructionEnum.DalSegnoAlCoda):new RepetitionInstruction(r,RepetitionInstructionEnum.DalSegno),this.addInstruction(this.repetitionInstructions,l),!0;if(StringUtil.StringContainsSeparatedWord(a,"to\\s?coda",!0)||StringUtil.StringContainsSeparatedWord(a,"a (la )?coda",!0)){var f=new RepetitionInstruction(r,RepetitionInstructionEnum.ToCoda);return this.addInstruction(this.repetitionInstructions,f),!0}if(StringUtil.StringContainsSeparatedWord(a,"fine",!0)){var p=new RepetitionInstruction(r,RepetitionInstructionEnum.Fine);return this.addInstruction(this.repetitionInstructions,p),!0}if(StringUtil.StringContainsSeparatedWord(a,"coda",!0)){var v=new RepetitionInstruction(r,RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,v),!0}if(StringUtil.StringContainsSeparatedWord(a,"segno",!0)){var m=new RepetitionInstruction(r,RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,m),!0}}else{if(e.element("segno")){var g=new RepetitionInstruction(r,RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,g),!0}if(e.element("coda")){var y=new RepetitionInstruction(r,RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,y),!0}}return!1}},{key:"removeRedundantInstructions",value:function(){for(var e=0,t=0,n=0,r=0,i=0;i0&&this.findInstructionInPreviousMeasure(i,a.measureIndex,RepetitionInstructionEnum.ToCoda)&&(a.type=RepetitionInstructionEnum.None),0===t&&0===n&&(a.type=RepetitionInstructionEnum.ToCoda,a.alignment=AlignmentType.End,a.measureIndex--);break;case RepetitionInstructionEnum.Segno:if(e-r>0){for(var o=!1,s=0,l=this.repetitionInstructions.length;s0?RepetitionInstructionEnum.DalSegnoAlCoda:RepetitionInstructionEnum.DalSegno,a.type=RepetitionInstructionEnum.None,o=!0;break;case RepetitionInstructionEnum.DalSegno:case RepetitionInstructionEnum.DalSegnoAlFine:case RepetitionInstructionEnum.DalSegnoAlCoda:a.type=RepetitionInstructionEnum.None,o=!0}if(o)break}if(o)break;a.type=n-t>0?RepetitionInstructionEnum.DalSegnoAlCoda:RepetitionInstructionEnum.DalSegno,a.alignment=AlignmentType.End,a.measureIndex--}}if(this.backwardSearchForPreviousIdenticalInstruction(i,a)||a.type===RepetitionInstructionEnum.None)this.repetitionInstructions.splice(i,1),i--;else switch(a.type){case RepetitionInstructionEnum.Fine:break;case RepetitionInstructionEnum.ToCoda:n++;break;case RepetitionInstructionEnum.Coda:t++;break;case RepetitionInstructionEnum.Segno:e++;break;case RepetitionInstructionEnum.DalSegnoAlFine:case RepetitionInstructionEnum.DalSegnoAlCoda:r++}}this.repetitionInstructions.sort(RepetitionInstructionComparer.Compare)}},{key:"findInstructionInPreviousMeasure",value:function(e,t,n){for(var r=e-1;r>=0;r--){var i=this.repetitionInstructions[r];if(t-i.measureIndex==1&&i.type===n)return!0}return!1}},{key:"backwardSearchForPreviousIdenticalInstruction",value:function(e,t){for(var n=e-1;n>=0;n--){if(this.repetitionInstructions[n].equals(t))return!0}return!1}},{key:"addInstruction",value:function(e,t){for(var n=!0,r=0,i=e.length;r0;)try{var o=this.openRepetitions.last();if(o.RepetitonUnderConstruction.FromWords){if(o.WaitingForCoda){var s=o.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex+1;s>=this.musicSheet.SourceMeasures.length&&(s=-1),o.RepetitonUnderConstruction.setEndingStartIndex(2,s)}else if(0===o.RepetitonUnderConstruction.BackwardJumpInstructions.length){this.openRepetitions.splice(this.openRepetitions.length-1,1);continue}}else if(0===o.RepetitonUnderConstruction.BackwardJumpInstructions.length){var l=r.length-1,u=new RepetitionInstruction(l,RepetitionInstructionEnum.BackJumpLine,AlignmentType.End,o.RepetitonUnderConstruction);o.RepetitonUnderConstruction.BackwardJumpInstructions.push(u),r[l].LastRepetitionInstructions.push(u)}this.finalizeRepetition(this.openRepetitions.last())}catch(err){try{var c,h=this.openRepetitions.last().RepetitonUnderConstruction,d=_createForOfIteratorHelper(this.repetitionInstructions);try{for(d.s();!(c=d.n()).done;){var f=c.value;f.parentRepetition===h&&(f.parentRepetition=void 0)}}catch(err){d.e(err)}finally{d.f()}this.openRepetitions.splice(this.openRepetitions.length-1,1)}catch(w){loglevelExports.error("RepetitionCalculator: calculateRepetitions2",w)}}var p,v=!1,m=this.musicSheet.SourceMeasures.length-1,g=_createForOfIteratorHelper(this.musicSheet.Repetitions);try{for(g.s();!(p=g.n()).done;){var y=p.value;if(0===y.StartIndex&&y.EndIndex===m){v=!0;break}}}catch(err){g.e(err)}finally{g.f()}if(!v){var b=new Repetition(this.musicSheet,!0);b.FromWords=!0,b.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.StartLine),b.startMarker.parentRepetition=b,this.musicSheet.SourceMeasures[0].FirstRepetitionInstructions.push(b.startMarker),b.endMarker=new RepetitionInstruction(m,RepetitionInstructionEnum.BackJumpLine),b.endMarker.parentRepetition=b,b.BackwardJumpInstructions.push(b.endMarker),b.UserNumberOfRepetitions=b.DefaultNumberOfRepetitions,this.musicSheet.Repetitions.push(b)}for(var A=0,S=this.musicSheet.SourceMeasures.length;A1&&x.FirstRepetitionInstructions.sort(RepetitionInstructionComparer.Compare),x.LastRepetitionInstructions.length>1&&x.LastRepetitionInstructions.sort(RepetitionInstructionComparer.Compare)}}},{key:"handleRepetitionInstructions",value:function(e){var t;switch(e.type){case RepetitionInstructionEnum.StartLine:t=this.createNewRepetition(this.currentMeasureIndex),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!1,t.RepetitonUnderConstruction.startMarker=e,this.currentMeasure.FirstRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.BackJumpLine:t=this.getOrCreateCurrentRepetition2(!1),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e),0===t.RepetitonUnderConstruction.EndingParts.length&&this.finalizeRepetition(t);break;case RepetitionInstructionEnum.Ending:if(t=this.getOrCreateCurrentRepetition(),e.parentRepetition=t.RepetitonUnderConstruction,e.endingIndices.contains(1)&&e.alignment===AlignmentType.Begin){if(t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0||t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)){t=void 0;for(var n=this.openRepetitions.length-1;n>=0;n--){var r=this.openRepetitions[n];if(0===r.RepetitonUnderConstruction.BackwardJumpInstructions.length)for(t=r;this.openRepetitions.length-1>n;){var i=this.openRepetitions.last();this.finalizeRepetition(i)}}void 0===t&&((t=this.createNewRepetition(0)).RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None))}void 0===t.RepetitonUnderConstruction.forwardJumpInstruction&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(this.currentMeasureIndex-1,RepetitionInstructionEnum.ForwardJump,AlignmentType.End,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].LastRepetitionInstructions.push(t.RepetitonUnderConstruction.forwardJumpInstruction))}if(e.alignment===AlignmentType.Begin)t.RepetitonUnderConstruction.setEndingsStartIndex(e.endingIndices,this.currentMeasureIndex),this.currentMeasure.FirstRepetitionInstructions.push(e);else for(var a=0,o=e.endingIndices.length;a0&&Math.abs(t.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex-this.currentMeasureIndex)<=1)break;if(this.openRepetitions.length&&this.openRepetitions.find((function(e){return e.RepetitonUnderConstruction.startMarker.type===RepetitionInstructionEnum.StartLine})).RepetitonUnderConstruction.StartIndex===this.currentMeasureIndex)break;t=this.createNewRepetition(this.currentMeasureIndex),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=e,this.currentMeasure.FirstRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.Fine:if(0===this.openRepetitions.length)break;if(void 0===(t=this.getCurrentRepetition(!0)))break;e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,void 0===t.RepetitonUnderConstruction.forwardJumpInstruction?(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=e,t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.currentMeasure.LastRepetitionInstructions.push(e)):this.currentMeasure.LastRepetitionInstructions.push(new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Fine,AlignmentType.End,void 0));break;case RepetitionInstructionEnum.ToCoda:if(0===this.openRepetitions.length)break;if(void 0===(t=this.getCurrentRepetition(!0)))break;void 0===t.RepetitonUnderConstruction.forwardJumpInstruction&&(e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.ToCodaFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=e,this.currentMeasure.LastRepetitionInstructions.push(e));break;case RepetitionInstructionEnum.Coda:if(0===this.openRepetitions.length)break;t=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=t.RepetitonUnderConstruction,t.WaitingForCoda?(t.CodaFound=!0,t.RepetitonUnderConstruction.setEndingStartIndex(2,this.currentMeasureIndex),this.currentMeasure.LastRepetitionInstructions.push(e),this.finalizeRepetition(t),this.currentMeasureIndex>0&&(this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].printNewSystemXml=!0)):t.ToCodaFound||(0===t.RepetitonUnderConstruction.BackwardJumpInstructions.length?(t.ToCodaFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.ToCoda,AlignmentType.End,t.RepetitonUnderConstruction),this.currentMeasure.LastRepetitionInstructions.push(t.RepetitonUnderConstruction.forwardJumpInstruction)):this.currentMeasure.LastRepetitionInstructions.push(new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Coda,AlignmentType.Begin,void 0)));break;case RepetitionInstructionEnum.DaCapo:(t=this.getOrCreateCurrentRepetition()).RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&this.finalizeRepetition(t),0!==t.RepetitonUnderConstruction.StartIndex&&(t=this.createNewRepetition(0)),e.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e),0===t.RepetitonUnderConstruction.EndingParts.length&&this.finalizeRepetition(t);break;case RepetitionInstructionEnum.DalSegno:if((t=this.getOrCreateCurrentRepetition2(!0)).RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(t),(t=this.createNewRepetition(0)).RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,t.RepetitonUnderConstruction)),e.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){var l=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,e.measureIndex);l>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(l,RepetitionInstructionEnum.Segno,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[l].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)&&t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DalSegnoAlFine:if(0===this.openRepetitions.length)break;if(t=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){var u=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,e.measureIndex);u>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(u,RepetitionInstructionEnum.Segno,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[u].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}if(!t.FineFound){var c=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Fine,e.measureIndex);c>=0&&(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(c,RepetitionInstructionEnum.Fine,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[c].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DaCapoAlFine:if((t=this.getOrCreateCurrentRepetition()).RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(t),t=this.createNewRepetition(0)),void 0!==t.RepetitonUnderConstruction.startMarker&&0!==t.RepetitonUnderConstruction.StartIndex&&(t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.FromWords=!0,e.parentRepetition=t.RepetitonUnderConstruction,!t.FineFound){var h=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Fine,e.measureIndex);h>=0&&(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(h,RepetitionInstructionEnum.Fine,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[h].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DalSegnoAlCoda:if(0===this.openRepetitions.length)break;if(t=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){var d=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,e.measureIndex);d>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(d,RepetitionInstructionEnum.Segno,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[d].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}if(!t.ToCodaFound){var f=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.ToCoda,e.measureIndex);if(f>=0)t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(f,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[f].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0;else{var p=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Coda,e.measureIndex);p>=0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(p,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[p].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0)}}t.ToCodaFound&&(t.WaitingForCoda=!0),t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DaCapoAlCoda:if(((t=this.getOrCreateCurrentRepetition()).RepetitonUnderConstruction.BackwardJumpInstructions.length>0||0===t.RepetitonUnderConstruction.EndingParts.length)&&(this.finalizeRepetition(t),t=this.createNewRepetition(0)),void 0!==t.RepetitonUnderConstruction.startMarker&&0!==t.RepetitonUnderConstruction.StartIndex&&(t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.FromWords=!0,e.parentRepetition=t.RepetitonUnderConstruction,!t.ToCodaFound){var v=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.ToCoda,e.measureIndex);if(v>=0)t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(v,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[v].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0;else{var m=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Coda,e.measureIndex);m>=0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(m,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[m].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0)}}t.ToCodaFound&&(t.WaitingForCoda=!0),t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.None:break;default:throw new ArgumentOutOfRangeException("currentRepetitionInstruction")}return!0}},{key:"findInstructionInMainListBackwards",value:function(e,t){for(var n=this.repetitionInstructions.length-1;n>=0;n--){var r=this.repetitionInstructions[n];if(r.measureIndex<=t&&r.type===e)return r.measureIndex}return-1}},{key:"finalizeRepetition",value:function(e){var t=e.RepetitonUnderConstruction;if(t.BackwardJumpInstructions.length>0){var n=!0,r=this.getLastFinalizedRepetition();if(void 0!==r&&t.coversIdenticalMeasures(r)){if(t.NumberOfEndings>r.NumberOfEndings){var i=this.musicSheet.Repetitions.indexOf(r,0);i>-1&&this.musicSheet.Repetitions.splice(i,1),r.removeFromRepetitionInstructions(),this.musicSheet.Repetitions.push(t)}n=!1,t.removeFromRepetitionInstructions()}else this.musicSheet.Repetitions.push(t);n&&(t.startMarker.type===RepetitionInstructionEnum.None&&this.musicSheet.SourceMeasures[t.StartIndex].FirstRepetitionInstructions.push(t.startMarker),t.UserNumberOfRepetitions=t.DefaultNumberOfRepetitions)}this.openRepetitions.splice(this.openRepetitions.length-1,1)}},{key:"getCurrentRepetition",value:function(e){for(var t=void 0,n=this.openRepetitions.length-1;n>=0;n--)if(this.openRepetitions[n].RepetitonUnderConstruction.FromWords===e){for(t=this.openRepetitions[n];n0)return this.openRepetitions.last();var e=this.createNewRepetition(0);return e.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,e.RepetitonUnderConstruction),e}},{key:"getOrCreateCurrentRepetition2",value:function(e){var t=void 0;if(this.openRepetitions.length&&this.openRepetitions.last().RepetitonUnderConstruction.EndingParts.length<2)for(var n=this.openRepetitions.length-1;n>=0;n--)if((t=this.openRepetitions[n]).RepetitonUnderConstruction.FromWords===e){for(;n0){var t=this.openRepetitions.last(),n=t.RepetitonUnderConstruction;if(n.BackwardJumpInstructions.length>0){var r=Object.keys(n.EndingIndexDict);(0===r.length||n.EndingIndexDict[r[r.length-1]].part.EndIndex>=0)&&this.finalizeRepetition(t)}}var i=new RepetitionBuildingContainer(this.musicSheet);return this.lastRepetitionCommonPartStartIndex=e,this.openRepetitions.push(i),i}},{key:"getLastFinalizedRepetition",value:function(){if(this.musicSheet.Repetitions.length>0)return this.musicSheet.Repetitions.last()}}]),e}(),RepetitionBuildingContainer=_createClass2((function e(t){_classCallCheck2(this,e),this.RepetitonUnderConstruction=new Repetition(t)})),MusicSymbolModuleFactory=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,null,[{key:"createRepetitionInstructionReader",value:function(){return new RepetitionInstructionReader}},{key:"createRepetitionCalculator",value:function(){return new RepetitionCalculator}}]),e}(),ReaderPluginManager=function(){function e(){_classCallCheck2(this,e),this.voiceMeasureReadPlugins=[]}return _createClass2(e,[{key:"addVoiceMeasureReadPlugin",value:function(e){this.voiceMeasureReadPlugins.push(e)}},{key:"processVoiceMeasureReadPlugins",value:function(e,t,n){var r,i=_createForOfIteratorHelper(this.voiceMeasureReadPlugins);try{for(i.s();!(r=i.n()).done;){var a=r.value;try{a.measureReadCalculations(e,t,n)}catch(o){loglevelExports.info("VoiceGenerator.addSingleNote: ",o)}}}catch(err){i.e(err)}finally{i.f()}}}]),e}(),MusicSheetReader=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new EngravingRules;_classCallCheck2(this,t),this.completeNumberOfStaves=0,this.pluginManager=new ReaderPluginManager,this.afterSheetReadingModules=e||[],this.repetitionInstructionReader=MusicSymbolModuleFactory.createRepetitionInstructionReader(),this.repetitionCalculator=MusicSymbolModuleFactory.createRepetitionCalculator(),this.rules=n}return _createClass2(t,[{key:"PluginManager",get:function(){return this.pluginManager}},{key:"CompleteNumberOfStaves",get:function(){return this.completeNumberOfStaves}},{key:"createMusicSheet",value:function(t,n){try{return this._createMusicSheet(t,n)}catch(e){return void loglevelExports.error("MusicSheetReader.CreateMusicSheet",e)}}},{key:"_removeFromArray",value:function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}},{key:"trimString",value:function(e){return e.replace(/^\s+|\s+$/g,"")}},{key:"_lastElement",value:function(e){return e[e.length-1]}},{key:"_createMusicSheet",value:function(n,r){var i=[],a=0;if(this.musicSheet=new MusicSheet,this.musicSheet.Path=r,this.musicSheet.Rules=this.rules,!n)throw new MusicSheetReadingException("Undefined root element");this.pushSheetLabels(n,r);var o=n.element("part-list");if(!o)throw new MusicSheetReadingException("Undefined partListNode");var s=n.elements("part"),l=o.elements();this.initializeReading(l,s,i);var u=!0;this.currentFraction=new Fraction$1(0,1);var c=!1,h=n.element("identification");for(h&&(h=h.element("encoding")),h&&(h=h.element("software")),void 0!==h&&"Guitar Pro 5"===h.value&&(c=!0);u;){void 0!==this.currentMeasure&&this.currentMeasure.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(a=0),this.currentMeasure=new SourceMeasure(this.completeNumberOfStaves,this.musicSheet.Rules);var d,f,p=_createForOfIteratorHelper(i);try{for(p.s();!(d=p.n()).done;){var v=d.value;try{u=u&&v.readNextXmlMeasure(this.currentMeasure,this.currentFraction,c)}catch(e){var m=ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading instruments.");throw new MusicSheetReadingException(m,e)}}}catch(err){p.e(err)}finally{p.f()}if(u)this.musicSheet.addMeasure(this.currentMeasure),this.checkIfRhythmInstructionsAreSetAndEqual(i),this.checkSourceMeasureForNullEntries(),a=this.setSourceMeasureDuration(i,a),t.doCalculationsAfterDurationHasBeenSet(i),this.currentMeasure.AbsoluteTimestamp=this.currentFraction.clone(),this.musicSheet.SheetErrors.finalizeMeasure(this.currentMeasure.MeasureNumber),this.currentFraction.Add(this.currentMeasure.Duration),this.previousMeasure=this.currentMeasure,this.musicSheet.SoundTempos=null===(f=i[0])||void 0===f?void 0:f.SoundTempos}this.repetitionInstructionReader&&(this.repetitionInstructionReader.removeRedundantInstructions(),this.repetitionCalculator&&this.repetitionCalculator.calculateRepetitions(this.musicSheet,this.repetitionInstructionReader.repetitionInstructions)),0===this.musicSheet.DefaultStartTempoInBpm&&(this.musicSheet.DefaultStartTempoInBpm=100),this.musicSheet.checkForInstrumentWithNoVoice(),this.musicSheet.fillStaffList();for(var g=0,y=this.afterSheetReadingModules.length;gi){if(this.areRhythmInstructionsMixed(t)&&l.SymbolEnum!==RhythmSymbolEnum.NONE)continue;i=l.Rhythm.RealValue,a=t.indexOf(l)}}if(t.length>0&&t.lengthe.Denominator){var n=t.Denominator/e.Denominator;e.expand(n)}}},{key:"checkIfMeasureIsImplicit",value:function(e,t){return!(this.previousMeasure||!e.lt(t))||!!this.previousMeasure&&Fraction$1.plus(this.previousMeasure.Duration,e).Equals(t)}},{key:"allInstrumentsHaveSameDuration",value:function(e,t){for(var n=0,r=0,i=e.length;r=0;e--)for(var t=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries.length-1;t>=0;t--){var n=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries[t];if(n)for(var r=n.VoiceEntries.length-1;r>=0;r--){var i=n.VoiceEntries[r];0===i.Notes.length&&(this._removeFromArray(i.ParentVoice.VoiceEntries,i),this._removeFromArray(n.VoiceEntries,i))}void 0!==n&&0===n.VoiceEntries.length&&(this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries[t]=void 0)}for(var a=this.currentMeasure.VerticalSourceStaffEntryContainers.length-1;a>=0;a--){for(var o=0,s=0,l=this.currentMeasure.VerticalSourceStaffEntryContainers[a].StaffEntries.length;st){if(!this.musicSheet.Title){var y=h.attribute("font-size").value,b=parseFloat(y);n0&&c.MidiInstrumentId!==MidiInstrument.Percussion&&(g.midiInstrumentID=Math.max(0,parseInt(_.value,10)-1));else if("midi-unpitched"===_.name)g.fixedKey=Math.max(0,parseInt(_.value,10));else if("volume"===_.name)try{var E=parseFloat(_.value);g.volume=E/127}catch(L){loglevelExports.debug("ExpressionReader.readExpressionParameters","read volume",L)}else if("pan"===_.name)try{var k=parseFloat(_.value);g.pan=k/64}catch(L){loglevelExports.debug("ExpressionReader.readExpressionParameters","read pan",L)}}catch(L){loglevelExports.info("MusicSheetReader.createInstrumentGroups midi settings: ",L)}}}}catch(L){loglevelExports.info("MusicSheetReader.createInstrumentGroups: ",L)}}if(0===c.SubInstruments.length){var C=new SubInstrument(c);c.SubInstruments.push(C)}i[u]=c,n?(n.InstrumentalGroups.push(c),this.musicSheet.Instruments.push(c)):(this.musicSheet.InstrumentalGroups.push(c),this.musicSheet.Instruments.push(c))}else if("part-group"===l.name&&"start"===l.attribute("type").value){var M=new InstrumentalGroup("group",this.musicSheet,n);n?n.InstrumentalGroups.push(M):this.musicSheet.InstrumentalGroups.push(M),n=M}else if("part-group"===l.name&&"stop"===l.attribute("type").value&&n){if(1===n.InstrumentalGroups.length){var P=n.InstrumentalGroups[0];n.Parent?(n.Parent.InstrumentalGroups.push(P),this._removeFromArray(n.Parent.InstrumentalGroups,n)):(this.musicSheet.InstrumentalGroups.push(P),this._removeFromArray(this.musicSheet.InstrumentalGroups,n))}n=n.Parent}}}catch(e){var I=ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading Instruments");throw new MusicSheetReadingException(I,e)}for(var T=0,B=this.musicSheet.Instruments.length;T0){var a=i[0];if(a){var o=a.element("attributes");o&&(o=o.element("staves")),o?n+=parseInt(o.value,10):n++}}}}catch(err){r.e(err)}finally{r.f()}if(isNaN(n)||n<=0){var s=ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of staves.");throw new MusicSheetReadingException(s)}return n}},{key:"getInstrumentNumberOfStavesFromXml",value:function(e){var t=0,n=e.element("measure");if(n){var r=n.element("attributes"),i=void 0;r&&(i=r.element("staves")),t=r&&i?parseInt(i.value,10):1}if(isNaN(t)||t<=0){var a=ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of Staves.");throw new MusicSheetReadingException(a)}return t}}],[{key:"doCalculationsAfterDurationHasBeenSet",value:function(e){var t,n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){t.value.doCalculationsAfterDurationHasBeenSet()}}catch(err){n.e(err)}finally{n.f()}}}]),t}();function commonjsRequire(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jszip_minExports={},jszip_min={get exports(){return jszip_minExports},set exports(e){jszip_minExports=e}}; /*! JSZip v3.7.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/master/LICENSE */ !function(e,t){e.exports=function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var l="function"==typeof commonjsRequire&&commonjsRequire;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){return i(t[o][1][e]||e)}),c,c.exports,e,t,n,r)}return n[o].exports}for(var a="function"==typeof commonjsRequire&&commonjsRequire,o=0;o>2,s=(3&t)<<4|n>>4,l=1>6:64,u=2>4,n=(15&o)<<4|(s=a.indexOf(e.charAt(u++)))>>2,r=(3&s)<<6|(l=a.indexOf(e.charAt(u++))),d[c++]=t,64!==s&&(d[c++]=n),64!==l&&(d[c++]=r);return d}},{"./support":30,"./utils":32}],2:[function(e,t,n){var r=e("./external"),i=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function s(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}s.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(e,t,n){return e.pipe(new a).pipe(new o("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var r=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(e){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){var r=e("./utils"),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t[s])];return-1^e}(0|t,e,e.length,0):function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){var r=null;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),a=e("./utils"),o=e("./stream/GenericWorker"),s=r?"uint8array":"array";function l(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic="\b\0",a.inherits(l,o),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new l("Deflate",e)},n.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){function r(e,t){var n,r="";for(n=0;n>>=8;return r}function i(e,t,n,i,o,c){var h,d,f=e.file,p=e.compression,v=c!==s.utf8encode,m=a.transformTo("string",c(f.name)),g=a.transformTo("string",s.utf8encode(f.name)),y=f.comment,b=a.transformTo("string",c(y)),A=a.transformTo("string",s.utf8encode(y)),S=g.length!==f.name.length,x=A.length!==y.length,w="",_="",E="",k=f.dir,C=f.date,M={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(M.crc32=e.crc32,M.compressedSize=e.compressedSize,M.uncompressedSize=e.uncompressedSize);var P=0;t&&(P|=8),v||!S&&!x||(P|=2048);var I=0,T=0;k&&(I|=16),"UNIX"===o?(T=798,I|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(f.unixPermissions,k)):(T=20,I|=function(e){return 63&(e||0)}(f.dosPermissions)),h=C.getUTCHours(),h<<=6,h|=C.getUTCMinutes(),h<<=5,h|=C.getUTCSeconds()/2,d=C.getUTCFullYear()-1980,d<<=4,d|=C.getUTCMonth()+1,d<<=5,d|=C.getUTCDate(),S&&(_=r(1,1)+r(l(m),4)+g,w+="up"+r(_.length,2)+_),x&&(E=r(1,1)+r(l(b),4)+A,w+="uc"+r(E.length,2)+E);var B="";return B+="\n\0",B+=r(P,2),B+=p.magic,B+=r(h,2),B+=r(d,2),B+=r(M.crc32,4),B+=r(M.compressedSize,4),B+=r(M.uncompressedSize,4),B+=r(m.length,2),B+=r(w.length,2),{fileRecord:u.LOCAL_FILE_HEADER+B+m+w,dirRecord:u.CENTRAL_FILE_HEADER+r(T,2)+B+r(b.length,2)+"\0\0\0\0"+r(I,4)+r(i,4)+m+w+b}}var a=e("../utils"),o=e("../stream/GenericWorker"),s=e("../utf8"),l=e("../crc32"),u=e("../signature");function c(e,t,n,r){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(c,o),c.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},c.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return u.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readAndCheckSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){var r=e("./Uint8ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var r=e("./DataReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var r=e("./ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var r=e("../utils"),i=e("../support"),a=e("./ArrayReader"),o=e("./StringReader"),s=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new s(e):i.uint8array?new l(r.transformTo("uint8array",e)):new a(r.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,n){var r=e("./GenericWorker"),i=e("../utils");function a(e){r.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var r=e("./GenericWorker"),i=e("../crc32");function a(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var r=e("../utils"),i=e("./GenericWorker");function a(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,i),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var r=e("../utils"),i=e("./GenericWorker");function a(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}r.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function r(e){this.name=e||"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}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n "+e:e}},t.exports=r},{}],29:[function(e,t,n){var r=e("../utils"),i=e("./ConvertWorker"),a=e("./GenericWorker"),o=e("../base64"),s=e("../support"),l=e("../external"),u=null;if(s.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function c(e,t){return new l.Promise((function(n,i){var a=[],s=e._internalType,l=e._outputType,u=e._mimeType;e.on("data",(function(e,n){a.push(e),t&&t(n)})).on("error",(function(e){a=[],i(e)})).on("end",(function(){try{var e=function(e,t,n){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),n);case"base64":return o.encode(t);default:return r.transformTo(e,t)}}(l,function(e,t){var n,r=0,i=null,a=0;for(n=0;n>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,i,a,o=e.length,l=new Array(2*o);for(t=n=0;t>10&1023,l[n++]=56320|1023&i)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),r.applyFromCharCode(l)}(e=r.transformTo(i.uint8array?"uint8array":"array",e))},r.inherits(u,o),u.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+s[e[n]]>t?n:t}(t),l=t;o!==t.length&&(i.uint8array?(l=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(l=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(l),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=u,r.inherits(c,o),c.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var r=e("./support"),i=e("./base64"),a=e("./nodejsUtils"),o=e("set-immediate-shim"),s=e("./external");function l(e){return e}function u(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(e){if(this.extraFields[1]){var t=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,u[r++]=56320|1023&i)}return l(u,r)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;0!==n;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,n){var r,i=e("../utils/common"),a=e("./trees"),o=e("./adler32"),s=e("./crc32"),l=e("./messages"),u=0,c=4,h=0,d=-2,f=-1,p=4,v=2,m=8,g=9,y=286,b=30,A=19,S=2*y+1,x=15,w=3,_=258,E=_+w+1,k=42,C=113,M=1,P=2,I=3,T=4;function B(e,t){return e.msg=l[t],t}function R(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),0!==n&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function F(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,N(e.strm)}function D(e,t){e.pending_buf[e.pending++]=t}function O(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function V(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,l=e.strstart>e.w_size-E?e.strstart-(e.w_size-E):0,u=e.window,c=e.w_mask,h=e.prev,d=e.strstart+_,f=u[a+o-1],p=u[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(n=t)+o]===p&&u[n+o-1]===f&&u[n]===u[a]&&u[++n]===u[a+1]){a+=2,n++;do{}while(u[++a]===u[++n]&&u[++a]===u[++n]&&u[++a]===u[++n]&&u[++a]===u[++n]&&u[++a]===u[++n]&&u[++a]===u[++n]&&u[++a]===u[++n]&&u[++a]===u[++n]&&al&&0!=--i);return o<=e.lookahead?o:e.lookahead}function z(e){var t,n,r,a,l,u,c,h,d,f,p=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=p+(p-E)){for(i.arraySet(e.window,e.window,p,p,0),e.match_start-=p,e.strstart-=p,e.block_start-=p,t=n=e.hash_size;r=e.head[--t],e.head[t]=p<=r?r-p:0,--n;);for(t=n=p;r=e.prev[--t],e.prev[t]=p<=r?r-p:0,--n;);a+=p}if(0===e.strm.avail_in)break;if(u=e.strm,c=e.window,h=e.strstart+e.lookahead,f=void 0,(d=a)<(f=u.avail_in)&&(f=d),n=0===f?0:(u.avail_in-=f,i.arraySet(c,u.input,u.next_in,f,h),1===u.state.wrap?u.adler=o(u.adler,c,f,h):2===u.state.wrap&&(u.adler=s(u.adler,c,f,h)),u.next_in+=f,u.total_in+=f,f),e.lookahead+=n,e.lookahead+e.insert>=w)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<=w&&(e.ins_h=(e.ins_h<=w)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-w),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=w){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=w&&(e.ins_h=(e.ins_h<=w&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-w,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-w),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(z(e),0===e.lookahead&&t===u)return M;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,F(e,!1),0===e.strm.avail_out))return M;if(e.strstart-e.block_start>=e.w_size-E&&(F(e,!1),0===e.strm.avail_out))return M}return e.insert=0,t===c?(F(e,!0),0===e.strm.avail_out?I:T):(e.strstart>e.block_start&&(F(e,!1),e.strm.avail_out),M)})),new U(4,4,8,4,G),new U(4,5,16,8,G),new U(4,6,32,32,G),new U(4,4,16,16,H),new U(8,16,32,32,H),new U(8,16,128,128,H),new U(8,32,128,256,H),new U(32,128,258,1024,H),new U(32,258,258,4096,H)],n.deflateInit=function(e,t){return W(e,t,m,15,8,0)},n.deflateInit2=W,n.deflateReset=Y,n.deflateResetKeep=Q,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?d:(e.state.gzhead=t,h):d},n.deflate=function(e,t){var n,i,o,l;if(!e||!e.state||5>8&255),D(i,i.gzhead.time>>16&255),D(i,i.gzhead.time>>24&255),D(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),D(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(D(i,255&i.gzhead.extra.length),D(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(D(i,0),D(i,0),D(i,0),D(i,0),D(i,0),D(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),D(i,3),i.status=C);else{var f=m+(i.w_bits-8<<4)<<8;f|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(f|=32),f+=31-f%31,i.status=C,O(i,f),0!==i.strstart&&(O(i,e.adler>>>16),O(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),N(e),o=i.pending,i.pending!==i.pending_buf_size));)D(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),N(e),o=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),0===l&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),N(e),o=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),0===l&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&N(e),i.pending+2<=i.pending_buf_size&&(D(i,255&e.adler),D(i,e.adler>>8&255),e.adler=0,i.status=C)):i.status=C),0!==i.pending){if(N(e),0===e.avail_out)return i.last_flush=-1,h}else if(0===e.avail_in&&R(t)<=R(n)&&t!==c)return B(e,-5);if(666===i.status&&0!==e.avail_in)return B(e,-5);if(0!==e.avail_in||0!==i.lookahead||t!==u&&666!==i.status){var p=2===i.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(z(e),0===e.lookahead)){if(t===u)return M;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(F(e,!1),0===e.strm.avail_out))return M}return e.insert=0,t===c?(F(e,!0),0===e.strm.avail_out?I:T):e.last_lit&&(F(e,!1),0===e.strm.avail_out)?M:P}(i,t):3===i.strategy?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=_){if(z(e),e.lookahead<=_&&t===u)return M;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=w&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=w?(n=a._tr_tally(e,1,e.match_length-w),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(F(e,!1),0===e.strm.avail_out))return M}return e.insert=0,t===c?(F(e,!0),0===e.strm.avail_out?I:T):e.last_lit&&(F(e,!1),0===e.strm.avail_out)?M:P}(i,t):r[i.level].func(i,t);if(p!==I&&p!==T||(i.status=666),p===M||p===I)return 0===e.avail_out&&(i.last_flush=-1),h;if(p===P&&(1===t?a._tr_align(i):5!==t&&(a._tr_stored_block(i,0,0,!1),3===t&&(L(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),N(e),0===e.avail_out))return i.last_flush=-1,h}return t!==c?h:i.wrap<=0?1:(2===i.wrap?(D(i,255&e.adler),D(i,e.adler>>8&255),D(i,e.adler>>16&255),D(i,e.adler>>24&255),D(i,255&e.total_in),D(i,e.total_in>>8&255),D(i,e.total_in>>16&255),D(i,e.total_in>>24&255)):(O(i,e.adler>>>16),O(i,65535&e.adler)),N(e),0=n.w_size&&(0===s&&(L(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new i.Buf8(n.w_size),i.arraySet(f,t,p-n.w_size,n.w_size,0),t=f,p=n.w_size),l=e.avail_in,u=e.next_in,c=e.input,e.avail_in=p,e.next_in=0,e.input=t,z(n);n.lookahead>=w;){for(r=n.strstart,a=n.lookahead-(w-1);n.ins_h=(n.ins_h<>>=A=b>>>24,p-=A,0==(A=b>>>16&255))k[a++]=65535&b;else{if(!(16&A)){if(0==(64&A)){b=v[(65535&b)+(f&(1<>>=A,p-=A),p<15&&(f+=E[r++]<>>=A=b>>>24,p-=A,!(16&(A=b>>>16&255))){if(0==(64&A)){b=m[(65535&b)+(f&(1<>>=A,p-=A,(A=a-o)>3,f&=(1<<(p-=S<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function m(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function g(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=d,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(f),t.distcode=t.distdyn=new r.Buf32(p),t.sane=1,t.back=-1,c):h}function y(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,g(e)):h}function b(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(a=o.wsize-o.wnext)&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,z,2,0),S=A=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&A)<<8)+(A>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&A)){e.msg="unknown compression method",n.mode=30;break}if(S-=4,N=8+(15&(A>>>=4)),0===n.wbits)n.wbits=N;else if(N>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(z[0]=255&A,z[1]=A>>>8&255,n.check=a(n.check,z,2,0)),S=A=0,n.mode=3;case 3:for(;S<32;){if(0===y)break e;y--,A+=f[m++]<>>8&255,z[2]=A>>>16&255,z[3]=A>>>24&255,n.check=a(n.check,z,4,0)),S=A=0,n.mode=4;case 4:for(;S<16;){if(0===y)break e;y--,A+=f[m++]<>8),512&n.flags&&(z[0]=255&A,z[1]=A>>>8&255,n.check=a(n.check,z,2,0)),S=A=0,n.mode=5;case 5:if(1024&n.flags){for(;S<16;){if(0===y)break e;y--,A+=f[m++]<>>8&255,n.check=a(n.check,z,2,0)),S=A=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(y<(k=n.length)&&(k=y),k&&(n.head&&(N=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,f,m,k,N)),512&n.flags&&(n.check=a(n.check,f,k,m)),y-=k,m+=k,n.length-=k),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===y)break e;for(k=0;N=f[m+k++],n.head&&N&&n.length<65536&&(n.head.name+=String.fromCharCode(N)),N&&k>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;S<32;){if(0===y)break e;y--,A+=f[m++]<>>=7&S,S-=7&S,n.mode=27;break}for(;S<3;){if(0===y)break e;y--,A+=f[m++]<>>=1)){case 0:n.mode=14;break;case 1:if(_(n),n.mode=20,6!==t)break;A>>>=2,S-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}A>>>=2,S-=2;break;case 14:for(A>>>=7&S,S-=7&S;S<32;){if(0===y)break e;y--,A+=f[m++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&A,S=A=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(k=n.length){if(y>>=5,S-=5,n.ndist=1+(31&A),A>>>=5,S-=5,n.ncode=4+(15&A),A>>>=4,S-=4,286>>=3,S-=3}for(;n.have<19;)n.lens[G[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,D={bits:n.lenbits},F=s(0,n.lens,0,19,n.lencode,0,n.work,D),n.lenbits=D.bits,F){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,T=65535&V,!((P=V>>>24)<=S);){if(0===y)break e;y--,A+=f[m++]<>>=P,S-=P,n.lens[n.have++]=T;else{if(16===T){for(O=P+2;S>>=P,S-=P,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}N=n.lens[n.have-1],k=3+(3&A),A>>>=2,S-=2}else if(17===T){for(O=P+3;S>>=P)),A>>>=3,S-=3}else{for(O=P+7;S>>=P)),A>>>=7,S-=7}if(n.have+k>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;k--;)n.lens[n.have++]=N}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,D={bits:n.lenbits},F=s(l,n.lens,0,n.nlen,n.lencode,0,n.work,D),n.lenbits=D.bits,F){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,D={bits:n.distbits},F=s(u,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,D),n.distbits=D.bits,F){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=y&&258<=b){e.next_out=g,e.avail_out=b,e.next_in=m,e.avail_in=y,n.hold=A,n.bits=S,o(e,w),g=e.next_out,p=e.output,b=e.avail_out,m=e.next_in,f=e.input,y=e.avail_in,A=n.hold,S=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;I=(V=n.lencode[A&(1<>>16&255,T=65535&V,!((P=V>>>24)<=S);){if(0===y)break e;y--,A+=f[m++]<>B)])>>>16&255,T=65535&V,!(B+(P=V>>>24)<=S);){if(0===y)break e;y--,A+=f[m++]<>>=B,S-=B,n.back+=B}if(A>>>=P,S-=P,n.back+=P,n.length=T,0===I){n.mode=26;break}if(32&I){n.back=-1,n.mode=12;break}if(64&I){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&I,n.mode=22;case 22:if(n.extra){for(O=n.extra;S>>=n.extra,S-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;I=(V=n.distcode[A&(1<>>16&255,T=65535&V,!((P=V>>>24)<=S);){if(0===y)break e;y--,A+=f[m++]<>B)])>>>16&255,T=65535&V,!(B+(P=V>>>24)<=S);){if(0===y)break e;y--,A+=f[m++]<>>=B,S-=B,n.back+=B}if(A>>>=P,S-=P,n.back+=P,64&I){e.msg="invalid distance code",n.mode=30;break}n.offset=T,n.extra=15&I,n.mode=24;case 24:if(n.extra){for(O=n.extra;S>>=n.extra,S-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===b)break e;if(k=w-b,n.offset>k){if((k=n.offset-k)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}C=k>n.wnext?(k-=n.wnext,n.wsize-k):n.wnext-k,k>n.length&&(k=n.length),M=n.window}else M=p,C=g-n.offset,k=n.length;for(by?(A=D[O+h[_]],R[L+h[_]]):(A=96,0),f=1<>P)+(p-=f)]=b<<24|A<<16|S|0,0!==p;);for(f=1<>=1;if(0!==f?(B&=f-1,B+=f):B=0,_++,0==--N[w]){if(w===k)break;w=t[n+h[_]]}if(C>>7)]}function D(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function O(e,t,n){e.bi_valid>v-n?(e.bi_buf|=t<>v-e.bi_valid,e.bi_valid+=n-v):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function G(e,t,n){var r,i,a=new Array(p+1),o=0;for(r=1;r<=p;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=z(a[s]++,s))}}function H(e){var t;for(t=0;t>1;1<=n;n--)Q(e,a,n);for(i=l;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Q(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,Q(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,l=t.dyn_tree,u=t.max_code,c=t.stat_desc.static_tree,h=t.stat_desc.has_stree,d=t.stat_desc.extra_bits,v=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(a=0;a<=p;a++)e.bl_count[a]=0;for(l[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;r>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return i;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return a;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=o&&(o=s)):o=s=n+5,n+4<=o&&-1!==t?$(e,t,n,r):4===e.strategy||s===o?(O(e,2+(r?1:0),3),Y(e,E,k)):(O(e,4+(r?1:0),3),function(e,t,n,r){var i;for(O(e,t-257,5),O(e,n-1,5),O(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(M[n]+u+1)]++,e.dyn_dtree[2*F(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){O(e,2,3),V(e,g,E),function(e){16===e.bi_valid?(D(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.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(e,t,n){t.exports="function"==typeof setImmediate?setImmediate:function(){var e=[].slice.apply(arguments);e.splice(1,0,0),setTimeout.apply(null,e)}},{}]},{},[10])(10)}(jszip_min);var MXLHelper=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,null,[{key:"MXLtoIXmlElement",value:function(e){var t=new jszip_minExports;return t.loadAsync(e).then((function(e){return t.file("META-INF/container.xml").async("text")}),(function(e){throw e})).then((function(e){var n=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return t.file(n).async("text")}),(function(e){throw e})).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml"),n=new IXmlElement(t.documentElement);return Promise.resolve(n)}),(function(e){throw e})).then((function(e){return e}),(function(e){throw new Error("extractSheetFromMxl: "+e.message)}))}},{key:"MXLtoXMLstring",value:function(e){var t=new jszip_minExports;return t.loadAsync(e).then((function(e){return t.file("META-INF/container.xml").async("text")}),(function(e){throw loglevelExports.error(e),e})).then((function(e){var n=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return t.file(n).async("text")}),(function(e){throw e}))}}]),e}(),PlaybackNoteGenerator=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,[{key:"calculate",value:function(e){for(var t=new MusicPartManagerIterator(e);!t.EndReached;){var n,r=t.CurrentEnrolledTimestamp,i=_createForOfIteratorHelper(t.CurrentAudibleVoiceEntries());try{for(i.s();!(n=i.n()).done;){var a=n.value;this.handleVoiceEntry(e,a,r)}}catch(err){i.e(err)}finally{i.f()}t.moveToNext()}}},{key:"handleVoiceEntry",value:function(t,n,r){if(!n.IsGrace){var i,a=n.ParentVoice;t.PlaybackDataDict.containsKey(a)?i=t.PlaybackDataDict.getValue(a):(i=[],t.PlaybackDataDict.setValue(a,i));var o,s=_createForOfIteratorHelper(n.PlaybackEntries);try{for(s.s();!(o=s.n()).done;){var l=o.value;if(l.HasNotes){var u,c=_createForOfIteratorHelper(l.Notes);try{for(c.s();!(u=c.n()).done;){u.value.setLength()}}catch(err){c.e(err)}finally{c.f()}var h=Fraction$1.plus(r,l.TimestampShift);e.addEntrySorted(i,l,h)}}}catch(err){s.e(err)}finally{s.f()}}}}],[{key:"addEntrySorted",value:function(e,t,n){if(0===e.length)e.push({enrolledTimestamp:n,playbackEntry:t});else for(var r=e.length-1;r>=0;r--){var i=e[r];if(n.RealValue>i.enrolledTimestamp.RealValue){if(r===e.length-1){e.push({enrolledTimestamp:n,playbackEntry:t});break}e.splice(r+1,0,{enrolledTimestamp:n,playbackEntry:t});break}}}}]),e}(),ScreenViewingRegion=function(){function e(t,n,r,i){_classCallCheck2(this,e),this.psi=new BoundingBox$1(void 0),this.displaySizeInPixel=t,this.RelativeDisplaySize=n,this.RelativeDisplayPosition=r,this.WidthInUnits=i}return _createClass2(e,[{key:"UpperLeftPositionInUnits",get:function(){return this.psi.AbsolutePosition},set:function(e){this.psi.AbsolutePosition=e}},{key:"DisplaySizeInPixel",get:function(){return this.displaySizeInPixel},set:function(e){this.displaySizeInPixel=e,this.regionSizeInPixel=new SizeF2D(this.displaySizeInPixel.width*this.relativeRegionSize.width,this.displaySizeInPixel.height*this.relativeRegionSize.height),this.recalculateDependentVariables()}},{key:"RelativeDisplaySize",get:function(){return this.relativeRegionSize},set:function(e){this.relativeRegionSize=e,this.regionSizeInPixel=new SizeF2D(this.displaySizeInPixel.width*this.relativeRegionSize.width,this.displaySizeInPixel.height*this.relativeRegionSize.height),this.recalculateDependentVariables()}},{key:"RegionSizeInPixel",get:function(){return this.regionSizeInPixel}},{key:"WidthInUnits",get:function(){return this.psi.BorderRight},set:function(e){this.psi.BorderRight=e,this.recalculateDependentVariables()}},{key:"ViewRegionInUnits",get:function(){return new SizeF2D(this.psi.BorderRight,this.psi.BorderBottom)}},{key:"isVisible",value:function(e,t){var n=this.psi.collisionDetection(e);return this.psi.liesInsideBorders(e),n}},{key:"isInsideDisplayArea",value:function(e,t){return this.RelativeDisplayPosition.x<=e&&e<=this.RelativeDisplayPosition.x+this.RelativeDisplaySize.width&&this.RelativeDisplayPosition.y<=t&&t<=this.RelativeDisplayPosition.y+this.RelativeDisplaySize.height}},{key:"transformToUnitCoordinates",value:function(e){return new PointF2D(this.UpperLeftPositionInUnits.x+this.ViewRegionInUnits.width*((e.x-this.RelativeDisplayPosition.x)/this.RelativeDisplaySize.width),this.UpperLeftPositionInUnits.y+this.ViewRegionInUnits.height*((e.y-this.RelativeDisplayPosition.y)/this.RelativeDisplaySize.height))}},{key:"transformLengthXToUnitCoordinates",value:function(e){return e/this.horizontalUnitToPixelRatio}},{key:"transformLengthYToUnitCoordinates",value:function(e){return e/this.verticalUnitToPixelRatio}},{key:"recalculateDependentVariables",value:function(){var e=this.regionSizeInPixel.width/this.regionSizeInPixel.height;this.psi.BorderBottom=this.psi.BorderRight/e,this.horizontalUnitToPixelRatio=this.regionSizeInPixel.width/this.ViewRegionInUnits.width,this.verticalUnitToPixelRatio=this.regionSizeInPixel.height/this.ViewRegionInUnits.height}}],[{key:"createWithRelativeDefaults",value:function(t,n){return new e(t,new SizeF2D(1,1),new PointF2D(0,0),n)}},{key:"createWithDefaults",value:function(){return new e(new SizeF2D(1,1),new SizeF2D(1,1),new PointF2D(0,0),1)}}]),e}(),AbstractZoomView=function(){function e(t){_classCallCheck2(this,e),this.aspectRatio=1,this.zoomViews=[],this.mouseZoomMode=!1,this.autoScrollY=!0,this.displayInteractionManager=t,this.displayInteractionManager.addListener(this),this.offsetXMin=Number.MIN_VALUE,this.offsetYMin=Number.MIN_VALUE,this.rangeXMin=1,this.rangeYMin=1,this.offsetXMax=Number.MAX_VALUE,this.offsetYMax=Number.MAX_VALUE,this.rangeXMax=1e9,this.rangeYMax=1e9,this.XScrollingEnabled=!1,this.YScrollingEnabled=!0}return _createClass2(e,[{key:"positionTouched",value:function(e,t){if(this.convertToUnitsReady()){var n=this.getPositionInUnits(e,t);this.unitPosTouched(n,e,t)}}},{key:"TouchActive",get:function(){return this.displayInteractionManager.TouchActive}},{key:"TouchMoving",get:function(){return this.displayInteractionManager.TouchMoving}},{key:"positionDoubleTouched",value:function(e,t){if(this.convertToUnitsReady()){var n=this.getPositionInUnits(e,t);this.unitPosDoubleTouched(n,e,t)}}},{key:"UsesManuallyControlledZoomMode",get:function(){return this.usesManuallyControlledZoomMode},set:function(e){this.usesManuallyControlledZoomMode=e}},{key:"mouseDown",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.convertToUnitsReady()){this.selectScrollControllerY(!1),this.lastRangeX=Math.max(1,this.RangeX),this.lastRangeY=Math.max(1,this.RangeY),this.lastOffsetX=this.OffsetX,this.lastOffsetY=this.OffsetY;var r=this.getPositionInUnits(e,t);this.unitPosTouchDown(r,e,t),this.usesManuallyControlledZoomMode||(this.mouseZoomMode=!!n)}}},{key:"mouseUp",value:function(e,t){var n=this.getPositionInUnits(e,t);this.unitPosTouchUp(n,e,t)}},{key:"mouseMove",value:function(e,t,n,r){this.mouseZoomMode?(Math.abs(n-0)>1e-8&&(this.RangeX=Math.abs(this.lastRangeX/(1+n))),!this.lockRanges&&Math.abs(r-0)>1e-8&&(this.RangeY=Math.abs(this.lastRangeY/(1-r)))):(Math.abs(n-0)>1e-8&&(this.OffsetX=this.lastOffsetX-n*this.RangeX),Math.abs(r-0)>1e-8&&(this.OffsetY=this.lastOffsetY-r*this.RangeY));var i=this.getPositionInUnits(e,t);this.unitPosMove(i,e,t)}},{key:"zoom",value:function(e){this.RangeX=Math.abs(this.lastRangeX/e)}},{key:"addZoomView",value:function(e){this.zoomViews.push(e)}},{key:"OffsetX",get:function(){return this.offsetX},set:function(e){this.offsetX=Math.min(this.offsetXMax,Math.max(this.offsetXMin,e));var t,n=_createForOfIteratorHelper(this.zoomViews);try{for(n.s();!(t=n.n()).done;){t.value.viewportXChanged(this.offsetX,this.RangeX)}}catch(err){n.e(err)}finally{n.f()}}},{key:"OffsetY",get:function(){return this.offsetY},set:function(e){this.offsetY=e,this.offsetY>this.offsetYMax?this.offsetY=this.offsetYMax:this.offsetYthis.offsetYMax&&this.setYOffset(this.offsetYMax,!0)}}},{key:"horizontalViewportChanged",value:function(e,t){this.mainViewingRegion.WidthInUnits!==t&&(this.mainViewingRegion.WidthInUnits=t)}},{key:"verticalViewportChanged",value:function(e,t){this.mainViewingRegion.UpperLeftPositionInUnits=new PointF2D(this.mainViewingRegion.UpperLeftPositionInUnits.x,e)}},{key:"unlockFromCursorIfNecessary",value:function(e){!1===this.LockDisplayToCursor||this.ZoomActive||(this.displayInteractionManager.ZoomGestureActive||this.displayInteractionManager.WasZoomGestureActive||Math.abs((e.y-this.yOffsetMouseDown)*this.mainViewingRegion.RegionSizeInPixel.height/this.mainViewingRegion.ViewRegionInUnits.height)>this.unlockCursorDistancePixel&&(this.LockDisplayToCursor=!1))}},{key:"getPositionInUnits",value:function(e,t){return this.mainViewingRegion.transformToUnitCoordinates(new PointF2D(e,t))}},{key:"handleUserDisplayInteraction",value:function(e,t,n){var r=this;switch(n){case InteractionType.TouchDown:case InteractionType.SingleTouch:case InteractionType.DoubleTouch:var i=this.graphicalMusicSheet.GetNearestVoiceEntry(t);if(i){var a=new CustomEvent("note-click",{detail:_objectSpread(_objectSpread({},i),{},{setAvtivePlay:function(){if(void 0!==i.parentStaffEntry.parentVerticalContainer){var e,t,n=i.parentStaffEntry.parentVerticalContainer.AbsoluteTimestamp;if(r.setStartPosition(n),void 0!==(null===(e=i.notes[0])||void 0===e?void 0:e.sourceNote.Pitch))console.log("playback clicked note",i.parentVoiceEntry),null===(t=r.PlaybackManager)||void 0===t||t.playVoiceEntry(i.parentVoiceEntry)}}})});window.dispatchEvent(a)}case InteractionType.TouchUp:case InteractionType.TouchDown:case InteractionType.Move:var o,s=_createForOfIteratorHelper(this.listeners);try{for(s.s();!(o=s.n()).done;){o.value.userDisplayInteraction(e,t,n)}}catch(err){s.e(err)}finally{s.f()}break;default:throw new Error("type")}}},{key:"setStartPosition",value:function(e){var t;void 0!==this.graphicalMusicSheet&&(this.graphicalMusicSheet.ParentMusicSheet.SelectionStart=e,null===(t=this.PlaybackManager)||void 0===t||t.reset())}},{key:"GraphicalMusicSheet",get:function(){return this.graphicalMusicSheet}}]),n}(AbstractZoomView),WebSheetRenderingManager=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(){return _classCallCheck2(this,n),t.apply(this,arguments)}return _createClass2(n,[{key:"mouseMove",value:function(e,t,n,r){var i=this.getPositionInUnits(e,t);this.unitPosMove(i,e,t)}}]),n}(SheetRenderingManager),AbstractDisplayInteractionManager=function(){function e(){_classCallCheck2(this,e),this.listeners=[],this.zoomGestureActive=!1,this.touchCount=0,this.touchActive=!1,this.touchMoving=!1,this.displayWidth=1,this.displayHeight=1,this.displayDpi=96,this.maxNumerOfFingers=2,this.movementThreshInch=.075,this.interactionWasZoomGesture=!1}return _createClass2(e,[{key:"addListener",value:function(e){this.listeners.push(e)}},{key:"ZoomGestureActive",get:function(){return this.zoomGestureActive}},{key:"WasZoomGestureActive",get:function(){return this.interactionWasZoomGesture}},{key:"displaySizeChanged",value:function(e,t){this.displayWidth=e,this.displayHeight=t;var n,r=_createForOfIteratorHelper(this.listeners);try{for(r.s();!(n=r.n()).done;){n.value.displaySizeChanged(this.displayWidth,this.displayHeight)}}catch(err){r.e(err)}finally{r.f()}}},{key:"Dispose",value:function(){this.dispose()}},{key:"Initialize",value:function(){this.initialize()}},{key:"DisplayDpi",get:function(){return this.displayDpi}},{key:"TouchActive",get:function(){return this.touchActive}},{key:"TouchMoving",get:function(){return this.touchMoving}},{key:"touchDown",value:function(e,t,n){this.interactionWasZoomGesture=!1;var r=e/this.displayWidth,i=t/this.displayHeight;this.lastRelPosX=r,this.lastRelPosY=i,this.lastPixelX=e,this.lastPixelY=t,this.touchActive=!0,this.touchMoving=!1,this.touchCount=Math.min(this.touchCount+1,this.maxNumerOfFingers);var a,o=_createForOfIteratorHelper(this.listeners);try{for(o.s();!(a=o.n()).done;){a.value.mouseDown(r,i,!n)}}catch(err){o.e(err)}finally{o.f()}}},{key:"move",value:function(e,t){if(this.touchActive&&!this.zoomGestureActive){var n=e/this.displayWidth,r=t/this.displayHeight,i=n-this.lastRelPosX,a=r-this.lastRelPosY;this.touchMoving=!0;var o,s=_createForOfIteratorHelper(this.listeners);try{for(s.s();!(o=s.n()).done;){o.value.mouseMove(n,r,i,a)}}catch(err){s.e(err)}finally{s.f()}}}},{key:"zoomGestureStarted",value:function(){this.zoomGestureActive=!0}},{key:"zoomGestureCompleted",value:function(){this.zoomGestureActive=!1,this.interactionWasZoomGesture=!0}},{key:"zoomGestureMove",value:function(e){this.zoomGestureActive&&this.listeners.forEach((function(t){t.zoom(e)}))}},{key:"touchUp",value:function(e,t){this.touchActive=!1,this.touchMoving=!1,this.touchCount=Math.max(0,this.touchCount-1);var n,r=e/this.displayWidth,i=t/this.displayHeight,a=_createForOfIteratorHelper(this.listeners);try{for(a.s();!(n=a.n()).done;){n.value.mouseUp(r,i)}}catch(err){a.e(err)}finally{a.f()}}},{key:"click",value:function(e,t){if(!this.mouseDidMove(this.lastPixelX,e,this.lastPixelY,t)&&!this.ZoomGestureActive){var n,r=e/this.displayWidth,i=t/this.displayHeight,a=_createForOfIteratorHelper(this.listeners);try{for(a.s();!(n=a.n()).done;){n.value.positionTouched(r,i)}}catch(err){a.e(err)}finally{a.f()}}}},{key:"doubleClick",value:function(e,t){if(!this.mouseDidMove(this.lastPixelX,e,this.lastPixelY,t)&&!this.ZoomGestureActive){var n,r=e/this.displayWidth,i=t/this.displayHeight,a=_createForOfIteratorHelper(this.listeners);try{for(a.s();!(n=a.n()).done;){n.value.positionDoubleTouched(r,i)}}catch(err){a.e(err)}finally{a.f()}}}},{key:"mouseDidMove",value:function(e,t,n,r){var i=Math.abs(e-t)/this.displayDpi,a=Math.abs(n-r)/this.displayDpi;return i>this.movementThreshInch||a>this.movementThreshInch}}]),e}(),WebDisplayInteractionManager=function(e){_inherits2(n,e);var t=_createSuper2(n);function n(e){var r;return _classCallCheck2(this,n),(r=t.call(this)).fullOffsetLeft=0,r.fullOffsetTop=0,r.fullScrollTop=0,r.fullScrollLeft=0,r.parentScrollMap=new Map,r.scrollCallbackMap=new Map,r.timeout=void 0,r.resizeObserver=void 0,r.EventCallbackMap=new Dictionary,r.DOUBLE_CLICK_WINDOW=200,r.lastClick=0,r.osmdSheetMusicContainer=e,r.listenForInteractions(),r}return _createClass2(n,[{key:"FullOffsetTop",get:function(){return this.fullOffsetTop}},{key:"FullScrollTop",get:function(){return this.fullScrollTop}},{key:"FullOffsetLeft",get:function(){return this.fullOffsetLeft}},{key:"FullScrollLeft",get:function(){return this.fullScrollLeft}},{key:"registerScrollOffsets",value:function(){var e=this.osmdSheetMusicContainer;this.fullScrollTop=0,this.fullScrollLeft=0;for(var t=this;e&&e!==document.documentElement;){if(this.parentScrollMap.set(e,[e.scrollTop,e.scrollLeft]),this.fullScrollLeft+=e.scrollLeft,this.fullScrollTop+=e.scrollTop,e.scrollHeight>e.clientHeight){var n=function(e){var n=t.parentScrollMap.get(this),r=n[0],i=n[1];t.fullScrollTop=t.fullScrollTop-r+this.scrollTop,t.fullScrollLeft=t.fullScrollLeft-i+this.scrollLeft,t.parentScrollMap.set(this,[this.scrollTop,this.scrollLeft])};this.scrollCallbackMap.set(e,n),e.addEventListener("scroll",n)}e=e.parentElement}}},{key:"deregisterScrollOffsets",value:function(){var e,t=_createForOfIteratorHelper(this.scrollCallbackMap.keys());try{for(t.s();!(e=t.n()).done;){var n=e.value;n.removeEventListener("scroll",this.scrollCallbackMap.get(n))}}catch(err){t.e(err)}finally{t.f()}this.scrollCallbackMap.clear()}},{key:"initialize",value:function(){this.fullOffsetLeft=0,this.fullOffsetTop=0;var e=this.osmdSheetMusicContainer,t=[],r=this;for(window.ResizeObserver&&(this.resizeObserver=new ResizeObserver((function(e){n.resizeCallback(e,r)})));e;)this.fullOffsetLeft+=e.offsetLeft,this.fullOffsetTop+=e.offsetTop,this.resizeObserver?this.resizeObserver.observe(e):t.push(e),e=e.offsetParent;if(this.resizeObserver)this.disposeResizeListener=function(){r.resizeObserver.disconnect(),r.resizeObserver=void 0};else{var i=function(){n.resizeCallback(t,r)};window.addEventListener("resize",i),this.disposeResizeListener=function(){window.removeEventListener("resize",i),i=void 0}}r.registerScrollOffsets()}},{key:"dispose",value:function(){this.disposeResizeListener();var e,t=_createForOfIteratorHelper(this.EventCallbackMap.keys());try{for(t.s();!(e=t.n()).done;){var n=e.value,r=this.EventCallbackMap.getValue(n);r[0].removeEventListener(n,r[1])}}catch(err){t.e(err)}finally{t.f()}this.EventCallbackMap.clear(),this.deregisterScrollOffsets(),this.scrollCallbackMap.clear(),this.parentScrollMap.clear()}},{key:"isTouch",value:function(){if("ontouchstart"in window||window.DocumentTouch)return!0;if(!window.matchMedia)return!1;var e=["(",["-webkit-","-moz-","-o-","-ms-"].join("touch-enabled),("),"heartz",")"].join("");return window.matchMedia(e).matches}},{key:"downEventName",get:function(){return this.isTouch()?"touchstart":"mousedown"}},{key:"moveEventName",get:function(){return this.isTouch()?"touchmove":"mousemove"}},{key:"listenForInteractions",value:function(){var e=this.downEventListener.bind(this),t=this.touchEndEventListener.bind(this),n=this.moveEventListener.bind(this);this.osmdSheetMusicContainer.addEventListener("mousedown",e),this.osmdSheetMusicContainer.addEventListener("touchend",t),document.addEventListener(this.moveEventName,n),this.EventCallbackMap.setValue("mousedown",[this.osmdSheetMusicContainer,e]),this.EventCallbackMap.setValue("touchend",[this.osmdSheetMusicContainer,t]),this.EventCallbackMap.setValue(this.moveEventName,[document,n])}},{key:"downEventListener",value:function(e){var t=(new Date).getTime(),n=t-this.lastClick;clearTimeout(this.clickTimeout);var r=0,i=0;this.isTouch()&&e instanceof TouchEvent?(r=e.touches[0].pageX,i=e.touches[0].pageY):e instanceof MouseEvent&&(r=e.pageX,i=e.pageY);var a=this.getOffsetCoordinates(r,i);if(n0)this.doubleClick(a.x,a.y);else{var o=this;this.clickTimeout=setTimeout((function(){clearTimeout(this.clickTimeout),o.isTouch()?o.touchDown(a.x,a.y,void 0):o.click(a.x,a.y)}),this.DOUBLE_CLICK_WINDOW)}this.lastClick=t}},{key:"moveEventListener",value:function(e){var t=0,n=0;if(this.isTouch()&&e instanceof TouchEvent){var r,i,a=void 0;e.touches&&e.touches.length>0?a=e.touches[0]:e.changedTouches&&e.changedTouches.length>0&&(a=e.changedTouches[0]),t=null===(r=a)||void 0===r?void 0:r.clientX,n=null===(i=a)||void 0===i?void 0:i.clientY}else e instanceof MouseEvent&&(t=e.clientX,n=e.clientY);var o=this.getOffsetCoordinates(t,n);this.move(o.x,o.y)}},{key:"touchEndEventListener",value:function(e){var t,n,r=void 0;e.touches&&e.touches.length>0?r=e.touches[0]:e.changedTouches&&e.changedTouches.length>0&&(r=e.changedTouches[0]);var i=this.getOffsetCoordinates(null===(t=r)||void 0===t?void 0:t.pageX,null===(n=r)||void 0===n?void 0:n.pageY);this.touchUp(i.x,i.y)}},{key:"resizeEventListener",value:function(){this.displaySizeChanged(this.osmdSheetMusicContainer.clientWidth,this.osmdSheetMusicContainer.clientHeight)}},{key:"getOffsetCoordinates",value:function(e,t){var n=e-this.fullOffsetLeft+this.fullScrollLeft,r=t-this.fullOffsetTop+this.fullScrollTop;return new PointF2D(n,r)}}],[{key:"resizeCallback",value:function(e,t){clearTimeout(t.timeout),t.timeout=setTimeout((function(){t.fullOffsetLeft=0,t.fullOffsetTop=0;for(var e=t.osmdSheetMusicContainer;e;)t.fullOffsetLeft+=e.offsetLeft,t.fullOffsetTop+=e.offsetTop,e=e.offsetParent;t.resizeEventListener(),t.deregisterScrollOffsets(),t.registerScrollOffsets()}),500)}}]),n}(AbstractDisplayInteractionManager),DynamicsCalculator=function(){function e(){_classCallCheck2(this,e)}return _createClass2(e,[{key:"calculate",value:function(t){e.fillDynamicExpressions(t)}}],[{key:"fillDynamicsList",value:function(e,t,n){for(var r=0;r=0&&n[u].push(new DynamicsContainer(o.InstantaneousDynamic,u))}if(void 0!==o.StartingContinuousDynamic){n[r].push(new DynamicsContainer(o.StartingContinuousDynamic,o.StaffNumber));var c=this.getOtherStaffIndexIfLinkedStavesAreDetected(e,r,o.StartingContinuousDynamic.Placement);c>=0&&n[c].push(new DynamicsContainer(o.StartingContinuousDynamic,c))}}}}},{key:"getOtherStaffIndexIfLinkedStavesAreDetected",value:function(e,t,n){var r=e.getStaffFromIndex(t),i=r.ParentInstrument.Staves.indexOf(r),a=r.ParentInstrument.Staves.length;return a>1&&0===i&&n===PlacementEnum.Below?t+1:a>1&&1===i&&n===PlacementEnum.Above?t-1:-1}},{key:"fillDynamicExpressions",value:function(t){for(var n=t.DynListStaves,r=t.getCompleteNumberOfStaves(),i=t.TimestampSortedDynamicExpressionsList,a=0;a1&&void 0!==arguments[1]?arguments[1]:OSMDOptions.OSMDOptionsStandard(),r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new EngravingRules;if(_classCallCheck2(this,e),this.version="1.4.5-audio-extended",this.cursorsOptions=[],this.cursors=[],this.zoom=1,this.zoomUpdated=!1,this.loadUrlTimeout=5e3,this.rules=r,"string"==typeof t?this.container=document.getElementById(t):t&&"appendChild"in t&&(this.container=t),!this.container)throw new Error("Please pass a valid div container to OpenSheetMusicDisplay");void 0===n.autoResize&&(n.autoResize=!0),this.backendType=BackendType.SVG,this.setOptions(n),this.interactionManager=new WebDisplayInteractionManager(this.container),this.renderingManager=new WebSheetRenderingManager(this.interactionManager,this.rules)}return _createClass2(e,[{key:"cursor",get:function(){return this.cursors[0]}},{key:"RenderingManager",get:function(){return this.renderingManager}},{key:"PlaybackManager",get:function(){var e;return null===(e=this.renderingManager)||void 0===e?void 0:e.PlaybackManager},set:function(e){this.renderingManager&&(this.renderingManager.PlaybackManager=e)}},{key:"isUrl",value:function(e){return e.length<2083}},{key:"isMxl",value:function(e){return"PK"===e.substr(0,4)}},{key:"processMxl",value:function(e,t,n){var r=this;MXLHelper.MXLtoXMLstring(e).then((function(e){t(r.processStringXml(e))}),(function(e){loglevelExports.error(new Error("[OSMD] Invalid MXL file: "+e)),n(new Error("[OSMD] Invalid MXL file: "+e))}))}},{key:"processStringXml",value:function(e){var t=new DOMParser;if(""===e.substr(0,3))return loglevelExports.debug("[OSMD] UTF with BOM detected, truncate first three bytes and pass along: "+e),t.parseFromString(e.substr(3),"application/xml");if(e.substr(0,6).includes("this.rules.MaxPageToDrawNumber)break;var o=this.createBackend(this.backendType,a),s=" exceeds CanvasBackend limit of 32767. Cutting off score.";o.getOSMDBackendType()===BackendType.Canvas&&t>r&&(loglevelExports.warn("[OSMD] Warning: width of "+t+s),t=r),this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?e=t/this.rules.PageFormat.aspectRatio:(e=a.PositionAndShape.Size.height,e+=this.rules.PageBottomMargin,e+=this.rules.CompactMode?this.rules.PageTopMarginNarrow:this.rules.PageTopMargin,this.rules.RenderTitle&&(e+=this.rules.TitleTopDistance),e*=10*this.zoom),o.getOSMDBackendType()===BackendType.Canvas&&e>r&&(loglevelExports.warn("[OSMD] Warning: height of "+e+s),e=Math.min(e,r)),o.resize(t,e),o.clear(),this.drawer.Backends.push(o),this.graphic.drawer=this.drawer}}catch(err){i.e(err)}finally{i.f()}}},{key:"exportSVG",value:function(){var e,t,n=_createForOfIteratorHelper(null===(e=this.drawer)||void 0===e?void 0:e.Backends);try{for(n.s();!(t=n.n()).done;){var r=t.value;r instanceof SvgVexFlowBackend&&r.export()}}catch(err){n.e(err)}finally{n.f()}}},{key:"IsReadyToRender",value:function(){return void 0!==this.graphic}},{key:"clear",value:function(){var e;null===(e=this.drawer)||void 0===e||e.clear(),this.reset()}},{key:"dispose",value:function(){this.disposeResizeListener&&this.disposeResizeListener(),this.InteractionManager&&this.InteractionManager.Dispose()}},{key:"setOptions",value:function(e){if(this.rules||(this.rules=new EngravingRules),this.drawingParameters||(this.drawingParameters=new DrawingParameters,this.drawingParameters.Rules=this.rules),null!=e){this.OnXMLRead=function(e){return e},e.onXMLRead&&(this.OnXMLRead=e.onXMLRead),e.drawingParameters&&(this.drawingParameters.DrawingParametersEnum=DrawingParametersEnum[e.drawingParameters.toLowerCase()]);var t=!this.drawer||!this.drawer.Backends||this.drawer.Backends.length<1;if(void 0!==e.backend){var n=OSMDOptions.BackendTypeFromString(e.backend);t=t||this.backendType!==n,this.backendType=n}this.needBackendUpdate=t,void 0!==e.autoBeam&&(this.rules.AutoBeamNotes=e.autoBeam);var r=e.autoBeamOptions;if(r&&(void 0===r.maintain_stem_directions&&(r.maintain_stem_directions=!1),this.rules.AutoBeamOptions=r,r.groups&&r.groups.length)){var i,a=_createForOfIteratorHelper(r.groups);try{for(a.s();!(i=a.n()).done;){if(2!==i.value.length)throw new Error("Each fraction in autoBeamOptions.groups must be of length 2, e.g. [3,4] for beaming three fourths")}}catch(err){a.e(err)}finally{a.f()}}void 0!==e.percussionOneLineCutoff&&(this.rules.PercussionOneLineCutoff=e.percussionOneLineCutoff),0!==this.rules.PercussionOneLineCutoff&&void 0!==e.percussionForceVoicesOneLineCutoff&&(this.rules.PercussionForceVoicesOneLineCutoff=e.percussionForceVoicesOneLineCutoff),void 0!==e.alignRests&&(this.rules.AlignRests=e.alignRests),void 0!==e.coloringMode&&this.setColoringMode(e),void 0!==e.coloringEnabled&&(this.rules.ColoringEnabled=e.coloringEnabled),void 0!==e.colorStemsLikeNoteheads&&(this.rules.ColorStemsLikeNoteheads=e.colorStemsLikeNoteheads),e.disableCursor&&(this.drawingParameters.drawCursors=!1),e.drawHiddenNotes&&(this.drawingParameters.drawHiddenNotes=!0),void 0!==e.drawCredits&&(this.drawingParameters.DrawCredits=e.drawCredits),void 0!==e.drawComposer&&(this.drawingParameters.DrawComposer=e.drawComposer),void 0!==e.drawTitle&&(this.drawingParameters.DrawTitle=e.drawTitle),void 0!==e.drawSubtitle&&(this.drawingParameters.DrawSubtitle=e.drawSubtitle),void 0!==e.drawLyricist&&(this.drawingParameters.DrawLyricist=e.drawLyricist),void 0!==e.drawMetronomeMarks&&(this.rules.MetronomeMarksDrawn=e.drawMetronomeMarks),void 0!==e.drawPartNames&&(this.drawingParameters.DrawPartNames=e.drawPartNames,e.drawPartAbbreviations||(this.rules.RenderPartAbbreviations=e.drawPartNames)),void 0!==e.drawPartAbbreviations&&(this.rules.RenderPartAbbreviations=e.drawPartAbbreviations),!1===e.drawFingerings&&(this.rules.RenderFingerings=!1),void 0!==e.drawMeasureNumbers&&(this.rules.RenderMeasureNumbers=e.drawMeasureNumbers),e.drawMeasureNumbersOnlyAtSystemStart&&(this.rules.RenderMeasureNumbersOnlyAtSystemStart=e.drawMeasureNumbersOnlyAtSystemStart),void 0!==e.drawLyrics&&(this.rules.RenderLyrics=e.drawLyrics),void 0!==e.drawTimeSignatures&&(this.rules.RenderTimeSignatures=e.drawTimeSignatures),void 0!==e.drawSlurs&&(this.rules.RenderSlurs=e.drawSlurs),void 0!==e.measureNumberInterval&&(this.rules.MeasureNumberLabelOffset=e.measureNumberInterval),void 0!==e.useXMLMeasureNumbers&&(this.rules.UseXMLMeasureNumbers=e.useXMLMeasureNumbers),void 0!==e.fingeringPosition&&(this.rules.FingeringPosition=AbstractExpression.PlacementEnumFromString(e.fingeringPosition)),void 0!==e.fingeringInsideStafflines&&(this.rules.FingeringInsideStafflines=e.fingeringInsideStafflines),void 0!==e.newSystemFromXML&&(this.rules.NewSystemAtXMLNewSystemAttribute=e.newSystemFromXML),void 0!==e.newPageFromXML&&(this.rules.NewPageAtXMLNewPageAttribute=e.newPageFromXML),void 0!==e.fillEmptyMeasuresWithWholeRest&&(this.rules.FillEmptyMeasuresWithWholeRest=e.fillEmptyMeasuresWithWholeRest),void 0!==e.followCursor&&(this.FollowCursor=e.followCursor),void 0!==e.setWantedStemDirectionByXml&&(this.rules.SetWantedStemDirectionByXml=e.setWantedStemDirectionByXml),e.darkMode?(this.rules.applyDefaultColorMusic("#FFFFFF"),this.rules.PageBackgroundColor="#000000"):!1===e.darkMode&&(this.rules.applyDefaultColorMusic("#000000"),this.rules.PageBackgroundColor=void 0),e.defaultColorMusic&&this.rules.applyDefaultColorMusic(e.defaultColorMusic),e.defaultColorNotehead&&(this.rules.DefaultColorNotehead=e.defaultColorNotehead),e.defaultColorRest&&(this.rules.DefaultColorRest=e.defaultColorRest),e.defaultColorStem&&(this.rules.DefaultColorStem=e.defaultColorStem),e.defaultColorLabel&&(this.rules.DefaultColorLabel=e.defaultColorLabel),e.defaultColorTitle&&(this.rules.DefaultColorTitle=e.defaultColorTitle),e.defaultFontFamily&&(this.rules.DefaultFontFamily=e.defaultFontFamily),e.defaultFontStyle&&(this.rules.DefaultFontStyle=e.defaultFontStyle),e.drawUpToMeasureNumber&&(this.rules.MaxMeasureToDrawIndex=e.drawUpToMeasureNumber-1),e.drawFromMeasureNumber&&(this.rules.MinMeasureToDrawIndex=e.drawFromMeasureNumber-1),e.drawUpToPageNumber&&(this.rules.MaxPageToDrawNumber=e.drawUpToPageNumber),e.drawUpToSystemNumber&&(this.rules.MaxSystemToDrawNumber=e.drawUpToSystemNumber),e.tupletsRatioed&&(this.rules.TupletsRatioed=!0),e.tupletsBracketed&&(this.rules.TupletsBracketed=!0),e.tripletsBracketed&&(this.rules.TripletsBracketed=!0),e.autoResize?(this.resizeHandlerAttached||this.autoResize(),this.autoResizeEnabled=!0):!1===e.autoResize&&(this.autoResizeEnabled=!1),void 0!==e.pageFormat&&this.setPageFormat(e.pageFormat),void 0!==e.pageBackgroundColor&&(this.rules.PageBackgroundColor=e.pageBackgroundColor),void 0!==e.performanceMode&&(this.rules.PerformanceMode=e.performanceMode),void 0!==e.renderSingleHorizontalStaffline&&(this.rules.RenderSingleHorizontalStaffline=e.renderSingleHorizontalStaffline),void 0!==e.spacingFactorSoftmax&&(this.rules.SoftmaxFactorVexFlow=e.spacingFactorSoftmax),void 0!==e.spacingBetweenTextLines&&(this.rules.SpacingBetweenTextLines=e.spacingBetweenTextLines),void 0!==e.stretchLastSystemLine&&(this.rules.StretchLastSystemLine=e.stretchLastSystemLine),void 0!==e.autoGenerateMutipleRestMeasuresFromRestMeasures&&(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures=e.autoGenerateMutipleRestMeasuresFromRestMeasures),void 0!==e.cursorsOptions?this.cursorsOptions=e.cursorsOptions:this.cursorsOptions=[{type:0,color:this.EngravingRules.DefaultColorCursor,alpha:.5,follow:!0}]}else loglevelExports.warn("warning: osmd.setOptions() called without an options parameter, has no effect.\nexample usage: osmd.setOptions({drawCredits: false, drawPartNames: false})")}},{key:"setColoringMode",value:function(e){if(e.coloringMode!==ColoringModes.XML){var t,n=[NoteEnum.C,NoteEnum.D,NoteEnum.E,NoteEnum.F,NoteEnum.G,NoteEnum.A,NoteEnum.B,-1];if(e.coloringMode===ColoringModes.CustomColorSet){if(!e.coloringSetCustom||8!==e.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).");var r,i=_createForOfIteratorHelper(e.coloringSetCustom);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(!/^\#[0-9a-fA-F]{6}$/.test(a))throw new Error("One of the color strings in options.coloringSetCustom was not a valid HTML Hex color:\n"+a)}}catch(err){i.e(err)}finally{i.f()}t=e.coloringSetCustom}else if(e.coloringMode===ColoringModes.AutoColoring){t=[];for(var o=Object.keys(AutoColorSet),s=0;s0&&t>0){var n=new PageFormat(e,t);this.rules.PageFormat=n}}},{key:"DrawSkyLine",get:function(){return this.drawer.skyLineVisible},set:function(e){this.drawSkyLine=e,this.drawer&&(this.drawer.skyLineVisible=e)}},{key:"DrawBottomLine",get:function(){return this.drawer.bottomLineVisible},set:function(e){this.drawBottomLine=e,this.drawer&&(this.drawer.bottomLineVisible=e)}},{key:"DrawBoundingBox",get:function(){return this.drawBoundingBox},set:function(e){this.setDrawBoundingBox(e,!0)}},{key:"setDrawBoundingBox",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.drawBoundingBox=e,this.drawer&&(this.drawer.drawableBoundingBoxElement=e),t&&this.render()}},{key:"AutoResizeEnabled",get:function(){return this.autoResizeEnabled},set:function(e){this.autoResizeEnabled=e}},{key:"Zoom",get:function(){return this.zoom},set:function(e){var t;this.zoom=e,this.zoomUpdated=!0,(null===(t=this.graphic)||void 0===t?void 0:t.GetCalculator)instanceof VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=this.zoomUpdated)}},{key:"FollowCursor",get:function(){return this.followCursor},set:function(e){this.followCursor=e}},{key:"TransposeCalculator",get:function(){return MusicSheetCalculator.transposeCalculator},set:function(e){MusicSheetCalculator.transposeCalculator=e}},{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:"InteractionManager",get:function(){return this.interactionManager}},{key:"Version",get:function(){return this.version}}],[{key:"StringToPageFormat",value:function(t){var n=PageFormat.UndefinedPageFormat;if(t.match("^[0-9]+x[0-9]+$")){var r=t.split("x"),i=Number.parseInt(r[0],10),a=Number.parseInt(r[1],10);i>0&&i<32768&&a>0&&a<32768&&(n=new PageFormat(i,a,"customPageFormat".concat(t)))}return t=(t=(t=t.replace(" ","_")).replace("Landscape","L")).replace("Portrait","P"),e.PageFormatStandards.hasOwnProperty(t)?n=e.PageFormatStandards[t]:n}}]),e}(),OpenSheetMusicDisplay=_OpenSheetMusicDisplay;OpenSheetMusicDisplay.PageFormatStandards={A3_L:new PageFormat(420,297,"A3_L"),A3_P:new PageFormat(297,420,"A3_P"),A4_L:new PageFormat(297,210,"A4_L"),A4_P:new PageFormat(210,297,"A4_P"),A5_L:new PageFormat(210,148,"A5_L"),A5_P:new PageFormat(148,210,"A5_P"),A6_L:new PageFormat(148,105,"A6_L"),A6_P:new PageFormat(105,148,"A6_P"),Endless:PageFormat.UndefinedPageFormat,Letter_L:new PageFormat(279.4,215.9,"Letter_L"),Letter_P:new PageFormat(215.9,279.4,"Letter_P")};var handlebarsExports={},handlebars={get exports(){return handlebarsExports},set exports(e){handlebarsExports=e}},handlebars_runtimeExports={},handlebars_runtime={get exports(){return handlebars_runtimeExports},set exports(e){handlebars_runtimeExports=e}},base$1={},utils={__esModule:!0};utils.extend=extend,utils.indexOf=indexOf,utils.escapeExpression=escapeExpression,utils.isEmpty=isEmpty,utils.createFrame=createFrame,utils.blockParams=blockParams,utils.appendContextPath=appendContextPath;var escape$1={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},badChars=/[&<>"'`=]/g,possible=/[&<>"'`=]/;function escapeChar(e){return escape$1[e]}function extend(e){for(var t=1;t0?(r.ids&&(r.ids=[r.name]),e.helpers.each(t,r)):i(this);if(r.data&&r.ids){var o=n.createFrame(r.data);o.contextPath=n.appendContextPath(r.data.contextPath,r.name),r={data:o}}return a(t,r)}))},e.exports=t.default}(blockHelperMissing,blockHelperMissingExports);var eachExports={},each={get exports(){return eachExports},set exports(e){eachExports=e}};!function(e,t){t.__esModule=!0;var n,r=utils,i=(n=exceptionExports)&&n.__esModule?n:{default:n};t.default=function(e){e.registerHelper("each",(function(e,t){if(!t)throw new i.default("Must pass iterator to #each");var n,a=t.fn,o=t.inverse,s=0,l="",u=void 0,c=void 0;function h(t,n,i){u&&(u.key=t,u.index=n,u.first=0===n,u.last=!!i,c&&(u.contextPath=c+t)),l+=a(e[t],{data:u,blockParams:r.blockParams([e[t],t],[c+t,null])})}if(t.data&&t.ids&&(c=r.appendContextPath(t.data.contextPath,t.ids[0])+"."),r.isFunction(e)&&(e=e.call(this)),t.data&&(u=r.createFrame(t.data)),e&&"object"===_typeof2(e))if(r.isArray(e))for(var d=e.length;s=0?t:parseInt(e,10)}return e},log:function(e){if(e=r.lookupLevel(e),"undefined"!=typeof console&&r.lookupLevel(r.level)<=e){var t=r.methodMap[e];console[t]||(t="log");for(var n=arguments.length,i=Array(n>1?n-1:0),a=1;a= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};base$1.REVISION_CHANGES=REVISION_CHANGES;var objectType="[object Object]";function HandlebarsEnvironment(e,t,n){this.helpers=e||{},this.partials=t||{},this.decorators=n||{},_helpers$2.registerDefaultHelpers(this),_decorators.registerDefaultDecorators(this)}HandlebarsEnvironment.prototype={constructor:HandlebarsEnvironment,logger:_logger2.default,log:_logger2.default.log,registerHelper:function(e,t){if(_utils$3.toString.call(e)===objectType){if(t)throw new _exception2$3.default("Arg not supported with multiple helpers");_utils$3.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if(_utils$3.toString.call(e)===objectType)_utils$3.extend(this.partials,e);else{if(void 0===t)throw new _exception2$3.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if(_utils$3.toString.call(e)===objectType){if(t)throw new _exception2$3.default("Arg not supported with multiple decorators");_utils$3.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]},resetLoggedPropertyAccesses:function(){_internalProtoAccess$1.resetLoggedProperties()}};var log=_logger2.default.log;base$1.log=log,base$1.createFrame=_utils$3.createFrame,base$1.logger=_logger2.default;var safeStringExports={},safeString={get exports(){return safeStringExports},set exports(e){safeStringExports=e}};!function(e,t){function n(e){this.string=e}t.__esModule=!0,n.prototype.toString=n.prototype.toHTML=function(){return""+this.string},t.default=n,e.exports=t.default}(safeString,safeStringExports);var runtime={},wrapHelper$1={};function wrapHelper(e,t){if("function"!=typeof e)return e;return function(){return arguments[arguments.length-1]=t(arguments[arguments.length-1]),e.apply(this,arguments)}}function _interopRequireDefault$3(e){return e&&e.__esModule?e:{default:e}}function _interopRequireWildcard$1(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}wrapHelper$1.__esModule=!0,wrapHelper$1.wrapHelper=wrapHelper,runtime.__esModule=!0,runtime.checkRevision=checkRevision,runtime.template=template,runtime.wrapProgram=wrapProgram,runtime.resolvePartial=resolvePartial,runtime.invokePartial=invokePartial,runtime.noop=noop;var _utils$2=utils,Utils=_interopRequireWildcard$1(_utils$2),_exception$2=exceptionExports,_exception2$2=_interopRequireDefault$3(_exception$2),_base=base$1,_helpers$1=helpers$1,_internalWrapHelper=wrapHelper$1,_internalProtoAccess=protoAccess;function checkRevision(e){var t=e&&e[0]||1,n=_base.COMPILER_REVISION;if(!(t>=_base.LAST_COMPATIBLE_COMPILER_REVISION&&t<=_base.COMPILER_REVISION)){if(t<_base.LAST_COMPATIBLE_COMPILER_REVISION){var r=_base.REVISION_CHANGES[n],i=_base.REVISION_CHANGES[t];throw new _exception2$2.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+i+").")}throw new _exception2$2.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")}}function template(e,t){if(!t)throw new _exception2$2.default("No environment passed to template");if(!e||!e.main)throw new _exception2$2.default("Unknown template object: "+_typeof2(e));e.main.decorator=e.main_d,t.VM.checkRevision(e.compiler);var n=e.compiler&&7===e.compiler[0];var r={strict:function(e,t,n){if(!e||!(t in e))throw new _exception2$2.default('"'+t+'" not defined in '+e,{loc:n});return r.lookupProperty(e,t)},lookupProperty:function(e,t){var n=e[t];return null==n||Object.prototype.hasOwnProperty.call(e,t)||_internalProtoAccess.resultIsAllowed(n,r.protoAccessControl,t)?n:void 0},lookup:function(e,t){for(var n=e.length,i=0;i2&&b.push("'"+this.terminals_[m]+"'");S=this.lexer.showPosition?"Parse error on line "+(s+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+b.join(", ")+", got '"+(this.terminals_[d]||d)+"'":"Parse error on line "+(s+1)+": Unexpected "+(1==d?"end of input":"'"+(this.terminals_[d]||d)+"'"),this.parseError(S,{text:this.lexer.match,token:this.terminals_[d]||d,line:this.lexer.yylineno,loc:u,expected:b})}if(p[0]instanceof Array&&p.length>1)throw new Error("Parse Error: multiple actions possible at state: "+f+", token: "+d);switch(p[0]){case 1:n.push(d),r.push(this.lexer.yytext),i.push(this.lexer.yylloc),n.push(p[1]),d=null,l=this.lexer.yyleng,o=this.lexer.yytext,s=this.lexer.yylineno,u=this.lexer.yylloc;break;case 2:if(g=this.productions_[p[1]][1],A.$=r[r.length-g],A._$={first_line:i[i.length-(g||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(g||1)].first_column,last_column:i[i.length-1].last_column},c&&(A._$.range=[i[i.length-(g||1)].range[0],i[i.length-1].range[1]]),void 0!==(v=this.performAction.call(A,o,l,s,this.yy,p[1],r,i)))return v;g&&(n=n.slice(0,-1*g*2),r=r.slice(0,-1*g),i=i.slice(0,-1*g)),n.push(this.productions_[p[1]][0]),r.push(A.$),i.push(A._$),y=a[n[n.length-2]][n[n.length-1]],n.push(y);break;case 3:return!0}}return!0}},t=function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t-1),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this},more:function(){return this._more=!0,this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;var e,t,n,r,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var a=this._currentRules(),o=0;ot[0].length)||(t=n,r=o,this.options.flex));o++);return t?((i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,a[r],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return void 0!==e?e:this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)},options:{},performAction:function(e,t,n,r){function i(e,n){return t.yytext=t.yytext.substring(e,t.yyleng-n+e)}switch(n){case 0:if("\\\\"===t.yytext.slice(-2)?(i(0,1),this.begin("mu")):"\\"===t.yytext.slice(-1)?(i(0,1),this.begin("emu")):this.begin("mu"),t.yytext)return 15;break;case 1:case 5:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(i(5,9),"END_RAW_BLOCK");case 6:case 22:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:case 23:return 48;case 21:this.unput(t.yytext),this.popState(),this.begin("com");break;case 24:return 73;case 25:case 26:case 41:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return t.yytext=i(1,2).replace(/\\"/g,'"'),80;case 32:return t.yytext=i(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 42:return t.yytext=t.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^\/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}}};return e}();function n(){this.yy={}}return e.lexer=t,n.prototype=e,e.Parser=n,new n}();t.default=n,e.exports=t.default}(parser$1,parserExports);var whitespaceControlExports={},whitespaceControl={get exports(){return whitespaceControlExports},set exports(e){whitespaceControlExports=e}},visitorExports={},visitor={get exports(){return visitorExports},set exports(e){visitorExports=e}};!function(e,t){t.__esModule=!0;var n,r=(n=exceptionExports)&&n.__esModule?n:{default:n};function i(){this.parents=[]}function a(e){this.acceptRequired(e,"path"),this.acceptArray(e.params),this.acceptKey(e,"hash")}function o(e){a.call(this,e),this.acceptKey(e,"program"),this.acceptKey(e,"inverse")}function s(e){this.acceptRequired(e,"name"),this.acceptArray(e.params),this.acceptKey(e,"hash")}i.prototype={constructor:i,mutating:!1,acceptKey:function(e,t){var n=this.accept(e[t]);if(this.mutating){if(n&&!i.prototype[n.type])throw new r.default('Unexpected node type "'+n.type+'" found when accepting '+t+" on "+e.type);e[t]=n}},acceptRequired:function(e,t){if(this.acceptKey(e,t),!e[t])throw new r.default(e.type+" requires "+t)},acceptArray:function(e){for(var t=0,n=e.length;t0)throw new _exception2$1.default("Invalid path: "+r,{loc:n});".."===l&&a++}}return{type:"PathExpression",data:e,depth:a,parts:i,original:r,loc:n}}function prepareMustache(e,t,n,r,i,a){var o=r.charAt(3)||r.charAt(2),s="{"!==o&&"&"!==o;return{type:/\*/.test(r)?"Decorator":"MustacheStatement",path:e,params:t,hash:n,escaped:s,strip:i,loc:this.locInfo(a)}}function prepareRawBlock(e,t,n,r){validateClose(e,n);var i={type:"Program",body:t,strip:{},loc:r=this.locInfo(r)};return{type:"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:i,openStrip:{},inverseStrip:{},closeStrip:{},loc:r}}function prepareBlock(e,t,n,r,i,a){r&&r.path&&validateClose(e,r);var o=/\*/.test(e.open);t.blockParams=e.blockParams;var s=void 0,l=void 0;if(n){if(o)throw new _exception2$1.default("Unexpected inverse block on decorator",n);n.chain&&(n.program.body[0].closeStrip=r.strip),l=n.strip,s=n.program}return i&&(i=s,s=t,t=i),{type:o?"DecoratorBlock":"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:t,inverse:s,openStrip:e.strip,inverseStrip:l,closeStrip:r&&r.strip,loc:this.locInfo(a)}}function prepareProgram(e,t){if(!t&&e.length){var n=e[0].loc,r=e[e.length-1].loc;n&&r&&(t={source:n.source,start:{line:n.start.line,column:n.start.column},end:{line:r.end.line,column:r.end.column}})}return{type:"Program",body:e,strip:{},loc:t}}function preparePartialBlock(e,t,n,r){return validateClose(e,n),{type:"PartialBlockStatement",name:e.path,params:e.params,hash:e.hash,program:t,openStrip:e.strip,closeStrip:n&&n.strip,loc:this.locInfo(r)}}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function _interopRequireDefault$1(e){return e&&e.__esModule?e:{default:e}}base.__esModule=!0,base.parseWithoutProcessing=parseWithoutProcessing,base.parse=parse$2;var _parser=parserExports,_parser2=_interopRequireDefault$1(_parser),_whitespaceControl=whitespaceControlExports,_whitespaceControl2=_interopRequireDefault$1(_whitespaceControl),_helpers=helpers,Helpers=_interopRequireWildcard(_helpers),_utils$1=utils;base.parser=_parser2.default;var yy={};function parseWithoutProcessing(e,t){return"Program"===e.type?e:(_parser2.default.yy=yy,yy.locInfo=function(e){return new yy.SourceLocation(t&&t.srcName,e)},_parser2.default.parse(e))}function parse$2(e,t){var n=parseWithoutProcessing(e,t);return new _whitespaceControl2.default(t).accept(n)}_utils$1.extend(yy,Helpers);var compiler={};function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}compiler.__esModule=!0,compiler.Compiler=Compiler,compiler.precompile=precompile,compiler.compile=compile;var _exception=exceptionExports,_exception2=_interopRequireDefault(_exception),_utils=utils,_ast=astExports,_ast2=_interopRequireDefault(_ast),slice=[].slice;function Compiler(){}function precompile(e,t,n){if(null==e||"string"!=typeof e&&"Program"!==e.type)throw new _exception2.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+e);"data"in(t=t||{})||(t.data=!0),t.compat&&(t.useDepths=!0);var r=n.parse(e,t),i=(new n.Compiler).compile(r,t);return(new n.JavaScriptCompiler).compile(i,t)}function compile(e,t,n){if(void 0===t&&(t={}),null==e||"string"!=typeof e&&"Program"!==e.type)throw new _exception2.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+e);"data"in(t=_utils.extend({},t))||(t.data=!0),t.compat&&(t.useDepths=!0);var r=void 0;function i(){var r=n.parse(e,t),i=(new n.Compiler).compile(r,t),a=(new n.JavaScriptCompiler).compile(i,t,void 0,!0);return n.template(a)}function a(e,t){return r||(r=i()),r.call(this,e,t)}return a._setup=function(e){return r||(r=i()),r._setup(e)},a._child=function(e,t,n,a){return r||(r=i()),r._child(e,t,n,a)},a}function argEquals(e,t){if(e===t)return!0;if(_utils.isArray(e)&&_utils.isArray(t)&&e.length===t.length){for(var n=0;n1)throw new _exception2.default("Unsupported number of partial arguments: "+n.length,e);n.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):n.push({type:"PathExpression",parts:[],depth:0}));var r=e.name.original,i="SubExpression"===e.name.type;i&&this.accept(e.name),this.setupFullMustacheParams(e,t,void 0,!0);var a=e.indent||"";this.options.preventIndent&&a&&(this.opcode("appendContent",a),a=""),this.opcode("invokePartial",i,r,a),this.opcode("append")},PartialBlockStatement:function(e){this.PartialStatement(e)},MustacheStatement:function(e){this.SubExpression(e),e.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(e){this.DecoratorBlock(e)},ContentStatement:function(e){e.value&&this.opcode("appendContent",e.value)},CommentStatement:function(){},SubExpression:function(e){transformLiteralToPath(e);var t=this.classifySexpr(e);"simple"===t?this.simpleSexpr(e):"helper"===t?this.helperSexpr(e):this.ambiguousSexpr(e)},ambiguousSexpr:function(e,t,n){var r=e.path,i=r.parts[0],a=null!=t||null!=n;this.opcode("getContext",r.depth),this.opcode("pushProgram",t),this.opcode("pushProgram",n),r.strict=!0,this.accept(r),this.opcode("invokeAmbiguous",i,a)},simpleSexpr:function(e){var t=e.path;t.strict=!0,this.accept(t),this.opcode("resolvePossibleLambda")},helperSexpr:function(e,t,n){var r=this.setupFullMustacheParams(e,t,n),i=e.path,a=i.parts[0];if(this.options.knownHelpers[a])this.opcode("invokeKnownHelper",r.length,a);else{if(this.options.knownHelpersOnly)throw new _exception2.default("You specified knownHelpersOnly, but used the unknown helper "+a,e);i.strict=!0,i.falsy=!0,this.accept(i),this.opcode("invokeHelper",r.length,i.original,_ast2.default.helpers.simpleId(i))}},PathExpression:function(e){this.addDepth(e.depth),this.opcode("getContext",e.depth);var t=e.parts[0],n=_ast2.default.helpers.scopedId(e),r=!e.depth&&!n&&this.blockParamIndex(t);r?this.opcode("lookupBlockParam",r,e.parts):t?e.data?(this.options.data=!0,this.opcode("lookupData",e.depth,e.parts,e.strict)):this.opcode("lookupOnContext",e.parts,e.falsy,e.strict,n):this.opcode("pushContext")},StringLiteral:function(e){this.opcode("pushString",e.value)},NumberLiteral:function(e){this.opcode("pushLiteral",e.value)},BooleanLiteral:function(e){this.opcode("pushLiteral",e.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(e){var t=e.pairs,n=0,r=t.length;for(this.opcode("pushHash");n=0)return[t,i]}}};var javascriptCompilerExports={},javascriptCompiler={get exports(){return javascriptCompilerExports},set exports(e){javascriptCompilerExports=e}},codeGenExports={},codeGen={get exports(){return codeGenExports},set exports(e){codeGenExports=e}},sourceMap={},sourceMapGenerator={},base64Vlq={},base64$1={},hasRequiredBase64,hasRequiredBase64Vlq;function requireBase64(){if(hasRequiredBase64)return base64$1;hasRequiredBase64=1;var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return base64$1.encode=function(t){if(0<=t&&t>>=5)>0&&(n|=32),r+=e.encode(n)}while(i>0);return r},base64Vlq.decode=function(t,n,r){var i,a,o,s,l=t.length,u=0,c=0;do{if(n>=l)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(a=e.decode(t.charCodeAt(n++))))throw new Error("Invalid base64 digit: "+t.charAt(n-1));i=!!(32&a),u+=(a&=31)<>1,1==(1&o)?-s:s),r.rest=n},base64Vlq}var util={},hasRequiredUtil;function requireUtil(){return hasRequiredUtil||(hasRequiredUtil=1,function(e){e.getArg=function(e,t,n){if(t in e)return e[t];if(3===arguments.length)return n;throw new Error('"'+t+'" is a required argument.')};var t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,n=/^data:.+\,.+$/;function r(e){var n=e.match(t);return n?{scheme:n[1],auth:n[2],host:n[3],port:n[4],path:n[5]}:null}function i(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function a(t){var n=t,a=r(t);if(a){if(!a.path)return t;n=a.path}for(var o,s=e.isAbsolute(n),l=n.split(/\/+/),u=0,c=l.length-1;c>=0;c--)"."===(o=l[c])?l.splice(c,1):".."===o?u++:u>0&&(""===o?(l.splice(c+1,u),u=0):(l.splice(c,2),u--));return""===(n=l.join("/"))&&(n=s?"/":"."),a?(a.path=n,i(a)):n}function o(e,t){""===e&&(e="."),""===t&&(t=".");var o=r(t),s=r(e);if(s&&(e=s.path||"/"),o&&!o.scheme)return s&&(o.scheme=s.scheme),i(o);if(o||t.match(n))return t;if(s&&!s.host&&!s.path)return s.host=t,i(s);var l="/"===t.charAt(0)?t:a(e.replace(/\/+$/,"")+"/"+t);return s?(s.path=l,i(s)):l}e.urlParse=r,e.urlGenerate=i,e.normalize=a,e.join=o,e.isAbsolute=function(e){return"/"===e.charAt(0)||t.test(e)},e.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var n=0;0!==t.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0)return t;if((e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return t;++n}return Array(n+1).join("../")+t.substr(e.length+1)};var s=!("__proto__"in Object.create(null));function l(e){return e}function u(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var n=t-10;n>=0;n--)if(36!==e.charCodeAt(n))return!1;return!0}function c(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}e.toSetString=s?l:function(e){return u(e)?"$"+e:e},e.fromSetString=s?l:function(e){return u(e)?e.slice(1):e},e.compareByOriginalPositions=function(e,t,n){var r=c(e.source,t.source);return 0!==r||0!==(r=e.originalLine-t.originalLine)||0!==(r=e.originalColumn-t.originalColumn)||n||0!==(r=e.generatedColumn-t.generatedColumn)||0!==(r=e.generatedLine-t.generatedLine)?r:c(e.name,t.name)},e.compareByGeneratedPositionsDeflated=function(e,t,n){var r=e.generatedLine-t.generatedLine;return 0!==r||0!==(r=e.generatedColumn-t.generatedColumn)||n||0!==(r=c(e.source,t.source))||0!==(r=e.originalLine-t.originalLine)||0!==(r=e.originalColumn-t.originalColumn)?r:c(e.name,t.name)},e.compareByGeneratedPositionsInflated=function(e,t){var n=e.generatedLine-t.generatedLine;return 0!==n||0!==(n=e.generatedColumn-t.generatedColumn)||0!==(n=c(e.source,t.source))||0!==(n=e.originalLine-t.originalLine)||0!==(n=e.originalColumn-t.originalColumn)?n:c(e.name,t.name)},e.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},e.computeSourceURL=function(e,t,n){if(t=t||"",e&&("/"!==e[e.length-1]&&"/"!==t[0]&&(e+="/"),t=e+t),n){var s=r(n);if(!s)throw new Error("sourceMapURL could not be parsed");if(s.path){var l=s.path.lastIndexOf("/");l>=0&&(s.path=s.path.substring(0,l+1))}t=o(i(s),t)}return a(t)}}(util)),util}var arraySet={},hasRequiredArraySet;function requireArraySet(){if(hasRequiredArraySet)return arraySet;hasRequiredArraySet=1;var e=requireUtil(),t=Object.prototype.hasOwnProperty,n="undefined"!=typeof Map;function r(){this._array=[],this._set=n?new Map:Object.create(null)}return r.fromArray=function(e,t){for(var n=new r,i=0,a=e.length;i=0)return i}else{var a=e.toSetString(r);if(t.call(this._set,a))return this._set[a]}throw new Error('"'+r+'" is not in the set.')},r.prototype.at=function(e){if(e>=0&&ei||a==i&&s>=o||e.compareByGeneratedPositionsInflated(n,r)<=0?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))},t.prototype.toArray=function(){return this._sorted||(this._array.sort(e.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},mappingList.MappingList=t,mappingList}function requireSourceMapGenerator(){if(hasRequiredSourceMapGenerator)return sourceMapGenerator;hasRequiredSourceMapGenerator=1;var e=requireBase64Vlq(),t=requireUtil(),n=requireArraySet().ArraySet,r=requireMappingList().MappingList;function i(e){e||(e={}),this._file=t.getArg(e,"file",null),this._sourceRoot=t.getArg(e,"sourceRoot",null),this._skipValidation=t.getArg(e,"skipValidation",!1),this._sources=new n,this._names=new n,this._mappings=new r,this._sourcesContents=null}return i.prototype._version=3,i.fromSourceMap=function(e){var n=e.sourceRoot,r=new i({file:e.file,sourceRoot:n});return e.eachMapping((function(e){var i={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(i.source=e.source,null!=n&&(i.source=t.relative(n,i.source)),i.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(i.name=e.name)),r.addMapping(i)})),e.sources.forEach((function(i){var a=i;null!==n&&(a=t.relative(n,i)),r._sources.has(a)||r._sources.add(a);var o=e.sourceContentFor(i);null!=o&&r.setSourceContent(i,o)})),r},i.prototype.addMapping=function(e){var n=t.getArg(e,"generated"),r=t.getArg(e,"original",null),i=t.getArg(e,"source",null),a=t.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,r,i,a),null!=i&&(i=String(i),this._sources.has(i)||this._sources.add(i)),null!=a&&(a=String(a),this._names.has(a)||this._names.add(a)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:i,name:a})},i.prototype.setSourceContent=function(e,n){var r=e;null!=this._sourceRoot&&(r=t.relative(this._sourceRoot,r)),null!=n?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[t.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[t.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},i.prototype.applySourceMap=function(e,r,i){var a=r;if(null==r){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}var o=this._sourceRoot;null!=o&&(a=t.relative(o,a));var s=new n,l=new n;this._mappings.unsortedForEach((function(n){if(n.source===a&&null!=n.originalLine){var r=e.originalPositionFor({line:n.originalLine,column:n.originalColumn});null!=r.source&&(n.source=r.source,null!=i&&(n.source=t.join(i,n.source)),null!=o&&(n.source=t.relative(o,n.source)),n.originalLine=r.line,n.originalColumn=r.column,null!=r.name&&(n.name=r.name))}var u=n.source;null==u||s.has(u)||s.add(u);var c=n.name;null==c||l.has(c)||l.add(c)}),this),this._sources=s,this._names=l,e.sources.forEach((function(n){var r=e.sourceContentFor(n);null!=r&&(null!=i&&(n=t.join(i,n)),null!=o&&(n=t.relative(o,n)),this.setSourceContent(n,r))}),this)},i.prototype._validateMapping=function(e,t,n,r){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||n||r)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:r}))},i.prototype._serializeMappings=function(){for(var n,r,i,a,o=0,s=1,l=0,u=0,c=0,h=0,d="",f=this._mappings.toArray(),p=0,v=f.length;p0){if(!t.compareByGeneratedPositionsInflated(r,f[p-1]))continue;n+=","}n+=e.encode(r.generatedColumn-o),o=r.generatedColumn,null!=r.source&&(a=this._sources.indexOf(r.source),n+=e.encode(a-h),h=a,n+=e.encode(r.originalLine-1-u),u=r.originalLine-1,n+=e.encode(r.originalColumn-l),l=r.originalColumn,null!=r.name&&(i=this._names.indexOf(r.name),n+=e.encode(i-c),c=i)),d+=n}return d},i.prototype._generateSourcesContent=function(e,n){return e.map((function(e){if(!this._sourcesContents)return null;null!=n&&(e=t.relative(n,e));var r=t.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)},i.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},i.prototype.toString=function(){return JSON.stringify(this.toJSON())},sourceMapGenerator.SourceMapGenerator=i,sourceMapGenerator}var sourceMapConsumer={},binarySearch={},hasRequiredBinarySearch;function requireBinarySearch(){return hasRequiredBinarySearch||(hasRequiredBinarySearch=1,function(e){function t(n,r,i,a,o,s){var l=Math.floor((r-n)/2)+n,u=o(i,a[l],!0);return 0===u?l:u>0?r-l>1?t(l,r,i,a,o,s):s==e.LEAST_UPPER_BOUND?r1?t(n,l,i,a,o,s):s==e.LEAST_UPPER_BOUND?l:n<0?-1:n}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(n,r,i,a){if(0===r.length)return-1;var o=t(-1,r.length,n,r,i,a||e.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&0===i(r[o],r[o-1],!0);)--o;return o}}(binarySearch)),binarySearch}var quickSort={},hasRequiredQuickSort,hasRequiredSourceMapConsumer;function requireQuickSort(){if(hasRequiredQuickSort)return quickSort;function e(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function t(n,r,i,a){if(i=0){var s=this._originalMappings[o];if(void 0===n.column)for(var l=s.originalLine;s&&s.originalLine===l;)a.push({line:e.getArg(s,"generatedLine",null),column:e.getArg(s,"generatedColumn",null),lastColumn:e.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++o];else for(var u=s.originalColumn;s&&s.originalLine===r&&s.originalColumn==u;)a.push({line:e.getArg(s,"generatedLine",null),column:e.getArg(s,"generatedColumn",null),lastColumn:e.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++o]}return a},sourceMapConsumer.SourceMapConsumer=a,o.prototype=Object.create(a.prototype),o.prototype.consumer=a,o.prototype._findSourceIndex=function(t){var n,r=t;if(null!=this.sourceRoot&&(r=e.relative(this.sourceRoot,r)),this._sources.has(r))return this._sources.indexOf(r);for(n=0;n1&&(a.source=v+l[1],v+=l[1],a.originalLine=f+l[2],f=a.originalLine,a.originalLine+=1,a.originalColumn=p+l[3],p=a.originalColumn,l.length>4&&(a.name=m+l[4],m+=l[4])),x.push(a),"number"==typeof a.originalLine&&S.push(a)}i(x,e.compareByGeneratedPositionsDeflated),this.__generatedMappings=x,i(S,e.compareByOriginalPositions),this.__originalMappings=S},o.prototype._findMapping=function(e,n,r,i,a,o){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[i]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[i]);return t.search(e,n,a,o)},o.prototype.computeColumnSpans=function(){for(var e=0;e=0){var i=this._generatedMappings[r];if(i.generatedLine===n.generatedLine){var o=e.getArg(i,"source",null);null!==o&&(o=this._sources.at(o),o=e.computeSourceURL(this.sourceRoot,o,this._sourceMapURL));var s=e.getArg(i,"name",null);return null!==s&&(s=this._names.at(s)),{source:o,line:e.getArg(i,"originalLine",null),column:e.getArg(i,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}},o.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e})))},o.prototype.sourceContentFor=function(t,n){if(!this.sourcesContent)return null;var r=this._findSourceIndex(t);if(r>=0)return this.sourcesContent[r];var i,a=t;if(null!=this.sourceRoot&&(a=e.relative(this.sourceRoot,a)),null!=this.sourceRoot&&(i=e.urlParse(this.sourceRoot))){var o=a.replace(/^file:\/\//,"");if("file"==i.scheme&&this._sources.has(o))return this.sourcesContent[this._sources.indexOf(o)];if((!i.path||"/"==i.path)&&this._sources.has("/"+a))return this.sourcesContent[this._sources.indexOf("/"+a)]}if(n)return null;throw new Error('"'+a+'" is not in the SourceMap.')},o.prototype.generatedPositionFor=function(t){var n=e.getArg(t,"source");if((n=this._findSourceIndex(n))<0)return{line:null,column:null,lastColumn:null};var r={source:n,originalLine:e.getArg(t,"line"),originalColumn:e.getArg(t,"column")},i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,e.getArg(t,"bias",a.GREATEST_LOWER_BOUND));if(i>=0){var o=this._originalMappings[i];if(o.source===r.source)return{line:e.getArg(o,"generatedLine",null),column:e.getArg(o,"generatedColumn",null),lastColumn:e.getArg(o,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},sourceMapConsumer.BasicSourceMapConsumer=o,l.prototype=Object.create(a.prototype),l.prototype.constructor=a,l.prototype._version=3,Object.defineProperty(l.prototype,"sources",{get:function(){for(var e=[],t=0;t=0;t--)this.prepend(e[t]);else{if(!e[r]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},i.prototype.walk=function(e){for(var t,n=0,i=this.children.length;n0){for(t=[],n=0;n0&&(n+=", "+r.join(", "));var i=0;Object.keys(this.aliases).forEach((function(e){var r=t.aliases[e];r.children&&r.referenceCount>1&&(n+=", alias"+ ++i+"="+e,r.children[0]="alias"+i)})),this.lookupPropertyFunctionIsUsed&&(n+=", "+this.lookupPropertyFunctionVarDeclaration());var a=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&a.push("blockParams"),this.useDepths&&a.push("depths");var o=this.mergeSource(n);return e?(a.push(o),Function.apply(this,a)):this.source.wrap(["function(",a.join(","),") {\n ",o,"}"])},mergeSource:function(e){var t=this.environment.isSimple,n=!this.forceBuffer,r=void 0,i=void 0,a=void 0,o=void 0;return this.source.each((function(e){e.appendToBuffer?(a?e.prepend(" + "):a=e,o=e):(a&&(i?a.prepend("buffer += "):r=!0,o.add(";"),a=o=void 0),i=!0,t||(n=!1))})),n?a?(a.prepend("return "),o.add(";")):i||this.source.push('return "";'):(e+=", buffer = "+(r?"":this.initializeBuffer()),a?(a.prepend("return buffer + "),o.add(";")):this.source.push("return buffer;")),e&&this.source.prepend("var "+e.substring(2)+(r?"":";\n")),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return"\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n ".trim()},blockValue:function(e){var t=this.aliasable("container.hooks.blockHelperMissing"),n=[this.contextName(0)];this.setupHelperArgs(e,0,n);var r=this.popStack();n.splice(1,0,r),this.push(this.source.functionCall(t,"call",n))},ambiguousBlockValue:function(){var e=this.aliasable("container.hooks.blockHelperMissing"),t=[this.contextName(0)];this.setupHelperArgs("",0,t,!0),this.flushInline();var n=this.topStack();t.splice(1,0,n),this.pushSource(["if (!",this.lastHelper,") { ",n," = ",this.source.functionCall(e,"call",t),"}"])},appendContent:function(e){this.pendingContent?e=this.pendingContent+e:this.pendingLocation=this.source.currentLocation,this.pendingContent=e},append:function(){if(this.isInline())this.replaceStack((function(e){return[" != null ? ",e,' : ""']})),this.pushSource(this.appendToBuffer(this.popStack()));else{var e=this.popStack();this.pushSource(["if (",e," != null) { ",this.appendToBuffer(e,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(e){this.lastContext=e},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(e,t,n,r){var i=0;r||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(e[i++])),this.resolvePath("context",e,i,t,n)},lookupBlockParam:function(e,t){this.useBlockParams=!0,this.push(["blockParams[",e[0],"][",e[1],"]"]),this.resolvePath("context",t,1)},lookupData:function(e,t,n){e?this.pushStackLiteral("container.data(data, "+e+")"):this.pushStackLiteral("data"),this.resolvePath("data",t,0,!0,n)},resolvePath:function(e,t,n,r,i){var a=this;if(this.options.strict||this.options.assumeObjects)this.push(function(e,t,n,r){var i=t.popStack(),a=0,o=n.length;e&&o--;for(;athis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var e=this.inlineStack;this.inlineStack=[];for(var t=0,n=e.length;t64&&e<91?e-65:e>96&&e<123?e-71:e>47&&e<58?e+4:43===e?62:47===e?63:0}function decode(e,t){for(var n,r,i=e.replace(/[^A-Za-z0-9\+\/]/g,""),a=i.length,o=t?Math.ceil((3*a+1>>2)/t)*t:3*a+1>>2,s=new Uint8Array(o),l=0,u=0,c=0;c>>(16>>>n&24)&255;l=0}return s}var base64={decode:decode},fetch$1=function(e,t){return new Promise((function(n,r){var i=new XMLHttpRequest;t&&(i.responseType=t),i.open("GET",e),i.onload=function(){200===i.status?n(i.response):r(Error(i.statusText))},i.onerror=function(){r(Error("Network Error"))},i.send()}))};!function(e){var t=base64,n=fetch$1;function r(e){return function(t){return"string"==typeof t&&e.test(t)}}function i(e,t){return"string"==typeof e?e+t:"function"==typeof e?e(t):t}function a(e,t,n,r){var i=t instanceof ArrayBuffer?o:s(t)?l:function(e){return e&&"function"==typeof e.then}(t)?u:c(t)?h:function(e){return e&&"object"===_typeof2(e)}(t)?d:f(t)?p:v(t)?m:g(t)?y:null;return i?i(e,t,n||{}):r?Promise.resolve(r):Promise.reject("Source not valid ("+t+")")}function o(e,t,n){return new Promise((function(n,r){e.decodeAudioData(t,(function(e){n(e)}),(function(){r("Can't decode audio data ("+t.slice(0,30)+"...)")}))}))}a.fetch=n;var s=r(/\.(mp3|wav|ogg)(\?.*)?$/i);function l(e,t,n){var r=i(n.from,t);return a(e,a.fetch(r,"arraybuffer"),n)}function u(e,t,n){return t.then((function(t){return a(e,t,n)}))}var c=Array.isArray;function h(e,t,n){return Promise.all(t.map((function(t){return a(e,t,n,t)})))}function d(e,t,n){var r={},i=Object.keys(t).map((function(i){if(n.only&&-1===n.only.indexOf(i))return null;var o=t[i];return a(e,o,n,o).then((function(e){r[i]=e}))}));return Promise.all(i).then((function(){return r}))}var f=r(/\.json(\?.*)?$/i);function p(e,t,n){var r=i(n.from,t);return a(e,a.fetch(r,"text").then(JSON.parse),n)}var v=r(/^data:audio/);function m(e,n,r){var i=n.indexOf(",");return a(e,t.decode(n.slice(i+1)).buffer,r)}var g=r(/\.js(\?.*)?$/i);function y(e,t,n){var r=i(n.from,t);return a(e,a.fetch(r,"text").then(b),n)}function b(e){var t=e.indexOf("MIDI.Soundfont.");if(t<0)throw Error("Invalid MIDI.js Soundfont format");t=e.indexOf("=",t)+2;var n=e.lastIndexOf(",");return JSON.parse(e.slice(t,n)+"}")}e.exports&&(e.exports=a),"undefined"!=typeof window&&(window.loadAudio=a)}(lib$1);var libExports={},lib={get exports(){return libExports},set exports(e){libExports=e}},adsr=ADSR$1;function ADSR$1(e){var t=e.createGain(),n=t._voltage=getVoltage(e),r=scale(n),i=scale(n),a=scale(n);return t._startAmount=scale(i),t._endAmount=scale(a),t._multiplier=scale(r),t._multiplier.connect(t),t._startAmount.connect(t),t._endAmount.connect(t),t.value=r.gain,t.startValue=i.gain,t.endValue=a.gain,t.startValue.value=0,t.endValue.value=0,Object.defineProperties(t,props),t}var props={attack:{value:0,writable:!0},decay:{value:0,writable:!0},sustain:{value:1,writable:!0},release:{value:0,writable:!0},getReleaseDuration:{value:function(){return this.release}},start:{value:function(e){var t=this._multiplier.gain,n=this._startAmount.gain,r=this._endAmount.gain;this._voltage.start(e),this._decayFrom=this._decayFrom=e+this.attack,this._startedAt=e;var i=this.sustain;t.cancelScheduledValues(e),n.cancelScheduledValues(e),r.cancelScheduledValues(e),r.setValueAtTime(0,e),this.attack?(t.setValueAtTime(0,e),t.linearRampToValueAtTime(1,e+this.attack),n.setValueAtTime(1,e),n.linearRampToValueAtTime(0,e+this.attack)):(t.setValueAtTime(1,e),n.setValueAtTime(0,e)),this.decay&&t.setTargetAtTime(i,this._decayFrom,getTimeConstant(this.decay))}},stop:{value:function(e,t){t&&(e-=this.release);var n=e+this.release;if(this.release){var r=this._multiplier.gain,i=this._startAmount.gain,a=this._endAmount.gain;r.cancelScheduledValues(e),i.cancelScheduledValues(e),a.cancelScheduledValues(e);var o=getTimeConstant(this.release);if(this.attack&&e=t&&(a=t),a}var ADSR=adsr,EMPTY={},DEFAULTS={gain:1,attack:.01,decay:.1,sustain:.9,release:.3,loop:!1,cents:0,loopStart:0,loopEnd:0};function SamplePlayer(e,t,n){var r=!1,i=0,a={},o=e.createGain();o.gain.value=1;var s=Object.assign({},DEFAULTS,n),l={context:e,out:o,opts:s};return t instanceof AudioBuffer?l.buffer=t:l.buffers=t,l.start=function(t,n,o){if(l.buffer&&null!==t)return l.start(null,t,n);var s=t?l.buffers[t]:l.buffer;if(s){if(r){var c=o||EMPTY;n=Math.max(e.currentTime,n||0),l.emit("start",n,t,c);var h=u(t,s,c);return h.id=function(t,n){return n.id=i++,a[n.id]=n,n.source.onended=function(){var t=e.currentTime;n.source.disconnect(),n.env.disconnect(),n.disconnect(),l.emit("ended",t,n.id,n)},n.id}(0,h),h.env.start(n),h.source.start(n),l.emit("started",n,h.id,h),c.duration&&h.stop(n+c.duration),h}console.warn("SamplePlayer not connected to any node.")}else console.warn("Buffer "+t+" not found.")},l.play=function(e,t,n){return l.start(e,t,n)},l.stop=function(e,t){var n;return(t=t||Object.keys(a)).map((function(t){return(n=a[t])?(n.stop(e),n.id):null}))},l.connect=function(e){return r=!0,o.connect(e),l},l.emit=function(e,t,n,r){l.onevent&&l.onevent(e,t,n,r);var i=l["on"+e];i&&i(t,n,r)},l;function u(t,n,r){var i=e.createGain();return i.gain.value=0,i.connect(o),i.env=envelope(e,r,s),i.env.connect(i.gain),i.source=e.createBufferSource(),i.source.buffer=n,i.source.connect(i),i.source.loop=r.loop||s.loop,i.source.playbackRate.value=centsToRate(r.cents||s.cents),i.source.loopStart=r.loopStart||s.loopStart,i.source.loopEnd=r.loopEnd||s.loopEnd,i.stop=function(n){var r=n||e.currentTime;l.emit("stop",r,t);var a=i.env.stop(r);i.source.stop(a)},i}}function isNum$1(e){return"number"==typeof e}var PARAMS=["attack","decay","sustain","release"];function envelope(e,t,n){var r=ADSR(e),i=t.adsr||n.adsr;return PARAMS.forEach((function(e,a){r[e]=i?i[a]:t[e]||n[e]})),r.value.value=isNum$1(t.gain)?t.gain:isNum$1(n.gain)?n.gain:1,r}function centsToRate(e){return e?Math.pow(2,e/1200):1}var player=SamplePlayer,events=function(e){return e.on=function(t,n){if(1===arguments.length&&"function"==typeof t)return e.on("event",t);var r="on"+t,i=e[r];return e[r]=i?chain(i,n):n,e},e};function chain(e,t){return function(n,r,i,a){e(n,r,i,a),t(n,r,i,a)}}var REGEX$1=/^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/;function regex$1(){return REGEX$1}var SEMITONES$1=[0,2,4,5,7,9,11];function parse$1(e,t,n){if("string"!=typeof e)return null;var r=REGEX$1.exec(e);if(!r||!t&&r[4])return null;var i={letter:r[1].toUpperCase(),acc:r[2].replace(/x/g,"##")};return i.pc=i.letter+i.acc,i.step=(i.letter.charCodeAt(0)+3)%7,i.alt="b"===i.acc[0]?-i.acc.length:i.acc.length,i.chroma=SEMITONES$1[i.step]+i.alt,r[3]&&(i.oct=+r[3],i.midi=i.chroma+12*(i.oct+1),i.freq=midiToFreq$1(i.midi,n)),t&&(i.tonicOf=r[4]),i}function midiToFreq$1(e,t){return Math.pow(2,(e-69)/12)*(t||440)}var parser={parse:parse$1,regex:regex$1,midiToFreq:midiToFreq$1},FNS=["letter","acc","pc","step","alt","chroma","oct","midi","freq"];FNS.forEach((function(e){parser[e]=function(t){var n=parse$1(t);return n&&void 0!==n[e]?n[e]:null}}));var noteParser$1=parser,note=noteParser$1,isMidi=function(e){return null!==e&&e!==[]&&e>=0&&e<129},toMidi=function(e){return isMidi(e)?+e:note.midi(e)},notes=function(e){if(e.buffers){var t=e.opts.map,n="function"==typeof t?t:toMidi,r=function(e){return e?n(e)||e:null};e.buffers=mapBuffers(e.buffers,r);var i=e.start;e.start=function(e,t,n){var a=r(e),o=a%1;return o&&(a=Math.floor(a),n=Object.assign(n||{},{cents:Math.floor(100*o)})),i(a,t,n)}}return e};function mapBuffers(e,t){return Object.keys(e).reduce((function(n,r){return n[t(r)]=e[r],n}),{})}var isArr=Array.isArray,isObj=function(e){return e&&"object"===_typeof2(e)},OPTS={},scheduler=function(e){return e.schedule=function(t,n){var r,i,a,o,s=e.context.currentTime,l=t6?null:LETTERS.charAt(e)+accStr(t)+octStr(n)}function midi(e){if((isNum(e)||isStr(e))&&e>=0&&e<128)return+e;var t=parse(e);return t&&isDef(t.midi)?t.midi:null}function freq(e,t){var n=midi(e);return null===n?null:midiToFreq(n,t)}function letter(e){return(parse(e)||{}).letter}function acc(e){return(parse(e)||{}).acc}function pc(e){return(parse(e)||{}).pc}function step(e){return(parse(e)||{}).step}function alt(e){return(parse(e)||{}).alt}function chroma(e){return(parse(e)||{}).chroma}function oct(e){return(parse(e)||{}).oct}var noteParser=Object.freeze(Object.defineProperty({__proto__:null,acc:acc,alt:alt,build:build,chroma:chroma,freq:freq,letter:letter,midi:midi,oct:oct,parse:parse,pc:pc,regex:regex,step:step},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(noteParser),legacy,hasRequiredLegacy;function requireLegacy(){if(hasRequiredLegacy)return legacy;hasRequiredLegacy=1;var e=require$$0;function t(e,n){if(console.warn("new Soundfont() is deprected"),console.log("Please use Soundfont.instrument() instead of new Soundfont().instrument()"),!(this instanceof t))return new t(e);this.nameToUrl=n||t.nameToUrl,this.ctx=e,this.instruments={},this.promises=[]}function n(t,n){return n=n||{},function(r,i,a,o){console.warn("The oscillator player is deprecated."),console.log("Starting with version 0.9.0 you will have to wait until the soundfont is loaded to play sounds.");var s=r>0&&r<129?+r:e.midi(r),l=s?e.midiToFreq(s,440):null;if(l){a=a||.2;var u=(o=o||{}).destination||n.destination||t.destination,c=o.vcoType||n.vcoType||"sine",h=o.gain||n.gain||.4,d=t.createOscillator();d.type=c,d.frequency.value=l;var f=t.createGain();return f.gain.value=h,d.connect(f),f.connect(u),d.start(i),a>0&&d.stop(i+a),d}}}return t.prototype.onready=function(e){console.warn("deprecated API"),console.log("Please use Promise.all(Soundfont.instrument(), Soundfont.instrument()).then() instead of new Soundfont().onready()"),Promise.all(this.promises).then(e)},t.prototype.instrument=function(e,r){console.warn("new Soundfont().instrument() is deprecated."),console.log("Please use Soundfont.instrument() instead.");var i=this.ctx;if((e=e||"default")in this.instruments)return this.instruments[e];var a={name:e,play:n(i,r)};if(this.instruments[e]=a,"default"!==e){var o=t.instrument(i,e,r).then((function(e){return a.play=e.play,a}));this.promises.push(o),a.onready=function(e){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),o.then(e)}}else a.onready=function(e){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),e()};return a},t.loadBuffers=function(e,n,r){return console.warn("Soundfont.loadBuffers is deprecate."),console.log("Use Soundfont.instrument(..) and get buffers properties from the result."),t.instrument(e,n,r).then((function(e){return e.buffers}))},t.noteToMidi=e.midi,legacy=t}!function(e){var t=libExports$1,n=libExports;function r(e){return/\.js(\?.*)?$/i.test(e)}function i(e,t,n){return"https://gleitz.github.io/midi-js-soundfonts/"+(t="FluidR3_GM"===t?t:"MusyngKite")+"/"+e+"-"+(n="ogg"===n?n:"mp3")+".js"}var a=requireLegacy();a.instrument=function e(a,o,s){if(1===arguments.length)return function(t,n){return e(a,t,n)};var l=s||{},u=l.isSoundfontURL||r,c=l.nameToUrl||i,h=u(o)?o:c(o,l.soundfont,l.format);return t(a,h,{only:l.only||l.notes}).then((function(e){var t=n(a,e,l).connect(l.destination?l.destination:a.destination);return t.url=h,t.name=o,t}))},a.nameToUrl=i,e.exports&&(e.exports=a),"undefined"!=typeof window&&(window.Soundfont=a)}(lib$2),NoteEnum.C,NoteEnum.D,NoteEnum.E,NoteEnum.F,NoteEnum.G,NoteEnum.A,NoteEnum.B;var speedInfo={"rall.":1.333333333,"poco rit.":1.333333333,"rit.":1.333333333,"molto rit.":1.333333333,"molto rall":1.333333333,molto:1.333333333,lentando:1.333333333,allargando:1.333333333,morendo:1.333333333,"accel.":.8,calando:2,"poco accel.":.8,"gradually slowing":1.333333333,slowing:1.333333333,slow:1.333333333,slowly:1.333333333,faster:1.333333333},getNextNote=function(e,t){for(var n=0,r=e.closest(t),i=r,a=null==r?void 0:r.closest("measure"),o=null;!o&&n<((null==a?void 0:a.childNodes.length)||50);){var s,l,u,c;if(n++,"note"===(null===(s=i)||void 0===s||null===(l=s.nextElementSibling)||void 0===l?void 0:l.tagName))o=null===(c=i)||void 0===c?void 0:c.nextElementSibling;i=null===(u=i)||void 0===u?void 0:u.nextElementSibling}return o},getGradualLengthByXml=function(e){for(var t=(new DOMParser).parseFromString(e,"text/xml"),n=Array.from(t.querySelectorAll("measure")),r=Array.from(t.querySelectorAll("note")),i=Array.from(t.querySelectorAll("words")),a=Array.from(t.querySelectorAll("metronome")),o=[],s=function(){var e=u[l],t=getNextNote(e,"direction");if(t){for(var i=null==t?void 0:t.closest("measure"),a=Array.from(i.querySelectorAll("note")),s=Array.from(i.childNodes).filter((function(e){return"note"===e.nodeName})).findIndex((function(e){return e===t})),c=0,h=0,d=0;d-1&&n.index>(null===(l=c[u])||void 0===l?void 0:l[0].start)&&(i=-1,c[u][1]={start:n.index,measureIndex:n.measureIndex,closedMeasureIndex:n.measureIndex,noteInMeasureIndex:n.noteInMeasureIndex,allDuration:n.allDuration,leftDuration:n.leftDuration,type:a})}"words"===n.type&&s&&c.push([{start:n.index,measureIndex:n.measureIndex,closedMeasureIndex:n.measureIndex+i,noteInMeasureIndex:n.noteInMeasureIndex,allDuration:n.allDuration,leftDuration:n.leftDuration,type:a}])},f=0,p=o;f0&&void 0!==arguments[0]?arguments[0]:"",t=e,n=e.split(":");return 1===n.length?t="00:".concat(n[0],":00"):2===n.length&&(t="00:".concat(n[0],":").concat(n[1])),"1970-01-01 00:".concat(t,"0")},getDuration=function(e){if(e){var t,n=null===(t=e.GraphicSheet.MeasureList[0][0])||void 0===t?void 0:t.parentSourceMeasure,r=n.Duration,i=n.TempoInBPM,a=n.ActiveTimeSignature,o=n.TempoExpressions;if(r){var s,l="quarter",u=_createForOfIteratorHelper(o);try{for(u.s();!(s=u.n()).done;){l=s.value.InstantaneousTempo.beatUnit||"quarter"}}catch(err){u.e(err)}finally{u.f()}return _objectSpread(_objectSpread({},formatDuration(a)),{},{TempoInBPM:i,beatUnit:l})}}return _objectSpread(_objectSpread({},new Fraction$1),{},{TempoInBPM:90,beatUnit:"quarter"})};function formatDuration(e,t){return e}function formatBeatUnit(e){var t=4;switch(e){case"1024th":t=1024;break;case"512th":t=512;break;case"256th":t=256;break;case"128th":t=128;break;case"64th":t=64;break;case"32nd":t=32;break;case"16th":t=16;break;case"eighth":t=8;break;case"quarter":t=4;break;case"half":t=2;break;case"whole":t=1;break;case"breve":t=.5;break;case"long":t=.25;break;case"maxima":t=.125}return t}function getTimeByBeatUnit(e,t,n){return n/formatBeatUnit(e)*t}var setElementNoteBefore=function(e,t,n){var r=0;if(t){for(var i=0;i0){var o=0,s=Array.from(n.childNodes).filter((function(e){return"note"===e.nodeName})),l=s[s.length-1];if(r>=s.length&&l)return void n.insertBefore(e,n.childNodes[Array.from(n.childNodes).indexOf(l)]);for(var u=0;u-1){var s=m.indexOf(i),l=e.getElementsByTagName("measure")[s];setElementNoteBefore(r,i,l)}})),y.forEach((function(t){var n=t.textContent||"";if((isSpecialMark(n=["cresc."].includes(n)?"":n)||isSpeedKeyword(n)||isGradientWords(n)||isRepeatWord(n)||GRADIENT_SPEED_RESET_TAG)&&n){var r,i=null===(r=t.parentElement)||void 0===r?void 0:r.parentElement,a=null==i?void 0:i.parentElement,o=_toConsumableArray2((null==a?void 0:a.childNodes)||[]),s=i?o.indexOf(i):-1;if(i&&a&&s>-1){var l=m.indexOf(a),u=e.getElementsByTagName("measure")[l];0===Array.from((null==u?void 0:u.getElementsByTagName("words"))||[]).reduce((function(e,t){var r;return null!==(r=t.textContent)&&void 0!==r&&r.includes(n)&&e++,e}),0)&&(["12280"].includes(h)?null==u||u.insertBefore(i.cloneNode(!0),null==u?void 0:u.childNodes[s]):setElementNoteBefore(i,a,u))}}})),b.forEach((function(t){var n,r=null===(n=t.parentElement)||void 0===n?void 0:n.parentElement,i=null==r?void 0:r.parentElement,a=_toConsumableArray2((null==i?void 0:i.childNodes)||[]),o=r?a.indexOf(r):-1;if(r&&i&&o>-1){var s=m.indexOf(i),l=e.getElementsByTagName("measure")[s];["12280"].includes(h)?null==l||l.insertBefore(r.cloneNode(!0),null==l?void 0:l.childNodes[o]):setElementNoteBefore(r,i,l)}})),A.forEach((function(t){var n,r=null===(n=t.parentElement)||void 0===n?void 0:n.parentElement,i=null==r?void 0:r.parentElement;if(i){var a,o=m.indexOf(i);null===(a=e.getElementsByTagName("measure")[o])||void 0===a||a.appendChild(r.cloneNode(!0))}}))}else y.forEach((function(e){var t=e.textContent||"";if(isSpeedKeyword(t)&&t){var n,r,i=null===(n=e.parentElement)||void 0===n||null===(r=n.parentElement)||void 0===r?void 0:r.parentElement;if(i&&i.firstElementChild&&i.firstElementChild!==e){var a,o=null===(a=e.parentElement)||void 0===a?void 0:a.parentElement,s=i.firstElementChild;i.insertBefore(o,s)}}}));if(e&&e.getAttribute("id")===x){var l,u,c=e.getElementsByTagName("barline"),d=null===(l=c[c.length-1])||void 0===l?void 0:l.parentElement;if("barline"!==(null==d||null===(u=d.lastElementChild)||void 0===u?void 0:u.tagName)){var f,p=_createForOfIteratorHelper((null==d?void 0:d.children)||[]);try{for(p.s();!(f=p.n()).done;){var v=f.value;if("barline"===v.tagName){null==d||d.appendChild(v);break}}}catch(err){p.e(err)}finally{p.f()}}}})),Array.from(f).forEach((function(e){var t;e&&e.getAttribute("id")!==x&&(null===(t=e.parentNode)||void 0===t||t.removeChild(e))}))}return(new XMLSerializer).serializeToString(appoggianceFormate(d))},appoggianceFormate=function(e){if(!e)return e;var t=e.querySelectorAll("grace");if(!t.length)return e;var n,r=function e(t){return t.querySelector("grace")?e(null==t?void 0:t.nextElementSibling):t},i=_createForOfIteratorHelper(t);try{for(i.s();!(n=i.n()).done;){var a,o=n.value,s=null===(a=o.parentElement)||void 0===a?void 0:a.querySelector("notations");if(s&&s.querySelectorAll("slur").length>1){var l,u=r(null===(l=o.parentElement)||void 0===l?void 0:l.nextElementSibling);if(u&&u.querySelectorAll("slur").length>0){var c,h,d=Array.from((null===(c=u.querySelector("notations"))||void 0===c?void 0:c.children)||[]).map((function(e){return e.getAttribute("number")})),f=_createForOfIteratorHelper(s.querySelectorAll("slur"));try{for(f.s();!(h=f.n()).done;){var p,v=h.value;if(!d.includes(v.getAttribute("number")))null===(p=u.querySelector("notations"))||void 0===p||p.appendChild(v)}}catch(err){f.e(err)}finally{f.f()}}}}}catch(err){i.e(err)}finally{i.f()}return e},formatXML=function(e){if(!e)return"";for(var t=(new DOMParser).parseFromString(e,"text/xml"),n=-1,r=-1,i=0,a=Array.from(t.getElementsByTagName("measure"));i\n \n '.concat(l*n,"\n 1\n whole\n ")}}return(new XMLSerializer).serializeToString(t)},formateTimes=exports("aQ",(function(e){var t=customData.customNoteRealValue,n=customData.customNoteCurrentTime,r=state$1.examSongId+"";state$1.partIndex;var i=browserInfo.huawei?.08:0,a=[],o=[],s=[],l=state$1.originSpeed;if(!e.cursor)return[];var u=e.cursor.Iterator;console.time("音符跑完时间");var c,h,d=0,f=0,p=[],v=[],m=0,g=0,y=0,b="quarter",A=0,S=0,x=0,w=[];state$1.gradualTimes&&console.log("后台设置的渐慢小节时间",state$1.gradual,state$1.gradualTimes);for(var _=u.currentTimeStamp.RealValue,E=[],k=!1,C=0;!u.EndReached;){var M,P,I,T=null!==(M=u.CurrentVoiceEntries)&&void 0!==M&&M[0]?[null===(P=u.CurrentVoiceEntries)||void 0===P?void 0:P[0]]:[],B=[];B=state$1.multitrack>0?_toConsumableArray2(u.CurrentVoiceEntries):_toConsumableArray2(u.CurrentVoiceEntries).filter((function(e){var t;return e&&1!=(null==e||null===(t=e.ParentVoice)||void 0===t?void 0:t.VoiceId)}));var R=0,L=!1,N=!1;if(B.length&&!k){var F,D,O;L=!0;var V=_toConsumableArray2(u.CurrentVoiceEntries).reduce((function(e,t){return e.push.apply(e,_toConsumableArray2(t.Notes)),e}),[]);if(R=(null===(F=V=V.sort((function(e,t){var n,r;return(null==e||null===(n=e.length)||void 0===n?void 0:n.realValue)-(null==t||null===(r=t.length)||void 0===r?void 0:r.realValue)})))||void 0===F||null===(D=F[0])||void 0===D||null===(O=D.length)||void 0===O?void 0:O.realValue)||0,state$1.multitrack>0&&2===B.length){var z,G,H,U,j=(null===(z=V[0])||void 0===z||null===(G=z.length)||void 0===G?void 0:G.realValue)||0;k=0!==(C=((null===(H=V[V.length-1])||void 0===H||null===(U=H.length)||void 0===U?void 0:U.realValue)||0)-j)}}null!==(I=w[w.length-1])&&void 0!==I&&I.isDouble&&!B.length&&(N=!0),state$1.multitrack>0&&!L&&k&&(L=!0,R=C,k=!1,C=0),E.push(u.currentTimeStamp.realValue-_),_=u.currentTimeStamp.realValue;for(var Q=0,Y=T;Q0&&R>K.length.realValue&&(R=K.length.realValue),w.push({note:K,iterator:_objectSpread({},u),currentTime:R,isDouble:L,isMutileSubject:N})}u.moveToNextVisibleVoiceEntry(!1)}for(var ie=function(){var u=oe[ae],w=u.note,_=u.iterator,k=u.currentTime,C=u.isDouble,M=u.isMutileSubject;if(w){var P,I,T,B,R,L,N,F,D,O,V;if(0===f&&s.push(w.sourceMeasure),0===f&&state$1.isSpecialBookCategory){var z,G,H=_createForOfIteratorHelper(null===(z=w.sourceMeasure)||void 0===z?void 0:z.TempoExpressions);try{for(H.s();!(G=H.n()).done;){var U,j=G.value;null!=j&&null!==(U=j.InstantaneousTempo)&&void 0!==U&&U.beatUnit&&(b=j.InstantaneousTempo.beatUnit)}}catch(err){H.e(err)}finally{H.f()}}var Q,Y=w.sourceMeasure.tempoInBPM,W=_.currentMeasure.metronomeNoteIndex;if(0!==W&&W>f)Y=(null===(Q=a[a.length-1])||void 0===Q?void 0:Q.speed)||100;var X=[null===(P=w.sourceMeasure.verticalMeasureList)||void 0===P?void 0:P[0]],K=_.currentTimeStamp.realValue,J=formatDuration(_.currentMeasure.activeTimeSignature,_.currentMeasure.duration),$=J.RealValue,q=J.Denominator,Z=w.length,ee=Z.wholeValue,te=Z.numerator,ne=Z.denominator,re=Z.realValue;t[d]&&(re=t[d]),C&&k>0&&k!=re&&(console.log("小节 ".concat(w.sourceMeasure.MeasureNumberXML," 替换: noteLength: ").concat(re,", 最小: ").concat(k)),re=k),n&&M&&E[d+1]>0&&re>E[d+1]&&(console.log(re,E[d+1]),re=E[d+1]);var ie=g,se=(state$1.isSpecialBookCategory?Y:l)||1;0===d&&(i+=getFixTime(se),state$1.fixtime=i,console.log("fixtime:",i,"速度:",se,"state.isSpecialBookCategory:",state$1.isSpecialBookCategory,"state.isOpenMetronome:",state$1.isOpenMetronome));var le=0,ue=(state$1.isSpecialBookCategory?Y:l)||1;h=_.currentMeasure.speedInfo||h,(!(c=(null===(I=e.Sheet.SoundTempos)||void 0===I?void 0:I.get(w.sourceMeasure.measureListIndex))||c)||c.length<2)&&(c=createSpeedInfo(h,ue));var ce=_.currentMeasure.measureListIndex;if(state$1.gradualTimes&&Object.keys(state$1.gradualTimes).length>0){var he=state$1.gradual.find((function(e,t){var n,r=state$1.gradual[t+1];return e[0].measureIndex<=ce&&(null===(n=e[1])||void 0===n?void 0:n.measureIndex)>=ce&&(!r||(null==r?void 0:r[0].measureIndex)!==ce)})),de=_slicedToArray(he||[],2),fe=de[0],pe=de[1];if(fe&&pe){var ve=pe.measureIndex-fe.measureIndex,me=fe.closedMeasureIndex==ce&&f>=fe.noteInMeasureIndex,ge=pe.closedMeasureIndex===ce&&f0)){var Se=c[0]-(c[1]-c[0]),xe=h,we=xe.resetXmlNoteIndex,_e=xe.endXmlNoteIndex,Ee=(c[c.length-1]-Se)/_e;if(Ee=w.DotsXml?Ee/1.5:Ee,A<_e){var ke=Math.ceil(ue+Ee*A),Ce=getTimeByBeatUnit(b,ke,_.currentMeasure.activeTimeSignature.Denominator),Me=(ee+te/ne)*q*(60/Ce);ue+=Math.ceil(Ee*(A+1)),le=(Me+(ee+te/ne)*q*(60/(Ce=getTimeByBeatUnit(b,ue,_.currentMeasure.activeTimeSignature.Denominator))))/2}else if(we>A){var Pe;ue=null===(Pe=a[d-1])||void 0===Pe?void 0:Pe.speed}se=(state$1.isSpecialBookCategory?getTimeByBeatUnit(b,ue,_.currentMeasure.activeTimeSignature.Denominator):l)||1;var Ie=!(A<_e||we>A);A++,Ie&&(A=0,h=void 0,c=void 0,v=[])}var Te=re,Be=le||Math.min($,re)*formatBeatUnit(b)*(60/se),Re=$*q*(60/se);g+=Be,y+=Be;var Le=Be+ie,Ne=w.fixedKey||0,Fe=null===(T=X[0])||void 0===T||null===(B=T.vfVoices[1])||void 0===B?void 0:B.tickables[f];if(a.length&&a[a.length-1].relativeTime===ie)return"continue";if(0===d){var De,Oe,Ve=0;((null===(De=w.sourceMeasure.verticalMeasureList)||void 0===De||null===(Oe=De[0])||void 0===Oe?void 0:Oe.staffEntries)||[]).forEach((function(e){var t,n,r,i,a,o;null!=e&&null!==(t=e.sourceStaffEntry)&&void 0!==t&&null!==(n=t.voiceEntries)&&void 0!==n&&null!==(r=n[0])&&void 0!==r&&null!==(i=r.notes)&&void 0!==i&&null!==(a=i[0])&&void 0!==a&&null!==(o=a.length)&&void 0!==o&&o.realValue&&(Ve+=e.sourceStaffEntry.voiceEntries[0].notes[0].length.realValue)})),Ve<$&&(m=Re-Be),m>0&&(i+=m)}var ze=null===(R=X[0])||void 0===R?void 0:R.stave;w.sourceMeasure.multipleRestMeasures&&(S=w.sourceMeasure.multipleRestMeasures,x=0),x=state$1.section[0].MeasureNumberXML&&e.MeasureNumberXML<=state$1.section[1].MeasureNumberXML)return e.MeasureNumberXML==state$1.section[0].MeasureNumberXML&&e.MeasureNumberXML==state$1.section[1].MeasureNumberXML?styles$1.centerStaveBox:e.MeasureNumberXML==state$1.section[0].MeasureNumberXML?styles$1.leftStaveBox:e.MeasureNumberXML==state$1.section[1].MeasureNumberXML?styles$1.rightStaveBox:styles$1.staveBox}}else if(state$1.activeMeasureIndex==e.MeasureNumberXML&&!state$1.isReport)return styles$1.staveBox}}));return onMounted((function(){calcNoteData()})),function(){return createVNode("div",{id:"selectionBox",class:styles$1.selectionContainer,onClick:function(e){return e.stopPropagation()}},[selectData.staves.map((function(e){var t,r=e.id&&evaluatingData.evaluatings[e.measureListIndex],i=!state$1.isReport&&!state$1.times[state$1.activeNoteIndex].multipleRestMeasures&&metronomeData.lineShow&&e.MeasureNumberXML===(null===(t=metronomeData.activeMetro)||void 0===t?void 0:t.measureNumberXML)&&state$1.times[state$1.activeNoteIndex].MeasureNumberXML===e.MeasureNumberXML;return createVNode(Fragment,null,[e.staveBox&&createVNode("div",{class:[styles$1.position,n.value(e),r?"scoreItemLeve".concat(r.leve):""],style:e.staveBox,onClick:function(){return handleSelection(e)}},[i&&createVNode("div",{class:styles$1.line,style:{left:metronomeData.activeMetro.left}},null),!state$1.isReport&&!!e.multipleRestMeasures&&state$1.activeMeasureIndex==e.MeasureNumberXML&&createVNode("div",{class:styles$1.dotWrap},[e.multipleRestMeasures]),createVNode(Transition,{name:"centerTop",onAfterEnter:function(){r.show=!1}},{default:function(){var e,t;return[(null==r?void 0:r.show)&&createVNode("div",{class:styles$1.scoreItem,style:{color:(null===(e=leveByScoreMeasureIcons[r.leve])||void 0===e?void 0:e.color)||""}},[createVNode("img",{src:null===(t=leveByScoreMeasureIcons[r.leve])||void 0===t?void 0:t.icon},null),createVNode("span",null,[r.score])])]}})])])})),selectData.notes.map((function(e){return createVNode("div",{class:[styles$1.position,t.value&&styles$1.disable,styles$1.note],style:e.bbox,onClick:function(){return skipNotePlay(e.index)}},[createVNode("div",{class:styles$1.noteFollow,"data-vf":"vf"+e.id},[createVNode(Icon$1,{name:"success"},null),createVNode(Icon$1,{name:"cross"},null)])])}))])}}}),inGradualRange="_inGradualRange_1ryfw_24",styles={inGradualRange:inGradualRange},musicRenderTypeKey=exports("a$","musicRenderType"),musicData=reactive({showSelection:!1,isRenderLoading:!0,score:"",containerWidth:0}),resetMusicScore=exports("aF",(function(){var e,t=(null===(e=document.getElementById("musicAndSelection"))||void 0===e?void 0:e.offsetWidth)||625;state$1.musicZoom=t/musicData.containerWidth})),resetRenderMusicScore=exports("b0",(function(){var e=queryString.parse(location.search),t=queryString.stringify(_objectSpread(_objectSpread({},e),{},{_t:Date.now()}));location.search="?"+t})),MusicScore=exports("aJ",defineComponent({name:"music-score",emits:["rendered"],props:{showSelection:{type:Boolean,default:!0}},setup:function(e,t){var n=t.emit,r=function(){var e=_asyncToGenerator2(_regeneratorRuntime().mark((function e(){var t,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(state$1.xmlUrl).then((function(e){return e.text()}));case 2:t=e.sent,n=formatXML(t),musicData.score=onlyVisible(n,state$1.partIndex),state$1.gradualTimes&&(state$1.gradual=getGradualLengthByXml(n));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),i=function(){var e=_asyncToGenerator2(_regeneratorRuntime().mark((function e(){var t,r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((t=document.getElementById("musicAndSelection"))&&musicData.score){e.next=3;break}return e.abrupt("return");case 3:return(r=new OpenSheetMusicDisplay(t,{drawTitle:!1,drawSubtitle:!1,autoResize:!1,followCursor:!1,drawPartNames:!1,drawComposer:!1})).EngravingRules.PageRightMargin=2,r.EngravingRules.PageTopMargin=10,r.EngravingRules.PageTopMarginNarrow=3,r.EngravingRules.PageLeftMargin=2,r.EngravingRules.PageBottomMargin=2,r.EngravingRules.DYMusicScoreType=state$1.musicRenderType===EnumMusicRenderType.staff?"staff":"jianpu",state$1.musicRenderType===EnumMusicRenderType.fixedTone&&(window.sett={keySignature:!0}),e.next=13,r.load(musicData.score);case 13:r.zoom=state$1.zoom,r.render(),n("rendered",r),musicData.showSelection=!0;case 17:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();onMounted(_asyncToGenerator2(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=void 0,musicData.containerWidth=(null===(n=document.getElementById("musicAndSelection"))||void 0===n?void 0:n.offsetWidth)||625,t=void 0,(t=sessionStorage.getItem(musicRenderTypeKey))in EnumMusicRenderType&&(state$1.musicRenderType=t),e.next=4,r();case 4:return e.next=6,i();case 6:musicData.isRenderLoading=!1;case 7:case"end":return e.stop()}var t,n}),e)}))));var a=computed((function(){var e,t,n=!1,r=(null===(e=state$1.times[state$1.activeNoteIndex])||void 0===e?void 0:e.measureListIndex)||-1,i=_createForOfIteratorHelper(state$1.gradual);try{for(i.s();!(t=i.n()).done;){var a=_slicedToArray(t.value,2),o=a[0],s=a[1];if(o&&s&&(n=o.measureIndex<=r&&r