var lr=Object.defineProperty;var cr=(t,e,i)=>e in t?lr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var ot=(t,e,i)=>(cr(t,typeof e!="symbol"?e+"":e,i),i);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function i(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=i(s);fetch(s.href,o)}})();const index="",common="",popup$1="",SnackbarSfc="",elevation="",loading$1="",button="",icon="",snackbar="",coreSfc="",cell="",CellSfc="",ripple="",formDetails="",hoverOverlay="",_switch="",SwitchSfc="",style="";function makeMap(t,e){const i=Object.create(null),r=t.split(",");for(let s=0;s!!i[s.toLowerCase()]:s=>!!i[s]}function normalizeStyle(t){if(isArray$9(t)){const e={};for(let i=0;i{if(i){const r=i.split(propertyDelimiterRE);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function normalizeClass(t){let e="";if(isString$2(t))e=t;else if(isArray$9(t))for(let i=0;iisString$2(t)?t:t==null?"":isArray$9(t)||isObject$5(t)&&(t.toString===objectToString$3||!isFunction$6(t.toString))?JSON.stringify(t,replacer,2):String(t),replacer=(t,e)=>e&&e.__v_isRef?replacer(t,e.value):isMap$3(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((i,[r,s])=>(i[`${r} =>`]=s,i),{})}:isSet$3(e)?{[`Set(${e.size})`]:[...e.values()]}:isObject$5(e)&&!isArray$9(e)&&!isPlainObject$3(e)?String(e):e,EMPTY_OBJ={},EMPTY_ARR=[],NOOP=()=>{},NO=()=>!1,onRE=/^on[^a-z]/,isOn=t=>onRE.test(t),isModelListener=t=>t.startsWith("onUpdate:"),extend$3=Object.assign,remove$7=(t,e)=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)},hasOwnProperty$f=Object.prototype.hasOwnProperty,hasOwn$2=(t,e)=>hasOwnProperty$f.call(t,e),isArray$9=Array.isArray,isMap$3=t=>toTypeString(t)==="[object Map]",isSet$3=t=>toTypeString(t)==="[object Set]",isFunction$6=t=>typeof t=="function",isString$2=t=>typeof t=="string",isSymbol$1=t=>typeof t=="symbol",isObject$5=t=>t!==null&&typeof t=="object",isPromise$1=t=>isObject$5(t)&&isFunction$6(t.then)&&isFunction$6(t.catch),objectToString$3=Object.prototype.toString,toTypeString=t=>objectToString$3.call(t),toRawType=t=>toTypeString(t).slice(8,-1),isPlainObject$3=t=>toTypeString(t)==="[object Object]",isIntegerKey=t=>isString$2(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,isReservedProp=makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),cacheStringFunction=t=>{const e=Object.create(null);return i=>e[i]||(e[i]=t(i))},camelizeRE$1=/-(\w)/g,camelize$2=cacheStringFunction(t=>t.replace(camelizeRE$1,(e,i)=>i?i.toUpperCase():"")),hyphenateRE=/\B([A-Z])/g,hyphenate=cacheStringFunction(t=>t.replace(hyphenateRE,"-$1").toLowerCase()),capitalize=cacheStringFunction(t=>t.charAt(0).toUpperCase()+t.slice(1)),toHandlerKey=cacheStringFunction(t=>t?`on${capitalize(t)}`:""),hasChanged=(t,e)=>!Object.is(t,e),invokeArrayFns=(t,e)=>{for(let i=0;i{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:i})},looseToNumber=t=>{const e=parseFloat(t);return isNaN(e)?t:e},toNumber$1=t=>{const e=isString$2(t)?Number(t):NaN;return isNaN(e)?t:e};let _globalThis;const getGlobalThis=()=>_globalThis||(_globalThis=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});let activeEffectScope;class EffectScope{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=activeEffectScope,!e&&activeEffectScope&&(this.index=(activeEffectScope.scopes||(activeEffectScope.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const i=activeEffectScope;try{return activeEffectScope=this,e()}finally{activeEffectScope=i}}}on(){activeEffectScope=this}off(){activeEffectScope=this.parent}stop(e){if(this._active){let i,r;for(i=0,r=this.effects.length;i{const e=new Set(t);return e.w=0,e.n=0,e},wasTracked=t=>(t.w&trackOpBit)>0,newTracked=t=>(t.n&trackOpBit)>0,initDepMarkers=({deps:t})=>{if(t.length)for(let e=0;e{const{deps:e}=t;if(e.length){let i=0;for(let r=0;r{(m==="length"||m>=c)&&l.push(u)})}else switch(i!==void 0&&l.push(a.get(i)),e){case"add":isArray$9(t)?isIntegerKey(i)&&l.push(a.get("length")):(l.push(a.get(ITERATE_KEY)),isMap$3(t)&&l.push(a.get(MAP_KEY_ITERATE_KEY)));break;case"delete":isArray$9(t)||(l.push(a.get(ITERATE_KEY)),isMap$3(t)&&l.push(a.get(MAP_KEY_ITERATE_KEY)));break;case"set":isMap$3(t)&&l.push(a.get(ITERATE_KEY));break}if(l.length===1)l[0]&&triggerEffects(l[0]);else{const c=[];for(const u of l)u&&c.push(...u);triggerEffects(createDep(c))}}function triggerEffects(t,e){const i=isArray$9(t)?t:[...t];for(const r of i)r.computed&&triggerEffect(r);for(const r of i)r.computed||triggerEffect(r)}function triggerEffect(t,e){(t!==activeEffect||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}function getDepFromReactive(t,e){var i;return(i=targetMap.get(t))===null||i===void 0?void 0:i.get(e)}const isNonTrackableKeys=makeMap("__proto__,__v_isRef,__isVue"),builtInSymbols=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(isSymbol$1)),get$1=createGetter(),shallowGet=createGetter(!1,!0),readonlyGet=createGetter(!0),arrayInstrumentations=createArrayInstrumentations();function createArrayInstrumentations(){const t={};return["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...i){const r=toRaw(this);for(let o=0,a=this.length;o{t[e]=function(...i){pauseTracking();const r=toRaw(this)[e].apply(this,i);return resetTracking(),r}}),t}function hasOwnProperty$e(t){const e=toRaw(this);return track(e,"has",t),e.hasOwnProperty(t)}function createGetter(t=!1,e=!1){return function(r,s,o){if(s==="__v_isReactive")return!t;if(s==="__v_isReadonly")return t;if(s==="__v_isShallow")return e;if(s==="__v_raw"&&o===(t?e?shallowReadonlyMap:readonlyMap:e?shallowReactiveMap:reactiveMap).get(r))return r;const a=isArray$9(r);if(!t){if(a&&hasOwn$2(arrayInstrumentations,s))return Reflect.get(arrayInstrumentations,s,o);if(s==="hasOwnProperty")return hasOwnProperty$e}const l=Reflect.get(r,s,o);return(isSymbol$1(s)?builtInSymbols.has(s):isNonTrackableKeys(s))||(t||track(r,"get",s),e)?l:isRef(l)?a&&isIntegerKey(s)?l:l.value:isObject$5(l)?t?readonly(l):reactive(l):l}}const set$1=createSetter(),shallowSet=createSetter(!0);function createSetter(t=!1){return function(i,r,s,o){let a=i[r];if(isReadonly(a)&&isRef(a)&&!isRef(s))return!1;if(!t&&(!isShallow(s)&&!isReadonly(s)&&(a=toRaw(a),s=toRaw(s)),!isArray$9(i)&&isRef(a)&&!isRef(s)))return a.value=s,!0;const l=isArray$9(i)&&isIntegerKey(r)?Number(r)t,getProto$1=t=>Reflect.getPrototypeOf(t);function get$2(t,e,i=!1,r=!1){t=t.__v_raw;const s=toRaw(t),o=toRaw(e);i||(e!==o&&track(s,"get",e),track(s,"get",o));const{has:a}=getProto$1(s),l=r?toShallow:i?toReadonly:toReactive;if(a.call(s,e))return l(t.get(e));if(a.call(s,o))return l(t.get(o));t!==s&&t.get(e)}function has$4(t,e=!1){const i=this.__v_raw,r=toRaw(i),s=toRaw(t);return e||(t!==s&&track(r,"has",t),track(r,"has",s)),t===s?i.has(t):i.has(t)||i.has(s)}function size(t,e=!1){return t=t.__v_raw,!e&&track(toRaw(t),"iterate",ITERATE_KEY),Reflect.get(t,"size",t)}function add(t){t=toRaw(t);const e=toRaw(this);return getProto$1(e).has.call(e,t)||(e.add(t),trigger(e,"add",t,t)),this}function set(t,e){e=toRaw(e);const i=toRaw(this),{has:r,get:s}=getProto$1(i);let o=r.call(i,t);o||(t=toRaw(t),o=r.call(i,t));const a=s.call(i,t);return i.set(t,e),o?hasChanged(e,a)&&trigger(i,"set",t,e):trigger(i,"add",t,e),this}function deleteEntry(t){const e=toRaw(this),{has:i,get:r}=getProto$1(e);let s=i.call(e,t);s||(t=toRaw(t),s=i.call(e,t)),r&&r.call(e,t);const o=e.delete(t);return s&&trigger(e,"delete",t,void 0),o}function clear(){const t=toRaw(this),e=t.size!==0,i=t.clear();return e&&trigger(t,"clear",void 0,void 0),i}function createForEach(t,e){return function(r,s){const o=this,a=o.__v_raw,l=toRaw(a),c=e?toShallow:t?toReadonly:toReactive;return!t&&track(l,"iterate",ITERATE_KEY),a.forEach((u,m)=>r.call(s,c(u),c(m),o))}}function createIterableMethod(t,e,i){return function(...r){const s=this.__v_raw,o=toRaw(s),a=isMap$3(o),l=t==="entries"||t===Symbol.iterator&&a,c=t==="keys"&&a,u=s[t](...r),m=i?toShallow:e?toReadonly:toReactive;return!e&&track(o,"iterate",c?MAP_KEY_ITERATE_KEY:ITERATE_KEY),{next(){const{value:d,done:g}=u.next();return g?{value:d,done:g}:{value:l?[m(d[0]),m(d[1])]:m(d),done:g}},[Symbol.iterator](){return this}}}}function createReadonlyMethod(t){return function(...e){return t==="delete"?!1:this}}function createInstrumentations(){const t={get(o){return get$2(this,o)},get size(){return size(this)},has:has$4,add,set,delete:deleteEntry,clear,forEach:createForEach(!1,!1)},e={get(o){return get$2(this,o,!1,!0)},get size(){return size(this)},has:has$4,add,set,delete:deleteEntry,clear,forEach:createForEach(!1,!0)},i={get(o){return get$2(this,o,!0)},get size(){return size(this,!0)},has(o){return has$4.call(this,o,!0)},add:createReadonlyMethod("add"),set:createReadonlyMethod("set"),delete:createReadonlyMethod("delete"),clear:createReadonlyMethod("clear"),forEach:createForEach(!0,!1)},r={get(o){return get$2(this,o,!0,!0)},get size(){return size(this,!0)},has(o){return has$4.call(this,o,!0)},add:createReadonlyMethod("add"),set:createReadonlyMethod("set"),delete:createReadonlyMethod("delete"),clear:createReadonlyMethod("clear"),forEach:createForEach(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{t[o]=createIterableMethod(o,!1,!1),i[o]=createIterableMethod(o,!0,!1),e[o]=createIterableMethod(o,!1,!0),r[o]=createIterableMethod(o,!0,!0)}),[t,i,e,r]}const[mutableInstrumentations,readonlyInstrumentations,shallowInstrumentations,shallowReadonlyInstrumentations]=createInstrumentations();function createInstrumentationGetter(t,e){const i=e?t?shallowReadonlyInstrumentations:shallowInstrumentations:t?readonlyInstrumentations:mutableInstrumentations;return(r,s,o)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?r:Reflect.get(hasOwn$2(i,s)&&s in r?i:r,s,o)}const 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(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function getTargetType(t){return t.__v_skip||!Object.isExtensible(t)?0:targetTypeMap(toRawType(t))}function reactive(t){return isReadonly(t)?t:createReactiveObject(t,!1,mutableHandlers,mutableCollectionHandlers,reactiveMap)}function shallowReactive(t){return createReactiveObject(t,!1,shallowReactiveHandlers,shallowCollectionHandlers,shallowReactiveMap)}function readonly(t){return createReactiveObject(t,!0,readonlyHandlers,readonlyCollectionHandlers,readonlyMap)}function createReactiveObject(t,e,i,r,s){if(!isObject$5(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const o=s.get(t);if(o)return o;const a=getTargetType(t);if(a===0)return t;const l=new Proxy(t,a===2?r:i);return s.set(t,l),l}function isReactive(t){return isReadonly(t)?isReactive(t.__v_raw):!!(t&&t.__v_isReactive)}function isReadonly(t){return!!(t&&t.__v_isReadonly)}function isShallow(t){return!!(t&&t.__v_isShallow)}function isProxy(t){return isReactive(t)||isReadonly(t)}function toRaw(t){const e=t&&t.__v_raw;return e?toRaw(e):t}function markRaw(t){return def(t,"__v_skip",!0),t}const toReactive=t=>isObject$5(t)?reactive(t):t,toReadonly=t=>isObject$5(t)?readonly(t):t;function trackRefValue(t){shouldTrack&&activeEffect&&(t=toRaw(t),trackEffects(t.dep||(t.dep=createDep())))}function triggerRefValue(t,e){t=toRaw(t);const i=t.dep;i&&triggerEffects(i)}function isRef(t){return!!(t&&t.__v_isRef===!0)}function ref(t){return createRef(t,!1)}function shallowRef(t){return createRef(t,!0)}function createRef(t,e){return isRef(t)?t:new RefImpl(t,e)}class RefImpl{constructor(e,i){this.__v_isShallow=i,this.dep=void 0,this.__v_isRef=!0,this._rawValue=i?e:toRaw(e),this._value=i?e:toReactive(e)}get value(){return trackRefValue(this),this._value}set value(e){const i=this.__v_isShallow||isShallow(e)||isReadonly(e);e=i?e:toRaw(e),hasChanged(e,this._rawValue)&&(this._rawValue=e,this._value=i?e:toReactive(e),triggerRefValue(this))}}function unref(t){return isRef(t)?t.value:t}const shallowUnwrapHandlers={get:(t,e,i)=>unref(Reflect.get(t,e,i)),set:(t,e,i,r)=>{const s=t[e];return isRef(s)&&!isRef(i)?(s.value=i,!0):Reflect.set(t,e,i,r)}};function proxyRefs(t){return isReactive(t)?t:new Proxy(t,shallowUnwrapHandlers)}function toRefs(t){const e=isArray$9(t)?new Array(t.length):{};for(const i in t)e[i]=toRef(t,i);return e}class ObjectRefImpl{constructor(e,i,r){this._object=e,this._key=i,this._defaultValue=r,this.__v_isRef=!0}get value(){const e=this._object[this._key];return e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return getDepFromReactive(toRaw(this._object),this._key)}}function toRef(t,e,i){const r=t[e];return isRef(r)?r:new ObjectRefImpl(t,e,i)}var _a$1;class ComputedRefImpl{constructor(e,i,r,s){this._setter=i,this.dep=void 0,this.__v_isRef=!0,this[_a$1]=!1,this._dirty=!0,this.effect=new ReactiveEffect(e,()=>{this._dirty||(this._dirty=!0,triggerRefValue(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=r}get value(){const e=toRaw(this);return trackRefValue(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}_a$1="__v_isReadonly";function computed$1(t,e,i=!1){let r,s;const o=isFunction$6(t);return o?(r=t,s=NOOP):(r=t.get,s=t.set),new ComputedRefImpl(r,s,o||!s,i)}function warn(t,...e){}function callWithErrorHandling(t,e,i,r){let s;try{s=r?t(...r):t()}catch(o){handleError(o,e,i)}return s}function callWithAsyncErrorHandling(t,e,i,r){if(isFunction$6(t)){const o=callWithErrorHandling(t,e,i,r);return o&&isPromise$1(o)&&o.catch(a=>{handleError(a,e,i)}),o}const s=[];for(let o=0;o>>1;getId(queue$1[r])flushIndex&&queue$1.splice(e,1)}function queuePostFlushCb(t){isArray$9(t)?pendingPostFlushCbs.push(...t):(!activePostFlushCbs||!activePostFlushCbs.includes(t,t.allowRecurse?postFlushIndex+1:postFlushIndex))&&pendingPostFlushCbs.push(t),queueFlush()}function flushPreFlushCbs(t,e=isFlushing?flushIndex+1:0){for(;egetId(i)-getId(r)),postFlushIndex=0;postFlushIndext.id==null?1/0:t.id,comparator=(t,e)=>{const i=getId(t)-getId(e);if(i===0){if(t.pre&&!e.pre)return-1;if(e.pre&&!t.pre)return 1}return i};function flushJobs(t){isFlushPending=!1,isFlushing=!0,queue$1.sort(comparator);const e=NOOP;try{for(flushIndex=0;flushIndexisString$2(y)?y.trim():y)),d&&(s=i.map(looseToNumber))}let l,c=r[l=toHandlerKey(e)]||r[l=toHandlerKey(camelize$2(e))];!c&&o&&(c=r[l=toHandlerKey(hyphenate(e))]),c&&callWithAsyncErrorHandling(c,t,6,s);const u=r[l+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[l])return;t.emitted[l]=!0,callWithAsyncErrorHandling(u,t,6,s)}}function normalizeEmitsOptions(t,e,i=!1){const r=e.emitsCache,s=r.get(t);if(s!==void 0)return s;const o=t.emits;let a={},l=!1;if(!isFunction$6(t)){const c=u=>{const m=normalizeEmitsOptions(u,e,!0);m&&(l=!0,extend$3(a,m))};!i&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}return!o&&!l?(isObject$5(t)&&r.set(t,null),null):(isArray$9(o)?o.forEach(c=>a[c]=null):extend$3(a,o),isObject$5(t)&&r.set(t,a),a)}function isEmitListener(t,e){return!t||!isOn(e)?!1:(e=e.slice(2).replace(/Once$/,""),hasOwn$2(t,e[0].toLowerCase()+e.slice(1))||hasOwn$2(t,hyphenate(e))||hasOwn$2(t,e))}let currentRenderingInstance=null,currentScopeId=null;function setCurrentRenderingInstance(t){const e=currentRenderingInstance;return currentRenderingInstance=t,currentScopeId=t&&t.type.__scopeId||null,e}function pushScopeId(t){currentScopeId=t}function popScopeId(){currentScopeId=null}function withCtx(t,e=currentRenderingInstance,i){if(!e||t._n)return t;const r=(...s)=>{r._d&&setBlockTracking(-1);const o=setCurrentRenderingInstance(e);let a;try{a=t(...s)}finally{setCurrentRenderingInstance(o),r._d&&setBlockTracking(1)}return a};return r._n=!0,r._c=!0,r._d=!0,r}function markAttrsAccessed(){}function renderComponentRoot(t){const{type:e,vnode:i,proxy:r,withProxy:s,props:o,propsOptions:[a],slots:l,attrs:c,emit:u,render:m,renderCache:d,data:g,setupState:y,ctx:b,inheritAttrs:S}=t;let E,x;const A=setCurrentRenderingInstance(t);try{if(i.shapeFlag&4){const P=s||r;E=normalizeVNode(m.call(P,P,d,o,y,g,b)),x=c}else{const P=e;E=normalizeVNode(P.length>1?P(o,{attrs:c,slots:l,emit:u}):P(o,null)),x=e.props?c:getFunctionalFallthrough(c)}}catch(P){blockStack.length=0,handleError(P,t,1),E=createVNode(Comment)}let _=E;if(x&&S!==!1){const P=Object.keys(x),{shapeFlag:T}=_;P.length&&T&7&&(a&&P.some(isModelListener)&&(x=filterModelListeners(x,a)),_=cloneVNode(_,x))}return i.dirs&&(_=cloneVNode(_),_.dirs=_.dirs?_.dirs.concat(i.dirs):i.dirs),i.transition&&(_.transition=i.transition),E=_,setCurrentRenderingInstance(A),E}const getFunctionalFallthrough=t=>{let e;for(const i in t)(i==="class"||i==="style"||isOn(i))&&((e||(e={}))[i]=t[i]);return e},filterModelListeners=(t,e)=>{const i={};for(const r in t)(!isModelListener(r)||!(r.slice(9)in e))&&(i[r]=t[r]);return i};function shouldUpdateComponent(t,e,i){const{props:r,children:s,component:o}=t,{props:a,children:l,patchFlag:c}=e,u=o.emitsOptions;if(e.dirs||e.transition)return!0;if(i&&c>=0){if(c&1024)return!0;if(c&16)return r?hasPropsChanged(r,a,u):!!a;if(c&8){const m=e.dynamicProps;for(let d=0;dt.__isSuspense;function queueEffectWithSuspense(t,e){e&&e.pendingBranch?isArray$9(t)?e.effects.push(...t):e.effects.push(t):queuePostFlushCb(t)}function provide(t,e){if(currentInstance){let i=currentInstance.provides;const r=currentInstance.parent&¤tInstance.parent.provides;r===i&&(i=currentInstance.provides=Object.create(r)),i[t]=e}}function inject(t,e,i=!1){const r=currentInstance||currentRenderingInstance;if(r){const s=r.parent==null?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides;if(s&&t in s)return s[t];if(arguments.length>1)return i&&isFunction$6(e)?e.call(r.proxy):e}}function watchEffect(t,e){return doWatch(t,null,e)}const INITIAL_WATCHER_VALUE={};function watch(t,e,i){return doWatch(t,e,i)}function doWatch(t,e,{immediate:i,deep:r,flush:s,onTrack:o,onTrigger:a}=EMPTY_OBJ){const l=getCurrentScope()===(currentInstance==null?void 0:currentInstance.scope)?currentInstance:null;let c,u=!1,m=!1;if(isRef(t)?(c=()=>t.value,u=isShallow(t)):isReactive(t)?(c=()=>t,r=!0):isArray$9(t)?(m=!0,u=t.some(_=>isReactive(_)||isShallow(_)),c=()=>t.map(_=>{if(isRef(_))return _.value;if(isReactive(_))return traverse(_);if(isFunction$6(_))return callWithErrorHandling(_,l,2)})):isFunction$6(t)?e?c=()=>callWithErrorHandling(t,l,2):c=()=>{if(!(l&&l.isUnmounted))return d&&d(),callWithAsyncErrorHandling(t,l,3,[g])}:c=NOOP,e&&r){const _=c;c=()=>traverse(_())}let d,g=_=>{d=x.onStop=()=>{callWithErrorHandling(_,l,4)}},y;if(isInSSRComponentSetup)if(g=NOOP,e?i&&callWithAsyncErrorHandling(e,l,3,[c(),m?[]:void 0,g]):c(),s==="sync"){const _=useSSRContext();y=_.__watcherHandles||(_.__watcherHandles=[])}else return NOOP;let b=m?new Array(t.length).fill(INITIAL_WATCHER_VALUE):INITIAL_WATCHER_VALUE;const S=()=>{if(x.active)if(e){const _=x.run();(r||u||(m?_.some((P,T)=>hasChanged(P,b[T])):hasChanged(_,b)))&&(d&&d(),callWithAsyncErrorHandling(e,l,3,[_,b===INITIAL_WATCHER_VALUE?void 0:m&&b[0]===INITIAL_WATCHER_VALUE?[]:b,g]),b=_)}else x.run()};S.allowRecurse=!!e;let E;s==="sync"?E=S:s==="post"?E=()=>queuePostRenderEffect(S,l&&l.suspense):(S.pre=!0,l&&(S.id=l.uid),E=()=>queueJob(S));const x=new ReactiveEffect(c,E);e?i?S():b=x.run():s==="post"?queuePostRenderEffect(x.run.bind(x),l&&l.suspense):x.run();const A=()=>{x.stop(),l&&l.scope&&remove$7(l.scope.effects,x)};return y&&y.push(A),A}function instanceWatch(t,e,i){const r=this.proxy,s=isString$2(t)?t.includes(".")?createPathGetter(r,t):()=>r[t]:t.bind(r,r);let o;isFunction$6(e)?o=e:(o=e.handler,i=e);const a=currentInstance;setCurrentInstance(this);const l=doWatch(s,o.bind(r),i);return a?setCurrentInstance(a):unsetCurrentInstance(),l}function createPathGetter(t,e){const i=e.split(".");return()=>{let r=t;for(let s=0;s{traverse(i,e)});else if(isPlainObject$3(t))for(const i in t)traverse(t[i],e);return t}function useTransitionState(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return onMounted(()=>{t.isMounted=!0}),onBeforeUnmount(()=>{t.isUnmounting=!0}),t}const TransitionHookValidator=[Function,Array],BaseTransitionImpl={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:TransitionHookValidator,onEnter:TransitionHookValidator,onAfterEnter:TransitionHookValidator,onEnterCancelled:TransitionHookValidator,onBeforeLeave:TransitionHookValidator,onLeave:TransitionHookValidator,onAfterLeave:TransitionHookValidator,onLeaveCancelled:TransitionHookValidator,onBeforeAppear:TransitionHookValidator,onAppear:TransitionHookValidator,onAfterAppear:TransitionHookValidator,onAppearCancelled:TransitionHookValidator},setup(t,{slots:e}){const i=getCurrentInstance(),r=useTransitionState();let s;return()=>{const o=e.default&&getTransitionRawChildren(e.default(),!0);if(!o||!o.length)return;let a=o[0];if(o.length>1){for(const S of o)if(S.type!==Comment){a=S;break}}const l=toRaw(t),{mode:c}=l;if(r.isLeaving)return emptyPlaceholder(a);const u=getKeepAliveChild(a);if(!u)return emptyPlaceholder(a);const m=resolveTransitionHooks(u,l,r,i);setTransitionHooks(u,m);const d=i.subTree,g=d&&getKeepAliveChild(d);let y=!1;const{getTransitionKey:b}=u.type;if(b){const S=b();s===void 0?s=S:S!==s&&(s=S,y=!0)}if(g&&g.type!==Comment&&(!isSameVNodeType(u,g)||y)){const S=resolveTransitionHooks(g,l,r,i);if(setTransitionHooks(g,S),c==="out-in")return r.isLeaving=!0,S.afterLeave=()=>{r.isLeaving=!1,i.update.active!==!1&&i.update()},emptyPlaceholder(a);c==="in-out"&&u.type!==Comment&&(S.delayLeave=(E,x,A)=>{const _=getLeavingNodesForType(r,g);_[String(g.key)]=g,E._leaveCb=()=>{x(),E._leaveCb=void 0,delete m.delayedLeave},m.delayedLeave=A})}return a}}},BaseTransition=BaseTransitionImpl;function getLeavingNodesForType(t,e){const{leavingVNodes:i}=t;let r=i.get(e.type);return r||(r=Object.create(null),i.set(e.type,r)),r}function resolveTransitionHooks(t,e,i,r){const{appear:s,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:m,onBeforeLeave:d,onLeave:g,onAfterLeave:y,onLeaveCancelled:b,onBeforeAppear:S,onAppear:E,onAfterAppear:x,onAppearCancelled:A}=e,_=String(t.key),P=getLeavingNodesForType(i,t),T=(I,D)=>{I&&callWithAsyncErrorHandling(I,r,9,D)},M=(I,D)=>{const G=D[1];T(I,D),isArray$9(I)?I.every($=>$.length<=1)&&G():I.length<=1&&G()},C={mode:o,persisted:a,beforeEnter(I){let D=l;if(!i.isMounted)if(s)D=S||l;else return;I._leaveCb&&I._leaveCb(!0);const G=P[_];G&&isSameVNodeType(t,G)&&G.el._leaveCb&&G.el._leaveCb(),T(D,[I])},enter(I){let D=c,G=u,$=m;if(!i.isMounted)if(s)D=E||c,G=x||u,$=A||m;else return;let N=!1;const z=I._enterCb=R=>{N||(N=!0,R?T($,[I]):T(G,[I]),C.delayedLeave&&C.delayedLeave(),I._enterCb=void 0)};D?M(D,[I,z]):z()},leave(I,D){const G=String(t.key);if(I._enterCb&&I._enterCb(!0),i.isUnmounting)return D();T(d,[I]);let $=!1;const N=I._leaveCb=z=>{$||($=!0,D(),z?T(b,[I]):T(y,[I]),I._leaveCb=void 0,P[G]===t&&delete P[G])};P[G]=t,g?M(g,[I,N]):N()},clone(I){return resolveTransitionHooks(I,e,i,r)}};return C}function emptyPlaceholder(t){if(isKeepAlive(t))return t=cloneVNode(t),t.children=null,t}function getKeepAliveChild(t){return isKeepAlive(t)?t.children?t.children[0]:void 0:t}function setTransitionHooks(t,e){t.shapeFlag&6&&t.component?setTransitionHooks(t.component.subTree,e):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function getTransitionRawChildren(t,e=!1,i){let r=[],s=0;for(let o=0;o1)for(let o=0;o!!t.type.__asyncLoader,isKeepAlive=t=>t.type.__isKeepAlive;function onActivated(t,e){registerKeepAliveHook(t,"a",e)}function onDeactivated(t,e){registerKeepAliveHook(t,"da",e)}function registerKeepAliveHook(t,e,i=currentInstance){const r=t.__wdc||(t.__wdc=()=>{let s=i;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(injectHook(e,r,i),i){let s=i.parent;for(;s&&s.parent;)isKeepAlive(s.parent.vnode)&&injectToKeepAliveRoot(r,e,i,s),s=s.parent}}function injectToKeepAliveRoot(t,e,i,r){const s=injectHook(e,t,r,!0);onUnmounted(()=>{remove$7(r[e],s)},i)}function injectHook(t,e,i=currentInstance,r=!1){if(i){const s=i[t]||(i[t]=[]),o=e.__weh||(e.__weh=(...a)=>{if(i.isUnmounted)return;pauseTracking(),setCurrentInstance(i);const l=callWithAsyncErrorHandling(e,i,t,a);return unsetCurrentInstance(),resetTracking(),l});return r?s.unshift(o):s.push(o),o}}const createHook=t=>(e,i=currentInstance)=>(!isInSSRComponentSetup||t==="sp")&&injectHook(t,(...r)=>e(...r),i),onBeforeMount=createHook("bm"),onMounted=createHook("m"),onBeforeUpdate=createHook("bu"),onUpdated=createHook("u"),onBeforeUnmount=createHook("bum"),onUnmounted=createHook("um"),onServerPrefetch=createHook("sp"),onRenderTriggered=createHook("rtg"),onRenderTracked=createHook("rtc");function onErrorCaptured(t,e=currentInstance){injectHook("ec",t,e)}function withDirectives(t,e){const i=currentRenderingInstance;if(i===null)return t;const r=getExposeProxy(i)||i.proxy,s=t.dirs||(t.dirs=[]);for(let o=0;oe(a,l,void 0,o&&o[l]));else{const a=Object.keys(t);s=new Array(a.length);for(let l=0,c=a.length;lisVNode(e)?!(e.type===Comment||e.type===Fragment&&!ensureValidVNode(e.children)):!0)?t:null}const getPublicInstance=t=>t?isStatefulComponent(t)?getExposeProxy(t)||t.proxy:getPublicInstance(t.parent):null,publicPropertiesMap=extend$3(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>getPublicInstance(t.parent),$root:t=>getPublicInstance(t.root),$emit:t=>t.emit,$options:t=>resolveMergedOptions(t),$forceUpdate:t=>t.f||(t.f=()=>queueJob(t.update)),$nextTick:t=>t.n||(t.n=nextTick.bind(t.proxy)),$watch:t=>instanceWatch.bind(t)}),hasSetupBinding=(t,e)=>t!==EMPTY_OBJ&&!t.__isScriptSetup&&hasOwn$2(t,e),PublicInstanceProxyHandlers={get({_:t},e){const{ctx:i,setupState:r,data:s,props:o,accessCache:a,type:l,appContext:c}=t;let u;if(e[0]!=="$"){const y=a[e];if(y!==void 0)switch(y){case 1:return r[e];case 2:return s[e];case 4:return i[e];case 3:return o[e]}else{if(hasSetupBinding(r,e))return a[e]=1,r[e];if(s!==EMPTY_OBJ&&hasOwn$2(s,e))return a[e]=2,s[e];if((u=t.propsOptions[0])&&hasOwn$2(u,e))return a[e]=3,o[e];if(i!==EMPTY_OBJ&&hasOwn$2(i,e))return a[e]=4,i[e];shouldCacheAccess&&(a[e]=0)}}const m=publicPropertiesMap[e];let d,g;if(m)return e==="$attrs"&&track(t,"get",e),m(t);if((d=l.__cssModules)&&(d=d[e]))return d;if(i!==EMPTY_OBJ&&hasOwn$2(i,e))return a[e]=4,i[e];if(g=c.config.globalProperties,hasOwn$2(g,e))return g[e]},set({_:t},e,i){const{data:r,setupState:s,ctx:o}=t;return hasSetupBinding(s,e)?(s[e]=i,!0):r!==EMPTY_OBJ&&hasOwn$2(r,e)?(r[e]=i,!0):hasOwn$2(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(o[e]=i,!0)},has({_:{data:t,setupState:e,accessCache:i,ctx:r,appContext:s,propsOptions:o}},a){let l;return!!i[a]||t!==EMPTY_OBJ&&hasOwn$2(t,a)||hasSetupBinding(e,a)||(l=o[0])&&hasOwn$2(l,a)||hasOwn$2(r,a)||hasOwn$2(publicPropertiesMap,a)||hasOwn$2(s.config.globalProperties,a)},defineProperty(t,e,i){return i.get!=null?t._.accessCache[e]=0:hasOwn$2(i,"value")&&this.set(t,e,i.value,null),Reflect.defineProperty(t,e,i)}};let shouldCacheAccess=!0;function applyOptions(t){const e=resolveMergedOptions(t),i=t.proxy,r=t.ctx;shouldCacheAccess=!1,e.beforeCreate&&callHook$1(e.beforeCreate,t,"bc");const{data:s,computed:o,methods:a,watch:l,provide:c,inject:u,created:m,beforeMount:d,mounted:g,beforeUpdate:y,updated:b,activated:S,deactivated:E,beforeDestroy:x,beforeUnmount:A,destroyed:_,unmounted:P,render:T,renderTracked:M,renderTriggered:C,errorCaptured:I,serverPrefetch:D,expose:G,inheritAttrs:$,components:N,directives:z,filters:R}=e;if(u&&resolveInjections(u,r,null,t.appContext.config.unwrapInjectedRef),a)for(const V in a){const k=a[V];isFunction$6(k)&&(r[V]=k.bind(i))}if(s){const V=s.call(i,i);isObject$5(V)&&(t.data=reactive(V))}if(shouldCacheAccess=!0,o)for(const V in o){const k=o[V],F=isFunction$6(k)?k.bind(i,i):isFunction$6(k.get)?k.get.bind(i,i):NOOP,Z=!isFunction$6(k)&&isFunction$6(k.set)?k.set.bind(i):NOOP,U=computed({get:F,set:Z});Object.defineProperty(r,V,{enumerable:!0,configurable:!0,get:()=>U.value,set:J=>U.value=J})}if(l)for(const V in l)createWatcher(l[V],r,i,V);if(c){const V=isFunction$6(c)?c.call(i):c;Reflect.ownKeys(V).forEach(k=>{provide(k,V[k])})}m&&callHook$1(m,t,"c");function O(V,k){isArray$9(k)?k.forEach(F=>V(F.bind(i))):k&&V(k.bind(i))}if(O(onBeforeMount,d),O(onMounted,g),O(onBeforeUpdate,y),O(onUpdated,b),O(onActivated,S),O(onDeactivated,E),O(onErrorCaptured,I),O(onRenderTracked,M),O(onRenderTriggered,C),O(onBeforeUnmount,A),O(onUnmounted,P),O(onServerPrefetch,D),isArray$9(G))if(G.length){const V=t.exposed||(t.exposed={});G.forEach(k=>{Object.defineProperty(V,k,{get:()=>i[k],set:F=>i[k]=F})})}else t.exposed||(t.exposed={});T&&t.render===NOOP&&(t.render=T),$!=null&&(t.inheritAttrs=$),N&&(t.components=N),z&&(t.directives=z)}function resolveInjections(t,e,i=NOOP,r=!1){isArray$9(t)&&(t=normalizeInject(t));for(const s in t){const o=t[s];let a;isObject$5(o)?"default"in o?a=inject(o.from||s,o.default,!0):a=inject(o.from||s):a=inject(o),isRef(a)&&r?Object.defineProperty(e,s,{enumerable:!0,configurable:!0,get:()=>a.value,set:l=>a.value=l}):e[s]=a}}function callHook$1(t,e,i){callWithAsyncErrorHandling(isArray$9(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,i)}function createWatcher(t,e,i,r){const s=r.includes(".")?createPathGetter(i,r):()=>i[r];if(isString$2(t)){const o=e[t];isFunction$6(o)&&watch(s,o)}else if(isFunction$6(t))watch(s,t.bind(i));else if(isObject$5(t))if(isArray$9(t))t.forEach(o=>createWatcher(o,e,i,r));else{const o=isFunction$6(t.handler)?t.handler.bind(i):e[t.handler];isFunction$6(o)&&watch(s,o,t)}}function resolveMergedOptions(t){const e=t.type,{mixins:i,extends:r}=e,{mixins:s,optionsCache:o,config:{optionMergeStrategies:a}}=t.appContext,l=o.get(e);let c;return l?c=l:!s.length&&!i&&!r?c=e:(c={},s.length&&s.forEach(u=>mergeOptions$1(c,u,a,!0)),mergeOptions$1(c,e,a)),isObject$5(e)&&o.set(e,c),c}function mergeOptions$1(t,e,i,r=!1){const{mixins:s,extends:o}=e;o&&mergeOptions$1(t,o,i,!0),s&&s.forEach(a=>mergeOptions$1(t,a,i,!0));for(const a in e)if(!(r&&a==="expose")){const l=internalOptionMergeStrats[a]||i&&i[a];t[a]=l?l(t[a],e[a]):e[a]}return t}const 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(t,e){return e?t?function(){return extend$3(isFunction$6(t)?t.call(this,this):t,isFunction$6(e)?e.call(this,this):e)}:e:t}function mergeInject(t,e){return mergeObjectOptions(normalizeInject(t),normalizeInject(e))}function normalizeInject(t){if(isArray$9(t)){const e={};for(let i=0;i0)&&!(a&16)){if(a&8){const m=t.vnode.dynamicProps;for(let d=0;d{c=!0;const[g,y]=normalizePropsOptions(d,e,!0);extend$3(a,g),y&&l.push(...y)};!i&&e.mixins.length&&e.mixins.forEach(m),t.extends&&m(t.extends),t.mixins&&t.mixins.forEach(m)}if(!o&&!c)return isObject$5(t)&&r.set(t,EMPTY_ARR),EMPTY_ARR;if(isArray$9(o))for(let m=0;m-1,y[1]=S<0||b-1||hasOwn$2(y,"default"))&&l.push(d)}}}const u=[a,l];return isObject$5(t)&&r.set(t,u),u}function validatePropName(t){return t[0]!=="$"}function getType(t){const e=t&&t.toString().match(/^\s*(function|class) (\w+)/);return e?e[2]:t===null?"null":""}function isSameType(t,e){return getType(t)===getType(e)}function getTypeIndex(t,e){return isArray$9(e)?e.findIndex(i=>isSameType(i,t)):isFunction$6(e)&&isSameType(e,t)?0:-1}const isInternalKey=t=>t[0]==="_"||t==="$stable",normalizeSlotValue=t=>isArray$9(t)?t.map(normalizeVNode):[normalizeVNode(t)],normalizeSlot$1=(t,e,i)=>{if(e._n)return e;const r=withCtx((...s)=>normalizeSlotValue(e(...s)),i);return r._c=!1,r},normalizeObjectSlots=(t,e,i)=>{const r=t._ctx;for(const s in t){if(isInternalKey(s))continue;const o=t[s];if(isFunction$6(o))e[s]=normalizeSlot$1(s,o,r);else if(o!=null){const a=normalizeSlotValue(o);e[s]=()=>a}}},normalizeVNodeSlots=(t,e)=>{const i=normalizeSlotValue(e);t.slots.default=()=>i},initSlots=(t,e)=>{if(t.vnode.shapeFlag&32){const i=e._;i?(t.slots=toRaw(e),def(e,"_",i)):normalizeObjectSlots(e,t.slots={})}else t.slots={},e&&normalizeVNodeSlots(t,e);def(t.slots,InternalObjectKey,1)},updateSlots=(t,e,i)=>{const{vnode:r,slots:s}=t;let o=!0,a=EMPTY_OBJ;if(r.shapeFlag&32){const l=e._;l?i&&l===1?o=!1:(extend$3(s,e),!i&&l===1&&delete s._):(o=!e.$stable,normalizeObjectSlots(e,s)),a=e}else e&&(normalizeVNodeSlots(t,e),a={default:1});if(o)for(const l in s)!isInternalKey(l)&&!(l in a)&&delete s[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}}let uid$1=0;function createAppAPI(t,e){return function(r,s=null){isFunction$6(r)||(r=Object.assign({},r)),s!=null&&!isObject$5(s)&&(s=null);const o=createAppContext(),a=new Set;let l=!1;const c=o.app={_uid:uid$1++,_component:r,_props:s,_container:null,_context:o,_instance:null,version,get config(){return o.config},set config(u){},use(u,...m){return a.has(u)||(u&&isFunction$6(u.install)?(a.add(u),u.install(c,...m)):isFunction$6(u)&&(a.add(u),u(c,...m))),c},mixin(u){return o.mixins.includes(u)||o.mixins.push(u),c},component(u,m){return m?(o.components[u]=m,c):o.components[u]},directive(u,m){return m?(o.directives[u]=m,c):o.directives[u]},mount(u,m,d){if(!l){const g=createVNode(r,s);return g.appContext=o,m&&e?e(g,u):t(g,u,d),l=!0,c._container=u,u.__vue_app__=c,getExposeProxy(g.component)||g.component.proxy}},unmount(){l&&(t(null,c._container),delete c._container.__vue_app__)},provide(u,m){return o.provides[u]=m,c}};return c}}function setRef(t,e,i,r,s=!1){if(isArray$9(t)){t.forEach((g,y)=>setRef(g,e&&(isArray$9(e)?e[y]:e),i,r,s));return}if(isAsyncWrapper(r)&&!s)return;const o=r.shapeFlag&4?getExposeProxy(r.component)||r.component.proxy:r.el,a=s?null:o,{i:l,r:c}=t,u=e&&e.r,m=l.refs===EMPTY_OBJ?l.refs={}:l.refs,d=l.setupState;if(u!=null&&u!==c&&(isString$2(u)?(m[u]=null,hasOwn$2(d,u)&&(d[u]=null)):isRef(u)&&(u.value=null)),isFunction$6(c))callWithErrorHandling(c,l,12,[a,m]);else{const g=isString$2(c),y=isRef(c);if(g||y){const b=()=>{if(t.f){const S=g?hasOwn$2(d,c)?d[c]:m[c]:c.value;s?isArray$9(S)&&remove$7(S,o):isArray$9(S)?S.includes(o)||S.push(o):g?(m[c]=[o],hasOwn$2(d,c)&&(d[c]=m[c])):(c.value=[o],t.k&&(m[t.k]=c.value))}else g?(m[c]=a,hasOwn$2(d,c)&&(d[c]=a)):y&&(c.value=a,t.k&&(m[t.k]=a))};a?(b.id=-1,queuePostRenderEffect(b,i)):b()}}}const queuePostRenderEffect=queueEffectWithSuspense;function createRenderer(t){return baseCreateRenderer(t)}function baseCreateRenderer(t,e){const i=getGlobalThis();i.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:a,createText:l,createComment:c,setText:u,setElementText:m,parentNode:d,nextSibling:g,setScopeId:y=NOOP,insertStaticContent:b}=t,S=(q,ie,B,re=null,ee=null,W=null,Q=!1,K=null,le=!!ie.dynamicChildren)=>{if(q===ie)return;q&&!isSameVNodeType(q,ie)&&(re=pe(q),J(q,ee,W,!0),q=null),ie.patchFlag===-2&&(le=!1,ie.dynamicChildren=null);const{type:oe,ref:ae,shapeFlag:he}=ie;switch(oe){case Text:E(q,ie,B,re);break;case Comment:x(q,ie,B,re);break;case Static:q==null&&A(ie,B,re,Q);break;case Fragment:N(q,ie,B,re,ee,W,Q,K,le);break;default:he&1?T(q,ie,B,re,ee,W,Q,K,le):he&6?z(q,ie,B,re,ee,W,Q,K,le):(he&64||he&128)&&oe.process(q,ie,B,re,ee,W,Q,K,le,be)}ae!=null&&ee&&setRef(ae,q&&q.ref,W,ie||q,!ie)},E=(q,ie,B,re)=>{if(q==null)r(ie.el=l(ie.children),B,re);else{const ee=ie.el=q.el;ie.children!==q.children&&u(ee,ie.children)}},x=(q,ie,B,re)=>{q==null?r(ie.el=c(ie.children||""),B,re):ie.el=q.el},A=(q,ie,B,re)=>{[q.el,q.anchor]=b(q.children,ie,B,re,q.el,q.anchor)},_=({el:q,anchor:ie},B,re)=>{let ee;for(;q&&q!==ie;)ee=g(q),r(q,B,re),q=ee;r(ie,B,re)},P=({el:q,anchor:ie})=>{let B;for(;q&&q!==ie;)B=g(q),s(q),q=B;s(ie)},T=(q,ie,B,re,ee,W,Q,K,le)=>{Q=Q||ie.type==="svg",q==null?M(ie,B,re,ee,W,Q,K,le):D(q,ie,ee,W,Q,K,le)},M=(q,ie,B,re,ee,W,Q,K)=>{let le,oe;const{type:ae,props:he,shapeFlag:me,transition:ye,dirs:fe}=q;if(le=q.el=a(q.type,W,he&&he.is,he),me&8?m(le,q.children):me&16&&I(q.children,le,null,re,ee,W&&ae!=="foreignObject",Q,K),fe&&invokeDirectiveHook(q,null,re,"created"),C(le,q,q.scopeId,Q,re),he){for(const ge in he)ge!=="value"&&!isReservedProp(ge)&&o(le,ge,null,he[ge],W,q.children,re,ee,ce);"value"in he&&o(le,"value",null,he.value),(oe=he.onVnodeBeforeMount)&&invokeVNodeHook(oe,re,q)}fe&&invokeDirectiveHook(q,null,re,"beforeMount");const xe=(!ee||ee&&!ee.pendingBranch)&&ye&&!ye.persisted;xe&&ye.beforeEnter(le),r(le,ie,B),((oe=he&&he.onVnodeMounted)||xe||fe)&&queuePostRenderEffect(()=>{oe&&invokeVNodeHook(oe,re,q),xe&&ye.enter(le),fe&&invokeDirectiveHook(q,null,re,"mounted")},ee)},C=(q,ie,B,re,ee)=>{if(B&&y(q,B),re)for(let W=0;W{for(let oe=le;oe{const K=ie.el=q.el;let{patchFlag:le,dynamicChildren:oe,dirs:ae}=ie;le|=q.patchFlag&16;const he=q.props||EMPTY_OBJ,me=ie.props||EMPTY_OBJ;let ye;B&&toggleRecurse(B,!1),(ye=me.onVnodeBeforeUpdate)&&invokeVNodeHook(ye,B,ie,q),ae&&invokeDirectiveHook(ie,q,B,"beforeUpdate"),B&&toggleRecurse(B,!0);const fe=ee&&ie.type!=="foreignObject";if(oe?G(q.dynamicChildren,oe,K,B,re,fe,W):Q||k(q,ie,K,null,B,re,fe,W,!1),le>0){if(le&16)$(K,ie,he,me,B,re,ee);else if(le&2&&he.class!==me.class&&o(K,"class",null,me.class,ee),le&4&&o(K,"style",he.style,me.style,ee),le&8){const xe=ie.dynamicProps;for(let ge=0;ge{ye&&invokeVNodeHook(ye,B,ie,q),ae&&invokeDirectiveHook(ie,q,B,"updated")},re)},G=(q,ie,B,re,ee,W,Q)=>{for(let K=0;K{if(B!==re){if(B!==EMPTY_OBJ)for(const K in B)!isReservedProp(K)&&!(K in re)&&o(q,K,B[K],null,Q,ie.children,ee,W,ce);for(const K in re){if(isReservedProp(K))continue;const le=re[K],oe=B[K];le!==oe&&K!=="value"&&o(q,K,oe,le,Q,ie.children,ee,W,ce)}"value"in re&&o(q,"value",B.value,re.value)}},N=(q,ie,B,re,ee,W,Q,K,le)=>{const oe=ie.el=q?q.el:l(""),ae=ie.anchor=q?q.anchor:l("");let{patchFlag:he,dynamicChildren:me,slotScopeIds:ye}=ie;ye&&(K=K?K.concat(ye):ye),q==null?(r(oe,B,re),r(ae,B,re),I(ie.children,B,ae,ee,W,Q,K,le)):he>0&&he&64&&me&&q.dynamicChildren?(G(q.dynamicChildren,me,B,ee,W,Q,K),(ie.key!=null||ee&&ie===ee.subTree)&&traverseStaticChildren(q,ie,!0)):k(q,ie,B,ae,ee,W,Q,K,le)},z=(q,ie,B,re,ee,W,Q,K,le)=>{ie.slotScopeIds=K,q==null?ie.shapeFlag&512?ee.ctx.activate(ie,B,re,Q,le):R(ie,B,re,ee,W,Q,le):H(q,ie,le)},R=(q,ie,B,re,ee,W,Q)=>{const K=q.component=createComponentInstance(q,re,ee);if(isKeepAlive(q)&&(K.ctx.renderer=be),setupComponent(K),K.asyncDep){if(ee&&ee.registerDep(K,O),!q.el){const le=K.subTree=createVNode(Comment);x(null,le,ie,B)}return}O(K,q,ie,B,ee,W,Q)},H=(q,ie,B)=>{const re=ie.component=q.component;if(shouldUpdateComponent(q,ie,B))if(re.asyncDep&&!re.asyncResolved){V(re,ie,B);return}else re.next=ie,invalidateJob(re.update),re.update();else ie.el=q.el,re.vnode=ie},O=(q,ie,B,re,ee,W,Q)=>{const K=()=>{if(q.isMounted){let{next:ae,bu:he,u:me,parent:ye,vnode:fe}=q,xe=ae,ge;toggleRecurse(q,!1),ae?(ae.el=fe.el,V(q,ae,Q)):ae=fe,he&&invokeArrayFns(he),(ge=ae.props&&ae.props.onVnodeBeforeUpdate)&&invokeVNodeHook(ge,ye,ae,fe),toggleRecurse(q,!0);const we=renderComponentRoot(q),Ce=q.subTree;q.subTree=we,S(Ce,we,d(Ce.el),pe(Ce),q,ee,W),ae.el=we.el,xe===null&&updateHOCHostEl(q,we.el),me&&queuePostRenderEffect(me,ee),(ge=ae.props&&ae.props.onVnodeUpdated)&&queuePostRenderEffect(()=>invokeVNodeHook(ge,ye,ae,fe),ee)}else{let ae;const{el:he,props:me}=ie,{bm:ye,m:fe,parent:xe}=q,ge=isAsyncWrapper(ie);if(toggleRecurse(q,!1),ye&&invokeArrayFns(ye),!ge&&(ae=me&&me.onVnodeBeforeMount)&&invokeVNodeHook(ae,xe,ie),toggleRecurse(q,!0),he&&Se){const we=()=>{q.subTree=renderComponentRoot(q),Se(he,q.subTree,q,ee,null)};ge?ie.type.__asyncLoader().then(()=>!q.isUnmounted&&we()):we()}else{const we=q.subTree=renderComponentRoot(q);S(null,we,B,re,q,ee,W),ie.el=we.el}if(fe&&queuePostRenderEffect(fe,ee),!ge&&(ae=me&&me.onVnodeMounted)){const we=ie;queuePostRenderEffect(()=>invokeVNodeHook(ae,xe,we),ee)}(ie.shapeFlag&256||xe&&isAsyncWrapper(xe.vnode)&&xe.vnode.shapeFlag&256)&&q.a&&queuePostRenderEffect(q.a,ee),q.isMounted=!0,ie=B=re=null}},le=q.effect=new ReactiveEffect(K,()=>queueJob(oe),q.scope),oe=q.update=()=>le.run();oe.id=q.uid,toggleRecurse(q,!0),oe()},V=(q,ie,B)=>{ie.component=q;const re=q.vnode.props;q.vnode=ie,q.next=null,updateProps(q,ie.props,re,B),updateSlots(q,ie.children,B),pauseTracking(),flushPreFlushCbs(),resetTracking()},k=(q,ie,B,re,ee,W,Q,K,le=!1)=>{const oe=q&&q.children,ae=q?q.shapeFlag:0,he=ie.children,{patchFlag:me,shapeFlag:ye}=ie;if(me>0){if(me&128){Z(oe,he,B,re,ee,W,Q,K,le);return}else if(me&256){F(oe,he,B,re,ee,W,Q,K,le);return}}ye&8?(ae&16&&ce(oe,ee,W),he!==oe&&m(B,he)):ae&16?ye&16?Z(oe,he,B,re,ee,W,Q,K,le):ce(oe,ee,W,!0):(ae&8&&m(B,""),ye&16&&I(he,B,re,ee,W,Q,K,le))},F=(q,ie,B,re,ee,W,Q,K,le)=>{q=q||EMPTY_ARR,ie=ie||EMPTY_ARR;const oe=q.length,ae=ie.length,he=Math.min(oe,ae);let me;for(me=0;meae?ce(q,ee,W,!0,!1,he):I(ie,B,re,ee,W,Q,K,le,he)},Z=(q,ie,B,re,ee,W,Q,K,le)=>{let oe=0;const ae=ie.length;let he=q.length-1,me=ae-1;for(;oe<=he&&oe<=me;){const ye=q[oe],fe=ie[oe]=le?cloneIfMounted(ie[oe]):normalizeVNode(ie[oe]);if(isSameVNodeType(ye,fe))S(ye,fe,B,null,ee,W,Q,K,le);else break;oe++}for(;oe<=he&&oe<=me;){const ye=q[he],fe=ie[me]=le?cloneIfMounted(ie[me]):normalizeVNode(ie[me]);if(isSameVNodeType(ye,fe))S(ye,fe,B,null,ee,W,Q,K,le);else break;he--,me--}if(oe>he){if(oe<=me){const ye=me+1,fe=yeme)for(;oe<=he;)J(q[oe],ee,W,!0),oe++;else{const ye=oe,fe=oe,xe=new Map;for(oe=fe;oe<=me;oe++){const Le=ie[oe]=le?cloneIfMounted(ie[oe]):normalizeVNode(ie[oe]);Le.key!=null&&xe.set(Le.key,oe)}let ge,we=0;const Ce=me-fe+1;let Te=!1,Me=0;const Pe=new Array(Ce);for(oe=0;oe=Ce){J(Le,ee,W,!0);continue}let Be;if(Le.key!=null)Be=xe.get(Le.key);else for(ge=fe;ge<=me;ge++)if(Pe[ge-fe]===0&&isSameVNodeType(Le,ie[ge])){Be=ge;break}Be===void 0?J(Le,ee,W,!0):(Pe[Be-fe]=oe+1,Be>=Me?Me=Be:Te=!0,S(Le,ie[Be],B,null,ee,W,Q,K,le),we++)}const Re=Te?getSequence(Pe):EMPTY_ARR;for(ge=Re.length-1,oe=Ce-1;oe>=0;oe--){const Le=fe+oe,Be=ie[Le],We=Le+1{const{el:W,type:Q,transition:K,children:le,shapeFlag:oe}=q;if(oe&6){U(q.component.subTree,ie,B,re);return}if(oe&128){q.suspense.move(ie,B,re);return}if(oe&64){Q.move(q,ie,B,be);return}if(Q===Fragment){r(W,ie,B);for(let he=0;heK.enter(W),ee);else{const{leave:he,delayLeave:me,afterLeave:ye}=K,fe=()=>r(W,ie,B),xe=()=>{he(W,()=>{fe(),ye&&ye()})};me?me(W,fe,xe):xe()}else r(W,ie,B)},J=(q,ie,B,re=!1,ee=!1)=>{const{type:W,props:Q,ref:K,children:le,dynamicChildren:oe,shapeFlag:ae,patchFlag:he,dirs:me}=q;if(K!=null&&setRef(K,null,B,q,!0),ae&256){ie.ctx.deactivate(q);return}const ye=ae&1&&me,fe=!isAsyncWrapper(q);let xe;if(fe&&(xe=Q&&Q.onVnodeBeforeUnmount)&&invokeVNodeHook(xe,ie,q),ae&6)te(q.component,B,re);else{if(ae&128){q.suspense.unmount(B,re);return}ye&&invokeDirectiveHook(q,null,ie,"beforeUnmount"),ae&64?q.type.remove(q,ie,B,ee,be,re):oe&&(W!==Fragment||he>0&&he&64)?ce(oe,ie,B,!1,!0):(W===Fragment&&he&384||!ee&&ae&16)&&ce(le,ie,B),re&&de(q)}(fe&&(xe=Q&&Q.onVnodeUnmounted)||ye)&&queuePostRenderEffect(()=>{xe&&invokeVNodeHook(xe,ie,q),ye&&invokeDirectiveHook(q,null,ie,"unmounted")},B)},de=q=>{const{type:ie,el:B,anchor:re,transition:ee}=q;if(ie===Fragment){ne(B,re);return}if(ie===Static){P(q);return}const W=()=>{s(B),ee&&!ee.persisted&&ee.afterLeave&&ee.afterLeave()};if(q.shapeFlag&1&&ee&&!ee.persisted){const{leave:Q,delayLeave:K}=ee,le=()=>Q(B,W);K?K(q.el,W,le):le()}else W()},ne=(q,ie)=>{let B;for(;q!==ie;)B=g(q),s(q),q=B;s(ie)},te=(q,ie,B)=>{const{bum:re,scope:ee,update:W,subTree:Q,um:K}=q;re&&invokeArrayFns(re),ee.stop(),W&&(W.active=!1,J(Q,q,ie,B)),K&&queuePostRenderEffect(K,ie),queuePostRenderEffect(()=>{q.isUnmounted=!0},ie),ie&&ie.pendingBranch&&!ie.isUnmounted&&q.asyncDep&&!q.asyncResolved&&q.suspenseId===ie.pendingId&&(ie.deps--,ie.deps===0&&ie.resolve())},ce=(q,ie,B,re=!1,ee=!1,W=0)=>{for(let Q=W;Qq.shapeFlag&6?pe(q.component.subTree):q.shapeFlag&128?q.suspense.next():g(q.anchor||q.el),ue=(q,ie,B)=>{q==null?ie._vnode&&J(ie._vnode,null,null,!0):S(ie._vnode||null,q,ie,null,null,null,B),flushPreFlushCbs(),flushPostFlushCbs(),ie._vnode=q},be={p:S,um:J,m:U,r:de,mt:R,mc:I,pc:k,pbc:G,n:pe,o:t};let Ee,Se;return e&&([Ee,Se]=e(be)),{render:ue,hydrate:Ee,createApp:createAppAPI(ue,Ee)}}function toggleRecurse({effect:t,update:e},i){t.allowRecurse=e.allowRecurse=i}function traverseStaticChildren(t,e,i=!1){const r=t.children,s=e.children;if(isArray$9(r)&&isArray$9(s))for(let o=0;o>1,t[i[l]]0&&(e[r]=i[o-1]),i[o]=r)}}for(o=i.length,a=i[o-1];o-- >0;)i[o]=a,a=e[a];return i}const isTeleport=t=>t.__isTeleport,isTeleportDisabled=t=>t&&(t.disabled||t.disabled===""),isTargetSVG=t=>typeof SVGElement<"u"&&t instanceof SVGElement,resolveTarget=(t,e)=>{const i=t&&t.to;return isString$2(i)?e?e(i):null:i},TeleportImpl={__isTeleport:!0,process(t,e,i,r,s,o,a,l,c,u){const{mc:m,pc:d,pbc:g,o:{insert:y,querySelector:b,createText:S,createComment:E}}=u,x=isTeleportDisabled(e.props);let{shapeFlag:A,children:_,dynamicChildren:P}=e;if(t==null){const T=e.el=S(""),M=e.anchor=S("");y(T,i,r),y(M,i,r);const C=e.target=resolveTarget(e.props,b),I=e.targetAnchor=S("");C&&(y(I,C),a=a||isTargetSVG(C));const D=(G,$)=>{A&16&&m(_,G,$,s,o,a,l,c)};x?D(i,M):C&&D(C,I)}else{e.el=t.el;const T=e.anchor=t.anchor,M=e.target=t.target,C=e.targetAnchor=t.targetAnchor,I=isTeleportDisabled(t.props),D=I?i:M,G=I?T:C;if(a=a||isTargetSVG(M),P?(g(t.dynamicChildren,P,D,s,o,a,l),traverseStaticChildren(t,e,!0)):c||d(t,e,D,G,s,o,a,l,!1),x)I||moveTeleport(e,i,T,u,1);else if((e.props&&e.props.to)!==(t.props&&t.props.to)){const $=e.target=resolveTarget(e.props,b);$&&moveTeleport(e,$,null,u,0)}else I&&moveTeleport(e,M,C,u,1)}updateCssVars(e)},remove(t,e,i,r,{um:s,o:{remove:o}},a){const{shapeFlag:l,children:c,anchor:u,targetAnchor:m,target:d,props:g}=t;if(d&&o(m),(a||!isTeleportDisabled(g))&&(o(u),l&16))for(let y=0;y0?currentBlock||EMPTY_ARR:null,closeBlock(),isBlockTreeEnabled>0&¤tBlock&¤tBlock.push(t),t}function createElementBlock(t,e,i,r,s,o){return setupBlock(createBaseVNode(t,e,i,r,s,o,!0))}function createBlock(t,e,i,r,s){return setupBlock(createVNode(t,e,i,r,s,!0))}function isVNode(t){return t?t.__v_isVNode===!0:!1}function isSameVNodeType(t,e){return t.type===e.type&&t.key===e.key}const InternalObjectKey="__vInternal",normalizeKey=({key:t})=>t!=null?t:null,normalizeRef=({ref:t,ref_key:e,ref_for:i})=>t!=null?isString$2(t)||isRef(t)||isFunction$6(t)?{i:currentRenderingInstance,r:t,k:e,f:!!i}:t:null;function createBaseVNode(t,e=null,i=null,r=0,s=null,o=t===Fragment?0:1,a=!1,l=!1){const c={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&normalizeKey(e),ref:e&&normalizeRef(e),scopeId:currentScopeId,slotScopeIds:null,children:i,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:currentRenderingInstance};return l?(normalizeChildren(c,i),o&128&&t.normalize(c)):i&&(c.shapeFlag|=isString$2(i)?8:16),isBlockTreeEnabled>0&&!a&¤tBlock&&(c.patchFlag>0||o&6)&&c.patchFlag!==32&¤tBlock.push(c),c}const createVNode=_createVNode;function _createVNode(t,e=null,i=null,r=0,s=null,o=!1){if((!t||t===NULL_DYNAMIC_COMPONENT)&&(t=Comment),isVNode(t)){const l=cloneVNode(t,e,!0);return i&&normalizeChildren(l,i),isBlockTreeEnabled>0&&!o&¤tBlock&&(l.shapeFlag&6?currentBlock[currentBlock.indexOf(t)]=l:currentBlock.push(l)),l.patchFlag|=-2,l}if(isClassComponent(t)&&(t=t.__vccOpts),e){e=guardReactiveProps(e);let{class:l,style:c}=e;l&&!isString$2(l)&&(e.class=normalizeClass(l)),isObject$5(c)&&(isProxy(c)&&!isArray$9(c)&&(c=extend$3({},c)),e.style=normalizeStyle(c))}const a=isString$2(t)?1:isSuspense(t)?128:isTeleport(t)?64:isObject$5(t)?4:isFunction$6(t)?2:0;return createBaseVNode(t,e,i,r,s,a,o,!0)}function guardReactiveProps(t){return t?isProxy(t)||InternalObjectKey in t?extend$3({},t):t:null}function cloneVNode(t,e,i=!1){const{props:r,ref:s,patchFlag:o,children:a}=t,l=e?mergeProps(r||{},e):r;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:l,key:l&&normalizeKey(l),ref:e&&e.ref?i&&s?isArray$9(s)?s.concat(normalizeRef(e)):[s,normalizeRef(e)]:normalizeRef(e):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Fragment?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&cloneVNode(t.ssContent),ssFallback:t.ssFallback&&cloneVNode(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce}}function createTextVNode(t=" ",e=0){return createVNode(Text,null,t,e)}function createCommentVNode(t="",e=!1){return e?(openBlock(),createBlock(Comment,null,t)):createVNode(Comment,null,t)}function normalizeVNode(t){return t==null||typeof t=="boolean"?createVNode(Comment):isArray$9(t)?createVNode(Fragment,null,t.slice()):typeof t=="object"?cloneIfMounted(t):createVNode(Text,null,String(t))}function cloneIfMounted(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:cloneVNode(t)}function normalizeChildren(t,e){let i=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(isArray$9(e))i=16;else if(typeof e=="object")if(r&65){const s=e.default;s&&(s._c&&(s._d=!1),normalizeChildren(t,s()),s._c&&(s._d=!0));return}else{i=32;const s=e._;!s&&!(InternalObjectKey in e)?e._ctx=currentRenderingInstance:s===3&¤tRenderingInstance&&(currentRenderingInstance.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else isFunction$6(e)?(e={default:e,_ctx:currentRenderingInstance},i=32):(e=String(e),r&64?(i=16,e=[createTextVNode(e)]):i=8);t.children=e,t.shapeFlag|=i}function mergeProps(...t){const e={};for(let i=0;icurrentInstance||currentRenderingInstance,setCurrentInstance=t=>{currentInstance=t,t.scope.on()},unsetCurrentInstance=()=>{currentInstance&¤tInstance.scope.off(),currentInstance=null};function isStatefulComponent(t){return t.vnode.shapeFlag&4}let isInSSRComponentSetup=!1;function setupComponent(t,e=!1){isInSSRComponentSetup=e;const{props:i,children:r}=t.vnode,s=isStatefulComponent(t);initProps(t,i,s,e),initSlots(t,r);const o=s?setupStatefulComponent(t,e):void 0;return isInSSRComponentSetup=!1,o}function setupStatefulComponent(t,e){const i=t.type;t.accessCache=Object.create(null),t.proxy=markRaw(new Proxy(t.ctx,PublicInstanceProxyHandlers));const{setup:r}=i;if(r){const s=t.setupContext=r.length>1?createSetupContext(t):null;setCurrentInstance(t),pauseTracking();const o=callWithErrorHandling(r,t,0,[t.props,s]);if(resetTracking(),unsetCurrentInstance(),isPromise$1(o)){if(o.then(unsetCurrentInstance,unsetCurrentInstance),e)return o.then(a=>{handleSetupResult(t,a,e)}).catch(a=>{handleError(a,t,0)});t.asyncDep=o}else handleSetupResult(t,o,e)}else finishComponentSetup(t,e)}function handleSetupResult(t,e,i){isFunction$6(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:isObject$5(e)&&(t.setupState=proxyRefs(e)),finishComponentSetup(t,i)}let compile$1;function finishComponentSetup(t,e,i){const r=t.type;if(!t.render){if(!e&&compile$1&&!r.render){const s=r.template||resolveMergedOptions(t).template;if(s){const{isCustomElement:o,compilerOptions:a}=t.appContext.config,{delimiters:l,compilerOptions:c}=r,u=extend$3(extend$3({isCustomElement:o,delimiters:l},a),c);r.render=compile$1(s,u)}}t.render=r.render||NOOP}setCurrentInstance(t),pauseTracking(),applyOptions(t),resetTracking(),unsetCurrentInstance()}function createAttrsProxy(t){return new Proxy(t.attrs,{get(e,i){return track(t,"get","$attrs"),e[i]}})}function createSetupContext(t){const e=r=>{t.exposed=r||{}};let i;return{get attrs(){return i||(i=createAttrsProxy(t))},slots:t.slots,emit:t.emit,expose:e}}function getExposeProxy(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy(proxyRefs(markRaw(t.exposed)),{get(e,i){if(i in e)return e[i];if(i in publicPropertiesMap)return publicPropertiesMap[i](t)},has(e,i){return i in e||i in publicPropertiesMap}}))}function getComponentName(t,e=!0){return isFunction$6(t)?t.displayName||t.name:t.name||e&&t.__name}function isClassComponent(t){return isFunction$6(t)&&"__vccOpts"in t}const computed=(t,e)=>computed$1(t,e,isInSSRComponentSetup);function h$1(t,e,i){const r=arguments.length;return r===2?isObject$5(e)&&!isArray$9(e)?isVNode(e)?createVNode(t,null,[e]):createVNode(t,e):createVNode(t,null,e):(r>3?i=Array.prototype.slice.call(arguments,2):r===3&&isVNode(i)&&(i=[i]),createVNode(t,e,i))}const ssrContextKey=Symbol(""),useSSRContext=()=>inject(ssrContextKey),version="3.2.47",svgNS="http://www.w3.org/2000/svg",doc$2=typeof document<"u"?document:null,templateContainer=doc$2&&doc$2.createElement("template"),nodeOps={insert:(t,e,i)=>{e.insertBefore(t,i||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,i,r)=>{const s=e?doc$2.createElementNS(svgNS,t):doc$2.createElement(t,i?{is:i}:void 0);return t==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:t=>doc$2.createTextNode(t),createComment:t=>doc$2.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>doc$2.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,i,r,s,o){const a=i?i.previousSibling:e.lastChild;if(s&&(s===o||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),i),!(s===o||!(s=s.nextSibling)););else{templateContainer.innerHTML=r?`${t}`:t;const l=templateContainer.content;if(r){const c=l.firstChild;for(;c.firstChild;)l.appendChild(c.firstChild);l.removeChild(c)}e.insertBefore(l,i)}return[a?a.nextSibling:e.firstChild,i?i.previousSibling:e.lastChild]}};function patchClass(t,e,i){const r=t._vtc;r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):i?t.setAttribute("class",e):t.className=e}function patchStyle(t,e,i){const r=t.style,s=isString$2(i);if(i&&!s){if(e&&!isString$2(e))for(const o in e)i[o]==null&&setStyle(r,o,"");for(const o in i)setStyle(r,o,i[o])}else{const o=r.display;s?e!==i&&(r.cssText=i):e&&t.removeAttribute("style"),"_vod"in t&&(r.display=o)}}const importantRE=/\s*!important$/;function setStyle(t,e,i){if(isArray$9(i))i.forEach(r=>setStyle(t,e,r));else if(i==null&&(i=""),e.startsWith("--"))t.setProperty(e,i);else{const r=autoPrefix(t,e);importantRE.test(i)?t.setProperty(hyphenate(r),i.replace(importantRE,""),"important"):t[r]=i}}const prefixes=["Webkit","Moz","ms"],prefixCache={};function autoPrefix(t,e){const i=prefixCache[e];if(i)return i;let r=camelize$2(e);if(r!=="filter"&&r in t)return prefixCache[e]=r;r=capitalize(r);for(let s=0;scachedNow||(p.then(()=>cachedNow=0),cachedNow=Date.now());function createInvoker(t,e){const i=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=i.attached)return;callWithAsyncErrorHandling(patchStopImmediatePropagation(r,i.value),e,5,[r])};return i.value=t,i.attached=getNow(),i}function patchStopImmediatePropagation(t,e){if(isArray$9(e)){const i=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{i.call(t),t._stopped=!0},e.map(r=>s=>!s._stopped&&r&&r(s))}else return e}const nativeOnRE=/^on[a-z]/,patchProp=(t,e,i,r,s=!1,o,a,l,c)=>{e==="class"?patchClass(t,r,s):e==="style"?patchStyle(t,i,r):isOn(e)?isModelListener(e)||patchEvent(t,e,i,r,a):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):shouldSetAsProp(t,e,r,s))?patchDOMProp(t,e,r,o,a,l,c):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),patchAttr(t,e,r,s))};function shouldSetAsProp(t,e,i,r){return r?!!(e==="innerHTML"||e==="textContent"||e in t&&nativeOnRE.test(e)&&isFunction$6(i)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA"||nativeOnRE.test(e)&&isString$2(i)?!1:e in t}const TRANSITION="transition",ANIMATION="animation",Transition=(t,{slots:e})=>h$1(BaseTransition,resolveTransitionProps(t),e);Transition.displayName="Transition";const 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=(t,e=[])=>{isArray$9(t)?t.forEach(i=>i(...e)):t&&t(...e)},hasExplicitCallback=t=>t?isArray$9(t)?t.some(e=>e.length>1):t.length>1:!1;function resolveTransitionProps(t){const e={};for(const N in t)N in DOMTransitionPropsValidators||(e[N]=t[N]);if(t.css===!1)return e;const{name:i="v",type:r,duration:s,enterFromClass:o=`${i}-enter-from`,enterActiveClass:a=`${i}-enter-active`,enterToClass:l=`${i}-enter-to`,appearFromClass:c=o,appearActiveClass:u=a,appearToClass:m=l,leaveFromClass:d=`${i}-leave-from`,leaveActiveClass:g=`${i}-leave-active`,leaveToClass:y=`${i}-leave-to`}=t,b=normalizeDuration(s),S=b&&b[0],E=b&&b[1],{onBeforeEnter:x,onEnter:A,onEnterCancelled:_,onLeave:P,onLeaveCancelled:T,onBeforeAppear:M=x,onAppear:C=A,onAppearCancelled:I=_}=e,D=(N,z,R)=>{removeTransitionClass(N,z?m:l),removeTransitionClass(N,z?u:a),R&&R()},G=(N,z)=>{N._isLeaving=!1,removeTransitionClass(N,d),removeTransitionClass(N,y),removeTransitionClass(N,g),z&&z()},$=N=>(z,R)=>{const H=N?C:A,O=()=>D(z,N,R);callHook(H,[z,O]),nextFrame(()=>{removeTransitionClass(z,N?c:o),addTransitionClass(z,N?m:l),hasExplicitCallback(H)||whenTransitionEnds(z,r,S,O)})};return extend$3(e,{onBeforeEnter(N){callHook(x,[N]),addTransitionClass(N,o),addTransitionClass(N,a)},onBeforeAppear(N){callHook(M,[N]),addTransitionClass(N,c),addTransitionClass(N,u)},onEnter:$(!1),onAppear:$(!0),onLeave(N,z){N._isLeaving=!0;const R=()=>G(N,z);addTransitionClass(N,d),forceReflow(),addTransitionClass(N,g),nextFrame(()=>{N._isLeaving&&(removeTransitionClass(N,d),addTransitionClass(N,y),hasExplicitCallback(P)||whenTransitionEnds(N,r,E,R))}),callHook(P,[N,R])},onEnterCancelled(N){D(N,!1),callHook(_,[N])},onAppearCancelled(N){D(N,!0),callHook(I,[N])},onLeaveCancelled(N){G(N),callHook(T,[N])}})}function normalizeDuration(t){if(t==null)return null;if(isObject$5(t))return[NumberOf(t.enter),NumberOf(t.leave)];{const e=NumberOf(t);return[e,e]}}function NumberOf(t){return toNumber$1(t)}function addTransitionClass(t,e){e.split(/\s+/).forEach(i=>i&&t.classList.add(i)),(t._vtc||(t._vtc=new Set)).add(e)}function removeTransitionClass(t,e){e.split(/\s+/).forEach(r=>r&&t.classList.remove(r));const{_vtc:i}=t;i&&(i.delete(e),i.size||(t._vtc=void 0))}function nextFrame(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let endId=0;function whenTransitionEnds(t,e,i,r){const s=t._endId=++endId,o=()=>{s===t._endId&&r()};if(i)return setTimeout(o,i);const{type:a,timeout:l,propCount:c}=getTransitionInfo(t,e);if(!a)return r();const u=a+"end";let m=0;const d=()=>{t.removeEventListener(u,g),o()},g=y=>{y.target===t&&++m>=c&&d()};setTimeout(()=>{m(i[b]||"").split(", "),s=r(`${TRANSITION}Delay`),o=r(`${TRANSITION}Duration`),a=getTimeout(s,o),l=r(`${ANIMATION}Delay`),c=r(`${ANIMATION}Duration`),u=getTimeout(l,c);let m=null,d=0,g=0;e===TRANSITION?a>0&&(m=TRANSITION,d=a,g=o.length):e===ANIMATION?u>0&&(m=ANIMATION,d=u,g=c.length):(d=Math.max(a,u),m=d>0?a>u?TRANSITION:ANIMATION:null,g=m?m===TRANSITION?o.length:c.length:0);const y=m===TRANSITION&&/\b(transform|all)(,|$)/.test(r(`${TRANSITION}Property`).toString());return{type:m,timeout:d,propCount:g,hasTransform:y}}function getTimeout(t,e){for(;t.lengthtoMs(i)+toMs(t[r])))}function toMs(t){return Number(t.slice(0,-1).replace(",","."))*1e3}function forceReflow(){return document.body.offsetHeight}const positionMap=new WeakMap,newPositionMap=new WeakMap,TransitionGroupImpl={name:"TransitionGroup",props:extend$3({},TransitionPropsValidators,{tag:String,moveClass:String}),setup(t,{slots:e}){const i=getCurrentInstance(),r=useTransitionState();let s,o;return onUpdated(()=>{if(!s.length)return;const a=t.moveClass||`${t.name||"v"}-move`;if(!hasCSSTransform(s[0].el,i.vnode.el,a))return;s.forEach(callPendingCbs),s.forEach(recordPosition);const l=s.filter(applyTranslation);forceReflow(),l.forEach(c=>{const u=c.el,m=u.style;addTransitionClass(u,a),m.transform=m.webkitTransform=m.transitionDuration="";const d=u._moveCb=g=>{g&&g.target!==u||(!g||/transform$/.test(g.propertyName))&&(u.removeEventListener("transitionend",d),u._moveCb=null,removeTransitionClass(u,a))};u.addEventListener("transitionend",d)})}),()=>{const a=toRaw(t),l=resolveTransitionProps(a);let c=a.tag||Fragment;s=o,o=e.default?getTransitionRawChildren(e.default()):[];for(let u=0;udelete t.mode;TransitionGroupImpl.props;const TransitionGroup=TransitionGroupImpl;function callPendingCbs(t){const e=t.el;e._moveCb&&e._moveCb(),e._enterCb&&e._enterCb()}function recordPosition(t){newPositionMap.set(t,t.el.getBoundingClientRect())}function applyTranslation(t){const e=positionMap.get(t),i=newPositionMap.get(t),r=e.left-i.left,s=e.top-i.top;if(r||s){const o=t.el.style;return o.transform=o.webkitTransform=`translate(${r}px,${s}px)`,o.transitionDuration="0s",t}}function hasCSSTransform(t,e,i){const r=t.cloneNode();t._vtc&&t._vtc.forEach(a=>{a.split(/\s+/).forEach(l=>l&&r.classList.remove(l))}),i.split(/\s+/).forEach(a=>a&&r.classList.add(a)),r.style.display="none";const s=e.nodeType===1?e:e.parentNode;s.appendChild(r);const{hasTransform:o}=getTransitionInfo(r);return s.removeChild(r),o}const keyNames={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},withKeys=(t,e)=>i=>{if(!("key"in i))return;const r=hyphenate(i.key);if(e.some(s=>s===r||keyNames[s]===r))return t(i)},vShow={beforeMount(t,{value:e},{transition:i}){t._vod=t.style.display==="none"?"":t.style.display,i&&e?i.beforeEnter(t):setDisplay(t,e)},mounted(t,{value:e},{transition:i}){i&&e&&i.enter(t)},updated(t,{value:e,oldValue:i},{transition:r}){!e!=!i&&(r?e?(r.beforeEnter(t),setDisplay(t,!0),r.enter(t)):r.leave(t,()=>{setDisplay(t,!1)}):setDisplay(t,e))},beforeUnmount(t,{value:e}){setDisplay(t,e)}};function setDisplay(t,e){t.style.display=e?t._vod:"none"}const rendererOptions=extend$3({patchProp},nodeOps);let renderer;function ensureRenderer(){return renderer||(renderer=createRenderer(rendererOptions))}const createApp=(...t)=>{const e=ensureRenderer().createApp(...t),{mount:i}=e;return e.mount=r=>{const s=normalizeContainer(r);if(!s)return;const o=e._component;!isFunction$6(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.innerHTML="";const a=i(s,!1,s instanceof SVGElement);return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),a},e};function normalizeContainer(t){return isString$2(t)?document.querySelector(t):t}/*! * vue-router v4.1.6 * (c) 2022 Eduardo San Martin Morote * @license MIT */const isBrowser=typeof window<"u";function isESModule(t){return t.__esModule||t[Symbol.toStringTag]==="Module"}const assign$2=Object.assign;function applyToParams(t,e){const i={};for(const r in e){const s=e[r];i[r]=isArray$8(s)?s.map(t):t(s)}return i}const noop$2=()=>{},isArray$8=Array.isArray,TRAILING_SLASH_RE=/\/$/,removeTrailingSlash=t=>t.replace(TRAILING_SLASH_RE,"");function parseURL(t,e,i="/"){let r,s={},o="",a="";const l=e.indexOf("#");let c=e.indexOf("?");return l=0&&(c=-1),c>-1&&(r=e.slice(0,c),o=e.slice(c+1,l>-1?l:e.length),s=t(o)),l>-1&&(r=r||e.slice(0,l),a=e.slice(l,e.length)),r=resolveRelativePath(r!=null?r:e,i),{fullPath:r+(o&&"?")+o+a,path:r,query:s,hash:a}}function stringifyURL(t,e){const i=e.query?t(e.query):"";return e.path+(i&&"?")+i+(e.hash||"")}function stripBase(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function isSameRouteLocation(t,e,i){const r=e.matched.length-1,s=i.matched.length-1;return r>-1&&r===s&&isSameRouteRecord(e.matched[r],i.matched[s])&&isSameRouteLocationParams(e.params,i.params)&&t(e.query)===t(i.query)&&e.hash===i.hash}function isSameRouteRecord(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function isSameRouteLocationParams(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t)if(!isSameRouteLocationParamsValue(t[i],e[i]))return!1;return!0}function isSameRouteLocationParamsValue(t,e){return isArray$8(t)?isEquivalentArray(t,e):isArray$8(e)?isEquivalentArray(e,t):t===e}function isEquivalentArray(t,e){return isArray$8(e)?t.length===e.length&&t.every((i,r)=>i===e[r]):t.length===1&&t[0]===e}function resolveRelativePath(t,e){if(t.startsWith("/"))return t;if(!t)return e;const i=e.split("/"),r=t.split("/");let s=i.length-1,o,a;for(o=0;o1&&s--;else break;return i.slice(0,s).join("/")+"/"+r.slice(o-(o===r.length?1:0)).join("/")}var NavigationType;(function(t){t.pop="pop",t.push="push"})(NavigationType||(NavigationType={}));var NavigationDirection;(function(t){t.back="back",t.forward="forward",t.unknown=""})(NavigationDirection||(NavigationDirection={}));function normalizeBase(t){if(!t)if(isBrowser){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),removeTrailingSlash(t)}const BEFORE_HASH_RE=/^[^#]+#/;function createHref(t,e){return t.replace(BEFORE_HASH_RE,"#")+e}function getElementPosition(t,e){const i=document.documentElement.getBoundingClientRect(),r=t.getBoundingClientRect();return{behavior:e.behavior,left:r.left-i.left-(e.left||0),top:r.top-i.top-(e.top||0)}}const computeScrollPosition=()=>({left:window.pageXOffset,top:window.pageYOffset});function scrollToPosition(t){let e;if("el"in t){const i=t.el,r=typeof i=="string"&&i.startsWith("#"),s=typeof i=="string"?r?document.getElementById(i.slice(1)):document.querySelector(i):i;if(!s)return;e=getElementPosition(s,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.pageXOffset,e.top!=null?e.top:window.pageYOffset)}function getScrollKey(t,e){return(history.state?history.state.position-e:-1)+t}const scrollPositions=new Map;function saveScrollPosition(t,e){scrollPositions.set(t,e)}function getSavedScrollPosition(t){const e=scrollPositions.get(t);return scrollPositions.delete(t),e}let createBaseLocation=()=>location.protocol+"//"+location.host;function createCurrentLocation(t,e){const{pathname:i,search:r,hash:s}=e,o=t.indexOf("#");if(o>-1){let l=s.includes(t.slice(o))?t.slice(o).length:1,c=s.slice(l);return c[0]!=="/"&&(c="/"+c),stripBase(c,"")}return stripBase(i,t)+r+s}function useHistoryListeners(t,e,i,r){let s=[],o=[],a=null;const l=({state:g})=>{const y=createCurrentLocation(t,location),b=i.value,S=e.value;let E=0;if(g){if(i.value=y,e.value=g,a&&a===b){a=null;return}E=S?g.position-S.position:0}else r(y);s.forEach(x=>{x(i.value,b,{delta:E,type:NavigationType.pop,direction:E?E>0?NavigationDirection.forward:NavigationDirection.back:NavigationDirection.unknown})})};function c(){a=i.value}function u(g){s.push(g);const y=()=>{const b=s.indexOf(g);b>-1&&s.splice(b,1)};return o.push(y),y}function m(){const{history:g}=window;g.state&&g.replaceState(assign$2({},g.state,{scroll:computeScrollPosition()}),"")}function d(){for(const g of o)g();o=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",m)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",m),{pauseListeners:c,listen:u,destroy:d}}function buildState(t,e,i,r=!1,s=!1){return{back:t,current:e,forward:i,replaced:r,position:window.history.length,scroll:s?computeScrollPosition():null}}function useHistoryStateNavigation(t){const{history:e,location:i}=window,r={value:createCurrentLocation(t,i)},s={value:e.state};s.value||o(r.value,{back:null,current:r.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function o(c,u,m){const d=t.indexOf("#"),g=d>-1?(i.host&&document.querySelector("base")?t:t.slice(d))+c:createBaseLocation()+t+c;try{e[m?"replaceState":"pushState"](u,"",g),s.value=u}catch(y){console.error(y),i[m?"replace":"assign"](g)}}function a(c,u){const m=assign$2({},e.state,buildState(s.value.back,c,s.value.forward,!0),u,{position:s.value.position});o(c,m,!0),r.value=c}function l(c,u){const m=assign$2({},s.value,e.state,{forward:c,scroll:computeScrollPosition()});o(m.current,m,!0);const d=assign$2({},buildState(r.value,c,null),{position:m.position+1},u);o(c,d,!1),r.value=c}return{location:r,state:s,push:l,replace:a}}function createWebHistory(t){t=normalizeBase(t);const e=useHistoryStateNavigation(t),i=useHistoryListeners(t,e.state,e.location,e.replace);function r(o,a=!0){a||i.pauseListeners(),history.go(o)}const s=assign$2({location:"",base:t,go:r,createHref:createHref.bind(null,t)},e,i);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>e.state.value}),s}function createWebHashHistory(t){return t=location.host?t||location.pathname+location.search:"",t.includes("#")||(t+="#"),createWebHistory(t)}function isRouteLocation(t){return typeof t=="string"||t&&typeof t=="object"}function isRouteName(t){return typeof t=="string"||typeof t=="symbol"}const START_LOCATION_NORMALIZED={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},NavigationFailureSymbol=Symbol("");var NavigationFailureType;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(NavigationFailureType||(NavigationFailureType={}));function createRouterError(t,e){return assign$2(new Error,{type:t,[NavigationFailureSymbol]:!0},e)}function isNavigationFailure(t,e){return t instanceof Error&&NavigationFailureSymbol in t&&(e==null||!!(t.type&e))}const BASE_PARAM_PATTERN="[^/]+?",BASE_PATH_PARSER_OPTIONS={sensitive:!1,strict:!1,start:!0,end:!0},REGEX_CHARS_RE=/[.+*?^${}()[\]/\\]/g;function tokensToParser(t,e){const i=assign$2({},BASE_PATH_PARSER_OPTIONS,e),r=[];let s=i.start?"^":"";const o=[];for(const u of t){const m=u.length?[]:[90];i.strict&&!u.length&&(s+="/");for(let d=0;de.length?e.length===1&&e[0]===40+40?1:-1:0}function comparePathParserScore(t,e){let i=0;const r=t.score,s=e.score;for(;i0&&e[e.length-1]<0}const ROOT_TOKEN={type:0,value:""},VALID_PARAM_RE=/[a-zA-Z0-9_]/;function tokenizePath(t){if(!t)return[[]];if(t==="/")return[[ROOT_TOKEN]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(y){throw new Error(`ERR (${i})/"${u}": ${y}`)}let i=0,r=i;const s=[];let o;function a(){o&&s.push(o),o=[]}let l=0,c,u="",m="";function d(){u&&(i===0?o.push({type:0,value:u}):i===1||i===2||i===3?(o.length>1&&(c==="*"||c==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),o.push({type:1,value:u,regexp:m,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):e("Invalid state to consume buffer"),u="")}function g(){u+=c}for(;l{a(A)}:noop$2}function a(m){if(isRouteName(m)){const d=r.get(m);d&&(r.delete(m),i.splice(i.indexOf(d),1),d.children.forEach(a),d.alias.forEach(a))}else{const d=i.indexOf(m);d>-1&&(i.splice(d,1),m.record.name&&r.delete(m.record.name),m.children.forEach(a),m.alias.forEach(a))}}function l(){return i}function c(m){let d=0;for(;d=0&&(m.record.path!==i[d].record.path||!isRecordChildOf(m,i[d]));)d++;i.splice(d,0,m),m.record.name&&!isAliasRecord(m)&&r.set(m.record.name,m)}function u(m,d){let g,y={},b,S;if("name"in m&&m.name){if(g=r.get(m.name),!g)throw createRouterError(1,{location:m});S=g.record.name,y=assign$2(paramsFromLocation(d.params,g.keys.filter(A=>!A.optional).map(A=>A.name)),m.params&¶msFromLocation(m.params,g.keys.map(A=>A.name))),b=g.stringify(y)}else if("path"in m)b=m.path,g=i.find(A=>A.re.test(b)),g&&(y=g.parse(b),S=g.record.name);else{if(g=d.name?r.get(d.name):i.find(A=>A.re.test(d.path)),!g)throw createRouterError(1,{location:m,currentLocation:d});S=g.record.name,y=assign$2({},d.params,m.params),b=g.stringify(y)}const E=[];let x=g;for(;x;)E.unshift(x.record),x=x.parent;return{name:S,path:b,params:y,matched:E,meta:mergeMetaFields(E)}}return t.forEach(m=>o(m)),{addRoute:o,resolve:u,removeRoute:a,getRoutes:l,getRecordMatcher:s}}function paramsFromLocation(t,e){const i={};for(const r of e)r in t&&(i[r]=t[r]);return i}function normalizeRouteRecord(t){return{path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:void 0,beforeEnter:t.beforeEnter,props:normalizeRecordProps(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}}}function normalizeRecordProps(t){const e={},i=t.props||!1;if("component"in t)e.default=i;else for(const r in t.components)e[r]=typeof i=="boolean"?i:i[r];return e}function isAliasRecord(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function mergeMetaFields(t){return t.reduce((e,i)=>assign$2(e,i.meta),{})}function mergeOptions(t,e){const i={};for(const r in t)i[r]=r in e?e[r]:t[r];return i}function isRecordChildOf(t,e){return e.children.some(i=>i===t||isRecordChildOf(t,i))}const 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(t){return encodeURI(""+t).replace(ENC_PIPE_RE,"|").replace(ENC_BRACKET_OPEN_RE,"[").replace(ENC_BRACKET_CLOSE_RE,"]")}function encodeHash(t){return commonEncode(t).replace(ENC_CURLY_OPEN_RE,"{").replace(ENC_CURLY_CLOSE_RE,"}").replace(ENC_CARET_RE,"^")}function encodeQueryValue(t){return commonEncode(t).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(t){return encodeQueryValue(t).replace(EQUAL_RE,"%3D")}function encodePath(t){return commonEncode(t).replace(HASH_RE,"%23").replace(IM_RE,"%3F")}function encodeParam(t){return t==null?"":encodePath(t).replace(SLASH_RE,"%2F")}function decode$5(t){try{return decodeURIComponent(""+t)}catch(e){}return""+t}function parseQuery(t){const e={};if(t===""||t==="?")return e;const r=(t[0]==="?"?t.slice(1):t).split("&");for(let s=0;so&&encodeQueryValue(o)):[r&&encodeQueryValue(r)]).forEach(o=>{o!==void 0&&(e+=(e.length?"&":"")+i,o!=null&&(e+="="+o))})}return e}function normalizeQuery(t){const e={};for(const i in t){const r=t[i];r!==void 0&&(e[i]=isArray$8(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return e}const matchedRouteKey=Symbol(""),viewDepthKey=Symbol(""),routerKey=Symbol(""),routeLocationKey=Symbol(""),routerViewLocationKey=Symbol("");function useCallbacks(){let t=[];function e(r){return t.push(r),()=>{const s=t.indexOf(r);s>-1&&t.splice(s,1)}}function i(){t=[]}return{add:e,list:()=>t,reset:i}}function guardToPromiseFn(t,e,i,r,s){const o=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(createRouterError(4,{from:i,to:e})):d instanceof Error?l(d):isRouteLocation(d)?l(createRouterError(2,{from:e,to:d})):(o&&r.enterCallbacks[s]===o&&typeof d=="function"&&o.push(d),a())},u=t.call(r&&r.instances[s],e,i,c);let m=Promise.resolve(u);t.length<3&&(m=m.then(c)),m.catch(d=>l(d))})}function extractComponentsGuards(t,e,i,r){const s=[];for(const o of t)for(const a in o.components){let l=o.components[a];if(!(e!=="beforeRouteEnter"&&!o.instances[a]))if(isRouteComponent(l)){const u=(l.__vccOpts||l)[e];u&&s.push(guardToPromiseFn(u,i,r,o,a))}else{let c=l();s.push(()=>c.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${a}" at "${o.path}"`));const m=isESModule(u)?u.default:u;o.components[a]=m;const g=(m.__vccOpts||m)[e];return g&&guardToPromiseFn(g,i,r,o,a)()}))}}return s}function isRouteComponent(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function useLink(t){const e=inject(routerKey),i=inject(routeLocationKey),r=computed(()=>e.resolve(unref(t.to))),s=computed(()=>{const{matched:c}=r.value,{length:u}=c,m=c[u-1],d=i.matched;if(!m||!d.length)return-1;const g=d.findIndex(isSameRouteRecord.bind(null,m));if(g>-1)return g;const y=getOriginalPath(c[u-2]);return u>1&&getOriginalPath(m)===y&&d[d.length-1].path!==y?d.findIndex(isSameRouteRecord.bind(null,c[u-2])):g}),o=computed(()=>s.value>-1&&includesParams(i.params,r.value.params)),a=computed(()=>s.value>-1&&s.value===i.matched.length-1&&isSameRouteLocationParams(i.params,r.value.params));function l(c={}){return guardEvent(c)?e[unref(t.replace)?"replace":"push"](unref(t.to)).catch(noop$2):Promise.resolve()}return{route:r,href:computed(()=>r.value.href),isActive:o,isExactActive:a,navigate:l}}const 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,setup(t,{slots:e}){const i=reactive(useLink(t)),{options:r}=inject(routerKey),s=computed(()=>({[getLinkClass(t.activeClass,r.linkActiveClass,"router-link-active")]:i.isActive,[getLinkClass(t.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:i.isExactActive}));return()=>{const o=e.default&&e.default(i);return t.custom?o:h$1("a",{"aria-current":i.isExactActive?t.ariaCurrentValue:null,href:i.href,onClick:i.navigate,class:s.value},o)}}}),RouterLink=RouterLinkImpl;function guardEvent(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function includesParams(t,e){for(const i in e){const r=e[i],s=t[i];if(typeof r=="string"){if(r!==s)return!1}else if(!isArray$8(s)||s.length!==r.length||r.some((o,a)=>o!==s[a]))return!1}return!0}function getOriginalPath(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const getLinkClass=(t,e,i)=>t!=null?t:e!=null?e:i,RouterViewImpl=defineComponent({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:i}){const r=inject(routerViewLocationKey),s=computed(()=>t.route||r.value),o=inject(viewDepthKey,0),a=computed(()=>{let u=unref(o);const{matched:m}=s.value;let d;for(;(d=m[u])&&!d.components;)u++;return u}),l=computed(()=>s.value.matched[a.value]);provide(viewDepthKey,computed(()=>a.value+1)),provide(matchedRouteKey,l),provide(routerViewLocationKey,s);const c=ref();return watch(()=>[c.value,l.value,t.name],([u,m,d],[g,y,b])=>{m&&(m.instances[d]=u,y&&y!==m&&u&&u===g&&(m.leaveGuards.size||(m.leaveGuards=y.leaveGuards),m.updateGuards.size||(m.updateGuards=y.updateGuards))),u&&m&&(!y||!isSameRouteRecord(m,y)||!g)&&(m.enterCallbacks[d]||[]).forEach(S=>S(u))},{flush:"post"}),()=>{const u=s.value,m=t.name,d=l.value,g=d&&d.components[m];if(!g)return normalizeSlot(i.default,{Component:g,route:u});const y=d.props[m],b=y?y===!0?u.params:typeof y=="function"?y(u):y:null,E=h$1(g,assign$2({},b,e,{onVnodeUnmounted:x=>{x.component.isUnmounted&&(d.instances[m]=null)},ref:c}));return normalizeSlot(i.default,{Component:E,route:u})||E}}});function normalizeSlot(t,e){if(!t)return null;const i=t(e);return i.length===1?i[0]:i}const RouterView=RouterViewImpl;function createRouter(t){const e=createRouterMatcher(t.routes,t),i=t.parseQuery||parseQuery,r=t.stringifyQuery||stringifyQuery,s=t.history,o=useCallbacks(),a=useCallbacks(),l=useCallbacks(),c=shallowRef(START_LOCATION_NORMALIZED);let u=START_LOCATION_NORMALIZED;isBrowser&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const m=applyToParams.bind(null,te=>""+te),d=applyToParams.bind(null,encodeParam),g=applyToParams.bind(null,decode$5);function y(te,ce){let pe,ue;return isRouteName(te)?(pe=e.getRecordMatcher(te),ue=ce):ue=te,e.addRoute(ue,pe)}function b(te){const ce=e.getRecordMatcher(te);ce&&e.removeRoute(ce)}function S(){return e.getRoutes().map(te=>te.record)}function E(te){return!!e.getRecordMatcher(te)}function x(te,ce){if(ce=assign$2({},ce||c.value),typeof te=="string"){const q=parseURL(i,te,ce.path),ie=e.resolve({path:q.path},ce),B=s.createHref(q.fullPath);return assign$2(q,ie,{params:g(ie.params),hash:decode$5(q.hash),redirectedFrom:void 0,href:B})}let pe;if("path"in te)pe=assign$2({},te,{path:parseURL(i,te.path,ce.path).path});else{const q=assign$2({},te.params);for(const ie in q)q[ie]==null&&delete q[ie];pe=assign$2({},te,{params:d(te.params)}),ce.params=d(ce.params)}const ue=e.resolve(pe,ce),be=te.hash||"";ue.params=m(g(ue.params));const Ee=stringifyURL(r,assign$2({},te,{hash:encodeHash(be),path:ue.path})),Se=s.createHref(Ee);return assign$2({fullPath:Ee,hash:be,query:r===stringifyQuery?normalizeQuery(te.query):te.query||{}},ue,{redirectedFrom:void 0,href:Se})}function A(te){return typeof te=="string"?parseURL(i,te,c.value.path):assign$2({},te)}function _(te,ce){if(u!==te)return createRouterError(8,{from:ce,to:te})}function P(te){return C(te)}function T(te){return P(assign$2(A(te),{replace:!0}))}function M(te){const ce=te.matched[te.matched.length-1];if(ce&&ce.redirect){const{redirect:pe}=ce;let ue=typeof pe=="function"?pe(te):pe;return typeof ue=="string"&&(ue=ue.includes("?")||ue.includes("#")?ue=A(ue):{path:ue},ue.params={}),assign$2({query:te.query,hash:te.hash,params:"path"in ue?{}:te.params},ue)}}function C(te,ce){const pe=u=x(te),ue=c.value,be=te.state,Ee=te.force,Se=te.replace===!0,q=M(pe);if(q)return C(assign$2(A(q),{state:typeof q=="object"?assign$2({},be,q.state):be,force:Ee,replace:Se}),ce||pe);const ie=pe;ie.redirectedFrom=ce;let B;return!Ee&&isSameRouteLocation(r,ue,pe)&&(B=createRouterError(16,{to:ie,from:ue}),Z(ue,ue,!0,!1)),(B?Promise.resolve(B):D(ie,ue)).catch(re=>isNavigationFailure(re)?isNavigationFailure(re,2)?re:F(re):V(re,ie,ue)).then(re=>{if(re){if(isNavigationFailure(re,2))return C(assign$2({replace:Se},A(re.to),{state:typeof re.to=="object"?assign$2({},be,re.to.state):be,force:Ee}),ce||ie)}else re=$(ie,ue,!0,Se,be);return G(ie,ue,re),re})}function I(te,ce){const pe=_(te,ce);return pe?Promise.reject(pe):Promise.resolve()}function D(te,ce){let pe;const[ue,be,Ee]=extractChangingRecords(te,ce);pe=extractComponentsGuards(ue.reverse(),"beforeRouteLeave",te,ce);for(const q of ue)q.leaveGuards.forEach(ie=>{pe.push(guardToPromiseFn(ie,te,ce))});const Se=I.bind(null,te,ce);return pe.push(Se),runGuardQueue(pe).then(()=>{pe=[];for(const q of o.list())pe.push(guardToPromiseFn(q,te,ce));return pe.push(Se),runGuardQueue(pe)}).then(()=>{pe=extractComponentsGuards(be,"beforeRouteUpdate",te,ce);for(const q of be)q.updateGuards.forEach(ie=>{pe.push(guardToPromiseFn(ie,te,ce))});return pe.push(Se),runGuardQueue(pe)}).then(()=>{pe=[];for(const q of te.matched)if(q.beforeEnter&&!ce.matched.includes(q))if(isArray$8(q.beforeEnter))for(const ie of q.beforeEnter)pe.push(guardToPromiseFn(ie,te,ce));else pe.push(guardToPromiseFn(q.beforeEnter,te,ce));return pe.push(Se),runGuardQueue(pe)}).then(()=>(te.matched.forEach(q=>q.enterCallbacks={}),pe=extractComponentsGuards(Ee,"beforeRouteEnter",te,ce),pe.push(Se),runGuardQueue(pe))).then(()=>{pe=[];for(const q of a.list())pe.push(guardToPromiseFn(q,te,ce));return pe.push(Se),runGuardQueue(pe)}).catch(q=>isNavigationFailure(q,8)?q:Promise.reject(q))}function G(te,ce,pe){for(const ue of l.list())ue(te,ce,pe)}function $(te,ce,pe,ue,be){const Ee=_(te,ce);if(Ee)return Ee;const Se=ce===START_LOCATION_NORMALIZED,q=isBrowser?history.state:{};pe&&(ue||Se?s.replace(te.fullPath,assign$2({scroll:Se&&q&&q.scroll},be)):s.push(te.fullPath,be)),c.value=te,Z(te,ce,pe,Se),F()}let N;function z(){N||(N=s.listen((te,ce,pe)=>{if(!ne.listening)return;const ue=x(te),be=M(ue);if(be){C(assign$2(be,{replace:!0}),ue).catch(noop$2);return}u=ue;const Ee=c.value;isBrowser&&saveScrollPosition(getScrollKey(Ee.fullPath,pe.delta),computeScrollPosition()),D(ue,Ee).catch(Se=>isNavigationFailure(Se,12)?Se:isNavigationFailure(Se,2)?(C(Se.to,ue).then(q=>{isNavigationFailure(q,20)&&!pe.delta&&pe.type===NavigationType.pop&&s.go(-1,!1)}).catch(noop$2),Promise.reject()):(pe.delta&&s.go(-pe.delta,!1),V(Se,ue,Ee))).then(Se=>{Se=Se||$(ue,Ee,!1),Se&&(pe.delta&&!isNavigationFailure(Se,8)?s.go(-pe.delta,!1):pe.type===NavigationType.pop&&isNavigationFailure(Se,20)&&s.go(-1,!1)),G(ue,Ee,Se)}).catch(noop$2)}))}let R=useCallbacks(),H=useCallbacks(),O;function V(te,ce,pe){F(te);const ue=H.list();return ue.length?ue.forEach(be=>be(te,ce,pe)):console.error(te),Promise.reject(te)}function k(){return O&&c.value!==START_LOCATION_NORMALIZED?Promise.resolve():new Promise((te,ce)=>{R.add([te,ce])})}function F(te){return O||(O=!te,z(),R.list().forEach(([ce,pe])=>te?pe(te):ce()),R.reset()),te}function Z(te,ce,pe,ue){const{scrollBehavior:be}=t;if(!isBrowser||!be)return Promise.resolve();const Ee=!pe&&getSavedScrollPosition(getScrollKey(te.fullPath,0))||(ue||!pe)&&history.state&&history.state.scroll||null;return nextTick().then(()=>be(te,ce,Ee)).then(Se=>Se&&scrollToPosition(Se)).catch(Se=>V(Se,te,ce))}const U=te=>s.go(te);let J;const de=new Set,ne={currentRoute:c,listening:!0,addRoute:y,removeRoute:b,hasRoute:E,getRoutes:S,resolve:x,options:t,push:P,replace:T,go:U,back:()=>U(-1),forward:()=>U(1),beforeEach:o.add,beforeResolve:a.add,afterEach:l.add,onError:H.add,isReady:k,install(te){const ce=this;te.component("RouterLink",RouterLink),te.component("RouterView",RouterView),te.config.globalProperties.$router=ce,Object.defineProperty(te.config.globalProperties,"$route",{enumerable:!0,get:()=>unref(c)}),isBrowser&&!J&&c.value===START_LOCATION_NORMALIZED&&(J=!0,P(s.location).catch(be=>{}));const pe={};for(const be in START_LOCATION_NORMALIZED)pe[be]=computed(()=>c.value[be]);te.provide(routerKey,ce),te.provide(routeLocationKey,reactive(pe)),te.provide(routerViewLocationKey,c);const ue=te.unmount;de.add(te),te.unmount=function(){de.delete(te),de.size<1&&(u=START_LOCATION_NORMALIZED,N&&N(),N=null,c.value=START_LOCATION_NORMALIZED,J=!1,O=!1),ue()}}};return ne}function runGuardQueue(t){return t.reduce((e,i)=>e.then(()=>i()),Promise.resolve())}function extractChangingRecords(t,e){const i=[],r=[],s=[],o=Math.max(e.matched.length,t.matched.length);for(let a=0;aisSameRouteRecord(u,l))?r.push(l):i.push(l));const c=t.matched[a];c&&(e.matched.find(u=>isSameRouteRecord(u,c))||s.push(c))}return[i,r,s]}function useRouter(){return inject(routerKey)}function useRoute$1(){return inject(routeLocationKey)}const isDef$1=t=>t!=null,isFunction$5=t=>typeof t=="function",isObject$4=t=>t!==null&&typeof t=="object",isPromise=t=>isObject$4(t)&&isFunction$5(t.then)&&isFunction$5(t.catch),isNumeric=t=>typeof t=="number"||/^\d+(\.\d+)?$/.test(t),isIOS$1=()=>inBrowser$2?/ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()):!1;function noop$1(){}const extend$2=Object.assign,inBrowser$2=typeof window<"u";function get(t,e){const i=e.split(".");let r=t;return i.forEach(s=>{var o;r=isObject$4(r)&&(o=r[s])!=null?o:""}),r}function pick$1(t,e,i){return e.reduce((r,s)=>((!i||t[s]!==void 0)&&(r[s]=t[s]),r),{})}const isSameValue=(t,e)=>JSON.stringify(t)===JSON.stringify(e),toArray=t=>Array.isArray(t)?t:[t],unknownProp=null,numericProp=[Number,String],truthProp={type:Boolean,default:!0},makeRequiredProp=t=>({type:t,required:!0}),makeArrayProp=()=>({type:Array,default:()=>[]}),makeNumberProp=t=>({type:Number,default:t}),makeNumericProp=t=>({type:numericProp,default:t}),makeStringProp=t=>({type:String,default:t});var inBrowser$1=typeof window<"u";function raf(t){return inBrowser$1?requestAnimationFrame(t):-1}function cancelRaf(t){inBrowser$1&&cancelAnimationFrame(t)}function doubleRaf(t){raf(()=>raf(t))}var isWindow=t=>t===window,makeDOMRect=(t,e)=>({top:0,left:0,right:t,bottom:e,width:t,height:e}),useRect=t=>{const e=unref(t);if(isWindow(e)){const i=e.innerWidth,r=e.innerHeight;return makeDOMRect(i,r)}return e!=null&&e.getBoundingClientRect?e.getBoundingClientRect():makeDOMRect(0,0)};function useParent$1(t){const e=inject(t,null);if(e){const i=getCurrentInstance(),{link:r,unlink:s,internalChildren:o}=e;r(i),onUnmounted(()=>s(i));const a=computed(()=>o.indexOf(i));return{parent:e,index:a}}return{parent:null,index:ref(-1)}}function flattenVNodes(t){const e=[],i=r=>{Array.isArray(r)&&r.forEach(s=>{var o;isVNode(s)&&(e.push(s),(o=s.component)!=null&&o.subTree&&(e.push(s.component.subTree),i(s.component.subTree.children)),s.children&&i(s.children))})};return i(t),e}var findVNodeIndex=(t,e)=>{const i=t.indexOf(e);return i===-1?t.findIndex(r=>e.key!==void 0&&e.key!==null&&r.type===e.type&&r.key===e.key):i};function sortChildren(t,e,i){const r=flattenVNodes(t.subTree.children);i.sort((o,a)=>findVNodeIndex(r,o.vnode)-findVNodeIndex(r,a.vnode));const s=i.map(o=>o.proxy);e.sort((o,a)=>{const l=s.indexOf(o),c=s.indexOf(a);return l-c})}function useChildren$1(t){const e=reactive([]),i=reactive([]),r=getCurrentInstance();return{children:e,linkChildren:o=>{provide(t,Object.assign({link:c=>{c.proxy&&(i.push(c),e.push(c.proxy),sortChildren(r,e,i))},unlink:c=>{const u=i.indexOf(c);e.splice(u,1),i.splice(u,1)},children:e,internalChildren:i},o))}}}function onMountedOrActivated(t){let e;onMounted(()=>{t(),nextTick(()=>{e=!0})}),onActivated(()=>{e&&t()})}function useEventListener$1(t,e,i={}){if(!inBrowser$1)return;const{target:r=window,passive:s=!1,capture:o=!1}=i;let a=!1,l;const c=d=>{if(a)return;const g=unref(d);g&&!l&&(g.addEventListener(t,e,{capture:o,passive:s}),l=!0)},u=d=>{if(a)return;const g=unref(d);g&&l&&(g.removeEventListener(t,e,o),l=!1)};onUnmounted(()=>u(r)),onDeactivated(()=>u(r)),onMountedOrActivated(()=>c(r));let m;return isRef(r)&&(m=watch(r,(d,g)=>{u(g),c(d)})),()=>{m==null||m(),u(r),a=!0}}function useClickAway(t,e,i={}){if(!inBrowser$1)return;const{eventName:r="click"}=i;useEventListener$1(r,o=>{(Array.isArray(t)?t:[t]).every(c=>{const u=unref(c);return u&&!u.contains(o.target)})&&e(o)},{target:document})}var width,height;function useWindowSize(){if(!width&&(width=ref(0),height=ref(0),inBrowser$1)){const t=()=>{width.value=window.innerWidth,height.value=window.innerHeight};t(),window.addEventListener("resize",t,{passive:!0}),window.addEventListener("orientationchange",t,{passive:!0})}return{width,height}}var overflowScrollReg=/scroll|auto|overlay/i,defaultRoot=inBrowser$1?window:void 0;function isElement$1(t){return t.tagName!=="HTML"&&t.tagName!=="BODY"&&t.nodeType===1}function getScrollParent(t,e=defaultRoot){let i=t;for(;i&&i!==e&&isElement$1(i);){const{overflowY:r}=window.getComputedStyle(i);if(overflowScrollReg.test(r))return i;i=i.parentNode}return e}function useScrollParent(t,e=defaultRoot){const i=ref();return onMounted(()=>{t.value&&(i.value=getScrollParent(t.value,e))}),i}var visibility;function usePageVisibility(){if(!visibility&&(visibility=ref("visible"),inBrowser$1)){const t=()=>{visibility.value=document.hidden?"hidden":"visible"};t(),window.addEventListener("visibilitychange",t)}return visibility}var CUSTOM_FIELD_INJECTION_KEY=Symbol("van-field");function useCustomFieldValue(t){const e=inject(CUSTOM_FIELD_INJECTION_KEY,null);e&&!e.customValue.value&&(e.customValue.value=t,watch(t,()=>{e.resetValidation(),e.validateWithTrigger("onChange")}))}function getScrollTop(t){const e="scrollTop"in t?t.scrollTop:t.pageYOffset;return Math.max(e,0)}function setScrollTop(t,e){"scrollTop"in t?t.scrollTop=e:t.scrollTo(t.scrollX,e)}function getRootScrollTop(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}function setRootScrollTop(t){setScrollTop(window,t),setScrollTop(document.body,t)}function getElementTop(t,e){if(t===window)return 0;const i=e?getScrollTop(e):getRootScrollTop();return useRect(t).top+i}const isIOS=isIOS$1();function resetScroll(){isIOS&&setRootScrollTop(getRootScrollTop())}const stopPropagation=t=>t.stopPropagation();function preventDefault(t,e){(typeof t.cancelable!="boolean"||t.cancelable)&&t.preventDefault(),e&&stopPropagation(t)}function isHidden(t){const e=unref(t);if(!e)return!1;const i=window.getComputedStyle(e),r=i.display==="none",s=e.offsetParent===null&&i.position!=="fixed";return r||s}const{width:windowWidth,height:windowHeight}=useWindowSize();function addUnit(t){if(isDef$1(t))return isNumeric(t)?`${t}px`:String(t)}function getSizeStyle(t){if(isDef$1(t)){if(Array.isArray(t))return{width:addUnit(t[0]),height:addUnit(t[1])};const e=addUnit(t);return{width:e,height:e}}}function getZIndexStyle(t){const e={};return t!==void 0&&(e.zIndex=+t),e}let rootFontSize;function getRootFontSize(){if(!rootFontSize){const t=document.documentElement,e=t.style.fontSize||window.getComputedStyle(t).fontSize;rootFontSize=parseFloat(e)}return rootFontSize}function convertRem(t){return t=t.replace(/rem/g,""),+t*getRootFontSize()}function convertVw(t){return t=t.replace(/vw/g,""),+t*windowWidth.value/100}function convertVh(t){return t=t.replace(/vh/g,""),+t*windowHeight.value/100}function unitToPx(t){if(typeof t=="number")return t;if(inBrowser$2){if(t.includes("rem"))return convertRem(t);if(t.includes("vw"))return convertVw(t);if(t.includes("vh"))return convertVh(t)}return parseFloat(t)}const camelizeRE=/-(\w)/g,camelize$1=t=>t.replace(camelizeRE,(e,i)=>i.toUpperCase()),kebabCase=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,""),clamp=(t,e,i)=>Math.min(Math.max(t,e),i);function trimExtraChar(t,e,i){const r=t.indexOf(e);return r===-1?t:e==="-"&&r!==0?t.slice(0,r):t.slice(0,r+1)+t.slice(r).replace(i,"")}function formatNumber(t,e=!0,i=!0){e?t=trimExtraChar(t,".",/\./g):t=t.split(".")[0],i?t=trimExtraChar(t,"-",/-/g):t=t.replace(/-/,"");const r=e?/[^-0-9.]/g:/[^-0-9]/g;return t.replace(r,"")}function addNumber(t,e){return Math.round((t+e)*1e10)/1e10}const{hasOwnProperty:hasOwnProperty$d}=Object.prototype;function assignKey(t,e,i){const r=e[i];isDef$1(r)&&(!hasOwnProperty$d.call(t,i)||!isObject$4(r)?t[i]=r:t[i]=deepAssign(Object(t[i]),r))}function deepAssign(t,e){return Object.keys(e).forEach(i=>{assignKey(t,e,i)}),t}var stdin_default$i={name:"姓名",tel:"电话",save:"保存",confirm:"确认",cancel:"取消",delete:"删除",loading:"加载中...",noCoupon:"暂无优惠券",nameEmpty:"请填写姓名",addContact:"添加联系人",telInvalid:"请填写正确的电话",vanCalendar:{end:"结束",start:"开始",title:"日期选择",weekdays:["日","一","二","三","四","五","六"],monthTitle:(t,e)=>`${t}年${e}月`,rangePrompt:t=>`最多选择 ${t} 天`},vanCascader:{select:"请选择"},vanPagination:{prev:"上一页",next:"下一页"},vanPullRefresh:{pulling:"下拉即可刷新...",loosing:"释放即可刷新..."},vanSubmitBar:{label:"合计:"},vanCoupon:{unlimited:"无门槛",discount:t=>`${t}折`,condition:t=>`满${t}元可用`},vanCouponCell:{title:"优惠券",count:t=>`${t}张可用`},vanCouponList:{exchange:"兑换",close:"不使用",enable:"可用",disabled:"不可用",placeholder:"输入优惠码"},vanAddressEdit:{area:"地区",areaEmpty:"请选择地区",addressEmpty:"请填写详细地址",addressDetail:"详细地址",defaultAddress:"设为默认收货地址"},vanAddressList:{add:"新增地址"}};const lang=ref("zh-CN"),messages=reactive({"zh-CN":stdin_default$i}),Locale={messages(){return messages[lang.value]},use(t,e){lang.value=t,this.add({[t]:e})},add(t={}){deepAssign(messages,t)}};var stdin_default$h=Locale;function createTranslate(t){const e=camelize$1(t)+".";return(i,...r)=>{const s=stdin_default$h.messages(),o=get(s,e+i)||get(s,i);return isFunction$5(o)?o(...r):o}}function genBem(t,e){return e?typeof e=="string"?` ${t}--${e}`:Array.isArray(e)?e.reduce((i,r)=>i+genBem(t,r),""):Object.keys(e).reduce((i,r)=>i+(e[r]?genBem(t,r):""),""):""}function createBEM(t){return(e,i)=>(e&&typeof e!="string"&&(i=e,e=""),e=e?`${t}__${e}`:t,`${e}${genBem(e,i)}`)}function createNamespace$1(t){const e=`van-${t}`;return[e,createBEM(e),createTranslate(e)]}const BORDER="van-hairline",BORDER_TOP=`${BORDER}--top`,BORDER_LEFT=`${BORDER}--left`,BORDER_BOTTOM=`${BORDER}--bottom`,BORDER_SURROUND=`${BORDER}--surround`,BORDER_TOP_BOTTOM=`${BORDER}--top-bottom`,BORDER_UNSET_TOP_BOTTOM=`${BORDER}-unset--top-bottom`,HAPTICS_FEEDBACK="van-haptics-feedback",FORM_KEY=Symbol("van-form");function callInterceptor(t,{args:e=[],done:i,canceled:r}){if(t){const s=t.apply(null,e);isPromise(s)?s.then(o=>{o?i():r&&r()}).catch(noop$1):s?i():r&&r()}else i()}function withInstall(t){return t.install=e=>{const{name:i}=t;i&&(e.component(i,t),e.component(camelize$1(`-${i}`),t))},t}const POPUP_TOGGLE_KEY=Symbol();function onPopupReopen(t){const e=inject(POPUP_TOGGLE_KEY,null);e&&watch(e,i=>{i&&t()})}const useHeight=(t,e)=>{const i=ref(),r=()=>{i.value=useRect(t).height};return onMounted(()=>{if(nextTick(r),e)for(let s=1;s<=3;s++)setTimeout(r,100*s)}),onPopupReopen(()=>nextTick(r)),watch([windowWidth,windowHeight],r),i};function usePlaceholder(t,e){const i=useHeight(t,!0);return r=>createVNode("div",{class:e("placeholder"),style:{height:i.value?`${i.value}px`:void 0}},[r()])}function useExpose(t){const e=getCurrentInstance();e&&extend$2(e.proxy,t)}const routeProps={to:[String,Object],url:String,replace:Boolean};function route({to:t,url:e,replace:i,$router:r}){t&&r?r[i?"replace":"push"](t):e&&(i?location.replace(e):location.href=e)}function useRoute(){const t=getCurrentInstance().proxy;return()=>route(t)}const[name$e,bem$e]=createNamespace$1("badge"),badgeProps={dot:Boolean,max:numericProp,tag:makeStringProp("div"),color:String,offset:Array,content:numericProp,showZero:truthProp,position:makeStringProp("top-right")};var stdin_default$g=defineComponent({name:name$e,props:badgeProps,setup(t,{slots:e}){const i=()=>{if(e.content)return!0;const{content:l,showZero:c}=t;return isDef$1(l)&&l!==""&&(c||l!==0&&l!=="0")},r=()=>{const{dot:l,max:c,content:u}=t;if(!l&&i())return e.content?e.content():isDef$1(c)&&isNumeric(u)&&+u>+c?`${c}+`:u},s=l=>l.startsWith("-")?l.replace("-",""):`-${l}`,o=computed(()=>{const l={background:t.color};if(t.offset){const[c,u]=t.offset,{position:m}=t,[d,g]=m.split("-");e.default?(typeof u=="number"?l[d]=addUnit(d==="top"?u:-u):l[d]=d==="top"?addUnit(u):s(u),typeof c=="number"?l[g]=addUnit(g==="left"?c:-c):l[g]=g==="left"?addUnit(c):s(c)):(l.marginTop=addUnit(u),l.marginLeft=addUnit(c))}return l}),a=()=>{if(i()||t.dot)return createVNode("div",{class:bem$e([t.position,{dot:t.dot,fixed:!!e.default}]),style:o.value},[r()])};return()=>{if(e.default){const{tag:l}=t;return createVNode(l,{class:bem$e("wrapper")},{default:()=>[e.default(),a()]})}return a()}}});const Badge=withInstall(stdin_default$g);let globalZIndex=2e3;const useGlobalZIndex=()=>++globalZIndex,setGlobalZIndex=t=>{globalZIndex=t},[name$d,bem$d]=createNamespace$1("config-provider"),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(t){const e={};return Object.keys(t).forEach(i=>{e[`--van-${kebabCase(i)}`]=t[i]}),e}defineComponent({name:name$d,props:configProviderProps,setup(t,{slots:e}){const i=computed(()=>mapThemeVarsToCSSVars(extend$2({},t.themeVars,t.theme==="dark"?t.themeVarsDark:t.themeVarsLight)));if(inBrowser$2){const r=()=>{document.documentElement.classList.add(`van-theme-${t.theme}`)},s=(o=t.theme)=>{document.documentElement.classList.remove(`van-theme-${o}`)};watch(()=>t.theme,(o,a)=>{a&&s(a),r()},{immediate:!0}),onActivated(r),onDeactivated(s),onBeforeUnmount(s)}return provide(CONFIG_PROVIDER_KEY,t),watchEffect(()=>{t.zIndex!==void 0&&setGlobalZIndex(t.zIndex)}),()=>createVNode(t.tag,{class:bem$d(),style:i.value},{default:()=>{var r;return[(r=e.default)==null?void 0:r.call(e)]}})}});const[name$c,bem$c]=createNamespace$1("icon"),isImage=t=>t==null?void 0:t.includes("/"),iconProps={dot:Boolean,tag:makeStringProp("i"),name:String,size:numericProp,badge:numericProp,color:String,badgeProps:Object,classPrefix:String};var stdin_default$f=defineComponent({name:name$c,props:iconProps,setup(t,{slots:e}){const i=inject(CONFIG_PROVIDER_KEY,null),r=computed(()=>t.classPrefix||(i==null?void 0:i.iconPrefix)||bem$c());return()=>{const{tag:s,dot:o,name:a,size:l,badge:c,color:u}=t,m=isImage(a);return createVNode(Badge,mergeProps({dot:o,tag:s,class:[r.value,m?"":`${r.value}-${a}`],style:{color:u,fontSize:addUnit(l)},content:c},t.badgeProps),{default:()=>{var d;return[(d=e.default)==null?void 0:d.call(e),m&&createVNode("img",{class:bem$c("image"),src:a},null)]}})}}});const Icon$1=withInstall(stdin_default$f),[name$b,bem$b]=createNamespace$1("loading"),SpinIcon=Array(12).fill(null).map((t,e)=>createVNode("i",{class:bem$b("line",String(e+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};var stdin_default$e=defineComponent({name:name$b,props:loadingProps,setup(t,{slots:e}){const i=computed(()=>extend$2({color:t.color},getSizeStyle(t.size))),r=()=>{const o=t.type==="spinner"?SpinIcon:CircularIcon;return createVNode("span",{class:bem$b("spinner",t.type),style:i.value},[e.icon?e.icon():o])},s=()=>{var o;if(e.default)return createVNode("span",{class:bem$b("text"),style:{fontSize:addUnit(t.textSize),color:(o=t.textColor)!=null?o:t.color}},[e.default()])};return()=>{const{type:o,vertical:a}=t;return createVNode("div",{class:bem$b([o,{vertical:a}]),"aria-live":"polite","aria-busy":!0},[r(),s()])}}});const Loading$1=withInstall(stdin_default$e),[name$a,bem$a]=createNamespace$1("button"),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")});var stdin_default$d=defineComponent({name:name$a,props:buttonProps,emits:["click"],setup(t,{emit:e,slots:i}){const r=useRoute(),s=()=>i.loading?i.loading():createVNode(Loading$1,{size:t.loadingSize,type:t.loadingType,class:bem$a("loading")},null),o=()=>{if(t.loading)return s();if(i.icon)return createVNode("div",{class:bem$a("icon")},[i.icon()]);if(t.icon)return createVNode(Icon$1,{name:t.icon,class:bem$a("icon"),classPrefix:t.iconPrefix},null)},a=()=>{let u;if(t.loading?u=t.loadingText:u=i.default?i.default():t.text,u)return createVNode("span",{class:bem$a("text")},[u])},l=()=>{const{color:u,plain:m}=t;if(u){const d={color:m?u:"white"};return m||(d.background=u),u.includes("gradient")?d.border=0:d.borderColor=u,d}},c=u=>{t.loading?preventDefault(u):t.disabled||(e("click",u),r())};return()=>{const{tag:u,type:m,size:d,block:g,round:y,plain:b,square:S,loading:E,disabled:x,hairline:A,nativeType:_,iconPosition:P}=t,T=[bem$a([m,d,{plain:b,block:g,round:y,square:S,loading:E,disabled:x,hairline:A}]),{[BORDER_SURROUND]:A}];return createVNode(u,{type:_,class:T,style:l(),disabled:x,onClick:c},{default:()=>[createVNode("div",{class:bem$a("content")},[P==="left"&&o(),a(),P==="right"&&o()])]})}}});const Button$1=withInstall(stdin_default$d),popupSharedProps={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=Object.keys(popupSharedProps);function getDirection(t,e){return t>e?"horizontal":e>t?"vertical":""}function useTouch(){const t=ref(0),e=ref(0),i=ref(0),r=ref(0),s=ref(0),o=ref(0),a=ref(""),l=()=>a.value==="vertical",c=()=>a.value==="horizontal",u=()=>{i.value=0,r.value=0,s.value=0,o.value=0,a.value=""};return{move:g=>{const y=g.touches[0];i.value=(y.clientX<0?0:y.clientX)-t.value,r.value=y.clientY-e.value,s.value=Math.abs(i.value),o.value=Math.abs(r.value);const b=10;(!a.value||s.value{u(),t.value=g.touches[0].clientX,e.value=g.touches[0].clientY},reset:u,startX:t,startY:e,deltaX:i,deltaY:r,offsetX:s,offsetY:o,direction:a,isVertical:l,isHorizontal:c}}let totalLockCount=0;const BODY_LOCK_CLASS="van-overflow-hidden";function useLockScroll(t,e){const i=useTouch(),r="01",s="10",o=m=>{i.move(m);const d=i.deltaY.value>0?s:r,g=getScrollParent(m.target,t.value),{scrollHeight:y,offsetHeight:b,scrollTop:S}=g;let E="11";S===0?E=b>=y?"00":"01":S+b>=y&&(E="10"),E!=="11"&&i.isVertical()&&!(parseInt(E,2)&parseInt(d,2))&&preventDefault(m,!0)},a=()=>{document.addEventListener("touchstart",i.start),document.addEventListener("touchmove",o,{passive:!1}),totalLockCount||document.body.classList.add(BODY_LOCK_CLASS),totalLockCount++},l=()=>{totalLockCount&&(document.removeEventListener("touchstart",i.start),document.removeEventListener("touchmove",o),totalLockCount--,totalLockCount||document.body.classList.remove(BODY_LOCK_CLASS))},c=()=>e()&&a(),u=()=>e()&&l();onMountedOrActivated(c),onDeactivated(u),onBeforeUnmount(u),watch(e,m=>{m?a():l()})}function useLazyRender(t){const e=ref(!1);return watch(t,i=>{i&&(e.value=i)},{immediate:!0}),i=>()=>e.value?i():null}const[name$9,bem$9]=createNamespace$1("overlay"),overlayProps={show:Boolean,zIndex:numericProp,duration:numericProp,className:unknownProp,lockScroll:truthProp,lazyRender:truthProp,customStyle:Object};var stdin_default$c=defineComponent({name:name$9,props:overlayProps,setup(t,{slots:e}){const i=ref(),r=useLazyRender(()=>t.show||!t.lazyRender),s=a=>{t.lockScroll&&preventDefault(a,!0)},o=r(()=>{var a;const l=extend$2(getZIndexStyle(t.zIndex),t.customStyle);return isDef$1(t.duration)&&(l.animationDuration=`${t.duration}s`),withDirectives(createVNode("div",{ref:i,style:l,class:[bem$9(),t.className]},[(a=e.default)==null?void 0:a.call(e)]),[[vShow,t.show]])});return useEventListener$1("touchmove",s,{target:i}),()=>createVNode(Transition,{name:"van-fade",appear:!0},{default:o})}});const 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}),[name$8,bem$8]=createNamespace$1("popup");var stdin_default$b=defineComponent({name:name$8,inheritAttrs:!1,props:popupProps,emits:["open","close","opened","closed","keydown","update:show","clickOverlay","clickCloseIcon"],setup(t,{emit:e,attrs:i,slots:r}){let s,o;const a=ref(),l=ref(),c=useLazyRender(()=>t.show||!t.lazyRender),u=computed(()=>{const T={zIndex:a.value};if(isDef$1(t.duration)){const M=t.position==="center"?"animationDuration":"transitionDuration";T[M]=`${t.duration}s`}return T}),m=()=>{s||(s=!0,a.value=t.zIndex!==void 0?+t.zIndex:useGlobalZIndex(),e("open"))},d=()=>{s&&callInterceptor(t.beforeClose,{done(){s=!1,e("close"),e("update:show",!1)}})},g=T=>{e("clickOverlay",T),t.closeOnClickOverlay&&d()},y=()=>{if(t.overlay)return createVNode(Overlay,{show:t.show,class:t.overlayClass,zIndex:a.value,duration:t.duration,customStyle:t.overlayStyle,role:t.closeOnClickOverlay?"button":void 0,tabindex:t.closeOnClickOverlay?0:void 0,onClick:g},{default:r["overlay-content"]})},b=T=>{e("clickCloseIcon",T),d()},S=()=>{if(t.closeable)return createVNode(Icon$1,{role:"button",tabindex:0,name:t.closeIcon,class:[bem$8("close-icon",t.closeIconPosition),HAPTICS_FEEDBACK],classPrefix:t.iconPrefix,onClick:b},null)},E=()=>e("opened"),x=()=>e("closed"),A=T=>e("keydown",T),_=c(()=>{var T;const{round:M,position:C,safeAreaInsetTop:I,safeAreaInsetBottom:D}=t;return withDirectives(createVNode("div",mergeProps({ref:l,style:u.value,role:"dialog",tabindex:0,class:[bem$8({round:M,[C]:C}),{"van-safe-area-top":I,"van-safe-area-bottom":D}],onKeydown:A},i),[(T=r.default)==null?void 0:T.call(r),S()]),[[vShow,t.show]])}),P=()=>{const{position:T,transition:M,transitionAppear:C}=t,I=T==="center"?"van-fade":`van-popup-slide-${T}`;return createVNode(Transition,{name:M||I,appear:C,onAfterEnter:E,onAfterLeave:x},{default:_})};return watch(()=>t.show,T=>{T&&!s&&(m(),i.tabindex===0&&nextTick(()=>{var M;(M=l.value)==null||M.focus()})),!T&&s&&(s=!1,e("close"))}),useExpose({popupRef:l}),useLockScroll(l,()=>t.show&&t.lockScroll),useEventListener$1("popstate",()=>{t.closeOnPopstate&&(d(),o=!1)}),onMounted(()=>{t.show&&m()}),onActivated(()=>{o&&(e("update:show",!0),o=!1)}),onDeactivated(()=>{t.show&&t.teleport&&(d(),o=!0)}),provide(POPUP_TOGGLE_KEY,()=>t.show),()=>t.teleport?createVNode(Teleport,{to:t.teleport},{default:()=>[y(),P()]}):createVNode(Fragment,null,[y(),P()])}});const Popup=withInstall(stdin_default$b);let current=0;function useId(){const t=getCurrentInstance(),{name:e="unknown"}=(t==null?void 0:t.type)||{};return`${e}-${++current}`}let lockCount=0;function lockClick(t){t?(lockCount||document.body.classList.add("van-toast--unclickable"),lockCount++):lockCount&&(lockCount--,lockCount||document.body.classList.remove("van-toast--unclickable"))}const[name$7,bem$7]=createNamespace$1("toast"),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};var stdin_default$a=defineComponent({name:name$7,props:toastProps,emits:["update:show"],setup(t,{emit:e,slots:i}){let r,s=!1;const o=()=>{const d=t.show&&t.forbidClick;s!==d&&(s=d,lockClick(s))},a=d=>e("update:show",d),l=()=>{t.closeOnClick&&a(!1)},c=()=>clearTimeout(r),u=()=>{const{icon:d,type:g,iconSize:y,iconPrefix:b,loadingType:S}=t;if(d||g==="success"||g==="fail")return createVNode(Icon$1,{name:d||g,size:y,class:bem$7("icon"),classPrefix:b},null);if(g==="loading")return createVNode(Loading$1,{class:bem$7("loading"),size:y,type:S},null)},m=()=>{const{type:d,message:g}=t;if(i.message)return createVNode("div",{class:bem$7("text")},[i.message()]);if(isDef$1(g)&&g!=="")return d==="html"?createVNode("div",{key:0,class:bem$7("text"),innerHTML:String(g)},null):createVNode("div",{class:bem$7("text")},[g])};return watch(()=>[t.show,t.forbidClick],o),watch(()=>[t.show,t.type,t.message,t.duration],()=>{c(),t.show&&t.duration>0&&(r=setTimeout(()=>{a(!1)},t.duration))}),onMounted(o),onUnmounted(o),()=>createVNode(Popup,mergeProps({class:[bem$7([t.position,t.wordBreak==="normal"?"break-normal":t.wordBreak,{[t.type]:!t.icon}]),t.className],lockScroll:!1,onClick:l,onClosed:c,"onUpdate:show":a},pick$1(t,popupInheritProps)),{default:()=>[u(),m()]})}});function usePopupState(){const t=reactive({show:!1}),e=s=>{t.show=s},i=s=>{extend$2(t,s,{transitionAppear:!0}),e(!0)},r=()=>e(!1);return useExpose({open:i,close:r,toggle:e}),{open:i,close:r,state:t,toggle:e}}function mountComponent(t){const e=createApp(t),i=document.createElement("div");return document.body.appendChild(i),{instance:e.mount(i),unmount(){e.unmount(),document.body.removeChild(i)}}}const 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};let queue=[],allowMultiple=!1,currentOptions=extend$2({},defaultOptions$1);const defaultOptionsMap=new Map;function parseOptions(t){return isObject$4(t)?t:{message:t}}function createInstance(){const{instance:t,unmount:e}=mountComponent({setup(){const i=ref(""),{open:r,state:s,close:o,toggle:a}=usePopupState(),l=()=>{},c=()=>createVNode(stdin_default$a,mergeProps(s,{onClosed:l,"onUpdate:show":a}),null);return watch(i,u=>{s.message=u}),getCurrentInstance().render=c,{open:r,close:o,message:i}}});return t}function getInstance(){if(!queue.length||allowMultiple){const t=createInstance();queue.push(t)}return queue[queue.length-1]}function showToast(t={}){if(!inBrowser$2)return{};const e=getInstance(),i=parseOptions(t);return e.open(extend$2({},currentOptions,defaultOptionsMap.get(i.type||currentOptions.type),i)),e}const createMethod=t=>e=>showToast(extend$2({type:t},parseOptions(e))),showLoadingToast=createMethod("loading"),closeToast=t=>{queue.length&&(t?(queue.forEach(e=>{e.close()}),queue=[]):queue[0].close())};withInstall(stdin_default$a);const[name$6,bem$6]=createNamespace$1("empty"),emptyProps={image:makeStringProp("default"),imageSize:[Number,String,Array],description:String};var stdin_default$9=defineComponent({name:name$6,props:emptyProps,setup(t,{slots:e}){const i=()=>{const x=e.description?e.description():t.description;if(x)return createVNode("p",{class:bem$6("description")},[x])},r=()=>{if(e.default)return createVNode("div",{class:bem$6("bottom")},[e.default()])},s=useId(),o=x=>`${s}-${x}`,a=x=>`url(#${o(x)})`,l=(x,A,_)=>createVNode("stop",{"stop-color":x,offset:`${A}%`,"stop-opacity":_},null),c=(x,A)=>[l(x,0),l(A,100)],u=x=>[createVNode("defs",null,[createVNode("radialGradient",{id:o(x),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:a(x),opacity:".8",cx:"80",cy:"140",rx:"46",ry:"8"},null)],m=()=>[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:a("a")},null),createVNode("path",{d:"M123 15h22v14h9v77h-31V15z",fill:a("a")},null)])],d=()=>[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:a("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:a("b")},null)])],g=()=>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%"},[c("#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"},[m(),createVNode("path",{fill:a(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:a(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:a(3)},null),createVNode("path",{d:"M53 36a34 34 0 0 0 0 48",stroke:a(3)},null),createVNode("path",{d:"M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",stroke:a(3)},null),createVNode("path",{d:"M106 84a34 34 0 0 0 0-48",stroke:a(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)])])]),y=()=>createVNode("svg",{viewBox:"0 0 160 160"},[createVNode("defs",null,[createVNode("linearGradient",{x1:"50%",x2:"50%",y2:"100%",id:o(5)},[c("#F2F3F5","#DCDEE0")]),createVNode("linearGradient",{x1:"95%",y1:"48%",x2:"5.5%",y2:"51%",id:o(6)},[c("#EAEDF1","#DCDEE0")]),createVNode("linearGradient",{y1:"45%",x2:"100%",y2:"54%",id:o(7)},[c("#EAEDF1","#DCDEE0")])]),m(),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:a(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:a(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:a(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)])]),b=()=>createVNode("svg",{viewBox:"0 0 160 160"},[createVNode("defs",null,[createVNode("linearGradient",{x1:"50%",x2:"50%",y2:"100%",id:o(8)},[c("#EAEDF1","#DCDEE0")])]),m(),d(),u("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:a(8)},null)]),S=()=>createVNode("svg",{viewBox:"0 0 160 160"},[createVNode("defs",null,[createVNode("linearGradient",{x1:"50%",y1:"100%",x2:"50%",id:o(9)},[c("#EEE","#D8D8D8")]),createVNode("linearGradient",{x1:"100%",y1:"50%",y2:"50%",id:o(10)},[c("#F2F3F5","#DCDEE0")]),createVNode("linearGradient",{x1:"50%",x2:"50%",y2:"100%",id:o(11)},[c("#F2F3F5","#DCDEE0")]),createVNode("linearGradient",{x1:"50%",x2:"50%",y2:"100%",id:o(12)},[c("#FFF","#F7F8FA")])]),m(),d(),u("d"),createVNode("g",{transform:"rotate(-45 113 -4)",fill:"none"},[createVNode("rect",{fill:a(9),x:"24",y:"52.8",width:"5.8",height:"19",rx:"1"},null),createVNode("rect",{fill:a(10),x:"22.1",y:"67.3",width:"9.9",height:"28",rx:"1"},null),createVNode("circle",{stroke:a(11),"stroke-width":"8",cx:"27",cy:"27",r:"27"},null),createVNode("circle",{fill:a(12),cx:"27",cy:"27",r:"16"},null),createVNode("path",{d:"M37 7c-8 0-15 5-16 12",stroke:a(11),"stroke-width":"3",opacity:".5","stroke-linecap":"round",transform:"rotate(45 29 13)"},null)])]),E=()=>{var x;if(e.image)return e.image();const A={error:b,search:S,network:g,default:y};return((x=A[t.image])==null?void 0:x.call(A))||createVNode("img",{src:t.image},null)};return()=>createVNode("div",{class:bem$6()},[createVNode("div",{class:bem$6("image"),style:getSizeStyle(t.imageSize)},[E()]),i(),r()])}});const Empty=withInstall(stdin_default$9),[name$5,bem$5]=createNamespace$1("nav-bar"),navBarProps={title:String,fixed:Boolean,zIndex:numericProp,border:truthProp,leftText:String,rightText:String,leftArrow:Boolean,placeholder:Boolean,safeAreaInsetTop:Boolean,clickable:truthProp};var stdin_default$8=defineComponent({name:name$5,props:navBarProps,emits:["clickLeft","clickRight"],setup(t,{emit:e,slots:i}){const r=ref(),s=usePlaceholder(r,bem$5),o=m=>e("clickLeft",m),a=m=>e("clickRight",m),l=()=>i.left?i.left():[t.leftArrow&&createVNode(Icon$1,{class:bem$5("arrow"),name:"arrow-left"},null),t.leftText&&createVNode("span",{class:bem$5("text")},[t.leftText])],c=()=>i.right?i.right():createVNode("span",{class:bem$5("text")},[t.rightText]),u=()=>{const{title:m,fixed:d,border:g,zIndex:y}=t,b=getZIndexStyle(y),S=t.leftArrow||t.leftText||i.left,E=t.rightText||i.right;return createVNode("div",{ref:r,style:b,class:[bem$5({fixed:d}),{[BORDER_BOTTOM]:g,"van-safe-area-top":t.safeAreaInsetTop}]},[createVNode("div",{class:bem$5("content")},[S&&createVNode("div",{class:[bem$5("left"),t.clickable?HAPTICS_FEEDBACK:""],onClick:o},[l()]),createVNode("div",{class:[bem$5("title"),"van-ellipsis"]},[i.title?i.title():m]),E&&createVNode("div",{class:[bem$5("right"),t.clickable?HAPTICS_FEEDBACK:""],onClick:a},[c()])])])};return()=>t.fixed&&t.placeholder?s(u):u()}});const NavBar=withInstall(stdin_default$8),[name$4,bem$4]=createNamespace$1("notice-bar"),noticeBarProps={text:String,mode:String,color:String,delay:makeNumericProp(1),speed:makeNumericProp(60),leftIcon:String,wrapable:Boolean,background:String,scrollable:{type:Boolean,default:null}};var stdin_default$7=defineComponent({name:name$4,props:noticeBarProps,emits:["close","replay"],setup(t,{emit:e,slots:i}){let r=0,s=0,o;const a=ref(),l=ref(),c=reactive({show:!0,offset:0,duration:0}),u=()=>{if(i["left-icon"])return i["left-icon"]();if(t.leftIcon)return createVNode(Icon$1,{class:bem$4("left-icon"),name:t.leftIcon},null)},m=()=>{if(t.mode==="closeable")return"cross";if(t.mode==="link")return"arrow"},d=E=>{t.mode==="closeable"&&(c.show=!1,e("close",E))},g=()=>{if(i["right-icon"])return i["right-icon"]();const E=m();if(E)return createVNode(Icon$1,{name:E,class:bem$4("right-icon"),onClick:d},null)},y=()=>{c.offset=r,c.duration=0,raf(()=>{doubleRaf(()=>{c.offset=-s,c.duration=(s+r)/+t.speed,e("replay")})})},b=()=>{const E=t.scrollable===!1&&!t.wrapable,x={transform:c.offset?`translateX(${c.offset}px)`:"",transitionDuration:`${c.duration}s`};return createVNode("div",{ref:a,role:"marquee",class:bem$4("wrap")},[createVNode("div",{ref:l,style:x,class:[bem$4("content"),{"van-ellipsis":E}],onTransitionend:y},[i.default?i.default():t.text])])},S=()=>{const{delay:E,speed:x,scrollable:A}=t,_=isDef$1(E)?+E*1e3:0;r=0,s=0,c.offset=0,c.duration=0,clearTimeout(o),o=setTimeout(()=>{if(!a.value||!l.value||A===!1)return;const P=useRect(a).width,T=useRect(l).width;(A||T>P)&&doubleRaf(()=>{r=P,s=T,c.offset=-s,c.duration=s/+x})},_)};return onPopupReopen(S),onMountedOrActivated(S),useEventListener$1("pageshow",S),useExpose({reset:S}),watch(()=>[t.text,t.scrollable],S),()=>{const{color:E,wrapable:x,background:A}=t;return withDirectives(createVNode("div",{role:"alert",class:bem$4({wrapable:x}),style:{color:E,background:A}},[u(),b(),g()]),[[vShow,c.show]])}}});const NoticeBar=withInstall(stdin_default$7),[name$3,bem$3]=createNamespace$1("skeleton-title"),skeletonTitleProps={round:Boolean,titleWidth:numericProp};var stdin_default$6=defineComponent({name:name$3,props:skeletonTitleProps,setup(t){return()=>createVNode("h3",{class:bem$3([{round:t.round}]),style:{width:addUnit(t.titleWidth)}},null)}});const SkeletonTitle=withInstall(stdin_default$6);var stdin_default$5=SkeletonTitle;const[name$2,bem$2]=createNamespace$1("skeleton-avatar"),skeletonAvatarProps={avatarSize:numericProp,avatarShape:makeStringProp("round")};var stdin_default$4=defineComponent({name:name$2,props:skeletonAvatarProps,setup(t){return()=>createVNode("div",{class:bem$2([t.avatarShape]),style:getSizeStyle(t.avatarSize)},null)}});const SkeletonAvatar=withInstall(stdin_default$4);var stdin_default$3=SkeletonAvatar;const DEFAULT_ROW_WIDTH="100%",skeletonParagraphProps={round:Boolean,rowWidth:{type:numericProp,default:DEFAULT_ROW_WIDTH}},[name$1,bem$1]=createNamespace$1("skeleton-paragraph");var stdin_default$2=defineComponent({name:name$1,props:skeletonParagraphProps,setup(t){return()=>createVNode("div",{class:bem$1([{round:t.round}]),style:{width:t.rowWidth}},null)}});const SkeletonParagraph=withInstall(stdin_default$2);var stdin_default$1=SkeletonParagraph;const[name,bem]=createNamespace$1("skeleton"),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}};var stdin_default=defineComponent({name,inheritAttrs:!1,props:skeletonProps,setup(t,{slots:e,attrs:i}){const r=()=>{if(t.avatar)return createVNode(stdin_default$3,{avatarShape:t.avatarShape,avatarSize:t.avatarSize},null)},s=()=>{if(t.title)return createVNode(stdin_default$5,{round:t.round,titleWidth:t.titleWidth},null)},o=c=>{const{rowWidth:u}=t;return u===DEFAULT_ROW_WIDTH&&c===+t.row-1?DEFAULT_LAST_ROW_WIDTH:Array.isArray(u)?u[c]:u},a=()=>Array(+t.row).fill("").map((c,u)=>createVNode(stdin_default$1,{key:u,round:t.round,rowWidth:addUnit(o(u))},null)),l=()=>e.template?e.template():createVNode(Fragment,null,[r(),createVNode("div",{class:bem("content")},[s(),a()])]);return()=>{var c;return t.loading?createVNode("div",mergeProps({class:bem({animate:t.animate,round:t.round})},i),[l()]):(c=e.default)==null?void 0:c.call(e)}}});const Skeleton=withInstall(stdin_default),storeData=reactive({status:"init",user:{},platformType:"STUDENT",platformApi:"/api-student",proxy:"",isApp:!1}),setStoreData=t=>{Object.assign(storeData,t)},setUserInfo=t=>{storeData.status="login",storeData.user=t||{}};var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getAugmentedNamespace(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var i=function r(){if(this instanceof r){var s=[null];s.push.apply(s,arguments);var o=Function.bind.apply(e,s);return new o}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(i,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}),i}var assign$1=make_assign(),create$1=make_create(),trim$1=make_trim(),Global$5=typeof window<"u"?window:commonjsGlobal,util$i={assign:assign$1,create:create$1,trim:trim$1,bind:bind$3,slice:slice$3,each:each$8,map,pluck:pluck$1,isList:isList$1,isFunction:isFunction$4,isObject:isObject$3,Global:Global$5};function make_assign(){return Object.assign?Object.assign:function(e,i,r,s){for(var o=1;o"u"?null:console;if(t){var e=t.warn?t.warn:t.log;e.apply(t,arguments)}}function createStore(t,e,i){i||(i=""),t&&!isList(t)&&(t=[t]),e&&!isList(e)&&(e=[e]);var r=i?"__storejs_"+i+"_":"",s=i?new RegExp("^"+r):null,o=/^[a-zA-Z0-9_\-]*$/;if(!o.test(i))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var a={_namespacePrefix:r,_namespaceRegexp:s,_testStorage:function(c){try{var u="__storejs__test__";c.write(u,u);var m=c.read(u)===u;return c.remove(u),m}catch(d){return!1}},_assignPluginFnProp:function(c,u){var m=this[u];this[u]=function(){var g=slice$2(arguments,0),y=this;function b(){if(m)return each$7(arguments,function(E,x){g[x]=E}),m.apply(y,g)}var S=[b].concat(g);return c.apply(y,S)}},_serialize:function(c){return JSON.stringify(c)},_deserialize:function(c,u){if(!c)return u;var m="";try{m=JSON.parse(c)}catch(d){m=c}return m!==void 0?m:u},_addStorage:function(c){this.enabled||this._testStorage(c)&&(this.storage=c,this.enabled=!0)},_addPlugin:function(c){var u=this;if(isList(c)){each$7(c,function(g){u._addPlugin(g)});return}var m=pluck(this.plugins,function(g){return c===g});if(!m){if(this.plugins.push(c),!isFunction$3(c))throw new Error("Plugins must be function values that return objects");var d=c.call(this);if(!isObject$2(d))throw new Error("Plugins must return an object of function properties");each$7(d,function(g,y){if(!isFunction$3(g))throw new Error("Bad plugin property: "+y+" from plugin "+c.name+". Plugins should only return functions.");u._assignPluginFnProp(g,y)})}},addStorage:function(c){_warn("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(c)}},l=create(a,storeAPI,{plugins:[]});return l.raw={},each$7(l,function(c,u){isFunction$3(c)&&(l.raw[u]=bind$2(l,c))}),each$7(t,function(c){l._addStorage(c)}),each$7(e,function(c){l._addPlugin(c)}),l}var util$g=util$i,Global$4=util$g.Global,localStorage_1={name:"localStorage",read:read$5,write:write$5,each:each$6,remove:remove$6,clearAll:clearAll$5};function localStorage$1(){return Global$4.localStorage}function read$5(t){return localStorage$1().getItem(t)}function write$5(t,e){return localStorage$1().setItem(t,e)}function each$6(t){for(var e=localStorage$1().length-1;e>=0;e--){var i=localStorage$1().key(e);t(read$5(i),i)}}function remove$6(t){return localStorage$1().removeItem(t)}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(t){return globalStorage[t]}function write$4(t,e){globalStorage[t]=e}function each$5(t){for(var e=globalStorage.length-1;e>=0;e--){var i=globalStorage.key(e);t(globalStorage[i],i)}}function remove$5(t){return globalStorage.removeItem(t)}function clearAll$4(){each$5(function(t,e){delete globalStorage[t]})}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(t,e){if(!disable$1){var i=fixKey(t);_withStorageEl(function(r){r.setAttribute(i,e),r.save(storageName)})}}function read$3(t){if(!disable$1){var e=fixKey(t),i=null;return _withStorageEl(function(r){i=r.getAttribute(e)}),i}}function each$4(t){_withStorageEl(function(e){for(var i=e.XMLDocument.documentElement.attributes,r=i.length-1;r>=0;r--){var s=i[r];t(e.getAttribute(s.name),s.name)}})}function remove$4(t){var e=fixKey(t);_withStorageEl(function(i){i.removeAttribute(e),i.save(storageName)})}function clearAll$3(){_withStorageEl(function(t){var e=t.XMLDocument.documentElement.attributes;t.load(storageName);for(var i=e.length-1;i>=0;i--)t.removeAttribute(e[i].name);t.save(storageName)})}var forbiddenCharsRegex=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function fixKey(t){return t.replace(/^\d/,"___$&").replace(forbiddenCharsRegex,"___")}function _makeIEStorageElFunction(){if(!doc$1||!doc$1.documentElement||!doc$1.documentElement.addBehavior)return null;var t="script",e,i,r;try{i=new ActiveXObject("htmlfile"),i.open(),i.write("<"+t+">document.w=window'),i.close(),e=i.w.frames[0].document,r=e.createElement("div")}catch(s){r=doc$1.createElement("div"),e=doc$1.body}return function(s){var o=[].slice.call(arguments,0);o.unshift(r),e.appendChild(r),r.addBehavior("#default#userData"),r.load(storageName),s.apply(this,o),e.removeChild(r)}}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(t){if(!t||!_has(t))return null;var e="(?:^|.*;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(doc.cookie.replace(new RegExp(e),"$1"))}function each$3(t){for(var e=doc.cookie.split(/; ?/g),i=e.length-1;i>=0;i--)if(trim(e[i])){var r=e[i].split("="),s=unescape(r[0]),o=unescape(r[1]);t(o,s)}}function write$2(t,e){t&&(doc.cookie=escape(t)+"="+escape(e)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function remove$3(t){!t||!_has(t)||(doc.cookie=escape(t)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function clearAll$2(){each$3(function(t,e){remove$3(e)})}function _has(t){return new RegExp("(?:^|;\\s*)"+escape(t).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(t){return sessionStorage$1().getItem(t)}function write$1(t,e){return sessionStorage$1().setItem(t,e)}function each$2(t){for(var e=sessionStorage$1().length-1;e>=0;e--){var i=sessionStorage$1().key(e);t(read$1(i),i)}}function remove$2(t){return sessionStorage$1().removeItem(t)}function clearAll$1(){return sessionStorage$1().clear()}var memoryStorage_1={name:"memoryStorage",read,write,each:each$1,remove:remove$1,clearAll},memoryStorage={};function read(t){return memoryStorage[t]}function write(t,e){memoryStorage[t]=e}function each$1(t){for(var e in memoryStorage)memoryStorage.hasOwnProperty(e)&&t(memoryStorage[e],e)}function remove$1(t){delete memoryStorage[t]}function clearAll(t){memoryStorage={}}var all=[localStorage_1,oldFFGlobalStorage,oldIEUserDataStorage,cookieStorage,sessionStorage_1,memoryStorage_1],json2$1={},hasRequiredJson2;function requireJson2(){return hasRequiredJson2||(hasRequiredJson2=1,typeof JSON!="object"&&(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;function f(t){return t<10?"0"+t:t}function this_value(){return this.valueOf()}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;function quote(t){return rx_escapable.lastIndex=0,rx_escapable.test(t)?'"'+t.replace(rx_escapable,function(e){var i=meta[e];return typeof i=="string"?i:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var i,r,s,o,a=gap,l,c=e[t];switch(c&&typeof c=="object"&&typeof c.toJSON=="function"&&(c=c.toJSON(t)),typeof rep=="function"&&(c=rep.call(e,t,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";if(gap+=indent,l=[],Object.prototype.toString.apply(c)==="[object Array]"){for(o=c.length,i=0;it==null,strictUriEncode=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),encodeFragmentIdentifier=Symbol("encodeFragmentIdentifier");function encoderForArrayFormat(t){switch(t.arrayFormat){case"index":return e=>(i,r)=>{const s=i.length;return r===void 0||t.skipNull&&r===null||t.skipEmptyString&&r===""?i:r===null?[...i,[encode$1(e,t),"[",s,"]"].join("")]:[...i,[encode$1(e,t),"[",encode$1(s,t),"]=",encode$1(r,t)].join("")]};case"bracket":return e=>(i,r)=>r===void 0||t.skipNull&&r===null||t.skipEmptyString&&r===""?i:r===null?[...i,[encode$1(e,t),"[]"].join("")]:[...i,[encode$1(e,t),"[]=",encode$1(r,t)].join("")];case"colon-list-separator":return e=>(i,r)=>r===void 0||t.skipNull&&r===null||t.skipEmptyString&&r===""?i:r===null?[...i,[encode$1(e,t),":list="].join("")]:[...i,[encode$1(e,t),":list=",encode$1(r,t)].join("")];case"comma":case"separator":case"bracket-separator":{const e=t.arrayFormat==="bracket-separator"?"[]=":"=";return i=>(r,s)=>s===void 0||t.skipNull&&s===null||t.skipEmptyString&&s===""?r:(s=s===null?"":s,r.length===0?[[encode$1(i,t),e,encode$1(s,t)].join("")]:[[r,encode$1(s,t)].join(t.arrayFormatSeparator)])}default:return e=>(i,r)=>r===void 0||t.skipNull&&r===null||t.skipEmptyString&&r===""?i:r===null?[...i,encode$1(e,t)]:[...i,[encode$1(e,t),"=",encode$1(r,t)].join("")]}}function parserForArrayFormat(t){let e;switch(t.arrayFormat){case"index":return(i,r,s)=>{if(e=/\[(\d*)]$/.exec(i),i=i.replace(/\[\d*]$/,""),!e){s[i]=r;return}s[i]===void 0&&(s[i]={}),s[i][e[1]]=r};case"bracket":return(i,r,s)=>{if(e=/(\[])$/.exec(i),i=i.replace(/\[]$/,""),!e){s[i]=r;return}if(s[i]===void 0){s[i]=[r];return}s[i]=[...s[i],r]};case"colon-list-separator":return(i,r,s)=>{if(e=/(:list)$/.exec(i),i=i.replace(/:list$/,""),!e){s[i]=r;return}if(s[i]===void 0){s[i]=[r];return}s[i]=[...s[i],r]};case"comma":case"separator":return(i,r,s)=>{const o=typeof r=="string"&&r.includes(t.arrayFormatSeparator),a=typeof r=="string"&&!o&&decode$3(r,t).includes(t.arrayFormatSeparator);r=a?decode$3(r,t):r;const l=o||a?r.split(t.arrayFormatSeparator).map(c=>decode$3(c,t)):r===null?r:decode$3(r,t);s[i]=l};case"bracket-separator":return(i,r,s)=>{const o=/(\[])$/.test(i);if(i=i.replace(/\[]$/,""),!o){s[i]=r&&decode$3(r,t);return}const a=r===null?[]:r.split(t.arrayFormatSeparator).map(l=>decode$3(l,t));if(s[i]===void 0){s[i]=a;return}s[i]=[...s[i],...a]};default:return(i,r,s)=>{if(s[i]===void 0){s[i]=r;return}s[i]=[...[s[i]].flat(),r]}}}function validateArrayFormatSeparator(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function encode$1(t,e){return e.encode?e.strict?strictUriEncode(t):encodeURIComponent(t):t}function decode$3(t,e){return e.decode?decodeUriComponent(t):t}function keysSorter(t){return Array.isArray(t)?t.sort():typeof t=="object"?keysSorter(Object.keys(t)).sort((e,i)=>Number(e)-Number(i)).map(e=>t[e]):t}function removeHash(t){const e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function getHash(t){let e="";const i=t.indexOf("#");return i!==-1&&(e=t.slice(i)),e}function parseValue(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function extract(t){t=removeHash(t);const e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function parse$5(t,e){e={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...e},validateArrayFormatSeparator(e.arrayFormatSeparator);const i=parserForArrayFormat(e),r=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return r;for(const s of t.split("&")){if(s==="")continue;const o=e.decode?s.replace(/\+/g," "):s;let[a,l]=splitOnFirst(o,"=");a===void 0&&(a=o),l=l===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?l:decode$3(l,e),i(decode$3(a,e),l,r)}for(const[s,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[a,l]of Object.entries(o))o[a]=parseValue(l,e);else r[s]=parseValue(o,e);return e.sort===!1?r:(e.sort===!0?Object.keys(r).sort():Object.keys(r).sort(e.sort)).reduce((s,o)=>{const a=r[o];return a&&typeof a=="object"&&!Array.isArray(a)?s[o]=keysSorter(a):s[o]=a,s},Object.create(null))}function stringify$2(t,e){if(!t)return"";e={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...e},validateArrayFormatSeparator(e.arrayFormatSeparator);const i=a=>e.skipNull&&isNullOrUndefined(t[a])||e.skipEmptyString&&t[a]==="",r=encoderForArrayFormat(e),s={};for(const[a,l]of Object.entries(t))i(a)||(s[a]=l);const o=Object.keys(s);return e.sort!==!1&&o.sort(e.sort),o.map(a=>{const l=t[a];return l===void 0?"":l===null?encode$1(a,e):Array.isArray(l)?l.length===0&&e.arrayFormat==="bracket-separator"?encode$1(a,e)+"[]":l.reduce(r(a),[]).join("&"):encode$1(a,e)+"="+encode$1(l,e)}).filter(a=>a.length>0).join("&")}function parseUrl(t,e){var s,o;e={decode:!0,...e};let[i,r]=splitOnFirst(t,"#");return i===void 0&&(i=t),{url:(o=(s=i==null?void 0:i.split("?"))==null?void 0:s[0])!=null?o:"",query:parse$5(extract(t),e),...e&&e.parseFragmentIdentifier&&r?{fragmentIdentifier:decode$3(r,e)}:{}}}function stringifyUrl(t,e){e={encode:!0,strict:!0,[encodeFragmentIdentifier]:!0,...e};const i=removeHash(t.url).split("?")[0]||"",r=extract(t.url),s={...parse$5(r,{sort:!1}),...t.query};let o=stringify$2(s,e);o&&(o=`?${o}`);let a=getHash(t.url);if(t.fragmentIdentifier){const l=new URL(i);l.hash=t.fragmentIdentifier,a=e[encodeFragmentIdentifier]?l.hash:`#${t.fragmentIdentifier}`}return`${i}${o}${a}`}function pick(t,e,i){i={parseFragmentIdentifier:!0,[encodeFragmentIdentifier]:!1,...i};const{url:r,query:s,fragmentIdentifier:o}=parseUrl(t,i);return stringifyUrl({url:r,query:includeKeys(s,e),fragmentIdentifier:o},i)}function exclude(t,e,i){const r=Array.isArray(e)?s=>!e.includes(s):(s,o)=>!e(s,o);return pick(t,r,i)}const queryString=Object.freeze(Object.defineProperty({__proto__:null,exclude,extract,parse:parse$5,parseUrl,pick,stringify:stringify$2,stringifyUrl},Symbol.toStringTag,{value:"Module"})),getQuery=()=>{let t={};try{t={...queryString.parse(location.search),...queryString.parse(location.hash.split("?")[1])}}catch(e){}return{...t}},browser=()=>{const t=navigator.userAgent;return{trident:t.indexOf("Trident")>-1,presto:t.indexOf("Presto")>-1,webKit:t.indexOf("AppleWebKit")>-1,gecko:t.indexOf("Gecko")>-1&&t.indexOf("KHTML")==-1,mobile:!!t.match(/AppleWebKit.*Mobile.*/),ios:!!t.match(/Mac OS X/)||/(iPhone|iPad|iPod|iOS)/i.test(t),android:t.indexOf("Android")>-1||t.indexOf("Adr")>-1,iPhone:t.indexOf("ORCHESTRAAPPI")>-1,isApp:t.includes("DAYAAPPA")||t.includes("DAYAAPPI")||t.includes("COLEXIUAPPA")||t.includes("COLEXIUAPPI")||t.includes("ORCHESTRAAPPI")||t.includes("ORCHESTRAAPPA"),isTeacher:t.indexOf("ORCHESTRATEACHER")>-1||t.includes("COLEXIUTEACHER"),isStudent:t.indexOf("ORCHESTRASTUDENT")>-1||t.includes("COLEXIUSTUDENT"),isSchool:t.indexOf("ORCHESTRASCHOOL")>-1,iPad:t.indexOf("iPad")>-1,webApp:t.indexOf("Safari")==-1,weixin:t.indexOf("MicroMessenger")>-1,alipay:t.indexOf("AlipayClient")>-1,huawei:!!t.match(/huawei/i)||!!t.match(/honor/i),xiaomi:!!t.match(/mi\s/i)||!!t.match(/redmi/i)||!!t.match(/mix/i)}},getRandomKey=()=>""+Date.now()+Math.floor(Math.random()*1e6),AuthorizationKey="AUTHORIZATION",setToken=t=>{sessionStorage.setItem(AuthorizationKey,t)},getToken=()=>sessionStorage.getItem(AuthorizationKey)||"",setGlobalData=(t,e)=>{if(!t||!e)return;const i=window.GYM||{};i[t]=e,window.GYM=i},BEHAVIORIDKEY="BEHAVIORID",setBehaviorId=t=>{localStorage.setItem(BEHAVIORIDKEY,t)},getBehaviorId=()=>localStorage.getItem(BEHAVIORIDKEY),campIdKey="CAMPID",setCampId=t=>{sessionStorage.setItem(campIdKey,t)},getCampId=()=>sessionStorage.getItem(campIdKey)||"",getSecondRPM=(t,e)=>{if(isNaN(t))return"00:00";let i=Math.floor(t/60/60%24),r=Math.floor(t/60%60),s=Math.floor(t%60);return e==="cn"?`${i>0?i.toString().padStart(2,"0")+"时":""}${r.toString().padStart(2,"0")}分${s.toString().padStart(2,"0")}秒`:`${i>0?i.toString().padStart(2,"0")+":":""}${r.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`},SPEEDKEY="speeds",setStorageSpeed=(t,e)=>{const i=store_legacy.get(SPEEDKEY)||{};i[t]=e,store_legacy.set(SPEEDKEY,i)},getStorageSpeed=t=>(store_legacy.get(SPEEDKEY)||{})[t]||0,matchProductApiUrl=()=>{const t=getQuery(),e={cbs:{dev:"https://dev.resource.colexiu.com",test:"https://test.resource.colexiu.com",online:"https://mec.colexiu.com"},gym:{dev:"https://dev.dayaedu.com",test:"https://test.dayaedu.com",online:"https://online.dayaedu.com"},colexiu:{dev:"https://dev.colexiu.com/",test:"https://test.colexiu.com",online:"https://online.colexiu.com"},orchestra:{dev:"https://dev.lexiaoya.cn",test:"https://test.lexiaoya.cn",online:"https://online.lexiaoya.cn"},instrument:{dev:"https://dev.kt.colexiu.com",test:"https://test.kt.colexiu.com",test2:"https://test.lexiaoya.cn",online:"https://kt.colexiu.com"}};let i=location.origin.includes("//dev")?"dev":location.origin.includes("//test")?"test":location.origin.includes("//online")||location.origin.includes("//kt")||location.origin.includes("//mec")?"online":"dev";if(t.isCbs)return e.cbs[i]+"/cbs-app";{const r=location.pathname.includes("gym")?"gym":location.pathname.includes("colexiu")?"colexiu":location.pathname.includes("orchestra")?"orchestra":"instrument";return r==="instrument"&&i==="test"&&(i=location.origin.includes("//test.kt")?"test":"test2"),e[r][i]+"/edu-app"}},debounce=(t,e=0)=>{let i;return function(...r){clearTimeout(i),i=setTimeout(()=>t.apply(this,r),e)}},originalPostMessage=window.postMessage;window.postMessage=t=>{originalPostMessage(t,"*")};const loop=()=>{},calls={};var oi,ai,li,ci,ui,hi;const instance=window.DAYA||((ai=(oi=window.webkit)==null?void 0:oi.messageHandlers)==null?void 0:ai.DAYA)||window.COLEXIU||((ci=(li=window.webkit)==null?void 0:li.messageHandlers)==null?void 0:ci.COLEXIU)||window.ORCHESTRA||((hi=(ui=window.webkit)==null?void 0:ui.messageHandlers)==null?void 0:hi.ORCHESTRA);instance&&window.addEventListener("message",t=>{var e,i;try{const r=t.data?typeof t.data=="object"?t.data:JSON.parse(t.data):{},s=((e=r.content)==null?void 0:e.uuid)||r.uuid;try{r.content&&(r.content=JSON.parse(r.content))}catch(l){}if(!s){const l=Object.keys(calls).filter(c=>c.indexOf(r.api)===0);for(const c of l){const u=calls[c]||loop;typeof u=="function"&&u(r),Array.isArray(u)&&u.forEach(m=>{typeof m=="function"&&m(r)})}return}const o=((i=r.content)==null?void 0:i.uuid)||r.uuid||r.api+r.uuid,a=calls[o]||loop;typeof a=="function"&&a(r)}catch(r){console.error("通信消息解析错误",r)}});const postMessage=(t,e)=>{if(instance){const i=getRandomKey();calls[i]=e||loop,t.content=t.content?{...t.content,uuid:i}:{uuid:i},instance.postMessage(JSON.stringify(t)),console.log("h5_请求_api:",t)}},listenerMessage=(t,e)=>{const i=t;calls[i]||(calls[i]=[]),calls[i].push(e||loop)},removeListenerMessage=(t,e)=>{const i=t;if(Array.isArray(calls[i])){const r=calls[i].indexOf(e);calls[i].splice(r,1)}},promisefiyPostMessage=t=>new Promise(e=>{postMessage(t,i=>e(i))}),api_getToken=()=>storeData.isApp?promisefiyPostMessage({api:"getToken"}):Promise.resolve({}),getEarphone=()=>storeData.isApp?promisefiyPostMessage({api:"isWiredHeadsetOn"}):Promise.resolve({}),isSpecialShapedScreen=()=>storeData.isApp?promisefiyPostMessage({api:"isSpecialShapedScreen"}):Promise.resolve({}),sendResult=t=>{listenerMessage("sendResult",t)},removeResult=t=>{removeListenerMessage("sendResult",t)},endSoundCheck=()=>{postMessage({api:"endSoundCheck"})},startEvaluating=t=>storeData.isApp?promisefiyPostMessage({api:"startEvaluating",content:t}):Promise.resolve({}),endEvaluating=t=>storeData.isApp?promisefiyPostMessage({api:"endEvaluating",content:t}):Promise.resolve({}),cancelEvaluating=()=>{postMessage({api:"cancelEvaluating"})},api_startRecordingCb=(t,e)=>{postMessage({api:"startRecording",content:t},e)},api_proxyServiceMessage=t=>storeData.isApp?promisefiyPostMessage({api:"proxyServiceMessage",content:t}):Promise.resolve({}),api_recordStartTime=t=>{listenerMessage("recordStartTime",t)},api_remove_recordStartTime=t=>{removeListenerMessage("recordStartTime",t)},api_videoUpdate=t=>{postMessage({api:"videoUpdate"},t)},api_shareAchievements=t=>storeData.isApp?promisefiyPostMessage({api:"shareAchievements",content:t}):Promise.resolve({}),api_openWebView=t=>storeData.isApp?promisefiyPostMessage({api:"openWebView",content:t}):Promise.resolve({}),api_openCamera=()=>storeData.isApp?promisefiyPostMessage({api:"openCamera"}):Promise.resolve({}),api_closeCamera=()=>storeData.isApp?promisefiyPostMessage({api:"closeCamera"}):Promise.resolve({}),api_setStatusBarVisibility=()=>{postMessage({api:"setStatusBarVisibility",content:{isVisibility:0}})},api_cloudToggleFollow=t=>storeData.isApp?promisefiyPostMessage({api:"cloudToggleFollow",content:{state:t}}):Promise.resolve({}),api_cloudFollowTime=(t,e=!0)=>{e?listenerMessage("cloudFollowTime",t):removeListenerMessage("cloudFollowTime",t)},api_goback=()=>{postMessage({api:"goBack"})},api_back=()=>{postMessage({api:"back"})},api_cloudLoading=(t=!1)=>{postMessage({api:"cloudLoading",content:{show:t,type:"fullscreen"}})},api_cloudDestroy=()=>{postMessage({api:"cloudDestroy"})},api_setEventTracking=()=>{postMessage({api:"setEventTracking",content:{type:"klx_xiaokuAI"}})},api_savePicture=t=>storeData.isApp?promisefiyPostMessage({api:"savePicture",content:t}):Promise.resolve({}),api_setCache=t=>{postMessage({api:"setCache",content:t})},api_suspendPlay=t=>{listenerMessage("suspendPlay",t)},api_startCapture=()=>{postMessage({api:"startCapture"})},api_endCapture=()=>{postMessage({api:"endCapture"})},api_getDeviceDelay=()=>storeData.isApp?promisefiyPostMessage({api:"getDeviceDelay"}):Promise.resolve({}),api_toggleTune=(t,e)=>{if(!storeData.isApp)return Promise.resolve({});if(t==="start")return promisefiyPostMessage({api:"startTune",content:{count:e+""}});if(t==="stop")return promisefiyPostMessage({api:"endTune"});if(t==="finishTune")return promisefiyPostMessage({api:"finishTune"})},api_createMusicPlayer=t=>storeData.isApp?promisefiyPostMessage({api:"createMusicPlayer",content:t}):Promise.resolve({}),api_keepScreenLongLight=()=>{postMessage({api:"keepScreenLongLight",content:{isOpenLight:!0}})},api_setRequestedOrientation=t=>{postMessage({api:"setRequestedOrientation",content:{orientation:t}})},api_playProgress=t=>{listenerMessage("playProgress",t)},api_openAdjustRecording=t=>{postMessage({api:"openAdjustRecording",content:t})},hideComplexButton=(t,e)=>{e?listenerMessage("hideComplexButton",t):removeListenerMessage("hideComplexButton",t)},addCheckPlayEnd=t=>{listenerMessage("checkPlayEnd",t)},removeCheckPlayEnd=t=>{removeListenerMessage("checkPlayEnd",t)},api_checkSocketStatus=()=>promisefiyPostMessage({api:"checkSocketStatus"}),addAccompanyError=t=>{listenerMessage("accompanyError",t)},removeAccompanyError=t=>{removeListenerMessage("accompanyError",t)},addSocketStatus=t=>{listenerMessage("socketConnectSuccessReport",t)},removeSocketStatus=t=>{removeListenerMessage("socketConnectSuccessReport",t)},api_disconnectSocket=()=>promisefiyPostMessage({api:"disconnectSocket"}),api_cloudDetail=(t,e)=>{postMessage({api:"cloudDetail",content:t},e)},api_cloudGetMediaStatus=()=>promisefiyPostMessage({api:"cloudGetMediaStatus"}),api_cloudPlay=t=>{promisefiyPostMessage({api:"cloudPlay",content:t})},api_cloudSuspend=t=>{promisefiyPostMessage({api:"cloudSuspend",content:t})},api_cloudSetCurrentTime=t=>{promisefiyPostMessage({api:"cloudSetCurrentTime",content:t})},api_cloudChangeSpeed=t=>{promisefiyPostMessage({api:"cloudChangeSpeed",content:t})},api_cloudVolume=t=>{promisefiyPostMessage({api:"cloudVolume",content:t})},api_cloudTimeUpdae=t=>{listenerMessage("cloudTimeUpdae",t)},api_remove_cloudTimeUpdae=t=>{removeListenerMessage("cloudTimeUpdae",t)},api_cloudplayed=t=>{listenerMessage("cloudplayed",t)},api_remove_cloudplayed=t=>{removeListenerMessage("cloudplayed",t)},api_midiMicDelay=t=>{postMessage({api:"proxyServiceMessage",content:t})},TheError=defineComponent({name:"The-error",setup(t,e){return()=>createVNode("div",null,[createVNode(NavBar,{leftArrow:!0,onClickLeft:()=>{api_back()}},null),createVNode(Empty,{image:"error",description:"网络开小差,请稍后重试"},{default:()=>[createVNode(Button$1,{type:"primary",size:"small",onClick:()=>history.go(0)},{default:()=>[createTextVNode("重新加载")]})]})])}});var shams=function t(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},i=Symbol("test"),r=Object(i);if(typeof i=="string"||Object.prototype.toString.call(i)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var s=42;e[i]=s;for(i in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==i||!Object.prototype.propertyIsEnumerable.call(e,i))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,i);if(a.value!==s||a.enumerable!==!0)return!1}return!0},origSymbol=typeof Symbol<"u"&&Symbol,hasSymbolSham=shams,hasSymbols$1=function t(){return typeof origSymbol!="function"||typeof Symbol!="function"||typeof origSymbol("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1: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 t(e){var i=this;if(typeof i!="function"||toStr$1.call(i)!==funcType)throw new TypeError(ERROR_MESSAGE+i);for(var r=slice$1.call(arguments,1),s,o=function(){if(this instanceof s){var m=i.apply(this,r.concat(slice$1.call(arguments)));return Object(m)===m?m:this}else return i.apply(e,r.concat(slice$1.call(arguments)))},a=Math.max(0,i.length-r.length),l=[],c=0;c"u"?undefined$1:getProto(Uint8Array),INTRINSICS={"%AggregateError%":typeof AggregateError>"u"?undefined$1:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$1:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols?getProto([][Symbol.iterator]()):undefined$1,"%AsyncFromSyncIteratorPrototype%":undefined$1,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":typeof Atomics>"u"?undefined$1:Atomics,"%BigInt%":typeof BigInt>"u"?undefined$1:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?undefined$1:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?undefined$1:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?undefined$1:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?undefined$1:Float32Array,"%Float64Array%":typeof Float64Array>"u"?undefined$1:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?undefined$1:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":typeof Int8Array>"u"?undefined$1:Int8Array,"%Int16Array%":typeof Int16Array>"u"?undefined$1:Int16Array,"%Int32Array%":typeof Int32Array>"u"?undefined$1:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols?getProto(getProto([][Symbol.iterator]())):undefined$1,"%JSON%":typeof JSON=="object"?JSON:undefined$1,"%Map%":typeof Map>"u"?undefined$1:Map,"%MapIteratorPrototype%":typeof Map>"u"||!hasSymbols?undefined$1:getProto(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?undefined$1:Promise,"%Proxy%":typeof Proxy>"u"?undefined$1:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?undefined$1:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?undefined$1:Set,"%SetIteratorPrototype%":typeof Set>"u"||!hasSymbols?undefined$1:getProto(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$1:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols?getProto(""[Symbol.iterator]()):undefined$1,"%Symbol%":hasSymbols?Symbol:undefined$1,"%SyntaxError%":$SyntaxError,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError$1,"%Uint8Array%":typeof Uint8Array>"u"?undefined$1:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?undefined$1:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?undefined$1:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?undefined$1:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?undefined$1:WeakMap,"%WeakRef%":typeof WeakRef>"u"?undefined$1:WeakRef,"%WeakSet%":typeof WeakSet>"u"?undefined$1:WeakSet};try{null.error}catch(t){var errorProto=getProto(getProto(t));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function t(e){var i;if(e==="%AsyncFunction%")i=getEvalledConstructor("async function () {}");else if(e==="%GeneratorFunction%")i=getEvalledConstructor("function* () {}");else if(e==="%AsyncGeneratorFunction%")i=getEvalledConstructor("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(i=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=t("%AsyncGenerator%");s&&(i=getProto(s.prototype))}return INTRINSICS[e]=i,i},LEGACY_ALIASES={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind=functionBind,hasOwn$1=src$1,$concat$1=bind.call(Function.call,Array.prototype.concat),$spliceApply=bind.call(Function.apply,Array.prototype.splice),$replace$1=bind.call(Function.call,String.prototype.replace),$strSlice=bind.call(Function.call,String.prototype.slice),$exec=bind.call(Function.call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function t(e){var i=$strSlice(e,0,1),r=$strSlice(e,-1);if(i==="%"&&r!=="%")throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&i!=="%")throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");var s=[];return $replace$1(e,rePropName,function(o,a,l,c){s[s.length]=l?$replace$1(c,reEscapeChar,"$1"):a||o}),s},getBaseIntrinsic=function t(e,i){var r=e,s;if(hasOwn$1(LEGACY_ALIASES,r)&&(s=LEGACY_ALIASES[r],r="%"+s[0]+"%"),hasOwn$1(INTRINSICS,r)){var o=INTRINSICS[r];if(o===needsEval&&(o=doEval(r)),typeof o>"u"&&!i)throw new $TypeError$1("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:o}}throw new $SyntaxError("intrinsic "+e+" does not exist!")},getIntrinsic=function t(e,i){if(typeof e!="string"||e.length===0)throw new $TypeError$1("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof i!="boolean")throw new $TypeError$1('"allowMissing" argument must be a boolean');if($exec(/^%?[^%]*%?$/,e)===null)throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=stringToPath(e),s=r.length>0?r[0]:"",o=getBaseIntrinsic("%"+s+"%",i),a=o.name,l=o.value,c=!1,u=o.alias;u&&(s=u[0],$spliceApply(r,$concat$1([0,1],u)));for(var m=1,d=!0;m=r.length){var S=$gOPD(l,g);d=!!S,d&&"get"in S&&!("originalValue"in S.get)?l=S.get:l=l[g]}else d=hasOwn$1(l,g),l=l[g];d&&!c&&(INTRINSICS[a]=l)}}return l},callBindExports={},callBind$1={get exports(){return callBindExports},set exports(t){callBindExports=t}};(function(t){var e=functionBind,i=getIntrinsic,r=i("%Function.prototype.apply%"),s=i("%Function.prototype.call%"),o=i("%Reflect.apply%",!0)||e.call(s,r),a=i("%Object.getOwnPropertyDescriptor%",!0),l=i("%Object.defineProperty%",!0),c=i("%Math.max%");if(l)try{l({},"a",{value:1})}catch(m){l=null}t.exports=function(d){var g=o(e,s,arguments);if(a&&l){var y=a(g,"length");y.configurable&&l(g,"length",{value:1+c(0,d.length-(arguments.length-1))})}return g};var u=function(){return o(e,r,arguments)};l?l(t.exports,"apply",{value:u}):t.exports.apply=u})(callBind$1);var GetIntrinsic$1=getIntrinsic,callBind=callBindExports,$indexOf=callBind(GetIntrinsic$1("String.prototype.indexOf")),callBound$1=function t(e,i){var r=GetIntrinsic$1(e,!!i);return typeof r=="function"&&$indexOf(e,".prototype.")>-1?callBind(r):r};const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$0$1=getAugmentedNamespace(__viteBrowserExternal$1);var hasMap=typeof Map=="function"&&Map.prototype,mapSizeDescriptor=Object.getOwnPropertyDescriptor&&hasMap?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,mapSize=hasMap&&mapSizeDescriptor&&typeof mapSizeDescriptor.get=="function"?mapSizeDescriptor.get:null,mapForEach=hasMap&&Map.prototype.forEach,hasSet=typeof Set=="function"&&Set.prototype,setSizeDescriptor=Object.getOwnPropertyDescriptor&&hasSet?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,setSize=hasSet&&setSizeDescriptor&&typeof setSizeDescriptor.get=="function"?setSizeDescriptor.get:null,setForEach=hasSet&&Set.prototype.forEach,hasWeakMap=typeof WeakMap=="function"&&WeakMap.prototype,weakMapHas=hasWeakMap?WeakMap.prototype.has:null,hasWeakSet=typeof WeakSet=="function"&&WeakSet.prototype,weakSetHas=hasWeakSet?WeakSet.prototype.has:null,hasWeakRef=typeof WeakRef=="function"&&WeakRef.prototype,weakRefDeref=hasWeakRef?WeakRef.prototype.deref:null,booleanValueOf=Boolean.prototype.valueOf,objectToString$2=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=typeof BigInt=="function"?BigInt.prototype.valueOf:null,gOPS=Object.getOwnPropertySymbols,symToString=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,hasShammedSymbols=typeof Symbol=="function"&&typeof Symbol.iterator=="object",toStringTag=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===hasShammedSymbols||"symbol")?Symbol.toStringTag:null,isEnumerable=Object.prototype.propertyIsEnumerable,gPO=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function addNumericSeparator(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||$test.call(/e/,e))return e;var i=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-$floor(-t):$floor(t);if(r!==t){var s=String(r),o=$slice.call(e,s.length+1);return $replace.call(s,i,"$&_")+"."+$replace.call($replace.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return $replace.call(e,i,"$&_")}var utilInspect=require$$0$1,inspectCustom=utilInspect.custom,inspectSymbol=isSymbol(inspectCustom)?inspectCustom:null,objectInspect=function t(e,i,r,s){var o=i||{};if(has$3(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(has$3(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=has$3(o,"customInspect")?o.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(has$3(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(has$3(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return inspectString(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return l?addNumericSeparator(e,c):c}if(typeof e=="bigint"){var u=String(e)+"n";return l?addNumericSeparator(e,u):u}var m=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=m&&m>0&&typeof e=="object")return isArray$7(e)?"[Array]":"[Object]";var d=getIndent(o,r);if(typeof s>"u")s=[];else if(indexOf$2(s,e)>=0)return"[Circular]";function g(z,R,H){if(R&&(s=$arrSlice.call(s),s.push(R)),H){var O={depth:o.depth};return has$3(o,"quoteStyle")&&(O.quoteStyle=o.quoteStyle),t(z,O,r+1,s)}return t(z,o,r+1,s)}if(typeof e=="function"&&!isRegExp$1(e)){var y=nameOf(e),b=arrObjKeys(e,g);return"[Function"+(y?": "+y:" (anonymous)")+"]"+(b.length>0?" { "+$join.call(b,", ")+" }":"")}if(isSymbol(e)){var S=hasShammedSymbols?$replace.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):symToString.call(e);return typeof e=="object"&&!hasShammedSymbols?markBoxed(S):S}if(isElement(e)){for(var E="<"+$toLowerCase.call(String(e.nodeName)),x=e.attributes||[],A=0;A",E}if(isArray$7(e)){if(e.length===0)return"[]";var _=arrObjKeys(e,g);return d&&!singleLineValues(_)?"["+indentedJoin(_,d)+"]":"[ "+$join.call(_,", ")+" ]"}if(isError(e)){var P=arrObjKeys(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!isEnumerable.call(e,"cause")?"{ ["+String(e)+"] "+$join.call($concat.call("[cause]: "+g(e.cause),P),", ")+" }":P.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+$join.call(P,", ")+" }"}if(typeof e=="object"&&a){if(inspectSymbol&&typeof e[inspectSymbol]=="function"&&utilInspect)return utilInspect(e,{depth:m-r});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(isMap$2(e)){var T=[];return mapForEach&&mapForEach.call(e,function(z,R){T.push(g(R,e,!0)+" => "+g(z,e))}),collectionOf("Map",mapSize.call(e),T,d)}if(isSet$2(e)){var M=[];return setForEach&&setForEach.call(e,function(z){M.push(g(z,e))}),collectionOf("Set",setSize.call(e),M,d)}if(isWeakMap(e))return weakCollectionOf("WeakMap");if(isWeakSet(e))return weakCollectionOf("WeakSet");if(isWeakRef(e))return weakCollectionOf("WeakRef");if(isNumber$1(e))return markBoxed(g(Number(e)));if(isBigInt(e))return markBoxed(g(bigIntValueOf.call(e)));if(isBoolean$1(e))return markBoxed(booleanValueOf.call(e));if(isString$1(e))return markBoxed(g(String(e)));if(!isDate$1(e)&&!isRegExp$1(e)){var C=arrObjKeys(e,g),I=gPO?gPO(e)===Object.prototype:e instanceof Object||e.constructor===Object,D=e instanceof Object?"":"null prototype",G=!I&&toStringTag&&Object(e)===e&&toStringTag in e?$slice.call(toStr(e),8,-1):D?"Object":"",$=I||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",N=$+(G||D?"["+$join.call($concat.call([],G||[],D||[]),": ")+"] ":"");return C.length===0?N+"{}":d?N+"{"+indentedJoin(C,d)+"}":N+"{ "+$join.call(C,", ")+" }"}return String(e)};function wrapQuotes(t,e,i){var r=(i.quoteStyle||e)==="double"?'"':"'";return r+t+r}function quote(t){return $replace.call(String(t),/"/g,""")}function isArray$7(t){return toStr(t)==="[object Array]"&&(!toStringTag||!(typeof t=="object"&&toStringTag in t))}function isDate$1(t){return toStr(t)==="[object Date]"&&(!toStringTag||!(typeof t=="object"&&toStringTag in t))}function isRegExp$1(t){return toStr(t)==="[object RegExp]"&&(!toStringTag||!(typeof t=="object"&&toStringTag in t))}function isError(t){return toStr(t)==="[object Error]"&&(!toStringTag||!(typeof t=="object"&&toStringTag in t))}function isString$1(t){return toStr(t)==="[object String]"&&(!toStringTag||!(typeof t=="object"&&toStringTag in t))}function isNumber$1(t){return toStr(t)==="[object Number]"&&(!toStringTag||!(typeof t=="object"&&toStringTag in t))}function isBoolean$1(t){return toStr(t)==="[object Boolean]"&&(!toStringTag||!(typeof t=="object"&&toStringTag in t))}function isSymbol(t){if(hasShammedSymbols)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!symToString)return!1;try{return symToString.call(t),!0}catch(e){}return!1}function isBigInt(t){if(!t||typeof t!="object"||!bigIntValueOf)return!1;try{return bigIntValueOf.call(t),!0}catch(e){}return!1}var hasOwn=Object.prototype.hasOwnProperty||function(t){return t in this};function has$3(t,e){return hasOwn.call(t,e)}function toStr(t){return objectToString$2.call(t)}function nameOf(t){if(t.name)return t.name;var e=$match.call(functionToString.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function indexOf$2(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0,r=t.length;ie.maxStringLength){var i=t.length-e.maxStringLength,r="... "+i+" more character"+(i>1?"s":"");return inspectString($slice.call(t,0,e.maxStringLength),e)+r}var s=$replace.call($replace.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lowbyte);return wrapQuotes(s,"single",e)}function lowbyte(t){var e=t.charCodeAt(0),i={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return i?"\\"+i:"\\x"+(e<16?"0":"")+$toUpperCase.call(e.toString(16))}function markBoxed(t){return"Object("+t+")"}function weakCollectionOf(t){return t+" { ? }"}function collectionOf(t,e,i,r){var s=r?indentedJoin(i,r):$join.call(i,", ");return t+" ("+e+") {"+s+"}"}function singleLineValues(t){for(var e=0;e=0)return!1;return!0}function getIndent(t,e){var i;if(t.indent===" ")i=" ";else if(typeof t.indent=="number"&&t.indent>0)i=$join.call(Array(t.indent+1)," ");else return null;return{base:i,prev:$join.call(Array(e+1),i)}}function indentedJoin(t,e){if(t.length===0)return"";var i=` `+e.prev+e.base;return i+$join.call(t,","+i)+` `+e.prev}function arrObjKeys(t,e){var i=isArray$7(t),r=[];if(i){r.length=t.length;for(var s=0;s1;){var i=e.pop(),r=i.obj[i.prop];if(isArray$6(r)){for(var s=[],o=0;o=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||o===formats$2.RFC1738&&(u===40||u===41)){l+=a.charAt(c);continue}if(u<128){l=l+hexTable[u];continue}if(u<2048){l=l+(hexTable[192|u>>6]+hexTable[128|u&63]);continue}if(u<55296||u>=57344){l=l+(hexTable[224|u>>12]+hexTable[128|u>>6&63]+hexTable[128|u&63]);continue}c+=1,u=65536+((u&1023)<<10|a.charCodeAt(c)&1023),l+=hexTable[240|u>>18]+hexTable[128|u>>12&63]+hexTable[128|u>>6&63]+hexTable[128|u&63]}return l},compact=function t(e){for(var i=[{obj:{o:e},prop:"o"}],r=[],s=0;s"u"&&(_=0)}if(typeof c=="function"?x=c(i,x):x instanceof Date?x=d(x):r==="comma"&&isArray$5(x)&&(x=utils$2.maybeMap(x,function(O){return O instanceof Date?d(O):O})),x===null){if(o)return l&&!b?l(i,defaults$1.encoder,S,"key",g):i;x=""}if(isNonNullishPrimitive(x)||utils$2.isBuffer(x)){if(l){var M=b?i:l(i,defaults$1.encoder,S,"key",g);return[y(M)+"="+y(l(x,defaults$1.encoder,S,"value",g))]}return[y(i)+"="+y(String(x))]}var C=[];if(typeof x>"u")return C;var I;if(r==="comma"&&isArray$5(x))b&&l&&(x=utils$2.maybeMap(x,l)),I=[{value:x.length>0?x.join(",")||null:void 0}];else if(isArray$5(c))I=c;else{var D=Object.keys(x);I=u?D.sort(u):D}for(var G=s&&isArray$5(x)&&x.length===1?i+"[]":i,$=0;$"u"?defaults$1.allowDots:!!e.allowDots,charset:i,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:defaults$1.charsetSentinel,delimiter:typeof e.delimiter>"u"?defaults$1.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:defaults$1.encode,encoder:typeof e.encoder=="function"?e.encoder:defaults$1.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:defaults$1.encodeValuesOnly,filter:o,format:r,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:defaults$1.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:defaults$1.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:defaults$1.strictNullHandling}},stringify_1=function(t,e){var i=t,r=normalizeStringifyOptions(e),s,o;typeof r.filter=="function"?(o=r.filter,i=o("",i)):isArray$5(r.filter)&&(o=r.filter,s=o);var a=[];if(typeof i!="object"||i===null)return"";var l;e&&e.arrayFormat in arrayPrefixGenerators?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var c=arrayPrefixGenerators[l];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=c==="comma"&&e&&e.commaRoundTrip;s||(s=Object.keys(i)),r.sort&&s.sort(r.sort);for(var m=getSideChannel(),d=0;d0?b+y:""},utils$1=utils$3,has=Object.prototype.hasOwnProperty,isArray$4=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(t){return t.replace(/&#(\d+);/g,function(e,i){return String.fromCharCode(parseInt(i,10))})},parseArrayValue=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function t(e,i){var r={},s=i.ignoreQueryPrefix?e.replace(/^\?/,""):e,o=i.parameterLimit===1/0?void 0:i.parameterLimit,a=s.split(i.delimiter,o),l=-1,c,u=i.charset;if(i.charsetSentinel)for(c=0;c-1&&(b=isArray$4(b)?[b]:b),has.call(r,y)?r[y]=utils$1.combine(r[y],b):r[y]=b}return r},parseObject=function(t,e,i,r){for(var s=r?e:parseArrayValue(e,i),o=t.length-1;o>=0;--o){var a,l=t[o];if(l==="[]"&&i.parseArrays)a=[].concat(s);else{a=i.plainObjects?Object.create(null):{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=parseInt(c,10);!i.parseArrays&&c===""?a={0:s}:!isNaN(u)&&l!==c&&String(u)===c&&u>=0&&i.parseArrays&&u<=i.arrayLimit?(a=[],a[u]=s):c!=="__proto__"&&(a[c]=s)}s=a}return s},parseKeys=function t(e,i,r,s){if(e){var o=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,c=r.depth>0&&a.exec(o),u=c?o.slice(0,c.index):o,m=[];if(u){if(!r.plainObjects&&has.call(Object.prototype,u)&&!r.allowPrototypes)return;m.push(u)}for(var d=0;r.depth>0&&(c=l.exec(o))!==null&&d"u"?defaults.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?defaults.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:defaults.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:defaults.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:defaults.arrayLimit,charset:i,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:defaults.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:defaults.comma,decoder:typeof e.decoder=="function"?e.decoder:defaults.decoder,delimiter:typeof e.delimiter=="string"||utils$1.isRegExp(e.delimiter)?e.delimiter:defaults.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:defaults.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:defaults.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:defaults.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:defaults.strictNullHandling}},parse$4=function(t,e){var i=normalizeParseOptions(e);if(t===""||t===null||typeof t>"u")return i.plainObjects?Object.create(null):{};for(var r=typeof t=="string"?parseValues(t,i):t,s=i.plainObjects?Object.create(null):{},o=Object.keys(r),a=0;a-1};function normalizeName(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||t==="")throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function normalizeValue(t){return typeof t!="string"&&(t=String(t)),t}function iteratorFor(t){var e={next:function(){var i=t.shift();return{done:i===void 0,value:i}}};return support.iterable&&(e[Symbol.iterator]=function(){return e}),e}function Headers(t){this.map={},t instanceof Headers?t.forEach(function(e,i){this.append(i,e)},this):Array.isArray(t)?t.forEach(function(e){this.append(e[0],e[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}Headers.prototype.append=function(t,e){t=normalizeName(t),e=normalizeValue(e);var i=this.map[t];this.map[t]=i?i+", "+e:e};Headers.prototype.delete=function(t){delete this.map[normalizeName(t)]};Headers.prototype.get=function(t){return t=normalizeName(t),this.has(t)?this.map[t]:null};Headers.prototype.has=function(t){return this.map.hasOwnProperty(normalizeName(t))};Headers.prototype.set=function(t,e){this.map[normalizeName(t)]=normalizeValue(e)};Headers.prototype.forEach=function(t,e){for(var i in this.map)this.map.hasOwnProperty(i)&&t.call(e,this.map[i],i,this)};Headers.prototype.keys=function(){var t=[];return this.forEach(function(e,i){t.push(i)}),iteratorFor(t)};Headers.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),iteratorFor(t)};Headers.prototype.entries=function(){var t=[];return this.forEach(function(e,i){t.push([i,e])}),iteratorFor(t)};support.iterable&&(Headers.prototype[Symbol.iterator]=Headers.prototype.entries);function consumed(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function fileReaderReady(t){return new Promise(function(e,i){t.onload=function(){e(t.result)},t.onerror=function(){i(t.error)}})}function readBlobAsArrayBuffer(t){var e=new FileReader,i=fileReaderReady(e);return e.readAsArrayBuffer(t),i}function readBlobAsText(t){var e=new FileReader,i=fileReaderReady(e);return e.readAsText(t),i}function readArrayBufferAsText(t){for(var e=new Uint8Array(t),i=new Array(e.length),r=0;r-1?e:t}function Request(t,e){if(!(this instanceof Request))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e=e||{};var i=e.body;if(t instanceof Request){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new Headers(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!i&&t._bodyInit!=null&&(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new Headers(e.headers)),this.method=normalizeMethod(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var r=/([?&])_=[^&]*/;if(r.test(this.url))this.url=this.url.replace(r,"$1_="+new Date().getTime());else{var s=/\?/;this.url+=(s.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})};function decode$1(t){var e=new FormData;return t.trim().split("&").forEach(function(i){if(i){var r=i.split("="),s=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(s),decodeURIComponent(o))}}),e}function parseHeaders(t){var e=new Headers,i=t.replace(/\r?\n[\t ]+/g," ");return i.split("\r").map(function(r){return r.indexOf(` `)===0?r.substr(1,r.length):r}).forEach(function(r){var s=r.split(":"),o=s.shift().trim();if(o){var a=s.join(":").trim();e.append(o,a)}}),e}Body.call(Request.prototype);function Response(t,e){if(!(this instanceof Response))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=e.status===void 0?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText===void 0?"":""+e.statusText,this.headers=new Headers(e.headers),this.url=e.url||"",this._initBody(t)}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 t=new Response(null,{status:0,statusText:""});return t.type="error",t};var redirectStatuses=[301,302,303,307,308];Response.redirect=function(t,e){if(redirectStatuses.indexOf(e)===-1)throw new RangeError("Invalid status code");return new Response(null,{status:e,headers:{location:t}})};var DOMException=global$1.DOMException;try{new DOMException}catch(t){DOMException=function(e,i){this.message=e,this.name=i;var r=Error(e);this.stack=r.stack},DOMException.prototype=Object.create(Error.prototype),DOMException.prototype.constructor=DOMException}function fetch$2(t,e){return new Promise(function(i,r){var s=new Request(t,e);if(s.signal&&s.signal.aborted)return r(new DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function a(){o.abort()}o.onload=function(){var c={status:o.status,statusText:o.statusText,headers:parseHeaders(o.getAllResponseHeaders()||"")};c.url="responseURL"in o?o.responseURL:c.headers.get("X-Request-URL");var u="response"in o?o.response:o.responseText;setTimeout(function(){i(new Response(u,c))},0)},o.onerror=function(){setTimeout(function(){r(new TypeError("Network request failed"))},0)},o.ontimeout=function(){setTimeout(function(){r(new TypeError("Network request failed"))},0)},o.onabort=function(){setTimeout(function(){r(new DOMException("Aborted","AbortError"))},0)};function l(c){try{return c===""&&global$1.location.href?global$1.location.href:c}catch(u){return c}}o.open(s.method,l(s.url),!0),s.credentials==="include"?o.withCredentials=!0:s.credentials==="omit"&&(o.withCredentials=!1),"responseType"in o&&(support.blob?o.responseType="blob":support.arrayBuffer&&s.headers.get("Content-Type")&&s.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(o.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof Headers)?Object.getOwnPropertyNames(e.headers).forEach(function(c){o.setRequestHeader(c,normalizeValue(e.headers[c]))}):s.headers.forEach(function(c,u){o.setRequestHeader(u,c)}),s.signal&&(s.signal.addEventListener("abort",a),o.onreadystatechange=function(){o.readyState===4&&s.signal.removeEventListener("abort",a)}),o.send(typeof s._bodyInit>"u"?null:s._bodyInit)})}fetch$2.polyfill=!0;global$1.fetch||(global$1.fetch=fetch$2,global$1.Headers=Headers,global$1.Request=Request,global$1.Response=Response);self.fetch.bind(self);function ownKeys(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),i.push.apply(i,r)}return i}function _objectSpread2(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function _construct(t,e,i){return _isNativeReflectConstruct()?_construct=Reflect.construct:_construct=function(s,o,a){var l=[null];l.push.apply(l,o);var c=Function.bind.apply(s,l),u=new c;return a&&_setPrototypeOf(u,a.prototype),u},_construct.apply(null,arguments)}function _isNativeFunction(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function _wrapNativeSuper(t){var e=typeof Map=="function"?new Map:void 0;return _wrapNativeSuper=function(r){if(r===null||!_isNativeFunction(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,s)}function s(){return _construct(r,arguments,_getPrototypeOf(this).constructor)}return s.prototype=Object.create(r.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(s,r)},_wrapNativeSuper(t)}function _assertThisInitialized(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _possibleConstructorReturn(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _createSuper(t){var e=_isNativeReflectConstruct();return function(){var r=_getPrototypeOf(t),s;if(e){var o=_getPrototypeOf(this).constructor;s=Reflect.construct(r,arguments,o)}else s=r.apply(this,arguments);return _possibleConstructorReturn(this,s)}}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _iterableToArray(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function _unsupportedIterableToArray(t,e){if(t){if(typeof t=="string")return _arrayLikeToArray(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);if(i==="Object"&&t.constructor&&(i=t.constructor.name),i==="Map"||i==="Set")return Array.from(t);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return _arrayLikeToArray(t,e)}}function _arrayLikeToArray(t,e){(e==null||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i1&&arguments[1]!==void 0?arguments[1]:{global:!1,core:!1,defaultInstance:!1},s=!1,o=!1,a=!1;if(typeof r=="number"?(process&&process.env,s=!0,o=!1):_typeof(r)==="object"&&r&&(o=r.global||!1,s=r.core||!1,a=r.defaultInstance||!1),o){t.globalMiddlewares.splice(t.globalMiddlewares.length-t.defaultGlobalMiddlewaresLength,0,i);return}if(s){t.coreMiddlewares.splice(t.coreMiddlewares.length-t.defaultCoreMiddlewaresLength,0,i);return}if(a){this.defaultMiddlewares.push(i);return}this.middlewares.push(i)}},{key:"execute",value:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=compose([].concat(_toConsumableArray(this.middlewares),_toConsumableArray(this.defaultMiddlewares),_toConsumableArray(t.globalMiddlewares),_toConsumableArray(t.coreMiddlewares)));return r(i)}}]),t}();Onion.globalMiddlewares=[];Onion.defaultGlobalMiddlewaresLength=0;Onion.coreMiddlewares=[];Onion.defaultCoreMiddlewaresLength=0;var MapCache$1=function(){function t(e){_classCallCheck(this,t),this.cache=new Map,this.timer={},this.extendOptions(e)}return _createClass(t,[{key:"extendOptions",value:function(i){this.maxCache=i.maxCache||0}},{key:"get",value:function(i){return this.cache.get(JSON.stringify(i))}},{key:"set",value:function(i,r){var s=this,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:6e4;if(this.maxCache>0&&this.cache.size>=this.maxCache){var a=_toConsumableArray(this.cache.keys())[0];this.cache.delete(a),this.timer[a]&&clearTimeout(this.timer[a])}var l=JSON.stringify(i);this.cache.set(l,r),o>0&&(this.timer[l]=setTimeout(function(){s.cache.delete(l),delete s.timer[l]},o))}},{key:"delete",value:function(i){var r=JSON.stringify(i);return delete this.timer[r],this.cache.delete(r)}},{key:"clear",value:function(){return this.timer={},this.cache.clear()}}]),t}(),RequestError=function(t){_inherits(i,t);var e=_createSuper(i);function i(r,s){var o,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"RequestError";return _classCallCheck(this,i),o=e.call(this,r),o.name="RequestError",o.request=s,o.type=a,o}return i}(_wrapNativeSuper(Error)),ResponseError=function(t){_inherits(i,t);var e=_createSuper(i);function i(r,s,o,a){var l,c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"ResponseError";return _classCallCheck(this,i),l=e.call(this,s||r.statusText),l.name="ResponseError",l.data=o,l.response=r,l.request=a,l.type=c,l}return i}(_wrapNativeSuper(Error));function readerGBK(t){return new Promise(function(e,i){var r=new FileReader;r.onload=function(){e(r.result)},r.onerror=i,r.readAsText(t,"GBK")})}function safeJsonParse(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;try{return JSON.parse(t)}catch(s){if(e)throw new ResponseError(i,"JSON.parse fail",t,r,"ParseError")}return t}function timeout2Throw(t,e,i){return new Promise(function(r,s){setTimeout(function(){s(new RequestError(e||"timeout of ".concat(t,"ms exceeded"),i,"Timeout"))},t)})}function cancel2Throw(t){return new Promise(function(e,i){t.cancelToken&&t.cancelToken.promise.then(function(r){i(r)})})}var toString$2=Object.prototype.toString;function getEnv(){var t;return typeof process<"u"&&toString$2.call(process)==="[object process]"&&(t="NODE"),typeof XMLHttpRequest<"u"&&(t="BROWSER"),t}function isArray$3(t){return _typeof(t)==="object"&&Object.prototype.toString.call(t)==="[object Array]"}function isURLSearchParams(t){return typeof URLSearchParams<"u"&&t instanceof URLSearchParams}function isDate(t){return _typeof(t)==="object"&&Object.prototype.toString.call(t)==="[object Date]"}function isObject$1(t){return t!==null&&_typeof(t)==="object"}function forEach2ObjArr(t,e){if(t)if(_typeof(t)!=="object"&&(t=[t]),isArray$3(t))for(var i=0;i1&&arguments[1]!==void 0?arguments[1]:{},r=i.prefix,s=i.suffix;return r&&(e="".concat(r).concat(e)),s&&(e="".concat(e).concat(s)),{url:e,options:i}},warnedCoreType=!1;function __defaultValidateCache(t,e){var i=e.method,r=i===void 0?"get":i;return r.toLowerCase()==="get"}function fetchMiddleware(t,e){if(!t)return e();var i=t.req;i=i===void 0?{}:i;var r=i.options,s=r===void 0?{}:r,o=i.url,a=o===void 0?"":o,l=t.cache,c=t.responseInterceptors,u=s.timeout,m=u===void 0?0:u,d=s.timeoutMessage,g=s.__umiRequestCoreType__,y=g===void 0?"normal":g,b=s.useCache,S=b===void 0?!1:b,E=s.method,x=E===void 0?"get":E,A=s.params,_=s.ttl,P=s.validateCache,T=P===void 0?__defaultValidateCache:P;if(y!=="normal")return process&&process.env,e();var M=fetch;if(!M)throw new Error("Global fetch not exist!");var C=getEnv()==="BROWSER",I=T(a,s)&&S&&C;if(I){var D=l.get({url:a,params:A,method:x});if(D)return D=D.clone(),D.useCache=!0,t.res=D,e()}var G;return m>0?G=Promise.race([cancel2Throw(s),M(a,s),timeout2Throw(m,d,t.req)]):G=Promise.race([cancel2Throw(s),M(a,s)]),c.forEach(function($){G=G.then(function(N){var z=typeof N.clone=="function"?N.clone():N;return $(z,s)})}),G.then(function($){if(I&&$.status===200){var N=$.clone();N.useCache=!0,l.set({url:a,params:A,method:x},N,_)}return t.res=$,e()})}function parseResponseMiddleware(t,e){var i;return e().then(function(){if(t){var r=t.res,s=r===void 0?{}:r,o=t.req,a=o===void 0?{}:o,l=a||{},c=l.options;c=c===void 0?{}:c;var u=c.responseType,m=u===void 0?"json":u,d=c.charset,g=d===void 0?"utf8":d;c.getResponse;var y=c.throwErrIfParseFail,b=y===void 0?!1:y,S=c.parseResponse,E=S===void 0?!0:S;if(E&&!(!s||!s.clone)){if(i=getEnv()==="BROWSER"?s.clone():s,i.useCache=s.useCache||!1,g==="gbk")try{return s.blob().then(readerGBK).then(function(x){return safeJsonParse(x,!1,i,a)})}catch(x){throw new ResponseError(i,x.message,null,a,"ParseError")}else if(m==="json")return s.text().then(function(x){return safeJsonParse(x,b,i,a)});try{return s[m]()}catch(x){throw new ResponseError(i,"responseType not support",null,a,"ParseError")}}}}).then(function(r){if(t){t.res;var s=t.req,o=s===void 0?{}:s,a=o||{},l=a.options;l=l===void 0?{}:l;var c=l.getResponse,u=c===void 0?!1:c;if(i){if(i.status>=200&&i.status<300){if(u){t.res={data:r,response:i};return}t.res=r;return}throw new ResponseError(i,"http error",r,o,"HttpError")}}}).catch(function(r){if(r instanceof RequestError||r instanceof ResponseError)throw r;var s=t.req,o=t.res;throw r.request=r.request||s,r.response=r.response||o,r.type=r.type||r.name,r.data=r.data||void 0,r})}function simplePostMiddleware(t,e){if(!t)return e();var i=t.req;i=i===void 0?{}:i;var r=i.options,s=r===void 0?{}:r,o=s.method,a=o===void 0?"get":o;if(["post","put","patch","delete"].indexOf(a.toLowerCase())===-1)return e();var l=s.requestType,c=l===void 0?"json":l,u=s.data;if(u){var m=Object.prototype.toString.call(u);m==="[object Object]"||m==="[object Array]"?c==="json"?(s.headers=_objectSpread2({Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},s.headers),s.body=JSON.stringify(u)):c==="form"&&(s.headers=_objectSpread2({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},s.headers),s.body=reqStringify(u)):(s.headers=_objectSpread2({Accept:"application/json"},s.headers),s.body=u)}return t.req.options=s,e()}function paramsSerialize(t,e){var i,r;if(t)if(e)i=e(t);else if(isURLSearchParams(t))i=t.toString();else if(isArray$3(t))r=[],forEach2ObjArr(t,function(o){o===null||typeof o>"u"?r.push(o):r.push(isObject$1(o)?JSON.stringify(o):o)}),i=reqStringify(r);else{r={},forEach2ObjArr(t,function(o,a){var l=o;o===null||typeof o>"u"?r[a]=o:isDate(o)?l=o.toISOString():isArray$3(o)?l=o:isObject$1(o)&&(l=JSON.stringify(o)),r[a]=l});var s=reqStringify(r);i=s}return i}function simpleGetMiddleware(t,e){if(!t)return e();var i=t.req;i=i===void 0?{}:i;var r=i.options,s=r===void 0?{}:r,o=s.paramsSerializer,a=s.params,l=t.req;l=l===void 0?{}:l;var c=l.url,u=c===void 0?"":c;s.method=s.method?s.method.toUpperCase():"GET",s.credentials=s.credentials||"same-origin";var m=paramsSerialize(a,o);if(t.req.originUrl=u,m){var d=u.indexOf("?")!==-1?"&":"?";t.req.url="".concat(u).concat(d).concat(m)}return t.req.options=s,e()}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$1(e),this.initOptions=e,this.instanceRequestInterceptors=[],this.instanceResponseInterceptors=[]}return _createClass(t,[{key:"use",value:function(i){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!1,core:!1};return this.onion.use(i,r),this}},{key:"extendOptions",value:function(i){this.initOptions=mergeRequestOptions(this.initOptions,i),this.mapCache.extendOptions(i)}},{key:"dealRequestInterceptors",value:function(i){var r=function(a,l){return a.then(function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return i.req.url=c.url||i.req.url,i.req.options=c.options||i.req.options,l(i.req.url,i.req.options)})},s=[].concat(_toConsumableArray(t.requestInterceptors),_toConsumableArray(this.instanceRequestInterceptors));return s.reduce(r,Promise.resolve()).then(function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return i.req.url=o.url||i.req.url,i.req.options=o.options||i.req.options,Promise.resolve()})}},{key:"request",value:function(i,r){var s=this,o=this.onion,a={req:{url:i,options:_objectSpread2(_objectSpread2({},r),{},{url:i})},res:null,cache:this.mapCache,responseInterceptors:[].concat(_toConsumableArray(t.responseInterceptors),_toConsumableArray(this.instanceResponseInterceptors))};if(typeof i!="string")throw new Error("url MUST be a string");return new Promise(function(l,c){s.dealRequestInterceptors(a).then(function(){return o.execute(a)}).then(function(){l(a.res)}).catch(function(u){var m=a.req.options.errorHandler;if(m)try{var d=m(u);l(d)}catch(g){c(g)}else c(u)})})}}],[{key:"requestUse",value:function(i){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!0};if(typeof i!="function")throw new TypeError("Interceptor must be function!");r.global?t.requestInterceptors.push(i):this.instanceRequestInterceptors.push(i)}},{key:"responseUse",value:function(i){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{global:!0};if(typeof i!="function")throw new TypeError("Interceptor must be function!");r.global?t.responseInterceptors.push(i):this.instanceResponseInterceptors.push(i)}}]),t}();Core.requestInterceptors=[addfix];Core.responseInterceptors=[];function Cancel(t){this.message=t}Cancel.prototype.toString=function t(){return this.message?"Cancel: ".concat(this.message):"Cancel"};Cancel.prototype.__CANCEL__=!0;function CancelToken(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(s){e=s});var i=this;t(function(s){i.reason||(i.reason=new Cancel(s),e(i.reason))})}CancelToken.prototype.throwIfRequested=function t(){if(this.reason)throw this.reason};CancelToken.source=function t(){var e,i=new CancelToken(function(s){e=s});return{token:i,cancel:e}};function isCancel(t){return!!(t&&t.__CANCEL__)}var request$1=function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=new Core(e),r=function(a){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=mergeRequestOptions(i.initOptions,l);return i.request(a,c)};r.use=i.use.bind(i),r.fetchIndex=i.fetchIndex,r.interceptors={request:{use:Core.requestUse.bind(i)},response:{use:Core.responseUse.bind(i)}};var s=["get","post","delete","put","patch","head","options","rpc"];return s.forEach(function(o){r[o]=function(a,l){return r(a,_objectSpread2(_objectSpread2({},l),{},{method:o}))}}),r.Cancel=Cancel,r.CancelToken=CancelToken,r.isCancel=isCancel,r.extendOptions=i.extendOptions.bind(i),r.middlewares={instance:i.onion.middlewares,defaultInstance:i.onion.defaultMiddlewares,global:Onion.globalMiddlewares,core:Onion.coreMiddlewares},r},extend$1=function t(e){return request$1(e)};request$1({parseResponse:!1});var request$1$1=request$1({}),lodash_isemptyExports={},lodash_isempty={get exports(){return lodash_isemptyExports},set exports(t){lodash_isemptyExports=t}};(function(t,e){var i=9007199254740991,r="[object Arguments]",s="[object Function]",o="[object GeneratorFunction]",a="[object Map]",l="[object Object]",c="[object Promise]",u="[object Set]",m="[object WeakMap]",d="[object DataView]",g=/[\\^$.*+?()[\]{}|]/g,y=/^\[object .+?Constructor\]$/,b=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,S=typeof self=="object"&&self&&self.Object===Object&&self,E=b||S||Function("return this")(),x=e&&!e.nodeType&&e,A=x&&!0&&t&&!t.nodeType&&t,_=A&&A.exports===x;function P(ge,we){return ge==null?void 0:ge[we]}function T(ge){var we=!1;if(ge!=null&&typeof ge.toString!="function")try{we=!!(ge+"")}catch(Ce){}return we}function M(ge,we){return function(Ce){return ge(we(Ce))}}var C=Function.prototype,I=Object.prototype,D=E["__core-js_shared__"],G=function(){var ge=/[^.]+$/.exec(D&&D.keys&&D.keys.IE_PROTO||"");return ge?"Symbol(src)_1."+ge:""}(),$=C.toString,N=I.hasOwnProperty,z=I.toString,R=RegExp("^"+$.call(N).replace(g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),H=_?E.Buffer:void 0,O=I.propertyIsEnumerable,V=H?H.isBuffer:void 0,k=M(Object.keys,Object),F=q(E,"DataView"),Z=q(E,"Map"),U=q(E,"Promise"),J=q(E,"Set"),de=q(E,"WeakMap"),ne=!O.call({valueOf:1},"valueOf"),te=ee(F),ce=ee(Z),pe=ee(U),ue=ee(J),be=ee(de);function Ee(ge){return z.call(ge)}function Se(ge){if(!ye(ge)||B(ge))return!1;var we=he(ge)||T(ge)?R:y;return we.test(ee(ge))}function q(ge,we){var Ce=P(ge,we);return Se(Ce)?Ce:void 0}var ie=Ee;(F&&ie(new F(new ArrayBuffer(1)))!=d||Z&&ie(new Z)!=a||U&&ie(U.resolve())!=c||J&&ie(new J)!=u||de&&ie(new de)!=m)&&(ie=function(ge){var we=z.call(ge),Ce=we==l?ge.constructor:void 0,Te=Ce?ee(Ce):void 0;if(Te)switch(Te){case te:return d;case ce:return a;case pe:return c;case ue:return u;case be:return m}return we});function B(ge){return!!G&&G in ge}function re(ge){var we=ge&&ge.constructor,Ce=typeof we=="function"&&we.prototype||I;return ge===Ce}function ee(ge){if(ge!=null){try{return $.call(ge)}catch(we){}try{return ge+""}catch(we){}}return""}function W(ge){return le(ge)&&N.call(ge,"callee")&&(!O.call(ge,"callee")||z.call(ge)==r)}var Q=Array.isArray;function K(ge){return ge!=null&&me(ge.length)&&!he(ge)}function le(ge){return fe(ge)&&K(ge)}var oe=V||xe;function ae(ge){if(K(ge)&&(Q(ge)||typeof ge=="string"||typeof ge.splice=="function"||oe(ge)||W(ge)))return!ge.length;var we=ie(ge);if(we==a||we==u)return!ge.size;if(ne||re(ge))return!k(ge).length;for(var Ce in ge)if(N.call(ge,Ce))return!1;return!0}function he(ge){var we=ye(ge)?z.call(ge):"";return we==s||we==o}function me(ge){return typeof ge=="number"&&ge>-1&&ge%1==0&&ge<=i}function ye(ge){var we=typeof ge;return!!ge&&(we=="object"||we=="function")}function fe(ge){return!!ge&&typeof ge=="object"}function xe(){return!1}t.exports=ae})(lodash_isempty,lodash_isemptyExports);var objectTag$4="[object Object]";function isHostObject(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(i){}return e}function overArg$1(t,e){return function(i){return t(e(i))}}var funcProto$2=Function.prototype,objectProto$f=Object.prototype,funcToString$2=funcProto$2.toString,hasOwnProperty$c=objectProto$f.hasOwnProperty,objectCtorString=funcToString$2.call(Object),objectToString$1=objectProto$f.toString,getPrototype$2=overArg$1(Object.getPrototypeOf,Object);function isObjectLike$1(t){return!!t&&typeof t=="object"}function isPlainObject$2(t){if(!isObjectLike$1(t)||objectToString$1.call(t)!=objectTag$4||isHostObject(t))return!1;var e=getPrototype$2(t);if(e===null)return!0;var i=hasOwnProperty$c.call(e,"constructor")&&e.constructor;return typeof i=="function"&&i instanceof i&&funcToString$2.call(i)==objectCtorString}var lodash_isplainobject=isPlainObject$2,lodash_transformExports={},lodash_transform={get exports(){return lodash_transformExports},set exports(t){lodash_transformExports=t}};(function(t,e){var i=200,r="Expected a function",s="__lodash_hash_undefined__",o=1,a=2,l=1/0,c=9007199254740991,u="[object Arguments]",m="[object Array]",d="[object Boolean]",g="[object Date]",y="[object Error]",b="[object Function]",S="[object GeneratorFunction]",E="[object Map]",x="[object Number]",A="[object Object]",_="[object Promise]",P="[object RegExp]",T="[object Set]",M="[object String]",C="[object Symbol]",I="[object WeakMap]",D="[object ArrayBuffer]",G="[object DataView]",$="[object Float32Array]",N="[object Float64Array]",z="[object Int8Array]",R="[object Int16Array]",H="[object Int32Array]",O="[object Uint8Array]",V="[object Uint8ClampedArray]",k="[object Uint16Array]",F="[object Uint32Array]",Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,U=/^\w*$/,J=/^\./,de=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ne=/[\\^$.*+?()[\]{}|]/g,te=/\\(\\)?/g,ce=/^\[object .+?Constructor\]$/,pe=/^(?:0|[1-9]\d*)$/,ue={};ue[$]=ue[N]=ue[z]=ue[R]=ue[H]=ue[O]=ue[V]=ue[k]=ue[F]=!0,ue[u]=ue[m]=ue[D]=ue[d]=ue[G]=ue[g]=ue[y]=ue[b]=ue[E]=ue[x]=ue[A]=ue[P]=ue[T]=ue[M]=ue[I]=!1;var be=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Ee=typeof self=="object"&&self&&self.Object===Object&&self,Se=be||Ee||Function("return this")(),q=e&&!e.nodeType&&e,ie=q&&!0&&t&&!t.nodeType&&t,B=ie&&ie.exports===q,re=B&&be.process,ee=function(){try{return re&&re.binding("util")}catch(Y){}}(),W=ee&&ee.isTypedArray;function Q(Y,se){for(var ve=-1,Ae=Y?Y.length:0;++ve-1}function yi(Y,se){var ve=this.__data__,Ae=Lt(ve,Y);return Ae<0?ve.push([Y,se]):ve[Ae][1]=se,this}Je.prototype.clear=Ht,Je.prototype.delete=pi,Je.prototype.get=mi,Je.prototype.has=gi,Je.prototype.set=yi;function ct(Y){var se=-1,ve=Y?Y.length:0;for(this.clear();++seNe))return!1;var He=_e.get(Y);if(He&&_e.get(se))return He==se;var je=-1,Xe=!0,ze=Ie&o?new It:void 0;for(_e.set(Y,se),_e.set(se,Y);++je-1&&Y%1==0&&Y-1&&Y%1==0&&Y<=c}function Pt(Y){var se=typeof Y;return!!Y&&(se=="object"||se=="function")}function Nt(Y){return!!Y&&typeof Y=="object"}function jt(Y){return typeof Y=="symbol"||Nt(Y)&&Le.call(Y)==C}var ni=W?ae(W):Vi;function ir(Y){return Y==null?"":Wi(Y)}function rr(Y,se,ve){var Ae=Y==null?void 0:Xt(Y,se);return Ae===void 0?ve:Ae}function nr(Y,se){return Y!=null&&qi(Y,se,Ni)}function Dt(Y){return ri(Y)?Ii(Y):Hi(Y)}function sr(Y,se,ve){var Ae=ht(Y)||ni(Y);if(se=Gi(se),ve==null)if(Ae||Pt(Y)){var Ie=Y.constructor;Ae?ve=ht(Y)?new Ie:[]:ve=Ut(Ie)?Li(Et(Y)):{}}else ve={};return(Ae?Q:Bi)(Y,function(_e,ke,Ne){return se(ve,_e,ke,Ne)}),ve}function or(Y){return Y}function ar(Y){return Bt(Y)?le(kt(Y)):Ui(Y)}t.exports=sr})(lodash_transform,lodash_transformExports);const isEmpty$1=lodash_isemptyExports,isPlainObject$1=lodash_isplainobject,transform=lodash_transformExports;var src=function t(e,{cleanKeys:i=[],cleanValues:r=[],emptyArrays:s=!0,emptyObjects:o=!0,emptyStrings:a=!0,NaNValues:l=!1,nullValues:c=!0,undefinedValues:u=!0}={}){return transform(e,(m,d,g)=>{if(!i.includes(g)&&((Array.isArray(d)||isPlainObject$1(d))&&(d=t(d,{NaNValues:l,cleanKeys:i,cleanValues:r,emptyArrays:s,emptyObjects:o,emptyStrings:a,nullValues:c,undefinedValues:u})),!r.includes(d)&&!(o&&isPlainObject$1(d)&&isEmpty$1(d))&&!(s&&Array.isArray(d)&&!d.length)&&!(a&&d==="")&&!(l&&Number.isNaN(d))&&!(c&&d===null)&&!(u&&d===void 0))){if(Array.isArray(m))return m.push(d);m[g]=d}})};const whiteUrl=()=>({"/sysMusicScoreCategories/queryTree":"/eduMusicScore/queryTree","/sysMusicScoreAccompaniment/queryPage":queryString.parse(location.search).platform?"/sysMusicScoreAccompaniment/queryPage":"/eduMusicScore/queryPage","/sysMusicScoreAccompaniment/queryPageLimit":"/eduMusicScore/queryPageLimit","/sysMusicScoreAccompaniment/querySubjectIds":"/eduMusicScore/querySubjectIds"});whiteUrl();browser();getQuery();const request=extend$1({requestType:"form",timeout:1e4});request.interceptors.request.use((t,e)=>{const i=e.isContentCenter?"/cbs-app":storeData.platformApi;storeData.proxy+i,t=matchProductApiUrl()+t;const r=getToken(),s={};return r&&!e.isContentCenter&&(s.Authorization=r),{url:t,options:{...e,params:src(e.params),data:src(e.data),headers:{...e.headers,...s}}}},{global:!1});request.interceptors.response.use(async(t,e)=>{if(t.status>299||t.status<200){const r=t.statusText+", 状态码"+t.status;showToast(r)}const i=await t.clone().json();if(i.code===5e3)return i;if(i.code!==200&&i.errCode!==0){const r=i.msg||i.message||"处理失败,请重试";throw i.code===403||i.code,new Error(r)}return i},{global:!1});var dayjs_minExports={},dayjs_min={get exports(){return dayjs_minExports},set exports(t){dayjs_minExports=t}};(function(t,e){(function(i,r){t.exports=r()})(commonjsGlobal,function(){var i=1e3,r=6e4,s=36e5,o="millisecond",a="second",l="minute",c="hour",u="day",m="week",d="month",g="quarter",y="year",b="date",S="Invalid Date",E=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|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,A={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(z){var R=["th","st","nd","rd"],H=z%100;return"["+z+(R[(H-20)%10]||R[H]||R[0])+"]"}},_=function(z,R,H){var O=String(z);return!O||O.length>=R?z:""+Array(R+1-O.length).join(H)+z},P={s:_,z:function(z){var R=-z.utcOffset(),H=Math.abs(R),O=Math.floor(H/60),V=H%60;return(R<=0?"+":"-")+_(O,2,"0")+":"+_(V,2,"0")},m:function z(R,H){if(R.date()1)return z(F[0])}else{var Z=R.name;M[Z]=R,V=Z}return!O&&V&&(T=V),V||!O&&T},D=function(z,R){if(C(z))return z.clone();var H=typeof R=="object"?R:{};return H.date=z,H.args=arguments,new $(H)},G=P;G.l=I,G.i=C,G.w=function(z,R){return D(z,{locale:R.$L,utc:R.$u,x:R.$x,$offset:R.$offset})};var $=function(){function z(H){this.$L=I(H.locale,null,!0),this.parse(H)}var R=z.prototype;return R.parse=function(H){this.$d=function(O){var V=O.date,k=O.utc;if(V===null)return new Date(NaN);if(G.u(V))return new Date;if(V instanceof Date)return new Date(V);if(typeof V=="string"&&!/Z$/i.test(V)){var F=V.match(E);if(F){var Z=F[2]-1||0,U=(F[7]||"0").substring(0,3);return k?new Date(Date.UTC(F[1],Z,F[3]||1,F[4]||0,F[5]||0,F[6]||0,U)):new Date(F[1],Z,F[3]||1,F[4]||0,F[5]||0,F[6]||0,U)}}return new Date(V)}(H),this.$x=H.x||{},this.init()},R.init=function(){var H=this.$d;this.$y=H.getFullYear(),this.$M=H.getMonth(),this.$D=H.getDate(),this.$W=H.getDay(),this.$H=H.getHours(),this.$m=H.getMinutes(),this.$s=H.getSeconds(),this.$ms=H.getMilliseconds()},R.$utils=function(){return G},R.isValid=function(){return this.$d.toString()!==S},R.isSame=function(H,O){var V=D(H);return this.startOf(O)<=V&&V<=this.endOf(O)},R.isAfter=function(H,O){return D(H)=0&&d<=1){if(g._volume=d,g._muted)return g;g.usingWebAudio&&g.masterGain.gain.setValueAtTime(d,i.ctx.currentTime);for(var y=0;y=0;g--)d._howls[g].unload();return d.usingWebAudio&&d.ctx&&typeof d.ctx.close<"u"&&(d.ctx.close(),d.ctx=null,m()),d},codecs:function(d){return(this||i)._codecs[d.replace(/^x-/,"")]},_setup:function(){var d=this||i;if(d.state=d.ctx&&d.ctx.state||"suspended",d._autoSuspend(),!d.usingWebAudio)if(typeof Audio<"u")try{var g=new Audio;typeof g.oncanplaythrough>"u"&&(d._canPlayEvent="canplay")}catch(y){d.noAudio=!0}else d.noAudio=!0;try{var g=new Audio;g.muted&&(d.noAudio=!0)}catch(y){}return d.noAudio||d._setupCodecs(),d},_setupCodecs:function(){var d=this||i,g=null;try{g=typeof Audio<"u"?new Audio:null}catch(P){return d}if(!g||typeof g.canPlayType!="function")return d;var y=g.canPlayType("audio/mpeg;").replace(/^no$/,""),b=d._navigator?d._navigator.userAgent:"",S=b.match(/OPR\/([0-6].)/g),E=S&&parseInt(S[0].split("/")[1],10)<33,x=b.indexOf("Safari")!==-1&&b.indexOf("Chrome")===-1,A=b.match(/Version\/(.*?) /),_=x&&A&&parseInt(A[1],10)<15;return d._codecs={mp3:!!(!E&&(y||g.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!y,opus:!!g.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!g.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!g.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(g.canPlayType('audio/wav; codecs="1"')||g.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!g.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!g.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(g.canPlayType("audio/x-m4a;")||g.canPlayType("audio/m4a;")||g.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(g.canPlayType("audio/x-m4b;")||g.canPlayType("audio/m4b;")||g.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(g.canPlayType("audio/x-mp4;")||g.canPlayType("audio/mp4;")||g.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!_&&g.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!_&&g.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!g.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(g.canPlayType("audio/x-flac;")||g.canPlayType("audio/flac;")).replace(/^no$/,"")},d},_unlockAudio:function(){var d=this||i;if(!(d._audioUnlocked||!d.ctx)){d._audioUnlocked=!1,d.autoUnlock=!1,!d._mobileUnloaded&&d.ctx.sampleRate!==44100&&(d._mobileUnloaded=!0,d.unload()),d._scratchBuffer=d.ctx.createBuffer(1,1,22050);var g=function(y){for(;d._html5AudioPool.length"u"?_.noteOn(0):_.start(0),typeof d.ctx.resume=="function"&&d.ctx.resume(),_.onended=function(){_.disconnect(0),d._audioUnlocked=!0,document.removeEventListener("touchstart",g,!0),document.removeEventListener("touchend",g,!0),document.removeEventListener("click",g,!0),document.removeEventListener("keydown",g,!0);for(var P=0;P"u"||!i.usingWebAudio)){for(var g=0;g"u"||!i.usingWebAudio))return d.state==="running"&&d.ctx.state!=="interrupted"&&d._suspendTimer?(clearTimeout(d._suspendTimer),d._suspendTimer=null):d.state==="suspended"||d.state==="running"&&d.ctx.state==="interrupted"?(d.ctx.resume().then(function(){d.state="running";for(var g=0;g"u"&&(d="__default",!y._playLock)){for(var S=0,E=0;E0?x._seek:y._sprite[d][0]/1e3),P=Math.max(0,(y._sprite[d][0]+y._sprite[d][1])/1e3-_),T=P*1e3/Math.abs(x._rate),M=y._sprite[d][0]/1e3,C=(y._sprite[d][0]+y._sprite[d][1])/1e3;x._sprite=d,x._ended=!1;var I=function(){x._paused=!1,x._seek=_,x._start=M,x._stop=C,x._loop=!!(x._loop||y._sprite[d][2])};if(_>=C){y._ended(x);return}var D=x._node;if(y._webAudio){var G=function(){y._playLock=!1,I(),y._refreshBuffer(x);var R=x._muted||y._muted?0:x._volume;D.gain.setValueAtTime(R,i.ctx.currentTime),x._playStart=i.ctx.currentTime,typeof D.bufferSource.start>"u"?x._loop?D.bufferSource.noteGrainOn(0,_,86400):D.bufferSource.noteGrainOn(0,_,P):x._loop?D.bufferSource.start(0,_,86400):D.bufferSource.start(0,_,P),T!==1/0&&(y._endTimers[x._id]=setTimeout(y._ended.bind(y,x),T)),g||setTimeout(function(){y._emit("play",x._id),y._loadQueue()},0)};i.state==="running"&&i.ctx.state!=="interrupted"?G():(y._playLock=!0,y.once("resume",G),y._clearTimer(x._id))}else{var $=function(){D.currentTime=_,D.muted=x._muted||y._muted||i._muted||D.muted,D.volume=x._volume*i.volume(),D.playbackRate=x._rate;try{var R=D.play();if(R&&typeof Promise<"u"&&(R instanceof Promise||typeof R.then=="function")?(y._playLock=!0,I(),R.then(function(){y._playLock=!1,D._unlocked=!0,g?y._loadQueue():y._emit("play",x._id)}).catch(function(){y._playLock=!1,y._emit("playerror",x._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."),x._ended=!0,x._paused=!0})):g||(y._playLock=!1,I(),y._emit("play",x._id)),D.playbackRate=x._rate,D.paused){y._emit("playerror",x._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.");return}d!=="__default"||x._loop?y._endTimers[x._id]=setTimeout(y._ended.bind(y,x),T):(y._endTimers[x._id]=function(){y._ended(x),D.removeEventListener("ended",y._endTimers[x._id],!1)},D.addEventListener("ended",y._endTimers[x._id],!1))}catch(H){y._emit("playerror",x._id,H)}};D.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(D.src=y._src,D.load());var N=window&&window.ejecta||!D.readyState&&i._navigator.isCocoonJS;if(D.readyState>=3||N)$();else{y._playLock=!0,y._state="loading";var z=function(){y._state="loaded",$(),D.removeEventListener(i._canPlayEvent,z,!1)};D.addEventListener(i._canPlayEvent,z,!1),y._clearTimer(x._id)}}return x._id},pause:function(d){var g=this;if(g._state!=="loaded"||g._playLock)return g._queue.push({event:"pause",action:function(){g.pause(d)}}),g;for(var y=g._getSoundIds(d),b=0;b"u"?S._node.bufferSource.noteOff(0):S._node.bufferSource.stop(0),g._cleanBuffer(S._node)}else(!isNaN(S._node.duration)||S._node.duration===1/0)&&S._node.pause();arguments[1]||g._emit("pause",S?S._id:null)}return g},stop:function(d,g){var y=this;if(y._state!=="loaded"||y._playLock)return y._queue.push({event:"stop",action:function(){y.stop(d)}}),y;for(var b=y._getSoundIds(d),S=0;S"u"?E._node.bufferSource.noteOff(0):E._node.bufferSource.stop(0),y._cleanBuffer(E._node)):(!isNaN(E._node.duration)||E._node.duration===1/0)&&(E._node.currentTime=E._start||0,E._node.pause(),E._node.duration===1/0&&y._clearSound(E._node))),g||y._emit("stop",E._id))}return y},mute:function(d,g){var y=this;if(y._state!=="loaded"||y._playLock)return y._queue.push({event:"mute",action:function(){y.mute(d,g)}}),y;if(typeof g>"u")if(typeof d=="boolean")y._muted=d;else return y._muted;for(var b=y._getSoundIds(g),S=0;S"u"){var S=d._getSoundIds(),E=S.indexOf(g[0]);E>=0?b=parseInt(g[0],10):y=parseFloat(g[0])}else g.length>=2&&(y=parseFloat(g[0]),b=parseInt(g[1],10));var x;if(typeof y<"u"&&y>=0&&y<=1){if(d._state!=="loaded"||d._playLock)return d._queue.push({event:"volume",action:function(){d.volume.apply(d,g)}}),d;typeof b>"u"&&(d._volume=y),b=d._getSoundIds(b);for(var A=0;A"u")}}return S},_startFadeInterval:function(d,g,y,b,S,E){var x=this,A=g,_=y-g,P=Math.abs(_/.01),T=Math.max(4,P>0?b/P:b),M=Date.now();d._fadeTo=y,d._interval=setInterval(function(){var C=(Date.now()-M)/b;M=Date.now(),A+=_*C,A=Math.round(A*100)/100,_<0?A=Math.max(y,A):A=Math.min(y,A),x._webAudio?d._volume=A:x.volume(A,d._id,!0),E&&(x._volume=A),(yg&&A>=y)&&(clearInterval(d._interval),d._interval=null,d._fadeTo=null,x.volume(y,d._id),x._emit("fade",d._id))},T)},_stopFade:function(d){var g=this,y=g._soundById(d);return y&&y._interval&&(g._webAudio&&y._node.gain.cancelScheduledValues(i.ctx.currentTime),clearInterval(y._interval),y._interval=null,g.volume(y._fadeTo,d),y._fadeTo=null,g._emit("fade",d)),g},loop:function(){var d=this,g=arguments,y,b,S;if(g.length===0)return d._loop;if(g.length===1)if(typeof g[0]=="boolean")y=g[0],d._loop=y;else return S=d._soundById(parseInt(g[0],10)),S?S._loop:!1;else g.length===2&&(y=g[0],b=parseInt(g[1],10));for(var E=d._getSoundIds(b),x=0;x=0?b=parseInt(g[0],10):y=parseFloat(g[0])}else g.length===2&&(y=parseFloat(g[0]),b=parseInt(g[1],10));var x;if(typeof y=="number"){if(d._state!=="loaded"||d._playLock)return d._queue.push({event:"rate",action:function(){d.rate.apply(d,g)}}),d;typeof b>"u"&&(d._rate=y),b=d._getSoundIds(b);for(var A=0;A=0?b=parseInt(g[0],10):d._sounds.length&&(b=d._sounds[0]._id,y=parseFloat(g[0]))}else g.length===2&&(y=parseFloat(g[0]),b=parseInt(g[1],10));if(typeof b>"u")return 0;if(typeof y=="number"&&(d._state!=="loaded"||d._playLock))return d._queue.push({event:"seek",action:function(){d.seek.apply(d,g)}}),d;var x=d._soundById(b);if(x)if(typeof y=="number"&&y>=0){var A=d.playing(b);A&&d.pause(b,!0),x._seek=y,x._ended=!1,d._clearTimer(b),!d._webAudio&&x._node&&!isNaN(x._node.duration)&&(x._node.currentTime=y);var _=function(){A&&d.play(b,!0),d._emit("seek",b)};if(A&&!d._webAudio){var P=function(){d._playLock?setTimeout(P,0):_()};setTimeout(P,0)}else _()}else if(d._webAudio){var T=d.playing(b)?i.ctx.currentTime-x._playStart:0,M=x._rateSeek?x._rateSeek-x._seek:0;return x._seek+(M+T*Math.abs(x._rate))}else return x._node.currentTime;return d},playing:function(d){var g=this;if(typeof d=="number"){var y=g._soundById(d);return y?!y._paused:!1}for(var b=0;b=0&&i._howls.splice(b,1);var S=!0;for(y=0;y=0){S=!1;break}return o&&S&&delete o[d._src],i.noAudio=!1,d._state="unloaded",d._sounds=[],d=null,null},on:function(d,g,y,b){var S=this,E=S["_on"+d];return typeof g=="function"&&E.push(b?{id:y,fn:g,once:b}:{id:y,fn:g}),S},off:function(d,g,y){var b=this,S=b["_on"+d],E=0;if(typeof g=="number"&&(y=g,g=null),g||y)for(E=0;E=0;E--)(!S[E].id||S[E].id===g||d==="load")&&(setTimeout(function(x){x.call(this,g,y)}.bind(b,S[E].fn),0),S[E].once&&b.off(d,S[E].fn,S[E].id));return b._loadQueue(d),b},_loadQueue:function(d){var g=this;if(g._queue.length>0){var y=g._queue[0];y.event===d&&(g._queue.shift(),g._loadQueue()),d||y.action()}return g},_ended:function(d){var g=this,y=d._sprite;if(!g._webAudio&&d._node&&!d._node.paused&&!d._node.ended&&d._node.currentTime=0;b--){if(y<=g)return;d._sounds[b]._ended&&(d._webAudio&&d._sounds[b]._node&&d._sounds[b]._node.disconnect(0),d._sounds.splice(b,1),y--)}}},_getSoundIds:function(d){var g=this;if(typeof d>"u"){for(var y=[],b=0;b=0;if(i._scratchBuffer&&d.bufferSource&&(d.bufferSource.onended=null,d.bufferSource.disconnect(0),y))try{d.bufferSource.buffer=i._scratchBuffer}catch(b){}return d.bufferSource=null,g},_clearSound:function(d){var g=/MSIE |Trident\//.test(i._navigator&&i._navigator.userAgent);g||(d.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var s=function(d){this._parent=d,this.init()};s.prototype={init:function(){var d=this,g=d._parent;return d._muted=g._muted,d._loop=g._loop,d._volume=g._volume,d._rate=g._rate,d._seek=0,d._paused=!0,d._ended=!0,d._sprite="__default",d._id=++i._counter,g._sounds.push(d),d.create(),d},create:function(){var d=this,g=d._parent,y=i._muted||d._muted||d._parent._muted?0:d._volume;return g._webAudio?(d._node=typeof i.ctx.createGain>"u"?i.ctx.createGainNode():i.ctx.createGain(),d._node.gain.setValueAtTime(y,i.ctx.currentTime),d._node.paused=!0,d._node.connect(i.masterGain)):i.noAudio||(d._node=i._obtainHtml5Audio(),d._errorFn=d._errorListener.bind(d),d._node.addEventListener("error",d._errorFn,!1),d._loadFn=d._loadListener.bind(d),d._node.addEventListener(i._canPlayEvent,d._loadFn,!1),d._endFn=d._endListener.bind(d),d._node.addEventListener("ended",d._endFn,!1),d._node.src=g._src,d._node.preload=g._preload===!0?"auto":g._preload,d._node.volume=y*i.volume(),d._node.load()),d},reset:function(){var d=this,g=d._parent;return d._muted=g._muted,d._loop=g._loop,d._volume=g._volume,d._rate=g._rate,d._seek=0,d._rateSeek=0,d._paused=!0,d._ended=!0,d._sprite="__default",d._id=++i._counter,d},_errorListener:function(){var d=this;d._parent._emit("loaderror",d._id,d._node.error?d._node.error.code:0),d._node.removeEventListener("error",d._errorFn,!1)},_loadListener:function(){var d=this,g=d._parent;g._duration=Math.ceil(d._node.duration*10)/10,Object.keys(g._sprite).length===0&&(g._sprite={__default:[0,g._duration*1e3]}),g._state!=="loaded"&&(g._state="loaded",g._emit("load"),g._loadQueue()),d._node.removeEventListener(i._canPlayEvent,d._loadFn,!1)},_endListener:function(){var d=this,g=d._parent;g._duration===1/0&&(g._duration=Math.ceil(d._node.duration*10)/10,g._sprite.__default[1]===1/0&&(g._sprite.__default[1]=g._duration*1e3),g._ended(d)),d._node.removeEventListener("ended",d._endFn,!1)}};var o={},a=function(d){var g=d._src;if(o[g]){d._duration=o[g].duration,u(d);return}if(/^data:[^;]+;base64,/.test(g)){for(var y=atob(g.split(",")[1]),b=new Uint8Array(y.length),S=0;S0?(o[g._src]=S,u(g,S)):y()};typeof Promise<"u"&&i.ctx.decodeAudioData.length===1?i.ctx.decodeAudioData(d).then(b).catch(y):i.ctx.decodeAudioData(d,b,y)},u=function(d,g){g&&!d._duration&&(d._duration=g.duration),Object.keys(d._sprite).length===0&&(d._sprite={__default:[0,d._duration*1e3]}),d._state!=="loaded"&&(d._state="loaded",d._emit("load"),d._loadQueue())},m=function(){if(i.usingWebAudio){try{typeof AudioContext<"u"?i.ctx=new AudioContext:typeof webkitAudioContext<"u"?i.ctx=new webkitAudioContext:i.usingWebAudio=!1}catch(S){i.usingWebAudio=!1}i.ctx||(i.usingWebAudio=!1);var d=/iP(hone|od|ad)/.test(i._navigator&&i._navigator.platform),g=i._navigator&&i._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),y=g?parseInt(g[1],10):null;if(d&&y&&y<9){var b=/safari/.test(i._navigator&&i._navigator.userAgent.toLowerCase());i._navigator&&!b&&(i.usingWebAudio=!1)}i.usingWebAudio&&(i.masterGain=typeof i.ctx.createGain>"u"?i.ctx.createGainNode():i.ctx.createGain(),i.masterGain.gain.setValueAtTime(i._muted?0:i._volume,i.ctx.currentTime),i.masterGain.connect(i.ctx.destination)),i._setup()}};t.Howler=i,t.Howl=r,typeof commonjsGlobal<"u"?(commonjsGlobal.HowlerGlobal=e,commonjsGlobal.Howler=i,commonjsGlobal.Howl=r,commonjsGlobal.Sound=s):typeof window<"u"&&(window.HowlerGlobal=e,window.Howler=i,window.Howl=r,window.Sound=s)})();/*! * 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(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(i){var r=this;if(!r.ctx||!r.ctx.listener)return r;for(var s=r._howls.length-1;s>=0;s--)r._howls[s].stereo(i);return r},HowlerGlobal.prototype.pos=function(i,r,s){var o=this;if(!o.ctx||!o.ctx.listener)return o;if(r=typeof r!="number"?o._pos[1]:r,s=typeof s!="number"?o._pos[2]:s,typeof i=="number")o._pos=[i,r,s],typeof o.ctx.listener.positionX<"u"?(o.ctx.listener.positionX.setTargetAtTime(o._pos[0],Howler.ctx.currentTime,.1),o.ctx.listener.positionY.setTargetAtTime(o._pos[1],Howler.ctx.currentTime,.1),o.ctx.listener.positionZ.setTargetAtTime(o._pos[2],Howler.ctx.currentTime,.1)):o.ctx.listener.setPosition(o._pos[0],o._pos[1],o._pos[2]);else return o._pos;return o},HowlerGlobal.prototype.orientation=function(i,r,s,o,a,l){var c=this;if(!c.ctx||!c.ctx.listener)return c;var u=c._orientation;if(r=typeof r!="number"?u[1]:r,s=typeof s!="number"?u[2]:s,o=typeof o!="number"?u[3]:o,a=typeof a!="number"?u[4]:a,l=typeof l!="number"?u[5]:l,typeof i=="number")c._orientation=[i,r,s,o,a,l],typeof c.ctx.listener.forwardX<"u"?(c.ctx.listener.forwardX.setTargetAtTime(i,Howler.ctx.currentTime,.1),c.ctx.listener.forwardY.setTargetAtTime(r,Howler.ctx.currentTime,.1),c.ctx.listener.forwardZ.setTargetAtTime(s,Howler.ctx.currentTime,.1),c.ctx.listener.upX.setTargetAtTime(o,Howler.ctx.currentTime,.1),c.ctx.listener.upY.setTargetAtTime(a,Howler.ctx.currentTime,.1),c.ctx.listener.upZ.setTargetAtTime(l,Howler.ctx.currentTime,.1)):c.ctx.listener.setOrientation(i,r,s,o,a,l);else return u;return c},Howl.prototype.init=function(i){return function(r){var s=this;return s._orientation=r.orientation||[1,0,0],s._stereo=r.stereo||null,s._pos=r.pos||null,s._pannerAttr={coneInnerAngle:typeof r.coneInnerAngle<"u"?r.coneInnerAngle:360,coneOuterAngle:typeof r.coneOuterAngle<"u"?r.coneOuterAngle:360,coneOuterGain:typeof r.coneOuterGain<"u"?r.coneOuterGain:0,distanceModel:typeof r.distanceModel<"u"?r.distanceModel:"inverse",maxDistance:typeof r.maxDistance<"u"?r.maxDistance:1e4,panningModel:typeof r.panningModel<"u"?r.panningModel:"HRTF",refDistance:typeof r.refDistance<"u"?r.refDistance:1,rolloffFactor:typeof r.rolloffFactor<"u"?r.rolloffFactor:1},s._onstereo=r.onstereo?[{fn:r.onstereo}]:[],s._onpos=r.onpos?[{fn:r.onpos}]:[],s._onorientation=r.onorientation?[{fn:r.onorientation}]:[],i.call(this,r)}}(Howl.prototype.init),Howl.prototype.stereo=function(i,r){var s=this;if(!s._webAudio)return s;if(s._state!=="loaded")return s._queue.push({event:"stereo",action:function(){s.stereo(i,r)}}),s;var o=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof r>"u")if(typeof i=="number")s._stereo=i,s._pos=[i,0,0];else return s._stereo;for(var a=s._getSoundIds(r),l=0;l"u")if(typeof i=="number")a._pos=[i,r,s];else return a._pos;for(var l=a._getSoundIds(o),c=0;c"u")if(typeof i=="number")a._orientation=[i,r,s];else return a._orientation;for(var l=a._getSoundIds(o),c=0;c"u"&&(s.pannerAttr||(s.pannerAttr={coneInnerAngle:s.coneInnerAngle,coneOuterAngle:s.coneOuterAngle,coneOuterGain:s.coneOuterGain,distanceModel:s.distanceModel,maxDistance:s.maxDistance,refDistance:s.refDistance,rolloffFactor:s.rolloffFactor,panningModel:s.panningModel}),i._pannerAttr={coneInnerAngle:typeof s.pannerAttr.coneInnerAngle<"u"?s.pannerAttr.coneInnerAngle:i._coneInnerAngle,coneOuterAngle:typeof s.pannerAttr.coneOuterAngle<"u"?s.pannerAttr.coneOuterAngle:i._coneOuterAngle,coneOuterGain:typeof s.pannerAttr.coneOuterGain<"u"?s.pannerAttr.coneOuterGain:i._coneOuterGain,distanceModel:typeof s.pannerAttr.distanceModel<"u"?s.pannerAttr.distanceModel:i._distanceModel,maxDistance:typeof s.pannerAttr.maxDistance<"u"?s.pannerAttr.maxDistance:i._maxDistance,refDistance:typeof s.pannerAttr.refDistance<"u"?s.pannerAttr.refDistance:i._refDistance,rolloffFactor:typeof s.pannerAttr.rolloffFactor<"u"?s.pannerAttr.rolloffFactor:i._rolloffFactor,panningModel:typeof s.pannerAttr.panningModel<"u"?s.pannerAttr.panningModel:i._panningModel});else return a=i._soundById(parseInt(r[0],10)),a?a._pannerAttr:i._pannerAttr;else r.length===2&&(s=r[0],o=parseInt(r[1],10));for(var l=i._getSoundIds(o),c=0;cmetronomeData.cursorMode,()=>{const t=document.querySelector("#cursorImg-0");if(t){switch(metronomeData.cursorMode){case 1:t.classList.remove("lineHide"),t.style.opacity="inherit",metronomeData.cursorTips="您已切换到指针跟随音符播放",t.style.opacity="inherit";break;case 2:t.classList.add("lineHide"),t.style.opacity="inherit",metronomeData.cursorTips="您已切换到指针跟随节拍播放";break;case 3:t.style.opacity="0",metronomeData.cursorTips="您已关闭指针显示";break}hideCursorTip()}});const toggleLine=()=>{if(!metronomeData.lineShow)return;const t=document.querySelector("#cursorImg-0");t&&(state$1.times[state$1.activeNoteIndex].multipleRestMeasures?t.classList.remove("lineHide"):t.classList.add("lineHide"))};watch(()=>metronomeData.lineShow,()=>{const t=document.querySelector("#cursorImg-0");t&&(metronomeData.lineShow?t.classList.add("lineHide"):t.classList.remove("lineHide"))});class Metronome{constructor(e){ot(this,"playType","tick");ot(this,"source",null);ot(this,"source1",null);ot(this,"source2",null);ot(this,"createAudio",e=>new Promise(i=>{const r=new Audio(e);r.load(),r.onloadedmetadata=()=>{i(r)},r.onerror=()=>{i(null)}}));ot(this,"sound",e=>{state$1.sectionStatus||(e=setCurrentTime(e));let i=-1,r=-1;for(let s=0;s=o)i=s,r=o;else break}if(i>-1&&metronomeData.activeIndex!==i){metronomeData.activeIndex=i,metronomeData.activeMetro=this.getStep(r),this.playAudio(),metronomeData.isClick=!1;return}toggleLine(),metronomeData.isClick=!1});ot(this,"playAudio",()=>{var i;if(!metronomeData.initPlayerState||state$1.playState==="paused")return;const e=state$1.setting.beatVolume/100;this.source=((i=metronomeData.activeMetro)==null?void 0:i.index)===0?audioData$2.tick:audioData$2.tock,this.source.volume=metronomeData.disable?0:e,this.source.volume<=0?this.source.muted=!0:this.source.muted=!1,this.source.play()});ot(this,"simulatePlayAudio",()=>{if(!metronomeData.initPlayerState)return;const e=state$1.setting.beatVolume/100;this.source=metronomeData.followAudioIndex===1?audioData$2.tick:audioData$2.tock,this.source.volume=metronomeData.disable?0:e,this.source.volume<=0?this.source.muted=!0:this.source.muted=!1,console.log("音量",this.source,this.source.volume),this.source.play(),metronomeData.followAudioIndex+=1,metronomeData.followAudioIndex=metronomeData.followAudioIndex>metronomeData.totalNumerator?1:metronomeData.followAudioIndex});ot(this,"loadAudio1",()=>new howler.Howl({src:tockAndTick.tick}));ot(this,"loadAudio2",()=>new howler.Howl({src:tockAndTick.tock}))}init(e){this.calculation(e),metronomeData.activeList=[]}initPlayer(){Promise.all([this.createAudio(tickWav),this.createAudio(tockWav)]).then(([e,i])=>{e&&(audioData$2.tick=e),i&&(audioData$2.tock=i),metronomeData.initPlayerState=!0})}selectPlay(){}getStep(e){for(let i=0;io.time===e);if(s)return s}return{}}calculation(e){var a,l,c,u,m,d,g,y,b,S,E,x,A,_;const i=[];let r=-1;for(let P=0;P-1&&M!=r){const I={measureNumberXML:M,measureNumberIndex:C,numerator:((g=(d=(m=T==null?void 0:T.noteElement)==null?void 0:m.sourceMeasure)==null?void 0:d.ActiveTimeSignature)==null?void 0:g.numerator)||0,start:T.measures[0].time,end:T.measures[T.measures.length-1].endtime,time:T.measures[T.measures.length-1].endtime-T.measures[0].time,stave_x:((x=(E=(S=(b=(y=T==null?void 0:T.noteElement)==null?void 0:y.sourceMeasure)==null?void 0:b.verticalMeasureList)==null?void 0:S[0])==null?void 0:E.stave)==null?void 0:x.x)||0,end_x:((A=T==null?void 0:T.stave)==null?void 0:A.end_x)||0||0,stepList:[],svgs:[],isRestFlag:T.isRestFlag};if([121].includes(state$1.subjectId)){const D=e.filter(G=>{var $,N;return((N=($=G==null?void 0:G.noteElement)==null?void 0:$.sourceMeasure)==null?void 0:N.measureListIndex)==C});T.measures=D,I.start=T.measures[0].time,I.end=T.measures[T.measures.length-1].endtime,I.time=T.measures[T.measures.length-1].endtime-T.measures[0].time;try{const G=T.noteElement.sourceMeasure.verticalMeasureList.reduce((N,z)=>(N.push(...z.vfVoices[1].tickables),N),[]),$=[];I.svgs=G.map(N=>{const z=N.getBoundingBox().x;if(!$.includes(z)&&N.duration!=="w")return $.push(z),N._start_x=z,N}).filter(Boolean).sort((N,z)=>N._start_x-z._start_x)}catch(G){console.log(G)}I.stepList=calculateMutilpleMetroStep(T.measures,I)}else I.stepList=calculateMetroStep(T.measures,I);i.push(I),r=M}}let s=[];const o=[];try{for(let P=0;P-1?`${N} + ${I}%`:`${N}px + ${I}%`:`${I}%`,T.stepList[D]=$}o[P].push({index:D,time:G,left:($==null?void 0:$.indexOf("%"))>-1?`calc(${$})`:$,measureNumberXML:T.measureNumberXML,isRestFlag:T.isRestFlag})}}}catch(P){console.log(P)}metronomeData.metroList=s,metronomeData.metroMeasure=o,metronomeData.activeMetro=((_=o[0])==null?void 0:_[0])||{}}}function calculateMetroStep(t,e){var l,c,u,m,d,g,y,b,S,E,x,A,_,P,T,M,C,I,D,G,$,N,z,R,H,O,V,k,F,Z,U,J,de,ne,te,ce,pe,ue,be,Ee,Se,q,ie,B,re;const r=t.reduce((ee,W)=>(ee+=W._noteLength,ee),0)/e.numerator;if(t.length===1){const ee=t[0].svgElement;if(ee&&!ee.isRest()){const W=((d=(m=(u=(c=(l=ee==null?void 0:ee.attrs)==null?void 0:l.el)==null?void 0:c.parentElement)==null?void 0:u.parentElement)==null?void 0:m.getBoundingClientRect)==null?void 0:d.call(m))||{x:0,right:0};let Q=((b=(y=(g=ee==null?void 0:ee.attrs)==null?void 0:g.el)==null?void 0:y.getBoundingClientRect)==null?void 0:b.call(y))||{x:0},K=Math.abs(W.right-Q.x)/e.numerator,le=[];for(let oe=0;oe=1){s-=r;const le=((N=($=(G=(D=(I=(C=W==null?void 0:W.svgElement)==null?void 0:C.attrs)==null?void 0:I.el)==null?void 0:D.parentElement)==null?void 0:G.parentElement)==null?void 0:$.getBoundingClientRect)==null?void 0:N.call($))||{x:0};if(o.length>0){let me=((V=(O=(H=(R=(z=o[0])==null?void 0:z.svgElement)==null?void 0:R.attrs)==null?void 0:H.el)==null?void 0:O.getBoundingClientRect)==null?void 0:V.call(O))||{x:0},ye=me.x-le.x;if(o[0]._noteLength/r>=1){const fe=((J=(U=(Z=(F=(k=t[o[0].index+1])==null?void 0:k.svgElement)==null?void 0:F.attrs)==null?void 0:Z.el)==null?void 0:U.getBoundingClientRect)==null?void 0:J.call(U))||{x:le.right},xe=Math.abs(me.x-fe.x)/2;ye=me.x-le.x+xe}a.push(ye)}else{let ye=(((ce=(te=(ne=(de=W==null?void 0:W.svgElement)==null?void 0:de.attrs)==null?void 0:ne.el)==null?void 0:te.getBoundingClientRect)==null?void 0:ce.call(te))||{x:0}).x-le.x;a.push(ye)}o=[];let oe=((Ee=(be=(ue=(pe=W==null?void 0:W.svgElement)==null?void 0:pe.attrs)==null?void 0:ue.el)==null?void 0:be.getBoundingClientRect)==null?void 0:Ee.call(be))||{x:0},ae=oe.x-le.x,he=0;if(K>1){const me=((re=(B=(ie=(q=(Se=t[ee+1])==null?void 0:Se.svgElement)==null?void 0:q.attrs)==null?void 0:ie.el)==null?void 0:B.getBoundingClientRect)==null?void 0:re.call(B))||{x:le.right};he=Math.abs(oe.x-me.x)/K}for(let me=1;meNumber.EPSILON&&s>0&&o.push(W)}return a=a.reduce((ee,W)=>(ee.includes(W)?ee.push(void 0):ee.push(W),ee),[]),a}function calculateMutilpleMetroStep(t,e){var l,c,u,m,d,g,y,b,S,E,x,A,_,P,T,M,C,I,D;const i=e.time/e.numerator,r=((y=(g=(d=(m=(u=(c=(l=t[0])==null?void 0:l.svgElement)==null?void 0:c.attrs)==null?void 0:u.el)==null?void 0:m.parentElement)==null?void 0:d.parentElement)==null?void 0:g.getBoundingClientRect)==null?void 0:y.call(g))||{x:0};if(t.length===1){const G=e.svgs[0];let $=((E=(S=(b=G==null?void 0:G.attrs)==null?void 0:b.el)==null?void 0:S.getBoundingClientRect)==null?void 0:E.call(S))||{x:0};return G&&!G.isRest()?[$.x-r.x]:[]}let s=0,o=[],a=[];for(let G=0;Gi){s-=i;let H=R.x-r.x;o.length>0&&(z=(T=(P=e.svgs[o[0]._index])==null?void 0:P.attrs)==null?void 0:T.el,R=((M=z==null?void 0:z.getBoundingClientRect)==null?void 0:M.call(z))||{x:0},H=R.x-r.x),a.push(H),o=[]}else o.push($);if(Math.abs(s-i)<.001){let H=R.x-r.x;o.length>0&&(z=(I=(C=e.svgs[o[0]._index])==null?void 0:C.attrs)==null?void 0:I.el,R=((D=z==null?void 0:z.getBoundingClientRect)==null?void 0:D.call(z))||{x:0},H=R.x-r.x),a.push(H),s=0,o=[]}}return a=a.reduce((G,$)=>(G.includes($)?G.push(void 0):G.push($),G),[]),a}function setCurrentTime(t){return browserInfo$3.huawei||browserInfo$3.xiaomi?t+=.125:browserInfo$3.android?t+=.11:browserInfo$3.ios&&(t+=.01),t}function hideCursorTip(){tipsTimer?(clearTimeout(tipsTimer),tipsTimer=setTimeout(()=>{metronomeData.cursorTips="",clearTimeout(tipsTimer),tipsTimer=null},2e3)):tipsTimer=setTimeout(()=>{metronomeData.cursorTips="",clearTimeout(tipsTimer),tipsTimer=null},2e3)}var GradualVersion=(t=>(t[t.BASE=0]="BASE",t[t.ENSEMBLE=1]="ENSEMBLE",t))(GradualVersion||{});const scoreMode="_scoreMode_6lpfe_1",tipBox="_tipBox_6lpfe_5",tipContent="_tipContent_6lpfe_15",tipBtn="_tipBtn_6lpfe_18",hiddenPop="_hiddenPop_6lpfe_28",styles$6={scoreMode,tipBox,tipContent,tipBtn,hiddenPop};var context={locks:{},zIndex:2e3,enableRipple:!0};reactive(context);const Context=reactive(context),isString=t=>typeof t=="string",isBoolean=t=>typeof t=="boolean",isNumber=t=>typeof t=="number",isPlainObject=t=>Object.prototype.toString.call(t)==="[object Object]",isFunction$2=t=>typeof t=="function",isArray$2=t=>Array.isArray(t),isURL=t=>t?/^(http)|(\.*\/)/.test(t):!1,toNumber=t=>t==null?0:isString(t)?(t=parseFloat(t),t=Number.isNaN(t)?0:t,t):isBoolean(t)?Number(t):t,removeItem=(t,e)=>{if(t.length){const i=t.indexOf(e);if(i>-1)return t.splice(i,1)}},inBrowser=()=>typeof window<"u",camelize=t=>t.replace(/-(\w)/g,(e,i)=>i.toUpperCase());function getViewportSize(){var{innerWidth:t,innerHeight:e}=window;return t>e?{vMin:e,vMax:t}:{vMin:t,vMax:e}}var isRem=t=>isString(t)&&t.endsWith("rem"),isPx=t=>isString(t)&&t.endsWith("px")||isNumber(t),isPercent=t=>isString(t)&&t.endsWith("%"),isVw=t=>isString(t)&&t.endsWith("vw"),isVh=t=>isString(t)&&t.endsWith("vh"),isVMin=t=>isString(t)&&t.endsWith("vmin"),isVMax=t=>isString(t)&&t.endsWith("vmax"),isCalc=t=>isString(t)&&t.startsWith("calc("),isVar=t=>isString(t)&&t.startsWith("var("),toPxNum=t=>{if(isNumber(t))return t;if(isPx(t))return+t.replace("px","");if(isVw(t))return+t.replace("vw","")*window.innerWidth/100;if(isVh(t))return+t.replace("vh","")*window.innerHeight/100;if(isRem(t)){var e=+t.replace("rem",""),i=window.getComputedStyle(document.documentElement).fontSize;return e*parseFloat(i)}return isVMin(t)?getViewportSize().vMin:isVMax(t)?getViewportSize().vMax:isString(t)?toNumber(t):0},toSizeUnit=t=>{if(t!=null)return isPercent(t)||isVw(t)||isVh(t)||isRem(t)||isCalc(t)||isVar(t)||isVMin(t)||isVMax(t)?t:toPxNum(t)+"px"},multiplySizeUnit=function(t,e){if(e===void 0&&(e=1),t!=null){var i=toSizeUnit(t),r=i.match(/(vh|%|rem|px|vw)$/)[0];return""+parseFloat(i)*e+r}};function supportTouch(){var t=typeof window<"u";return t&&"ontouchstart"in window}function useMounted(t){let e=!1;onMounted(()=>{t(),nextTick(()=>{e=!0})}),onActivated(()=>{e&&t()})}function useEventListener(t,e,i,r={}){if(!inBrowser())return;const{passive:s=!1,capture:o=!1}=r;let a=!1,l=!1;const c=g=>{if(a||l)return;const y=unref(g);y&&(y.addEventListener(e,i,{passive:s,capture:o}),a=!0)},u=g=>{if(!a||l)return;const y=unref(g);y&&(y.removeEventListener(e,i,{capture:o}),a=!1)};let m;isRef(t)&&(m=watch(()=>t.value,(g,y)=>{u(y),c(g)}));const d=()=>{m==null||m(),u(t),l=!0};return useMounted(()=>{c(t)}),onBeforeUnmount(()=>{u(t)}),onDeactivated(()=>{u(t)}),d}var __rest=globalThis&&globalThis.__rest||function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);si.indexOf(a)),parentProvider:o,bindParent:u=>{onMounted(()=>{nextTick().then(()=>{r(a,u)})}),onBeforeUnmount(()=>{nextTick().then(()=>{s(a,u)})})}}}function flatVNodes(t){const e=[],i=r=>{if(r!=null&&r.component){i(r==null?void 0:r.component.subTree);return}Array.isArray(r==null?void 0:r.children)&&r.children.forEach(s=>{isVNode(s)&&(e.push(s),i(s))})};return i(t),e}function useChildren(t){const e=getCurrentInstance(),i=reactive([]),r=[],s=computed(()=>i.length),o=()=>{const u=flatVNodes(e.subTree);i.sort((m,d)=>u.indexOf(m.vnode)-u.indexOf(d.vnode))},a=(u,m)=>{i.push(u),r.push(m),o()},l=(u,m)=>{removeItem(i,u),removeItem(r,m)};return{length:s,childProviders:r,bindChildren:u=>{provide(t,Object.assign({childInstances:i,collect:a,clear:l},u))}}}function asyncGeneratorStep$1(t,e,i,r,s,o,a){try{var l=t[o](a),c=l.value}catch(u){i(u);return}l.done?e(c):Promise.resolve(c).then(r,s)}function _asyncToGenerator$1(t){return function(){var e=this,i=arguments;return new Promise(function(r,s){var o=t.apply(e,i);function a(c){asyncGeneratorStep$1(o,r,s,a,l,"next",c)}function l(c){asyncGeneratorStep$1(o,r,s,a,l,"throw",c)}a(void 0)})}}function _extends$5(){return _extends$5=Object.assign?Object.assign.bind():function(t){for(var e=1;e(i[r]=t[r],i),{}):t[e]}function mount(t){var e=createApp(t),i=document.createElement("div");return document.body.appendChild(i),{instance:e.mount(i),unmount(){e.unmount(),document.body.removeChild(i)}}}function mountInstance(t,e,i){e===void 0&&(e={}),i===void 0&&(i={});var r={setup(){return()=>h$1(t,_extends$5({},e,i))}},{unmount:s}=mount(r);return{unmountInstance:s}}function useValidation(){var t=ref(""),e=function(){var s=_asyncToGenerator$1(function*(o,a,l){if(!isArray$2(o)||!o.length)return!0;var c=yield Promise.all(o.map(u=>u(a,l)));return!c.some(u=>u!==!0?(t.value=String(u),!0):!1)});return function(a,l,c){return s.apply(this,arguments)}}(),i=()=>{t.value=""},r=function(){var s=_asyncToGenerator$1(function*(o,a,l,c,u){o.includes(a)&&(yield e(l,c,u))&&(t.value="")});return function(a,l,c,u,m){return s.apply(this,arguments)}}();return{errorMessage:t,validate:e,resetValidation:i,validateWithTrigger:r}}function useRouteListener(t){inBrowser()&&(useEventListener(window,"hashchange",t),useEventListener(window,"popstate",t))}function useTeleport(){var t=ref(!1);return onActivated(()=>{t.value=!1}),onDeactivated(()=>{t.value=!0}),{disabled:t}}function createNamespace(t){var e="var",i=e+"-"+t,r=o=>o?o[0]==="$"?o.replace("$",e):o.startsWith("--")?""+i+o:i+"__"+o:i,s=function(){for(var o=arguments.length,a=new Array(o),l=0;l{if(isArray$2(c)){var[u,m,d=null]=c;return u?m:d}return c})};return{n:r,classes:s}}function call(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;rs(...i));if(t)return t(...i)}function defineListenerProp(t){return{type:[Function,Array],default:t}}function formatElevation(t,e){return t===!1?null:(t===!0&&e&&(t=e),"var-elevation--"+t)}function _extends$4(){return _extends$4=Object.assign?Object.assign.bind():function(t){for(var e=1;e{e.tasker=null;var{x:r,y:s,centerX:o,centerY:a,size:l}=computeRippleStyles(this,t),c=document.createElement("div");c.classList.add(n$9()),c.style.opacity="0",c.style.transform="translate("+r+"px, "+s+"px) scale3d(.3, .3, .3)",c.style.width=l+"px",c.style.height=l+"px",e.color&&(c.style.backgroundColor=e.color),c.dataset.createdAt=String(performance.now()),setStyles(this),this.appendChild(c),window.setTimeout(()=>{c.style.transform="translate("+o+"px, "+a+"px) scale3d(1, 1, 1)",c.style.opacity=".25"},20)};e.tasker=window.setTimeout(i,30)}}function removeRipple(){var t=this._ripple,e=()=>{var i=this.querySelectorAll("."+n$9());if(i.length){var r=i[i.length-1],s=ANIMATION_DURATION-performance.now()+Number(r.dataset.createdAt);window.setTimeout(()=>{r.style.opacity="0",window.setTimeout(()=>{var o;return(o=r.parentNode)==null?void 0:o.removeChild(r)},ANIMATION_DURATION)},s)}};t.tasker?window.setTimeout(e,30):e()}function forbidRippleTask(){if(!(!supportTouch()||!Context.enableRipple)){var t=this._ripple;t.tasker&&window.clearTimeout(t.tasker),t.tasker=null}}function mounted$1(t,e){var i;t._ripple=_extends$4({tasker:null},(i=e.value)!=null?i:{},{removeRipple:removeRipple.bind(t)}),t.addEventListener("touchstart",createRipple,{passive:!0}),t.addEventListener("touchmove",forbidRippleTask,{passive:!0}),t.addEventListener("dragstart",removeRipple,{passive:!0}),document.addEventListener("touchend",t._ripple.removeRipple,{passive:!0}),document.addEventListener("touchcancel",t._ripple.removeRipple,{passive:!0})}function unmounted$1(t){t.removeEventListener("touchstart",createRipple),t.removeEventListener("touchmove",forbidRippleTask),t.removeEventListener("dragstart",removeRipple),document.removeEventListener("touchend",t._ripple.removeRipple),document.removeEventListener("touchcancel",t._ripple.removeRipple)}function updated$1(t,e){var i,r,s,o,a={color:(i=e.value)==null?void 0:i.color,disabled:(r=e.value)==null?void 0:r.disabled},l=a.color!==((s=t._ripple)==null?void 0:s.color)||a.disabled!==((o=t._ripple)==null?void 0:o.disabled);if(l){var c,u;t._ripple=_extends$4({tasker:a.disabled?null:(c=t._ripple)==null?void 0:c.tasker,removeRipple:(u=t._ripple)==null?void 0:u.removeRipple},a)}}var Ripple={mounted:mounted$1,unmounted:unmounted$1,updated:updated$1,install(t){t.directive("ripple",this)}};const Ripple$1=Ripple;function resolveLock(){var t=Object.keys(Context.locks).length;t<=0?document.body.classList.remove("var--lock"):document.body.classList.add("var--lock")}function addLock(t){Context.locks[t]=1,resolveLock()}function releaseLock(t){delete Context.locks[t],resolveLock()}function useLock(t,e){var{uid:i}=getCurrentInstance();e&&watch(e,r=>{r===!1?releaseLock(i):r===!0&&t()===!0&&addLock(i)}),watch(t,r=>{e&&e()===!1||(r===!0?addLock(i):releaseLock(i))}),onBeforeMount(()=>{e&&e()===!1||t()===!0&&addLock(i)}),onUnmounted(()=>{e&&e()===!1||t()===!0&&releaseLock(i)}),onActivated(()=>{e&&e()===!1||t()===!0&&addLock(i)}),onDeactivated(()=>{e&&e()===!1||t()===!0&&releaseLock(i)})}function useZIndex(t,e){var i=ref(Context.zIndex);return watch(t,r=>{r&&(Context.zIndex+=e,i.value=Context.zIndex)},{immediate:!0}),{zIndex:i}}var props$8={name:{type:String},size:{type:[Number,String]},color:{type:String},namespace:{type:String,default:"var-icon"},transition:{type:[Number,String],default:0},animationClass:{type:String},onClick:defineListenerProp()};function asyncGeneratorStep(t,e,i,r,s,o,a){try{var l=t[o](a),c=l.value}catch(u){i(u);return}l.done?e(c):Promise.resolve(c).then(r,s)}function _asyncToGenerator(t){return function(){var e=this,i=arguments;return new Promise(function(r,s){var o=t.apply(e,i);function a(c){asyncGeneratorStep(o,r,s,a,l,"next",c)}function l(c){asyncGeneratorStep(o,r,s,a,l,"throw",c)}a(void 0)})}}var{n:n$8,classes:classes$6}=createNamespace("icon");function __render__$8(t,e){return openBlock(),createBlock(resolveDynamicComponent(t.isURL(t.name)?"img":"i"),{class:normalizeClass(t.classes(t.n(),[t.namespace!==t.n(),t.namespace],t.namespace+"--set",[t.isURL(t.name),t.n("image"),t.namespace+"-"+t.nextName],[t.animateInProgress,t.animationClass==null?t.n("--shrinking"):t.animationClass])),style:normalizeStyle({color:t.color,"transition-duration":t.toNumber(t.transition)+"ms",width:t.isURL(t.name)?t.toSizeUnit(t.size):null,height:t.isURL(t.name)?t.toSizeUnit(t.size):null,fontSize:t.toSizeUnit(t.size)}),src:t.isURL(t.name)?t.nextName:null,onClick:t.onClick},null,8,["class","style","src","onClick"])}var __sfc__$8=defineComponent({name:"VarIcon",props:props$8,setup(t){var e=ref(""),i=ref(!1),r=function(){var s=_asyncToGenerator(function*(o,a){var{transition:l}=t;if(a==null||toNumber(l)===0){e.value=o;return}i.value=!0,yield nextTick(),setTimeout(()=>{a!=null&&(e.value=o),i.value=!1},toNumber(l))});return function(a,l){return s.apply(this,arguments)}}();return watch(()=>t.name,r,{immediate:!0}),{n:n$8,classes:classes$6,nextName:e,animateInProgress:i,isURL,toNumber,toSizeUnit}}});__sfc__$8.render=__render__$8;const Icon=__sfc__$8;Icon.install=function(t){t.component(Icon.name,Icon)};function typeValidator$3(t){return["circle","wave","cube","rect","disappear"].includes(t)}function sizeValidator$2(t){return["normal","mini","small","large"].includes(t)}var props$7={type:{type:String,default:"circle",validator:typeValidator$3},radius:{type:[String,Number]},size:{type:String,default:"normal",validator:sizeValidator$2},color:{type:String},description:{type:String},loading:{type:Boolean,default:!1}},{n:n$7,classes:classes$5}=createNamespace("loading"),_withScopeId=t=>(pushScopeId(""),t=t(),popScopeId(),t),_hoisted_1$3=_withScopeId(()=>createBaseVNode("svg",{viewBox:"25 25 50 50"},[createBaseVNode("circle",{cx:"50",cy:"50",r:"20",fill:"none"})],-1)),_hoisted_2$1=[_hoisted_1$3];function __render__$7(t,e){return openBlock(),createElementBlock("div",{class:normalizeClass(t.n())},[t.$slots.default?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(t.classes(t.n("content"),[t.loading,t.n("content--active")]))},[renderSlot(t.$slots,"default"),t.loading?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(t.n("content-mask"))},null,2)):createCommentVNode("v-if",!0)],2)):createCommentVNode("v-if",!0),t.isShow?(openBlock(),createElementBlock("div",{key:1,class:normalizeClass(t.classes(t.n("$--box"),t.n("body"),[t.$slots.default,t.n("inside")]))},[t.type==="circle"?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(t.n("circle"))},[createBaseVNode("span",{class:normalizeClass(t.classes(t.n("circle-block"),t.n("circle-block--"+t.size))),style:normalizeStyle({width:t.multiplySizeUnit(t.radius,2),height:t.multiplySizeUnit(t.radius,2),color:t.color})},_hoisted_2$1,6)],2)):createCommentVNode("v-if",!0),(openBlock(!0),createElementBlock(Fragment,null,renderList(t.loadingTypeDict,(i,r)=>(openBlock(),createElementBlock(Fragment,{key:r},[t.type===r?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(t.classes(t.n(r),t.n(r+"--"+t.size)))},[(openBlock(!0),createElementBlock(Fragment,null,renderList(i,s=>(openBlock(),createElementBlock("div",{key:s+r,style:normalizeStyle({backgroundColor:t.color}),class:normalizeClass(t.classes(t.n(r+"-item"),t.n(r+"-item--"+t.size)))},null,6))),128))],2)):createCommentVNode("v-if",!0)],64))),128)),t.$slots.description||t.description?(openBlock(),createElementBlock("div",{key:1,class:normalizeClass(t.classes(t.n("description"),t.n("description--"+t.size))),style:normalizeStyle({color:t.color})},[renderSlot(t.$slots,"description",{},()=>[createTextVNode(toDisplayString(t.description),1)])],6)):createCommentVNode("v-if",!0)],2)):createCommentVNode("v-if",!0)],2)}var __sfc__$7=defineComponent({name:"VarLoading",props:props$7,setup(t,e){var{slots:i}=e,r={wave:5,cube:4,rect:8,disappear:3},s=computed(()=>call(i.default)?t.loading:!0);return{n:n$7,classes:classes$5,multiplySizeUnit,loadingTypeDict:r,isShow:s}}});__sfc__$7.render=__render__$7;const Loading=__sfc__$7;Loading.install=function(t){t.component(Loading.name,Loading)};var props$6={hovering:{type:Boolean,default:!0}},{n:n$6,classes:classes$4}=createNamespace("hover-overlay");function __render__$6(t,e){return openBlock(),createElementBlock("div",{class:normalizeClass(t.classes(t.n(),[t.hovering,t.n("--hovering")]))},null,2)}var __sfc__$6=defineComponent({name:"VarHoverOverlay",props:props$6,setup(){return{n:n$6,classes:classes$4}}});__sfc__$6.render=__render__$6;const HoverOverlay=__sfc__$6;HoverOverlay.install=function(t){t.component(HoverOverlay.name,HoverOverlay)};function useHoverOverlay(){var t=ref(!1),e=i=>{t.value=i};return{hovering:t,handleHovering:e}}function shouldDisabled(t){if(!t)return!1;var e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);return!!(t==="desktop"&&e||t==="mobile"&&!e)}function getStyle(t){var e=t.getAttribute("style");return e?e.split(";").filter(Boolean).reduce((i,r)=>{var[s,o]=r.split(":").map(a=>a.trim());return i[camelize(s)]=o,i},{}):{}}function updateRawStyle(t){var{value:e}=t._hover,i=getStyle(t);Object.keys(e).forEach(r=>{var s=camelize(r),o=e[s];o!=null&&i[s]&&(t._hover.rawStyle[s]=i[s])})}function updateStyle(t,e){Object.keys(e).forEach(i=>{var r=e[i];r!=null&&(t.style[i]=r)})}function clearStyle(t){Object.keys(t._hover.value).forEach(e=>{var i=t._hover.value[e];i!=null&&(t.style[e]="")})}function restoreStyle(t){clearStyle(t),updateStyle(t,t._hover.rawStyle)}function createHover(){var{value:t}=this._hover;if(this._hover.hovering=!0,isFunction$2(t)){t(this._hover.hovering);return}updateStyle(this,t)}function removeHover(){if(this._hover.hovering=!1,isFunction$2(this._hover.value)){this._hover.value(this._hover.hovering);return}restoreStyle(this)}function mounted(t,e){var i,r,{arg:s,value:o}=e;shouldDisabled(s)||(t._hover={value:o,hovering:(i=(r=t._hover)==null?void 0:r.hovering)!=null?i:!1,rawStyle:{}},updateRawStyle(t),t.addEventListener("mouseenter",createHover),t.addEventListener("mouseleave",removeHover))}function unmounted(t,e){shouldDisabled(e.arg)||(restoreStyle(t),t.removeEventListener("mouseenter",createHover),t.removeEventListener("mouseleave",removeHover))}function beforeUpdate(t,e){t._hover&&unmounted(t,e)}function shouldUpdateStyle(t,e){return!isFunction$2(e.value)&&t._hover.hovering}function updated(t,e){mounted(t,e),shouldUpdateStyle(t,e)&&updateStyle(t,e.value)}var Hover={mounted,unmounted,beforeUpdate,updated,install(t){t.directive("hover",this)}};const Hover$1=Hover;function _extends$3(){return _extends$3=Object.assign?Object.assign.bind():function(t){for(var e=1;e{if(!i)return{elevation:formatElevation(t.elevation,2),type:t.type!=null?t.type:"default",size:t.size!=null?t.size:"normal",color:t.color,text:t.text,textColor:t.textColor,outline:t.outline};var{type:u,size:m,color:d,textColor:g,mode:y}=i;return{elevation:"",type:t.type!=null?t.type:u.value,size:t.size!=null?t.size:m.value,color:t.color!=null?t.color:d.value,textColor:t.textColor!=null?t.textColor:g.value,text:y.value!=="normal",outline:y.value==="outline"}}),a=u=>{t.autoLoading&&(e.value=!0,u=isArray$2(u)?u:[u],Promise.all(u).then(()=>{e.value=!1}).catch(()=>{e.value=!1}))},l=u=>{var{loading:m,disabled:d,onClick:g}=t;!g||m||d||e.value||a(call(g,u))},c=u=>{var{loading:m,disabled:d,onTouchstart:g}=t;!g||m||d||e.value||a(call(g,u))};return{n:n$5,classes:classes$3,pending:e,states:o,hovering:r,handleHovering:s,handleClick:l,handleTouchstart:c}}});__sfc__$5.render=__render__$5;const Button=__sfc__$5;Button.install=function(t){t.component(Button.name,Button)};function typeValidator$1(t){return["default","primary","info","success","warning","danger"].includes(t)}function sizeValidator(t){return["normal","mini","small","large"].includes(t)}function modeValidator(t){return["normal","text","outline"].includes(t)}var props$4={type:{type:String,default:"default",validator:typeValidator$1},size:{type:String,default:"normal",validator:sizeValidator},color:{type:String},textColor:{type:String},mode:{type:String,default:"normal",validator:modeValidator},elevation:{type:[Boolean,Number,String],default:!0},vertical:{type:Boolean,default:!1}},{n:n$4,classes:classes$2}=createNamespace("button-group");function __render__$4(t,e){return openBlock(),createElementBlock("div",{class:normalizeClass(t.classes(t.n(),t.n("$--box"),[t.mode,""+t.n("--mode-"+t.mode)],[t.vertical,t.n("--vertical"),t.n("--horizontal")],[t.mode==="normal",t.formatElevation(t.elevation,2)]))},[renderSlot(t.$slots,"default")],2)}var __sfc__$4=defineComponent({name:"VarButtonGroup",props:props$4,setup(t){var{bindButtons:e}=useButtons(),i={elevation:computed(()=>t.elevation),type:computed(()=>t.type),size:computed(()=>t.size),color:computed(()=>t.color),textColor:computed(()=>t.textColor),mode:computed(()=>t.mode)};return e(i),{n:n$4,classes:classes$2,formatElevation}}});__sfc__$4.render=__render__$4;const ButtonGroup=__sfc__$4;ButtonGroup.install=function(t){t.component(ButtonGroup.name,ButtonGroup)};var props$3={errorMessage:{type:String,default:""},extraMessage:{type:String,default:""}},{n:n$3}=createNamespace("form-details"),_hoisted_1$1={key:0},_hoisted_2={key:0};function __render__$3(t,e){return openBlock(),createBlock(Transition,{name:t.n()},{default:withCtx(()=>[t.errorMessage||t.extraMessage?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(t.n())},[createBaseVNode("div",{class:normalizeClass(t.n("error-message"))},[createVNode(Transition,{name:t.n("message")},{default:withCtx(()=>[t.errorMessage?(openBlock(),createElementBlock("div",_hoisted_1$1,toDisplayString(t.errorMessage),1)):createCommentVNode("v-if",!0)]),_:1},8,["name"])],2),createBaseVNode("div",{class:normalizeClass(t.n("extra-message"))},[createVNode(Transition,{name:t.n("message")},{default:withCtx(()=>[t.extraMessage?(openBlock(),createElementBlock("div",_hoisted_2,toDisplayString(t.extraMessage),1)):createCommentVNode("v-if",!0)]),_:1},8,["name"])],2)],2)):createCommentVNode("v-if",!0)]),_:1},8,["name"])}var __sfc__$3=defineComponent({name:"VarFormDetails",props:props$3,setup:()=>({n:n$3})});__sfc__$3.render=__render__$3;const FormDetails=__sfc__$3;FormDetails.install=function(t){t.component(FormDetails.name,FormDetails)};function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(t){for(var e=1;e{i(_extends$2({},o,{instance:r}))}:null;return{index:e,form:t,bindForm:s}}function _extends$1(){return _extends$1=Object.assign?Object.assign.bind():function(t){for(var e=1;e[createTextVNode(toDisplayString(t.content),1)])],2),createBaseVNode("div",{class:normalizeClass(t.n("action"))},[t.iconName?(openBlock(),createBlock(i,{key:0,name:t.iconName},null,8,["name"])):createCommentVNode("v-if",!0),t.type==="loading"?(openBlock(),createBlock(r,{key:1,type:t.loadingType,size:t.loadingSize,color:t.loadingColor,radius:t.loadingRadius},null,8,["type","size","color","radius"])):createCommentVNode("v-if",!0),renderSlot(t.$slots,"action")],2)],6)],6)),[[vShow,t.show]])}var __sfc__$2=defineComponent({name:"VarSnackbarCore",components:{VarLoading:Loading,VarIcon:Icon},props:props$2,setup(t){var e=ref(null),{zIndex:i}=useZIndex(()=>t.show,1);useLock(()=>t.show,()=>t.lockScroll);var r=computed(()=>t.type==="loading"||t.forbidClick),s=computed(()=>t.type?ICON_TYPE_DICT[t.type]:""),o=()=>{e.value=setTimeout(()=>{t.type!=="loading"&&call(t["onUpdate:show"],!1)},t.duration)};return watch(()=>t.show,a=>{a?(call(t.onOpen),o()):a===!1&&(clearTimeout(e.value),call(t.onClose))}),watch(()=>t._update,()=>{clearTimeout(e.value),o()}),useMounted(()=>{t.show&&(call(t.onOpen),o())}),{SNACKBAR_TYPE,n:n$2,classes:classes$1,zIndex:i,iconName:s,isForbidClick:r}}});__sfc__$2.render=__render__$2;const VarSnackbarCore=__sfc__$2;var{n:n$1}=createNamespace("snackbar");function __render__$1(t,e){var i=resolveComponent("var-snackbar-core");return openBlock(),createBlock(Teleport,{to:t.teleport,disabled:t.disabled},[createVNode(Transition,{name:t.n()+"-fade",onAfterEnter:t.onOpened,onAfterLeave:t.onClosed},{default:withCtx(()=>[createVNode(i,mergeProps(t.$props,{class:t.n("transition")}),{action:withCtx(()=>[renderSlot(t.$slots,"action")]),default:withCtx(()=>[renderSlot(t.$slots,"default",{},()=>[createTextVNode(toDisplayString(t.content),1)])]),_:3},16,["class"])]),_:3},8,["name","onAfterEnter","onAfterLeave"])],8,["to","disabled"])}var __sfc__$1=defineComponent({name:"VarSnackbar",components:{VarSnackbarCore},props:props$2,setup(){var{disabled:t}=useTeleport();return{n:n$1,disabled:t}}});__sfc__$1.render=__render__$1;const VarSnackbar=__sfc__$1;function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e{},onOpened:()=>{},onClose:()=>{},onClosed:()=>{}},uniqSnackbarOptions=reactive([]),defaultOptions=defaultOptionsValue,transitionGroupProps={name:"var-snackbar-fade",tag:"div",class:"var-transition-group"},TransitionGroupHost={setup(){return()=>{var t=uniqSnackbarOptions.map(e=>{var{id:i,reactiveSnackOptions:r,_update:s}=e,o=document.querySelector(".var-transition-group");r.forbidClick||r.type==="loading"?o.classList.add("var-pointer-auto"):o.classList.remove("var-pointer-auto"),isAllowMultiple&&(r.position="top");var a=isAllowMultiple?"relative":"absolute",l=_extends({position:a},getTop(r.position));return createVNode(VarSnackbarCore,mergeProps(r,{key:i,style:l,"data-id":i,_update:s,show:r.show,"onUpdate:show":c=>r.show=c}),null)});return createVNode(TransitionGroup,mergeProps(transitionGroupProps,{style:{zIndex:Context.zIndex},onAfterEnter:opened,onAfterLeave:removeUniqOption}),_isSlot(t)?t:{default:()=>[t]})}}},Snackbar=function(t){var e=normalizeOptions(t),i=reactive(_extends({},defaultOptions,e));i.show=!0,isMount||(isMount=!0,unmount=mountInstance(TransitionGroupHost).unmountInstance);var{length:r}=uniqSnackbarOptions,s={id:sid++,reactiveSnackOptions:i};if(r===0||isAllowMultiple)addUniqOption(s);else{var o="update-"+sid;updateUniqOption(i,o)}return{clear(){!isAllowMultiple&&uniqSnackbarOptions.length?uniqSnackbarOptions[0].reactiveSnackOptions.show=!1:i.show=!1}}};SNACKBAR_TYPE.forEach(t=>{Snackbar[t]=e=>(isPlainObject(e)?e.type=t:e={content:e,type:t},Snackbar(e))});Snackbar.install=function(t){t.component(VarSnackbar.name,VarSnackbar)};Snackbar.allowMultiple=function(t){t===void 0&&(t=!1),t!==isAllowMultiple&&(uniqSnackbarOptions.forEach(e=>{e.reactiveSnackOptions.show=!1}),isAllowMultiple=t)};Snackbar.clear=function(){uniqSnackbarOptions.forEach(t=>{t.reactiveSnackOptions.show=!1})};Snackbar.setDefaultOptions=function(t){defaultOptions=t};Snackbar.resetDefaultOptions=function(){defaultOptions=defaultOptionsValue};Snackbar.Component=VarSnackbar;function opened(t){var e=t.getAttribute("data-id"),i=uniqSnackbarOptions.find(r=>r.id===toNumber(e));i&&call(i.reactiveSnackOptions.onOpened)}function removeUniqOption(t){t.parentElement&&t.parentElement.classList.remove("var-pointer-auto");var e=t.getAttribute("data-id"),i=uniqSnackbarOptions.find(s=>s.id===toNumber(e));i&&(i.animationEnd=!0,call(i.reactiveSnackOptions.onClosed));var r=uniqSnackbarOptions.every(s=>s.animationEnd);r&&(call(unmount),uniqSnackbarOptions=reactive([]),isMount=!1)}function addUniqOption(t){uniqSnackbarOptions.push(t)}function normalizeOptions(t){return t===void 0&&(t={}),isString(t)?{content:t}:t}function updateUniqOption(t,e){var[i]=uniqSnackbarOptions;i.reactiveSnackOptions=_extends({},i.reactiveSnackOptions,t),i._update=e}function getTop(t){return t===void 0&&(t="top"),t==="bottom"?{[t]:"5%"}:{top:t==="top"?"5%":"45%"}}VarSnackbar.install=function(t){t.component(VarSnackbar.name,VarSnackbar)};const Snackbar$1=Snackbar;var props$1={modelValue:{default:!1},activeValue:{default:!0},inactiveValue:{default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},color:{type:String},loadingColor:{type:String},closeColor:{type:String},size:{type:[String,Number]},rules:{type:Array},ripple:{type:Boolean,default:!0},onClick:defineListenerProp(),onChange:defineListenerProp(),"onUpdate:modelValue":defineListenerProp()},{n,classes}=createNamespace("switch");function __render__(t,e){var i=resolveComponent("var-loading"),r=resolveComponent("var-hover-overlay"),s=resolveComponent("var-form-details"),o=resolveDirective("ripple"),a=resolveDirective("hover");return withDirectives((openBlock(),createElementBlock("div",{class:normalizeClass(t.n())},[createBaseVNode("div",{class:normalizeClass(t.classes(t.n("block"),[t.disabled||t.formDisabled,t.n("--disabled")])),onClick:e[0]||(e[0]=function(){return t.switchActive&&t.switchActive(...arguments)}),style:normalizeStyle(t.styleComputed.switch)},[createBaseVNode("div",{style:normalizeStyle(t.styleComputed.track),class:normalizeClass(t.classes(t.n("track"),[t.modelValue===t.activeValue,t.n("track--active")],[t.errorMessage,t.n("track--error")]))},null,6),withDirectives((openBlock(),createElementBlock("div",{class:normalizeClass(t.classes(t.n("ripple"),[t.modelValue===t.activeValue,t.n("ripple--active")])),style:normalizeStyle(t.styleComputed.ripple)},[createBaseVNode("div",{style:normalizeStyle(t.styleComputed.handle),class:normalizeClass(t.classes(t.n("handle"),t.n("$-elevation--2"),[t.modelValue===t.activeValue,t.n("handle--active")],[t.errorMessage,t.n("handle--error")]))},[t.loading?(openBlock(),createBlock(i,{key:0,radius:t.radius,color:"currentColor"},null,8,["radius"])):createCommentVNode("v-if",!0)],6),createVNode(r,{hovering:t.hovering},null,8,["hovering"])],6)),[[o,{disabled:!t.ripple||t.disabled||t.loading||t.formDisabled}]])],6),createVNode(s,{"error-message":t.errorMessage},null,8,["error-message"])],2)),[[a,t.hover,"desktop"]])}var __sfc__=defineComponent({name:"VarSwitch",components:{VarLoading:Loading,VarFormDetails:FormDetails,VarHoverOverlay:HoverOverlay},directives:{Ripple:Ripple$1,Hover:Hover$1},props:props$1,setup(t){var{bindForm:e,form:i}=useForm(),{errorMessage:r,validateWithTrigger:s,validate:o,resetValidation:a}=useValidation(),{hovering:l,handleHovering:c}=useHoverOverlay(),u=()=>o(t.rules,t.modelValue),m=()=>nextTick(()=>s(["onChange"],"onChange",t.rules,t.modelValue)),d=computed(()=>{var{size:x,modelValue:A,color:_,closeColor:P,loadingColor:T,activeValue:M}=t;return{handle:{width:multiplySizeUnit(x),height:multiplySizeUnit(x),backgroundColor:A===M?_:P,color:T},ripple:{left:A===M?multiplySizeUnit(x,.5):"-"+multiplySizeUnit(x,.5),color:A===M?_:P||"#999",width:multiplySizeUnit(x,2),height:multiplySizeUnit(x,2)},track:{height:multiplySizeUnit(x,.72),width:multiplySizeUnit(x,1.9),borderRadius:multiplySizeUnit(x,2/3),filter:A===M||r!=null&&r.value?void 0:"brightness(.6)",backgroundColor:A===M?_:P},switch:{height:multiplySizeUnit(x,1.2),width:multiplySizeUnit(x,2)}}}),g=computed(()=>{var{size:x="5.333vw"}=t;return multiplySizeUnit(x,.4)}),y=x=>{var{onClick:A,onChange:_,disabled:P,loading:T,readonly:M,modelValue:C,activeValue:I,inactiveValue:D,"onUpdate:modelValue":G}=t;if(call(A,x),!(P||T||M||i!=null&&i.disabled.value||i!=null&&i.readonly.value)){var $=C===I?D:I;call(_,$),call(G,$),m()}},b=x=>{t.disabled||i!=null&&i.disabled.value||c(x)},S=()=>{call(t["onUpdate:modelValue"],t.inactiveValue),a()},E={reset:S,validate:u,resetValidation:a};return call(e,E),{n,classes,switchActive:y,hovering:l,hover:b,radius:g,styleComputed:d,errorMessage:r,formDisabled:i==null?void 0:i.disabled,formReadonly:i==null?void 0:i.readonly}}});__sfc__.render=__render__;const Switch=__sfc__;Switch.install=function(t){t.component(Switch.name,Switch)};const Image1=""+new URL("5-d8bfbf51.png",import.meta.url).href,Image2=""+new URL("4-cfa387c7.png",import.meta.url).href,Image3=""+new URL("3-d02c685a.png",import.meta.url).href,Image4=""+new URL("2-5c4c2ef5.png",import.meta.url).href,Image5=""+new URL("1-a0d5037d.png",import.meta.url).href,clx1=""+new URL("clx5-b3331931.svg",import.meta.url).href,clx2=""+new URL("clx4-7a8a1657.svg",import.meta.url).href,clx3=""+new URL("clx3-82262a8a.svg",import.meta.url).href,clx4=""+new URL("clx2-99f2ced3.svg",import.meta.url).href,clx5=""+new URL("clx1-3d063166.svg",import.meta.url).href,good="data:image/png;base64,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",bad="data:image/png;base64,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",perfect="data:image/png;base64,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",great="data:image/png;base64,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",scoreIcon={good,bad,perfect,great},leveByScoreMeasureIcons=[{icon:scoreIcon.bad,text:"bad",color:"#EE4C6A"},{icon:scoreIcon.good,text:"good",color:"#FF958B"},{icon:scoreIcon.great,text:"great",color:"#FF8E5A"},{icon:scoreIcon.perfect,text:"perfect",color:"#516AFF"}],icons=[{img:Image1,tips:"你的演奏不太好,再练一练吧~",mome:"敢于尝试",clxImg:clx1,clxtip:"你的演奏不太好,音准和完整性还需加强,再练一练吧~",clxmome:"敢于尝试"},{img:Image2,tips:"你的演奏还不熟练,加紧训练才能有好成绩哦~",mome:"还要加油哦~",clxImg:clx2,clxtip:"你的演奏还不熟练,音准和完整性还需加强,加紧训练才能有好成绩哦~",clxmome:"还要加油哦~"},{img:Image3,tips:"你的演奏还不流畅,科学的练习才能更完美哦~",mome:"突破自我",clxImg:clx3,clxtip:"你的演奏还不流畅,音准和节奏还需加强,科学的练习才能更完美哦~",clxmome:"突破自我"},{img:Image4,tips:"你的演奏还不错,继续加油吧,离完美就差一步啦~",mome:"崭露头角",clxImg:clx4,clxtip:"你的演奏还不错,继续加油吧,加强音准,离完美就差一步啦~",clxmome:"崭露头角"},{img:Image5,tips:"你的演奏完美无缺,继续努力吧~",mome:"你很棒",clxImg:clx5,clxtip:"你的演奏非常不错,音准的把握和节奏稍有瑕疵,完整性把握的很好~",clxmome:"你很棒"}],getLeveByScore=t=>{if(!t&&typeof t!="number")return{};let e=0;return t>20&&t<=40?e=1:t>40&&t<=60?e=2:t>60&&t<=80?e=3:t>80&&(e=4),{...icons[e],leve:e}},getLeveByScoreMeasure=t=>{if(!t&&typeof t!="number")return{};let e=0;return t>=40&&t<70?e=1:t>=70&&t<90?e=2:t>=90&&(e=3),e},audioList="_audioList_1j0z3_1",styles$5={audioList};let timer=null;const midiData=reactive({iframeRef:null,playing:!1,index:0,rate:1}),playNote=()=>{var i,r;if(!midiData.playing)return;const t=state$1.times[midiData.index];if(!t)return;midiData.index++;const e=t.endtime-t.time;(r=(i=midiData.iframeRef)==null?void 0:i.contentWindow)==null||r.playNote(t.realKey,e),timer=setTimeout(()=>{playNote()},e/midiData.rate*1e3)},hanldeInitMidiData=t=>{midiData.iframeRef=t},hanldeSetMidiPlaybackRate=t=>{midiData.rate=t},setMidiCurrentTime=t=>{clearTimeout(timer),midiData.index=t,playNote()},initMidi=(t,e)=>{const i=ref(!1);if(e){console.log("曲谱为midi,使用app播放"),i.value=!0,state$1.midiPlayIniting=!0;const r=getDuration(state$1.osmd);api_cloudDestroy(),api_cloudDetail({midi:e,denominator:r.denominator,numerator:r.numerator,originalSpeed:state$1.originSpeed,interval:50,duration:t*1e3},()=>{state$1.midiPlayIniting=!1,i.value=!1,e&&changeMode("music")}),state$1.durationNum=t}return{initial:i}},getActiveMidiId=()=>{var t,e,i,r,s,o,a;return(a=(o=(s=(r=(i=(e=(t=state$1.osmd)==null?void 0:t.sheet)==null?void 0:e.instruments)==null?void 0:i[0])==null?void 0:r.subInstruments)==null?void 0:s[0])==null?void 0:o.midiInstrumentID)!=null?a:0},changeMode=async(t,e)=>{var r,s,o,a;const i=t==="background"?"music":"background";if(console.log(!state$1.songs[t],t,i),state$1.isAppPlay){const l=new Map;for(const c of state$1.partListNames)l.set(c,60);api_cloudVolume({activeMidiId:getActiveMidiId(),activeMidiVolume:i==="background"?100:0,parts:Array.from(l.keys()).map(c=>({name:c,volume:l.get(c)}))})}state$1.playSource=t,e==="all"?((r=state$1.audiosInstance)==null||r.setMute(!0,state$1.songs[i]),(s=state$1.audiosInstance)==null||s.setMute(!0,state$1.songs[t])):((o=state$1.audiosInstance)==null||o.setMute(!0,state$1.songs[i]),(a=state$1.audiosInstance)==null||a.setMute(!1,state$1.songs[t]))},cloudToggleState=async t=>{const e=await api_cloudGetMediaStatus(),i=e==null?void 0:e.content.status;if(i==="init"||i==="suspend"&&t==="paused")return;i==="suspend"?(state$1.isSelectMeasureMode&&(audioData$1.progress=state$1.midiSectionStart),await api_cloudPlay({songID:state$1.examSongId,startTime:audioData$1.progress*1e3,originalSpeed:state$1.originSpeed,speed:state$1.modeType==="evaluating"?state$1.originSpeed:state$1.speed,hertz:440}),onPlay()):(await api_cloudSuspend({songID:state$1.examSongId}),state$1.modeType==="evaluating"&&(audioData$1.progress=0));const r=await api_cloudGetMediaStatus();state$1.playState=(r==null?void 0:r.content.status)==="suspend"?"paused":"play",console.log(r,"cloudGetMediaStatused")},audioData$1=reactive({songEle:null,backgroundEle:null,midiRender:!1,progress:0,duration:0}),midiRef=ref(),audioListStart=t=>{var e,i,r,s;if(t==="play"&&state$1.originSpeed!==0&&setAudioPlaybackRate(state$1.speed/state$1.originSpeed),state$1.isAppPlay){cloudToggleState(t);return}t==="play"?((e=audioData$1.songEle)==null||e.play(),(i=audioData$1.backgroundEle)==null||i.play()):t==="paused"&&((r=audioData$1.songEle)==null||r.pause(),(s=audioData$1.backgroundEle)==null||s.pause())},setAudioPlaybackRate=t=>{if(state$1.isAppPlay){if(state$1.modeType==="evaluating")return;hanldeSetMidiPlaybackRate(t);return}audioData$1.songEle&&(audioData$1.songEle.playbackRate=t),audioData$1.backgroundEle&&(audioData$1.backgroundEle.playbackRate=t)},getAudioCurrentTime=()=>{var t,e,i;return state$1.isAppPlay?audioData$1.progress:state$1.playSource==="music"?((t=audioData$1.songEle)==null?void 0:t.currentTime)||audioData$1.progress:state$1.playSource==="background"?((e=audioData$1.backgroundEle)==null?void 0:e.currentTime)||audioData$1.progress:((i=audioData$1.songEle)==null?void 0:i.currentTime)||audioData$1.progress},getAudioDuration=()=>{var t,e,i;if(state$1.isAppPlay){const r=((t=state$1.times[state$1.times.length-1||0])==null?void 0:t.endtime)||0;return audioData$1.duration||r}return((e=audioData$1.songEle)==null?void 0:e.duration)||((i=audioData$1.backgroundEle)==null?void 0:i.duration)||audioData$1.duration},setAudioCurrentTime=(t,e=0)=>{if(state$1.isAppPlay){setMidiCurrentTime(e);return}audioData$1.songEle&&(audioData$1.songEle.currentTime=t),audioData$1.backgroundEle&&(audioData$1.backgroundEle.currentTime=t),audioData$1.progress=t},toggleMutePlayAudio=(t,e)=>{t==="music"?audioData$1.songEle&&(audioData$1.songEle.muted=e):t==="background"&&audioData$1.backgroundEle&&(audioData$1.backgroundEle.muted=e)},AudioList=defineComponent({name:"audio-list",setup(){const t=()=>{midiRef.value.contentWindow.handleRendered=()=>{audioData$1.midiRender=!0},hanldeInitMidiData(midiRef.value)};watch(()=>state$1.playSource,()=>{if(state$1.modeType==="evaluating"&&!state$1.setting.enableAccompaniment){console.log("评测模式设置了关闭伴奏,不切换原音伴奏");return}state$1.playSource==="music"?(audioData$1.songEle&&(audioData$1.songEle.muted=!1),audioData$1.backgroundEle&&(audioData$1.backgroundEle.muted=!0)):(audioData$1.songEle&&(audioData$1.songEle.muted=!0),audioData$1.backgroundEle&&(audioData$1.backgroundEle.muted=!1))});const e=o=>new Promise(a=>{const l=new Audio(o+"?v="+Date.now());l.load(),l.onloadedmetadata=()=>{a(l)},l.onerror=()=>{a(null)}}),i=o=>{var u,m,d;const a=(o==null?void 0:o.currentTime)||((u=o==null?void 0:o.content)==null?void 0:u.currentTime),l=(o==null?void 0:o.totalDuration)||((m=o==null?void 0:o.content)==null?void 0:m.totalDuration),c=a/1e3;if(audioData$1.progress=c,audioData$1.songEle&&(audioData$1.songEle.currentTime=c),audioData$1.backgroundEle&&(audioData$1.backgroundEle.currentTime=c),audioData$1.duration=l/1e3,((d=o==null?void 0:o.content)==null?void 0:d.totalDuration)>1e3&&a>=l){if(evaluatingData.isAudioPlayEnd)return;evaluatingData.isAudioPlayEnd=!0,onEnded()}},r=o=>{var c,u,m;if(audioData$1.duration==0){const d=((c=state$1.times[state$1.times.length-1||0])==null?void 0:c.endtime)||0;audioData$1.duration=d}const a=(o==null?void 0:o.currentTime)||((u=o==null?void 0:o.content)==null?void 0:u.currentTime);o!=null&&o.totalDuration||((m=o==null?void 0:o.content)==null||m.totalDuration);const l=a/1e3;audioData$1.progress=l,state$1.sectionStatus&&state$1.section.length==2&&a>=state$1.section},s=o=>{o&&(console.log("midi结束"),audioData$1.progress=0,onEnded())};return onMounted(()=>{var o;if(state$1.playMode!=="MIDI")Promise.all([e(state$1.music),e(state$1.accompany)]).then(([a,l])=>{a&&(audioData$1.songEle=a),l&&(audioData$1.backgroundEle=l),audioData$1.songEle?(audioData$1.songEle.addEventListener("play",onPlay),audioData$1.songEle.addEventListener("ended",onEnded),l&&(l.muted=!0)):audioData$1.backgroundEle&&(audioData$1.backgroundEle.addEventListener("play",onPlay),audioData$1.backgroundEle.addEventListener("ended",onEnded))}),api_playProgress(i);else{const a=((o=state$1.times[state$1.times.length-1||0])==null?void 0:o.endtime)||0;audioData$1.duration=a,api_cloudTimeUpdae(r),api_cloudplayed(s)}}),onUnmounted(()=>{api_remove_cloudplayed(s),api_remove_cloudTimeUpdae(r)}),()=>createVNode("div",{class:styles$5.audioList},[state$1.playMode==="MIDI"&&state$1.speed!=0&&createVNode("iframe",{style:{display:"none"},ref:midiRef,src:"/midi/index.html",onLoad:t},null)])}}),popup="_popup_1838h_1",dots="_dots_1838h_6",dot="_dot_1838h_6",active="_active_1838h_20",one="_one_1838h_23",styles$4={popup,dots,dot,active,one},browserInfo$2=browser(),tickData=reactive({list:[],len:0,tickEnd:!1,beatLengthInMilliseconds:0,state:"",source1:"",source2:"",index:0,show:!1}),handlePlay=(t,e)=>new Promise(i=>{setTimeout(()=>{if(tickData.tickEnd){i(t);return}if(tickData.index++,e){const r=state$1.setting.beatVolume/100;e.volume=r,e.volume<=0?e.muted=!0:e.muted=!1,e.play()}i(t)},tickData.beatLengthInMilliseconds)}),audioData=reactive({tick:null,tock:null}),createAudio=t=>new Promise(e=>{const i=new Audio(t+"?v="+Date.now());i.load(),i.onloadedmetadata=()=>{e(i)},i.onerror=()=>{e(null)}}),handleInitTick=(t,e)=>{tickData.state="",tickData.beatLengthInMilliseconds=t,tickData.len=e},handleStartTick=async()=>{tickData.show=!0,tickData.tickEnd=!1,tickData.state!=="ok"&&(tickData.source1=new howler.Howl({src:tockAndTick.tick,html5:browserInfo$2.ios}),tickData.source2=new howler.Howl({src:tockAndTick.tock}),tickData.state="ok"),tickData.index=0,tickData.beatLengthInMilliseconds=60/state$1.speed*1e3;for(let t=0;t<=tickData.len;t++){if(tickData.tickEnd)return!1;const e=t===0?audioData.tick:t===tickData.len?null:audioData.tock;await handlePlay(t,e)}return tickData.show=!1,!0},Tick=defineComponent({name:"metronome",setup(){const t=()=>{tickData.tickEnd=!0};return onMounted(()=>{Promise.all([createAudio(tickWav),createAudio(tockWav)]).then(([e,i])=>{e&&(audioData.tick=e),i&&(audioData.tock=i)})}),()=>createVNode(Popup,{class:styles$4.popup,show:tickData.show,"onUpdate:show":e=>tickData.show=e,closeable:!0,onClickCloseIcon:t},{default:()=>[createVNode("div",{class:styles$4.dots},[Array(tickData.len).fill(0).map((e,i)=>createVNode("div",{class:[styles$4.dot,tickData.index>i&&styles$4.active,tickData.index>i&&i===0&&styles$4.one]},null))])]})}}),fraction="_fraction_8vx8x_1",close="_close_8vx8x_11",bg="_bg_8vx8x_18",content="_content_8vx8x_21",title="_title_8vx8x_21",desc="_desc_8vx8x_29",btn="_btn_8vx8x_37",loadColumn="_loadColumn_8vx8x_42",loadIcon="_loadIcon_8vx8x_57",successIcon="_successIcon_8vx8x_61",styles$3={fraction,close,bg,content,title,desc,btn,loadColumn,loadIcon,successIcon};var lottieExports={},lottie={get exports(){return lottieExports},set exports(t){lottieExports=t}};(function(module,exports){typeof navigator<"u"&&function(t,e){module.exports=e()}(commonjsGlobal,function(){var svgNS="http://www.w3.org/2000/svg",locationHref="",_useWebWorker=!1,initialDefaultFrame=-999999,setWebWorker=function(e){_useWebWorker=!!e},getWebWorker=function(){return _useWebWorker},setLocationHref=function(e){locationHref=e},getLocationHref=function(){return locationHref};function createTag(t){return document.createElement(t)}function extendPrototype(t,e){var i,r=t.length,s;for(i=0;i1?i[1]=1:i[1]<=0&&(i[1]=0),HSVtoRGB(i[0],i[1],i[2])}function addBrightnessToRGB(t,e){var i=RGBtoHSV(t[0]*255,t[1]*255,t[2]*255);return i[2]+=e,i[2]>1?i[2]=1:i[2]<0&&(i[2]=0),HSVtoRGB(i[0],i[1],i[2])}function addHueToRGB(t,e){var i=RGBtoHSV(t[0]*255,t[1]*255,t[2]*255);return i[0]+=e/360,i[0]>1?i[0]-=1:i[0]<0&&(i[0]+=1),HSVtoRGB(i[0],i[1],i[2])}var rgbToHex=function(){var t=[],e,i;for(e=0;e<256;e+=1)i=e.toString(16),t[e]=i.length===1?"0"+i:i;return function(r,s,o){return r<0&&(r=0),s<0&&(s=0),o<0&&(o=0),"#"+t[r]+t[s]+t[o]}}(),setSubframeEnabled=function(e){subframeEnabled=!!e},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(e){expressionsPlugin=e},getExpressionsPlugin=function(){return expressionsPlugin},setExpressionInterfaces=function(e){expressionsInterfaces=e},getExpressionInterfaces=function(){return expressionsInterfaces},setDefaultCurveSegments=function(e){defaultCurveSegments=e},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(e){idPrefix$1=e};function createNS(t){return document.createElementNS(svgNS,t)}function _typeof$5(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$5=function(i){return typeof i}:_typeof$5=function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},_typeof$5(t)}var dataManager=function(){var t=1,e=[],i,r,s={onmessage:function(){},postMessage:function(y){i({data:y})}},o={postMessage:function(y){s.onmessage({data:y})}};function a(g){if(window.Worker&&window.Blob&&getWebWorker()){var y=new Blob(["var _workerSelf = self; self.onmessage = ",g.toString()],{type:"text/javascript"}),b=URL.createObjectURL(y);return new Worker(b)}return i=g,s}function l(){r||(r=a(function(y){function b(){function E(H,O){var V,k,F=H.length,Z,U,J,de;for(k=0;k=0;O-=1)if(H[O].ty==="sh")if(H[O].ks.k.i)T(H[O].ks.k);else for(F=H[O].ks.k.length,k=0;kV[0]?!0:V[0]>H[0]?!1:H[1]>V[1]?!0:V[1]>H[1]?!1:H[2]>V[2]?!0:V[2]>H[2]?!1:null}var C=function(){var H=[4,4,14];function O(k){var F=k.t.d;k.t.d={k:[{s:F,t:0}]}}function V(k){var F,Z=k.length;for(F=0;F=0;F-=1)if(k[F].ty==="sh")if(k[F].ks.k.i)k[F].ks.k.c=k[F].closed;else for(J=k[F].ks.k.length,U=0;U500)&&(this._imageLoaded(),clearInterval(_)),A+=1}.bind(this),50)}function o(x){var A=r(x,this.assetsPath,this.path),_=createNS("image");isSafari?this.testImageLoaded(_):_.addEventListener("load",this._imageLoaded,!1),_.addEventListener("error",function(){P.img=t,this._imageLoaded()}.bind(this),!1),_.setAttributeNS("http://www.w3.org/1999/xlink","href",A),this._elementHelper.append?this._elementHelper.append(_):this._elementHelper.appendChild(_);var P={img:_,assetData:x};return P}function a(x){var A=r(x,this.assetsPath,this.path),_=createTag("img");_.crossOrigin="anonymous",_.addEventListener("load",this._imageLoaded,!1),_.addEventListener("error",function(){P.img=t,this._imageLoaded()}.bind(this),!1),_.src=A;var P={img:_,assetData:x};return P}function l(x){var A={assetData:x},_=r(x,this.assetsPath,this.path);return dataManager.loadData(_,function(P){A.img=P,this._footageLoaded()}.bind(this),function(){A.img={},this._footageLoaded()}.bind(this)),A}function c(x,A){this.imagesLoadedCb=A;var _,P=x.length;for(_=0;_this.animationData.op&&(this.animationData.op=t.op,this.totalFrames=Math.floor(t.op-this.animationData.ip));var e=this.animationData.layers,i,r=e.length,s=t.layers,o,a=s.length;for(o=0;othis.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},AnimationItem.prototype.renderFrame=function(){if(!(this.isLoaded===!1||!this.renderer))try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(t){this.triggerRenderFrameError(t)}},AnimationItem.prototype.play=function(t){t&&this.name!==t||this.isPaused===!0&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(t){t&&this.name!==t||this.isPaused===!1&&(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},AnimationItem.prototype.togglePause=function(t){t&&this.name!==t||(this.isPaused===!0?this.play():this.pause())},AnimationItem.prototype.stop=function(t){t&&this.name!==t||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.getMarkerData=function(t){for(var e,i=0;i=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(e>this.totalFrames?e%this.totalFrames:0)||(i=!0,e=this.totalFrames-1):e>=this.totalFrames?(this.playCount+=1,this.checkSegments(e%this.totalFrames)||(this.setCurrentRawFrameValue(e%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(e):e<0?this.checkSegments(e%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(this.setCurrentRawFrameValue(this.totalFrames+e%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0):(i=!0,e=0)):this.setCurrentRawFrameValue(e),i&&(this.setCurrentRawFrameValue(e),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(t,e){this.playCount=0,t[1]0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=t[0]-t[1],this.timeCompleted=this.totalFrames,this.firstFrame=t[1],this.setCurrentRawFrameValue(this.totalFrames-.001-e)):t[1]>t[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=t[1]-t[0],this.timeCompleted=this.totalFrames,this.firstFrame=t[0],this.setCurrentRawFrameValue(.001+e)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(t,e){var i=-1;this.isPaused&&(this.currentRawFrame+this.firstFramee&&(i=e-t)),this.firstFrame=t,this.totalFrames=e-t,this.timeCompleted=this.totalFrames,i!==-1&&this.goToAndStop(i,!0)},AnimationItem.prototype.playSegments=function(t,e){if(e&&(this.segments.length=0),_typeof$4(t[0])==="object"){var i,r=t.length;for(i=0;i=0;V-=1)e[V].animation.destroy(O)}function I(O,V,k){var F=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),Z,U=F.length;for(Z=0;Z0?P=I:_=I;while(Math.abs(C)>o&&++D=s?E(_,$,P,T):N===0?$:S(_,C,C+c,P,T)}},t}(),pooling=function(){function t(e){return e.concat(createSizedArray(e.length))}return{double:t}}(),poolFactory=function(){return function(t,e,i){var r=0,s=t,o=createSizedArray(s),a={newElement:l,release:c};function l(){var u;return r?(r-=1,u=o[r]):u=e(),u}function c(u){r===s&&(o=pooling.double(o),s*=2),i&&i(u),o[r]=u,r+=1}return a}}(),bezierLengthPool=function(){function t(){return{addedLength:0,percents:createTypedArray("float32",getDefaultCurveSegments()),lengths:createTypedArray("float32",getDefaultCurveSegments())}}return poolFactory(8,t)}(),segmentsLengthPool=function(){function t(){return{lengths:[],totalLength:0}}function e(i){var r,s=i.lengths.length;for(r=0;r-.001&&A<.001}function i(g,y,b,S,E,x,A,_,P){if(b===0&&x===0&&P===0)return e(g,y,S,E,A,_);var T=t.sqrt(t.pow(S-g,2)+t.pow(E-y,2)+t.pow(x-b,2)),M=t.sqrt(t.pow(A-g,2)+t.pow(_-y,2)+t.pow(P-b,2)),C=t.sqrt(t.pow(A-S,2)+t.pow(_-E,2)+t.pow(P-x,2)),I;return T>M?T>C?I=T-M-C:I=C-M-T:C>M?I=C-M-T:I=M-T-C,I>-1e-4&&I<1e-4}var r=function(){return function(g,y,b,S){var E=getDefaultCurveSegments(),x,A,_,P,T,M=0,C,I=[],D=[],G=bezierLengthPool.newElement();for(_=b.length,x=0;xA?-1:1,T=!0;T;)if(S[x]<=A&&S[x+1]>A?(_=(A-S[x])/(S[x+1]-S[x]),T=!1):x+=P,x<0||x>=E-1){if(x===E-1)return b[x];T=!1}return b[x]+(b[x+1]-b[x])*_}function u(g,y,b,S,E,x){var A=c(E,x),_=1-A,P=t.round((_*_*_*g[0]+(A*_*_+_*A*_+_*_*A)*b[0]+(A*A*_+_*A*A+A*_*A)*S[0]+A*A*A*y[0])*1e3)/1e3,T=t.round((_*_*_*g[1]+(A*_*_+_*A*_+_*_*A)*b[1]+(A*A*_+_*A*A+A*_*A)*S[1]+A*A*A*y[1])*1e3)/1e3;return[P,T]}var m=createTypedArray("float32",8);function d(g,y,b,S,E,x,A){E<0?E=0:E>1&&(E=1);var _=c(E,A);x=x>1?1:x;var P=c(x,A),T,M=g.length,C=1-_,I=1-P,D=C*C*C,G=_*C*C*3,$=_*_*C*3,N=_*_*_,z=C*C*I,R=_*C*I+C*_*I+C*C*P,H=_*_*I+C*_*P+_*C*P,O=_*_*P,V=C*I*I,k=_*I*I+C*P*I+C*I*P,F=_*P*I+C*P*P+_*I*P,Z=_*P*P,U=I*I*I,J=P*I*I+I*P*I+I*I*P,de=P*P*I+I*P*P+P*I*P,ne=P*P*P;for(T=0;T=u.t-i){c.h&&(c=u),s=0;break}if(u.t-i>t){s=o;break}o=x||t=x?P.points.length-1:0;for(g=P.points[T].point.length,d=0;d=I&&M=x)r[0]=_[0],r[1]=_[1],r[2]=_[2];else if(t<=A)r[0]=c.s[0],r[1]=c.s[1],r[2]=c.s[2];else{var R=createQuaternion(c.s),H=createQuaternion(_),O=(t-A)/(x-A);quaternionToEuler(r,slerp(R,H,O))}else for(o=0;o=x?y=1:t1e-6?(g=Math.acos(y),b=Math.sin(g),S=Math.sin((1-i)*g)/b,E=Math.sin(i*g)/b):(S=1-i,E=i),r[0]=S*s+E*c,r[1]=S*o+E*u,r[2]=S*a+E*m,r[3]=S*l+E*d,r}function quaternionToEuler(t,e){var i=e[0],r=e[1],s=e[2],o=e[3],a=Math.atan2(2*r*o-2*i*s,1-2*r*r-2*s*s),l=Math.asin(2*i*r+2*s*o),c=Math.atan2(2*i*o-2*r*s,1-2*i*i-2*s*s);t[0]=a/degToRads,t[1]=l/degToRads,t[2]=c/degToRads}function createQuaternion(t){var e=t[0]*degToRads,i=t[1]*degToRads,r=t[2]*degToRads,s=Math.cos(e/2),o=Math.cos(i/2),a=Math.cos(r/2),l=Math.sin(e/2),c=Math.sin(i/2),u=Math.sin(r/2),m=s*o*a-l*c*u,d=l*c*a+s*o*u,g=l*o*a+s*c*u,y=s*c*a-l*o*u;return[d,g,y,m]}function getValueAtCurrentTime(){var t=this.comp.renderedFrame-this.offsetTime,e=this.keyframes[0].t-this.offsetTime,i=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(t===this._caching.lastFrame||this._caching.lastFrame!==initFrame&&(this._caching.lastFrame>=i&&t>=i||this._caching.lastFrame=t&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var r=this.interpolateValue(t,this._caching);this.pv=r}return this._caching.lastFrame=t,this.pv}function setVValue(t){var e;if(this.propType==="unidimensional")e=t*this.mult,mathAbs(this.v-e)>1e-5&&(this.v=e,this._mdf=!0);else for(var i=0,r=this.v.length;i1e-5&&(this.v[i]=e,this._mdf=!0),i+=1}function processEffectsSequence(){if(!(this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)){if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=this._isFirstFrame;var t,e=this.effectsSequence.length,i=this.kf?this.pv:this.data.k;for(t=0;t=this._maxLength&&this.doubleArrayLength(),i){case"v":o=this.v;break;case"i":o=this.i;break;case"o":o=this.o;break;default:o=[];break}(!o[r]||o[r]&&!s)&&(o[r]=pointPool.newElement()),o[r][0]=t,o[r][1]=e},ShapePath.prototype.setTripleAt=function(t,e,i,r,s,o,a,l){this.setXYAt(t,e,"v",a,l),this.setXYAt(i,r,"o",a,l),this.setXYAt(s,o,"i",a,l)},ShapePath.prototype.reverse=function(){var t=new ShapePath;t.setPathData(this.c,this._length);var e=this.v,i=this.o,r=this.i,s=0;this.c&&(t.setTripleAt(e[0][0],e[0][1],r[0][0],r[0][1],i[0][0],i[0][1],0,!1),s=1);var o=this._length-1,a=this._length,l;for(l=s;l=R[R.length-1].t-this.offsetTime)T=R[R.length-1].s?R[R.length-1].s[0]:R[R.length-2].e[0],C=!0;else{for(var H=P,O=R.length-1,V=!0,k,F,Z;V&&(k=R[H],F=R[H+1],!(F.t-this.offsetTime>x));)H=F.t-this.offsetTime)N=1;else if(x_&&x>_)||(this._caching.lastIndex=P0||k>-1e-6&&k<0?r(k*F)/F:k}function V(){var k=this.props,F=O(k[0]),Z=O(k[1]),U=O(k[4]),J=O(k[5]),de=O(k[12]),ne=O(k[13]);return"matrix("+F+","+Z+","+U+","+J+","+de+","+ne+")"}return function(){this.reset=s,this.rotate=o,this.rotateX=a,this.rotateY=l,this.rotateZ=c,this.skew=m,this.skewFromAxis=d,this.shear=u,this.scale=g,this.setTransform=y,this.translate=b,this.transform=S,this.multiply=E,this.applyToPoint=T,this.applyToX=M,this.applyToY=C,this.applyToZ=I,this.applyToPointArray=z,this.applyToTriplePoints=N,this.applyToPointStringified=R,this.toCSS=H,this.to2dCSS=V,this.clone=_,this.cloneFromProps=P,this.equals=A,this.inversePoints=$,this.inversePoint=G,this.getInverseMatrix=D,this._t=this.transform,this.isIdentity=x,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}}();function _typeof$3(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$3=function(i){return typeof i}:_typeof$3=function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},_typeof$3(t)}var lottie={};function setLocation(t){setLocationHref(t)}function searchAnimations(){animationManager.searchAnimations()}function setSubframeRendering(t){setSubframeEnabled(t)}function setPrefix(t){setIdPrefix(t)}function loadAnimation(t){return animationManager.loadAnimation(t)}function setQuality(t){if(typeof t=="string")switch(t){case"high":setDefaultCurveSegments(200);break;default:case"medium":setDefaultCurveSegments(50);break;case"low":setDefaultCurveSegments(10);break}else!isNaN(t)&&t>1&&setDefaultCurveSegments(t)}function inBrowser(){return typeof navigator<"u"}function installPlugin(t,e){t==="expressions"&&setExpressionsPlugin(e)}function getFactory(t){switch(t){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix;default:return null}}lottie.play=animationManager.play,lottie.pause=animationManager.pause,lottie.setLocationHref=setLocation,lottie.togglePause=animationManager.togglePause,lottie.setSpeed=animationManager.setSpeed,lottie.setDirection=animationManager.setDirection,lottie.stop=animationManager.stop,lottie.searchAnimations=searchAnimations,lottie.registerAnimation=animationManager.registerAnimation,lottie.loadAnimation=loadAnimation,lottie.setSubframeRendering=setSubframeRendering,lottie.resize=animationManager.resize,lottie.goToAndStop=animationManager.goToAndStop,lottie.destroy=animationManager.destroy,lottie.setQuality=setQuality,lottie.inBrowser=inBrowser,lottie.installPlugin=installPlugin,lottie.freeze=animationManager.freeze,lottie.unfreeze=animationManager.unfreeze,lottie.setVolume=animationManager.setVolume,lottie.mute=animationManager.mute,lottie.unmute=animationManager.unmute,lottie.getRegisteredAnimations=animationManager.getRegisteredAnimations,lottie.useWebWorker=setWebWorker,lottie.setIDPrefix=setPrefix,lottie.__getFactory=getFactory,lottie.version="5.12.2";function checkReady(){document.readyState==="complete"&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(t){for(var e=queryString.split("&"),i=0;i=1?o.push({s:t-1,e:e-1}):(o.push({s:t,e:1}),o.push({s:0,e:e-1}));var a=[],l,c=o.length,u;for(l=0;lr+i)){var m,d;u.s*s<=r?m=0:m=(u.s*s-r)/i,u.e*s>=r+i?d=1:d=(u.e*s-r)/i,a.push([m,d])}return a.length||a.push([0,0]),a},TrimModifier.prototype.releasePathsData=function(t){var e,i=t.length;for(e=0;e1?e=1+r:this.s.v<0?e=0+r:e=this.s.v+r,this.e.v>1?i=1+r:this.e.v<0?i=0+r:i=this.e.v+r,e>i){var s=e;e=i,i=s}e=Math.round(e*1e4)*1e-4,i=Math.round(i*1e4)*1e-4,this.sValue=e,this.eValue=i}else e=this.sValue,i=this.eValue;var o,a,l=this.shapes.length,c,u,m,d,g,y=0;if(i===e)for(a=0;a=0;a-=1)if(S=this.shapes[a],S.shape._mdf){for(E=S.localShapeCollection,E.releaseShapes(),this.m===2&&l>1?(P=this.calculateShapeEdges(e,i,S.totalShapeLength,_,y),_+=S.totalShapeLength):P=[[x,A]],u=P.length,c=0;c=1?b.push({s:S.totalShapeLength*(x-1),e:S.totalShapeLength*(A-1)}):(b.push({s:S.totalShapeLength*x,e:S.totalShapeLength}),b.push({s:0,e:S.totalShapeLength*(A-1)}));var T=this.addShapes(S,b[0]);if(b[0].s!==b[0].e){if(b.length>1){var M=S.shape.paths.shapes[S.shape.paths._length-1];if(M.c){var C=T.pop();this.addPaths(T,E),T=this.addShapes(S,b[1],C)}else this.addPaths(T,E),T=this.addShapes(S,b[1])}this.addPaths(T,E)}}S.shape.paths=E}}},TrimModifier.prototype.addPaths=function(t,e){var i,r=t.length;for(i=0;ie.e){i.c=!1;break}else e.s<=u&&e.e>=u+m.addedLength?(this.addSegment(s[o].v[l-1],s[o].o[l-1],s[o].i[l],s[o].v[l],i,d,E),E=!1):(y=bez.getNewSegment(s[o].v[l-1],s[o].v[l],s[o].o[l-1],s[o].i[l],(e.s-u)/m.addedLength,(e.e-u)/m.addedLength,g[l-1]),this.addSegmentFromArray(y,i,d,E),E=!1,i.c=!1),u+=m.addedLength,d+=1;if(s[o].c&&g.length){if(m=g[l-1],u<=e.e){var x=g[l-1].addedLength;e.s<=u&&e.e>=u+x?(this.addSegment(s[o].v[l-1],s[o].o[l-1],s[o].i[0],s[o].v[0],i,d,E),E=!1):(y=bez.getNewSegment(s[o].v[l-1],s[o].v[0],s[o].o[l-1],s[o].i[0],(e.s-u)/x,(e.e-u)/x,g[l-1]),this.addSegmentFromArray(y,i,d,E),E=!1,i.c=!1)}else i.c=!1;u+=m.addedLength,d+=1}if(i._length&&(i.setXYAt(i.v[S][0],i.v[S][1],"i",S),i.setXYAt(i.v[i._length-1][0],i.v[i._length-1][1],"o",i._length-1)),u>e.e)break;o=this.p.keyframes[this.p.keyframes.length-1].t?(m=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/u,0),d=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/u,0)):(m=this.p.pv,d=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/u,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){m=[],d=[];var g=this.px,y=this.py;g._caching.lastFrame+g.offsetTime<=g.keyframes[0].t?(m[0]=g.getValueAtTime((g.keyframes[0].t+.01)/u,0),m[1]=y.getValueAtTime((y.keyframes[0].t+.01)/u,0),d[0]=g.getValueAtTime(g.keyframes[0].t/u,0),d[1]=y.getValueAtTime(y.keyframes[0].t/u,0)):g._caching.lastFrame+g.offsetTime>=g.keyframes[g.keyframes.length-1].t?(m[0]=g.getValueAtTime(g.keyframes[g.keyframes.length-1].t/u,0),m[1]=y.getValueAtTime(y.keyframes[y.keyframes.length-1].t/u,0),d[0]=g.getValueAtTime((g.keyframes[g.keyframes.length-1].t-.01)/u,0),d[1]=y.getValueAtTime((y.keyframes[y.keyframes.length-1].t-.01)/u,0)):(m=[g.pv,y.pv],d[0]=g.getValueAtTime((g._caching.lastFrame+g.offsetTime-.01)/u,g.offsetTime),d[1]=y.getValueAtTime((y._caching.lastFrame+y.offsetTime-.01)/u,y.offsetTime))}else d=t,m=d;this.v.rotate(-Math.atan2(m[1]-d[1],m[0]-d[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function r(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length)this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1;else return;if(!this.s.effectsSequence.length)this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2;else return;if(this.sk)if(!this.sk.effectsSequence.length&&!this.sa.effectsSequence.length)this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;else return;this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):!this.rz.effectsSequence.length&&!this.ry.effectsSequence.length&&!this.rx.effectsSequence.length&&!this.or.effectsSequence.length&&(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}function s(){}function o(c){this._addDynamicProperty(c),this.elem.addDynamicProperty(c),this._isDirty=!0}function a(c,u,m){if(this.elem=c,this.frameId=-1,this.propType="transform",this.data=u,this.v=new Matrix,this.pre=new Matrix,this.appliedTransformations=0,this.initDynamicPropertyContainer(m||c),u.p&&u.p.s?(this.px=PropertyFactory.getProp(c,u.p.x,0,0,this),this.py=PropertyFactory.getProp(c,u.p.y,0,0,this),u.p.z&&(this.pz=PropertyFactory.getProp(c,u.p.z,0,0,this))):this.p=PropertyFactory.getProp(c,u.p||{k:[0,0,0]},1,0,this),u.rx){if(this.rx=PropertyFactory.getProp(c,u.rx,0,degToRads,this),this.ry=PropertyFactory.getProp(c,u.ry,0,degToRads,this),this.rz=PropertyFactory.getProp(c,u.rz,0,degToRads,this),u.or.k[0].ti){var d,g=u.or.k.length;for(d=0;d0;)i-=1,this._elements.unshift(e[i]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(t){var e,i=t.length;for(e=0;e0?Math.floor(g):Math.ceil(g),S=this.pMatrix.props,E=this.rMatrix.props,x=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var A=0;if(g>0){for(;Ab;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),A-=1;y&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-y,!0),A-=y)}r=this.data.m===1?0:this._currentCopies-1,s=this.data.m===1?1:-1,o=this._currentCopies;for(var _,P;o;){if(e=this.elemsData[r].it,i=e[e.length-1].transform.mProps.v.props,P=i.length,e[e.length-1].transform.mProps._mdf=!0,e[e.length-1].transform.op._mdf=!0,e[e.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(r/(this._currentCopies-1)),A!==0){for((r!==0&&s===1||r!==this._currentCopies-1&&s===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(E[0],E[1],E[2],E[3],E[4],E[5],E[6],E[7],E[8],E[9],E[10],E[11],E[12],E[13],E[14],E[15]),this.matrix.transform(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15]),this.matrix.transform(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[8],S[9],S[10],S[11],S[12],S[13],S[14],S[15]),_=0;_0&&r<1?[e]:[]:[e-r,e+r].filter(function(s){return s>0&&s<1})},PolynomialBezier.prototype.split=function(t){if(t<=0)return[singlePoint(this.points[0]),this];if(t>=1)return[this,singlePoint(this.points[this.points.length-1])];var e=lerpPoint(this.points[0],this.points[1],t),i=lerpPoint(this.points[1],this.points[2],t),r=lerpPoint(this.points[2],this.points[3],t),s=lerpPoint(e,i,t),o=lerpPoint(i,r,t),a=lerpPoint(s,o,t);return[new PolynomialBezier(this.points[0],e,s,a,!0),new PolynomialBezier(a,o,r,this.points[3],!0)]};function extrema(t,e){var i=t.points[0][e],r=t.points[t.points.length-1][e];if(i>r){var s=r;r=i,i=s}for(var o=quadRoots(3*t.a[e],2*t.b[e],t.c[e]),a=0;a0&&o[a]<1){var l=t.point(o[a])[e];lr&&(r=l)}return{min:i,max:r}}PolynomialBezier.prototype.bounds=function(){return{x:extrema(this,0),y:extrema(this,1)}},PolynomialBezier.prototype.boundingBox=function(){var t=this.bounds();return{left:t.x.min,right:t.x.max,top:t.y.min,bottom:t.y.max,width:t.x.max-t.x.min,height:t.y.max-t.y.min,cx:(t.x.max+t.x.min)/2,cy:(t.y.max+t.y.min)/2}};function intersectData(t,e,i){var r=t.boundingBox();return{cx:r.cx,cy:r.cy,width:r.width,height:r.height,bez:t,t:(e+i)/2,t1:e,t2:i}}function splitData(t){var e=t.bez.split(.5);return[intersectData(e[0],t.t1,t.t),intersectData(e[1],t.t,t.t2)]}function boxIntersect(t,e){return Math.abs(t.cx-e.cx)*2=o||t.width<=r&&t.height<=r&&e.width<=r&&e.height<=r){s.push([t.t,e.t]);return}var a=splitData(t),l=splitData(e);intersectsImpl(a[0],l[0],i+1,r,s,o),intersectsImpl(a[0],l[1],i+1,r,s,o),intersectsImpl(a[1],l[0],i+1,r,s,o),intersectsImpl(a[1],l[1],i+1,r,s,o)}}PolynomialBezier.prototype.intersections=function(t,e,i){e===void 0&&(e=2),i===void 0&&(i=7);var r=[];return intersectsImpl(intersectData(this,0,1),intersectData(t,0,1),0,e,r,i),r},PolynomialBezier.shapeSegment=function(t,e){var i=(e+1)%t.length();return new PolynomialBezier(t.v[e],t.o[e],t.i[i],t.v[i],!0)},PolynomialBezier.shapeSegmentInverted=function(t,e){var i=(e+1)%t.length();return new PolynomialBezier(t.v[i],t.i[i],t.o[e],t.v[e],!0)};function crossProduct(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function lineIntersection(t,e,i,r){var s=[t[0],t[1],1],o=[e[0],e[1],1],a=[i[0],i[1],1],l=[r[0],r[1],1],c=crossProduct(crossProduct(s,o),crossProduct(a,l));return floatZero(c[2])?null:[c[0]/c[2],c[1]/c[2]]}function polarOffset(t,e,i){return[t[0]+Math.cos(e)*i,t[1]-Math.sin(e)*i]}function pointDistance(t,e){return Math.hypot(t[0]-e[0],t[1]-e[1])}function pointEqual(t,e){return floatEqual(t[0],e[0])&&floatEqual(t[1],e[1])}function ZigZagModifier(){}extendPrototype([ShapeModifier],ZigZagModifier),ZigZagModifier.prototype.initModifierProperties=function(t,e){this.getValue=this.processKeys,this.amplitude=PropertyFactory.getProp(t,e.s,0,null,this),this.frequency=PropertyFactory.getProp(t,e.r,0,null,this),this.pointsType=PropertyFactory.getProp(t,e.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0};function setPoint(t,e,i,r,s,o,a){var l=i-Math.PI/2,c=i+Math.PI/2,u=e[0]+Math.cos(i)*r*s,m=e[1]-Math.sin(i)*r*s;t.setTripleAt(u,m,u+Math.cos(l)*o,m-Math.sin(l)*o,u+Math.cos(c)*a,m-Math.sin(c)*a,t.length())}function getPerpendicularVector(t,e){var i=[e[0]-t[0],e[1]-t[1]],r=-Math.PI*.5,s=[Math.cos(r)*i[0]-Math.sin(r)*i[1],Math.sin(r)*i[0]+Math.cos(r)*i[1]];return s}function getProjectingAngle(t,e){var i=e===0?t.length()-1:e-1,r=(e+1)%t.length(),s=t.v[i],o=t.v[r],a=getPerpendicularVector(s,o);return Math.atan2(0,1)-Math.atan2(a[1],a[0])}function zigZagCorner(t,e,i,r,s,o,a){var l=getProjectingAngle(e,i),c=e.v[i%e._length],u=e.v[i===0?e._length-1:i-1],m=e.v[(i+1)%e._length],d=o===2?Math.sqrt(Math.pow(c[0]-u[0],2)+Math.pow(c[1]-u[1],2)):0,g=o===2?Math.sqrt(Math.pow(c[0]-m[0],2)+Math.pow(c[1]-m[1],2)):0;setPoint(t,e.v[i%e._length],l,a,r,g/((s+1)*2),d/((s+1)*2))}function zigZagSegment(t,e,i,r,s,o){for(var a=0;a1&&e.length>1&&(s=getIntersection(t[0],e[e.length-1]),s)?[[t[0].split(s[0])[0]],[e[e.length-1].split(s[1])[1]]]:[i,r]}function pruneIntersections(t){for(var e,i=1;i1&&(e=pruneSegmentIntersection(t[t.length-1],t[0]),t[t.length-1]=e[0],t[0]=e[1]),t}function offsetSegmentSplit(t,e){var i=t.inflectionPoints(),r,s,o,a;if(i.length===0)return[offsetSegment(t,e)];if(i.length===1||floatEqual(i[1],1))return o=t.split(i[0]),r=o[0],s=o[1],[offsetSegment(r,e),offsetSegment(s,e)];o=t.split(i[0]),r=o[0];var l=(i[1]-i[0])/(1-i[0]);return o=o[1].split(l),a=o[0],s=o[1],[offsetSegment(r,e),offsetSegment(a,e),offsetSegment(s,e)]}function OffsetPathModifier(){}extendPrototype([ShapeModifier],OffsetPathModifier),OffsetPathModifier.prototype.initModifierProperties=function(t,e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(t,e.a,0,null,this),this.miterLimit=PropertyFactory.getProp(t,e.ml,0,null,this),this.lineJoin=e.lj,this._isAnimated=this.amount.effectsSequence.length!==0},OffsetPathModifier.prototype.processPath=function(t,e,i,r){var s=shapePool.newElement();s.c=t.c;var o=t.length();t.c||(o-=1);var a,l,c,u=[];for(a=0;a=0;a-=1)c=PolynomialBezier.shapeSegmentInverted(t,a),u.push(offsetSegmentSplit(c,e));u=pruneIntersections(u);var m=null,d=null;for(a=0;a0&&(J=!1),J){var te=createTag("style");te.setAttribute("f-forigin",k[F].fOrigin),te.setAttribute("f-origin",k[F].origin),te.setAttribute("f-family",k[F].fFamily),te.type="text/css",te.innerText="@font-face {font-family: "+k[F].fFamily+"; font-style: normal; src: url('"+k[F].fPath+"');}",V.appendChild(te)}}else if(k[F].fOrigin==="g"||k[F].origin===1){for(de=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),ne=0;ne=55296&&k<=56319){var F=O.charCodeAt(1);F>=56320&&F<=57343&&(V=(k-55296)*1024+F-56320+65536)}return V}function M(O,V){var k=O.toString(16)+V.toString(16);return d.indexOf(k)!==-1}function C(O){return O===c}function I(O){return O===l}function D(O){var V=T(O);return V>=u&&V<=m}function G(O){return D(O.substr(0,2))&&D(O.substr(2,2))}function $(O){return i.indexOf(O)!==-1}function N(O,V){var k=T(O.substr(V,2));if(k!==r)return!1;var F=0;for(V+=2;F<5;){if(k=T(O.substr(V,2)),ka)return!1;F+=1,V+=2}return T(O.substr(V,2))===s}function z(){this.isLoaded=!0}var R=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};R.isModifier=M,R.isZeroWidthJoiner=C,R.isFlagEmoji=G,R.isRegionalCode=D,R.isCombinedCharacter=$,R.isRegionalFlag=N,R.isVariationSelector=I,R.BLACK_FLAG_CODE_POINT=r;var H={addChars:x,addFonts:E,getCharData:A,getFontByName:P,measureText:_,checkLoadedFonts:b,setIsLoaded:z};return R.prototype=H,R}();function SlotManager(t){this.animationData=t}SlotManager.prototype.getProp=function(t){return this.animationData.slots&&this.animationData.slots[t.sid]?Object.assign(t,this.animationData.slots[t.sid].p):t};function slotFactory(t){return new SlotManager(t)}function RenderableElement(){}RenderableElement.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(e){this.renderableComponents.indexOf(e)===-1&&this.renderableComponents.push(e)},removeRenderableComponent:function(e){this.renderableComponents.indexOf(e)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(e),1)},prepareRenderableFrame:function(e){this.checkLayerLimits(e)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(e){this.data.ip-this.data.st<=e&&this.data.op-this.data.st>e?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var e,i=this.renderableComponents.length;for(e=0;e.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},AudioElement.prototype.show=function(){},AudioElement.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},AudioElement.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},AudioElement.prototype.resume=function(){this._canPlay=!0},AudioElement.prototype.setRate=function(t){this.audio.rate(t)},AudioElement.prototype.volume=function(t){this._volumeMultiplier=t,this._previousVolume=t*this._volume,this.audio.volume(this._previousVolume)},AudioElement.prototype.getBaseElement=function(){return null},AudioElement.prototype.destroy=function(){},AudioElement.prototype.sourceRectAtTime=function(){},AudioElement.prototype.initExpressions=function(){};function BaseRenderer(){}BaseRenderer.prototype.checkLayers=function(t){var e,i=this.layers.length,r;for(this.completeLayers=!0,e=i-1;e>=0;e-=1)this.elements[e]||(r=this.layers[e],r.ip-r.st<=t-this.layers[e].st&&r.op-r.st>t-this.layers[e].st&&this.buildItem(e)),this.completeLayers=this.elements[e]?this.completeLayers:!1;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(t){switch(t.ty){case 2:return this.createImage(t);case 0:return this.createComp(t);case 1:return this.createSolid(t);case 3:return this.createNull(t);case 4:return this.createShape(t);case 5:return this.createText(t);case 6:return this.createAudio(t);case 13:return this.createCamera(t);case 15:return this.createFootage(t);default:return this.createNull(t)}},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.createAudio=function(t){return new AudioElement(t,this.globalData,this)},BaseRenderer.prototype.createFootage=function(t){return new FootageElement(t,this.globalData,this)},BaseRenderer.prototype.buildAllItems=function(){var t,e=this.layers.length;for(t=0;t0&&(this.maskElement.setAttribute("id",g),this.element.maskedElement.setAttribute(A,"url("+getLocationHref()+"#"+g+")"),r.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}MaskElement.prototype.getMaskProperty=function(t){return this.viewData[t].prop},MaskElement.prototype.renderFrame=function(t){var e=this.element.finalTransform.mat,i,r=this.masksProperties.length;for(i=0;i1&&(r+=" C"+e.o[s-1][0]+","+e.o[s-1][1]+" "+e.i[0][0]+","+e.i[0][1]+" "+e.v[0][0]+","+e.v[0][1]),i.lastPath!==r){var a="";i.elem&&(e.c&&(a=t.inv?this.solidPath+r:r),i.elem.setAttribute("d",a)),i.lastPath=r}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var filtersFactory=function(){var t={};t.createFilter=e,t.createAlphaToLuminanceFilter=i;function e(r,s){var o=createNS("filter");return o.setAttribute("id",r),s!==!0&&(o.setAttribute("filterUnits","objectBoundingBox"),o.setAttribute("x","0%"),o.setAttribute("y","0%"),o.setAttribute("width","100%"),o.setAttribute("height","100%")),o}function i(){var r=createNS("feColorMatrix");return r.setAttribute("type","matrix"),r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),r}return t}(),featureSupport=function(){var t={maskType:!0,svgLumaHidden:!0,offscreenCanvas:typeof OffscreenCanvas<"u"};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(t.maskType=!1),/firefox/i.test(navigator.userAgent)&&(t.svgLumaHidden=!1),t}(),registeredEffects$1={},idPrefix="filter_result_";function SVGEffects(t){var e,i="SourceGraphic",r=t.data.ef?t.data.ef.length:0,s=createElementID(),o=filtersFactory.createFilter(s,!0),a=0;this.filters=[];var l;for(e=0;e=0&&(r=this.shapeModifiers[e].processShapes(this._isFirstFrame),!r);e-=1);}},searchProcessedElement:function(e){for(var i=this.processedElements,r=0,s=i.length;r.01)return!1;i+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var t=0,e=this.data.k.k.length;t0;)x=g.transformers[D].mProps._mdf||x,I-=1,D-=1;if(x)for(I=T-g.styles[_].lvl,D=g.transformers.length-1;I>0;)C.multiply(g.transformers[D].mProps.v),I-=1,D-=1}else C=t;if(M=g.sh.paths,S=M._length,x){for(E="",b=0;b=1?z=.99:z<=-1&&(z=-.99);var R=$*z,H=Math.cos(N+g.a.v)*R+E[0],O=Math.sin(N+g.a.v)*R+E[1];b.setAttribute("fx",H),b.setAttribute("fy",O),S&&!g.g._collapsable&&(g.of.setAttribute("fx",H),g.of.setAttribute("fy",O))}}}function m(d,g,y){var b=g.style,S=g.d;S&&(S._mdf||y)&&S.dashStr&&(b.pElem.setAttribute("stroke-dasharray",S.dashStr),b.pElem.setAttribute("stroke-dashoffset",S.dashoffset[0])),g.c&&(g.c._mdf||y)&&b.pElem.setAttribute("stroke","rgb("+bmFloor(g.c.v[0])+","+bmFloor(g.c.v[1])+","+bmFloor(g.c.v[2])+")"),(g.o._mdf||y)&&b.pElem.setAttribute("stroke-opacity",g.o.v),(g.w._mdf||y)&&(b.pElem.setAttribute("stroke-width",g.w.v),b.msElem&&b.msElem.setAttribute("stroke-width",g.w.v))}return i}();function SVGShapeElement(t,e,i){this.shapes=[],this.shapesData=t.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(t,e,i),this.prevViewData=[]}extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement],SVGShapeElement),SVGShapeElement.prototype.initSecondaryElement=function(){},SVGShapeElement.prototype.identityMatrix=new Matrix,SVGShapeElement.prototype.buildExpressionInterface=function(){},SVGShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},SVGShapeElement.prototype.filterUniqueShapes=function(){var t,e=this.shapes.length,i,r,s=this.stylesList.length,o,a=[],l=!1;for(r=0;r1&&l&&this.setShapesAsAnimated(a)}},SVGShapeElement.prototype.setShapesAsAnimated=function(t){var e,i=t.length;for(e=0;e=0;c-=1){if(E=this.searchProcessedElement(t[c]),E?e[c]=i[E-1]:t[c]._render=a,t[c].ty==="fl"||t[c].ty==="st"||t[c].ty==="gf"||t[c].ty==="gs"||t[c].ty==="no")E?e[c].style.closed=!1:e[c]=this.createStyleElement(t[c],s),t[c]._render&&e[c].style.pElem.parentNode!==r&&r.appendChild(e[c].style.pElem),g.push(e[c].style);else if(t[c].ty==="gr"){if(!E)e[c]=this.createGroupElement(t[c]);else for(d=e[c].it.length,m=0;m1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(t){this.effectsSequence.push(t),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(t){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!t)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var e=this.currentData,i=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var r,s=this.effectsSequence.length,o=t||this.data.d.k[this.keysIndex].s;for(r=0;re);)i+=1;return this.keysIndex!==i&&(this.keysIndex=i),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(t){for(var e=[],i=0,r=t.length,s,o,a=!1,l=!1,c="";i=55296&&s<=56319?FontManager.isRegionalFlag(t,i)?c=t.substr(i,14):(o=t.charCodeAt(i+1),o>=56320&&o<=57343&&(FontManager.isModifier(s,o)?(c=t.substr(i,2),a=!0):FontManager.isFlagEmoji(t.substr(i,4))?c=t.substr(i,4):c=t.substr(i,2))):s>56319?(o=t.charCodeAt(i+1),FontManager.isVariationSelector(s)&&(a=!0)):FontManager.isZeroWidthJoiner(s)&&(a=!0,l=!0),a?(e[e.length-1]+=c,a=!1):e.push(c),i+=c.length;return e},TextProperty.prototype.completeTextData=function(t){t.__complete=!0;var e=this.elem.globalData.fontManager,i=this.data,r=[],s,o,a,l=0,c,u=i.m.g,m=0,d=0,g=0,y=[],b=0,S=0,E,x,A=e.getFontByName(t.f),_,P=0,T=getFontProperties(A);t.fWeight=T.weight,t.fStyle=T.style,t.finalSize=t.s,t.finalText=this.buildFinalText(t.t),o=t.finalText.length,t.finalLineHeight=t.lh;var M=t.tr/1e3*t.finalSize,C;if(t.sz)for(var I=!0,D=t.sz[0],G=t.sz[1],$,N;I;){N=this.buildFinalText(t.t),$=0,b=0,o=N.length,M=t.tr/1e3*t.finalSize;var z=-1;for(s=0;sD&&N[s]!==" "?(z===-1?o+=1:s=z,$+=t.finalLineHeight||t.finalSize*1.2,N.splice(s,z===s?1:0,"\r"),z=-1,b=0):(b+=P,b+=M);$+=A.ascent*t.finalSize/100,this.canResize&&t.finalSize>this.minimumFontSize&&G<$?(t.finalSize-=1,t.finalLineHeight=t.finalSize*t.lh/t.s):(t.finalText=N,o=t.finalText.length,I=!1)}b=-M,P=0;var R=0,H;for(s=0;sS?b:S,b=-2*M,c="",a=!0,g+=1):c=H,e.chars?(_=e.getCharData(H,A.fStyle,e.getFontByName(t.f).fFamily),P=a?0:_.w*t.finalSize/100):P=e.measureText(c,t.f,t.finalSize),H===" "?R+=P+M:(b+=P+M+R,R=0),r.push({l:P,an:P,add:m,n:a,anIndexes:[],val:c,line:g,animatorJustifyOffset:0}),u==2){if(m+=P,c===""||c===" "||s===o-1){for((c===""||c===" ")&&(m-=P);d<=s;)r[d].an=m,r[d].ind=l,r[d].extra=P,d+=1;l+=1,m=0}}else if(u==3){if(m+=P,c===""||s===o-1){for(c===""&&(m-=P);d<=s;)r[d].an=m,r[d].ind=l,r[d].extra=P,d+=1;m=0,l+=1}}else r[l].ind=l,r[l].extra=0,l+=1;if(t.l=r,S=b>S?b:S,y.push(b),t.sz)t.boxWidth=t.sz[0],t.justifyOffset=0;else switch(t.boxWidth=S,t.j){case 1:t.justifyOffset=-t.boxWidth;break;case 2:t.justifyOffset=-t.boxWidth/2;break;default:t.justifyOffset=0}t.lineWidths=y;var O=i.a,V,k;x=O.length;var F,Z,U=[];for(E=0;E0?l=this.ne.v/100:c=-this.ne.v/100,this.xe.v>0?u=1-this.xe.v/100:m=1+this.xe.v/100;var d=BezierFactory.getBezierEasing(l,c,u,m).get,g=0,y=this.finalS,b=this.finalE,S=this.data.sh;if(S===2)b===y?g=a>=b?1:0:g=t(0,e(.5/(b-y)+(a-y)/(b-y),1)),g=d(g);else if(S===3)b===y?g=a>=b?0:1:g=1-t(0,e(.5/(b-y)+(a-y)/(b-y),1)),g=d(g);else if(S===4)b===y?g=0:(g=t(0,e(.5/(b-y)+(a-y)/(b-y),1)),g<.5?g*=2:g=1-2*(g-.5)),g=d(g);else if(S===5){if(b===y)g=0;else{var E=b-y;a=e(t(0,a+.5-y),b-y);var x=-E/2+a,A=E/2;g=Math.sqrt(1-x*x/(A*A))}g=d(g)}else S===6?(b===y?g=0:(a=e(t(0,a+.5-y),b-y),g=(1+Math.cos(Math.PI+Math.PI*2*a/(b-y)))/2),g=d(g)):(a>=i(y)&&(a-y<0?g=t(0,e(e(b,1)-(y-a),1)):g=t(0,e(b-a,1))),g=d(g));if(this.sm.v!==100){var _=this.sm.v*.01;_===0&&(_=1e-8);var P=.5-_*.5;g1&&(g=1))}return g*this.a.v},getValue:function(a){this.iterateDynamicProperties(),this._mdf=a||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,a&&this.data.r===2&&(this.e.v=this._currentTextLength);var l=this.data.r===2?1:100/this.data.totalChars,c=this.o.v/l,u=this.s.v/l+c,m=this.e.v/l+c;if(u>m){var d=u;u=m,m=d}this.finalS=u,this.finalE=m}},extendPrototype([DynamicPropertyContainer],r);function s(o,a,l){return new r(o,a)}return{getTextSelectorProp:s}}();function TextAnimatorDataProperty(t,e,i){var r={propType:!1},s=PropertyFactory.getProp,o=e.a;this.a={r:o.r?s(t,o.r,0,degToRads,i):r,rx:o.rx?s(t,o.rx,0,degToRads,i):r,ry:o.ry?s(t,o.ry,0,degToRads,i):r,sk:o.sk?s(t,o.sk,0,degToRads,i):r,sa:o.sa?s(t,o.sa,0,degToRads,i):r,s:o.s?s(t,o.s,1,.01,i):r,a:o.a?s(t,o.a,1,0,i):r,o:o.o?s(t,o.o,0,.01,i):r,p:o.p?s(t,o.p,1,0,i):r,sw:o.sw?s(t,o.sw,0,0,i):r,sc:o.sc?s(t,o.sc,1,0,i):r,fc:o.fc?s(t,o.fc,1,0,i):r,fh:o.fh?s(t,o.fh,0,0,i):r,fs:o.fs?s(t,o.fs,0,.01,i):r,fb:o.fb?s(t,o.fb,0,.01,i):r,t:o.t?s(t,o.t,0,0,i):r},this.s=TextSelectorProp.getTextSelectorProp(t,e.s,i),this.s.t=e.s.t}function TextAnimatorProperty(t,e,i){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=t,this._renderType=e,this._elem=i,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(i)}TextAnimatorProperty.prototype.searchProperties=function(){var t,e=this._textData.a.length,i,r=PropertyFactory.getProp;for(t=0;t=b+fe||!T?(D=(b+fe-E)/S.partialLength,ne=P.point[0]+(S.point[0]-P.point[0])*D,te=P.point[1]+(S.point[1]-P.point[1])*D,o.translate(-i[0]*g[m].an*.005,-(i[1]*R)*.01),x=!1):T&&(E+=S.partialLength,A+=1,A>=T.length&&(A=0,_+=1,M[_]?T=M[_].points:$.v.c?(A=0,_=0,T=M[_].points):(E-=S.partialLength,T=null)),T&&(P=S,S=T[A],C=S.partialLength));de=g[m].an/2-g[m].add,o.translate(-de,0,0)}else de=g[m].an/2-g[m].add,o.translate(-de,0,0),o.translate(-i[0]*g[m].an*.005,-i[1]*R*.01,0);for(k=0;kt?this.textSpans[t].span:createNS(l?"g":"text"),_<=t){if(c.setAttribute("stroke-linecap","butt"),c.setAttribute("stroke-linejoin","round"),c.setAttribute("stroke-miterlimit","4"),this.textSpans[t].span=c,l){var T=createNS("g");c.appendChild(T),this.textSpans[t].childSpan=T}this.textSpans[t].span=c,this.layerElement.appendChild(c)}c.style.display="inherit"}if(u.reset(),d&&(a[t].n&&(g=-S,y+=i.yOffset,y+=b?1:0,b=!1),this.applyTextPropertiesToMatrix(i,u,a[t].line,g,y),g+=a[t].l||0,g+=S),l){P=this.globalData.fontManager.getCharData(i.finalText[t],r.fStyle,this.globalData.fontManager.getFontByName(i.f).fFamily);var M;if(P.t===1)M=new SVGCompElement(P.data,this.globalData,this);else{var C=emptyShapeData;P.data&&P.data.shapes&&(C=this.buildShapeData(P.data,i.finalSize)),M=new SVGShapeElement(C,this.globalData,this)}if(this.textSpans[t].glyph){var I=this.textSpans[t].glyph;this.textSpans[t].childSpan.removeChild(I.layerElement),I.destroy()}this.textSpans[t].glyph=M,M._debug=!0,M.prepareFrame(0),M.renderFrame(),this.textSpans[t].childSpan.appendChild(M.layerElement),P.t===1&&this.textSpans[t].childSpan.setAttribute("transform","scale("+i.finalSize/100+","+i.finalSize/100+")")}else d&&c.setAttribute("transform","translate("+u.props[12]+","+u.props[13]+")"),c.textContent=a[t].val,c.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}d&&c&&c.setAttribute("d",m)}for(;t=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].prepareFrame(t-this.layers[e].st);if(this.globalData._mdf)for(e=0;e=0;i-=1)(this.completeLayers||this.elements[i])&&(this.elements[i].prepareFrame(this.renderedFrame-this.layers[i].st),this.elements[i]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var t,e=this.layers.length;for(t=0;t=0;r-=1)e.finalTransform.multiply(e.transforms[r].transform.mProps.v);e._mdf=o},processSequences:function(e){var i,r=this.sequenceList.length;for(i=0;i=1){this.buffers=[];var e=this.globalData.canvasContext,i=assetLoader.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(i);var r=assetLoader.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(r),this.data.tt>=3&&!document._isProxy&&assetLoader.loadLumaCanvas()}this.canvasContext=this.globalData.canvasContext,this.transformCanvas=this.globalData.transformCanvas,this.renderableEffectsManager=new CVEffects(this),this.searchEffectTransforms()},createContent:function(){},setBlendMode:function(){var e=this.globalData;if(e.blendMode!==this.data.bm){e.blendMode=this.data.bm;var i=getBlendMode(this.data.bm);e.canvasContext.globalCompositeOperation=i}},createRenderableComponents:function(){this.maskManager=new CVMaskElement(this.data,this),this.transformEffects=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT)},hideElement:function(){!this.hidden&&(!this.isInRange||this.isTransparent)&&(this.hidden=!0)},showElement:function(){this.isInRange&&!this.isTransparent&&(this.hidden=!1,this._isFirstFrame=!0,this.maskManager._isFirstFrame=!0)},clearCanvas:function(e){e.clearRect(this.transformCanvas.tx,this.transformCanvas.ty,this.transformCanvas.w*this.transformCanvas.sx,this.transformCanvas.h*this.transformCanvas.sy)},prepareLayer:function(){if(this.data.tt>=1){var e=this.buffers[0],i=e.getContext("2d");this.clearCanvas(i),i.drawImage(this.canvasContext.canvas,0,0),this.currentTransform=this.canvasContext.getTransform(),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform)}},exitLayer:function(){if(this.data.tt>=1){var e=this.buffers[1],i=e.getContext("2d");this.clearCanvas(i),i.drawImage(this.canvasContext.canvas,0,0),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform);var r=this.comp.getElementById("tp"in this.data?this.data.tp:this.data.ind-1);if(r.renderFrame(!0),this.canvasContext.setTransform(1,0,0,1,0,0),this.data.tt>=3&&!document._isProxy){var s=assetLoader.getLumaCanvas(this.canvasContext.canvas),o=s.getContext("2d");o.drawImage(this.canvasContext.canvas,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.drawImage(s,0,0)}this.canvasContext.globalCompositeOperation=operationsMap[this.data.tt],this.canvasContext.drawImage(e,0,0),this.canvasContext.globalCompositeOperation="destination-over",this.canvasContext.drawImage(this.buffers[0],0,0),this.canvasContext.setTransform(this.currentTransform),this.canvasContext.globalCompositeOperation="source-over"}},renderFrame:function(e){if(!(this.hidden||this.data.hd)&&!(this.data.td===1&&!e)){this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.setBlendMode();var i=this.data.ty===0;this.prepareLayer(),this.globalData.renderer.save(i),this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity),this.renderInnerContent(),this.globalData.renderer.restore(i),this.exitLayer(),this.maskManager.hasMasks&&this.globalData.renderer.restore(!0),this._isFirstFrame&&(this._isFirstFrame=!1)}},destroy:function(){this.canvasContext=null,this.data=null,this.globalData=null,this.maskManager.destroy()},mHelper:new Matrix},CVBaseElement.prototype.hide=CVBaseElement.prototype.hideElement,CVBaseElement.prototype.show=CVBaseElement.prototype.showElement;function CVShapeData(t,e,i,r){this.styledShapes=[],this.tr=[0,0,0,0,0,0];var s=4;e.ty==="rc"?s=5:e.ty==="el"?s=6:e.ty==="sr"&&(s=7),this.sh=ShapePropertyFactory.getShapeProp(t,e,s,t);var o,a=i.length,l;for(o=0;o=0;o-=1){if(d=this.searchProcessedElement(t[o]),d?e[o]=i[d-1]:t[o]._shouldRender=r,t[o].ty==="fl"||t[o].ty==="st"||t[o].ty==="gf"||t[o].ty==="gs")d?e[o].style.closed=!1:e[o]=this.createStyleElement(t[o],b),u.push(e[o].style);else if(t[o].ty==="gr"){if(!d)e[o]=this.createGroupElement(t[o]);else for(c=e[o].it.length,l=0;l=0;s-=1)e[s].ty==="tr"?(a=i[s].transform,this.renderShapeTransform(t,a)):e[s].ty==="sh"||e[s].ty==="el"||e[s].ty==="rc"||e[s].ty==="sr"?this.renderPath(e[s],i[s]):e[s].ty==="fl"?this.renderFill(e[s],i[s],a):e[s].ty==="st"?this.renderStroke(e[s],i[s],a):e[s].ty==="gf"||e[s].ty==="gs"?this.renderGradientFill(e[s],i[s],a):e[s].ty==="gr"?this.renderShape(a,e[s].it,i[s].it):e[s].ty;r&&this.drawLayer()},CVShapeElement.prototype.renderStyledShape=function(t,e){if(this._isFirstFrame||e._mdf||t.transforms._mdf){var i=t.trNodes,r=e.paths,s,o,a,l=r._length;i.length=0;var c=t.transforms.finalTransform;for(a=0;a=1?m=.99:m<=-1&&(m=-.99);var d=c*m,g=Math.cos(u+e.a.v)*d+a[0],y=Math.sin(u+e.a.v)*d+a[1];s=o.createRadialGradient(g,y,0,a[0],a[1],c)}var b,S=t.g.p,E=e.g.c,x=1;for(b=0;bo&&c==="xMidYMid slice"||ss&&l==="meet"||os&&l==="slice")?this.transformCanvas.tx=(i-this.transformCanvas.w*(r/this.transformCanvas.h))/2*this.renderConfig.dpr:u==="xMax"&&(os&&l==="slice")?this.transformCanvas.tx=(i-this.transformCanvas.w*(r/this.transformCanvas.h))*this.renderConfig.dpr:this.transformCanvas.tx=0,m==="YMid"&&(o>s&&l==="meet"||os&&l==="meet"||o=0;t-=1)this.elements[t]&&this.elements[t].destroy&&this.elements[t].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(t,e){if(!(this.renderedFrame===t&&this.renderConfig.clearCanvas===!0&&!e||this.destroyed||t===-1)){this.renderedFrame=t,this.globalData.frameNum=t-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=t;var i,r=this.layers.length;for(this.completeLayers||this.checkLayers(t),i=r-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&this.elements[i].prepareFrame(t-this.layers[i].st);if(this.globalData._mdf){for(this.renderConfig.clearCanvas===!0?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),i=r-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&this.elements[i].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(t){var e=this.elements;if(!(e[t]||this.layers[t].ty===99)){var i=this.createItem(this.layers[t],this,this.globalData);e[t]=i,i.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var t=this.pendingElements.pop();t.checkParenting()}},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"};function CanvasContext(){this.opacity=-1,this.transform=createTypedArray("float32",16),this.fillStyle="",this.strokeStyle="",this.lineWidth="",this.lineCap="",this.lineJoin="",this.miterLimit="",this.id=Math.random()}function CVContextData(){this.stack=[],this.cArrPos=0,this.cTr=new Matrix;var t,e=15;for(t=0;t=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].renderFrame()},CVCompElement.prototype.destroy=function(){var t,e=this.layers.length;for(t=e-1;t>=0;t-=1)this.elements[t]&&this.elements[t].destroy();this.layers=null,this.elements=null},CVCompElement.prototype.createComp=function(t){return new CVCompElement(t,this.globalData,this)};function CanvasRenderer(t,e){this.animationItem=t,this.renderConfig={clearCanvas:e&&e.clearCanvas!==void 0?e.clearCanvas:!0,context:e&&e.context||null,progressiveLoad:e&&e.progressiveLoad||!1,preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",className:e&&e.className||"",id:e&&e.id||"",runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.renderConfig.dpr=e&&e.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=e&&e.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new CVContextData,this.elements=[],this.pendingElements=[],this.transformMat=new Matrix,this.completeLayers=!1,this.rendererType="canvas",this.renderConfig.clearCanvas&&(this.ctxTransform=this.contextData.transform.bind(this.contextData),this.ctxOpacity=this.contextData.opacity.bind(this.contextData),this.ctxFillStyle=this.contextData.fillStyle.bind(this.contextData),this.ctxStrokeStyle=this.contextData.strokeStyle.bind(this.contextData),this.ctxLineWidth=this.contextData.lineWidth.bind(this.contextData),this.ctxLineCap=this.contextData.lineCap.bind(this.contextData),this.ctxLineJoin=this.contextData.lineJoin.bind(this.contextData),this.ctxMiterLimit=this.contextData.miterLimit.bind(this.contextData),this.ctxFill=this.contextData.fill.bind(this.contextData),this.ctxFillRect=this.contextData.fillRect.bind(this.contextData),this.ctxStroke=this.contextData.stroke.bind(this.contextData),this.save=this.contextData.save.bind(this.contextData))}extendPrototype([CanvasRendererBase],CanvasRenderer),CanvasRenderer.prototype.createComp=function(t){return new CVCompElement(t,this.globalData,this)};function HBaseElement(){}HBaseElement.prototype={checkBlendMode:function(){},initRendererElement:function(){this.baseElement=createTag(this.data.tg||"div"),this.data.hasMask?(this.svgElement=createNS("svg"),this.layerElement=createNS("g"),this.maskedElement=this.layerElement,this.svgElement.appendChild(this.layerElement),this.baseElement.appendChild(this.svgElement)):this.layerElement=this.baseElement,styleDiv(this.baseElement)},createContainerElements:function(){this.renderableEffectsManager=new CVEffects(this),this.transformedElement=this.baseElement,this.maskedElement=this.layerElement,this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.bm!==0&&this.setBlendMode()},renderElement:function(){var e=this.transformedElement?this.transformedElement.style:{};if(this.finalTransform._matMdf){var i=this.finalTransform.mat.toCSS();e.transform=i,e.webkitTransform=i}this.finalTransform._opMdf&&(e.opacity=this.finalTransform.mProp.o.v)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},destroy:function(){this.layerElement=null,this.transformedElement=null,this.matteElement&&(this.matteElement=null),this.maskManager&&(this.maskManager.destroy(),this.maskManager=null)},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData)},addEffects:function(){},setMatte:function(){}},HBaseElement.prototype.getBaseElement=SVGBaseElement.prototype.getBaseElement,HBaseElement.prototype.destroyBaseElement=HBaseElement.prototype.destroy,HBaseElement.prototype.buildElementParenting=BaseRenderer.prototype.buildElementParenting;function HSolidElement(t,e,i){this.initElement(t,e,i)}extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],HSolidElement),HSolidElement.prototype.createContent=function(){var t;this.data.hasMask?(t=createNS("rect"),t.setAttribute("width",this.data.sw),t.setAttribute("height",this.data.sh),t.setAttribute("fill",this.data.sc),this.svgElement.setAttribute("width",this.data.sw),this.svgElement.setAttribute("height",this.data.sh)):(t=createTag("div"),t.style.width=this.data.sw+"px",t.style.height=this.data.sh+"px",t.style.backgroundColor=this.data.sc),this.layerElement.appendChild(t)};function HShapeElement(t,e,i){this.shapes=[],this.shapesData=t.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.shapesContainer=createNS("g"),this.initElement(t,e,i),this.prevViewData=[],this.currentBBox={x:999999,y:-999999,h:0,w:0}}extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement],HShapeElement),HShapeElement.prototype._renderShapeFrame=HShapeElement.prototype.renderInnerContent,HShapeElement.prototype.createContent=function(){var t;if(this.baseElement.style.fontSize=0,this.data.hasMask)this.layerElement.appendChild(this.shapesContainer),t=this.svgElement;else{t=createNS("svg");var e=this.comp.data?this.comp.data:this.globalData.compSize;t.setAttribute("width",e.w),t.setAttribute("height",e.h),t.appendChild(this.shapesContainer),this.layerElement.appendChild(t)}this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0,[],!0),this.filterUniqueShapes(),this.shapeCont=t},HShapeElement.prototype.getTransformedPoint=function(t,e){var i,r=t.length;for(i=0;i0&&c<1&&s[g].push(this.calculateF(c,t,e,i,r,g))):(u=a*a-4*l*o,u>=0&&(m=(-a+bmSqrt(u))/(2*o),m>0&&m<1&&s[g].push(this.calculateF(m,t,e,i,r,g)),d=(-a-bmSqrt(u))/(2*o),d>0&&d<1&&s[g].push(this.calculateF(d,t,e,i,r,g)))));this.shapeBoundingBox.left=bmMin.apply(null,s[0]),this.shapeBoundingBox.top=bmMin.apply(null,s[1]),this.shapeBoundingBox.right=bmMax.apply(null,s[0]),this.shapeBoundingBox.bottom=bmMax.apply(null,s[1])},HShapeElement.prototype.calculateF=function(t,e,i,r,s,o){return bmPow(1-t,3)*e[o]+3*bmPow(1-t,2)*t*i[o]+3*(1-t)*bmPow(t,2)*r[o]+bmPow(t,3)*s[o]},HShapeElement.prototype.calculateBoundingBox=function(t,e){var i,r=t.length;for(i=0;ii&&(i=s)}i*=t.mult}else i=t.v*t.mult;e.x-=i,e.xMax+=i,e.y-=i,e.yMax+=i},HShapeElement.prototype.currentBoxContains=function(t){return this.currentBBox.x<=t.x&&this.currentBBox.y<=t.y&&this.currentBBox.width+this.currentBBox.x>=t.x+t.width&&this.currentBBox.height+this.currentBBox.y>=t.y+t.height},HShapeElement.prototype.renderInnerContent=function(){if(this._renderShapeFrame(),!this.hidden&&(this._isFirstFrame||this._mdf)){var t=this.tempBoundingBox,e=999999;if(t.x=e,t.xMax=-e,t.y=e,t.yMax=-e,this.calculateBoundingBox(this.itemsData,t),t.width=t.xMax=0;e-=1){var r=this.hierarchy[e].finalTransform.mProp;this.mat.translate(-r.p.v[0],-r.p.v[1],r.p.v[2]),this.mat.rotateX(-r.or.v[0]).rotateY(-r.or.v[1]).rotateZ(r.or.v[2]),this.mat.rotateX(-r.rx.v).rotateY(-r.ry.v).rotateZ(r.rz.v),this.mat.scale(1/r.s.v[0],1/r.s.v[1],1/r.s.v[2]),this.mat.translate(r.a.v[0],r.a.v[1],r.a.v[2])}if(this.p?this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]):this.mat.translate(-this.px.v,-this.py.v,this.pz.v),this.a){var s;this.p?s=[this.p.v[0]-this.a.v[0],this.p.v[1]-this.a.v[1],this.p.v[2]-this.a.v[2]]:s=[this.px.v-this.a.v[0],this.py.v-this.a.v[1],this.pz.v-this.a.v[2]];var o=Math.sqrt(Math.pow(s[0],2)+Math.pow(s[1],2)+Math.pow(s[2],2)),a=[s[0]/o,s[1]/o,s[2]/o],l=Math.sqrt(a[2]*a[2]+a[0]*a[0]),c=Math.atan2(a[1],l),u=Math.atan2(a[0],-a[2]);this.mat.rotateY(u).rotateX(-c)}this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v),this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]),this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0),this.mat.translate(0,0,this.pe.v);var m=!this._prevMat.equals(this.mat);if((m||this.pe._mdf)&&this.comp.threeDElements){i=this.comp.threeDElements.length;var d,g,y;for(e=0;e=t)return this.threeDElements[e].perspectiveElem;e+=1}return null},HybridRendererBase.prototype.createThreeDContainer=function(t,e){var i=createTag("div"),r,s;styleDiv(i);var o=createTag("div");if(styleDiv(o),e==="3d"){r=i.style,r.width=this.globalData.compSize.w+"px",r.height=this.globalData.compSize.h+"px";var a="50% 50%";r.webkitTransformOrigin=a,r.mozTransformOrigin=a,r.transformOrigin=a,s=o.style;var l="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";s.transform=l,s.webkitTransform=l}i.appendChild(o);var c={container:o,perspectiveElem:i,startPos:t,endPos:t,type:e};return this.threeDElements.push(c),c},HybridRendererBase.prototype.build3dContainers=function(){var t,e=this.layers.length,i,r="";for(t=0;t=0;t-=1)this.resizerElem.appendChild(this.threeDElements[t].perspectiveElem)},HybridRendererBase.prototype.addTo3dContainer=function(t,e){for(var i=0,r=this.threeDElements.length;ii?(s=t/this.globalData.compSize.w,o=t/this.globalData.compSize.w,a=0,l=(e-this.globalData.compSize.h*(t/this.globalData.compSize.w))/2):(s=e/this.globalData.compSize.h,o=e/this.globalData.compSize.h,a=(t-this.globalData.compSize.w*(e/this.globalData.compSize.h))/2,l=0);var c=this.resizerElem.style;c.webkitTransform="matrix3d("+s+",0,0,0,0,"+o+",0,0,0,0,1,0,"+a+","+l+",0,1)",c.transform=c.webkitTransform},HybridRendererBase.prototype.renderFrame=SVGRenderer.prototype.renderFrame,HybridRendererBase.prototype.hide=function(){this.resizerElem.style.display="none"},HybridRendererBase.prototype.show=function(){this.resizerElem.style.display="block"},HybridRendererBase.prototype.initItems=function(){if(this.buildAllItems(),this.camera)this.camera.setup();else{var t=this.globalData.compSize.w,e=this.globalData.compSize.h,i,r=this.threeDElements.length;for(i=0;i=u;)$/=2,N/=2,z>>>=1;return($+z)/N};return D.int32=function(){return I.g(4)|0},D.quick=function(){return I.g(4)/4294967296},D.double=D,E(A(I.S),t),(P.pass||T||function(G,$,N,z){return z&&(z.S&&b(z,I),G.state=function(){return b(I,{})}),N?(e[a]=G,$):G})(D,C,"global"in P?P.global:this==e,P.state)}e["seed"+a]=g;function y(_){var P,T=_.length,M=this,C=0,I=M.i=M.j=0,D=M.S=[];for(T||(_=[T++]);Ci){var r=i;i=e,e=r}return Math.min(Math.max(t,e),i)}function radiansToDegrees(t){return t/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(t){return t*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(t,e){if(typeof t=="number"||t instanceof Number)return e=e||0,Math.abs(t-e);e||(e=helperLengthArray);var i,r=Math.min(t.length,e.length),s=0;for(i=0;i.5?u/(2-s-o):u/(s+o),s){case e:a=(i-r)/u+(i1&&(i-=1),i<1/6?t+(e-t)*6*i:i<1/2?e:i<2/3?t+(e-t)*(2/3-i)*6:t}function hslToRgb(t){var e=t[0],i=t[1],r=t[2],s,o,a;if(i===0)s=r,a=r,o=r;else{var l=r<.5?r*(1+i):r+i-r*i,c=2*r-l;s=hue2rgb(c,l,e+1/3),o=hue2rgb(c,l,e),a=hue2rgb(c,l,e-1/3)}return[s,o,a,t[3]]}function linear(t,e,i,r,s){if((r===void 0||s===void 0)&&(r=e,s=i,e=0,i=1),i=i)return s;var a=i===e?0:(t-e)/(i-e);if(!r.length)return r+(s-r)*a;var l,c=r.length,u=createTypedArray("float32",c);for(l=0;l1){for(s=0;s1?e=1:e<0&&(e=0);var a=t(e);if($bm_isInstanceOfArray(s)){var l,c=s.length,u=createTypedArray("float32",c);for(l=0;ldata.k[e].t&&tdata.k[e+1].t-t?(r=e+2,s=data.k[e+1].t):(r=e+1,s=data.k[e].t);break}r===-1&&(r=e+1,s=data.k[e].t)}var o={};return o.index=r,o.time=s/elem.comp.globalData.frameRate,o}function key(t){var e,i,r;if(!data.k.length||typeof data.k[0]=="number")throw new Error("The property has no keyframe at index "+t);t-=1,e={time:data.k[t].t/elem.comp.globalData.frameRate,value:[]};var s=Object.prototype.hasOwnProperty.call(data.k[t],"s")?data.k[t].s:data.k[t-1].e;for(r=s.length,i=0;iE.length-1)&&(y=E.length-1),_=E[E.length-1-y].t,A=x-_);var P,T,M;if(g==="pingpong"){var C=Math.floor((S-_)/A);if(C%2!==0)return this.getValueAtTime((A-(S-_)%A+_)/this.comp.globalData.frameRate,0)}else if(g==="offset"){var I=this.getValueAtTime(_/this.comp.globalData.frameRate,0),D=this.getValueAtTime(x/this.comp.globalData.frameRate,0),G=this.getValueAtTime(((S-_)%A+_)/this.comp.globalData.frameRate,0),$=Math.floor((S-_)/A);if(this.pv.length){for(M=new Array(I.length),T=M.length,P=0;P=x)return this.pv;var A,_;b?(y?A=Math.abs(this.elem.comp.globalData.frameRate*y):A=Math.max(0,this.elem.data.op-x),_=x+A):((!y||y>E.length-1)&&(y=E.length-1),_=E[y].t,A=_-x);var P,T,M;if(g==="pingpong"){var C=Math.floor((x-S)/A);if(C%2===0)return this.getValueAtTime(((x-S)%A+x)/this.comp.globalData.frameRate,0)}else if(g==="offset"){var I=this.getValueAtTime(x/this.comp.globalData.frameRate,0),D=this.getValueAtTime(_/this.comp.globalData.frameRate,0),G=this.getValueAtTime((A-(x-S)%A+x)/this.comp.globalData.frameRate,0),$=Math.floor((x-S)/A)+1;if(this.pv.length){for(M=new Array(I.length),T=M.length,P=0;P1?(E-S)/(y-1):1,A=0,_=0,P;this.pv.length?P=createTypedArray("float32",this.pv.length):P=0;for(var T;AA){var C=_,I=S.c&&_===P-1?0:_+1,D=(A-T)/x[_].addedLength;M=bez.getPointInSegment(S.v[C],S.v[I],S.o[C],S.i[I],D,x[_]);break}else T+=x[_].addedLength;_+=1}return M||(M=S.c?[S.v[0][0],S.v[0][1]]:[S.v[S._length-1][0],S.v[S._length-1][1]]),M},vectorOnPath:function(y,b,S){y==1?y=this.v.c:y==0&&(y=.999);var E=this.pointOnPath(y,b),x=this.pointOnPath(y+.001,b),A=x[0]-E[0],_=x[1]-E[1],P=Math.sqrt(Math.pow(A,2)+Math.pow(_,2));if(P===0)return[0,0];var T=S==="tangent"?[A/P,_/P]:[-_/P,A/P];return T},tangentOnPath:function(y,b){return this.vectorOnPath(y,b,"tangent")},normalOnPath:function(y,b){return this.vectorOnPath(y,b,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([m],c),extendPrototype([m],u),u.prototype.getValueAtTime=l,u.prototype.initiateExpression=ExpressionManager.initiateExpression;var d=ShapePropertyFactory.getShapeProp;ShapePropertyFactory.getShapeProp=function(g,y,b,S,E){var x=d(g,y,b,S,E);return x.propertyIndex=y.ix,x.lock=!1,b===3?expressionHelpers.searchExpressions(g,y.pt,x):b===4&&expressionHelpers.searchExpressions(g,y.ks,x),x.k&&g.addDynamicProperty(x),x}}function initialize$1(){addPropertyDecorator()}function addDecorator(){function t(){return this.data.d.x?(this.calculateExpression=ExpressionManager.initiateExpression.bind(this)(this.elem,this.data.d,this),this.addEffect(this.getExpressionValue.bind(this)),!0):null}TextProperty.prototype.getExpressionValue=function(e,i){var r=this.calculateExpression(i);if(e.t!==r){var s={};return this.copyData(s,e),s.t=r.toString(),s.__complete=!1,s}return e},TextProperty.prototype.searchProperty=function(){var e=this.searchKeyframes(),i=this.searchExpressions();return this.kf=e||i,this.kf},TextProperty.prototype.searchExpressions=t}function initialize(){addDecorator()}function SVGComposableEffect(){}SVGComposableEffect.prototype={createMergeNode:function t(e,i){var r=createNS("feMerge");r.setAttribute("result",e);var s,o;for(o=0;o=u?d=b<0?r:s:d=r+y*Math.pow((l-t)/b,1/i),m[g]=d,g+=1,o+=256/(a-1);return m.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){var e,i=this.filterManager.effectElements;this.feFuncRComposed&&(t||i[3].p._mdf||i[4].p._mdf||i[5].p._mdf||i[6].p._mdf||i[7].p._mdf)&&(e=this.getTableValue(i[3].p.v,i[4].p.v,i[5].p.v,i[6].p.v,i[7].p.v),this.feFuncRComposed.setAttribute("tableValues",e),this.feFuncGComposed.setAttribute("tableValues",e),this.feFuncBComposed.setAttribute("tableValues",e)),this.feFuncR&&(t||i[10].p._mdf||i[11].p._mdf||i[12].p._mdf||i[13].p._mdf||i[14].p._mdf)&&(e=this.getTableValue(i[10].p.v,i[11].p.v,i[12].p.v,i[13].p.v,i[14].p.v),this.feFuncR.setAttribute("tableValues",e)),this.feFuncG&&(t||i[17].p._mdf||i[18].p._mdf||i[19].p._mdf||i[20].p._mdf||i[21].p._mdf)&&(e=this.getTableValue(i[17].p.v,i[18].p.v,i[19].p.v,i[20].p.v,i[21].p.v),this.feFuncG.setAttribute("tableValues",e)),this.feFuncB&&(t||i[24].p._mdf||i[25].p._mdf||i[26].p._mdf||i[27].p._mdf||i[28].p._mdf)&&(e=this.getTableValue(i[24].p.v,i[25].p.v,i[26].p.v,i[27].p.v,i[28].p.v),this.feFuncB.setAttribute("tableValues",e)),this.feFuncA&&(t||i[31].p._mdf||i[32].p._mdf||i[33].p._mdf||i[34].p._mdf||i[35].p._mdf)&&(e=this.getTableValue(i[31].p.v,i[32].p.v,i[33].p.v,i[34].p.v,i[35].p.v),this.feFuncA.setAttribute("tableValues",e))}};function SVGDropShadowEffect(t,e,i,r,s){var o=e.container.globalData.renderConfig.filterSize,a=e.data.fs||o;t.setAttribute("x",a.x||o.x),t.setAttribute("y",a.y||o.y),t.setAttribute("width",a.width||o.width),t.setAttribute("height",a.height||o.height),this.filterManager=e;var l=createNS("feGaussianBlur");l.setAttribute("in","SourceAlpha"),l.setAttribute("result",r+"_drop_shadow_1"),l.setAttribute("stdDeviation","0"),this.feGaussianBlur=l,t.appendChild(l);var c=createNS("feOffset");c.setAttribute("dx","25"),c.setAttribute("dy","0"),c.setAttribute("in",r+"_drop_shadow_1"),c.setAttribute("result",r+"_drop_shadow_2"),this.feOffset=c,t.appendChild(c);var u=createNS("feFlood");u.setAttribute("flood-color","#00ff00"),u.setAttribute("flood-opacity","1"),u.setAttribute("result",r+"_drop_shadow_3"),this.feFlood=u,t.appendChild(u);var m=createNS("feComposite");m.setAttribute("in",r+"_drop_shadow_3"),m.setAttribute("in2",r+"_drop_shadow_2"),m.setAttribute("operator","in"),m.setAttribute("result",r+"_drop_shadow_4"),t.appendChild(m);var d=this.createMergeNode(r,[r+"_drop_shadow_4",s]);t.appendChild(d)}extendPrototype([SVGComposableEffect],SVGDropShadowEffect),SVGDropShadowEffect.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){if((t||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),t||this.filterManager.effectElements[0].p._mdf){var e=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(e[0]*255),Math.round(e[1]*255),Math.round(e[2]*255)))}if((t||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),t||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var i=this.filterManager.effectElements[3].p.v,r=(this.filterManager.effectElements[2].p.v-90)*degToRads,s=i*Math.cos(r),o=i*Math.sin(r);this.feOffset.setAttribute("dx",s),this.feOffset.setAttribute("dy",o)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(t,e,i){this.initialized=!1,this.filterManager=e,this.filterElem=t,this.elem=i,i.matteElement=createNS("g"),i.matteElement.appendChild(i.layerElement),i.matteElement.appendChild(i.transformedElement),i.baseElement=i.matteElement}SVGMatte3Effect.prototype.findSymbol=function(t){for(var e=0,i=_svgMatteSymbols.length;e-1&&t%1==0&&t-1&&t%1==0&&t<=MAX_SAFE_INTEGER}function isArrayLike(t){return t!=null&&isLength(t.length)&&!isFunction$1(t)}var objectProto$a=Object.prototype;function isPrototype(t){var e=t&&t.constructor,i=typeof e=="function"&&e.prototype||objectProto$a;return t===i}function baseTimes(t,e){for(var i=-1,r=Array(t);++i-1}function listCacheSet(t,e){var i=this.__data__,r=assocIndexOf(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this}function ListCache(t){var e=-1,i=t==null?0:t.length;for(this.clear();++el))return!1;var u=o.get(t),m=o.get(e);if(u&&m)return u==e&&m==t;var d=-1,g=!0,y=i&COMPARE_UNORDERED_FLAG$1?new SetCache:void 0;for(o.set(t,e),o.set(e,t);++d{const i=t.__vccOpts||t;for(const[r,s]of e)i[r]=s;return i};const _sfc_main=defineComponent({props:{animationData:{type:Object,default:()=>({})},animationLink:{type:String,default:""},loop:{type:[Boolean,Number],default:!0},autoPlay:{type:Boolean,default:!0},width:{type:[Number,String],default:"100%"},height:{type:[Number,String],default:"100%"},speed:{type:Number,default:1},delay:{type:Number,default:0},direction:{type:String,default:"forward"},pauseOnHover:{type:Boolean,default:!1},playOnHover:{type:Boolean,default:!1},backgroundColor:{type:String,default:"transparent"},pauseAnimation:{type:Boolean,default:!1},renderer:{type:String,default:"svg"},rendererSettings:{type:Object,default:()=>({})},assetsPath:{type:String,default:""}},emits:{onComplete:null,onLoopComplete:null,onEnterFrame:null,onSegmentStart:null,onAnimationLoaded:null},setup(t,{emit:e}){let i=ref(null);const r=ref("");let s=1;const o=I=>document.querySelector(`[data-id="${I}"]`)!==null,a=async I=>{let D=t.autoPlay;t.playOnHover&&(D=!1);let G={};if(isEqual(t.animationData,{})===!1&&(G=cloneDeep(t.animationData)),t.animationLink!="")try{G=await(await fetch(t.animationLink)).json()}catch(z){console.error(z);return}let $=t.loop;typeof $=="number"&&$>0&&($=$-1),t.delay>0&&(D=!1);const N={container:I,renderer:t.renderer,loop:$,autoplay:D,animationData:G,assetsPath:t.assetsPath};isEqual(t.rendererSettings,{})===!1&&(N.rendererSettings=t.rendererSettings),i=Lottie.loadAnimation(N),setTimeout(()=>{D=t.autoPlay,t.playOnHover?i.pause():D?i.play():i.pause(),e("onAnimationLoaded")},t.delay),i.setSpeed(t.speed),t.direction==="reverse"&&i.setDirection(-1),t.direction==="normal"&&i.setDirection(1),(t.pauseAnimation||t.playOnHover)&&i.pause(),i.addEventListener("loopComplete",()=>{t.direction==="alternate"&&(i.stop(),s=s*-1,i.setDirection(s),i.play()),e("onLoopComplete")}),i.addEventListener("complete",()=>{e("onComplete")}),i.addEventListener("enterFrame",()=>{e("onEnterFrame")}),i.addEventListener("segmentStart",()=>{e("onSegmentStart")})},l=computed(()=>{let I=t.width,D=t.height;return typeof t.width=="number"&&(I=`${t.width}px`),typeof t.height=="number"&&(D=`${t.height}px`),{"--lottie-animation-container-width":I,"--lottie-animation-container-height":D,"--lottie-animation-container-background-color":t.backgroundColor}}),c=()=>{i&&t.pauseOnHover&&i.pause(),i&&t.playOnHover&&i.play()},u=()=>{i&&t.pauseOnHover&&i.play(),i&&t.playOnHover&&i.pause()};watch(()=>t.pauseAnimation,()=>{if((t.pauseOnHover||t.playOnHover)&&t.pauseAnimation){console.error("If you are using pauseAnimation prop for Vue3-Lottie, please remove the props pauseOnHover and playOnHover");return}i&&(t.pauseAnimation?i.pause():i.play())});const m=()=>{i&&i.play()},d=()=>{i&&i.pause()},g=()=>{i&&i.stop()},y=()=>{i&&i.destroy()},b=(I=1)=>{if(I<=0)throw new Error("Speed must be greater than 0");i&&i.setSpeed(I)},S=I=>{i&&(I==="forward"?i.setDirection(1):I==="reverse"&&i.setDirection(-1))},E=(I,D=!0)=>{i&&i.goToAndStop(I,D)},x=(I,D=!0)=>{i&&i.goToAndPlay(I,D)},A=(I,D=!1)=>{i&&i.playSegments(I,D)},_=(I=!0)=>{i&&i.setSubframe(I)},P=(I=!0)=>{if(i)return i.getDuration(I)},T=(I,D=0)=>{i&&i.renderer.elements[D].updateDocumentData(I)},M=I=>{for(var D="",G="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",$=G.length,N=0;N{if(t.pauseOnHover&&t.playOnHover)throw new Error("You cannot set pauseOnHover and playOnHover for Vue3-Lottie at the same time.");if(t.animationLink===""&&isEqual(t.animationData,{}))throw new Error("You must provide either animationLink or animationData");const D=setInterval(()=>{if(o(I)){clearInterval(D);const G=document.querySelector(`[data-id="${I}" ]`);G&&a(G)}},0)};return onMounted(async()=>{r.value=M(20),C(r.value)}),{elementid:r,hoverEnded:u,hoverStarted:c,getCurrentStyle:l,play:m,pause:d,stop:g,destroy:y,setSpeed:b,setDirection:S,goToAndStop:E,goToAndPlay:x,playSegments:A,setSubFrame:_,getDuration:P,updateDocumentData:T}}}),_hoisted_1=["data-id"];function _sfc_render(t,e,i,r,s,o){return openBlock(),createElementBlock("div",{"data-id":t.elementid,class:"lottie-animation-container",style:normalizeStyle(t.getCurrentStyle),onMouseenter:e[0]||(e[0]=(...a)=>t.hoverStarted&&t.hoverStarted(...a)),onMouseleave:e[1]||(e[1]=(...a)=>t.hoverEnded&&t.hoverEnded(...a))},null,44,_hoisted_1)}var Vue3Lottie=_export_sfc(_sfc_main,[["render",_sfc_render]]);const v="5.7.1",fr=25,ip=0,op=50,w=120,h=120,nm="转动",ddd=0,assets=[],layers=[{ddd:0,ind:1,ty:4,nm:"转动",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[60,60,0],ix:2},a:{a:0,k:[-16,-36,0],ix:1},s:{a:0,k:[23.737,23.737,100],ix:6}},ao:0,shapes:[{ty:"gr",it:[{d:1,ty:"el",s:{a:0,k:[447.14,447.14],ix:2},p:{a:0,k:[0,0],ix:3},nm:"椭圆路径 1",mn:"ADBE Vector Shape - Ellipse",hd:!1},{ty:"st",c:{a:0,k:[.125490196078,.741176470588,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:46,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"描边 1",mn:"ADBE Vector Graphic - Stroke",hd:!1},{ty:"tr",p:{a:0,k:[-16,-36],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"变换"}],nm:"椭圆 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1},{ty:"tm",s:{a:0,k:0,ix:1},e:{a:1,k:[{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:0,s:[0],e:[50]},{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:25,s:[50],e:[0]},{t:50}],ix:2},o:{a:1,k:[{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:0,s:[0],e:[720]},{t:50}],ix:3},m:1,ix:2,nm:"修剪路径 1",mn:"ADBE Vector Filter - Trim",hd:!1}],ip:0,op:50,st:0,bm:0},{ddd:0,ind:2,ty:4,nm:"底",sr:1,ks:{o:{a:0,k:30,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[60,60,0],ix:2},a:{a:0,k:[-16,-36,0],ix:1},s:{a:0,k:[23.737,23.737,100],ix:6}},ao:0,shapes:[{ty:"gr",it:[{d:1,ty:"el",s:{a:0,k:[447.14,447.14],ix:2},p:{a:0,k:[0,0],ix:3},nm:"椭圆路径 1",mn:"ADBE Vector Shape - Ellipse",hd:!1},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:46,ix:5},lc:1,lj:1,ml:4,bm:0,nm:"描边 1",mn:"ADBE Vector Graphic - Stroke",hd:!1},{ty:"tr",p:{a:0,k:[-16,-36],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"变换"}],nm:"椭圆 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:!1}],ip:0,op:50,st:0,bm:0}],markers=[],loading={v,fr,ip,op,w,h,nm,ddd,assets,layers,markers},AbnormalPop=defineComponent({name:"abnormal-pop",props:{},emits:["close","confirm"],setup(t,{emit:e}){return()=>createVNode(Fragment,null,[evaluatingData.socketErrorStatus===0&&createVNode("div",{class:styles$3.fraction},[createVNode("img",{class:styles$3.close,src:popImgs.icon_close,onClick:()=>e("close")},null),createVNode("img",{class:styles$3.bg,src:popImgs.icon_bg},null),createVNode("div",{class:styles$3.content},[createVNode("div",{class:styles$3.title},[createTextVNode("您的网络连接异常")]),createVNode("div",{class:styles$3.desc},[createTextVNode("请确保网络正常后重新连接")])]),createVNode("div",null,[createVNode("img",{src:popImgs.icon_btn,class:styles$3.btn,onClick:()=>e("confirm",!0)},null)])]),evaluatingData.socketErrorStatus===1&&createVNode("div",{class:styles$3.loadColumn},[createVNode(Vue3Lottie,{class:styles$3.loadIcon,animationData:loading,loop:!0},null),createVNode("img",{class:styles$3.close,src:popImgs.icon_close,onClick:()=>e("close")},null),createVNode("p",null,[createTextVNode("正在连接服务器,请稍后…")])]),evaluatingData.socketErrorStatus===2&&createVNode("div",{class:styles$3.loadColumn},[createVNode("img",{class:styles$3.successIcon,src:popImgs.icon_success},null),createVNode("p",null,[createTextVNode("连接成功")])])])}}),icon_bg=""+new URL("icon_bg-026faf73.svg",import.meta.url).href,icon_close=""+new URL("icon_close-0f82fcc9.svg",import.meta.url).href,icon_btn=""+new URL("icon_btn-f3b09ea8.svg",import.meta.url).href,icon_success=""+new URL("icon_success-6e9ec0d6.svg",import.meta.url).href,browserInfo$1=browser();let socketStartTime=0;const popImgs={icon_bg,icon_close,icon_btn,icon_success},evaluatingData=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,isDisabledPlayMusic:!1,socketErrorPop:!1,errorContents:"",socketErrorStatus:0,delayCheckSocketError:!1,isErrorState:!1,accompanyErrorType:"",isAudioPlayEnd:!1}),sendOffsetTime=async t=>{var i;const e=await api_getDeviceDelay();api_midiMicDelay({header:{commond:"audioPlayStart",type:"SOUND_COMPARE"},body:{offsetTime:t,micDelay:(i=e==null?void 0:e.content)==null?void 0:i.value}})},handleStartEvaluat=async()=>{var t;if(state$1.modeType==="evaluating")handleCancelEvaluat();else if(state$1.platform!=="PC"){const e=await api_checkSocketStatus();((t=e==null?void 0:e.content)==null?void 0:t.status)==="connected"&&handleStopPlay()}else handleStopPlay();state$1.modeType=state$1.modeType==="evaluating"?"practise":"evaluating",state$1.modeType!=="evaluating"&&(evaluatingData.rendered=!1)},startCheckDelay=async()=>{var e;const t=await api_checkSocketStatus();return((e=t==null?void 0:t.content)==null?void 0:e.status)==="connected"?new Promise(i=>{i({checked:!0})}):(socketStartTime=+new Date,evaluatingData.socketErrorPop=!0,evaluatingData.socketErrorStatus=1,new Promise(i=>{i({checked:!1})}))},check_currentTime=()=>{let t=0;if(state$1.isSelectMeasureMode&&(t=state$1.section[0].time*1e3),getAudioCurrentTime()*1e3-t>=500){sendEvaluatingOffsetTime(500);return}setTimeout(()=>{check_currentTime()},10)},sendEvaluatingOffsetTime=async t=>{if(!evaluatingData.backtime)return;const i=Date.now()-evaluatingData.backtime-t;console.error("真正播放延迟",i,"currentTime:",t),await api_proxyServiceMessage({header:{commond:"audioPlayStart",type:"SOUND_COMPARE"},body:{offsetTime:i<0?0:i,micDelay:0}})},checkUseEarphone=async()=>{var e;const t=await getEarphone();return((e=t==null?void 0:t.content)==null?void 0:e.checkIsWired)||!1},handleEndSoundCheck=()=>{endSoundCheck()},connectWebsocket=async t=>{evaluatingData.contentData=t,evaluatingData.websocketState=!0},handlePerformDetection=async()=>{if(!evaluatingData.checkEnd){if(evaluatingData.checkStep===0){if(evaluatingData.checkStep=5,state$1.setting.soundEffect){evaluatingData.soundEffectMode=!0;return}const t=await api_getDeviceDelay();if(console.log("🚀 ~ delayTime:",t),!t){evaluatingData.soundEffectMode=!0;return}handlePerformDetection();return}if(evaluatingData.checkStep=5){if(evaluatingData.checkStep=10,!await checkUseEarphone()){evaluatingData.earphoneMode=!0;return}handlePerformDetection();return}evaluatingData.checkStep===10&&(evaluatingData.checkEnd=!0)}},addMeasureScore=(t,e=!0)=>{for(let i in evaluatingData.evaluatings)evaluatingData.evaluatings[i].show=!1;evaluatingData.evaluatings[t.measureRenderIndex]={...t,leve:getLeveByScoreMeasure(t.score),show:e}},handleScoreResult=t=>{if(console.log("返回",t),t!=null&&t.content){const{header:e,body:i}=t.content;e.commond==="checking"&&(evaluatingData.soundEffectFrequency=i.frequency),(e==null?void 0:e.commond)==="measureScore"&&(console.log("🚀 ~ 评测返回:",t),addMeasureScore(i)),(e==null?void 0:e.commond)==="overall"&&(console.log("🚀 ~ 评测返回:",t),state$1.isHideEvaluatReportSaveBtn=!1,setTimeout(()=>{evaluatingData.resulstMode=!evaluatingData.isErrorState},200),evaluatingData.resultData={...i,...getLeveByScore(i.score)},closeToast())}},handleStartBegin=async t=>{var i,r;state$1.isAppPlay&&await api_cloudSetCurrentTime({currentTime:0,songID:state$1.examSongId}),evaluatingData.isComplete=!1,evaluatingData.evaluatings={},evaluatingData.resultData={},evaluatingData.backtime=0,resetPlaybackToStart(),evaluatingData.isAudioPlayEnd=!1;const e=await startEvaluating(evaluatingData.contentData);if((e==null?void 0:e.api)!=="startEvaluating"){Snackbar$1.error("请在APP端进行评测"),evaluatingData.startBegin=!1;return}if((i=e==null?void 0:e.content)!=null&&i.reson){showToast((r=e.content)==null?void 0:r.des),evaluatingData.startBegin=!1;return}if(evaluatingData.startBegin=!0,evaluatingData.isDisabledPlayMusic){if(state$1.playState=state$1.playState==="paused"?"play":"paused",state$1.playState==="play"&&state$1.needTick){const s=await handleStartTick();if(console.log("🚀 ~ tickend:",s),!s){state$1.playState="paused",evaluatingData.startBegin=!1;return}}onPlay()}evaluatingData.isErrorState||(await api_startRecordingCb({accompanimentState:state$1.setting.enableAccompaniment?1:0,firstNoteTime:t||0},()=>{state$1.isAppPlay&&setTimeout(()=>{sendOffsetTime(0)},300)}),state$1.setting.camera&&(console.log("开始录制视频"),await api_startCapture()),state$1.isAppPlay&&(await api_cloudChangeSpeed({speed:state$1.originSpeed,originalSpeed:state$1.originSpeed,songID:state$1.examSongId}),audioData$1.progress=0,audioListStart(state$1.playState)))},playMusic=async()=>{if(!await togglePlay("play")){evaluatingData.startBegin=!1,handleCancelEvaluat();return}check_currentTime(),state$1.setting.camera&&(console.log("开始录制视频"),api_startCapture())},recordStartTimePoint=async t=>{var i;if(console.error("开始录音"),!evaluatingData.startBegin)return;let e=((i=t==null?void 0:t.content)==null?void 0:i.inteveral)||0;browserInfo$1.ios&&(e*=1e3),evaluatingData.backtime=e||Date.now(),console.log("🚀 ~ 开始时间点:",evaluatingData.backtime,"已经录的时间:",Date.now()-e,"记录时间点:",Date.now()),!evaluatingData.isDisabledPlayMusic&&playMusic()},handleEndEvaluat=(t=!1)=>{!evaluatingData.startBegin||state$1.modeType!=="evaluating"||(console.log("评测结束1"),endEvaluating({musicScoreId:state$1.examSongId}),showLoadingToast({message:"评分中",duration:0,overlay:!0,overlayClass:styles$6.scoreMode}),setTimeout(()=>{evaluatingData.startBegin=!1},500),evaluatingData.isComplete=t,state$1.setting.camera&&(console.log("结束录制视频"),api_endCapture()))},handleEndBegin=()=>{handleEndEvaluat(),handleStopPlay()},handleCancelEvaluat=t=>{evaluatingData.evaluatings={},evaluatingData.startBegin=!1,closeToast(),api_proxyServiceMessage({header:{commond:"recordCancel",type:"SOUND_COMPARE",status:200}}),cancelEvaluating(),handleStopPlay(),console.log("评测结束2"),endEvaluating({musicScoreId:state$1.examSongId}),state$1.setting.camera&&(console.log("结束录制视频"),api_endCapture())},handleViewReport=(t,e)=>{var s;const i=((s=evaluatingData.resultData)==null?void 0:s[t])||"";let r="";switch(e){case"gym":r=location.origin+location.pathname+"#/report/"+i;break;case"orchestra":r=location.origin+location.pathname+"report-share.html?id="+i;break;case"instrument":r=location.origin+location.pathname+"#/evaluat-report?id="+i+"&musicRenderType="+state$1.musicRenderType;break;default:r=location.origin+location.pathname+"report-share.html?id="+i;break}api_openWebView({url:r,orientation:0,isHideTitle:!0,statusBarTextColor:!1,isOpenLight:!0,c_orientation:0})},handleComplexButton=t=>{console.log("监听是否隐藏保存按钮",t),t!=null&&t.content&&(t.content,state$1.isHideEvaluatReportSaveBtn=!0)},handleAccompanyError=t=>{if(console.log("异常信息返回",t),t!=null&&t.content){const{type:e,reson:i}=t.content;switch(e){case"enterBackground":case"playError":case"socketError":if(evaluatingData.soundEffectMode){evaluatingData.socketErrorStatus=0,evaluatingData.delayCheckSocketError=!0,evaluatingData.socketErrorPop=e==="socketError",evaluatingData.accompanyErrorType=e;return}state$1.modeType==="evaluating"&&evaluatingData.startBegin&&handleCancelEvaluat(),tickData.show&&(tickData.tickEnd=!0,tickData.show=!1),evaluatingData.socketErrorStatus=0,evaluatingData.socketErrorPop=e==="socketError",evaluatingData.isErrorState=!0,evaluatingData.accompanyErrorType=e,resetPlaybackToStart();break}}},handleSocketStatus=t=>{var e;if(((e=t==null?void 0:t.content)==null?void 0:e.status)==="connected"){const i=+new Date;evaluatingData.delayCheckSocketError=!1;const r=i-socketStartTime;if(r<1e3){const s=1e3-r;console.log(s,99999),setTimeout(()=>{evaluatingData.socketErrorStatus=2},s)}}},hanldeConfirmPop=async()=>{api_checkSocketStatus(),evaluatingData.socketErrorStatus=1,socketStartTime=+new Date},hanldeClosePop=()=>{evaluatingData.socketErrorPop=!1,evaluatingData.socketErrorStatus=0},Evaluating=defineComponent({name:"evaluating",setup(){const t=usePageVisibility(),e=reactive({finger:!1,play_mode:"",enableAccompaniment:!0}),i=()=>{e.finger=state$1.setting.displayFingering,state$1.setting.displayFingering=!1,e.play_mode=state$1.playSource,e.enableAccompaniment=state$1.setting.enableAccompaniment,e.enableAccompaniment||(console.log("关闭伴奏"),toggleMutePlayAudio(e.play_mode==="music"?"music":"background",!0))},r=()=>{state$1.setting.displayFingering=e.finger,state$1.playSource=e.play_mode,e.enableAccompaniment||toggleMutePlayAudio(e.play_mode==="music"?"music":"background",!1)};return watch(t,s=>{s=="hidden"&&evaluatingData.startBegin}),watch(()=>evaluatingData.socketErrorStatus,()=>{evaluatingData.socketErrorStatus===2&&setTimeout(()=>{evaluatingData.socketErrorPop=!1},1e3)}),onMounted(()=>{resetPlaybackToStart(),i(),evaluatingData.resultData={},evaluatingData.evaluatings={},evaluatingData.soundEffectFrequency=0,evaluatingData.checkStep=0,evaluatingData.rendered=!0,sendResult(handleScoreResult),hideComplexButton(handleComplexButton,!0),api_recordStartTime(recordStartTimePoint),addAccompanyError(handleAccompanyError),addSocketStatus(handleSocketStatus),state$1.isSelectMeasureMode||clearSelection(),console.log("加载评测模块成功")}),onUnmounted(()=>{evaluatingData.checkEnd=!1,evaluatingData.rendered=!1,resetPlaybackToStart(),removeResult(handleScoreResult),hideComplexButton(()=>{},!1),api_remove_recordStartTime(recordStartTimePoint),r(),removeAccompanyError(handleAccompanyError),removeSocketStatus(handleSocketStatus),api_disconnectSocket(),console.log("卸载评测模块成功")}),()=>createVNode("div",null,[createVNode("div",{class:styles$6.hiddenPop},[createVNode("img",{src:popImgs.icon_bg},null),createVNode("img",{src:popImgs.icon_btn},null),createVNode("img",{src:popImgs.icon_success},null),createVNode("img",{src:popImgs.icon_close},null)]),createVNode(Popup,{teleport:"body",closeOnClickOverlay:!1,class:["popup-custom","van-scale"],transition:"van-scale",show:evaluatingData.socketErrorPop,"onUpdate:show":s=>evaluatingData.socketErrorPop=s},{default:()=>[createVNode(AbnormalPop,{onConfirm:hanldeConfirmPop,onClose:hanldeClosePop},null)]})])}}),scriptRel="modulepreload",assetsURL=function(t,e){return new URL(t,e).href},seen={},__vitePreload=function t(e,i,r){if(!i||i.length===0)return e();const s=document.getElementsByTagName("link");return Promise.all(i.map(o=>{if(o=assetsURL(o,r),o in seen)return;seen[o]=!0;const a=o.endsWith(".css"),l=a?'[rel="stylesheet"]':"";if(!!r)for(let m=s.length-1;m>=0;m--){const d=s[m];if(d.href===o&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${l}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":scriptRel,a||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),a)return new Promise((m,d)=>{u.addEventListener("load",m),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e())},relationships={flute:{59:[27,26,25,15,24,22,17,20],60:[27,26,25,15,24,22,17,20],61:[27,26,25,15,24,22,17,21],62:[27,26,25,15,24,22,17],63:[27,26,25,15,24,22,17,19],64:[27,26,25,15,24,22,19],65:[27,26,25,15,24,19],66:[27,26,25,15,17,19],67:[27,26,25,15,19],68:[27,26,25,15,18,19],69:[27,26,15,19],70:[[27,14,19],[27,24,15,19]],71:[27,15,19],72:[27,19],73:[19],74:[26,25,24,22,17,15],75:[26,25,24,22,17,19,15],76:[27,26,25,15,24,22,19],77:[27,26,25,15,24,19],78:[27,26,25,15,17,19],79:[27,26,25,15,19],80:[27,26,25,15,18,19],81:[27,26,15,19],82:[[27,14,19],[27,24,15,19]],83:[27,15,19],84:[27,19],85:[19],86:[26,25,15,19],87:[27,26,25,15,24,22,17,18,19],88:[27,26,15,24,22,19],89:[27,25,24,15,19],90:[27,25,17,15,19],91:[27,26,25,19],92:[26,25,18,19],93:[26,24,15,19],94:[23,24,15,19],95:[27,25,15,16],96:[27,26,25,18,24,19]},clarinet:{52:[[3,4,6,8,9,11,14,18,20],[3,4,6,8,9,11,14,20]],53:[[3,4,6,8,9,11,12,20],[3,4,6,8,9,11,18,20]],54:[[3,4,6,8,9,11,13,18,20],[3,4,6,8,9,11,13,20],[3,4,6,8,9,11,15]],55:[3,4,6,8,9,11,20],56:[3,4,6,8,9,11,16,20],57:[3,4,6,8,9,20],58:[3,4,6,8,20],59:[[3,4,6,9,20],[3,4,6,8,10,20]],60:[3,4,6,20],61:[3,4,6,7,20],62:[3,4,20],63:[[3,4,20,24],[3,4,5,20],[3,8,20]],64:[3,20],65:[20],66:[[3],[20,23,24]],67:[],68:[2],69:[1],70:[1,19],71:[[3,4,6,8,9,11,14,18,19,20],[3,4,6,8,9,11,14,19,20]],72:[[3,4,6,8,9,11,12,19,20],[3,4,6,8,9,11,18,19,20]],73:[[3,4,6,8,9,11,13,19,20],[3,4,6,8,9,11,13,18,19,20],[3,4,6,8,9,11,15,19,20]],74:[3,4,6,8,9,11,19,20],75:[3,4,6,8,9,11,16,19,20],76:[3,4,6,8,9,19,20],77:[3,4,6,8,19,20],78:[[3,4,6,9,19,20],[3,4,6,8,10,19,20]],79:[3,4,6,19,20],80:[3,4,6,7,19,20],81:[3,4,19,20],82:[[3,4,19,20,24],[3,4,5,19,20],[3,4,8,19,20]],83:[3,19,20],84:[19,20],85:[4,6,8,9,19,20],86:[4,6,8,16,19,20],87:[[4,6,8,10,16,19,20],[4,6,9,16,19,20]],88:[4,6,16,19,20],89:[4,6,7,16,19,20]},trumpet:{0:[1,2,3],54:[4,5,6],55:[4,2,6],56:[1,5,6],57:[4,5,3],58:[4,2,3],59:[1,5,3],60:[1,2,3],61:[4,5,6],62:[4,2,6],63:[1,5,6],64:[4,5,3],65:[4,2,3],66:[1,5,3],67:[1,2,3],68:[1,5,6],69:[4,5,3],70:[4,2,3],71:[1,5,3],72:[1,2,3],73:[4,5,3],74:[4,2,3],75:[1,5,3],76:[1,2,3],77:[4,2,3],78:[1,4,3],79:[1,2,3],80:[1,5,6],81:[4,5,3],82:[4,2,3],83:[1,5,3],84:[1,2,3]},horn:{53:[1],54:[2],55:[],56:[2,3],57:[1,2],58:[1],59:[2],60:[],61:[1,2],62:[1],63:[2],64:[],65:[1],66:[2],67:[],68:[0,2,3],69:[0,1,2],70:[0,1],71:[0,2],72:[0],73:[0,2,3],74:[0,1,2],75:[0,1],76:[0,2],77:[0],78:[0,2],79:[0],80:[0,2,3],81:[0,1,2],82:[0,1],83:[0,2],84:[0]},"up-bass-horn":{0:[1,2,3],40:[4,5,6],41:[4,2,6],42:[1,5,6],43:[4,5,3],44:[4,2,3],45:[1,5,3],46:[1,2,3],47:[4,5,6],48:[4,2,6],49:[1,5,6],50:[4,5,3],51:[4,2,3],52:[1,5,3],53:[1,2,3],54:[1,5,6],55:[4,5,3],56:[4,2,3],57:[1,5,3],58:[1,2,3],59:[4,5,3],60:[4,2,3],61:[1,5,3],62:[1,2,3],63:[4,2,3],64:[1,5,3],65:[1,2,3],66:[1,5,6],67:[4,5,3],68:[4,2,3],69:[1,5,3],70:[1,2,3]},trombone:{0:[1],40:[22],41:[11],42:[5],43:[4],44:[3],45:[2],46:[1],47:[22],48:[11],49:[5],50:[4],51:[3],52:[2],53:[1],54:[5],55:[4],56:[3],57:[2],58:[1],59:[4],60:[3],61:[2],62:[1],63:[3],64:[2],65:[1],66:[5],67:[4],68:[3],69:[2],70:[1]},saxophone:{58:[2,4,5,13,17,18,19,23],59:[2,4,5,11,17,18,19,23],60:[2,4,5,17,18,19,23],61:[2,4,5,12,17,18,19,23],62:[2,4,5,17,18,19],63:[2,4,5,17,18,19,22],64:[2,4,5,17,18],65:[2,4,5,17],66:[[2,4,5,18],[2,4,5,17,21]],67:[2,4,5],68:[2,4,5,10],69:[2,4],70:[[2,4,16],[2,17],[2,3]],71:[2],72:[[4],[2,15]],73:[],74:[2,4,5,6,17,18,19],75:[2,4,5,6,17,18,19,22],76:[2,4,5,6,17,18],77:[2,4,5,6,17],78:[[2,4,5,6,18],[2,4,5,6,17,21]],79:[2,4,5,6],80:[2,4,5,6,10],81:[2,4,6],82:[[2,4,6,16],[2,6,17],[2,3,6]],83:[2,6],84:[[4,6],[2,6,15]],85:[6],86:[6,9],87:[6,7,8],88:[6,8,9,14],89:[[6,7,8,9,14],[1,4,6]]},tuba:{0:[1,2,3],28:[4,5,6],29:[4,2,6],30:[1,5,6],31:[4,5,3],32:[4,2,3],33:[4,2,6],34:[1,2,3],35:[4,5,6],36:[4,2,6],37:[1,5,6],38:[4,5,3],39:[4,2,3],40:[1,5,3],41:[1,2,3],42:[1,5,6],43:[4,5,3],44:[4,2,3],45:[1,5,3],46:[1,2,3],47:[4,5,3],48:[4,2,3],49:[1,5,3],50:[1,2,3],51:[4,2,3],52:[1,5,3],53:[1,2,3],54:[1,5,6],55:[4,5,3],56:[4,2,3],57:[1,5,3],58:[1,2,3]},piccolo:{60:[11,2,33,4,5,6,7,8],61:[11,2,33,4,5,6,7,88],62:[11,2,33,4,5,6,7],63:[11,2,33,4,5,6,77],64:[11,2,33,4,5,6],65:[11,2,33,4,5],66:[11,2,33,4,6,7],67:[11,2,33,4],68:[11,2,33,5,6,77],69:[11,2,33],70:[[11,2,4,5],[1,11,2,4,6,7]],71:[[11,2],[11,33,4]],72:[11,33],73:[[2,33],[11]],74:[33],75:[33,4,5,6,7],76:[1,2,33,4,5,6],77:[1,2,33,4,5],78:[1,2,33,4,6,8],79:[1,2,33,4],80:[1,2,33,4,6,7,8],81:[1,2,33],82:[1,2,33,5,6,7],83:[1,2,33,5,6],84:[1,2,5,6],85:[1,2,4,5,7,8,100],86:[1,2,4,5,7,8]},"small-drum":{0:["active","active-left","active-right"],64:["left","right"]},hulusi:{64:[7,6,5,4,3,2,11,91],65:[7,6,5,4,3,2,1,91],66:[7,6,5,4,3,2,91],67:[7,6,5,4,3,2,11,92],68:[7,6,5,4,3,2,1,92],69:[7,6,5,4,3,2,93],70:[7,6,5,4,3,11,93],71:[7,6,5,4,3,93],72:[7,6,5,4,95],73:[7,6,5,3,2,95],74:[7,6,5,95],75:[7,6,4,3,95],76:[7,6,95],77:[7,5,4,3,2,94],78:[7,5,4,94],79:[7,94],80:[6,94],81:[96]},pan:{55:[21],57:[20],59:[19],60:[18],62:[17],64:[16],65:[15],67:[14],69:[13],71:[12],72:[11],74:[10],76:[9],77:[8],79:[7],81:[6],83:[5],84:[4],86:[3],88:[2],89:[1]},ocarina:{57:[1,2,3,4,5,6,7,8,9,10,11,12],58:[1,2,3,4,5,6,8,9,10,11,12],59:[1,2,4,5,6,7,8,9,10,11,12],60:[1,2,4,5,6,8,9,10,11,12],61:[1,2,4,5,6,7,8,9,11,12],62:[1,2,4,5,6,8,9,11,12],63:[1,2,4,5,6,9,11,12],64:[1,2,4,5,6,8,11,12],65:[1,2,4,5,6,11,12],66:[1,2,4,6,9,11,12],67:[1,2,4,6,11,12],68:[1,2,6,9,11,12],69:[1,2,6,11,12],70:[1,6,9,11,12],71:[1,6,11,12],72:[6,11,12],73:[6,9,12],74:[6,12],75:[6,9],76:[6],77:[]},melodica:{53:[1],54:[101],55:[2],56:[102],57:[3],58:[103],59:[4],60:[5],61:[104],62:[6],63:[105],64:[7],65:[8],66:[106],67:[9],68:[107],69:[10],70:[108],71:[11],72:[12],73:[109],74:[13],75:[110],76:[14],77:[15],78:[111],79:[16],80:[112],81:[17],82:[113],83:[18],84:[19]},baroqueRecorder:{60:[11,2,33,4,5,6,7,8],61:[11,2,33,4,5,6,7,88],62:[11,2,33,4,5,6,7],63:[11,2,33,4,5,6,77],64:[11,2,33,4,5,6],65:[11,2,33,4,5,7,8],66:[11,2,33,4,6,7],67:[11,2,33,4],68:[11,2,33,5,6,77],69:[11,2,33],70:[11,2,4,5],71:[11,2],72:[11,33],73:[2,33],74:[33],75:[33,4,5,6,7],76:[1,2,33,4,5,6],77:[1,2,33,4,5,7],78:[1,2,33,4,6],79:[1,2,33,4],80:[1,2,33,5],81:[1,2,33],82:[1,2,33,5,6,7],83:[1,2,33,5,6],84:[1,2,5,6],85:[1,2,4,5,7,8,100],86:[1,2,4,5,7,8],87:[1,2,4],88:[1,2,33,4,5,6],89:[1,2,33,4,5,7],90:[1,2,33,4,6],91:[1,2,33,4],92:[1,2,33,5],93:[1,2,33],94:[1,2,33,5,6,7],95:[1,2,33,5,6],96:[1,2,5,6],97:[1,2,4,5,7,8],98:[1,2,4]}},mappingVoicePart=(t,e)=>{if(e==="GYM")return Number(t);if(e==="COLEXIU")return{Flute:2,Clarinet:4,Trombone:14,Tuba:17,Trumpet:12,Horn:13,AltoSaxophone:6,TenorSaxophone:6,Saxophone:6,UpBassHorn:15,Melodica:137,HulusiFlute:136,PanFlute:135,Ocarina:134,Recorder:120,Ukulele:130,Mouthorgan:140,Piano:150}[t];if(e==="ORCHESTRA")return{1:23,2:2,3:5,4:4,5:12,6:14,7:13,8:15,9:17}[t];if(e==="INSTRUMENT"){let i=t;return typeof i=="string"&&(i=i.toLocaleLowerCase().replace(/ /g,"")),{flute:2,clarinet:4,trombone:14,tuba:17,trumpet:12,horn:13,altosaxophone:6,tenorsaxophone:6,saxophone:6,upbasshorn:15,melodica:137,hulusiFlute:136,panflute:135,recorder:120,ukulele:130,mouthorgan:140,piano:150,baroquerecorder:"baroque-recorder",4:"piccolo",3:"hulusi-flute",1:"pan-flute",2:"ocarina",5:"melodica",23:2,24:6,25:4,26:12,27:14,28:13,29:15,30:17,tenorrecorder:"piccolo",woodwind:"hulusi-flute",panpipes:"pan-flute",ocarina:"ocarina",nai:"melodica",15:"baroque-recorder",16:"baroque-recorder"}[i]||0}else if(e==="ENSEMBLE"){let i=t;const r={Piccolo:"piccolo",Flute:2,"Flute 1":2,"Flute 2":2,Oboe:1,"Clarinet in Bb 1":4,"Clarinet in Bb 2":4,"Alto Clarinet in Eb":4,"Bass Clarinet in Bb":4,Bassoon:1,"Alto Saxophone":5,"Tenor Saxophone":5,"Baritone Saxophone":5,"Trumpet in Bb 1":12,"Trumpet in Bb 2":12,"Horn in F":13,"Horn in F 1":13,"Horn in F 2":13,"Trombone 1":14,"Trombone 2":14,"Trombone 3":14,Euphonium:15,Tuba:17,Chimes:1,Bells:1,Xylophone:1,"Snare Drum":1,"Bass Drum":1,Triangle:1,"Suspended Cymbal":1,"Crash Cymbals":1,"Concert Toms":1,Timpani:1,flute:2,oboe:4,clarinet:4,trombone:14,tuba:17,trumpet:12,horn:13,altosaxophone:6,tenorsaxophone:6,saxophone:6,upbasshorn:15,melodica:137,hulusiFlute:136,panflute:135,recorder:120,ukulele:130,mouthorgan:140,piano:150,4:"piccolo",3:"hulusi-flute",1:"pan-flute",2:"ocarina",5:"melodica",26:12,tenorrecorder:"piccolo",woodwind:"hulusi-flute",panpipes:"pan-flute",ocarina:"ocarina",nai:"melodica",BaroqueRecorder:"baroque-recorder"};let s;if(typeof i=="string"){for(let o in r)if(o===i){s=r[o];break}}else s=r.code;return s}return 0},matchVoicePart=(t,e)=>{if(e==="SINGLE")return{33:"pan-flute",34:"ocarina",35:"hulusi-flute",37:"piccolo",36:"melodica",38:"baroque-recorder",1:2,5:5,3:4,11:12,13:14,12:13,14:15,16:17}[t];{let i=t;const r={Piccolo:"piccolo",Flute:2,"Flute 1":2,"Flute 2":2,Oboe:1,"Clarinet in Bb":4,"Clarinet in Bb 1":4,"Clarinet in Bb 2":4,"Alto Clarinet in Eb":4,"Bass Clarinet in Bb":4,Bassoon:1,"Alto Saxophone":5,"Tenor Saxophone":5,"Baritone Saxophone":5,"Trumpet in Bb 1":12,"Trumpet in Bb 2":12,"Horn in F":13,"Horn in F 1":13,"Horn in F 2":13,"Trombone 1":14,"Trombone 2":14,"Trombone 3":14,Euphonium:15,Tuba:17,Chimes:1,Bells:1,Xylophone:1,"Snare Drum":1,"Bass Drum":1,Triangle:1,"Suspended Cymbal":1,"Crash Cymbals":1,"Concert Toms":1,Timpani:1,flute:2,oboe:4,clarinet:4,trombone:14,tuba:17,trumpet:12,horn:13,altosaxophone:6,tenorsaxophone:6,saxophone:6,upbasshorn:15,melodica:137,hulusiFlute:136,panflute:135,recorder:120,ukulele:130,mouthorgan:140,piano:150,4:"piccolo",3:"hulusi-flute",1:"pan-flute",2:"ocarina",5:"melodica",26:12,tenorrecorder:"piccolo",woodwind:"hulusi-flute",panpipes:"pan-flute",ocarina:"ocarina",nai:"melodica",BaroqueRecorder:"baroque-recorder","Drum Set":24,Marimba:26,Vibraphone:27,"Tubular Bells":30,Mallets:32};let s;if(typeof i=="string"){i=i.toLocaleLowerCase().replace(/ /g,"");for(let o in r){let a=o;if(typeof o=="string"&&(a=a.toLocaleLowerCase().replace(/ /g,"")),a===i){s=r[o];break}}}else s=r.code;return s}},subjectFingering=t=>{switch(t){case 2:return{name:"flute",direction:"transverse",height:"1.6rem",hasTizhi:!0,id:1};case 4:return{name:"clarinet",direction:"vertical",width:"3rem",hasTizhi:!0,id:3};case 5:case 6:return{name:"saxophone",direction:"vertical",width:"4.34rem",hasTizhi:!0,id:5};case 12:return{name:"trumpet",direction:"transverse",height:"1.6rem",hasTizhi:!1,id:11};case 13:return{name:"horn",direction:"vertical",width:"4.98rem",hasTizhi:!1,id:12};case 14:return{name:"trombone",direction:"transverse",height:"1.6rem",hasTizhi:!1,id:13};case 15:return{name:"up-bass-horn",direction:"vertical",width:"4.34rem",hasTizhi:!1,id:14};case 17:return{name:"tuba",direction:"vertical",width:"4.34rem",hasTizhi:!1,id:16};case 120:return{name:"piccolo",direction:"vertical",width:"3rem",orientation:1,hasTizhi:!0,id:2};case"piccolo":return{name:"piccolo",direction:"vertical",width:"3rem",orientation:1,code:"竖笛",hasTizhi:!0,id:37};case"hulusi-flute":return{name:"hulusi-flute",direction:"vertical",width:"3rem",orientation:1,code:"葫芦丝",hasTizhi:!1,id:35};case"pan-flute":return{name:"pan-flute",direction:"transverse",height:"2rem",disabledFinger:!0,orientation:0,code:"排箫",hasTizhi:!1,id:33};case"ocarina":return{name:"ocarina",direction:"vertical",width:"3rem",disabledFinger:!0,orientation:0,code:"陶笛",hasTizhi:!1,id:34};case"melodica":return{name:"melodica",direction:"transverse",height:"2rem",orientation:0,code:"口风琴",hasTizhi:!1,id:36};case"baroque-recorder":return{name:"baroque-recorder",direction:"vertical",width:"3rem",orientation:1,code:"竖笛",hasTizhi:!0,id:38};default:return typeof t=="number"?{id:t}:{}}},getFingeringConfig=async t=>{switch(t){case"flute":return{json:(await __vitePreload(()=>import("./index-7f22768f.js"),[],import.meta.url)).default,relationship:relationships.flute,height:"60px",styles:{}};case"clarinet":return{json:(await __vitePreload(()=>import("./index-2499965c.js"),[],import.meta.url)).default,relationship:relationships.clarinet,styles:{marginLeft:".4rem",marginRight:".7rem"}};case"trumpet":return{json:(await __vitePreload(()=>import("./index-f01bef28.js"),[],import.meta.url)).default,relationship:relationships.trumpet};case"horn":return{json:(await __vitePreload(()=>import("./index-20c025d3.js"),[],import.meta.url)).default,relationship:relationships.horn,height:"212px",width:"252px"};case"tuba":return{json:(await __vitePreload(()=>import("./index-902205b3.js"),[],import.meta.url)).default,relationship:relationships.tuba};case"piccolo":return{json:(await __vitePreload(()=>import("./index-991877f6.js"),[],import.meta.url)).default,relationship:relationships.piccolo};case"piccolo1":return{json:(await __vitePreload(()=>import("./index-0bbf84fb.js"),[],import.meta.url)).default,relationship:relationships.piccolo};case"piccolo2":return{json:(await __vitePreload(()=>import("./index-f5dd9e1d.js"),[],import.meta.url)).default,relationship:relationships.piccolo};case"up-bass-horn":return{json:(await __vitePreload(()=>import("./index-ad5b3309.js"),[],import.meta.url)).default,relationship:relationships["up-bass-horn"]};case"trombone":return{json:(await __vitePreload(()=>import("./index-f23e3dbf.js"),[],import.meta.url)).default,relationship:relationships.trombone};case"saxophone":return{json:(await __vitePreload(()=>import("./index-cef965b9.js"),[],import.meta.url)).default,relationship:relationships.saxophone,styles:{marginLeft:".2rem",marginRight:".3rem"}};case"small-drum":return{json:(await __vitePreload(()=>import("./index-7ad0b9f0.js"),[],import.meta.url)).default,relationship:relationships["up-bass-horn"],width:"180px"};case"hulusi-flute":return{json:(await __vitePreload(()=>import("./index-71a277d3.js"),[],import.meta.url)).default,relationship:relationships.hulusi,styles:{marginLeft:".6rem",marginRight:".7rem"}};case"hulusi-flute1":return{json:(await __vitePreload(()=>import("./index-03bddf2b.js"),[],import.meta.url)).default,relationship:relationships.hulusi,styles:{marginLeft:".6rem",marginRight:".7rem"}};case"hulusi-flute2":return{json:(await __vitePreload(()=>import("./index-97e45cdd.js"),[],import.meta.url)).default,relationship:relationships.hulusi,styles:{marginLeft:".6rem",marginRight:".7rem"}};case"pan-flute":return{json:(await __vitePreload(()=>import("./index-0bc55d54.js"),[],import.meta.url)).default,relationship:relationships.pan};case"pan-flute1":return{json:(await __vitePreload(()=>import("./index-97c2723f.js"),[],import.meta.url)).default,relationship:relationships.pan};case"pan-flute2":return{json:(await __vitePreload(()=>import("./index-589cb412.js"),[],import.meta.url)).default,relationship:relationships.pan};case"pan-flute3":return{json:(await __vitePreload(()=>import("./index-e427d448.js"),[],import.meta.url)).default,relationship:relationships.pan};case"ocarina":return{json:(await __vitePreload(()=>import("./index-ecdafa29.js"),[],import.meta.url)).default,relationship:relationships.ocarina,width:"180px",styles:{marginTop:"auto"}};case"ocarina1":return{json:(await __vitePreload(()=>import("./index-1cca1c70.js"),[],import.meta.url)).default,relationship:relationships.ocarina,width:"180px",styles:{marginTop:"auto"}};case"ocarina2":return{json:(await __vitePreload(()=>import("./index-a1f8bc5d.js"),[],import.meta.url)).default,relationship:relationships.ocarina,width:"180px",styles:{marginTop:"auto"}};case"melodica":return{json:(await __vitePreload(()=>import("./index-55a98a41.js"),[],import.meta.url)).default,relationship:relationships.melodica,height:"80px",styles:{marginTop:"auto"}};case"melodica1":return{json:(await __vitePreload(()=>import("./index-b6d2ab3b.js"),[],import.meta.url)).default,relationship:relationships.melodica,height:"80px",styles:{marginTop:"auto"}};case"baroque-recorder":return{json:(await __vitePreload(()=>import("./index-7908a008.js"),[],import.meta.url)).default,relationship:relationships.baroqueRecorder};case"baroque-recorder1":return{json:(await __vitePreload(()=>import("./index-142fdf16.js"),[],import.meta.url)).default,relationship:relationships.baroqueRecorder};case"baroque-recorder2":return{json:(await __vitePreload(()=>import("./index-d13c0247.js"),[],import.meta.url)).default,relationship:relationships.baroqueRecorder};default:return null}};function autoCorrelate(t,e){for(var i=t.length,r=0,s=0;su[d+1];)d++;for(var g=-1,y=-1,s=d;sg&&(g=u[s],y=s);var b=y,S=u[b-1],E=u[b],x=u[b+1];let A=(S+x-2*E)/2,_=(x-S)/2;return A&&(b=b-_/(2*A)),e/b}const audioRecorder={audioContext:null,mediaRecorder:null,recordeState:!1,progress:t=>{},init(){this.audioContext=new(window.AudioContext||window.webkitAudioContext)},toggleRecord(t){return new Promise((e,i)=>{t?navigator.mediaDevices.getUserMedia({audio:!0}).then(r=>{audioRecorder.mediaRecorder=r.getAudioTracks()[0],audioRecorder.recordeState=!0;const s=this.audioContext.createMediaStreamSource(r),o=this.audioContext.createAnalyser();o.fftSize=2048,s.connect(o);var a=new Float32Array(o.fftSize);const l=this.audioContext.sampleRate;function c(){if(!audioRecorder.recordeState)return;o.getFloatTimeDomainData(a);const u=autoCorrelate(a,l);audioRecorder.progress(u),setTimeout(()=>{c()},10)}c(),e(!0)}).catch(r=>{e(!1),console.error("Error accessing media devices:",r)}):audioRecorder.mediaRecorder.stop()})},checkSupport(){return new Promise((t,e)=>{if(navigator.mediaDevices.getUserMedia){const i={audio:!0};navigator.mediaDevices.getUserMedia(i).then(r=>{t(!0),console.log("授权成功!")},()=>{t(!1),console.error("授权失败!")})}else t(!1),console.error("浏览器不支持 getUserMedia")})}},studentQueryUserInfo=async()=>await request.get("/user/getUserInfo"),api_musicPracticeRecordSave=t=>request.post("/musicPracticeRecord/save",{requestType:"json",data:t}),api_lessonTrainingSubmitTraining=t=>request.post("/lessonTraining/submitTraining",{requestType:"json",data:t}),api_lessonTrainingTrainingStudentDetail=t=>request.get(`/lessonTraining/trainingContentStudentDetail?id=${t}`),api_musicPracticeRecordVideoUpload=t=>request.post("/musicPracticeRecord/videoUpload",{data:t,requestType:"json"}),sysSuggestionAdd=t=>request.post("/sysSuggestion/save",{data:t,requestType:"json"}),api_musicPracticeRecordDetail=t=>request.get("/musicPracticeRecord/detail/"+t),api_musicalInstrumentList=t=>request.post("/musicalInstrument/list",{data:t,requestType:"json"}),api_musicSheetPage=t=>request.post("/musicSheet/page",{data:t,requestType:"json"}),getSuggestionList=t=>request.post("/sysSuggestionType/page",{data:t,requestType:"json"}),query$2=getQuery(),followData=reactive({list:[],index:0,start:!1,rendered:!1,earphone:!1}),handleRecord=t=>{if(query$2.isCbs)return;t<0&&(t=0);const e=t/1e3,i={clientType:storeData.user.clientType,musicSheetId:state$1.examSongId,sysMusicScoreId:state$1.examSongId,feature:"FOLLOW_UP_TRAINING",practiceSource:"FOLLOW_UP_TRAINING",playTime:e,deviceType:browser().android?"ANDROID":"IOS",behaviorId:getBehaviorId()};api_musicPracticeRecordSave(i)},toggleFollow=(t=!0)=>{state$1.modeType=state$1.modeType==="follow"?"practise":"follow",t||(followData.start=!1,openToggleRecord(!1))},noteFrequency=ref(0),audioFrequency=ref(0),followTime=ref(0),openToggleRecord=async(t=!0)=>{if(t||api_cloudToggleFollow(t?"start":"end"),t)followTime.value=Date.now();else{const e=Date.now()-followTime.value;followTime.value!==0&&e>0&&(handleRecord(e),followTime.value=0)}storeData.isApp||!await(audioRecorder==null?void 0:audioRecorder.toggleRecord(t))&&followData.start&&(followData.earphone=!0,followData.start=!1)},onClear=()=>{state$1.times.forEach(t=>{const e=document.querySelector(`div[data-vf=vf${t.id}]`);e&&e.classList.remove("follow-up","follow-down","follow-error","follow-success");const i=document.getElementById(`vf-${t.id}`);i&&i.classList.remove("follow-up","follow-down")})},handleFollowStart=async()=>{var e;const t=await api_cloudToggleFollow("start");if(!((e=t==null?void 0:t.content)!=null&&e.reson)){if(followData.start=!0,!await handleStartTick())return followData.start=!1,!1;onClear(),followData.start=!0,followData.index=0,followData.list=[],resetPlaybackToStart(),openToggleRecord(!0),getNoteIndex();const r=getDuration(state$1.osmd);metronomeData.totalNumerator=r.numerator||2,metronomeData.followAudioIndex=1,state$1.beatStartTime=0,followBeatPaly()}},handleFollowEnd=()=>{onClear(),followData.start=!1,openToggleRecord(!1),followData.index=0,console.log("结束")},next=()=>{gotoNext(state$1.times[followData.index])},getNoteIndex=()=>{const t=state$1.times[followData.index];return t.frequency<=0?(followData.index=followData.index+1,next(),getNoteIndex()):(noteFrequency.value=t.frequency,{id:t.id,min:t.frequency-(t.frequency-t.prevFrequency)*.5,max:t.frequency+(t.nextFrequency-t.frequency)*.5,duration:t.duration,baseFrequency:t.frequency})};let checking=!1;const onFollowTime=t=>{var i;const e=(i=t==null?void 0:t.content)==null?void 0:i.frequency;followData.start&&e>0&&(audioFrequency.value=e,checked())};let startTime=0;const checked=()=>{if(checking)return;checking=!0;const t=getNoteIndex();if(audioFrequency.value=t.min&&audioFrequency.value<=t.max){if(startTime===0)startTime=Date.now();else if((Date.now()-startTime)/1e3>=t.duration*.6){startTime=0,followData.index=followData.index+1,setColor(t,"",!0),next(),checking=!1;return}}setColor(t,audioFrequency.value>t.baseFrequency?"follow-up":"follow-down"),checking=!1},setColor=(t,e,i=!1)=>{const r=document.querySelector(`div[data-vf=vf${t.id}]`);r&&(r.classList.remove("follow-up","follow-down","follow-error","follow-success"),i?r.classList.add("follow-success"):r.classList.add("follow-error",e));const s=document.getElementById(`vf-${t.id}`);s&&(s.classList.remove("follow-up","follow-down"),e&&s.classList.add(e))},FollowPractice=defineComponent({name:"follow",setup(){return onMounted(async()=>{storeData.isApp?api_cloudFollowTime(onFollowTime):await audioRecorder.checkSupport()?(audioRecorder.init(),audioRecorder.progress=e=>{onFollowTime({api:"",content:{frequency:e}})}):followData.earphone=!0,console.log("进入跟练模式")}),onUnmounted(()=>{api_cloudFollowTime(onFollowTime,!1),resetPlaybackToStart(),onClear(),openToggleRecord(!1),console.log("退出跟练模式")}),()=>createVNode("div",null,null)}}),getMusicSheetDetail=t=>request.get("/musicSheet/cbsDetail/"+t),query$1=getQuery();var EnumMusicRenderType=(t=>(t.staff="staff",t.firstTone="firstTone",t.fixedTone="fixedTone",t))(EnumMusicRenderType||{});const musicscoresettingKey="musicscoresetting";var IPlatform=(t=>(t.APP="APP",t.PC="PC",t))(IPlatform||{});const classids=[1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,30,31,35,36,38,108,150,151,152,153,154,155,156,157,158,178,179,180,181,182],musicalInstrumentCodeInfo=[{name:"长笛",code:"Flute",id:1},{name:"短笛",code:"Piccolo",id:2},{name:"单簧管",code:"Clarinet",id:3},{name:"低音单簧管",code:"Bass Clarinet",id:4},{name:"中音萨克斯",code:"Alto Saxophone",id:5},{name:"次中音萨克斯",code:"Tenor Saxophone",id:6},{name:"高音萨克斯",code:"Soprano Saxophone",id:7},{name:"上低音萨克斯",code:"Baritone Saxophone",id:8},{name:"双簧管",code:"Oboe",id:9},{name:"大管",code:"Bassoon",id:10},{name:"小号",code:"Trumpet",id:11},{name:"圆号",code:"Horn",id:12},{name:"长号",code:"Trombone",id:13},{name:"上低音号",code:"Baritone",id:14},{name:"次中音号",code:"Euphonium",id:15},{name:"大号",code:"Tuba",id:16},{name:"钢琴",code:"Piano",id:17},{name:"电钢琴",code:"Electronical Piano",id:18},{name:"钢片琴",code:"Glockenspiel",id:19},{name:"小提琴",code:"Violin",id:20},{name:"中提琴",code:"Viola",id:21},{name:"大提琴",code:"Violoncello",id:22},{name:"低音提琴",code:"Contrabass",id:23},{name:"架子鼓",code:"Drum Set",id:24},{name:"小鼓",code:"Snare Drum",id:25},{name:"马林巴",code:"Marimba",id:26},{name:"颤音琴",code:"Vibraphone",id:27},{name:"钟琴",code:"Chimes",id:28},{name:"木琴",code:"Xylophone",id:29},{name:"管钟",code:"Tubular Bells",id:30},{name:"定音鼓",code:"Timpani",id:31},{name:"键盘",code:"Mallets",id:32},{name:"排箫",code:"Panpipes",id:33},{name:"陶笛",code:"Ocarina",id:34},{name:"葫芦丝",code:"Woodwind",id:35},{name:"口风琴",code:"Nai",id:36},{name:"德式竖笛",code:"Tenor Recorder",id:37},{name:"英式竖笛",code:"Baroque Recorder",id:38}],state=reactive({platform:"",appName:"",musicRenderType:"staff",musicRendered:!1,detailId:"",xmlUrl:"",subjectId:0,trackId:0,categoriesId:0,categoriesName:"",enableEvaluation:!0,enableNotation:!1,examSongId:"",cbsExamSongId:"",examSongName:"",coverImg:"",extConfigJson:{},extStyleConfigJson:{},isOpenMetronome:!1,isShowFingering:!1,music:"",accompany:"",midiUrl:"",parentCategoriesId:0,musicSheetCategoriesId:0,bizMusicCategoryId:0,playMode:"MP3",speed:0,originSpeed:0,playIngSpeed: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:0,evaluationDifficulty:"ADVANCED",saveToAlbum:!0,enableAccompaniment:!0,reactionTimeMs:0,beatVolume:50},baseFrequency:440,fixtime:0,fingeringInfo:{},scrollContainer:"musicAndSelection",isPercussion:!1,evaluationStandard:"",repeatedBeats:0,partListNames:[],gradual:[],gradualVersion:GradualVersion.BASE,gradualTimes:null,multitrack:0,zoom:.8,musicZoom:1,isSelectMeasureMode:!1,isReport:!1,isHideEvaluatReportSaveBtn:!1,isConcert:!1,userChooseEndIndex:0,repeatInfo:[],canSelectTracks:[],subjectCodeId:0,musicalCodeId:0,musicalCode:"",isCombineRender:!1,measureTime:0,beatStartTime:0,isPreView:!1,isEvaluatReport:!1,midiPlayIniting:!1,songs:{},isAppPlay:!1,audiosInstance:null,durationNum:0,midiSectionStart:0});browser();const customData=reactive({customNoteRealValue:[],customNoteCurrentTime:!1}),setStep=()=>{if(state.playState!=="play"){console.log("暂停播放");return}let t=Date.now();requestAnimationFrame(()=>{Date.now()-t<16.7?(handlePlaying(),setStep()):setTimeout(()=>{handlePlaying(),setStep()},16.7)})},onPlay=()=>{console.log("开始播放"),state.playEnd=!1,setStep()},autoResetPlay=()=>{state.modeType==="practise"&&(skipNotePlay(0,!0),state.setting.repeatAutoPlay&&(scrollViewNote(),setTimeout(()=>{togglePlay("play")},1e3)))},onEnded=()=>{console.log("音频播放结束"),state.playEnd=!0,state.playState="paused",audioListStart(state.playState),handleEndEvaluat(!0),autoResetPlay()},handlePlaying=()=>{var r;const t=getAudioCurrentTime(),e=getAudioDuration();state.playProgress=t/e*100;let i=getNote(t);if(i&&state.modeType==="practise"&&state.playState==="play"&&i.measureSpeed&&i.measureSpeed!==state.playIngSpeed){const s=state.speed/state.originSpeed;state.playIngSpeed=Math.ceil(s*i.measureSpeed)||state.speed}else state.modeType==="practise"&&state.playState==="play"&&i&&!i.measureSpeed&&(state.playIngSpeed=state.speed);if(i){if(state.sectionStatus&&state.section.length===2){const s=state.sectionFirst?state.sectionFirst:state.section[0],o=state.section[1];if(state.repeatInfo.length){const a=verifyCanRepeat(state.section[0].MeasureNumberXML,state.section[1].MeasureNumberXML),l=a.repeatIdx==-1?0:a.repeatIdx;if(state.modeType==="practise"&&!a.canRepeat&&state.section[1].MeasureNumberXML>state.repeatInfo[l].end){const c=state.times[i.i-1];if(c&&c.MeasureNumberXML>i.MeasureNumberXML){const u=state.times.find(m=>m.MeasureNumberXML===c.MeasureNumberXML+1);if(u){setAudioCurrentTime(u.time,u.i),gotoNext(u);return}}}}if(t-o.endtime>=0){if(console.log("选段播放结束",state.setting.repeatAutoPlay),state.modeType==="evaluating"&&state.isSelectMeasureMode){onEnded();return}if(state.modeType==="practise"&&state.sectionStatus){onEnded(),resetPlaybackToStart();return}i=s,setAudioCurrentTime(s.time,s.i)}}gotoNext(i)}(r=metronomeData.metro)==null||r.sound(t)},skipNotePlay=async(t,e=!1)=>{var s;const i=state.times[t];let r=i.time;e&&(r=0),i&&(setAudioCurrentTime(r,t),gotoNext(i),(s=metronomeData.metro)==null||s.sound(r),state.isAppPlay&&(await api_cloudSetCurrentTime({currentTime:r*1e3,songID:state.examSongId}),audioData$1.progress=r,state.midiSectionStart=r))},togglePlay=async t=>{if(state.isAppPlay){if(t==="paused"){await api_cloudSuspend({songID:state.examSongId}),state.playState="paused";return}await api_cloudChangeSpeed({speed:state.modeType==="evaluating"?state.originSpeed:state.speed,originalSpeed:state.originSpeed,songID:state.examSongId});const e=await api_cloudGetMediaStatus(),i=(e==null?void 0:e.content.status)==="suspend"?"play":"paused";state.playState=i}else state.playState=t||(state.playState==="paused"?"play":"paused");return state.playState==="play"&&state.sectionStatus&&state.section.length==2&&state.playProgress===0&&resetPlaybackToStart(),state.playState==="play"&&state.needTick&&!await handleStartTick()?(state.playState="paused",!1):(state.playState=="play"&&state.sectionStatus&&state.section.length<2&&clearSelection(),audioListStart(state.playState),!0)},handleStopPlay=()=>{state.playState="paused",audioListStart(state.playState)},resetPlaybackToStart=()=>{if(state.sectionStatus&&state.section.length===2){state.section=formateSelectMearure(state.section);return}skipNotePlay(0,!0)},gotoCustomNote=t=>{try{state.osmd.cursor.reset()}catch(e){}for(let e=0;e{(state.musicRenderType==="firstTone"||state.musicRenderType==="fixedTone")&&nextTick(()=>{var o,a,l,c;let i=t.bbox;if(!i){const m=(((o=document.getElementById("musicAndSelection"))==null?void 0:o.getBoundingClientRect())||{x:0,y:0}).x||0,d=document.querySelector(`#vf-${(l=(a=t.svgElement)==null?void 0:a.attrs)==null?void 0:l.id}`);if(d){const g=d.querySelector(".vf-numbered-note-head"),y=(c=g==null?void 0:g.getBoundingClientRect)==null?void 0:c.call(g);y&&(t.bbox={left:y.x-m-y.width/4,width:y.width*1.5},i=t.bbox)}}if(!i)return;const r=state.platform==="PC"?29:18,s=(i.width-r)/3;e.cursorElement.style.left=i.left+"px",e.cursorElement.style.transform=`translateX(${s}px)`})},gotoNext=t=>{const e=t.i;if(state.activeNoteIndex===t.i){try{setCursorPosition(t,state.osmd.cursor)}catch(s){console.log(s)}return}const i=state.osmd;let r=state.activeNoteIndex;if(state.activeNoteIndex=e,state.activeMeasureIndex=t.MeasureNumberXML,r&&e-r===1)i.cursor.next();else if(r&&e-r>0)for(;e-r>0;)r++,i.cursor.next();else gotoCustomNote(e);try{setCursorPosition(t,state.osmd.cursor)}catch(s){console.log(s)}scrollViewNote()},getNote=t=>{const e=state.times,i=state.times.length;if(t>e[i-1].endtime+2&&!state.isAppPlay){onEnded();return}let r=null;for(let s=state.activeNoteIndex;s=o.time)(!a||o.time!=a.time)&&(r=o);else break}return r},handleResetPlay=()=>{state.isAppPlay&&(audioData$1.progress=0),resetPlaybackToStart(),togglePlay("play")},handleSetSpeed=t=>{setStorageSpeed(state.examSongId,t),state.speed=t},clearSelection=()=>{state.sectionStatus=!1,state.section=[],closeToast()},handleChangeSection=()=>{if(state.sectionStatus){togglePlay("paused"),skipNotePlay(0,!0),clearSelection();return}state.sectionStatus=!0,state.sectionStatus&&togglePlay("paused"),showToast({message:"请选择开始小节",duration:0,position:"top",className:"selectionToast"})},formateSelectMearure=t=>{var l,c;if(!t.length)return[];const e=t.sort((u,m)=>u.time-m.time),i=(l=e[0])==null?void 0:l.measureOpenIndex,r=(c=e.last())==null?void 0:c.measureOpenIndex,s=state.times.filter(u=>i===u.measureOpenIndex)||[],o=state.times.filter(u=>r===u.measureOpenIndex)||[];if(!s.length||!o.length)return clearSelection(),[];e[0]=s[0],e[1]=o.last();let a=e[0].i;if(state.isOpenPrepare){const u=e[0].MeasureNumberXML;state.sectionFirst=state.times.find(m=>u-m.MeasureNumberXML===1),a=state.sectionFirst?state.sectionFirst.i:a}return skipNotePlay(a,a===0),e},handleSelection=t=>{!state.sectionStatus||state.section.length>1||(state.section.length!==2&&t&&(state.section.push(t),state.section.length===2&&(setSection(state.section[0].MeasureNumberXML,state.section[1].MeasureNumberXML),closeToast())),state.section.length===1&&showToast({message:"请选择结束小节",duration:0,position:"top",className:"selectionToast"}))},setSection=(t,e,i)=>{var b;const r=state.times.filter(S=>S.noteElement.sourceMeasure.MeasureNumberXML==t),s=state.times.filter(S=>S.noteElement.sourceMeasure.MeasureNumberXML==e);state.userChooseEndIndex=e;const o=s[s.length-1].noteId;let a=s.filter(S=>S.noteId===o);const l=verifyCanRepeat(t,e);console.log("能否重播",l);const c=l.canRepeat;let u=e;const m=((b=state.repeatInfo[l.repeatIdx])==null?void 0:b.end)||0;for(;c&&a.length===1&&a[0].MeasureNumberXML<=m;){u=u-1;const S=state.times.filter(x=>x.noteElement.sourceMeasure.MeasureNumberXML==u),E=S[S.length-1].noteId;a=S.filter(x=>x.noteId===E)}const d=c&&l.repeatIdx==state.repeatInfo.length-1?a.length-1:0,g=r[0],y=a[d];g&&y&&(state.isSelectMeasureMode=!0,hanldeDirectSelection([g,y]),i&&handleSetSpeed(i))},hanldeDirectSelection=t=>{!Array.isArray(t)||t.length!==2||(state.sectionStatus=!0,setTimeout(()=>{state.section=formateSelectMearure(t)},500))};let offsetTop=0;const scrollViewNote=()=>{const t=document.getElementById("cursorImg-0"),e=document.getElementById(state.scrollContainer);!t||!e||offsetTop===t.offsetTop||(offsetTop=t.offsetTop,offsetTop>50?e.scrollTo({top:(offsetTop-50)*state.musicZoom,behavior:"smooth"}):e.scrollTo({top:0,behavior:"smooth"}))},isRhythmicExercises=()=>state.examSongName.indexOf("节奏练习")>-1,handleRessetState=()=>{skipNotePlay(0,!0),clearSelection(),state.isAppPlay&&(audioData$1.progress=0),state.modeType==="evaluating"?handleStartEvaluat():state.modeType==="practise"?togglePlay("paused"):state.modeType==="follow"&&toggleFollow(!1)},state$1=state,evaluatCreateMusicPlayer=()=>api_createMusicPlayer({musicSrc:state.accompany||state.music,tuneSrc:"https://oss.dayaedu.com/cloud-coach/1686725501654check_music1_(1).mp3"}),getMusicDetail=async t=>{const e=await getMusicSheetDetail(t);(e==null?void 0:e.code)===200&&getMusicInfo(e)},getMusicInfo=t=>{var o,a;const e=query$1["part-index"]?parseInt(query$1["part-index"]):0,i=((o=t.data.musicSheetSoundList)==null?void 0:o[e])||{},r=((a=t.data.musicSheetAccompanimentList)==null?void 0:a[0])||{},s={...t.data,music:i.audioFileUrl||"",accompany:r.audioFileUrl||"",musicSheetId:i.musicSheetId||t.data.bizId,track:i.track||""};console.log("🚀 ~ musicInfo:",s),setState(s,e)},setState=(t,e)=>{var m,d,g,y,b,S,E,x,A,_,P,T,M,C;state.appName="COLEXIU",state.detailId=t.bizId,state.xmlUrl=t.xmlFileUrl,state.partIndex=e,state.trackId=t.track,state.subjectId=t.subjectIds?(m=t.subjectIds.split(","))==null?void 0:m[0]:0;const i=t.subjectCodes?(d=t.subjectCodes.split(","))==null?void 0:d[0]:"";let r=t.musicalInstrumentIdCodes?(g=t.musicalInstrumentIdCodes.split(","))==null?void 0:g[0]:"";const s=musicalInstrumentCodeInfo.find(I=>I.code.toLocaleLowerCase()===i.toLocaleLowerCase()),o=musicalInstrumentCodeInfo.find(I=>I.code.toLocaleLowerCase()===r.toLocaleLowerCase());if(state.subjectCodeId=s?s.id:0,state.musicalCodeId=o?o.id:0,state.categoriesId=t.musicCategoryId,state.categoriesName=t.musicTagNames,state.examSongId=t.bizId+"",state.cbsExamSongId=t.id+"",state.examSongName=t.name,state.coverImg=(y=t.musicCover)!=null?y:"",state.isCombineRender=t.musicSheetType==="SINGLE"&&((b=t.musicSheetSoundList)==null?void 0:b.length)>1,setCustom(state.isCombineRender?(S=t.musicSheetSoundList)==null?void 0:S.length:0),t.extConfigJson)try{state.extConfigJson=JSON.parse(t.extConfigJson)}catch(I){console.error("解析扩展字段错误:",I)}state.gradualTimes=state.extConfigJson.gradualTimes,state.repeatedBeats=state.extConfigJson.repeatedBeats||0,state.needTick=!!(t.isUseSystemBeat&&t.isPlayBeat),state.isOpenMetronome=!!(t.isPlayBeat&&!t.isUseSystemBeat),state.isShowFingering=!!t.isShowFingering,state.isAppPlay=t.playMode==="MIDI",state.music=t.music,state.accompany=t.accompany,state.midiUrl=t.midiFileUrl,state.parentCategoriesId=t.musicTag,state.musicSheetCategoriesId=t.musicCategoryId,state.bizMusicCategoryId=t.bizMusicCategoryId,state.playMode=t.playMode==="MP3"?"MP3":"MIDI",state.originSpeed=state.speed=t.playSpeed;const a=t.code||t.track;state.track=a?a.replace(/ /g,"").toLocaleLowerCase():"",state.isAppPlay?state.enableEvaluation=!!state.midiUrl:state.enableEvaluation=!!state.accompany,state.isConcert=t.musicSheetType==="CONCERT",state.canSelectTracks=t.multiTracksSelection==="null"||t.multiTracksSelection===""||t.multiTracksSelection===null?[]:(E=t.multiTracksSelection)==null?void 0:E.split(","),state.isOpenPrepare=!0,state.extStyleConfigJson=t.extStyleConfigJson||{},state.isPercussion=t.evaluationStandard==="AMPLITUDE"||t.evaluationStandard==="DECIBELS",state.evaluationStandard=((x=t.evaluationStandard)==null?void 0:x.toLocaleLowerCase())||"",state.isSpecialBookCategory=!classids.includes(Number(t.musicCategoryId));const l=state.isConcert?matchVoicePart(state.trackId,"CONCERT"):matchVoicePart(state.musicalCodeId,"SINGLE");state.fingeringInfo=subjectFingering(l),console.log("🚀 ~ state.fingeringInfo:",l,state.fingeringInfo,state.trackId,state.track),state.musicalCodeId=((A=state.fingeringInfo)==null?void 0:A.id)||0,state.musicalCode=((_=musicalInstrumentCodeInfo.find(I=>I.id===state.musicalCodeId))==null?void 0:_.code)||state.trackId,window.DYSubjectId=state.musicalCodeId,window.customSectionAmount=!0,!state.fingeringInfo.name&&state.setting.displayFingering&&(state.setting.displayFingering=!1),(!state.music||!state.accompany)&&(state.playSource=state.music?"music":"background"),state.platform=((P=query$1.platform)==null?void 0:P.toLocaleUpperCase())||"",state.platform==="PC"&&(state.zoom=query$1.zoom||1.5);let c=null;state.isConcert?(r=(T=musicalInstrumentCodeInfo.find(I=>I.id===state.musicalCodeId))==null?void 0:T.code,c=(M=t.musicalInstruments)==null?void 0:M.find(I=>I.code===r)):c=(C=t.musicalInstruments)==null?void 0:C.find(I=>I.code===r);let u="";c!=null&&c.defaultScore&&(u=(c==null?void 0:c.defaultScore)==="STAVE"?"staff":(c==null?void 0:c.defaultScore)==="JIAN"?"fixedTone":(c==null?void 0:c.defaultScore)==="FIRST"?"firstTone":""),state.musicRenderType=query$1.musicRenderType||u||"firstTone",state.enableNotation=c?t.isConvertibleScore&&c.transferFlag:t.isConvertibleScore,console.log("state对象",state),state.baseFrequency=t.evaluationFrequency?t.evaluationFrequency.split(",")[0]:440,state.baseFrequency=Number(state.baseFrequency),Math.abs(state.setting.frequency-state.baseFrequency)>10?state.setting.frequency=state.baseFrequency>=0?state.baseFrequency:440:state.setting.frequency=state.setting.frequency||state.baseFrequency},setCustom=t=>{(t||state.extConfigJson.multitrack)&&setGlobalData("multitrack",t||state.extConfigJson.multitrack)},followBeatPaly=()=>{let t=null;if(!followData.start){clearTimeout(t),t=null;return}const e=state.measureTime*1e3/metronomeData.totalNumerator;requestAnimationFrame(()=>{var r;Date.now()-state.beatStartTime-1?"text/plain; charset=x-user-defined":"application/xml";if(XMLHttpRequest)r=new XMLHttpRequest;else if(ActiveXObject)r=new ActiveXObject("Microsoft.XMLHTTP");else return Promise.reject(new Error("XMLHttp not supported."));return r.timeout=i,new Promise((o,a)=>{r.onreadystatechange=()=>{r.readyState===XMLHttpRequest.DONE&&(r.status===200||r.status===0&&r.responseText?o(r.responseText):a(new Error("Could not retrieve requested URL "+r.status)))},r.ontimeout=l=>{a(new Error("Server request Timeout"))},r.overrideMimeType(s),r.open("GET",e,!0),r.send()})}}const _Fraction=class{constructor(t=0,e=1,i=0,r=!0){this.numerator=0,this.denominator=1,this.wholeValue=0,this.numerator=t,this.denominator=e,this.wholeValue=i,r&&this.simplify(),this.setRealValue()}static max(t,e){return t.RealValue>e.RealValue?t:e}static Equal(t,e){return t.wholeValue===e.wholeValue&&t.Denominator===e.Denominator&&t.Numerator===e.Numerator}static createFromFraction(t){return new _Fraction(t.numerator,t.denominator,t.wholeValue,!1)}static plus(t,e){const i=t.clone();return i.Add(e),i}static minus(t,e){const i=t.clone();return i.Sub(e),i}static multiply(t,e){return new _Fraction((t.wholeValue*t.denominator+t.numerator)*(e.wholeValue*e.denominator+e.numerator),t.denominator*e.denominator)}static greatestCommonDenominator(t,e){if(t===0)return e;if(e===1)return 1;for(;Math.abs(e)>1e-8;)t>e?t-=e:e-=t;return Math.round(t)}toString(){let t=this.numerator+"/"+this.denominator;return this.wholeValue!==0&&(t=this.wholeValue+" "+t),t}clone(){return new _Fraction(this.numerator,this.denominator,this.wholeValue,!1)}get Numerator(){return this.numerator}set Numerator(t){this.numerator!==t&&(this.numerator=t,this.simplify(),this.setRealValue())}get Denominator(){return this.denominator}set Denominator(t){this.denominator!==t&&(this.denominator=t,this.numerator!==0&&this.simplify(),this.setRealValue())}get WholeValue(){return this.wholeValue}set WholeValue(t){this.wholeValue!==t&&(this.wholeValue=t,this.setRealValue())}GetExpandedNumerator(){return this.wholeValue*this.denominator+this.numerator}calculateNumberOfNeededDots(){let t=1,e=2;const i=this.GetExpandedNumerator();for(;et;)e.Numerator++;if(this.numerator>this.denominator){const i=new _Fraction(this.numerator-1,this.denominator,this.wholeValue);for(;i.Denominator>t;)i.Numerator--;if(i.Denominator_Fraction.maximumAllowedNumber){const i=this.denominator/_Fraction.maximumAllowedNumber;this.numerator=Math.round(this.numerator/i),this.denominator=Math.round(this.denominator/i)}if(this.numerator>_Fraction.maximumAllowedNumber){const i=this.numerator/_Fraction.maximumAllowedNumber;this.numerator=Math.round(this.numerator/i),this.denominator=Math.round(this.denominator/i)}}isOnBeat(t){const e=this.distanceFromBeat(t);return Math.abs(e)<_Fraction.FloatInaccuracyTolerance}distanceFromBeat(t){const e=new _Fraction(1,t.Denominator);return this.RealValue%e.RealValue}};let Fraction$1=_Fraction;Fraction$1.maximumAllowedNumber=46340;Fraction$1.FloatInaccuracyTolerance=1e-4;class AbstractExpression{constructor(e){this.placement=e}static isStringInStringList(e,i){for(let r=0,s=e.length;r(t[t.Above=0]="Above",t[t.Below=1]="Below",t[t.Left=2]="Left",t[t.Right=3]="Right",t[t.NotYetDefined=4]="NotYetDefined",t[t.AboveOrBelow=5]="AboveOrBelow",t))(PlacementEnum||{});const _ContinuousDynamicExpression=class extends AbstractExpression{constructor(t,e,i,r,s,o,a=""){super(e),super.parentMeasure=r,this.NumberXml=o,this.dynamicType=t,this.label=a,this.staffNumber=i,this.activeInstantaneousDynamic=s,this.startVolume=1,this.endVolume=1,this.setStartAndEndVolume(),a!==""&&this.setType()}setStartAndEndVolume(){this.activeInstantaneousDynamic&&(this.dynamicType===0&&(this.startVolume=this.activeInstantaneousDynamic.Volume,this.endVolume=this.activeInstantaneousDynamic.Volume*1.2),this.dynamicType===1&&(this.startVolume=this.activeInstantaneousDynamic.Volume,this.endVolume=this.activeInstantaneousDynamic.Volume*.8))}get DynamicType(){return this.dynamicType}set DynamicType(t){this.dynamicType=t}get StartMultiExpression(){return this.startMultiExpression}set StartMultiExpression(t){this.startMultiExpression=t}get EndMultiExpression(){return this.endMultiExpression}set EndMultiExpression(t){this.endMultiExpression=t}get Placement(){return this.placement}set Placement(t){this.placement=t}get StartVolume(){return this.startVolume}set StartVolume(t){this.startVolume=t}get EndVolume(){return this.endVolume}set EndVolume(t){this.endVolume=t}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t}get Label(){return this.label}set Label(t){this.label=t,this.setType()}static isInputStringContinuousDynamic(t){return t?_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicIncreasing,t)||_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicDecreasing,t):!1}getInterpolatedDynamic(t){const e=this.StartMultiExpression.AbsoluteTimestamp;let i;if(this.EndMultiExpression?i=this.EndMultiExpression.AbsoluteTimestamp:i=Fraction$1.plus(this.startMultiExpression.SourceMeasureParent.AbsoluteTimestamp,this.startMultiExpression.SourceMeasureParent.Duration),t.lt(e))return-1;if(i.lt(t))return-2;const r=Fraction$1.minus(t,e).RealValue/Fraction$1.minus(i,e).RealValue;return Math.max(0,Math.min(99.9,this.startVolume+(this.endVolume-this.startVolume)*r))}isWedge(){return!this.label}setType(){_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicIncreasing,this.label)?this.dynamicType=0:_ContinuousDynamicExpression.isStringInStringList(_ContinuousDynamicExpression.listContinuousDynamicDecreasing,this.label)&&(this.dynamicType=1)}};let ContinuousDynamicExpression=_ContinuousDynamicExpression;ContinuousDynamicExpression.listContinuousDynamicIncreasing=["crescendo","cresc","cresc.","cres."];ContinuousDynamicExpression.listContinuousDynamicDecreasing=["decrescendo","decresc","decr.","diminuendo","dim.","dim"];var ContDynamicEnum=(t=>(t[t.crescendo=0]="crescendo",t[t.diminuendo=1]="diminuendo",t))(ContDynamicEnum||{}),DynamicExpressionSymbolEnum=(t=>(t[t.p=0]="p",t[t.f=1]="f",t[t.s=2]="s",t[t.z=3]="z",t[t.m=4]="m",t[t.r=5]="r",t))(DynamicExpressionSymbolEnum||{});class MusicSheetReadingException{constructor(e,i){this.message=e,i&&(this.message+=" "+i.toString())}}class ArgumentOutOfRangeException{constructor(e){this.message=e}}class InvalidEnumArgumentException{constructor(e){this.message=e}}var loglevelExports={},loglevel={get exports(){return loglevelExports},set exports(t){loglevelExports=t}};(function(t){(function(e,i){t.exports?t.exports=i():e.log=i()})(commonjsGlobal,function(){var e=function(){},i="undefined",r=typeof window!==i&&typeof window.navigator!==i&&/Trident\/|MSIE /.test(window.navigator.userAgent),s=["trace","debug","info","warn","error"],o={},a=null;function l(S,E){var x=S[E];if(typeof x.bind=="function")return x.bind(S);try{return Function.prototype.bind.call(x,S)}catch(A){return function(){return Function.prototype.apply.apply(x,[S,arguments])}}}function c(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function u(S){return S==="debug"&&(S="log"),typeof console===i?!1:S==="trace"&&r?c:console[S]!==void 0?l(console,S):console.log!==void 0?l(console,"log"):e}function m(){for(var S=this.getLevel(),E=0;E=0&&N<=x.levels.SILENT)return N;throw new TypeError("log.setLevel() called with invalid level: "+$)}x.name=S,x.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},x.methodFactory=E||g,x.getLevel=function(){return P!=null?P:_!=null?_:A},x.setLevel=function($,N){return P=D($),N!==!1&&M(P),m.call(x)},x.setDefaultLevel=function($){_=D($),C()||x.setLevel($,!1)},x.resetLevel=function(){P=null,I(),m.call(x)},x.enableAll=function($){x.setLevel(x.levels.TRACE,$)},x.disableAll=function($){x.setLevel(x.levels.SILENT,$)},x.rebuild=function(){if(a!==x&&(A=D(a.getLevel())),m.call(x),a===x)for(var $ in o)o[$].rebuild()},A=D(a?a.getLevel():"WARN");var G=C();G!=null&&(P=D(G)),m.call(x)}a=new y,a.getLogger=function(E){if(typeof E!="symbol"&&typeof E!="string"||E==="")throw new TypeError("You must supply a name when creating a logger.");var x=o[E];return x||(x=o[E]=new y(E,a.methodFactory)),x};var b=typeof window!==i?window.log:void 0;return a.noConflict=function(){return typeof window!==i&&window.log===a&&(window.log=b),a},a.getLoggers=function(){return o},a.default=a,a})})(loglevel);var lib$3={},arrays$4={},util$b={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Object.prototype.hasOwnProperty;t.has=function(d,g){return e.call(d,g)};function i(d,g){return d"u"}t.isUndefined=l;function c(d){return Object.prototype.toString.call(d)==="[object String]"}t.isString=c;function u(d){return l(d)||!a(d)?function(g,y){return g=0;o--)if(r(t[o],e))return o;return-1}arrays$4.lastIndexOf=lastIndexOf;function contains(t,e,i){return indexOf$1(t,e,i)>=0}arrays$4.contains=contains;function remove(t,e,i){var r=indexOf$1(t,e,i);return r<0?!1:(t.splice(r,1),!0)}arrays$4.remove=remove;function frequency(t,e,i){for(var r=i||util$a.defaultEquals,s=t.length,o=0,a=0;a=t.length||i<0||i>=t.length)return!1;var r=t[e];return t[e]=t[i],t[i]=r,!0}arrays$4.swap=swap;function toString$1(t){return"["+t.toString()+"]"}arrays$4.toString=toString$1;function forEach(t,e){for(var i=0,r=t;ie.size())return!1;var i=!0;return this.forEach(function(r){return e.contains(r)?!0:(i=!1,!1)}),i},t.prototype.remove=function(e){return this.contains(e)?(this.dictionary.remove(e),!0):!1},t.prototype.forEach=function(e){this.dictionary.forEach(function(i,r){return e(r)})},t.prototype.toArray=function(){return this.dictionary.values()},t.prototype.isEmpty=function(){return this.dictionary.isEmpty()},t.prototype.size=function(){return this.dictionary.size()},t.prototype.clear=function(){this.dictionary.clear()},t.prototype.toString=function(){return arrays$3.toString(this.toArray())},t}();_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 t(e){this.toStrF=e||util$7.defaultToString,this.dictionary=new Dictionary_1$4.default(this.toStrF),this.nElements=0}return t.prototype.add=function(e,i){if(i===void 0&&(i=1),util$7.isUndefined(e)||i<=0)return!1;if(this.contains(e))this.dictionary.getValue(e).copies+=i;else{var r={value:e,copies:i};this.dictionary.setValue(e,r)}return this.nElements+=i,!0},t.prototype.count=function(e){return this.contains(e)?this.dictionary.getValue(e).copies:0},t.prototype.contains=function(e){return this.dictionary.containsKey(e)},t.prototype.remove=function(e,i){if(i===void 0&&(i=1),util$7.isUndefined(e)||i<=0)return!1;if(this.contains(e)){var r=this.dictionary.getValue(e);return i>r.copies?this.nElements-=r.copies:this.nElements-=i,r.copies-=i,r.copies<=0&&this.dictionary.remove(e),!0}else return!1},t.prototype.toArray=function(){for(var e=[],i=this.dictionary.values(),r=0,s=i;rthis.nElements||util$6.isUndefined(e))return!1;var r=this.createNode(e);if(this.nElements===0||this.lastNode===null)this.firstNode=r,this.lastNode=r;else if(i===this.nElements)this.lastNode.next=r,this.lastNode=r;else if(i===0)r.next=this.firstNode,this.firstNode=r;else{var s=this.nodeAtIndex(i-1);if(s===null)return!1;r.next=s.next,s.next=r}return this.nElements++,!0},t.prototype.first=function(){if(this.firstNode!==null)return this.firstNode.element},t.prototype.last=function(){if(this.lastNode!==null)return this.lastNode.element},t.prototype.elementAtIndex=function(e){var i=this.nodeAtIndex(e);if(i!==null)return i.element},t.prototype.indexOf=function(e,i){var r=i||util$6.defaultEquals;if(util$6.isUndefined(e))return-1;for(var s=this.firstNode,o=0;s!==null;){if(r(s.element,e))return o;o++,s=s.next}return-1},t.prototype.contains=function(e,i){return this.indexOf(e,i)>=0},t.prototype.remove=function(e,i){var r=i||util$6.defaultEquals;if(this.nElements<1||util$6.isUndefined(e))return!1;for(var s=null,o=this.firstNode;o!==null;){if(r(o.element,e))return s===null?(this.firstNode=o.next,o===this.lastNode&&(this.lastNode=null)):o===this.lastNode?(this.lastNode=s,s.next=o.next,o.next=null):(s.next=o.next,o.next=null),this.nElements--,!0;s=o,o=o.next}return!1},t.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},t.prototype.equals=function(e,i){var r=i||util$6.defaultEquals;return!(e instanceof t)||this.size()!==e.size()?!1:this.equalsAux(this.firstNode,e.firstNode,r)},t.prototype.equalsAux=function(e,i,r){for(;e!==null&&i!==null;){if(!r(e.element,i.element))return!1;e=e.next,i=i.next}return!0},t.prototype.removeElementAtIndex=function(e){if(!(e<0||e>=this.nElements||this.firstNode===null||this.lastNode===null)){var i;if(this.nElements===1)i=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var r=this.nodeAtIndex(e-1);r===null?(i=this.firstNode.element,this.firstNode=this.firstNode.next):r.next===this.lastNode&&(i=this.lastNode.element,this.lastNode=r),r!==null&&r.next!==null&&(i=r.next.element,r.next=r.next.next)}return this.nElements--,i}},t.prototype.forEach=function(e){for(var i=this.firstNode;i!==null&&e(i.element)!==!1;)i=i.next},t.prototype.reverse=function(){for(var e=null,i=this.firstNode,r=null;i!==null;)r=i.next,i.next=e,e=i,i=r;r=this.firstNode,this.firstNode=this.lastNode,this.lastNode=r},t.prototype.toArray=function(){for(var e=[],i=this.firstNode;i!==null;)e.push(i.element),i=i.next;return e},t.prototype.size=function(){return this.nElements},t.prototype.isEmpty=function(){return this.nElements<=0},t.prototype.toString=function(){return arrays$2.toString(this.toArray())},t.prototype.nodeAtIndex=function(e){if(e<0||e>=this.nElements)return null;if(e===this.nElements-1)return this.lastNode;for(var i=this.firstNode,r=0;r0&&(e=e.rightCh);return e},t.prototype.transplant=function(e,i){e.parent===null?this.root=i:e===e.parent.leftCh?e.parent.leftCh=i:e.parent.rightCh=i,i!==null&&(i.parent=e.parent)},t.prototype.removeNode=function(e){if(e.leftCh===null)this.transplant(e,e.rightCh);else if(e.rightCh===null)this.transplant(e,e.leftCh);else{var i=this.minimumAux(e.rightCh);i.parent!==e&&(this.transplant(i,i.rightCh),i.rightCh=e.rightCh,i.rightCh.parent=i),this.transplant(e,i),i.leftCh=e.leftCh,i.leftCh.parent=i}},t.prototype.inorderTraversalAux=function(e,i,r){e===null||r.stop||(this.inorderTraversalAux(e.leftCh,i,r),!r.stop&&(r.stop=i(e.element)===!1,!r.stop&&this.inorderTraversalAux(e.rightCh,i,r)))},t.prototype.levelTraversalAux=function(e,i){var r=new Queue_1$1.default;for(e!==null&&r.enqueue(e),e=r.dequeue()||null;e!=null;){if(i(e.element)===!1)return;e.leftCh!==null&&r.enqueue(e.leftCh),e.rightCh!==null&&r.enqueue(e.rightCh),e=r.dequeue()||null}},t.prototype.preorderTraversalAux=function(e,i,r){e===null||r.stop||(r.stop=i(e.element)===!1,!r.stop&&(this.preorderTraversalAux(e.leftCh,i,r),!r.stop&&this.preorderTraversalAux(e.rightCh,i,r)))},t.prototype.postorderTraversalAux=function(e,i,r){e===null||r.stop||(this.postorderTraversalAux(e.leftCh,i,r),!r.stop&&(this.postorderTraversalAux(e.rightCh,i,r),!r.stop&&(r.stop=i(e.element)===!1)))},t.prototype.minimumAux=function(e){for(;e!=null&&e.leftCh!==null;)e=e.leftCh;return e},t.prototype.maximumAux=function(e){for(;e!=null&&e.rightCh!==null;)e=e.rightCh;return e},t.prototype.heightAux=function(e){return e===null?-1:Math.max(this.heightAux(e.leftCh),this.heightAux(e.rightCh))+1},t.prototype.insertNode=function(e){for(var i=null,r=this.root;r!==null;){var s=this.compare(e.element,r.element);if(s===0)return null;s<0?(i=r,r=r.leftCh):(i=r,r=r.rightCh)}return e.parent=i,i===null?this.root=e:this.compare(e.element,i.element)<0?i.leftCh=e:i.rightCh=e,e},t.prototype.createNode=function(e){return{element:e,leftCh:null,rightCh:null,parent:null}},t}();BSTreeKV$1.default=BSTreeKV;var __extends$2=commonjsGlobal&&commonjsGlobal.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])};return function(e,i){t(e,i);function r(){this.constructor=e}e.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(BSTree$1,"__esModule",{value:!0});var BSTreeKV_1$1=BSTreeKV$1,BSTree=function(t){__extends$2(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(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 t(e){this.data=[],this.compare=e||collections.defaultCompare}return t.prototype.leftChildIndex=function(e){return 2*e+1},t.prototype.rightChildIndex=function(e){return 2*e+2},t.prototype.parentIndex=function(e){return Math.floor((e-1)/2)},t.prototype.minIndex=function(e,i){return i>=this.data.length?e>=this.data.length?-1:e:this.compare(this.data[e],this.data[i])<=0?e:i},t.prototype.siftUp=function(e){for(var i=this.parentIndex(e);e>0&&this.compare(this.data[i],this.data[e])>0;)arrays$1.swap(this.data,i,e),e=i,i=this.parentIndex(e)},t.prototype.siftDown=function(e){for(var i=this.minIndex(this.leftChildIndex(e),this.rightChildIndex(e));i>=0&&this.compare(this.data[e],this.data[i])>0;)arrays$1.swap(this.data,i,e),e=i,i=this.minIndex(this.leftChildIndex(e),this.rightChildIndex(e))},t.prototype.peek=function(){if(this.data.length>0)return this.data[0]},t.prototype.add=function(e){return collections.isUndefined(e)?!1:(this.data.push(e),this.siftUp(this.data.length-1),!0)},t.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}},t.prototype.contains=function(e){var i=collections.compareToEquals(this.compare);return arrays$1.contains(this.data,e,i)},t.prototype.size=function(){return this.data.length},t.prototype.isEmpty=function(){return this.data.length<=0},t.prototype.clear=function(){this.data.length=0},t.prototype.forEach=function(e){arrays$1.forEach(this.data,e)},t}();Heap$1.default=Heap;var LinkedDictionary$1={},__extends$1=commonjsGlobal&&commonjsGlobal.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])};return function(e,i){t(e,i);function r(){this.constructor=e}e.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(LinkedDictionary$1,"__esModule",{value:!0});var Dictionary_1$3=Dictionary$2,util$4=util$b,LinkedDictionaryPair=function(){function t(e,i){this.key=e,this.value=i}return t.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},t}(),HeadOrTailLinkedDictionaryPair=function(){function t(){this.key=null,this.value=null}return t.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},t}();function isHeadOrTailLinkedDictionaryPair(t){return!t.next}var LinkedDictionary=function(t){__extends$1(e,t);function e(i){var r=t.call(this,i)||this;return r.head=new HeadOrTailLinkedDictionaryPair,r.tail=new HeadOrTailLinkedDictionaryPair,r.head.next=r.tail,r.tail.prev=r.head,r}return e.prototype.appendToTail=function(i){var r=this.tail.prev;r.next=i,i.prev=r,i.next=this.tail,this.tail.prev=i},e.prototype.getLinkedDictionaryPair=function(i){if(!util$4.isUndefined(i)){var r="$"+this.toStr(i),s=this.table[r];return s}},e.prototype.getValue=function(i){var r=this.getLinkedDictionaryPair(i);if(!util$4.isUndefined(r))return r.value},e.prototype.remove=function(i){var r=this.getLinkedDictionaryPair(i);if(!util$4.isUndefined(r))return t.prototype.remove.call(this,i),r.unlink(),r.value},e.prototype.clear=function(){t.prototype.clear.call(this),this.head.next=this.tail,this.tail.prev=this.head},e.prototype.replace=function(i,r){var s="$"+this.toStr(r.key);r.next=i.next,r.prev=i.prev,this.remove(i.key),r.prev.next=r,r.next.prev=r,this.table[s]=r,++this.nElements},e.prototype.setValue=function(i,r){if(!(util$4.isUndefined(i)||util$4.isUndefined(r))){var s=this.getLinkedDictionaryPair(i),o=new LinkedDictionaryPair(i,r),a="$"+this.toStr(i);if(util$4.isUndefined(s)){this.appendToTail(o),this.table[a]=o,++this.nElements;return}else return this.replace(s,o),s.value}},e.prototype.keys=function(){var i=[];return this.forEach(function(r,s){i.push(r)}),i},e.prototype.values=function(){var i=[];return this.forEach(function(r,s){i.push(s)}),i},e.prototype.forEach=function(i){for(var r=this.head.next;!isHeadOrTailLinkedDictionaryPair(r);){var s=i(r.key,r.value);if(s===!1)return;r=r.next}},e}(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 t(e,i,r){r===void 0&&(r=!1),this.dict=new Dictionary_1$2.default(e),this.equalsF=i||util$3.defaultEquals,this.allowDuplicate=r}return t.prototype.getValue=function(e){var i=this.dict.getValue(e);return util$3.isUndefined(i)?[]:arrays.copy(i)},t.prototype.setValue=function(e,i){if(util$3.isUndefined(e)||util$3.isUndefined(i))return!1;var r=this.dict.getValue(e);return util$3.isUndefined(r)?(this.dict.setValue(e,[i]),!0):!this.allowDuplicate&&arrays.contains(r,i,this.equalsF)?!1:(r.push(i),!0)},t.prototype.remove=function(e,i){if(util$3.isUndefined(i)){var r=this.dict.remove(e);return!util$3.isUndefined(r)}var s=this.dict.getValue(e);return!util$3.isUndefined(s)&&arrays.remove(s,i,this.equalsF)?(s.length===0&&this.dict.remove(e),!0):!1},t.prototype.keys=function(){return this.dict.keys()},t.prototype.values=function(){for(var e=this.dict.values(),i=[],r=0,s=e;r-1&&this.insertIdIntoRoot(i,r);for(var s in this.nodes)if(this.nodes.hasOwnProperty(s)){var o=this.findNodeId(s,e);o>-1&&this.insertIdIntoNode(s,i,o)}},t.prototype.insertIdAfterId=function(e,i){var r=this.findRootId(e);r>-1&&this.insertIdIntoRoot(i,r+1);for(var s in this.nodes)if(this.nodes.hasOwnProperty(s)){var o=this.findNodeId(s,e);o>-1&&this.insertIdIntoNode(s,i,o+1)}},t.prototype.insertIdIntoId=function(e,i){this.nodeInsertAtEnd(e,i),this.nodes[i]=[]},t.prototype.insertIdIntoRoot=function(e,i){if(i===void 0)this.rootInsertAtEnd(e);else if(i<0){var r=this.rootIds.length;this.rootIds.splice(i+r+1,0,e)}else this.rootIds.splice(i,0,e);this.nodes[e]=this.nodes[e]||[]},t.prototype.insertIdIntoNode=function(e,i,r){if(this.nodes[e]=this.nodes[e]||[],this.nodes[i]=this.nodes[i]||[],r===void 0)this.nodeInsertAtEnd(e,i);else if(r<0){var s=this.nodes[e].length;this.nodes[e].splice(r+s+1,0,i)}else this.nodes[e].splice(r,0,i)},t.prototype.moveId=function(e,i,r){var s=e,o=this.findRootId(s);this.nodes[i];for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){this.findNodeId(a,i);break}var l=i,c=this.findRootId(l);this.nodes[i];for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){this.findNodeId(a,i);break}if(o>-1)if(c>-1)switch(this.rootDelete(o),c>o&&c--,r){case Direction.BEFORE:this.insertIdIntoRoot(s,c);break;case Direction.AFTER:this.insertIdIntoRoot(s,c+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(l,s);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(l,s);break}else{this.rootDelete(o);for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){var u=this.findNodeId(a,l);if(u>-1){switch(r){case Direction.BEFORE:this.insertIdIntoNode(a,s,u);break;case Direction.AFTER:this.insertIdIntoNode(a,s,u+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(l,s);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(l,s);break}break}}}else if(c>-1){for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){var u=this.findNodeId(a,s);if(u>-1){this.nodeDeleteAtIndex(a,u);break}}switch(r){case Direction.BEFORE:this.insertIdIntoRoot(s,c);break;case Direction.AFTER:this.insertIdIntoRoot(s,c+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(l,s);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(l,s);break}}else{for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){var u=this.findNodeId(a,s);if(u>-1){this.nodeDeleteAtIndex(a,u);break}}for(var a in this.nodes)if(this.nodes.hasOwnProperty(a)){var u=this.findNodeId(a,l);if(u>-1){switch(r){case Direction.BEFORE:this.insertIdIntoNode(a,s,u);break;case Direction.AFTER:this.insertIdIntoNode(a,s,u+1);break;case Direction.INSIDE_AT_START:this.nodeInsertAtStart(l,s);break;case Direction.INSIDE_AT_END:this.nodeInsertAtEnd(l,s);break}break}}}},t.prototype.swapArrayElements=function(e,i,r){var s=e[i];return e[i]=e[r],e[r]=s,e},t.prototype.rootDeleteId=function(e){var i=this.findRootId(e);i>-1&&this.rootDelete(i)},t.prototype.nodeAndSubNodesDelete=function(e){for(var i=[],r=0;r(t[t.pppppp=0]="pppppp",t[t.ppppp=1]="ppppp",t[t.pppp=2]="pppp",t[t.ppp=3]="ppp",t[t.pp=4]="pp",t[t.p=5]="p",t[t.mp=6]="mp",t[t.mf=7]="mf",t[t.f=8]="f",t[t.ff=9]="ff",t[t.fff=10]="fff",t[t.ffff=11]="ffff",t[t.fffff=12]="fffff",t[t.ffffff=13]="ffffff",t[t.sf=14]="sf",t[t.sff=15]="sff",t[t.sfp=16]="sfp",t[t.sfpp=17]="sfpp",t[t.fp=18]="fp",t[t.rf=19]="rf",t[t.rfz=20]="rfz",t[t.sfz=21]="sfz",t[t.sffz=22]="sffz",t[t.fz=23]="fz",t[t.other=24]="other",t))(DynamicEnum||{});InstantaneousDynamicExpression.staticConstructor();class DynamicsContainer{constructor(e,i){e instanceof ContinuousDynamicExpression?this.continuousDynamicExpression=e:e instanceof InstantaneousDynamicExpression&&(this.instantaneousDynamicExpression=e),this.staffNumber=i}static Compare(e,i){return e.parMultiExpression().AbsoluteTimestamp.CompareTo(i.parMultiExpression().AbsoluteTimestamp)}parMultiExpression(){if(this.continuousDynamicExpression)return this.continuousDynamicExpression.StartMultiExpression;if(this.instantaneousDynamicExpression)return this.instantaneousDynamicExpression.ParentMultiExpression}}class AbstractNotationInstruction{constructor(e){this.printObject=!0,this.parent=e}get Parent(){return this.parent}set Parent(e){this.parent=e}get PrintObject(){return this.printObject}set PrintObject(e){this.printObject=e}}class RhythmInstruction extends AbstractNotationInstruction{constructor(e,i){super(void 0),this.rhythm=e,this.numerator=e.Numerator,this.denominator=e.Denominator,this.symbolEnum=i}get Rhythm(){return this.rhythm}set Rhythm(e){this.rhythm=e}get SymbolEnum(){return this.symbolEnum}set SymbolEnum(e){this.symbolEnum=e}clone(){return new RhythmInstruction(this.rhythm.clone(),this.symbolEnum)}OperatorEquals(e){const i=this;return i===e?!0:!i||!e?!1:i.numerator===e.numerator&&i.denominator===e.denominator}OperatorNotEqual(e){return this!==e}ToString(){return"Rhythm: "+this.rhythm.toString()}}var RhythmSymbolEnum=(t=>(t[t.NONE=0]="NONE",t[t.COMMON=1]="COMMON",t[t.CUT=2]="CUT",t))(RhythmSymbolEnum||{});class MusicPartManagerIterator{constructor(e,i,r){this.currentMeasureIndex=0,this.currentPartIndex=0,this.currentVoiceEntryIndex=-1,this.currentDynamicEntryIndex=0,this.currentTempoEntryIndex=0,this.currentDynamicChangingExpressions=[],this.repetitionIterationCountDictKeys=[],this.repetitionIterationCountDictValues=[],this.currentRepetition=void 0,this.endReached=!1,this.frontReached=!1,this.currentTimeStamp=new Fraction$1(0,1),this.currentEnrolledMeasureTimestamp=new Fraction$1(0,1),this.currentRelativeInMeasureTimestamp=new Fraction$1(0,1),this.currentVerticalContainerInMeasureTimestamp=new Fraction$1(0,1),this.jumpResponsibleRepetition=void 0,this.activeDynamicExpressions=[];try{this.frontReached=!0,this.musicSheet=e,this.currentBpm=e.userStartTempoInBPM,this.currentVoiceEntries=void 0,this.frontReached=!1;for(const s of this.musicSheet.Repetitions)this.setRepetitionIterationCount(s,1);for(let s=0;s=this.JumpResponsibleRepetition.StartIndex&&s.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(s)}}handleRepetitionsAtMeasureEnd(){for(let e=0,i=this.currentMeasure.LastRepetitionInstructions.length;e-1&&this.getRepetitionIterationCount(s)=this.JumpResponsibleRepetition.StartIndex&&s.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(s),this.repetitionIterationCountDictKeys.contains(s))){const o=s.getForwardJumpTargetForIteration(this.getRepetitionIterationCount(s));if(o>=0){this.currentMeasureIndex=o,this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.jumpResponsibleRepetition=s,this.forwardJumpOccurred=!0;return}o===-2&&(this.endReached=!0)}}}this.currentMeasureIndex++,this.JumpResponsibleRepetition!==void 0&&this.currentMeasureIndex>this.JumpResponsibleRepetition.EndIndex&&(this.jumpResponsibleRepetition=void 0)}doBackJump(e){this.currentMeasureIndex=e.getBackwardJumpTarget(),this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.incrementRepetitionIterationCount(e),this.jumpResponsibleRepetition=e,this.backJumpOccurred=!0}activateCurrentRhythmInstructions(){if(this.currentMeasure!==void 0&&this.currentMeasure.FirstInstructionsStaffEntries.length>0&&this.currentMeasure.FirstInstructionsStaffEntries[0]!==void 0){const e=this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions;for(let i=0,r=e.length;i0&&(this.currentDynamicEntryIndex>=e.length||e[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentDynamicEntryIndex--;for(;this.currentDynamicEntryIndex0&&(this.currentTempoEntryIndex>=i.length||i[this.currentTempoEntryIndex].AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentTempoEntryIndex--;for(;this.currentTempoEntryIndex=0&&this.currentVoiceEntryIndex=0&&this.currentMeasureIndex0){if(!e)return!0;for(let r=0,s=i.length;ri&&(this.openSheetMusicDisplay.Sheet.SelectionStart=this.openSheetMusicDisplay.Sheet.SourceMeasures[i].AbsoluteTimestamp),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>r){const o=this.openSheetMusicDisplay.Sheet.SourceMeasures[r];this.openSheetMusicDisplay.Sheet.SelectionEnd=Fraction$1.plus(o.AbsoluteTimestamp,o.Duration)}this.iterator=this.manager.getIterator()}getStaffEntryFromVoiceEntry(e){const i=e.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.measureListIndex,r=e.ParentSourceStaffEntry.ParentStaff.idInMusicSheet;return this.graphic.findGraphicalStaffEntryFromMeasureList(r,i,e.ParentSourceStaffEntry)}updateWithTimestamp(e){const i=this.manager.absoluteEnrolledToSheetTimestamp(e),r=this.graphic.calculateXPositionFromTimestamp(i),s=r[0],o=r[1];this.updateCurrentPageFromSystem(o);const a=r[2];if(!a)return;const l=Math.max(a.parentMeasure.MeasureNumber,1);let c;for(const g of this.graphic.MeasureList[l-1])if(g){c=g;break}const u=this.graphic.calculateCursorPoints(s,o),m=u[0].y,d=u[1].y-m;if(c){if(this.updateWidthAndStyle(c.PositionAndShape,s,m,d),this.openSheetMusicDisplay.FollowCursor){const g=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:g<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}}update(){if(this.hidden||this.hidden===void 0||this.hidden===null)return;this.updateCurrentPage();const e=this.Iterator,i=e.CurrentVisibleVoiceEntries();if(e.EndReached||!e.CurrentVoiceEntries||i.length===0)return;let r=0,s=0,o=0,a;if(e.CurrentMeasure.isReducedToMultiRest){const m=this.graphic.findGraphicalMeasure(e.CurrentMeasureIndex,0),d=m.parentSourceMeasure.multipleRestMeasures,y=e.CurrentMeasure.multipleRestMeasureNumber/(d+1),b=m.PositionAndShape.Size.width-m.beginInstructionsWidth;r=m.PositionAndShape.AbsolutePosition.x+m.beginInstructionsWidth+y*b,a=m.ParentMusicSystem}else{const d=i.map(g=>this.getStaffEntryFromVoiceEntry(g)).sort((g,y)=>{var b,S,E,x;return((S=(b=g==null?void 0:g.PositionAndShape)==null?void 0:b.AbsolutePosition)==null?void 0:S.x)<=((x=(E=y==null?void 0:y.PositionAndShape)==null?void 0:E.AbsolutePosition)==null?void 0:x.x)?-1:1})[0];d&&(r=d.PositionAndShape.AbsolutePosition.x,a=d.parentMeasure.ParentMusicSystem)}if(!a)return;s=a.PositionAndShape.AbsolutePosition.y+a.StaffLines[0].PositionAndShape.RelativePosition.y;const l=a.StaffLines[a.StaffLines.length-1];o=a.PositionAndShape.AbsolutePosition.y+l.PositionAndShape.RelativePosition.y+l.StaffHeight-s;const u=this.graphic.findGraphicalMeasure(e.CurrentMeasureIndex,0).PositionAndShape;if(this.updateWidthAndStyle(u,r,s,o),this.openSheetMusicDisplay.FollowCursor&&this.cursorOptions.follow)if(this.openSheetMusicDisplay.EngravingRules.RenderSingleHorizontalStaffline)this.cursorElement.scrollIntoView({behavior:"smooth",inline:"center"});else{const m=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:m<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}updateWidthAndStyle(e,i,r,s){var c;const o=this.cursorElement;let a=0,l=s;switch(this.cursorOptions.type){case 1:o.style.top=r*10*this.openSheetMusicDisplay.zoom+"px",o.style.left=(i-1.5)*10*this.openSheetMusicDisplay.zoom+"px",l=s*10*this.openSheetMusicDisplay.zoom,o.height=l,o.style.height=l+"px",a=5*this.openSheetMusicDisplay.zoom;break;case 2:o.style.top=(r-2.5)*10*this.openSheetMusicDisplay.zoom+"px",o.style.left=i*10*this.openSheetMusicDisplay.zoom+"px",l=1.5*10*this.openSheetMusicDisplay.zoom,o.height=l,o.style.height=l+"px",a=5*this.openSheetMusicDisplay.zoom;break;case 3:o.style.top=e.AbsolutePosition.y*10*this.openSheetMusicDisplay.zoom+"px",o.style.left=e.AbsolutePosition.x*10*this.openSheetMusicDisplay.zoom+"px",l=s*10*this.openSheetMusicDisplay.zoom,o.height=l,o.style.height=l+"px",a=e.Size.width*10*this.openSheetMusicDisplay.zoom;break;case 4:o.style.top=e.AbsolutePosition.y*10*this.openSheetMusicDisplay.zoom+"px",o.style.left=e.AbsolutePosition.x*10*this.openSheetMusicDisplay.zoom+"px",l=s*10*this.openSheetMusicDisplay.zoom,o.height=l,o.style.height=l+"px",a=(i-e.AbsolutePosition.x)*10*this.openSheetMusicDisplay.zoom;break;default:o.style.top=r*10*this.openSheetMusicDisplay.zoom+"px",o.style.left=(i-1.5)*10*this.openSheetMusicDisplay.zoom+"px",l=s*10*this.openSheetMusicDisplay.zoom,o.height=l,o.style.height=l+"px",a=3*10*this.openSheetMusicDisplay.zoom;break}(c=window.GYM)!=null&&c.multitrack&&(o.height=l+24,o.style.height=l+24+"px"),a!==o.width&&(o.width=a,this.updateStyle(a,this.cursorOptions))}hide(){this.cursorElement.style.display="none",this.hidden=!0}next(){this.Iterator.moveToNextVisibleVoiceEntry(!1),this.update()}reset(){this.resetIterator();const e=this.manager.getIterator(this.graphic.ParentMusicSheet.SelectionStart);this.updateWithTimestamp(e.CurrentEnrolledTimestamp)}updateStyle(e,i=void 0){i!==void 0&&(this.cursorOptions=i);const r=document.createElement("canvas");r.width=this.cursorElement.width,r.height=1;const s=r.getContext("2d");s.globalAlpha=this.cursorOptions.alpha;const o=s.createLinearGradient(0,0,this.cursorElement.width,0);switch(this.cursorOptions.type){case 1:case 2:case 3:case 4:o.addColorStop(1,this.cursorOptions.color);break;default:o.addColorStop(0,"white"),o.addColorStop(.2,this.cursorOptions.color),o.addColorStop(.8,this.cursorOptions.color),o.addColorStop(1,"white");break}s.fillStyle=o,s.fillRect(0,0,e,1),this.cursorElement.src=r.toDataURL("image/png")}get Iterator(){return this.iterator}get Hidden(){return this.hidden}VoicesUnderCursor(e){return this.Iterator.CurrentVisibleVoiceEntries(e)}NotesUnderCursor(e){const i=this.VoicesUnderCursor(e),r=[];return i.forEach(s=>{r.push.apply(r,s.Notes)}),r}GNotesUnderCursor(e){const i=this.VoicesUnderCursor(e),r=[];return i.forEach(s=>{r.push(...s.Notes.map(o=>this.rules.GNote(o)))}),r}updateCurrentPage(){const e=this.Iterator.currentTimeStamp;for(const i of this.graphic.MusicPages)if(i.MusicSystems.last().GetSystemsLastTimeStamp().gt(e)){const s=i.PageNumber;return s!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById(this.rules.DYContainerId+s),this.container.appendChild(this.cursorElement)),this.currentPageNumber=s}return 1}updateCurrentPageFromSystem(e){if(e!=null&&e.Parent){const i=e.Parent.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}return 1}}class PointF2D{constructor(e=0,i=0){this.x=0,this.y=0,this.x=e,this.y=i}static get Empty(){return new PointF2D}static pointsAreEqual(e,i){return e.x===i.x&&e.y===i.y}ToString(){return"["+this.x+", "+this.y+"]"}}class SizeF2D{constructor(e=0,i=0){this.width=e,this.height=i}}class RectangleF2D{constructor(e,i,r,s){this.x=0,this.y=0,this.width=0,this.height=0,this.x=e,this.y=i,this.width=r,this.height=s}static createFromLocationAndSize(e,i){return new RectangleF2D(e.x,e.y,i.width,i.height)}get Location(){return new PointF2D(this.x,this.y)}get Size(){return new SizeF2D(this.width,this.height)}}class AClassHierarchyTrackable{isInstanceOfClass(e){let i=this.constructor.prototype;for(;i;){if(e===i.constructor.name)return!0;i=i.__proto__}return!1}}class GraphicalObject extends AClassHierarchyTrackable{get PositionAndShape(){return this.boundingBox}set PositionAndShape(e){this.boundingBox=e}}class StaffLineActivitySymbol extends GraphicalObject{constructor(e){super(),this.parentStaffLine=e;const i=e.PositionAndShape;this.boundingBox=new BoundingBox$1(this,i),this.boundingBox.BorderRight=6,this.boundingBox.BorderBottom=4.5,this.boundingBox.BorderLeft=-1.5,this.boundingBox.BorderTop=-1.5}}class Clickable extends GraphicalObject{}let BoundingBox$1=class{constructor(e=void 0,i=void 0,r=!1){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=i,this.dataObject=e,this.isSymbol=r,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,i&&(this.Parent=i)}get RelativePositionHasBeenSet(){return this.relativePositionHasBeenSet}get XBordersHaveBeenSet(){return this.xBordersHaveBeenSet}set XBordersHaveBeenSet(e){this.xBordersHaveBeenSet=e}get YBordersHaveBeenSet(){return this.yBordersHaveBeenSet}set YBordersHaveBeenSet(e){this.yBordersHaveBeenSet=e}get AbsolutePosition(){return this.absolutePosition}set AbsolutePosition(e){this.absolutePosition=e}get RelativePosition(){return this.relativePosition}set RelativePosition(e){this.relativePosition=e,this.relativePositionHasBeenSet=!0}get Size(){return this.size}set Size(e){this.size=e}get MarginSize(){return this.marginSize}get UpperLeftCorner(){return this.upperLeftCorner}get UpperLeftMarginCorner(){return this.upperLeftMarginCorner}get BorderLeft(){return this.borderLeft}set BorderLeft(e){this.borderLeft=e,this.calculateRectangle()}get BorderRight(){return this.borderRight}set BorderRight(e){this.borderRight=e,this.calculateRectangle()}get BorderTop(){return this.borderTop}set BorderTop(e){this.borderTop=e,this.calculateRectangle()}get BorderBottom(){return this.borderBottom}set BorderBottom(e){this.borderBottom=e,this.calculateRectangle()}get BorderMarginLeft(){return this.borderMarginLeft>this.borderLeft?this.borderLeft:this.borderMarginLeft}set BorderMarginLeft(e){this.borderMarginLeft=e,this.calculateMarginRectangle()}get BorderMarginRight(){return this.borderMarginRightthis.borderTop?this.borderTop:this.borderMarginTop}set BorderMarginTop(e){this.borderMarginTop=e,this.calculateMarginRectangle()}get BorderMarginBottom(){return this.borderMarginBottom-1&&this.parent.ChildElements.splice(a,1)}this.parent=e,((r=(i=this.parent)==null?void 0:i.ChildElements)==null?void 0:r.indexOf(this))>-1?loglevelExports.error("BoundingBox of "+this.dataObject.constructor.name+" already in children list of "+this.parent.dataObject.constructor.name+"'s BoundingBox"):(o=(s=this.parent)==null?void 0:s.ChildElements)==null||o.push(this)}get DataObject(){return this.dataObject}get Center(){return new PointF2D(this.RelativePosition.x+(this.BorderMarginRight+this.BorderMarginLeft),this.RelativePosition.y+(this.BorderMarginBottom+this.BorderMarginTop))}setAbsolutePositionFromParent(){this.parent?(this.absolutePosition.x=this.parent.AbsolutePosition.x+this.relativePosition.x,this.absolutePosition.y=this.parent.AbsolutePosition.y+this.relativePosition.y):this.absolutePosition=this.relativePosition}calculateAbsolutePosition(){this.absolutePosition.x=this.relativePosition.x,this.absolutePosition.y=this.relativePosition.y;let e=this.parent;for(;e;)this.absolutePosition.x+=e.relativePosition.x,this.absolutePosition.y+=e.relativePosition.y,e=e.parent}calculateAbsolutePositionsRecursiveWithoutTopelement(){this.absolutePosition.x=0,this.absolutePosition.y=0;for(let e=0,i=this.ChildElements.length;e.001;break;case 2:case 3:s=this.relativePosition.y,e.calculateMarginPositionAlongDirection(this,i),o=Math.abs(s-this.relativePosition.y)>.001;break;default:throw new ArgumentOutOfRangeException("direction")}while(o)}collisionDetection(e){const i=Math.min(this.AbsolutePosition.x+this.borderRight,e.absolutePosition.x+e.borderRight)-Math.max(this.AbsolutePosition.x+this.borderLeft,e.absolutePosition.x+e.borderLeft),r=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 i>0&&r>0}liesInsideBorders(e){const i=this.AbsolutePosition.x+this.borderLeft<=e.absolutePosition.x+e.borderLeft&&e.absolutePosition.x+e.borderLeft<=this.AbsolutePosition.x+this.borderRight,r=this.AbsolutePosition.x+this.borderLeft<=e.absolutePosition.x+e.borderRight&&e.absolutePosition.x+e.borderRight<=this.AbsolutePosition.x+this.borderRight;if(i&&r){const s=this.AbsolutePosition.y+this.borderTop<=e.absolutePosition.y+e.borderTop&&e.absolutePosition.y+e.borderTop<=this.AbsolutePosition.y+this.borderBottom,o=this.AbsolutePosition.y+this.borderTop<=e.absolutePosition.y+e.borderBottom&&e.absolutePosition.y+e.borderBottom<=this.AbsolutePosition.y+this.borderBottom;if(s&&o)return!0}return!1}pointLiesInsideBorders(e){return this.AbsolutePosition.x+this.borderLeft<=e.x&&e.x<=this.AbsolutePosition.x+this.borderRight&&this.AbsolutePosition.y+this.borderTop<=e.y&&e.y<=this.AbsolutePosition.y+this.borderBottom}marginCollisionDetection(e){const i=Math.min(this.AbsolutePosition.x+this.borderMarginRight,e.absolutePosition.x+e.borderMarginRight)-Math.max(this.AbsolutePosition.x+this.borderMarginLeft,e.absolutePosition.x+e.borderMarginLeft),r=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 i>0&&r>0}liesInsideMargins(e){const i=this.AbsolutePosition.x+this.borderMarginLeft<=e.absolutePosition.x+e.borderMarginLeft&&e.absolutePosition.x+e.borderMarginLeft<=this.AbsolutePosition.x+this.borderMarginRight,r=this.AbsolutePosition.x+this.borderMarginLeft<=e.absolutePosition.x+e.borderMarginRight&&e.absolutePosition.x+e.borderMarginRight<=this.AbsolutePosition.x+this.borderMarginRight;if(i&&r){const s=this.AbsolutePosition.y+this.borderMarginTop<=e.absolutePosition.y+e.borderMarginTop&&e.absolutePosition.y+e.borderMarginTop<=this.AbsolutePosition.y+this.borderMarginBottom,o=this.AbsolutePosition.y+this.borderMarginTop<=e.absolutePosition.y+e.borderMarginBottom&&e.absolutePosition.y+e.borderMarginBottom<=this.AbsolutePosition.y+this.borderMarginBottom;if(s&&o)return!0}return!1}pointLiesInsideMargins(e){return this.AbsolutePosition.x+this.borderMarginLeft<=e.x&&e.x<=this.AbsolutePosition.x+this.borderMarginRight&&this.AbsolutePosition.y+this.borderMarginTop<=e.y&&e.y<=this.AbsolutePosition.y+this.borderMarginBottom}computeNonOverlappingPosition(e,i,r){this.RelativePosition=new PointF2D(r.x,r.y),this.setAbsolutePositionFromParent();let s=0,o=!1;do switch(i){case 0:case 1:s=this.relativePosition.x,e.calculatePositionAlongDirection(this,i),o=Math.abs(s-this.relativePosition.x)>1e-4;break;case 2:case 3:s=this.relativePosition.y,e.calculatePositionAlongDirection(this,i),o=Math.abs(s-this.relativePosition.y)>1e-4;break;default:throw new ArgumentOutOfRangeException("direction")}while(o)}getClickedObjectOfType(e){const i=this.dataObject;if(this.pointLiesInsideBorders(e)&&i)return i;for(let r=0,s=this.childElements.length;r(t[t.Left=0]="Left",t[t.Right=1]="Right",t[t.Up=2]="Up",t[t.Down=3]="Down",t))(ColDirEnum||{});class GraphicalMusicPage extends GraphicalObject{constructor(e){super(),this.musicSystems=[],this.labels=[],this.parent=e,this.boundingBox=new BoundingBox$1(this,void 0)}get MusicSystems(){return this.musicSystems}set MusicSystems(e){this.musicSystems=e}get Labels(){return this.labels}set Labels(e){this.labels=e}get Parent(){return this.parent}set Parent(e){this.parent=e}get PageNumber(){return this.pageNumber}set PageNumber(e){this.pageNumber=e}setMusicPageAbsolutePosition(e,i){return new PointF2D(0,0)}}var PagePlacementEnum=(t=>(t[t.Down=0]="Down",t[t.Right=1]="Right",t[t.RightDown=2]="RightDown",t))(PagePlacementEnum||{}),TextAlignmentEnum=(t=>(t[t.LeftTop=0]="LeftTop",t[t.LeftCenter=1]="LeftCenter",t[t.LeftBottom=2]="LeftBottom",t[t.CenterTop=3]="CenterTop",t[t.CenterCenter=4]="CenterCenter",t[t.CenterBottom=5]="CenterBottom",t[t.RightTop=6]="RightTop",t[t.RightCenter=7]="RightCenter",t[t.RightBottom=8]="RightBottom",t))(TextAlignmentEnum||{});class TextAlignment{static IsLeft(e){return e===0||e===1||e===2}static IsCenterAligned(e){return e===3||e===4||e===5}static IsRight(e){return e===6||e===7||e===8}}var FontStyles=(t=>(t[t.Regular=0]="Regular",t[t.Bold=1]="Bold",t[t.Italic=2]="Italic",t[t.BoldItalic=3]="BoldItalic",t[t.Underlined=4]="Underlined",t))(FontStyles||{}),Fonts=(t=>(t[t.TimesNewRoman=0]="TimesNewRoman",t[t.Kokila=1]="Kokila",t[t.Gonville=2]="Gonville",t))(Fonts||{});const FontStringNames={0:"Times New Roman",1:"Kokila",2:"Gonville"};var TieTypes=(t=>(t.SIMPLE="",t.HAMMERON="H",t.PULLOFF="P",t.SLIDE="S",t.TAPPING="T",t))(TieTypes||{});const Additional={"-2":[4,12,23],"-7":[13],"-9":[6]};var NoteEnum=(t=>(t[t.C=0]="C",t[t.D=2]="D",t[t.E=4]="E",t[t.F=5]="F",t[t.G=7]="G",t[t.A=9]="A",t[t.B=11]="B",t))(NoteEnum||{}),AccidentalEnum=(t=>(t[t.SHARP=0]="SHARP",t[t.FLAT=1]="FLAT",t[t.NONE=2]="NONE",t[t.NATURAL=3]="NATURAL",t[t.DOUBLESHARP=4]="DOUBLESHARP",t[t.DOUBLEFLAT=5]="DOUBLEFLAT",t[t.TRIPLESHARP=6]="TRIPLESHARP",t[t.TRIPLEFLAT=7]="TRIPLEFLAT",t[t.QUARTERTONESHARP=8]="QUARTERTONESHARP",t[t.QUARTERTONEFLAT=9]="QUARTERTONEFLAT",t[t.SLASHFLAT=10]="SLASHFLAT",t[t.THREEQUARTERSSHARP=11]="THREEQUARTERSSHARP",t[t.THREEQUARTERSFLAT=12]="THREEQUARTERSFLAT",t[t.SLASHQUARTERSHARP=13]="SLASHQUARTERSHARP",t[t.SLASHSHARP=14]="SLASHSHARP",t[t.DOUBLESLASHFLAT=15]="DOUBLESLASHFLAT",t[t.SORI=16]="SORI",t[t.KORON=17]="KORON",t))(AccidentalEnum||{});const _Pitch=class{constructor(t,e,i,r=void 0){this.accidental=2,this.fundamentalNote=t,this.octave=e,this.accidental=i,this.accidentalXml=r,this.halfTone=t+(e+_Pitch.octXmlDiff)*12+_Pitch.HalfTonesFromAccidental(i),this.frequency=_Pitch.calcFrequency(this),this.nextFrequency=_Pitch.calcFrequency(this,"next"),this.prevFrequency=_Pitch.calcFrequency(this,"prev")}static getNoteEnumString(t){switch(t){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""}}static lineShiftFromNoteEnum(t,e){if(e===0)return[t,0];const i=_Pitch.pitchEnumValues,r=i.indexOf(t);let s=0,o=(r+e)%i.length;return r+e>i.length-1&&(s=1),o<0&&(o=i.length+o,s=-1),[i[o],s]}static CalculateTransposedHalfTone(t,e){const i=t.fundamentalNote+t.AccidentalHalfTones+e;return _Pitch.WrapAroundCheck(i,12)}static WrapAroundCheck(t,e){let i=0;for(;t<0;)t+=e,i--;for(;t>=e;)t-=e,i++;return{overflow:i,halftone:t}}static calcFrequency(t,e){let i=0,r;if(t instanceof _Pitch){const l=t;i=l.octave-1,r=l.fundamentalNote-9+l.AccidentalHalfTones}else typeof t=="number"&&(r=t-57);const s=window.DYSubjectId;let o=0;window.DYEnvironment==="COLEXIU"&&(Additional[12]=[120]);for(const l in Additional)if(Object.prototype.hasOwnProperty.call(Additional,l)&&Additional[l].includes(s)){o=parseFloat(l);break}let a=r+o;return e==="next"&&a++,e==="prev"&&a--,442*Math.pow(2,i)*Math.pow(2,a/12)}static calcFractionalKey(t){return Math.log(t/440)/Math.LN10*_Pitch.halftoneFactor+57}static fromFrequency(t){const e=_Pitch.calcFractionalKey(t)+.5,i=Math.floor(e/12)-_Pitch.octXmlDiff,r=Math.floor(e)%12;let s=r,o=2;return this.pitchEnumValues.indexOf(s)===-1&&(s=r-1,o=0),new _Pitch(s,i,o)}static fromHalftone(t){const e=Math.floor(t/12)-_Pitch.octXmlDiff,i=t%12;let r=i,s=2;return this.pitchEnumValues.indexOf(r)===-1&&(r=i-1,s=0),new _Pitch(r,e,s)}static ceiling(t){t=t%12;let e=t;return this.pitchEnumValues.indexOf(e)===-1&&(e=t+1),e}static floor(t){t=t%12;let e=t;return this.pitchEnumValues.indexOf(e)===-1&&(e=t-1),e}static HalfTonesFromAccidental(t){switch(t){case 2:return 0;case 0:return 1;case 1:return-1;case 3:return 0;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")}}static AccidentalFromHalfTones(t){switch(t){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 t>0&&t<1?8:t<0&&t>-1?9:8}}static accidentalVexflow(t){let e;switch(t){case 3:e="n";break;case 1:e="b";break;case 0:e="#";break;case 4:e="##";break;case 6:e="###";break;case 5:e="bb";break;case 7:e="bbs";break;case 8:e="+";break;case 9:e="d";break;case 10:e="bs";break;case 11:e="++";break;case 12:e="db";break;case 13:e="+-";break;case 14:e="++-";break;case 15:e="bss";break;case 16:e="o";break;case 17:e="k";break}return e}get AccidentalHalfTones(){return _Pitch.HalfTonesFromAccidental(this.accidental)}get Octave(){return this.octave}get FundamentalNote(){return this.fundamentalNote}get Accidental(){return this.accidental}get AccidentalXml(){return this.accidentalXml}get Frequency(){return this.frequency}static get OctaveXmlDifference(){return _Pitch.octXmlDiff}getHalfTone(){return this.halfTone}getTransposedPitch(t){if(t>12)throw new Error("rewrite this method to handle bigger octave changes or don't use is with bigger octave changes!");return t>0?this.getHigherPitchByTransposeFactor(t):t<0?this.getLowerPitchByTransposeFactor(-t):this}DoEnharmonicChange(){switch(this.accidental){case 1:case 5:this.fundamentalNote=this.getPreviousFundamentalNote(this.fundamentalNote),this.accidental=_Pitch.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+(this.octave+_Pitch.octXmlDiff)*12));break;case 0:case 4:this.fundamentalNote=this.getNextFundamentalNote(this.fundamentalNote),this.accidental=_Pitch.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+(this.octave+_Pitch.octXmlDiff)*12));break;default:return}}ToString(){let t=_Pitch.accidentalVexflow(this.accidental);return t||(t=""),"Key: "+_Pitch.getNoteEnumString(this.fundamentalNote)+t+", Note: "+this.fundamentalNote+", octave: "+this.octave.toString()}OperatorEquals(t){const e=this;return!e||!t?!1:e.FundamentalNote===t.FundamentalNote&&e.Octave===t.Octave&&e.Accidental===t.Accidental}OperatorNotEqual(t){return this!==t}OperatorFundamentalGreaterThan(t){const e=this;return e.Octave===t.Octave?e.FundamentalNote>t.FundamentalNote:e.Octave>t.Octave}OperatorFundamentalLessThan(t){const e=this;return e.Octave===t.Octave?e.FundamentalNote_Pitch.pitchEnumValues.length-1?(r=_Pitch.pitchEnumValues[e+t-_Pitch.pitchEnumValues.length],i++):r=_Pitch.pitchEnumValues[e+t],new _Pitch(r,i,2)}getLowerPitchByTransposeFactor(t){const e=_Pitch.pitchEnumValues.indexOf(this.fundamentalNote);let i=this.octave,r;return e-t<0?(r=_Pitch.pitchEnumValues[_Pitch.pitchEnumValues.length+e-t],i--):r=_Pitch.pitchEnumValues[e-t],new _Pitch(r,i,2)}getNextFundamentalNote(t){let e=_Pitch.pitchEnumValues.indexOf(t);return e=(e+1)%_Pitch.pitchEnumValues.length,_Pitch.pitchEnumValues[e]}getPreviousFundamentalNote(t){const e=_Pitch.pitchEnumValues.indexOf(t);return e>0?_Pitch.pitchEnumValues[e-1]:_Pitch.pitchEnumValues[_Pitch.pitchEnumValues.length-1]}};let Pitch=_Pitch;Pitch.pitchEnumValues=[0,2,4,5,7,9,11];Pitch.halftoneFactor=12/(Math.LN2/Math.LN10);Pitch.octXmlDiff=3;class VerticalGraphicalStaffEntryContainer{constructor(e,i){this.staffEntries=[],this.absoluteTimestamp=i,this.staffEntries=new Array(e)}get Index(){return this.index}set Index(e){this.index=e}get AbsoluteTimestamp(){return this.absoluteTimestamp}get StaffEntries(){return this.staffEntries}set StaffEntries(e){this.staffEntries=e}static compareByTimestamp(e,i){const r=e.absoluteTimestamp.RealValue,s=i.absoluteTimestamp.RealValue;return rs?1:0}getFirstNonNullStaffEntry(){for(let e=0,i=this.staffEntries.length;e(t[t.BaseWritingColor=0]="BaseWritingColor",t[t.FollowingCursor=1]="FollowingCursor",t[t.AlternativeFollowingCursor=2]="AlternativeFollowingCursor",t[t.PlaybackCursor=3]="PlaybackCursor",t[t.Highlighted=4]="Highlighted",t[t.ErrorUnderlay=5]="ErrorUnderlay",t[t.Selected=6]="Selected",t[t.SelectionSymbol=7]="SelectionSymbol",t[t.DebugColor1=8]="DebugColor1",t[t.DebugColor2=9]="DebugColor2",t[t.DebugColor3=10]="DebugColor3",t[t.SplitScreenDivision=11]="SplitScreenDivision",t[t.GreyTransparentOverlay=12]="GreyTransparentOverlay",t[t.MarkedArea1=13]="MarkedArea1",t[t.MarkedArea2=14]="MarkedArea2",t[t.MarkedArea3=15]="MarkedArea3",t[t.MarkedArea4=16]="MarkedArea4",t[t.MarkedArea5=17]="MarkedArea5",t[t.MarkedArea6=18]="MarkedArea6",t[t.MarkedArea7=19]="MarkedArea7",t[t.MarkedArea8=20]="MarkedArea8",t[t.MarkedArea9=21]="MarkedArea9",t[t.MarkedArea10=22]="MarkedArea10",t[t.Comment1=23]="Comment1",t[t.Comment2=24]="Comment2",t[t.Comment3=25]="Comment3",t[t.Comment4=26]="Comment4",t[t.Comment5=27]="Comment5",t[t.Comment6=28]="Comment6",t[t.Comment7=29]="Comment7",t[t.Comment8=30]="Comment8",t[t.Comment9=31]="Comment9",t[t.Comment10=32]="Comment10",t))(OutlineAndFillStyleEnum||{});const 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=(t=>(t[t.Background=0]="Background",t[t.Highlight=1]="Highlight",t[t.MeasureError=2]="MeasureError",t[t.SelectionSymbol=3]="SelectionSymbol",t[t.Cursor=4]="Cursor",t[t.PSI_Debug=5]="PSI_Debug",t[t.Notes=6]="Notes",t[t.Comment=7]="Comment",t[t.Debug_above=8]="Debug_above",t))(GraphicalLayers||{}),NoteState=(t=>(t[t.Normal=0]="Normal",t[t.Selected=1]="Selected",t[t.Follow_Confirmed=2]="Follow_Confirmed",t[t.QFeedback_NotFound=3]="QFeedback_NotFound",t[t.QFeedback_OK=4]="QFeedback_OK",t[t.QFeedback_Perfect=5]="QFeedback_Perfect",t[t.Debug1=6]="Debug1",t[t.Debug2=7]="Debug2",t[t.Debug3=8]="Debug3",t))(NoteState||{}),AutoColorSet=(t=>(t.C="#d82c6b",t.D="#F89D15",t.E="#FFE21A",t.F="#4dbd5c",t.G="#009D96",t.A="#43469d",t.B="#76429c",t.Rest="#000000",t))(AutoColorSet||{});class GraphicalLine{constructor(e,i,r=0,s=OutlineAndFillStyleEnum.BaseWritingColor,o=void 0){this.start=e,this.end=i,this.width=r,this.styleId=s,this.colorHex=o}get Start(){return this.start}set Start(e){this.start=e}get End(){return this.end}set End(e){this.end=e}get Width(){return this.width}set Width(e){this.width=e}}class ClefInstruction extends AbstractNotationInstruction{constructor(e=0,i=0,r=2){super(void 0),this.clefType=0,this.line=2,this.octaveOffset=0,this.line=r,this.clefType=e,this.octaveOffset=i,this.calcParameters()}static getDefaultClefFromMidiInstrument(e){switch(e){case 0:return new ClefInstruction(1,0,4);case 33:return new ClefInstruction(1,0,4);case 34:return new ClefInstruction(1,0,4);case 35:return new ClefInstruction(1,0,4);case 36:return new ClefInstruction(1,0,4);case 37:return new ClefInstruction(1,0,4);case 38:return new ClefInstruction(1,0,4);case 39:return new ClefInstruction(1,0,4);case 43:return new ClefInstruction(1,0,4);default:return new ClefInstruction(0,0,2)}}static getAllPossibleClefs(){const e=[];for(let i=0;i<=2;i++){const r=new ClefInstruction(0,i,2);e.push(r)}for(let i=-2;i<=0;i++){const r=new ClefInstruction(1,i,4);e.push(r)}return e}static isSupportedClef(e){switch(e){case 0:case 1:case 2:case 3:case 4:return!0;default:return!1}}get ClefType(){return this.clefType}set ClefType(e){this.clefType=e}get Line(){return this.line}set Line(e){this.line=e}get OctaveOffset(){return this.octaveOffset}set OctaveOffset(e){this.octaveOffset=e}get ClefPitch(){return this.clefPitch}set ClefPitch(e){this.clefPitch=e}get ReferenceCyPosition(){return this.referenceCyPosition}set ReferenceCyPosition(e){this.referenceCyPosition=e}Equals(e){return this===e?!0:!this||!e?!1:this.clefPitch===e.clefPitch&&this.Line===e.Line}NotEqual(e){return!this.Equals(e)}ToString(){return"ClefType: "+this.clefType}calcParameters(){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")}}}var ClefEnum=(t=>(t[t.G=0]="G",t[t.F=1]="F",t[t.C=2]="C",t[t.percussion=3]="percussion",t[t.TAB=4]="TAB",t))(ClefEnum||{}),MidiInstrument=(t=>(t[t.None=-1]="None",t[t.Acoustic_Grand_Piano=0]="Acoustic_Grand_Piano",t[t.Bright_Acoustic_Piano=1]="Bright_Acoustic_Piano",t[t.Electric_Grand_Piano=2]="Electric_Grand_Piano",t[t.Honky_tonk_Piano=3]="Honky_tonk_Piano",t[t.Electric_Piano_1=4]="Electric_Piano_1",t[t.Electric_Piano_2=5]="Electric_Piano_2",t[t.Harpsichord=6]="Harpsichord",t[t.Clavinet=7]="Clavinet",t[t.Celesta=8]="Celesta",t[t.Glockenspiel=9]="Glockenspiel",t[t.Music_Box=10]="Music_Box",t[t.Vibraphone=11]="Vibraphone",t[t.Marimba=12]="Marimba",t[t.Xylophone=13]="Xylophone",t[t.Tubular_Bells=14]="Tubular_Bells",t[t.Dulcimer=15]="Dulcimer",t[t.Drawbar_Organ=16]="Drawbar_Organ",t[t.Percussive_Organ=17]="Percussive_Organ",t[t.Rock_Organ=18]="Rock_Organ",t[t.Church_Organ=19]="Church_Organ",t[t.Reed_Organ=20]="Reed_Organ",t[t.Accordion=21]="Accordion",t[t.Harmonica=22]="Harmonica",t[t.Tango_Accordion=23]="Tango_Accordion",t[t.Acoustic_Guitar_nylon=24]="Acoustic_Guitar_nylon",t[t.Acoustic_Guitar_steel=25]="Acoustic_Guitar_steel",t[t.Electric_Guitar_jazz=26]="Electric_Guitar_jazz",t[t.Electric_Guitar_clean=27]="Electric_Guitar_clean",t[t.Electric_Guitar_muted=28]="Electric_Guitar_muted",t[t.Overdriven_Guitar=29]="Overdriven_Guitar",t[t.Distortion_Guitar=30]="Distortion_Guitar",t[t.Guitar_harmonics=31]="Guitar_harmonics",t[t.Acoustic_Bass=32]="Acoustic_Bass",t[t.Electric_Bass_finger=33]="Electric_Bass_finger",t[t.Electric_Bass_pick=34]="Electric_Bass_pick",t[t.Fretless_Bass=35]="Fretless_Bass",t[t.Slap_Bass_1=36]="Slap_Bass_1",t[t.Slap_Bass_2=37]="Slap_Bass_2",t[t.Synth_Bass_1=38]="Synth_Bass_1",t[t.Synth_Bass_2=39]="Synth_Bass_2",t[t.Violin=40]="Violin",t[t.Viola=41]="Viola",t[t.Cello=42]="Cello",t[t.Contrabass=43]="Contrabass",t[t.Tremolo_Strings=44]="Tremolo_Strings",t[t.Pizzicato_Strings=45]="Pizzicato_Strings",t[t.Orchestral_Harp=46]="Orchestral_Harp",t[t.Timpani=47]="Timpani",t[t.String_Ensemble_1=48]="String_Ensemble_1",t[t.String_Ensemble_2=49]="String_Ensemble_2",t[t.Synth_Strings_1=50]="Synth_Strings_1",t[t.Synth_Strings_2=51]="Synth_Strings_2",t[t.Choir_Aahs=52]="Choir_Aahs",t[t.Voice_Oohs=53]="Voice_Oohs",t[t.Synth_Voice=54]="Synth_Voice",t[t.Orchestra_Hit=55]="Orchestra_Hit",t[t.Trumpet=56]="Trumpet",t[t.Trombone=57]="Trombone",t[t.Tuba=58]="Tuba",t[t.Muted_Trumpet=59]="Muted_Trumpet",t[t.French_Horn=60]="French_Horn",t[t.Brass_Section=61]="Brass_Section",t[t.Synth_Brass_1=62]="Synth_Brass_1",t[t.Synth_Brass_2=63]="Synth_Brass_2",t[t.Soprano_Sax=64]="Soprano_Sax",t[t.Alto_Sax=65]="Alto_Sax",t[t.Tenor_Sax=66]="Tenor_Sax",t[t.Baritone_Sax=67]="Baritone_Sax",t[t.Oboe=68]="Oboe",t[t.English_Horn=69]="English_Horn",t[t.Bassoon=70]="Bassoon",t[t.Clarinet=71]="Clarinet",t[t.Piccolo=72]="Piccolo",t[t.Flute=73]="Flute",t[t.Recorder=74]="Recorder",t[t.Pan_Flute=75]="Pan_Flute",t[t.Blown_Bottle=76]="Blown_Bottle",t[t.Shakuhachi=77]="Shakuhachi",t[t.Whistle=78]="Whistle",t[t.Ocarina=79]="Ocarina",t[t.Lead_1_square=80]="Lead_1_square",t[t.Lead_2_sawtooth=81]="Lead_2_sawtooth",t[t.Lead_3_calliope=82]="Lead_3_calliope",t[t.Lead_4_chiff=83]="Lead_4_chiff",t[t.Lead_5_charang=84]="Lead_5_charang",t[t.Lead_6_voice=85]="Lead_6_voice",t[t.Lead_7_fifths=86]="Lead_7_fifths",t[t.Lead_8_bass_lead=87]="Lead_8_bass_lead",t[t.Pad_1_new_age=88]="Pad_1_new_age",t[t.Pad_2_warm=89]="Pad_2_warm",t[t.Pad_3_polysynth=90]="Pad_3_polysynth",t[t.Pad_4_choir=91]="Pad_4_choir",t[t.Pad_5_bowed=92]="Pad_5_bowed",t[t.Pad_6_metallic=93]="Pad_6_metallic",t[t.Pad_7_halo=94]="Pad_7_halo",t[t.Pad_8_sweep=95]="Pad_8_sweep",t[t.FX_1_rain=96]="FX_1_rain",t[t.FX_2_soundtrack=97]="FX_2_soundtrack",t[t.FX_3_crystal=98]="FX_3_crystal",t[t.FX_4_atmosphere=99]="FX_4_atmosphere",t[t.FX_5_brightness=100]="FX_5_brightness",t[t.FX_6_goblins=101]="FX_6_goblins",t[t.FX_7_echoes=102]="FX_7_echoes",t[t.FX_8_scifi=103]="FX_8_scifi",t[t.Sitar=104]="Sitar",t[t.Banjo=105]="Banjo",t[t.Shamisen=106]="Shamisen",t[t.Koto=107]="Koto",t[t.Kalimba=108]="Kalimba",t[t.Bag_pipe=109]="Bag_pipe",t[t.Fiddle=110]="Fiddle",t[t.Shanai=111]="Shanai",t[t.Tinkle_Bell=112]="Tinkle_Bell",t[t.Agogo=113]="Agogo",t[t.Steel_Drums=114]="Steel_Drums",t[t.Woodblock=115]="Woodblock",t[t.Taiko_Drum=116]="Taiko_Drum",t[t.Melodic_Tom=117]="Melodic_Tom",t[t.Synth_Drum=118]="Synth_Drum",t[t.Reverse_Cymbal=119]="Reverse_Cymbal",t[t.Guitar_Fret_Noise=120]="Guitar_Fret_Noise",t[t.Breath_Noise=121]="Breath_Noise",t[t.Seashore=122]="Seashore",t[t.Bird_Tweet=123]="Bird_Tweet",t[t.Telephone_Ring=124]="Telephone_Ring",t[t.Helicopter=125]="Helicopter",t[t.Applause=126]="Applause",t[t.Gunshot=127]="Gunshot",t[t.euphonium=128]="euphonium",t[t.AltoClarinetInEb=200]="AltoClarinetInEb",t[t.TrumpetInBb=201]="TrumpetInBb",t[t.BaritoneSaxophone=202]="BaritoneSaxophone",t[t.TenorSaxophone=203]="TenorSaxophone",t[t.ClarinetInEb=204]="ClarinetInEb",t[t.Euphonium=205]="Euphonium",t[t.Alto_Clarinet=206]="Alto_Clarinet",t[t.Bass_Clarinet=207]="Bass_Clarinet",t[t.Bass_Trombone=208]="Bass_Trombone",t[t.clarinet_in_bb=209]="clarinet_in_bb",t[t.clarinet_in_eb=210]="clarinet_in_eb",t[t.Percussion=135]="Percussion",t))(MidiInstrument||{});const _KeyInstruction=class extends AbstractNotationInstruction{constructor(t=void 0,e=0,i=0){super(t),this.isTransposedBy=0,this.Key=e,this.keyTypeOriginal=e,this.mode=i,this.alteratedNotes=this.calcAlteratedNotes()}static copy(t){const e=new _KeyInstruction(t.parent,t.Key,t.Mode);return e.keyTypeOriginal=t.keyTypeOriginal,e}static getAllPossibleMajorKeyInstructions(){const t=[];for(let e=-7;e<7;e++){const i=new _KeyInstruction(void 0,e,0);t.push(i)}return t}get Key(){return this.keyType}set Key(t){this.keyType=t,this.alteratedNotes=this.calcAlteratedNotes()}get Mode(){return this.mode}set Mode(t){this.mode=t}get AlteratedNotes(){return this.alteratedNotes}calcAlteratedNotes(){const t=[];if(this.keyType>0)for(let e=0;e=0}getAlterationForPitch(t){return this.keyType>0&&this.alteratedNotes.indexOf(t.FundamentalNote)<=this.keyType?AccidentalEnum.SHARP:this.keyType<0&&this.alteratedNotes.indexOf(t.FundamentalNote)<=Math.abs(this.keyType)?AccidentalEnum.FLAT:AccidentalEnum.NONE}ToString(){return"Key: "+this.keyType+this.mode}OperatorEquals(t){const e=this;return e===t?!0:!e||!t?!1:e.Key===t.Key&&e.Mode===t.Mode}OperatorNotEqual(t){return!this.OperatorEquals(t)}};let 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=(t=>(t[t.major=0]="major",t[t.minor=1]="minor",t[t.none=2]="none",t[t.dorian=3]="dorian",t[t.phrygian=4]="phrygian",t[t.lydian=5]="lydian",t[t.mixolydian=6]="mixolydian",t[t.aeolian=7]="aeolian",t[t.ionian=8]="ionian",t[t.locrian=9]="locrian",t))(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(t){return this.indexOf(t)!==-1}});class CollectionUtil{static contains2(e,i){for(let r=0;r{var r,s,o,a;return((s=(r=i.sourceNote.Pitch)==null?void 0:r.getHalfTone())!=null?s:0)-((a=(o=e.sourceNote.Pitch)==null?void 0:o.getHalfTone())!=null?a:0)}),this.notes}sortForVexflow(){return this.notes.sort((e,i)=>{var r,s,o;return((s=(r=e.sourceNote.Pitch)==null?void 0:r.getHalfTone())!=null?s:0)-((o=i.sourceNote.Pitch.getHalfTone())!=null?o:0)}),this.notes}color(){}}class GraphicalMusicSheet{constructor(e,i){this.musicPages=[],this.measureList=[],this.verticalGraphicalStaffEntryContainers=[],this.cursors=[],this.leadSheet=!1,this.musicSheet=e,this.numberOfStaves=this.musicSheet.Staves.length,this.calculator=i,this.calculator.initialize(this)}get ParentMusicSheet(){return this.musicSheet}get GetCalculator(){return this.calculator}get JianpuKeySignature(){return this.jianpuKeySignature}set JianpuKeySignature(e){this.jianpuKeySignature=e}get MusicPages(){return this.musicPages}set MusicPages(e){this.musicPages=e}get MeasureList(){return this.measureList}set MeasureList(e){this.measureList=e}get VerticalGraphicalStaffEntryContainers(){return this.verticalGraphicalStaffEntryContainers}set VerticalGraphicalStaffEntryContainers(e){this.verticalGraphicalStaffEntryContainers=e}get Title(){return this.title}set Title(e){this.title=e}get Subtitle(){return this.subtitle}set Subtitle(e){this.subtitle=e}get Composer(){return this.composer}set Composer(e){this.composer=e}get Lyricist(){return this.lyricist}set Lyricist(e){this.lyricist=e}get Cursors(){return this.cursors}get SelectionStartSymbol(){return this.selectionStartSymbol}get SelectionEndSymbol(){return this.selectionEndSymbol}get MinAllowedSystemWidth(){return this.minAllowedSystemWidth}set MinAllowedSystemWidth(e){this.minAllowedSystemWidth=e}get NumberOfStaves(){return this.numberOfStaves}get LeadSheet(){return this.leadSheet}set LeadSheet(e){this.leadSheet=e}static transformRelativeToAbsolutePosition(e){for(let i=0;i=0;r--){const s=this.measureList[r][i];if(s)return s}}findGraphicalStaffEntryFromMeasureList(e,i,r){for(let s=i;s0)return a.staffEntries[0]}}getFirstVisibleMeasuresListFromIndices(e,i){const r=[],s=this.measureList[0].length;for(let o=e;o<=i;o++)for(let a=0;a=0;i--){if(this.verticalGraphicalStaffEntryContainers[i].AbsoluteTimestamp.lt(e)){const r=new VerticalGraphicalStaffEntryContainer(this.numberOfStaves,e);return this.verticalGraphicalStaffEntryContainers.splice(i+1,0,r),r}if(this.verticalGraphicalStaffEntryContainers[i].AbsoluteTimestamp.Equals(e))return this.verticalGraphicalStaffEntryContainers[i]}}GetVerticalContainerFromTimestamp(e,i=0){const r=CollectionUtil.binarySearch(this.verticalGraphicalStaffEntryContainers,new VerticalGraphicalStaffEntryContainer(0,e),VerticalGraphicalStaffEntryContainer.compareByTimestamp,i);if(r>=0)return this.verticalGraphicalStaffEntryContainers[r]}GetInterpolatedIndexInVerticalContainers(e){const i=this.verticalGraphicalStaffEntryContainers;let r=0,s=i.length-1,o,a;if(e.lte(i[i.length-1].AbsoluteTimestamp)){for(;s-r>1;){const m=Math.floor((s+r)/2);if(i[r].AbsoluteTimestamp.Equals(e)){s=r;break}else if(i[s].AbsoluteTimestamp.Equals(e)){r=s;break}else{if(i[m].AbsoluteTimestamp.Equals(e))return this.verticalGraphicalStaffEntryContainers.indexOf(i[m]);e.lt(i[m].AbsoluteTimestamp)?s=m:r=m}}if(r===s)return this.verticalGraphicalStaffEntryContainers.indexOf(i[r]);o=i[r].AbsoluteTimestamp,a=i[s].AbsoluteTimestamp}else o=i[i.length-1].AbsoluteTimestamp,a=Fraction$1.plus(this.getLongestStaffEntryDuration(i.length-1),o),s=i.length;const l=a.RealValue-o.RealValue,c=a.RealValue-e.RealValue,u=s-c/l;return Math.min(u,this.verticalGraphicalStaffEntryContainers.length)}getVisibleStavesIndicesFromSourceMeasure(e){const i=[],r=[];for(let s=0,o=e.length;s{var r;return((r=i.parentStaffEntry)==null?void 0:r.relInMeasureTimestamp)!==void 0})}GetNearestNote(e,i){const r=this.GetNearestVoiceEntry(e);if(!r)return;let s,o=Number.MAX_SAFE_INTEGER;for(const a of r.notes){const l=a.PositionAndShape.AbsolutePosition.y,c=Math.abs(a.PositionAndShape.AbsolutePosition.x-e.x),u=Math.abs(l-e.y);c+ua.PositionAndShape.RelativePosition.x&&(r=a):r=a)}}catch(s){loglevelExports.info("GraphicalMusicSheet.getStaffEntry",s)}return r}GetPreviousVisibleContainerIndex(e){for(let i=e-1;i>=0;i--){const r=this.verticalGraphicalStaffEntryContainers[i].StaffEntries;for(let s=0,o=r.length;s=0;o--)if(r=this.getStaffEntry(o),r)if(i){if(r.sourceStaffEntry.ParentStaff.ParentInstrument.Visible)return r}else return r}findClosestRightStaffEntry(e,i){let r;const s=Math.max(0,Math.ceil(e));for(let o=s;o{};Vex.L=(t,e)=>{if(!e)return;const i=Array.prototype.slice.call(e).join(" ");window.console.log(t+": "+i)};Vex.MakeException=t=>class extends Error{constructor(i,r){super(i),this.name=t,this.message=i,this.data=r}};class RuntimeError{constructor(e,i){this.code=e,this.message=i}toString(){return"[RuntimeError] "+this.code+":"+this.message}}Vex.RuntimeError=RuntimeError;Vex.RERR=Vex.RuntimeError;Vex.Merge=(t,e)=>{for(const i in e)t[i]=e[i];return t};Vex.Min=Math.min;Vex.Max=Math.max;Vex.forEach=(t,e)=>{for(let i=0;it%e>=e/2?parseInt(t/e,10)*e+e:parseInt(t/e,10)*e;Vex.MidLine=(t,e)=>{let i=e+(t-e)/2;return i%2>0&&(i=Vex.RoundN(i*10,5)/10),i};Vex.SortAndUnique=(t,e,i)=>{if(t.length>1){const r=[];let s;t.sort(e);for(let o=0;o{let i=t.length;for(;i--;)if(t[i]===e)return!0;return!1};Vex.getCanvasContext=t=>{if(!t)throw new Vex.RERR("BadArgument","Invalid canvas selector: "+t);const e=document.getElementById(t);if(!(e&&e.getContext))throw new Vex.RERR("UnsupportedBrowserError","This browser does not support HTML5 Canvas");return e.getContext("2d")};Vex.drawDot=(t,e,i,r="#55")=>{t.save(),t.setFillStyle(r),t.beginPath(),t.arc(e,i,3,0,Math.PI*2,!0),t.closePath(),t.fill(),t.restore()};Vex.BM=(t,e)=>{const i=new Date().getTime();e();const r=new Date().getTime()-i;Vex.L(t+r+"ms")};Vex.StackTrace=()=>new Error().stack;Vex.W=(...t)=>{const e=t.join(" ");window.console.log("Warning: ",e,Vex.StackTrace())};Vex.Prefix=t=>Vex.Prefix.prefix+t;Vex.Prefix.prefix="vf-";class Fraction{static GCD(e,i){if(typeof e!="number"||typeof i!="number")throw new Vex.RERR("BadArgument",`Invalid numbers: ${e}, ${i}`);let r;for(;i!==0;)r=i,i=e%i,e=r;return e}static LCM(e,i){return e*i/Fraction.GCD(e,i)}static LCMM(e){if(e.length===0)return 0;if(e.length===1)return e[0];if(e.length===2)return Fraction.LCM(e[0],e[1]);{const i=e[0];return e.shift(),Fraction.LCM(i,Fraction.LCMM(e))}}constructor(e,i){this.set(e,i)}set(e,i){return this.numerator=e===void 0?1:e,this.denominator=i===void 0?1:i,this}value(){return this.numerator/this.denominator}simplify(){let e=this.numerator,i=this.denominator;const r=Fraction.GCD(e,i);return e/=r,i/=r,i<0&&(i=-i,e=-e),this.set(e,i)}add(e,i){let r,s;e instanceof Fraction?(r=e.numerator,s=e.denominator):(e!==void 0?r=e:r=0,i!==void 0?s=i:s=1);const o=Fraction.LCM(this.denominator,s),a=o/this.denominator,l=o/s,c=this.numerator*a+r*l;return this.set(c,o)}subtract(e,i){let r,s;e instanceof Fraction?(r=e.numerator,s=e.denominator):(e!==void 0?r=e:r=0,i!==void 0?s=i:s=1);const o=Fraction.LCM(this.denominator,s),a=o/this.denominator,l=o/s,c=this.numerator*a-r*l;return this.set(c,o)}multiply(e,i){let r,s;return e instanceof Fraction?(r=e.numerator,s=e.denominator):(e!==void 0?r=e:r=1,i!==void 0?s=i:s=1),this.set(this.numerator*r,this.denominator*s)}divide(e,i){let r,s;return e instanceof Fraction?(r=e.numerator,s=e.denominator):(e!==void 0?r=e:r=1,i!==void 0?s=i:s=1),this.set(this.numerator*s,this.denominator*r)}equals(e){const i=Fraction.__compareA.copy(e).simplify(),r=Fraction.__compareB.copy(this).simplify();return i.numerator===r.numerator&&i.denominator===r.denominator}greaterThan(e){const i=Fraction.__compareB.copy(this);return i.subtract(e),i.numerator>0}greaterThanEquals(e){const i=Fraction.__compareB.copy(this);return i.subtract(e),i.numerator>=0}lessThan(e){return!this.greaterThanEquals(e)}lessThanEquals(e){return!this.greaterThan(e)}clone(){return new Fraction(this.numerator,this.denominator)}copy(e){return typeof e=="number"?this.set(e||0,1):this.set(e.numerator,e.denominator)}quotient(){return Math.floor(this.numerator/this.denominator)}fraction(){return this.numerator%this.denominator}abs(){return this.denominator=Math.abs(this.denominator),this.numerator=Math.abs(this.numerator),this}toString(){return this.numerator+"/"+this.denominator}toSimplifiedString(){return Fraction.__tmp.copy(this).simplify().toString()}toMixedString(){let e="";const i=this.quotient(),r=Fraction.__tmp.copy(this);return i<0?r.abs().fraction():r.fraction(),i!==0?(e+=i,r.numerator!==0&&(e+=" "+r.toSimplifiedString())):r.numerator===0?e="0":e=r.toSimplifiedString(),e}parse(e){const i=e.split("/"),r=parseInt(i[0],10),s=i[1]?parseInt(i[1],10):1;return this.set(r,s)}}Fraction.__compareA=new Fraction;Fraction.__compareB=new Fraction;Fraction.__tmp=new Fraction;const X$3=Vex.MakeException("RegistryError");function setIndexValue(t,e,i,r,s){t[e][i]||(t[e][i]={}),t[e][i][r]=s}class Registry{static get INDEXES(){return["type"]}constructor(){this.clear()}static enableDefaultRegistry(e){Registry.defaultRegistry=e}static getDefaultRegistry(){return Registry.defaultRegistry}static disableDefaultRegistry(){Registry.defaultRegistry=null}clear(){return this.index={id:{},type:{},class:{}},this}updateIndex({id:e,name:i,value:r,oldValue:s}){const o=this.getElementById(e);s!==null&&this.index[i][s]&&delete this.index[i][s][e],r!==null&&setIndexValue(this.index,i,r,o.getAttribute("id"),o)}register(e,i){if(i=i||e.getAttribute("id"),!i)throw new X$3("Can't add element without `id` attribute to registry",e);return e.setAttribute("id",i),setIndexValue(this.index,"id",i,i,e),Registry.INDEXES.forEach(r=>{this.updateIndex({id:i,name:r,value:e.getAttribute(r),oldValue:null})}),e.onRegister(this),this}getElementById(e){return this.index.id[e]?this.index.id[e][e]:null}getElementsByAttribute(e,i){const r=this.index[e];return r&&r[i]?Object.keys(r[i]).map(s=>r[i][s]):[]}getElementsByType(e){return this.getElementsByAttribute("type",e)}getElementsByClass(e){return this.getElementsByAttribute("class",e)}onUpdate({id:e,name:i,value:r,oldValue:s}){function o(a,l){return a.filter(c=>c===l).length>0}return o(Registry.INDEXES.concat(["id","class"]),i)?(this.updateIndex({id:e,name:i,value:r,oldValue:s}),this):this}}Registry.defaultRegistry=null;let Element$1=class Yt{static newID(){return"auto"+Yt.ID++}constructor({type:e}={}){this.attrs={id:Yt.newID(),el:null,type:e||"Base",classes:{}},this.boundingBox=null,this.context=null,this.rendered=!1,Registry.getDefaultRegistry()&&Registry.getDefaultRegistry().register(this)}setStyle(e){return this.style=e,this}getStyle(){return this.style}applyStyle(e=this.context,i=this.getStyle()){return i?(e.save(),i.shadowColor&&e.setShadowColor(i.shadowColor),i.shadowBlur&&e.setShadowBlur(i.shadowBlur),i.fillStyle&&e.setFillStyle(i.fillStyle),i.strokeStyle&&e.setStrokeStyle(i.strokeStyle),i.lineWidth&&e.setLineWidth(i.lineWidth),this):this}restoreStyle(e=this.context,i=this.getStyle()){return i?(e.restore(),this):this}drawWithStyle(){this.checkContext(),this.applyStyle(),this.draw(),this.restoreStyle()}hasClass(e){return this.attrs.classes[e]===!0}addClass(e){return this.attrs.classes[e]=!0,this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:e,oldValue:null}),this}removeClass(e){return delete this.attrs.classes[e],this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:null,oldValue:e}),this}onRegister(e){return this.registry=e,this}isRendered(){return this.rendered}setRendered(e=!0){return this.rendered=e,this}getAttributes(){return this.attrs}getAttribute(e){return this.attrs[e]}setAttribute(e,i){const r=this.attrs.id,s=this.attrs[e];return this.attrs[e]=i,this.registry&&this.registry.onUpdate({id:r,name:e,value:i,oldValue:s}),this}getContext(){return this.context}setContext(e){return this.context=e,this}getBoundingBox(){return this.boundingBox}checkContext(){if(!this.context)throw new Vex.RERR("NoContext","No rendering context attached to instance");return this.context}};Element$1.ID=1e3;class BoundingBoxComputation{constructor(e,i,r,s){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.addPoint(e,i),this.addPoint(r,s)}width(){return this.x2-this.x1}height(){return this.y2-this.y1}addPoint(e,i){e!=null&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),ethis.x2&&(this.x2=e)),i!=null&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=i,this.y2=i),ithis.y2&&(this.y2=i))}addX(e){this.addPoint(e,null)}addY(e){this.addPoint(null,e)}addQuadraticCurve(e,i,r,s,o,a){const l=e+.6666666666666666*(r-e),c=i+2/3*(s-i),u=l+1/3*(o-e),m=c+1/3*(a-i);this.addBezierCurve(e,i,l,c,u,m,o,a)}addBezierCurve(e,i,r,s,o,a,l,c){const u=[e,i],m=[r,s],d=[o,a],g=[l,c];let y;this.addPoint(u[0],u[1]),this.addPoint(g[0],g[1]);const b=(S,E)=>Math.pow(1-S,3)*u[E]+3*Math.pow(1-S,2)*S*m[E]+3*(1-S)*Math.pow(S,2)*d[E]+Math.pow(S,3)*g[E];for(y=0;y<=1;y++){const S=6*u[y]-12*m[y]+6*d[y],E=-3*u[y]+9*m[y]-9*d[y]+3*g[y],x=3*m[y]-3*u[y];if(E===0){if(S===0)continue;const T=-x/S;0{if(!t)throw new Vex.RERR("BadArgument","Invalid clef: "+t);const e=Flow.clefProperties.values[t];if(!e)throw new Vex.RERR("BadArgument","Invalid clef: "+t);return e};Flow.clefProperties.values={treble:{line_shift:0},bass:{line_shift:6},tenor:{line_shift:4},alto:{line_shift:3},soprano:{line_shift:1},percussion:{line_shift:0},"mezzo-soprano":{line_shift:2},"baritone-c":{line_shift:5},"baritone-f":{line_shift:5},subbass:{line_shift:7},french:{line_shift:-1}};Flow.keyProperties=(t,e,i)=>{e===void 0&&(e="treble");const r={octave_shift:0};typeof i=="object"&&Vex.Merge(r,i);const s=t.split("/");if(s.length<2)throw new Vex.RERR("BadArguments",`Key must have note + octave and an optional glyph: ${t}`);const o=s[0].toUpperCase(),a=Flow.keyProperties.note_values[o];if(!a)throw new Vex.RERR("BadArguments","Invalid key name: "+o);a.octave&&(s[1]=a.octave);let l=parseInt(s[1],10);l-=r.octave_shift;let u=(l*7-4*7+a.index)/2;u+=Flow.clefProperties(e).line_shift;let m=0;u<=0&&u*2%2===0&&(m=1),u>=6&&u*2%2===0&&(m=-1);const d=typeof a.int_val<"u"?l*12+a.int_val:null,g=a.code,y=a.shift_right;let b={};if(s.length>2&&s[2]){const S=s[2].toUpperCase();b=Flow.keyProperties.customNoteHeads[S]||{}}return{key:o,octave:l,line:u,int_value:d,accidental:a.accidental,code:g,stroke:m,shift_right:y,displaced:!1,...b}};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},TI:{code:"v11",shift_right:0,stem_up_y_shift:5,stem_down_y_shift:5,stem_up_x_offset:6,stem_down_x_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},rwl:{code:"rwl",shift_right:0},rhl:{code:"rhl",shift_right:0}};Flow.integerToNote=t=>{if(typeof t>"u")throw new Vex.RERR("BadArguments","Undefined integer for integerToNote");if(t<-2)throw new Vex.RERR("BadArguments",`integerToNote requires integer > -2: ${t}`);const e=Flow.integerToNote.table[t];if(!e)throw new Vex.RERR("BadArguments",`Unknown note value for integer: ${t}`);return e};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=(t,e=1)=>{let i=null,r=0,s=0;if(t.toString().toUpperCase()==="X"){const o=new Glyph("v7f",Flow.DEFAULT_TABLATURE_FONT_SCALE).getMetrics();i="v7f",r=o.width,s=-o.height/2}else r=Flow.textWidth(t.toString());return{text:t,code:i,getWidth:()=>r*e,shift_y:s}};Flow.textWidth=t=>7*t.toString().length;Flow.articulationCodes=t=>Flow.articulationCodes.articulations[t];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=t=>Flow.accidentalCodes.accidentals[t];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=t=>Flow.ornamentCodes.ornaments[t];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=t=>{const e=Flow.keySignature.keySpecs[t];if(!e)throw new Vex.RERR("BadKeySignature",`Bad key signature spec: '${t}'`);if(!e.acc)return[];const i=Flow.keySignature.accidentalList(e.acc),r=[];for(let s=0;s({b:[2,.5,2.5,1,3,1.5,3.5],"#":[0,1.5,-.5,1,2.5,.5,2]})[t];Flow.parseNoteDurationString=t=>{if(typeof t!="string")return null;const i=/(\d*\/?\d+|[a-z])(d*)([nrhms]|$)/.exec(t);if(!i)return null;const r=i[1],s=i[2].length;let o=i[3];return o.length===0&&(o="n"),{duration:r,dots:s,type:o}};Flow.parseNoteStruct=t=>{const e=t.duration,i=Flow.parseNoteDurationString(e);if(!i)return null;let r=Flow.durationToTicks(i.duration);if(r==null)return null;let s=t.type;const o=[];if(s){if(!Flow.getGlyphProps.validTypes[s])return null}else s=i.type||"n",t.keys!==void 0&&t.keys.forEach((c,u)=>{const m=c.split("/");m&&m.length===3&&(o[u]=m[2])});const a=t.dots?t.dots:i.dots;if(typeof a!="number")return null;let l=r;for(let c=0;c{const e=Flow.durationAliases[t];if(e!==void 0&&(t=e),Flow.durationToTicks.durations[t]===void 0)throw new Vex.RERR("BadArguments",`The provided duration is not valid: ${t}`);return t};Flow.durationToFraction=t=>new Fraction().parse(Flow.sanitizeDuration(t));Flow.durationToNumber=t=>Flow.durationToFraction(t).value();Flow.durationToTicks=t=>{t=Flow.sanitizeDuration(t);const e=Flow.durationToTicks.durations[t];return e===void 0?null:e};Flow.durationToTicks.durations={"1/2":Flow.RESOLUTION*2,1:Flow.RESOLUTION/1,2:Flow.RESOLUTION/2,4:Flow.RESOLUTION/4,8:Flow.RESOLUTION/8,16:Flow.RESOLUTION/16,32:Flow.RESOLUTION/32,64:Flow.RESOLUTION/64,128:Flow.RESOLUTION/128,256:Flow.RESOLUTION/256};Flow.durationAliases={w:"1",h:"2",q:"4",b:"256"};Flow.getGlyphProps=(t,e)=>{t=Flow.sanitizeDuration(t);const i=Flow.getGlyphProps.duration_codes[t];if(i===void 0)return null;e||(e="n");let r=i.type[e];if(r===void 0){const s=Flow.keyProperties.customNoteHeads[e.toUpperCase()];if(s===void 0)return null;r={code_head:s.code,...s}}return{...i.common,...r}};Flow.getGlyphProps.validTypes={n:{name:"note"},r:{name:"rest"},h:{name:"harmonic"},m:{name:"muted"},s:{name:"slash"}};Flow.getGlyphProps.duration_codes={"1/2":{common:{getWidth(t=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v53",t).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:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},1:{common:{getWidth(t=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v1d",t).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:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},2:{common:{getWidth(t=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"v81",t).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:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},4:{common:{getWidth(t=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",t).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:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},8:{common:{getWidth(t=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",t).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:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},16:{common:{beam_count:2,getWidth(t=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",t).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:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},32:{common:{beam_count:3,getWidth(t=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",t).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:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},64:{common:{beam_count:4,getWidth(t=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",t).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:()=>Flow.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},128:{common:{beam_count:5,getWidth(t=Flow.DEFAULT_NOTATION_FONT_SCALE){return new Glyph(this.code_head||"vb",t).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:()=>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};class CanvasContext{static get WIDTH(){return 600}static get HEIGHT(){return 400}static get CANVAS_BROWSER_SIZE_LIMIT(){return 32767}static SanitizeCanvasDims(e,i){return Math.max(e,i)>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),i>this.CANVAS_BROWSER_SIZE_LIMIT&&(i=this.CANVAS_BROWSER_SIZE_LIMIT)),[e,i]}constructor(e){this.vexFlowCanvasContext=e,e.canvas?this.canvas=e.canvas:this.canvas={width:CanvasContext.WIDTH,height:CanvasContext.HEIGHT}}clear(){this.vexFlowCanvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}openGroup(){}closeGroup(){}add(){}setFont(e,i,r){return this.vexFlowCanvasContext.font=(r||"")+" "+i+"pt "+e,this}setRawFont(e){return this.vexFlowCanvasContext.font=e,this}setFillStyle(e){return this.vexFlowCanvasContext.fillStyle=e,this}setBackgroundFillStyle(e){return this.background_fillStyle=e,this}setStrokeStyle(e){return this.vexFlowCanvasContext.strokeStyle=e,this}setShadowColor(e){return this.vexFlowCanvasContext.shadowColor=e,this}setShadowBlur(e){return this.vexFlowCanvasContext.shadowBlur=e,this}setLineWidth(e){return this.vexFlowCanvasContext.lineWidth=e,this}setLineCap(e){return this.vexFlowCanvasContext.lineCap=e,this}setLineDash(e){return this.vexFlowCanvasContext.lineDash=e,this}scale(e,i){return this.vexFlowCanvasContext.scale(parseFloat(e),parseFloat(i))}resize(e,i){return[e,i]=this.SanitizeCanvasDims(parseInt(e,10),parseInt(i,10)),this.vexFlowCanvasContext.resize(e,i)}rect(e,i,r,s){return this.vexFlowCanvasContext.rect(e,i,r,s)}fillRect(e,i,r,s){return this.vexFlowCanvasContext.fillRect(e,i,r,s)}clearRect(e,i,r,s){return this.vexFlowCanvasContext.clearRect(e,i,r,s)}beginPath(){return this.vexFlowCanvasContext.beginPath()}moveTo(e,i){return this.vexFlowCanvasContext.moveTo(e,i)}lineTo(e,i){return this.vexFlowCanvasContext.lineTo(e,i)}bezierCurveTo(e,i,r,s,o,a){return this.vexFlowCanvasContext.bezierCurveTo(e,i,r,s,o,a)}quadraticCurveTo(e,i,r,s){return this.vexFlowCanvasContext.quadraticCurveTo(e,i,r,s)}arc(e,i,r,s,o,a){return this.vexFlowCanvasContext.arc(e,i,r,s,o,a)}glow(){return this.vexFlowCanvasContext.glow()}fill(){return this.vexFlowCanvasContext.fill()}stroke(){return this.vexFlowCanvasContext.stroke()}closePath(){return this.vexFlowCanvasContext.closePath()}measureText(e){return this.vexFlowCanvasContext.measureText(e)}fillText(e,i,r){return this.vexFlowCanvasContext.fillText(e,i,r)}save(){return this.vexFlowCanvasContext.save()}restore(){return this.vexFlowCanvasContext.restore()}}class RaphaelContext{constructor(e){this.element=e,this.paper=Raphael(e),this.path="",this.pen={x:0,y:0},this.lineWidth=1,this.state={scale:{x:1,y:1},font_family:"Arial",font_size:8,font_weight:800},this.attributes={"stroke-width":.3,fill:"black",stroke:"black",font:"10pt Arial"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white",font:"10pt Arial"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[]}openGroup(){}closeGroup(){}add(){}setFont(e,i,r){return this.state.font_family=e,this.state.font_size=i,this.state.font_weight=r,this.attributes.font=(this.state.font_weight||"")+" "+this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}setRawFont(e){return this.attributes.font=e,this}setFillStyle(e){return this.attributes.fill=e,this}setBackgroundFillStyle(e){return this.background_attributes.fill=e,this.background_attributes.stroke=e,this}setStrokeStyle(e){return this.attributes.stroke=e,this}setShadowColor(e){return this.shadow_attributes.color=e,this}setShadowBlur(e){return this.shadow_attributes.width=e,this}setLineWidth(e){this.attributes["stroke-width"]=e,this.lineWidth=e}setLineDash(){return this}setLineCap(){return this}scale(e,i){return this.state.scale={x:e,y:i},this.attributes.transform="S"+e+","+i+",0,0",this.attributes.scale=e+","+i+",0,0",this.attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this.background_attributes.transform="S"+e+","+i+",0,0",this.background_attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}clear(){this.paper.clear()}resize(e,i){return this.element.style.width=e,this.paper.setSize(e,i),this}setViewBox(e){this.paper.canvas.setAttribute("viewBox",e)}rect(e,i,r,s){return s<0&&(i+=s,s=-s),this.paper.rect(e,i,r-.5,s-.5).attr(this.attributes).attr("fill","none").attr("stroke-width",this.lineWidth),this}fillRect(e,i,r,s){return s<0&&(i+=s,s=-s),this.paper.rect(e,i,r-.5,s-.5).attr(this.attributes),this}clearRect(e,i,r,s){return s<0&&(i+=s,s=-s),this.paper.rect(e,i,r-.5,s-.5).attr(this.background_attributes),this}beginPath(){return this.path="",this.pen.x=0,this.pen.y=0,this}moveTo(e,i){return this.path+="M"+e+","+i,this.pen.x=e,this.pen.y=i,this}lineTo(e,i){return this.path+="L"+e+","+i,this.pen.x=e,this.pen.y=i,this}bezierCurveTo(e,i,r,s,o,a){return this.path+="C"+e+","+i+","+r+","+s+","+o+","+a,this.pen.x=o,this.pen.y=a,this}quadraticCurveTo(e,i,r,s){return this.path+="Q"+e+","+i+","+r+","+s,this.pen.x=r,this.pen.y=s,this}arc(e,i,r,s,o,a){function l(u){for(;u<0;)u+=Math.PI*2;for(;u>Math.PI*2;)u-=Math.PI*2;return u}if(s=l(s),o=l(o),s>o){const u=s;s=o,o=u,a=!a}const c=o-s;return c>Math.PI?(this.arcHelper(e,i,r,s,s+c/2,a),this.arcHelper(e,i,r,s+c/2,o,a)):this.arcHelper(e,i,r,s,o,a),this}arcHelper(e,i,r,s,o,a){const l=e+r*Math.cos(s),c=i+r*Math.sin(s),u=e+r*Math.cos(o),m=i+r*Math.sin(o);let d=0,g=0;a?(g=1,o-sMath.PI&&(d=1),this.path+="M"+l+","+c+",A"+r+","+r+",0,"+d+","+g+","+u+","+m+"M"+this.pen.x+","+this.pen.y}glow(){const e=this.paper.set();if(this.shadow_attributes.width>0){const i=this.shadow_attributes,r=i.width/2;for(let s=1;s<=r;s++)e.push(this.paper.path(this.path).attr({stroke:i.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(i.width/r*s).toFixed(3),opacity:+((i.opacity||.3)/r).toFixed(3),transform:this.attributes.transform,scale:this.attributes.scale}))}return e}fill(){const e=this.paper.path(this.path).attr(this.attributes).attr("stroke-width",0);return this.glow(e),this}stroke(){const e=this.lineWidth*(this.state.scale.x+this.state.scale.y)/2,i=this.paper.path(this.path).attr(this.attributes).attr("fill","none").attr("stroke-width",e);return this.glow(i),this}closePath(){return this.path+="Z",this}measureText(e){const i=this.paper.text(0,0,e).attr(this.attributes).attr("fill","none").attr("stroke","none"),r=i.getBBox();return i.remove(),{width:r.width,height:r.height}}fillText(e,i,r){return this.paper.text(i+this.measureText(e).width/2,r-this.state.font_size/(2.25*this.state.scale.y),e).attr(this.attributes),this}save(){return this.state_stack.push({state:{font_family:this.state.font_family},attributes:{font:this.attributes.font,fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color}}),this}restore(){const 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}}const attrNamesToIgnoreMap={path:{x:!0,y:!0,width:!0,height:!0},rect:{},text:{width:!0,height:!0}};{const t={"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0};Vex.Merge(attrNamesToIgnoreMap.rect,t),Vex.Merge(attrNamesToIgnoreMap.path,t)}class SVGContext{constructor(e){this.element=e,this.svgNS="http://www.w3.org/2000/svg";const i=this.create("svg");this.element.appendChild(i),this.svg=i,this.groups=[this.svg],this.parent=this.svg,this.path="",this.pen={x:NaN,y:NaN},this.lineWidth=1,this.state={scale:{x:1,y:1},"font-family":"Arial","font-size":"8pt","font-weight":"normal"},this.attributes={"stroke-width":.3,fill:"black",stroke:"black","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[],this.iePolyfill()}create(e){return document.createElementNS(this.svgNS,e)}openGroup(e,i,r){const s=this.create("g");return this.groups.push(s),this.parent.appendChild(s),this.parent=s,e&&s.setAttribute("class",Vex.Prefix(e)),i&&s.setAttribute("id",Vex.Prefix(i)),r&&r.pointerBBox&&s.setAttribute("pointer-events","bounding-box"),s}closeGroup(){this.groups.pop(),this.parent=this.groups[this.groups.length-1]}add(e){this.parent.appendChild(e)}iePolyfill(){typeof navigator<"u"&&(this.ie=/MSIE 9/i.test(navigator.userAgent)||/MSIE 10/i.test(navigator.userAgent)||/rv:11\.0/i.test(navigator.userAgent)||/Trident/i.test(navigator.userAgent))}setFont(e,i,r){let s=!1,o=!1,a="normal";typeof r=="string"&&(r.indexOf("italic")!==-1&&(r=r.replace(/italic/g,""),o=!0),r.indexOf("bold")!==-1&&(r=r.replace(/bold/g,""),s=!0),r=r.replace(/ /g,"")),r=s?"bold":r,r=typeof r>"u"||r===""?"normal":r,a=o?"italic":a;const l={"font-family":e,"font-size":i+"pt","font-weight":r,"font-style":a};return this.fontSize=Number(i),Vex.Merge(this.attributes,l),Vex.Merge(this.state,l),this}setRawFont(e){e=e.trim();const i=e.split(" ");return this.attributes["font-family"]=i[1],this.state["font-family"]=i[1],this.attributes["font-size"]=i[0],this.state["font-size"]=i[0],this.fontSize=Number(i[0].match(/\d+/)),this}setFillStyle(e){return this.attributes.fill=e,this}setBackgroundFillStyle(e){return this.background_attributes.fill=e,this.background_attributes.stroke=e,this}setStrokeStyle(e){return this.attributes.stroke=e,this}setShadowColor(e){return this.shadow_attributes.color=e,this}setShadowBlur(e){return this.shadow_attributes.width=e,this}setLineWidth(e){this.attributes["stroke-width"]=e,this.lineWidth=e}setLineDash(e){if(Object.prototype.toString.call(e)==="[object Array]")return e=e.join(", "),this.attributes["stroke-dasharray"]=e,this;throw new Vex.RERR("ArgumentError","lineDash must be an array of integers.")}setLineCap(e){return this.attributes["stroke-linecap"]=e,this}resize(e,i){this.width=e,this.height=i,this.element.style.width=e;const r={width:e,height:i};return this.applyAttributes(this.svg,r),this.scale(this.state.scale.x,this.state.scale.y),this}scale(e,i){this.state.scale={x:e,y:i};const r=this.width/e,s=this.height/i;return this.setViewBox(0,0,r,s),this}setViewBox(...e){if(e.length===1){const[i]=e;this.svg.setAttribute("viewBox",i)}else{const[i,r,s,o]=e,a=i+" "+r+" "+s+" "+o;this.svg.setAttribute("viewBox",a)}}applyAttributes(e,i){const r=attrNamesToIgnoreMap[e.nodeName];return Object.keys(i).forEach(s=>{r&&r[s]||e.setAttributeNS(null,s,i[s])}),e}clear(){for(;this.svg.lastChild;)this.svg.removeChild(this.svg.lastChild);this.scale(this.state.scale.x,this.state.scale.y)}rect(e,i,r,s,o){s<0&&(i+=s,s*=-1);const a=this.create("rect");return typeof o>"u"&&(o={fill:"none","stroke-width":this.lineWidth,stroke:this.attributes.stroke}),Vex.Merge(o,{x:e,y:i,width:r,height:s}),this.applyAttributes(a,o),this.add(a),this}fillRect(e,i,r,s){return s<0&&(i+=s,s*=-1),this.rect(e,i,r,s,this.attributes),this}clearRect(e,i,r,s){return this.rect(e,i,r,s,this.background_attributes),this}beginPath(){return this.path="",this.pen.x=NaN,this.pen.y=NaN,this}moveTo(e,i){return this.path+="M"+e+" "+i,this.pen.x=e,this.pen.y=i,this}lineTo(e,i){return this.path+="L"+e+" "+i,this.pen.x=e,this.pen.y=i,this}bezierCurveTo(e,i,r,s,o,a){return this.path+="C"+e+" "+i+","+r+" "+s+","+o+" "+a,this.pen.x=o,this.pen.y=a,this}quadraticCurveTo(e,i,r,s){return this.path+="Q"+e+" "+i+","+r+" "+s,this.pen.x=r,this.pen.y=s,this}arc(e,i,r,s,o,a){function l(u){for(;u<0;)u+=Math.PI*2;for(;u>Math.PI*2;)u-=Math.PI*2;return u}if(s=l(s),o=l(o),s>o){const u=s;s=o,o=u,a=!a}const c=o-s;return c>Math.PI?(this.arcHelper(e,i,r,s,s+c/2,a),this.arcHelper(e,i,r,s+c/2,o,a)):this.arcHelper(e,i,r,s,o,a),this}arcHelper(e,i,r,s,o,a){const l=e+r*Math.cos(s),c=i+r*Math.sin(s),u=e+r*Math.cos(o),m=i+r*Math.sin(o);let d=0,g=0;a?(g=1,o-sMath.PI&&(d=1),this.path+="M"+l+" "+c+" A"+r+" "+r+" 0 "+d+" "+g+" "+u+" "+m,!isNaN(this.pen.x)&&!isNaN(this.pen.y)&&(this.peth+="M"+this.pen.x+" "+this.pen.y)}closePath(){return this.path+="Z",this}glow(){if(this.shadow_attributes.width>0){const e=this.shadow_attributes,i=e.width/2;for(let r=1;r<=i;r++){const s={stroke:e.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(e.width*.4/i*r).toFixed(3),opacity:+((e.opacity||.3)/i).toFixed(3)},o=this.create("path");s.d=this.path,this.applyAttributes(o,s),this.add(o)}}return this}fill(e){this.glow();const i=this.create("path");let r=e;return typeof e>"u"?(e={},Vex.Merge(e,this.attributes),e.stroke="none",r=e):(r=e,Vex.Merge(r,this.attributes),e.class&&(r.class=e.class),e.id&&(r.id=e.id)),e.d=this.path,this.applyAttributes(i,e),this.add(i),this}stroke(e=void 0){this.glow();const i=this.create("path"),r={};return Vex.Merge(r,this.attributes),e&&Vex.Merge(r,e),r.fill="none",r["stroke-width"]=this.lineWidth,r.d=this.path,this.applyAttributes(i,r),this.add(i),this}measureText(e){const i=this.create("text");if(typeof i.getBBox!="function")return{x:0,y:0,width:0,height:0};i.textContent=e,this.applyAttributes(i,this.attributes),this.svg.appendChild(i);let r=i.getBBox();return this.ie&&e!==""&&this.attributes["font-style"]==="italic"&&(r=this.ieMeasureTextFix(r,e)),this.svg.removeChild(i),r}ieMeasureTextFix(e){const i=Number(this.fontSize),r=1.196,s=1.9598,o=r*i+s,a=e.width-o,l=e.height-1.5;return{x:e.x,y:e.y,width:a,height:l}}fillText(e,i,r){if(!e||e.length<=0)return;const s={};Vex.Merge(s,this.attributes),s.stroke="none",s.x=i,s.y=r;const o=this.create("text");o.textContent=e,this.applyAttributes(o,s),this.add(o)}save(){return this.state_stack.push({state:{"font-family":this.state["font-family"],"font-weight":this.state["font-weight"],"font-style":this.state["font-style"],"font-size":this.state["font-size"],scale:this.state.scale},attributes:{"font-family":this.attributes["font-family"],"font-weight":this.attributes["font-weight"],"font-style":this.attributes["font-style"],"font-size":this.attributes["font-size"],fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"],"stroke-dasharray":this.attributes["stroke-dasharray"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color},lineWidth:this.lineWidth}),this}restore(){const 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}}let lastContext=null;class Renderer{static get Backends(){return{CANVAS:1,RAPHAEL:2,SVG:3,VML:4}}static get LineEndType(){return{NONE:1,UP:2,DOWN:3}}static get USE_CANVAS_PROXY(){return!1}static get lastContext(){return lastContext}static set lastContext(e){lastContext=e}static buildContext(e,i,r,s,o){const a=new Renderer(e,i);r&&s&&a.resize(r,s),o||(o="#FFF");const l=a.getContext();return l.setBackgroundFillStyle(o),Renderer.lastContext=l,l}static getCanvasContext(e,i,r,s){return Renderer.buildContext(e,Renderer.Backends.CANVAS,i,r,s)}static getRaphaelContext(e,i,r,s){return Renderer.buildContext(e,Renderer.Backends.RAPHAEL,i,r,s)}static getSVGContext(e,i,r,s){return Renderer.buildContext(e,Renderer.Backends.SVG,i,r,s)}static bolsterCanvasContext(e){if(Renderer.USE_CANVAS_PROXY)return new CanvasContext(e);const i=["clear","setFont","setRawFont","setFillStyle","setBackgroundFillStyle","setStrokeStyle","setShadowColor","setShadowBlur","setLineWidth","setLineCap","setLineDash","openGroup","closeGroup","getGroup"];return e.vexFlowCanvasContext=e,i.forEach(r=>{e[r]=e[r]||CanvasContext.prototype[r]}),e}static drawDashedLine(e,i,r,s,o,a){e.beginPath();const l=s-i,c=o-r,u=Math.atan2(c,l);let m=i,d=r;e.moveTo(i,r);let g=0,y=!0;for(;!((l<0?m<=s:m>=s)&&(c<0?d<=o:d>=o));){const b=a[g++%a.length],S=m+Math.cos(u)*b;m=l<0?Math.max(s,S):Math.min(s,S);const E=d+Math.sin(u)*b;d=c<0?Math.max(o,E):Math.min(o,E),y?e.lineTo(m,d):e.moveTo(m,d),y=!y}e.closePath(),e.stroke()}constructor(e,i){if(this.elementId=e,!this.elementId)throw new Vex.RERR("BadArgument","Invalid id for renderer.");if(this.element=document.getElementById(e),this.element||(this.element=e),this.ctx=null,this.paper=null,this.backend=i,this.backend===Renderer.Backends.CANVAS){if(!this.element.getContext)throw new Vex.RERR("BadElement",`Can't get canvas context from element: ${e}`);this.ctx=Renderer.bolsterCanvasContext(this.element.getContext("2d",{willReadFrequently:!0}))}else if(this.backend===Renderer.Backends.RAPHAEL)this.ctx=new RaphaelContext(this.element);else if(this.backend===Renderer.Backends.SVG)this.ctx=new SVGContext(this.element);else throw new Vex.RERR("InvalidBackend",`No support for backend: ${this.backend}`)}resize(e,i){if(this.backend===Renderer.Backends.CANVAS){if(!this.element.getContext)throw new Vex.RERR("BadElement",`Can't get canvas context from element: ${this.elementId}`);[e,i]=CanvasContext.SanitizeCanvasDims(e,i);const r=window.devicePixelRatio||1;this.element.width=e*r,this.element.height=i*r,this.element.style.width=e+"px",this.element.style.height=i+"px",this.ctx=Renderer.bolsterCanvasContext(this.element.getContext("2d",{willReadFrequently:!0})),this.ctx.scale(r,r)}else this.ctx.resize(e,i);return this}getContext(){return this.ctx}}function L$j(...t){Stem.DEBUG&&Vex.L("Vex.Flow.Stem",t)}class Stem extends Element$1{static get CATEGORY(){return"stem"}static get UP(){return 1}static get DOWN(){return-1}static get WIDTH(){return Flow.STEM_WIDTH}static get HEIGHT(){return Flow.STEM_HEIGHT}constructor(e={}){super(),this.setAttribute("type","Stem"),this.x_begin=e.x_begin||0,this.x_end=e.x_end||0,this.y_top=e.y_top||0,this.y_bottom=e.y_bottom||0,this.stem_extension=e.stem_extension||0,this.stem_direction=e.stem_direction||0,this.hide=e.hide||!1,this.isStemlet=e.isStemlet||!1,this.stemletHeight=e.stemletHeight||0,this.renderHeightAdjustment=0,this.setOptions(e)}setResetHeight(e){this.resetHeight=e}setOptions(e){this.stem_up_y_offset=e.stem_up_y_offset||0,this.stem_down_y_offset=e.stem_down_y_offset||0}setNoteHeadXBounds(e,i){return this.x_begin=e,this.x_end=i,this}setDirection(e){this.stem_direction=e}setExtension(e){this.stem_extension=e}getExtension(){return this.stem_extension}setYBounds(e,i){this.y_top=e,this.y_bottom=i}getCategory(){return Stem.CATEGORY}getHeight(){const e=this.stem_direction===Stem.UP?this.stem_up_y_offset:this.stem_down_y_offset;return(this.y_bottom-this.y_top)*this.stem_direction+(Stem.HEIGHT-e+this.stem_extension)*this.stem_direction}getBoundingBox(){throw new Vex.RERR("NotImplemented","getBoundingBox() not implemented.")}getExtents(){const e=this.stem_direction===Stem.UP,i=[this.y_top,this.y_bottom],r=Stem.HEIGHT+this.stem_extension,s=(e?Math.min:Math.max)(...i),o=(e?Math.max:Math.min)(...i);return{topY:s+r*-this.stem_direction,baseY:o}}setVisibility(e){return this.hide=!e,this}setStemlet(e,i){return this.isStemlet=e,this.stemletHeight=i,this}draw(){if(this.setRendered(),this.hide)return;const e=this.checkContext();let i,r;const s=this.stem_direction;s===Stem.DOWN?(i=this.x_begin,r=this.y_top+this.stem_down_y_offset):(i=this.x_end,r=this.y_bottom-this.stem_up_y_offset);const o=this.getHeight();L$j("Rendering stem - ","Top Y: ",this.y_top,"Bottom Y: ",this.y_bottom);const a=this.isStemlet?o-this.stemletHeight*this.stem_direction:0;if(e.save(),this.applyStyle(e),e.beginPath(),e.setLineWidth(Stem.WIDTH),e.moveTo(i,r-a),e.lineTo(i,r-o-this.renderHeightAdjustment*s),e.svg){const l={class:Vex.Prefix("stem")};this.id&&(l.id=this.id),e.stroke(l)}else e.stroke();this.restoreStyle(e),e.restore()}}let Tuplet$1=class dt extends Element$1{static get LOCATION_TOP(){return 1}static get LOCATION_BOTTOM(){return-1}static get NESTING_OFFSET(){return 15}constructor(e,i){if(super(),this.setAttribute("type","Tuplet"),!e||!e.length)throw new Vex.RuntimeError("BadArguments","No notes provided for tuplet.");this.options=Vex.Merge({},i),this.notes=e,this.num_notes="num_notes"in this.options?this.options.num_notes:e.length,this.options.beats_occupied&&this.beatsOccupiedDeprecationWarning(),this.notes_occupied=this.options.notes_occupied||this.options.beats_occupied||2,"bracketed"in this.options?this.bracketed=this.options.bracketed:this.bracketed=e.some(r=>r.beam===null),this.ratioed="ratioed"in this.options?this.options.ratioed:Math.abs(this.notes_occupied-this.num_notes)>1,this.point=28,this.y_pos=16,this.x_pos=100,this.width=200,this.location=this.options.location||dt.LOCATION_TOP,Formatter.AlignRestsToNotes(e,!0,!0),this.resolveGlyphs(),this.attach()}attach(){for(let 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)}getNestedTupletCount(){const e=this.location,i=this.notes[0];let r=o(i,e),s=o(i,e);function o(a,l){return a.tupletStack.filter(c=>c.location===l).length}return this.notes.forEach(a=>{const l=o(a,e);r=l>r?l:r,s=ls&&(s=a)}}return s+e+i}draw(){this.checkContext(),this.setRendered();const e=this.notes[0],i=this.notes[this.notes.length-1];this.bracketed?(this.x_pos=e.getTieLeftX()-5,this.width=i.getTieRightX()-this.x_pos+5):(this.x_pos=e.getStemX(),this.width=i.getStemX()-this.x_pos),this.y_pos=this.getYPosition();const r=(l,c)=>l+c.getMetrics().width;let s=this.numerator_glyphs.reduce(r,0);this.ratioed&&(s=this.denom_glyphs.reduce(r,s),s+=this.point*.32);const a=this.x_pos+this.width/2-s/2;if(this.bracketed){const l=this.width/2-s/2-5;l>0&&(this.context.fillRect(this.x_pos,this.y_pos,l,1),this.context.fillRect(this.x_pos+this.width/2+s/2+5,this.y_pos,l,1),this.context.fillRect(this.x_pos,this.y_pos+(this.location===dt.LOCATION_BOTTOM),1,this.location*10),this.context.fillRect(this.x_pos+this.width,this.y_pos+(this.location===dt.LOCATION_BOTTOM),1,this.location*10))}if(this.RenderTupletNumber!==!1){let l=0;this.numerator_glyphs.forEach(c=>{c.render(this.context,a+l,this.y_pos+this.point/3-2),l+=c.getMetrics().width})}if(this.ratioed){const l=a+x_offset+this.point*.16,c=this.point*.06;this.context.beginPath(),this.context.arc(l,this.y_pos-this.point*.08,c,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),this.context.beginPath(),this.context.arc(l,this.y_pos+this.point*.12,c,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),x_offset+=this.point*.32,this.denom_glyphs.forEach(u=>{u.render(this.context,a+x_offset,this.y_pos+this.point/3-2),x_offset+=u.getMetrics().width})}}};function calculateStemDirection(t){let e=0;return t.forEach(i=>{i.keyProps&&i.keyProps.forEach(r=>{e+=r.line-3})}),e>=0?Stem.DOWN:Stem.UP}const getStemSlope=(t,e)=>{const i=t.getStemExtents().topY,r=t.getStemX(),s=e.getStemExtents().topY,o=e.getStemX();return(s-i)/(o-r)},BEAM_LEFT="L",BEAM_RIGHT="R",BEAM_BOTH="B";let Beam$1=class Qt extends Element$1{static getDefaultBeamGroups(e){(!e||e==="c")&&(e="4/4");const r={"1/2":["1/2"],"2/2":["1/2"],"3/2":["1/2"],"4/2":["1/2"],"1/4":["1/4"],"2/4":["1/4"],"3/4":["1/4"],"4/4":["1/4"],"1/8":["1/8"],"2/8":["2/8"],"3/8":["3/8"],"4/8":["2/8"],"1/16":["1/16"],"2/16":["2/16"],"3/16":["3/16"],"4/16":["2/16"]}[e];if(r===void 0){const s=parseInt(e.split("/")[0],10),o=parseInt(e.split("/")[1],10);if(s%3===0)return[new Fraction(3,o)];if(o>4)return[new Fraction(2,o)];if(o<=4)return[new Fraction(1,o)]}else return r.map(s=>new Fraction().parse(s));return[new Fraction(1,4)]}static applyAndGetBeams(e,i,r){return Qt.generateBeams(e.getTickables(),{groups:r,stem_direction:i})}static generateBeams(e,i){i||(i={}),(!i.groups||!i.groups.length)&&(i.groups=[new Fraction(2,8)]);const r=i.groups.map(P=>{if(!P.multiply)throw new Vex.RuntimeError("InvalidBeamGroups","The beam groups must be an array of Vex.Flow.Fractions");return P.clone().multiply(Flow.RESOLUTION,1)}),s=e;let o=0,a=[],l=[];function c(P){return P.reduce((T,M)=>M.getTicks().clone().add(T),new Fraction(0,1))}function u(){r.length-1>o?o+=1:o=0}function m(){let P=[];s.forEach(T=>{if(P=[],T.shouldIgnoreTicks()){a.push(l),l=P;return}l.push(T);const M=r[o].clone(),C=c(l),I=Flow.durationToNumber(T.duration)<8;I&&T.tuplet&&(M.numerator*=2),C.greaterThan(M)?(I||P.push(l.pop()),a.push(l),l=P,u()):C.equals(M)&&(a.push(l),l=P,u())}),l.length>0&&a.push(l)}function d(){return a.filter(P=>{if(P.length>1){let T=!0;return P.forEach(M=>{M.getIntrinsicTicks()>=Flow.durationToTicks("4")&&(T=!1)}),T}return!1})}function g(){const P=[];a.forEach(T=>{let M=[];T.forEach((C,I,D)=>{const G=I===0||I===D.length-1,$=D[I-1],N=!i.beam_rests&&C.isRest(),z=i.beam_rests&&i.beam_middle_only&&C.isRest()&&G;let R=!1;if(i.maintain_stem_directions&&$&&!C.isRest()&&!$.isRest()){const V=$.getStemDirection();R=C.getStemDirection()!==V}const H=parseInt(C.duration,10)<8;N||z||R||H?(M.length>0&&P.push(M),M=R?[C]:[]):M.push(C)}),M.length>0&&P.push(M)}),a=P}function y(){a.forEach(P=>{let T;if(i.maintain_stem_directions){const M=b(P);T=M?M.getStemDirection():Stem.UP}else i.stem_direction?T=i.stem_direction:T=calculateStemDirection(P);S(P,T)})}function b(P){for(let T=0;T{M.setStemDirection(T)})}function E(){const P=[];return a.forEach(T=>{let M=null;T.forEach(C=>{C.tuplet&&M!==C.tuplet&&(M=C.tuplet,P.push(M))})}),P}m(),g(),y();const x=d(),A=E(),_=[];return x.forEach(P=>{const T=new Qt(P);i.show_stemlets&&(T.render_options.show_stemlets=!0),i.secondary_breaks&&(T.render_options.secondary_break_ticks=Flow.durationToTicks(i.secondary_breaks)),i.flat_beams===!0&&(T.render_options.flat_beams=!0,T.render_options.flat_beam_offset=i.flat_beam_offset),_.push(T)}),A.forEach(P=>{const T=P.notes[0].stem_direction===Stem.DOWN?Tuplet$1.LOCATION_BOTTOM:Tuplet$1.LOCATION_TOP;P.setTupletLocation(T);let M=!1;for(let C=0;C=Flow.durationToTicks("4"))throw new Vex.RuntimeError("BadArguments","Beams can only be applied to notes shorter than a quarter note.");let r,s;for(this.stem_direction=Stem.UP,r=0;rl+c.stem_direction,0)>-1?Stem.UP:Stem.DOWN),r=0;rr.getGlyph().beam_count).reduce((r,s)=>s>r?s:r)}breakSecondaryAt(e){return this.break_on_indices=e,this}getSlopeY(e,i,r,s){return r+(e-i)*s}calculateSlope(){const{notes:e,stem_direction:i,render_options:{max_slope:r,min_slope:s,slope_iterations:o,slope_cost:a}}=this,l=e[0],c=getStemSlope(l,e[e.length-1]),u=(r-s)/o;let m=Number.MAX_VALUE,d=0,g=0;for(let y=s;y<=r;y+=u){let b=0,S=0;for(let _=1;_E)&&(u=E,l=Math.min(...S.getYs()),c=S.getBeamCount())}let m=a/e.length;const d=r*1.5,g=s+c*d,y=l+g*-i;i===Stem.DOWN&&my&&(m=l-g),o+this.render_options.flat_beam_offset_per_beam>0?i===Stem.DOWN&&m>o&&!this.render_options.flat_beams?this.render_options.flat_beam_offset=m:i===Stem.UP&&m0){let s=this.render_options.flat_beam_offset;this.render_options.flat_beam_offset_per_beam&&(s+=this.render_options.flat_beam_offset_per_beam*this.getBeamCount());let o=this.notes[0].note_heads[0].y;const a=this.stem_direction>0?Math.min:Math.max;for(const l of this.notes)for(const c of l.note_heads)o=a(o,c.y);r=o+s*-this.stem_direction}return r}applyStemExtensions(){const{notes:e,slope:i,y_shift:r,stem_direction:s,beam_count:o,render_options:{show_stemlets:a,stemlet_extension:l,beam_width:c}}=this,u=e[0],m=this.getBeamYToDraw(),d=u.getStemX();for(let g=0;g=8&&(y=this.break_on_indices.indexOf(m)!==-1,this.render_options.secondary_break_ticks&&c>=this.render_options.secondary_break_ticks&&(c=0,y=!0));const b=d.getIntrinsicTicks(){e.getStem()&&(this.context.openGroup("stem",e.getAttribute("id")+"-stem"),e.getStem().setContext(this.context).draw(),this.context.closeGroup())},this)}drawBeamLines(){this.checkContext();const e=["4","8","16","32","64"],i=this.notes[0];let r=this.getBeamYToDraw();const s=i.getStemX(),o=this.render_options.beam_width*this.stem_direction,a={};for(const l of this.notes)a[l.getAttribute("id")]=0;for(let l=0;l{e.getStave()||e.setStave(this.stave)}),this.preFormatted=!0,this)}draw(e=this.context,i=this.stave){this.setRendered();let r=null;for(let s=0;s0&&r){const a=o.getBoundingBox();a&&r.mergeWith(a)}o.setContext(e),o.drawWithStyle()}this.boundingBox=r}};function drawBoldDoubleLine(t,e,i,r,s){if(e!==StaveConnector.type.BOLD_DOUBLE_LEFT&&e!==StaveConnector.type.BOLD_DOUBLE_RIGHT)throw new Vex.RERR("InvalidConnector","A REPEAT_BEGIN or REPEAT_END type must be provided.");let o=3,a=3.5;const l=2;e===StaveConnector.type.BOLD_DOUBLE_RIGHT&&(o=-5,a=3),t.fillRect(i+o,r,1,s-r),t.fillRect(i-l,r,a,s-r)}class StaveConnector extends Element$1{static get type(){return{SINGLE_RIGHT:0,SINGLE_LEFT:1,SINGLE:1,DOUBLE:2,BRACE:3,BRACKET:4,BOLD_DOUBLE_LEFT:5,BOLD_DOUBLE_RIGHT:6,THIN_DOUBLE:7,NONE:8}}static get typeString(){return{singleRight:StaveConnector.type.SINGLE_RIGHT,singleLeft:StaveConnector.type.SINGLE_LEFT,single:StaveConnector.type.SINGLE,double:StaveConnector.type.DOUBLE,brace:StaveConnector.type.BRACE,bracket:StaveConnector.type.BRACKET,boldDoubleLeft:StaveConnector.type.BOLD_DOUBLE_LEFT,boldDoubleRight:StaveConnector.type.BOLD_DOUBLE_RIGHT,thinDouble:StaveConnector.type.THIN_DOUBLE,none:StaveConnector.type.NONE}}constructor(e,i){super(),this.setAttribute("type","StaveConnector"),this.thickness=Flow.STAVE_LINE_THICKNESS,this.width=3,this.top_stave=e,this.bottom_stave=i,this.type=StaveConnector.type.DOUBLE,this.font={family:"times",size:16,weight:"normal"},this.x_shift=0,this.texts=[]}setType(e){return e=typeof e=="string"?StaveConnector.typeString[e]:e,e>=StaveConnector.type.SINGLE_RIGHT&&e<=StaveConnector.type.NONE&&(this.type=e),this}setText(e,i){return this.texts.push({content:e,options:Vex.Merge({shift_x:0,shift_y:0},i)}),this}setFont(e){Vex.Merge(this.font,e)}setXShift(e){if(typeof e!="number")throw Vex.RERR("InvalidType","x_shift must be a Number");return this.x_shift=e,this}draw(){const e=this.checkContext();this.setRendered();let i=this.top_stave.getYForLine(0),r=this.bottom_stave.getYForLine(this.bottom_stave.getNumLines()-1)+this.thickness,s=this.width,o=this.top_stave.getX();(this.type===StaveConnector.type.SINGLE_RIGHT||this.type===StaveConnector.type.BOLD_DOUBLE_RIGHT||this.type===StaveConnector.type.THIN_DOUBLE)&&(o=this.top_stave.getX()+this.top_stave.width);let l=r-i;switch(this.type){case StaveConnector.type.SINGLE:s=1;break;case StaveConnector.type.SINGLE_LEFT:s=1;break;case StaveConnector.type.SINGLE_RIGHT:s=1;break;case StaveConnector.type.DOUBLE:o-=this.width+2;break;case StaveConnector.type.BRACE:{s=12;const c=this.top_stave.getX()-2+this.x_shift,u=i,m=c,d=r,g=c-s,y=u+l/2,b=g-.9*s,S=u+.2*l,E=c+1.1*s,x=y-.135*l,A=E,_=y+.135*l,P=b,T=d-.2*l,M=g-s,C=T,I=c+.4*s,D=y+.135*l,G=I,$=y-.135*l,N=M,z=S;e.beginPath(),e.moveTo(c,u),e.bezierCurveTo(b,S,E,x,g,y),e.bezierCurveTo(A,_,P,T,m,d),e.bezierCurveTo(M,C,I,D,g,y),e.bezierCurveTo(G,$,N,z,c,u),e.fill(),e.stroke();break}case StaveConnector.type.BRACKET:i-=4,r+=4,l=r-i,Glyph.renderGlyph(e,o-5,i-3,40,"v1b",!0),Glyph.renderGlyph(e,o-5,r+3,40,"v10",!0),o-=this.width+2;break;case StaveConnector.type.BOLD_DOUBLE_LEFT:drawBoldDoubleLine(e,this.type,o+this.x_shift,i,r);break;case StaveConnector.type.BOLD_DOUBLE_RIGHT:drawBoldDoubleLine(e,this.type,o,i,r);break;case StaveConnector.type.THIN_DOUBLE:s=1;break;case StaveConnector.type.NONE:break;default:throw new Vex.RERR("InvalidType",`The provided StaveConnector.type (${this.type}) is invalid`)}this.type!==StaveConnector.type.BRACE&&this.type!==StaveConnector.type.BOLD_DOUBLE_LEFT&&this.type!==StaveConnector.type.BOLD_DOUBLE_RIGHT&&this.type!==StaveConnector.type.NONE&&e.fillRect(o,i,s,l),this.type===StaveConnector.type.THIN_DOUBLE&&e.fillRect(o-3,i,s,l),e.save(),e.lineWidth=2,e.setFont(this.font.family,this.font.size,this.font.weight);for(let c=0;c0){const E=S.space.deviation,x=E>=0?"+":"";e.setFillStyle("red"),e.fillText(x+Math.round(E),l+i.getXShift(),r-10)}e.restore()}constructor(e){if(super(),this.setAttribute("type","Note"),!e)throw new Vex.RuntimeError("BadArguments","Note must have valid initialization data to identify duration and type.");const i=Flow.parseNoteStruct(e);if(!i)throw new Vex.RuntimeError("BadArguments",`Invalid note initialization object: ${JSON.stringify(e)}`);if(this.duration=i.duration,this.dots=i.dots,this.noteType=i.type,this.customTypes=i.customTypes,e.duration_override?this.setDuration(e.duration_override):this.setIntrinsicTicks(i.ticks),this.modifiers=[],this.glyph=Flow.getGlyphProps(this.duration,this.noteType),this.customGlyphs=this.customTypes.map(r=>Flow.getGlyphProps(this.duration,r)),this.positions&&(typeof this.positions!="object"||!this.positions.length))throw new Vex.RuntimeError("BadArguments","Note keys must be array type.");this.playNote=null,this.tickContext=null,this.modifierContext=null,this.ignore_ticks=!1,this.width=0,this.extraLeftPx=0,this.extraRightPx=0,this.x_shift=0,this.left_modPx=0,this.right_modPx=0,this.voice=null,this.preFormatted=!1,this.ys=[],e.align_center&&this.setCenterAlignment(e.align_center),this.stave=null,this.render_options={annotation_spacing:5,stave_padding:Note.STAVEPADDING}}getPlayNote(){return this.playNote}setPlayNote(e){return this.playNote=e,this}isRest(){return!1}addStroke(e,i){return i.setNote(this),i.setIndex(e),this.modifiers.push(i),this.setPreFormatted(!1),this}getStave(){return this.stave}setStave(e){return this.stave=e,this.setYs([e.getYForLine(0)]),this.context=this.stave.context,this}getCategory(){return Note.CATEGORY}setContext(e){return this.context=e,this}getExtraLeftPx(){return this.extraLeftPx}getExtraRightPx(){return this.extraRightPx}setExtraLeftPx(e){return this.extraLeftPx=e,this}setExtraRightPx(e){return this.extraRightPx=e,this}shouldIgnoreTicks(){return this.ignore_ticks}getLineNumber(){return 0}getLineForRest(){return 0}getGlyph(){return this.glyph}getGlyphWidth(){return this.glyph.getWidth(this.render_options.glyph_font_scale)}setYs(e){return this.ys=e,this}getYs(){if(this.ys.length===0)throw new Vex.RERR("NoYValues","No Y-values calculated for this note.");return this.ys}getYForTopText(e){if(!this.stave)throw new Vex.RERR("NoStave","No stave attached to this note.");return this.stave.getYForTopText(e)}getBoundingBox(){return null}getVoice(){if(!this.voice)throw new Vex.RERR("NoVoice","Note has no voice.");return this.voice}setVoice(e){return this.voice=e,this.preFormatted=!1,this}getTickContext(){return this.tickContext}setTickContext(e){return this.tickContext=e,this.preFormatted=!1,this}getDuration(){return this.duration}isDotted(){return this.dots>0}hasStem(){return!1}getDots(){return this.dots}getNoteType(){return this.noteType}setBeam(){return this}setModifierContext(e){return this.modifierContext=e,this}addModifier(e,i=0){return e.setNote(this),e.setIndex(i),this.modifiers.push(e),this.setPreFormatted(!1),this}getModifierStartXY(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");return{x:this.getAbsoluteX(),y:this.ys[0]}}getMetrics(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call getMetrics on an unformatted note.");let e=0,i=0;this.modifierContext!=null&&(e=this.modifierContext.state.left_shift,i=this.modifierContext.state.right_shift);const r=this.getWidth();return{width:r,noteWidth:r-e-i-this.extraLeftPx-this.extraRightPx,left_shift:this.x_shift,modLeftPx:e,modRightPx:i,extraLeftPx:this.extraLeftPx,extraRightPx:this.extraRightPx}}setWidth(e){this.width=e}getWidth(){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)}setXShift(e){return this.x_shift=e,this}getXShift(){return this.x_shift}getX(){if(!this.tickContext)throw new Vex.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");return this.tickContext.getX()+this.x_shift}getAbsoluteX(){if(!this.tickContext)throw new Vex.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");let e=this.tickContext.getX();return this.stave&&(e+=this.stave.getNoteStartX()+this.render_options.stave_padding),this.isCenterAligned()&&(e+=this.getCenterXShift()),e}setPreFormatted(e){if(this.preFormatted=e,this.preFormatted){const i=this.tickContext.getExtraPx();this.left_modPx=Math.max(this.left_modPx,i.left),this.right_modPx=Math.max(this.right_modPx,i.right)}}}function L$i(...t){NoteHead.DEBUG&&Vex.L("Vex.Flow.NoteHead",t)}function drawSlashNoteHead(t,e,i,r,s,o){const a=Flow.SLASH_NOTEHEAD_WIDTH;t.save(),t.setLineWidth(Flow.STEM_WIDTH);let l=!1;if(Flow.durationToNumber(e)>2&&(l=!0),l||(i-=Flow.STEM_WIDTH/2*s),t.beginPath(),t.moveTo(i,r+o),t.lineTo(i,r+1),t.lineTo(i+a,r-o),t.lineTo(i+a,r),t.lineTo(i,r+o),t.closePath(),l?t.fill():t.stroke(),Flow.durationToFraction(e).equals(.5)){const c=[-3,-1,a+1,a+3];for(let u=0;u5||this.line<0)&&(this.isLedgerLinedRest=!0,this.duration==="h"?(e.custom_glyph_code="rhl",this.x_shift_ledger_rest-=4):this.duration==="w"&&(e.custom_glyph_code="rwl",this.x_shift_ledger_rest-=4,this.y_shift_ledger_rest=-5)),e.custom_glyph_code&&(this.custom_glyph=!0,this.glyph_code=e.custom_glyph_code,this.stem_up_x_offset=e.stem_up_x_offset||0,this.stem_down_x_offset=e.stem_down_x_offset||0,this.stem_up_y_shift=e.stem_up_y_shift||0,this.stem_down_y_shift=e.stem_down_y_shift||0),this.style=e.style,this.slashed=e.slashed,Vex.Merge(this.render_options,{glyph_font_scale:e.glyph_font_scale||Flow.DEFAULT_NOTATION_FONT_SCALE,stroke_px:3}),this.setWidth(this.glyph.getWidth(this.render_options.glyph_font_scale))}getCategory(){return NoteHead.CATEGORY}getWidth(){return this.width}isDisplaced(){return this.displaced===!0}getGlyph(){return this.glyph}setX(e){return this.x=e,this}getY(){return this.y}setY(e){return this.y=e,this}getLine(){return this.line}setLine(e){return this.line=e,this}getAbsoluteX(){const e=this.preFormatted?super.getAbsoluteX():this.x,i=Stem.WIDTH/2;return e+(this.displaced?(this.width-i)*this.stem_direction:0)}getBoundingBox(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");const e=this.stave.getSpacingBetweenLines(),i=e/2,r=this.y-i;return new Flow.BoundingBox(this.getAbsoluteX(),r,this.width,e)}setStave(e){const i=this.getLine();return this.stave=e,this.setY(e.getYForNote(i)),this.context=this.stave.context,this}preFormat(){if(this.preFormatted)return this;const e=this.getWidth()+this.extraLeftPx+this.extraRightPx;return this.setWidth(e),this.setPreFormatted(!0),this}draw(){this.checkContext(),this.setRendered();const e=this.context;let i=this.getAbsoluteX(),r=this.y;this.custom_glyph&&(i+=this.x_shift_ledger_rest,this.stem_direction===Stem.UP?(i+=this.stem_up_x_offset,r+=this.stem_up_y_shift||0):this.stem_direction===Stem.DOWN&&(i+=this.stem_down_x_offset,r+=this.stem_down_y_shift||0),r+=this.y_shift_ledger_rest),L$i("Drawing note head '",this.note_type,this.duration,"' at",i,r);const s=this.stem_direction,o=this.render_options.glyph_font_scale;if(this.style&&this.applyStyle(e),this.note_type==="s"){const a=this.stave.getSpacingBetweenLines();drawSlashNoteHead(e,this.duration,i,r,s,a)}else Glyph.renderGlyph(e,i,r,o,this.glyph_code);this.style&&this.restoreStyle(e)}}class StemmableNote extends Note{constructor(e){super(e),this.setAttribute("type","StemmableNote"),this.stem=null,this.stemExtensionOverride=null,this.beam=null,this.renderFlag=!0}getStem(){return this.stem}setStem(e){return this.stem=e,this}buildStem(){const e=new Stem;return this.setStem(e),this}buildFlag(){const{glyph:e,beam:i}=this,r=i===null&&this.renderFlag;if(e&&e.flag&&r){const s=this.getStemDirection()===Stem.DOWN?e.code_flag_downstem:e.code_flag_upstem;this.flag=new Glyph(s,this.render_options.glyph_font_scale)}}getTopGlyph(){return this.getStemDirection()===Stem.DOWN?this.customGlyphs[this.customGlyphs.length-1]:this.customGlyphs[0]}getStemLength(){return Stem.HEIGHT+this.getStemExtension()}getBeamCount(){const e=this.getGlyph();return e?e.beam_count:0}getStemMinumumLength(){let i=Flow.durationToFraction(this.duration).value()<=1?0:20;switch(this.duration){case"8":this.beam==null&&(i=35);break;case"16":i=this.beam==null?35:25;break;case"32":i=this.beam==null?45:35;break;case"64":i=this.beam==null?50:40;break;case"128":i=this.beam==null?55:45;break}return i}getStemDirection(){return this.stem_direction}setStemDirection(e){if(e||(e=Stem.UP),e!==Stem.UP&&e!==Stem.DOWN)throw new Vex.RERR("BadArgument",`Invalid stem direction: ${e}`);if(this.stem_direction=e,this.stem){this.stem.setDirection(e),this.stem.setExtension(this.getStemExtension());const i=this.getTopGlyph()||this.getGlyph();this.stem.setOptions({stem_up_y_offset:i.stem_up_y_offset,stem_down_y_offset:i.stem_down_y_offset})}return this.reset(),this.flag&&this.renderFlag&&this.buildFlag(),this.beam=null,this.preFormatted&&this.preFormat(),this}getStemX(){const e=this.getAbsoluteX()+this.x_shift,i=this.getAbsoluteX()+this.x_shift+this.getGlyphWidth();return this.stem_direction===Stem.DOWN?e:i}getCenterGlyphX(){return this.getAbsoluteX()+this.x_shift+this.getGlyphWidth()/2}getStemExtension(){const e=this.getGlyph();return this.stemExtensionOverride!=null?this.stemExtensionOverride:e?this.getStemDirection()===1?e.stem_up_extension:e.stem_down_extension:0}setStemLength(e){return this.stemExtensionOverride=e-Stem.HEIGHT,this}getStemExtents(){return this.stem.getExtents()}setBeam(e){return this.beam=e,this}getYForTopText(e){const i=this.getStemExtents();return this.hasStem()?Math.min(this.stave.getYForTopText(e),i.topY-this.render_options.annotation_spacing*(e+1)):this.stave.getYForTopText(e)}getYForBottomText(e){const i=this.getStemExtents();return this.hasStem()?Math.max(this.stave.getYForTopText(e),i.baseY+this.render_options.annotation_spacing*e):this.stave.getYForBottomText(e)}hasFlag(){return this.renderFlag&&Flow.getGlyphProps(this.duration).flag&&!this.beam}postFormat(){return this.beam&&this.beam.postFormat(),this.postFormatted=!0,this}drawStem(e){this.checkContext(),this.setRendered(),this.setStem(new Stem(e)),this.stem.setContext(this.context).draw()}}class Modifier extends Element$1{static get CATEGORY(){return"none"}static get Position(){return{LEFT:1,RIGHT:2,ABOVE:3,BELOW:4}}static get PositionString(){return{above:Modifier.Position.ABOVE,below:Modifier.Position.BELOW,left:Modifier.Position.LEFT,right:Modifier.Position.RIGHT}}constructor(){super(),this.setAttribute("type","Modifier"),this.width=0,this.note=null,this.index=null,this.text_line=0,this.position=Modifier.Position.LEFT,this.modifier_context=null,this.x_shift=0,this.y_shift=0,this.spacingFromNextModifier=0}getCategory(){return Modifier.CATEGORY}getWidth(){return this.width}setWidth(e){return this.width=e,this}getNote(){return this.note}setNote(e){return this.note=e,this}getIndex(){return this.index}setIndex(e){return this.index=e,this}getModifierContext(){return this.modifier_context}setModifierContext(e){return this.modifier_context=e,this}getPosition(){return this.position}setPosition(e){return this.position=typeof e=="string"?Modifier.PositionString[e]:e,this}setTextLine(e){return this.text_line=e,this}setYShift(e){return this.y_shift=e,this}setSpacingFromNextModifier(e){this.spacingFromNextModifier=e}getSpacingFromNextModifier(){return this.spacingFromNextModifier}setXShift(e){this.x_shift=0,this.position===Modifier.Position.LEFT?this.x_shift-=e:this.x_shift+=e}getXShift(){return this.x_shift}draw(){throw this.checkContext(),new Vex.RERR("MethodNotImplemented","draw() not implemented for this modifier.")}alignSubNotesWithNote(e,i){const r=i.getTickContext(),s=r.getExtraPx(),o=r.getX()-s.left-s.extraLeft+this.getSpacingFromNextModifier();e.forEach(a=>{const l=a.getTickContext();a.setStave(i.stave),l.setXOffset(o)})}}class Dot extends Modifier{static get CATEGORY(){return"dots"}static format(e,i){const r=i.right_shift,s=1;if(!e||e.length===0)return!1;const o=[],a={};for(let y=0;yb.line-y.line);let l=r,c=0,u=null,m=null,d=null,g=0;for(let y=0;yc?l:c,u=x,m=S}return i.right_shift+=c,!0}constructor(){super(),this.setAttribute("type","Dot"),this.note=null,this.index=null,this.position=Modifier.Position.RIGHT,this.radius=2,this.setWidth(5),this.dot_shiftY=0}getCategory(){return Dot.CATEGORY}setNote(e){this.note=e,this.note.getCategory()==="gracenotes"&&(this.radius*=.5,this.setWidth(3))}setDotShiftY(e){return this.dot_shiftY=e,this}draw(){if(this.checkContext(),this.setRendered(),!this.note||this.index===null)throw new Vex.RERR("NoAttachedNote","Can't draw dot without a note and index.");const e=this.note.stave.options.spacing_between_lines_px,i=this.note.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});this.note.getCategory()==="tabnotes"&&(i.y=this.note.getStemExtents().baseY+1);const r=i.x+this.x_shift+this.width-this.radius;let s=this.dot_shiftY*e;this.note&&this.note.DYMusicScoreType=="jianpu"&&(s=-5);const o=i.y+this.y_shift+s,a=this.context;a.beginPath(),a.arc(r,o,this.radius,0,Math.PI*2,!1),a.fill()}}function L$h(...t){StaveNote.DEBUG&&Vex.L("Vex.Flow.StaveNote",t)}const getStemAdjustment=t=>Stem.WIDTH/(2*-t.getStemDirection()),isInnerNoteIndex=(t,e)=>e===(t.getStemDirection()===Stem.UP?t.keyProps.length-1:0);function shiftRestVertical(t,e,i){if(t.note.shiftRestVerticalDisabled)return;const r=(e.isrest?0:1)*i;t.line+=r,t.maxLine+=r,t.minLine+=r,t.note.setKeyLine(0,t.note.getKeyLine(0)+r)}function centerRest(t,e,i){const r=t.line-Vex.MidLine(e.minLine,i.maxLine);t.note.setKeyLine(0,t.note.getKeyLine(0)-r),t.line-=r,t.maxLine-=r,t.minLine-=r}class StaveNote extends StemmableNote{static get CATEGORY(){return"stavenotes"}static get STEM_UP(){return Stem.UP}static get STEM_DOWN(){return Stem.DOWN}static get DEFAULT_LEDGER_LINE_OFFSET(){return 3}static renderVibrato(e,i,r,s){let{width:o,height:a,wave_width:l,wave_girth:c,wave_height:u,stem_direction:m}=s;const d=Math.floor(o/l);let g=a/(d/2)*m;g==0&&(m=1,g=.3),e.beginPath(),e.moveTo(i,r+c);for(let y=0;y2?r[1]:null;let c=o>2?r[2]:r[1];o===2&&a.stemDirection===-1&&c.stemDirection===1&&!a.isrest&&!c.isRest&&(a=r[1],c=r[0]);const u=Math.max(a.voice_shift,c.voice_shift);let m=0,d;if(o===2){const g=a.stemDirection===c.stemDirection?0:.5;if(a.stemDirection===c.stemDirection&&a.minLine<=c.maxLine&&(a.isrest||(d=Math.abs(a.line-(c.maxLine+.5)),d=Math.max(d,a.stemMin),a.minLine=a.line-d,a.note.setStemLength(d*10))),a.minLine<=c.maxLine+g)if(a.isrest)shiftRestVertical(a,c,1),a.note.hasLedgerLinedRest&&(a.note.shiftRestVerticalDisabled=!0);else if(c.isrest)shiftRestVertical(c,a,-1),c.note.hasLedgerLinedRest&&(c.note.shiftRestVerticalDisabled=!0);else{m=u;const y=Math.abs(a.line-c.line);let b=0,S=0;a.note.duration==="h"?b++:a.note.duration==="w"&&S++,c.note.duration==="h"?b++:c.note.duration==="w"&&S++;let E=b===1||S===1||a.note.dots!==c.note.dots;if(s&&(E=E||S===2),y===0&&E){if(c.note.setXShift(m),a.note.dots>0){let x=0;for(const A of a.note.modifiers)if(A instanceof Dot&&(x++,A.setYShift(-10*(c.maxLine-a.line+1)),x===a.note.dots))break}}else y<1&&y>0?c.note.setXShift(m):a.note.voice!==c.note.voice&&a.stemDirection===c.stemDirection&&(a.line>c.line?a.stemDirection===1?c.note.renderFlag=!1:a.note.renderFlag=!1:c.line>a.line?c.stemDirection===1?a.note.renderFlag=!1:c.note.renderFlag=!1:c.stemDirection===1&&(c.stemDirection=-1,c.note.setStemDirection(-1)))}return!0}if(l!==null&&l.minLinei.postFormat()),!0):!1}constructor(e){if(super(e),this.setAttribute("type","StaveNote"),this.keys=e.keys,this.clef=e.clef,this.octave_shift=e.octave_shift,this.beam=null,this.vibrato=null,this.slideNote=null,this.glyph=Flow.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new Vex.RuntimeError("BadArguments",`Invalid note initialization data (No glyph found): ${JSON.stringify(e)}`);this.displaced=!1,this.dot_shiftY=0,this.addDotsCount=0,this.keyProps=[],this.use_default_head_x=!1,this.paddingRight=0,this.note_heads=[],this.modifiers=[],Vex.Merge(this.render_options,{glyph_font_scale:e.glyph_font_scale||Flow.DEFAULT_NOTATION_FONT_SCALE,stroke_px:e.stroke_px||StaveNote.DEFAULT_LEDGER_LINE_OFFSET}),this.calculateKeyProps(),this.buildStem(),e.auto_stem?this.autoStem():this.setStemDirection(e.stem_direction),this.reset(),this.buildFlag()}reset(){super.reset();const e=this.note_heads.map(r=>r.getStyle()),i=[];this.note_heads.forEach(r=>i.push(r.note_type)),this.buildNoteHeads(),this.note_heads.forEach((r,s)=>{r.setStyle(e[s]),i[s]&&(r.note_type=i[s])}),this.stave&&this.note_heads.forEach(r=>r.setStave(this.stave)),this.calcExtraPx()}setBeam(e){return this.beam=e,this.calcExtraPx(),this}setVibrato(e){this.vibrato=e}setSlideNote(e){this.slideNote=e}getCategory(){return StaveNote.CATEGORY}buildStem(){this.setStem(new Stem({hide:!!this.isRest()})),this.stem.id=Vex.Prefix(`${this.getAttribute("id")}-stem`)}buildNoteHeads(){this.note_heads=[];const e=this.getStemDirection(),i=this.getKeys();let r=null,s=null,o=!1,a,l,c;e===Stem.UP?(a=0,l=i.length,c=1):e===Stem.DOWN&&(a=i.length-1,l=-1,c=-1);for(let u=a;u!==l;u+=c){const m=this.keyProps[u],d=m.line;r===null?r=d:(s=Math.abs(r-d),s===0||s===.5?o=!o:(o=!1,this.use_default_head_x=!0)),r=d;const g=new NoteHead({duration:this.duration,note_type:this.noteType,displaced:o,stem_direction:e,custom_glyph_code:m.code,glyph_font_scale:this.render_options.glyph_font_scale,x_shift:m.shift_right,stem_up_x_offset:m.stem_up_x_offset,stem_down_x_offset:m.stem_down_x_offset,stem_up_y_shift:m.stem_up_y_shift,stem_down_y_shift:m.stem_down_y_shift,line:m.line});g.isLedgerLinedRest&&(this.hasLedgerLinedRest=!0),this.note_heads[u]=g}}autoStem(){this.minLine=this.keyProps[0].line,this.maxLine=this.keyProps[this.keyProps.length-1].line;const e=3,r=(this.minLine+this.maxLine)/20&&(this.keyProps[i-1].displaced=!0)),e=a,this.keyProps.push(o)}e=-1/0,this.keyProps.forEach(i=>{i.linei.line-r.line)}getBoundingBox(){if(!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");const{width:e,modLeftPx:i,extraLeftPx:r}=this.getMetrics(),s=this.getAbsoluteX()-i-r-this.paddingRight;let o=0,a=0;const l=this.getStave().getSpacingBetweenLines()/2,c=l*2;if(this.isRest()){const u=this.ys[0],m=Flow.durationToFraction(this.duration);m.equals(1)||m.equals(2)?(o=u-l,a=u+l):(o=u-this.glyph.line_above*c,a=u+this.glyph.line_below*c)}else if(this.glyph.stem){const u=this.getStemExtents();u.baseY+=l*this.stem_direction,o=Math.min(u.topY,u.baseY),a=Math.max(u.topY,u.baseY)}else{o=null,a=null;for(let u=0;ui&&(i=s):s1}hasStem(){return this.glyph.stem}hasFlag(){return super.hasFlag()&&!this.isRest()&&this.renderFlag}getStemX(){return this.noteType==="r"?this.getCenterGlyphX():super.getStemX()+getStemAdjustment(this)}getYForTopText(e){const i=this.getStemExtents();return Math.min(this.stave.getYForTopText(e),i.topY-this.render_options.annotation_spacing*(e+1))}getYForBottomText(e){const i=this.getStemExtents();return Math.max(this.stave.getYForTopText(e),i.baseY+this.render_options.annotation_spacing*e)}setStave(e){super.setStave(e);const i=this.note_heads.map(r=>(r.setStave(e),r.getY()));if(this.setYs(i),this.stem){const{y_top:r,y_bottom:s}=this.getNoteHeadBounds();this.stem.setYBounds(r,s)}return this}getKeys(){return this.keys}getKeyProps(){return this.keyProps}isDisplaced(){return this.displaced}setNoteDisplaced(e){return this.displaced=e,this}getTieRightX(){let e=this.getAbsoluteX();return e+=this.getGlyphWidth()+this.x_shift+this.extraRightPx,this.modifierContext&&(e+=this.modifierContext.getExtraRightPx()),e}getTieLeftX(){let e=this.getAbsoluteX();return e+=this.x_shift-this.extraLeftPx,e}getLineForRest(){let e=this.keyProps[0].line;if(this.keyProps.length>1){const i=this.keyProps[this.keyProps.length-1].line,r=Math.max(e,i),s=Math.min(e,i);e=Vex.MidLine(r,s)}return e}getModifierStartXY(e,i,r){if(r=r||{},!this.preFormatted)throw new Vex.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(this.ys.length===0)throw new Vex.RERR("NoYValues","No Y-Values calculated for this note.");const{ABOVE:s,BELOW:o,LEFT:a,RIGHT:l}=Modifier.Position;let c=0;return e===a?c=-1*2:e===l?(c=this.getGlyphWidth()+this.x_shift+2,this.stem_direction===Stem.UP&&this.hasFlag()&&(r.forceFlagRight||isInnerNoteIndex(this,i))&&(c+=this.flag.getMetrics().width)):(e===o||e===s)&&(c=this.getGlyphWidth()/2),{x:this.getAbsoluteX()+c,y:this.ys[i]}}setStyle(e){super.setStyle(e),this.note_heads.forEach(i=>i.setStyle(e)),this.stem&&this.stem.setStyle(e)}setStemStyle(e){this.stem&&this.getStem().setStyle(e)}getStemStyle(){return this.stem.getStyle()}setLedgerLineStyle(e){this.ledgerLineStyle=e}getLedgerLineStyle(){return this.ledgerLineStyle}setFlagStyle(e){this.flagStyle=e}getFlagStyle(){return this.flagStyle}setKeyStyle(e,i){return this.note_heads[e].setStyle(i),this}setKeyLine(e,i){return this.keyProps[e].line=i,this.reset(),this}getKeyLine(e){return this.keyProps[e].line}addToModifierContext(e){this.setModifierContext(e);for(let i=0;i{const g=d.getLine(),y=d.getY();(e===null||yi)&&(i=y),s===null&&d.isDisplaced()&&(s=d.getAbsoluteX()),r===null&&!d.isDisplaced()&&(r=d.getAbsoluteX()),o=g>o?g:o,a=g{let T;P&&_?T=S-r:_?T=b-r:T=y-r;const M=_&&P?a:o;s.beginPath(),s.moveTo(T,A),s.lineTo(T+M,A),s.stroke()},x={...e.getStyle()||{},...this.getLedgerLineStyle()||{}};this.applyStyle(s,x);for(let A=6;A<=l;++A){const _=b!==null&&A<=m,P=y!==null&&A<=u;E(e.getYForNote(A),_,P)}for(let A=0;A>=c;--A){const _=b!==null&&A>=g,P=y!==null&&A>=d;E(e.getYForNote(A),_,P)}this.restoreStyle(s,x)}drawVibrato(){if(this.vibrato){const e=this.context,i=this.vibrato.getNoteHeadEndX()+2;let{y_bottom:r}=this.vibrato.getNoteHeadBounds(),{y_top:s}=this.getNoteHeadBounds();const o=r1&&r.getAttribute("type")==="Accidental"&&this.modifiers.findIndex(l=>l.getAttribute("type")==="GraceNoteGroup")>=0)&&!(r.note&&r.note.DYMusicScoreType=="jianpu"&&r.getAttribute("type")==="Dot"&&!r.note.formatterMetrics.duration)){if(r.note&&r.note.DYMusicScoreType=="jianpu"&&r.getAttribute("type")==="Dot")try{r.note.getModifierStartXY(r.position,0,{forceFlagRight:!0}).x-r.note.x<9&&(r.x_shift+=7)}catch(a){console.log("🚀 ~ error:",a)}s.applyStyle(e,o),r.setContext(e),r.drawWithStyle(),s.restoreStyle(e,o)}}e.closeGroup(),this.drawVibrato(),this.drawSlide()}drawFlag(){const{stem:e,beam:i,context:r}=this;if(!r)throw new Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");const s=i===null&&this.renderFlag;if(this.getGlyph().flag&&s){const{y_top:a,y_bottom:l}=this.getNoteHeadBounds(),c=e.getHeight(),u=this.getStemX(),m=this.getStemDirection()===Stem.DOWN?a-c+2:l-c-2;r.openGroup("flag",null,{pointerBBox:!0}),this.applyStyle(r,this.getFlagStyle()||!1),this.flag.render(r,u,m),this.restoreStyle(r,this.getFlagStyle()||!1),r.closeGroup()}}drawNoteHeads(){this.note_heads.forEach(e=>{this.context.openGroup("notehead",null,{pointerBBox:!0});try{if(this.isRest()&&this.duration==="w"){const i=this.stave.options.line_config.filter(s=>s.visible).length;this.keyProps[0].line===4&&i<5&&e.setY(e.getY()+10),i===1&&e.setLine(3)}}catch(i){}e.setContext(this.context).draw(),this.context.closeGroup()})}drawStem(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(`${this.getAttribute("id")}-stem`),this.stem&&(this.context.openGroup("stem",null,{pointerBBox:!0}),this.stem.setContext(this.context).draw(),this.context.closeGroup())}draw(){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(this.ys.length===0)throw new Vex.RERR("NoYValues","Can't draw note without Y values.");const e=this.stave.getLines();if(e===2||e===3||e===4)for(let s=0;ss.setX(i)),this.stem){let s=this.getStemX();const o=this.keyProps[0].line;(o>6.5||o<-.5)&&(this.beam||(this.stem.renderHeightAdjustment=o>6.5?(o-6.5)*10:Math.abs(o+.5)*10)),this.stem.setNoteHeadXBounds(s,s)}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}),r&&this.drawStem(),this.drawNoteHeads(),this.drawFlag(),this.context.closeGroup(),this.drawModifiers(),this.context.closeGroup(),this.restoreStyle(),this.setRendered()}}class FretHandFinger extends Modifier{static get CATEGORY(){return"frethandfinger"}static format(e,i){const{left_shift:r,right_shift:s}=i,o=1;if(!e||e.length===0)return!1;const a=[];let l=null,c=0,u=0;for(let E=0;Ex.line-E.line);let m=0,d=0,g=0,y=0,b=null,S=null;for(let E=0;Eg?x:g):_===Modifier.Position.RIGHT&&(P.setXShift(d),x=u+I,y=x>y?x:y),b=T,S=A}return i.left_shift+=g,i.right_shift+=y,!0}constructor(e){super(),this.setAttribute("type","FretHandFinger"),this.note=null,this.index=null,this.finger=e,this.width=7,this.position=Modifier.Position.LEFT,this.x_shift=0,this.y_shift=0,this.x_offset=0,this.y_offset=0,this.font={family:"sans-serif",size:9,weight:"bold"}}getCategory(){return FretHandFinger.CATEGORY}setFretHandFinger(e){return this.finger=e,this}setOffsetX(e){return this.x_offset=e,this}setOffsetY(e){return this.y_offset=e,this}draw(){if(this.checkContext(),!this.note||this.index==null)throw new Vex.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();const e=this.context,i=this.note.getModifierStartXY(this.position,this.index);let r=i.x+this.x_shift+this.x_offset,s=i.y+this.y_shift+this.y_offset+5;switch(this.position){case Modifier.Position.ABOVE:r-=4,s-=12;break;case Modifier.Position.BELOW:r-=2,s+=10;break;case Modifier.Position.LEFT:r-=this.width;break;case Modifier.Position.RIGHT:r+=1;break;default:throw new Vex.RERR("InvalidPostion",`The position ${this.position} does not exist`)}e.save(),e.setFont(this.font.family,this.font.size,this.font.weight),e.fillText(""+this.finger,r,s),e.restore()}}class Music{static get NUM_TONES(){return 12}static get roots(){return["c","d","e","f","g","a","b"]}static get root_values(){return[0,2,4,5,7,9,11]}static get root_indices(){return{c:0,d:1,e:2,f:3,g:4,a:5,b:6}}static get canonical_notes(){return["c","c#","d","d#","e","f","f#","g","g#","a","a#","b"]}static get diatonic_intervals(){return["unison","m2","M2","m3","M3","p4","dim5","p5","m6","M6","b7","M7","octave"]}static get diatonic_accidentals(){return{unison:{note:0,accidental:0},m2:{note:1,accidental:-1},M2:{note:1,accidental:0},m3:{note:2,accidental:-1},M3:{note:2,accidental:0},p4:{note:3,accidental:0},dim5:{note:4,accidental:-1},p5:{note:4,accidental:0},m6:{note:5,accidental:-1},M6:{note:5,accidental:0},b7:{note:6,accidental:-1},M7:{note:6,accidental:0},octave:{note:7,accidental:0}}}static get intervals(){return{u:0,unison:0,m2:1,b2:1,min2:1,S:1,H:1,2:2,M2:2,maj2:2,T:2,W:2,m3:3,b3:3,min3:3,M3:4,3:4,maj3:4,4:5,p4:5,"#4":6,b5:6,aug4:6,dim5:6,5:7,p5:7,"#5":8,b6:8,aug5:8,6:9,M6:9,maj6:9,b7:10,m7:10,min7:10,dom7:10,M7:11,maj7:11,8:12,octave:12}}static get scales(){return{major:[2,2,1,2,2,2,1],dorian:[2,1,2,2,2,1,2],mixolydian:[2,2,1,2,2,1,2],minor:[2,1,2,2,1,2,2]}}static get scaleTypes(){return{M:Music.scales.major,m:Music.scales.minor}}static get accidentals(){return["bb","b","n","#","##"]}static get noteValues(){return{c:{root_index:0,int_val:0},cn:{root_index:0,int_val:0},"c#":{root_index:0,int_val:1},"c##":{root_index:0,int_val:2},cb:{root_index:0,int_val:11},cbb:{root_index:0,int_val:10},d:{root_index:1,int_val:2},dn:{root_index:1,int_val:2},"d#":{root_index:1,int_val:3},"d##":{root_index:1,int_val:4},db:{root_index:1,int_val:1},dbb:{root_index:1,int_val:0},e:{root_index:2,int_val:4},en:{root_index:2,int_val:4},"e#":{root_index:2,int_val:5},"e##":{root_index:2,int_val:6},eb:{root_index:2,int_val:3},ebb:{root_index:2,int_val:2},f:{root_index:3,int_val:5},fn:{root_index:3,int_val:5},"f#":{root_index:3,int_val:6},"f##":{root_index:3,int_val:7},fb:{root_index:3,int_val:4},fbb:{root_index:3,int_val:3},g:{root_index:4,int_val:7},gn:{root_index:4,int_val:7},"g#":{root_index:4,int_val:8},"g##":{root_index:4,int_val:9},gb:{root_index:4,int_val:6},gbb:{root_index:4,int_val:5},a:{root_index:5,int_val:9},an:{root_index:5,int_val:9},"a#":{root_index:5,int_val:10},"a##":{root_index:5,int_val:11},ab:{root_index:5,int_val:8},abb:{root_index:5,int_val:7},b:{root_index:6,int_val:11},bn:{root_index:6,int_val:11},"b#":{root_index:6,int_val:0},"b##":{root_index:6,int_val:1},bb:{root_index:6,int_val:10},bbb:{root_index:6,int_val:9}}}isValidNoteValue(e){return!(e==null||e<0||e>=Music.NUM_TONES)}isValidIntervalValue(e){return this.isValidNoteValue(e)}getNoteParts(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);const i=e.toLowerCase(),s=/^([cdefgab])(b|bb|n|#|##)?$/.exec(i);if(s!=null){const o=s[1],a=s[2];return{root:o,accidental:a}}else throw new Vex.RERR("BadArguments","Invalid note name: "+e)}getKeyParts(e){if(!e||e.length<1)throw new Vex.RERR("BadArguments","Invalid key: "+e);const i=e.toLowerCase(),s=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(i);if(s!=null){const o=s[1],a=s[2];let l=s[3];return l||(l="M"),{root:o,accidental:a,type:l}}else throw new Vex.RERR("BadArguments",`Invalid key: ${e}`)}getNoteValue(e){const i=Music.noteValues[e];if(i==null)throw new Vex.RERR("BadArguments",`Invalid note name: ${e}`);return i.int_val}getIntervalValue(e){const i=Music.intervals[e];if(i==null)throw new Vex.RERR("BadArguments",`Invalid interval name: ${e}`);return i}getCanonicalNoteName(e){if(!this.isValidNoteValue(e))throw new Vex.RERR("BadArguments",`Invalid note value: ${e}`);return Music.canonical_notes[e]}getCanonicalIntervalName(e){if(!this.isValidIntervalValue(e))throw new Vex.RERR("BadArguments",`Invalid interval value: ${e}`);return Music.diatonic_intervals[e]}getRelativeNoteValue(e,i,r){if(r==null&&(r=1),r!==1&&r!==-1)throw new Vex.RERR("BadArguments",`Invalid direction: ${r}`);let s=(e+r*i)%Music.NUM_TONES;return s<0&&(s+=Music.NUM_TONES),s}getRelativeNoteName(e,i){const r=this.getNoteParts(e),s=this.getNoteValue(r.root);let o=i-s;if(Math.abs(o)>Music.NUM_TONES-3){let l=1;o>0&&(l=-1);const c=(i+1+(s+1))%Music.NUM_TONES*l;if(Math.abs(c)>2)throw new Vex.RERR("BadArguments",`Notes not related: ${e}, ${i})`);o=c}if(Math.abs(o)>2)throw new Vex.RERR("BadArguments",`Notes not related: ${e}, ${i})`);let a=r.root;if(o>0)for(let l=1;l<=o;++l)a+="#";else if(o<0)for(let l=-1;l>=o;--l)a+="b";return a}getScaleTones(e,i){const r=[e];let s=e;for(let o=0;ot.getMetrics().width;class Accidental extends Modifier{static get CATEGORY(){return"accidentals"}static format(e,i){const s=i.left_shift+1,o=3;if(!e||e.length===0)return;const a=[];let l=null,c=0,u;for(let A=0;A_.line-A.line);const m=[];let d=0,g=null;for(let A=0;Ad?_.shift:d,g=_.line}let y=0;for(let A=0;Am[P+R],C=R=>R.map(M),I=(R,H)=>{const[O,V]=C([R,H]).map(k=>k.line);return O-V},D=(...R)=>R.map(C).every(H=>!this.checkCollision(...H)),G=T-P+1;let $=this.checkCollision(m[P],m[T])?"a":"b";switch(G){case 3:$==="a"&&I(1,2)===.5&&I(0,1)!==.5&&($="second_on_bottom");break;case 4:D([0,2],[1,3])&&($="spaced_out_tetrachord");break;case 5:$==="b"&&D([1,3])&&($="spaced_out_pentachord",D([0,2],[2,4])&&($="very_spaced_out_pentachord"));break;case 6:D([0,3],[1,4],[2,5])&&($="spaced_out_hexachord"),D([0,2],[2,4],[1,3],[3,5])&&($="very_spaced_out_hexachord");break}let N,z;if(G>=7){let R=2,H=!0;for(;H===!0;){H=!1;for(let O=0;O+Rz?y:z}else for(N=A;N<=T;N++)z=Flow.accidentalColumnsTable[G][$][N-A],m[N].column=z,y=y>z?y:z;A=T}const b=[],S=[];for(let A=0;A<=y;A++)b[A]=0,S[A]=0;b[0]=d+s,S[0]=d+s,m.forEach(A=>{A.width>b[A.column]&&(b[A.column]=A.width)});for(let A=1;A{let _=0;const P=x+A.numAcc;for(x;x0?(s=i.flatLine||i.dblSharpLine?2.5:3,e.dblSharpLine&&(r-=.5)):(s=e.flatLine||e.dblSharpLine?2.5:3,i.dblSharpLine&&(r-=.5));const o=Math.abs(r){const c=new Fraction(0,1);l.getTickables().forEach(m=>{if(m.shouldIgnoreTicks())return;const d=s[c.value()];d?d.push(m):(r.push(c.value()),s[c.value()]=[m]),c.add(m.getTicks())})});const o=new Music;i||(i="C");const a=o.createScaleMap(i);r.forEach(l=>{const c=s[l],u=[],m=d=>{d.isRest()||d.shouldIgnoreTicks()||(d.keys.forEach((g,y)=>{const b=o.getNoteParts(g.split("/")[0]),S=b.accidental||"n",E=b.root+S,x=a[b.root]===E,A=u.indexOf(E)>-1;if(!x||x&&A){a[b.root]=E;const _=new Accidental(S);d.addAccidental(y,_),u.push(E)}}),d.getModifiers().forEach(g=>{g.getCategory()==="gracenotegroups"&&g.getGraceNotes().forEach(m)}))};c.forEach(m)})}constructor(e=null){if(super(),this.setAttribute("type","Accidental"),L$g("New accidental: ",e),this.note=null,this.index=null,this.type=e,this.position=Modifier.Position.LEFT,this.render_options={font_scale:38,stroke_px:3,parenLeftPadding:2,parenRightPadding:2},this.accidental=Flow.accidentalCodes(this.type),!this.accidental)throw new Vex.RERR("ArgumentError",`Unknown accidental type: ${e}`);this.cautionary=!1,this.parenLeft=null,this.parenRight=null,this.reset()}reset(){const 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))}getCategory(){return Accidental.CATEGORY}getWidth(){const e=this.cautionary?getGlyphWidth(this.parenLeft)+getGlyphWidth(this.parenRight)+this.render_options.parenLeftPadding+this.render_options.parenRightPadding:0;return getGlyphWidth(this.glyph)+e}setNote(e){if(!e)throw new Vex.RERR("ArgumentError",`Bad note value: ${e}`);this.note=e,this.note.getCategory()==="gracenotes"&&(this.render_options.font_scale=25,this.reset())}setAsCautionary(){return this.cautionary=!0,this.render_options.font_scale=28,this.reset(),this}draw(){const{context:e,type:i,position:r,note:s,index:o,cautionary:a,x_shift:l,y_shift:c,glyph:u,parenLeft:m,parenRight:d,render_options:{parenLeftPadding:g,parenRightPadding:y}}=this;if(this.checkContext(),!(s&&o!=null))throw new Vex.RERR("NoAttachedNote","Can't draw accidental without a note and index.");const b=s.getModifierStartXY(r,o);let S=b.x+l;const E=b.y+c;L$g("Rendering: ",i,S,E),a?(d.render(e,S,E),S-=getGlyphWidth(d),S-=y,S-=this.accidental.parenRightPaddingAdjustment,u.render(e,S,E),S-=getGlyphWidth(u),S-=g,m.render(e,S,E)):u.render(e,S,E),this.setRendered()}}let NoteSubGroup$1=class fi extends Modifier{static get CATEGORY(){return"notesubgroup"}static format(e,i){if(!e||e.length===0)return!1;let r=0;for(let s=0;s{i.ignore_ticks=!1}),this.width=0,this.preFormatted=!1,this.formatter=new Formatter,this.voice=new Voice$1({num_beats:4,beat_value:4,resolution:Flow.RESOLUTION}).setStrict(!1),this.voice.addTickables(this.subNotes),this}getCategory(){return fi.CATEGORY}preFormat(){this.preFormatted||(this.formatter.joinVoices([this.voice]).format([this.voice],0),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}setNote(e){this.note=e}setWidth(e){this.width=e}getWidth(){return this.width}draw(){this.checkContext();const e=this.getNote();if(!(e&&this.index!==null))throw new Vex.RuntimeError("NoAttachedNote","Can't draw notes without a parent note and parent note index.");this.setRendered(),this.alignSubNotesWithNote(this.subNotes,e),this.subNotes.forEach(i=>i.setContext(this.context).drawWithStyle())}};class StaveTie extends Element$1{constructor(e,i){super(),this.setAttribute("type","StaveTie"),this.notes=e,this.context=null,this.text=i,this.direction=null,this.render_options={cp1:8,cp2:12,text_shift_x:0,first_x_shift:0,last_x_shift:0,y_shift:7,tie_spacing:0,font:{family:"Arial",size:10,style:""}},this.font=this.render_options.font,this.setNotes(e)}setFont(e){return this.font=e,this}setDirection(e){return this.direction=e,this}setNotes(e){if(!e.first_note&&!e.last_note)throw new Vex.RuntimeError("BadArguments","Tie needs to have either first_note or last_note set.");if(e.first_indices||(e.first_indices=[0]),e.last_indices||(e.last_indices=[0]),e.first_indices.length!==e.last_indices.length)throw new Vex.RuntimeError("BadArguments","Tied notes must have similar index sizes");return this.first_note=e.first_note,this.first_indices=e.first_indices,this.last_note=e.last_note,this.last_indices=e.last_indices,this}isPartial(){return!this.first_note||!this.last_note}renderTie(e){if(e.first_ys.length===0||e.last_ys.length===0)throw new Vex.RERR("BadArguments","No Y-values to render");const i=this.context;let r=this.render_options.cp1,s=this.render_options.cp2;Math.abs(e.last_x_px-e.first_x_px)<10&&(r=2,s=8);const o=this.render_options.first_x_shift,a=this.render_options.last_x_shift,l=this.render_options.y_shift*e.direction;for(let c=0;c1){const i=new Beam$1(e);i.render_options.beam_width=3,i.render_options.partial_beam_length=4,this.beams.push(i)}return this}setNote(e){this.note=e}setWidth(e){this.width=e}getWidth(){return this.width}getGraceNotes(){return this.grace_notes}draw(){this.checkContext();const e=this.getNote();if(L$f("Drawing grace note group for:",e),!(e&&this.index!==null))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(),e),this.grace_notes.forEach(i=>{i.setContext(this.context).draw()}),this.beams.forEach(i=>{i.setContext(this.context).draw()}),this.show_slur){const i=this.getNote().getCategory()===StaveNote.CATEGORY,r=i?StaveTie:TabTie;this.slur=new r({last_note:this.grace_notes[0],first_note:e,first_indices:[0],last_indices:[0]}),this.slur.render_options.cp2=12,this.slur.render_options.y_shift=(i?7:5)+this.render_options.slur_y_shift,this.slur.setContext(this.context).draw()}}}class Stroke extends Modifier{static get CATEGORY(){return"strokes"}static get Type(){return{BRUSH_DOWN:1,BRUSH_UP:2,ROLL_DOWN:3,ROLL_UP:4,RASQUEDO_DOWN:5,RASQUEDO_UP:6,ARPEGGIO_DIRECTIONLESS:7}}static format(e,i){const r=i.left_shift,s=0;if(!e||e.length===0)return this;const o=e.map(c=>{const u=c.getNote();if(u instanceof StaveNote){const{line:m,displaced:d}=u.getKeyProps()[c.getIndex()],g=d?u.getExtraLeftPx():0;return{line:m,shift:g,stroke:c}}else{const{str:m}=u.getPositions()[c.getIndex()];return{line:m,shift:0,stroke:c}}}),a=r,l=o.reduce((c,{stroke:u,shift:m})=>(u.setXShift(a+m),Math.max(u.getWidth()+s,c)),0);return i.left_shift+=l,!0}constructor(e,i){super(),this.setAttribute("type","Stroke"),this.note=null,this.options=Vex.Merge({},i),this.all_voices="all_voices"in this.options?this.options.all_voices:!0,this.note_end=null,this.index=null,this.type=e,this.position=Modifier.Position.LEFT,this.render_options={font_scale:38,stroke_px:3,stroke_spacing:10},this.font={family:"serif",size:10,weight:"bold italic"},this.setXShift(0),this.setWidth(10)}getCategory(){return Stroke.CATEGORY}getPosition(){return this.position}addEndNote(e){return this.note_end=e,this}draw(){if(this.checkContext(),this.setRendered(),!(this.note&&this.index!=null))throw new Vex.RERR("NoAttachedNote","Can't draw stroke without a note and index.");const e=this.note.getModifierStartXY(this.position,this.index);let i=this.note.getYs(),r=e.y,s=e.y;const o=e.x-5,a=this.note.stave.options.spacing_between_lines_px,l=this.getModifierContext().getModifiers(this.note.getCategory());for(let y=0;yT.line-P.line);let S=0,E=0,x=0,A=null,_=null;for(m=0;mE?P:E):y===Modifier.Position.RIGHT&&(d.setXShift(S),P+=C,x=P>x?P:x),A=T,_=g}return i.left_shift+=E,i.right_shift+=x,!0}constructor(e){super(),this.setAttribute("type","StringNumber"),this.note=null,this.last_note=null,this.index=null,this.string_number=e,this.setWidth(20),this.position=Modifier.Position.ABOVE,this.x_shift=0,this.y_shift=0,this.x_offset=0,this.y_offset=0,this.dashed=!0,this.leg=Renderer.LineEndType.NONE,this.radius=8,this.font={family:"sans-serif",size:10,weight:"bold"}}getCategory(){return StringNumber.CATEGORY}getNote(){return this.note}setNote(e){return this.note=e,this}getIndex(){return this.index}setIndex(e){return this.index=e,this}setLineEndType(e){return e>=Renderer.LineEndType.NONE&&e<=Renderer.LineEndType.DOWN&&(this.leg=e),this}setStringNumber(e){return this.string_number=e,this}setOffsetX(e){return this.x_offset=e,this}setOffsetY(e){return this.y_offset=e,this}setLastNote(e){return this.last_note=e,this}setDashed(e){return this.dashed=e,this}draw(){const e=this.checkContext();if(!(this.note&&this.index!=null))throw new Vex.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();const i=this.note.stave.options.spacing_between_lines_px,r=this.note.getModifierStartXY(this.position,this.index);let s=r.x+this.x_shift+this.x_offset,o=r.y+this.y_shift+this.y_offset;switch(this.position){case Modifier.Position.ABOVE:case Modifier.Position.BELOW:{const l=this.note.getStemExtents();let c=l.topY,u=l.baseY+2;this.note.stem_direction===StaveNote.STEM_DOWN&&(c=l.baseY,u=l.topY-2),this.position===Modifier.Position.ABOVE?o=this.note.hasStem()?c-i*1.75:r.y-i*1.75:o=this.note.hasStem()?u+i*1.5:r.y+i*1.75,o+=this.y_shift+this.y_offset;break}case Modifier.Position.LEFT:s-=this.radius/2+5;break;case Modifier.Position.RIGHT:s+=this.radius/2+6;break;default:throw new Vex.RERR("InvalidPosition",`The position ${this.position} is invalid`)}e.save(),e.beginPath(),e.arc(s,o,this.radius,0,Math.PI*2,!1),e.lineWidth=1.5,e.stroke(),e.setFont(this.font.family,this.font.size,this.font.weight);const a=s-e.measureText(this.string_number).width/2;if(e.fillText(""+this.string_number,a,o+4.5),this.last_note!=null){const l=this.last_note.getStemX()-this.note.getX()+5;e.strokeStyle="#000000",e.lineCap="round",e.lineWidth=.6,this.dashed?Renderer.drawDashedLine(e,s+10,o,s+l,o,[3,3]):Renderer.drawDashedLine(e,s+10,o,s+l,o,[3,0]);let c,u;switch(this.leg){case Renderer.LineEndType.UP:c=-10,u=this.dashed?[3,3]:[3,0],Renderer.drawDashedLine(e,s+l,o,s+l,o+c,u);break;case Renderer.LineEndType.DOWN:c=10,u=this.dashed?[3,3]:[3,0],Renderer.drawDashedLine(e,s+l,o,s+l,o+c,u);break}}e.restore()}}class TickContext extends Tickable{static getNextContext(e){const i=e.tContexts,r=i.indexOf(e);return i[r+1]}constructor(){super(),this.setAttribute("type","TickContext"),this.currentTick=new Fraction(0,1),this.maxTicks=new Fraction(0,1),this.minTicks=null,this.padding=3,this.x=0,this.xBase=0,this.xOffset=0,this.tickables=[],this.notePx=0,this.extraLeftPx=0,this.extraRightPx=0,this.tContexts=[]}getX(){return this.x}setX(e){return this.x=e,this.xBase=e,this.xOffset=0,this}getXBase(){return this.xBase}setXBase(e){this.xBase=e,this.x=e+this.xOffset}getXOffset(){return this.xOffset}setXOffset(e){this.xOffset=e,this.x=this.xBase+e}getWidth(){return this.width+this.padding*2}setPadding(e){return this.padding=e,this}getMaxTicks(){return this.maxTicks}getMinTicks(){return this.minTicks}getTickables(){return this.tickables}getCenterAlignedTickables(){return this.tickables.filter(e=>e.isCenterAligned())}getMetrics(){const{width:e,notePx:i,extraLeftPx:r,extraRightPx:s}=this;return{width:e,notePx:i,extraLeftPx:r,extraRightPx:s}}getCurrentTick(){return this.currentTick}setCurrentTick(e){this.currentTick=e,this.preFormatted=!1}getExtraPx(){let e=0,i=0,r=0,s=0;for(let o=0;ot(e/.5)*.5,isWithinLines=(t,e)=>e===ABOVE?t<=5:t>=1,getRoundingFunction=(t,e)=>isWithinLines(t,e)?e===ABOVE?Math.ceil:Math.floor:Math.round,snapLineToStaff=(t,e,i,r)=>{const s=roundToNearestHalf(getRoundingFunction(e,i),e),o=t&&isWithinLines(s,i),a=s%1===0;return o&&a?s+.5*-r:s},isStaveNote=t=>{const e=t.getCategory();return e==="stavenotes"||e==="gracenotes"},getTopY=(t,e)=>{const i=t.getStave(),r=t.getStemDirection(),{topY:s,baseY:o}=t.getStemExtents();if(isStaveNote(t))return t.hasStem()?r===Stem.UP?s:o:Math.min(...t.getYs());if(t.getCategory()==="tabnotes")return t.hasStem()&&r===Stem.UP?s:i.getYForTopText(e);throw new Vex.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},getBottomY=(t,e)=>{const i=t.getStave(),r=t.getStemDirection(),{topY:s,baseY:o}=t.getStemExtents();if(isStaveNote(t))return t.hasStem()?r===Stem.UP?o:s:Math.max(...t.getYs());if(t.getCategory()==="tabnotes")return t.hasStem()?r===Stem.UP?i.getYForBottomText(e):s:i.getYForBottomText(e);throw new Vex.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},getInitialOffset=(t,e)=>{const i=e===ABOVE&&t.getStemDirection()===Stem.UP||e===BELOW&&t.getStemDirection()===Stem.DOWN;return isStaveNote(t)?t.hasStem()&&i?.5:1:t.hasStem()&&i?1:0};let Articulation$1=class Vt extends Modifier{static get CATEGORY(){return"articulations"}static get INITIAL_OFFSET(){return-.5}static format(e,i){if(!e||e.length===0)return!1;const r=c=>c.getPosition()===ABOVE,s=c=>c.getPosition()===BELOW,o=.5,a=(c,u,m)=>roundToNearestHalf(getRoundingFunction(u,m),c.glyph.getMetrics().height/10+o);e.filter(r).forEach(c=>{c.setTextLine(i.top_text_line),i.top_text_line+=a(c,i.top_text_line,ABOVE)}),e.filter(s).forEach(c=>{c.setTextLine(i.text_line),i.text_line+=a(c,i.text_line,BELOW)});const l=e.map(c=>c.getWidth()).reduce((c,u)=>Math.max(u,c));return i.left_shift+=l/2,i.right_shift+=l/2,!0}static easyScoreHook({articulations:e},i,r){if(!e)return;const s={staccato:"a.",tenuto:"a-"};e.split(",").map(o=>o.trim().split(".")).map(([o,a])=>{const l={type:s[o]};return a&&(l.position=Modifier.PositionString[a]),r.getFactory().Articulation(l)}).map(o=>i.addModifier(0,o))}constructor(e){if(super(),this.setAttribute("type","Articulation"),this.note=null,this.index=null,this.type=e,this.position=BELOW,this.render_options={font_scale:38},this.breathMarkDistance=.8,this.articulation=Flow.articulationCodes(this.type),this.type==="abr"&&(this.articulation={code:"v6c",between_lines:!1}),!this.articulation)throw new Vex.RERR("ArgumentError",`Articulation not found: ${this.type}`);this.glyph=new Glyph(this.articulation.code,this.render_options.font_scale),this.setWidth(this.glyph.getMetrics().width)}getCategory(){return Vt.CATEGORY}draw(){const{note:e,index:i,position:r,glyph:s,articulation:{between_lines:o},text_line:a,context:l}=this;if(this.checkContext(),!e||i==null)throw new Vex.RERR("NoAttachedNote","Can't draw Articulation without a note and index.");this.setRendered();const c=e.getStave(),u=c.getSpacingBetweenLines(),m=e.getCategory()==="tabnotes";let{x:d}=e.getModifierStartXY(r,i);if(this.type==="abr"){let E=0;const x=e.getTickContext(),A=TickContext.getNextContext(x),_=e.getTickContext().getX();if(A)E=(A.getX()-_)*this.breathMarkDistance;else{const P=e.getStave();E=(P.getX()+P.getWidth()-_)*this.breathMarkDistance}d+=E}const g=this.getXShift();g&&(d+=g);const y=!o||m,b=getInitialOffset(e,r);let S={[ABOVE]:()=>{s.setOrigin(.5,1);const E=getTopY(e,a)-(a+b)*u+(this.y_shift||0);return y?Math.min(c.getYForTopText(Vt.INITIAL_OFFSET),E):E},[BELOW]:()=>{s.setOrigin(.5,0);const E=getBottomY(e,a)+(a+b)*u;return y?Math.max(c.getYForBottomText(Vt.INITIAL_OFFSET),E):E}}[r]();if(this.y_shift&&(S+=this.y_shift),!m){const E=r===ABOVE?-1:1,x=m?e.positions[i].str:e.getKeyProps()[i].line,_=(e.getYs()[i]-S)/u+x,P=snapLineToStaff(o,_,r,E);isWithinLines(P,r)&&s.setOrigin(.5,.5),S+=Math.abs(P-_)*u*E}L$e(`Rendering articulation at (x: ${d}, y: ${S})`),s.render(l,d,S)}};function L$d(...t){Ornament.DEBUG&&Vex.L("Vex.Flow.Ornament",t)}class Ornament extends Modifier{static get CATEGORY(){return"ornaments"}static format(e,i){if(!e||e.length===0)return!1;let r=0;for(let s=0;s0&&s--;for(let c=0;c{L$b("Preformatting ModifierContext: ",e.CATEGORY),e.format(this.getModifiers(e.CATEGORY),this.state,this)}),this.width=this.state.left_shift+this.state.right_shift,this.preFormatted=!0)}postFormat(){this.postFormatted||this.POSTFORMAT.forEach(e=>{L$b("Postformatting ModifierContext: ",e.CATEGORY),e.postFormat(this.getModifiers(e.CATEGORY),this)})}}function L$a(...t){Formatter.DEBUG&&Vex.L("Vex.Flow.Formatter",t)}function getNext(t,e){var r,s;const i=t[e+1];return i&&((r=i==null?void 0:i.keys)!=null&&r.includes("b/4"))||(s=i==null?void 0:i.keys)!=null&&s.includes("r/4")?getNext(t,e+1):i}function lookAhead(t,e,i,r){let s=e;for(i+=1;i{if(c.getMode()===Voice$1.Mode.STRICT&&!c.isComplete())throw new Vex.RERR("IncompleteVoice","Voice does not have enough notes.");return Math.max(l,Fraction.LCM(l,c.getResolutionMultiplier()))},1),s={},o=[],a=[];return t.forEach(l=>{const c=new Fraction(0,r);l.getTickables().forEach(u=>{const m=c.numerator;if(!s[m]){const d=new e;a.push(d),s[m]=d}i(u,s[m]),o.push(m),c.add(u.getTicks())})}),{map:s,array:a,list:Vex.SortAndUnique(o,(l,c)=>l-c,(l,c)=>l===c),resolutionMultiplier:r}}class Formatter{static SimpleFormat(e,i=0,{paddingBetween:r=10}={}){e.reduce((s,o)=>{o.addToModifierContext(new ModifierContext);const a=new TickContext().addTickable(o).preFormat(),l=a.getExtraPx();return a.setX(s+l.left),s+a.getWidth()+l.right+r},i)}static plotDebugging(e,i,r,s,o){const a=r+Note.STAVEPADDING,l=i.contextGaps;function c(u,m,d){e.beginPath(),e.setStrokeStyle(d),e.setFillStyle(d),e.setLineWidth(1),e.fillRect(u,s,m-u,o-s)}e.save(),e.setFont("Arial",8,""),l.gaps.forEach(u=>{c(a+u.x1,a+u.x2,"#aaa"),e.fillText(Math.round(u.x2-u.x1),a+u.x1,o+12)}),e.fillText(Math.round(l.total)+"px",a-20,o+12),e.setFillStyle("red"),e.fillText("Loss: "+i.lossHistory.map(u=>Math.round(u)),a-20,o+22),e.restore()}static FormatAndDraw(e,i,r,s){const o={auto_beam:!1,align_rests:!1};typeof s=="object"?Vex.Merge(o,s):typeof s=="boolean"&&(o.auto_beam=s);const a=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(r),l=o.auto_beam?Beam$1.applyAndGetBeams(a):[];return new Formatter().joinVoices([a],{align_rests:o.align_rests}).formatToStave([a],i,{align_rests:o.align_rests,stave:i}),a.setStave(i).draw(e,i),l.forEach(c=>c.setContext(e).draw()),a.getBoundingBox()}static FormatAndDrawTab(e,i,r,s,o,a,l){const c={auto_beam:a,align_rests:!1};typeof l=="object"?Vex.Merge(c,l):typeof l=="boolean"&&(c.auto_beam=l);const u=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(o),m=new Voice$1(Flow.TIME4_4).setMode(Voice$1.Mode.SOFT).addTickables(s),d=c.auto_beam?Beam$1.applyAndGetBeams(u):[];new Formatter().joinVoices([u],{align_rests:c.align_rests}).joinVoices([m]).formatToStave([u,m],r,{align_rests:c.align_rests}),u.draw(e,r),m.draw(e,i),d.forEach(g=>g.setContext(e).draw()),new StaveConnector(r,i).setContext(e).draw()}static AlignRestsToNotes(e,i,r){return e.forEach((s,o)=>{if(s instanceof StaveNote&&s.isRest()){if(s.tuplet&&!r)return;const a=s.getGlyph().position.toUpperCase();if(a!=="R/4"&&a!=="B/4")return;if(i||s.beam!=null){const l=s.getKeyProps()[0];if(o===0)l.line=lookAhead(e,l.line,o,!1),s.setKeyLine(0,l.line);else if(o>0&&o0){const S=y<1.5?Math.abs(y-1.5)*l:0;b.setResetHeight(S)}else{const S=y>4.5?Math.abs(y-4.5)*l:0;b.setResetHeight(S)}}}}}}),this}constructor(){this.minTotalWidth=0,this.hasMinTotalWidth=!1,this.totalTicks=new Fraction(0,1),this.tickContexts=null,this.modiferContexts=null,this.contextGaps={total:0,gaps:[]},this.voices=[]}alignRests(e,i){if(!e||!e.length)throw new Vex.RERR("BadArgument","No voices to format rests");e.forEach(r=>Formatter.AlignRestsToNotes(r.getTickables(),i))}preCalculateMinTotalWidth(e){if(this.hasMinTotalWidth)return this.minTotalWidth;if(!this.tickContexts){if(!e)throw new Vex.RERR("BadArgument","'voices' required to run preCalculateMinTotalWidth");this.createTickContexts(e)}const{list:i,map:r}=this.tickContexts;return this.minTotalWidth=i.map(s=>{const o=r[s];return o.preFormat(),o.getWidth()}).reduce((s,o)=>s+o,0),this.hasMinTotalWidth=!0,this.minTotalWidth}getMinTotalWidth(){if(!this.hasMinTotalWidth)throw new Vex.RERR("NoMinTotalWidth","Call 'preCalculateMinTotalWidth' or 'preFormat' before calling 'getMinTotalWidth'");return this.minTotalWidth}createModifierContexts(e){const i=createContexts(e,ModifierContext,(r,s)=>r.addToModifierContext(s));return this.modiferContexts=i,i}createTickContexts(e){const i=createContexts(e,TickContext,(r,s)=>s.addTickable(r));return i.array.forEach(r=>{r.tContexts=i.array}),this.totalTicks=e[0].getTicksUsed().clone(),this.tickContexts=i,i}preFormat(e=0,i,r,s){const o=this.tickContexts,{list:a,map:l,resolutionMultiplier:c}=o;r&&s&&r.forEach(E=>E.setStave(s).preFormat());let u=0,m=0;const d=e/2;if(this.minTotalWidth=0,a.forEach(E=>{const x=l[E];i&&x.setContext(i),x.preFormat();const A=x.getWidth();this.minTotalWidth+=A;const _=x.getMetrics();u=u+m+_.extraLeftPx,x.setX(u),m=A-_.extraLeftPx}),this.minTotalWidth=u+m,this.hasMinTotalWidth=!0,e<=0)return;const g=e-this.minTotalWidth;let y=this.totalTicks.value();y===0&&(y=1);const b=g/(y*c);let S=0;a.forEach((E,x)=>{const A=a[x-1]||0,_=l[E],P=(E-A)*b;S+=P,_.setX(_.getX()+S),_.getCenterAlignedTickables().forEach(T=>{T.center_x_shift=d-_.getX()})}),a.length!==1&&(this.justifyWidth=e,this.lossHistory=[],this.evaluate())}evaluate(){const e=this.justifyWidth;this.contextGaps={total:0,gaps:[]},this.tickContexts.list.forEach((o,a)=>{if(a===0)return;const l=this.tickContexts.list[a-1],c=this.tickContexts.map[l],u=this.tickContexts.map[o],m=c.getMetrics(),d=c.getX()+m.width,g=u.getX(),y=g-d;this.contextGaps.total+=y,this.contextGaps.gaps.push({x1:d,x2:g}),u.getFormatterMetrics().freedom.left=y,c.getFormatterMetrics().freedom.right=y});const i=this.durationStats={};function r(o,a){const l=i[o];l===void 0?i[o]={mean:a,count:1}:(l.count+=1,l.mean=(l.mean+a)/2)}this.voices.forEach(o=>{o.getTickables().forEach((a,l,c)=>{const u=a.getTicks().clone().simplify().toString(),m=a.getMetrics(),d=a.getFormatterMetrics(),g=a.getX()+m.noteWidth+m.modRightPx+m.extraRightPx;let y=0;if(l{o.getTickables().forEach(a=>{const l=a.getTicks().clone().simplify().toString(),c=a.getFormatterMetrics();c.iterations+=1,c.space.deviation=c.space.used-i[l].mean,c.duration=l,c.space.mean=i[l].mean,s+=Math.pow(i[l].mean,2)})}),this.totalCost=Math.sqrt(s),this.lossHistory.push(this.totalCost),this}tune(){const e=s=>s.reduce((o,a)=>o+a);function i(s,o,a,l){s.setX(s.getX()+l),s.getFormatterMetrics().freedom.left+=l,s.getFormatterMetrics().freedom.right-=l,o&&(o.getFormatterMetrics().freedom.right+=l),a&&(a.getFormatterMetrics().freedom.left-=l)}let r=0;return this.tickContexts.list.forEach((s,o,a)=>{const l=this.tickContexts.map[s],c=o>0?this.tickContexts.map[a[o-1]]:null,u=og.getFormatterMetrics().space.deviation));m>0?r=-Math.min(l.getFormatterMetrics().freedom.right,Math.abs(m)):m<0&&(u?r=Math.min(u.getFormatterMetrics().freedom.right,Math.abs(m)):r=0);const d=Math.min(5,Math.abs(r));r=r>0?d:-d}),this.evaluate()}postFormat(){const e=i=>i.list.forEach(r=>i.map[r].postFormat());return e(this.modiferContexts),e(this.tickContexts),this}joinVoices(e){return this.createModifierContexts(e),this.hasMinTotalWidth=!1,this}format(e,i,r){const s={align_rests:!1,context:null,stave:null};return Vex.Merge(s,r),this.voices=e,this.alignRests(e,s.align_rests),this.createTickContexts(e),this.preFormat(i,s.context,e,s.stave),this}formatToStave(e,i,r){const s=i.getNoteEndX()-i.getNoteStartX()-10;L$a("Formatting voices to width: ",s);const o={context:i.getContext()};return Vex.Merge(o,r),this.format(e,s,o)}}class StaveModifier extends Element$1{static get Position(){return{LEFT:1,RIGHT:2,ABOVE:3,BELOW:4,BEGIN:5,END:6}}constructor(){super(),this.setAttribute("type","StaveModifier"),this.padding=10,this.position=StaveModifier.Position.ABOVE,this.layoutMetrics=null}getPosition(){return this.position}setPosition(e){return this.position=e,this}getStave(){return this.stave}setStave(e){return this.stave=e,this}getWidth(){return this.width}setWidth(e){return this.width=e,this}getX(){return this.x}setX(e){return this.x=e,this}getCategory(){return""}makeSpacer(e){return{getContext(){return!0},setStave(){},renderToStave(){},getMetrics(){return{width:e}}}}placeGlyphOnLine(e,i,r){e.setYShift(i.getYForLine(r)-i.getYForGlyphs())}getPadding(e){return e!==void 0&&e<2?0:this.padding}setPadding(e){return this.padding=e,this}setLayoutMetrics(e){return this.layoutMetrics=e,this}getLayoutMetrics(){return this.layoutMetrics}}class Barline extends StaveModifier{static get CATEGORY(){return"barlines"}static get type(){return{SINGLE:1,DOUBLE:2,END:3,REPEAT_BEGIN:4,REPEAT_END:5,REPEAT_BOTH:6,NONE:7}}static get typeString(){return{single:Barline.type.SINGLE,double:Barline.type.DOUBLE,end:Barline.type.END,repeatBegin:Barline.type.REPEAT_BEGIN,repeatEnd:Barline.type.REPEAT_END,repeatBoth:Barline.type.REPEAT_BOTH,none:Barline.type.NONE}}constructor(e){super(),this.setAttribute("type","Barline"),this.thickness=Flow.STAVE_LINE_THICKNESS;const i=Barline.type;this.widths={},this.widths[i.SINGLE]=5,this.widths[i.DOUBLE]=5,this.widths[i.END]=5,this.widths[i.REPEAT_BEGIN]=5,this.widths[i.REPEAT_END]=5,this.widths[i.REPEAT_BOTH]=5,this.widths[i.NONE]=5,this.paddings={},this.paddings[i.SINGLE]=0,this.paddings[i.DOUBLE]=0,this.paddings[i.END]=0,this.paddings[i.REPEAT_BEGIN]=15,this.paddings[i.REPEAT_END]=15,this.paddings[i.REPEAT_BOTH]=15,this.paddings[i.NONE]=0,this.layoutMetricsMap={},this.layoutMetricsMap[i.SINGLE]={xMin:0,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[i.DOUBLE]={xMin:-3,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[i.END]={xMin:-5,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[i.REPEAT_END]={xMin:-10,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[i.REPEAT_BEGIN]={xMin:-2,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[i.REPEAT_BOTH]={xMin:-10,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[i.NONE]={xMin:0,xMax:0,paddingLeft:5,paddingRight:5},this.setPosition(StaveModifier.Position.BEGIN),this.setType(e)}getCategory(){return Barline.CATEGORY}getType(){return this.type}setType(e){return this.type=typeof e=="string"?Barline.typeString[e]:e,this.setWidth(this.widths[this.type]),this.setPadding(this.paddings[this.type]),this.setLayoutMetrics(this.layoutMetricsMap[this.type]),this}draw(e){switch(e.checkContext(),this.setRendered(),this.type){case Barline.type.SINGLE:this.drawVerticalBar(e,this.x,!1);break;case Barline.type.DOUBLE:this.drawVerticalBar(e,this.x,!0);break;case Barline.type.END:this.drawVerticalEndBar(e,this.x);break;case Barline.type.REPEAT_BEGIN:this.drawRepeatBar(e,this.x,!0),e.getX()!==this.x&&this.drawVerticalBar(e,e.getX());break;case Barline.type.REPEAT_END:this.drawRepeatBar(e,this.x,!1);break;case Barline.type.REPEAT_BOTH:this.drawRepeatBar(e,this.x,!1),this.drawRepeatBar(e,this.x,!0);break}}drawVerticalBar(e,i,r){e.checkContext();const s=e.getTopLineTopY(),o=e.getBottomLineBottomY();r&&e.context.fillRect(i-3,s,1,o-s),e.context.fillRect(i,s,1,o-s)}drawVerticalEndBar(e,i){e.checkContext();const r=e.getTopLineTopY(),s=e.getBottomLineBottomY();e.context.fillRect(i-5,r,1,s-r),e.context.fillRect(i-2,r,3,s-r)}drawRepeatBar(e,i,r){e.checkContext();const s=e.getTopLineTopY(),o=e.getBottomLineBottomY();let a=3;r||(a=-5),e.context.fillRect(i+a,s,1,o-s),e.context.fillRect(i-2,s,3,o-s);const l=2;r?a+=4:a-=4;const c=i+a+l/2;let u=(e.getNumLines()-1)*e.getSpacingBetweenLines();u=u/2-e.getSpacingBetweenLines()/2;let m=s+u+l/2;e.context.beginPath(),e.context.arc(c,m,l,0,Math.PI*2,!1),e.context.fill(),m+=e.getSpacingBetweenLines(),e.context.beginPath(),e.context.arc(c,m,l,0,Math.PI*2,!1),e.context.fill()}}let Repetition$1=class Fe extends StaveModifier{static get CATEGORY(){return"repetitions"}static get type(){return{NONE:1,CODA_LEFT:2,CODA_RIGHT:3,SEGNO_LEFT:4,SEGNO_RIGHT:5,DC:6,DC_AL_CODA:7,DC_AL_FINE:8,DS:9,DS_AL_CODA:10,DS_AL_FINE:11,FINE:12,TO_CODA:13}}constructor(e,i,r){super(),this.setAttribute("type","Repetition"),this.symbol_type=e,this.x=i,this.x_shift=0,this.y_shift=r,this.font={family:"times",size:12,weight:"bold italic"}}getCategory(){return Fe.CATEGORY}setShiftX(e){return this.x_shift=e,this}setShiftY(e){return this.y_shift=e,this}setX(e){return this.x=e,this}draw(e,i){switch(this.setRendered(),this.symbol_type){case Fe.type.CODA_RIGHT:this.drawCodaFixed(e,i+e.width);break;case Fe.type.CODA_LEFT:this.drawSymbolText(e,i,"Coda",!0);break;case Fe.type.SEGNO_LEFT:this.drawSignoFixed(e,i);break;case Fe.type.SEGNO_RIGHT:this.drawSignoFixed(e,i+e.width);break;case Fe.type.DC:this.drawSymbolText(e,i,"D.C.",!1);break;case Fe.type.DC_AL_CODA:this.drawSymbolText(e,i,"D.C. al",!0);break;case Fe.type.DC_AL_FINE:this.drawSymbolText(e,i,"D.C. al Fine",!1);break;case Fe.type.DS:this.drawSymbolText(e,i,"D.S.",!1);break;case Fe.type.DS_AL_CODA:this.drawSymbolText(e,i,"D.S. al",!0);break;case Fe.type.DS_AL_FINE:this.drawSymbolText(e,i,"D.S. al Fine",!1);break;case Fe.type.FINE:this.drawSymbolText(e,i,"Fine",!1);break;case Fe.type.TO_CODA:this.drawSymbolText(e,i,"To",!0);break}return this}drawCodaFixed(e,i){const r=e.getYForTopText(e.options.num_lines)+this.y_shift;return Glyph.renderGlyph(e.context,this.x+i+this.x_shift,r+25,40,"v4d",!0),this}drawSignoFixed(e,i){const r=e.getYForTopText(e.options.num_lines)+this.y_shift;return Glyph.renderGlyph(e.context,this.x+i+this.x_shift,r+25,30,"v8c",!0),this}drawSymbolText(e,i,r,s){const o=e.checkContext();o.save(),o.setFont(this.font.family,this.font.size,this.font.weight);let a=0+this.x_shift,l=i+this.x_shift;if(this.symbol_type===Fe.type.CODA_LEFT?(a=this.x+this.x_shift,l=a+o.measureText(r).width+12):(this.x_shift=-(a+o.measureText(r).width+12+e.options.vertical_bar_width+12),a=this.x+this.x_shift+e.options.vertical_bar_width,l=a+o.measureText(r).width+12),this.xShiftAsPercentOfStaveWidth){const u=e.width*this.xShiftAsPercentOfStaveWidth;(this.symbol_type===Fe.type.DC_AL_FINE||this.symbol_type===Fe.type.FINE||this.symbol_type===Fe.type.DC||this.symbol_type===Fe.type.DS_AL_FINE||this.symbol_type===Fe.type.DS||this.symbol_type===Fe.type.FINE)&&(a+=u)}const c=e.getYForTopText(e.options.num_lines)+this.y_shift+25;return s&&Glyph.renderGlyph(o,l,c,40,"v4d",!0),o.fillText(r,a,c+5),o.restore(),this}};class StaveSection extends StaveModifier{static get CATEGORY(){return"stavesection"}constructor(e,i,r){super(),this.setAttribute("type","StaveSection"),this.setWidth(16),this.section=e,this.x=i,this.shift_x=0,this.shift_y=r,this.font={family:"sans-serif",size:12,weight:"bold"}}getCategory(){return StaveSection.CATEGORY}setStaveSection(e){return this.section=e,this}setShiftX(e){return this.shift_x=e,this}setShiftY(e){return this.shift_y=e,this}draw(e,i){const r=e.checkContext();this.setRendered(),r.save(),r.lineWidth=2,r.setFont(this.font.family,this.font.size,this.font.weight);const s=r.measureText(""+this.section),o=s.width;let a=s.height;!a&&s.emHeightAscent>=0&&(a=s.emHeightAscent+2),a||(a=s.fontBoundingBoxAscent+3);let l=o+6;l<18&&(l=18);const c=a+this.font.size/10,u=e.getYForTopText(3)+19-c*1.15+this.shift_y;let m=this.x+i;return r.beginPath(),r.lineWidth=2,r.rect(m,u+a/4,l,c),r.stroke(),m+=(l-o)/2,r.fillText(""+this.section,m,u+c),r.restore(),this}}class StaveTempo extends StaveModifier{static get CATEGORY(){return"stavetempo"}constructor(e,i,r){super(),this.setAttribute("type","StaveTempo"),this.tempo=e,this.position=Modifier.Position.ABOVE,this.x=i,this.shift_x=10,this.shift_y=r,this.font={family:"times",size:14,weight:"bold"},this.render_options={glyph_font_scale:30}}getCategory(){return StaveTempo.CATEGORY}setTempo(e){return this.tempo=e,this}setShiftX(e){return this.shift_x=e,this}setShiftY(e){return this.shift_y=e,this}draw(e,i){const r=e.checkContext();this.setRendered();const s=this.render_options,o=s.glyph_font_scale/38,a=this.tempo.name,l=this.tempo.duration,c=this.tempo.dots,u=this.tempo.bpm,m=this.font;let d=this.x+this.shift_x+i;const g=e.getYForTopText(1)+this.shift_y;if(r.save(),a&&(r.setFont(m.family,m.size,m.weight),r.fillText(a,d,g),d+=r.measureText(a).width),l&&u){r.setFont(m.family,m.size,"normal"),a&&(d+=r.measureText(" ").width,r.fillText("(",d,g),d+=r.measureText("(").width);const y=Flow.getGlyphProps(l);if(d+=3*o,Glyph.renderGlyph(r,d,g,s.glyph_font_scale,y.code_head),d+=y.getWidth()*o,y.stem){let b=30;y.beam_count&&(b+=3*(y.beam_count-1)),b*=o;const S=g-b;r.fillRect(d-o,S,o,b),y.flag&&(Glyph.renderGlyph(r,d,S,s.glyph_font_scale,y.code_flag_upstem),c||(d+=6*o))}for(let b=0;b=e.line?c.above:c.below)}this.placeGlyphOnLine(s,this.stave,e.line),this.glyphs.push(s);const a=this.xPositions[this.xPositions.length-1],l=s.getMetrics().width+o;this.xPositions.push(a+l),this.width+=l}cancelKey(e){return this.formatted=!1,this.cancelKeySpec=e,this}convertToCancelAccList(e){const i=Flow.keySignature(e),r=this.accList.length>0&&i.length>0&&i[0].type!==this.accList[0].type,s=r?i.length:i.length-this.accList.length;if(s<1)return;const o=[];for(let a=0;a0?e[0].type:null;let r;if(this.cancelKeySpec&&(r=this.convertToCancelAccList(this.cancelKeySpec)),this.alterKeySpec&&this.convertToAlterAccList(this.alterKeySpec),this.accList.length>0){const s=(this.position===StaveModifier.Position.END?this.stave.endClef:this.stave.clef)||this.stave.clef;r&&this.convertAccLines(s,r.type,r.accList),this.convertAccLines(s,i,e);for(let o=0;o0){const e=this.stave.context.openGroup("keysignature");for(let i=0;i{const e=t.split("/").filter(i=>i!=="");if(e.length!==2)throw new Vex.RERR("BadTimeSignature",`Invalid time spec: ${t}. Must be in the form "/"`);e.forEach(i=>{if(isNaN(Number(i)))throw new Vex.RERR("BadTimeSignature",`Invalid time spec: ${t}. Must contain two valid numbers.`)})};class TimeSignature extends StaveModifier{static get CATEGORY(){return"timesignatures"}static get glyphs(){return{C:{code:"v41",point:40,line:2},"C|":{code:"vb6",point:40,line:2}}}constructor(e=null,i=15,r=!0){if(super(),this.setAttribute("type","TimeSignature"),this.validate_args=r,e===null)return;const s=i;this.point=40,this.topLine=2,this.bottomLine=4,this.setPosition(StaveModifier.Position.BEGIN),this.setTimeSig(e),this.setWidth(this.timeSig.glyph.getMetrics().width),this.setPadding(s)}getCategory(){return TimeSignature.CATEGORY}parseTimeSpec(e){if(e==="C"||e==="C|"){const{line:s,code:o,point:a}=TimeSignature.glyphs[e];return{line:s,num:!1,glyph:new Glyph(o,a)}}this.validate_args&&assertIsValidFraction(e);const[i,r]=e.split("/").map(s=>s.split(""));return{num:!0,glyph:this.makeTimeSignatureGlyph(i,r)}}makeTimeSignatureGlyph(e,i){const r=new Glyph("v0",this.point);r.topGlyphs=[],r.botGlyphs=[];let s=0;for(let d=0;do?s:o,l=r.getMetrics().x_min;r.getMetrics=()=>({x_min:l,x_max:l+a,width:a});const c=(a-s)/2,u=(a-o)/2,m=this;return r.renderToStave=function(g){let y=g+c;for(let b=0;bi.visible).filter(Boolean).length}formatBegModifiers(e){let i=0;e.forEach(r=>{r.getNoteStartX()>i&&(i=r.getNoteStartX())}),e.forEach(r=>{r.setNoteStartX(i)}),i=0,e.forEach(r=>{r.getModifiers(StaveModifier.Position.BEGIN,Barline.CATEGORY).forEach(o=>{o.getType()==Barline.type.REPEAT_BEGIN&&o.getX()>i&&(i=o.getX())})}),e.forEach(r=>{r.getModifiers(StaveModifier.Position.BEGIN,Barline.CATEGORY).forEach(o=>{o.getType()==Barline.type.REPEAT_BEGIN&&o.setX(i)})}),i=0,e.forEach(r=>{r.getModifiers(StaveModifier.Position.BEGIN,TimeSignature.CATEGORY).forEach(o=>{o.getX()>i&&(i=o.getX())})}),e.forEach(r=>{r.getModifiers(StaveModifier.Position.BEGIN,TimeSignature.CATEGORY).forEach(o=>{o.setX(i)})})}getOptions(){return this.options}setNoteStartX(e){return this.formatted||this.format(),this.setStartX(e),this}setStartX(e){this.start_x=e}getNoteStartX(){return this.formatted||this.format(),this.start_x}getNoteEndX(){return this.formatted||this.format(),this.end_x}getTieStartX(){return this.start_x}getTieEndX(){return this.x+this.width}getX(){return this.x}getNumLines(){return this.options.num_lines}setNumLines(e){return this.options.num_lines=parseInt(e,10),this.resetLines(),this}setY(e){return this.y=e,this}getTopLineTopY(){return this.getYForLine(0)-Flow.STAVE_LINE_THICKNESS/2}getBottomLineBottomY(){return this.getLines()===2?this.getYForLine(6)+Flow.STAVE_LINE_THICKNESS/2:this.getYForLine(this.getNumLines()-1)+Flow.STAVE_LINE_THICKNESS/2}setX(e){const i=e-this.x;this.formatted=!1,this.x=e,this.start_x+=i,this.end_x+=i;for(let r=0;rr.getWidth()&&(i-=r.getWidth()),i}setRepetitionTypeLeft(e,i){return this.modifiers.push(new Repetition$1(e,this.x,i)),this}setRepetitionTypeRight(e,i){return this.modifiers.push(new Repetition$1(e,this.x,i)),this}setVoltaType(e,i,r){return this.modifiers.push(new Volta(e,i,this.x,r)),this}setSection(e,i,r=0,s=12){const o=new StaveSection(e,this.x+r,i);return o.font.size=s,this.modifiers.push(o),this}setTempo(e,i){return this.modifiers.push(new StaveTempo(e,this.x,i)),this}setText(e,i,r){return this.modifiers.push(new StaveText(e,i,r)),this}getHeight(){return this.height}getSpacingBetweenLines(){return this.options.spacing_between_lines_px}getBoundingBox(){return new BoundingBox(this.x,this.y,this.width,this.getBottomY()-this.y)}getBottomY(){const e=this.options,i=e.spacing_between_lines_px;return this.getYForLine(e.num_lines)+e.space_below_staff_ln*i}getBottomLineY(){return this.getYForLine(this.options.num_lines)}getYForLine(e){const i=this.options,r=i.spacing_between_lines_px,s=i.space_above_staff_ln;return this.y+e*r+s*r}getLineForY(e){const i=this.options,r=i.spacing_between_lines_px,s=i.space_above_staff_ln;return(e-this.y)/r-s}getYForTopText(e){const i=e||0;return this.getYForLine(-i-this.options.top_text_position)}getYForBottomText(e){const i=e||0;return this.getYForLine(this.options.bottom_text_position+i)}getYForNote(e){const i=this.options,r=i.spacing_between_lines_px,s=i.space_above_staff_ln;return this.y+s*r+5*r-e*r}getYForGlyphs(){return this.getYForLine(3)}addModifier(e,i){return i!==void 0&&e.setPosition(i),e.setStave(this),this.formatted=!1,this.modifiers.push(e),this}addEndModifier(e){return this.addModifier(e,StaveModifier.Position.END),this}setBegBarType(e){const{SINGLE:i,REPEAT_BEGIN:r,NONE:s}=Barline.type;return(e===i||e===r||e===s)&&(this.modifiers[0].setType(e),this.formatted=!1),this}setEndBarType(e){return e!==Barline.type.REPEAT_BEGIN&&(this.modifiers[1].setType(e),this.formatted=!1),this}setClef(e,i,r,s){s===void 0&&(s=StaveModifier.Position.BEGIN),s===StaveModifier.Position.END?this.endClef=e:this.clef=e;const o=this.getModifiers(s,Clef.CATEGORY);return o.length===0?this.addClef(e,i,r,s):o[0].setType(e,i,r),this}setEndClef(e,i,r){return this.setClef(e,i,r,StaveModifier.Position.END),this}setKeySignature(e,i,r){r===void 0&&(r=StaveModifier.Position.BEGIN);const s=this.getModifiers(r,KeySignature.CATEGORY);return s.length===0?this.addKeySignature(e,i,r):s[0].setKeySig(e,i),this}setEndKeySignature(e,i){return this.setKeySignature(e,i,StaveModifier.Position.END),this}setTimeSignature(e,i,r){r===void 0&&(r=StaveModifier.Position.BEGIN);const s=this.getModifiers(r,TimeSignature.CATEGORY);return s.length===0?this.addTimeSignature(e,i,r):s[0].setTimeSig(e),this}setEndTimeSignature(e,i){return this.setTimeSignature(e,i,StaveModifier.Position.END),this}addKeySignature(e,i,r){return r===void 0&&(r=StaveModifier.Position.BEGIN),this.addModifier(new KeySignature(e,i).setPosition(r),r),this}addClef(e,i,r,s){return s===void 0||s===StaveModifier.Position.BEGIN?this.clef=e:s===StaveModifier.Position.END&&(this.endClef=e),this.addModifier(new Clef(e,i,r),s),this}addEndClef(e,i,r){return this.addClef(e,i,r,StaveModifier.Position.END),this}addTimeSignature(e,i,r){return this.addModifier(new TimeSignature(e,i),r),this}addEndTimeSignature(e,i){return this.addTimeSignature(e,i,StaveModifier.Position.END),this}addTrebleGlyph(){return this.addClef("treble"),this}getModifiers(e,i){return e===void 0&&i===void 0?this.modifiers:this.modifiers.filter(r=>(e===void 0||e===r.getPosition())&&(i===void 0||i===r.getCategory()))}sortByCategory(e,i){for(let r=e.length-1;r>=0;r--)for(let s=0;si[e[s+1].getCategory()]){const o=e[s];e[s]=e[s+1],e[s+1]=o}}format(){const e=this.modifiers[0],i=this.modifiers[1],r=this.getModifiers(StaveModifier.Position.BEGIN),s=this.getModifiers(StaveModifier.Position.END);this.sortByCategory(r,{barlines:0,clefs:1,keysignatures:2,timesignatures:3}),this.sortByCategory(s,{timesignatures:0,keysignatures:1,barlines:2,clefs:3}),r.length>1&&e.getType()===Barline.type.REPEAT_BEGIN&&(r.push(r.splice(0,1)[0]),r.splice(0,0,new Barline(Barline.type.SINGLE))),s.indexOf(i)>0&&s.splice(0,0,new Barline(Barline.type.NONE));let o,a,l,c=0,u=this.x;for(let g=0;gu?u=y:l.setX(u),u+=o,a+o===0&&c--}u>this.start_x&&this.setStartX(u),u=this.x+this.width;const m={left:0,right:0,paddingRight:0,paddingLeft:0};let d=0;for(let g=0;g{a.includes(c)?l.visible=!0:l.visible=!1})}for(let a=0;a0){this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);const a=this.context.measureText(""+this.measure).width;s=this.getYForTopText(0)+3,this.context.fillText(""+this.measure,this.x-a/2,s),this.context.restore()}return this}drawStaveTempo(){if(!this.staveTempos.length)return;const e=document.querySelector(`#${this.attrs.id}`);if(!e)return;const i=e.parentElement.getBBox(),r=this.getYForLine(0),s=e.parentElement.parentElement.querySelectorAll(".vf-curve");if(s.length){const o=this.x+this.staveTempos[0].shift_x+this.getModifierXShift(0),a=this.getYForTopText(1)+i.y-r+5;s.forEach(l=>{const c=l.getBBox();c.x-10o&&c.y-10a&&(i.y=c.y+5)})}for(let o=0;o=0&&this.timeSignature.numerator){let e=40,i=0;this.MeasureNumber<2&&(e=70,i=-72),this.setText(`${this.timeSignature.numerator}`,1,{justification:1,shift_x:e,shift_y:i-13}),this.setText("ᅳ",1,{justification:1,shift_x:e+3,shift_y:i-2}),this.setText(`${this.timeSignature.denominator}`,1,{justification:1,shift_x:e,shift_y:i+8})}}drawVertical(e,i){this.drawVerticalFixed(this.x+e,i)}drawVerticalFixed(e,i){this.checkContext();const r=this.getYForLine(0),s=this.getYForLine(this.options.num_lines-1);i&&this.context.fillRect(e-3,r,1,s-r+1),this.context.fillRect(e,r,1,s-r+1)}drawVerticalBar(e){this.drawVerticalBarFixed(this.x+e,!1)}drawVerticalBarFixed(e){this.checkContext();const i=this.getYForLine(0),r=this.getYForLine(this.options.num_lines-1);this.context.fillRect(e,i,1,r-i+1)}getConfigForLines(){return this.options.line_config}setConfigForLine(e,i){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(i.visible===void 0)throw new Vex.RERR("StaveConfigError","The line configuration object is missing the 'visible' property.");if(typeof i.visible!="boolean")throw new Vex.RERR("StaveConfigError","The line configuration objects 'visible' property must be true or false.");return this.options.line_config[e]=i,this}setConfigForLines(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(const i in e)e[i]||(e[i]=this.options.line_config[i]),Vex.Merge(this.options.line_config[i],e[i]);return this.options.line_config=e,this}}class TabStave extends Stave{constructor(e,i,r,s){const o={spacing_between_lines_px:13,num_lines:6,top_text_position:1};Vex.Merge(o,s),super(e,i,r,o),this.setAttribute("type","TabStave")}getYForGlyphs(){return this.getYForLine(2.5)}addTabGlyph(){return this.addClef("tab"),this}}function getUnusedStringGroups(t,e){const i=[];let r=[];for(let s=1;s<=t;s++)e.indexOf(s)>-1?(i.push(r),r=[]):r.push(s);return r.length>0&&i.push(r),i}function getPartialStemLines(t,e,i,r){const s=r!==1,o=r!==-1,a=i.getSpacingBetweenLines(),l=i.getNumLines(),c=[];return e.forEach(u=>{const m=u.indexOf(l)>-1,d=u.indexOf(1)>-1;if(s&&d||o&&m)return;u.length===1&&u.push(u[0]);const g=[];u.forEach((y,b,S)=>{const E=y===1,x=y===l;let A=i.getYForLine(y-1);b===0&&!E?A-=a/2-1:b===S.length-1&&!x&&(A+=a/2-1),g.push(A),r===1&&E?g.push(t-2):r===-1&&x&&g.push(t+2)}),c.push(g.sort((y,b)=>y-b))}),c}let TabNote$1=class di extends StemmableNote{static get CATEGORY(){return"tabnotes"}constructor(e,i){if(super(e),this.setAttribute("type","TabNote"),this.ghost=!1,this.positions=e.positions,Vex.Merge(this.render_options,{glyph_font_scale:Flow.DEFAULT_TABLATURE_FONT_SCALE,draw_stem:i,draw_dots:i,draw_stem_through_stave:!1,y_shift:0,scale:1,font:"10pt Arial"}),this.glyph=Flow.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new Vex.RuntimeError("BadArguments",`Invalid note initialization data (No glyph found): ${JSON.stringify(e)}`);this.buildStem(),e.stem_direction?this.setStemDirection(e.stem_direction):this.setStemDirection(Stem.UP),this.ghost=!1,this.updateWidth()}reset(){this.stave&&this.setStave(this.stave)}getCategory(){return di.CATEGORY}setGhost(e){return this.ghost=e,this.updateWidth(),this}hasStem(){return this.render_options.draw_stem}getStemExtension(){const e=this.getGlyph();return this.stem_extension_override!=null?this.stem_extension_override:e?this.getStemDirection()===1?e.tabnote_stem_up_extension:e.tabnote_stem_down_extension:0}addDot(){const e=new Dot;return this.dots+=1,this.addModifier(e,0)}updateWidth(){this.glyphs=[],this.width=0;for(let e=0;ethis.width}setStave(e){super.setStave(e),this.context=e.context;let i;if(this.context){const s=this.context;for(this.width=0,i=0;io.width),this.width=Math.max(o.getWidth(),this.width)}this.glyph.getWidth=()=>this.width}const r=this.positions.map(({str:s})=>e.getYForLine(s-1));return this.setYs(r),this.stem&&this.stem.setYBounds(this.getStemY(),this.getStemY()),this}getPositions(){return this.positions}addToModifierContext(e){this.setModifierContext(e);for(let i=0;i{e.getCategory()==="dots"&&!this.render_options.draw_dots||(e.setContext(this.context),e.drawWithStyle())})}drawStemThrough(){const e=this.getStemX(),i=this.getStemY(),r=this.context,s=this.render_options.draw_stem_through_stave;if(this.render_options.draw_stem&&s){const a=this.stave.getNumLines(),l=this.positions.map(m=>m.str),c=getUnusedStringGroups(a,l),u=getPartialStemLines(i,c,this.getStave(),this.getStemDirection());r.save(),r.setLineWidth(Stem.WIDTH),u.forEach(m=>{m.length!==0&&(r.beginPath(),r.moveTo(e,m[0]),r.lineTo(e,m[m.length-1]),r.stroke(),r.closePath())}),r.restore()}}drawPositions(){const e=this.context,i=this.getAbsoluteX(),r=this.ys;for(let s=0;sparseInt(s,10)?TabSlide.SLIDE_DOWN:TabSlide.SLIDE_UP}this.slide_direction=i,this.render_options.cp1=11,this.render_options.cp2=14,this.render_options.y_shift=.5,this.setFont({font:"Times",size:10,style:"bold italic"}),this.setNotes(e)}renderTie(e){if(e.first_ys.length===0||e.last_ys.length===0)throw new Vex.RERR("BadArguments","No Y-values to render");const i=this.context,r=e.first_x_px,s=e.first_ys,o=e.last_x_px,a=this.slide_direction;if(a!==TabSlide.SLIDE_UP&&a!==TabSlide.SLIDE_DOWN)throw new Vex.RERR("BadSlide","Invalid slide direction");for(let l=0;lthis.numStrings)throw new Vex.RERR("BadArguments",`String number must be between 1 and ${this.numStrings}:${e}`);return this.tuningValues[i-1]}getValueForFret(e,i){const r=this.getValueForString(i),s=parseInt(e,10);if(s<0)throw new Vex.RERR("BadArguments","Fret number must be 0 or higher: "+e);return r+s}getNoteForFret(e,i){const r=this.getValueForFret(e,i),s=Math.floor(r/12),o=r%12;return Flow.integerToNote(o)+"/"+s}}class KeyManager{constructor(e){this.music=new Music,this.setKey(e)}setKey(e){return this.key=e,this.reset(),this}getKey(){return this.key}reset(){if(this.keyParts=this.music.getKeyParts(this.key),this.keyString=this.keyParts.root,this.keyParts.accidental&&(this.keyString+=this.keyParts.accidental),!Music.scaleTypes[this.keyParts.type])throw new Vex.RERR("BadArguments",`Unsupported key type: ${this.key}`);this.scale=this.music.getScaleTones(this.music.getNoteValue(this.keyString),Music.scaleTypes[this.keyParts.type]),this.scaleMap={},this.scaleMapByValue={},this.originalScaleMapByValue={};const i=Music.root_indices[this.keyParts.root];for(let r=0;r{const r=TextDynamics.GLYPHS[i];if(!r)throw new Vex.RERR("Invalid dynamics character: "+i);const s=this.render_options.glyph_font_size,o=new Glyph(r.code,s);this.glyphs.push(o),e+=r.width}),this.setWidth(e),this.preFormatted=!0,this}draw(){this.setRendered();const e=this.getAbsoluteX(),i=this.stave.getYForLine(this.line+-3);L$7("Rendering Dynamics: ",this.sequence);let r=e;this.glyphs.forEach((s,o)=>{const a=this.sequence[o];s.render(this.context,r,i),r+=TextDynamics.GLYPHS[a].width})}}function drawArrowHead(t,e,i,r,s,o,a){t.beginPath(),t.moveTo(e,i),t.lineTo(r,s),t.lineTo(o,a),t.lineTo(e,i),t.closePath(),t.fill()}function drawArrowLine(t,e,i,r){const s=r.draw_start_arrow&&r.draw_end_arrow,o=e.x,a=e.y,l=i.x,c=i.y,u=Math.sqrt((l-o)*(l-o)+(c-a)*(c-a)),m=(u-r.arrowhead_length/3)/u;let d,g,y,b;r.draw_end_arrow||s?(d=Math.round(o+(l-o)*m),g=Math.round(a+(c-a)*m)):(d=l,g=c),r.draw_start_arrow||s?(y=o+(l-o)*(1-m),b=a+(c-a)*(1-m)):(y=o,b=a),r.color&&(t.setStrokeStyle(r.color),t.setFillStyle(r.color)),t.beginPath(),t.moveTo(y,b),t.lineTo(d,g),t.stroke(),t.closePath();const S=Math.atan2(c-a,l-o),E=Math.abs(r.arrowhead_length/Math.cos(r.arrowhead_angle));let x,A,_,P,T,M;(r.draw_end_arrow||s)&&(x=S+Math.PI+r.arrowhead_angle,_=l+Math.cos(x)*E,P=c+Math.sin(x)*E,A=S+Math.PI-r.arrowhead_angle,T=l+Math.cos(A)*E,M=c+Math.sin(A)*E,drawArrowHead(t,_,P,l,c,T,M)),(r.draw_start_arrow||s)&&(x=S+r.arrowhead_angle,_=o+Math.cos(x)*E,P=a+Math.sin(x)*E,A=S-r.arrowhead_angle,T=o+Math.cos(A)*E,M=a+Math.sin(A)*E,drawArrowHead(t,_,P,o,a,T,M))}class StaveLine extends Element$1{static get TextVerticalPosition(){return{TOP:1,BOTTOM:2}}static get TextJustification(){return{LEFT:1,CENTER:2,RIGHT:3}}constructor(e){super(),this.setAttribute("type","StaveLine"),this.notes=e,this.text="",this.font={family:"Arial",size:10,weight:""},this.render_options={padding_left:4,padding_right:3,line_width:1,line_dash:null,rounded_end:!0,color:null,draw_start_arrow:!1,draw_end_arrow:!1,arrowhead_length:10,arrowhead_angle:Math.PI/8,text_position_vertical:StaveLine.TextVerticalPosition.TOP,text_justification:StaveLine.TextJustification.CENTER},this.setNotes(e)}setFont(e){return this.font=e,this}setText(e){return this.text=e,this}setNotes(e){if(!e.first_note&&!e.last_note)throw new Vex.RuntimeError("BadArguments","Notes needs to have either first_note or last_note set.");if(e.first_indices||(e.first_indices=[0]),e.last_indices||(e.last_indices=[0]),e.first_indices.length!==e.last_indices.length)throw new Vex.RuntimeError("BadArguments","Connected notes must have similar index sizes");return this.first_note=e.first_note,this.first_indices=e.first_indices,this.last_note=e.last_note,this.last_indices=e.last_indices,this}applyLineStyle(){const e=this.checkContext(),i=this.render_options;i.line_dash&&e.setLineDash(i.line_dash),i.line_width&&e.setLineWidth(i.line_width),i.rounded_end?e.setLineCap("round"):e.setLineCap("square")}applyFontStyle(){const e=this.checkContext();this.font&&e.setFont(this.font.family,this.font.size,this.font.weight),this.render_options.color&&(e.setStrokeStyle(this.render_options.color),e.setFillStyle(this.render_options.color))}draw(){const e=this.checkContext();this.setRendered();const i=this.first_note,r=this.last_note,s=this.render_options;e.save(),this.applyLineStyle();let o,a;this.first_indices.forEach((g,y)=>{const b=this.last_indices[y];o=i.getModifierStartXY(2,g),a=r.getModifierStartXY(1,b);const S=o.y>a.y;o.x+=i.getMetrics().modRightPx+s.padding_left,a.x-=r.getMetrics().modLeftPx+s.padding_right;const E=i.getGlyph().getWidth();i.getKeyProps()[g].displaced&&i.getStemDirection()===1&&(o.x+=E+s.padding_left),r.getKeyProps()[b].displaced&&r.getStemDirection()===-1&&(a.x-=E+s.padding_right),o.y+=S?-3:1,a.y+=S?2:0,drawArrowLine(e,o,a,this.render_options)}),e.restore();const l=e.measureText(this.text).width,c=s.text_justification;let u=0;c===StaveLine.TextJustification.LEFT?u=o.x:c===StaveLine.TextJustification.CENTER?u=(a.x-o.x)/2+o.x-l/2:c===StaveLine.TextJustification.RIGHT&&(u=a.x-l);let m;const d=s.text_position_vertical;return d===StaveLine.TextVerticalPosition.TOP?m=i.getStave().getYForTopText():d===StaveLine.TextVerticalPosition.BOTTOM&&(m=i.getStave().getYForBottomText(Flow.TEXT_HEIGHT_OFFSET_HACK)),e.save(),this.applyFontStyle(),e.fillText(this.text,u,m),e.restore(),this}}function L$6(...t){PedalMarking.DEBUG&&Vex.L("Vex.Flow.PedalMarking",t)}function drawPedalGlyph(t,e,i,r,s){const o=PedalMarking.GLYPHS[t];new Glyph(o.code,s).render(e,i+o.x_shift,r+o.y_shift)}class PedalMarking extends Element$1{static get GLYPHS(){return{pedal_depress:{code:"v36",x_shift:-10,y_shift:0},pedal_release:{code:"v5d",x_shift:-2,y_shift:3}}}static get Styles(){return{TEXT:1,BRACKET:2,MIXED:3,MIXED_OPEN_END:4,BRACKET_OPEN_BEGIN:5,BRACKET_OPEN_END:6,BRACKET_OPEN_BOTH:7}}static get StylesString(){return{text:PedalMarking.Styles.TEXT,bracket:PedalMarking.Styles.BRACKET,mixed:PedalMarking.Styles.MIXED,mixed_open_end:PedalMarking.Styles.MIXED_OPEN_END,bracket_open_begin:PedalMarking.Styles.BRACKET_OPEN_BEGIN,bracket_open_end:PedalMarking.Styles.BRACKET_OPEN_END,bracket_open_both:PedalMarking.Styles.BRACKET_OPEN_BOTH}}static createSustain(e){return new PedalMarking(e)}static createSostenuto(e){const i=new PedalMarking(e);return i.setStyle(PedalMarking.Styles.MIXED),i.setCustomText("Sost. Ped."),i}static createUnaCorda(e){const i=new PedalMarking(e);return i.setStyle(PedalMarking.Styles.TEXT),i.setCustomText("una corda","tre corda"),i}constructor(e){super(),this.setAttribute("type","PedalMarking"),this.EndsStave=!1,this.ChangeBegin=!1,this.ChangeEnd=!1,this.notes=e,this.style=PedalMarking.TEXT,this.line=0,this.custom_depress_text="",this.custom_release_text="",this.font={family:"Times New Roman",size:12,weight:"italic bold"},this.render_options={bracket_height:10,text_margin_right:6,bracket_line_width:1,glyph_point_size:40,color:"black"}}setEndStave(e){if(this.endStave=e,this.endStaveAddedWidth=0,this.startMargin=0,this.endMargin=0,Array.isArray(this.endStave.modifiers))for(let i=0;i3)throw new Vex.RERR("InvalidParameter","The style must be one found in PedalMarking.Styles");return this.style=e,this}setLine(e){return this.line=e,this}drawBracketed(){const e=this.context;let i=!1,r,s;const o=this;this.notes.forEach((a,l,c)=>{i=!i;let u=0;if(a?(u=a.getNoteHeadBeginX(),this.BeginsStave&&(u=a.getStave().getNoteStartX())):u=this.endStave.end_x+this.endStaveAddedWidth,this.EndsStave)i?this.ChangeBegin&&(u=a.getAbsoluteX()):(a?this.ChangeEnd?u=a.getAbsoluteX():u=a.getStave().end_x+this.endStaveAddedWidth-o.render_options.text_margin_right:u=this.endStave.end_x+this.endStaveAddedWidth-o.render_options.text_margin_right,this.endMargin=-o.render_options.text_margin_right);else if(a)if(i)this.ChangeBegin&&(u=a.getAbsoluteX());else switch(o.style){case PedalMarking.Styles.BRACKET_OPEN_END:case PedalMarking.Styles.BRACKET_OPEN_BOTH:case PedalMarking.Styles.MIXED_OPEN_END:u=a.getNoteHeadEndX();break;default:this.ChangeEnd?u=a.getAbsoluteX():(u=a.getNoteHeadBeginX()-o.render_options.text_margin_right,this.startMargin=-o.render_options.text_margin_right);break}let m=this.endStave;a&&(m=a.getStave());let d=m.getYForBottomText(o.line+3);s&&s>d&&(d=s);const g=c[l+1]===a,y=c[l-1]===a;let b=0;if(i)if(b=y?5:0,(o.style===PedalMarking.Styles.MIXED||o.style===PedalMarking.Styles.MIXED_OPEN_END)&&!y)if(o.custom_depress_text){const S=e.measureText(o.custom_depress_text).width;e.fillText(o.custom_depress_text,u-S/2,d),b=S/2+o.render_options.text_margin_right}else drawPedalGlyph("pedal_depress",e,u,d,o.render_options.glyph_point_size),b=20+o.render_options.text_margin_right;else e.beginPath(),o.style===PedalMarking.Styles.BRACKET_OPEN_BEGIN||o.style===PedalMarking.Styles.BRACKET_OPEN_BOTH?e.moveTo(u+b,d):(this.ChangeBegin&&(u+=5),e.moveTo(u,d-o.render_options.bracket_height),this.ChangeBegin&&(u+=5),e.lineTo(u+b,d)),e.stroke(),e.closePath();else b=g&&!this.EndsStave?-5:0,e.beginPath(),e.moveTo(r,s),e.lineTo(u+b,d),o.style!==PedalMarking.Styles.BRACKET_OPEN_END&&o.style!==PedalMarking.Styles.MIXED_OPEN_END&&o.style!==PedalMarking.Styles.BRACKET_OPEN_BOTH&&(this.ChangeEnd&&(u+=5),e.lineTo(u,d-o.render_options.bracket_height)),e.stroke(),e.closePath();r=u+b,s=d})}drawText(){const e=this.context;let i=!1;const r=this,s=r.render_options.glyph_point_size;this.notes.forEach(o=>{if(!o)return;i=!i;const a=o.getStave(),l=o.getAbsoluteX(),c=a.getYForBottomText(r.line+3);let u=0;i?r.custom_depress_text?(u=e.measureText(r.custom_depress_text).width,e.fillText(r.custom_depress_text,l-u/2,c)):drawPedalGlyph("pedal_depress",e,l,c,s):r.custom_release_text?(u=e.measureText(r.custom_release_text).width,e.fillText(r.custom_release_text,l-u/2,c)):drawPedalGlyph("pedal_release",e,l,c,s)})}draw(){const 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===PedalMarking.Styles.BRACKET||this.style===PedalMarking.Styles.MIXED||this.style===PedalMarking.Styles.MIXED_OPEN_END||this.style===PedalMarking.Styles.BRACKET_OPEN_BEGIN||this.style===PedalMarking.Styles.BRACKET_OPEN_END||this.style===PedalMarking.Styles.BRACKET_OPEN_BOTH?(e.setLineWidth(this.render_options.bracket_line_width),this.drawBracketed()):this.style===PedalMarking.Styles.TEXT&&this.drawText(),e.restore()}}function L$5(...t){TextBracket.DEBUG&&Vex.L("Vex.Flow.TextBracket",t)}class TextBracket extends Element$1{static get Positions(){return{TOP:1,BOTTOM:-1}}static get PositionString(){return{top:TextBracket.Positions.TOP,bottom:TextBracket.Positions.BOTTOM}}constructor({start:e,stop:i,text:r="",superscript:s="",position:o=TextBracket.Positions.TOP}){super(),this.setAttribute("type","TextBracket"),this.start=e,this.stop=i,this.text=r,this.superscript=s,this.position=typeof o=="string"?TextBracket.PositionString[o]:o,this.line=1,this.font={family:"Serif",size:15,weight:"italic"},this.render_options={dashed:!0,dash:[5],color:"black",line_width:1,show_bracket:!0,bracket_height:8,underline_superscript:!0}}applyStyle(e){return e.setFont(this.font.family,this.font.size,this.font.weight),e.setStrokeStyle(this.render_options.color),e.setFillStyle(this.render_options.color),e.setLineWidth(this.render_options.line_width),this}setDashed(e,i){return this.render_options.dashed=e,i&&(this.render_options.dash=i),this}setFont(e){return this.font={...this.font,...e},this}setLine(e){return this.line=e,this}draw(){const e=this.context;this.setRendered();let i=0;switch(this.position){case TextBracket.Positions.TOP:i=this.start.getStave().getYForTopText(this.line);break;case TextBracket.Positions.BOTTOM:i=this.start.getStave().getYForBottomText(this.line+Flow.TEXT_HEIGHT_OFFSET_HACK);break;default:throw new Vex.RERR("InvalidPosition",`The position ${this.position} is invalid`)}const r={x:this.start.getAbsoluteX(),y:i},s={x:this.stop.getAbsoluteX(),y:i};L$5("Rendering TextBracket: start:",r,"stop:",s,"y:",i);const o=this.render_options.bracket_height*this.position;e.save(),this.applyStyle(e),e.fillText(this.text,r.x,r.y);let a=e.measureText(this.text).width;a>0||(a=10*this.text.length);let l=e.measureText("M").width;l>0||(l=20);const c=r.y-l/2.5;e.setFont(this.font.family,this.font.size/1.4,this.font.weight),e.fillText(this.superscript,r.x+a+1,c);let u=e.measureText(this.superscript).width;u>0||(u=12,this.superscript.includes("m")&&(u+=5));let m=e.measureText("M").width;m>0||(m=10);let d=r.x,g=c,y=s.x+this.stop.getGlyph().getWidth();this.position===TextBracket.Positions.TOP?(d+=a+u+5,g-=m/2.7):this.position===TextBracket.Positions.BOTTOM&&(g+=m/2.7,d+=a+2,this.render_options.underline_superscript||(d+=u)),this.render_options.dashed?(y0||i===!0;return i&&!(o>0)&&(this.pos=s),l?this.matchSuccess():this.matchFail(s),{success:l,results:r,numMatches:o}}expectZeroOrMore(e){return this.expectOneOrMore(e,!0)}expect(e){L$2("Evaluating rules:",e);let i;if(!e)throw new X$2("Invalid Rule: "+e,e);const r=e.bind(this.grammar)();if(r.token)i=this.matchToken(r.token,r.noSpace===!0),i.success&&(this.pos+=i.incrementPos);else if(r.expect)r.oneOrMore?i=this.expectOneOrMore(r):r.zeroOrMore?i=this.expectZeroOrMore(r):i=this.expectOne(r);else throw new X$2("Bad grammar! No `token` or `expect` property",r);return i.matches=[],i.results&&i.results.forEach(s=>i.matches.push(flattenMatches(s))),r.run&&i.success&&r.run(i),i}}function L$1(...t){EasyScore.DEBUG&&Vex.L("Vex.Flow.EasyScore",t)}const X$1=Vex.MakeException("EasyScoreError");class Grammar{constructor(e){this.builder=e}begin(){return this.LINE}LINE(){return{expect:[this.PIECE,this.PIECES,this.EOL]}}PIECE(){return{expect:[this.CHORDORNOTE,this.PARAMS],run:()=>this.builder.commitPiece()}}PIECES(){return{expect:[this.COMMA,this.PIECE],zeroOrMore:!0}}PARAMS(){return{expect:[this.DURATION,this.TYPE,this.DOTS,this.OPTS]}}CHORDORNOTE(){return{expect:[this.CHORD,this.SINGLENOTE],or:!0}}CHORD(){return{expect:[this.LPAREN,this.NOTES,this.RPAREN],run:e=>this.builder.addChord(e.matches[1])}}NOTES(){return{expect:[this.NOTE],oneOrMore:!0}}NOTE(){return{expect:[this.NOTENAME,this.ACCIDENTAL,this.OCTAVE]}}SINGLENOTE(){return{expect:[this.NOTENAME,this.ACCIDENTAL,this.OCTAVE],run:e=>this.builder.addSingleNote(e.matches[0],e.matches[1],e.matches[2])}}ACCIDENTAL(){return{expect:[this.ACCIDENTALS],maybe:!0}}DOTS(){return{expect:[this.DOT],zeroOrMore:!0,run:e=>this.builder.setNoteDots(e.matches[0])}}TYPE(){return{expect:[this.SLASH,this.MAYBESLASH,this.TYPES],maybe:!0,run:e=>this.builder.setNoteType(e.matches[2])}}DURATION(){return{expect:[this.SLASH,this.DURATIONS],maybe:!0,run:e=>this.builder.setNoteDuration(e.matches[1])}}OPTS(){return{expect:[this.LBRACKET,this.KEYVAL,this.KEYVALS,this.RBRACKET],maybe:!0}}KEYVALS(){return{expect:[this.COMMA,this.KEYVAL],zeroOrMore:!0}}KEYVAL(){const e=i=>i.slice(1,-1);return{expect:[this.KEY,this.EQUALS,this.VAL],run:i=>this.builder.addNoteOption(i.matches[0],e(i.matches[2]))}}VAL(){return{expect:[this.SVAL,this.DVAL],or:!0}}KEY(){return{token:"[a-zA-Z][a-zA-Z0-9]*"}}DVAL(){return{token:'["][^"]*["]'}}SVAL(){return{token:"['][^']*[']"}}NOTENAME(){return{token:"[a-gA-G]"}}OCTAVE(){return{token:"[0-9]+"}}ACCIDENTALS(){return{token:"bbs|bb|bss|bs|b|db|d|##|#|n|\\+\\+-|\\+-|\\+\\+|\\+|k|o"}}DURATIONS(){return{token:"[0-9whq]+"}}TYPES(){return{token:"[rRsSxX]"}}LPAREN(){return{token:"[(]"}}RPAREN(){return{token:"[)]"}}COMMA(){return{token:"[,]"}}DOT(){return{token:"[.]"}}SLASH(){return{token:"[/]"}}MAYBESLASH(){return{token:"[/]?"}}EQUALS(){return{token:"[=]"}}LBRACKET(){return{token:"\\["}}RBRACKET(){return{token:"\\]"}}EOL(){return{token:"$"}}}class Builder{constructor(e){this.factory=e,this.commitHooks=[],this.reset()}reset(e={}){this.options={stem:"auto",clef:"treble"},this.elements={notes:[],accidentals:[]},this.rollingDuration="8",this.resetPiece(),Object.assign(this.options,e)}getFactory(){return this.factory}getElements(){return this.elements}addCommitHook(e){this.commitHooks.push(e)}resetPiece(){L$1("resetPiece"),this.piece={chord:[],duration:this.rollingDuration,dots:0,type:void 0,options:{}}}setNoteDots(e){L$1("setNoteDots:",e),e&&(this.piece.dots=e.length)}setNoteDuration(e){L$1("setNoteDuration:",e),this.rollingDuration=this.piece.duration=e||this.rollingDuration}setNoteType(e){L$1("setNoteType:",e),e&&(this.piece.type=e)}addNoteOption(e,i){L$1("addNoteOption: key:",e,"value:",i),this.piece.options[e]=i}addNote(e,i,r){L$1("addNote:",e,i,r),this.piece.chord.push({key:e,accid:i,octave:r})}addSingleNote(e,i,r){L$1("addSingleNote:",e,i,r),this.addNote(e,i,r)}addChord(e){L$1("startChord"),typeof e[0]!="object"?this.addSingleNote(e[0]):e.forEach(i=>{i&&this.addNote(...i)}),L$1("endChord")}commitPiece(){L$1("commitPiece");const{factory:e}=this;if(!e)return;const i={...this.options,...this.piece.options},{stem:r,clef:s}=i,o=r.toLowerCase()==="auto",a=!o&&r.toLowerCase()==="up"?StaveNote.STEM_UP:StaveNote.STEM_DOWN,{chord:l,duration:c,dots:u,type:m}=this.piece,d=l.map(b=>b.key+"/"+b.octave),g=e.StaveNote({keys:d,duration:c,dots:u,type:m,clef:s,auto_stem:o});o||g.setStemDirection(a);const y=l.map(b=>b.accid||null);y.forEach((b,S)=>{b&&g.addAccidental(S,e.Accidental({type:b}))});for(let b=0;bb(i,g,this)),this.elements.notes.push(g),this.elements.accidentals.concat(y),this.resetPiece()}}function setId({id:t},e){t!==void 0&&e.setAttribute("id",t)}function setClass(t,e){if(!t.class)return;const i=/\s*,\s*/;t.class.split(i).forEach(r=>e.addClass(r))}class EasyScore{constructor(e={}){this.setOptions(e),this.defaults={clef:"treble",time:"4/4",stem:"auto"}}set(e){return Object.assign(this.defaults,e),this}setOptions(e){return this.options={factory:null,builder:null,commitHooks:[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(i=>this.addCommitHook(i)),this}setContext(e){return this.factory&&this.factory.setContext(e),this}parse(e,i={}){this.builder.reset(i);const r=this.parser.parse(e);if(!r.success&&this.options.throwOnError)throw new X$1("Error parsing line: "+e,r);return r}beam(e,i={}){return this.factory.Beam({notes:e,options:i}),e}tuplet(e,i={}){return this.factory.Tuplet({notes:e,options:i}),e}notes(e,i={}){return i={clef:this.defaults.clef,stem:this.defaults.stem,...i},this.parse(e,i),this.builder.getElements().notes}voice(e,i){return i={time:this.defaults.time,...i},this.factory.Voice(i).addTickables(e)}addCommitHook(e){return this.builder.addCommitHook(e)}}function L(...t){Factory.DEBUG&&Vex.L("Vex.Flow.Factory",t)}const X=Vex.MakeException("FactoryError");function setDefaults$1(t={},e){const i=e.options;return t=Object.assign(e,t),t.options=Object.assign(i,t.options),t}class Factory{constructor(e){L("New factory: ",e);const i={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=i,this.setOptions(e)}static newFromElementId(e,i=500,r=200){return new Factory({renderer:{elementId:e,width:i,height:r}})}reset(){this.renderQ=[],this.systems=[],this.staves=[],this.voices=[],this.stave=null}getOptions(){return this.options}setOptions(e){for(const i of["stave","renderer","font"])Object.assign(this.options[i],e[i]);(this.options.renderer.elementId!==null||this.options.renderer.context)&&this.initRenderer(),this.reset()}initRenderer(){const{elementId:e,backend:i,width:r,height:s,background:o}=this.options.renderer;if(e==="")throw new X("HTML DOM element not set in Factory");this.context=Renderer.buildContext(e,i,r,s,o)}getContext(){return this.context}setContext(e){return this.context=e,this}getStave(){return this.stave}getVoices(){return this.voices}space(e){return this.options.stave.space*e}Stave(e){e=setDefaults$1(e,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:this.options.stave.space}});const i=new Stave(e.x,e.y,e.width,e.options);return this.staves.push(i),i.setContext(this.context),this.stave=i,i}TabStave(e){e=setDefaults$1(e,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:this.options.stave.space*1.3}});const i=new TabStave(e.x,e.y,e.width,e.options);return this.staves.push(i),i.setContext(this.context),this.stave=i,i}StaveNote(e){const i=new StaveNote(e);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}GhostNote(e){const i=new GhostNote(e);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}TextNote(e){const i=new TextNote(e);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}BarNote(e){e=setDefaults$1(e,{type:"single",options:{}});const i=new BarNote(e.type);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}ClefNote(e){e=setDefaults$1(e,{type:"treble",options:{size:"default"}});const i=new ClefNote(e.type,e.options.size,e.options.annotation);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}TimeSigNote(e){e=setDefaults$1(e,{time:"4/4",options:{}});const i=new TimeSigNote(e.time);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}KeySigNote(e){const i=new KeySigNote(e.key,e.cancelKey,e.alterKey);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}TabNote(e){const i=new TabNote$1(e);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}GraceNote(e){const i=new GraceNote(e);return this.stave&&i.setStave(this.stave),i.setContext(this.context),i}GraceNoteGroup(e){const i=new GraceNoteGroup(e.notes,e.slur);return i.setContext(this.context),i}Accidental(e){e=setDefaults$1(e,{type:null,options:{}});const i=new Accidental(e.type);return i.setContext(this.context),i}Annotation(e){e=setDefaults$1(e,{text:"p",vJustify:"below",hJustify:"center",fontFamily:"Times",fontSize:14,fontWeight:"bold italic",options:{}});const i=new Annotation(e.text);return i.setJustification(e.hJustify),i.setVerticalJustification(e.vJustify),i.setFont(e.fontFamily,e.fontSize,e.fontWeight),i.setContext(this.context),i}Articulation(e){e=setDefaults$1(e,{type:"a.",position:"above",options:{}});const i=new Articulation$1(e.type);return i.setPosition(e.position),i.setContext(this.context),i}TextDynamics(e){e=setDefaults$1(e,{text:"p",duration:"q",dots:0,line:0,options:{}});const i=new TextDynamics({text:e.text,line:e.line,duration:e.duration,dots:e.dots});return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}Fingering(e){e=setDefaults$1(e,{number:"0",position:"left",options:{}});const i=new FretHandFinger(e.number);return i.setPosition(e.position),i.setContext(this.context),i}StringNumber(e){e=setDefaults$1(e,{number:"0",position:"left",options:{}});const i=new StringNumber(e.number);return i.setPosition(e.position),i.setContext(this.context),i}TickContext(){return new TickContext().setContext(this.context)}ModifierContext(){return new ModifierContext}MultiMeasureRest(e){const i=new MultiMeasureRest(e.number_of_measures,e);return i.setContext(this.context),this.renderQ.push(i),i}Voice(e){e=setDefaults$1(e,{time:"4/4",options:{}});const i=new Voice$1(e.time);return this.voices.push(i),i}StaveConnector(e){e=setDefaults$1(e,{top_stave:null,bottom_stave:null,type:"double",options:{}});const i=new StaveConnector(e.top_stave,e.bottom_stave);return i.setType(e.type).setContext(this.context),this.renderQ.push(i),i}Formatter(){return new Formatter}Tuplet(e){e=setDefaults$1(e,{notes:[],options:{}});const i=new Tuplet$1(e.notes,e.options).setContext(this.context);return this.renderQ.push(i),i}Beam(e){e=setDefaults$1(e,{notes:[],options:{autoStem:!1,secondaryBeamBreaks:[]}});const i=new Beam$1(e.notes,e.options.autoStem).setContext(this.context);return i.breakSecondaryAt(e.options.secondaryBeamBreaks),this.renderQ.push(i),i}Curve(e){e=setDefaults$1(e,{from:null,to:null,options:{}});const i=new Curve(e.from,e.to,e.options).setContext(this.context);return this.renderQ.push(i),i}StaveTie(e){e=setDefaults$1(e,{from:null,to:null,first_indices:[0],last_indices:[0],text:null,options:{direction:void 0}});const i=new StaveTie({first_note:e.from,last_note:e.to,first_indices:e.first_indices,last_indices:e.last_indices},e.text);return e.options.direction&&i.setDirection(e.options.direction),i.setContext(this.context),this.renderQ.push(i),i}StaveLine(e){e=setDefaults$1(e,{from:null,to:null,first_indices:[0],last_indices:[0],options:{}});const i=new StaveLine({first_note:e.from,last_note:e.to,first_indices:e.first_indices,last_indices:e.last_indices});return e.options.text&&i.setText(e.options.text),e.options.font&&i.setFont(e.options.font),i.setContext(this.context),this.renderQ.push(i),i}VibratoBracket(e){e=setDefaults$1(e,{from:null,to:null,options:{harsh:!1}});const i=new VibratoBracket({start:e.from,stop:e.to});return e.options.line&&i.setLine(e.options.line),e.options.harsh&&i.setHarsh(e.options.harsh),i.setContext(this.context),this.renderQ.push(i),i}TextBracket(e){e=setDefaults$1(e,{from:null,to:null,text:"",options:{superscript:"",position:1}});const i=new TextBracket({start:e.from,stop:e.to,text:e.text,superscript:e.options.superscript,position:e.options.position});return e.options.line&&i.setLine(e.options.line),e.options.font&&i.setFont(e.options.font),i.setContext(this.context),this.renderQ.push(i),i}System(e={}){e.factory=this;const i=new System(e).setContext(this.context);return this.systems.push(i),i}EasyScore(e={}){return e.factory=this,new EasyScore(e)}PedalMarking(e={}){e=setDefaults$1(e,{notes:[],options:{style:"mixed"}});const i=new PedalMarking(e.notes);return i.setStyle(PedalMarking.StylesString[e.options.style]),i.setContext(this.context),this.renderQ.push(i),i}NoteSubGroup(e={}){e=setDefaults$1(e,{notes:[],options:{}});const i=new NoteSubGroup$1(e.notes);return i.setContext(this.context),i}draw(){this.systems.forEach(e=>e.setContext(this.context).format()),this.staves.forEach(e=>e.setContext(this.context).draw()),this.voices.forEach(e=>e.setContext(this.context).draw()),this.renderQ.forEach(e=>{e.isRendered()||e.setContext(this.context).draw()}),this.systems.forEach(e=>e.setContext(this.context).draw()),this.reset()}}function setDefaults(t,e){const i=e.options;return t=Object.assign(e,t),t.options=Object.assign(i,t.options),t}class System extends Element$1{constructor(e={}){super(),this.setAttribute("type","System"),this.setOptions(e),this.parts=[]}setOptions(e={}){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}})}setContext(e){return super.setContext(e),this.factory.setContext(e),this}addConnector(e="double"){return this.connector=this.factory.StaveConnector({top_stave:this.parts[0].stave,bottom_stave:this.parts[this.parts.length-1].stave,type:e}),this.connector}addStave(e){return e=setDefaults(e,{stave:null,voices:[],spaceAbove:0,spaceBelow:0,debugNoteMetrics:!1,options:{left_bar:!1}}),e.stave||(e.stave=this.factory.Stave({x:this.options.x,y:this.options.y,width:this.options.width,options:e.options})),e.voices.forEach(i=>i.setContext(this.context).setStave(e.stave).getTickables().forEach(r=>r.setStave(e.stave))),this.parts.push(e),e.stave}format(){const e=new Formatter;this.formatter=e;let i=this.options.y,r=0,s=[];const o=[];this.parts.forEach(l=>{i=i+l.stave.space(l.spaceAbove),l.stave.setY(i),e.joinVoices(l.voices),i=i+l.stave.space(l.spaceBelow),i=i+l.stave.space(this.options.spaceBetweenStaves),l.debugNoteMetrics&&(o.push({y:i,voice:l.voices[0]}),i+=15),s=s.concat(l.voices),r=Math.max(r,l.stave.getNoteStartX())}),this.parts.forEach(l=>l.stave.setNoteStartX(r));const a=this.options.width-(r-this.options.x)-Note.STAVEPADDING;e.format(s,a);for(let l=0;l{i.voice.getTickables().forEach(r=>Note.plotMetrics(e,r,i.y))})}}Vex.Flow=Flow;Vex.Flow.Element=Element$1;Vex.Flow.Fraction=Fraction;Vex.Flow.Renderer=Renderer;Vex.Flow.Formatter=Formatter;Vex.Flow.Music=Music;Vex.Flow.Glyph=Glyph;Vex.Flow.Stave=Stave;Vex.Flow.StaveNote=StaveNote;Vex.Flow.StaveModifier=StaveModifier;Vex.Flow.StaveTempo=StaveTempo;Vex.Flow.Voice=Voice$1;Vex.Flow.Accidental=Accidental;Vex.Flow.Beam=Beam$1;Vex.Flow.StaveTie=StaveTie;Vex.Flow.TabStave=TabStave;Vex.Flow.TabNote=TabNote$1;Vex.Flow.Bend=Bend;Vex.Flow.Vibrato=Vibrato;Vex.Flow.VibratoBracket=VibratoBracket;Vex.Flow.Note=Note;Vex.Flow.ModifierContext=ModifierContext;Vex.Flow.MultiMeasureRest=MultiMeasureRest;Vex.Flow.TickContext=TickContext;Vex.Flow.Articulation=Articulation$1;Vex.Flow.Annotation=Annotation;Vex.Flow.Barline=Barline;Vex.Flow.NoteHead=NoteHead;Vex.Flow.StaveConnector=StaveConnector;Vex.Flow.ClefNote=ClefNote;Vex.Flow.KeySignature=KeySignature;Vex.Flow.KeySigNote=KeySigNote;Vex.Flow.TimeSignature=TimeSignature;Vex.Flow.TimeSigNote=TimeSigNote;Vex.Flow.Stem=Stem;Vex.Flow.TabTie=TabTie;Vex.Flow.Clef=Clef;Vex.Flow.Dot=Dot;Vex.Flow.Modifier=Modifier;Vex.Flow.TabSlide=TabSlide;Vex.Flow.Tuplet=Tuplet$1;Vex.Flow.GraceNote=GraceNote;Vex.Flow.GraceTabNote=GraceTabNote;Vex.Flow.Tuning=Tuning;Vex.Flow.KeyManager=KeyManager;Vex.Flow.StaveHairpin=StaveHairpin;Vex.Flow.BoundingBox=BoundingBox;Vex.Flow.Stroke=Stroke;Vex.Flow.TextNote=TextNote;Vex.Flow.Curve=Curve;Vex.Flow.TextDynamics=TextDynamics;Vex.Flow.StaveLine=StaveLine;Vex.Flow.Ornament=Ornament;Vex.Flow.PedalMarking=PedalMarking;Vex.Flow.TextBracket=TextBracket;Vex.Flow.FretHandFinger=FretHandFinger;Vex.Flow.Repetition=Repetition$1;Vex.Flow.BarNote=BarNote;Vex.Flow.GhostNote=GhostNote;Vex.Flow.NoteSubGroup=NoteSubGroup$1;Vex.Flow.GraceNoteGroup=GraceNoteGroup;Vex.Flow.Tremolo=Tremolo;Vex.Flow.StringNumber=StringNumber;Vex.Flow.Crescendo=Crescendo;Vex.Flow.Volta=Volta;Vex.Flow.Font=Font;Vex.Flow.System=System;Vex.Flow.Factory=Factory;Vex.Flow.Parser=Parser;Vex.Flow.EasyScore=EasyScore;Vex.Flow.Registry=Registry;var SystemLinesEnum=(t=>(t[t.SingleThin=0]="SingleThin",t[t.DoubleThin=1]="DoubleThin",t[t.ThinBold=2]="ThinBold",t[t.BoldThinDots=3]="BoldThinDots",t[t.DotsThinBold=4]="DotsThinBold",t[t.DotsBoldBoldDots=5]="DotsBoldBoldDots",t[t.None=6]="None",t[t.Dotted=7]="Dotted",t[t.Dashed=8]="Dashed",t[t.Bold=9]="Bold",t[t.BoldThin=10]="BoldThin",t[t.DoubleBold=11]="DoubleBold",t[t.Tick=12]="Tick",t[t.Short=13]="Short",t))(SystemLinesEnum||{});class SystemLinesEnumHelper{static xmlBarlineStyleToSystemLinesEnum(e){return e==="regular"?0:e==="dotted"?7:e==="dashed"?8:e==="heavy"?9:e==="light-light"?1:e==="light-heavy"?2:e==="heavy-light"?10:e==="heavy-heavy"?11:e==="tick"?12:e==="short"?13:e==="none"?6:0}}class Matrix2D{constructor(){this.matrix=[];for(let e=0;e<2;e++){this.matrix[e]=[];for(let i=0;i<2;i++)this.matrix[e][i]=0}}static getRotationMatrix(e){const i=new Matrix2D,r=Math.cos(e),s=Math.sin(e);return i.matrix[0][0]=r,i.matrix[0][1]=-s,i.matrix[1][0]=s,i.matrix[1][1]=r,i}scalarMultiplication(e){for(let i=0;i<2;i++)for(let r=0;r<2;r++)this.matrix[i][r]*=e}getTransposeMatrix(){const e=new Matrix2D;for(let i=0;i<2;i++)for(let r=0;r<2;r++)e.matrix[i][r]=this.matrix[r][i];return e}vectorMultiplication(e){const i=new PointF2D;return i.x=e.x*this.matrix[0][0]+e.y*this.matrix[0][1],i.y=e.x*this.matrix[1][0]+e.y*this.matrix[1][1],i}}class MusicSheetErrors{constructor(){this.measureErrors={},this.errors=[],this.tempErrors=[]}finalizeMeasure(e){let i=this.measureErrors[e];i||(i=[]),this.measureErrors[e]=i.concat(this.tempErrors),this.tempErrors=[]}pushMeasureError(e){this.tempErrors.push(e)}push(e){this.errors.push(e)}}class Arpeggio{constructor(e,i=7){this.parentVoiceEntry=e,this.type=i,this.notes=[]}addNote(e){this.notes.push(e),e.Arpeggio=this}}var ArpeggioType=(t=>(t[t.BRUSH_DOWN=1]="BRUSH_DOWN",t[t.BRUSH_UP=2]="BRUSH_UP",t[t.ROLL_DOWN=3]="ROLL_DOWN",t[t.ROLL_UP=4]="ROLL_UP",t[t.RASQUEDO_DOWN=5]="RASQUEDO_DOWN",t[t.RASQUEDO_UP=6]="RASQUEDO_UP",t[t.ARPEGGIO_DIRECTIONLESS=7]="ARPEGGIO_DIRECTIONLESS",t))(ArpeggioType||{});class Beam{constructor(e=1,i=0){this.notes=[],this.extendedNoteList=[],this.BeamNumberOffsetToXML=0,this.BeamNumber=e,this.BeamNumberOffsetToXML=i}get Notes(){return this.notes}set Notes(e){this.notes=e}get ExtendedNoteList(){return this.extendedNoteList}set ExtendedNoteList(e){this.extendedNoteList=e}addNoteToBeam(e){e&&(e.NoteBeam=this,this.notes.push(e),this.extendedNoteList.push(e))}}class Voice{constructor(e,i){this.voiceEntries=[],this.volume=1,this.parent=e,this.visible=!0,this.audible=!0,this.following=!0,this.voiceId=i,this.uniqueVoiceId="I:"+this.parent.Id+" V: "+this.voiceId}get VoiceEntries(){return this.voiceEntries}get Parent(){return this.parent}get Visible(){return this.visible}set Visible(e){this.visible=e}get Audible(){return this.audible}set Audible(e){this.audible=e}get Following(){return this.following}set Following(e){this.following=e}get Solo(){return this.solo}set Solo(e){this.solo=e}get VoiceId(){return this.voiceId}get Volume(){return this.volume}set Volume(e){this.volume=e}toString(){return this.uniqueVoiceId}}class LinkedVoice extends Voice{constructor(e,i,r){super(e,i),this.master=r}get Master(){return this.master}}class Notehead{constructor(e,i,r=void 0){this.sourceNote=e,this.setShapeFromXml(i,r)}setShapeFromXml(e,i=void 0){this.shape=Notehead.ShapeTypeXmlToShape(e);let r=i;r===void 0&&(this.sourceNote?r=this.sourceNote.Length.Denominator>2:(loglevelExports.warn("notehead: sourceNote and filledXmlAttribute undefined."),r=!0)),this.filled=r}get SourceNote(){return this.sourceNote}get Shape(){return this.shape}get Filled(){return this.filled}static ShapeTypeXmlToShape(e){switch(e.toLowerCase()){case"normal":return 2;case"x":return 7;case"slash":return 4;case"diamond":return 1;case"square":return 5;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}}}var NoteHeadShape=(t=>(t[t.CIRCLEX=0]="CIRCLEX",t[t.DIAMOND=1]="DIAMOND",t[t.NORMAL=2]="NORMAL",t[t.RECTANGLE=3]="RECTANGLE",t[t.SLASH=4]="SLASH",t[t.SQUARE=5]="SQUARE",t[t.TRIANGLE=6]="TRIANGLE",t[t.X=7]="X",t))(NoteHeadShape||{});class ITextTranslation{static translateText(e,i){if(!this.defaultTextTranslation)return i}}var NoteType=(t=>(t[t.UNDEFINED=0]="UNDEFINED",t[t._1024th=1]="_1024th",t[t._512th=2]="_512th",t[t._256th=3]="_256th",t[t._128th=4]="_128th",t[t._64th=5]="_64th",t[t._32nd=6]="_32nd",t[t._16th=7]="_16th",t[t.EIGTH=8]="EIGTH",t[t.QUARTER=9]="QUARTER",t[t.HALF=10]="HALF",t[t.WHOLE=11]="WHOLE",t[t.BREVE=12]="BREVE",t[t.LONG=13]="LONG",t[t.MAXIMA=14]="MAXIMA",t))(NoteType||{});class NoteTypeHandler{static NoteTypeToString(e){return this.NoteTypeXmlValues[e]}static StringToNoteType(e){const i=this.NoteTypeXmlValues.indexOf(e);return i!==-1?i:0}static getNoteDurationFromType(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:{const i=ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid note duration.");throw new MusicSheetReadingException(i)}}}}NoteTypeHandler.NoteTypeXmlValues=["","1024th","512th","256th","128th","64th","32nd","16th","eigth","quarter","half","whole","breve","long","maxima"];class OrnamentContainer{constructor(e){this.placement=PlacementEnum.Above,this.accidentalAbove=AccidentalEnum.NONE,this.accidentalBelow=AccidentalEnum.NONE,this.ornament=e}get GetOrnament(){return this.ornament}get AccidentalAbove(){return this.accidentalAbove}set AccidentalAbove(e){this.accidentalAbove=e}get AccidentalBelow(){return this.accidentalBelow}set AccidentalBelow(e){this.accidentalBelow=e}}var OrnamentEnum=(t=>(t[t.Trill=0]="Trill",t[t.Turn=1]="Turn",t[t.InvertedTurn=2]="InvertedTurn",t[t.DelayedTurn=3]="DelayedTurn",t[t.DelayedInvertedTurn=4]="DelayedInvertedTurn",t[t.Mordent=5]="Mordent",t[t.InvertedMordent=6]="InvertedMordent",t))(OrnamentEnum||{});class VerticalSourceStaffEntryContainer{constructor(e,i,r){this.staffEntries=[],this.comments=[],this.timestamp=i,this.staffEntries=new Array(r),this.parentMeasure=e}$get$(e){return this.staffEntries[e]}$set$(e,i){this.staffEntries[e]=i}get Timestamp(){return this.timestamp}set Timestamp(e){this.timestamp=e}get StaffEntries(){return this.staffEntries}set StaffEntries(e){this.staffEntries=e}get Comments(){return this.comments}set Comments(e){this.comments=e}get ParentMeasure(){return this.parentMeasure}set ParentMeasure(e){this.parentMeasure=e}getAbsoluteTimestamp(){return Fraction$1.plus(this.timestamp,this.parentMeasure.AbsoluteTimestamp)}}class SourceStaffEntry{constructor(e,i){this.voiceEntries=[],this.instructions=[],this.chordSymbolContainers=[],this.verticalContainerParent=e,this.parentStaff=i}get ParentStaff(){return this.parentStaff}get VerticalContainerParent(){return this.verticalContainerParent}get Timestamp(){if(this.VerticalContainerParent)return this.VerticalContainerParent.Timestamp}get AbsoluteTimestamp(){if(this.VerticalContainerParent)return Fraction$1.plus(this.VerticalContainerParent.ParentMeasure.AbsoluteTimestamp,this.VerticalContainerParent.Timestamp)}get VoiceEntries(){return this.voiceEntries}set VoiceEntries(e){this.voiceEntries=e}get Link(){return this.staffEntryLink}set Link(e){this.staffEntryLink=e}get Instructions(){return this.instructions}set Instructions(e){this.instructions=e}get ChordContainers(){return this.chordSymbolContainers}set ChordContainers(e){this.chordSymbolContainers=e}removeAllInstructionsOfTypeClefInstruction(){let e=0,i=0;for(;e0)return!0;return!1}hasTie(){for(let e=0,i=this.VoiceEntries.length;ei.parentRepetition.StartIndex)return-1}if(e.alignment===0&&i.alignment===0){if(e.parentRepetition.EndIndexi.parentRepetition.EndIndex)return-1}}return 0}}class RepetitionInstruction{constructor(e,i,r=1,s=void 0,o=void 0){this.endingIndices=void 0,this.measureIndex=e,o&&(this.endingIndices=o.slice()),this.type=i,this.alignment=r,this.parentRepetition=s}CompareTo(e){const i=e;if(this.measureIndex>i.measureIndex)return 1;if(this.measureIndex(t[t.StartLine=0]="StartLine",t[t.ForwardJump=1]="ForwardJump",t[t.BackJumpLine=2]="BackJumpLine",t[t.Ending=3]="Ending",t[t.DaCapo=4]="DaCapo",t[t.DalSegno=5]="DalSegno",t[t.Fine=6]="Fine",t[t.ToCoda=7]="ToCoda",t[t.DalSegnoAlFine=8]="DalSegnoAlFine",t[t.DaCapoAlFine=9]="DaCapoAlFine",t[t.DalSegnoAlCoda=10]="DalSegnoAlCoda",t[t.DaCapoAlCoda=11]="DaCapoAlCoda",t[t.Coda=12]="Coda",t[t.Segno=13]="Segno",t[t.None=14]="None",t))(RepetitionInstructionEnum||{}),AlignmentType=(t=>(t[t.Begin=0]="Begin",t[t.End=1]="End",t))(AlignmentType||{});let prevSourceMeasure=null;class SourceMeasure{constructor(e,i){this.printNewSystemXml=!1,this.printNewPageXml=!1,this.IsSystemStartMeasure=!1,this.hasLyrics=!1,this.hasMoodExpressions=!1,this.allRests=!1,this.isReducedToMultiRest=!1,this.multipleRestMeasureNumber=0,this.staffLinkedExpressions=[],this.tempoExpressions=[],this.verticalSourceStaffEntryContainers=[],this.graphicalMeasureErrors=[],this.firstRepetitionInstructions=[],this.lastRepetitionInstructions=[],this.metronomeNoteIndex=0,this.completeNumberOfStaves=e,this.implicitMeasure=!1,this.hasEndLine=!1,this.endingBarStyleXml="",this.endingBarStyleEnum=SystemLinesEnum.SingleThin,this.firstInstructionsStaffEntries=new Array(e),this.lastInstructionsStaffEntries=new Array(e),this.rules=i,this.TempoInBPM=0;for(let r=0;r1)return e[this.measureListIndex-1]}get Rules(){return this.rules}get VerticalMeasureList(){return this.verticalMeasureList}set VerticalMeasureList(e){this.verticalMeasureList=e}get TempoInBPM(){return this.tempoInBPM}set TempoInBPM(e){this.tempoInBPM=e}findOrCreateStaffEntry(e,i,r){let s,o;for(const l of this.verticalSourceStaffEntryContainers)if(l.Timestamp.Equals(e)){o=l;break}if(o)return o.StaffEntries[i]?s=o.StaffEntries[i]:(s=new SourceStaffEntry(o,r),o.StaffEntries[i]=s),{createdNewContainer:!1,staffEntry:s};const a=this.verticalSourceStaffEntryContainers[this.verticalSourceStaffEntryContainers.length-1];if(this.verticalSourceStaffEntryContainers.length===0||a.Timestamp.lt(e)){const l=new VerticalSourceStaffEntryContainer(this,e.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.push(l),s=new SourceStaffEntry(l,r),l.StaffEntries[i]=s}else for(let l=this.verticalSourceStaffEntryContainers.length-1;l>=0;l--){if(this.verticalSourceStaffEntryContainers[l].Timestamp.lt(e)){const c=new VerticalSourceStaffEntryContainer(this,e.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(l+1,0,c),s=new SourceStaffEntry(c,r),c.StaffEntries[i]=s;break}if(l===0){const c=new VerticalSourceStaffEntryContainer(this,e.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(l,0,c),s=new SourceStaffEntry(c,r),c.StaffEntries[i]=s;break}}return{createdNewContainer:!0,staffEntry:s}}findOrCreateVoiceEntry(e,i){let r,s=!1;for(const o of e.VoiceEntries)if(o.ParentVoice===i){r=o;break}return r||(r=new VoiceEntry(e.Timestamp,i,e),s=!0),{createdVoiceEntry:s,voiceEntry:r}}getPreviousSourceStaffEntryFromIndex(e,i){for(let r=i-1;r>=0;r--)if(this.verticalSourceStaffEntryContainers[r][e])return this.verticalSourceStaffEntryContainers[r][e]}getVerticalContainerIndexByTimestamp(e){for(let i=0,r=this.VerticalSourceStaffEntryContainers.length;i=0;d--){const g=this.verticalSourceStaffEntryContainers[d][l+c];if(g!==void 0&&g.hasTie()&&a.lt(Fraction$1.plus(g.Timestamp,g.calculateMaxNoteLength()))){a=Fraction$1.plus(g.Timestamp,g.calculateMaxNoteLength());break}}}}s.push(a)}for(let o=0,a=s.length;o0)return!0}return!1}beginsWithLineRepetition(){for(let e=0,i=this.FirstRepetitionInstructions.length;e=0&&(i=this.verticalSourceStaffEntryContainers[r].StaffEntries[e],!i);r--);return i}canBeReducedToMultiRest(){var r,s,o,a,l,c;let e=!0,i=!1;for(const u of this.verticalSourceStaffEntryContainers)if(u){for(const m of u.StaffEntries)if(!(!m||!m.ParentStaff.ParentInstrument.Visible)){if(m.ChordContainers.length>0||(m.ParentStaff.hasLyrics&&(i=!0),this.firstRepetitionInstructions.length>0||this.lastRepetitionInstructions.length>0))return!1;for(const d of m.VoiceEntries){for(const g of d.Notes)if(!g.isRest()){e=!1;break}if(!e)break}}}if(!e||i||this.hasMoodExpressions||this.tempoExpressions.length>0)return!1;for(const u of this.staffLinkedExpressions)if(u.length>0)return!1;for(const u of this.lastInstructionsStaffEntries)for(let m=0,d=u==null?void 0:u.Instructions.length;m=0;i--)for(let r=0;r(t[t.Fingering=0]="Fingering",t[t.String=1]="String",t))(TechnicalInstructionType||{});class TechnicalInstruction{}class PlaybackNote{constructor(e,i){this.parentEntry=e,this.parentNote=i,this.ParentNote.PlaybackNote=this,this.Length=this.ParentNote.Length,i.Pitch!==void 0?this.ParentNote.ParentStaff.ParentInstrument.MidiInstrumentId===MidiInstrument.Percussion?this.MidiKey=PlaybackNote.noteToMidiDrumKey(i):this.MidiKey=i.Pitch.getHalfTone()+12:this.MidiKey=0}setLength(){this.ParentNote.NoteTie!==void 0&&this.ParentNote.NoteTie.StartNote===this.ParentNote&&(this.Length=this.ParentNote.NoteTie.Duration)}get ParentEntry(){return this.parentEntry}get ParentNote(){return this.parentNote}static noteToMidiDrumKey(e){var s;const i=e.Pitch.getHalfTone()-12,r=(s=e.Notehead)==null?void 0:s.Shape;switch(e.Pitch.Octave){case 1:switch(e.Pitch.FundamentalNote){case NoteEnum.D:switch(r){default:return 44}case NoteEnum.E:switch(r){default:return 35}case NoteEnum.F:switch(r){default:return 36}case NoteEnum.G:switch(r){default:return 41}case NoteEnum.A:switch(r){default:return 43}case NoteEnum.B:switch(r){case NoteHeadShape.TRIANGLE:return 54;default:return 47}default:return i}case 2:switch(e.Pitch.FundamentalNote){case NoteEnum.C:switch(r){case NoteHeadShape.X:return 37;default:return 38}case NoteEnum.D:switch(r){case NoteHeadShape.X:return 59;default:return 48}case NoteEnum.E:switch(r){case NoteHeadShape.X:return 42;case NoteHeadShape.CIRCLEX:return 46;case NoteHeadShape.TRIANGLE:return 56;default:return 50}case NoteEnum.F:switch(r){case NoteHeadShape.DIAMOND:return 53;default:return 51}case NoteEnum.G:switch(r){case NoteHeadShape.CIRCLEX:case NoteHeadShape.DIAMOND:return 46;default:return 42}case NoteEnum.A:switch(r){default:return 49}case NoteEnum.B:switch(r){default:return 57}default:return i}case 3:switch(e.Pitch.FundamentalNote){case NoteEnum.C:switch(r){case NoteHeadShape.CIRCLEX:return 52;default:return 55}default:return i}default:return i}}}class PlaybackEntry{constructor(e){this.notes=[],this.TimestampShift=new Fraction$1,this.parentVoiceEntry=e;for(const i of e.Notes)this.Notes.push(new PlaybackNote(this,i))}get ParentVoiceEntry(){return this.parentVoiceEntry}get Notes(){return this.notes}get Length(){if(this.Notes.length>0)return this.Notes[0].Length}set Length(e){for(const i of this.Notes)i.Length=e}get HasNotes(){return this.Notes.length>0}}class VoiceEntry{constructor(e,i,r,s=!0,o=!1,a=!1,l=!1){if(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=e,this.parentVoice=i,this.parentSourceStaffEntry=r,this.isGrace=o,this.graceAfterMainNote=!1,this.graceNoteSlash=a,this.graceSlur=l,o||i.VoiceEntries.push(this),s&&r!==void 0){const c=r.VoiceEntries;c.indexOf(this)===-1&&c.push(this)}this.mainPlaybackEntry=new PlaybackEntry(this),this.PlaybackEntries.push(this.mainPlaybackEntry)}get ParentSourceStaffEntry(){return this.parentSourceStaffEntry}get ParentVoice(){return this.parentVoice}get Timestamp(){return this.timestamp}set Timestamp(e){this.timestamp=e}get Notes(){return this.notes}addNote(e){this.notes.push(e),!e.isRest()&&(e.NoteTie===void 0||e.NoteTie.StartNote===e)&&this.MainPlaybackEntry.Notes.push(new PlaybackNote(this.MainPlaybackEntry,e))}get GraceVoiceEntriesBefore(){return this.graceVoiceEntriesBefore}set GraceVoiceEntriesBefore(e){this.graceVoiceEntriesBefore=e;for(const i of this.graceVoiceEntriesBefore)i.parentSourceStaffEntry=this.ParentSourceStaffEntry}get GraceVoiceEntriesAfter(){return this.graceVoiceEntriesAfter}set GraceVoiceEntriesAfter(e){this.graceVoiceEntriesAfter=e;for(const i of this.graceVoiceEntriesAfter)i.parentSourceStaffEntry=this.ParentSourceStaffEntry}get IsGrace(){return this.isGrace}set IsGrace(e){this.isGrace=e}get GraceAfterMainNote(){return this.graceAfterMainNote}set GraceAfterMainNote(e){this.graceAfterMainNote=e}get GraceNoteSlash(){return this.graceNoteSlash}set GraceNoteSlash(e){this.graceNoteSlash=e}get GraceSlur(){return this.graceSlur}set GraceSlur(e){this.graceSlur=e}get Articulations(){return this.articulations}get PlaybackEntries(){return this.playbackEntries}get Fermata(){return this.fermata}get MainPlaybackEntry(){return this.mainPlaybackEntry}set MainPlaybackEntry(e){this.mainPlaybackEntry=e}removeMainPlaybackEntry(){this.mainPlaybackEntry!==void 0&&this.removePlaybackEntry(this.mainPlaybackEntry)}removePlaybackEntry(e){this.mainPlaybackEntry===e&&(this.mainPlaybackEntry=void 0);const i=this.playbackEntries.indexOf(e);i>-1&&this.playbackEntries.splice(i,1)}get TechnicalInstructions(){return this.technicalInstructions}get LyricsEntries(){return this.lyricsEntries}get Arpeggio(){return this.arpeggio}set Arpeggio(e){this.arpeggio=e}get OrnamentContainer(){return this.ornamentContainer}set OrnamentContainer(e){this.ornamentContainer=e}set WantedStemDirection(e){this.wantedStemDirection=e}get WantedStemDirection(){return this.wantedStemDirection}set StemDirectionXml(e){this.stemDirectionXml=e}get StemDirectionXml(){return this.stemDirectionXml}set StemDirection(e){this.stemDirection=e}get StemDirection(){return this.stemDirection}get StemColorXml(){return this.stemColorXml}set StemColorXml(e){this.stemColorXml=e}get StemColor(){return this.stemColor}set StemColor(e){this.stemColor=e}get VolumeModifier(){return this.volumeModifier}set VolumeModifier(e){this.volumeModifier=e}get DurationModifier(){return this.durationModifier}set DurationModifier(e){this.durationModifier=e}hasArticulation(e){for(const i of this.articulations)if(i.Equals(e))return!0;return!1}static isSupportedArticulation(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}}hasTie(){for(let e=0,i=this.Notes.length;e0)return!0;return!1}isStaccato(){for(const e of this.Articulations)if(e.articulationEnum===5)return!0;return!1}isAccent(){for(const e of this.Articulations)if(e.articulationEnum===0||e.articulationEnum===1)return!0;return!1}getVerseNumberForLyricEntry(e){let i=1;return this.lyricsEntries.forEach((r,s)=>{e===s&&(i=r)}),i}}var ArticulationEnum=(t=>(t[t.accent=0]="accent",t[t.strongaccent=1]="strongaccent",t[t.marcatoup=2]="marcatoup",t[t.marcatodown=3]="marcatodown",t[t.invertedstrongaccent=4]="invertedstrongaccent",t[t.staccato=5]="staccato",t[t.staccatissimo=6]="staccatissimo",t[t.spiccato=7]="spiccato",t[t.tenuto=8]="tenuto",t[t.fermata=9]="fermata",t[t.invertedfermata=10]="invertedfermata",t[t.breathmark=11]="breathmark",t[t.caesura=12]="caesura",t[t.lefthandpizzicato=13]="lefthandpizzicato",t[t.naturalharmonic=14]="naturalharmonic",t[t.snappizzicato=15]="snappizzicato",t[t.upbow=16]="upbow",t[t.downbow=17]="downbow",t[t.scoop=18]="scoop",t[t.plop=19]="plop",t[t.doit=20]="doit",t[t.falloff=21]="falloff",t[t.stress=22]="stress",t[t.unstress=23]="unstress",t[t.detachedlegato=24]="detachedlegato",t[t.otherarticulation=25]="otherarticulation",t[t.bend=26]="bend",t))(ArticulationEnum||{}),StemDirectionType=(t=>(t[t.Undefined=-1]="Undefined",t[t.Up=0]="Up",t[t.Down=1]="Down",t[t.None=2]="None",t[t.Double=3]="Double",t))(StemDirectionType||{}),SystemLinePosition=(t=>(t[t.MeasureBegin=0]="MeasureBegin",t[t.MeasureEnd=1]="MeasureEnd",t))(SystemLinePosition||{});class GraphicalLabel extends Clickable{constructor(e,i,r,s,o=void 0){super(),this.label=e,this.boundingBox=new BoundingBox$1(this,o),this.label.fontHeight=i,this.label.textAlignment=r,this.rules=s,this.rules.MpatMode&&this.label.text==="TRIO"&&(this.label.fontFamily="Arial")}get Label(){return this.label}toString(){return`${this.label.text} (${this.boundingBox.RelativePosition.x},${this.boundingBox.RelativePosition.y})`}setLabelPositionAndShapeBorders(){var l,c;if(this.Label.text.trim()==="")return;this.TextLines=[];const e=(c=(l=this.rules)==null?void 0:l.LabelMarginBorderFactor)!=null?c:.1,i=this.Label.text.split(/[\n\r]+/g),r=i.length;let s=0;for(let u=0;u0&&this.TextLines.length>1&&(o+=this.rules.SpacingBetweenTextLines*r/10);const a=this.PositionAndShape;switch(this.Label.textAlignment){case TextAlignmentEnum.CenterBottom:a.BorderTop=-o,a.BorderLeft=-s/2,a.BorderBottom=0,a.BorderRight=s/2;break;case TextAlignmentEnum.CenterCenter:a.BorderTop=-o/2,a.BorderLeft=-s/2,a.BorderBottom=o/2,a.BorderRight=s/2;break;case TextAlignmentEnum.CenterTop:a.BorderTop=0,a.BorderLeft=-s/2,a.BorderBottom=o,a.BorderRight=s/2;break;case TextAlignmentEnum.LeftBottom:a.BorderTop=-o,a.BorderLeft=0,a.BorderBottom=0,a.BorderRight=s;break;case TextAlignmentEnum.LeftCenter:a.BorderTop=-o/2,a.BorderLeft=0,a.BorderBottom=o/2,a.BorderRight=s;break;case TextAlignmentEnum.LeftTop:a.BorderTop=0,a.BorderLeft=0,a.BorderBottom=o,a.BorderRight=s;break;case TextAlignmentEnum.RightBottom:a.BorderTop=-o,a.BorderLeft=-s,a.BorderBottom=0,a.BorderRight=0;break;case TextAlignmentEnum.RightCenter:a.BorderTop=-o/2,a.BorderLeft=-s,a.BorderBottom=o/2,a.BorderRight=0;break;case TextAlignmentEnum.RightTop:a.BorderTop=0,a.BorderLeft=-s,a.BorderBottom=o,a.BorderRight=0;break}a.BorderMarginTop=a.BorderTop-o*e,a.BorderMarginLeft=a.BorderLeft-o*e,a.BorderMarginBottom=a.BorderBottom+o*e,a.BorderMarginRight=a.BorderRight+o*e}}class Label{constructor(e="",i=TextAlignmentEnum.CenterBottom,r=void 0,s=!0){this.IsCreditLabel=!1,this.text=e,this.print=s,this.textAlignment=i,this.font=r,this.fontFamily=void 0}set font(e){this.fontEnumValue=e,this.fontFamily=FontStringNames[e]}get font(){return this.fontEnumValue}ToString(){return this.text}}const 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(t){return t.indexOf(SpeedKeyword)===0}function isSpeedHiddenKeyword(t){return t.indexOf(SpeedHiddenKeyword)===0}function formatSpeedKeyword(t){return t.replace(SpeedHiddenKeyword,"").replace(SpeedKeyword,"")}function isGradientWords(t){return GradientWords.includes(t)}function isSpecialMark(t){return[...Object.keys(SpeedTag),...SpecialMarks,...SpecialWords,...HideWords].map(e=>e.trim().toLocaleUpperCase()).includes(t.toLocaleUpperCase().trim())}function isTopFont(t){return[TextAlignmentEnum.CenterTop,TextAlignmentEnum.RightTop].includes(t)}var MusicSymbol=(t=>(t[t.Unused_first_Symbol=0]="Unused_first_Symbol",t[t.BLACK_HEAD=1]="BLACK_HEAD",t[t.UPWARDS_TAIL=2]="UPWARDS_TAIL",t[t.DOWNWARDS_TAIL=3]="DOWNWARDS_TAIL",t[t.UPWARDS_DOUBLE_TAIL=4]="UPWARDS_DOUBLE_TAIL",t[t.DOWNWARDS_DOUBLE_TAIL=5]="DOWNWARDS_DOUBLE_TAIL",t[t.UPWARDS_TRIPLE_TAIL=6]="UPWARDS_TRIPLE_TAIL",t[t.DOWNWARDS_TRIPLE_TAIL=7]="DOWNWARDS_TRIPLE_TAIL",t[t.UPWARDS_QUAD_TAIL=8]="UPWARDS_QUAD_TAIL",t[t.DOWNWARDS_QUAD_TAIL=9]="DOWNWARDS_QUAD_TAIL",t[t.ROUND_HEAD=10]="ROUND_HEAD",t[t.WHITE_HEAD=11]="WHITE_HEAD",t[t.G_CLEF=12]="G_CLEF",t[t.F_CLEF=13]="F_CLEF",t[t.C_CLEF=14]="C_CLEF",t[t.BREVE=15]="BREVE",t[t.BREVE_REST=16]="BREVE_REST",t[t.COMMON_TIME=17]="COMMON_TIME",t[t.CUT_TIME=18]="CUT_TIME",t[t.WHOLE_REST=19]="WHOLE_REST",t[t.HALF_REST=20]="HALF_REST",t[t.QUARTER_REST=21]="QUARTER_REST",t[t.EIGHTH_REST=22]="EIGHTH_REST",t[t.SIXTEENTH_REST=23]="SIXTEENTH_REST",t[t.THIRTYSECOND_REST=24]="THIRTYSECOND_REST",t[t.SIXTYFOURTH_REST=25]="SIXTYFOURTH_REST",t[t.FLAT=26]="FLAT",t[t.SHARP=27]="SHARP",t[t.NATURAL=28]="NATURAL",t[t.DOUBLE_FLAT=29]="DOUBLE_FLAT",t[t.DOUBLE_SHARP=30]="DOUBLE_SHARP",t[t.ZERO=31]="ZERO",t[t.ONE=32]="ONE",t[t.TWO=33]="TWO",t[t.THREE=34]="THREE",t[t.FOUR=35]="FOUR",t[t.FIVE=36]="FIVE",t[t.SIX=37]="SIX",t[t.SEVEN=38]="SEVEN",t[t.EIGHT=39]="EIGHT",t[t.NINE=40]="NINE",t[t.DOT=41]="DOT",t[t.FERMATA=42]="FERMATA",t[t.INVERTED_FERMATA=43]="INVERTED_FERMATA",t[t.SPICCATO=44]="SPICCATO",t[t.TENUTO=45]="TENUTO",t[t.MARCATO=46]="MARCATO",t[t.MARCATISSIMO=47]="MARCATISSIMO",t[t.INVERTED_MARCATISSIMO=48]="INVERTED_MARCATISSIMO",t[t.P=49]="P",t[t.F=50]="F",t[t.S=51]="S",t[t.Z=52]="Z",t[t.M=53]="M",t[t.R=54]="R",t[t.SEGNO=55]="SEGNO",t[t.CODA=56]="CODA",t[t.DRUM_CLEF=57]="DRUM_CLEF",t[t.G_CLEF_SUB8=58]="G_CLEF_SUB8",t[t.G_CLEF_SUPER8=59]="G_CLEF_SUPER8",t[t.G_CLEF_SUB15=60]="G_CLEF_SUB15",t[t.G_CLEF_SUPER15=61]="G_CLEF_SUPER15",t[t.F_CLEF_SUB8=62]="F_CLEF_SUB8",t[t.F_CLEF_SUPER8=63]="F_CLEF_SUPER8",t[t.F_CLEF_SUB15=64]="F_CLEF_SUB15",t[t.F_CLEF_SUPER15=65]="F_CLEF_SUPER15",t[t.DOWN_BOW=66]="DOWN_BOW",t[t.MORDENT=67]="MORDENT",t[t.INVERTED_MORDENT=68]="INVERTED_MORDENT",t[t.TURN=69]="TURN",t[t.INVERTED_TURN=70]="INVERTED_TURN",t[t.LEFTHAND_PIZZICATO=71]="LEFTHAND_PIZZICATO",t[t.RELEASE_PED=72]="RELEASE_PED",t[t.ENGAGE_PED=73]="ENGAGE_PED",t[t.VA8=74]="VA8",t[t.VB8=75]="VB8",t[t.TRILL=76]="TRILL",t[t.MA15=77]="MA15",t[t.MB15=78]="MB15",t[t.HIGH=79]="HIGH",t[t.PLAY=80]="PLAY",t[t.MIC=81]="MIC",t[t.SNAP_PIZZICATO=82]="SNAP_PIZZICATO",t[t.NATURAL_HARMONIC=83]="NATURAL_HARMONIC",t[t.EditPen=84]="EditPen",t[t.PEDAL_BRACKET=85]="PEDAL_BRACKET",t[t.PEDAL_MIXED=86]="PEDAL_MIXED",t[t.PEDAL_SYMBOL=87]="PEDAL_SYMBOL",t))(MusicSymbol||{}),MusicSymbolDrawingStyle=(t=>(t[t.Normal=0]="Normal",t[t.Disabled=1]="Disabled",t[t.Selected=2]="Selected",t[t.Clickable=3]="Clickable",t[t.PlaybackSymbols=4]="PlaybackSymbols",t[t.FollowSymbols=5]="FollowSymbols",t[t.QFeedbackNotFound=6]="QFeedbackNotFound",t[t.QFeedbackOk=7]="QFeedbackOk",t[t.QFeedbackPerfect=8]="QFeedbackPerfect",t[t.Debug1=9]="Debug1",t[t.Debug2=10]="Debug2",t[t.Debug3=11]="Debug3",t))(MusicSymbolDrawingStyle||{}),PhonicScoreModes=(t=>(t[t.Following=0]="Following",t[t.Midi=1]="Midi",t[t.Manual=2]="Manual",t))(PhonicScoreModes||{});class LabelRenderSpecs{}class MusicSheetDrawer{constructor(e,i){this.drawableBoundingBoxElement="None",this.skyLineVisible=!1,this.bottomLineVisible=!1,this.phonicScoreMode=PhonicScoreModes.Manual,this.textMeasurer=e,this.splitScreenLineColor=-1,this.drawingParameters=i,this.rules=i.Rules}set Mode(e){this.phonicScoreMode=e}drawSheet(e){if(this.graphicalMusicSheet=e,this.rules=e.ParentMusicSheet.Rules,this.drawSplitScreenLine(),this.drawingParameters.drawCursors)for(const r of e.Cursors){if(!r)continue;const s=new BoundingBox$1(r);s.AbsolutePosition=r.Start,s.BorderBottom=r.End.y-r.Start.y,s.BorderRight=r.Width/2,s.BorderLeft=-r.Width/2,this.isVisible(s)&&this.drawLineAsVerticalRectangle(r,GraphicalLayers.Cursor)}this.drawingParameters.drawScrollIndicator&&this.drawScrollIndicator();const i=Math.min(this.graphicalMusicSheet.MusicPages.length,this.rules.MaxPageToDrawNumber);for(let r=0;rU[0]).filter(Boolean))||[],F=[];let Z=!1;for(let U=0;UU.x-J.x))==null?void 0:T[0])==null?void 0:M.measure;break}}}catch(O){console.log("🚀 ~ error",O)}let R=0;z?R=((C=z.stave)==null?void 0:C.end_x)||0:R=((I=r.sourceNote.SourceMeasure.VerticalMeasureList[0])==null?void 0:I.getVFStave()).end_x;const H=0;o.ScreenPosition.x=R,o.ScreenPosition.y=$===0?(e.PositionAndShape.Parent.AbsolutePosition.y-3-H)*10:$*10}const c=["C","G","D","A","E","B","F#","C#","G#","F","Bb","Eb","Ab","Db","Gb","Cb","Fb","D#","A#","E#"];c.includes(s.text)&&(o.ScreenPosition.y=(e.PositionAndShape.Parent.AbsolutePosition.y+e.PositionAndShape.Parent.BorderTop+e.PositionAndShape.Parent.BorderMarginTop)*10),["play","listen"].includes(s.text.toLocaleLowerCase())&&s.textAlignment===TextAlignmentEnum.LeftBottom&&(o.ScreenPosition.y=(e.PositionAndShape.Parent.AbsolutePosition.y-1+e.PositionAndShape.Parent.BorderBottom)*10);const u=["ffp","p-f","sfzp","szf","sffzp"];for(let $=0;$0&&(isTopFont(e.Label.textAlignment)||[TextAlignmentEnum.CenterBottom].includes(e.Label.textAlignment))){let $=-1,N=!1;for(const z of(l==null?void 0:l.AbstractExpressions)||[])if(z.Label===e?$=(D=z==null?void 0:z.parentMeasure)==null?void 0:D.measureListIndex:(G=z.expression)!=null&&G.TempoInBpm&&(N=z.expression.TempoInBpm>0),N&&$>-1){o.ScreenPosition.y-=4*10;break}}this.rules.DYMusicScoreType==="jianpu"?isNaN(parseInt(e.Label.text,10))&&this.renderLabel(e,i,o):this.renderLabel(e,i,o)}calculateLabel(e){const i=new LabelRenderSpecs,r=e.Label,s=new BoundingBox$1(this);s.AbsolutePosition.x=e.PositionAndShape.AbsolutePosition.x,s.AbsolutePosition.y=e.PositionAndShape.AbsolutePosition.y||e.PositionAndShape.Parent.AbsolutePosition.y,i.ScreenPosition=this.applyScreenTransformation(s.AbsolutePosition),i.FontHeightInPixel=this.calculatePixelDistance(r.fontHeight);const o=this.calculatePixelDistance(e.PositionAndShape.Size.width);switch(i.BitmapWidth=Math.ceil(o),i.BitmapHeight=e.TextLines?Math.ceil(i.FontHeightInPixel*(.2+e.TextLines.length)):10,r.textAlignment){case TextAlignmentEnum.LeftTop:i.ScreenPosition.x-=i.BitmapWidth/2,i.ScreenPosition.y+=i.BitmapHeight*1.5;break;case TextAlignmentEnum.LeftCenter:i.ScreenPosition.y-=i.BitmapHeight/2;break;case TextAlignmentEnum.LeftBottom:i.ScreenPosition.y-=i.BitmapHeight;break;case TextAlignmentEnum.CenterTop:i.ScreenPosition.x-=i.BitmapWidth/2;break;case TextAlignmentEnum.CenterCenter:i.ScreenPosition.x-=i.BitmapWidth/2,i.ScreenPosition.y-=i.BitmapHeight/2;break;case TextAlignmentEnum.CenterBottom:i.ScreenPosition.x-=i.BitmapWidth/2,i.ScreenPosition.y-=i.BitmapHeight;break;case TextAlignmentEnum.RightTop:i.ScreenPosition.x-=i.BitmapWidth;break;case TextAlignmentEnum.RightCenter:i.ScreenPosition.x-=i.BitmapWidth,i.ScreenPosition.y-=i.BitmapHeight/2;break;case TextAlignmentEnum.RightBottom:i.ScreenPosition.x-=i.BitmapWidth,i.ScreenPosition.y-=i.BitmapHeight;break;default:throw new ArgumentOutOfRangeException("")}return i}applyScreenTransformations(e){const i=[];for(const r of e)i.push(this.applyScreenTransformation(r));return i}drawSplitScreenLine(){}renderRectangle(e,i,r,s=void 0,o=1){throw new Error("not implemented")}drawScrollIndicator(){}drawSelectionStartSymbol(e){}drawSelectionEndSymbol(e){}renderLabel(e,i,r){throw new Error("not implemented")}renderSystemToScreen(e,i,r){}drawSkyLine(e){}drawBottomLine(e){}drawInstrumentBrace(e,i){}drawGroupBracket(e,i){}isVisible(e){return!0}drawMusicSystem(e){const i=this.getSystemAbsBoundingRect(e),r=this.getSytemBoundingBoxInPixels(i);this.drawMusicSystemComponents(e,r,i)}getSytemBoundingBoxInPixels(e){const i=this.applyScreenTransformationForRect(e);return i.x=Math.round(i.x),i.y=Math.round(i.y),i}getSystemAbsBoundingRect(e){const i=e.PositionAndShape.BoundingRectangle;return new RectangleF2D(e.PositionAndShape.AbsolutePosition.x+e.PositionAndShape.BorderLeft-1,e.PositionAndShape.AbsolutePosition.y+e.PositionAndShape.BorderTop-1,i.width+6,i.height+2)}drawMusicSystemComponents(e,i,r){const s=this.graphicalMusicSheet.SelectionStartSymbol,o=this.graphicalMusicSheet.SelectionEndSymbol;this.drawingParameters.drawSelectionStartSymbol&&s!==void 0&&this.isVisible(s.PositionAndShape)&&this.drawSelectionStartSymbol(s),this.drawingParameters.drawSelectionEndSymbol&&o!==void 0&&this.isVisible(o.PositionAndShape)&&this.drawSelectionEndSymbol(o);for(const c of e.StaffLines)this.drawStaffLine(c),this.rules.RenderLyrics&&(c.LyricsDashes.length>0&&this.drawDashes(c.LyricsDashes),c.LyricLines.length>0&&this.drawLyricLines(c.LyricLines,c));for(const c of e.SystemLines)this.drawSystemLineObject(c);if(e.Parent===e.Parent.Parent.MusicPages[0])for(const c of e.Labels)c.SVGNode=this.drawLabel(c,GraphicalLayers.Notes);const a=this.graphicalMusicSheet.ParentMusicSheet.Instruments,l=a.filter(c=>c.Visible).length;for(const c of e.InstrumentBrackets)this.drawInstrumentBrace(c,e);if(a.length>0)if(l>1)for(const c of e.GroupBrackets)this.drawGroupBracket(c,e);else for(const c of e.GroupBrackets)c.Visible=!1;if(!this.leadSheet)for(const c of e.MeasureNumberLabels)c.SVGNode=this.drawLabel(c,GraphicalLayers.Notes);for(const c of e.StaffLines)this.drawStaffLineSymbols(c);this.drawingParameters.drawMarkedAreas&&this.drawMarkedAreas(e)}activateSystemRendering(e,i,r,s){return!0}drawSystemLineObject(e){}drawStaffLine(e){for(const i of e.Measures)this.drawMeasure(i);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)}drawLyricLines(e,i){i.LyricLines.forEach(r=>{r.Start.y+=i.PositionAndShape.AbsolutePosition.y,r.End.y+=i.PositionAndShape.AbsolutePosition.y,r.Start.x+=i.PositionAndShape.AbsolutePosition.x,r.End.x+=i.PositionAndShape.AbsolutePosition.x,this.drawGraphicalLine(r,this.rules.LyricUnderscoreLineWidth)})}drawExpressions(e){}drawGraphicalLine(e,i,r="black"){return this.drawLine(e.Start,e.End,r,i)}drawLine(e,i,r="#FF0000FF",s){}drawDashes(e){e.forEach(i=>i.SVGNode=this.drawLabel(i,GraphicalLayers.Notes))}drawOctaveShifts(e){}drawStaffLines(e){if(e.StaffLines){const i=e.PositionAndShape.AbsolutePosition;for(let r=0;r<5;r++)this.drawLineAsHorizontalRectangleWithOffset(e.StaffLines[r],i,GraphicalLayers.Notes)}}drawSymbol(e,i,r,s=1,o=GraphicalLayers.Notes){}get leadSheet(){return this.graphicalMusicSheet.LeadSheet}set leadSheet(e){this.graphicalMusicSheet.LeadSheet=e}drawPage(e){if(this.isVisible(e.PositionAndShape)){for(const i of e.MusicSystems)this.isVisible(i.PositionAndShape)&&this.drawMusicSystem(i);if(e===e.Parent.MusicPages[0])for(const i of e.Labels)i.SVGNode=this.drawLabel(i,GraphicalLayers.Notes);this.drawableBoundingBoxElement&&this.drawBoundingBoxes(e.PositionAndShape,0,this.drawableBoundingBoxElement)}}drawBoundingBoxes(e,i=0,r="all"){const s=e.DataObject.constructor.name;let o=!1;r==="all"&&(o=!0),(o||s===r)&&this.drawBoundingBox(e,void 0,!0,s,i),i++,e.ChildElements.forEach(a=>this.drawBoundingBoxes(a,i,r))}drawBoundingBox(e,i=void 0,r=!1,s=void 0,o=0){let a=new RectangleF2D(e.AbsolutePosition.x+e.BorderMarginLeft,e.AbsolutePosition.y+e.BorderMarginTop,e.BorderMarginRight-e.BorderMarginLeft,e.BorderMarginBottom-e.BorderMarginTop);r&&(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,i),o-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,i),o-1)),a=this.applyScreenTransformationForRect(a);const l=this.renderRectangle(a,GraphicalLayers.Background,o,i,.5);if(s){const c=new Label(s),u=new LabelRenderSpecs;u.BitmapWidth=a.width,u.BitmapHeight=a.height,u.FontHeightInPixel=a.height,u.ScreenPosition=new PointF2D(a.x,a.y+12),this.renderLabel(new GraphicalLabel(c,.8,TextAlignmentEnum.CenterCenter,this.rules),o,u)}return l}drawMarkedAreas(e){for(const i of e.GraphicalMarkedAreas)i&&(i.systemRectangle&&this.drawRectangle(i.systemRectangle,GraphicalLayers.Background),i.settings&&(i.settings.SVGNode=this.drawLabel(i.settings,GraphicalLayers.Comment)),i.labelRectangle&&this.drawRectangle(i.labelRectangle,GraphicalLayers.Background),i.label&&(i.label.SVGNode=this.drawLabel(i.label,GraphicalLayers.Comment)))}drawStaffLineSymbols(e){const i=e.ParentStaff.ParentInstrument,r=e.PositionAndShape.AbsolutePosition.x,s=e.PositionAndShape.AbsolutePosition.y+2,o=e.PositionAndShape.BorderRight;i.highlight&&this.drawingParameters.drawHighlights&&this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(r,s),new PointF2D(r+o,s),4,OutlineAndFillStyleEnum.Highlighted),GraphicalLayers.Highlight);let a=MusicSymbolDrawingStyle.Disabled,l=MusicSymbol.PLAY,c=this.drawingParameters.drawActivitySymbols;switch(this.phonicScoreMode){case PhonicScoreModes.Midi:l=MusicSymbol.PLAY,this.midiPlaybackAvailable&&e.ParentStaff.audible&&(a=MusicSymbolDrawingStyle.PlaybackSymbols);break;case PhonicScoreModes.Following:l=MusicSymbol.MIC,e.ParentStaff.following&&(a=MusicSymbolDrawingStyle.FollowSymbols);break;default:c=!1;break}if(c){const u=new PointF2D(r+o+2,s);this.drawSymbol(l,a,u)}if(this.drawingParameters.drawErrors)for(const u of e.Measures){const m=u.PositionAndShape,d=m.AbsolutePosition.x,g=m.AbsolutePosition.y+2;u.hasError&&this.graphicalMusicSheet.ParentMusicSheet.DrawErroneousMeasures&&this.drawLineAsHorizontalRectangle(new GraphicalLine(new PointF2D(d,g),new PointF2D(d+m.BorderRight,g),4,OutlineAndFillStyleEnum.ErrorUnderlay),GraphicalLayers.MeasureError)}}}class VexFlowTextMeasurer{constructor(e){this.fontSize=20,this.fontSizeStandard=this.fontSize;const i=document.createElement("canvas");this.context=i.getContext("2d"),this.rules=e}computeTextWidthToHeightRatio(e,i,r,s=void 0,o=this.fontSize){return this.context.font=VexFlowConverter.font(o,r,i,this.rules,s),this.context.measureText(e).width/o}setFontSize(e=this.fontSizeStandard){return this.fontSize=e,e}}class AbstractGraphicalExpression extends GraphicalObject{constructor(e,i,r){super(),this.expression=i,this.parentMeasure=r,this.boundingBox=new BoundingBox$1(this,e.PositionAndShape),this.parentStaffLine=e,this.parentStaffLine.AbstractExpressions.push(this),this.rules=e.ParentMusicSystem.rules}get Label(){return this.label}get ParentStaffLine(){return this.parentStaffLine}get SourceExpression(){return this.expression}get Placement(){return this.expression.Placement}}class GraphicalInstantaneousTempoExpression extends AbstractGraphicalExpression{constructor(e,i){super(i.PositionAndShape.Parent.DataObject,e,e.parentMeasure),this.label=i}get GraphicalLabel(){return this.label}updateSkyBottomLine(){}}class GraphicalInstantaneousDynamicExpression extends AbstractGraphicalExpression{constructor(e,i,r){super(i,e,r.parentSourceMeasure),this.mInstantaneousDynamicExpression=e,this.mMeasure=r}updateSkyBottomLine(){const e=this.parentStaffLine.SkyBottomLineCalculator,i=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginLeft,r=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginRight;let s=0;switch(this.Placement){case PlacementEnum.Above:s=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginTop,e.updateSkyLineInRange(i,r,s);break;case PlacementEnum.Below:s=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginBottom,e.updateBottomLineInRange(i,r,s);break;default:loglevelExports.error("Placement for GraphicalInstantaneousDynamicExpression is unknown")}}}class GraphicalContinuousDynamicExpression extends AbstractGraphicalExpression{constructor(e,i,r){super(i,e,r),this.lines=[],this.isSplittedPart=!1,this.notToBeRemoved=!1}get StartMeasure(){return this.startMeasure}set StartMeasure(e){this.startMeasure=e}get EndMeasure(){return this.endMeasure}set EndMeasure(e){this.endMeasure=e}get EndStaffLine(){return this.endMeasure?this.endMeasure.ParentStaffLine:void 0}get IsSplittedPart(){return this.isSplittedPart}set IsSplittedPart(e){this.isSplittedPart=e}get IsVerbal(){return this.ContinuousDynamic.Label&&this.ContinuousDynamic.Label.length>0}get NotToBeRemoved(){return this.notToBeRemoved}set NotToBeRemoved(e){this.notToBeRemoved=e}get Lines(){return this.lines}get ContinuousDynamic(){return this.SourceExpression}updateSkyBottomLine(){var s;const e=this.parentStaffLine.SkyBottomLineCalculator,i=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;switch(!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: "+((s=this.startMeasure)==null?void 0:s.MeasureNumber)),this.Placement){case PlacementEnum.Above:if(!this.IsVerbal)this.ContinuousDynamic.DynamicType===ContDynamicEnum.crescendo?e.updateSkyLineWithWedge(this.lines[0].Start,this.lines[0].End):this.ContinuousDynamic.DynamicType===ContDynamicEnum.diminuendo&&e.updateSkyLineWithWedge(this.lines[0].End,this.lines[0].Start);else{const o=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;e.updateSkyLineInRange(i,r,o)}break;case PlacementEnum.Below:if(!this.IsVerbal)this.ContinuousDynamic.DynamicType===ContDynamicEnum.crescendo?e.updateBottomLineWithWedge(this.lines[1].Start,this.lines[1].End):this.ContinuousDynamic.DynamicType===ContDynamicEnum.diminuendo&&e.updateBottomLineWithWedge(this.lines[1].End,this.lines[1].Start);else{const o=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;e.updateBottomLineInRange(i,r,o)}break;default:loglevelExports.error("Placement for GraphicalContinuousDynamicExpression is unknown")}}createCrescendoLines(e,i,r,s=this.rules.WedgeOpeningLength,o=this.rules.WedgeLineWidth){const a=new PointF2D(e,r),l=new PointF2D(i,r-s/2),c=new PointF2D(i,r+s/2);this.addWedgeLines(a,l,c,o)}createFirstHalfCrescendoLines(e,i,r,s=this.rules.WedgeMeasureEndOpeningLength,o=this.rules.WedgeLineWidth){const a=new PointF2D(e,r),l=new PointF2D(i,r-s/2),c=new PointF2D(i,r+s/2);this.addWedgeLines(a,l,c,o)}createSecondHalfCrescendoLines(e,i,r,s=this.rules.WedgeMeasureBeginOpeningLength,o=this.rules.WedgeOpeningLength,a=this.rules.WedgeLineWidth){const l=new PointF2D(e,r-s/2),c=new PointF2D(e,r+s/2),u=new PointF2D(i,r-o/2),m=new PointF2D(i,r+o/2);this.addDoubleLines(l,u,c,m,a)}recalculateCrescendoLines(e,i,r){const s=Math.abs(this.lines[0].Start.y-this.lines[1].Start.y)>1e-4;this.lines.clear(),s?this.createSecondHalfCrescendoLines(e,i,r):this.isSplittedPart?this.createFirstHalfCrescendoLines(e,i,r):this.createCrescendoLines(e,i,r)}createDiminuendoLines(e,i,r,s=this.rules.WedgeOpeningLength,o=this.rules.WedgeLineWidth){const a=new PointF2D(e,r-s/2),l=new PointF2D(e,r+s/2),c=new PointF2D(i,r);this.addWedgeLines(c,a,l,o)}createFirstHalfDiminuendoLines(e,i,r,s=this.rules.WedgeOpeningLength,o=this.rules.WedgeMeasureEndOpeningLength,a=this.rules.WedgeLineWidth){const l=new PointF2D(e,r-s/2),c=new PointF2D(e,r+s/2),u=new PointF2D(i,r-o/2),m=new PointF2D(i,r+o/2);this.addDoubleLines(l,u,c,m,a)}createSecondHalfDiminuendoLines(e,i,r,s=this.rules.WedgeMeasureBeginOpeningLength,o=this.rules.WedgeLineWidth){const a=new PointF2D(e,r-s/2),l=new PointF2D(e,r+s/2),c=new PointF2D(i,r);this.addWedgeLines(c,a,l,o)}recalculateDiminuendoLines(e,i,r){const s=Math.abs(this.lines[0].End.y-this.lines[1].End.y)>1e-4;this.lines.clear(),s?this.createFirstHalfDiminuendoLines(e,i,r):this.isSplittedPart?this.createSecondHalfDiminuendoLines(e,i,r):this.createDiminuendoLines(e,i,r)}calcPsi(){if(this.IsVerbal){this.PositionAndShape.calculateBoundingBox();return}this.PositionAndShape.RelativePosition=this.lines[0].Start,this.PositionAndShape.BorderMarginTop=this.lines[0].End.y-this.lines[0].Start.y,this.PositionAndShape.BorderMarginBottom=this.lines[1].End.y-this.lines[1].Start.y,this.PositionAndShape.Center.y=(this.PositionAndShape.BorderMarginTop+this.PositionAndShape.BorderMarginBottom)/2,this.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)}cleanUp(){this.lines.clear()}shiftYPosition(e){this.IsVerbal?(this.PositionAndShape.RelativePosition.y+=e,this.PositionAndShape.calculateBoundingBox()):(this.lines[0].Start.y+=e,this.lines[0].End.y+=e,this.lines[1].End.y+=e)}squeeze(e){this.IsVerbal||Math.abs(this.lines[0].End.x-this.lines[0].Start.x)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())}addWedgeLines(e,i,r,s){const o=new GraphicalLine(e,i,s),a=new GraphicalLine(e,r,s);this.lines.push(o),this.lines.push(a)}addDoubleLines(e,i,r,s,o){const a=new GraphicalLine(e,i,o),l=new GraphicalLine(r,s,o);this.lines.push(a),this.lines.push(l)}}class GraphicalUnknownExpression extends AbstractGraphicalExpression{constructor(e,i,r,s,o=void 0){super(e,new AbstractExpression(r),s),this.label=i,this.sourceMultiExpression=o}updateSkyBottomLine(){const e=this.parentStaffLine.SkyBottomLineCalculator,i=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft,r=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight;switch(this.Placement){case PlacementEnum.Above:const s=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;e.updateSkyLineInRange(i,r,s);break;case PlacementEnum.Below:const o=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;e.updateBottomLineInRange(i,r,o);break;default:loglevelExports.error("Placement for GraphicalUnknownExpression is unknown")}}}const unitInPixels=10;class VexFlowMusicSheetDrawer extends MusicSheetDrawer{constructor(e=new DrawingParameters){super(new VexFlowTextMeasurer(e.Rules),e),this.backends=[],this.zoom=1,this.pageIdx=0,this.getDotId=(i,r)=>r?String(i.Label.PositionAndShape.RelativePosition[r]):String(i.Label.PositionAndShape.RelativePosition.x)+String(i.Label.PositionAndShape.RelativePosition.y),this.hasDot=(i,r,s,o)=>{const a=r||Object.values(o);for(const l of a){if(s)return i.x===l.x&&i.y===l.y;if(i.x===l.x)return!0}return!1}}get Zoom(){return this.zoom}get Backends(){return this.backends}initializeBackendForPage(e){this.backend=this.backends[e.PageNumber-1]}drawSheet(e){var i,r,s;this.rules.DefaultVexFlowNoteFont==="gonville"&&(Vex.Flow.DEFAULT_FONT_STACK=[(i=Vex.Flow.Fonts)==null?void 0:i.Gonville,(r=Vex.Flow.Fonts)==null?void 0:r.Bravura,(s=Vex.Flow.Fonts)==null?void 0:s.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;for(const o of e.MusicPages){if(o.PageNumber>this.rules.MaxPageToDrawNumber)break;const a=this.backends[this.pageIdx];a.graphicalMusicPage=o,a.scale(this.zoom),this.pageIdx+=1}this.pageIdx=0,this.backend=this.backends[0],super.drawSheet(e)}drawPage(e){e&&(this.backend=this.backends[e.PageNumber-1],super.drawPage(e),this.pageIdx+=1)}clear(){for(const e of this.backends)e.clear()}setZoom(e){this.zoom=e}calculatePixelDistance(e){return e*unitInPixels}drawStaffLine(e){const i=this.backend.getContext().openGroup();i&&i.classList.add("staffline"),super.drawStaffLine(e);const r=e.PositionAndShape.AbsolutePosition;this.rules.RenderSlurs&&this.drawSlurs(e,r),this.backend.getContext().closeGroup()}drawSlurs(e,i){var s,o,a,l;const r=(s=window.GYM)==null?void 0:s.vfcurveItem;for(let c=0;c(d.index?d.index===c:!0)&&d.MeasureNumberXML==u.staffEntries[u.staffEntries.length-1].parentMeasure.MeasureNumber);m&&(u.bezierEndControlPt.y+=(o=m==null?void 0:m.bezierEndControlPt)!=null&&o.y?m.bezierEndControlPt.y:0,u.bezierEndPt.y+=(a=m==null?void 0:m.bezierEndPt)!=null&&a.y?m.bezierEndPt.y:0,u.bezierStartControlPt.y+=(l=m==null?void 0:m.bezierStartControlPt)!=null&&l.y?m.bezierStartControlPt.y:0)}catch(m){console.log(m)}this.drawSlur(u,i)}}}drawSlur(e,i){const r=[];let s,o,a,l;this.rules.DYMusicScoreType==="jianpu"?((e.placement>0||e.bezierStartPt.y>0)&&(e.bezierStartPt.y=-.8,e.bezierStartControlPt.y=-2.5),s=new PointF2D(e.bezierStartPt.x+i.x,e.bezierStartPt.y+i.y),o=new PointF2D(e.bezierStartControlPt.x+i.x,e.bezierStartControlPt.y+i.y),a=new PointF2D(e.bezierEndControlPt.x+i.x,e.bezierStartControlPt.y+i.y),l=new PointF2D(e.bezierEndPt.x+i.x,e.bezierStartPt.y+i.y)):(s=new PointF2D(e.bezierStartPt.x+i.x,e.bezierStartPt.y+i.y),o=new PointF2D(e.bezierStartControlPt.x+i.x,e.bezierStartControlPt.y+i.y),a=new PointF2D(e.bezierEndControlPt.x+i.x,e.bezierEndControlPt.y+i.y),l=new PointF2D(e.bezierEndPt.x+i.x,e.bezierEndPt.y+i.y)),r.push(this.applyScreenTransformation(s)),r.push(this.applyScreenTransformation(o)),r.push(this.applyScreenTransformation(a)),r.push(this.applyScreenTransformation(l)),e.placement===PlacementEnum.Above?(s.y-=.05,o.y-=.3,a.y-=.3,l.y-=.05):(s.y+=.05,o.y+=.3,a.y+=.3,l.y+=.05),r.push(this.applyScreenTransformation(s)),r.push(this.applyScreenTransformation(o)),r.push(this.applyScreenTransformation(a)),r.push(this.applyScreenTransformation(l)),e.SVGElement=this.backend.renderCurve(r)}drawMeasure(e){e.setAbsoluteCoordinates(e.PositionAndShape.AbsolutePosition.x*unitInPixels,e.PositionAndShape.AbsolutePosition.y*unitInPixels);const i=this.backend.getContext();try{e.draw(i)}catch(r){loglevelExports.warn("VexFlowMusicSheetDrawer.drawMeasure",r)}for(const r of e.staffEntries)this.drawStaffEntry(r)}drawLine(e,i,r="#FF0000FF",s=.2){return e=this.applyScreenTransformation(e),i=this.applyScreenTransformation(i),this.backend.renderLine(e,i,r,s*unitInPixels)}DrawOverlayLine(e,i,r,s="#FF0000FF",o=.2){if(!r.PageNumber||r.PageNumber>this.backends.length||r.PageNumber<1){console.log("VexFlowMusicSheetDrawer.drawOverlayLine: invalid page number / music page number doesn't correspond to an existing backend.");return}const a=r.PageNumber-1,l=this.backends[a];return e=this.applyScreenTransformation(e),i=this.applyScreenTransformation(i),l.renderLine(e,i,s,o*unitInPixels)}drawSkyLine(e){const i=e.PositionAndShape.AbsolutePosition,r=e.PositionAndShape.Size.width;this.drawSampledLine(e.SkyLine,i,r)}drawBottomLine(e){const i=new PointF2D(e.PositionAndShape.AbsolutePosition.x,e.PositionAndShape.AbsolutePosition.y),r=e.PositionAndShape.Size.width;this.drawSampledLine(e.BottomLine,i,r,"#0000FFFF")}drawSampledLine(e,i,r,s="#FF0000FF"){const o=[];let a=0;for(let c=0;c0){const c=this.rules.SamplingUnit;let u=new PointF2D(l.x,l.y),m=new PointF2D(o[0]/c+l.x,l.y);this.drawLine(u,m,s);let d,g;e[0]>=0&&(d=new PointF2D(o[0]/c+l.x,l.y),g=new PointF2D(o[0]/c+l.x,l.y+e[o[0]]),this.drawLine(d,g,s));for(let y=1;y0)for(const i of e.FingeringEntries)i.SVGNode=this.drawLabel(i,GraphicalLayers.Notes);if(e.graphicalChordContainers!==void 0&&e.graphicalChordContainers.length>0)for(const i of e.graphicalChordContainers){const r=i.GraphicalLabel;r.SVGNode=this.drawLabel(r,GraphicalLayers.Notes)}this.rules.RenderLyrics&&e.LyricsEntries.length>0&&this.drawLyrics(e.LyricsEntries,GraphicalLayers.Notes)}drawLyrics(e,i){e.forEach(r=>{const s=r.GraphicalLabel;s.SVGNode=this.drawLabel(s,i)})}drawInstrumentBrace(e,i){e.draw(this.backend.getContext())}drawGroupBracket(e,i){e.draw(this.backend.getContext())}drawOctaveShifts(e){for(const i of e.OctaveShifts)if(i){const r=i,s=this.backend.getContext(),o=r.getTextBracket();o.setContext(s);try{o.draw()}catch(a){loglevelExports.warn(a)}}}drawPedals(e){for(const i of e.Pedals)if(i){const r=i,s=this.backend.getContext(),o=r.getPedalMarking();o.setContext(s),o.draw()}}drawWavyLines(e){for(const i of e.WavyLines)if(i){const r=i,s=this.backend.getContext(),o=r.getVibratoBracket();o.setContext(s),o.draw()}}getMaxExpressionsYAndDots(e){var c,u;const i=[];let r=0;for(const m of e.measures)i.push(m.measureNumber);const s={},o={},a={};for(const m of e.AbstractExpressions)if(m instanceof GraphicalUnknownExpression&&i.includes(m.parentMeasure.MeasureNumber)){const d=this.getDotId(m),g=this.getDotId(m,"x");o[d]||(o[d]=[]),a[g]||(a[g]=[]),this.hasDot(m.Label.PositionAndShape.RelativePosition,o[d],!0)||(o[d].push(m.Label.PositionAndShape.RelativePosition),a[g].push(m.Label.PositionAndShape.RelativePosition)),s[d]=m.Label.PositionAndShape.RelativePosition}let l=0;for(const m of e.AbstractExpressions){const d=(c=m.parentMeasure)==null?void 0:c.MeasureNumber;if(m instanceof GraphicalUnknownExpression&&i.includes(d)){const g=(u=m.parentMeasure.verticalMeasureList[0])==null?void 0:u.stave,y=(g==null?void 0:g.end_x)-(g==null?void 0:g.x),b=this.getDotId(m,"x");if((a[b]||[]).length===1&&l!==d){const S=m.Label.PositionAndShape.AbsolutePosition.y;r=r===0?S:Math.min(r,S)}(a[b]||[]).length!==1&&y/10Number.EPSILON){let r=Math.min(...e.Lines.map(o=>o.Start.x)),s=Math.min(...e.Lines.map(o=>o.Start.y));e.Lines[0].Start.x=r,e.Lines[1].Start.x=r,e.Lines[0].Start.y=s+this.rules.WedgeOpeningLength/2,e.Lines[1].Start.y=s+this.rules.WedgeOpeningLength*2,e.Lines[0].End.y+=this.rules.WedgeOpeningLength/2,e.Lines[1].End.y+=this.rules.WedgeOpeningLength}}catch(r){}const i=this.backend.getContext();i.openGroup("lineGroup");for(const r of e.Lines){const s=new PointF2D(e.ParentStaffLine.PositionAndShape.AbsolutePosition.x+r.Start.x,e.ParentStaffLine.PositionAndShape.AbsolutePosition.y+r.Start.y),o=new PointF2D(e.ParentStaffLine.PositionAndShape.AbsolutePosition.x+r.End.x,e.ParentStaffLine.PositionAndShape.AbsolutePosition.y+r.End.y);this.drawLine(s,o,"black",r.Width)}i.closeGroup()}}renderLabel(e,i,r){return this._renderLabel(e,r)}_renderLabel(e,i){var u;if(!e.Label.print)return;const r=e.Label.fontHeight*unitInPixels,{font:s}=e.Label;let o;this.rules.ColoringEnabled&&(o=e.Label.colorDefault,e.Label.color&&(o=e.Label.color.toString()),o||(o=this.rules.DefaultColorLabel));let{fontStyle:a,fontFamily:l}=e.Label;a||(a=this.rules.DefaultFontStyle),l||(l=this.rules.DefaultFontFamily);let c;for(let m=0;m<((u=e.TextLines)==null?void 0:u.length);m++){const d=e.TextLines[m],g=this.calculatePixelDistance(d.xOffset),y=new PointF2D(i.ScreenPosition.x+g,i.ScreenPosition.y),b=this.backend.renderText(r,a,s,d.text,i.FontHeightInPixel,y,o,e.Label.fontFamily);c?c.appendChild(b):c=b,i.ScreenPosition.y=i.ScreenPosition.y+i.FontHeightInPixel,e.TextLines.length>1&&(i.ScreenPosition.y+=this.rules.SpacingBetweenTextLines)}return c}renderRectangle(e,i,r,s,o){return this.backend.renderRectangle(e,r,s,o)}applyScreenTransformation(e){return new PointF2D(e.x*unitInPixels,e.y*unitInPixels)}applyScreenTransformationForRect(e){return new RectangleF2D(e.x*unitInPixels,e.y*unitInPixels,e.width*unitInPixels,e.height*unitInPixels)}}function initGroup(){return{notes:[],finish:!1,total:0,staveId:""}}let _text_width=null,tone="C",group=initGroup(),_denominator="",_numerator="",ornamentGroup="";class NumberedNote extends StaveNote{static get CATEGORY(){return"numberednotes"}static accidentalAndKey(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{}}}static accidentalMap(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","#":"","##":"#"}}}static get noteLift(){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"]}}static get longDurationLine(){return{1:3,2:1,6:2}}static get numberedDurationLine(){return{8:1,16:2,32:3,64:4,128:5}}static get durationTime(){return{8:6144,4:4096}}constructor(e){super(e),this.setAttribute("type","NumberedNote"),tone=e.keyString,this.ornament=!!e.ornament,this.line=0,this.keys=e.keys||[],this.fontSize=20,this.offset_x=0,this.offset_y=0,this.note_tones=[],this.duration_lines=0,this.long_duration_lines=0,this.note_size=e.note_size||16;const i=Flow.sanitizeDuration(this.duration);var r=NumberedNote.numberedDurationLine[i.toString()];if(r&&(this.duration_lines=r),r=NumberedNote.longDurationLine[i.toString()],r&&(this.long_duration_lines=r),!_text_width){var s="__$text_wraper$$__";let a=document.createElement("canvas");a.id=s,document.body.append(a);const l=document.getElementById(s),c=l.getContext("2d");c.font="Arial 22px";var o=c.measureText("5");_text_width=o.width+2,document.body.removeChild(l)}}getCategory(){return NumberedNote.CATEGORY}setKeySignature(e){this.keySignature=e}preFormat(){this.preFormatted||(this.modifierContext&&this.modifierContext.preFormat(),this.setWidth(this.full_width),this.setPreFormatted(!0))}filterNote(){if(window&&window.sett&&window.sett.keySignature||!this.keys||!this.keys.length)return;const e=NumberedNote.accidentalMap(tone);if(!e)return;const i=NumberedNote.noteLift;if(!i)return;var r=this.keys[0].split("/"),s=r[0];s==="b"&&(s="R"),s=s.replace(new RegExp("#","g"),""),s=s.replace(new RegExp("n","g"),""),s.length>1&&(s=s.replace(new RegExp("b","g"),""));const o=NumberedNoteHead.numberedNotationMapping[s.toUpperCase()];if(i.includes(o))for(let a=0;a{switch(r.getAttribute("type")){case"Accidental":r.render_options.font_scale=this.note_width*1.4,r.x_shift=2,r.y_shift=this.unit_height/2,this.ornament&&(r.render_options.font_scale=this.note_width,r.x_shift=14,r.y_shift=-10);break;case"Stroke":r.x_shift=-1*e,r.y_shift=1*this.unit_height;break;case"Dot":r.x_shift=i*this.duration_dot_width+7,r.y_shift=1*this.unit_height,i++;break;case"Ornament":r.y_shift=-3;break;default:r.y_shift=1*this.unit_height}r.reset&&r.reset(),e+=r.getWidth()/2})}handleDeleteDot(){for(let e=0;ea),r=i.length?i[0]/i[1]:0;if(this.ornament)return;if(r===0)return this.long_duration_lines=this.intrinsicTicks/e-1,this.long_duration_lines>=_numerator&&(this.long_duration_lines=_numerator-1),_denominator==8&&(this.long_duration_lines=0,_numerator==3&&this.draw_dot(this.context,this.bottom_x+25,this.bottom_y-30,this.dot_width),_numerator==6&&(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))),group=initGroup();let s={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>e*2&&(this.long_duration_lines=parseInt(r/e)-1,this.handleDeleteDot()),ornamentGroup&&(s.x+=this.note_width),group.notes.push(s);let o=group.notes.reduce((a,l)=>a+l.duration,0);o=parseInt(o),o>e&&(o-=e),o>e-10&&ol.lines===0).length&&(this.drawDurationLoneLine(),group=initGroup()))}draw(){if(this.checkContext(),!this.stave)throw new Vex.RERR("NoStave","Can't draw without a stave.");let e=this.context;e.save(),e.setFont("Arial",this.note_height,"normal"),this.setAttribute("el",e.openGroup("stavenote",this.getAttribute("id"))),e.openGroup("note",null,{pointerBBox:!0});let i=this.getAbsoluteX()+2.5;this.x=i;let r=this.stave.getYForLine(2)+this.note_height/2;this.y=r,this.buildToneHeads(),this.preFormatModifier(),this.applyStyle(),this.note_tones.forEach(s=>{s.draw(e)}),e.openGroup("modifier",null,{pointerBBox:!0}),this.drawModifiers(),e.closeGroup(),e.closeGroup(),e.closeGroup(),this.calcGroup(),group.staveId=this.stave.attrs.id,this.drawDurationLine(e,{}),this.drawLongDurationLines(e),this.restoreStyle(),this.setRendered(),this.ornament?ornamentGroup?ornamentGroup=Object.assign(ornamentGroup,{lines:this.duration_lines,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,width:this.full_width}):ornamentGroup={lines:this.duration_lines,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,width:this.full_width}:ornamentGroup=""}drawDurationLoneLine(e,i){e=e||this.context;let r=i||this.y+this.duration_line_space;for(let s=0;s<5;s++){let o=[],a=0;for(let l=0;ls)o.push(c),a++;else{if(o.length>1){let u=o.length-1;r=o[0].y+this.duration_line_space,e.rect(o[0].x,r+s*3,o[u].x-o[0].x+o[u].width,.5)}o=[],a=l+1}}if(o.length>1){let l=o.length-1;r=o[0].y+this.duration_line_space,e.rect(o[0].x,r+s*3,o[l].x-o[0].x+o[l].width,.5)}}}draw_dot(e,i,r,s){e.openGroup("numbered-note-dot"),e.beginPath(),e.arc(i,r,s,0,2*Math.PI),e.closePath(),e.fill(),e.closeGroup()}drawDurationLine(e,i){var r=this.attrs.id+"-lines";e.openGroup("numbered_note_lines",r);var s,o;if(this.duration_lines>0){const c=this.duration_line_space;var a=this.full_width;if(i&&i.width&&(a=i.width),a<0&&(a=this.note_width),!i||typeof i.startX>"u"?s=this.x-c/2-this.left_width:s=i.startX,!i||typeof i.startY>"u"?o=this.y+this.duration_line_space:o=i.startY,group.finish&&(this.drawDurationLoneLine(e,o),group=initGroup()),this.ornament?(s+=12,o-=22,a=15,ornamentGroup&&(s-=10,a+=10)):ornamentGroup&&(s+=this.note_width,a-=this.note_width),a>0){for(var l=0;lc.getAttribute("type")==="Dot"),a=this.modifiers.findIndex(c=>c.getAttribute("type")==="Accidental"),l=this.modifiers.findIndex(c=>c.getAttribute("type")==="GraceNoteGroup");s&&a>-1?this.modifiers[a].accidental.code=s==="#"?"v18":"v44":o>=0||l>=0?o>=0&&this.modifiers.splice(o+1,1):this.modifiers.splice(a,1)}}catch(s){console.log("🚀 ~ error",s)}}this.setYs(e)}getFullWidth(){return this.full_width}getFullHeight(){return this.full_height}getLine(){return this.keyProps[0].line}get full_width(){return this.note_width+this.left_width+this.right_width+this.long_duration_line_width}get long_duration_line_width(){return(this.long_duration_width+this.long_duration_space)*this.long_duration_lines}get full_height(){return this.bottom_y-this.top_y}get note_width(){return this.note_size||0}get note_dot_width(){return 6}get note_height(){return this.unit_height}get unit_height(){return this.note_size||0}get note_x(){return this.x||0}get top_x(){return this.x||0}get top_y(){var e=this;return(this.y||0)-(e.note_tones.map(r=>(r.td+r.bd)*(e.dot_space+e.dot_width)).reduce((r,s)=>r+s,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)}get bottom_x(){return this.x||0}get bottom_y(){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)}get left_width(){return this.modifiers_width}get right_width(){return this.full_duration_dot_width}get duration_dot_width(){return 6}get full_duration_dot_width(){return this.duration_dot_width*this.getModifiersByCategory(Dot.CATEGORY).length}getModifiersByCategory(e){var i=[];return this.modifiers.forEach(r=>{r.getCategory()===e&&i.push(r)}),i}get head_space(){return 6}get duration_line_height(){return 2}get duration_line_space(){return 4}get dot_width(){return 2}get dot_space(){return 2}get long_duration_space(){return 10}get long_duration_width(){return 20}getWidth(){return this.full_width}get modifiers_width(){let e=0;return this.modifiers.forEach(i=>{e+=i.getWidth()}),e}}class NumberedNoteHead{static get numberedNotationMapping(){let 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":return{C:"2",D:"3",E:"4",F:"5",G:"6",A:"7",B:"1",R:"0",min:-.5,max:2.5};case"D":return{C:"7",D:"1",E:"2",F:"3",G:"4",A:"5",B:"6",R:"0",min:.5,max:3.5};case"E":return{C:"6",D:"7",E:"1",F:"2",G:"3",A:"4",B:"5",R:"0",min:1,max:4};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"Eb":return{C:"6",D:"7",E:"1",F:"2",G:"3",A:"4",B:"5",R:"0",min:1,max:4};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"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"Ab":case"G#":return{C:"3",D:"4",E:"5",F:"6",G:"7",A:"1",B:"2",R:"0",min:-1,max:2};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"C#":case"Cb":default:return{C:"1",D:"2",E:"3",F:"4",G:"5",A:"6",B:"7",R:"0",min:0,max:3}}}tone_to_numbered_key(){var e=this.key.split("/"),i=e[0];i==="b"&&(i="R"),i=i.replace(new RegExp("#","g"),""),i=i.replace(new RegExp("n","g"),""),i.length>1&&(i=i.replace(new RegExp("b","g"),""));let r=0,s=0;this.note.stave&&this.note.stave.options&&this.note.stave.options.keySignature&&(tone=this.note.stave.options.keySignature);const o=this.note.getLine();return oNumberedNoteHead.numberedNotationMapping.max&&(s=Math.ceil((o-NumberedNoteHead.numberedNotationMapping.max)/3.5)),i.toUpperCase()==="R"&&(r=0,s=0),{key:NumberedNoteHead.numberedNotationMapping[i.toUpperCase()],td:s,bd:r}}constructor(e){this.key=e.key,this.x=e.x||0,this.y=e.y||0,this.idx=e.idx||0,this.note=e.note||0,this.meta=this.tone_to_numbered_key(),this.noteSize=e.noteSize||16,this.td=this.meta.td,this.bd=this.meta.bd}draw(e){let i=this.y;e.openGroup("numbered-note-head");var r=this.x+(this.note.ornament?-2:0);let s=i-this.note.unit_height-this.note.dot_space-(this.note.ornament?-4:2);for(let a=0;a1&&(l-=this.note.duration_line_space),i+=l}this.draw_dot(e,r+_text_width,i,this.note.dot_width),i+=this.note.dot_width+this.note.dot_space}e.closeGroup()}get height(){return this.note.note_height+(this.meta.bd+this.meta.td)*(this.note.dot_width+this.note.dot_space)}draw_dot(e,i,r,s){e.openGroup("numbered-note-dot"),e.beginPath(),e.arc(i,r,s,0,2*Math.PI),e.closePath(),e.fill(),e.closeGroup()}}const VF$c=Vex.Flow,_VexFlowConverter=class{static durations(t,e){const i=[],r=t.clone();for(;r.RealValue>0;){const s=r.RealValue;if(s>=2)i.push("1/2"),r.Sub(new Fraction$1(2,1));else if(s>=1)i.push("w"),r.Sub(new Fraction$1(1,1));else if(s<1&&s>=.5){if(e&&s>.5)return["w"];i.push("h"),r.Sub(new Fraction$1(1,2))}else if(s<.5&&s>=.25){if(e&&s>.25)return["h"];i.push("q"),r.Sub(new Fraction$1(1,4))}else if(s<.25&&s>=.125){if(e&&s>.125)return["q"];i.push("8"),r.Sub(new Fraction$1(1,8))}else if(s<.125&&s>=.0625){if(e&&s>.0625)return["8"];i.push("16"),r.Sub(new Fraction$1(1,16))}else if(s<.0625&&s>=.03125){if(e&&s>.03125)return["16"];i.push("32"),r.Sub(new Fraction$1(1,32))}else if(s<.03125&&s>=.015625){if(e&&s>.015625)return["32"];i.push("64"),r.Sub(new Fraction$1(1,64))}else{if(e)return["64"];i.push("128"),r.Sub(new Fraction$1(1,128))}}return i}static pitch(t,e,i,r=void 0,s=void 0){let o=s;s===void 0&&(o=3),e&&s===void 0&&(o=0,i.ClefType===ClefEnum.F&&(o=2),i.ClefType===ClefEnum.C&&(o=2));const a=NoteEnum[t.FundamentalNote].toLowerCase(),l=Pitch.accidentalVexflow(t.Accidental),c=t.Octave-i.OctaveOffset+o;let u="";return r&&(u=this.NoteHeadCode(r)),[a+"n/"+c+u,l,i]}static restToNotePitch(t,e){let i=t.Octave;switch(e){case ClefEnum.C:case ClefEnum.F:{i+=2;break}case ClefEnum.G:}return new Pitch(t.FundamentalNote,i,AccidentalEnum.NONE)}static NoteHeadCode(t){const e="/",i=t.Filled?"2":"1";switch(t.Shape){case NoteHeadShape.NORMAL:return"";case NoteHeadShape.DIAMOND:return e+"D"+i;case NoteHeadShape.TRIANGLE:return e+"T"+i;case NoteHeadShape.X:return e+"X"+i;case NoteHeadShape.CIRCLEX:return e+"X3";case NoteHeadShape.RECTANGLE:return e+"R"+i;case NoteHeadShape.SQUARE:return e+"S"+i;case NoteHeadShape.SLASH:return"";default:return""}}static GhostNotes(t){const e=[],i=_VexFlowConverter.durations(t,!1);for(const r of i)e.push(new VF$c.GhostNote({duration:r}));return e}static StaveNote(t){var C,I,D,G,$,N,z,R,H,O,V,k,F,Z,U,J,de;t.sortForVexflow();const e=t.notes,i=t.parentStaffEntry.parentMeasure.parentSourceMeasure.Rules,r=e[0];let s=[],o;const a=[],l=r.graphicalNoteLength,c=r.sourceNote.NoteTuplet!==void 0;let u=_VexFlowConverter.durations(l,c)[0];r.sourceNote.TypeLength!==void 0&&r.sourceNote.TypeLength!==l&&r.sourceNote.TypeLength.RealValue!==0&&(u=_VexFlowConverter.durations(r.sourceNote.TypeLength,c)[0],r.numberOfDots=r.sourceNote.DotsXml);let m,d=r.numberOfDots,g=!1,y=0,b=!1,S=!1,E;for(const ne of e){if(d=1&&be.length-1>=q+1&&(Ee=($=(G=be[q-1])==null?void 0:G.graphicalVoiceEntries[0])==null?void 0:$.parentVoiceEntry,Se=(z=(N=be[q+1])==null?void 0:N.graphicalVoiceEntries[0])==null?void 0:z.parentVoiceEntry,Ee&&Se)){const ie=Ee.Notes[0],B=Se.Notes[0];if((R=ie.NoteBeam)!=null&&R.Notes.includes(B)&&B.ParentStaffEntry.ParentStaff.StafflineCount!==1){const re=Ee.Notes.last().Pitch,ee=ne.Clef(),W=_VexFlowConverter.pitch(_VexFlowConverter.restToNotePitch(re.getTransposedPitch(-2),ee.ClefType),!1,ee);re.FundamentalNote===4&&(s=[W[0]])}}}}if(l.RealValue===ne.sourceNote.SourceMeasure.ActiveTimeSignature.RealValue&&(s=i.DYMusicScoreType==="staff"?["d/5"]:["R/5"],u="w",d=0,g=!0,y=i.WholeRestXShiftVexflow*unitInPixels),[...ne.sourceNote.ParentStaff.Voices].filter(ue=>(ue==null?void 0:ue.VoiceId)!=1).length){const ue=ne.parentVoiceEntry.parentStaffEntry.graphicalVoiceEntries,be=ne.parentVoiceEntry.parentVoiceEntry.ParentVoice.VoiceId;let Ee,Se;for(const q of ue)for(const ie of q.notes){if(ie===ne||ie.sourceNote.isRest()||!ie.sourceNote.PrintObject){ne.lineShift=-2;continue}const B=ie.parentVoiceEntry.parentVoiceEntry.WantedStemDirection,re=be===1||be===5,ee=re?1:-1,Q=ie.sourceNote.Pitch.getHalfTone(),K=ee===1&&Q>Ee,le=ee===-1&&Q0){let q=3;const ie=ne.Clef();switch(ie.ClefType){case ClefEnum.F:q=5;break;case ClefEnum.C:q=4;break}E=Pitch.fromHalftone(Ee),s=[_VexFlowConverter.pitch(E,!0,ie,void 0,q)[0]]}}break}ne.sourceNote.Notehead&&ne.sourceNote.Notehead.Shape===NoteHeadShape.SLASH&&(b=!0);const te=ne.vfpitch;if((O=(H=te[2])==null?void 0:H.Parent)!=null&&O.Instructions)for(let ce=0,pe=te[2].Parent.Instructions.length;ce1&&t.notes[0].sourceNote.ParentVoiceEntry.ParentVoice.VoiceId==1&&(x.getKeyProps()[0].line=4.5);const M=(Z=window.GYM)==null?void 0:Z.customBassDrum;if(M&&x.isRest()&&(x.getDuration()==="q"&&(x.getKeyProps()[0].line=M),x.getDuration()==="h"&&(x.getKeyProps()[0].line=M-1)),x.getKeyProps().forEach(({line:ne},te)=>t.notes[te].staffLine=ne),(i.LedgerLineWidth||i.LedgerLineStrokeStyle)&&(x.ledgerLineStyle||(x.ledgerLineStyle={}),i.LedgerLineWidth&&(x.ledgerLineStyle.lineWidth=i.LedgerLineWidth),i.LedgerLineStrokeStyle&&(x.ledgerLineStyle.strokeStyle=i.LedgerLineStrokeStyle)),i.ColoringEnabled){const ne=i.DefaultColorStem;let te=t.parentVoiceEntry.StemColor;!te&&ne&&(te=ne);const ce={fillStyle:te,strokeStyle:te};te&&(x.setStemStyle(ce),x.flag&&i.ColorFlags&&x.setFlagStyle(ce))}if(x.x_shift=y,t.parentVoiceEntry.IsGrace&&t.notes[0].sourceNote.NoteBeam&&(t.parentVoiceEntry.WantedStemDirection=t.notes[0].sourceNote.NoteBeam.Notes[0].ParentVoiceEntry.WantedStemDirection),t.parentVoiceEntry){let ne=t.parentVoiceEntry.WantedStemDirection;const te=((U=window.GYM)==null?void 0:U.stemDirectionNote)||[],ce=te==null?void 0:te.find(pe=>pe.id===t.notes[0].sourceNote.NoteToGraphicalNoteObjectId);switch(ce&&typeof(ce==null?void 0:ce.direction)=="number"&&(ne=ce.direction),ne){case StemDirectionType.Up:x.setStemDirection(VF$c.Stem.UP),t.parentVoiceEntry.StemDirection=StemDirectionType.Up;break;case StemDirectionType.Down:x.setStemDirection(VF$c.Stem.DOWN),t.parentVoiceEntry.StemDirection=StemDirectionType.Down;break}}for(let ne=0,te=e.length;ne0&&pe==="single"){const ue=new VF$c.Tremolo(ce);ue.extra_stroke_scale=i.TremoloStrokeScale,ue.y_spacing_scale=i.TremoloYSpacingScale,x&&x.duration==="w"&&x.stem.setExtension(-9),x.addModifier(ne,ue)}if(ce>0&&pe==="start"&&this.noteTremoloList.push(x),ce>0&&pe==="stop"){if(this.noteTremoloList.push(x),this.noteTremoloList.filter(Ee=>Ee.duration==="w").length===this.noteTremoloList.length)try{this.noteTremoloList[0].keyProps&&this.noteTremoloList[1].keyProps&&((J=(this.noteTremoloList[0].keyProps[0].line>this.noteTremoloList[1].keyProps[0].line?this.noteTremoloList[1]:this.noteTremoloList[0]).stem)==null||J.setResetHeight(30))}catch(Ee){console.error("设置都是全音符,stem的高度失败")}const be=new VF$c.Tremolo(ce,[...this.noteTremoloList]);be.extra_stroke_scale=1.2,be.y_spacing_scale=1.2,be.x_shift=-30,x.addModifier(ne,be),this.noteTremoloList=[]}this.glissandoList.length&&(x.setVibrato(this.glissandoList[0].vfnote[0]),this.glissandoList=[]),e[ne].sourceNote.glissandoType==="start"&&this.glissandoList.push(e[ne])}if(this.slideNote){try{x.setSlideNote(this.slideNote)}catch(ne){console.error(ne)}this.slideNote=null}if(t.notes[0].sourceNote.slideType==="start"&&(this.slideNote=x),_.Length.RealValue===.25&&_.Notehead&&_.Notehead.Filled===!1){const ne=x.getKeyProps();for(let te=0;te1){let ne=x.getKeyProps().filter(ce=>!ce.code&&ce.line>3);!((de=window.GYM)==null?void 0:de.stemDirectionNote)&&ne.length===s.length&&x.setStemDirection(-1)}i.DYMusicScoreType==="jianpu"&&window&&window.sett&&window.sett.keySignature&&x.addAccidental(0,new VF$c.Accidental("#"));try{const ne=["b","#","§","º","X"],te={b:"b","#":"#","§":"n",º:"bb",X:"##"};for(const ce of e){const pe=ce.sourceNote.voiceEntry.Timestamp;for(const ue of ce.sourceNote.SourceMeasure.StaffLinkedExpressions)for(const be of ue){const Ee=Fraction$1.Equal(pe,be.Timestamp),q=be.EntriesList.map(ie=>ie.label).filter(ie=>ne.includes(ie)).map(ie=>te[ie]);if(Ee){for(const ie of q)ie&&x.addAnnotation(0,new VF$c.Annotation(ie));break}}}}catch(ne){}return x}static generateArticulations(t,e,i){var r,s,o,a,l,c;if(!(!t||t.getAttribute("type")==="GhostNote"))for(const u of e){let m=VF$c.Modifier.Position.ABOVE;t.getStemDirection()===VF$c.Stem.UP&&(m=VF$c.Modifier.Position.BELOW);let d;const g=u.articulationEnum;switch(i.ArticulationPlacementFromXML&&(u.placement===PlacementEnum.Above?m=VF$c.Modifier.Position.ABOVE:u.placement===PlacementEnum.Below&&(m=VF$c.Modifier.Position.BELOW)),g){case ArticulationEnum.accent:{d=new VF$c.Articulation("a>");break}case ArticulationEnum.downbow:{d=new VF$c.Articulation("am"),u.placement===void 0&&(m=VF$c.Modifier.Position.ABOVE);break}case ArticulationEnum.fermata:{d=new VF$c.Articulation("a@a"),m=VF$c.Modifier.Position.ABOVE;break}case ArticulationEnum.marcatodown:{d=new VF$c.Articulation("a|");break}case ArticulationEnum.marcatoup:{d=new VF$c.Articulation("a^");break}case ArticulationEnum.invertedfermata:{d=new VF$c.Articulation("a@u"),m=VF$c.Modifier.Position.BELOW;break}case ArticulationEnum.lefthandpizzicato:{d=new VF$c.Articulation("a+");break}case ArticulationEnum.naturalharmonic:{d=new VF$c.Articulation("ah");break}case ArticulationEnum.snappizzicato:{d=new VF$c.Articulation("ao");break}case ArticulationEnum.staccatissimo:{d=new VF$c.Articulation("av");break}case ArticulationEnum.staccato:{d=new VF$c.Articulation("a.");break}case ArticulationEnum.tenuto:{d=new VF$c.Articulation("a-");break}case ArticulationEnum.upbow:{d=new VF$c.Articulation("a|"),u.placement===void 0&&(m=VF$c.Modifier.Position.ABOVE);break}case ArticulationEnum.strongaccent:{d=new VF$c.Articulation("a^");break}}d&&(!t.hasStem()&&!t.isRest()&&g==ArticulationEnum.accent&&t.getLineNumber()>=3&&(m=VF$c.Modifier.Position.ABOVE,(s=(r=t==null?void 0:t.modifiers)==null?void 0:r.filter(S=>["TREMOLO"].includes(S.getCategory().toLocaleUpperCase())))!=null&&s.length&&d.setYShift(-16)),g===ArticulationEnum.strongaccent&&(m=VF$c.Modifier.Position.ABOVE,(o=window.GYM)!=null&&o.customArtPosition&&(t.getStemDirection()===1?m=VF$c.Modifier.Position.ABOVE:(m=VF$c.Modifier.Position.BELOW,d=new VF$c.Articulation("a|")))),(a=window.GYM)!=null&&a.customAccentItem&&g===ArticulationEnum.accent&&(m=VF$c.Modifier.Position.ABOVE),(l=window.GYM)!=null&&l.customLefthandpizzicatoItem&&(g===ArticulationEnum.lefthandpizzicato||g===ArticulationEnum.naturalharmonic)&&(m=VF$c.Modifier.Position.ABOVE),g===ArticulationEnum.tenuto&&t.getDuration()==="w"&&((c=window.GYM)!=null&&c.customTenutoItem)&&(m=VF$c.Modifier.Position.ABOVE),d.setPosition(m),t.addModifier(0,d))}}static generateOrnaments(t,e){let i=VF$c.Modifier.Position.ABOVE;e.placement===PlacementEnum.Below&&(i=VF$c.Modifier.Position.BELOW);let r;switch(e.GetOrnament){case OrnamentEnum.DelayedInvertedTurn:{r=new VF$c.Ornament("turn_inverted"),r.setDelayed(!0);break}case OrnamentEnum.DelayedTurn:{r=new VF$c.Ornament("turn"),r.setDelayed(!0);break}case OrnamentEnum.InvertedMordent:{r=new VF$c.Ornament("mordent"),r.setDelayed(!1);break}case OrnamentEnum.InvertedTurn:{r=new VF$c.Ornament("turn_inverted"),r.setDelayed(!1);break}case OrnamentEnum.Mordent:{r=new VF$c.Ornament("mordent_inverted"),r.setDelayed(!1);break}case OrnamentEnum.Trill:{r=new VF$c.Ornament("tr"),r.setDelayed(!1);break}case OrnamentEnum.Turn:{r=new VF$c.Ornament("turn"),r.setDelayed(!1);break}default:{loglevelExports.warn("unhandled OrnamentEnum type: "+e.GetOrnament);return}}r&&(e.AccidentalBelow!==AccidentalEnum.NONE&&r.setLowerAccidental(Pitch.accidentalVexflow(e.AccidentalBelow)),e.AccidentalAbove!==AccidentalEnum.NONE&&r.setUpperAccidental(Pitch.accidentalVexflow(e.AccidentalAbove)),r.setPosition(i),t.addModifier(0,r))}static StrokeTypeFromArpeggioType(t){switch(t){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}}static CreateTabNote(t){const e=[],i=t.notes.reverse(),r=[],s=t.notes[0].graphicalNoteLength,o=t.notes[0].sourceNote.NoteTuplet!==void 0;let a=_VexFlowConverter.durations(s,o)[0],l=0;for(const u of t.notes){const m=u.sourceNote,d={str:m.StringNumberTab,fret:m.FretNumber};e.push(d),m.BendArray&&m.BendArray.forEach(function(g){let y;const b=g.bendalter-d.fret;b>1?y="Full":b===1?y="1/2":y="1/4",g.direction==="up"?r.push({type:VF$c.Bend.UP,text:y,width:10}):r.push({type:VF$c.Bend.DOWN,text:y,width:10})}),l(t[t.VA8=0]="VA8",t[t.VB8=1]="VB8",t[t.MA15=2]="MA15",t[t.MB15=3]="MB15",t[t.NONE=4]="NONE",t))(OctaveEnum||{});class AbstractTempoExpression extends AbstractExpression{constructor(e,i,r,s){super(i),this.label=e,this.staffNumber=r,this.parentMultiTempoExpression=s}get Label(){return this.label}set Label(e){this.label=e}get Placement(){return this.placement}set Placement(e){this.placement=e}get StaffNumber(){return this.staffNumber}set StaffNumber(e){this.staffNumber=e}get ParentMultiTempoExpression(){return this.parentMultiTempoExpression}static isStringInStringList(e,i){for(const r of e)if(AbstractTempoExpression.stringContainsSeparatedWord(i.toLowerCase().trim(),r.toLowerCase().trim()))return!0;return!1}static stringContainsSeparatedWord(e,i){return e===i||e.indexOf(" "+i)!==-1||e.indexOf(i+" ")!==-1}}const _InstantaneousTempoExpression=class extends AbstractTempoExpression{constructor(t,e,i,r,s,o=!1){super(t,e,i,s),this.setTempoAndTempoType(r)}static getDefaultValueForTempoType(t){switch(t){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")}}static isInputStringInstantaneousTempo(t){return t?_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghissimo,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoGrave,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLento,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLargo,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghetto,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagio,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagietto,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndanteModerato,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndante,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndantino,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoModerato,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegretto,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegroModerato,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegro,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivace,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivacissimo,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegrissimo,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPresto,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPrestissimo,t)||_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoChangesGeneral,t):!1}get Label(){return this.label}set Label(t){this.label=t}get Placement(){return this.placement}set Placement(t){this.placement=t}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t}get Enum(){return this.tempoEnum}get TempoInBpm(){return this.tempoInBpm}set TempoInBpm(t){this.tempoInBpm=t}get ParentMultiTempoExpression(){return this.parentMultiTempoExpression}getAbsoluteTimestamp(){return Fraction$1.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp)}getAbsoluteFloatTimestamp(){return Fraction$1.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp).RealValue}setTempoAndTempoType(t){if(!this.label){this.tempoInBpm=t,this.tempoEnum=23;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghissimo,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(1)),this.tempoInBpm=t,this.tempoEnum=1;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoGrave,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(2)),this.tempoInBpm=t,this.tempoEnum=2;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLento,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(3)),this.tempoInBpm=t,this.tempoEnum=3;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLargo,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(4)),this.tempoInBpm=t,this.tempoEnum=4;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoLarghetto,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(5)),this.tempoInBpm=t,this.tempoEnum=5;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagio,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(6)),this.tempoInBpm=t,this.tempoEnum=6;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAdagietto,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(7)),this.tempoInBpm=t,this.tempoEnum=7;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndanteModerato,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(8)),this.tempoInBpm=t,this.tempoEnum=8;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndante,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(9)),this.tempoInBpm=t,this.tempoEnum=9;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAndantino,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(10)),this.tempoInBpm=t,this.tempoEnum=10;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoModerato,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(11)),this.tempoInBpm=t,this.tempoEnum=11;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegretto,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(12)),this.tempoInBpm=t,this.tempoEnum=12;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegroModerato,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(13)),this.tempoInBpm=t,this.tempoEnum=13;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegro,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(14)),this.tempoInBpm=t,this.tempoEnum=14;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivace,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(15)),this.tempoInBpm=t,this.tempoEnum=15;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoVivacissimo,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(16)),this.tempoInBpm=t,this.tempoEnum=16;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAllegrissimo,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(17)),this.tempoInBpm=t,this.tempoEnum=17;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPresto,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(18)),this.tempoInBpm=t,this.tempoEnum=18;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoPrestissimo,this.label)){t===0&&(t=_InstantaneousTempoExpression.getDefaultValueForTempoType(19)),this.tempoInBpm=t,this.tempoEnum=19;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoAddons,this.label)){this.tempoInBpm=0,this.tempoEnum=21;return}if(_InstantaneousTempoExpression.isStringInStringList(_InstantaneousTempoExpression.listInstantaneousTempoChangesGeneral,this.label)){this.tempoInBpm=0,this.tempoEnum=22;return}}};let 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=(t=>(t[t.none=0]="none",t[t.larghissimo=1]="larghissimo",t[t.grave=2]="grave",t[t.lento=3]="lento",t[t.largo=4]="largo",t[t.larghetto=5]="larghetto",t[t.adagio=6]="adagio",t[t.adagietto=7]="adagietto",t[t.andanteModerato=8]="andanteModerato",t[t.andante=9]="andante",t[t.andantino=10]="andantino",t[t.moderato=11]="moderato",t[t.allegretto=12]="allegretto",t[t.allegroModerato=13]="allegroModerato",t[t.allegro=14]="allegro",t[t.vivace=15]="vivace",t[t.vivacissimo=16]="vivacissimo",t[t.allegrissimo=17]="allegrissimo",t[t.presto=18]="presto",t[t.prestissimo=19]="prestissimo",t[t.lastRealTempo=20]="lastRealTempo",t[t.addon=21]="addon",t[t.changes=22]="changes",t[t.metronomeMark=23]="metronomeMark",t))(TempoEnum||{});const _MoodExpression=class extends AbstractExpression{constructor(t,e,i){super(e),this.label=t,this.staffNumber=i,this.setMoodType()}static isInputStringMood(t){return t?_MoodExpression.isStringInStringList(_MoodExpression.listMoodAffettuoso,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodAgitato,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodAnimato,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodAppassionato,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodBrillante,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodCantabile,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodDolce,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodEnergico,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodEroico,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodEspressivo,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodFurioso,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGiocoso,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGioioso,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrandioso,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrazioso,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodLacrimoso,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodLeggiero,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMaestoso,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMalinconico,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarcato,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarziale,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMesto,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodMorendo,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodNobilmente,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodPatetico,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodPesante,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSaltando,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSautille,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodScherzando,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSostenuto,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodSpiccato,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodTenerezza,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodTranquillamente,t)||_MoodExpression.isStringInStringList(_MoodExpression.listMoodTrionfante,t):!1}get Label(){return this.label}set Label(t){this.label=t}get Mood(){return this.moodType}set Mood(t){this.moodType=t}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t}get Placement(){return this.placement}set Placement(t){this.placement=t}setMoodType(){_MoodExpression.isStringInStringList(_MoodExpression.listMoodAffettuoso,this.label)?this.moodType=0:_MoodExpression.isStringInStringList(_MoodExpression.listMoodAgitato,this.label)?this.moodType=1:_MoodExpression.isStringInStringList(_MoodExpression.listMoodAnimato,this.label)?this.moodType=3:_MoodExpression.isStringInStringList(_MoodExpression.listMoodAppassionato,this.label)?this.moodType=2:_MoodExpression.isStringInStringList(_MoodExpression.listMoodBrillante,this.label)?this.moodType=4:_MoodExpression.isStringInStringList(_MoodExpression.listMoodCantabile,this.label)?this.moodType=5:_MoodExpression.isStringInStringList(_MoodExpression.listMoodDolce,this.label)?this.moodType=6:_MoodExpression.isStringInStringList(_MoodExpression.listMoodEnergico,this.label)?this.moodType=7:_MoodExpression.isStringInStringList(_MoodExpression.listMoodEroico,this.label)?this.moodType=8:_MoodExpression.isStringInStringList(_MoodExpression.listMoodEspressivo,this.label)?this.moodType=9:_MoodExpression.isStringInStringList(_MoodExpression.listMoodFurioso,this.label)?this.moodType=10:_MoodExpression.isStringInStringList(_MoodExpression.listMoodGiocoso,this.label)?this.moodType=11:_MoodExpression.isStringInStringList(_MoodExpression.listMoodGioioso,this.label)?this.moodType=12:_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrandioso,this.label)?this.moodType=14:_MoodExpression.isStringInStringList(_MoodExpression.listMoodGrazioso,this.label)?this.moodType=15:_MoodExpression.isStringInStringList(_MoodExpression.listMoodLacrimoso,this.label)?this.moodType=13:_MoodExpression.isStringInStringList(_MoodExpression.listMoodLeggiero,this.label)?this.moodType=16:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMaestoso,this.label)?this.moodType=17:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMalinconico,this.label)?this.moodType=18:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarcato,this.label)?this.moodType=19:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMarziale,this.label)?this.moodType=20:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMesto,this.label)?this.moodType=21:_MoodExpression.isStringInStringList(_MoodExpression.listMoodMorendo,this.label)?this.moodType=22:_MoodExpression.isStringInStringList(_MoodExpression.listMoodNobilmente,this.label)?this.moodType=23:_MoodExpression.isStringInStringList(_MoodExpression.listMoodPatetico,this.label)?this.moodType=24:_MoodExpression.isStringInStringList(_MoodExpression.listMoodPesante,this.label)?this.moodType=25:_MoodExpression.isStringInStringList(_MoodExpression.listMoodSaltando,this.label)?this.moodType=27:_MoodExpression.isStringInStringList(_MoodExpression.listMoodSautille,this.label)?this.moodType=26:_MoodExpression.isStringInStringList(_MoodExpression.listMoodScherzando,this.label)?this.moodType=28:_MoodExpression.isStringInStringList(_MoodExpression.listMoodSostenuto,this.label)?this.moodType=29:_MoodExpression.isStringInStringList(_MoodExpression.listMoodSpiccato,this.label)?this.moodType=30:_MoodExpression.isStringInStringList(_MoodExpression.listMoodTenerezza,this.label)?this.moodType=31:_MoodExpression.isStringInStringList(_MoodExpression.listMoodTranquillamente,this.label)?this.moodType=32:_MoodExpression.isStringInStringList(_MoodExpression.listMoodTrionfante,this.label)&&(this.moodType=33)}};let 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"];class UnknownExpression extends AbstractExpression{constructor(e,i,r,s){super(i),this.label=e,this.staffNumber=s,r===void 0&&(r=TextAlignmentEnum.LeftBottom),this.textAlignment=r}get Label(){return this.label}get Placement(){return this.placement}set Placement(e){this.placement=e}get StaffNumber(){return this.staffNumber}set StaffNumber(e){this.staffNumber=e}get TextAlignment(){return this.textAlignment}}class MultiExpression{constructor(e,i){this.unknownList=[],this.moodList=[],this.expressions=[],this.sourceMeasure=e,this.timestamp=i}get SourceMeasureParent(){return this.sourceMeasure}set SourceMeasureParent(e){this.sourceMeasure=e}get StaffNumber(){return this.staffNumber}set StaffNumber(e){this.staffNumber=e}get Timestamp(){return this.timestamp}set Timestamp(e){this.timestamp=e}get AbsoluteTimestamp(){return Fraction$1.plus(this.timestamp,this.sourceMeasure.AbsoluteTimestamp)}get InstantaneousDynamic(){return this.instantaneousDynamic}set InstantaneousDynamic(e){this.instantaneousDynamic=e}get EndingContinuousDynamic(){return this.endingContinuousDynamic}set EndingContinuousDynamic(e){this.endingContinuousDynamic=e}get StartingContinuousDynamic(){return this.startingContinuousDynamic}set StartingContinuousDynamic(e){this.startingContinuousDynamic=e}get MoodList(){return this.moodList}get UnknownList(){return this.unknownList}get EntriesList(){return this.expressions}get OctaveShiftStart(){return this.octaveShiftStart}set OctaveShiftStart(e){this.octaveShiftStart=e}get OctaveShiftEnd(){return this.octaveShiftEnd}set OctaveShiftEnd(e){this.octaveShiftEnd=e}get CombinedExpressionsText(){return this.combinedExpressionsText}set CombinedExpressionsText(e){this.combinedExpressionsText=e}getPlacementOfFirstEntry(){let e=PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].expression instanceof InstantaneousDynamicExpression?e=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof ContinuousDynamicExpression?e=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof MoodExpression?e=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof UnknownExpression&&(e=this.expressions[0].expression.Placement)),e}getFontstyleOfFirstEntry(){var i;let e=FontStyles.Regular;return this.expressions.length>0&&(this.expressions[0].expression instanceof ContinuousDynamicExpression||this.expressions[0].expression instanceof MoodExpression?e=FontStyles.Italic:this.expressions[0].expression instanceof UnknownExpression&&(e=(i=this.expressions[0].expression.fontStyle)!=null?i:FontStyles.Regular)),e}addExpression(e,i){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,i)}CompareTo(e){return this.Timestamp.RealValue>e.Timestamp.RealValue?1:this.Timestamp.RealValue=5&&t<=12}get TempoType(){return this.tempoType}set TempoType(t){this.tempoType=t}get StartTempo(){return this.startTempo}set StartTempo(t){this.startTempo=t}get EndTempo(){return this.endTempo}set EndTempo(t){this.endTempo=t}get AbsoluteEndTimestamp(){return this.absoluteEndTimestamp}set AbsoluteEndTimestamp(t){this.absoluteEndTimestamp=t}get AbsoluteTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp}getAbsoluteFloatTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp.RealValue}getInterpolatedTempo(t){const e=Fraction$1.plus(this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.parentMultiTempoExpression.Timestamp);if(t.lt(e))return-1;if(this.absoluteEndTimestamp.lt(t))return-2;const i=Fraction$1.minus(t,e).RealValue/Fraction$1.minus(this.absoluteEndTimestamp,e).RealValue;return Math.max(0,Math.min(250,this.startTempo+(this.endTempo-this.startTempo)*i))}setTempoType(){_ContinuousTempoExpression.isStringInStringList(_ContinuousTempoExpression.listContinuousTempoFaster,this.label)?this.tempoType=0:_ContinuousTempoExpression.isStringInStringList(_ContinuousTempoExpression.listContinuousTempoSlower,this.label)&&(this.tempoType=9)}};let 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"];class MultiTempoExpression{constructor(e,i){this.expressions=[],this.sourceMeasure=e,this.timestamp=i}get Timestamp(){return this.timestamp}get AbsoluteTimestamp(){return Fraction$1.plus(this.sourceMeasure.AbsoluteTimestamp,this.timestamp)}get SourceMeasureParent(){return this.sourceMeasure}set SourceMeasureParent(e){this.sourceMeasure=e}get InstantaneousTempo(){return this.instantaneousTempo}get ContinuousTempo(){return this.continuousTempo}get EntriesList(){return this.expressions}get CombinedExpressionsText(){return this.combinedExpressionsText}set CombinedExpressionsText(e){this.combinedExpressionsText=e}getPlacementOfFirstEntry(){let e=PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].Expression instanceof InstantaneousTempoExpression?e=this.expressions[0].Expression.Placement:this.expressions[0].Expression instanceof ContinuousTempoExpression&&(e=this.expressions[0].Expression.Placement)),e}getFontstyleOfFirstEntry(){let e=FontStyles.Regular;return this.expressions[0].Expression instanceof InstantaneousTempoExpression?e=FontStyles.Bold:this.expressions[0].Expression instanceof ContinuousTempoExpression&&(e=FontStyles.Italic),e}addExpression(e,i){if(this.checkIfAlreadyExists(e))return;e instanceof InstantaneousTempoExpression?this.instantaneousTempo=e:e instanceof ContinuousTempoExpression&&(this.continuousTempo=e);const r=new TempoExpressionEntry;r.prefix=i,r.Expression=e,r.label=e.Label,this.expressions.push(r)}CompareTo(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}calculateSystemYLayout(){for(const e of this.musicSystems)this.optimizeDistanceBetweenStaffLines(e);this.calculateMusicSystemsRelativePositions()}setMeasureWidth(e,i,r,s){for(let o=0,a=e.length;o0&&(l.beginInstructionsWidth=r),s>0&&(l.endInstructionsWidth=s)}}finalizeCurrentAndCreateNewSystem(e,i=!1,r=!0,s=!1){this.finalizeCurrentSystem(e,i,r,s),this.currentSystemParams=new SystemBuildParameters,e!==void 0&&this.measureListIndex=1){const i=this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length-1];let r=0;const s=e[e.length-1];s.endLine===SystemLinesEnum.DotsBoldBoldDots&&(s.endLine=SystemLinesEnum.DotsThinBold,r=i[0].getLineWidth(SystemLinesEnum.DotsBoldBoldDots)/2-i[0].getLineWidth(SystemLinesEnum.DotsThinBold)),this.currentSystemParams.currentSystemFixWidth-=r;for(let o=0,a=i.length;o1){a=!0;break}}let l=0;for(let c=0;c=0&&this.measureList[M]){const I=(_=this.measureList[M][0])==null?void 0:_.parentSourceMeasure;I!=null&&I.ImplicitMeasure&&(I!=null&&I.RhythmPrinted)&&(P=!1)}P&&(i.addRhythmAtBegin(u),i.parentSourceMeasure.RhythmPrinted=u,y=!0)}return(d||g||y)&&(a+=i.beginInstructionsWidth,y&&(a+=this.rules.RhythmRightMargin)),a}addInstructionsAtMeasureEnd(e,i,r){if(!e||!e.Instructions||e.Instructions.length===0)return 0;for(let s=0,o=e.Instructions.length;s0&&(this.currentSystemParams.systemMeasures.push({beginLine:SystemLinesEnum.None,endLine:SystemLinesEnum.None}),this.currentSystemParams.currentWidth+=s,this.currentSystemParams.currentSystemFixWidth+=s)}addExtraInstructionMeasure(e,i,r){const s=this.currentSystemParams.currentSystem,o=MusicSheetCalculator.symbolFactory.createExtraGraphicalMeasure(s.StaffLines[e]);i&&o.addKeyAtBegin(i,this.activeKeys[e],this.activeClefs[e]),r!==void 0&&r.PrintObject&&o.addRhythmAtBegin(r),o.PositionAndShape.BorderLeft=0,o.PositionAndShape.BorderTop=0,o.PositionAndShape.BorderBottom=this.rules.StaffHeight;const a=this.rules.MeasureLeftMargin+o.beginInstructionsWidth+this.rules.MeasureRightMargin;return o.PositionAndShape.BorderRight=a,s.StaffLines[e].Measures.push(o),a}addStaveMeasuresToSystem(e){if(e[0]){const i=[];for(let s=0;s1){const l=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,e.measureListIndex+e.multipleRestMeasures-1);e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[l]}}finally{}const i=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures,r=i[this.measureListIndex];let s=!1;return r.allRests&&(s=(a=(o=i[this.measureListIndex+r.multipleRestMeasures-1])==null?void 0:o.endsWithLineRepetition)==null?void 0:a.call(o)),this.nextMeasureBeginsLineRepetition()&&this.thisMeasureEndsLineRepetition()?SystemLinesEnum.DotsBoldBoldDots:this.thisMeasureEndsLineRepetition()||s?SystemLinesEnum.DotsThinBold:this.nextMeasureHasKeyInstructionChange()||this.thisMeasureEndsWordRepetition()||this.nextMeasureBeginsWordRepetition()?SystemLinesEnum.DoubleThin:e&&e.endingBarStyleEnum!==void 0?e.endingBarStyleEnum:SystemLinesEnum.SingleThin}getLineWidth(e,i,r){let s=e.getLineWidth(i);return i===SystemLinesEnum.DotsBoldBoldDots&&(s/=2),r&&i===SystemLinesEnum.BoldThinDots&&(s+=this.rules.DistanceBetweenLastInstructionAndRepetitionBarline),s}previousMeasureEndsLineRepetition(){if(this.measureListIndex===0)return!1;for(let e=0,i=this.measureList[this.measureListIndex-1].length;e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||!this.measureList[e])return!1;for(let i=0,r=this.measureList[e].length;i=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||e>this.measureList.length-1)return!1;for(let i=0,r=this.measureList[e].length;i1)for(let l=1;lo&&(o=m)}for(let l=0;lthis.rules.PageHeight-this.rules.PageBottomMargin&&(s++,s<=4&&console.log(`warning: could not fit a single system on page ${e.PageNumber} and measure number ${r.GraphicalMeasures[0][0].MeasureNumber}. The PageFormat may be too small for this sheet." Will not give further warnings for all pages, only total.`))}else{const c=this.musicSystems[l-1],u=c.StaffLines[c.StaffLines.length-1],m=u.PositionAndShape;let d=this.findRequiredDistanceWithSkyBottomLine(c,r);d=Math.max(o,d),d+=this.rules.MinSkyBottomDistBetweenSystems,((a=window==null?void 0:window.appName)==null?void 0:a.toLocaleUpperCase())==="GYM"&&(d=d<16?16:d);const g=this.hasExpressionCounts(r);g.TempoCount>0&&this.rules.MetronomeMarksDrawn&&(d+=2),g.OtherCount>0&&this.rules.MetronomeMarksDrawn&&(d+=2),d=Math.max(d,this.rules.MinimumDistanceBetweenSystems+u.StaffHeight);const y=i+m.RelativePosition.y+d,b=y+r.PositionAndShape.BorderMarginBottom;if(!(this.rules.NewPageAtXMLNewPageAttribute&&c.breaksPage)&&b0&&console.log(`total amount of pages that couldn't fit a single music system: ${s} of ${e.PageNumber}`)}findRequiredDistanceWithSkyBottomLine(e,i){const r=e.StaffLines[e.StaffLines.length-1],s=i.StaffLines[0],o=r.BottomLine,a=s.SkyLine,l=r.PositionAndShape,c=s.PositionAndShape,u=1/this.rules.SamplingUnit;let m=0;for(let d=0;d=a.length)break;const b=Math.max(0,y-6),S=Math.min(a.length-1,y+6);let E=0;for(let A=b;A<=S;A++)E=Math.min(E,a[A]);const x=g-E;m=Math.max(x,m)}return m===0&&(m=l.BorderBottom-c.BorderTop),m}}class SystemBuildParameters{constructor(){this.systemMeasures=[],this.systemMeasureIndex=0,this.currentWidth=0,this.currentSystemFixWidth=0,this.currentSystemVarWidth=0,this.maxLabelLength=0}IsSystemStartMeasure(){return this.systemMeasureIndex===0}}class OctaveShiftParams{constructor(e,i,r){this.getOpenOctaveShift=e,this.getAbsoluteStartTimestamp=i,this.getAbsoluteEndTimestamp=r}}class AccidentalCalculator{constructor(){this.keySignatureNoteAlterationsDict=new Dictionary,this.currentAlterationsComparedToKeyInstructionList=[],this.currentInMeasureNoteAlterationsDict=new Dictionary}get ActiveKeyInstruction(){return this.activeKeyInstruction}set ActiveKeyInstruction(e){this.activeKeyInstruction=e,this.reactOnKeyInstructionChange()}doCalculationsAtEndOfMeasure(){this.currentInMeasureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.clear();for(const e of this.keySignatureNoteAlterationsDict.keys())this.currentInMeasureNoteAlterationsDict.setValue(e,this.keySignatureNoteAlterationsDict.getValue(e))}checkAccidental(e,i){if(!i)return;const r=i.FundamentalNote+i.Octave*12,s=this.currentAlterationsComparedToKeyInstructionList.indexOf(r)>=0;if(this.currentInMeasureNoteAlterationsDict.containsKey(r)){if(s&&this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(r),1),this.currentInMeasureNoteAlterationsDict.getValue(r)!==i.AccidentalHalfTones){this.keySignatureNoteAlterationsDict.containsKey(r)&&this.keySignatureNoteAlterationsDict.getValue(r)!==i.AccidentalHalfTones?(this.currentAlterationsComparedToKeyInstructionList.push(r),this.currentInMeasureNoteAlterationsDict.setValue(r,i.AccidentalHalfTones)):i.Accidental!==AccidentalEnum.NONE&&this.currentInMeasureNoteAlterationsDict.remove(r);const o=this.currentInMeasureNoteAlterationsDict.getValue(r);if(i.Accidental===AccidentalEnum.NONE&&(Math.abs(o)===.5?i=new Pitch(i.FundamentalNote,i.Octave,AccidentalEnum.NONE):i=new Pitch(i.FundamentalNote,i.Octave,AccidentalEnum.NATURAL)),this.isAlterAmbiguousAccidental(i.Accidental)&&!i.AccidentalXml)return;MusicSheetCalculator.symbolFactory.addGraphicalAccidental(e,i)}}else if(i.Accidental!==AccidentalEnum.NONE){if(s||this.currentAlterationsComparedToKeyInstructionList.push(r),this.currentInMeasureNoteAlterationsDict.setValue(r,i.AccidentalHalfTones),this.isAlterAmbiguousAccidental(i.Accidental)&&!i.AccidentalXml)return;MusicSheetCalculator.symbolFactory.addGraphicalAccidental(e,i)}else s&&(i=new Pitch(i.FundamentalNote,i.Octave,AccidentalEnum.NATURAL),this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(r),1),MusicSheetCalculator.symbolFactory.addGraphicalAccidental(e,i))}isAlterAmbiguousAccidental(e){return e===AccidentalEnum.SLASHFLAT||e===AccidentalEnum.QUARTERTONEFLAT}reactOnKeyInstructionChange(){const e=this.activeKeyInstruction.AlteratedNotes;let i;this.activeKeyInstruction.Key>0?i=AccidentalEnum.SHARP:i=AccidentalEnum.FLAT,this.keySignatureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.length=0;for(let r=-9;r<9;r++)for(let s=0;s0?(r=m-1,e.push({startIndex:i,endIndex:r}),i=m):y.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(r=m,e.push({startIndex:i,endIndex:r}),i=m+1)}i0?Number(N):6,T===N||P+D>S&&T%2===0?(o.push(T),P=I,T=1):T++}else P>S?(o.push(T),P=I,T=1):T++;I>S?G=M+1:G=Math.ceil(G),A===G?_+=1:(s.push(_),A=G,_=1)}s.push(_),o.push(T),o=o.filter(Boolean)}return o.length>1&&o[o.length-1]===1&&(o[o.length-2]=o[o.length-2]-1,o[o.length-1]=o[o.length-1]+1),console.log(o,s),this.buildPreparedMusicSystems(o)}buildPreparedMusicSystems(e){let i=!1;this.currentSystemParams=new SystemBuildParameters,this.currentSystemParams.currentSystem=this.initMusicSystem();for(let r=0,s=this.measureList.length;r0&&this.rules.RenderMultipleRestMeasures){d.isReducedToMultiRest=!0,d.multipleRestMeasureNumber=1;const y=d.multipleRestMeasures-1;u+=y;for(let b=1;b<=y;b++){const S=e.SourceMeasures[d.MeasureNumber-1+b];S.multipleRestMeasureNumber=b+1,S.isReducedToMultiRest=!0,i.push([void 0])}}}if(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures&&this.rules.RenderMultipleRestMeasures){let u,m=0;for(let d=0,g=e.SourceMeasures.length;d0){u.isReducedToMultiRest=!0,u.multipleRestMeasureNumber=1,m++,y.multipleRestMeasureNumber=m,y.isReducedToMultiRest=!0;for(let b=0;b1){u.multipleRestMeasures=m;const b=this.createGraphicalMeasuresForSourceMeasure(u,r,o,l,s);i[u.measureListIndex]=b,m=0,u=void 0}else m=0,u=void 0}if(m>1){u.multipleRestMeasures=m,u.isReducedToMultiRest=!0;const d=this.createGraphicalMeasuresForSourceMeasure(u,r,o,l,s);i[u.measureListIndex]=d,m=0,u=void 0}}const c=s.map(u=>u.ClefType===ClefEnum.percussion);this.handleStaffEntries(c),this.calculateVerticalContainersList(),this.setIndicesToVerticalGraphicalContainers()}calculate(){this.musicSystems=[],this.clearSystemsAndMeasures(),this.clearRecreatedObjects(),this.createGraphicalTies(),this.calculateSheetLabelBoundingBoxes(),this.calculateXLayout(this.graphicalMusicSheet,this.maxInstrNameLabelLength()),this.graphicalMusicSheet.MusicPages.length=0,this.calculateMusicSystems(),GraphicalMusicSheet.transformRelativeToAbsolutePosition(this.graphicalMusicSheet)}calculateXLayout(e,i){let r=0;const s=this.rules.MaxInstructionsConstValue;if(this.graphicalMusicSheet.MeasureList.length>0){let o=this.graphicalMusicSheet.MeasureList[0],a=this.calculateMeasureXLayout(o);a=this.calculateMeasureWidthFromStaffEntries(o,a),MusicSheetCalculator.setMeasuresMinStaffEntriesWidth(o,a),r=a*1.2+i+s;for(let l=1;l0)return;const a=i.Measures[o];(a.MeasureNumber===0||a.MeasureNumber===1)&&(r=a.MeasureNumber),a!==i.Measures[0]&&this.rules.MeasureNumberLabelXOffset?s=this.rules.MeasureNumberLabelXOffset:s=0;const l=this.rules.UseXMLMeasureNumbers&&a.MeasureNumber===1&&a.parentSourceMeasure.getPrintedMeasureNumber()!==1;((a.MeasureNumber===r||a.MeasureNumber>=r+this.rules.MeasureNumberLabelOffset)&&!a.parentSourceMeasure.ImplicitMeasure||l)&&((a.MeasureNumber!==1||a.MeasureNumber===1&&a!==i.Measures[0]||l)&&this.calculateSingleMeasureNumberPlacement(a,i,e,s),r=a.MeasureNumber)}}calculateSingleMeasureNumberPlacement(e,i,r,s=0){const o=e.parentSourceMeasure.getPrintedMeasureNumber().toString(),a=new Label(o),l=new GraphicalLabel(a,this.rules.MeasureNumberLabelHeight,TextAlignmentEnum.LeftBottom,this.rules),c=i.SkyBottomLineCalculator;l.setLabelPositionAndShapeBorders(),l.PositionAndShape.Parent=r.PositionAndShape;const u=i.PositionAndShape.RelativePosition.x+e.PositionAndShape.RelativePosition.x-l.PositionAndShape.BorderMarginLeft+s;let m,d=u,g=u-l.PositionAndShape.BorderLeft+l.PositionAndShape.BorderRight;d-=i.PositionAndShape.RelativePosition.x,g-=i.PositionAndShape.RelativePosition.x;const y=d+.5,b=g-.5,S=c.getSkyLineMinInRange(y,b);if(e===i.Measures[0]){let E=0;if(r.GroupBrackets.length>0)for(const x of r.GroupBrackets)E=Math.min(E,x.PositionAndShape.BorderTop);m=Math.min(S,E)}else m=S;m=Math.min(0,m),l.PositionAndShape.RelativePosition=new PointF2D(u,m),r.MeasureNumberLabels.push(l)}calculateMeasureNumberSkyline(e){const i=e.StaffLines[0];for(const r of e.MeasureNumberLabels){let s=r.PositionAndShape.RelativePosition.x,o=s-r.PositionAndShape.BorderLeft+r.PositionAndShape.BorderRight;s-=i.PositionAndShape.RelativePosition.x,o-=i.PositionAndShape.RelativePosition.x,i.SkyBottomLineCalculator.updateSkyLineInRange(s,o,r.PositionAndShape.RelativePosition.y+r.PositionAndShape.BorderMarginTop)}}layoutGraphicalTie(e,i,r){throw new Error(this.abstractNotImplementedErrorMessage)}calculateSingleStaffLineLyricsPosition(e,i){let r=0,s=this.rules.StaffHeight;const o=[],a=e.SkyBottomLineCalculator;let l=e.Measures.length;for(let u=0;u0){o.push(b),r=Math.max(r,b.LyricsEntries.length);const S=b.PositionAndShape.RelativePosition.x+d.x;let E=Number.MAX_VALUE,x=Number.MIN_VALUE;for(let _=0;_0){const u=e.PositionAndShape.Size.width;let m=o[0].PositionAndShape.RelativePosition.x+o[0].PositionAndShape.BorderMarginLeft+o[0].parentMeasure.PositionAndShape.RelativePosition.x;m=m>u?u:m,a.updateBottomLineInRange(m,u,c)}return o}calculateLyricsExtendsAndDashes(e){for(let i=0,r=e.length;i0||e.UnknownList.length>0){let c="";for(let y=0,b=e.EntriesList.length;ye.length-1&&(loglevelExports.debug("minimum measure to draw index out of range. resetting min measure index to limit."),this.rules.MinMeasureToDrawIndex=e.length-1);const i=[];for(let a=this.rules.MinMeasureToDrawIndex,l=e.length;a0)&&(s=r.getSkyLineMinInRange(d,g));let y=0;l===0?(y+=this.rules.ChordSymbolYOffset,y+=.1):y+=this.rules.ChordSymbolYPadding,y*=-1;const b=c.GraphicalLabel;b.PositionAndShape.RelativePosition.y=s+y,b.setLabelPositionAndShapeBorders(),b.PositionAndShape.calculateBoundingBox(),r.updateSkyLineInRange(d,g,s+b.PositionAndShape.BorderMarginTop)}}}}calculateAlignedChordSymbolsOffset(e,i){let r=Number.MAX_SAFE_INTEGER;for(const s of e)for(const o of s.graphicalChordContainers){const a=s.PositionAndShape,l=o.PositionAndShape,c=l.BorderMarginLeft+a.AbsolutePosition.x,u=l.BorderMarginRight+a.AbsolutePosition.x;r=Math.min(r,i.getSkyLineMinInRange(c,u))}return r}layoutMeasureWithWholeRest(e,i,r){}layoutBeams(e){}layoutArticulationMarks(e,i,r){}layoutOrnament(e,i,r){}calculateRestNotePlacementWithinGraphicalBeam(e,i,r,s,o){}calculateTupletNumbers(){}calculateSlurs(){}calculateDynamicExpressionsForMultiExpression(e,i,r){}calculateGraphicalVerbalContinuousDynamic(e,i){const r=e.Label,s=i.x+r.PositionAndShape.BorderMarginLeft,o=i.x+r.PositionAndShape.BorderMarginRight,a=e.ContinuousDynamic.Placement,c=e.ParentStaffLine.SkyBottomLineCalculator;let u;a===PlacementEnum.Below?(u=c.getBottomLineMaxInRange(s,o),r.PositionAndShape.RelativePosition=new PointF2D(i.x,u-r.PositionAndShape.BorderMarginTop)):(u=c.getSkyLineMinInRange(s,o),r.PositionAndShape.RelativePosition=new PointF2D(i.x,u-r.PositionAndShape.BorderMarginBottom))}calculateGraphicalContinuousDynamic(e,i){var R,H,O;const r=e.ParentStaffLine.ParentStaff.idInMusicSheet,s=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(e.ContinuousDynamic.EndMultiExpression.SourceMeasureParent,r);if(!s){loglevelExports.warn("MusicSheetCalculator.calculateGraphicalContinuousDynamic: No endMeasure found");return}e.EndMeasure=s;const o=e.ParentStaffLine,a=s.ParentStaffLine,l=a&&o===a;let c=!1;a?c=a==null?void 0:a.isPartOfMultiStaffInstrument():o&&(c=o==null?void 0:o.isPartOfMultiStaffInstrument());const u=Fraction$1.createFromFraction(e.ContinuousDynamic.EndMultiExpression.AbsoluteTimestamp),m=this.graphicalMusicSheet.GetVerticalContainerFromTimestamp(u),d=m.getFirstNonNullStaffEntry().parentMeasure,g=d.PositionAndShape.AbsolutePosition.x+d.PositionAndShape.BorderRight;let y=new Fraction$1(0,0,0);for(const V of m.StaffEntries){const k=(R=V==null?void 0:V.sourceStaffEntry)==null?void 0:R.calculateMaxNoteLength();k!=null&&k.gt(y)&&(y=k)}const b=this.getRelativePositionInStaffLineFromTimestamp(u,r,a,c,0),S=Fraction$1.plus(u,y),E=this.getRelativePositionInStaffLineFromTimestamp(S,r,a,c,0);E.x>b.x&&E.x_){const Z=A.StaffLines[V].PositionAndShape.RelativePosition.y-o.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;N=this.rules.StaffHeight+Z/2}else N=this.rules.WedgePlacementBelowY;N-=this.rules.WedgeOpeningLength/2,l||(z=N);let k=P.getBottomLineMaxInRange(I,G);if(k>N&&(N=k),_z&&(z=k),z+=this.rules.WedgeOpeningLength/2,z+=this.rules.WedgeVerticalMargin),N+=this.rules.WedgeOpeningLength/2,N+=this.rules.WedgeVerticalMargin}else if(T===PlacementEnum.Above){if(o.ParentStaff.ParentInstrument.Staves.length===1)N=this.rules.WedgePlacementAboveY;else{let k=0;_>0&&(k=_-1);const F=A.StaffLines[k];N=-(o.PositionAndShape.RelativePosition.y-F.PositionAndShape.RelativePosition.y-this.rules.StaffHeight)/2}N+=this.rules.WedgeOpeningLength/2,l||(z=N);let V=P.getSkyLineMinInRange(I,G);if(V1&&_>0){const k=o.findClosestStaffEntry(I),F=o.findClosestStaffEntry(G);k&&F&&k.parentVerticalContainer}l||(V=a.SkyBottomLineCalculator.getSkyLineMinInRange(D,$),V-d/2?c=-d/2:c=u-e.PositionAndShape.BorderMarginBottom}else c=u-e.PositionAndShape.BorderMarginBottom;e.PositionAndShape.RelativePosition=new PointF2D(i.x,c)}else if(e.Placement===PlacementEnum.Below){const u=l.getBottomLineMaxInRange(o,a),m=s.ParentStaff.ParentInstrument.Staves[s.ParentStaff.ParentInstrument.Staves.length-1];if(s.isPartOfMultiStaffInstrument()&&s.ParentStaff!==m){const g=s.ParentMusicSystem.StaffLines[s.ParentMusicSystem.StaffLines.indexOf(s)+1].PositionAndShape.RelativePosition.y-s.PositionAndShape.RelativePosition.y-this.rules.StaffHeight,y=e.PositionAndShape.BorderMarginBottom;u+ye.PositionAndShape.Size.width&&(g=e.PositionAndShape.Size.width-this.rules.MeasureRightMargin,d=g-u.PositionAndShape.MarginSize.width,i.x=d-u.PositionAndShape.BorderMarginLeft);let y;const b=e.SkyBottomLineCalculator;return o===PlacementEnum.Below?y=b.getBottomLineMaxInRange(d,g):y=b.getSkyLineMinInRange(d,g),u.PositionAndShape.RelativePosition=new PointF2D(i.x,y),o===PlacementEnum.Below?b.updateBottomLineInRange(d,g,u.PositionAndShape.BorderMarginBottom+y):b.updateSkyLineInRange(d,g,u.PositionAndShape.BorderMarginTop+y),u}calculateTempoExpressionsForMultiTempoExpression(e,i,r,s){metronomeMarks={};const o=Fraction$1.plus(e.AbsoluteTimestamp,i.Timestamp),a=this.graphicalMusicSheet.MeasureList[r];let l=new PointF2D;if(i.ContinuousTempo||i.InstantaneousTempo){if(this.rules.MinMeasureToDrawIndex>0||!a[0])return;let c=a[0].ParentStaffLine,u=a[0].PositionAndShape.RelativePosition.x,m=0;for(let d=0;d0){c=a[d].ParentStaffLine,u=a[d].PositionAndShape.RelativePosition.x,m=d;break}if(l=this.getRelativePositionInStaffLineFromTimestamp(o,m,c,c.isPartOfMultiStaffInstrument(),u),i.EntriesList.length>0&&i.EntriesList[0].Expression instanceof InstantaneousTempoExpression){const d=i.EntriesList[0].Expression;if(d.Placement=PlacementEnum.Above,c.Measures[0].staffEntries.length>0&&Math.abs(l.x-c.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x)===0&&c.ParentMusicSystem===this.musicSystems[0]){const g=c.Measures[0].FirstInstructionStaffEntry;if(g){const y=g.GraphicalInstructions.last();l.x=y.PositionAndShape.RelativePosition.x}this.rules.CompactMode&&(l.x=c.PositionAndShape.RelativePosition.x+c.Measures[0].PositionAndShape.RelativePosition.x)}}for(const d of i.EntriesList){let g=TextAlignmentEnum.CenterBottom;this.rules.CompactMode&&(g=TextAlignmentEnum.LeftBottom);const y=this.calculateLabel(c,l,d.label,i.getFontstyleOfFirstEntry(),d.Expression.Placement,this.rules.UnknownTextHeight,g);if(d.Expression instanceof InstantaneousTempoExpression){for(const S of c.AbstractExpressions)S instanceof GraphicalInstantaneousTempoExpression&&(S.SourceExpression.Label,d.Expression.Label);new GraphicalInstantaneousTempoExpression(d.Expression,y).ParentStaffLine||loglevelExports.warn("Adding staffline didn't work"),d.Expression.Enum===TempoEnum.metronomeMark&&(metronomeMarks[r]=d.Expression)}else d.Expression instanceof ContinuousTempoExpression;if(s===e.TempoExpressions.length-1)for(const b of Object.values(metronomeMarks))this.createMetronomeMark(b,r)}}}createMetronomeMark(e,i){throw new Error(this.abstractNotImplementedErrorMessage)}graphicalMeasureCreatedCalculations(e){}clearSystemsAndMeasures(){for(let e=0,i=this.graphicalMusicSheet.MusicPages.length;e-1&&g.PositionAndShape.ChildElements.splice(y,1),g.FirstInstructionStaffEntry=void 0,g.beginInstructionsWidth=0}if(g.LastInstructionStaffEntry){const y=g.PositionAndShape.ChildElements.indexOf(g.LastInstructionStaffEntry.PositionAndShape);y>-1&&g.PositionAndShape.ChildElements.splice(y,1),g.LastInstructionStaffEntry=void 0,g.endInstructionsWidth=0}}u.Measures=[],u.PositionAndShape.ChildElements=[]}a.StaffLines.length=0,a.PositionAndShape.ChildElements=[]}r.MusicSystems=[],r.PositionAndShape.ChildElements=[]}this.graphicalMusicSheet.MusicPages=[]}handleVoiceEntry(e,i,r,s,o,a,l,c,u,m=void 0,d=void 0){e.StemDirectionXml!==StemDirectionType.Undefined&&this.rules.SetWantedStemDirectionByXml&&e.StemDirectionXml!==void 0?e.WantedStemDirection=e.StemDirectionXml:this.calculateStemDirectionFromVoices(e);const g=i.findOrCreateGraphicalVoiceEntry(e);g.octaveShiftValue=c;const y=i.tabStaffEntry;let b;y&&(b=y.findOrCreateGraphicalVoiceEntry(e));for(let S=0,E=e.Notes.length;S-1)continue;let A;if(e.IsGrace?A=MusicSheetCalculator.symbolFactory.createGraceNote(x,g,o,this.rules,c):(A=MusicSheetCalculator.symbolFactory.createNote(x,g,o,c,this.rules,void 0),MusicSheetCalculator.stafflineNoteCalculator.trackNote(A)),x.Pitch&&this.checkNoteForAccidental(A,r,o,c),this.resetYPositionForLeadSheet(A.PositionAndShape),i.addGraphicalNoteToListAtCorrectYPosition(g,A),A.PositionAndShape.calculateBoundingBox(),this.leadSheet||(x.NoteBeam!==void 0&&x.PrintObject&&this.handleBeam(A,x.NoteBeam,l),x.NoteTuplet!==void 0&&x.PrintObject&&this.handleTuplet(A,x.NoteTuplet,a)),b){const _=MusicSheetCalculator.symbolFactory.createNote(x,b,o,c,this.rules,void 0);y.addGraphicalNoteToListAtCorrectYPosition(b,_),_.PositionAndShape.calculateBoundingBox(),this.leadSheet||x.NoteTuplet&&this.handleTuplet(_,x.NoteTuplet,a)}}return e.Articulations.length>0&&this.handleVoiceEntryArticulations(e.Articulations,e,i),e.TechnicalInstructions.length>0&&this.handleVoiceEntryTechnicalInstructions(e.TechnicalInstructions,e,i),e.LyricsEntries.size()>0&&this.handleVoiceEntryLyrics(e,i,s),e.OrnamentContainer&&this.handleVoiceEntryOrnaments(e.OrnamentContainer,e,i),c}resetYPositionForLeadSheet(e){this.leadSheet&&(e.RelativePosition=new PointF2D(e.RelativePosition.x,0))}layoutVoiceEntries(e,i){if(e.PositionAndShape.RelativePosition=new PointF2D(0,0),!this.leadSheet)for(const r of e.graphicalVoiceEntries){const s=r.notes;if(s.length===0)continue;const o=s[0].sourceNote.ParentVoiceEntry,a=s[0].sourceNote.Pitch!==void 0;this.layoutVoiceEntry(o,s,e,a)}}maxInstrNameLabelLength(){var i;let e=0;for(const r of this.graphicalMusicSheet.ParentMusicSheet.Instruments)if((i=r.NameLabel)!=null&&i.print&&r.Voices.length>0&&r.Voices[0].Visible){let s=r.NameLabel;this.rules.RenderPartNames||(s=new Label("",s.textAlignment,s.font));const o=new GraphicalLabel(s,this.rules.InstrumentLabelTextHeight,TextAlignmentEnum.LeftCenter,this.rules);o.setLabelPositionAndShapeBorders(),e=Math.max(e,o.PositionAndShape.MarginSize.width)}return this.rules.RenderPartNames?e:0}calculateSheetLabelBoundingBoxes(){var s;const e=this.graphicalMusicSheet.ParentMusicSheet,i=this.rules.DefaultColorTitle;if(e.Title!==void 0&&this.rules.RenderTitle){const o=new GraphicalLabel(e.Title,this.rules.SheetTitleHeight,TextAlignmentEnum.CenterBottom,this.rules);o.Label.IsCreditLabel=!0,o.Label.colorDefault=i,this.graphicalMusicSheet.Title=o,o.setLabelPositionAndShapeBorders()}else this.rules.RenderTitle||(this.graphicalMusicSheet.Title=void 0);if(e.Subtitle!==void 0&&this.rules.RenderSubtitle){const o=new GraphicalLabel(e.Subtitle,this.rules.SheetSubtitleHeight,TextAlignmentEnum.CenterCenter,this.rules);o.Label.IsCreditLabel=!0,o.Label.colorDefault=i,this.graphicalMusicSheet.Subtitle=o,o.setLabelPositionAndShapeBorders()}else this.rules.RenderSubtitle||(this.graphicalMusicSheet.Subtitle=void 0);if(e.Composer!==void 0&&this.rules.RenderComposer){const o=new GraphicalLabel(e.Composer,this.rules.SheetComposerHeight,TextAlignmentEnum.RightCenter,this.rules);o.Label.IsCreditLabel=!0,o.Label.colorDefault=i,this.graphicalMusicSheet.Composer=o,o.setLabelPositionAndShapeBorders()}else this.rules.RenderComposer||(this.graphicalMusicSheet.Composer=void 0);if(e.Lyricist!==void 0&&this.rules.RenderLyricist){const o=new GraphicalLabel(e.Lyricist,this.rules.SheetAuthorHeight,TextAlignmentEnum.LeftCenter,this.rules);o.Label.IsCreditLabel=!0,o.Label.colorDefault=i,this.graphicalMusicSheet.Lyricist=o,o.setLabelPositionAndShapeBorders()}else this.rules.RenderLyricist||(this.graphicalMusicSheet.Lyricist=void 0);const r=(s=this.graphicalMusicSheet.musicSheet.sourceMeasures)==null?void 0:s[0];if(r&&r.FirstInstructionsStaffEntries.length>0){const o=r.FirstInstructionsStaffEntries[0];let a,l;for(let c=0,u=o.Instructions.length;c0&&m.graphicalVoiceEntries[0].notes.length===1){const d=m.graphicalVoiceEntries[0].notes[0];!d.sourceNote.Pitch&&new Fraction$1(1,2).lt(d.sourceNote.Length)&&this.layoutMeasureWithWholeRest(d,m,u)}}}}}}optimizeRestNotePlacement(e,i){if(e.graphicalVoiceEntries.length===0)return;const r=e.graphicalVoiceEntries[0].notes;if(r.length===0)return;const s=r[0],o=s.sourceNote.isRest();if(e.graphicalVoiceEntries.length===2){let a=!1;const l=e.graphicalVoiceEntries[1].notes;l.length>0&&(a=l[0].sourceNote.isRest()),o&&a?this.calculateTwoRestNotesPlacementWithCollisionDetection(e):(o||a)&&this.calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(e)}else if(o&&e!==i.staffEntries[0]&&e!==i.staffEntries[i.staffEntries.length-1]){const a=i.staffEntries.indexOf(e),l=i.staffEntries[a-1],c=i.staffEntries[a+1];if(l.graphicalVoiceEntries.length===1){const u=l.graphicalVoiceEntries[0].notes[0];if(u.sourceNote.NoteBeam!==void 0&&c.graphicalVoiceEntries.length===1){const m=c.graphicalVoiceEntries[0].notes[0];m.sourceNote.NoteBeam!==void 0&&u.sourceNote.NoteBeam===m.sourceNote.NoteBeam&&(this.calculateRestNotePlacementWithinGraphicalBeam(e,s,u,c,m),e.PositionAndShape.calculateBoundingBox())}}}}getRelativePositionInStaffLineFromTimestamp(e,i,r,s,o=0){let a=new PointF2D,l,c;const u=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,m=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(e),d=Math.min(Math.floor(m),u-1),g=Math.min(Math.ceil(m),u-1);if(d<0||i<0)return a;if(l=this.getFirstLeftNotNullStaffEntryFromContainer(d,i,s),c=this.getFirstRightNotNullStaffEntryFromContainer(g,i,s),l&&c){let y=l.parentMeasure.PositionAndShape.RelativePosition.x;o>0&&(y=o);let b=l.PositionAndShape.RelativePosition.x+y,S=c.PositionAndShape.RelativePosition.x+c.parentMeasure.PositionAndShape.RelativePosition.x;o>0&&(S=c.PositionAndShape.RelativePosition.x+y);let E=0;if(l!==c){const x=l.getAbsoluteTimestamp(),A=c.getAbsoluteTimestamp();E=Fraction$1.minus(e,x).RealValue/Fraction$1.minus(A,x).RealValue}l.parentMeasure.ParentStaffLine!==c.parentMeasure.ParentStaffLine&&(l.parentMeasure.ParentStaffLine===r?S=r.PositionAndShape.Size.width:b=r.PositionAndShape.RelativePosition.x),a=new PointF2D(b+(S-b)*E,0)}return a}getRelativeXPositionFromTimestamp(e){const i=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,r=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(e),s=Math.max(0,Math.min(Math.round(r),i-1)),o=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[s].getFirstNonNullStaffEntry();return o.PositionAndShape.RelativePosition.x+o.parentMeasure.PositionAndShape.RelativePosition.x}calculatePageLabels(e){var a;this.rules.RenderSingleHorizontalStaffline&&(e.PositionAndShape.BorderRight=e.PositionAndShape.Size.width,e.PositionAndShape.calculateBoundingBox(),this.graphicalMusicSheet.ParentMusicSheet.pageWidth=e.PositionAndShape.Size.width);let i=10;if(e.MusicSystems.length>0){const l=e.MusicSystems[0];i=l.PositionAndShape.RelativePosition.y+l.PositionAndShape.BorderTop}if(this.graphicalMusicSheet.Title){const l=this.graphicalMusicSheet.Title;l.PositionAndShape.Parent=e.PositionAndShape;const c=new PointF2D;c.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,c.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight,l.PositionAndShape.RelativePosition=c,e.Labels.push(l)}if(this.graphicalMusicSheet.Subtitle){const l=this.graphicalMusicSheet.Subtitle;l.PositionAndShape.Parent=e.PositionAndShape;const c=new PointF2D;c.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,c.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight+this.rules.SheetMinimumDistanceBetweenTitleAndSubtitle,l.PositionAndShape.RelativePosition=c,e.Labels.push(l)}const r=this.graphicalMusicSheet.Composer;let s;if(r){r.PositionAndShape.Parent=e.PositionAndShape,r.setLabelPositionAndShapeBorders();const l=new PointF2D;l.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageRightMargin,l.y=i,l.y-=this.rules.SystemComposerDistance;const c=(a=r.TextLines)==null?void 0:a.length;c>1&&(l.y-=r.PositionAndShape.BorderBottom*(c-1)/c),s=l.y,r.PositionAndShape.RelativePosition=l,e.Labels.push(r)}const o=this.graphicalMusicSheet.Lyricist;if(o){o.PositionAndShape.Parent=e.PositionAndShape,o.setLabelPositionAndShapeBorders();const l=new PointF2D;l.x=this.rules.PageLeftMargin,l.y=i,l.y+=o.PositionAndShape.BorderBottom,l.y=Math.min(l.y,s!=null?s:Number.MAX_SAFE_INTEGER),o.PositionAndShape.RelativePosition=l,e.Labels.push(o)}}createGraphicalTies(){for(let e=0;e=0&&this.staffEntriesWithGraphicalTies.push(o)}o=l}}setTieDirections(e){if(!e)return;const i=e.ties;if(i.length>1){let r;for(const s of i){const o=s.Notes[0];(!r||o.Pitch.getHalfTone()>r.Pitch.getHalfTone())&&(r=o)}for(const s of i)s.TieDirection===PlacementEnum.NotYetDefined&&(s.Notes[0]===r?s.TieDirection=PlacementEnum.Above:s.TieDirection=PlacementEnum.Below)}}createAccidentalCalculators(){const e=[],i=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(i)for(let r=0;r1)return;d=MusicSheetCalculator.symbolFactory.createGraphicalMeasure(e,m)}if(d.hasError=e.getErrorInMeasure(c),e.FirstInstructionsStaffEntries[c])for(let _=0,P=e.FirstInstructionsStaffEntries[c].Instructions.length;_0){const I=P.Instructions[0];MusicSheetCalculator.symbolFactory.createInStaffClef(T,I)}this.rules.RenderChordSymbols&&((A=P.ChordContainers)==null?void 0:A.length)>0&&(P.ParentStaff.ParentInstrument.HasChordSymbols=!0,MusicSheetCalculator.symbolFactory.createChordSymbols(P,T,s.ActiveKeyInstruction,this.graphicalMusicSheet.ParentMusicSheet.Transpose))}}if(s.doCalculationsAtEndOfMeasure(),e.LastInstructionsStaffEntries[c]){const _=e.LastInstructionsStaffEntries[c];for(let P=0,T=_.Instructions.length;P=1&&d.staffEntries.length===0){const _=new SourceStaffEntry(new VerticalSourceStaffEntryContainer(d.parentSourceMeasure,d.parentSourceMeasure.AbsoluteTimestamp,d.parentSourceMeasure.CompleteNumberOfStaves),m),P=new VoiceEntry(new Fraction$1(0,1),m.Voices[0],_),T=new Note$1(P,_,Fraction$1.createFromFraction(e.Duration),void 0,e);T.PrintObject=this.rules.FillEmptyMeasuresWithWholeRest===FillEmptyMeasuresWithWholeRests.YesVisible,P.addNote(T);const M=MusicSheetCalculator.symbolFactory.createStaffEntry(_,d);d.addGraphicalStaffEntry(M),M.relInMeasureTimestamp=P.Timestamp;const C=MusicSheetCalculator.symbolFactory.createVoiceEntry(P,M);M.graphicalVoiceEntries.push(C);const I=MusicSheetCalculator.symbolFactory.createNote(T,C,new ClefInstruction,OctaveEnum.NONE,void 0);MusicSheetCalculator.stafflineNoteCalculator.trackNote(I),C.notes.push(I)}d.hasOnlyRests=!0;for(const _ of d.staffEntries)if(d.hasOnlyRests=_.hasOnlyRests(),!d.hasOnlyRests)break;return d}checkNoteForAccidental(e,i,r,s){let o=e.sourceNote.Pitch;const a=e.parentVoiceEntry.parentStaffEntry.parentMeasure.getTransposedHalftones();a!==0&&e.sourceNote.ParentStaffEntry.ParentStaff.ParentInstrument.MidiInstrumentId!==MidiInstrument.Percussion&&(o=e.Transpose(i.ActiveKeyInstruction,r,a,s),e.sourceNote.TransposedPitch=o),e.sourceNote.halfTone=o.getHalfTone(),i.checkAccidental(e,o)}handleStaffEntries(e){for(let i=0,r=this.graphicalMusicSheet.MeasureList.length;i0&&c.graphicalVoiceEntries[0].notes.length>0&&(this.layoutVoiceEntries(c,o),this.layoutStaffEntry(c));this.graphicalMeasureCreatedCalculations(l)}}}}calculateSkyBottomLines(){for(const e of this.musicSystems)for(const i of e.StaffLines)i.SkyBottomLineCalculator.calculateLines()}calculateExpressionAlignements(){}calculateStaffEntryArticulationMarks(){for(let e=0,i=this.musicSystems.length;e0&&this.layoutArticulationMarks(S.Articulations,S,g)}}}}}}calculateOrnaments(){for(let e=0,i=this.musicSystems.length;e0&&s.LyricVersesNumbers.sort()}for(let i=0,r=this.musicSystems.length;i=0&&(s=i.GraphicalLyricsEntries[r+1]),!s)return;const o=e.StaffEntryParent.parentMeasure.ParentStaffLine,a=s.StaffEntryParent.parentMeasure.ParentStaffLine,l=e.StaffEntryParent,c=s.StaffEntryParent;if(e.StaffEntryParent.parentMeasure.ParentStaffLine===s.StaffEntryParent.parentMeasure.ParentStaffLine){const u=l.parentMeasure.PositionAndShape.RelativePosition.x+l.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,m=c.parentMeasure.PositionAndShape.RelativePosition.x+c.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.RelativePosition.x+s.GraphicalLabel.PositionAndShape.BorderMarginLeft,d=e.GraphicalLabel.PositionAndShape.RelativePosition.y;let g=1;m-u>this.rules.MinimumDistanceBetweenDashes*3&&(g=Math.floor((m-u)/this.rules.MinimumDistanceBetweenDashes)-1),g===1?this.calculateSingleDashForLyricWord(o,u,m,d):this.calculateDashes(o,u,m,d)}else{const u=l.parentMeasure.PositionAndShape.RelativePosition.x+l.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,m=o.Measures[o.Measures.length-1],d=m.PositionAndShape.RelativePosition.x+m.PositionAndShape.Size.width;let g=e.GraphicalLabel.PositionAndShape.RelativePosition.y;if(this.calculateDashes(o,u,d,g),a&&a.Measures[0]&&c.parentMeasure.ParentStaffLine&&!(c===c.parentMeasure.staffEntries[0]&&c.parentMeasure===c.parentMeasure.ParentStaffLine.Measures[0])){const y=a.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,b=c.parentMeasure.PositionAndShape.RelativePosition.x+c.PositionAndShape.RelativePosition.x+s.GraphicalLabel.PositionAndShape.BorderMarginLeft;g=s.GraphicalLabel.PositionAndShape.RelativePosition.y,this.calculateDashes(a,y,b,g)}}}calculateDashes(e,i,r,s){let o=r-i;if(oi;)o=this.calculateRightAndLeftDashesForLyricWord(e,i,r,s),i+=l,r-=l,c++;o>l*2&&this.calculateSingleDashForLyricWord(e,i,r,s)}}calculateSingleDashForLyricWord(e,i,r,s){const o=new Label("-"),a=new GraphicalLabel(o,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);a.setLabelPositionAndShapeBorders(),e.LyricsDashes.push(a),this.staffLinesWithLyricWords.indexOf(e)===-1&&this.staffLinesWithLyricWords.push(e),a.PositionAndShape.Parent=e.PositionAndShape;const l=new PointF2D(i+(r-i)/2,s);a.PositionAndShape.RelativePosition=l}calculateLyricExtend(e){let i=e.GraphicalLabel.PositionAndShape.RelativePosition.y;const r=e.StaffEntryParent,s=r.parentMeasure.ParentStaffLine;let o,a;const l=r.parentMeasure.ParentStaff.idInMusicSheet;for(let c=r.parentVerticalContainer.Index+1;c0)break;o=u,a=o.parentMeasure.ParentStaffLine,a||(a=r.parentMeasure.ParentStaffLine)}}if(!(!o||!a))if(s===a&&o.parentMeasure.ParentStaffLine){const c=r.parentMeasure.PositionAndShape.RelativePosition.x+r.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,u=o.parentMeasure.PositionAndShape.RelativePosition.x+o.PositionAndShape.RelativePosition.x+o.PositionAndShape.BorderMarginRight;i-=e.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(s,c,u,i)}else{const c=s.Measures[s.Measures.length-1].PositionAndShape,u=r.parentMeasure.PositionAndShape.RelativePosition.x+r.PositionAndShape.RelativePosition.x+e.GraphicalLabel.PositionAndShape.BorderMarginRight,m=c.RelativePosition.x+c.Size.width;if(i-=e.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(s,u,m,i),!o)return;if(o.parentMeasure.ParentStaffLine&&o.parentMeasure.staffEntries&&!(o===o.parentMeasure.staffEntries[0]&&o.parentMeasure===o.parentMeasure.ParentStaffLine.Measures[0])){const d=a.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,g=o.parentMeasure.PositionAndShape.RelativePosition.x+o.PositionAndShape.RelativePosition.x+o.PositionAndShape.BorderMarginRight;this.calculateSingleLyricWordWithUnderscore(a,d,g,i)}}}calculateSingleLyricWordWithUnderscore(e,i,r,s){const o=new PointF2D(i,s),a=new PointF2D(r,s),l=new GraphicalLine(o,a,this.rules.LyricUnderscoreLineWidth);e.LyricLines.push(l),this.staffLinesWithLyricWords.indexOf(e)===-1&&this.staffLinesWithLyricWords.push(e)}calculateRightAndLeftDashesForLyricWord(e,i,r,s){const o=new Label("-"),a=new GraphicalLabel(o,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);a.setLabelPositionAndShapeBorders(),e.LyricsDashes.push(a),this.staffLinesWithLyricWords.indexOf(e)===-1&&this.staffLinesWithLyricWords.push(e),a.PositionAndShape.Parent=e.PositionAndShape;const l=new PointF2D(i,s);a.PositionAndShape.RelativePosition=l;const c=new Label("-"),u=new GraphicalLabel(c,this.rules.LyricsHeight,TextAlignmentEnum.CenterBottom,this.rules);u.setLabelPositionAndShapeBorders(),e.LyricsDashes.push(u),u.PositionAndShape.Parent=e.PositionAndShape;const m=new PointF2D(r,s);return u.PositionAndShape.RelativePosition=m,u.PositionAndShape.RelativePosition.x-a.PositionAndShape.RelativePosition.x}calculateDynamicExpressions(){const e=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex),i=Math.min(this.rules.MinMeasureToDrawIndex,this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length);for(let r=i;r<=e;r++){const s=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[r];this.dynamicExpressionMap.clear();for(let o=0;o=0;a--)if((o=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[a])!=null&&o.StaffEntries[i])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[a].StaffEntries[i]}getFirstRightNotNullStaffEntryFromContainer(e,i,r){var s,o;if((s=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[e])!=null&&s.StaffEntries[i])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[e].StaffEntries[i];for(let a=e+1;a0||i.StaffLinkedExpressions[r][s].UnknownList.length>0)&&this.calculateMoodAndUnknownExpression(i.StaffLinkedExpressions[r][s],e,r)}}calculateStemDirectionFromVoices(e){if(e.ParentSourceStaffEntry.Link!==void 0)if(e===e.ParentSourceStaffEntry.VoiceEntries[0]){e.WantedStemDirection=StemDirectionType.Up;return}else{e.WantedStemDirection=StemDirectionType.Down;return}else e.ParentVoice instanceof LinkedVoice?e.WantedStemDirection=StemDirectionType.Down:e.ParentSourceStaffEntry.VoiceEntries.length>1&&(e.WantedStemDirection=StemDirectionType.Up)}setBeamNotesWantedStemDirections(e){if(!(e.Notes.length>0))return;const i=e.Notes[0].NoteBeam;if(i){for(const r of i.Notes)if(r.ParentVoiceEntry.WantedStemDirection!==StemDirectionType.Undefined&&r.ParentVoiceEntry.ParentSourceStaffEntry.ParentStaff.Id===e.ParentSourceStaffEntry.ParentStaff.Id){e.WantedStemDirection=r.ParentVoiceEntry.WantedStemDirection;break}}}}class ChordSymbolContainer{constructor(e,i,r,s,o){this.rootPitch=e,this.chordKind=i,this.bassPitch=r,this.degrees=s,this.rules=o}get RootPitch(){return this.rootPitch}get ChordKind(){return this.chordKind}get BassPitch(){return this.bassPitch}get ChordDegrees(){return this.degrees}static calculateChordText(e,i,r){let s=e.RootPitch;if(MusicSheetCalculator.transposeCalculator&&(s=MusicSheetCalculator.transposeCalculator.transposePitch(e.RootPitch,r,i)),e.ChordKind===31)return e.getTextFromChordKindEnum(e.ChordKind);let o=Pitch.getNoteEnumString(s.FundamentalNote);s.Accidental!==AccidentalEnum.NONE&&(o+=this.getTextForAccidental(s.Accidental));const a={adds:[],alts:[],subs:[]};for(const m of e.ChordDegrees)if(m){let d="";switch(m.alteration!==AccidentalEnum.NONE&&(d+=this.getTextForAccidental(m.alteration)),d+=m.value,m.text){case 0:a.adds.push(d);break;case 1:a.alts.push(d);break;case 2:a.subs.push(d);break}}let l=e.getTextFromChordKindEnum(e.ChordKind);const c=["adds","alts","subs"],u=e.rules.CustomChords;for(const m of u){if(m.chordKind!==e.chordKind)continue;let d=!0;for(const g of c){for(const y of m.degrees[g]||[])if(a[g].indexOf(y)<0){d=!1;break}if(!d)break}if(d){for(const g of c)for(const y of m.degrees[g]||[])a[g].splice(a[g].indexOf(y),1);l=m.alternateName}}if(o+=l,a.adds.length>0&&(o+="("+a.adds.join(",")+")"),a.alts.length>0&&(o+="(alt "+a.alts.join(",")+")"),a.subs.length>0&&(o+="(omit "+a.subs.join(",")+")"),e.BassPitch){let m=e.BassPitch;MusicSheetCalculator.transposeCalculator&&(m=MusicSheetCalculator.transposeCalculator.transposePitch(e.BassPitch,r,i)),o+="/",o+=Pitch.getNoteEnumString(m.FundamentalNote),o+=this.getTextForAccidental(m.Accidental)}return o}static getTextForAccidental(e){let i="";switch(e){case AccidentalEnum.DOUBLEFLAT:i+="bb";break;case AccidentalEnum.FLAT:i+="b";break;case AccidentalEnum.SHARP:i+="#";break;case AccidentalEnum.DOUBLESHARP:i+="x";break}return i}getTextFromChordKindEnum(e){var i;return(i=this.rules.ChordSymbolLabelTexts.getValue(e))!=null?i:""}}class Degree{constructor(e,i,r){this.value=e,this.alteration=i,this.text=r}}class CustomChord{constructor(e,i,r){this.alternateName=e,this.chordKind=i,this.degrees=r}static createCustomChord(e,i,r){return new CustomChord(e,i,r)}static renameCustomChord(e,i,r){for(const s of r)s.alternateName===e&&(s.alternateName=i)}}var ChordDegreeText=(t=>(t[t.add=0]="add",t[t.alter=1]="alter",t[t.subtract=2]="subtract",t))(ChordDegreeText||{}),ChordSymbolEnum=(t=>(t[t.major=0]="major",t[t.minor=1]="minor",t[t.augmented=2]="augmented",t[t.diminished=3]="diminished",t[t.dominant=4]="dominant",t[t.majorseventh=5]="majorseventh",t[t.minorseventh=6]="minorseventh",t[t.diminishedseventh=7]="diminishedseventh",t[t.augmentedseventh=8]="augmentedseventh",t[t.halfdiminished=9]="halfdiminished",t[t.majorminor=10]="majorminor",t[t.majorsixth=11]="majorsixth",t[t.minorsixth=12]="minorsixth",t[t.dominantninth=13]="dominantninth",t[t.majorninth=14]="majorninth",t[t.minorninth=15]="minorninth",t[t.dominant11th=16]="dominant11th",t[t.major11th=17]="major11th",t[t.minor11th=18]="minor11th",t[t.dominant13th=19]="dominant13th",t[t.major13th=20]="major13th",t[t.minor13th=21]="minor13th",t[t.suspendedsecond=22]="suspendedsecond",t[t.suspendedfourth=23]="suspendedfourth",t[t.Neapolitan=24]="Neapolitan",t[t.Italian=25]="Italian",t[t.French=26]="French",t[t.German=27]="German",t[t.pedal=28]="pedal",t[t.power=29]="power",t[t.Tristan=30]="Tristan",t[t.none=31]="none",t))(ChordSymbolEnum||{});class GraphicalNote extends GraphicalObject{constructor(e,i,r,s=void 0){super(),this.DrawnAccidental=AccidentalEnum.NONE,this.lineShift=0,this.sourceNote=e,this.parentVoiceEntry=i,this.PositionAndShape=new BoundingBox$1(this,i.PositionAndShape),s?this.graphicalNoteLength=s:this.graphicalNoteLength=e.Length,this.numberOfDots=this.calculateNumberOfNeededDots(this.graphicalNoteLength),this.rules=r,this.rules.addGraphicalNoteToNoteMap(e,this)}Transpose(e,i,r,s){let o=this.sourceNote.Pitch;return MusicSheetCalculator.transposeCalculator&&(o=MusicSheetCalculator.transposeCalculator.transposePitch(this.sourceNote.Pitch,e,r)),o}calculateNumberOfNeededDots(e){return!this.sourceNote||!this.sourceNote.NoteTuplet?e.calculateNumberOfNeededDots():0}get ParentMusicPage(){return this.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentMusicSystem.Parent}static FromNote(e,i){return i.NoteToGraphicalNoteMap.getValue(e.NoteToGraphicalNoteObjectId)}}const _EngravingRules=class{constructor(){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()}loadDefaultValues(){this.SamplingUnit=_EngravingRules.unit*3,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=_EngravingRules.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=_EngravingRules.unit/2,this.BeamSpaceWidth=_EngravingRules.unit/3,this.BeamForwardLength=1.25*_EngravingRules.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*_EngravingRules.unit,this.MeasureNumberLabelOffset=2,this.MeasureNumberLabelXOffset=-.5,this.TupletsRatioed=!1,this.TupletsBracketed=!1,this.TripletsBracketed=!1,this.TupletNumberLabelHeight=1.5*_EngravingRules.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=_EngravingRules.unit/2,this.SystemRepetitionEndingLineWidth=.12,this.SystemDotWidth=_EngravingRules.unit/2,this.DistanceBetweenVerticalSystemLines=.35,this.DistanceBetweenDotAndLine=.7,this.RepeatEndStartPadding=2,this.OctaveShiftLineWidth=.12,this.OctaveShiftVerticalLineLength=_EngravingRules.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,_EngravingRules.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)}applyDefaultColorMusic(t){this.DefaultColorMusic=t,this.DefaultColorNotehead=this.DefaultColorMusic,this.DefaultColorRest=this.DefaultColorNotehead,this.DefaultColorStem=this.DefaultColorNotehead,this.DefaultColorLabel=this.DefaultColorNotehead,this.DefaultColorTitle=this.DefaultColorNotehead,this.LedgerLineColorDefault=this.DefaultColorNotehead}addGraphicalNoteToNoteMap(t,e){t.NoteToGraphicalNoteObjectId=this.NoteToGraphicalNoteMapObjectCount,this.NoteToGraphicalNoteMap.setValue(t.NoteToGraphicalNoteObjectId,e),this.NoteToGraphicalNoteMapObjectCount++}GNote(t){return GraphicalNote.FromNote(t,this)}clearMusicSheetObjects(){this.NoteToGraphicalNoteMap=new Dictionary,this.NoteToGraphicalNoteMapObjectCount=0}setChordSymbolLabelText(t,e){this.ChordSymbolLabelTexts.setValue(t,e)}resetChordSymbolLabelTexts(t){return t.setValue(ChordSymbolEnum.minor,"m"),t.setValue(ChordSymbolEnum.augmented,"aug"),t.setValue(ChordSymbolEnum.diminished,"dim"),t.setValue(ChordSymbolEnum.dominant,"7"),t.setValue(ChordSymbolEnum.majorseventh,"maj7"),t.setValue(ChordSymbolEnum.minorseventh,"m7"),t.setValue(ChordSymbolEnum.diminishedseventh,"dim7"),t.setValue(ChordSymbolEnum.augmentedseventh,"aug7"),t.setValue(ChordSymbolEnum.halfdiminished,"m7b5"),t.setValue(ChordSymbolEnum.majorminor,"m(maj7)"),t.setValue(ChordSymbolEnum.majorsixth,"maj6"),t.setValue(ChordSymbolEnum.minorsixth,"m6"),t.setValue(ChordSymbolEnum.dominantninth,"9"),t.setValue(ChordSymbolEnum.majorninth,"maj9"),t.setValue(ChordSymbolEnum.minorninth,"m9"),t.setValue(ChordSymbolEnum.dominant11th,"11"),t.setValue(ChordSymbolEnum.major11th,"maj11"),t.setValue(ChordSymbolEnum.minor11th,"m11"),t.setValue(ChordSymbolEnum.dominant13th,"13"),t.setValue(ChordSymbolEnum.major13th,"maj13"),t.setValue(ChordSymbolEnum.minor13th,"m13"),t.setValue(ChordSymbolEnum.suspendedsecond,"sus2"),t.setValue(ChordSymbolEnum.suspendedfourth,"sus4"),t.setValue(ChordSymbolEnum.power,"5"),t.setValue(ChordSymbolEnum.none,"N.C."),t}addChordName(t,e,i,r,s){if(ChordSymbolEnum[e]!==void 0){const o={adds:i,alts:r,subs:s};this.CustomChords.push(CustomChord.createCustomChord(t,ChordSymbolEnum[e],o))}}renameChord(t,e){CustomChord.renameCustomChord(t,e,this.CustomChords)}resetChordNames(){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"],[],[])}calculateCurveParametersArrays(){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(let t=0;t(t[t.XML=0]="XML",t[t.AutoColoring=1]="AutoColoring",t[t.CustomColorSet=2]="CustomColorSet",t))(ColoringModes||{}),DrawingParametersEnum=(t=>(t.allon="allon",t.compact="compact",t.compacttight="compacttight",t.default="default",t.leadsheet="leadsheet",t.preview="preview",t.thumbnail="thumbnail",t))(DrawingParametersEnum||{});class DrawingParameters{constructor(e="default"){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=e}set DrawingParametersEnum(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;case"default":default:this.setForDefault()}}get DrawingParametersEnum(){return this.drawingParametersEnum}setForAllOn(){this.drawHighlights=!0,this.drawErrors=!0,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!0,this.drawScrollIndicator=!0,this.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}setForDefault(){this.rules.loadDefaultValues(),this.setForAllOn(),this.drawHiddenNotes=!1}setForThumbnail(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!1,this.drawSelectionStartSymbol=!1,this.drawCursors=!1,this.drawActivitySymbols=!1,this.drawScrollIndicator=!1,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0,this.drawHiddenNotes=!1}setForCompactMode(){this.rules.CompactMode=!0,this.DrawCredits=!1,this.drawHiddenNotes=!1}setForCompactTightMode(){this.setForCompactMode(),this.DrawPartNames=!1,this.rules.VoiceSpacingMultiplierVexflow=.65,this.rules.VoiceSpacingAddendVexflow=2,this.rules.MinSkyBottomDistBetweenStaves=1,this.rules.MinSkyBottomDistBetweenSystems=1,this.rules.BetweenStaffDistance=2.5,this.rules.StaffDistance=3.5,this.rules.MinimumDistanceBetweenSystems=1,this.rules.PageBottomMargin=0,this.rules.PageLeftMargin=2,this.rules.PageRightMargin=2}setForLeadsheet(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!1,this.drawScrollIndicator=!0,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0}get DrawCredits(){return this.drawCredits}set DrawCredits(e){this.drawCredits=e,this.DrawComposer=e,this.DrawTitle=e,this.DrawSubtitle=e,this.DrawLyricist=e}get DrawTitle(){return this.drawTitle}set DrawTitle(e){this.drawTitle=e,this.rules.RenderTitle=e,e||(this.DrawSubtitle=!1)}get DrawSubtitle(){return this.drawSubtitle}set DrawSubtitle(e){this.drawSubtitle=e,this.rules.RenderSubtitle=e,e&&(this.DrawTitle=!0)}get DrawComposer(){return this.drawComposer}set DrawComposer(e){this.drawComposer=e,this.rules.RenderComposer=e}get DrawLyricist(){return this.drawLyricist}set DrawLyricist(e){this.drawLyricist=e,this.rules.RenderLyricist=e}get DrawPartNames(){return this.drawPartNames}set DrawPartNames(e){this.drawPartNames=e,this.rules.RenderPartNames=e,this.rules.RenderPartNames||(this.rules.RenderPartAbbreviations=!1)}get FingeringPosition(){return this.fingeringPosition}set FingeringPosition(e){this.fingeringPosition=e,this.rules.FingeringPosition=e}get Rules(){return this.rules}set Rules(e){this.rules=e}}var AlignRestOption=(t=>(t[t.Never=0]="Never",t[t.Always=1]="Always",t[t.Auto=2]="Auto",t))(AlignRestOption||{}),FillEmptyMeasuresWithWholeRests=(t=>(t[t.No=0]="No",t[t.YesVisible=1]="YesVisible",t[t.YesInvisible=2]="YesInvisible",t))(FillEmptyMeasuresWithWholeRests||{}),BackendType=(t=>(t[t.SVG=0]="SVG",t[t.Canvas=1]="Canvas",t))(BackendType||{});class OSMDOptions{static OSMDOptionsStandard(){return{autoResize:!0,backend:"svg",drawingParameters:DrawingParametersEnum.default}}static BackendTypeFromString(e){return e&&e.toLowerCase()==="canvas"?1:0}}class IXmlElement{constructor(e){if(this.hasAttributes=!1,!e)throw new Error("IXmlElement: expected Element, got undefined");this.elem=e,this.name=e.nodeName.toLowerCase(),e.hasAttributes()&&(this.hasAttributes=!0,this.firstAttribute=e.attributes[0]),this.hasElements=e.hasChildNodes(),e.childNodes.length===1&&e.childNodes[0].nodeType===Node.TEXT_NODE?this.value=e.childNodes[0].nodeValue:this.value=""}attribute(e){return this.elem.attributes.getNamedItem(e)}attributes(){if(!this.attrs){const e=this.elem.attributes,i=[];for(let r=0;r0?this.Voices[0].Visible:!1}set Visible(e){for(let i=0,r=this.Voices.length;i-1&&this.parent.MusicSystems.splice(i,1)}this.parent=e,this.boundingBox.Parent=e.PositionAndShape}get NextSystem(){const e=this.Parent.MusicSystems.indexOf(this);return e!==this.Parent.MusicSystems.length?this.Parent.MusicSystems[e+1]:void 0}get StaffLines(){return this.staffLines}get GraphicalMeasures(){return this.graphicalMeasures}get MeasureNumberLabels(){return this.measureNumberLabels}get Labels(){return this.labels.values()}get ObjectsToRedraw(){return this.objectsToRedraw}get InstrumentBrackets(){return this.instrumentBrackets}get GroupBrackets(){return this.groupBrackets}get GraphicalMarkedAreas(){return this.graphicalMarkedAreas}get SystemLines(){return this.systemLines}get Id(){return this.id}createSystemLeftLine(e,i,r){let s=-e/2;r&&(s=this.maxLabelLength+i-e/2);const o=this.staffLines[0].Measures[0];let a;this.staffLines.length>1&&(a=this.staffLines[this.staffLines.length-1].Measures[0]);const l=this.createSystemLine(s,e,SystemLinesEnum.SingleThin,SystemLinePosition.MeasureBegin,this,o,a);this.SystemLines.push(l),l.PositionAndShape.RelativePosition=new PointF2D(s,0),l.PositionAndShape.BorderLeft=0,l.PositionAndShape.BorderRight=e,l.PositionAndShape.BorderTop=0,l.PositionAndShape.BorderBottom=this.boundingBox.Size.height,this.createLinesForSystemLine(l)}createVerticalLineForMeasure(e,i,r,s,o,a){const l=a.ParentStaffLine,c=new PointF2D(l.PositionAndShape.RelativePosition.x,l.PositionAndShape.RelativePosition.y),u=l.ParentStaff.ParentInstrument.Staves;if(l.ParentStaff===u[0]){let m;u.length>1&&(m=this.getBottomStaffLine(l).Measures[o]);const d=this.createSystemLine(e,i,r,s,this,a,m),g=c.x+e;d.PositionAndShape.RelativePosition=new PointF2D(g,0),d.PositionAndShape.BorderLeft=0,d.PositionAndShape.BorderRight=i,this.SystemLines.push(d)}}setYPositionsToVerticalLineObjectsAndCreateLines(e){}calculateBorders(e){}alignBeginInstructions(){}GetLeftBorderAbsoluteXPosition(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].Measures[0].beginInstructionsWidth}GetRightBorderAbsoluteXPosition(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].StaffLines[0].End.x}AddGraphicalMeasures(e){for(let i=0,r=e.length;i1){let a,l;for(let c=0,u=this.staffLines.length;cthis.maxLabelLength&&(this.maxLabelLength=m.PositionAndShape.Size.width,i=o)}this.updateMusicSystemStaffLineXPosition(i)}setMusicSystemLabelsYPosition(){this.labels.forEach((e,i)=>{let r=0,s=0;for(let o=0;o0&&(i.PositionAndShape.RelativePosition=new PointF2D(0,r/s+2))})}checkStaffEntriesForStaffEntryLink(){let e=!1,i=!1;for(let r=0;r=0;r--){if(i=e.InstrumentalGroups[r],i instanceof Instrument){if(i.Visible===!0)return i;continue}return this.findLastVisibleInstrumentInInstrumentalGroup(i)}}updateMusicSystemStaffLineXPosition(e){for(let i=0,r=this.StaffLines.length;i1}isVisible(){return this.ParentStaff.ParentInstrument.Visible}getGraphicalMeasureDurationFromStaffEntries(){let e=new Fraction$1(0,1);const i=[];for(let r=0,s=this.staffEntries.length;r0&&a.Add(c.notes[0].graphicalNoteLength);e.lt(a)&&(e=Fraction$1.createFromFraction(a))}return e}addGraphicalStaffEntry(e){this.staffEntries.push(e)}addGraphicalStaffEntryAtTimestamp(e){if(e)if(this.staffEntries.length===0||this.staffEntries[this.staffEntries.length-1].relInMeasureTimestamp.lt(e.relInMeasureTimestamp))this.staffEntries.push(e);else for(let i=this.staffEntries.length-1;i>=0;i--){if(this.staffEntries[i].relInMeasureTimestamp.lt(e.relInMeasureTimestamp)){this.staffEntries.splice(i+1,0,e);break}i===0&&this.staffEntries.splice(i,0,e)}}isPianoRightHand(){return this.isUpperStaffOfInstrument()}isPianoLeftHand(){return this.isLowerStaffOfInstrument()}isUpperStaffOfInstrument(){return this.parentStaff.ParentInstrument.Staves.length===1?!0:this.ParentStaff===this.parentStaff.ParentInstrument.Staves[0]}isLowerStaffOfInstrument(){return this.parentStaff.ParentInstrument.Staves.length===1?!1:this.ParentStaff===this.ParentStaff.ParentInstrument.Staves.last()}beginsWithLineRepetition(){const e=this.parentSourceMeasure;return e?e.beginsWithLineRepetition():!1}endsWithLineRepetition(){const e=this.parentSourceMeasure;return e?e.endsWithLineRepetition():!1}beginsWithWordRepetition(){const e=this.parentSourceMeasure;return e?e.beginsWithWordRepetition():!1}endsWithWordRepetition(){const e=this.parentSourceMeasure;return e?e.endsWithWordRepetition():!1}getTransposedHalftones(){return this.parentStaff.ParentInstrument.GetMusicSheet.Transpose+this.parentStaff.ParentInstrument.Transpose}}class VexFlowVoiceEntry extends GraphicalVoiceEntry{constructor(e,i){super(e,i)}applyBordersFromVexflow(){const e=this.vfStaveNote;if(!e.getNoteHeadBeginX)return;const i=e.getBoundingBox(),r=e.getNoteHeadBeginX()-i.x;this.PositionAndShape.RelativePosition.y=i.y/unitInPixels,this.PositionAndShape.BorderTop=0,this.PositionAndShape.BorderBottom=i.h/unitInPixels,this.PositionAndShape.BorderLeft=-(r+e.width/2)/unitInPixels,this.PositionAndShape.BorderRight=(i.w-r)/unitInPixels}set vfStaveNote(e){this.mVexFlowStaveNote=e}get vfStaveNote(){return this.mVexFlowStaveNote}color(){var g;const e=this.rules.DefaultColorNotehead,i=this.rules.DefaultColorRest,r=this.rules.DefaultColorStem,s="#00000000";let o,a;const l=this.vfStaveNote;for(let y=0;yc.symbol_type===i))return;const l=new VF$9.Repetition(i,s,-this.rules.RepetitionSymbolsYOffset);this.stave.addModifier(l,r);return}this.addVolta(e)}addVolta(e){var r;let i=VF$9.Volta.type.BEGIN;if(e.type===RepetitionInstructionEnum.Ending){switch(e.alignment){case AlignmentType.Begin:this.parentSourceMeasure.endsRepetitionEnding()?i=VF$9.Volta.type.BEGIN_END:i=VF$9.Volta.type.BEGIN;break;case AlignmentType.End:if(this.parentSourceMeasure.beginsRepetitionEnding())return;i=VF$9.Volta.type.END;break}const s=this.ParentStaffLine.SkyBottomLineCalculator,o=this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginLeft+.4,a=Math.max(this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginRight,o+.4),l=s.getSkyLineMinInRange(o,a)-2;let c=-6.1+this.rules.VoltaOffset,u=this.rules.VoltaOffset;if(l0){loglevelExports.trace(`Ghost Found in between (measure ${this.MeasureNumber})`);const d=this.createGhostGves(m);r.splice(a,0,...d),a+=d.length}}else{const m=Fraction$1.minus(c,this.parentSourceMeasure.AbsoluteTimestamp);if(m.RealValue>0){loglevelExports.trace(`Ghost Found at start (measure ${this.MeasureNumber})`);const d=this.createGhostGves(m);r.splice(0,0,...d),a+=d.length}}i=u}const s=Fraction$1.plus(this.parentSourceMeasure.AbsoluteTimestamp,this.parentSourceMeasure.Duration),o=Fraction$1.minus(s,i);if(o.RealValue>0){loglevelExports.trace(`Ghost Found at end (measure ${this.MeasureNumber})`);const a=this.createGhostGves(o);r=r.concat(a)}return r}createGhostGves(e){const i=VexFlowConverter.GhostNotes(e),r=[];for(const s of i){const o=new VexFlowVoiceEntry(void 0,void 0);o.vfStaveNote=s,r.push(o)}return r}handleBeam(e,i){const r=e.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;let s=this.beams[r];s||(s=this.beams[r]=[]);let o;for(const l of s)l[0]===i&&(o=l);o||(o=[i,[]],s.push(o));const a=e.parentVoiceEntry;o[1].indexOf(a)<0&&o[1].push(a)}handleTuplet(e,i){const r=e.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;i=e.sourceNote.NoteTuplet;let s=this.tuplets[r];s||(s=this.tuplets[r]=[]);let o;for(const l of s)l[0]===i&&(o=l);o||(o=[i,[]],s.push(o));const a=e.parentVoiceEntry;o[1].indexOf(a)<0&&o[1].push(a)}finalizeBeams(){this.vfbeams={};const e=[];for(const i in this.beams)if(this.beams.hasOwnProperty(i)){let r=this.vfbeams[i];r||(r=this.vfbeams[i]=[]);for(const s of this.beams[i]){let o=!1;for(const y of s[0].Notes)if(y.Length.RealValue>=new Fraction$1(1,4).RealValue&&(!y.TypeLength||y.TypeLength.RealValue>.125)){o=!0;break}if(o){loglevelExports.debug("Beam between note >= quarter, likely tremolo, currently unsupported. continuing.");continue}const a=[],l=s[0],c=s[1];let u=!0;for(const y of c)y.parentVoiceEntry.ParentVoice===l.Notes[0].ParentVoiceEntry.ParentVoice&&(u=y.parentVoiceEntry.WantedStemDirection===StemDirectionType.Undefined);let m=!1,d;const g=[];for(const y of c){const b=y.vfStaveNote;b&&(a.push(b),e.push(b)),y.parentVoiceEntry.IsGrace&&(m=!0),y.parentVoiceEntry.StemColor&&this.rules.ColoringEnabled&&g.push(y.parentVoiceEntry.StemColor)}if(a.length>1){const y=new VF$9.Beam(a,u);if(m&&(y.render_options.beam_width=3,y.render_options.partial_beam_length=4),g.length>=2&&this.rules.ColorBeams){d=g[0];for(const b of g)if(b!==d){d=void 0;break}y.setStyle({fillStyle:d,strokeStyle:d})}this.rules.FlatBeams&&(y.render_options.flat_beams=!0,y.render_options.flat_beam_offset=this.rules.FlatBeamOffset,y.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),r.push(y)}else loglevelExports.debug("Warning! Beam with no notes!")}}this.rules.AutoBeamNotes&&this.autoBeamNotes(e)}autoBeamNotes(e){if(!this.rules.AutoBeamTabs&&this.isTabMeasure)return;let i=[],r=[],s,o=[];this.autoTupletVfBeams=[];const a=[];this.autoVfBeams=[];let l=this.parentSourceMeasure.ActiveTimeSignature;l||(l=this.parentSourceMeasure.Duration);for(const m of this.staffEntries)for(const d of m.graphicalVoiceEntries){const g=d.vfStaveNote,y=d.notes[0],b=m.relInMeasureTimestamp.isOnBeat(l),S=r.length>=2,E=y.sourceNote.Length.RealValue-new Fraction$1(1,4).RealValue>-Fraction$1.FloatInaccuracyTolerance,x=d.parentVoiceEntry.IsGrace||E||e.contains(g);if(x||b){if(S){for(const _ of r)i.push(_);a.push(i.slice()),i=[]}if(r=[],x)continue}const A=d.notes[0].sourceNote.NoteTuplet;if(A){let _=!1;for(const P of A.Notes){for(const T of P)if(T.NoteTypeXml>=NoteType.QUARTER||T.ParentVoiceEntry.IsGrace||T.isRest()&&!this.rules.AutoBeamOptions.beam_rests){_=!0;break}if(_)break}if(!s)s=A;else if(s!==A){if(o.length>1){const P=new VF$9.Beam(o,!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)}o=[],s=A}_||o.push(g);continue}else s=void 0;r.push(g)}if(o.length>=2){const m=new VF$9.Beam(o,!0);this.rules.FlatBeams&&(m.render_options.flat_beams=!0,m.render_options.flat_beam_offset=this.rules.FlatBeamOffset,m.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(m)}if(r.length>=2){for(const m of r)i.push(m);a.push(i)}const c=this.rules.AutoBeamOptions,u={beam_middle_only:c.beam_middle_rests_only,beam_rests:c.beam_rests,maintain_stem_directions:c.maintain_stem_directions};if(c.groups&&c.groups.length){const m=[];for(const d of c.groups)m.push(new VF$9.Fraction(d[0],d[1]));u.groups=m}for(const m of a){const d=VF$9.Beam.generateBeams(m,u);for(const g of d)this.rules.FlatBeams&&(g.render_options.flat_beams=!0,g.render_options.flat_beam_offset=this.rules.FlatBeamOffset,g.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoVfBeams.push(g)}}finalizeTuplets(){this.vftuplets={};for(const e in this.tuplets)if(this.tuplets.hasOwnProperty(e)){let i=this.vftuplets[e];i||(i=this.vftuplets[e]=[]);for(const r of this.tuplets[e]){const s=[],o=r[1];for(const a of o)s.push(a.vfStaveNote);if(s.length>1){const a=r[0],l=a.Notes[0][0].NormalNotes,c=a.Bracket||a.TupletLabelNumber===3&&this.rules.TripletsBracketed||a.TupletLabelNumber!==3&&this.rules.TupletsBracketed;let u=VF$9.Tuplet.LOCATION_TOP;a.tupletLabelNumberPlacement===PlacementEnum.Below&&(u=VF$9.Tuplet.LOCATION_BOTTOM),i.push(new VF$9.Tuplet(s,{bracketed:c,location:u,notes_occupied:l,num_notes:a.TupletLabelNumber,ratioed:this.rules.TupletsRatioed}))}else loglevelExports.debug("Warning! Tuplet with no notes! Trying to ignore, but this is a serious problem.")}}}layoutStaffEntry(e){}graphicalMeasureCreatedCalculations(){let e,i=[];const r=[];for(const o of this.staffEntries){e=!1,i=[];for(const a of o.graphicalVoiceEntries){if(a.parentVoiceEntry.IsGrace){i.push(a),r.push(a),e||(e=a.parentVoiceEntry.GraceSlur);continue}if(a.vfStaveNote=VexFlowConverter.StaveNote(a),i.length>0){const l=[];for(let u=0;u0&&(m.GraceSlash=!1);const d=VexFlowConverter.StaveNote(m);m.vfStaveNote=d,l.push(d)}const c=new VF$9.GraceNoteGroup(l,e);a.vfStaveNote.addModifier(0,c),i=[]}}}if(i.length>0)for(const o of i)o.vfStaveNote=VexFlowConverter.StaveNote(o),o.parentVoiceEntry.GraceAfterMainNote=!0;this.finalizeBeams(),this.finalizeTuplets();const s=this.getVoicesWithinMeasure();if(this.rules.RenderFingerings)for(const o of this.staffEntries)o.setModifierXOffsets();for(const o of s){if(!o)continue;this.vfVoices[o.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);const a=this.getRestFilledVexFlowStaveNotesPerVoice(o);for(const l of a){if(l.parentVoiceEntry&&l.parentVoiceEntry.IsGrace&&!l.parentVoiceEntry.GraceAfterMainNote)continue;const c=l;if(c.vfStaveNote.ticks.denominator===0)continue;if(l.notes.length===0||!l.notes[0]||!l.notes[0].sourceNote.PrintObject){this.vfVoices[o.VoiceId].addTickable(c.vfStaveNote);continue}const u=c.parentStaffEntry;if(u&&u.vfClefBefore){const m=new NoteSubGroup([u.vfClefBefore]);c.vfStaveNote.getCategory&&c.vfStaveNote.getCategory()==="stavenotes"&&c.vfStaveNote.addModifier(0,m)}l.parentVoiceEntry&&this.rules.RenderFingerings&&((this.rules.FingeringPosition===PlacementEnum.Left||this.rules.FingeringPosition===PlacementEnum.Right)&&this.createFingerings(l),this.createStringNumber(l)),this.createArpeggio(l),this.vfVoices[o.VoiceId].addTickable(c.vfStaveNote)}}this.setStemDirectionFromVexFlow();for(const o of r)this.createFingerings(o),this.createStringNumber(o),this.createArpeggio(o);this.createArticulations(),this.createOrnaments()}createArpeggio(e){if(e.parentVoiceEntry&&e.parentVoiceEntry.Arpeggio){const i=e.parentVoiceEntry.Arpeggio;if(e.notes&&e.notes.length>1){const r=VexFlowConverter.StrokeTypeFromArpeggioType(i.type),s=new VF$9.Stroke(r,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&e.vfStaveNote.addStroke(0,s)}else loglevelExports.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn. voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.`)}}setStemDirectionFromVexFlow(){for(const e of this.staffEntries)for(const i of e.graphicalVoiceEntries)for(const r of i.notes){const s=r.vfnote;if(!s||!s[0])continue;switch(s[0].getStemDirection()){case VF$9.Stem.UP:i.parentVoiceEntry.StemDirection=StemDirectionType.Up;break;case VF$9.Stem.DOWN:i.parentVoiceEntry.StemDirection=StemDirectionType.Down;break}}}createArticulations(){for(let e=0,i=this.staffEntries.length;e1||e.parentStaffEntry.graphicalVoiceEntries.length>1?u=VF$9.StaveModifier.Position.LEFT:d.idInMusicSheet===0?(u=VF$9.StaveModifier.Position.ABOVE,l=PlacementEnum.Above):(u=VF$9.StaveModifier.Position.BELOW,l=PlacementEnum.Below)}const m=new VF$9.FretHandFinger(a.value);if(m.setPosition(u),m.setOffsetX(c),l===PlacementEnum.Above||l===PlacementEnum.Below){const d=l===PlacementEnum.Above?-1:1,g=l===PlacementEnum.Above?s:r-1-s;if(this.rules.FingeringInsideStafflines&&r>1){const y=m.getWidth()/2,b=r*2.5;m.setOffsetY(d*(g+b)*y)}else if(!this.rules.FingeringInsideStafflines){const y=new VF$9.StringNumber(a.value);y.radius=0,y.setPosition(u),y.setOffsetY(d*g*y.getWidth()*2/3),i.vfStaveNote.addModifier(s,y);continue}}i.vfStaveNote.addModifier(s,m)}}createStringNumber(e){if(!this.rules.RenderStringNumbersClassical)return;const i=e;e.notes.forEach((r,s)=>{const o=r.sourceNote.StringInstruction;if(o){let a=o.value;switch(a){case"1":a="I";break;case"2":a="II";break;case"3":a="III";break;case"4":a="IV";break;case"5":a="V";break;case"6":a="VI";break}const l=new VF$9.StringNumber(a);l.radius=0;const c=-this.rules.StringNumberOffsetY;e.notes.length>1||e.parentStaffEntry.graphicalVoiceEntries.length>1?(l.setOffsetX(r.baseStringNumberXOffset*13),l.setPosition(VF$9.Modifier.Position.RIGHT)):l.setPosition(VF$9.Modifier.Position.ABOVE),l.setOffsetY(c),i.vfStaveNote.addModifier(s,l)}})}lineTo(e,i){const r=new VF$9.StaveConnector(e.getVFStave(),this.stave);r.setType(i),this.connectors.push(r)}getVFStave(){return this.stave}updateInstructionWidth(){let e=0,i=0;const r=this.stave.getModifiers();for(const s of r)s.getPosition()===5?e+=s.getWidth()+s.getPadding(void 0):s.getPosition()===6&&(i+=s.getWidth()+s.getPadding(void 0));this.beginInstructionsWidth=(e!=null?e:0)/unitInPixels,this.endInstructionsWidth=(i!=null?i:0)/unitInPixels}addStaveTie(e,i){this.vfTies.push(e),i.vfTie=e}}class GraphicalStaffEntry extends GraphicalObject{constructor(e,i=void 0,r=void 0){super(),this.graphicalChordContainers=[],this.tabStaffEntry=void 0,this.MaxAccidentals=0,this.graphicalInstructions=[],this.ties=[],this.graphicalTies=[],this.lyricsEntries=[],this.parentMeasure=e,this.graphicalVoiceEntries=[],this.sourceStaffEntry=i,r?(this.staffEntryParent=r,this.parentVerticalContainer=r.parentVerticalContainer,this.PositionAndShape=new BoundingBox$1(this,r.PositionAndShape)):this.PositionAndShape=new BoundingBox$1(this,e.PositionAndShape),i&&(this.relInMeasureTimestamp=i.Timestamp),this.FingeringEntries=[]}get GraphicalInstructions(){return this.graphicalInstructions}get GraphicalTies(){return this.graphicalTies}get LyricsEntries(){return this.lyricsEntries}set LyricsEntries(e){this.lyricsEntries=e}getAbsoluteTimestamp(){const e=this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.clone();return this.relInMeasureTimestamp&&e.Add(this.relInMeasureTimestamp),e}findTieGraphicalNoteFromNote(e){var r;const i=((r=window.GYM)==null?void 0:r.graceCustom)||!1;for(const s of this.graphicalVoiceEntries)for(const o of s.notes){const a=o.sourceNote;if(i){if(e.NoteToGraphicalNoteObjectId==a.NoteToGraphicalNoteObjectId)return o}else if(!a.isRest()&&a.Pitch.FundamentalNote===e.Pitch.FundamentalNote&&a.Pitch.Octave===e.Pitch.Octave&&a.getAbsoluteTimestamp().Equals(e.getAbsoluteTimestamp()))return o}}findEndTieGraphicalNoteFromNoteWithStartingSlur(e,i){if(e){for(const r of this.graphicalVoiceEntries)if(r.parentVoiceEntry===e.ParentVoiceEntry)for(const s of r.notes){const o=s.sourceNote;if(o.NoteTie&&o.NoteSlurs.indexOf(i)!==-1)return s}}}findGraphicalNoteFromGraceNote(e){if(e){for(const i of this.graphicalVoiceEntries)if(i.parentVoiceEntry===e.ParentVoiceEntry){for(const r of i.notes)if(r.sourceNote===e)return r}}}findGraphicalNoteFromNote(e){if(e){for(const i of this.graphicalVoiceEntries)if(i.parentVoiceEntry===e.ParentVoiceEntry){for(const r of i.notes)if(r.sourceNote===e&&this.getAbsoluteTimestamp().Equals(e.getAbsoluteTimestamp()))return r}}}getGraphicalNoteDurationFromVoice(e){for(const i of this.graphicalVoiceEntries)if(i.parentVoiceEntry.ParentVoice===e)return i.notes[0].graphicalNoteLength;return new Fraction$1(0,1)}findVoiceEntryGraphicalNotes(e){for(const i of this.graphicalVoiceEntries)if(i.parentVoiceEntry===e)return i.notes}isVoiceEntryPartOfLinkedVoiceEntry(e){if(this.sourceStaffEntry.Link)for(let i=0,r=this.sourceStaffEntry.Link.LinkStaffEntries.length;i0&&(e=s)}return e}findStaffEntryMaxNoteLength(){let e=new Fraction$1(0,1);for(const i of this.graphicalVoiceEntries)for(const r of i.notes){const s=r.graphicalNoteLength;e.lt(s)&&s.GetExpandedNumerator()>0&&(e=s)}return e}findOrCreateGraphicalVoiceEntry(e){for(const r of this.graphicalVoiceEntries)if(r.parentVoiceEntry===e)return r;const i=MusicSheetCalculator.symbolFactory.createVoiceEntry(e,this);return this.graphicalVoiceEntries.push(i),i}findOrCreateGraphicalVoiceEntryFromGraphicalNote(e){for(const r of this.graphicalVoiceEntries)if(r===e.parentVoiceEntry)return r;const i=MusicSheetCalculator.symbolFactory.createVoiceEntry(e.sourceNote.ParentVoiceEntry,this);return this.graphicalVoiceEntries.push(i),i}addGraphicalNoteToListAtCorrectYPosition(e,i){const r=e.notes;if(r.length===0||i.PositionAndShape.RelativePosition.y=0;s--){if(r[s].PositionAndShape.RelativePosition.y>i.PositionAndShape.RelativePosition.y){r.splice(s+1,0,i);break}if(s===0){r.splice(0,0,i);break}}}hasOnlyRests(){for(const i of this.graphicalVoiceEntries)for(const r of i.notes)if(!r.sourceNote.isRest())return!1;return!0}getSkylineMin(){var s;const e=(s=this.parentMeasure)==null?void 0:s.ParentStaffLine.SkyBottomLineCalculator;if(!e)return;const[i,r]=this.getAbsoluteStartAndEnd();return e.getSkyLineMinInRange(i,r)}getHighestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getSkylineMin()}getLowestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getBottomlineMax()}getBottomlineMax(){var s;const e=(s=this.parentMeasure)==null?void 0:s.ParentStaffLine.SkyBottomLineCalculator;if(!e)return;const[i,r]=this.getAbsoluteStartAndEnd();return e.getBottomLineMaxInRange(i,r)}getAbsoluteStartAndEnd(){let e=this.PositionAndShape.AbsolutePosition.x;e-=this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.x;const i=e+this.PositionAndShape.Size.width;return[e,i]}}const VF$8=Vex.Flow;class VexFlowStaffEntry extends GraphicalStaffEntry{constructor(e,i,r){super(e,i,r)}calculateXPosition(){const e=this.parentMeasure.getVFStave();let i=0;for(const r of this.graphicalVoiceEntries)if(r.vfStaveNote){if(r.vfStaveNote.setStave(e),e&&e.getLines&&e.getLines()===1&&r.vfStaveNote.getStemDirection()<0&&(r.vfStaveNote.setStemDirection(VF$8.Stem.UP),r.parentVoiceEntry.StemDirection=StemDirectionType.Up),!r.vfStaveNote.preFormatted)continue;r.applyBordersFromVexflow(),this.parentMeasure.ParentStaff.isTab?this.PositionAndShape.RelativePosition.x=(r.vfStaveNote.getAbsoluteX()+r.vfStaveNote.glyph.getWidth())/unitInPixels:this.PositionAndShape.RelativePosition.x=r.vfStaveNote.getBoundingBox().getX()/unitInPixels;const s=r.notes[0].sourceNote;s.isRest()&&s.Length.RealValue===this.parentMeasure.parentSourceMeasure.ActiveTimeSignature.RealValue&&(this.PositionAndShape.RelativePosition.x+=this.parentMeasure.parentSourceMeasure.Rules.WholeRestXShiftVexflow-.1,r.PositionAndShape.BorderLeft=-.7,r.PositionAndShape.BorderRight=.7),r.PositionAndShape.BorderLefto.staffLine),r=this.calculateModifierXOffsets(i,1),s=this.calculateModifierXOffsets(i,.5);e.forEach((o,a)=>{o.baseFingeringXOffset=s[a],o.baseStringNumberXOffset=r[a]})}calculateModifierXOffsets(e,i){const r=[];for(let s=0;s=0;l--){if(Math.abs(e[s]-e[l])<=i&&o===r[l]){o++,a=!0;break}a=!1}r.push(o)}return r}}class VexFlowGraphicalNote extends GraphicalNote{constructor(e,i,r,s=OctaveEnum.NONE,o,a=void 0){if(super(e,i,o,a),this.clef=r,this.octaveShift=s,e.Pitch){const l=e.isRest()?e.Pitch:OctaveShift.getPitchFromOctaveShift(e.Pitch,s);this.vfpitch=VexFlowConverter.pitch(l,e.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0}}setAccidental(e){const i=this.drawPitch(e);this.vfpitch=VexFlowConverter.pitch(i,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.DrawnAccidental=i.Accidental}drawPitch(e){return OctaveShift.getPitchFromOctaveShift(e,this.octaveShift)}Transpose(e,i,r,s){const o=super.Transpose(e,i,r,s),a=OctaveShift.getPitchFromOctaveShift(o,this.octaveShift);return this.vfpitch=VexFlowConverter.pitch(a,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0,a}setIndex(e,i){this.vfnote=[e,i],this.vfnoteIndex=i}notehead(e=void 0){let i=e;i||(i=this.vfnote[0]);const r=i.note_heads;return r&&r.length>this.vfnoteIndex&&r[this.vfnoteIndex]?i.note_heads[this.vfnoteIndex]:{line:0}}Clef(){return this.clef}getSVGId(){if(this.vfnote)return this.vfnote[0].getAttribute("id")}getSVGGElement(){if(this.vfnote)return this.vfnote[0].getAttribute("el")}getStemSVG(){return document.getElementById("vf-"+this.getSVGId()+"-stem")}getBeamSVGs(){const e=[];for(let i=0;;i++){const r=document.getElementById(`vf-${this.getSVGId()}-beam${i}`);if(!r)break;e.push(r)}return e}}class GraphicalChordSymbolContainer extends GraphicalObject{constructor(e,i,r,s,o,a){super(),this.chordSymbolContainer=e,this.boundingBox=new BoundingBox$1(this,i),this.rules=a,this.calculateLabel(r,o,s)}get GetChordSymbolContainer(){return this.chordSymbolContainer}get GraphicalLabel(){return this.graphicalLabel}calculateLabel(e,i,r){const s=ChordSymbolContainer.calculateChordText(this.chordSymbolContainer,i,r);this.graphicalLabel=new GraphicalLabel(new Label(s),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}}const VF$7=Vex.Flow;class VexFlowTabMeasure extends VexFlowMeasure{constructor(e,i=void 0,r=void 0){super(e,i,r),this.isTabMeasure=!0}resetLayout(){var i;const e=(i=this.ParentStaff.StafflineCount)!=null?i:6;this.stave=new VF$7.TabStave(0,0,0,{space_above_staff_ln:0,space_below_staff_ln:0,num_lines:e}),this.updateInstructionWidth()}graphicalMeasureCreatedCalculations(){for(let i=0,r=this.staffEntries.length;i1){const l=VexFlowConverter.StrokeTypeFromArpeggioType(a.type),c=new VF$7.Stroke(l,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&o.vfStaveNote.addStroke(0,c)}else loglevelExports.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn. voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.`)}this.vfVoices[i.VoiceId].addTickable(o.vfStaveNote)}}}}class StaffLine extends GraphicalObject{constructor(e,i){super(),this.measures=[],this.staffLines=new Array(5),this.octaveShifts=[],this.lyricLines=[],this.lyricsDashes=[],this.abstractExpressions=[],this.graphicalSlurs=[],this.Pedals=[],this.WavyLines=[],this.parentMusicSystem=e,this.parentStaff=i,this.boundingBox=new BoundingBox$1(this,e.PositionAndShape),this.skyBottomLine=MusicSheetCalculator.symbolFactory.createSkyBottomLineCalculator(this),this.staffHeight=this.parentMusicSystem.rules.StaffHeight,this.topLineOffset=0,this.bottomLineOffset=4,this.calculateStaffLineOffsets()}calculateStaffLineOffsets(){if(this.ParentStaff.isTab)switch(this.ParentStaff.StafflineCount){case 5:this.staffHeight=this.bottomLineOffset=this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight*6;break;default:this.staffHeight=this.bottomLineOffset=this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight*this.ParentStaff.StafflineCount;break}else switch(this.ParentStaff.StafflineCount){case 4:this.bottomLineOffset=1;break;case 3:this.topLineOffset=1,this.bottomLineOffset=1;break;case 2:this.topLineOffset=2,this.bottomLineOffset=1;break;case 1:this.topLineOffset=2,this.bottomLineOffset=2;break}}get Measures(){return this.measures}set Measures(e){this.measures=e}get StaffLines(){return this.staffLines}set StaffLines(e){this.staffLines=e}get Index(){return this.parentMusicSystem.StaffLines.indexOf(this)}get NextStaffLine(){const e=this.Index;return e!==this.parentMusicSystem.StaffLines.length?this.parentMusicSystem.StaffLines[e+1]:void 0}get LyricLines(){return this.lyricLines}get AbstractExpressions(){return this.abstractExpressions}set AbstractExpressions(e){this.abstractExpressions=e}set LyricLines(e){this.lyricLines=e}get LyricsDashes(){return this.lyricsDashes}set LyricsDashes(e){this.lyricsDashes=e}get ParentMusicSystem(){return this.parentMusicSystem}set ParentMusicSystem(e){this.parentMusicSystem=e}get ParentStaff(){return this.parentStaff}set ParentStaff(e){this.parentStaff=e}get SkyBottomLineCalculator(){return this.skyBottomLine}get SkyLine(){return this.skyBottomLine.SkyLine}get BottomLine(){return this.skyBottomLine.BottomLine}get OctaveShifts(){return this.octaveShifts}set OctaveShifts(e){this.octaveShifts=e}get StaffHeight(){return this.staffHeight}get TopLineOffset(){return this.topLineOffset}get BottomLineOffset(){return this.bottomLineOffset}get GraphicalSlurs(){return this.graphicalSlurs}addSlurToStaffline(e){this.graphicalSlurs.push(e)}addActivitySymbolClickArea(){const e=new StaffLineActivitySymbol(this),i=this.PositionAndShape;e.PositionAndShape.RelativePosition=new PointF2D(i.RelativePosition.x+i.BorderRight+.5,i.RelativePosition.y+.5),e.PositionAndShape.Parent=this.parentMusicSystem.PositionAndShape}isPartOfMultiStaffInstrument(){return this.parentStaff.ParentInstrument.Staves.length>1}findClosestStaffEntry(e){let i;for(let r=0,s=this.Measures.length;r0){const c=l.map(g=>g.PositionAndShape.Center.y),u=Math.max(...c),m=((o=window.GYM)==null?void 0:o.noNeedContinuousDynamic)||!1,d=((a=window.GYM)==null?void 0:a.noNeedGraphicalContinuousDynamic)||!1;for(let g=0;g0?l[g-1]:void 0;if(S){const x=this.getOverlap(y.PositionAndShape,S.PositionAndShape);y.squeeze(-(x.x+this.rules.DynamicExpressionSpacer))}if(E){const x=this.getOverlap(E.PositionAndShape,y.PositionAndShape);y.squeeze(x.x+this.rules.DynamicExpressionSpacer)}}}}}getDistance(e,i){const r=e.RelativePosition.x+e.BorderMarginRight,s=i.RelativePosition.x+i.BorderMarginLeft,o=e.RelativePosition.y+e.BorderMarginBottom,a=i.RelativePosition.y+i.BorderMarginTop;return new PointF2D(s-r,a-o)}getOverlap(e,i){return new PointF2D(e.RelativePosition.x+e.BorderMarginRight-(i.RelativePosition.x+i.BorderMarginLeft),e.RelativePosition.y+e.BorderMarginBottom-(i.RelativePosition.y+i.BorderMarginTop))}}class VexFlowStaffLine extends StaffLine{constructor(e,i){super(e,i),this.slursInVFStaffLine=[],this.alignmentManager=new AlignmentManager(this)}get SlursInVFStaffLine(){return this.slursInVFStaffLine}addVFSlurToVFStaffline(e){this.slursInVFStaffLine.push(e)}get AlignmentManager(){return this.alignmentManager}}const VF$6=Vex.Flow;class VexFlowMultiRestMeasure extends VexFlowMeasure{constructor(e,i=void 0,r=void 0){super(e,i,r),this.minimumStaffEntriesWidth=-1,r?this.rules=r.ParentMusicSystem.rules:i&&(this.rules=i.Rules),this.resetLayout(),this.multiRestElement=new VF$6.MultiMeasureRest(i.multipleRestMeasures,{})}draw(e){var o,a,l,c,u;const i=e.openGroup();(o=i==null?void 0:i.classList)==null||o.add("vf-measure");const r=e.openGroup();(a=r==null?void 0:r.classList)==null||a.add("vf-stave"),r==null||r.setAttribute("id",(c=(l=this.stave)==null?void 0:l.attrs)==null?void 0:c.id),this.stave.setContext(e).draw(),e.closeGroup();const s=e.openGroup();(u=s==null?void 0:s.classList)==null||u.add("vf-voices"),this.multiRestElement.setStave(this.stave),this.multiRestElement.setContext(e),this.multiRestElement.draw(),e.closeGroup();for(const m of this.connectors)m.setContext(e).draw();return e.closeGroup(),i}format(){}getVoicesWithinMeasure(){return[]}getGraphicalVoiceEntriesPerVoice(e){return[]}getRestFilledVexFlowStaveNotesPerVoice(e){return[]}handleBeam(e,i){}handleTuplet(e,i){}finalizeBeams(){}finalizeTuplets(){}layoutStaffEntry(e){}graphicalMeasureCreatedCalculations(){}createArticulations(){}createOrnaments(){}createFingerings(e){}getVFStave(){return this.stave}}const VF$5=Vex.Flow;class VexFlowBackend{getInnerElement(){return this.inner}getCanvas(){return this.canvas}getRenderElement(){let e=this.canvas;return this.getVexflowBackendType()===VF$5.Renderer.Backends.CANVAS&&(e=this.inner),e}getRenderer(){return this.renderer}removeAllChildrenFromContainer(e){for(;e.children.length!==0;)e.removeChild(e.children.item(0))}removeFromContainer(e){const i=this.getRenderElement();for(let r=0;r \r<`)),o.download="opensheetmusicdisplay_download.svg",o.innerHTML=window.location.href+"/download",document.body.appendChild(o)}}class VexFlowInstantaneousDynamicExpression extends GraphicalInstantaneousDynamicExpression{constructor(e,i,r){super(e,i,r);const s=new Label(this.Expression);this.label=new GraphicalLabel(s,this.rules.ContinuousDynamicTextHeight,TextAlignmentEnum.CenterCenter,this.rules,this.PositionAndShape),this.label.Label.fontStyle=FontStyles.BoldItalic,this.label.setLabelPositionAndShapeBorders(),this.PositionAndShape.calculateBoundingBox()}get InstantaneousDynamic(){return this.mInstantaneousDynamicExpression}get Expression(){return DynamicEnum[this.mInstantaneousDynamicExpression.DynEnum]}}class GraphicalOctaveShift extends GraphicalObject{constructor(e,i){super(),this.getOctaveShift=e,this.setSymbol(),this.PositionAndShape=new BoundingBox$1(this,i)}setSymbol(){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("")}}}const VF$2=Vex.Flow;class VexFlowOctaveShift extends GraphicalOctaveShift{constructor(e,i){switch(super(e,i),e.Type){case OctaveEnum.VA8:this.position=VF$2.TextBracket.Positions.TOP,this.supscript="va",this.text="8";break;case OctaveEnum.MA15:this.position=VF$2.TextBracket.Positions.TOP,this.supscript="ma",this.text="15";break;case OctaveEnum.VB8:this.position=VF$2.TextBracket.Positions.BOTTOM,this.supscript="vb",this.text="8";break;case OctaveEnum.MB15:this.position=VF$2.TextBracket.Positions.BOTTOM,this.supscript="mb",this.text="15";break;default:loglevelExports.error("Unknown or NONE octaveshift. This should not be called!");break}}setStartNote(e){for(const i of e.graphicalVoiceEntries){const r=i;if(r!=null&&r.vfStaveNote)return this.startNote=r.vfStaveNote,!0}return!1}setEndNote(e){for(const i of e.graphicalVoiceEntries){const r=i;if(r!=null&&r.vfStaveNote)return this.endNote=r.vfStaveNote,!0}return!1}getTextBracket(){return new VF$2.TextBracket({position:this.position,start:this.startNote,stop:this.endNote,superscript:this.supscript,text:this.text})}}class VexflowStafflineNoteCalculator{constructor(e){this.staffPitchListMapping=new Dictionary,this.baseLineNote=NoteEnum.B,this.baseLineOctave=1,this.rules=e}trackNote(e){if(!(e instanceof VexFlowGraphicalNote)||e.Clef().ClefType!==ClefEnum.percussion||e.sourceNote.isRest()||this.rules.PercussionOneLineCutoff===0||this.rules.PercussionForceVoicesOneLineCutoff===-1)return;const i=e.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet;let r;this.staffPitchListMapping.containsKey(i)||this.staffPitchListMapping.setValue(i,new Array),r=this.staffPitchListMapping.getValue(i);const s=e.sourceNote.Pitch;VexflowStafflineNoteCalculator.findOrInsert(r,s)}static PitchIndexOf(e,i,r=0){if(r>e.length-1)return-1;for(let s=r;sthis.rules.PercussionOneLineCutoff&&!s)return e;const o=e,a=e.sourceNote.Pitch;let l=this.baseLineNote,c=this.baseLineOctave;if(this.rules.PercussionUseXMLDisplayStep&&e.sourceNote.displayStepUnpitched!==void 0&&(l=e.sourceNote.displayStepUnpitched,c=e.sourceNote.displayOctaveUnpitched+this.rules.PercussionOneLineXMLDisplayStepOctaveOffset),r.length<=this.rules.PercussionForceVoicesOneLineCutoff)o.setAccidental(new Pitch(l,c,a.Accidental));else{const u=VexflowStafflineNoteCalculator.PitchIndexOf(r,a);if(u>-1){const m=Math.ceil(r.length/2);if(!this.rules.PercussionUseXMLDisplayStep)if(u>=m)switch(c=2,(u-m)%5){case 1:l=NoteEnum.E;break;case 2:l=NoteEnum.G;break;case 3:l=NoteEnum.B;break;case 4:l=NoteEnum.D,c=3;break;default:l=NoteEnum.C;break}else switch(u%5){case 1:l=NoteEnum.F;break;case 2:l=NoteEnum.D;break;case 3:l=NoteEnum.B,c=0;break;case 4:l=NoteEnum.G,c=0;break;default:l=NoteEnum.A;break}const d=new Pitch(l,c,a.Accidental);o.setAccidental(d);const g=o.parentVoiceEntry.parentVoiceEntry;!this.rules.SetWantedStemDirectionByXml&&g.Notes.length<2&&(d.Octave>this.baseLineOctave||d.FundamentalNote===this.baseLineNote&&d.Octave===this.baseLineOctave?o.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=StemDirectionType.Up:o.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=StemDirectionType.Down)}}return o}getStafflineUniquePositionCount(e){return this.staffPitchListMapping.containsKey(e)?this.staffPitchListMapping.getValue(e).length:0}}class SkyBottomLineCalculator{constructor(e){this.mStaffLineParent=e,this.mRules=e.ParentMusicSystem.rules}calculateLines(){const e=Math.max(Math.ceil(this.StaffLineParent.PositionAndShape.Size.width*this.SamplingUnit),1);this.mSkyLine=[],this.mBottomLine=[];const i=new CanvasVexFlowBackend(this.StaffLineParent.ParentMusicSystem.rules);for(const a of this.StaffLineParent.Measures){a.PositionAndShape.calculateAbsolutePositionsRecursive(0,0);const l=a.getVFStave();let c=l.getWidth();if(!(c>0)&&!a.IsExtraGraphicalMeasure&&(loglevelExports.warn("SkyBottomLineCalculator: width not > 0 in measure "+a.MeasureNumber),c=50),!(c>=50)&&a.IsExtraGraphicalMeasure)continue;i.initializeHeadless(c);const u=i.getContext(),m=i.getCanvas();c=m.width;const d=m.height;this.mRules.DYMusicScoreType==="jianpu"?l.setY(l.y-50):l.setY(l.y+100);const g=l.getWidth();l.setWidth(c),a.format(),l.setWidth(g);try{a.draw(u)}catch(A){loglevelExports.warn("SkyBottomLineCalculator.calculateLines.draw",A)}const y=u.getImageData(0,0,c,d),b=4,S=Math.max(Math.ceil(a.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),E=new Array(S),x=new Array(S);for(let A=0;A0){E[A]=_;break}}for(let _=d;_>0;_--){const T=_*c*b+A*b;if(y.data[T+3]>0){x[A]=_;break}}}for(let A=0;A(a-Math.max(...this.mSkyLine))/unitInPixels+this.StaffLineParent.TopLineOffset),this.mBottomLine=this.mBottomLine.map(a=>(a-Math.min(...this.mBottomLine))/unitInPixels+this.StaffLineParent.BottomLineOffset)}findPreviousValidNumber(e,i){for(let r=e;r>=0;r--)if(!isNaN(i[r]))return i[r];return 0}findNextValidNumber(e,i){if(e>=i.length)return i[e-1];for(let r=e;r=this.BottomLine.length&&(r=this.BottomLine.length-1),s<0&&(s=0),s>=this.BottomLine.length&&(s=this.BottomLine.length),this.SkyLine[r]=e.y;for(let a=r+1;a=this.BottomLine.length&&(r=this.BottomLine.length-1),s<0&&(s=0),s>=this.BottomLine.length&&(s=this.BottomLine.length),this.BottomLine[r]=e.y;for(let a=r+1;ae)}setBottomLineWithValue(e){this.BottomLine.forEach(i=>e)}getLeftIndexForPointX(e,i){const r=Math.floor(e*this.SamplingUnit);return r<0?0:r>=i?i-1:r}getRightIndexForPointX(e,i){const r=Math.ceil(e*this.SamplingUnit);return r<0?0:r>=i?i-1:r}updateStaffLineBorders(){this.mStaffLineParent.PositionAndShape.BorderTop=this.getSkyLineMin(),this.mStaffLineParent.PositionAndShape.BorderMarginTop=this.getSkyLineMin(),this.mStaffLineParent.PositionAndShape.BorderBottom=this.getBottomLineMax(),this.mStaffLineParent.PositionAndShape.BorderMarginBottom=this.getBottomLineMax()}getSkyLineMin(){return Math.min(...this.SkyLine.filter(e=>!isNaN(e)))}getSkyLineMinAtPoint(e){const i=Math.round(e*this.SamplingUnit);return this.mSkyLine[i]}getSkyLineMinInRange(e,i){return this.getMinInRange(this.SkyLine,e,i)}getBottomLineMax(){return Math.max(...this.BottomLine.filter(e=>!isNaN(e)))}getBottomLineMaxAtPoint(e){const i=Math.round(e*this.SamplingUnit);return this.mBottomLine[i]}getBottomLineMaxInRange(e,i){return this.getMaxInRange(this.BottomLine,e,i)}getBottomLineMaxInBoundingBox(e){const i=Math.floor(e.AbsolutePosition.x+e.BorderLeft),r=Math.ceil(e.AbsolutePosition.x+e.BorderRight);return this.getMaxInRange(this.mBottomLine,i,r)}updateWithBoundingBoxRecursively(e){if(e.ChildElements&&e.ChildElements.length>0)for(const i of e.ChildElements)this.updateWithBoundingBoxRecursively(i);else{const i=e.BorderTop+e.AbsolutePosition.y,r=e.BorderBottom+e.AbsolutePosition.y;if(i<0){const s=Math.floor(e.AbsolutePosition.x+e.BorderLeft),o=Math.ceil(e.AbsolutePosition.x+e.BorderRight);this.updateInRange(this.mSkyLine,s,o,i)}else if(r>this.StaffLineParent.StaffHeight){const s=Math.floor(e.AbsolutePosition.x+e.BorderLeft),o=Math.ceil(e.AbsolutePosition.x+e.BorderRight);this.updateInRange(this.mBottomLine,s,o,r)}}}updateInRange(e,i=0,r=e.length,s=0){if(i=Math.floor(i*this.SamplingUnit),r=Math.ceil(r*this.SamplingUnit),re.length&&(r=e.length);for(let o=i;oMath.abs(e[o])?s:e[o]}setInRange(e,i=0,r=e.length,s=0){if(i=Math.floor(i*this.SamplingUnit),r=Math.ceil(r*this.SamplingUnit),re.length&&(r=e.length);for(let o=i;o=e.length&&(i=e.length-1),r<0&&(r=0),r>=e.length&&(r=e.length),i>=0&&r<=e.length)return Math.min(...e.slice(i,r+1))}getMaxInRange(e,i,r){if(i=Math.floor(i*this.SamplingUnit),r=Math.ceil(r*this.SamplingUnit),!e)return Number.MIN_VALUE;if(i<0&&(i=0),i>=e.length&&(i=e.length-1),r<0&&(r=0),r>=e.length&&(r=e.length),i>=0&&r<=e.length)return Math.max(...e.slice(i,r+1))}get SamplingUnit(){return this.mRules.SamplingUnit}get StaffLineParent(){return this.mStaffLineParent}get SkyLine(){return this.mSkyLine}get BottomLine(){return this.mBottomLine}}var parserExports$1={},parser$2={get exports(){return parserExports$1},set exports(t){parserExports$1=t}};/*! * 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(t,e){(function(i,r){t.exports=r()})(commonjsGlobal,function(){return function(r){for(var s={command:/\s*([achlmqstvz])/gi,number:/\s*([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/gi,comma:/\s*(?:(,)|\s)/g,flag:/\s*([01])/g},o={number:function(S){return+y("number",S)},"coordinate pair":function(S){var E=y("number",S);if(E===null&&!S)return null;y("comma");var x=y("number",!0);return{x:+E,y:+x}},"arc definition":function(S){var E=o["coordinate pair"](S);if(!E&&!S)return null;y("comma");var x=+y("number",!0);y("comma",!0);var A=!!+y("flag",!0);y("comma");var _=!!+y("flag",!0);y("comma");var P=o["coordinate pair"](!0);return{radii:E,rotation:x,large:A,clockwise:_,end:P}}},a=0,l=[];ai.bottom)switch(e.tagName.toLowerCase()){case"g":for(const g of e.children)this.recursiveUpdate(g,i,r,s);break;case"circle":case"rect":case"line":case"path":let m=Math.floor((o.x-r.x)/unitInPixels*this.mRules.SamplingUnit);const d=m+Math.ceil(o.width/unitInPixels*this.mRules.SamplingUnit);if(e.parentElement.classList.contains("vf-beams")&&e.hasAttribute("d")){const g=parserExports$1(e.getAttribute("d"));if(g.length===5){const y=g[0],b=g[3],S=(b.end.y-y.end.y)/(b.end.x-y.end.x);let E=y.end.y/unitInPixels;for(m;m<=d;m++)Eu[m]&&(u[m]=E),E+=S/this.mRules.SamplingUnit}}else for(m;m<=d;m++)au[m]&&(u[m]=l);break}}calculateLinesForMeasure(e,i){var M,C,I;const r=i.getBBox(),s=Math.max(Math.round(e.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),o=r.height/unitInPixels,l=i.getElementsByClassName("vf-stave")[0].getBBox();let c=(l==null?void 0:l.height)/unitInPixels,u=(l==null?void 0:l.y)/unitInPixels;const m=e.getVFStave();let d=((M=m.options)!=null&&M.num_lines?m.options.num_lines:5)-1,g=-1,y=0;const b=[d];for(const D of(C=m.options)==null?void 0:C.line_config)D.visible?(g===-1&&(g=y),b.push(y)):d--,y++;const S=b.pop();g===-1&&(g=0),d=S-g;const E=(I=m.options)==null?void 0:I.spacing_between_lines_px,x=d*E/unitInPixels;c-x>.2&&(c=x,u=g*E/unitInPixels);const A=u+c,_=new Array(s).fill(u),P=new Array(s).fill(A),T=[_,P];if(o>c)for(const D of i.children)this.recursiveUpdate(D,{top:u,bottom:A},r,[_,P]);return T}calculateLines(){this.mSkyLine=[],this.mBottomLine=[];const e=document.createElement("div");document.body.append(e);const i=new SvgVexFlowBackend(this.mRules);i.initialize(e,1,"0");const r=i.getContext(),s=r.openGroup();s.classList.add("staffline");for(const o of this.StaffLineParent.Measures){o.PositionAndShape.calculateAbsolutePositionsRecursive(0,0),o.setAbsoluteCoordinates(o.PositionAndShape.AbsolutePosition.x*unitInPixels,o.PositionAndShape.AbsolutePosition.y*unitInPixels);const a=o.draw(r),[l,c]=this.calculateLinesForMeasure(o,a);this.mSkyLine.push(...l),this.mBottomLine.push(...c)}r.closeGroup();for(const o of s.getElementsByClassName("vf-ties"))for(const a of o.childNodes)if(a.nodeName.toLowerCase()==="path"){const l=a.getBBox();let c=Math.floor(l.x/unitInPixels*this.mRules.SamplingUnit);const u=c+Math.ceil(l.width/unitInPixels*this.mRules.SamplingUnit),m=l.y/unitInPixels,d=l.height/unitInPixels+m;for(c;c<=u;c++)mthis.mBottomLine[c]&&(this.mBottomLine[c]=d)}i.clear(),e.remove()}}const VF$1=Vex.Flow;class VexFlowGraphicalSymbolFactory{constructor(){this.hasBBox=!1,document.createElementNS("http://www.w3.org/2000/svg","g").getBBox!==void 0&&(this.hasBBox=!0)}createMusicSystem(e,i){return new VexFlowMusicSystem(e,i)}createStaffLine(e,i){return new VexFlowStaffLine(e,i)}createSkyBottomLineCalculator(e){return e.ParentMusicSystem.rules.PerformanceMode&&this.hasBBox?new SkyBottomLineCalculatorSVG(e):new SkyBottomLineCalculator(e)}createGraphicalMeasure(e,i,r=!1){return new VexFlowMeasure(i,e,void 0)}createMultiRestMeasure(e,i,r){return new VexFlowMultiRestMeasure(i,e,r)}createTabStaffMeasure(e,i){return new VexFlowTabMeasure(i,e)}createExtraGraphicalMeasure(e){const i=new VexFlowMeasure(e.ParentStaff,void 0,e);return i.IsExtraGraphicalMeasure=!0,i.ExtraGraphicalMeasurePreviousMeasure=e.Measures.last(),i}createStaffEntry(e,i){return new VexFlowStaffEntry(i,e,void 0)}createVoiceEntry(e,i){return new VexFlowVoiceEntry(e,i)}createNote(e,i,r,s=OctaveEnum.NONE,o,a=void 0){return new VexFlowGraphicalNote(e,i,r,s,o,a)}createGraceNote(e,i,r,s,o=OctaveEnum.NONE){return new VexFlowGraphicalNote(e,i,r,o,s)}addGraphicalAccidental(e,i){e.setAccidental(i)}addFermataAtTiedEndNote(e,i){}createInStaffClef(e,i){const r=e,s=VexFlowConverter.Clef(i,"small");r.vfClefBefore=new VF$1.ClefNote(s.type,s.size,s.annotation)}createChordSymbols(e,i,r,s){const o=i.parentMeasure.parentSourceMeasure.Rules;let a=0;const l=o.ChordSymbolXSpacing;for(const c of e.ChordContainers){const u=new GraphicalChordSymbolContainer(c,i.PositionAndShape,o.ChordSymbolTextHeight,r,s,i.parentMeasure.parentSourceMeasure.Rules),m=u.GraphicalLabel;m.PositionAndShape.RelativePosition.y-=o.ChordSymbolYOffset,m.PositionAndShape.RelativePosition.x+=a,m.setLabelPositionAndShapeBorders(),u.PositionAndShape.calculateBoundingBox(),i.graphicalChordContainers.push(u),a+=m.PositionAndShape.Size.width+l}}createGraphicalTechnicalInstruction(e,i){}}class GraphicalTie{constructor(e,i=void 0,r=void 0){this.tie=e,this.startNote=i,this.endNote=r}get SVGElement(){return this.vfTie.getAttribute("el")}get GetTie(){return this.tie}get StartNote(){return this.startNote}get Tie(){return this.tie}set StartNote(e){this.startNote=e}get EndNote(){return this.endNote}set EndNote(e){this.endNote=e}}class GraphicalLyricEntry{constructor(e,i,r,s){this.lyricsEntry=e,this.graphicalStaffEntry=i;const o=i.parentMeasure.parentSourceMeasure.Rules.LyricsAlignmentStandard;e.Text.length>=4&&e.Parent.Notes[0].Length.Denominator>4&&TextAlignmentEnum.LeftBottom;const a=new Label(e.Text);this.graphicalLabel=new GraphicalLabel(a,r,o,this.graphicalStaffEntry.parentMeasure.parentSourceMeasure.Rules,i.PositionAndShape),this.graphicalLabel.PositionAndShape.RelativePosition=new PointF2D(0,s),o===TextAlignmentEnum.LeftBottom&&(this.graphicalLabel.PositionAndShape.RelativePosition.x-=1)}get LyricsEntry(){return this.lyricsEntry}get ParentLyricWord(){return this.graphicalLyricWord}set ParentLyricWord(e){this.graphicalLyricWord=e}get GraphicalLabel(){return this.graphicalLabel}set GraphicalLabel(e){this.graphicalLabel=e}get StaffEntryParent(){return this.graphicalStaffEntry}set StaffEntryParent(e){this.graphicalStaffEntry=e}}class GraphicalLyricWord{constructor(e){this.graphicalLyricsEntries=[],this.lyricWord=e,this.initialize()}get GetLyricWord(){return this.lyricWord}get GraphicalLyricsEntries(){return this.graphicalLyricsEntries}set GraphicalLyricsEntries(e){this.graphicalLyricsEntries=e}isFilled(){for(let e=0;e=_GraphicalCurve.bezierCurveStepSize?new PointF2D:new PointF2D(_GraphicalCurve.oneMinusTPow3[e]*this.bezierStartPt.x+_GraphicalCurve.bezierFactorOne[e]*this.bezierStartControlPt.x+_GraphicalCurve.bezierFactorTwo[e]*this.bezierEndControlPt.x+_GraphicalCurve.tPow3[e]*this.bezierEndPt.x,_GraphicalCurve.oneMinusTPow3[e]*this.bezierStartPt.y+_GraphicalCurve.bezierFactorOne[e]*this.bezierStartControlPt.y+_GraphicalCurve.bezierFactorTwo[e]*this.bezierEndControlPt.y+_GraphicalCurve.tPow3[e]*this.bezierEndPt.y)}};let GraphicalCurve=_GraphicalCurve;GraphicalCurve.bezierCurveStepSize=1e3;const _GraphicalSlur=class extends GraphicalCurve{constructor(t,e){super(),this.staffEntries=[],this.slur=t,this.rules=e}static Compare(t,e){if(t.staffEntries.length<1)return-1;if(e.staffEntries.length<1)return 1;const i=Fraction$1.minus(t.staffEntries[t.staffEntries.length-1].getAbsoluteTimestamp(),t.staffEntries[0].getAbsoluteTimestamp()),r=Fraction$1.minus(e.staffEntries[e.staffEntries.length-1].getAbsoluteTimestamp(),e.staffEntries[0].getAbsoluteTimestamp());return i.RealValue>r.RealValue?1:r.RealValue>i.RealValue?-1:0}calculateCurve(t){const e=this.staffEntries[0],i=this.staffEntries[this.staffEntries.length-1];let r=e.findGraphicalNoteFromNote(this.slur.StartNote);!r&&this.graceStart&&(r=e.findGraphicalNoteFromGraceNote(this.slur.StartNote)),r||(r=e.findEndTieGraphicalNoteFromNoteWithStartingSlur(this.slur.StartNote,this.slur));let s=i.findGraphicalNoteFromNote(this.slur.EndNote);!s&&this.graceEnd&&(s=i.findGraphicalNoteFromGraceNote(this.slur.EndNote));const o=e.parentMeasure.ParentStaffLine,a=o.SkyBottomLineCalculator;this.calculatePlacement(a,o);const l=this.calculateStartAndEnd(r,s,o,t,a),c=l.startX,u=l.endX;let m=l.startY,d=l.endY;const g=t.SlurTangentMinAngle,y=t.SlurTangentMaxAngle;let b;if(this.placement===PlacementEnum.Above){m-=t.SlurNoteHeadYOffset,d-=t.SlurNoteHeadYOffset;const S=new PointF2D(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,m);r?S.x+=this.staffEntries[0].PositionAndShape.BorderRight:S.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(S.x+=i.PositionAndShape.RelativePosition.x);const E=new PointF2D(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,d);if(s?E.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:E.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(E.x+=i.staffEntryParent.PositionAndShape.RelativePosition.x),b=this.calculateTopPoints(S,E,o,a),b.length===0){const ce=new PointF2D((E.x-S.x)/2+S.x,(E.y-S.y)/2+S.y);b.push(ce)}const x=Math.atan((d-m)/(u-c)),A=new PointF2D(0,0);let _=new PointF2D(u-c,-(d-m));const P=Matrix2D.getRotationMatrix(x),T=P.getTransposeMatrix();_=P.vectorMultiplication(_);const M=this.calculateTranslatedAndRotatedPointListAbove(b,c,m,P);let C=this.calculateMaxLeftSlope(M,A,_),I=this.calculateMaxRightSlope(M,A,_);const D=A.y-A.x*C,G=_.y-_.x*I,$=new PointF2D;let N=!1;Math.abs(Math.abs(C)-Math.abs(I))<1e-4?($.x=_.x/2,$.y=0,N=!0):($.x=(G-D)/(C-I),$.y=C*$.x+D);const z=this.calculateHeightWidthRatio(_.x,M);let R=0,H=0;if(Math.abs(z)>.001){const ce=Math.abs(C/(z*2)),pe=Math.abs(C);R=Math.max(0,pe*(Math.min(10,ce-1)/10)),C-=R;const ue=Math.abs(I/(z*2)),be=Math.abs(I);H=Math.max(0,be*(Math.min(10,ue-1)/10)),I+=H}let O=g,V=-g;if(!N){const ce=this.calculateAngles(g,C,I,y);O=ce.startAngle,V=ce.endAngle}const k=this.calculateControlPoints(_.x,O,V,M,z,m,d);let F=k.startControlPoint,Z=k.endControlPoint;F=T.vectorMultiplication(F),F.x+=c,F.y=-F.y+m,Z=T.vectorMultiplication(Z),Z.x+=c,Z.y=-Z.y+m,this.bezierStartPt=new PointF2D(c,m-R),this.bezierStartControlPt=new PointF2D(F.x,F.y-R),this.bezierEndControlPt=new PointF2D(Z.x,Z.y-H),this.bezierEndPt=new PointF2D(u,d-H);const U=o.SkyLine.length,J=a.getLeftIndexForPointX(this.bezierStartPt.x,U),de=a.getLeftIndexForPointX(this.bezierEndPt.x,U),ne=this.bezierEndPt.x-this.bezierStartPt.x,te=a.SamplingUnit;for(let ce=J;ce=J&&(o.SkyLine[be]=Math.min(o.SkyLine[be],ue.y)),be++,be.001){const ce=Math.abs(C/(z*2)),pe=Math.abs(C);R=Math.max(0,pe*(Math.min(10,ce-1)/10)),C-=R;const ue=Math.abs(I/(z*2)),be=Math.abs(I);H=Math.max(0,be*(Math.min(10,ue-1)/10)),I+=H}let O=g,V=-g;if(!N){const ce=this.calculateAngles(g,C,I,y);O=ce.startAngle,V=ce.endAngle}const k=this.calculateControlPoints(_.x,O,V,M,z,m,d);let F=k.startControlPoint,Z=k.endControlPoint;F=T.vectorMultiplication(F),F.x+=c,F.y+=m,Z=T.vectorMultiplication(Z),Z.x+=c,Z.y+=m,this.bezierStartPt=new PointF2D(c,m+R),this.bezierStartControlPt=new PointF2D(F.x,F.y+R),this.bezierEndControlPt=new PointF2D(Z.x,Z.y+H),this.bezierEndPt=new PointF2D(u,d+H);const U=o.BottomLine.length,J=a.getLeftIndexForPointX(this.bezierStartPt.x,U),de=a.getLeftIndexForPointX(this.bezierEndPt.x,U),ne=this.bezierEndPt.x-this.bezierStartPt.x,te=a.SamplingUnit;for(let ce=J;ce=J&&(o.BottomLine[be]=Math.max(o.BottomLine[be],ue.y)),be++,be0){this.placement=PlacementEnum.Above;return}const i=this.staffEntries[0],r=this.staffEntries[this.staffEntries.length-1],s=i.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection,o=r.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection;if(s===o)this.placement=s===StemDirectionType.Up?PlacementEnum.Below:PlacementEnum.Above;else{let a=i.PositionAndShape.BorderLeft+i.PositionAndShape.RelativePosition.x+i.parentMeasure.PositionAndShape.RelativePosition.x,l=r.PositionAndShape.BorderRight+r.PositionAndShape.RelativePosition.x+r.parentMeasure.PositionAndShape.RelativePosition.x;this.graceStart&&(a+=r.PositionAndShape.RelativePosition.x),this.graceEnd&&(l+=r.staffEntryParent.PositionAndShape.RelativePosition.x);const c=t.getSkyLineMinInRange(a,l)*-1;t.getBottomLineMaxInRange(a,l)-e.StaffHeight>c?this.placement=PlacementEnum.Above:this.placement=PlacementEnum.Below}}calculateTopPoints(t,e,i,r){const s=[];let o=r.getRightIndexForPointX(t.x,i.SkyLine.length),a=r.getLeftIndexForPointX(e.x,i.SkyLine.length);o<0&&(o=0),a>=i.SkyLine.length&&(a=i.SkyLine.length-1);for(let l=o;l=i.BottomLine.length&&(a=i.BottomLine.length-1);for(let l=o;lu&&t>m&&(c+=t/70*this.rules.SlurHeightFlattenLongSlursFactorByWidth,c*=1+e/30*this.rules.SlurHeightFlattenLongSlursFactorByAngle,l/=c);const d=Math.min(.5,Math.max(.1,1.7*e/80*l*Math.pow(Math.max(s,.05),.4))),g=Math.min(.5,Math.max(.1,1.7*-i/80*l*Math.pow(Math.max(s,.05),.4))),y=new PointF2D;y.x=t*d*Math.cos(e*_GraphicalSlur.degreesToRadiansFactor),y.y=t*d*Math.sin(e*_GraphicalSlur.degreesToRadiansFactor);const b=new PointF2D;b.x=t-t*g*Math.cos(i*_GraphicalSlur.degreesToRadiansFactor),b.y=-(t*g*Math.sin(i*_GraphicalSlur.degreesToRadiansFactor));let S=y.y-b.y;for(;this.rules.SlurMaximumYControlPointDistance&&Math.abs(S)>this.rules.SlurMaximumYControlPointDistance;)S<0?(y.y+=1,b.y-=1):(y.y-=1,b.y+=1),S=y.y-b.y;return{startControlPoint:y,endControlPoint:b}}calculateAngles(t,e,i,r){let o=Math.atan(e)/_GraphicalSlur.degreesToRadiansFactor;e>0?o+=20:o-=20;let a=Math.atan(i)/_GraphicalSlur.degreesToRadiansFactor;i<0?a-=20:a+=20;const l=Math.min(Math.max(t,o),r),c=Math.max(Math.min(-t,a),-r);return{startAngle:l,endAngle:c}}};let GraphicalSlur=_GraphicalSlur;GraphicalSlur.degreesToRadiansFactor=Math.PI/180;class GraphicalPedal extends GraphicalObject{constructor(e,i){super(),this.getPedal=e,this.setSymbol(),this.PositionAndShape=new BoundingBox$1(this,i)}setSymbol(){!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}}class VexFlowPedal extends GraphicalPedal{constructor(e,i,r=!1,s=!1){switch(super(e,i),this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET,this.ChangeBegin=!1,this.ChangeEnd=!1,this.line=-3,this.EndSymbolPositionAndShape=void 0,this.ChangeBegin=e.ChangeBegin,this.ChangeEnd=e.ChangeEnd,this.pedalSymbol){case MusicSymbol.PEDAL_SYMBOL:this.vfStyle=Vex.Flow.PedalMarking.Styles.TEXT,this.EndSymbolPositionAndShape=new BoundingBox$1(this,i);break;case MusicSymbol.PEDAL_MIXED:r&&s?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:r?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:s?this.vfStyle=Vex.Flow.PedalMarking.Styles.MIXED_OPEN_END:this.vfStyle=Vex.Flow.PedalMarking.Styles.MIXED;break;case MusicSymbol.PEDAL_BRACKET:default:r&&s?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:r?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:s?this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET_OPEN_END:this.vfStyle=Vex.Flow.PedalMarking.Styles.BRACKET;break}}setStartNote(e){if(!e)return!1;for(const i of e.graphicalVoiceEntries){const r=i;if(r!=null&&r.vfStaveNote)return this.startNote=r.vfStaveNote,this.startVfVoiceEntry=r,!0}return!1}setEndNote(e){if(!e)return!1;for(const i of e.graphicalVoiceEntries){const r=i;if(r!=null&&r.vfStaveNote)return this.endNote=r.vfStaveNote,this.endVfVoiceEntry=r,!0}return!1}setEndMeasure(e){this.endMeasure=e}CalculateBoundingBox(){}setLine(e){this.line=e}getPedalMarking(){var i,r,s,o;const e=new Vex.Flow.PedalMarking([this.startNote,this.endNote]);return this.endMeasure&&e.setEndStave(this.endMeasure.getVFStave()),e.setStyle(this.vfStyle),e.setLine(this.line),e.setCustomText(this.DepressText,this.ReleaseText),(((i=this.endVfVoiceEntry)==null?void 0:i.parentStaffEntry)===((o=(s=(r=this.endVfVoiceEntry)==null?void 0:r.parentStaffEntry)==null?void 0:s.parentMeasure)==null?void 0:o.staffEntries.last())||!this.endVfVoiceEntry)&&(e.EndsStave=!0),e.ChangeBegin=this.ChangeBegin,e.ChangeEnd=this.ChangeEnd,e}}class GraphicalWavyLine extends GraphicalObject{constructor(e,i){super(),this.getWavyLine=e,this.PositionAndShape=new BoundingBox$1(this,i)}}class VexflowVibratoBracket extends GraphicalWavyLine{constructor(e,i,r=!1){super(e,i),this.line=1,this.isVibrato=!1,this.toEndOfStopStave=!1,this.isVibrato=r}get ToEndOfStopStave(){return this.toEndOfStopStave}setStartNote(e){for(const i of e.graphicalVoiceEntries){const r=i;if(r!=null&&r.vfStaveNote)return this.startNote=r.vfStaveNote,this.startVfVoiceEntry=r,!0}return!1}setEndNote(e){for(const i of e.graphicalVoiceEntries){const r=i;if(r!=null&&r.vfStaveNote){this.endNote=r.vfStaveNote,this.endVfVoiceEntry=r;const s=this.endVfVoiceEntry.parentStaffEntry.parentMeasure.staffEntries,o=s[s.length-1];return this.toEndOfStopStave=o===this.endVfVoiceEntry.parentStaffEntry,!0}}return!1}CalculateBoundingBox(){const e=this.getVibratoBracket();this.boundingBox.Size.height=e.render_options.wave_height*.2}getVibratoBracket(){const 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}}const VF=Vex.Flow;class VexFlowMusicSheetCalculator extends MusicSheetCalculator{constructor(e){var i,r,s,o,a,l,c,u;super(),this.beamsNeedUpdate=!1,this.rules=e,MusicSheetCalculator.symbolFactory=new VexFlowGraphicalSymbolFactory,MusicSheetCalculator.TextMeasurer=new VexFlowTextMeasurer(this.rules),MusicSheetCalculator.stafflineNoteCalculator=new VexflowStafflineNoteCalculator(this.rules),((i=this.rules.DefaultVexFlowNoteFont)==null?void 0:i.toLowerCase())==="gonville"?Vex.Flow.DEFAULT_FONT_STACK=[(r=Vex.Flow.Fonts)==null?void 0:r.Gonville,(s=Vex.Flow.Fonts)==null?void 0:s.Bravura,(o=Vex.Flow.Fonts)==null?void 0:o.Custom]:((a=this.rules.DefaultVexFlowNoteFont)==null?void 0:a.toLowerCase())==="petaluma"&&(Vex.Flow.DEFAULT_FONT_STACK=[(l=Vex.Flow.Fonts)==null?void 0:l.Petaluma,(c=Vex.Flow.Fonts)==null?void 0:c.Gonville,(u=Vex.Flow.Fonts)==null?void 0:u.Bravura])}clearRecreatedObjects(){super.clearRecreatedObjects(),MusicSheetCalculator.stafflineNoteCalculator=new VexflowStafflineNoteCalculator(this.rules);for(const e of this.graphicalMusicSheet.MeasureList)for(const i of e)i==null||i.clean()}formatMeasures(){for(const e of this.graphicalMusicSheet.MeasureList){if(!e||!e[0])continue;e[0].format();for(const r of e){for(const s of r.staffEntries)s.calculateXPosition();r.finalizeBeams()}}this.beamsNeedUpdate=!1}calculateMeasureXLayout(e){const i=[];for(const m of e)m&&i.push(m);if(i.length===0)return 0;e=i;const r=[],s=new VF.Formatter({softmaxFactor:this.rules.SoftmaxFactorVexFlow});let o=e[0].staffEntries.length,a=1;for(const m of e){if(!m)continue;let d=0;for(const b of m.staffEntries)d+=b.setMaxAccidentals();m.parentSourceMeasure.ImplicitMeasure&&(o=Math.max(m.staffEntries.length,o),a=Math.max(m.staffEntries.length+d,a));const g=m.vfVoices,y=[];for(const b in g)g.hasOwnProperty(b)&&(y.push(g[b]),r.push(g[b]));if(y.length===0){loglevelExports.debug("Found a measure with no voices. Continuing anyway.",g);continue}s.joinVoices(y)}let l=12;const c=e[0].parentSourceMeasure,u=.3;if(r.length>0){l=s.preCalculateMinTotalWidth(r)/unitInPixels*this.rules.VoiceSpacingMultiplierVexflow+this.rules.VoiceSpacingAddendVexflow+o*u,c!=null&&c.ImplicitMeasure&&(l=c.Duration.RealValue/c.ActiveTimeSignature.RealValue*l,o>1&&(l+=a*u*1.5),l*=this.rules.PickupMeasureWidthMultiplier),MusicSheetCalculator.setMeasuresMinStaffEntriesWidth(e,l);const m=(g,y)=>{s.formatToStave(r,y.getVFStave())},d=(g,y)=>{s.formatToStave(r,y.getVFStave(),{align_rests:!0,context:void 0})};for(const g of e){if(this.rules.AlignRests===AlignRestOption.Never)g.formatVoices=m;else if(this.rules.AlignRests===AlignRestOption.Always)g.formatVoices=d;else if(this.rules.AlignRests===AlignRestOption.Auto){let y=!1;for(const b of g.staffEntries){let S=0,E=0;for(const x of b.graphicalVoiceEntries)if(x.parentVoiceEntry.IsGrace||x&&x.notes&&x.notes[0]&&x.notes[0].sourceNote&&x.notes[0].sourceNote.PrintObject&&S++,x&&x.notes&&x.notes[0]&&x.notes[0].sourceNote&&x.notes[0].sourceNote.isRest()&&x.notes[0].sourceNote.PrintObject&&E++,S>1&&E>=1){y=!0;break}if(y)break}y?g.formatVoices=d:g.formatVoices=m}if(g===e[0]){const y=g;y.formatVoices(l*unitInPixels,y)}}}for(const m of e)if(m)for(const d of m.staffEntries)d.calculateXPosition();for(const m of e){if(!m)continue;const d=m.vfVoices,g=[];for(const y in d)d.hasOwnProperty(y)&&g.push(d[y]);if(g.length===0){loglevelExports.debug("Found a measure with no voices. Continuing anyway.",d);continue}s.joinVoices(g)}return l}calculateElongationFactor(e,i,r,s,o,a,l,c){let u=o,m=0;for(const d of e){const g=d.GraphicalLabel.Label.textAlignment;let y=l,b=c;if(d instanceof GraphicalLyricEntry&&d.ParentLyricWord){d.LyricsEntry.SyllableIndex>0&&(y=this.rules.BetweenSyllableMinimumDistance,TextAlignment.IsCenterAligned(g)&&(y+=1));const N=d.ParentLyricWord.GetLyricWord.Syllables;N.length>1&&d.LyricsEntry.SyllableIndex4&&(G*=1.1)}}else r[m]&&(G=_/P);I=Math.max(D,G),u=Math.max(u,I);let $=Math.max(_-P||0,0);r[m]&&($+=r[m].cumulativeOverlap),r[m]={cumulativeOverlap:$,extend:d instanceof GraphicalLyricEntry?d.LyricsEntry.extend:!1,labelWidth:E,measureNumber:a,sourceNoteDuration:d instanceof GraphicalLyricEntry?d.LyricsEntry&&d.LyricsEntry.Parent.Notes[0].Length:!1,text:d instanceof GraphicalLyricEntry?d.LyricsEntry.Text:d.GraphicalLabel.Label.text,xPosition:A},m++}return u}calculateElongationFactorFromStaffEntries(e,i,r,s){let o=r;const a={},l={};for(const c of e)c.LyricsEntries.length>0&&(o=this.calculateElongationFactor(c.LyricsEntries,c,a,i,o,s,this.rules.HorizontalBetweenLyricsDistance,this.rules.LyricOverlapAllowedIntoNextMeasure)),c.graphicalChordContainers.length>0&&(o=this.calculateElongationFactor(c.graphicalChordContainers,c,l,i,o,s,this.rules.ChordSymbolXSpacing,this.rules.ChordOverlapAllowedIntoNextMeasure));return o}calculateMeasureWidthFromStaffEntries(e,i){var a;let r=1;if(!((a=window.GYM)==null?void 0:a.multitrack))for(const l of e)!l||l.staffEntries.length===0||(r=this.calculateElongationFactorFromStaffEntries(l.staffEntries,i,r,l.MeasureNumber),r=1);return r=Math.min(r,this.rules.MaximumLyricsElongationFactor),i*r}createGraphicalTie(e,i,r,s,o){return new GraphicalTie(e,s,o)}updateStaffLineBorders(e){e.SkyBottomLineCalculator.updateStaffLineBorders()}graphicalMeasureCreatedCalculations(e){e.rules=this.rules,e.graphicalMeasureCreatedCalculations()}layoutVoiceEntry(e,i,r,s){for(let o=0;o=2&&(a=s.vfnote[0],l=s.vfnote[1]);let c,u=0;if(o&&o.vfnote&&o.vfnote.length>=2&&(c=o.vfnote[0],u=o.vfnote[1]),i){if(a){const E=new VF.StaveTie({first_indices:[l],first_note:a}),x=s.parentVoiceEntry.parentStaffEntry.parentMeasure;if(c){c.getDuration()==="w"&&((d=(m=c.keyProps)==null?void 0:m[0])==null?void 0:d.line)>=3&&c.setStemDirection(-1);let A=((g=window.GYM)==null?void 0:g.tieDirection)||0;Math.abs(A)===1&&(((b=(y=c.keyProps)==null?void 0:y[0])==null?void 0:b.line)>=3?c.setStemDirection(-A):c.setStemDirection(A)),E==null||E.setDirection(c.getStemDirection())}if(x.vfTies.length>0){const A=x.vfTies[0].direction;E==null||E.setDirection(A?-A:1)}x.addStaveTie(E,e)}if(c){const E=new VF.StaveTie({last_indices:[u],last_note:c}),x=o.parentVoiceEntry.parentStaffEntry.parentMeasure;if(x.vfTies.length>0){const A=x.vfTies[0].direction;E==null||E.setDirection(A?-A:1)}x.addStaveTie(E,e)}}else if(a||c){let E;if(r)if(e.Tie.Type==="S"){const _=e.StartNote.sourceNote,P=e.EndNote.sourceNote;let T=1;_.FretNumber>P.FretNumber&&(T=-1),E=new VF.TabSlide({first_indices:[l],first_note:a,last_indices:[u],last_note:c},T)}else E=new VF.TabTie({first_indices:[l],first_note:a,last_indices:[u],last_note:c},e.Tie.Type);else{E=new VF.StaveTie({first_indices:[l],first_note:a,last_indices:[u],last_note:c});const _=e.Tie.getTieDirection(s.sourceNote);_===PlacementEnum.Below?E.setDirection(1):_===PlacementEnum.Above&&E.setDirection(-1);try{Math.abs((a==null?void 0:a.getTieRightX())-(c==null?void 0:c.getTieLeftX()))<10&&(E.render_options.first_x_shift=-3,E.render_options.last_x_shift=3)}catch(P){console.log(P)}}const x=o.parentVoiceEntry.parentStaffEntry.parentMeasure,A=((S=window.GYM)==null?void 0:S.graceCustom)||!1;A&&E.setDirection(A.direction),x.addStaveTie(E,e)}}calculateDynamicExpressionsForMultiExpression(e,i,r){if(ithis.rules.MaxMeasureToDrawIndex)return;const s=e.AbsoluteTimestamp,o=this.graphicalMusicSheet.MeasureList[i],a=o[r].ParentStaffLine,l=o[r];if(!a)return;const c=this.getRelativePositionInStaffLineFromTimestamp(s,r,a,a==null?void 0:a.isPartOfMultiStaffInstrument());if(c.x<=0&&(c.x=l.beginInstructionsWidth+this.rules.RhythmRightMargin),e.InstantaneousDynamic){const u=new VexFlowInstantaneousDynamicExpression(e.InstantaneousDynamic,a,l);this.calculateGraphicalInstantaneousDynamicExpression(u,c,s),this.dynamicExpressionMap.set(s.RealValue,u.PositionAndShape)}if(e.StartingContinuousDynamic){const u=e.StartingContinuousDynamic,m=new VexFlowContinuousDynamicExpression(e.StartingContinuousDynamic,a,l.parentSourceMeasure);if(m.StartMeasure=l,!m.IsVerbal&&u.EndMultiExpression)try{this.calculateGraphicalContinuousDynamic(m,c),m.updateSkyBottomLine()}catch(d){}else m.IsVerbal?this.calculateGraphicalVerbalContinuousDynamic(m,c):loglevelExports.warn("This continuous dynamic is not covered. measure"+e.SourceMeasureParent.MeasureNumber)}}createMetronomeMark(e,i){var A,_,P,T,M,C,I,D,G;const r=Math.max(e.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber-1,0),s=i||r,o=Math.max(e.StaffNumber-1,0),a=this.graphicalMusicSheet.MeasureList[s][o].getVFStave();let l="q";if(e.beatUnit){const $=NoteTypeHandler.getNoteDurationFromType(e.beatUnit);l=VexFlowConverter.durations($,!1)[0]}let c=this.rules.MetronomeMarkYShift,u=!1;const m=[];if(e.parentMeasure){for(const $ of e.parentMeasure.StaffLinkedExpressions)for(const N of $)N&&N instanceof UnknownExpression&&m.push(N);for(const $ of e.parentMeasure.TempoExpressions){const N=((A=$.InstantaneousTempo)==null?void 0:A.Enum)===TempoEnum.metronomeMark;if(!e.beatUnit&&$.InstantaneousTempo.beatUnit){const z=NoteTypeHandler.getNoteDurationFromType(e.beatUnit);l=VexFlowConverter.durations(z,!1)[0]}if($.getPlacementOfFirstEntry()===PlacementEnum.Above&&!N){u=!0;break}}}u&&(c-=1.4);const d=(_=this.graphicalMusicSheet.MeasureList[0][0].ParentStaffLine)==null?void 0:_.SkyLine;let g=e.TempoInBpm,y="",b="",S="";for(const $ of this.graphicalMusicSheet.MeasureList[s][o].parentSourceMeasure.TempoExpressions){if(b=$.CombinedExpressionsText,isSpecialMark($.CombinedExpressionsText)){y=$.CombinedExpressionsText;break}if(isSpeedKeyword($.CombinedExpressionsText)||isSpeedHiddenKeyword($.CombinedExpressionsText)){y=formatSpeedKeyword($.CombinedExpressionsText),g=$.sourceMeasure.TempoInBPM,isSpeedKeyword($.CombinedExpressionsText)&&(S=l);break}}const E={bpm:e.TempoInBpm,dots:e.dotted,duration:l,name:y};y&&(E.bpm=g/(E.dots?1.5:1),isSpeedKeyword(b)?E.duration=S:(g===SpeedTag[y]||!SpeedTag[y])&&(E.duration=""));const x=((T=(P=this.graphicalMusicSheet.MeasureList[s][o].vfVoices)==null?void 0:P[1])==null?void 0:T.boundingBox.y)||0;if(this.rules.MetronomeMarksDrawn){if(d){const R=((C=(M=this.graphicalMusicSheet.MeasureList[0])==null?void 0:M[o])==null?void 0:C.ParentStaffLine).Measures.map(H=>H.MeasureNumber-1);if(x&&R.includes(s)&&(isSpeedKeyword(b)||isSpeedHiddenKeyword(b))){const H=d.slice(0,9);let O=Math.min(...H);O=O<0?O-1:O,c+=O}R.includes(s)&&m.length?d[0]=Math.min(d[0],-4.5+c-4):d[0]=Math.min(d[0],-4.5+c)}a.options.line_config.reduce((z,R)=>(R.visible&&z++,z),0)<5&&(c-=2),a.setTempo(E,c*unitInPixels);let N=0;try{const z=(G=(D=(I=this.graphicalMusicSheet.MeasureList[s][o])==null?void 0:I.vfVoices)==null?void 0:D[1])==null?void 0:G.getTickables();N+=z[e.parentMeasure.metronomeNoteIndex].getBoundingBox().getX()-a.getNoteStartX()}catch(z){}a.getModifiers()[a.getModifiers().length-1].setShiftX(N)}}calculateRehearsalMark(e){var u,m,d,g,y,b,S,E;const i=e.rehearsalExpression;if(!i)return;const r=(d=(m=(u=e.VerticalMeasureList)==null?void 0:u[0])==null?void 0:m.getVFStave)==null?void 0:d.call(m);if(!r)return;const s=-this.rules.RehearsalMarkYOffsetDefault-this.rules.RehearsalMarkYOffset;let o=this.rules.RehearsalMarkXOffsetDefault+this.rules.RehearsalMarkXOffset;e.IsSystemStartMeasure&&(o+=this.rules.RehearsalMarkXOffsetSystemStartMeasure);const a=this.rules.RehearsalMarkFontSize,l=r.getModifiers(),c=l.find(x=>x.getCategory().toLocaleLowerCase()==="repetitions");if(c&&c.setShiftY(c.y_shift-10),r.setSection(i.label,s,o,a),(y=(g=e.VerticalMeasureList)==null?void 0:g[0])!=null&&y.ParentStaffLine.AbstractExpressions){const x=l.find(A=>A.getCategory().toLocaleLowerCase()==="stavesection");for(let A of((E=(S=(b=e==null?void 0:e.VerticalMeasureList)==null?void 0:b[0])==null?void 0:S.ParentStaffLine)==null?void 0:E.AbstractExpressions)||[])A instanceof GraphicalUnknownExpression&&(x&&(A.Label.PositionAndShape.RelativePosition.y-=.5),c&&(A.Label.PositionAndShape.RelativePosition.y-=1.7))}}calculateSingleOctaveShift(e,i,r,s){var b;const o=i.OctaveShiftStart,a=o.ParentStartMultiExpression.Timestamp,l=(b=o.ParentEndMultiExpression)==null?void 0:b.Timestamp,c=this.rules.MinMeasureToDrawIndex,u=this.rules.MaxMeasureToDrawIndex;let m=this.graphicalMusicSheet.MeasureList[r][s].ParentStaffLine;m||(m=this.graphicalMusicSheet.MeasureList[c][s].ParentStaffLine);let d;o.ParentEndMultiExpression?d=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentEndMultiExpression.SourceMeasureParent,s):d=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0),d.MeasureNumber>u+1&&(d=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0));let g;if(o.ParentEndMultiExpression?g=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentStartMultiExpression.SourceMeasureParent,s):g=this.graphicalMusicSheet.MeasureList[c][s],g.MeasureNumberu||d.parentSourceMeasure.measureListIndexu)return;let y=d.ParentStaffLine;if(y||(y=m),d&&m&&y){const S=new VexFlowOctaveShift(o,m.PositionAndShape);if(!S.startNote){let A;for(const _ of g.staffEntries)if(_){A=_;break}if(!A||(S.setStartNote(A),!S.startNote))return}if(!S.endNote){let A;for(let _=d.staffEntries.length-1;_>=0;_++)if(d.staffEntries[_]){A=d.staffEntries[_];break}if(S.setEndNote(A),!S.endNote)return}let E=g.findGraphicalStaffEntryFromTimestamp(a);E||(E=g.staffEntries[0]);let x=d.findGraphicalStaffEntryFromTimestamp(l);if(x||(x=d.staffEntries[d.staffEntries.length-1]),S.setStartNote(E),y!==m){S.endsOnDifferentStaffLine=!0;let A=m.Measures[m.Measures.length-1];A===void 0&&(A=d);const _=A.staffEntries[A.staffEntries.length-1];S.setEndNote(_);const P=y.ParentMusicSystem.Id-m.ParentMusicSystem.Id;if(P>0)for(let T=m.ParentMusicSystem.Id;Tu+1&&(d=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0));let g;if(o.ParentEndMultiExpression?g=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentStartMultiExpression.SourceMeasureParent,s):(g=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentStartMultiExpression.SourceMeasureParent,s),g||(g=this.graphicalMusicSheet.MeasureList[c][s])),g.MeasureNumberu||d.parentSourceMeasure.measureListIndexu)return;let y=d.ParentStaffLine;if(y||(y=m),d&&m&&y){let S=!1;m!==y&&(S=!0);const E=new VexFlowPedal(o,m.PositionAndShape,!1,S);let x=g.findGraphicalStaffEntryFromTimestamp(a);x||(x=g.staffEntries[0]);let A=d.findGraphicalStaffEntryFromTimestamp(l);if(A||(A=d.staffEntries[d.staffEntries.length-1]),!E.setStartNote(x))return;if(y!==m)if(E.pedalSymbol===MusicSymbol.PEDAL_SYMBOL){E.setEndNote(A),E.setEndMeasure(d),E.ReleaseText=" ",E.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(E.startVfVoiceEntry,E.endVfVoiceEntry,E,m);const _=y.Measures[0],P=new VexFlowPedal(o,_.PositionAndShape),T=_.staffEntries[0];if(!P.setStartNote(T))return;P.setEndNote(A),E.setEndMeasure(d),y.Pedals.push(P),P.CalculateBoundingBox(),P.DepressText=" ",this.calculatePedalSkyBottomLine(P.startVfVoiceEntry,P.endVfVoiceEntry,P,y)}else{let _=m.Measures[m.Measures.length-1];_===void 0&&(_=d);const P=_.staffEntries[_.staffEntries.length-1];E.setEndNote(P),E.setEndMeasure(d),E.ChangeEnd=!1;const T=y.ParentMusicSystem.Id-m.ParentMusicSystem.Id;if(T>0){let M=1;for(let C=m.ParentMusicSystem.Id;Cu+1&&(d=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0));let g;if(o.ParentEndMultiExpression?g=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(o.ParentStartMultiExpression.SourceMeasureParent,s):g=this.graphicalMusicSheet.MeasureList[c][s],g.MeasureNumberu||d.parentSourceMeasure.measureListIndexu)return;let y=d.ParentStaffLine;if(y||(y=m),d&&m&&y){const E=new VexflowVibratoBracket(o,m.PositionAndShape,g.ParentStaff.isTab);let x=g.findGraphicalStaffEntryFromTimestamp(a);x||(x=g.staffEntries[0]);let A=d.findGraphicalStaffEntryFromTimestamp(l);if(A||(A=d.staffEntries[d.staffEntries.length-1]),E.setStartNote(x),y!==m){let _=m.Measures[m.Measures.length-1];_===void 0&&(_=d);const P=_.staffEntries[_.staffEntries.length-1];if(E.setEndNote(P),y.ParentMusicSystem.Id-m.ParentMusicSystem.Id>0)for(let M=m.ParentMusicSystem.Id;Md){const _=d;d=m,m=_}s.SkyBottomLineCalculator.updateBottomLineInRange(m,d,g+x)}for(const x of s.Pedals){const A=x,_=A.getPedalMarking(),P=_.line+3+(s.StaffLines.length-1);if(g>P){const T=_.render_options.text_margin_right/10;let M=A.startVfVoiceEntry.PositionAndShape.AbsolutePosition.x-T,C;A.setLine(g-3-(s.StaffLines.length-1));let I=(b=A.endVfVoiceEntry)==null?void 0:b.PositionAndShape;if(I||(I=A.endMeasure.PositionAndShape),A.EndSymbolPositionAndShape){const D=l.render_options.glyph_point_size/20;C=M+3.4;const G=I.AbsolutePosition.x-T,$=G+1.5;s.SkyBottomLineCalculator.updateBottomLineInRange(M,C,g+D),s.SkyBottomLineCalculator.updateBottomLineInRange(G,$,g+D)}else{const D=_.render_options.bracket_height/10;if(_.EndsStave)C=I.AbsolutePosition.x+I.Size.width-T;else switch(l.style){case a.BRACKET_OPEN_END:case a.BRACKET_OPEN_BOTH:case a.MIXED_OPEN_END:C=I.AbsolutePosition.x+I.BorderRight-T;break;default:C=I.AbsolutePosition.x+I.BorderLeft-T;break}const G=(E=(S=A.endVfVoiceEntry)==null?void 0:S.parentStaffEntry)==null?void 0:E.vfClefBefore;if(G){const $=G.getWidth()/10;C+=$}if(M>C){const $=M;M=C,C=$}s.SkyBottomLineCalculator.updateBottomLineInRange(M,C,g+D)}}}}calculateOctaveShiftSkyBottomLine(e,i,r,s){if(!i){loglevelExports.warn("octaveshift: no endStaffEntry");return}let o=e.PositionAndShape.Size.width,a=i.PositionAndShape.Size.width;e.hasOnlyRests()?o=-o:o/=2,i.hasOnlyRests()?a*=2:a/=2,e===i&&(a*=2);const l=e.PositionAndShape.AbsolutePosition.x-o,c=i.PositionAndShape.AbsolutePosition.x+a;r.PositionAndShape.Size.width=l-c;const u=r.getTextBracket(),m=u.font.size/10;if(u.position===VF.TextBracket.Positions.TOP){const d=Math.ceil(s.SkyBottomLineCalculator.getSkyLineMinInRange(l,c));if(d===1/0)return;u.start.getStave().options.top_text_position=Math.abs(d),s.SkyBottomLineCalculator.updateSkyLineInRange(l,c,d-m*2)}else{const d=s.SkyBottomLineCalculator.getBottomLineMaxInRange(l,c);if(d===1/0)return;u.start.getStave().options.bottom_text_position=d,e.parentMeasure!==i.parentMeasure&&(u.stop.getStave().options.bottom_text_position=d),s.SkyBottomLineCalculator.updateBottomLineInRange(l,c,d+m*1.5)}}calculateWordRepetitionInstruction(e,i){let r;const s=this.graphicalMusicSheet.MeasureList[i];for(let o=0,a=s.length;o{r.updateSkyBottomLine()})}catch(r){}}handleTiedGraphicalNote(e,i,r,s,o,a,l,c){}handleBeam(e,i,r){e.parentVoiceEntry.parentStaffEntry.parentMeasure.handleBeam(e,i)}handleVoiceEntryLyrics(e,i,r){e.LyricsEntries.forEach((s,o)=>{const a=new GraphicalLyricEntry(o,i,this.rules.LyricsHeight,this.rules.StaffHeight);if(i.LyricsEntries.push(a),a.GraphicalLabel.setLabelPositionAndShapeBorders(),o.Word){const c=o.Word.Syllables.indexOf(o);let u=r.indexOf(o.Word);if(u===-1&&(r.push(o.Word),u=r.indexOf(o.Word)),this.graphicalLyricWords.length===0||u>this.graphicalLyricWords.length-1){const m=new GraphicalLyricWord(o.Word);a.ParentLyricWord=m,m.GraphicalLyricsEntries[c]=a,this.graphicalLyricWords.push(m)}else{const m=this.graphicalLyricWords[u];a.ParentLyricWord=m,m.GraphicalLyricsEntries[c]=a,m.isFilled()&&(r.splice(u,1),this.graphicalLyricWords.splice(this.graphicalLyricWords.indexOf(m),1))}}})}handleVoiceEntryOrnaments(e,i,r){}handleVoiceEntryArticulations(e,i,r){}handleVoiceEntryTechnicalInstructions(e,i,r){}handleTuplet(e,i,r){e.parentVoiceEntry.parentStaffEntry.parentMeasure.handleTuplet(e,i)}findIndexGraphicalSlurFromSlur(e,i){for(let r=0;r=0){const d=s[m];d.staffEntries.indexOf(a)===-1&&d.staffEntries.push(a),s.splice(m,1)}}}for(const l of s)l.staffEntries.indexOf(a)===-1&&l.staffEntries.push(a)}}for(const i of this.musicSystems)for(const r of i.StaffLines){const s=r.GraphicalSlurs.sort(GraphicalSlur.Compare);for(const o of s)o.slur.isCrossed()||o.calculateCurve(this.rules)}}}class MusicPartManager{constructor(e){this.musicSheet=e}reInit(){this.init()}init(){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()}getCurrentRepetitionTimestampTransform(e){let i;for(let r=this.timestamps.length-1;r>=0;r--)if(i=this.timestamps[r],e.gte(i.from))return i;return this.timestamps[0]}absoluteEnrolledToSheetTimestamp(e){if(this.timestamps.length===0)return e;const i=this.getCurrentRepetitionTimestampTransform(e);return Fraction$1.plus(e,Fraction$1.minus(i.to,i.from))}get Parts(){return this.parts}get MusicSheet(){return this.musicSheet}getIterator(e){return e?new MusicPartManagerIterator(this.musicSheet,e,void 0):new MusicPartManagerIterator(this.musicSheet,this.musicSheet.SelectionStart,this.musicSheet.SelectionEnd)}setSelectionStart(e){this.musicSheet.SelectionStart=e,this.musicSheet.SelectionEnd=void 0}setSelectionRange(e,i){this.musicSheet.SelectionStart=e!=null?e:this.sheetStart,this.musicSheet.SelectionEnd=i!=null?i:this.sheetEnd}calcMapping(){this.timestamps=[];const e=this.getIterator();let i=e.CurrentRepetition,r=new TimestampTransform(e.CurrentEnrolledTimestamp.clone(),e.CurrentSourceTimestamp.clone(),void 0,0);for(this.timestamps.push(r);!e.EndReached;){if(e.JumpOccurred||i!==e.CurrentRepetition){if(i=e.CurrentRepetition,e.backJumpOccurred){const s=e.JumpResponsibleRepetition;r.nextBackJump=e.CurrentEnrolledTimestamp,r.curRepetition=s,r.curRepetitionIteration=e.CurrentJumpResponsibleRepetitionIterationBeforeJump;for(let o=this.timestamps.length-2;o>=0&&!(s.AbsoluteTimestamp.gt(this.timestamps[o].to)||this.timestamps[o].curRepetition);o--)this.timestamps[o].nextBackJump=r.nextBackJump,this.timestamps[o].curRepetition=s,this.timestamps[o].curRepetitionIteration=r.curRepetitionIteration}r=new TimestampTransform(e.CurrentEnrolledTimestamp.clone(),e.CurrentSourceTimestamp.clone(),void 0,0),this.timestamps.push(r)}e.moveToNext()}}}class TimestampTransform{constructor(e,i,r,s){this.from=e,this.to=i,this.curRepetition=r,this.curRepetitionIteration=s,this.nextBackJump=void 0,this.nextForwardJump=void 0}}class PartListEntry{constructor(e){this.enrolledTimestamps=[],this.visible=!0,this.musicSheet=e}get Visible(){return this.visible}set Visible(e){this.visible=e}getFirstSourceMeasure(){return this.musicSheet.SourceMeasures[this.startIndex]}getLastSourceMeasure(){return this.musicSheet.SourceMeasures[this.endIndex]}}class SourceMusicPart extends PartListEntry{constructor(e,i,r){super(e),this.musicSheet=e,this.startIndex=i,this.endIndex=r}get MeasuresCount(){return this.endIndex-this.startIndex+1}get StartIndex(){return this.startIndex}get EndIndex(){return this.endIndex}get ParentRepetition(){return this.parentRepetition}set ParentRepetition(e){this.parentRepetition=e}get AbsoluteTimestamp(){return Fraction$1.createFromFraction(this.musicSheet.SourceMeasures[this.startIndex].AbsoluteTimestamp)}setStartIndex(e){this.startIndex=e}setEndIndex(e){this.endIndex=e}}class Repetition extends PartListEntry{constructor(e,i=!1){super(e),this.backwardJumpInstructions=[],this.endingParts=[],this.endingIndexDict={},this.userNumberOfRepetitions=0,this.visibles=[],this.fromWords=!1,this.repetitonIterationOrder=[],this.numberOfEndings=1,this.musicSheet2=e,this.virtualOverallRepetition=i}get BackwardJumpInstructions(){return this.backwardJumpInstructions}get EndingIndexDict(){return this.endingIndexDict}get EndingParts(){return this.endingParts}get Visibles(){return this.visibles}set Visibles(e){this.visibles=e}get DefaultNumberOfRepetitions(){let e=2;return this.virtualOverallRepetition&&(e=1),Math.max(e,Object.keys(this.endingIndexDict).length,this.checkRepetitionForMultipleLyricVerses())}get UserNumberOfRepetitions(){return this.userNumberOfRepetitions}set UserNumberOfRepetitions(e){this.userNumberOfRepetitions=e,this.repetitonIterationOrder=[];const i=this.userNumberOfRepetitions-this.NumberOfEndings;for(let r=1;r<=this.userNumberOfRepetitions;r++)r<=i?this.repetitonIterationOrder.push(1):this.repetitonIterationOrder.push(r-i)}getForwardJumpTargetForIteration(e){const i=this.repetitonIterationOrder[e-1];return this.endingIndexDict[i]?this.endingIndexDict[i].part.StartIndex:-1}getBackwardJumpTarget(){return this.startMarker.measureIndex}setEndingsStartIndex(e,i){const r=new RepetitionEndingPart(new SourceMusicPart(this.musicSheet2,i,i));this.endingParts.push(r);for(const s of e)try{this.endingIndexDict[s]=r,r.endingIndices.push(s),this.numberOfEndings0&&(s=1),o.Add(new Fraction$1(s,i)),o}}class MusicSheet{constructor(){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}get SoundTempos(){return this.soundTempos}set SoundTempos(e){this.soundTempos=e}static getIndexFromStaff(e){return e.idInMusicSheet}get CurrentKeyInstruction(){return this.currentKeyInstruction}set CurrentKeyInstruction(e){this.currentKeyInstruction=e}get SourceMeasures(){return this.sourceMeasures}set SourceMeasures(e){this.sourceMeasures=e}get Repetitions(){return this.repetitions}set Repetitions(e){this.repetitions=e}get DynListStaves(){return this.dynListStaves}get TimestampSortedTempoExpressionsList(){return this.timestampSortedTempoExpressionsList}get TimestampSortedDynamicExpressionsList(){return this.timestampSortedDynamicExpressionsList}get InstrumentalGroups(){return this.instrumentalGroups}get Parts(){return this.instruments}get Instruments(){return this.instruments}get SheetPlaybackSetting(){return this.playbackSettings}set SheetPlaybackSetting(e){this.playbackSettings=e}get DrawErroneousMeasures(){return this.drawErroneousMeasures}set DrawErroneousMeasures(e){this.drawErroneousMeasures=e}get HasBeenOpenedForTheFirstTime(){return this.hasBeenOpenedForTheFirstTime}set HasBeenOpenedForTheFirstTime(e){this.hasBeenOpenedForTheFirstTime=e}InitializeStartTempoInBPM(e){this.playbackSettings.BeatsPerMinute=e,this.userStartTempoInBPM=e}get DefaultStartTempoInBpm(){return this.defaultStartTempoInBpm}set DefaultStartTempoInBpm(e){this.defaultStartTempoInBpm=e,this.InitializeStartTempoInBPM(e)}get Path(){return this.path}set Path(e){this.path=e}get Staves(){return this.staves}get TitleString(){return this.title?this.title.text:""}set TitleString(e){this.Title=new Label(e)}get SubtitleString(){return this.subtitle?this.subtitle.text:""}set SubtitleString(e){this.Subtitle=new Label(e)}get ComposerString(){return this.composer?this.composer.text:""}set ComposerString(e){this.Composer=new Label(e)}get LyricistString(){return this.lyricist?this.lyricist.text:""}set LyricistString(e){this.Lyricist=new Label(e)}get Title(){return this.title}set Title(e){this.title=e}get Subtitle(){return this.subtitle}set Subtitle(e){this.subtitle=e}get Composer(){return this.composer}set Composer(e){this.composer=e}get Lyricist(){return this.lyricist}set Lyricist(e){this.lyricist=e}get Rules(){return this.rules||(loglevelExports.debug("warning: sheet.Rules was undefined. Creating new EngravingRules."),this.rules=new EngravingRules),this.rules}set Rules(e){this.rules=e}get SheetErrors(){return this.musicSheetErrors}get PlaybackDataDict(){return this.playbackDataDict}get SelectionStart(){return this.selectionStart}set SelectionStart(e){this.selectionStart=e.clone(),this.currentEnrolledPosition=e.clone()}get SelectionEnd(){return this.selectionEnd}set SelectionEnd(e){this.selectionEnd=e}set HasBPMInfo(e){this.hasBPMInfo=e}get HasBPMInfo(){return this.hasBPMInfo}addMeasure(e){this.sourceMeasures.push(e),e.measureListIndex=this.sourceMeasures.length-1}checkForInstrumentWithNoVoice(){for(let e=0,i=this.instruments.length;e0){const e=this.TimestampSortedTempoExpressionsList[0];if(e.InstantaneousTempo)return e.InstantaneousTempo.TempoInBpm;if(e.ContinuousTempo)return e.ContinuousTempo.StartTempo}return this.userStartTempoInBPM}get Errors(){return this.musicSheetErrors.measureErrors}get FirstMeasureNumber(){try{return this.getFirstSourceMeasure().MeasureNumber}catch(e){return loglevelExports.info("MusicSheet.FirstMeasureNumber: ",e),0}}get LastMeasureNumber(){try{return this.getLastSourceMeasure().MeasureNumber}catch(e){return loglevelExports.info("MusicSheet.LastMeasureNumber: ",e),0}}get CurrentEnrolledPosition(){return this.currentEnrolledPosition.clone()}set CurrentEnrolledPosition(e){this.currentEnrolledPosition=e.clone()}get Transpose(){return this.transpose}set Transpose(e){this.transpose=e}get FullNameString(){return this.ComposerString+" "+this.TitleString}get IdString(){return this.idString}set IdString(e){this.idString=e}getEnrolledSelectionStartTimeStampWorkaround(){const e=this.MusicPartManager.getIterator(this.SelectionStart);return Fraction$1.createFromFraction(e.CurrentEnrolledTimestamp)}get SheetEndTimestamp(){const e=this.getLastSourceMeasure();return Fraction$1.plus(e.AbsoluteTimestamp,e.Duration)}getSourceMeasureFromTimeStamp(e){for(let i=0,r=this.sourceMeasures.length;i0&&s.Voices[0].Visible&&e.push(s)}return e}}MusicSheet.defaultTitle="[no title given]";class LyricWord{constructor(){this.syllables=[]}get Syllables(){return this.syllables}containsVoiceEntry(e){for(let i=0,r=this.Syllables.length;i=0&&(this.syllableIndex=o)}get Text(){return this.text}set Text(e){this.text=e}get Word(){return this.word}get Parent(){return this.parent}set Parent(e){this.parent=e}get VerseNumber(){return this.verseNumber}get SyllableIndex(){return this.syllableIndex}}class LyricsReader{constructor(e){this.openLyricWords={},this.musicSheet=e}addLyricEntry(e,i){var r,s;if(e){const o=e;for(let a=0,l=o.length;a0)for(let P=x;P1&&(y=parseInt(E[1],10))}catch(E){const x=ITextTranslation.translateText("ReaderErrorMessages/LyricVerseNumberError","Invalid lyric verse number");this.musicSheet.SheetErrors.pushMeasureError(x);continue}}let S;if(u==="single"||u==="end"){if(this.openLyricWords[y]){this.currentLyricWord=this.openLyricWords[y];const E=this.currentLyricWord.Syllables.length;S=new LyricsEntry(d,y,this.currentLyricWord,i,E),this.currentLyricWord.Syllables.push(S),delete this.openLyricWords[y],this.currentLyricWord=void 0}else S=new LyricsEntry(d,y,void 0,i);S.extend=c.element("extend")!==void 0}else if(u==="begin")this.openLyricWords[y]&&(delete this.openLyricWords[y],this.currentLyricWord=void 0),this.currentLyricWord=new LyricWord,this.openLyricWords[y]=this.currentLyricWord,S=new LyricsEntry(d,y,this.currentLyricWord,i,0),this.currentLyricWord.Syllables.push(S);else if(u==="middle")if(this.openLyricWords[y]){this.currentLyricWord=this.openLyricWords[y];const E=this.currentLyricWord.Syllables.length;S=new LyricsEntry(d,y,this.currentLyricWord,i,E),this.currentLyricWord.Syllables.push(S)}else S=new LyricsEntry(d,y,void 0,i);S&&(i.LyricsEntries[y]||(i.LyricsEntries.setValue(y,S),(s=(r=i.ParentSourceStaffEntry)==null?void 0:r.VerticalContainerParent)!=null&&s.ParentMeasure&&(i.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.hasLyrics=!0)),i.ParentVoice.Parent.LyricVersesNumbers[y]||i.ParentVoice.Parent.LyricVersesNumbers.push(y))}}}catch(u){const m=ITextTranslation.translateText("ReaderErrorMessages/LyricError","Error while reading lyric entry.");this.musicSheet.SheetErrors.pushMeasureError(m);continue}}i.ParentVoice.Parent.LyricVersesNumbers=i.ParentVoice.Parent.LyricVersesNumbers.filter((a,l,c)=>c.indexOf(a)===l)}}}class Articulation{constructor(e,i){this.articulationEnum=e,this.placement=i}Equals(e){return e.articulationEnum===this.articulationEnum&&e.placement===this.placement}}class ArticulationReader{constructor(e){this.rules=e}getAccEnumFromString(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}}addArticulationExpression(e,i){var r,s;if(e!==void 0&&e.elements().length>0){const o=e.elements();for(let a=0,l=o.length;a0&&i.Articulations[0].articulationEnum!==ArticulationEnum.staccato&&i.Articulations.splice(0,0,y),u==="strongaccent"){const b=(s=c==null?void 0:c.attribute("type"))==null?void 0:s.value;b==="up"?y.articulationEnum=ArticulationEnum.marcatoup:b==="down"&&(y.articulationEnum=ArticulationEnum.marcatodown)}if(u==="detachedlegato"){const b=new Articulation(ArticulationEnum.staccato,d),S=new Articulation(ArticulationEnum.tenuto,d);i.Articulations.push(b,S)}if(!i.hasArticulation(y))switch(i.Articulations.push(y),y.articulationEnum){case ArticulationEnum.staccato:case ArticulationEnum.staccatissimo:i.DurationModifier=y;break;case ArticulationEnum.accent:case ArticulationEnum.strongaccent:i.VolumeModifier=y;break;default:break}}}catch(m){const d="Invalid note articulation.";loglevelExports.debug("addArticulationExpression",d,m);return}}}}addFermata(e,i){var o;let r=ArticulationEnum.fermata;e.attributes().length>0&&e.attribute("type")&&e.attribute("type").value==="inverted"&&(r=ArticulationEnum.invertedfermata);let s=PlacementEnum.Above;((o=e.attribute("placement"))==null?void 0:o.value)==="below"&&(s=PlacementEnum.Below),i.Articulations.push(new Articulation(r,s))}addTechnicalArticulations(e,i,r){var l,c;const s={bend:ArticulationEnum.bend,"down-bow":ArticulationEnum.downbow,"open-string":ArticulationEnum.naturalharmonic,"snap-pizzicato":ArticulationEnum.snappizzicato,stopped:ArticulationEnum.lefthandpizzicato,"up-bow":ArticulationEnum.upbow};for(const u in s){if(!s.hasOwnProperty(u))continue;const m=s[u],d=e.element(u);if(d){let g;((l=d.attribute("placement"))==null?void 0:l.value)==="above"&&(g=PlacementEnum.Above),((c=d.attribute("placement"))==null?void 0:c.value)==="below"&&(g=PlacementEnum.Below);const y=new Articulation(m,g);i.hasArticulation(y)||i.Articulations.push(y)}}const o=e.element("fingering");if(o){const u=this.createTechnicalInstruction(o,r);u.type=TechnicalInstructionType.Fingering,r.Fingering=u,i.TechnicalInstructions.push(u)}const a=e.element("string");if(a){const u=this.createTechnicalInstruction(a,r);u.type=TechnicalInstructionType.String,r.StringInstruction=u,i.TechnicalInstructions.push(u)}}createTechnicalInstruction(e,i){const r=new TechnicalInstruction;r.sourceNote=i,r.value=e.value;const s=e.attribute("placement");return this.rules.FingeringPositionFromXML&&(r.placement=this.getPlacement(s)),r}getPlacement(e,i=PlacementEnum.NotYetDefined){if(i!==PlacementEnum.NotYetDefined)return i;if(e)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}else return PlacementEnum.NotYetDefined}addOrnament(e,i){if(e){let r;const s={"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(const o in s){if(!s.hasOwnProperty(o))continue;const a=e.element(o);if(a){r=new OrnamentContainer(s[o]);const l=a.attribute("placement");l&&l.value==="below"&&(r.placement=PlacementEnum.Below)}}if(r){const o=e.elements("accidental-mark");if(o){let a=PlacementEnum.Below,l=AccidentalEnum.NONE;const c=o;for(let u=0,m=c.length;u0&&(this.currentVoiceEntry.GraceVoiceEntriesBefore=this.graceVoiceEntriesTempList,this.graceVoiceEntriesTempList=[]))}finalizeReadingMeasure(){this.graceVoiceEntriesTempList.length>0&&this.currentNormalVoiceEntry!==void 0&&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()}read(e,i,r,s,o,a,l,c,u,m,d,g,y,b,S,E,x,A,_,P,T,M,C){this.currentStaffEntry=l,this.currentMeasure=c;try{this.currentNote=a?this.addRestNote(e.element("rest"),i,s,o,y,b,_):this.addSingleNote(e,i,s,r,o,d,g,y,b,S,E,x,A,_,T,M,C),this.currentNote.DotsXml=P;const I=e.elements("lyric");this.lyricsReader!==void 0&&I&&(this.lyricsReader.addLyricEntry(I,this.currentVoiceEntry),this.voice.Parent.HasLyrics=!0);let D=!1;const G=e.element("notations");if(G){this.articulationReader&&this.readArticulations(G,this.currentVoiceEntry,this.currentNote);const $=G.elements("slur");this.slurReader!==void 0&&$.length>0&&!this.currentNote.ParentVoiceEntry.IsGrace&&this.slurReader.addSlur($,this.currentNote);const N=G.elements("tuplet");N.length>0&&(this.openTupletNumber=this.addTuplet(e,N),D=!0);const z=G.element("arpeggiate");if(z!==void 0){let V;if(this.currentVoiceEntry.Arpeggio)V=this.currentVoiceEntry.Arpeggio;else{let k=!1;for(const F of this.currentStaffEntry.VoiceEntries)if(F.Arpeggio){k=!0,V=F.Arpeggio;break}if(!k){let F=ArpeggioType.ARPEGGIO_DIRECTIONLESS;const Z=z.attribute("direction");if(Z)switch(Z.value){case"up":F=ArpeggioType.ROLL_UP;break;case"down":F=ArpeggioType.ROLL_DOWN;break;default:F=ArpeggioType.ARPEGGIO_DIRECTIONLESS}V=new Arpeggio(this.currentVoiceEntry,F),this.currentVoiceEntry.Arpeggio=V}}V.addNote(this.currentNote)}const R=G.elements("tied");R.length>0&&this.addTie(R,u,m,TieTypes.SIMPLE);const H=G.elements("slide");H.length>0&&this.addTie(H,u,m,TieTypes.SLIDE);const O=G.element("technical");if(O){const V=O.elements("hammer-on");V.length>0&&this.addTie(V,u,m,TieTypes.HAMMERON);const k=O.elements("pull-off");k.length>0&&this.addTie(k,u,m,TieTypes.PULLOFF)}}e.element("time-modification")!==void 0&&!D&&this.handleTimeModificationNode(e)}catch(I){loglevelExports.warn(I);const D=ITextTranslation.translateText("ReaderErrorMessages/NoteError","Ignored erroneous Note.");this.musicSheet.SheetErrors.pushMeasureError(D),this.musicSheet.SheetErrors.pushMeasureError(I)}return this.currentNote}checkForStaffEntryLink(e,i,r,s){const o=new StaffEntryLink(this.currentVoiceEntry);o.LinkStaffEntries.push(r),r.Link=o;const a=this.currentVoiceEntry.Timestamp.clone(),l=s.getVerticalContainerByTimestamp(a);return r=l.StaffEntries[e],r||(r=new SourceStaffEntry(l,i),l.StaffEntries[e]=r),r.VoiceEntries.push(this.currentVoiceEntry),o.LinkStaffEntries.push(r),r.Link=o,r}checkForOpenBeam(){this.openBeams.length>0&&this.currentNote&&this.handleOpenBeam()}checkOpenTies(){const e=this.openTieDict;for(const i in e)if(e.hasOwnProperty(i)){const r=e[i];Fraction$1.plus(r.StartNote.ParentStaffEntry.Timestamp,r.Duration).lt(r.StartNote.SourceMeasure.Duration)&&delete e[i]}}hasVoiceEntry(){return this.currentVoiceEntry!==void 0}readArticulations(e,i,r){const s=e.element("articulations");s&&this.articulationReader.addArticulationExpression(s,i);const o=e.element("fermata");o&&this.articulationReader.addFermata(o,i);const a=e.element("technical");a&&this.articulationReader.addTechnicalArticulations(a,i,r);const l=e.element("ornaments");l&&this.articulationReader.addOrnament(l,i)}addSingleNote(e,i,r,s,o,a,l,c,u,m,d,g,y,b,S,E,x){let A=0,_,P=AccidentalEnum.NONE,T=NoteEnum.C,M=NoteEnum.C,C=0,I=0,D,G,$;const N=e.elements();for(let Z=0,U=N.length;Z0&&this.openBeams.last().ExtendedNoteList.push(b),b}addNoteInfo(e,i,r,s,o,a,l,c,u){e.NoteTypeXml=i,e.PrintObject=r,e.IsCueNote=s,e.NormalNotes=o,e.displayStepUnpitched=a,e.displayOctaveUnpitched=l,e.NoteheadColorXml=c,e.NoteheadColor=c}createBeam(e,i){var r;try{const s=e.element("beam");let o;if(s!==void 0&&s.hasAttributes&&(o=s.attribute("number")),o){let a=parseInt(o.value,10);const l=e.elements("beam"),c=l[0].value;l&&(c==="begin"?(a===((r=this.openBeams.last())==null?void 0:r.BeamNumber)?(this.beamNumberOffset++,a+=this.beamNumberOffset):this.openBeams.last()&&this.handleOpenBeam(),this.openBeams.push(new Beam(a,this.beamNumberOffset))):a+=this.beamNumberOffset);let u=!1;if(!(a>0&&a<=this.openBeams.length)||!this.openBeams[a-1]){loglevelExports.debug("[OSMD] invalid beamnumber");return}for(let m=0,d=this.openBeams[a-1].Notes.length;m1){let s=e.element("time-modification");s&&(s=s.element("actual-notes"));const o=i;for(let a=0,l=o.length;a1&&this.openTupletNumber--),this.tupletDict[d]=y;const S=[];S.push(this.currentNote),y.Notes.push(S),y.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=y,this.openTupletNumber=d}else if(m.value==="stop"){let d=1;c.attribute("number")&&(d=parseInt(c.attribute("number").value,10));const g=this.tupletDict[d];if(g){const y=c.attribute("placement");y&&(y.value==="below"?g.tupletLabelNumberPlacement=PlacementEnum.Below:g.tupletLabelNumberPlacement=PlacementEnum.Above,g.PlacementFromXml=!0);const b=[];if(b.push(this.currentNote),g.Notes.push(b),!g.PlacementFromXml){let S=!1;for(const E of g.Notes){for(const x of E)if(!x.isRest()){x.StemDirectionXml===StemDirectionType.Down?g.tupletLabelNumberPlacement=PlacementEnum.Below:g.tupletLabelNumberPlacement=PlacementEnum.Above,S=!0;break}if(S)break}}g.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=g,delete this.tupletDict[d],Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--}}}}}else if(i[0]){const s=i[0];if(s.hasAttributes){const o=s.attribute("type").value;let a=1;s.attribute("number")&&(a=parseInt(s.attribute("number").value,10));const l=isNaN(a),c=s.attribute("bracket");if(c&&c.value==="yes"&&(r=!0),o==="start"){let u=0,m=e.element("time-modification");if(m&&(m=m.element("actual-notes")),m&&(u=parseInt(m.value,10),isNaN(u))){const b=ITextTranslation.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(b),new MusicSheetReadingException(b)}l&&(this.openTupletNumber++,a=this.openTupletNumber);let d=this.tupletDict[a];d||(d=this.tupletDict[a]=new Tuplet(u,r),d.tupletLabelNumberPlacement=PlacementEnum.Above);const g=s.attribute("placement");g&&(g.value==="below"?d.tupletLabelNumberPlacement=PlacementEnum.Below:d.tupletLabelNumberPlacement=PlacementEnum.Above,d.PlacementFromXml=!0);const y=[];y.push(this.currentNote),d.Notes.push(y),d.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=d,this.openTupletNumber=a}else if(o==="stop"){l&&(a=this.openTupletNumber);const u=this.tupletDict[this.openTupletNumber];if(u){const m=s.attribute("placement");m&&(m.value==="below"?u.tupletLabelNumberPlacement=PlacementEnum.Below:u.tupletLabelNumberPlacement=PlacementEnum.Above,u.PlacementFromXml=!0);const d=[];if(d.push(this.currentNote),u.Notes.push(d),!u.PlacementFromXml){let g=!1;for(const y of u.Notes){for(const b of y)if(!b.isRest()){b.StemDirectionXml===StemDirectionType.Down?u.tupletLabelNumberPlacement=PlacementEnum.Below:u.tupletLabelNumberPlacement=PlacementEnum.Above,g=!0;break}if(g)break}}u.Fractions.push(this.getTupletNoteDurationFromType(e)),this.currentNote.NoteTuplet=u,Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--,delete this.tupletDict[a]}}}}return this.openTupletNumber}handleTimeModificationNode(e){if(this.tupletDict[this.openTupletNumber])try{const i=this.tupletDict[this.openTupletNumber],r=CollectionUtil.last(i.Notes),s=r[0].ParentVoiceEntry;let o;s.Timestamp.Equals(this.currentVoiceEntry.Timestamp)?o=r:(o=[],i.Notes.push(o),i.Fractions.push(this.getTupletNoteDurationFromType(e))),o.push(this.currentNote),this.currentNote.NoteTuplet=i}catch(i){const r=ITextTranslation.translateText("ReaderErrorMessages/TupletNumberError","Invalid tuplet number.");throw this.musicSheet.SheetErrors.pushMeasureError(r),i}else if(this.currentVoiceEntry.Notes.length>0){const i=this.currentVoiceEntry.Notes[0];if(i.NoteTuplet){const r=i.NoteTuplet;CollectionUtil.last(r.Notes).push(this.currentNote),this.currentNote.NoteTuplet=r}}}addTie(e,i,r,s){if(e){if(e.length===1){const o=e[0];if(o!==void 0&&o.attributes()){const a=this.getTieDirection(o),l=o.attribute("type").value;try{if(l==="start"){const c=this.findCurrentNoteInTieDict(this.currentNote);c<0&&delete this.openTieDict[c];const u=this.getNextAvailableNumberForTie(),m=new Tie(this.currentNote,s);this.openTieDict[u]=m,m.TieNumber=u,m.TieDirection=a}else if(l==="stop"){const c=this.findCurrentNoteInTieDict(this.currentNote),u=this.openTieDict[c];u&&(u.AddNote(this.currentNote),delete this.openTieDict[c])}}catch(c){const u=ITextTranslation.translateText("ReaderErrorMessages/TieError","Error while reading tie.");this.musicSheet.SheetErrors.pushMeasureError(u)}}}else if(e.length===2){const o=this.findCurrentNoteInTieDict(this.currentNote);if(o>=0){const a=this.openTieDict[o];a.AddNote(this.currentNote);for(const l of e)if(l.attribute("type").value==="start"){const u=this.getTieDirection(l);a.NoteIndexToTieDirection[a.Notes.length-1]=u}}}}}getTieDirection(e){let i=PlacementEnum.NotYetDefined;const r=e.attribute("placement");r&&(r.value==="above"?i=PlacementEnum.Above:r.value==="below"&&(i=PlacementEnum.Below));const s=e.attribute("orientation");return s&&(s.value==="over"?i=PlacementEnum.Above:s.value==="under"&&(i=PlacementEnum.Below)),i}getNextAvailableNumberForTie(){const e=Object.keys(this.openTieDict);if(e.length===0)return 1;e.sort((i,r)=>+i-+r);for(let i=0;i0?s.RealValue>0?(u=Fraction$1.multiply(Fraction$1.minus(s,o),u),this.directionTimestamp=Fraction$1.plus(u,s)):this.directionTimestamp=Fraction$1.createFromFraction(u):this.offsetDivisions<0&&(s.RealValue>0?(u=Fraction$1.multiply(Fraction$1.minus(s,o),u),this.directionTimestamp=Fraction$1.minus(s,u)):this.directionTimestamp=Fraction$1.createFromFraction(u));const m=e.attribute("placement");if(m)try{const d=m.value;d==="below"?this.placement=PlacementEnum.Below:d==="above"&&(this.placement=PlacementEnum.Above)}catch(d){const g=ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");loglevelExports.debug("ExpressionReader.readExpressionParameters",g,d),this.musicSheet.SheetErrors.pushMeasureError(g),this.placement=PlacementEnum.Below}if(this.placement===PlacementEnum.NotYetDefined)try{const d=e.element("direction-type");if(d){const g=d.element("dynamics");if(g){const E=g.attribute("default-y");E&&this.readExpressionPlacement(E,"read dynamics y pos")}const y=d.element("wedge");if(y){const E=y.attribute("default-y");E&&this.readExpressionPlacement(E,"read wedge y pos")}const b=d.element("words");if(b){const E=b.attribute("default-y");E&&this.readExpressionPlacement(E,"read words y pos")}const S=d.element("rehearsal");if(S){const E=S.attribute("default-y");E&&this.readExpressionPlacement(E,"read rehearsal pos")}}}catch(d){const g=ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");loglevelExports.debug("ExpressionReader.readExpressionParameters",g,d),this.musicSheet.SheetErrors.pushMeasureError(g),this.placement=PlacementEnum.Below}this.placement===PlacementEnum.NotYetDefined&&(i.Staves.length>1?this.placement=PlacementEnum.Below:i.HasLyrics?this.placement=PlacementEnum.Above:this.placement=PlacementEnum.Below)}read(e,i,r,s=void 0,o=0){let a=!1,l=!1;const c=e.element("sound");if(c){const d=c.attribute("tempo"),g=c.attribute("dynamics");if(d){const y=d.value.match(/^(\d+)(\.\d+)?$/);(y==null?void 0:y.length)>0?this.soundTempo=Math.round(Number.parseFloat(d.value)):(loglevelExports.info("invalid xml tempo: "+d.value),this.soundTempo=100),i.TempoInBPM=this.soundTempo,this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,a=!0}if(g){const y=g.value.match(/\d+/);this.soundDynamic=y!==void 0?parseInt(y[0],10):100,l=!0}}const u=e.element("direction-type");if(!u)return;let m=u.element("metronome");if(m){i.metronomeNoteIndex=o;const d=m.element("beat-unit"),g=m.element("beat-unit-dot")!==void 0,y=m.element("per-minute");if(d!==void 0&&y){m.hasAttributes&&m.attribute("default-x")!==void 0&&(this.directionTimestamp=Fraction$1.createFromFraction(r));const S=parseFloat(y.value);this.createNewTempoExpressionIfNeeded(i);const E=new InstantaneousTempoExpression(void 0,this.placement,this.staffNumber,S,this.currentMultiTempoExpression,!0);E.parentMeasure=i,this.soundTempo=S,i.TempoInBPM=this.soundTempo*(g?1.5:1),this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),i.MeasureNumberXML===1&&this.musicSheet.SourceMeasures.length===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,E.dotted=g,E.beatUnit=d.value,this.currentMultiTempoExpression.addExpression(E,""),this.currentMultiTempoExpression.CombinedExpressionsText="test"}return}if(m=u.element("dynamics"),m){const d=e.element("notations")!==void 0;this.interpretInstantaneousDynamics(m,i,r,d);return}if(m=u.element("words"),m){const d=u.elements("words");let g="";for(const y of d)g+=y.value;if(m.value=g,a||isSpeedKeyword(m.value)||isSpeedHiddenKeyword(m.value)){this.createNewTempoExpressionIfNeeded(i),this.currentMultiTempoExpression.CombinedExpressionsText=m.value,(isSpeedKeyword(m.value)||isSpeedHiddenKeyword(m.value))&&(m.value=void 0);const y=new InstantaneousTempoExpression(m.value,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);this.currentMultiTempoExpression.addExpression(y,"")}else l||this.interpretWords(m,i,r);return}if(m=u.element("wedge"),m){this.interpretWedge(m,i,s,i.MeasureNumber);return}if(m=u.element("rehearsal"),m){this.interpretRehearsalMark(m,i,r,i.MeasureNumber);return}}closeOpenExpressions(e,i){for(const r of this.openContinuousDynamicExpressions)this.createNewMultiExpressionIfNeeded(e,r.NumberXml,i),this.closeOpenContinuousDynamic(r,e,i);this.openContinuousTempoExpression&&this.closeOpenContinuousTempo(Fraction$1.plus(e.AbsoluteTimestamp,i))}addOctaveShift(e,i,r){var l;let s=1;const o=e.element("staff");if(o)try{s=parseInt(o.value,10)}catch(c){const u=ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftStaffError","Invalid octave shift staff number -> set to default");this.musicSheet.SheetErrors.pushMeasureError(u),s=1,loglevelExports.debug("ExpressionReader.addOctaveShift",u,c)}const a=e.element("direction-type");if(a){const c=a.element("octave-shift"),u=this.readPlacement(e);if(c!==void 0&&c.hasAttributes)try{const m=this.readNumber(c);if(c.attribute("size")){const d=parseInt(c.attribute("size").value,10);let g=0;d===8?g=1:d===15&&(g=2);let y=(l=c.attribute("type"))==null?void 0:l.value;if(y||(u===PlacementEnum.Above?y="down":u===PlacementEnum.Below&&(y="up")),y==="up"||y==="down"){const b=new OctaveShift(y,g);b.StaffNumber=s,this.getMultiExpression=this.createNewMultiExpressionIfNeeded(i,m),this.getMultiExpression.OctaveShiftStart=b,b.ParentStartMultiExpression=this.getMultiExpression,this.openOctaveShift=b}else if(y==="stop"){if(this.openOctaveShift){this.getMultiExpression=this.createNewMultiExpressionIfNeeded(i,this.openOctaveShift.numberXml,r);const b=this.getMultiExpression;b.OctaveShiftEnd=this.openOctaveShift,this.openOctaveShift.ParentEndMultiExpression=this.getMultiExpression,this.openOctaveShift=void 0}}else y||loglevelExports.debug("octave-shift missing type in xml")}}catch(m){const d=ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftError","Error while reading octave shift.");this.musicSheet.SheetErrors.pushMeasureError(d),loglevelExports.debug("ExpressionReader.addOctaveShift",d,m)}}}addPedalMarking(e,i,r){var o,a,l,c;const s=e.element("direction-type");if(s){const u=s.element("pedal");if(u!==void 0&&u.hasAttributes){let m=!1,d=!1;try{switch(((o=u.attribute("line"))==null?void 0:o.value)==="yes"?d=!0:((a=u.attribute("line"))==null?void 0:a.value)==="no"&&(d=!1,m=!0),((l=u.attribute("sign"))==null?void 0:l.value)==="yes"?m=!0:((c=u.attribute("sign"))==null?void 0:c.value)==="no"&&(m=!1,d=!0),u.attribute("type").value){case"start":this.openPedal&&this.openPedal.IsLine&&this.endOpenPedal(i),this.createNewMultiExpressionIfNeeded(i,-1),this.openPedal=new Pedal(d,m),this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openPedal&&this.endOpenPedal(i);break;case"change":this.openPedal&&this.openPedal.IsLine&&(this.openPedal.ChangeEnd=!0,this.createNewMultiExpressionIfNeeded(i,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.createNewMultiExpressionIfNeeded(i,-1),this.openPedal=new Pedal(d,m),this.openPedal.ChangeBegin=!0,this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression);break;case"continue":break;default:break}}catch(g){const y=ITextTranslation.translateText("ReaderErrorMessages/PedalError","Error while reading pedal.");this.musicSheet.SheetErrors.pushMeasureError(y),loglevelExports.debug("ExpressionReader.addPedalMarking",y,g)}}}}endOpenPedal(e){this.createNewMultiExpressionIfNeeded(e,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.openPedal=void 0}addWavyLine(e,i,r,s){if(e&&e.hasAttributes)try{switch(e.attribute("type").value){case"start":this.createNewMultiExpressionIfNeeded(i,-1),this.openWavyLine=new WavyLine(this.placement),this.getMultiExpression.WavyLineStart=this.openWavyLine,this.openWavyLine.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openWavyLine&&(this.createNewMultiExpressionIfNeeded(i,-1,r),this.getMultiExpression.WavyLineEnd=this.openWavyLine,this.openWavyLine.ParentEndMultiExpression=this.getMultiExpression,this.openWavyLine=void 0);break;case"continue":break;default:break}}catch(o){const a=ITextTranslation.translateText("ReaderErrorMessages/WavyLineError","Error while reading wavy-line.");this.musicSheet.SheetErrors.pushMeasureError(a),loglevelExports.debug("ExpressionReader.addWavyLine",a,o)}}initialize(){this.placement=PlacementEnum.NotYetDefined,this.soundTempo=0,this.soundDynamic=0,this.offsetDivisions=0}readPlacement(e){var r;const i=(r=e.attribute("placement"))==null?void 0:r.value;return i==="above"?PlacementEnum.Above:i==="below"?PlacementEnum.Below:PlacementEnum.NotYetDefined}readExpressionPlacement(e,i){try{const r=parseInt(e.value,10);r<0?this.placement=PlacementEnum.Below:r>0&&(this.placement=PlacementEnum.Above)}catch(r){loglevelExports.debug("ExpressionReader.readExpressionParameters",i,r)}}interpretInstantaneousDynamics(e,i,r,s){if(e.hasElements){e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(r));const o=this.readNumber(e);let a=e.elements()[0].name;if(a==="other-dynamics"&&(a=e.elements()[0].value),a){s?this.createNewMultiExpressionIfNeeded(i,o,Fraction$1.createFromFraction(r)):this.createNewMultiExpressionIfNeeded(i,o);const l=new InstantaneousDynamicExpression(a,this.soundDynamic,this.placement,this.staffNumber,i);l.InMeasureTimestamp=r.clone(),this.getMultiExpression.addExpression(l,""),this.initialize(),this.activeInstantaneousDynamic?this.activeInstantaneousDynamic.DynEnum=l.DynEnum:this.activeInstantaneousDynamic=new InstantaneousDynamicExpression(a,0,PlacementEnum.NotYetDefined,1,i)}}}interpretWords(e,i,r){const s=e.value;let o;const a=e.attribute("font-style");if(a&&a.value==="italic"&&(o=FontStyles.Italic),s.length>0){if(e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(r)),this.checkIfWordsNodeIsRepetitionInstruction(s))return;this.fillMultiOrTempoExpression(s,i,r,o),this.initialize()}}readNumber(e){var s;let i=1;const r=(s=e.attribute("number"))==null?void 0:s.value;return r&&(i=Number.parseInt(r,10)),i}interpretWedge(e,i,r,s){var a,l;e!==void 0&&e.hasAttributes&&e.attribute("default-x")&&(this.directionTimestamp=Fraction$1.createFromFraction(r));const o=this.readNumber(e);((l=(a=e.attribute("type"))==null?void 0:a.value)==null?void 0:l.toLowerCase())==="stop"?this.createNewMultiExpressionIfNeeded(i,o,r):this.createNewMultiExpressionIfNeeded(i,o),this.addWedge(e,i,r),this.initialize()}interpretRehearsalMark(e,i,r,s){i.rehearsalExpression=new RehearsalExpression(e.value,this.placement)}createNewMultiExpressionIfNeeded(e,i,r=void 0){r||(r=this.directionTimestamp);let s=this.getMultiExpression;return(!s||s&&(s.SourceMeasureParent!==e||s.numberXml!==i||s.SourceMeasureParent===e&&s.Timestamp!==r))&&(this.getMultiExpression=s=new MultiExpression(e,Fraction$1.createFromFraction(r)),e.StaffLinkedExpressions[this.globalStaffIndex].push(s)),s}createNewTempoExpressionIfNeeded(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))}addWedge(e,i,r){if(e!==void 0&&e.hasAttributes){const s=this.readNumber(e),o=e.attribute("type").value.toLowerCase();try{if(o==="crescendo"||o==="diminuendo"){const a=new ContinuousDynamicExpression(ContDynamicEnum[o],this.placement,this.staffNumber,i,this.activeInstantaneousDynamic,s);this.openContinuousDynamicExpressions.push(a);let l=this.getMultiExpression;l||(l=this.createNewMultiExpressionIfNeeded(i,s)),l.StartingContinuousDynamic=a,a.StartMultiExpression=l,this.activeInstantaneousDynamic!==void 0&&this.activeInstantaneousDynamic.StaffNumber===a.StaffNumber&&(this.activeInstantaneousDynamic=void 0)}else if(o==="stop")for(const a of this.openContinuousDynamicExpressions)a.NumberXml===s&&a.NumberXml===s&&this.closeOpenContinuousDynamic(a,i,r)}catch(a){const l="ReaderErrorMessages/WedgeError, Error while reading Crescendo / Diminuendo.";this.musicSheet.SheetErrors.pushMeasureError(l),loglevelExports.debug("ExpressionReader.addWedge",l,a)}}}fillMultiOrTempoExpression(e,i,r,s){if(!e)return;const o=e.trim();this.createExpressionFromString("",o,i,r,e,s)}createExpressionFromString(e,i,r,s,o,a){if(InstantaneousTempoExpression.isInputStringInstantaneousTempo(i)||ContinuousTempoExpression.isInputStringContinuousTempo(i)){if(r.TempoExpressions.length>0)for(let m=0,d=r.TempoExpressions.length;m0)for(let m=0,d=r.TempoExpressions.length;m0&&!this.hasDigit(i)&&this.globalStaffIndex>0){if(g.EntriesList[0].label.indexOf(i)>=0)return!1;break}}let c=TextAlignmentEnum.CenterBottom;this.musicSheet.Rules.CompactMode&&(c=TextAlignmentEnum.LeftBottom);const u=new UnknownExpression(i,this.placement,c,this.staffNumber);return u.fontStyle=a,l.addExpression(u,e),!1}closeOpenContinuousDynamic(e,i,r){if(!e)return;const s=e.NumberXml;e.EndMultiExpression=this.createNewMultiExpressionIfNeeded(i,s,r),e.StartMultiExpression.EndingContinuousDynamic=e,this.openContinuousDynamicExpressions=this.openContinuousDynamicExpressions.filter(o=>o!==e)}closeOpenContinuousTempo(e){this.openContinuousTempoExpression.AbsoluteEndTimestamp=e,this.openContinuousTempoExpression=void 0}checkIfWordsNodeIsRepetitionInstruction(e){return e=e.trim().toLowerCase(),e==="coda"||e==="tocoda"||e==="to coda"||e==="fine"||e==="d.c."||e==="dacapo"||e==="da capo"||e==="d.s."||e==="dalsegno"||e==="dal segno"||e==="d.c. al fine"||e==="d.s. al fine"||e==="d.c. al coda"||e==="d.s. al coda"}hasDigit(e){return/\d/.test(e)}}class Slur{constructor(){}get StartNote(){return this.startNote}set StartNote(e){this.startNote=e}get EndNote(){return this.endNote}set EndNote(e){this.endNote=e}startNoteHasMoreStartingSlurs(){if(!this.startNote)return!1;for(let e=0,i=this.startNote.NoteSlurs.length;e0){const s=r.attribute("type").value;let o=1;try{r.attribute("number")&&(o=parseInt(r.attribute("number").value,10))}catch(u){loglevelExports.debug("VoiceGenerator.addSlur number: ",u)}let a=PlacementEnum.NotYetDefined;const l=r.attribute("placement");l&&l.value&&(l.value==="above"?a=PlacementEnum.Above:l.value==="below"&&(a=PlacementEnum.Below));const c=r.attribute("orientation");if(c&&c.value&&(c.value==="over"?a=PlacementEnum.Above:c.value==="under"&&(a=PlacementEnum.Below)),s==="start"){let u=this.openSlurDict[o];u||(u=new Slur,this.openSlurDict[o]=u),u.StartNote=i,u.PlacementXml=a}else if(s==="stop"){const u=this.openSlurDict[o];u&&(u.EndNote=i,i.checkForDoubleSlur(u)||(i.NoteSlurs.push(u),u.StartNote.NoteSlurs.push(u)),delete this.openSlurDict[o])}}}}catch(r){const s=ITextTranslation.translateText("ReaderErrorMessages/SlurError","Error while reading slur.");this.musicSheet.SheetErrors.pushMeasureError(s)}}}class InstrumentReader{constructor(e,i,r,s){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=i,this.xmlMeasureList=r,this.musicSheet=s.GetMusicSheet,this.instrument=s,this.activeClefs=new Array(s.Staves.length),this.activeClefsHaveBeenInitialized=new Array(s.Staves.length);for(let o=0;o=this.xmlMeasureList.length)return!1;this.currentMeasure=e,this.followingMultirestMeasures=Math.max(this.followingMultirestMeasures-1,0),this.inSourceMeasureInstrumentIndex=this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument),this.repetitionInstructionReader&&this.repetitionInstructionReader.prepareReadingMeasure(e,this.currentXmlMeasureIndex);let s=new Fraction$1(0,1),o=new Fraction$1(0,1),a=!1;this.maxTieNoteFraction=new Fraction$1(0,1);let l=!1;const c=[];try{const _=this.xmlMeasureList[this.currentXmlMeasureIndex],P=_.elements();if(e.Rules.UseXMLMeasureNumbers&&!Number.isInteger(e.MeasureNumberXML)){const M=parseInt((u=_.attribute("number"))==null?void 0:u.value,10);Number.isInteger(M)&&(e.MeasureNumberXML=M)}let T;for(let M=0;M0&&(T=P[M-1]),C.name==="print"){const I=C.attribute("new-system");(I==null?void 0:I.value)==="yes"&&(e.printNewSystemXml=!0);const D=C.attribute("new-page");(D==null?void 0:D.value)==="yes"&&(e.printNewPageXml=!0)}else if(C.name==="note"){C.element("grace")||(this.xmlNotes.push(C),c.push(C));let I=!0;((m=C.attribute("print-object"))==null?void 0:m.value)==="no"&&(I=!1);let D=1;this.instrument.Staves.length>1&&C.element("staff")&&(D=parseInt(C.element("staff").value,10),isNaN(D)&&(loglevelExports.debug("InstrumentReader.readNextXmlMeasure.get staff number"),D=1)),this.currentStaff=this.instrument.Staves[D-1];const G=C.element("chord")!==void 0;if(C.element("voice")){const K=parseInt(C.element("voice").value,10);this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(K,D-1)}else(!G||!this.currentVoiceGenerator)&&(this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(1,D-1));let $=0,N=new Fraction$1(0,1),z=2,R,H=!1;if(C.element("duration")){if($=parseInt(C.element("duration").value,10),isNaN($)){const K=ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid Note Duration.");this.musicSheet.SheetErrors.pushMeasureError(K),loglevelExports.debug("InstrumentReader.readNextXmlMeasure",K);continue}else if(N=new Fraction$1($,4*this.divisions),$===0?N=this.getNoteDurationFromTypeNode(C):R=this.getNoteDurationFromTypeNode(C),C.element("time-modification")){N=this.getNoteDurationForTuplet(C);const K=C.element("time-modification");K!=null&&K.element("normal-notes")&&(z=parseInt(K.element("normal-notes").value,10)),H=!0}}const O=C.element("rest")!==void 0,V=C.element("notations"),k=C.element("grace")!==void 0||$===0||G&&l;let F=!1,Z=!1;if(k){const K=C.element("duration"),le=C.element("grace");le&&le.attributes()&&le.attribute("slash")&&le.attribute("slash").value==="yes"&&(F=!0),K||(N=this.getNoteDurationFromTypeNode(C));const oe=C.element("notations");oe&&oe.element("slur")&&(Z=!0)}let U=!1;C.element("cue")&&(U=!0);const de=C.element("type");let ne=NoteType.UNDEFINED;if(de){const K=de.attribute("size");(K==null?void 0:K.value)==="cue"&&(U=!0),ne=NoteTypeHandler.StringToNoteType(de.value)}let te=StemDirectionType.Undefined,ce;const pe=C.element("stem");if(pe){switch(pe.value){case"down":te=StemDirectionType.Down;break;case"up":te=StemDirectionType.Up;break;case"double":te=StemDirectionType.Double;break;case"none":te=StemDirectionType.None;break;default:te=StemDirectionType.Undefined}const K=pe.attribute("color");K&&(ce=this.parseXmlColor(K.value))}let ue=0,be="",Ee="",Se="";if(V){const K=V.element("ornaments");if(K){const me=K.element("tremolo");if(me){const fe=me.attribute("type");if(be=fe.value,fe){const xe=parseInt(me.value,10);xe>0&&(ue=xe),(fe.value==="start"||fe.value==="stop")&&(N=new Fraction$1(parseInt(C.element("duration").value,10),4*this.divisions))}}const ye=K.elements("wavy-line");if(ye!==void 0)for(const fe of ye){const xe=this.expressionReaders[this.readExpressionStaffNumber(C)-1];xe&&(xe.readExpressionParameters(fe,this.instrument,this.divisions,s,o,this.currentMeasure.MeasureNumber,!1),xe.addWavyLine(fe,this.currentMeasure,s,o))}}V.elements("glissando").find(me=>me.attribute("type").value==="start")&&(Ee="start"),V.elements("slide").find(me=>me.attribute("type").value==="start")&&(Se="start")}let q;const ie=C.element("notehead");if(ie){const K=ie.attribute("color");K&&(q=this.parseXmlColor(K.value))}let B;const re=C.attribute("color");re&&(B=this.parseXmlColor(re.value),q||(q=B),ce||(ce=B));let ee=s.clone();G&&(ee=o.clone()),this.currentStaffEntry=this.currentMeasure.findOrCreateStaffEntry(ee,this.inSourceMeasureInstrumentIndex+D-1,this.currentStaff).staffEntry,(!this.currentVoiceGenerator.hasVoiceEntry()||!G&&!k&&!l||k&&!l||k&&!G||!k&&l)&&this.currentVoiceGenerator.createVoiceEntry(ee,this.currentStaffEntry,this.activeKey,this.ActiveRhythm,k,F,Z),!k&&!G&&(o=s.clone(),s.Add(N)),G&&this.currentStaffEntry!==void 0&&this.currentStaffEntry.ParentStaff!==this.currentStaff&&(this.currentStaffEntry=this.currentVoiceGenerator.checkForStaffEntryLink(this.inSourceMeasureInstrumentIndex+D-1,this.currentStaff,this.currentStaffEntry,this.currentMeasure));const W=this.currentStaffEntry!==void 0&&this.currentStaffEntry.Timestamp!==void 0&&this.currentStaffEntry.Timestamp.Equals(new Fraction$1(0,1))&&!this.currentStaffEntry.hasNotes();this.saveAbstractInstructionList(this.instrument.Staves.length,W),this.openChordSymbolContainers.length!==0&&(this.currentStaffEntry.ChordContainers=this.openChordSymbolContainers,this.openChordSymbolContainers=[]),this.activeRhythm,!H&&!k&&(N=new Fraction$1($,4*this.divisions));const Q=C.elements("dot").length;if(this.currentVoiceGenerator.read(C,N,R,ne,z,O,this.currentStaffEntry,this.currentMeasure,i,this.maxTieNoteFraction,G,r,I,U,k,te,ue,ce,q,Q,be,Ee,Se),V!==void 0&&V.element("dynamics")){const K=this.expressionReaders[this.readExpressionStaffNumber(C)-1];K&&(K.readExpressionParameters(C,this.instrument,this.divisions,s,o,this.currentMeasure.MeasureNumber,!1),K.read(C,this.currentMeasure,o,void 0,c.length))}l=k}else if(C.name==="attributes"){const I=C.element("divisions");if(I&&(this.divisions=parseInt(I.value,10),isNaN(this.divisions))){const $=ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(loglevelExports.debug("InstrumentReader.readNextXmlMeasure",$),this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push($+this.instrument.Name);else throw a=!0,new MusicSheetReadingException($+this.instrument.Name)}if(!C.element("divisions")&&this.divisions===0&&this.currentXmlMeasureIndex===0){const $=ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push($+this.instrument.Name);else throw a=!0,new MusicSheetReadingException($+this.instrument.Name)}this.addAbstractInstruction(C,r,T,s.clone()),s.Equals(new Fraction$1(0,1))&&this.isAttributesNodeAtBeginOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],C)&&this.saveAbstractInstructionList(this.instrument.Staves.length,!0),this.isAttributesNodeAtEndOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],C)&&this.saveClefInstructionAtEndOfMeasure();const D=C.elements("staff-details");for(const $ of D){const N=$.element("staff-lines");if(N){let z=1;const R=$.attribute("number");R&&(z=parseInt(R.value,10)),this.instrument.Staves[z-1].StafflineCount=parseInt(N.value,10)}}const G=C.element("measure-style");if(G){const $=G.element("multiple-rest");if($){const N=$.value;let z=0;try{z=Number.parseInt(N,10),e.multipleRestMeasures!==void 0&&z!==e.multipleRestMeasures?e.multipleRestMeasures=0:(e.multipleRestMeasures=z,this.currentMultirestStartMeasure=e,this.followingMultirestMeasures=z+1)}catch(R){console.log("multirest parse error: "+R)}}}}else if(C.name==="forward"){const I=parseInt(C.element("duration").value,10);s.Add(new Fraction$1(I,4*this.divisions))}else if(C.name==="backup"){const I=parseInt(C.element("duration").value,10);s.Sub(new Fraction$1(I,4*this.divisions)),s.IsNegative()&&(s=new Fraction$1(0,1)),o.Sub(new Fraction$1(I,4*this.divisions)),o.IsNegative()&&(o=new Fraction$1(0,1))}else if(C.name==="direction"){const I=C.elements("direction-type"),D=C.element("direction-type");let G=Math.min(1,s.RealValue);this.activeRhythm!==void 0&&this.activeRhythm.Rhythm&&(G/=this.activeRhythm.Rhythm.RealValue);let $=!1;if(this.repetitionInstructionReader&&($=this.repetitionInstructionReader.handleRepetitionInstructionsFromWordsOrSymbols(D,G)),!$){let N=this.expressionReaders[0];const z=this.readExpressionStaffNumber(C)-1;if(zO==null?void 0:O.toLocaleLowerCase()).includes((d=R.value)==null?void 0:d.toLocaleLowerCase())&&(this.currentGradualChangeMeasure=this.currentMeasure,this.currentMeasure.speedInfo={startWord:(g=R.value)==null?void 0:g.toLocaleLowerCase(),startXmlNoteIndex:c.length,endXmlNoteIndex:0,resetXmlNoteIndex:0,startMeasureListIndex:this.currentXmlMeasureIndex,endMeasureListIndex:0,resetMeasureListIndex:0},this.xmlNotes=[]),R.value.startsWith(GRADIENT_SPEED_CLOSE_TAG)&&((y=this.currentGradualChangeMeasure)!=null&&y.speedInfo)&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:this.xmlNotes.length,endMeasureListIndex:this.currentXmlMeasureIndex}),((b=R.value)==null?void 0:b.toLocaleLowerCase())==="a tempo".toLocaleLowerCase()&&((S=this.currentGradualChangeMeasure)!=null&&S.speedInfo))){const{endXmlNoteIndex:O,resetXmlNoteIndex:V,endMeasureListIndex:k}=this.currentGradualChangeMeasure.speedInfo;V===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:O||this.xmlNotes.length,endMeasureListIndex:k||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.xmlNotes=[]}if(I.find(H=>H.element("metronome"))&&((E=this.currentGradualChangeMeasure)!=null&&E.speedInfo)){const{endXmlNoteIndex:H,resetXmlNoteIndex:O,endMeasureListIndex:V}=this.currentGradualChangeMeasure.speedInfo;O===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:H||this.xmlNotes.length,endMeasureListIndex:V||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.xmlNotes=[]}N.readExpressionParameters(C,this.instrument,this.divisions,s,o,this.currentMeasure.MeasureNumber,!1),N.read(C,this.currentMeasure,s,o.clone(),c.length)}}}else if(C.name==="barline"){this.repetitionInstructionReader&&this.repetitionInstructionReader.handleLineRepetitionInstructions(C)&&(this.currentMeasure.HasEndLine=!0);const I=C.attribute("location");if(M===P.length-1||I&&I.value==="right"){const G=(x=C.element("bar-style"))==null?void 0:x.value;if(G&&(this.currentMeasure.endingBarStyleXml=G,this.currentMeasure.endingBarStyleEnum=SystemLinesEnumHelper.xmlBarlineStyleToSystemLinesEnum(G),(A=this.currentGradualChangeMeasure)!=null&&A.speedInfo)){const{endXmlNoteIndex:$,resetXmlNoteIndex:N,endMeasureListIndex:z}=this.currentGradualChangeMeasure.speedInfo;N===0&&(this.currentGradualChangeMeasure.speedInfo={...this.currentGradualChangeMeasure.speedInfo,endXmlNoteIndex:$||this.xmlNotes.length,endMeasureListIndex:z||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex}),this.currentGradualChangeMeasure=void 0,this.xmlNotes=[]}}}else if(C.name==="sound")try{if(C.attribute("tempo")){const I=parseFloat(C.attribute("tempo").value);C.element("offset")&&(this.soundTempos.has(this.currentXmlMeasureIndex)||this.soundTempos.set(this.currentXmlMeasureIndex,[]),this.soundTempos.get(this.currentXmlMeasureIndex).push(I)),this.currentXmlMeasureIndex===0&&(this.musicSheet.DefaultStartTempoInBpm=I,this.musicSheet.HasBPMInfo=!0)}}catch(I){loglevelExports.debug("InstrumentReader.readTempoInstruction",I)}else C.name==="harmony"&&this.openChordSymbolContainers.push(ChordSymbolReader.readChordSymbol(C,this.musicSheet,this.activeKey))}for(const M in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(M)&&this.voiceGeneratorsDict[M].checkForOpenBeam();if(this.currentXmlMeasureIndex===this.xmlMeasureList.length-1){for(let M=0;M{this.voiceGeneratorsDict[M].finalizeReadingMeasure()}),this.musicSheet.HasBPMInfo?e.TempoInBPM===0&&this.previousMeasure&&(this.currentMeasure.TempoInBPM=this.previousMeasure.TempoInBPM):this.currentMeasure.TempoInBPM=120,this.currentMeasure.TempoInBPM||(this.currentMeasure.TempoInBPM=this.musicSheet.DefaultStartTempoInBpm)}catch(_){if(a)throw new MusicSheetReadingException(_.Message);const P=ITextTranslation.translateText("ReaderErrorMessages/MeasureError","Error while reading Measure.");this.musicSheet.SheetErrors.pushMeasureError(P),loglevelExports.debug("InstrumentReader.readNextXmlMeasure",P,_)}return this.previousMeasure=this.currentMeasure,this.currentXmlMeasureIndex+=1,!0}parseXmlColor(e){if(e)return e.length===7?e:e.length===9?"#"+e.substr(3):void 0}doCalculationsAfterDurationHasBeenSet(){for(const e in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(e)&&this.voiceGeneratorsDict[e].checkOpenTies()}getOrCreateVoiceGenerator(e,i){const r=this.instrument.Staves[i];let s=this.voiceGeneratorsDict[e];if(s)r.Voices.indexOf(s.GetVoice)===-1&&r.Voices.push(s.GetVoice);else{const o=this.staffMainVoiceGeneratorDict[i];o?(s=new VoiceGenerator(this.pluginManager,r,e,this.slurReader,o.GetVoice),r.Voices.push(s.GetVoice),this.voiceGeneratorsDict[e]=s):(s=new VoiceGenerator(this.pluginManager,r,e,this.slurReader),r.Voices.push(s.GetVoice),this.voiceGeneratorsDict[e]=s,this.staffMainVoiceGeneratorDict[i]=s)}return s}createExpressionGenerators(e){this.expressionReaders=new Array(e);for(let i=0;i0?i=this.musicSheet.SourceMeasures[0]:i=this.currentMeasure;const r=new ClefInstruction(ClefEnum.G,0,2);let s;i.FirstInstructionsStaffEntries[e]?(s=i.FirstInstructionsStaffEntries[e],s.removeFirstInstructionOfTypeClefInstruction()):(s=new SourceStaffEntry(void 0,void 0),i.FirstInstructionsStaffEntries[e]=s),r.Parent=s,s.Instructions.splice(0,0,r)}createDefaultKeyInstruction(){let e;this.musicSheet.SourceMeasures.length>0?e=this.musicSheet.SourceMeasures[0]:e=this.currentMeasure;const i=new KeyInstruction(void 0,0,KeyEnum.major);for(let r=this.inSourceMeasureInstrumentIndex;r0&&r[s-1].name==="backup")return!0;let o=-1;for(let a=0;a0||o<0}isAttributesNodeAtEndOfMeasure(e,i){const r=e.elements().slice();let s=0;for(let a=0;ao}getNoteDurationFromTypeNode(e){const i=e.element("type");if(i){const r=i.value;return NoteTypeHandler.getNoteDurationFromType(r)}return new Fraction$1(0,4*this.divisions)}addAbstractInstruction(e,i,r,s){if(e.element("divisions")&&e.elements().length===1)return;const o=e.element("transpose");if(o){const c=o.element("chromatic");c&&(this.instrument.PlaybackTranspose=parseInt(c.value,10))}const a=e.elements("clef");let l;if(a.length>0)for(let c=0,u=a.length;c using default clef line."),this.musicSheet.SheetErrors.pushMeasureError(l),g=2,loglevelExports.debug("InstrumentReader.addAbstractInstruction",l,_)}const E=m.element("sign");if(E)try{d=ClefEnum[E.value],ClefInstruction.isSupportedClef(d)||(l=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Unsupported clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(l),d=ClefEnum.G,g=2),d===ClefEnum.TAB&&(b=-1)}catch(_){l=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(l),d=ClefEnum.G,g=2,loglevelExports.debug("InstrumentReader.addAbstractInstruction",l,_)}const x=m.element("clef-octave-change");if(x)try{b=parseInt(x.value,10)}catch(_){l=ITextTranslation.translateText("ReaderErrorMessages/ClefOctaveError","Invalid clef octave found -> using default clef octave."),this.musicSheet.SheetErrors.pushMeasureError(l),b=0}if(m.hasAttributes&&m.attribute("number"))try{y=parseInt(m.attribute("number").value,10),y>this.currentClefNumber&&(y=this.currentClefNumber),this.currentClefNumber=y+1}catch(_){l=ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(l),y=1,this.currentClefNumber=y+1}const A=new ClefInstruction(d,b,g);this.abstractInstructions.push([y,A,s])}if(e.element("key")!==void 0&&this.instrument.MidiInstrumentId!==MidiInstrument.Percussion){let c=0;const u=e.element("key").element("fifths");if(u)try{c=parseInt(u.value,10)}catch(y){l=ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(l),c=0,loglevelExports.debug("InstrumentReader.addAbstractInstruction",l,y)}let m=KeyEnum.none,d=e.element("key");if(d&&(d=d.element("mode")),d)try{m=KeyEnum[d.value]}catch(y){l=ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(l),m=KeyEnum.major,loglevelExports.debug("InstrumentReader.addAbstractInstruction",l,y)}const g=new KeyInstruction(void 0,c,m);this.abstractInstructions.push([1,g,s])}if(e.element("time")){const c=e.element("time");let u=RhythmSymbolEnum.NONE,m=!0;if(c!==void 0&&c.hasAttributes){const x=c.attribute("symbol");x&&(x.value==="common"?u=RhythmSymbolEnum.COMMON:x.value==="cut"&&(u=RhythmSymbolEnum.CUT));const A=c.attribute("print-object");A&&A.value==="no"&&(m=!1)}let d=0,g=0;const y=c&&c.element("senza-misura")!==void 0,b=e.elements("time"),S=[],E=[];for(let x=0,A=b.length;x0&&E!==void 0&&S.length===E.length){const A=S.length,_=new Array(A);let P=0;for(let T=0;T set to default."),this.musicSheet.SheetErrors.pushMeasureError(l),d=4,g=4,loglevelExports.debug("InstrumentReader.addAbstractInstruction",l,A)}const x=new RhythmInstruction(new Fraction$1(d,g,0,!1),u);x.PrintObject=m,this.abstractInstructions.push([1,x,s])}}}saveAbstractInstructionList(e,i){for(let r=this.abstractInstructions.length-1;r>=0;r--){const s=this.abstractInstructions[r],o=s[0],a=s[1],l=s[2];if(a instanceof ClefInstruction){const c=a;if(this.currentXmlMeasureIndex===0||o<=this.activeClefs.length&&c!==this.activeClefs[o-1])if(!i&&this.currentStaffEntry!==void 0&&!this.currentStaffEntry.hasNotes()&&o-1===this.instrument.Staves.indexOf(this.currentStaffEntry.ParentStaff)){const u=c,m=this.currentStaffEntry;if(l&&Math.abs(l.RealValue-m.Timestamp.RealValue)>.01)continue;u.Parent=m,m.removeFirstInstructionOfTypeClefInstruction(),m.Instructions.push(u),this.activeClefs[o-1]=c,this.abstractInstructions.splice(r,1)}else if(i){if(l.RealValue!==0)continue;let u;if(this.currentMeasure){const m=c,d=this.inSourceMeasureInstrumentIndex+o-1,g=this.currentMeasure.FirstInstructionsStaffEntries[d];if(this.currentXmlMeasureIndex===0)if(!g)u=new SourceStaffEntry(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[d]=u,m.Parent=u,u.Instructions.push(m),this.activeClefsHaveBeenInitialized[o-1]=!0;else if(this.currentMeasure.FirstInstructionsStaffEntries[d]!==void 0&&!(g.Instructions[0]instanceof ClefInstruction))u=g,m.Parent=u,u.removeFirstInstructionOfTypeClefInstruction(),u.Instructions.splice(0,0,m),this.activeClefsHaveBeenInitialized[o-1]=!0;else{const y=new SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[d]=y,m.Parent=y,y.Instructions.push(m)}else if(this.activeClefsHaveBeenInitialized[o-1]){let y=this.previousMeasure;this.followingMultirestMeasures>0&&this.currentMeasure.Rules.RenderMultipleRestMeasures&&(y=this.currentMultirestStartMeasure);const b=new SourceStaffEntry(void 0,void 0);y.LastInstructionsStaffEntries[d]=b,m.Parent=b,b.Instructions.push(m)}else{const y=this.musicSheet.SourceMeasures[0];y.FirstInstructionsStaffEntries[d]?(u=y.FirstInstructionsStaffEntries[d],u.removeFirstInstructionOfTypeClefInstruction()):u=new SourceStaffEntry(void 0,void 0),m.Parent=u,u.Instructions.splice(0,0,m),this.activeClefsHaveBeenInitialized[o-1]=!0}this.activeClefs[o-1]=c,this.abstractInstructions.splice(r,1)}}else{let u;const m=this.activeRhythm.Rhythm;m.RealValue>0&&l.RealValue/m.RealValue>.9&&(this.currentMeasure.LastInstructionsStaffEntries[o-1]||(this.currentMeasure.LastInstructionsStaffEntries[o-1]=new SourceStaffEntry(void 0,this.instrument.Staves[o-1])),u=this.currentMeasure.LastInstructionsStaffEntries[o-1]),u&&(c.Parent=u,u.Instructions.push(c),this.activeClefs[o-1]=c,this.abstractInstructions.splice(r,1))}else o<=this.activeClefs.length&&c===this.activeClefs[o-1]&&this.abstractInstructions.splice(r,1)}if(a instanceof KeyInstruction){const c=a;if(!this.activeKey||this.activeKey.Key!==c.Key){this.activeKey=c,this.abstractInstructions.splice(r,1);let u;if(this.activeKeyHasBeenInitialized?u=this.currentMeasure:(this.activeKeyHasBeenInitialized=!0,this.currentXmlMeasureIndex>0?u=this.musicSheet.SourceMeasures[0]:u=this.currentMeasure),u)for(let m=this.inSourceMeasureInstrumentIndex;m=0;e--){const i=this.abstractInstructions[e][0],r=this.abstractInstructions[e][1];if(r instanceof ClefInstruction){const s=r;if(!this.activeClefs[i-1]||s.ClefType!==this.activeClefs[i-1].ClefType||s.ClefType===this.activeClefs[i-1].ClefType&&s.Line!==this.activeClefs[i-1].Line){const o=new SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[this.inSourceMeasureInstrumentIndex+i-1]=o;const a=s;a.Parent=o,o.Instructions.push(a),this.activeClefs[i-1]=s,this.abstractInstructions.splice(e,1)}}}}getNoteDurationForTuplet(e){let i=new Fraction$1(0,1);const r=this.getNoteDurationFromTypeNode(e);if(e.element("time-modification")){const s=e.element("time-modification");if(s&&s.element("actual-notes")!==void 0&&s.element("normal-notes")){const o=s.element("actual-notes"),a=s.element("normal-notes");if(o!==void 0&&a){const l=parseInt(o.value,10),c=parseInt(a.value,10);i=new Fraction$1(c*r.Numerator,l*r.Denominator)}}}return i}readExpressionStaffNumber(e){let i=1;if(e.element("staff")){const r=e.element("staff");if(r)try{i=parseInt(r.value,10)}catch(s){const o=ITextTranslation.translateText("ReaderErrorMessages/ExpressionStaffError","Invalid Expression staff number -> set to default.");this.musicSheet.SheetErrors.pushMeasureError(o),i=1,loglevelExports.debug("InstrumentReader.readExpressionStaffNumber",o,s)}}return i}readDivisionsFromNotes(){let e=0,i=this.currentXmlMeasureIndex,r=!1;for(;!r;){const s=this.xmlMeasureList[i].elements();for(let o=0,a=s.length;o0){r=!0;break}}if(e===0&&(i++,i===this.xmlMeasureList.length)){const o=ITextTranslation.translateText("ReaderErrorMEssages/DivisionsError","Invalid divisions value at Instrument: ");throw new MusicSheetReadingException(o+this.instrument.Name)}}return e}}const _SubInstrument=class{constructor(t){this.parentInstrument=t,this.fixedKey=-1,this.name=this.parseMidiInstrument(this.parentInstrument.Name),this.midiInstrumentID=_SubInstrument.midiInstrument[this.name],this.volume=1}get ParentInstrument(){return this.parentInstrument}static isPianoInstrument(t){return t===MidiInstrument.Acoustic_Grand_Piano||t===MidiInstrument.Bright_Acoustic_Piano||t===MidiInstrument.Electric_Grand_Piano||t===MidiInstrument.Electric_Piano_1||t===MidiInstrument.Electric_Piano_2}setMidiInstrument(t){this.midiInstrumentID=_SubInstrument.midiInstrument[this.parseMidiInstrument(t)]}parseMidiInstrument(t){try{if(t){let e=t.toLowerCase().trim();e=e.replace(/\s+/g,"_");for(const i in _SubInstrument.midiInstrument)if(e.indexOf(i)!==-1)return i}if(this.parentInstrument.Name){let e=this.parentInstrument.Name.toLowerCase().trim();e=e.replace(/\s+/g,"_");for(const i in _SubInstrument.midiInstrument)if(e.indexOf(i)!==-1)return i}}catch(e){loglevelExports.error("Error parsing MIDI Instrument. Default to Grand Piano.")}return"unnamed"}};let 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};class StringUtil{static StringContainsSeparatedWord(e,i,r=!1){return new RegExp("( |^)"+i+"([ .]|$)",r?"i":void 0).test(e)}}class RepetitionInstructionReader{set MusicSheet(e){this.musicSheet=e,this.xmlMeasureList=new Array(this.musicSheet.Instruments.length),this.repetitionInstructions=[]}prepareReadingMeasure(e,i){this.currentMeasureIndex=i}handleLineRepetitionInstructions(e){let i=!1;if(e.elements().length>0){let r="",s=!1,o="",a="",l="";const c=[],u=e.element("bar-style");u&&(l=u.value),e.attributes().length>0&&e.attribute("location")?r=e.attribute("location").value:r="right";const m=e.elements();for(let d=0,g=m.length;d0)if(r==="left"){if(a==="start"){const d=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Ending,AlignmentType.Begin,void 0,c);this.addInstruction(this.repetitionInstructions,d)}if(o==="forward"){const d=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.StartLine);this.addInstruction(this.repetitionInstructions,d)}}else{if(a==="stop"){const d=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Ending,AlignmentType.End,void 0,c);this.addInstruction(this.repetitionInstructions,d)}if(o==="backward"){const d=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.BackJumpLine);this.addInstruction(this.repetitionInstructions,d)}}}return i}handleRepetitionInstructionsFromWordsOrSymbols(e,i){const r=e.element("words"),s=this.currentMeasureIndex;if(r){const o="d\\s?\\.s\\.",a=r.value.trim().toLowerCase();if(StringUtil.StringContainsSeparatedWord(a,o+" al fine",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.DalSegnoAlFine);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,o+" al coda",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.DalSegnoAlCoda);return this.addInstruction(this.repetitionInstructions,c),!0}const l="d\\.\\s?c\\.";if(StringUtil.StringContainsSeparatedWord(a,l+" al fine",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.DaCapoAlFine);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,l+" al coda",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.DaCapoAlCoda);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,l)||StringUtil.StringContainsSeparatedWord(a,"da\\s?capo",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.DaCapo);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,o,!0)||StringUtil.StringContainsSeparatedWord(a,"dal\\s?segno",!0)){let c;return StringUtil.StringContainsSeparatedWord(a,"al\\s?coda",!0)?c=new RepetitionInstruction(s,RepetitionInstructionEnum.DalSegnoAlCoda):c=new RepetitionInstruction(s,RepetitionInstructionEnum.DalSegno),this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,"to\\s?coda",!0)||StringUtil.StringContainsSeparatedWord(a,"a (la )?coda",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.ToCoda);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,"fine",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.Fine);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,"coda",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,c),!0}if(StringUtil.StringContainsSeparatedWord(a,"segno",!0)){const c=new RepetitionInstruction(s,RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,c),!0}}else if(e.element("segno")){const o=new RepetitionInstruction(s,RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,o),!0}else if(e.element("coda")){const o=new RepetitionInstruction(s,RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,o),!0}return!1}removeRedundantInstructions(){let e=0,i=0,r=0,s=0;for(let o=0;o0&&this.findInstructionInPreviousMeasure(o,a.measureIndex,RepetitionInstructionEnum.ToCoda)&&(a.type=RepetitionInstructionEnum.None),i===0&&r===0&&(a.type=RepetitionInstructionEnum.ToCoda,a.alignment=AlignmentType.End,a.measureIndex--);break;case RepetitionInstructionEnum.Segno:if(e-s>0){let l=!1;for(let c=0,u=this.repetitionInstructions.length;c0?m.type=RepetitionInstructionEnum.DalSegnoAlCoda:m.type=RepetitionInstructionEnum.DalSegno,a.type=RepetitionInstructionEnum.None,l=!0;break;case RepetitionInstructionEnum.DalSegno:case RepetitionInstructionEnum.DalSegnoAlFine:case RepetitionInstructionEnum.DalSegnoAlCoda:a.type=RepetitionInstructionEnum.None,l=!0;break}if(l)break}if(l)break;r-i>0?a.type=RepetitionInstructionEnum.DalSegnoAlCoda:a.type=RepetitionInstructionEnum.DalSegno,a.alignment=AlignmentType.End,a.measureIndex--}break}if(this.backwardSearchForPreviousIdenticalInstruction(o,a)||a.type===RepetitionInstructionEnum.None)this.repetitionInstructions.splice(o,1),o--;else switch(a.type){case RepetitionInstructionEnum.Fine:break;case RepetitionInstructionEnum.ToCoda:r++;break;case RepetitionInstructionEnum.Coda:i++;break;case RepetitionInstructionEnum.Segno:e++;break;case RepetitionInstructionEnum.DalSegnoAlFine:case RepetitionInstructionEnum.DalSegnoAlCoda:s++;break}}this.repetitionInstructions.sort(RepetitionInstructionComparer.Compare)}findInstructionInPreviousMeasure(e,i,r){for(let s=e-1;s>=0;s--){const o=this.repetitionInstructions[s];if(i-o.measureIndex===1&&o.type===r)return!0}return!1}backwardSearchForPreviousIdenticalInstruction(e,i){for(let r=e-1;r>=0;r--)if(this.repetitionInstructions[r].equals(i))return!0;return!1}addInstruction(e,i){let r=!0;for(let s=0,o=e.length;s0;)try{const l=this.openRepetitions.last();if(l.RepetitonUnderConstruction.FromWords){if(l.WaitingForCoda){let c=l.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex+1;c>=this.musicSheet.SourceMeasures.length&&(c=-1),l.RepetitonUnderConstruction.setEndingStartIndex(2,c)}else if(l.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){this.openRepetitions.splice(this.openRepetitions.length-1,1);continue}}else if(l.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){const c=r.length-1,u=new RepetitionInstruction(c,RepetitionInstructionEnum.BackJumpLine,AlignmentType.End,l.RepetitonUnderConstruction);l.RepetitonUnderConstruction.BackwardJumpInstructions.push(u),r[c].LastRepetitionInstructions.push(u)}this.finalizeRepetition(this.openRepetitions.last())}catch(l){try{const c=this.openRepetitions.last().RepetitonUnderConstruction;for(const u of this.repetitionInstructions)u.parentRepetition===c&&(u.parentRepetition=void 0);this.openRepetitions.splice(this.openRepetitions.length-1,1)}catch(c){loglevelExports.error("RepetitionCalculator: calculateRepetitions2",c)}}let s=!1;const o=0,a=this.musicSheet.SourceMeasures.length-1;for(const l of this.musicSheet.Repetitions)if(l.StartIndex===o&&l.EndIndex===a){s=!0;break}if(!s){const l=new Repetition(this.musicSheet,!0);l.FromWords=!0,l.startMarker=new RepetitionInstruction(o,RepetitionInstructionEnum.StartLine),l.startMarker.parentRepetition=l,this.musicSheet.SourceMeasures[o].FirstRepetitionInstructions.push(l.startMarker),l.endMarker=new RepetitionInstruction(a,RepetitionInstructionEnum.BackJumpLine),l.endMarker.parentRepetition=l,l.BackwardJumpInstructions.push(l.endMarker),l.UserNumberOfRepetitions=l.DefaultNumberOfRepetitions,this.musicSheet.Repetitions.push(l)}for(let l=0,c=this.musicSheet.SourceMeasures.length;l1&&u.FirstRepetitionInstructions.sort(RepetitionInstructionComparer.Compare),u.LastRepetitionInstructions.length>1&&u.LastRepetitionInstructions.sort(RepetitionInstructionComparer.Compare)}}handleRepetitionInstructions(e){let i;switch(e.type){case RepetitionInstructionEnum.StartLine:i=this.createNewRepetition(this.currentMeasureIndex),e.parentRepetition=i.RepetitonUnderConstruction,i.RepetitonUnderConstruction.FromWords=!1,i.RepetitonUnderConstruction.startMarker=e,this.currentMeasure.FirstRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.BackJumpLine:i=this.getOrCreateCurrentRepetition2(!1),e.parentRepetition=i.RepetitonUnderConstruction,i.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e),i.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(i);break;case RepetitionInstructionEnum.Ending:if(i=this.getOrCreateCurrentRepetition(),e.parentRepetition=i.RepetitonUnderConstruction,e.endingIndices.contains(1)&&e.alignment===AlignmentType.Begin){if(i.RepetitonUnderConstruction.BackwardJumpInstructions.length>0||i.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)){i=void 0;for(let s=this.openRepetitions.length-1;s>=0;s--){const o=this.openRepetitions[s];if(o.RepetitonUnderConstruction.BackwardJumpInstructions.length===0)for(i=o;this.openRepetitions.length-1>s;){const a=this.openRepetitions.last();this.finalizeRepetition(a)}}i===void 0&&(i=this.createNewRepetition(0),i.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None))}i.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(i.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(this.currentMeasureIndex-1,RepetitionInstructionEnum.ForwardJump,AlignmentType.End,i.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].LastRepetitionInstructions.push(i.RepetitonUnderConstruction.forwardJumpInstruction))}if(e.alignment===AlignmentType.Begin)i.RepetitonUnderConstruction.setEndingsStartIndex(e.endingIndices,this.currentMeasureIndex),this.currentMeasure.FirstRepetitionInstructions.push(e);else for(let s=0,o=e.endingIndices.length;s0&&Math.abs(i.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex-this.currentMeasureIndex)<=1||this.openRepetitions.length&&this.openRepetitions.find(s=>s.RepetitonUnderConstruction.startMarker.type===RepetitionInstructionEnum.StartLine).RepetitonUnderConstruction.StartIndex===this.currentMeasureIndex)break;i=this.createNewRepetition(this.currentMeasureIndex),e.parentRepetition=i.RepetitonUnderConstruction,i.RepetitonUnderConstruction.FromWords=!0,i.SegnoFound=!0,i.RepetitonUnderConstruction.startMarker=e,this.currentMeasure.FirstRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.Fine:if(this.openRepetitions.length===0||(i=this.getCurrentRepetition(!0),i===void 0))break;e.parentRepetition=i.RepetitonUnderConstruction,i.RepetitonUnderConstruction.FromWords=!0,i.RepetitonUnderConstruction.forwardJumpInstruction===void 0?(i.FineFound=!0,i.RepetitonUnderConstruction.forwardJumpInstruction=e,i.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(this.openRepetitions.length===0||(i=this.getCurrentRepetition(!0),i===void 0))break;i.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(e.parentRepetition=i.RepetitonUnderConstruction,i.RepetitonUnderConstruction.FromWords=!0,i.ToCodaFound=!0,i.RepetitonUnderConstruction.forwardJumpInstruction=e,this.currentMeasure.LastRepetitionInstructions.push(e));break;case RepetitionInstructionEnum.Coda:if(this.openRepetitions.length===0)break;i=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=i.RepetitonUnderConstruction,i.WaitingForCoda?(i.CodaFound=!0,i.RepetitonUnderConstruction.setEndingStartIndex(2,this.currentMeasureIndex),this.currentMeasure.LastRepetitionInstructions.push(e),this.finalizeRepetition(i),this.currentMeasureIndex>0&&(this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].printNewSystemXml=!0)):i.ToCodaFound||(i.RepetitonUnderConstruction.BackwardJumpInstructions.length===0?(i.ToCodaFound=!0,i.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.ToCoda,AlignmentType.End,i.RepetitonUnderConstruction),this.currentMeasure.LastRepetitionInstructions.push(i.RepetitonUnderConstruction.forwardJumpInstruction)):this.currentMeasure.LastRepetitionInstructions.push(new RepetitionInstruction(this.currentMeasureIndex,RepetitionInstructionEnum.Coda,AlignmentType.Begin,void 0)));break;case RepetitionInstructionEnum.DaCapo:i=this.getOrCreateCurrentRepetition(),i.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&this.finalizeRepetition(i),i.RepetitonUnderConstruction.StartIndex!==0&&(i=this.createNewRepetition(0)),e.parentRepetition=i.RepetitonUnderConstruction,i.RepetitonUnderConstruction.FromWords=!0,i.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,i.RepetitonUnderConstruction),i.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e),i.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(i);break;case RepetitionInstructionEnum.DalSegno:if(i=this.getOrCreateCurrentRepetition2(!0),i.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(i),i=this.createNewRepetition(0),i.RepetitonUnderConstruction.FromWords=!0,i.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,i.RepetitonUnderConstruction)),e.parentRepetition=i.RepetitonUnderConstruction,!i.SegnoFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,e.measureIndex);s>=0&&(i.SegnoFound=!0,i.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(s,RepetitionInstructionEnum.Segno,AlignmentType.Begin,i.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].FirstRepetitionInstructions.splice(0,0,i.RepetitonUnderConstruction.startMarker))}i.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)&&i.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),i.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DalSegnoAlFine:if(this.openRepetitions.length===0)break;if(i=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=i.RepetitonUnderConstruction,!i.SegnoFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,e.measureIndex);s>=0&&(i.SegnoFound=!0,i.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(s,RepetitionInstructionEnum.Segno,AlignmentType.Begin,i.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].FirstRepetitionInstructions.splice(0,0,i.RepetitonUnderConstruction.startMarker))}if(!i.FineFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Fine,e.measureIndex);s>=0&&(i.FineFound=!0,i.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(s,RepetitionInstructionEnum.Fine,AlignmentType.Begin,i.RepetitonUnderConstruction),i.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,i.RepetitonUnderConstruction.forwardJumpInstruction))}i.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||i.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),i.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DaCapoAlFine:if(i=this.getOrCreateCurrentRepetition(),i.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(i),i=this.createNewRepetition(0)),i.RepetitonUnderConstruction.startMarker!==void 0&&i.RepetitonUnderConstruction.StartIndex!==0&&(i=this.createNewRepetition(0)),i.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,i.RepetitonUnderConstruction),i.RepetitonUnderConstruction.FromWords=!0,e.parentRepetition=i.RepetitonUnderConstruction,!i.FineFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Fine,e.measureIndex);s>=0&&(i.FineFound=!0,i.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(s,RepetitionInstructionEnum.Fine,AlignmentType.Begin,i.RepetitonUnderConstruction),i.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,i.RepetitonUnderConstruction.forwardJumpInstruction))}i.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||i.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),i.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DalSegnoAlCoda:if(this.openRepetitions.length===0)break;if(i=this.getOrCreateCurrentRepetition2(!0),e.parentRepetition=i.RepetitonUnderConstruction,!i.SegnoFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Segno,e.measureIndex);s>=0&&(i.SegnoFound=!0,i.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(s,RepetitionInstructionEnum.Segno,AlignmentType.Begin,i.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].FirstRepetitionInstructions.splice(0,0,i.RepetitonUnderConstruction.startMarker))}if(!i.ToCodaFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.ToCoda,e.measureIndex);if(s>=0)i.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(s,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,i.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,i.RepetitonUnderConstruction.forwardJumpInstruction),i.ToCodaFound=!0;else{const o=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Coda,e.measureIndex);o>=0&&(i.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(o,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,i.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[o].LastRepetitionInstructions.splice(0,0,i.RepetitonUnderConstruction.forwardJumpInstruction),i.ToCodaFound=!0)}}i.ToCodaFound&&(i.WaitingForCoda=!0),i.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||i.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),i.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.DaCapoAlCoda:if(i=this.getOrCreateCurrentRepetition(),i.RepetitonUnderConstruction.BackwardJumpInstructions.length>0?(this.finalizeRepetition(i),i=this.createNewRepetition(0)):i.RepetitonUnderConstruction.EndingParts.length===0&&(this.finalizeRepetition(i),i=this.createNewRepetition(0)),i.RepetitonUnderConstruction.startMarker!==void 0&&i.RepetitonUnderConstruction.StartIndex!==0&&(i=this.createNewRepetition(0)),i.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,i.RepetitonUnderConstruction),i.RepetitonUnderConstruction.FromWords=!0,e.parentRepetition=i.RepetitonUnderConstruction,!i.ToCodaFound){const s=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.ToCoda,e.measureIndex);if(s>=0)i.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(s,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,i.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,i.RepetitonUnderConstruction.forwardJumpInstruction),i.ToCodaFound=!0;else{const o=this.findInstructionInMainListBackwards(RepetitionInstructionEnum.Coda,e.measureIndex);o>=0&&(i.RepetitonUnderConstruction.forwardJumpInstruction=new RepetitionInstruction(o,RepetitionInstructionEnum.ToCoda,AlignmentType.Begin,i.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[o].LastRepetitionInstructions.splice(0,0,i.RepetitonUnderConstruction.forwardJumpInstruction),i.ToCodaFound=!0)}}i.ToCodaFound&&(i.WaitingForCoda=!0),i.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||i.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),i.RepetitonUnderConstruction.BackwardJumpInstructions.push(e),this.currentMeasure.LastRepetitionInstructions.push(e);break;case RepetitionInstructionEnum.None:break;default:throw new ArgumentOutOfRangeException("currentRepetitionInstruction")}return!0}findInstructionInMainListBackwards(e,i){for(let r=this.repetitionInstructions.length-1;r>=0;r--){const s=this.repetitionInstructions[r];if(s.measureIndex<=i&&s.type===e)return s.measureIndex}return-1}finalizeRepetition(e){const i=e.RepetitonUnderConstruction;if(i.BackwardJumpInstructions.length>0){let r=!0;const s=this.getLastFinalizedRepetition();if(s!==void 0&&i.coversIdenticalMeasures(s)){if(i.NumberOfEndings>s.NumberOfEndings){const o=this.musicSheet.Repetitions.indexOf(s,0);o>-1&&this.musicSheet.Repetitions.splice(o,1),s.removeFromRepetitionInstructions(),this.musicSheet.Repetitions.push(i)}r=!1,i.removeFromRepetitionInstructions()}else this.musicSheet.Repetitions.push(i);r&&(i.startMarker.type===RepetitionInstructionEnum.None&&this.musicSheet.SourceMeasures[i.StartIndex].FirstRepetitionInstructions.push(i.startMarker),i.UserNumberOfRepetitions=i.DefaultNumberOfRepetitions)}this.openRepetitions.splice(this.openRepetitions.length-1,1)}getCurrentRepetition(e){let i;for(let r=this.openRepetitions.length-1;r>=0;r--)if(this.openRepetitions[r].RepetitonUnderConstruction.FromWords===e){for(i=this.openRepetitions[r];r0)return this.openRepetitions.last();const e=this.createNewRepetition(0);return e.RepetitonUnderConstruction.startMarker=new RepetitionInstruction(0,RepetitionInstructionEnum.None,AlignmentType.Begin,e.RepetitonUnderConstruction),e}getOrCreateCurrentRepetition2(e){let i;if(this.openRepetitions.length&&this.openRepetitions.last().RepetitonUnderConstruction.EndingParts.length<2){for(let s=this.openRepetitions.length-1;s>=0;s--)if(i=this.openRepetitions[s],i.RepetitonUnderConstruction.FromWords===e){for(;s0){const r=this.openRepetitions.last(),s=r.RepetitonUnderConstruction;if(s.BackwardJumpInstructions.length>0){const o=Object.keys(s.EndingIndexDict);(o.length===0||s.EndingIndexDict[o[o.length-1]].part.EndIndex>=0)&&this.finalizeRepetition(r)}}const i=new RepetitionBuildingContainer(this.musicSheet);return this.lastRepetitionCommonPartStartIndex=e,this.openRepetitions.push(i),i}getLastFinalizedRepetition(){if(this.musicSheet.Repetitions.length>0)return this.musicSheet.Repetitions.last()}}class RepetitionBuildingContainer{constructor(e){this.RepetitonUnderConstruction=new Repetition(e)}}class MusicSymbolModuleFactory{static createRepetitionInstructionReader(){return new RepetitionInstructionReader}static createRepetitionCalculator(){return new RepetitionCalculator}}class ReaderPluginManager{constructor(){this.voiceMeasureReadPlugins=[]}addVoiceMeasureReadPlugin(e){this.voiceMeasureReadPlugins.push(e)}processVoiceMeasureReadPlugins(e,i,r){for(const s of this.voiceMeasureReadPlugins)try{s.measureReadCalculations(e,i,r)}catch(o){loglevelExports.info("VoiceGenerator.addSingleNote: ",o)}}}class MusicSheetReader{constructor(e=void 0,i=new EngravingRules){this.completeNumberOfStaves=0,this.pluginManager=new ReaderPluginManager,e?this.afterSheetReadingModules=e:this.afterSheetReadingModules=[],this.repetitionInstructionReader=MusicSymbolModuleFactory.createRepetitionInstructionReader(),this.repetitionCalculator=MusicSymbolModuleFactory.createRepetitionCalculator(),this.rules=i}get PluginManager(){return this.pluginManager}get CompleteNumberOfStaves(){return this.completeNumberOfStaves}static doCalculationsAfterDurationHasBeenSet(e){for(const i of e)i.doCalculationsAfterDurationHasBeenSet()}createMusicSheet(e,i){try{return this._createMusicSheet(e,i)}catch(r){loglevelExports.error("MusicSheetReader.CreateMusicSheet",r);return}}_removeFromArray(e,i){const r=e.indexOf(i);r!==-1&&e.splice(r,1)}trimString(e){return e.replace(/^\s+|\s+$/g,"")}_lastElement(e){return e[e.length-1]}_createMusicSheet(e,i){var d;const r=[];let s=0;if(this.musicSheet=new MusicSheet,this.musicSheet.Path=i,this.musicSheet.Rules=this.rules,!e)throw new MusicSheetReadingException("Undefined root element");this.pushSheetLabels(e,i);const o=e.element("part-list");if(!o)throw new MusicSheetReadingException("Undefined partListNode");const a=e.elements("part"),l=o.elements();this.initializeReading(l,a,r);let c=!0;this.currentFraction=new Fraction$1(0,1);let u=!1,m=e.element("identification");for(m&&(m=m.element("encoding")),m&&(m=m.element("software")),m!==void 0&&m.value==="Guitar Pro 5"&&(u=!0);c;){this.currentMeasure!==void 0&&this.currentMeasure.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(s=0),this.currentMeasure=new SourceMeasure(this.completeNumberOfStaves,this.musicSheet.Rules);for(const g of r)try{c=c&&g.readNextXmlMeasure(this.currentMeasure,this.currentFraction,u)}catch(y){const b=ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading instruments.");throw new MusicSheetReadingException(b,y)}c&&(this.musicSheet.addMeasure(this.currentMeasure),this.checkIfRhythmInstructionsAreSetAndEqual(r),this.checkSourceMeasureForNullEntries(),s=this.setSourceMeasureDuration(r,s),MusicSheetReader.doCalculationsAfterDurationHasBeenSet(r),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=(d=r[0])==null?void 0:d.SoundTempos)}this.repetitionInstructionReader&&(this.repetitionInstructionReader.removeRedundantInstructions(),this.repetitionCalculator&&this.repetitionCalculator.calculateRepetitions(this.musicSheet,this.repetitionInstructionReader.repetitionInstructions)),this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=100),this.musicSheet.checkForInstrumentWithNoVoice(),this.musicSheet.fillStaffList();for(let g=0,y=this.afterSheetReadingModules.length;gr){if(this.areRhythmInstructionsMixed(i)&&l.SymbolEnum!==RhythmSymbolEnum.NONE)continue;r=l.Rhythm.RealValue,s=i.indexOf(l)}}if(i.length>0&&i.lengthe.Denominator){const r=i.Denominator/e.Denominator;e.expand(r)}}checkIfMeasureIsImplicit(e,i){return!this.previousMeasure&&e.lt(i)?!0:this.previousMeasure?Fraction$1.plus(this.previousMeasure.Duration,e).Equals(i):!1}allInstrumentsHaveSameDuration(e,i){let r=0;for(let s=0,o=e.length;s=0;e--)for(let i=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries.length-1;i>=0;i--){const r=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries[i];if(r)for(let s=r.VoiceEntries.length-1;s>=0;s--){const o=r.VoiceEntries[s];o.Notes.length===0&&(this._removeFromArray(o.ParentVoice.VoiceEntries,o),this._removeFromArray(r.VoiceEntries,o))}r!==void 0&&r.VoiceEntries.length===0&&(this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries[i]=void 0)}for(let e=this.currentMeasure.VerticalSourceStaffEntryContainers.length-1;e>=0;e--){let i=0;for(let r=0,s=this.currentMeasure.VerticalSourceStaffEntryContainers[e].StaffEntries.length;ri){if(!this.musicSheet.Title){const _=b.attribute("font-size").value,P=parseFloat(_);r0&&m.MidiInstrumentId!==MidiInstrument.Percussion&&(S.midiInstrumentID=Math.max(0,parseInt(_.value,10)-1));else if(_.name==="midi-unpitched")S.fixedKey=Math.max(0,parseInt(_.value,10));else if(_.name==="volume")try{const P=parseFloat(_.value);S.volume=P/127}catch(P){loglevelExports.debug("ExpressionReader.readExpressionParameters","read volume",P)}else if(_.name==="pan")try{const P=parseFloat(_.value);S.pan=P/64}catch(P){loglevelExports.debug("ExpressionReader.readExpressionParameters","read pan",P)}}catch(P){loglevelExports.info("MusicSheetReader.createInstrumentGroups midi settings: ",P)}}}}catch(S){loglevelExports.info("MusicSheetReader.createInstrumentGroups: ",S)}}if(m.SubInstruments.length===0){const g=new SubInstrument(m);m.SubInstruments.push(g)}r[u]=m,s?(s.InstrumentalGroups.push(m),this.musicSheet.Instruments.push(m)):(this.musicSheet.InstrumentalGroups.push(m),this.musicSheet.Instruments.push(m))}else if(c.name==="part-group"&&c.attribute("type").value==="start"){const u=new InstrumentalGroup("group",this.musicSheet,s);s?s.InstrumentalGroups.push(u):this.musicSheet.InstrumentalGroups.push(u),s=u}else if(c.name==="part-group"&&c.attribute("type").value==="stop"&&s){if(s.InstrumentalGroups.length===1){const u=s.InstrumentalGroups[0];s.Parent?(s.Parent.InstrumentalGroups.push(u),this._removeFromArray(s.Parent.InstrumentalGroups,s)):(this.musicSheet.InstrumentalGroups.push(u),this._removeFromArray(this.musicSheet.InstrumentalGroups,s))}s=s.Parent}}}catch(o){const a=ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading Instruments");throw new MusicSheetReadingException(a,o)}for(let o=0,a=this.musicSheet.Instruments.length;o0){const o=s[0];if(o){let a=o.element("attributes");a&&(a=a.element("staves")),a?i+=parseInt(a.value,10):i++}}}if(isNaN(i)||i<=0){const r=ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of staves.");throw new MusicSheetReadingException(r)}return i}getInstrumentNumberOfStavesFromXml(e){let i=0;const r=e.element("measure");if(r){const s=r.element("attributes");let o;s&&(o=s.element("staves")),!s||!o?i=1:i=parseInt(o.value,10)}if(isNaN(i)||i<=0){const s=ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of Staves.");throw new MusicSheetReadingException(s)}return i}}function commonjsRequire(t){throw new Error('Could not dynamically require "'+t+'". 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(t){jszip_minExports=t}};/*! JSZip v3.10.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/main/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(t,e){(function(i){t.exports=i()})(function(){return function i(r,s,o){function a(u,m){if(!s[u]){if(!r[u]){var d=typeof commonjsRequire=="function"&&commonjsRequire;if(!m&&d)return d(u,!0);if(l)return l(u,!0);var g=new Error("Cannot find module '"+u+"'");throw g.code="MODULE_NOT_FOUND",g}var y=s[u]={exports:{}};r[u][0].call(y.exports,function(b){var S=r[u][1][b];return a(S||b)},y,y.exports,i,r,s,o)}return s[u].exports}for(var l=typeof commonjsRequire=="function"&&commonjsRequire,c=0;c>2,y=(3&u)<<4|m>>4,b=1<_?(15&m)<<2|d>>6:64,S=2<_?63&d:64,E.push(l.charAt(g)+l.charAt(y)+l.charAt(b)+l.charAt(S));return E.join("")},s.decode=function(c){var u,m,d,g,y,b,S=0,E=0,x="data:";if(c.substr(0,x.length)===x)throw new Error("Invalid base64 input, it looks like a data url.");var A,_=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&_--,c.charAt(c.length-2)===l.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(A=a.uint8array?new Uint8Array(0|_):new Array(0|_);S>4,m=(15&g)<<4|(y=l.indexOf(c.charAt(S++)))>>2,d=(3&y)<<6|(b=l.indexOf(c.charAt(S++))),A[E++]=u,y!==64&&(A[E++]=m),b!==64&&(A[E++]=d);return A}},{"./support":30,"./utils":32}],2:[function(i,r,s){var o=i("./external"),a=i("./stream/DataWorker"),l=i("./stream/Crc32Probe"),c=i("./stream/DataLengthProbe");function u(m,d,g,y,b){this.compressedSize=m,this.uncompressedSize=d,this.crc32=g,this.compression=y,this.compressedContent=b}u.prototype={getContentWorker:function(){var m=new a(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),d=this;return m.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),m},getCompressedWorker:function(){return new a(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(m,d,g){return m.pipe(new l).pipe(new c("uncompressedSize")).pipe(d.compressWorker(g)).pipe(new c("compressedSize")).withStreamInfo("compression",d)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(i,r,s){var o=i("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},s.DEFLATE=i("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(i,r,s){var o=i("./utils"),a=function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var m=0;m<8;m++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c}();r.exports=function(l,c){return l!==void 0&&l.length?o.getTypeOf(l)!=="string"?function(u,m,d,g){var y=a,b=g+d;u^=-1;for(var S=g;S>>8^y[255&(u^m[S])];return-1^u}(0|c,l,l.length,0):function(u,m,d,g){var y=a,b=g+d;u^=-1;for(var S=g;S>>8^y[255&(u^m.charCodeAt(S))];return-1^u}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(i,r,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(i,r,s){var o=null;o=typeof Promise<"u"?Promise:i("lie"),r.exports={Promise:o}},{lie:37}],7:[function(i,r,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=i("pako"),l=i("./utils"),c=i("./stream/GenericWorker"),u=o?"uint8array":"array";function m(d,g){c.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=g,this.meta={}}s.magic="\b\0",l.inherits(m,c),m.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,d.data),!1)},m.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},m.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},m.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(g){d.push({data:g,meta:d.meta})}},s.compressWorker=function(d){return new m("Deflate",d)},s.uncompressWorker=function(){return new m("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(i,r,s){function o(y,b){var S,E="";for(S=0;S>>=8;return E}function a(y,b,S,E,x,A){var _,P,T=y.file,M=y.compression,C=A!==u.utf8encode,I=l.transformTo("string",A(T.name)),D=l.transformTo("string",u.utf8encode(T.name)),G=T.comment,$=l.transformTo("string",A(G)),N=l.transformTo("string",u.utf8encode(G)),z=D.length!==T.name.length,R=N.length!==G.length,H="",O="",V="",k=T.dir,F=T.date,Z={crc32:0,compressedSize:0,uncompressedSize:0};b&&!S||(Z.crc32=y.crc32,Z.compressedSize=y.compressedSize,Z.uncompressedSize=y.uncompressedSize);var U=0;b&&(U|=8),C||!z&&!R||(U|=2048);var J=0,de=0;k&&(J|=16),x==="UNIX"?(de=798,J|=function(te,ce){var pe=te;return te||(pe=ce?16893:33204),(65535&pe)<<16}(T.unixPermissions,k)):(de=20,J|=function(te){return 63&(te||0)}(T.dosPermissions)),_=F.getUTCHours(),_<<=6,_|=F.getUTCMinutes(),_<<=5,_|=F.getUTCSeconds()/2,P=F.getUTCFullYear()-1980,P<<=4,P|=F.getUTCMonth()+1,P<<=5,P|=F.getUTCDate(),z&&(O=o(1,1)+o(m(I),4)+D,H+="up"+o(O.length,2)+O),R&&(V=o(1,1)+o(m($),4)+N,H+="uc"+o(V.length,2)+V);var ne="";return ne+=` \0`,ne+=o(U,2),ne+=M.magic,ne+=o(_,2),ne+=o(P,2),ne+=o(Z.crc32,4),ne+=o(Z.compressedSize,4),ne+=o(Z.uncompressedSize,4),ne+=o(I.length,2),ne+=o(H.length,2),{fileRecord:d.LOCAL_FILE_HEADER+ne+I+H,dirRecord:d.CENTRAL_FILE_HEADER+o(de,2)+ne+o($.length,2)+"\0\0\0\0"+o(J,4)+o(E,4)+I+H+$}}var l=i("../utils"),c=i("../stream/GenericWorker"),u=i("../utf8"),m=i("../crc32"),d=i("../signature");function g(y,b,S,E){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=b,this.zipPlatform=S,this.encodeFileName=E,this.streamFiles=y,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(g,c),g.prototype.push=function(y){var b=y.meta.percent||0,S=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(y):(this.bytesWritten+=y.data.length,c.prototype.push.call(this,{data:y.data,meta:{currentFile:this.currentFile,percent:S?(b+100*(S-E-1))/S:100}}))},g.prototype.openedSource=function(y){this.currentSourceOffset=this.bytesWritten,this.currentFile=y.file.name;var b=this.streamFiles&&!y.file.dir;if(b){var S=a(y,b,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:S.fileRecord,meta:{percent:0}})}else this.accumulate=!0},g.prototype.closedSource=function(y){this.accumulate=!1;var b=this.streamFiles&&!y.file.dir,S=a(y,b,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(S.dirRecord),b)this.push({data:function(E){return d.DATA_DESCRIPTOR+o(E.crc32,4)+o(E.compressedSize,4)+o(E.uncompressedSize,4)}(y),meta:{percent:100}});else for(this.push({data:S.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},g.prototype.flush=function(){for(var y=this.bytesWritten,b=0;b=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return o.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},r.exports=a},{"../utils":32}],19:[function(i,r,s){var o=i("./Uint8ArrayReader");function a(l){o.call(this,l)}i("../utils").inherits(a,o),a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(i,r,s){var o=i("./DataReader");function a(l){o.call(this,l)}i("../utils").inherits(a,o),a.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},a.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},a.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(i,r,s){var o=i("./ArrayReader");function a(l){o.call(this,l)}i("../utils").inherits(a,o),a.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(i,r,s){var o=i("../utils"),a=i("../support"),l=i("./ArrayReader"),c=i("./StringReader"),u=i("./NodeBufferReader"),m=i("./Uint8ArrayReader");r.exports=function(d){var g=o.getTypeOf(d);return o.checkSupport(g),g!=="string"||a.uint8array?g==="nodebuffer"?new u(d):a.uint8array?new m(o.transformTo("uint8array",d)):new l(o.transformTo("array",d)):new c(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(i,r,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(i,r,s){var o=i("./GenericWorker"),a=i("../utils");function l(c){o.call(this,"ConvertWorker to "+c),this.destType=c}a.inherits(l,o),l.prototype.processChunk=function(c){this.push({data:a.transformTo(this.destType,c.data),meta:c.meta})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(i,r,s){var o=i("./GenericWorker"),a=i("../crc32");function l(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}i("../utils").inherits(l,o),l.prototype.processChunk=function(c){this.streamInfo.crc32=a(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(i,r,s){var o=i("../utils"),a=i("./GenericWorker");function l(c){a.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(l,a),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}a.prototype.processChunk.call(this,c)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(i,r,s){var o=i("../utils"),a=i("./GenericWorker");function l(c){a.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(m){u.dataIsReady=!0,u.data=m,u.max=m&&m.length||0,u.type=o.getTypeOf(m),u.isPaused||u._tickAndRepeat()},function(m){u.error(m)})}o.inherits(l,a),l.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(i,r,s){function o(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,l){return this._listeners[a].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,l){if(this._listeners[a])for(var c=0;c "+a:a}},r.exports=o},{}],29:[function(i,r,s){var o=i("../utils"),a=i("./ConvertWorker"),l=i("./GenericWorker"),c=i("../base64"),u=i("../support"),m=i("../external"),d=null;if(u.nodestream)try{d=i("../nodejs/NodejsStreamOutputAdapter")}catch(b){}function g(b,S){return new m.Promise(function(E,x){var A=[],_=b._internalType,P=b._outputType,T=b._mimeType;b.on("data",function(M,C){A.push(M),S&&S(C)}).on("error",function(M){A=[],x(M)}).on("end",function(){try{var M=function(C,I,D){switch(C){case"blob":return o.newBlob(o.transformTo("arraybuffer",I),D);case"base64":return c.encode(I);default:return o.transformTo(C,I)}}(P,function(C,I){var D,G=0,$=null,N=0;for(D=0;D"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch(l){try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(o),s.blob=a.getBlob("application/zip").size===0}catch(c){s.blob=!1}}}try{s.nodestream=!!i("readable-stream").Readable}catch(l){s.nodestream=!1}},{"readable-stream":16}],31:[function(i,r,s){for(var o=i("./utils"),a=i("./support"),l=i("./nodejsUtils"),c=i("./stream/GenericWorker"),u=new Array(256),m=0;m<256;m++)u[m]=252<=m?6:248<=m?5:240<=m?4:224<=m?3:192<=m?2:1;u[254]=u[254]=1;function d(){c.call(this,"utf-8 decode"),this.leftOver=null}function g(){c.call(this,"utf-8 encode")}s.utf8encode=function(y){return a.nodebuffer?l.newBufferFrom(y,"utf-8"):function(b){var S,E,x,A,_,P=b.length,T=0;for(A=0;A>>6:(E<65536?S[_++]=224|E>>>12:(S[_++]=240|E>>>18,S[_++]=128|E>>>12&63),S[_++]=128|E>>>6&63),S[_++]=128|63&E);return S}(y)},s.utf8decode=function(y){return a.nodebuffer?o.transformTo("nodebuffer",y).toString("utf-8"):function(b){var S,E,x,A,_=b.length,P=new Array(2*_);for(S=E=0;S<_;)if((x=b[S++])<128)P[E++]=x;else if(4<(A=u[x]))P[E++]=65533,S+=A-1;else{for(x&=A===2?31:A===3?15:7;1>10&1023,P[E++]=56320|1023&x)}return P.length!==E&&(P.subarray?P=P.subarray(0,E):P.length=E),o.applyFromCharCode(P)}(y=o.transformTo(a.uint8array?"uint8array":"array",y))},o.inherits(d,c),d.prototype.processChunk=function(y){var b=o.transformTo(a.uint8array?"uint8array":"array",y.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var S=b;(b=new Uint8Array(S.length+this.leftOver.length)).set(this.leftOver,0),b.set(S,this.leftOver.length)}else b=this.leftOver.concat(b);this.leftOver=null}var E=function(A,_){var P;for((_=_||A.length)>A.length&&(_=A.length),P=_-1;0<=P&&(192&A[P])==128;)P--;return P<0||P===0?_:P+u[A[P]]>_?P:_}(b),x=b;E!==b.length&&(a.uint8array?(x=b.subarray(0,E),this.leftOver=b.subarray(E,b.length)):(x=b.slice(0,E),this.leftOver=b.slice(E,b.length))),this.push({data:s.utf8decode(x),meta:y.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=d,o.inherits(g,c),g.prototype.processChunk=function(y){this.push({data:s.utf8encode(y.data),meta:y.meta})},s.Utf8EncodeWorker=g},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(i,r,s){var o=i("./support"),a=i("./base64"),l=i("./nodejsUtils"),c=i("./external");function u(S){return S}function m(S,E){for(var x=0;x>8;this.dir=!!(16&this.externalFileAttributes),y==0&&(this.dosPermissions=63&this.externalFileAttributes),y==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var y=o(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=y.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=y.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=y.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=y.readInt(4))}},readExtraFields:function(y){var b,S,E,x=y.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});y.index+4>>6:(y<65536?g[E++]=224|y>>>12:(g[E++]=240|y>>>18,g[E++]=128|y>>>12&63),g[E++]=128|y>>>6&63),g[E++]=128|63&y);return g},s.buf2binstring=function(d){return m(d,d.length)},s.binstring2buf=function(d){for(var g=new o.Buf8(d.length),y=0,b=g.length;y>10&1023,A[b++]=56320|1023&S)}return m(A,b)},s.utf8border=function(d,g){var y;for((g=g||d.length)>d.length&&(g=d.length),y=g-1;0<=y&&(192&d[y])==128;)y--;return y<0||y===0?g:y+c[d[y]]>g?y:g}},{"./common":41}],43:[function(i,r,s){r.exports=function(o,a,l,c){for(var u=65535&o|0,m=o>>>16&65535|0,d=0;l!==0;){for(l-=d=2e3>>1:a>>>1;l[c]=a}return l}();r.exports=function(a,l,c,u){var m=o,d=u+c;a^=-1;for(var g=u;g>>8^m[255&(a^l[g])];return-1^a}},{}],46:[function(i,r,s){var o,a=i("../utils/common"),l=i("./trees"),c=i("./adler32"),u=i("./crc32"),m=i("./messages"),d=0,g=4,y=0,b=-2,S=-1,E=4,x=2,A=8,_=9,P=286,T=30,M=19,C=2*P+1,I=15,D=3,G=258,$=G+D+1,N=42,z=113,R=1,H=2,O=3,V=4;function k(B,re){return B.msg=m[re],re}function F(B){return(B<<1)-(4B.avail_out&&(ee=B.avail_out),ee!==0&&(a.arraySet(B.output,re.pending_buf,re.pending_out,ee,B.next_out),B.next_out+=ee,re.pending_out+=ee,B.total_out+=ee,B.avail_out-=ee,re.pending-=ee,re.pending===0&&(re.pending_out=0))}function J(B,re){l._tr_flush_block(B,0<=B.block_start?B.block_start:-1,B.strstart-B.block_start,re),B.block_start=B.strstart,U(B.strm)}function de(B,re){B.pending_buf[B.pending++]=re}function ne(B,re){B.pending_buf[B.pending++]=re>>>8&255,B.pending_buf[B.pending++]=255&re}function te(B,re){var ee,W,Q=B.max_chain_length,K=B.strstart,le=B.prev_length,oe=B.nice_match,ae=B.strstart>B.w_size-$?B.strstart-(B.w_size-$):0,he=B.window,me=B.w_mask,ye=B.prev,fe=B.strstart+G,xe=he[K+le-1],ge=he[K+le];B.prev_length>=B.good_match&&(Q>>=2),oe>B.lookahead&&(oe=B.lookahead);do if(he[(ee=re)+le]===ge&&he[ee+le-1]===xe&&he[ee]===he[K]&&he[++ee]===he[K+1]){K+=2,ee++;do;while(he[++K]===he[++ee]&&he[++K]===he[++ee]&&he[++K]===he[++ee]&&he[++K]===he[++ee]&&he[++K]===he[++ee]&&he[++K]===he[++ee]&&he[++K]===he[++ee]&&he[++K]===he[++ee]&&Kae&&--Q!=0);return le<=B.lookahead?le:B.lookahead}function ce(B){var re,ee,W,Q,K,le,oe,ae,he,me,ye=B.w_size;do{if(Q=B.window_size-B.lookahead-B.strstart,B.strstart>=ye+(ye-$)){for(a.arraySet(B.window,B.window,ye,ye,0),B.match_start-=ye,B.strstart-=ye,B.block_start-=ye,re=ee=B.hash_size;W=B.head[--re],B.head[re]=ye<=W?W-ye:0,--ee;);for(re=ee=ye;W=B.prev[--re],B.prev[re]=ye<=W?W-ye:0,--ee;);Q+=ye}if(B.strm.avail_in===0)break;if(le=B.strm,oe=B.window,ae=B.strstart+B.lookahead,he=Q,me=void 0,me=le.avail_in,he=D)for(K=B.strstart-B.insert,B.ins_h=B.window[K],B.ins_h=(B.ins_h<=D&&(B.ins_h=(B.ins_h<=D)if(W=l._tr_tally(B,B.strstart-B.match_start,B.match_length-D),B.lookahead-=B.match_length,B.match_length<=B.max_lazy_match&&B.lookahead>=D){for(B.match_length--;B.strstart++,B.ins_h=(B.ins_h<=D&&(B.ins_h=(B.ins_h<=D&&B.match_length<=B.prev_length){for(Q=B.strstart+B.lookahead-D,W=l._tr_tally(B,B.strstart-1-B.prev_match,B.prev_length-D),B.lookahead-=B.prev_length-1,B.prev_length-=2;++B.strstart<=Q&&(B.ins_h=(B.ins_h<B.pending_buf_size-5&&(ee=B.pending_buf_size-5);;){if(B.lookahead<=1){if(ce(B),B.lookahead===0&&re===d)return R;if(B.lookahead===0)break}B.strstart+=B.lookahead,B.lookahead=0;var W=B.block_start+ee;if((B.strstart===0||B.strstart>=W)&&(B.lookahead=B.strstart-W,B.strstart=W,J(B,!1),B.strm.avail_out===0)||B.strstart-B.block_start>=B.w_size-$&&(J(B,!1),B.strm.avail_out===0))return R}return B.insert=0,re===g?(J(B,!0),B.strm.avail_out===0?O:V):(B.strstart>B.block_start&&(J(B,!1),B.strm.avail_out),R)}),new be(4,4,8,4,pe),new be(4,5,16,8,pe),new be(4,6,32,32,pe),new be(4,4,16,16,ue),new be(8,16,32,32,ue),new be(8,16,128,128,ue),new be(8,32,128,256,ue),new be(32,128,258,1024,ue),new be(32,258,258,4096,ue)],s.deflateInit=function(B,re){return ie(B,re,A,15,8,0)},s.deflateInit2=ie,s.deflateReset=q,s.deflateResetKeep=Se,s.deflateSetHeader=function(B,re){return B&&B.state?B.state.wrap!==2?b:(B.state.gzhead=re,y):b},s.deflate=function(B,re){var ee,W,Q,K;if(!B||!B.state||5>8&255),de(W,W.gzhead.time>>16&255),de(W,W.gzhead.time>>24&255),de(W,W.level===9?2:2<=W.strategy||W.level<2?4:0),de(W,255&W.gzhead.os),W.gzhead.extra&&W.gzhead.extra.length&&(de(W,255&W.gzhead.extra.length),de(W,W.gzhead.extra.length>>8&255)),W.gzhead.hcrc&&(B.adler=u(B.adler,W.pending_buf,W.pending,0)),W.gzindex=0,W.status=69):(de(W,0),de(W,0),de(W,0),de(W,0),de(W,0),de(W,W.level===9?2:2<=W.strategy||W.level<2?4:0),de(W,3),W.status=z);else{var le=A+(W.w_bits-8<<4)<<8;le|=(2<=W.strategy||W.level<2?0:W.level<6?1:W.level===6?2:3)<<6,W.strstart!==0&&(le|=32),le+=31-le%31,W.status=z,ne(W,le),W.strstart!==0&&(ne(W,B.adler>>>16),ne(W,65535&B.adler)),B.adler=1}if(W.status===69)if(W.gzhead.extra){for(Q=W.pending;W.gzindex<(65535&W.gzhead.extra.length)&&(W.pending!==W.pending_buf_size||(W.gzhead.hcrc&&W.pending>Q&&(B.adler=u(B.adler,W.pending_buf,W.pending-Q,Q)),U(B),Q=W.pending,W.pending!==W.pending_buf_size));)de(W,255&W.gzhead.extra[W.gzindex]),W.gzindex++;W.gzhead.hcrc&&W.pending>Q&&(B.adler=u(B.adler,W.pending_buf,W.pending-Q,Q)),W.gzindex===W.gzhead.extra.length&&(W.gzindex=0,W.status=73)}else W.status=73;if(W.status===73)if(W.gzhead.name){Q=W.pending;do{if(W.pending===W.pending_buf_size&&(W.gzhead.hcrc&&W.pending>Q&&(B.adler=u(B.adler,W.pending_buf,W.pending-Q,Q)),U(B),Q=W.pending,W.pending===W.pending_buf_size)){K=1;break}K=W.gzindexQ&&(B.adler=u(B.adler,W.pending_buf,W.pending-Q,Q)),K===0&&(W.gzindex=0,W.status=91)}else W.status=91;if(W.status===91)if(W.gzhead.comment){Q=W.pending;do{if(W.pending===W.pending_buf_size&&(W.gzhead.hcrc&&W.pending>Q&&(B.adler=u(B.adler,W.pending_buf,W.pending-Q,Q)),U(B),Q=W.pending,W.pending===W.pending_buf_size)){K=1;break}K=W.gzindexQ&&(B.adler=u(B.adler,W.pending_buf,W.pending-Q,Q)),K===0&&(W.status=103)}else W.status=103;if(W.status===103&&(W.gzhead.hcrc?(W.pending+2>W.pending_buf_size&&U(B),W.pending+2<=W.pending_buf_size&&(de(W,255&B.adler),de(W,B.adler>>8&255),B.adler=0,W.status=z)):W.status=z),W.pending!==0){if(U(B),B.avail_out===0)return W.last_flush=-1,y}else if(B.avail_in===0&&F(re)<=F(ee)&&re!==g)return k(B,-5);if(W.status===666&&B.avail_in!==0)return k(B,-5);if(B.avail_in!==0||W.lookahead!==0||re!==d&&W.status!==666){var oe=W.strategy===2?function(ae,he){for(var me;;){if(ae.lookahead===0&&(ce(ae),ae.lookahead===0)){if(he===d)return R;break}if(ae.match_length=0,me=l._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++,me&&(J(ae,!1),ae.strm.avail_out===0))return R}return ae.insert=0,he===g?(J(ae,!0),ae.strm.avail_out===0?O:V):ae.last_lit&&(J(ae,!1),ae.strm.avail_out===0)?R:H}(W,re):W.strategy===3?function(ae,he){for(var me,ye,fe,xe,ge=ae.window;;){if(ae.lookahead<=G){if(ce(ae),ae.lookahead<=G&&he===d)return R;if(ae.lookahead===0)break}if(ae.match_length=0,ae.lookahead>=D&&0ae.lookahead&&(ae.match_length=ae.lookahead)}if(ae.match_length>=D?(me=l._tr_tally(ae,1,ae.match_length-D),ae.lookahead-=ae.match_length,ae.strstart+=ae.match_length,ae.match_length=0):(me=l._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++),me&&(J(ae,!1),ae.strm.avail_out===0))return R}return ae.insert=0,he===g?(J(ae,!0),ae.strm.avail_out===0?O:V):ae.last_lit&&(J(ae,!1),ae.strm.avail_out===0)?R:H}(W,re):o[W.level].func(W,re);if(oe!==O&&oe!==V||(W.status=666),oe===R||oe===O)return B.avail_out===0&&(W.last_flush=-1),y;if(oe===H&&(re===1?l._tr_align(W):re!==5&&(l._tr_stored_block(W,0,0,!1),re===3&&(Z(W.head),W.lookahead===0&&(W.strstart=0,W.block_start=0,W.insert=0))),U(B),B.avail_out===0))return W.last_flush=-1,y}return re!==g?y:W.wrap<=0?1:(W.wrap===2?(de(W,255&B.adler),de(W,B.adler>>8&255),de(W,B.adler>>16&255),de(W,B.adler>>24&255),de(W,255&B.total_in),de(W,B.total_in>>8&255),de(W,B.total_in>>16&255),de(W,B.total_in>>24&255)):(ne(W,B.adler>>>16),ne(W,65535&B.adler)),U(B),0=ee.w_size&&(K===0&&(Z(ee.head),ee.strstart=0,ee.block_start=0,ee.insert=0),he=new a.Buf8(ee.w_size),a.arraySet(he,re,me-ee.w_size,ee.w_size,0),re=he,me=ee.w_size),le=B.avail_in,oe=B.next_in,ae=B.input,B.avail_in=me,B.next_in=0,B.input=re,ce(ee);ee.lookahead>=D;){for(W=ee.strstart,Q=ee.lookahead-(D-1);ee.ins_h=(ee.ins_h<>>=D=I>>>24,_-=D,(D=I>>>16&255)===0)H[m++]=65535&I;else{if(!(16&D)){if(!(64&D)){I=P[(65535&I)+(A&(1<>>=D,_-=D),_<15&&(A+=R[c++]<<_,_+=8,A+=R[c++]<<_,_+=8),I=T[A&C];i:for(;;){if(A>>>=D=I>>>24,_-=D,!(16&(D=I>>>16&255))){if(!(64&D)){I=T[(65535&I)+(A&(1<>>=D,_-=D,(D=m-d)<$){if(S<(D=$-D)&&l.sane){o.msg="invalid distance too far back",l.mode=30;break e}if(z=x,(N=0)===E){if(N+=b-D,D>3,A&=(1<<(_-=G<<3))-1,o.next_in=c,o.next_out=m,o.avail_in=c>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function A(){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 o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(N){var z;return N&&N.state?(z=N.state,N.total_in=N.total_out=z.total=0,N.msg="",z.wrap&&(N.adler=1&z.wrap),z.mode=b,z.last=0,z.havedict=0,z.dmax=32768,z.head=null,z.hold=0,z.bits=0,z.lencode=z.lendyn=new o.Buf32(S),z.distcode=z.distdyn=new o.Buf32(E),z.sane=1,z.back=-1,g):y}function P(N){var z;return N&&N.state?((z=N.state).wsize=0,z.whave=0,z.wnext=0,_(N)):y}function T(N,z){var R,H;return N&&N.state?(H=N.state,z<0?(R=0,z=-z):(R=1+(z>>4),z<48&&(z&=15)),z&&(z<8||15=V.wsize?(o.arraySet(V.window,z,R-V.wsize,V.wsize,0),V.wnext=0,V.whave=V.wsize):(H<(O=V.wsize-V.wnext)&&(O=H),o.arraySet(V.window,z,R-H,O,V.wnext),(H-=O)?(o.arraySet(V.window,z,R-H,H,0),V.wnext=H,V.whave=V.wsize):(V.wnext+=O,V.wnext===V.wsize&&(V.wnext=0),V.whave>>8&255,R.check=l(R.check,K,2,0),J=U=0,R.mode=2;break}if(R.flags=0,R.head&&(R.head.done=!1),!(1&R.wrap)||(((255&U)<<8)+(U>>8))%31){N.msg="incorrect header check",R.mode=30;break}if((15&U)!=8){N.msg="unknown compression method",R.mode=30;break}if(J-=4,B=8+(15&(U>>>=4)),R.wbits===0)R.wbits=B;else if(B>R.wbits){N.msg="invalid window size",R.mode=30;break}R.dmax=1<>8&1),512&R.flags&&(K[0]=255&U,K[1]=U>>>8&255,R.check=l(R.check,K,2,0)),J=U=0,R.mode=3;case 3:for(;J<32;){if(F===0)break e;F--,U+=H[V++]<>>8&255,K[2]=U>>>16&255,K[3]=U>>>24&255,R.check=l(R.check,K,4,0)),J=U=0,R.mode=4;case 4:for(;J<16;){if(F===0)break e;F--,U+=H[V++]<>8),512&R.flags&&(K[0]=255&U,K[1]=U>>>8&255,R.check=l(R.check,K,2,0)),J=U=0,R.mode=5;case 5:if(1024&R.flags){for(;J<16;){if(F===0)break e;F--,U+=H[V++]<>>8&255,R.check=l(R.check,K,2,0)),J=U=0}else R.head&&(R.head.extra=null);R.mode=6;case 6:if(1024&R.flags&&(F<(te=R.length)&&(te=F),te&&(R.head&&(B=R.head.extra_len-R.length,R.head.extra||(R.head.extra=new Array(R.head.extra_len)),o.arraySet(R.head.extra,H,V,te,B)),512&R.flags&&(R.check=l(R.check,H,te,V)),F-=te,V+=te,R.length-=te),R.length))break e;R.length=0,R.mode=7;case 7:if(2048&R.flags){if(F===0)break e;for(te=0;B=H[V+te++],R.head&&B&&R.length<65536&&(R.head.name+=String.fromCharCode(B)),B&&te>9&1,R.head.done=!0),N.adler=R.check=0,R.mode=12;break;case 10:for(;J<32;){if(F===0)break e;F--,U+=H[V++]<>>=7&J,J-=7&J,R.mode=27;break}for(;J<3;){if(F===0)break e;F--,U+=H[V++]<>>=1)){case 0:R.mode=14;break;case 1:if(G(R),R.mode=20,z!==6)break;U>>>=2,J-=2;break e;case 2:R.mode=17;break;case 3:N.msg="invalid block type",R.mode=30}U>>>=2,J-=2;break;case 14:for(U>>>=7&J,J-=7&J;J<32;){if(F===0)break e;F--,U+=H[V++]<>>16^65535)){N.msg="invalid stored block lengths",R.mode=30;break}if(R.length=65535&U,J=U=0,R.mode=15,z===6)break e;case 15:R.mode=16;case 16:if(te=R.length){if(F>>=5,J-=5,R.ndist=1+(31&U),U>>>=5,J-=5,R.ncode=4+(15&U),U>>>=4,J-=4,286>>=3,J-=3}for(;R.have<19;)R.lens[le[R.have++]]=0;if(R.lencode=R.lendyn,R.lenbits=7,ee={bits:R.lenbits},re=u(0,R.lens,0,19,R.lencode,0,R.work,ee),R.lenbits=ee.bits,re){N.msg="invalid code lengths set",R.mode=30;break}R.have=0,R.mode=19;case 19:for(;R.have>>16&255,Ee=65535&Q,!((ue=Q>>>24)<=J);){if(F===0)break e;F--,U+=H[V++]<>>=ue,J-=ue,R.lens[R.have++]=Ee;else{if(Ee===16){for(W=ue+2;J>>=ue,J-=ue,R.have===0){N.msg="invalid bit length repeat",R.mode=30;break}B=R.lens[R.have-1],te=3+(3&U),U>>>=2,J-=2}else if(Ee===17){for(W=ue+3;J>>=ue)),U>>>=3,J-=3}else{for(W=ue+7;J>>=ue)),U>>>=7,J-=7}if(R.have+te>R.nlen+R.ndist){N.msg="invalid bit length repeat",R.mode=30;break}for(;te--;)R.lens[R.have++]=B}}if(R.mode===30)break;if(R.lens[256]===0){N.msg="invalid code -- missing end-of-block",R.mode=30;break}if(R.lenbits=9,ee={bits:R.lenbits},re=u(m,R.lens,0,R.nlen,R.lencode,0,R.work,ee),R.lenbits=ee.bits,re){N.msg="invalid literal/lengths set",R.mode=30;break}if(R.distbits=6,R.distcode=R.distdyn,ee={bits:R.distbits},re=u(d,R.lens,R.nlen,R.ndist,R.distcode,0,R.work,ee),R.distbits=ee.bits,re){N.msg="invalid distances set",R.mode=30;break}if(R.mode=20,z===6)break e;case 20:R.mode=21;case 21:if(6<=F&&258<=Z){N.next_out=k,N.avail_out=Z,N.next_in=V,N.avail_in=F,R.hold=U,R.bits=J,c(N,ne),k=N.next_out,O=N.output,Z=N.avail_out,V=N.next_in,H=N.input,F=N.avail_in,U=R.hold,J=R.bits,R.mode===12&&(R.back=-1);break}for(R.back=0;be=(Q=R.lencode[U&(1<>>16&255,Ee=65535&Q,!((ue=Q>>>24)<=J);){if(F===0)break e;F--,U+=H[V++]<>Se)])>>>16&255,Ee=65535&Q,!(Se+(ue=Q>>>24)<=J);){if(F===0)break e;F--,U+=H[V++]<>>=Se,J-=Se,R.back+=Se}if(U>>>=ue,J-=ue,R.back+=ue,R.length=Ee,be===0){R.mode=26;break}if(32&be){R.back=-1,R.mode=12;break}if(64&be){N.msg="invalid literal/length code",R.mode=30;break}R.extra=15&be,R.mode=22;case 22:if(R.extra){for(W=R.extra;J>>=R.extra,J-=R.extra,R.back+=R.extra}R.was=R.length,R.mode=23;case 23:for(;be=(Q=R.distcode[U&(1<>>16&255,Ee=65535&Q,!((ue=Q>>>24)<=J);){if(F===0)break e;F--,U+=H[V++]<>Se)])>>>16&255,Ee=65535&Q,!(Se+(ue=Q>>>24)<=J);){if(F===0)break e;F--,U+=H[V++]<>>=Se,J-=Se,R.back+=Se}if(U>>>=ue,J-=ue,R.back+=ue,64&be){N.msg="invalid distance code",R.mode=30;break}R.offset=Ee,R.extra=15&be,R.mode=24;case 24:if(R.extra){for(W=R.extra;J>>=R.extra,J-=R.extra,R.back+=R.extra}if(R.offset>R.dmax){N.msg="invalid distance too far back",R.mode=30;break}R.mode=25;case 25:if(Z===0)break e;if(te=ne-Z,R.offset>te){if((te=R.offset-te)>R.whave&&R.sane){N.msg="invalid distance too far back",R.mode=30;break}ce=te>R.wnext?(te-=R.wnext,R.wsize-te):R.wnext-te,te>R.length&&(te=R.length),pe=R.window}else pe=O,ce=k-R.offset,te=R.length;for(ZC?(D=ce[pe+E[z]],J[de+E[z]]):(D=96,0),A=1<>k)+(_-=A)]=I<<24|D<<16|G|0,_!==0;);for(A=1<>=1;if(A!==0?(U&=A-1,U+=A):U=0,z++,--ne[N]==0){if(N===H)break;N=d[g+E[z]]}if(O>>7)]}function de(Q,K){Q.pending_buf[Q.pending++]=255&K,Q.pending_buf[Q.pending++]=K>>>8&255}function ne(Q,K,le){Q.bi_valid>x-le?(Q.bi_buf|=K<>x-Q.bi_valid,Q.bi_valid+=le-x):(Q.bi_buf|=K<>>=1,le<<=1,0<--K;);return le>>>1}function pe(Q,K,le){var oe,ae,he=new Array(E+1),me=0;for(oe=1;oe<=E;oe++)he[oe]=me=me+le[oe-1]<<1;for(ae=0;ae<=K;ae++){var ye=Q[2*ae+1];ye!==0&&(Q[2*ae]=ce(he[ye]++,ye))}}function ue(Q){var K;for(K=0;K>1;1<=le;le--)Se(Q,he,le);for(ae=fe;le=Q.heap[1],Q.heap[1]=Q.heap[Q.heap_len--],Se(Q,he,1),oe=Q.heap[1],Q.heap[--Q.heap_max]=le,Q.heap[--Q.heap_max]=oe,he[2*ae]=he[2*le]+he[2*oe],Q.depth[ae]=(Q.depth[le]>=Q.depth[oe]?Q.depth[le]:Q.depth[oe])+1,he[2*le+1]=he[2*oe+1]=ae,Q.heap[1]=ae++,Se(Q,he,1),2<=Q.heap_len;);Q.heap[--Q.heap_max]=Q.heap[1],function(ge,we){var Ce,Te,Me,Pe,Re,Le,Be=we.dyn_tree,We=we.max_code,bt=we.stat_desc.static_tree,Et=we.stat_desc.has_stree,Ye=we.stat_desc.extra_bits,at=we.stat_desc.extra_base,$e=we.stat_desc.max_length,tt=0;for(Pe=0;Pe<=E;Pe++)ge.bl_count[Pe]=0;for(Be[2*ge.heap[ge.heap_max]+1]=0,Ce=ge.heap_max+1;Ce>=7;ae>>=1)if(1&xe&&ye.dyn_ltree[2*fe]!==0)return a;if(ye.dyn_ltree[18]!==0||ye.dyn_ltree[20]!==0||ye.dyn_ltree[26]!==0)return l;for(fe=32;fe>>3,(he=Q.static_len+3+7>>>3)<=ae&&(ae=he)):ae=he=le+5,le+4<=ae&&K!==-1?W(Q,K,le,oe):Q.strategy===4||he===ae?(ne(Q,2+(oe?1:0),3),q(Q,$,N)):(ne(Q,4+(oe?1:0),3),function(ye,fe,xe,ge){var we;for(ne(ye,fe-257,5),ne(ye,xe-1,5),ne(ye,ge-4,4),we=0;we>>8&255,Q.pending_buf[Q.d_buf+2*Q.last_lit+1]=255&K,Q.pending_buf[Q.l_buf+Q.last_lit]=255&le,Q.last_lit++,K===0?Q.dyn_ltree[2*le]++:(Q.matches++,K--,Q.dyn_ltree[2*(R[le]+d+1)]++,Q.dyn_dtree[2*J(K)]++),Q.last_lit===Q.lit_bufsize-1},s._tr_align=function(Q){ne(Q,2,3),te(Q,_,$),function(K){K.bi_valid===16?(de(K,K.bi_buf),K.bi_buf=0,K.bi_valid=0):8<=K.bi_valid&&(K.pending_buf[K.pending++]=255&K.bi_buf,K.bi_buf>>=8,K.bi_valid-=8)}(Q)}},{"../utils/common":41}],53:[function(i,r,s){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(i,r,s){(function(o){(function(a,l){if(!a.setImmediate){var c,u,m,d,g=1,y={},b=!1,S=a.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(a);E=E&&E.setTimeout?E:a,c={}.toString.call(a.process)==="[object process]"?function(P){process.nextTick(function(){A(P)})}:function(){if(a.postMessage&&!a.importScripts){var P=!0,T=a.onmessage;return a.onmessage=function(){P=!1},a.postMessage("","*"),a.onmessage=T,P}}()?(d="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",_,!1):a.attachEvent("onmessage",_),function(P){a.postMessage(d+P,"*")}):a.MessageChannel?((m=new MessageChannel).port1.onmessage=function(P){A(P.data)},function(P){m.port2.postMessage(P)}):S&&"onreadystatechange"in S.createElement("script")?(u=S.documentElement,function(P){var T=S.createElement("script");T.onreadystatechange=function(){A(P),T.onreadystatechange=null,u.removeChild(T),T=null},u.appendChild(T)}):function(P){setTimeout(A,0,P)},E.setImmediate=function(P){typeof P!="function"&&(P=new Function(""+P));for(var T=new Array(arguments.length-1),M=0;M"u"?o===void 0?this:o:self)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(jszip_min);class MXLHelper{static MXLtoIXmlElement(e){const i=new jszip_minExports;return i.loadAsync(e).then(o=>i.file("META-INF/container.xml").async("text"),o=>{throw o}).then(o=>{const c=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return i.file(c).async("text")},o=>{throw o}).then(o=>{const l=new DOMParser().parseFromString(o,"text/xml"),c=new IXmlElement(l.documentElement);return Promise.resolve(c)},o=>{throw o}).then(o=>o,o=>{throw new Error("extractSheetFromMxl: "+o.message)})}static MXLtoXMLstring(e){const i=new jszip_minExports;return i.loadAsync(e).then(r=>i.file("META-INF/container.xml").async("text"),r=>{throw loglevelExports.error(r),r}).then(r=>{const a=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return i.file(a).async("text")},r=>{throw r})}}class PlaybackNoteGenerator{calculate(e){const i=new MusicPartManagerIterator(e);for(;!i.EndReached;){const r=i.CurrentEnrolledTimestamp,s=i.CurrentAudibleVoiceEntries();for(const o of s)this.handleVoiceEntry(e,o,r);i.moveToNext()}}handleVoiceEntry(e,i,r){if(i.IsGrace)return;const s=i.ParentVoice;let o;e.PlaybackDataDict.containsKey(s)?o=e.PlaybackDataDict.getValue(s):(o=[],e.PlaybackDataDict.setValue(s,o));for(const a of i.PlaybackEntries)if(a.HasNotes){for(const c of a.Notes)c.setLength();const l=Fraction$1.plus(r,a.TimestampShift);PlaybackNoteGenerator.addEntrySorted(o,a,l)}}static addEntrySorted(e,i,r){if(e.length===0)e.push({enrolledTimestamp:r,playbackEntry:i});else for(let s=e.length-1;s>=0;s--){const o=e[s];if(r.RealValue>o.enrolledTimestamp.RealValue)if(s===e.length-1){e.push({enrolledTimestamp:r,playbackEntry:i});break}else{e.splice(s+1,0,{enrolledTimestamp:r,playbackEntry:i});break}}}}class ScreenViewingRegion{constructor(e,i,r,s){this.psi=new BoundingBox$1(void 0),this.displaySizeInPixel=e,this.RelativeDisplaySize=i,this.RelativeDisplayPosition=r,this.WidthInUnits=s}static createWithRelativeDefaults(e,i){return new ScreenViewingRegion(e,new SizeF2D(1,1),new PointF2D(0,0),i)}static createWithDefaults(){return new ScreenViewingRegion(new SizeF2D(1,1),new SizeF2D(1,1),new PointF2D(0,0),1)}get UpperLeftPositionInUnits(){return this.psi.AbsolutePosition}set UpperLeftPositionInUnits(e){this.psi.AbsolutePosition=e}get DisplaySizeInPixel(){return this.displaySizeInPixel}set DisplaySizeInPixel(e){this.displaySizeInPixel=e,this.regionSizeInPixel=new SizeF2D(this.displaySizeInPixel.width*this.relativeRegionSize.width,this.displaySizeInPixel.height*this.relativeRegionSize.height),this.recalculateDependentVariables()}get RelativeDisplaySize(){return this.relativeRegionSize}set RelativeDisplaySize(e){this.relativeRegionSize=e,this.regionSizeInPixel=new SizeF2D(this.displaySizeInPixel.width*this.relativeRegionSize.width,this.displaySizeInPixel.height*this.relativeRegionSize.height),this.recalculateDependentVariables()}get RegionSizeInPixel(){return this.regionSizeInPixel}get WidthInUnits(){return this.psi.BorderRight}set WidthInUnits(e){this.psi.BorderRight=e,this.recalculateDependentVariables()}get ViewRegionInUnits(){return new SizeF2D(this.psi.BorderRight,this.psi.BorderBottom)}isVisible(e,i){const r=this.psi.collisionDetection(e);return this.psi.liesInsideBorders(e),r}isInsideDisplayArea(e,i){return this.RelativeDisplayPosition.x<=e&&e<=this.RelativeDisplayPosition.x+this.RelativeDisplaySize.width&&this.RelativeDisplayPosition.y<=i&&i<=this.RelativeDisplayPosition.y+this.RelativeDisplaySize.height}transformToUnitCoordinates(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))}transformLengthXToUnitCoordinates(e){return e/this.horizontalUnitToPixelRatio}transformLengthYToUnitCoordinates(e){return e/this.verticalUnitToPixelRatio}recalculateDependentVariables(){const 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}}class AbstractZoomView{constructor(e){this.aspectRatio=1,this.zoomViews=[],this.mouseZoomMode=!1,this.autoScrollY=!0,this.displayInteractionManager=e,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}positionTouched(e,i){if(!this.convertToUnitsReady())return;const r=this.getPositionInUnits(e,i);this.unitPosTouched(r,e,i)}get TouchActive(){return this.displayInteractionManager.TouchActive}get TouchMoving(){return this.displayInteractionManager.TouchMoving}positionDoubleTouched(e,i){if(!this.convertToUnitsReady())return;const r=this.getPositionInUnits(e,i);this.unitPosDoubleTouched(r,e,i)}get UsesManuallyControlledZoomMode(){return this.usesManuallyControlledZoomMode}set UsesManuallyControlledZoomMode(e){this.usesManuallyControlledZoomMode=e}mouseDown(e,i,r=!1){if(!this.convertToUnitsReady())return;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;const s=this.getPositionInUnits(e,i);this.unitPosTouchDown(s,e,i),this.usesManuallyControlledZoomMode||(r?this.mouseZoomMode=!0:this.mouseZoomMode=!1)}mouseUp(e,i){const r=this.getPositionInUnits(e,i);this.unitPosTouchUp(r,e,i)}mouseMove(e,i,r,s){this.mouseZoomMode?(Math.abs(r-0)>1e-8&&(this.RangeX=Math.abs(this.lastRangeX/(1+r))),!this.lockRanges&&Math.abs(s-0)>1e-8&&(this.RangeY=Math.abs(this.lastRangeY/(1-s)))):(Math.abs(r-0)>1e-8&&(this.OffsetX=this.lastOffsetX-r*this.RangeX),Math.abs(s-0)>1e-8&&(this.OffsetY=this.lastOffsetY-s*this.RangeY));const o=this.getPositionInUnits(e,i);this.unitPosMove(o,e,i)}zoom(e){this.RangeX=Math.abs(this.lastRangeX/e)}addZoomView(e){this.zoomViews.push(e)}get OffsetX(){return this.offsetX}set OffsetX(e){this.offsetX=Math.min(this.offsetXMax,Math.max(this.offsetXMin,e));for(const i of this.zoomViews)i.viewportXChanged(this.offsetX,this.RangeX)}get OffsetY(){return this.offsetY}set OffsetY(e){this.offsetY=e,this.offsetY>this.offsetYMax?this.offsetY=this.offsetYMax:this.offsetY(t[t.SingleTouch=0]="SingleTouch",t[t.DoubleTouch=1]="DoubleTouch",t[t.TouchUp=2]="TouchUp",t[t.TouchDown=3]="TouchDown",t[t.Move=4]="Move",t))(InteractionType||{});class VoiceEntryInteractionListener{constructor(e){this.renderingManager=e}userDisplayInteraction(e,i,r){var s,o;switch(r){case InteractionType.TouchDown:case InteractionType.SingleTouch:case InteractionType.DoubleTouch:{const a=this.renderingManager.GraphicalMusicSheet.GetNearestVoiceEntry(i);a&&a.parentStaffEntry.parentVerticalContainer!==void 0&&((s=a.notes[0])==null?void 0:s.sourceNote.Pitch)!==void 0&&((o=this.renderingManager.PlaybackManager)==null||o.playVoiceEntry(a.parentVoiceEntry));break}}}}class SheetRenderingManager extends AbstractZoomView{constructor(e,i){super(e),this.mainViewingRegion=ScreenViewingRegion.createWithDefaults(),this.tryAgainToRenderCount=0,this.yOffsetMouseDown=Number.MIN_VALUE,this.unlockCursorDistancePixel=50,this.relativeTopPosition=.06,this.internalPreviewImageScale=3,this.listeners=[],this.LockDisplayToCursor=!0,this.ZoomActive=!1,this.rules=i,this.addZoomView(this),this.lockRanges=!0,this.TopBarHeightInPixel=70,this.BottomBarHeightInPixel=0,this.rules.UseDefaultVoiceInteractionListener&&this.listeners.push(new VoiceEntryInteractionListener(this))}addListener(e){this.listeners.push(e)}get Listeners(){return this.listeners}convertToUnitsReady(){return this.graphicalMusicSheet!==void 0}unitPosTouched(e,i,r){if(!this.SingleTouchDisabled){const s=new PointF2D(i,r);this.handleUserDisplayInteraction(s,e,InteractionType.SingleTouch)}}unitPosDoubleTouched(e,i,r){if(!this.DoubleTouchDisabled){const s=new PointF2D(i,r);this.handleUserDisplayInteraction(s,e,InteractionType.DoubleTouch)}}unitPosTouchDown(e,i,r){const s=new PointF2D(i,r);this.handleUserDisplayInteraction(s,e,InteractionType.TouchDown),this.yOffsetMouseDown=e.y}unitPosTouchUp(e,i,r){const s=new PointF2D(i,r);this.handleUserDisplayInteraction(s,e,InteractionType.TouchUp),this.displayInteractionManager.WasZoomGestureActive===!1&&this.unlockFromCursorIfNecessary(e),this.yOffsetMouseDown=Number.MIN_VALUE}unitPosMove(e,i,r){const s=new PointF2D(i,r);this.handleUserDisplayInteraction(s,e,InteractionType.Move),this.unlockFromCursorIfNecessary(e)}get MainViewingRegion(){return this.mainViewingRegion}setMusicSheet(e){this.graphicalMusicSheet=e,this.adaptDisplayLimitsToSheet(),this.setYOffset(0,!0)}viewportXChanged(e,i){this.graphicalMusicSheet!==void 0&&this.horizontalViewportChanged(e,i)}viewportYChanged(e,i){this.graphicalMusicSheet!==void 0&&(this.yOffsetMouseDown<=Number.MIN_VALUE+.5&&(this.yOffsetMouseDown=e),this.verticalViewportChanged(e,i))}displaySizeChanged(e,i){super.viewSizeChanged(e,i),!(Math.abs(e-0)<1e-7||Math.abs(i-0)<1e-7)&&(this.graphicalMusicSheet!==void 0&&this.graphicalMusicSheet.EnforceRedrawOfMusicSystems(),this.mainViewingRegion.DisplaySizeInPixel=new SizeF2D(e,i),this.adaptDisplayLimitsToSheet())}calcDisplayYPosition(e){return e.PositionAndShape.AbsolutePosition.y+e.PositionAndShape.BorderMarginTop-this.topBarHeightInUnits()-this.relativeTopPosition*this.heightWithoutTopBottomBarsInUnits()}yPositionForLastSystem(e){return e.PositionAndShape.AbsolutePosition.y+e.PositionAndShape.BorderMarginBottom-this.topBarHeightInUnits()-(1-this.relativeTopPosition)*this.heightWithoutTopBottomBarsInUnits()}scorePositionChanged(e,i,r,s,o,a){const l=this.calcDisplayYPosition(s);this.setYPosition(l,a)}setXPosition(e,i){this.LockDisplayToCursor&&this.setXOffset(e,i)}setYPosition(e,i){this.LockDisplayToCursor&&this.setYOffset(e,i)}get DrawingParameters(){return this.musicSheetDrawer.drawingParameters}topBarHeightInUnits(){return this.mainViewingRegion.transformLengthYToUnitCoordinates(this.TopBarHeightInPixel)}bottomBarHeightInUnits(){return this.mainViewingRegion.transformLengthYToUnitCoordinates(this.BottomBarHeightInPixel)}heightWithoutTopBottomBarsInUnits(){return this.mainViewingRegion.ViewRegionInUnits.height-this.topBarHeightInUnits()-this.bottomBarHeightInUnits()}activePositionToBottomBarHeight(){return(this.mainViewingRegion.ViewRegionInUnits.height-this.topBarHeightInUnits()-this.bottomBarHeightInUnits())*(1-2*this.relativeTopPosition)}getClickPosition(e,i){return this.mainViewingRegion.transformToUnitCoordinates(new PointF2D(e,i))}graphicalObjectIsVisible(e){return this.mainViewingRegion.isVisible(e,!1)}adaptDisplayLimitsToSheet(){if(this.graphicalMusicSheet===void 0||this.graphicalMusicSheet.MusicPages.length===0||this.graphicalMusicSheet.MusicPages[0].MusicSystems.length===0)return;this.offsetXMin=0,this.rangeXMin=this.graphicalMusicSheet.MinAllowedSystemWidth,this.rangeXMax=300,this.offsetYMin=-.3*this.RangeY;const e=this.graphicalMusicSheet.MusicPages.last().PositionAndShape;this.offsetYMax=Math.max(0,e.BorderMarginBottom-.7*this.RangeY),this.OffsetY>this.offsetYMax&&this.setYOffset(this.offsetYMax,!0)}horizontalViewportChanged(e,i){this.mainViewingRegion.WidthInUnits!==i&&(this.mainViewingRegion.WidthInUnits=i)}verticalViewportChanged(e,i){this.mainViewingRegion.UpperLeftPositionInUnits=new PointF2D(this.mainViewingRegion.UpperLeftPositionInUnits.x,e)}unlockFromCursorIfNecessary(e){if(this.LockDisplayToCursor===!1||this.ZoomActive||this.displayInteractionManager.ZoomGestureActive||this.displayInteractionManager.WasZoomGestureActive)return;Math.abs((e.y-this.yOffsetMouseDown)*this.mainViewingRegion.RegionSizeInPixel.height/this.mainViewingRegion.ViewRegionInUnits.height)>this.unlockCursorDistancePixel&&(this.LockDisplayToCursor=!1)}getPositionInUnits(e,i){return this.mainViewingRegion.transformToUnitCoordinates(new PointF2D(e,i))}handleUserDisplayInteraction(e,i,r){switch(r){case InteractionType.TouchDown:case InteractionType.SingleTouch:case InteractionType.DoubleTouch:{const s=this.graphicalMusicSheet.GetNearestVoiceEntry(i);if(s){const o=new CustomEvent("note-click",{detail:{...s,setAvtivePlay:()=>{var a,l;if(s.parentStaffEntry.parentVerticalContainer!==void 0){const c=s.parentStaffEntry.parentVerticalContainer.AbsoluteTimestamp;this.setStartPosition(c),((a=s.notes[0])==null?void 0:a.sourceNote.Pitch)!==void 0&&(console.log("playback clicked note",s.parentVoiceEntry),(l=this.PlaybackManager)==null||l.playVoiceEntry(s.parentVoiceEntry))}}}});window.dispatchEvent(o)}}case InteractionType.TouchUp:case InteractionType.TouchDown:case InteractionType.Move:for(const s of this.listeners)s.userDisplayInteraction(e,i,r);break;default:throw new Error("type")}}setStartPosition(e){var i;this.graphicalMusicSheet!==void 0&&(this.graphicalMusicSheet.ParentMusicSheet.SelectionStart=e,(i=this.PlaybackManager)==null||i.reset())}get GraphicalMusicSheet(){return this.graphicalMusicSheet}}class WebSheetRenderingManager extends SheetRenderingManager{mouseMove(e,i,r,s){const o=this.getPositionInUnits(e,i);this.unitPosMove(o,e,i)}}class AbstractDisplayInteractionManager{constructor(){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}addListener(e){this.listeners.push(e)}get ZoomGestureActive(){return this.zoomGestureActive}get WasZoomGestureActive(){return this.interactionWasZoomGesture}displaySizeChanged(e,i){this.displayWidth=e,this.displayHeight=i;for(const r of this.listeners)r.displaySizeChanged(this.displayWidth,this.displayHeight)}Dispose(){this.dispose()}Initialize(){this.initialize()}get DisplayDpi(){return this.displayDpi}get TouchActive(){return this.touchActive}get TouchMoving(){return this.touchMoving}touchDown(e,i,r){this.interactionWasZoomGesture=!1;const s=e/this.displayWidth,o=i/this.displayHeight;this.lastRelPosX=s,this.lastRelPosY=o,this.lastPixelX=e,this.lastPixelY=i,this.touchActive=!0,this.touchMoving=!1,this.touchCount=Math.min(this.touchCount+1,this.maxNumerOfFingers);for(const a of this.listeners)a.mouseDown(s,o,!r)}move(e,i){if(this.touchActive&&!this.zoomGestureActive){const r=e/this.displayWidth,s=i/this.displayHeight,o=r-this.lastRelPosX,a=s-this.lastRelPosY;this.touchMoving=!0;for(const l of this.listeners)l.mouseMove(r,s,o,a)}}zoomGestureStarted(){this.zoomGestureActive=!0}zoomGestureCompleted(){this.zoomGestureActive=!1,this.interactionWasZoomGesture=!0}zoomGestureMove(e){this.zoomGestureActive&&this.listeners.forEach(function(i){i.zoom(e)})}touchUp(e,i){this.touchActive=!1,this.touchMoving=!1,this.touchCount=Math.max(0,this.touchCount-1);const r=e/this.displayWidth,s=i/this.displayHeight;for(const o of this.listeners)o.mouseUp(r,s)}click(e,i){if(!this.mouseDidMove(this.lastPixelX,e,this.lastPixelY,i)&&!this.ZoomGestureActive){const r=e/this.displayWidth,s=i/this.displayHeight;for(const o of this.listeners)o.positionTouched(r,s)}}doubleClick(e,i){if(!this.mouseDidMove(this.lastPixelX,e,this.lastPixelY,i)&&!this.ZoomGestureActive){const r=e/this.displayWidth,s=i/this.displayHeight;for(const o of this.listeners)o.positionDoubleTouched(r,s)}}mouseDidMove(e,i,r,s){const o=Math.abs(e-i)/this.displayDpi,a=Math.abs(r-s)/this.displayDpi;return o>this.movementThreshInch||a>this.movementThreshInch}}class WebDisplayInteractionManager extends AbstractDisplayInteractionManager{constructor(e){super(),this.fullOffsetLeft=0,this.fullOffsetTop=0,this.fullScrollTop=0,this.fullScrollLeft=0,this.parentScrollMap=new Map,this.scrollCallbackMap=new Map,this.timeout=void 0,this.resizeObserver=void 0,this.EventCallbackMap=new Dictionary,this.DOUBLE_CLICK_WINDOW=200,this.lastClick=0,this.osmdSheetMusicContainer=e,this.listenForInteractions()}get FullOffsetTop(){return this.fullOffsetTop}get FullScrollTop(){return this.fullScrollTop}get FullOffsetLeft(){return this.fullOffsetLeft}get FullScrollLeft(){return this.fullScrollLeft}static resizeCallback(e,i){clearTimeout(i.timeout),i.timeout=setTimeout(()=>{i.fullOffsetLeft=0,i.fullOffsetTop=0;let r=i.osmdSheetMusicContainer;for(;r;)i.fullOffsetLeft+=r.offsetLeft,i.fullOffsetTop+=r.offsetTop,r=r.offsetParent;i.resizeEventListener(),i.deregisterScrollOffsets(),i.registerScrollOffsets()},500)}registerScrollOffsets(){let e=this.osmdSheetMusicContainer;this.fullScrollTop=0,this.fullScrollLeft=0;const i=this;for(;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){const r=function(s){const o=i.parentScrollMap.get(this),a=o[0],l=o[1];i.fullScrollTop=i.fullScrollTop-a+this.scrollTop,i.fullScrollLeft=i.fullScrollLeft-l+this.scrollLeft,i.parentScrollMap.set(this,[this.scrollTop,this.scrollLeft])};this.scrollCallbackMap.set(e,r),e.addEventListener("scroll",r)}e=e.parentElement}}deregisterScrollOffsets(){for(const e of this.scrollCallbackMap.keys())e.removeEventListener("scroll",this.scrollCallbackMap.get(e));this.scrollCallbackMap.clear()}initialize(){this.fullOffsetLeft=0,this.fullOffsetTop=0;let e=this.osmdSheetMusicContainer;const i=[],r=this;for(window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(s=>{WebDisplayInteractionManager.resizeCallback(s,r)}));e;)this.fullOffsetLeft+=e.offsetLeft,this.fullOffsetTop+=e.offsetTop,this.resizeObserver?this.resizeObserver.observe(e):i.push(e),e=e.offsetParent;if(this.resizeObserver)this.disposeResizeListener=()=>{r.resizeObserver.disconnect(),r.resizeObserver=void 0};else{let s=()=>{WebDisplayInteractionManager.resizeCallback(i,r)};window.addEventListener("resize",s),this.disposeResizeListener=()=>{window.removeEventListener("resize",s),s=void 0}}r.registerScrollOffsets()}dispose(){this.disposeResizeListener();for(const e of this.EventCallbackMap.keys()){const i=this.EventCallbackMap.getValue(e);i[0].removeEventListener(e,i[1])}this.EventCallbackMap.clear(),this.deregisterScrollOffsets(),this.scrollCallbackMap.clear(),this.parentScrollMap.clear()}isTouch(){if("ontouchstart"in window||window.DocumentTouch)return!0;if(!window.matchMedia)return!1;const i=["(",["-webkit-","-moz-","-o-","-ms-"].join("touch-enabled),("),"heartz",")"].join("");return window.matchMedia(i).matches}get downEventName(){return this.isTouch()?"touchstart":"mousedown"}get moveEventName(){return this.isTouch()?"touchmove":"mousemove"}listenForInteractions(){const e=this.downEventListener.bind(this),i=this.touchEndEventListener.bind(this),r=this.moveEventListener.bind(this);this.osmdSheetMusicContainer.addEventListener("mousedown",e),this.osmdSheetMusicContainer.addEventListener("touchend",i),document.addEventListener(this.moveEventName,r),this.EventCallbackMap.setValue("mousedown",[this.osmdSheetMusicContainer,e]),this.EventCallbackMap.setValue("touchend",[this.osmdSheetMusicContainer,i]),this.EventCallbackMap.setValue(this.moveEventName,[document,r])}downEventListener(e){const i=new Date().getTime(),r=i-this.lastClick;clearTimeout(this.clickTimeout);let s=0,o=0;this.isTouch()&&e instanceof TouchEvent?(s=e.touches[0].pageX,o=e.touches[0].pageY):e instanceof MouseEvent&&(s=e.pageX,o=e.pageY);const a=this.getOffsetCoordinates(s,o);if(r0)this.doubleClick(a.x,a.y);else{const l=this;this.clickTimeout=setTimeout(function(){clearTimeout(this.clickTimeout),l.isTouch()?l.touchDown(a.x,a.y,void 0):l.click(a.x,a.y)},this.DOUBLE_CLICK_WINDOW)}this.lastClick=i}moveEventListener(e){let i=0,r=0;if(this.isTouch()&&e instanceof TouchEvent){let o;e.touches&&e.touches.length>0?o=e.touches[0]:e.changedTouches&&e.changedTouches.length>0&&(o=e.changedTouches[0]),i=o==null?void 0:o.clientX,r=o==null?void 0:o.clientY}else e instanceof MouseEvent&&(i=e.clientX,r=e.clientY);const s=this.getOffsetCoordinates(i,r);this.move(s.x,s.y)}touchEndEventListener(e){let i;e.touches&&e.touches.length>0?i=e.touches[0]:e.changedTouches&&e.changedTouches.length>0&&(i=e.changedTouches[0]);const r=this.getOffsetCoordinates(i==null?void 0:i.pageX,i==null?void 0:i.pageY);this.touchUp(r.x,r.y)}resizeEventListener(){this.displaySizeChanged(this.osmdSheetMusicContainer.clientWidth,this.osmdSheetMusicContainer.clientHeight)}getOffsetCoordinates(e,i){const r=e-this.fullOffsetLeft+this.fullScrollLeft,s=i-this.fullOffsetTop+this.fullScrollTop;return new PointF2D(r,s)}}class DynamicsCalculator{static fillDynamicsList(e,i,r){for(let s=0;s=0&&r[c].push(new DynamicsContainer(l.InstantaneousDynamic,c))}if(l.StartingContinuousDynamic!==void 0){r[s].push(new DynamicsContainer(l.StartingContinuousDynamic,l.StaffNumber));const c=this.getOtherStaffIndexIfLinkedStavesAreDetected(e,s,l.StartingContinuousDynamic.Placement);c>=0&&r[c].push(new DynamicsContainer(l.StartingContinuousDynamic,c))}}}}static getOtherStaffIndexIfLinkedStavesAreDetected(e,i,r){const s=e.getStaffFromIndex(i),o=s.ParentInstrument.Staves.indexOf(s),a=s.ParentInstrument.Staves.length;return a>1&&o===0&&r===PlacementEnum.Below?i+1:a>1&&o===1&&r===PlacementEnum.Above?i-1:-1}static fillDynamicExpressions(e){const i=e.DynListStaves,r=e.getCompleteNumberOfStaves(),s=e.TimestampSortedDynamicExpressionsList;for(let o=0;o{e(this.processStringXml(r))},r=>{loglevelExports.error(new Error("[OSMD] Invalid MXL file: "+r)),i(new Error("[OSMD] Invalid MXL file: "+r))})}processStringXml(t){const e=new DOMParser;if(t.substr(0,3)==="")return loglevelExports.debug("[OSMD] UTF with BOM detected, truncate first three bytes and pass along: "+t),e.parseFromString(t.substr(3),"application/xml");if(t.substr(0,6).includes("{i.isMxl(d)?i.processMxl(d,l,c):l(i.processStringXml(d))},d=>{throw c(d),d});else{const d=new Error("[OSMD] osmd.load(string): Could not process string. Did not find {e.init(this.sheet.MusicPartManager,this.graphic)}),this.renderingManager.setMusicSheet(this.graphic),this.interactionManager.Initialize()}render(){var e;if(!this.graphic)throw new Error("OpenSheetMusicDisplay: Before rendering a music sheet, please load a MusicXML file");(e=this.drawer)==null||e.clear();let t=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(t=this.rules.SheetMaximumWidth),this.sheet.pageWidth=t/this.zoom/10,this.renderingManager.MainViewingRegion.WidthInUnits=this.sheet.pageWidth,this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?(this.rules.PageHeight=this.sheet.pageWidth/this.rules.PageFormat.aspectRatio,loglevelExports.debug("[OSMD] PageHeight: "+this.rules.PageHeight)):(loglevelExports.debug("[OSMD] endless/undefined pageformat, id: "+this.rules.PageFormat.idString),this.rules.PageHeight=100001),this.graphic.reCalculate(),this.drawingParameters.drawCursors&&(this.graphic.Cursors.length=0),this.createOrRefreshRenderBackend(),this.needBackendUpdate=!1,this.drawer.setZoom(this.zoom),this.drawer.drawSheet(this.graphic),this.enableOrDisableCursors(this.drawingParameters.drawCursors),this.drawingParameters.drawCursors&&this.cursors.forEach(i=>{i.update()}),this.zoomUpdated=!1,this.interactionManager.displaySizeChanged(this.container.clientWidth,this.container.clientHeight)}createOrRefreshRenderBackend(){this.drawer&&this.drawer.Backends&&(this.drawer.Backends[0]&&this.drawer.Backends[0].removeAllChildrenFromContainer(this.container),this.drawer.Backends.clear()),this.drawingParameters.Rules=this.rules,this.drawer=new VexFlowMusicSheetDrawer(this.drawingParameters),this.drawer.drawableBoundingBoxElement=this.DrawBoundingBox,this.drawer.bottomLineVisible=this.drawBottomLine,this.drawer.skyLineVisible=this.drawSkyLine;let t=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(t=this.graphic.MusicPages[0].PositionAndShape.Size.width*10*this.zoom);let e;const i=32767;for(const r of this.graphic.MusicPages){if(r.PageNumber>this.rules.MaxPageToDrawNumber)break;const s=this.createBackend(this.backendType,r),o=" exceeds CanvasBackend limit of 32767. Cutting off score.";s.getOSMDBackendType()===BackendType.Canvas&&t>i&&(loglevelExports.warn("[OSMD] Warning: width of "+t+o),t=i),this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?e=t/this.rules.PageFormat.aspectRatio:(e=r.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*=this.zoom*10),s.getOSMDBackendType()===BackendType.Canvas&&e>i&&(loglevelExports.warn("[OSMD] Warning: height of "+e+o),e=Math.min(e,i)),s.resize(t,e),s.clear(),this.drawer.Backends.push(s),this.graphic.drawer=this.drawer}}exportSVG(){var t;for(const e of(t=this.drawer)==null?void 0:t.Backends)e instanceof SvgVexFlowBackend&&e.export()}IsReadyToRender(){return this.graphic!==void 0}clear(){var t;(t=this.drawer)==null||t.clear(),this.reset()}dispose(){this.disposeResizeListener&&this.disposeResizeListener(),this.InteractionManager&&this.InteractionManager.Dispose()}setOptions(t){if(this.rules||(this.rules=new EngravingRules),this.drawingParameters||(this.drawingParameters=new DrawingParameters,this.drawingParameters.Rules=this.rules),t==null){loglevelExports.warn(`warning: osmd.setOptions() called without an options parameter, has no effect. example usage: osmd.setOptions({drawCredits: false, drawPartNames: false})`);return}this.OnXMLRead=function(s){return s},t.onXMLRead&&(this.OnXMLRead=t.onXMLRead),t.drawingParameters&&(this.drawingParameters.DrawingParametersEnum=DrawingParametersEnum[t.drawingParameters.toLowerCase()]);let i=!this.drawer||!this.drawer.Backends||this.drawer.Backends.length<1;if(t.backend!==void 0){const s=OSMDOptions.BackendTypeFromString(t.backend);i=i||this.backendType!==s,this.backendType=s}this.needBackendUpdate=i,t.autoBeam!==void 0&&(this.rules.AutoBeamNotes=t.autoBeam);const r=t.autoBeamOptions;if(r&&(r.maintain_stem_directions===void 0&&(r.maintain_stem_directions=!1),this.rules.AutoBeamOptions=r,r.groups&&r.groups.length)){for(const s of r.groups)if(s.length!==2)throw new Error("Each fraction in autoBeamOptions.groups must be of length 2, e.g. [3,4] for beaming three fourths")}t.percussionOneLineCutoff!==void 0&&(this.rules.PercussionOneLineCutoff=t.percussionOneLineCutoff),this.rules.PercussionOneLineCutoff!==0&&t.percussionForceVoicesOneLineCutoff!==void 0&&(this.rules.PercussionForceVoicesOneLineCutoff=t.percussionForceVoicesOneLineCutoff),t.alignRests!==void 0&&(this.rules.AlignRests=t.alignRests),t.coloringMode!==void 0&&this.setColoringMode(t),t.coloringEnabled!==void 0&&(this.rules.ColoringEnabled=t.coloringEnabled),t.colorStemsLikeNoteheads!==void 0&&(this.rules.ColorStemsLikeNoteheads=t.colorStemsLikeNoteheads),t.disableCursor&&(this.drawingParameters.drawCursors=!1),t.drawHiddenNotes&&(this.drawingParameters.drawHiddenNotes=!0),t.drawCredits!==void 0&&(this.drawingParameters.DrawCredits=t.drawCredits),t.drawComposer!==void 0&&(this.drawingParameters.DrawComposer=t.drawComposer),t.drawTitle!==void 0&&(this.drawingParameters.DrawTitle=t.drawTitle),t.drawSubtitle!==void 0&&(this.drawingParameters.DrawSubtitle=t.drawSubtitle),t.drawLyricist!==void 0&&(this.drawingParameters.DrawLyricist=t.drawLyricist),t.drawMetronomeMarks!==void 0&&(this.rules.MetronomeMarksDrawn=t.drawMetronomeMarks),t.drawPartNames!==void 0&&(this.drawingParameters.DrawPartNames=t.drawPartNames,t.drawPartAbbreviations||(this.rules.RenderPartAbbreviations=t.drawPartNames)),t.drawPartAbbreviations!==void 0&&(this.rules.RenderPartAbbreviations=t.drawPartAbbreviations),t.drawFingerings===!1&&(this.rules.RenderFingerings=!1),t.drawMeasureNumbers!==void 0&&(this.rules.RenderMeasureNumbers=t.drawMeasureNumbers),t.drawMeasureNumbersOnlyAtSystemStart&&(this.rules.RenderMeasureNumbersOnlyAtSystemStart=t.drawMeasureNumbersOnlyAtSystemStart),t.drawLyrics!==void 0&&(this.rules.RenderLyrics=t.drawLyrics),t.drawTimeSignatures!==void 0&&(this.rules.RenderTimeSignatures=t.drawTimeSignatures),t.drawSlurs!==void 0&&(this.rules.RenderSlurs=t.drawSlurs),t.measureNumberInterval!==void 0&&(this.rules.MeasureNumberLabelOffset=t.measureNumberInterval),t.useXMLMeasureNumbers!==void 0&&(this.rules.UseXMLMeasureNumbers=t.useXMLMeasureNumbers),t.fingeringPosition!==void 0&&(this.rules.FingeringPosition=AbstractExpression.PlacementEnumFromString(t.fingeringPosition)),t.fingeringInsideStafflines!==void 0&&(this.rules.FingeringInsideStafflines=t.fingeringInsideStafflines),t.newSystemFromXML!==void 0&&(this.rules.NewSystemAtXMLNewSystemAttribute=t.newSystemFromXML),t.newPageFromXML!==void 0&&(this.rules.NewPageAtXMLNewPageAttribute=t.newPageFromXML),t.fillEmptyMeasuresWithWholeRest!==void 0&&(this.rules.FillEmptyMeasuresWithWholeRest=t.fillEmptyMeasuresWithWholeRest),t.followCursor!==void 0&&(this.FollowCursor=t.followCursor),t.setWantedStemDirectionByXml!==void 0&&(this.rules.SetWantedStemDirectionByXml=t.setWantedStemDirectionByXml),t.darkMode?(this.rules.applyDefaultColorMusic("#FFFFFF"),this.rules.PageBackgroundColor="#000000"):t.darkMode===!1&&(this.rules.applyDefaultColorMusic("#000000"),this.rules.PageBackgroundColor=void 0),t.defaultColorMusic&&this.rules.applyDefaultColorMusic(t.defaultColorMusic),t.defaultColorNotehead&&(this.rules.DefaultColorNotehead=t.defaultColorNotehead),t.defaultColorRest&&(this.rules.DefaultColorRest=t.defaultColorRest),t.defaultColorStem&&(this.rules.DefaultColorStem=t.defaultColorStem),t.defaultColorLabel&&(this.rules.DefaultColorLabel=t.defaultColorLabel),t.defaultColorTitle&&(this.rules.DefaultColorTitle=t.defaultColorTitle),t.defaultFontFamily&&(this.rules.DefaultFontFamily=t.defaultFontFamily),t.defaultFontStyle&&(this.rules.DefaultFontStyle=t.defaultFontStyle),t.drawUpToMeasureNumber&&(this.rules.MaxMeasureToDrawIndex=t.drawUpToMeasureNumber-1),t.drawFromMeasureNumber&&(this.rules.MinMeasureToDrawIndex=t.drawFromMeasureNumber-1),t.drawUpToPageNumber&&(this.rules.MaxPageToDrawNumber=t.drawUpToPageNumber),t.drawUpToSystemNumber&&(this.rules.MaxSystemToDrawNumber=t.drawUpToSystemNumber),t.tupletsRatioed&&(this.rules.TupletsRatioed=!0),t.tupletsBracketed&&(this.rules.TupletsBracketed=!0),t.tripletsBracketed&&(this.rules.TripletsBracketed=!0),t.autoResize?(this.resizeHandlerAttached||this.autoResize(),this.autoResizeEnabled=!0):t.autoResize===!1&&(this.autoResizeEnabled=!1),t.pageFormat!==void 0&&this.setPageFormat(t.pageFormat),t.pageBackgroundColor!==void 0&&(this.rules.PageBackgroundColor=t.pageBackgroundColor),t.performanceMode!==void 0&&(this.rules.PerformanceMode=t.performanceMode),t.renderSingleHorizontalStaffline!==void 0&&(this.rules.RenderSingleHorizontalStaffline=t.renderSingleHorizontalStaffline),t.spacingFactorSoftmax!==void 0&&(this.rules.SoftmaxFactorVexFlow=t.spacingFactorSoftmax),t.spacingBetweenTextLines!==void 0&&(this.rules.SpacingBetweenTextLines=t.spacingBetweenTextLines),t.stretchLastSystemLine!==void 0&&(this.rules.StretchLastSystemLine=t.stretchLastSystemLine),t.autoGenerateMutipleRestMeasuresFromRestMeasures!==void 0&&(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures=t.autoGenerateMutipleRestMeasuresFromRestMeasures),t.cursorsOptions!==void 0?this.cursorsOptions=t.cursorsOptions:this.cursorsOptions=[{type:0,color:this.EngravingRules.DefaultColorCursor,alpha:.5,follow:!0}]}setColoringMode(t){if(t.coloringMode===ColoringModes.XML){this.rules.ColoringMode=ColoringModes.XML;return}const e=[NoteEnum.C,NoteEnum.D,NoteEnum.E,NoteEnum.F,NoteEnum.G,NoteEnum.A,NoteEnum.B,-1];let i;if(t.coloringMode===ColoringModes.CustomColorSet){if(!t.coloringSetCustom||t.coloringSetCustom.length!==8)throw new Error("Invalid amount of colors: With coloringModes.customColorSet, you have to provide a coloringSetCustom parameter with 8 strings (C to B, rest note).");for(const s of t.coloringSetCustom)if(!/^\#[0-9a-fA-F]{6}$/.test(s))throw new Error(`One of the color strings in options.coloringSetCustom was not a valid HTML Hex color: `+s);i=t.coloringSetCustom}else if(t.coloringMode===ColoringModes.AutoColoring){i=[];const s=Object.keys(AutoColorSet);for(let o=0;o{t.hide()}),this.sheet=void 0,this.graphic=void 0,this.zoom=1}autoResize(){const t=this;this.handleResize(()=>{},()=>{var e;((e=this.graphic)==null?void 0:e.GetCalculator)instanceof VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=!0),t.IsReadyToRender()&&t.render()})}handleResize(t,e){let i,r;const o=this;function a(){o.AutoResizeEnabled&&(i=new Date().getTime(),r||(t(),i=new Date().getTime(),r=window.setTimeout(l,200)))}function l(){r=void 0,window.clearTimeout(r),new Date().getTime()-i<200?r=window.setTimeout(l,200):e()}window.attachEvent?window.attachEvent("onresize",a):window.addEventListener("resize",a),this.disposeResizeListener=()=>{window.detachEvent?window.detachEvent("onresize",a):window.removeEventListener("resize",a),this.resizeHandlerAttached=!1},this.resizeHandlerAttached=!0,window.setTimeout(t,0),window.setTimeout(e,1)}enableOrDisableCursors(t){var e,i,r,s,o,a;if(this.drawingParameters.drawCursors=t,t){for(let l=0;l{l.hide()})}createBackend(t,e){let i;return t===void 0||t===BackendType.SVG?i=new SvgVexFlowBackend(this.rules):i=new CanvasVexFlowBackend(this.rules),i.graphicalMusicPage=e,i.initialize(this.container,this.zoom),i.getContext().setFillStyle(this.rules.DefaultColorMusic),i.getContext().setStrokeStyle(this.rules.DefaultColorMusic),i}static StringToPageFormat(t){let e=PageFormat.UndefinedPageFormat;if(t.match("^[0-9]+x[0-9]+$")){const i=t.split("x"),r=Number.parseInt(i[0],10),s=Number.parseInt(i[1],10);r>0&&r<32768&&s>0&&s<32768&&(e=new PageFormat(r,s,`customPageFormat${t}`))}return t=t.replace(" ","_"),t=t.replace("Landscape","L"),t=t.replace("Portrait","P"),_OpenSheetMusicDisplay.PageFormatStandards.hasOwnProperty(t)&&(e=_OpenSheetMusicDisplay.PageFormatStandards[t]),e}setPageFormat(t){const e=_OpenSheetMusicDisplay.StringToPageFormat(t);this.needBackendUpdate=!e.Equals(this.rules.PageFormat),this.rules.PageFormat=e}setCustomPageFormat(t,e){if(t>0&&e>0){const i=new PageFormat(t,e);this.rules.PageFormat=i}}set DrawSkyLine(t){this.drawSkyLine=t,this.drawer&&(this.drawer.skyLineVisible=t)}get DrawSkyLine(){return this.drawer.skyLineVisible}set DrawBottomLine(t){this.drawBottomLine=t,this.drawer&&(this.drawer.bottomLineVisible=t)}get DrawBottomLine(){return this.drawer.bottomLineVisible}set DrawBoundingBox(t){this.setDrawBoundingBox(t,!0)}get DrawBoundingBox(){return this.drawBoundingBox}setDrawBoundingBox(t,e=!1){this.drawBoundingBox=t,this.drawer&&(this.drawer.drawableBoundingBoxElement=t),e&&this.render()}get AutoResizeEnabled(){return this.autoResizeEnabled}set AutoResizeEnabled(t){this.autoResizeEnabled=t}get Zoom(){return this.zoom}set Zoom(t){var e;this.zoom=t,this.zoomUpdated=!0,((e=this.graphic)==null?void 0:e.GetCalculator)instanceof VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=this.zoomUpdated)}set FollowCursor(t){this.followCursor=t}get FollowCursor(){return this.followCursor}set TransposeCalculator(t){MusicSheetCalculator.transposeCalculator=t}get TransposeCalculator(){return MusicSheetCalculator.transposeCalculator}get Sheet(){return this.sheet}get Drawer(){return this.drawer}get GraphicSheet(){return this.graphic}get DrawingParameters(){return this.drawingParameters}get EngravingRules(){return this.rules}get InteractionManager(){return this.interactionManager}get Version(){return this.version}};let 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(t){handlebarsExports=t}},handlebars_runtimeExports={},handlebars_runtime={get exports(){return handlebars_runtimeExports},set exports(t){handlebars_runtimeExports=t}},base$1={},utils={};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(t){return escape$1[t]}function extend(t){for(var e=1;e0?(o.ids&&(o.ids=[o.name]),r.helpers.each(s,o)):a(this);if(o.data&&o.ids){var c=i.createFrame(o.data);c.contextPath=i.appendContextPath(o.data.contextPath,o.name),o={data:c}}return l(s,o)})},t.exports=e.default})(blockHelperMissing,blockHelperMissingExports);var eachExports={},each={get exports(){return eachExports},set exports(t){eachExports=t}};(function(t,e){e.__esModule=!0;function i(a){return a&&a.__esModule?a:{default:a}}var r=utils,s=exceptionExports,o=i(s);e.default=function(a){a.registerHelper("each",function(l,c){if(!c)throw new o.default("Must pass iterator to #each");var u=c.fn,m=c.inverse,d=0,g="",y=void 0,b=void 0;c.data&&c.ids&&(b=r.appendContextPath(c.data.contextPath,c.ids[0])+"."),r.isFunction(l)&&(l=l.call(this)),c.data&&(y=r.createFrame(c.data));function S(P,T,M){y&&(y.key=P,y.index=T,y.first=T===0,y.last=!!M,b&&(y.contextPath=b+P)),g=g+u(l[P],{data:y,blockParams:r.blockParams([l[P],P],[b+P,null])})}if(l&&typeof l=="object")if(r.isArray(l))for(var E=l.length;d=0?o=a:o=parseInt(o,10)}return o},log:function(o){if(o=r.lookupLevel(o),typeof console<"u"&&r.lookupLevel(r.level)<=o){var a=r.methodMap[o];console[a]||(a="log");for(var l=arguments.length,c=Array(l>1?l-1:0),u=1;u= 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(t,e,i){this.helpers=t||{},this.partials=e||{},this.decorators=i||{},_helpers$2.registerDefaultHelpers(this),_decorators.registerDefaultDecorators(this)}HandlebarsEnvironment.prototype={constructor:HandlebarsEnvironment,logger:_logger2.default,log:_logger2.default.log,registerHelper:function t(e,i){if(_utils$3.toString.call(e)===objectType){if(i)throw new _exception2$3.default("Arg not supported with multiple helpers");_utils$3.extend(this.helpers,e)}else this.helpers[e]=i},unregisterHelper:function t(e){delete this.helpers[e]},registerPartial:function t(e,i){if(_utils$3.toString.call(e)===objectType)_utils$3.extend(this.partials,e);else{if(typeof i>"u")throw new _exception2$3.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=i}},unregisterPartial:function t(e){delete this.partials[e]},registerDecorator:function t(e,i){if(_utils$3.toString.call(e)===objectType){if(i)throw new _exception2$3.default("Arg not supported with multiple decorators");_utils$3.extend(this.decorators,e)}else this.decorators[e]=i},unregisterDecorator:function t(e){delete this.decorators[e]},resetLoggedPropertyAccesses:function t(){_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(t){safeStringExports=t}};(function(t,e){e.__esModule=!0;function i(r){this.string=r}i.prototype.toString=i.prototype.toHTML=function(){return""+this.string},e.default=i,t.exports=e.default})(safeString,safeStringExports);var runtime={},wrapHelper$1={};wrapHelper$1.__esModule=!0;wrapHelper$1.wrapHelper=wrapHelper;function wrapHelper(t,e){if(typeof t!="function")return t;var i=function(){var s=arguments[arguments.length-1];return arguments[arguments.length-1]=e(s),t.apply(this,arguments)};return i}runtime.__esModule=!0;runtime.checkRevision=checkRevision;runtime.template=template;runtime.wrapProgram=wrapProgram;runtime.resolvePartial=resolvePartial;runtime.invokePartial=invokePartial;runtime.noop=noop;function _interopRequireDefault$3(t){return t&&t.__esModule?t:{default:t}}function _interopRequireWildcard$1(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e}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(t){var e=t&&t[0]||1,i=_base.COMPILER_REVISION;if(!(e>=_base.LAST_COMPATIBLE_COMPILER_REVISION&&e<=_base.COMPILER_REVISION))if(e<_base.LAST_COMPATIBLE_COMPILER_REVISION){var r=_base.REVISION_CHANGES[i],s=_base.REVISION_CHANGES[e];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 ("+s+").")}else 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 ("+t[1]+").")}function template(t,e){if(!e)throw new _exception2$2.default("No environment passed to template");if(!t||!t.main)throw new _exception2$2.default("Unknown template object: "+typeof t);t.main.decorator=t.main_d,e.VM.checkRevision(t.compiler);var i=t.compiler&&t.compiler[0]===7;function r(a,l,c){c.hash&&(l=Utils.extend({},l,c.hash),c.ids&&(c.ids[0]=!0)),a=e.VM.resolvePartial.call(this,a,l,c);var u=Utils.extend({},c,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),m=e.VM.invokePartial.call(this,a,l,u);if(m==null&&e.compile&&(c.partials[c.name]=e.compile(a,t.compilerOptions,e),m=c.partials[c.name](l,u)),m!=null){if(c.indent){for(var d=m.split(` `),g=0,y=d.length;g"u"&&(this.lexer.yylloc={});var E=this.lexer.yylloc;d.push(E);var x=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);function A(){var z;return z=c.lexer.lex()||1,typeof z!="number"&&(z=c.symbols_[z]||z),z}for(var _,P,T,M,C={},I,D,G,$;;){if(P=u[u.length-1],this.defaultActions[P]?T=this.defaultActions[P]:((_===null||typeof _>"u")&&(_=A()),T=g[P]&&g[P][_]),typeof T>"u"||!T.length||!T[0]){var N="";{$=[];for(I in g[P])this.terminals_[I]&&I>2&&$.push("'"+this.terminals_[I]+"'");this.lexer.showPosition?N="Parse error on line "+(b+1)+`: `+this.lexer.showPosition()+` Expecting `+$.join(", ")+", got '"+(this.terminals_[_]||_)+"'":N="Parse error on line "+(b+1)+": Unexpected "+(_==1?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(N,{text:this.lexer.match,token:this.terminals_[_]||_,line:this.lexer.yylineno,loc:E,expected:$})}}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+_);switch(T[0]){case 1:u.push(_),m.push(this.lexer.yytext),d.push(this.lexer.yylloc),u.push(T[1]),_=null,S=this.lexer.yyleng,y=this.lexer.yytext,b=this.lexer.yylineno,E=this.lexer.yylloc;break;case 2:if(D=this.productions_[T[1]][1],C.$=m[m.length-D],C._$={first_line:d[d.length-(D||1)].first_line,last_line:d[d.length-1].last_line,first_column:d[d.length-(D||1)].first_column,last_column:d[d.length-1].last_column},x&&(C._$.range=[d[d.length-(D||1)].range[0],d[d.length-1].range[1]]),M=this.performAction.call(C,y,S,b,this.yy,T[1],m,d),typeof M<"u")return M;D&&(u=u.slice(0,-1*D*2),m=m.slice(0,-1*D),d=d.slice(0,-1*D)),u.push(this.productions_[T[1]][0]),m.push(C.$),d.push(C._$),G=g[u[u.length-2]][u[u.length-1]],u.push(G);break;case 3:return!0}}return!0}},s=function(){var a={EOF:1,parseError:function(c,u){if(this.yy.parser)this.yy.parser.parseError(c,u);else throw new Error(c)},setInput:function(c){return this._input=c,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 c=this._input[0];this.yytext+=c,this.yyleng++,this.offset++,this.match+=c,this.matched+=c;var u=c.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),c},unput:function(c){var u=c.length,m=c.split(/(?:\r\n?|\n)/g);this._input=c+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u-1),this.offset-=u;var d=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),m.length-1&&(this.yylineno-=m.length-1);var g=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:m?(m.length===d.length?this.yylloc.first_column:0)+d[d.length-m.length].length-m[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[g[0],g[0]+this.yyleng-u]),this},more:function(){return this._more=!0,this},less:function(c){this.unput(this.match.slice(c))},pastInput:function(){var c=this.matched.substr(0,this.matched.length-this.match.length);return(c.length>20?"...":"")+c.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var c=this.match;return c.length<20&&(c+=this._input.substr(0,20-c.length)),(c.substr(0,20)+(c.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var c=this.pastInput(),u=new Array(c.length+1).join("-");return c+this.upcomingInput()+` `+u+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var c,u,m,d,g;this._more||(this.yytext="",this.match="");for(var y=this._currentRules(),b=0;bu[0].length)&&(u=m,d=b,!this.options.flex)));b++);return u?(g=u[0].match(/(?:\r\n?|\n).*/g),g&&(this.yylineno+=g.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:g?g[g.length-1].length-g[g.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+u[0].length},this.yytext+=u[0],this.match+=u[0],this.matches=u,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(u[0].length),this.matched+=u[0],c=this.performAction.call(this,this.yy,this,y[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c||void 0):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var c=this.next();return typeof c<"u"?c:this.lex()},begin:function(c){this.conditionStack.push(c)},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(c){this.begin(c)}};return a.options={},a.performAction=function(c,u,m,d){function g(y,b){return u.yytext=u.yytext.substring(y,u.yyleng-b+y)}switch(m){case 0:if(u.yytext.slice(-2)==="\\\\"?(g(0,1),this.begin("mu")):u.yytext.slice(-1)==="\\"?(g(0,1),this.begin("emu")):this.begin("mu"),u.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),this.conditionStack[this.conditionStack.length-1]==="raw"?15:(g(5,9),"END_RAW_BLOCK");case 5:return 15;case 6: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:return this.popState(),44;case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(u.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return u.yytext=g(1,2).replace(/\\"/g,'"'),80;case 32:return u.yytext=g(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:return 82;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 41:return 72;case 42:return u.yytext=u.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},a.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\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],a.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}},a}();r.lexer=s;function o(){this.yy={}}return o.prototype=r,r.Parser=o,new o}();e.default=i,t.exports=e.default})(parser$1,parserExports);var whitespaceControlExports={},whitespaceControl={get exports(){return whitespaceControlExports},set exports(t){whitespaceControlExports=t}},visitorExports={},visitor={get exports(){return visitorExports},set exports(t){visitorExports=t}};(function(t,e){e.__esModule=!0;function i(u){return u&&u.__esModule?u:{default:u}}var r=exceptionExports,s=i(r);function o(){this.parents=[]}o.prototype={constructor:o,mutating:!1,acceptKey:function(m,d){var g=this.accept(m[d]);if(this.mutating){if(g&&!o.prototype[g.type])throw new s.default('Unexpected node type "'+g.type+'" found when accepting '+d+" on "+m.type);m[d]=g}},acceptRequired:function(m,d){if(this.acceptKey(m,d),!m[d])throw new s.default(m.type+" requires "+d)},acceptArray:function(m){for(var d=0,g=m.length;d0)throw new _exception2$1.default("Invalid path: "+r,{loc:i});c===".."&&o++}else s.push(c)}return{type:"PathExpression",data:t,depth:o,parts:s,original:r,loc:i}}function prepareMustache(t,e,i,r,s,o){var a=r.charAt(3)||r.charAt(2),l=a!=="{"&&a!=="&",c=/\*/.test(r);return{type:c?"Decorator":"MustacheStatement",path:t,params:e,hash:i,escaped:l,strip:s,loc:this.locInfo(o)}}function prepareRawBlock(t,e,i,r){validateClose(t,i),r=this.locInfo(r);var s={type:"Program",body:e,strip:{},loc:r};return{type:"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:s,openStrip:{},inverseStrip:{},closeStrip:{},loc:r}}function prepareBlock(t,e,i,r,s,o){r&&r.path&&validateClose(t,r);var a=/\*/.test(t.open);e.blockParams=t.blockParams;var l=void 0,c=void 0;if(i){if(a)throw new _exception2$1.default("Unexpected inverse block on decorator",i);i.chain&&(i.program.body[0].closeStrip=r.strip),c=i.strip,l=i.program}return s&&(s=l,l=e,e=s),{type:a?"DecoratorBlock":"BlockStatement",path:t.path,params:t.params,hash:t.hash,program:e,inverse:l,openStrip:t.strip,inverseStrip:c,closeStrip:r&&r.strip,loc:this.locInfo(o)}}function prepareProgram(t,e){if(!e&&t.length){var i=t[0].loc,r=t[t.length-1].loc;i&&r&&(e={source:i.source,start:{line:i.start.line,column:i.start.column},end:{line:r.end.line,column:r.end.column}})}return{type:"Program",body:t,strip:{},loc:e}}function preparePartialBlock(t,e,i,r){return validateClose(t,i),{type:"PartialBlockStatement",name:t.path,params:t.params,hash:t.hash,program:e,openStrip:t.strip,closeStrip:i&&i.strip,loc:this.locInfo(r)}}base.__esModule=!0;base.parseWithoutProcessing=parseWithoutProcessing;base.parse=parse$2;function _interopRequireWildcard(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e}function _interopRequireDefault$1(t){return t&&t.__esModule?t:{default:t}}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={};_utils$1.extend(yy,Helpers);function parseWithoutProcessing(t,e){if(t.type==="Program")return t;_parser2.default.yy=yy,yy.locInfo=function(r){return new yy.SourceLocation(e&&e.srcName,r)};var i=_parser2.default.parse(t);return i}function parse$2(t,e){var i=parseWithoutProcessing(t,e),r=new _whitespaceControl2.default(e);return r.accept(i)}var compiler={};compiler.__esModule=!0;compiler.Compiler=Compiler;compiler.precompile=precompile;compiler.compile=compile;function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}var _exception=exceptionExports,_exception2=_interopRequireDefault(_exception),_utils=utils,_ast=astExports,_ast2=_interopRequireDefault(_ast),slice=[].slice;function Compiler(){}Compiler.prototype={compiler:Compiler,equals:function t(e){var i=this.opcodes.length;if(e.opcodes.length!==i)return!1;for(var r=0;r1)throw new _exception2.default("Unsupported number of partial arguments: "+r.length,e);r.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):r.push({type:"PathExpression",parts:[],depth:0}));var s=e.name.original,o=e.name.type==="SubExpression";o&&this.accept(e.name),this.setupFullMustacheParams(e,i,void 0,!0);var a=e.indent||"";this.options.preventIndent&&a&&(this.opcode("appendContent",a),a=""),this.opcode("invokePartial",o,s,a),this.opcode("append")},PartialBlockStatement:function t(e){this.PartialStatement(e)},MustacheStatement:function t(e){this.SubExpression(e),e.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function t(e){this.DecoratorBlock(e)},ContentStatement:function t(e){e.value&&this.opcode("appendContent",e.value)},CommentStatement:function t(){},SubExpression:function t(e){transformLiteralToPath(e);var i=this.classifySexpr(e);i==="simple"?this.simpleSexpr(e):i==="helper"?this.helperSexpr(e):this.ambiguousSexpr(e)},ambiguousSexpr:function t(e,i,r){var s=e.path,o=s.parts[0],a=i!=null||r!=null;this.opcode("getContext",s.depth),this.opcode("pushProgram",i),this.opcode("pushProgram",r),s.strict=!0,this.accept(s),this.opcode("invokeAmbiguous",o,a)},simpleSexpr:function t(e){var i=e.path;i.strict=!0,this.accept(i),this.opcode("resolvePossibleLambda")},helperSexpr:function t(e,i,r){var s=this.setupFullMustacheParams(e,i,r),o=e.path,a=o.parts[0];if(this.options.knownHelpers[a])this.opcode("invokeKnownHelper",s.length,a);else{if(this.options.knownHelpersOnly)throw new _exception2.default("You specified knownHelpersOnly, but used the unknown helper "+a,e);o.strict=!0,o.falsy=!0,this.accept(o),this.opcode("invokeHelper",s.length,o.original,_ast2.default.helpers.simpleId(o))}},PathExpression:function t(e){this.addDepth(e.depth),this.opcode("getContext",e.depth);var i=e.parts[0],r=_ast2.default.helpers.scopedId(e),s=!e.depth&&!r&&this.blockParamIndex(i);s?this.opcode("lookupBlockParam",s,e.parts):i?e.data?(this.options.data=!0,this.opcode("lookupData",e.depth,e.parts,e.strict)):this.opcode("lookupOnContext",e.parts,e.falsy,e.strict,r):this.opcode("pushContext")},StringLiteral:function t(e){this.opcode("pushString",e.value)},NumberLiteral:function t(e){this.opcode("pushLiteral",e.value)},BooleanLiteral:function t(e){this.opcode("pushLiteral",e.value)},UndefinedLiteral:function t(){this.opcode("pushLiteral","undefined")},NullLiteral:function t(){this.opcode("pushLiteral","null")},Hash:function t(e){var i=e.pairs,r=0,s=i.length;for(this.opcode("pushHash");r=0)return[i,o]}}};function precompile(t,e,i){if(t==null||typeof t!="string"&&t.type!=="Program")throw new _exception2.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+t);e=e||{},"data"in e||(e.data=!0),e.compat&&(e.useDepths=!0);var r=i.parse(t,e),s=new i.Compiler().compile(r,e);return new i.JavaScriptCompiler().compile(s,e)}function compile(t,e,i){if(e===void 0&&(e={}),t==null||typeof t!="string"&&t.type!=="Program")throw new _exception2.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+t);e=_utils.extend({},e),"data"in e||(e.data=!0),e.compat&&(e.useDepths=!0);var r=void 0;function s(){var a=i.parse(t,e),l=new i.Compiler().compile(a,e),c=new i.JavaScriptCompiler().compile(l,e,void 0,!0);return i.template(c)}function o(a,l){return r||(r=s()),r.call(this,a,l)}return o._setup=function(a){return r||(r=s()),r._setup(a)},o._child=function(a,l,c,u){return r||(r=s()),r._child(a,l,c,u)},o}function argEquals(t,e){if(t===e)return!0;if(_utils.isArray(t)&&_utils.isArray(e)&&t.length===e.length){for(var i=0;i>1;return c?-u:u}return base64Vlq.encode=function(c){var u="",m,d=o(c);do m=d&r,d>>>=e,d>0&&(m|=s),u+=t.encode(m);while(d>0);return u},base64Vlq.decode=function(c,u,m){var d=c.length,g=0,y=0,b,S;do{if(u>=d)throw new Error("Expected more digits in base 64 VLQ value.");if(S=t.decode(c.charCodeAt(u++)),S===-1)throw new Error("Invalid base64 digit: "+c.charAt(u-1));b=!!(S&s),S&=r,g=g+(S<=0;$--)D=I[$],D==="."?I.splice($,1):D===".."?G++:G>0&&(D===""?(I.splice($+1,G),G=0):(I.splice($,2),G--));return T=I.join("/"),T===""&&(T=C?"/":"."),M?(M.path=T,o(M)):T}t.normalize=a;function l(P,T){P===""&&(P="."),T===""&&(T=".");var M=s(T),C=s(P);if(C&&(P=C.path||"/"),M&&!M.scheme)return C&&(M.scheme=C.scheme),o(M);if(M||T.match(r))return T;if(C&&!C.host&&!C.path)return C.host=T,o(C);var I=T.charAt(0)==="/"?T:a(P.replace(/\/+$/,"")+"/"+T);return C?(C.path=I,o(C)):I}t.join=l,t.isAbsolute=function(P){return P.charAt(0)==="/"||i.test(P)};function c(P,T){P===""&&(P="."),P=P.replace(/\/$/,"");for(var M=0;T.indexOf(P+"/")!==0;){var C=P.lastIndexOf("/");if(C<0||(P=P.slice(0,C),P.match(/^([^\/]+:\/)?\/*$/)))return T;++M}return Array(M+1).join("../")+T.substr(P.length+1)}t.relative=c;var u=function(){var P=Object.create(null);return!("__proto__"in P)}();function m(P){return P}function d(P){return y(P)?"$"+P:P}t.toSetString=u?m:d;function g(P){return y(P)?P.slice(1):P}t.fromSetString=u?m:g;function y(P){if(!P)return!1;var T=P.length;if(T<9||P.charCodeAt(T-1)!==95||P.charCodeAt(T-2)!==95||P.charCodeAt(T-3)!==111||P.charCodeAt(T-4)!==116||P.charCodeAt(T-5)!==111||P.charCodeAt(T-6)!==114||P.charCodeAt(T-7)!==112||P.charCodeAt(T-8)!==95||P.charCodeAt(T-9)!==95)return!1;for(var M=T-10;M>=0;M--)if(P.charCodeAt(M)!==36)return!1;return!0}function b(P,T,M){var C=E(P.source,T.source);return C!==0||(C=P.originalLine-T.originalLine,C!==0)||(C=P.originalColumn-T.originalColumn,C!==0||M)||(C=P.generatedColumn-T.generatedColumn,C!==0)||(C=P.generatedLine-T.generatedLine,C!==0)?C:E(P.name,T.name)}t.compareByOriginalPositions=b;function S(P,T,M){var C=P.generatedLine-T.generatedLine;return C!==0||(C=P.generatedColumn-T.generatedColumn,C!==0||M)||(C=E(P.source,T.source),C!==0)||(C=P.originalLine-T.originalLine,C!==0)||(C=P.originalColumn-T.originalColumn,C!==0)?C:E(P.name,T.name)}t.compareByGeneratedPositionsDeflated=S;function E(P,T){return P===T?0:P===null?1:T===null?-1:P>T?1:-1}function x(P,T){var M=P.generatedLine-T.generatedLine;return M!==0||(M=P.generatedColumn-T.generatedColumn,M!==0)||(M=E(P.source,T.source),M!==0)||(M=P.originalLine-T.originalLine,M!==0)||(M=P.originalColumn-T.originalColumn,M!==0)?M:E(P.name,T.name)}t.compareByGeneratedPositionsInflated=x;function A(P){return JSON.parse(P.replace(/^\)]}'[^\n]*\n/,""))}t.parseSourceMapInput=A;function _(P,T,M){if(T=T||"",P&&(P[P.length-1]!=="/"&&T[0]!=="/"&&(P+="/"),T=P+T),M){var C=s(M);if(!C)throw new Error("sourceMapURL could not be parsed");if(C.path){var I=C.path.lastIndexOf("/");I>=0&&(C.path=C.path.substring(0,I+1))}T=l(o(C),T)}return a(T)}t.computeSourceURL=_}(util)),util}var arraySet={},hasRequiredArraySet;function requireArraySet(){if(hasRequiredArraySet)return arraySet;hasRequiredArraySet=1;var t=requireUtil(),e=Object.prototype.hasOwnProperty,i=typeof Map<"u";function r(){this._array=[],this._set=i?new Map:Object.create(null)}return r.fromArray=function(o,a){for(var l=new r,c=0,u=o.length;c=0)return a}else{var l=t.toSetString(o);if(e.call(this._set,l))return this._set[l]}throw new Error('"'+o+'" is not in the set.')},r.prototype.at=function(o){if(o>=0&&oo||a==o&&c>=l||t.compareByGeneratedPositionsInflated(r,s)<=0}function i(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}return i.prototype.unsortedForEach=function(s,o){this._array.forEach(s,o)},i.prototype.add=function(s){e(this._last,s)?(this._last=s,this._array.push(s)):(this._sorted=!1,this._array.push(s))},i.prototype.toArray=function(){return this._sorted||(this._array.sort(t.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},mappingList.MappingList=i,mappingList}var hasRequiredSourceMapGenerator;function requireSourceMapGenerator(){if(hasRequiredSourceMapGenerator)return sourceMapGenerator;hasRequiredSourceMapGenerator=1;var t=requireBase64Vlq(),e=requireUtil(),i=requireArraySet().ArraySet,r=requireMappingList().MappingList;function s(o){o||(o={}),this._file=e.getArg(o,"file",null),this._sourceRoot=e.getArg(o,"sourceRoot",null),this._skipValidation=e.getArg(o,"skipValidation",!1),this._sources=new i,this._names=new i,this._mappings=new r,this._sourcesContents=null}return s.prototype._version=3,s.fromSourceMap=function(a){var l=a.sourceRoot,c=new s({file:a.file,sourceRoot:l});return a.eachMapping(function(u){var m={generated:{line:u.generatedLine,column:u.generatedColumn}};u.source!=null&&(m.source=u.source,l!=null&&(m.source=e.relative(l,m.source)),m.original={line:u.originalLine,column:u.originalColumn},u.name!=null&&(m.name=u.name)),c.addMapping(m)}),a.sources.forEach(function(u){var m=u;l!==null&&(m=e.relative(l,u)),c._sources.has(m)||c._sources.add(m);var d=a.sourceContentFor(u);d!=null&&c.setSourceContent(u,d)}),c},s.prototype.addMapping=function(a){var l=e.getArg(a,"generated"),c=e.getArg(a,"original",null),u=e.getArg(a,"source",null),m=e.getArg(a,"name",null);this._skipValidation||this._validateMapping(l,c,u,m),u!=null&&(u=String(u),this._sources.has(u)||this._sources.add(u)),m!=null&&(m=String(m),this._names.has(m)||this._names.add(m)),this._mappings.add({generatedLine:l.line,generatedColumn:l.column,originalLine:c!=null&&c.line,originalColumn:c!=null&&c.column,source:u,name:m})},s.prototype.setSourceContent=function(a,l){var c=a;this._sourceRoot!=null&&(c=e.relative(this._sourceRoot,c)),l!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[e.toSetString(c)]=l):this._sourcesContents&&(delete this._sourcesContents[e.toSetString(c)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},s.prototype.applySourceMap=function(a,l,c){var u=l;if(l==null){if(a.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);u=a.file}var m=this._sourceRoot;m!=null&&(u=e.relative(m,u));var d=new i,g=new i;this._mappings.unsortedForEach(function(y){if(y.source===u&&y.originalLine!=null){var b=a.originalPositionFor({line:y.originalLine,column:y.originalColumn});b.source!=null&&(y.source=b.source,c!=null&&(y.source=e.join(c,y.source)),m!=null&&(y.source=e.relative(m,y.source)),y.originalLine=b.line,y.originalColumn=b.column,b.name!=null&&(y.name=b.name))}var S=y.source;S!=null&&!d.has(S)&&d.add(S);var E=y.name;E!=null&&!g.has(E)&&g.add(E)},this),this._sources=d,this._names=g,a.sources.forEach(function(y){var b=a.sourceContentFor(y);b!=null&&(c!=null&&(y=e.join(c,y)),m!=null&&(y=e.relative(m,y)),this.setSourceContent(y,b))},this)},s.prototype._validateMapping=function(a,l,c,u){if(l&&typeof l.line!="number"&&typeof l.column!="number")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(!(a&&"line"in a&&"column"in a&&a.line>0&&a.column>=0&&!l&&!c&&!u)){if(a&&"line"in a&&"column"in a&&l&&"line"in l&&"column"in l&&a.line>0&&a.column>=0&&l.line>0&&l.column>=0&&c)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:a,source:c,original:l,name:u}))}},s.prototype._serializeMappings=function(){for(var a=0,l=1,c=0,u=0,m=0,d=0,g="",y,b,S,E,x=this._mappings.toArray(),A=0,_=x.length;A<_;A++){if(b=x[A],y="",b.generatedLine!==l)for(a=0;b.generatedLine!==l;)y+=";",l++;else if(A>0){if(!e.compareByGeneratedPositionsInflated(b,x[A-1]))continue;y+=","}y+=t.encode(b.generatedColumn-a),a=b.generatedColumn,b.source!=null&&(E=this._sources.indexOf(b.source),y+=t.encode(E-d),d=E,y+=t.encode(b.originalLine-1-u),u=b.originalLine-1,y+=t.encode(b.originalColumn-c),c=b.originalColumn,b.name!=null&&(S=this._names.indexOf(b.name),y+=t.encode(S-m),m=S)),g+=y}return g},s.prototype._generateSourcesContent=function(a,l){return a.map(function(c){if(!this._sourcesContents)return null;l!=null&&(c=e.relative(l,c));var u=e.toSetString(c);return Object.prototype.hasOwnProperty.call(this._sourcesContents,u)?this._sourcesContents[u]:null},this)},s.prototype.toJSON=function(){var a={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(a.file=this._file),this._sourceRoot!=null&&(a.sourceRoot=this._sourceRoot),this._sourcesContents&&(a.sourcesContent=this._generateSourcesContent(a.sources,a.sourceRoot)),a},s.prototype.toString=function(){return JSON.stringify(this.toJSON())},sourceMapGenerator.SourceMapGenerator=s,sourceMapGenerator}var sourceMapConsumer={},binarySearch={},hasRequiredBinarySearch;function requireBinarySearch(){return hasRequiredBinarySearch||(hasRequiredBinarySearch=1,function(t){t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2;function e(i,r,s,o,a,l){var c=Math.floor((r-i)/2)+i,u=a(s,o[c],!0);return u===0?c:u>0?r-c>1?e(c,r,s,o,a,l):l==t.LEAST_UPPER_BOUND?r1?e(i,c,s,o,a,l):l==t.LEAST_UPPER_BOUND?c:i<0?-1:i}t.search=function(r,s,o,a){if(s.length===0)return-1;var l=e(-1,s.length,r,s,o,a||t.GREATEST_LOWER_BOUND);if(l<0)return-1;for(;l-1>=0&&o(s[l],s[l-1],!0)===0;)--l;return l}}(binarySearch)),binarySearch}var quickSort={},hasRequiredQuickSort;function requireQuickSort(){if(hasRequiredQuickSort)return quickSort;hasRequiredQuickSort=1;function t(r,s,o){var a=r[s];r[s]=r[o],r[o]=a}function e(r,s){return Math.round(r+Math.random()*(s-r))}function i(r,s,o,a){if(o=0){var S=this._originalMappings[b];if(m.column===void 0)for(var E=S.originalLine;S&&S.originalLine===E;)y.push({line:t.getArg(S,"generatedLine",null),column:t.getArg(S,"generatedColumn",null),lastColumn:t.getArg(S,"lastGeneratedColumn",null)}),S=this._originalMappings[++b];else for(var x=S.originalColumn;S&&S.originalLine===d&&S.originalColumn==x;)y.push({line:t.getArg(S,"generatedLine",null),column:t.getArg(S,"generatedColumn",null),lastColumn:t.getArg(S,"lastGeneratedColumn",null)}),S=this._originalMappings[++b]}return y},sourceMapConsumer.SourceMapConsumer=o;function a(u,m){var d=u;typeof u=="string"&&(d=t.parseSourceMapInput(u));var g=t.getArg(d,"version"),y=t.getArg(d,"sources"),b=t.getArg(d,"names",[]),S=t.getArg(d,"sourceRoot",null),E=t.getArg(d,"sourcesContent",null),x=t.getArg(d,"mappings"),A=t.getArg(d,"file",null);if(g!=this._version)throw new Error("Unsupported version: "+g);S&&(S=t.normalize(S)),y=y.map(String).map(t.normalize).map(function(_){return S&&t.isAbsolute(S)&&t.isAbsolute(_)?t.relative(S,_):_}),this._names=i.fromArray(b.map(String),!0),this._sources=i.fromArray(y,!0),this._absoluteSources=this._sources.toArray().map(function(_){return t.computeSourceURL(S,_,m)}),this.sourceRoot=S,this.sourcesContent=E,this._mappings=x,this._sourceMapURL=m,this.file=A}a.prototype=Object.create(o.prototype),a.prototype.consumer=o,a.prototype._findSourceIndex=function(u){var m=u;if(this.sourceRoot!=null&&(m=t.relative(this.sourceRoot,m)),this._sources.has(m))return this._sources.indexOf(m);var d;for(d=0;d1&&(I.source=E+G[1],E+=G[1],I.originalLine=b+G[2],b=I.originalLine,I.originalLine+=1,I.originalColumn=S+G[3],S=I.originalColumn,G.length>4&&(I.name=x+G[4],x+=G[4])),C.push(I),typeof I.originalLine=="number"&&M.push(I)}s(C,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=C,s(M,t.compareByOriginalPositions),this.__originalMappings=M},a.prototype._findMapping=function(m,d,g,y,b,S){if(m[g]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+m[g]);if(m[y]<0)throw new TypeError("Column must be greater than or equal to 0, got "+m[y]);return e.search(m,d,b,S)},a.prototype.computeColumnSpans=function(){for(var m=0;m=0){var y=this._generatedMappings[g];if(y.generatedLine===d.generatedLine){var b=t.getArg(y,"source",null);b!==null&&(b=this._sources.at(b),b=t.computeSourceURL(this.sourceRoot,b,this._sourceMapURL));var S=t.getArg(y,"name",null);return S!==null&&(S=this._names.at(S)),{source:b,line:t.getArg(y,"originalLine",null),column:t.getArg(y,"originalColumn",null),name:S}}}return{source:null,line:null,column:null,name:null}},a.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(m){return m==null}):!1},a.prototype.sourceContentFor=function(m,d){if(!this.sourcesContent)return null;var g=this._findSourceIndex(m);if(g>=0)return this.sourcesContent[g];var y=m;this.sourceRoot!=null&&(y=t.relative(this.sourceRoot,y));var b;if(this.sourceRoot!=null&&(b=t.urlParse(this.sourceRoot))){var S=y.replace(/^file:\/\//,"");if(b.scheme=="file"&&this._sources.has(S))return this.sourcesContent[this._sources.indexOf(S)];if((!b.path||b.path=="/")&&this._sources.has("/"+y))return this.sourcesContent[this._sources.indexOf("/"+y)]}if(d)return null;throw new Error('"'+y+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(m){var d=t.getArg(m,"source");if(d=this._findSourceIndex(d),d<0)return{line:null,column:null,lastColumn:null};var g={source:d,originalLine:t.getArg(m,"line"),originalColumn:t.getArg(m,"column")},y=this._findMapping(g,this._originalMappings,"originalLine","originalColumn",t.compareByOriginalPositions,t.getArg(m,"bias",o.GREATEST_LOWER_BOUND));if(y>=0){var b=this._originalMappings[y];if(b.source===g.source)return{line:t.getArg(b,"generatedLine",null),column:t.getArg(b,"generatedColumn",null),lastColumn:t.getArg(b,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},sourceMapConsumer.BasicSourceMapConsumer=a;function c(u,m){var d=u;typeof u=="string"&&(d=t.parseSourceMapInput(u));var g=t.getArg(d,"version"),y=t.getArg(d,"sections");if(g!=this._version)throw new Error("Unsupported version: "+g);this._sources=new i,this._names=new i;var b={line:-1,column:0};this._sections=y.map(function(S){if(S.url)throw new Error("Support for url field in sections not implemented.");var E=t.getArg(S,"offset"),x=t.getArg(E,"line"),A=t.getArg(E,"column");if(x=0;c--)this.prepend(l[c]);else if(l[s]||typeof l=="string")this.children.unshift(l);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+l);return this},o.prototype.walk=function(l){for(var c,u=0,m=this.children.length;u0){for(c=[],u=0;u0&&(S+=", "+E.join(", "));var x=0;Object.keys(this.aliases).forEach(function(P){var T=b.aliases[P];T.children&&T.referenceCount>1&&(S+=", alias"+ ++x+"="+P,T.children[0]="alias"+x)}),this.lookupPropertyFunctionIsUsed&&(S+=", "+this.lookupPropertyFunctionVarDeclaration());var A=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&A.push("blockParams"),this.useDepths&&A.push("depths");var _=this.mergeSource(S);return y?(A.push(_),Function.apply(this,A)):this.source.wrap(["function(",A.join(","),`) { `,_,"}"])},mergeSource:function(y){var b=this.environment.isSimple,S=!this.forceBuffer,E=void 0,x=void 0,A=void 0,_=void 0;return this.source.each(function(P){P.appendToBuffer?(A?P.prepend(" + "):A=P,_=P):(A&&(x?A.prepend("buffer += "):E=!0,_.add(";"),A=_=void 0),x=!0,b||(S=!1))}),S?A?(A.prepend("return "),_.add(";")):x||this.source.push('return "";'):(y+=", buffer = "+(E?"":this.initializeBuffer()),A?(A.prepend("return buffer + "),_.add(";")):this.source.push("return buffer;")),y&&this.source.prepend("var "+y.substring(2)+(E?"":`; `)),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return` lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined } `.trim()},blockValue:function(y){var b=this.aliasable("container.hooks.blockHelperMissing"),S=[this.contextName(0)];this.setupHelperArgs(y,0,S);var E=this.popStack();S.splice(1,0,E),this.push(this.source.functionCall(b,"call",S))},ambiguousBlockValue:function(){var y=this.aliasable("container.hooks.blockHelperMissing"),b=[this.contextName(0)];this.setupHelperArgs("",0,b,!0),this.flushInline();var S=this.topStack();b.splice(1,0,S),this.pushSource(["if (!",this.lastHelper,") { ",S," = ",this.source.functionCall(y,"call",b),"}"])},appendContent:function(y){this.pendingContent?y=this.pendingContent+y:this.pendingLocation=this.source.currentLocation,this.pendingContent=y},append:function(){if(this.isInline())this.replaceStack(function(b){return[" != null ? ",b,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var y=this.popStack();this.pushSource(["if (",y," != null) { ",this.appendToBuffer(y,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(y){this.lastContext=y},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(y,b,S,E){var x=0;!E&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(y[x++])):this.pushContext(),this.resolvePath("context",y,x,b,S)},lookupBlockParam:function(y,b){this.useBlockParams=!0,this.push(["blockParams[",y[0],"][",y[1],"]"]),this.resolvePath("context",b,1)},lookupData:function(y,b,S){y?this.pushStackLiteral("container.data(data, "+y+")"):this.pushStackLiteral("data"),this.resolvePath("data",b,0,!0,S)},resolvePath:function(y,b,S,E,x){var A=this;if(this.options.strict||this.options.assumeObjects){this.push(d(this.options.strict&&x,this,b,S,y));return}for(var _=b.length;S<_;S++)this.replaceStack(function(P){var T=A.nameLookup(P,b[S],y);return E?[" && ",T]:[" != null ? ",T," : ",P]})},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(y,b){this.pushContext(),this.pushString(b),b!=="SubExpression"&&(typeof y=="string"?this.pushString(y):this.pushStackLiteral(y))},emptyHash:function(y){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(y?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var y=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(y.ids)),this.stringParams&&(this.push(this.objectLiteral(y.contexts)),this.push(this.objectLiteral(y.types))),this.push(this.objectLiteral(y.values))},pushString:function(y){this.pushStackLiteral(this.quotedString(y))},pushLiteral:function(y){this.pushStackLiteral(y)},pushProgram:function(y){y!=null?this.pushStackLiteral(this.programExpression(y)):this.pushStackLiteral(null)},registerDecorator:function(y,b){var S=this.nameLookup("decorators",b,"decorator"),E=this.setupHelperArgs(b,y);this.decorators.push(["fn = ",this.decorators.functionCall(S,"",["fn","props","container",E])," || fn;"])},invokeHelper:function(y,b,S){var E=this.popStack(),x=this.setupHelper(y,b),A=[];S&&A.push(x.name),A.push(E),this.options.strict||A.push(this.aliasable("container.hooks.helperMissing"));var _=["(",this.itemsSeparatedBy(A,"||"),")"],P=this.source.functionCall(_,"call",x.callParams);this.push(P)},itemsSeparatedBy:function(y,b){var S=[];S.push(y[0]);for(var E=1;Ethis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var y=this.inlineStack;this.inlineStack=[];for(var b=0,S=y.length;bt!==null&&t.isSecureContext,createNativeAudioBufferConstructor=t=>t===null?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null,createNativeAudioContextConstructor=t=>t===null?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null,createNativeAudioWorkletNodeConstructor=t=>t===null?null:t.hasOwnProperty("AudioWorkletNode")?t.AudioWorkletNode:null,createNativeOfflineAudioContextConstructor=t=>t===null?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null,createWindow=()=>typeof window>"u"?null:window,window$1=createWindow();createNativeOfflineAudioContextConstructor(window$1);createNativeAudioContextConstructor(window$1);createNativeAudioWorkletNodeConstructor(window$1);createNativeAudioBufferConstructor(window$1);createIsSecureContext(window$1);var libExports$2={},lib$2={get exports(){return libExports$2},set exports(t){libExports$2=t}},libExports$1={},lib$1={get exports(){return libExports$1},set exports(t){libExports$1=t}};function b64ToUint6(t){return t>64&&t<91?t-65:t>96&&t<123?t-71:t>47&&t<58?t+4:t===43?62:t===47?63:0}function decode(t,e){for(var i=t.replace(/[^A-Za-z0-9\+\/]/g,""),r=i.length,s=e?Math.ceil((r*3+1>>2)/e)*e:r*3+1>>2,o=new Uint8Array(s),a,l,c=0,u=0,m=0;m>>(16>>>a&24)&255;c=0}return o}var base64={decode},fetch$1=function(t,e){return new Promise(function(i,r){var s=new XMLHttpRequest;e&&(s.responseType=e),s.open("GET",t),s.onload=function(){s.status===200?i(s.response):r(Error(s.statusText))},s.onerror=function(){r(Error("Network Error"))},s.send()})};(function(t){var e=base64,i=fetch$1;function r(C){return function(I){return typeof I=="string"&&C.test(I)}}function s(C,I){return typeof C=="string"?C+I:typeof C=="function"?C(I):I}function o(C,I,D,G){var $=a(I)?l:c(I)?u:m(I)?d:g(I)?y:b(I)?S:E(I)?x:A(I)?_:P(I)?T:null,N=D||{};return $?$(C,I,N):G?Promise.resolve(G):Promise.reject("Source not valid ("+I+")")}o.fetch=i;function a(C){return C instanceof ArrayBuffer}function l(C,I,D){return new Promise(function(G,$){C.decodeAudioData(I,function(N){G(N)},function(){$("Can't decode audio data ("+I.slice(0,30)+"...)")})})}var c=r(/\.(mp3|wav|ogg)(\?.*)?$/i);function u(C,I,D){var G=s(D.from,I);return o(C,o.fetch(G,"arraybuffer"),D)}function m(C){return C&&typeof C.then=="function"}function d(C,I,D){return I.then(function(G){return o(C,G,D)})}var g=Array.isArray;function y(C,I,D){return Promise.all(I.map(function(G){return o(C,G,D,G)}))}function b(C){return C&&typeof C=="object"}function S(C,I,D){var G={},$=Object.keys(I).map(function(N){if(D.only&&D.only.indexOf(N)===-1)return null;var z=I[N];return o(C,z,D,z).then(function(R){G[N]=R})});return Promise.all($).then(function(){return G})}var E=r(/\.json(\?.*)?$/i);function x(C,I,D){var G=s(D.from,I);return o(C,o.fetch(G,"text").then(JSON.parse),D)}var A=r(/^data:audio/);function _(C,I,D){var G=I.indexOf(",");return o(C,e.decode(I.slice(G+1)).buffer,D)}var P=r(/\.js(\?.*)?$/i);function T(C,I,D){var G=s(D.from,I);return o(C,o.fetch(G,"text").then(M),D)}function M(C){var I=C.indexOf("MIDI.Soundfont.");if(I<0)throw Error("Invalid MIDI.js Soundfont format");I=C.indexOf("=",I)+2;var D=C.lastIndexOf(",");return JSON.parse(C.slice(I,D)+"}")}t.exports&&(t.exports=o),typeof window<"u"&&(window.loadAudio=o)})(lib$1);var libExports={},lib={get exports(){return libExports},set exports(t){libExports=t}},adsr=ADSR$1;function ADSR$1(t){var e=t.createGain(),i=e._voltage=getVoltage(t),r=scale(i),s=scale(i),o=scale(i);return e._startAmount=scale(s),e._endAmount=scale(o),e._multiplier=scale(r),e._multiplier.connect(e),e._startAmount.connect(e),e._endAmount.connect(e),e.value=r.gain,e.startValue=s.gain,e.endValue=o.gain,e.startValue.value=0,e.endValue.value=0,Object.defineProperties(e,props),e}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(t){var e=this._multiplier.gain,i=this._startAmount.gain,r=this._endAmount.gain;this._voltage.start(t),this._decayFrom=this._decayFrom=t+this.attack,this._startedAt=t;var s=this.sustain;e.cancelScheduledValues(t),i.cancelScheduledValues(t),r.cancelScheduledValues(t),r.setValueAtTime(0,t),this.attack?(e.setValueAtTime(0,t),e.linearRampToValueAtTime(1,t+this.attack),i.setValueAtTime(1,t),i.linearRampToValueAtTime(0,t+this.attack)):(e.setValueAtTime(1,t),i.setValueAtTime(0,t)),this.decay&&e.setTargetAtTime(s,this._decayFrom,getTimeConstant(this.decay))}},stop:{value:function(t,e){e&&(t=t-this.release);var i=t+this.release;if(this.release){var r=this._multiplier.gain,s=this._startAmount.gain,o=this._endAmount.gain;r.cancelScheduledValues(t),s.cancelScheduledValues(t),o.cancelScheduledValues(t);var a=getTimeConstant(this.release);if(this.attack&&t=e&&(u=e),u}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(t,e,i){var r=!1,s=0,o={},a=t.createGain();a.gain.value=1;var l=Object.assign({},DEFAULTS,i),c={context:t,out:a,opts:l};return e instanceof AudioBuffer?c.buffer=e:c.buffers=e,c.start=function(d,g,y){if(c.buffer&&d!==null)return c.start(null,d,g);var b=d?c.buffers[d]:c.buffer;if(b){if(!r){console.warn("SamplePlayer not connected to any node.");return}}else{console.warn("Buffer "+d+" not found.");return}var S=y||EMPTY;g=Math.max(t.currentTime,g||0),c.emit("start",g,d,S);var E=m(d,b,S);return E.id=u(d,E),E.env.start(g),E.source.start(g),c.emit("started",g,E.id,E),S.duration&&E.stop(g+S.duration),E},c.play=function(d,g,y){return c.start(d,g,y)},c.stop=function(d,g){var y;return g=g||Object.keys(o),g.map(function(b){return y=o[b],y?(y.stop(d),y.id):null})},c.connect=function(d){return r=!0,a.connect(d),c},c.emit=function(d,g,y,b){c.onevent&&c.onevent(d,g,y,b);var S=c["on"+d];S&&S.forEach(E=>{E(g,y,b)})},c;function u(d,g){return g.id=s++,o[g.id]=g,g.startTime=t.currentTime,g.source.onended=function(){var y=t.currentTime;g.source.disconnect(),g.env.disconnect(),g.disconnect(),c.emit("ended",y,g.id,g)},g.id}function m(d,g,y){var b=t.createGain();return b.gain.value=0,b.connect(a),b.env=envelope(t,y,l),b.env.connect(b.gain),b.source=t.createBufferSource(),b.source.buffer=g,b.source.connect(b),b.source.loop=y.loop||l.loop,b.source.playbackRate.value=centsToRate(y.cents||l.cents),b.source.loopStart=y.loopStart||l.loopStart,b.source.loopEnd=y.loopEnd||l.loopEnd,b.stop=function(S){var E=S||t.currentTime;c.emit("stop",E,d);var x=b.env.stop(E);b.source.stop(x)},b}}function isNum$1(t){return typeof t=="number"}var PARAMS=["attack","decay","sustain","release"];function envelope(t,e,i){var r=ADSR(t),s=e.adsr||i.adsr;return PARAMS.forEach(function(o,a){s?r[o]=s[a]:r[o]=e[o]||i[o]}),r.value.value=isNum$1(e.gain)?e.gain:isNum$1(i.gain)?i.gain:1,r}function centsToRate(t){return t?Math.pow(2,t/1200):1}var player=SamplePlayer,events=function(t){return t.on=function(e,i){if(arguments.length===1&&typeof e=="function")return t.on("event",e);var r="on"+e;return t[r]?t[r].push(i):t[r]=[i],t},t},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(t,e,i){if(typeof t!="string")return null;var r=REGEX$1.exec(t);if(!r||!e&&r[4])return null;var s={letter:r[1].toUpperCase(),acc:r[2].replace(/x/g,"##")};return s.pc=s.letter+s.acc,s.step=(s.letter.charCodeAt(0)+3)%7,s.alt=s.acc[0]==="b"?-s.acc.length:s.acc.length,s.chroma=SEMITONES$1[s.step]+s.alt,r[3]&&(s.oct=+r[3],s.midi=s.chroma+12*(s.oct+1),s.freq=midiToFreq$1(s.midi,i)),e&&(s.tonicOf=r[4]),s}function midiToFreq$1(t,e){return Math.pow(2,(t-69)/12)*(e||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(t){parser[t]=function(e){var i=parse$1(e);return i&&typeof i[t]<"u"?i[t]:null}});var noteParser$1=parser,note$1=noteParser$1,isMidi=function(t){return t!==null&&t!==[]&&t>=0&&t<129},toMidi=function(t){return isMidi(t)?+t:note$1.midi(t)},notes=function(t){if(t.buffers){var e=t.opts.map,i=typeof e=="function"?e:toMidi,r=function(o){return o?i(o)||o:null};t.buffers=mapBuffers(t.buffers,r);var s=t.start;t.start=function(o,a,l){var c=r(o),u=c%1;return u&&(c=Math.floor(c),l=Object.assign(l||{},{cents:Math.floor(u*100)})),s(c,a,l)}}return t};function mapBuffers(t,e){return Object.keys(t).reduce(function(i,r){return i[e(r)]=t[r],i},{})}var isArr=Array.isArray,isObj=function(t){return t&&typeof t=="object"},OPTS={},scheduler=function(t){return t.schedule=function(e,i){var r=t.context.currentTime,s=e"u"?null:t.step?build(t.step,t.alt,t.oct):t<0||t>6?null:LETTERS.charAt(t)+accStr(e)+octStr(i)}function midi(t){if((isNum(t)||isStr(t))&&t>=0&&t<128)return+t;var e=parse(t);return e&&isDef(e.midi)?e.midi:null}function freq(t,e){var i=midi(t);return i===null?null:midiToFreq(i,e)}function letter(t){return(parse(t)||{}).letter}function acc(t){return(parse(t)||{}).acc}function pc(t){return(parse(t)||{}).pc}function step(t){return(parse(t)||{}).step}function alt(t){return(parse(t)||{}).alt}function chroma(t){return(parse(t)||{}).chroma}function oct(t){return(parse(t)||{}).oct}const noteParser=Object.freeze(Object.defineProperty({__proto__:null,acc,alt,build,chroma,freq,letter,midi,oct,parse,pc,regex,step},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(noteParser);var legacy,hasRequiredLegacy;function requireLegacy(){if(hasRequiredLegacy)return legacy;hasRequiredLegacy=1;var t=require$$0;function e(s,o){if(console.warn("new Soundfont() is deprected"),console.log("Please use Soundfont.instrument() instead of new Soundfont().instrument()"),!(this instanceof e))return new e(s);this.nameToUrl=o||e.nameToUrl,this.ctx=s,this.instruments={},this.promises=[]}e.prototype.onready=function(s){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(s)},e.prototype.instrument=function(s,o){console.warn("new Soundfont().instrument() is deprecated."),console.log("Please use Soundfont.instrument() instead.");var a=this.ctx;if(s=s||"default",s in this.instruments)return this.instruments[s];var l={name:s,play:r(a,o)};if(this.instruments[s]=l,s!=="default"){var c=e.instrument(a,s,o).then(function(u){return l.play=u.play,l});this.promises.push(c),l.onready=function(u){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),c.then(u)}}else l.onready=function(u){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),u()};return l};function i(s,o,a){return console.warn("Soundfont.loadBuffers is deprecate."),console.log("Use Soundfont.instrument(..) and get buffers properties from the result."),e.instrument(s,o,a).then(function(l){return l.buffers})}e.loadBuffers=i;function r(s,o){return o=o||{},function(a,l,c,u){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 m=a>0&&a<129?+a:t.midi(a),d=m?t.midiToFreq(m,440):null;if(d){c=c||.2,u=u||{};var g=u.destination||o.destination||s.destination,y=u.vcoType||o.vcoType||"sine",b=u.gain||o.gain||.4,S=s.createOscillator();S.type=y,S.frequency.value=d;var E=s.createGain();return E.gain.value=b,S.connect(E),E.connect(g),S.start(l),c>0&&S.stop(l+c),S}}}return e.noteToMidi=t.midi,legacy=e,legacy}(function(t){var e=libExports$1,i=libExports;function r(l,c,u){if(arguments.length===1)return function(b,S){return r(l,b,S)};var m=u||{},d=m.isSoundfontURL||s,g=m.nameToUrl||o,y=d(c)?c:g(c,m.soundfont,m.format);return e(l,y,{only:m.only||m.notes}).then(function(b){var S=i(l,b,m).connect(m.destination?m.destination:l.destination);return S.url=y,S.name=c,S})}function s(l){return/\.js(\?.*)?$/i.test(l)}function o(l,c,u){return u=u==="ogg"?u:"mp3",c=c==="FluidR3_GM"?c:"MusyngKite","https://gleitz.github.io/midi-js-soundfonts/"+c+"/"+l+"-"+u+".js"}var a=requireLegacy();a.instrument=r,a.nameToUrl=o,t.exports&&(t.exports=a),typeof window<"u"&&(window.Soundfont=a)})(lib$2);NoteEnum.C,NoteEnum.D,NoteEnum.E,NoteEnum.F,NoteEnum.G,NoteEnum.A,NoteEnum.B;const 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=(t,e)=>{var l;let i=0;const r=t.closest(e);let s=r;const o=r==null?void 0:r.closest("measure");let a=null;for(;!a&&i<((o==null?void 0:o.childNodes.length)||50);)i++,((l=s==null?void 0:s.nextElementSibling)==null?void 0:l.tagName)==="note"&&(a=s==null?void 0:s.nextElementSibling),s=s==null?void 0:s.nextElementSibling;return a},getGradualLengthByXml=t=>{var u,m,d,g;const e=new DOMParser().parseFromString(t,"text/xml"),i=Array.from(e.querySelectorAll("measure")),r=Array.from(e.querySelectorAll("note")),s=Array.from(e.querySelectorAll("words")),o=Array.from(e.querySelectorAll("metronome")),a=[];for(const y of[...s,...o]){const b=getNextNote(y,"direction");if(b){const S=b==null?void 0:b.closest("measure"),E=Array.from(S.querySelectorAll("note")),x=Array.from(S.childNodes).filter(P=>P.nodeName==="note").findIndex(P=>P===b);let A=0,_=0;for(let P=0;Py.index-b.index);const c=Object.keys(speedInfo).map(y=>y.toLocaleLowerCase());for(const y of a){let b=!1,S=0;const E=(m=y.textContent)==null?void 0:m.toLocaleLowerCase().trim();y===a[a.length-1]&&((d=l[l.length-1])==null?void 0:d.length)===1&&(b=!0);const x=c.find(A=>{const _=A.split(" ");return E&&_.includes(E)});if(y.type==="metronome"||y.type==="words"&&(E.startsWith("a tempo")||x)||b){const A=l.findIndex(_=>_.length===1);A>-1&&y.index>((g=l[A])==null?void 0:g[0].start)&&(S=-1,l[A][1]={start:y.index,measureIndex:y.measureIndex,closedMeasureIndex:y.measureIndex,noteInMeasureIndex:y.noteInMeasureIndex,allDuration:y.allDuration,leftDuration:y.leftDuration,type:E})}y.type==="words"&&x&&l.push([{start:y.index,measureIndex:y.measureIndex,closedMeasureIndex:y.measureIndex+S,noteInMeasureIndex:y.noteInMeasureIndex,allDuration:y.allDuration,leftDuration:y.leftDuration,type:E}])}return l},browserInfo=browser();dayjs.extend(duration);const getFixTime=t=>{const e=getDuration(state$1.osmd);let i=e.numerator||0,r=e.denominator||4;const s=e.beatUnit||"quarter";return state$1.repeatedBeats&&(i=i*2),state$1.isOpenMetronome?60/t*formatBeatUnit(s)*(i/r):0},retain=t=>Math.ceil(t*1e6)/1e6,formatLyricsEntries=t=>{var r,s;const e=((r=t.parentStaffEntry)==null?void 0:r.voiceEntries)||[],i=[];for(const o of e)if((s=o.lyricsEntries)!=null&&s.table){const a=Object.values(o.lyricsEntries.table);for(const l of a)i.push(l==null?void 0:l.value.text)}return i},createSpeedInfo=(t,e)=>{var i,r;if(t&&speedInfo[(i=t.startWord)==null?void 0:i.toLocaleLowerCase()]){const s=Math.max(t.endXmlNoteIndex,3),o=[],a=e,l=e/speedInfo[(r=t.startWord)==null?void 0:r.toLocaleLowerCase()];for(let c=0;c{let e=t;const i=t.split(":");return i.length===1?e=`00:${i[0]}:00`:i.length===2&&(e=`00:${i[0]}:${i[1]}`),`1970-01-01 00:${e}0`},getDuration=t=>{var i;if(t){const{Duration:r,TempoInBPM:s,ActiveTimeSignature:o,TempoExpressions:a}=(i=t.GraphicSheet.MeasureList[0][0])==null?void 0:i.parentSourceMeasure;if(r){let l="quarter";for(const u of a)l=u.InstantaneousTempo.beatUnit||"quarter";return{...formatDuration(o),TempoInBPM:s,beatUnit:l}}}return{...new Fraction$1,TempoInBPM:90,beatUnit:"quarter"}};function formatDuration(t,e){return t}function formatBeatUnit(t){let e=4;switch(t){case"1024th":e=1024;break;case"512th":e=512;break;case"256th":e=256;break;case"128th":e=128;break;case"64th":e=64;break;case"32nd":e=32;break;case"16th":e=16;break;case"eighth":e=8;break;case"quarter":e=4;break;case"half":e=2;break;case"whole":e=1;break;case"breve":e=.5;break;case"long":e=.25;break;case"maxima":e=.125;break}return e}function getTimeByBeatUnit(t,e,i){return i/formatBeatUnit(t)*e}const setElementNoteBefore=(t,e,i)=>{let r=0;if(e){for(let s=0;s0){let s=0;const o=Array.from(i.childNodes).filter(l=>l.nodeName==="note"),a=o[o.length-1];if(r>=o.length&&a){i.insertBefore(t,i.childNodes[Array.from(i.childNodes).indexOf(a)]);return}for(let l=0;l{if(t){const e=t.toLocaleLowerCase(),i="d\\s?\\.s\\.",r="d\\.\\s?c\\.";return e==="@"||StringUtil.StringContainsSeparatedWord(e,i+" al fine",!0)||StringUtil.StringContainsSeparatedWord(e,i+" al coda",!0)||StringUtil.StringContainsSeparatedWord(e,r+" al fine",!0)||StringUtil.StringContainsSeparatedWord(e,r+" al coda",!0)||StringUtil.StringContainsSeparatedWord(e,r)||StringUtil.StringContainsSeparatedWord(e,"da\\s?capo",!0)||StringUtil.StringContainsSeparatedWord(e,i,!0)||StringUtil.StringContainsSeparatedWord(e,"dal\\s?segno",!0)||StringUtil.StringContainsSeparatedWord(e,"al\\s?coda",!0)||StringUtil.StringContainsSeparatedWord(e,"to\\s?coda",!0)||StringUtil.StringContainsSeparatedWord(e,"a (la )?coda",!0)||StringUtil.StringContainsSeparatedWord(e,"fine",!0)||StringUtil.StringContainsSeparatedWord(e,"coda",!0)||StringUtil.StringContainsSeparatedWord(e,"segno",!0)}return!1},onlyVisible=(t,e)=>{var y,b,S,E,x,A,_,P,T;if(!t)return"";const i=state$1.examSongId+"",r=new DOMParser().parseFromString(t,"text/xml"),s=((b=(y=r.getElementsByTagName("part-list"))==null?void 0:y[0])==null?void 0:b.getElementsByTagName("score-part"))||[],o=Array.from(s).map(M=>{var C,I,D;return((D=(I=(C=M.getElementsByTagName("part-name"))==null?void 0:C[0])==null?void 0:I.textContent)==null?void 0:D.trim())||""}),a=r.getElementsByTagName("part"),l=[...(S=a[0])==null?void 0:S.getElementsByTagName("measure")],c=[...(E=a[0])==null?void 0:E.getElementsByTagName("metronome")],u=[...(x=a[0])==null?void 0:x.getElementsByTagName("words")],m=[...(A=a[0])==null?void 0:A.getElementsByTagName("coda")],d=[...(_=a[0])==null?void 0:_.getElementsByTagName("rehearsal")];((T=(P=o[0])==null?void 0:P.toLocaleUpperCase)==null?void 0:T.call(P))==="COMMON"&&(e++,o.shift());const g=s[e];if(state$1.partListNames=o,g){const M=g.getAttribute("id");Array.from(a).forEach(C=>{var I,D,G,$,N;if(C&&C.getAttribute("id")!==M)(I=C.parentNode)==null||I.removeChild(C);else if(C&&C.getAttribute("id")!=="P1"){const z={};for(let R=0;R{var F;const H=(F=R.parentElement)==null?void 0:F.parentElement,O=H==null?void 0:H.parentElement,V=[...(O==null?void 0:O.childNodes)||[]],k=H?V.indexOf(H):-1;if(O&&k>-1){const Z=l.indexOf(O),U=C.getElementsByTagName("measure")[Z];setElementNoteBefore(H,O,U)}}),u.forEach(R=>{var O;let H=R.textContent||"";if(H=["cresc."].includes(H)?"":H,(isSpecialMark(H)||isSpeedKeyword(H)||isGradientWords(H)||isRepeatWord(H)||GRADIENT_SPEED_RESET_TAG)&&H){const V=(O=R.parentElement)==null?void 0:O.parentElement,k=V==null?void 0:V.parentElement,F=[...(k==null?void 0:k.childNodes)||[]],Z=V?F.indexOf(V):-1;if(V&&k&&Z>-1){const U=l.indexOf(k),J=C.getElementsByTagName("measure")[U];Array.from((J==null?void 0:J.getElementsByTagName("words"))||[]).reduce((te,ce)=>{var pe;return(pe=ce.textContent)!=null&&pe.includes(H)&&te++,te},0)===0&&(["12280"].includes(i)?J==null||J.insertBefore(V.cloneNode(!0),J==null?void 0:J.childNodes[Z]):setElementNoteBefore(V,k,J))}}}),m.forEach(R=>{var F;const H=(F=R.parentElement)==null?void 0:F.parentElement,O=H==null?void 0:H.parentElement,V=[...(O==null?void 0:O.childNodes)||[]],k=H?V.indexOf(H):-1;if(H&&O&&k>-1){const Z=l.indexOf(O),U=C.getElementsByTagName("measure")[Z];["12280"].includes(i)?U==null||U.insertBefore(H.cloneNode(!0),U==null?void 0:U.childNodes[k]):setElementNoteBefore(H,O,U)}}),d.forEach(R=>{var V,k;const H=(V=R.parentElement)==null?void 0:V.parentElement,O=H==null?void 0:H.parentElement;if(O){const F=l.indexOf(O);(k=C.getElementsByTagName("measure")[F])==null||k.appendChild(H.cloneNode(!0))}})}else u.forEach((z,R)=>{var O,V,k;const H=z.textContent||"";if(isSpeedKeyword(H)&&H){const F=(V=(O=z.parentElement)==null?void 0:O.parentElement)==null?void 0:V.parentElement;if(F&&F.firstElementChild&&F.firstElementChild!==z){const Z=(k=z.parentElement)==null?void 0:k.parentElement,U=F.firstElementChild;F.insertBefore(Z,U)}}});if(C&&C.getAttribute("id")===M){const z=C.getElementsByTagName("barline"),R=($=z[z.length-1])==null?void 0:$.parentElement;if(((N=R==null?void 0:R.lastElementChild)==null?void 0:N.tagName)!=="barline"){const H=(R==null?void 0:R.children)||[];for(let O of H)if(O.tagName==="barline"){R==null||R.appendChild(O);break}}}}),Array.from(s).forEach(C=>{var I;C&&C.getAttribute("id")!==M&&((I=C.parentNode)==null||I.removeChild(C))})}return new XMLSerializer().serializeToString(appoggianceFormate(r))},appoggianceFormate=t=>{var r,s,o,a;if(!t)return t;const e=t.querySelectorAll("grace");if(!e.length)return t;const i=l=>l.querySelector("grace")?i(l==null?void 0:l.nextElementSibling):l;for(let l of e){const c=(r=l.parentElement)==null?void 0:r.querySelector("notations");if(c&&c.querySelectorAll("slur").length>1){let u=i((s=l.parentElement)==null?void 0:s.nextElementSibling);if(u&&u.querySelectorAll("slur").length>0){const m=Array.from(((o=u.querySelector("notations"))==null?void 0:o.children)||[]).map(g=>g.getAttribute("number")),d=c.querySelectorAll("slur");for(let g of d)m.includes(g.getAttribute("number"))||(a=u.querySelector("notations"))==null||a.appendChild(g)}}}return t},formatXML=t=>{var l,c,u;if(!t)return"";const e=new DOMParser().parseFromString(t,"text/xml"),i=Array.from(e.getElementsByTagName("measure")),r=Array.from(e.querySelectorAll("repeat"));compatibleXmlPitchVoice(e),parseXmlToRepeat(r);let s=-1,o=-1,a=-1;for(const m of i){o===-1&&m.getElementsByTagName("beats").length&&(o=parseInt(m.getElementsByTagName("beats")[0].textContent||"4")),a===-1&&m.getElementsByTagName("beat-type").length&&(a=parseInt(m.getElementsByTagName("beat-type")[0].textContent||"4")),s===-1&&m.getElementsByTagName("per-minute").length&&(s=Number((l=m.getElementsByTagName("per-minute")[0])==null?void 0:l.textContent));const d=parseInt(((c=m.getElementsByTagName("divisions")[0])==null?void 0:c.textContent)||"256");if(m.getElementsByTagName("note").length===0){const g=(u=m.getElementsByTagName("forward")[0])==null?void 0:u.getElementsByTagName("duration")[0];g&&(g.textContent="0"),m.innerHTML=m.innerHTML+` ${d*o} 1 whole `}}return state$1.originSpeed||(state$1.originSpeed=state$1.speed=s||100),new XMLSerializer().serializeToString(e)},formateTimes=t=>{var R,H,O,V,k,F,Z,U,J,de,ne,te,ce,pe,ue,be,Ee,Se,q,ie,B,re,ee,W,Q,K,le,oe,ae,he,me,ye;const e=customData.customNoteRealValue,i=customData.customNoteCurrentTime;state$1.examSongId+"",state$1.partIndex+"";let r=browserInfo.huawei?.08:0;const s=[],o=[],a=[],{originSpeed:l}=state$1,c=(fe,xe)=>{var Te,Me,Pe,Re,Le,Be;return["906"].includes(state$1.cbsExamSongId)?((Te=xe.measures[0])==null?void 0:Te.realKey)||fe:["782","784"].includes(state$1.cbsExamSongId)&&[14,16,30,32].includes((Me=xe.firstVerticalMeasure)==null?void 0:Me.measureNumber)?((Pe=s[s.length-1])==null?void 0:Pe.realKey)||fe:["900","901","640","641","739","740","800","801","773","774","869","872","714","715"].includes(state$1.cbsExamSongId)&&(((Re=xe.firstVerticalMeasure)==null?void 0:Re.measureNumber)===3||((Le=xe.firstVerticalMeasure)==null?void 0:Le.measureNumber)===9)&&((Be=xe.measures[0])==null?void 0:Be.realKey)||fe};if(!t.cursor)return[];const u=t.cursor.Iterator;console.time("音符跑完时间");let m=0,d=0,g=[],y=[],b=0,S=0,E=0,x="quarter",A,_,P=0,T=0,M=0;const C=[];state$1.gradualTimes&&console.log("后台设置的渐慢小节时间",state$1.gradual,state$1.gradualTimes);let I=u.currentTimeStamp.RealValue;const D=[];let G=!1,$=0;for(;!u.EndReached;){const fe=(R=u.CurrentVoiceEntries)!=null&&R[0]?[(H=u.CurrentVoiceEntries)==null?void 0:H[0]]:[];let xe=[];state$1.multitrack>0?xe=[...u.CurrentVoiceEntries]:xe=[...u.CurrentVoiceEntries].filter(Te=>{var Me;return Te&&((Me=Te==null?void 0:Te.ParentVoice)==null?void 0:Me.VoiceId)!=1});let ge=0,we=!1,Ce=!1;if(xe.length&&!G){we=!0;let Te=[...u.CurrentVoiceEntries].reduce((Me,Pe)=>(Me.push(...Pe.Notes),Me),[]);if(Te=Te.sort((Me,Pe)=>{var Re,Le;return((Re=Me==null?void 0:Me.length)==null?void 0:Re.realValue)-((Le=Pe==null?void 0:Pe.length)==null?void 0:Le.realValue)}),ge=((V=(O=Te==null?void 0:Te[0])==null?void 0:O.length)==null?void 0:V.realValue)||0,state$1.multitrack>0&&xe.length===2){const Me=((F=(k=Te[0])==null?void 0:k.length)==null?void 0:F.realValue)||0;$=(((U=(Z=Te[Te.length-1])==null?void 0:Z.length)==null?void 0:U.realValue)||0)-Me,G=$!==0}}(J=C[C.length-1])!=null&&J.isDouble&&!xe.length&&(Ce=!0),state$1.multitrack>0&&!we&&G&&(we=!0,ge=$,G=!1,$=0),D.push(u.currentTimeStamp.realValue-I),I=u.currentTimeStamp.realValue;for(const Te of fe){let Me=Te.notes[0];if(Me.IsGraceNote&&(Me=Me.parentStaffEntry.voiceEntries.find(Re=>!Re.isGrace).notes[0]),Me.fixedKey=Me.ParentVoiceEntry.ParentVoice.Parent.SubInstruments[0].fixedKey||0,(de=Me==null?void 0:Me.voiceEntry)!=null&&de.isGrace){we=!0;let Pe=[...u.currentVoiceEntries].reduce((Re,Le)=>(Re.push(...Le.notes),Re),[]);Pe=Pe.sort((Re,Le)=>{var Be,We;return((Be=Le==null?void 0:Le.length)==null?void 0:Be.realValue)-((We=Re==null?void 0:Re.length)==null?void 0:We.realValue)}),ge=ge!=0?Math.min((te=(ne=Pe==null?void 0:Pe[0])==null?void 0:ne.length)==null?void 0:te.realValue,ge):(pe=(ce=Pe==null?void 0:Pe[0])==null?void 0:ce.length)==null?void 0:pe.realValue}state$1.multitrack>0&&ge>Me.length.realValue&&(ge=Me.length.realValue),C.push({note:Me,iterator:{...u},currentTime:ge,isDouble:we,isMutileSubject:Ce,measuresTempoInBPM:(ue=Me==null?void 0:Me.sourceMeasure)==null?void 0:ue.tempoInBPM})}u.moveToNextVisibleVoiceEntry(!1)}const N=C.some(fe=>fe.measuresTempoInBPM!==C[0].measuresTempoInBPM);console.log("变速曲子",N);for(let{note:fe,iterator:xe,currentTime:ge,isDouble:we,isMutileSubject:Ce}of C){if(fe){if(d===0&&a.push(fe.sourceMeasure),d===0&&state$1.isSpecialBookCategory)for(const Ve of(be=fe.sourceMeasure)==null?void 0:be.TempoExpressions)(Ee=Ve==null?void 0:Ve.InstantaneousTempo)!=null&&Ee.beatUnit&&(x=Ve.InstantaneousTempo.beatUnit);let Te=fe.sourceMeasure.tempoInBPM;const{metronomeNoteIndex:Me}=xe.currentMeasure;Me!==0&&Me>d&&(Te=((Se=s[s.length-1])==null?void 0:Se.speed)||100);const Pe=[(q=fe.sourceMeasure.verticalMeasureList)==null?void 0:q[0]],{realValue:Re}=xe.currentTimeStamp,{RealValue:Le,Denominator:Be}=formatDuration(xe.currentMeasure.activeTimeSignature,xe.currentMeasure.duration);let{wholeValue:We,numerator:bt,denominator:Et,realValue:Ye}=fe.length;e[m]&&(Ye=e[m]),we&&ge>0&&ge!=Ye&&(console.log(`小节 ${fe.sourceMeasure.MeasureNumberXML} 替换: noteLength: ${Ye}, 最小: ${ge}`),Ye=ge),i&&Ce&&D[m+1]>0&&Ye>D[m+1]&&(console.log(Ye,D[m+1]),Ye=D[m+1]);let at=S,$e=0;Te!==l&&!N?$e=l||Te||100:$e=(state$1.isSpecialBookCategory?Te:l)||1,m===0&&(r+=getFixTime($e),state$1.fixtime=r);let tt=0,it=(state$1.isSpecialBookCategory?Te:l)||1;_=xe.currentMeasure.speedInfo||_,A=((ie=t.Sheet.SoundTempos)==null?void 0:ie.get(fe.sourceMeasure.measureListIndex))||A,(!A||A.length<2)&&(A=createSpeedInfo(_,it));const qe=xe.currentMeasure.measureListIndex;if(state$1.gradualTimes&&Object.keys(state$1.gradualTimes).length>0){const Ve=state$1.gradual.find((Oe,Qe)=>{var nt;const Ke=state$1.gradual[Qe+1];return Oe[0].measureIndex<=qe&&((nt=Oe[1])==null?void 0:nt.measureIndex)>=qe&&(!Ke||(Ke==null?void 0:Ke[0].measureIndex)!==qe)}),[Ue,Ge]=Ve||[];if(Ue&&Ge){const Oe=Ge.measureIndex-Ue.measureIndex,Qe=Ue.closedMeasureIndex==qe&&d>=Ue.noteInMeasureIndex,Ke=Ge.closedMeasureIndex===qe&&d0)){const Ve=A[0]-(A[1]-A[0]),{resetXmlNoteIndex:Ue,endXmlNoteIndex:Ge}=_,Oe=Ge;let Qe=(A[A.length-1]-Ve)/Oe;if(Qe=fe.DotsXml?Qe/1.5:Qe,PP&&(it=(B=s[m-1])==null?void 0:B.speed);$e=(state$1.isSpecialBookCategory?getTimeByBeatUnit(x,it,xe.currentMeasure.activeTimeSignature.Denominator):l)||1;const Ke=!(PP);P++,Ke&&(P=0,_=void 0,A=void 0,y=[])}const Tt=Ye;let vt=tt||Math.min(Le,Ye)*formatBeatUnit(x)*(60/$e);const At=Le*Be*(60/$e);S+=vt,E+=vt;let pt=vt+at;const Mt=fe.fixedKey||0,wt=(ee=(re=Pe[0])==null?void 0:re.vfVoices["1"])==null?void 0:ee.tickables[d];if(s.length&&s[s.length-1].relativeTime===at)continue;if(m===0&&!state$1.isAppPlay){let Ve=0;(((Q=(W=fe.sourceMeasure.verticalMeasureList)==null?void 0:W[0])==null?void 0:Q.staffEntries)||[]).forEach(Ge=>{var Oe,Qe,Ke,nt,st,lt;(lt=(st=(nt=(Ke=(Qe=(Oe=Ge==null?void 0:Ge.sourceStaffEntry)==null?void 0:Oe.voiceEntries)==null?void 0:Qe[0])==null?void 0:Ke.notes)==null?void 0:nt[0])==null?void 0:st.length)!=null&<.realValue&&(Ve+=Ge.sourceStaffEntry.voiceEntries[0].notes[0].length.realValue)}),Ve0&&(r+=b)}let Gt=(K=Pe[0])==null?void 0:K.stave;fe.sourceMeasure.multipleRestMeasures&&(T=fe.sourceMeasure.multipleRestMeasures,M=0),Mfe.relativeTime-xe.relativeTime).map((fe,xe)=>({...fe,i:xe}));console.timeEnd("音符跑完时间");try{t.cursor.reset()}catch(fe){}return state$1.activeMeasureIndex=z[0].MeasureNumberXML,z},getNoteByMeasuresSlursStart=t=>{let e=t,i;if(t.noteElement.tie&&t.noteElement.tie.StartNote&&(i=t.noteElement.tie.StartNote),e&&i&&i!==e.noteElement){const r=[];for(const s of state$1.times)i===s.noteElement&&r.push(s);if(r.length)return r.find(s=>s.i===t.i-1)||r[0]}return e},parseXmlToRepeat=t=>{if(!t.length)return;let e=[],i=0,r=0;for(let s=0;s{let i=-1;if(state$1.repeatInfo.length){for(let r=state$1.repeatInfo.length-1;r>=0;r--){const{start:s,end:o}=state$1.repeatInfo[r];if(t<=s&&e>=o)return i=r,{repeatIdx:i,canRepeat:!0}}return{repeatIdx:i,canRepeat:!1}}else return{repeatIdx:i,canRepeat:!1}},compatibleXmlPitchVoice=t=>{var r,s,o;if(Array.from(t.getElementsByTagName("part-name")).map(a=>{var l,c;return((c=(l=a[0])==null?void 0:l.textContent)==null?void 0:c.trim().toLocaleUpperCase)!=="COMMON"}).length==1){const l=((o=(s=(r=(Array.from(t.getElementsByTagName("instrument-name"))||[])[0])==null?void 0:r.textContent)==null?void 0:s.trim())==null?void 0:o.toLocaleLowerCase())||"";let c=!1;switch(state$1.musicalCodeId){case 37:case 38:c=!!(!l||l.includes("solo")||l.includes("tenor recorder"));break;case 33:c=!!(!l||l.includes("solo")||l.includes("panpipes"));break;case 34:c=!!(!l||l.includes("solo")||l.includes("ocarina"));break;default:c=!!(!l||l.includes("solo"));break}window.xmlNeedAdjustVoice=c}},selectionContainer="_selectionContainer_1ofh0_1",position="_position_1ofh0_8",note="_note_1ofh0_11",staveBox="_staveBox_1ofh0_14",leftStaveBox="_leftStaveBox_1ofh0_17",rightStaveBox="_rightStaveBox_1ofh0_31",centerStaveBox="_centerStaveBox_1ofh0_45",prepareStaveBox="_prepareStaveBox_1ofh0_70",disable="_disable_1ofh0_73",line="_line_1ofh0_76",eyeLine="_eyeLine_1ofh0_88",lineStaff="_lineStaff_1ofh0_91",lineJianPu="_lineJianPu_1ofh0_94",scoreItem="_scoreItem_1ofh0_100",dotWrap="_dotWrap_1ofh0_137",noteFollow="_noteFollow_1ofh0_152",linePC="_linePC_1ofh0_188",noteDot="_noteDot_1ofh0_192",styles$2={selectionContainer,position,note,staveBox,leftStaveBox,rightStaveBox,centerStaveBox,prepareStaveBox,disable,line,eyeLine,lineStaff,lineJianPu,scoreItem,dotWrap,noteFollow,linePC,noteDot},noteMove="_noteMove_6dz5a_1",activeModel="_activeModel_6dz5a_14",toolBox="_toolBox_6dz5a_17",moveDisabled="_moveDisabled_6dz5a_33",hideTool="_hideTool_6dz5a_36",rightHideIcon$1="_rightHideIcon_6dz5a_39",styles$1={noteMove,activeModel,toolBox,moveDisabled,hideTool,rightHideIcon:rightHideIcon$1},tooltip="",TooltipSfc="",buttonGroup="",ButtonGroupSfc="",rightHideIcon="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAB4CAYAAACjK+FPAAAAAXNSR0IArs4c6QAAA9hJREFUeF7tnctrE1EUxr+J7wfqRsdCA2okIhMfNCXZVKyKWOzSZVbdCS5KcetON6J/RKEQBKFLwVWpUgvddNFVNkWbGrptSCsVm8otmTDpTDptb+49cx8Xumrn3PM735m5Z5r2HAf86zyAqwAuAjgF4HTr6xi/6Z5Z+Occ0dQZANdbgOeOaEPmZYcGPQHgJoAbAFIyPeXc61CgaQAeAAar2joQKEvv2wAyqtEF/I0FPQ4gD+CKwpDM9X1BmZJFAJcVh4wFZfcje+josLoqyh4893UgbDFEgp4E8AQAuz91WZGgOqWsL1QI9CyAxwCOWjElNQNCoHcAXEuqtxx+hUCftgpyDpuJvLQD9BKAB4l0k9+pDtBbALL8NhNpoQOUVUGql3rdotwB+hDAhUTqwe9UB+gzAKxY0HG1QdlL9KiOhHtLQPYyPWJB1Y9AO3WtouqLuUtgFdVEyDaGVdQqqmgEbOoqKlxXt62iVlFFI2BTV1Hh7MPIpq5NXUUjYFNXUeHsU9emLmnqzszMvCgUCqOO4zgLCwtfhoeHP3M6lDxFl5aWXuZyuecBsJ3Jycn3Y2NjPzhgkwUaAbnLtry8/D2TyXzQArQbJIObm5srDw0NfVIedD/IRqPx23XdV5ubm02lQWMga4ODgxOVSuUPByT9b+olQdKCSoSkA5UMSQNKACkflAhSLighpDxQYkg5oCsrK2/S6XQh6hxsNBq9OifjjlmxtW61Wn3T399PDSle0e3t7elUKhX6S+6NjY1aPp/vRcUTp6T/fbGKNpvNacdxQqD1er3qed7E6urq34N6yvlzYkFrtdrbvr6+e1FO1uv1X57nvZYEKxaUAa6trb1zXfcuMax4UAZYqVTGs9ks+8+L0JKkrBzQBMDKAyWGlQtKCCsflAiWBpQAlg5UMiwtqERYetA42PX19Z+u645vbW3tcJSByQCNg52dnZ3i/PwlOaD7wWr1kYSfllHlYrlc/lgqlb5pkbpBiPn5+dLAwMAI+9hwcXHxa7FYnOKAFP/izelcLy9P1j3aS7I9tiyowOCSmLaKkoRd4KZWUYHBJTFtFSUJu8BNraICg0ti2ipKEnaBm1pFBQaXxLRVlCTsAje1igoMLolpqyhJ2AVuahUVGFwS021FjWncxMJsRCsuBmpMczVj2uUZ0wDRmJaW7D41okkpA821JgqQHHYCN22fo/4erJHwI8WmChwkPiFQdpERraEZqDHNvhmsEe3b/ZzXKYUj71Ef1JgRCwzYiKEZQWW1H4MSPKO0H2wThDViVFEQWPvhU1HlVnCcGBsl5o8US9Q4sf9BGvvA8pV1NwAAAABJRU5ErkJggg==";let extStyleConfigJson={};window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;const showToolBox=ref(!0),moveData=reactive({open:!1,zoom:state$1.zoom,partIndex:"0",hasExtJson:!1,isWeb:!1,modelList:[],activeIndex:-1,sw:0,tool:{isAddAndSub:!1},noteCoords:[]}),initNoteCoord=()=>{const t=Array.from(document.querySelectorAll(".node-dot"));moveData.noteCoords=t.map(e=>{var r;const i=((r=e==null?void 0:e.getBoundingClientRect)==null?void 0:r.call(e))||{x:0,y:0};return{x:i.x,y:i.y}})},computedDistance=(t,e)=>{let i=-1,r=0,s,o,a;return moveData.noteCoords.forEach((l,c)=>{s=Math.abs(l.x-t),o=Math.abs(l.y-e),a=Math.sqrt(s*s+o*o),a=Number(a.toFixed(0)),a!==0&&(i===-1||a{setEleId(d,"temp"+a),a++});let l=1;[...i].forEach(d=>{setEleId(d,"text"+l),l++});let c=1;[...r].forEach(d=>{setEleId(d,"section"+c),c++});let u=1;[...s].forEach(d=>{setEleId(d,"repet"+u),u++});let m=1;[...o].forEach(d=>{setEleId(d,"line"+m),m++})}function setEleId(t,e){if(!t||!e)return;t.getAttribute("id")||t.setAttribute("id",e),createModelBox(t)}function createModelBox(t){var l;const e=((l=document.getElementById("musicAndSelection"))==null?void 0:l.getBoundingClientRect())||{x:0,y:0},i=e.x||0,r=e.y||0,s=t.getBoundingClientRect(),o={left:s.x-i+"px",top:s.y-r+"px",width:s.width+"px",height:s.height+"px"},a=t.getAttribute("class");moveData.modelList.push({id:t.getAttribute("id"),bbox:o,type:a,isMove:!1,left:s.left,top:s.top,width:s.width,height:s.height,x:0,y:0,zoom:state$1.zoom,isDelete:!1,d2:getLineGroupPathDx(t),dx:0})}function getBox(t){var o;if(!t)return{};const e=((o=document.getElementById("musicAndSelection"))==null?void 0:o.getBoundingClientRect())||{x:0,y:0},i=e.x||0,r=e.y||0,s=t.getBoundingClientRect();return{left:s.x-i,top:s.y-r,width:s.width,height:s.height}}const filterMoveData=async()=>{const t=state$1.examSongId;if(t){const e=window.fontSize,i=moveData.modelList.filter(s=>s.isMove).map(s=>{var d,g,y,b;const o=s.left+s.x,a=s.top+s.y,l=computedDistance(o,a),c=o-((d=moveData.noteCoords[l])==null?void 0:d.x),u=a-((g=moveData.noteCoords[l])==null?void 0:g.y);let m={id:s.id,isMove:s.isMove,isDelete:s.isDelete,x:s.x,y:s.y,xRem:Math.abs(s.x/e),yRem:Math.abs(s.y/e),zoom:s.zoom,w:moveData.sw,type:s.type,noteIdx:l,noteRelativeX:c,noteRelativeY:u};if(s.type==="vf-lineGroup"&&(m.dx=s.dx),s.id.includes("text")){const S=((b=(y=document.querySelector("#"+s.id))==null?void 0:y.querySelector("text"))==null?void 0:b.innerHTML)||"";m.textContent=S}return m});extStyleConfigJson[moveData.partIndex]=i,console.log("🚀 ~ extStyleConfigJson",extStyleConfigJson);const r=await request.post("/musicSheet/img",{requestType:"json",data:{id:t,extStyleConfigJson:JSON.stringify(extStyleConfigJson)}});r&&r.code==200&&showToast("保存成功"),clearActiveModel()}},dragData={open:!1,startX:0,startY:0,x:0,y:0,repeatEdit:!1},undoData=reactive({undoList:[],redoList:[],activeItem:null});function onDown(t){const e=t.target,i=moveData.modelList.findIndex(r=>r.id===e.dataset.id);if(i>-1){const r=moveData.modelList[i];moveData.activeIndex=i,dragData.startX=t.clientX,dragData.startY=t.clientY,dragData.x=r.x,dragData.y=r.y,dragData.repeatEdit=r.noteIdx>=0,document.onmousemove=onMove,document.onmouseup=onUp,dragData.open=!0,r.type==="vf-lineGroup"?moveData.tool.isAddAndSub=!0:moveData.tool.isAddAndSub=!1,undoData.activeItem={...r};return}moveData.activeIndex=-1}function onMove(t){if(dragData.open){const e=t.clientX-dragData.startX+dragData.x,i=t.clientY-dragData.startY+dragData.y;setModelPostion(moveData.modelList[moveData.activeIndex],e,i,dragData.repeatEdit)}}function onUp(t){document.onmousemove=null,document.onmouseup=null,dragData.open=!1;const e=t.clientX-dragData.startX+dragData.x,i=t.clientY-dragData.startY+dragData.y;(e||i)&&(moveData.modelList[moveData.activeIndex].isMove=!0,moveData.modelList[moveData.activeIndex].x=e,moveData.modelList[moveData.activeIndex].y=i,undoData.activeItem&&undoData.undoList.push({...undoData.activeItem})),undoData.activeItem=null}const renderSvgItem=t=>{if(setModelPostion(t,t.x,t.y),t.isDelete){const e=document.querySelector("#"+t.id);e&&(e.style.display="none")}else{const e=document.querySelector("#"+t.id);e&&(e.style.display="")}};async function setModelPostion(t,e,i,r){var s;if(t){const o=document.querySelector("#"+t.id),a=document.querySelector(`[data-id=${t.id}]`);if(e===0&&i===0)o&&o.removeAttribute("transform"),a&&(a.style.transform="");else{let l=e,c=i;if(t.noteIdx>=0&&!r){moveData.noteCoords.length||await initNoteCoord();const u=moveData.noteCoords[t.noteIdx].x+t.noteRelativeX,m=moveData.noteCoords[t.noteIdx].y+t.noteRelativeY,d=((s=document.getElementById(t.id))==null?void 0:s.getBoundingClientRect())||{x:0,y:0};l=u-d.x,c=m-d.y,o&&o.setAttribute("transform",`translate(${l/moveData.zoom}, ${c/moveData.zoom})`),a&&(a.style.transform=`translate(${l}px, ${c}px)`)}else o&&o.setAttribute("transform",`translate(${l/moveData.zoom}, ${c/moveData.zoom})`),a&&(a.style.transform=`translate(${l}px, ${c}px)`)}}}const handleDeleteMoveNote=()=>{const t=moveData.modelList[moveData.activeIndex];if(t){moveData.modelList[moveData.activeIndex].isMove=!0,undoData.undoList.push({...moveData.modelList[moveData.activeIndex]}),moveData.modelList[moveData.activeIndex].isDelete=!t.isDelete;const e=document.querySelector("#"+t.id);e&&(e.style.display=moveData.modelList[moveData.activeIndex].isDelete?"none":"")}else showToast("选中需要删除的元素")},resetMoveNote=()=>{for(let t=0;t{if(!["add","sub"].includes(t))return;const e=moveData.modelList[moveData.activeIndex];if(!e||e.type!=="vf-lineGroup")return;e.isMove=!0;const i=t==="add"?10:-10;undoData.undoList.push({...moveData.modelList[moveData.activeIndex]}),moveData.modelList[moveData.activeIndex].dx=e.dx+i,renderLineGroup(moveData.modelList[moveData.activeIndex])};function getLineGroupPathDx(t){var i,r,s,o;if(!t)return 0;const e=t.querySelectorAll("path");if(e!=null&&e.length)for(let a=0;a{const t=undoData.undoList.pop();if(t){const e=moveData.modelList.findIndex(i=>i.id===t.id);e>-1&&(moveData.modelList[e]=t,renderSvgItem(moveData.modelList[e]),t.type==="vf-lineGroup"&&renderLineGroup(t))}},renderForMoveData=()=>{if(state$1.extStyleConfigJson)try{extStyleConfigJson=JSON.parse(state$1.extStyleConfigJson)}catch(e){extStyleConfigJson={}}if(!extStyleConfigJson||!(extStyleConfigJson!=null&&extStyleConfigJson[moveData.partIndex])){initSvgId();return}else initSvgId();const t=extStyleConfigJson==null?void 0:extStyleConfigJson[moveData.partIndex];t&&Array.isArray(t)&&nextTick(()=>{console.log("🚀 ~ list",t),t.forEach(e=>{var r,s,o,a,l,c,u;let i=moveData.modelList.findIndex(m=>m.id===e.id);if(e.type==="vf-text"&&e.textContent){let m=((o=(s=document.querySelector("#"+((r=moveData.modelList[i])==null?void 0:r.id)))==null?void 0:s.querySelector("text"))==null?void 0:o.innerHTML)||"",d=i,g=!1,y=i,b=i;if(m!==e.textContent)for(;!g;){let S=moveData.modelList[y]&&((l=(a=document.querySelector("#"+moveData.modelList[y].id))==null?void 0:a.querySelector("text"))==null?void 0:l.innerHTML)||"",E=moveData.modelList[b]&&((u=(c=document.querySelector("#"+moveData.modelList[b].id))==null?void 0:c.querySelector("text"))==null?void 0:u.innerHTML)||"";S===e.textContent||E===e.textContent?(g=!0,d=S===e.textContent?y:b):(!S&&!E&&(g=!0,d=-1),y=y-1,b=b+1)}i=d,e.id=`text${d+1}`}i>-1&&(moveData.modelList[i]={...moveData.modelList[i],...e},renderSvgItem(moveData.modelList[i]),e.type==="vf-lineGroup"&&renderLineGroup(moveData.modelList[i]))})})},MoveMusicScore=defineComponent({name:"move-music-score",setup(){const e=getQuery().isMove==="1";return console.log("🚀 ~ isOpen:",e),onMounted(()=>{nextTick(()=>initNoteCoord());const i=document.getElementById("toolBox");i&&document.body.appendChild(i)}),()=>createVNode("div",{class:[moveData.open?"":styles$1.moveDisabled]},[createVNode("div",{id:"toolBox"},[createVNode("div",{class:[styles$1.toolBox,!showToolBox.value&&styles$1.hideTool]},[createVNode(Switch,{modelValue:moveData.open,"onUpdate:modelValue":i=>moveData.open=i},null),moveData.open&&createVNode(Fragment,null,[moveData.tool.isAddAndSub&&createVNode(ButtonGroup,{size:"small",elevation:!1},{default:()=>[createVNode(Button,{onClick:()=>handleAddAndSub("add")},{default:()=>[createTextVNode("加")]}),createVNode(Button,{onClick:()=>handleAddAndSub("sub")},{default:()=>[createTextVNode("减")]})]}),createVNode(Button,{size:"small",onClick:handleUndo,disabled:!undoData.undoList.length},{default:()=>[createVNode(Icon,{name:"arrow-down",style:{transform:"rotate(90deg)"}},null)]}),createVNode(Button,{size:"small",onClick:handleDeleteMoveNote,disabled:!(moveData.activeIndex>-1)},{default:()=>{var i;return[(i=moveData.modelList[moveData.activeIndex])!=null&&i.isDelete?"显示元素":"删除元素"]}}),createVNode(Button,{size:"small",onClick:resetMoveNote},{default:()=>[createTextVNode("重置数据")]}),createVNode(Button,{size:"small",type:"primary",onClick:filterMoveData},{default:()=>[createTextVNode("保存数据")]}),createVNode(Button,{size:"small",type:"primary",onClick:()=>showToolBox.value=!1},{default:()=>[createTextVNode("收起")]})])]),!showToolBox.value&&createVNode("img",{class:[styles$1.rightHideIcon,showToolBox.value?"":styles$1.rightIconShow],src:rightHideIcon,onClick:()=>showToolBox.value=!0},null)]),moveData.modelList.map((i,r)=>createVNode("div",{class:[styles$1.noteMove,moveData.activeIndex===r&&styles$1.activeModel],style:i.bbox,"data-id":i.id,onMousedown:onDown},null))])}}),selectData=reactive({notes:[],staves:[],measureHeight:0}),calcNoteData=()=>{var a,l,c,u,m,d,g,y,b,S,E,x,A;const t=((a=document.getElementById("musicAndSelection"))==null?void 0:a.getBoundingClientRect())||{x:0,y:0},e=t.x||0,i=t.y||0,r=state$1.times,s=[],o=[];for(let _=0;_{var G;(G=D==null?void 0:D.style)==null||G.setProperty("display","none")})}catch(D){}const I=((A=M==null?void 0:M.getBoundingClientRect)==null?void 0:A.call(M))||{x:0,width:0,y:0,height:0};try{C.length&&C.forEach(D=>{var G;(G=D==null?void 0:D.style)==null||G.removeProperty("display")})}catch(D){}selectData.measureHeight=I.height,T.staveBox={left:I.x-e+"px",top:I.y-i+"px",width:I.width+"px",height:I.height+"px"},selectData.staves.push(T)}o.push(P.MeasureNumberXML)}else if(P.multipleRestMeasures){const M=selectData.staves.find(C=>C.MeasureNumberXML===P.MeasureNumberXML-1);M!=null&&M.staveBox&&(T.staveBox={left:M.staveBox.left,top:M.staveBox.top,width:M.staveBox.width},selectData.staves.push(T),o.push(P.MeasureNumberXML))}}}console.log("🚀 ~ selectData.notes:",selectData.notes,selectData.staves)},Selection=defineComponent({name:"selection",setup(){const t=useRoute$1(),e={...getQuery(),...t.query},i=computed(()=>state$1.sectionStatus||state$1.modeType!=="practise"),r=computed(()=>s=>{var o;if(state$1.sectionStatus){if(state$1.section.length===1&&s.MeasureNumberXML==state$1.section[0].MeasureNumberXML)return styles$2.leftStaveBox;if(state$1.section.length===2){const a=state$1.userChooseEndIndex>state$1.section[1].MeasureNumberXML?state$1.userChooseEndIndex:state$1.section[1].MeasureNumberXML;if(state$1.sectionFirst&&s.MeasureNumberXML===state$1.sectionFirst.MeasureNumberXML)return styles$2.prepareStaveBox;if(s.MeasureNumberXML>=state$1.section[0].MeasureNumberXML&&s.MeasureNumberXML<=a)return s.MeasureNumberXML==state$1.section[0].MeasureNumberXML&&s.MeasureNumberXML==a?styles$2.centerStaveBox:s.MeasureNumberXML==state$1.section[0].MeasureNumberXML?styles$2.leftStaveBox:s.MeasureNumberXML==a?((o=s.staveBox)!=null&&o.height||(s.staveBox.height=selectData.measureHeight+"px"),styles$2.rightStaveBox):styles$2.staveBox}}else if(state$1.activeMeasureIndex==s.MeasureNumberXML&&!state$1.isReport)return styles$2.staveBox});return onMounted(()=>{calcNoteData();try{moveData.partIndex=e["part-index"]||"0",nextTick(()=>renderForMoveData())}catch(s){}}),()=>createVNode("div",{id:"selectionBox",class:styles$2.selectionContainer,onClick:s=>s.stopPropagation()},[selectData.staves.map(s=>{var l;const o=s.id&&evaluatingData.evaluatings[s.measureListIndex],a=!state$1.isReport&&!state$1.times[state$1.activeNoteIndex].multipleRestMeasures&&metronomeData.cursorMode===2&&s.MeasureNumberXML===((l=metronomeData.activeMetro)==null?void 0:l.measureNumberXML)&&state$1.times[state$1.activeNoteIndex].MeasureNumberXML===s.MeasureNumberXML;return createVNode(Fragment,null,[s.staveBox&&createVNode("div",{class:[styles$2.position,r.value(s),o?`scoreItemLeve${o.leve}`:"",state$1.platform===IPlatform.PC?styles$2.linePC:""],style:s.staveBox,onClick:()=>handleSelection(s)},[a&&createVNode("div",{class:[styles$2.line,state$1.setting.eyeProtection?styles$2.eyeLine:"",state$1.musicRenderType==EnumMusicRenderType.staff?styles$2.lineStaff:styles$2.lineJianPu],style:{left:metronomeData.activeMetro.left}},null),!state$1.isReport&&!!s.multipleRestMeasures&&state$1.activeMeasureIndex==s.MeasureNumberXML&&createVNode("div",{class:styles$2.dotWrap},[s.multipleRestMeasures]),createVNode(Transition,{name:"centerTop",onAfterEnter:()=>{o.show=!1}},{default:()=>{var c,u;return[(o==null?void 0:o.show)&&createVNode("div",{class:styles$2.scoreItem,style:{color:((c=leveByScoreMeasureIcons[o.leve])==null?void 0:c.color)||""}},[createVNode("img",{src:(u=leveByScoreMeasureIcons[o.leve])==null?void 0:u.icon},null),createVNode("span",null,[o.score])])]}})])])}),selectData.notes.map(s=>createVNode("div",{class:[styles$2.position,i.value&&styles$2.disable,styles$2.note,`noteIndex_${s.index}`],style:s.bbox,onClick:()=>skipNotePlay(s.index)},[createVNode("div",{class:styles$2.noteFollow,"data-vf":"vf"+s.id},[createVNode(Icon$1,{name:"success"},null),createVNode(Icon$1,{name:"cross"},null)]),createVNode("div",{class:[styles$2.noteDot,"node-dot"]},null)])),e.isMove=="1"&&createVNode(MoveMusicScore,null,null)])}}),inGradualRange="_inGradualRange_srp9d_25",styles={inGradualRange},query=getQuery(),container=ref(),resetGivenFormate=()=>{var i,r;const e={12200:[{parts:["0","1"],tieId:["1483"]},{parts:["2"],tieId:["1463"]},{parts:["10"],tieId:["1246"]},{parts:["11"],tieId:["2455"]},{parts:["13"],tieId:["1488","1688"]},{parts:["14","15"],tieId:["1272"]},{parts:["16"],tieId:["1264","1368"],staveSection:[{id:"section-0",y:-10}]}],12420:[{parts:["0"],tieId:["1298","1405","1998","2598","3229","2731","2617"]}],7729:[{parts:["3"],tieId:["1498","1660"]}],7439:[{parts:["23"],vfmodifiers:[{id:"modifiers-130",y:-18,isLast:!0}]}],12711:[{parts:["0"],voltas:-12},{parts:["4"],voltas:-8}],3581:[{parts:["0"],voltas:-8}],6244:[{parts:["15"],stavenote:[{id:"vf-auto1608",y:-15}]}],7473:[{parts:["0"],voltas:-8}]}[state$1.cbsExamSongId];if(e){const s=query["part-index"]||"0",o=e.find(a=>a.parts.includes(s));if(!o)return;if(o.tieId&&o.tieId.length)for(let a=0;a{l.classList.add(`section-${c}`)});for(let l=0;l{l.classList.add(`modifiers-${c}`)});for(let l=0;l{l.style.transform=`translateY(${o.voltas}px)`}),o.stavenote&&o.stavenote.length)for(let a=0;a{var r,s,o;if(container.value=document.getElementById("scrollContainer"),state$1.extStyleConfigJson||!container.value)return;const t=Array.from(container.value.querySelectorAll(".staffline")),e=4,i=28;for(let a=0,l=t.length;a .vf-voices")),b=Array.from(c.querySelectorAll(".vf-measure > .vf-beams")),S=Array.from(c.querySelectorAll(".vf-ties")),E=Array.from(c.querySelectorAll(".vf-line")),x=Array.from(c.querySelectorAll(".vf-measure > .vf-stave text"));Array.from(c.querySelectorAll(".vf-measure > .vf-stave rect[fill=none]"));const A=Array.from(c.querySelectorAll(".vf-measure .vf-staveSection")),P=((r=Array.from(c.querySelectorAll(".vf-measure > .vf-stave path"))[0])==null?void 0:r.getBBox().y)||0,T=["To Coda","D.S. al Coda","Coda"];x.filter(R=>T.includes(R.textContent||"")).forEach(R=>{b.forEach(H=>{var k;const O=collisionDetection(R,H),V=R==null?void 0:R.previousSibling;if(O.isCollision){const F=Number(R.getAttribute("y"))-(O.b1-O.t2)-e+"";R.setAttribute("y",F),V&&V.getAttribute("stroke-width")==="0.3"&&V.getAttribute("stroke")==="none"&&(((k=V.getAttribute("d"))==null?void 0:k.length)||0)>3e3&&(V.style.transform=`translateY(${-(O.b1-O.t2+e)}px)`)}}),y.forEach(H=>{var k;const O=collisionDetection(R,H),V=R==null?void 0:R.previousSibling;if(O.isCollision){const F=Number(R.getAttribute("y"))-(O.b1-O.t2)-e+"";R.setAttribute("y",F),V&&V.getAttribute("stroke-width")==="0.3"&&V.getAttribute("stroke")==="none"&&(((k=V.getAttribute("d"))==null?void 0:k.length)||0)>3e3&&(V.style.transform=`translateY(${-(O.b1-O.t2+e)}px)`)}})}),A.forEach(R=>{let H=0;[...g,...S,...y].forEach(O=>{const V=collisionDetection(R,O);V.isCollision&&(H=Math.min(H,V.t2-V.b1-e))}),R.style.transform=`translateY(${H}px)`});let M=Array.from(c.querySelectorAll(".vf-text > text")).filter(R=>R.getBBox().y text")).filter(R=>R.getBBox().y{const H=R.getBBox();H.y1&&I.forEach(R=>{R.setAttribute("y",C+"")}),M.forEach(R=>{[...g,...d,...E].forEach(H=>{let O=collisionDetection(R,H);if(O.isCollision&&O.b1{M.forEach(H=>{if(R.parentNode!==H.parentNode&&!["marcato","legato"].includes(R.textContent))if(["marcato","legato"].includes(H.textContent)){if(collisionDetection(R,H,30,30).isCollision){const V=R.getBBox();H.setAttribute("x",V.x+V.width+5+""),H.setAttribute("y",V.y+V.height-5+"")}}else{const O=collisionDetection(R,H);if(O.isCollision){const V=Number(R.getAttribute("y")),k=O.b2-O.t2<24?24:O.b2-O.t2;H.setAttribute("y",V-k-.5+"")}}})});const D=["C","G","D","A","E","B","F#","C#","G#","F","Bb","Eb","Ab","Db","Gb","Cb","Fb","D#","A#","E#"],G=["Bb","Eb","Ab","Db","Gb","Cb","Fb"],$=["F#","C#","G#","D#","A#","E#","B#"];M.forEach(R=>{const H=R.textContent;if(D.includes(H)){const O=Number(R.getAttribute("y")),V=P?P-i:O;R.setAttribute("y",V)}G.includes(H)&&(R.textContent=H.replace("b","♭")),$.includes(H)&&(R.textContent=H.replace("#","♯"))});const N=Array.from(c.querySelectorAll(".vf-text > text")).filter(R=>R.getBBox().y>m),z=Array.from(c.querySelectorAll(".vf-line")).filter(R=>R.getBBox().y>m);for(let R=0;R{[...d].forEach(H=>{let O=collisionDetection(R,H);O.isCollision&&R.setAttribute("y",O.b2+Math.abs(O.t1-Number(R.getAttribute("y")))+"")})}),z.forEach(R=>{var O;const H=[];if((O=R.nextElementSibling)!=null&&O.classList.contains("vf-line")&&N.forEach(V=>{let k=collisionDetection(R,V,20,20);k.isCollision&&H.push({text:V,result:k})}),H.length===1){const V=H[0].result,k=H[0].text;V.x2+V.w2V.x1+V.w1?Math.abs(V.y2-V.y1)>10&&k.setAttribute("y",V.y1+V.h2/2+""):Math.abs(V.x2-V.x1)10&&k.setAttribute("y",V.y1+V.h2/2+"")):(k.setAttribute("x",V.x1+V.w1+5+""),Math.abs(V.y2-V.y1)>10&&k.setAttribute("y",V.y1+V.h2/2+""))}else if(H.length===2){const V=H[0].result,k=H[0].text,F=H[1].result,Z=H[1].text;k.setAttribute("x",V.x1-V.w2-5+""),Math.abs(V.y2-V.y1)>10&&k.setAttribute("y",V.y1+V.h2/2+""),Z.setAttribute("x",F.x1+F.w1+5+""),Math.abs(F.y2-F.y1)>10&&Z.setAttribute("y",F.y1+F.h2/2+"")}}),N.forEach(R=>{N.forEach(H=>{if(R.parentNode!==H.parentNode&&!["marcato","legato","cresc.","Cantabile"].includes(R.textContent))if(["marcato","legato","cresc.","Cantabile"].includes(H.textContent)){if(collisionDetection(R,H,30,30).isCollision){const V=R.getBBox();H.setAttribute("x",V.x+V.width+5+""),H.setAttribute("y",V.y+V.height-5+"")}}else{const O=collisionDetection(R,H);O.isCollision&&H.setAttribute("y",O.y1+O.h1+O.h2+"")}})})}},collisionDetection=(t,e,i=0,r=0)=>{const s=t.getBBox(),o=e.getBBox();let a=s.y-r,l=s.x-i,c=s.x+s.width+i,u=s.y+s.height+r,m=o.y,d=o.x,g=o.x+o.width,y=o.y+o.height;return ug||a>y||c{const t=query["part-index"]||"0",i=[{id:"12644",part_index:"25",direction:1}].find(({id:_,part_index:P})=>_==state$1.cbsExamSongId&&P==t);setGlobalData("tieDirection",i?i.direction:void 0);const s=[{id:"3509",part_index:"16",direction:1}].find(({id:_,part_index:P})=>_==state$1.cbsExamSongId&&P==t);s&&setGlobalData("graceCustom",{direction:s.direction});const a=[{id:"3030",part_index:"17",line:4},{id:"12704",part_index:"23",line:3}].find(({id:_,part_index:P})=>_==state$1.cbsExamSongId&&P==t);a&&setGlobalData("customBassDrum",a.line);const c=[{id:"11654",part_index:"16",stemNotes:[{id:124,direction:0},{id:125,direction:0},{id:126,direction:0},{id:127,direction:0},{id:128,direction:0}]},{id:"3581",part_index:"4",stemNotes:[{id:380,direction:1}]},{id:"3470",part_index:"0",stemNotes:[{id:36,direction:1},{id:37,direction:1}]},{id:"3470",part_index:"11",stemNotes:[{id:33,direction:1},{id:56,direction:1}]},{id:"12644",part_index:"22",stemNotes:[{id:22,direction:1},{id:26,direction:1},{id:135,direction:1},{id:163,direction:1},{id:199,direction:1},{id:204,direction:1},{id:206,direction:1},{id:208,direction:1},{id:210,direction:1},{id:213,direction:1}]},{id:"12303",part_index:"18",stemNotes:[{id:1,direction:1},{id:4,direction:1},{id:6,direction:1},{id:9,direction:1},{id:12,direction:1},{id:14,direction:1}]},{id:"12669",part_index:"24",stemNotes:[{id:65,direction:1},{id:296,direction:1},{id:298,direction:1},{id:300,direction:1},{id:338,direction:1}]},{id:"12420",part_index:"21",stemNotes:[{id:614,direction:0},{id:617,direction:0},{id:619,direction:0},{id:621,direction:0}]},{id:"12711",part_index:"22",stemNotes:[]},{id:"12973",part_index:"21",stemNotes:[{id:619,direction:1},{id:622,direction:1},{id:745,direction:1}]}].find(({id:_,part_index:P})=>_==state$1.cbsExamSongId&&P==t);c&&setGlobalData("stemDirectionNote",c.stemNotes);const m=[{id:"12711",part_index:"4",vfcurve:[{MeasureNumberXML:25,index:1,bezierEndControlPt:{y:-2}},{MeasureNumberXML:33,index:1,bezierEndControlPt:{y:-2}}]},{id:"12059",part_index:"0",vfcurve:[{MeasureNumberXML:15,bezierEndControlPt:{y:2.8},bezierEndPt:{y:1.1}},{MeasureNumberXML:16,bezierEndControlPt:{y:-1}},{MeasureNumberXML:19,index:1,bezierEndControlPt:{y:2}},{MeasureNumberXML:20,bezierEndControlPt:{y:-1}},{MeasureNumberXML:42,index:1,bezierEndControlPt:{y:-1.5},bezierStartControlPt:{y:-1.5}},{MeasureNumberXML:46,index:3,bezierEndControlPt:{y:-1.5},bezierStartControlPt:{y:-1.5}}]},{id:"12668",part_index:"11",vfcurve:[{MeasureNumberXML:8,index:2,bezierEndControlPt:{y:-3},bezierStartControlPt:{y:-3},bezierEndPt:{y:-1}}]},{id:"11976",part_index:"0",vfcurve:[{MeasureNumberXML:14,index:4,bezierEndControlPt:{y:-3}},{MeasureNumberXML:14,index:1,bezierEndPt:{y:1.5},bezierEndControlPt:{y:1}}]}].find(({id:_,part_index:P})=>_==state$1.cbsExamSongId&&P==t);m&&setGlobalData("vfcurveItem",m.vfcurve),[{id:"12644",part_index:"25"}].find(({id:_,part_index:P})=>_==state$1.cbsExamSongId&&P==t)&&setGlobalData("customArtPosition",!0),[{id:"12645",part_index:"5"}].find(({id:_,part_index:P})=>_==state$1.cbsExamSongId&&P==t)&&setGlobalData("customTenutoItem",!0),[{id:"12711",part_index:"22"},{id:"12711",part_index:"25"}].find(({id:_,part_index:P})=>_==state$1.cbsExamSongId&&P==t)&&setGlobalData("customAccentItem",!0),[{id:"12711",part_index:"25"},{id:"7755",part_index:"10"},{id:"6226",part_index:"16"}].find(({id:_,part_index:P})=>_==state$1.cbsExamSongId&&P==t)&&setGlobalData("customLefthandpizzicatoItem",!0)},setCustomGradual=()=>{if(state$1.gradualTimes){const t=state$1.cbsExamSongId+"",e=state$1.partIndex+"";["12280"].includes(t)&&["24"].includes(e)&&(state$1.gradualTimes[8]="00:26:10",state$1.gradualTimes[66]="01:53:35",state$1.gradualTimes[90]="02:41:40")}},setCustomNoteRealValue=()=>{const t=state$1.cbsExamSongId+"",e=state$1.partIndex+"";["2670"].includes(t)&&(customData.customNoteRealValue={0:.03125}),["12673"].includes(t)&&["22"].includes(e)&&(customData.customNoteRealValue={208:.125}),["12667","12673"].includes(t)&&(customData.customNoteCurrentTime=!0)},musicRenderTypeKey="musicRenderType";let osmd=null;const musicData=reactive({showSelection:!1,isRenderLoading:!0,score:"",containerWidth:0}),resetMusicScore=()=>{var e;const t=((e=document.getElementById("musicAndSelection"))==null?void 0:e.offsetWidth)||625;state$1.musicZoom=t/musicData.containerWidth},resetRenderMusicScore=t=>{const e=queryString.parse(location.search),i=queryString.stringify({...e,_t:Date.now(),musicRenderType:t});location.search="?"+i},MusicScore=defineComponent({name:"music-score",emits:["rendered"],props:{showSelection:{type:Boolean,default:!0},renderTypeKey:{type:String,default:""},musicColor:{type:String,default:""}},setup(t,{emit:e}){const i=()=>{const l=sessionStorage.getItem(t.renderTypeKey||musicRenderTypeKey);l in EnumMusicRenderType&&(state$1.musicRenderType=l)},r=async()=>{const l=await fetch(state$1.xmlUrl).then(u=>u.text()),c=formatXML(l);musicData.score=state$1.isCombineRender?c:onlyVisible(c,state$1.partIndex),state$1.gradualTimes&&(state$1.gradual=getGradualLengthByXml(c))},s=async()=>{const l=document.getElementById("musicAndSelection");!l||!musicData.score||(setGlobalMusicSheet(),osmd=new OpenSheetMusicDisplay(l,{drawTitle:!1,drawSubtitle:!1,autoResize:!1,followCursor:!1,drawPartNames:!1,drawComposer:!1,defaultColorMusic:t.musicColor}),osmd.EngravingRules.PageRightMargin=2,osmd.EngravingRules.PageTopMargin=10,osmd.EngravingRules.PageTopMarginNarrow=3,osmd.EngravingRules.PageLeftMargin=2,osmd.EngravingRules.PageBottomMargin=2,osmd.EngravingRules.DYMusicScoreType=state$1.musicRenderType===EnumMusicRenderType.staff?"staff":"jianpu",state$1.musicRenderType===EnumMusicRenderType.fixedTone&&(window.sett={keySignature:!0}),osmd.EngravingRules.DYMusicScoreId=state$1.examSongId||"",await osmd.load(musicData.score),osmd.zoom=state$1.zoom,osmd.render(),e("rendered",osmd),resetFormate(),resetGivenFormate(),musicData.showSelection=!0)},o=()=>{var l;musicData.containerWidth=((l=document.getElementById("musicAndSelection"))==null?void 0:l.offsetWidth)||625};onMounted(async()=>{o(),i(),await r(),await s(),musicData.isRenderLoading=!1});const a=computed(()=>{var u;let l=!1;const c=((u=state$1.times[state$1.activeNoteIndex])==null?void 0:u.measureListIndex)||-1;for(const[m,d]of state$1.gradual)if(m&&d&&(l=m.measureIndex<=c&&ccreateVNode("div",{id:"musicAndSelection",style:{"--music-zoom":state$1.musicZoom},class:[a.value&&styles.inGradualRange,state$1.musicRenderType==EnumMusicRenderType.staff?"staff":"jianpuTone"]},[t.showSelection&&musicData.showSelection&&!state$1.isPreView&&!state$1.isEvaluatReport&&createVNode(Selection,null,null)])}}),Notfind=defineComponent({name:"notfund",render(){return createVNode(Empty,{image:"error",description:this.$route.path+" 路径不存在"},{default:()=>[createVNode(Button$1,{type:"primary",onClick:()=>this.$router.replace("/")},{default:()=>[createTextVNode("返回首页")]})]})}});export{closeToast as $,handleEndSoundCheck as A,handleViewReport as B,handleStartEvaluat as C,api_videoUpdate as D,api_proxyServiceMessage as E,Fragment as F,connectWebsocket as G,getNoteByMeasuresSlursStart as H,Icon$1 as I,useClickAway as J,Button$1 as K,handleSetSpeed as L,api_openCamera as M,NoticeBar as N,api_closeCamera as O,Popup as P,store_legacy as Q,RouterView as R,Snackbar$1 as S,TheError as T,toRefs as U,isVNode as V,api_cloudDestroy as W,postMessage as X,useRoute$1 as Y,showLoadingToast as Z,request$1$1 as _,setBehaviorId as a,debounce as a$,getBehaviorId as a0,getCampId as a1,onUnmounted as a2,handleChangeSection as a3,togglePlay as a4,metronomeData as a5,handleResetPlay as a6,Badge as a7,api_back as a8,useRouter as a9,Vue3Lottie as aA,api_savePicture as aB,musicRenderTypeKey as aC,resetRenderMusicScore as aD,handleRessetState as aE,toggleFollow as aF,getAudioCurrentTime as aG,handleFollowStart as aH,handleFollowEnd as aI,api_setEventTracking as aJ,Tick as aK,FollowPractice as aL,handleInitTick as aM,promisefiyPostMessage as aN,api_setCache as aO,getToken as aP,api_suspendPlay as aQ,followData as aR,hanldeDirectSelection as aS,api_openWebView as aT,musicscoresettingKey as aU,createNamespace$1 as aV,Comment as aW,Text as aX,withInstall as aY,api_getToken as aZ,studentQueryUserInfo as a_,getSecondRPM as aa,customData as ab,setGlobalData as ac,api_setStatusBarVisibility as ad,resetMusicScore as ae,onBeforeUnmount as af,Skeleton as ag,Transition as ah,MusicScore as ai,AudioList as aj,Evaluating as ak,isSpecialShapedScreen as al,mappingVoicePart as am,isRhythmicExercises as an,subjectFingering as ao,formateTimes as ap,Metronome as aq,getStorageSpeed as ar,nextTick as as,api_cloudLoading as at,addMeasureScore as au,createRouter as av,createWebHashHistory as aw,Notfind as ax,setStoreData as ay,createApp as az,setCampId as b,routeProps as b$,getAudioDuration as b0,api_musicPracticeRecordSave as b1,sendResult as b2,addCheckPlayEnd as b3,removeResult as b4,removeCheckPlayEnd as b5,api_toggleTune as b6,getEarphone as b7,startCheckDelay as b8,getSuggestionList as b9,clamp as bA,numericProp as bB,makeRequiredProp as bC,makeArrayProp as bD,useTouch as bE,useParent$1 as bF,useExpose as bG,watchEffect as bH,useEventListener$1 as bI,preventDefault as bJ,HAPTICS_FEEDBACK as bK,useChildren$1 as bL,pick$1 as bM,makeNumericProp as bN,truthProp as bO,makeStringProp as bP,unitToPx as bQ,isSameValue as bR,Loading$1 as bS,mergeProps as bT,BORDER_UNSET_TOP_BOTTOM as bU,useScrollParent as bV,onUpdated as bW,useRect as bX,isHidden as bY,addUnit as bZ,usePlaceholder as b_,sysSuggestionAdd as ba,api_goback as bb,usePageVisibility as bc,setSection as bd,api_lessonTrainingSubmitTraining as be,api_lessonTrainingTrainingStudentDetail as bf,IPlatform as bg,api_getDeviceDelay as bh,checkUseEarphone as bi,resetPlaybackToStart as bj,api_openAdjustRecording as bk,api_musicPracticeRecordVideoUpload as bl,api_musicSheetPage as bm,getFingeringConfig as bn,api_musicalInstrumentList as bo,howler as bp,api_keepScreenLongLight as bq,getMusicDetail as br,setCustomGradual as bs,setCustomNoteRealValue as bt,initMidi as bu,evaluatCreateMusicPlayer as bv,api_setRequestedOrientation as bw,__vitePreload as bx,isDef$1 as by,extend$2 as bz,onMounted as c,useRoute as c0,popupSharedProps as c1,unknownProp as c2,popupSharedPropKeys as c3,withKeys as c4,noop$1 as c5,isFunction$5 as c6,BORDER_LEFT as c7,BORDER_TOP as c8,callInterceptor as c9,isObject$4 as cA,isPromise as cB,FORM_KEY as cC,toArray as cD,formatNumber as cE,CUSTOM_FIELD_INJECTION_KEY as cF,resetScroll as cG,makeNumberProp as cH,cancelRaf as cI,getSizeStyle as cJ,BORDER_BOTTOM as cK,stopPropagation as cL,addNumber as cM,defineListenerProp as cN,useZIndex as cO,useTeleport as cP,useLock as cQ,useRouteListener as cR,Teleport as cS,call as cT,createNamespace as cU,commonjsGlobal as cV,EnumMusicRenderType as cW,api_musicPracticeRecordDetail as cX,inBrowser$2 as ca,mountComponent as cb,usePopupState as cc,useCustomFieldValue as cd,raf as ce,getScrollTop as cf,setScrollTop as cg,onBeforeUpdate as ch,onDeactivated as ci,onMountedOrActivated as cj,getZIndexStyle as ck,windowWidth as cl,windowHeight as cm,onActivated as cn,onPopupReopen as co,doubleRaf as cp,useId as cq,BORDER_TOP_BOTTOM as cr,setRootScrollTop as cs,getElementTop as ct,route as cu,inject as cv,provide as cw,withDirectives as cx,vShow as cy,getRootScrollTop as cz,defineComponent as d,computed as e,createVNode as f,getQuery as g,storeData as h,setUserInfo as i,getRandomKey as j,createTextVNode as k,ref as l,state$1 as m,reactive as n,onBeforeMount as o,evaluatingData as p,showToast as q,request as r,setToken as s,queryString as t,api_shareAchievements as u,browser as v,watch as w,handlePerformDetection as x,handleStartBegin as y,handleEndBegin as z};